From 988a6490a793b73ff23aa3baf87b337152178e4d Mon Sep 17 00:00:00 2001 From: Dave Kleikamp Date: Mon, 31 Oct 2005 16:53:04 -0600 Subject: JFS: set i_ctime & i_mtime on target directory when creating links jfs has never been setting i_ctime or i_mtime when creating either hard or symbolic links. I'm surprised nobody had noticed until now. Thanks to Chris Spiegel for reporting the problem. Signed-off-by: Dave Kleikamp --- fs/jfs/namei.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c index 1abe7343f920..4abbe8604302 100644 --- a/fs/jfs/namei.c +++ b/fs/jfs/namei.c @@ -827,6 +827,7 @@ static int jfs_link(struct dentry *old_dentry, /* update object inode */ ip->i_nlink++; /* for new link */ ip->i_ctime = CURRENT_TIME; + dir->i_ctime = dir->i_mtime = CURRENT_TIME; mark_inode_dirty(dir); atomic_inc(&ip->i_count); @@ -1024,6 +1025,8 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry, insert_inode_hash(ip); mark_inode_dirty(ip); + dip->i_ctime = dip->i_mtime = CURRENT_TIME; + mark_inode_dirty(dip); /* * commit update of parent directory and link object */ -- cgit v1.2.2 From 193515d51ccb363165d6b09e9ba5c21089e34bad Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Mon, 7 Nov 2005 00:59:37 -0500 Subject: [libata] eliminate use of drivers/scsi/scsi.h compatibility header/defines --- drivers/scsi/ahci.c | 4 ++-- drivers/scsi/ata_piix.c | 3 +-- drivers/scsi/libata-core.c | 2 +- drivers/scsi/libata-scsi.c | 2 +- drivers/scsi/pdc_adma.c | 3 +-- drivers/scsi/sata_mv.c | 4 ++-- drivers/scsi/sata_nv.c | 3 +-- drivers/scsi/sata_promise.c | 4 ++-- drivers/scsi/sata_qstor.c | 3 +-- drivers/scsi/sata_sil.c | 3 +-- drivers/scsi/sata_sil24.c | 4 ++-- drivers/scsi/sata_sis.c | 3 +-- drivers/scsi/sata_svw.c | 3 +-- drivers/scsi/sata_sx4.c | 4 ++-- drivers/scsi/sata_uli.c | 3 +-- drivers/scsi/sata_via.c | 3 +-- drivers/scsi/sata_vsc.c | 3 +-- include/linux/libata.h | 6 +++--- 18 files changed, 25 insertions(+), 35 deletions(-) diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c index 4612312c0c2d..10c470e7d316 100644 --- a/drivers/scsi/ahci.c +++ b/drivers/scsi/ahci.c @@ -42,8 +42,8 @@ #include #include #include -#include "scsi.h" #include +#include #include #include @@ -196,7 +196,7 @@ static u8 ahci_check_status(struct ata_port *ap); static inline int ahci_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc); static void ahci_remove_one (struct pci_dev *pdev); -static Scsi_Host_Template ahci_sht = { +static struct scsi_host_template ahci_sht = { .module = THIS_MODULE, .name = DRV_NAME, .ioctl = ata_scsi_ioctl, diff --git a/drivers/scsi/ata_piix.c b/drivers/scsi/ata_piix.c index 7f8aa1b552ce..a1bd8d95623c 100644 --- a/drivers/scsi/ata_piix.c +++ b/drivers/scsi/ata_piix.c @@ -46,7 +46,6 @@ #include #include #include -#include "scsi.h" #include #include @@ -128,7 +127,7 @@ static struct pci_driver piix_pci_driver = { .remove = ata_pci_remove_one, }; -static Scsi_Host_Template piix_sht = { +static struct scsi_host_template piix_sht = { .module = THIS_MODULE, .name = DRV_NAME, .ioctl = ata_scsi_ioctl, diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 1c1a7caf785e..98769a3d31ae 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c @@ -51,8 +51,8 @@ #include #include #include -#include "scsi.h" #include "scsi_priv.h" +#include #include #include #include diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c index eb604b0a8990..38a895ebe826 100644 --- a/drivers/scsi/libata-scsi.c +++ b/drivers/scsi/libata-scsi.c @@ -37,9 +37,9 @@ #include #include #include -#include "scsi.h" #include #include +#include #include #include #include diff --git a/drivers/scsi/pdc_adma.c b/drivers/scsi/pdc_adma.c index a50588c60fab..78b4ff117af6 100644 --- a/drivers/scsi/pdc_adma.c +++ b/drivers/scsi/pdc_adma.c @@ -41,7 +41,6 @@ #include #include #include -#include "scsi.h" #include #include #include @@ -139,7 +138,7 @@ static u8 adma_bmdma_status(struct ata_port *ap); static void adma_irq_clear(struct ata_port *ap); static void adma_eng_timeout(struct ata_port *ap); -static Scsi_Host_Template adma_ata_sht = { +static struct scsi_host_template adma_ata_sht = { .module = THIS_MODULE, .name = DRV_NAME, .ioctl = ata_scsi_ioctl, diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c index 0f469e3dabe2..93d55233af7b 100644 --- a/drivers/scsi/sata_mv.c +++ b/drivers/scsi/sata_mv.c @@ -30,8 +30,8 @@ #include #include #include -#include "scsi.h" #include +#include #include #include @@ -270,7 +270,7 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance, static void mv_eng_timeout(struct ata_port *ap); static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); -static Scsi_Host_Template mv_sht = { +static struct scsi_host_template mv_sht = { .module = THIS_MODULE, .name = DRV_NAME, .ioctl = ata_scsi_ioctl, diff --git a/drivers/scsi/sata_nv.c b/drivers/scsi/sata_nv.c index d573888eda76..37a4fae95ed4 100644 --- a/drivers/scsi/sata_nv.c +++ b/drivers/scsi/sata_nv.c @@ -62,7 +62,6 @@ #include #include #include -#include "scsi.h" #include #include @@ -219,7 +218,7 @@ static struct pci_driver nv_pci_driver = { .remove = ata_pci_remove_one, }; -static Scsi_Host_Template nv_sht = { +static struct scsi_host_template nv_sht = { .module = THIS_MODULE, .name = DRV_NAME, .ioctl = ata_scsi_ioctl, diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c index b41c977d6fab..9edc9d91efc3 100644 --- a/drivers/scsi/sata_promise.c +++ b/drivers/scsi/sata_promise.c @@ -39,8 +39,8 @@ #include #include #include -#include "scsi.h" #include +#include #include #include #include "sata_promise.h" @@ -94,7 +94,7 @@ static void pdc_irq_clear(struct ata_port *ap); static int pdc_qc_issue_prot(struct ata_queued_cmd *qc); -static Scsi_Host_Template pdc_ata_sht = { +static struct scsi_host_template pdc_ata_sht = { .module = THIS_MODULE, .name = DRV_NAME, .ioctl = ata_scsi_ioctl, diff --git a/drivers/scsi/sata_qstor.c b/drivers/scsi/sata_qstor.c index 65502c157a54..d274ab235781 100644 --- a/drivers/scsi/sata_qstor.c +++ b/drivers/scsi/sata_qstor.c @@ -36,7 +36,6 @@ #include #include #include -#include "scsi.h" #include #include #include @@ -128,7 +127,7 @@ static u8 qs_bmdma_status(struct ata_port *ap); static void qs_irq_clear(struct ata_port *ap); static void qs_eng_timeout(struct ata_port *ap); -static Scsi_Host_Template qs_ata_sht = { +static struct scsi_host_template qs_ata_sht = { .module = THIS_MODULE, .name = DRV_NAME, .ioctl = ata_scsi_ioctl, diff --git a/drivers/scsi/sata_sil.c b/drivers/scsi/sata_sil.c index 435f7e0085ec..d0e3c3c6c25f 100644 --- a/drivers/scsi/sata_sil.c +++ b/drivers/scsi/sata_sil.c @@ -42,7 +42,6 @@ #include #include #include -#include "scsi.h" #include #include @@ -131,7 +130,7 @@ static struct pci_driver sil_pci_driver = { .remove = ata_pci_remove_one, }; -static Scsi_Host_Template sil_sht = { +static struct scsi_host_template sil_sht = { .module = THIS_MODULE, .name = DRV_NAME, .ioctl = ata_scsi_ioctl, diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c index e6c8e89c226f..4682a50650b4 100644 --- a/drivers/scsi/sata_sil24.c +++ b/drivers/scsi/sata_sil24.c @@ -37,7 +37,7 @@ #include #include #include -#include "scsi.h" +#include #include #include @@ -255,7 +255,7 @@ static struct pci_driver sil24_pci_driver = { .remove = ata_pci_remove_one, /* safe? */ }; -static Scsi_Host_Template sil24_sht = { +static struct scsi_host_template sil24_sht = { .module = THIS_MODULE, .name = DRV_NAME, .ioctl = ata_scsi_ioctl, diff --git a/drivers/scsi/sata_sis.c b/drivers/scsi/sata_sis.c index 42288be0e561..42d7c4e92501 100644 --- a/drivers/scsi/sata_sis.c +++ b/drivers/scsi/sata_sis.c @@ -39,7 +39,6 @@ #include #include #include -#include "scsi.h" #include #include @@ -83,7 +82,7 @@ static struct pci_driver sis_pci_driver = { .remove = ata_pci_remove_one, }; -static Scsi_Host_Template sis_sht = { +static struct scsi_host_template sis_sht = { .module = THIS_MODULE, .name = DRV_NAME, .ioctl = ata_scsi_ioctl, diff --git a/drivers/scsi/sata_svw.c b/drivers/scsi/sata_svw.c index db615ff794d8..9895d1caefcf 100644 --- a/drivers/scsi/sata_svw.c +++ b/drivers/scsi/sata_svw.c @@ -45,7 +45,6 @@ #include #include #include -#include "scsi.h" #include #include @@ -284,7 +283,7 @@ static int k2_sata_proc_info(struct Scsi_Host *shost, char *page, char **start, #endif /* CONFIG_PPC_OF */ -static Scsi_Host_Template k2_sata_sht = { +static struct scsi_host_template k2_sata_sht = { .module = THIS_MODULE, .name = DRV_NAME, .ioctl = ata_scsi_ioctl, diff --git a/drivers/scsi/sata_sx4.c b/drivers/scsi/sata_sx4.c index f859bbd681ed..d5a38784352b 100644 --- a/drivers/scsi/sata_sx4.c +++ b/drivers/scsi/sata_sx4.c @@ -39,8 +39,8 @@ #include #include #include -#include "scsi.h" #include +#include #include #include #include "sata_promise.h" @@ -177,7 +177,7 @@ static void pdc20621_irq_clear(struct ata_port *ap); static int pdc20621_qc_issue_prot(struct ata_queued_cmd *qc); -static Scsi_Host_Template pdc_sata_sht = { +static struct scsi_host_template pdc_sata_sht = { .module = THIS_MODULE, .name = DRV_NAME, .ioctl = ata_scsi_ioctl, diff --git a/drivers/scsi/sata_uli.c b/drivers/scsi/sata_uli.c index a5e245c098e1..cf0baaa4e045 100644 --- a/drivers/scsi/sata_uli.c +++ b/drivers/scsi/sata_uli.c @@ -33,7 +33,6 @@ #include #include #include -#include "scsi.h" #include #include @@ -71,7 +70,7 @@ static struct pci_driver uli_pci_driver = { .remove = ata_pci_remove_one, }; -static Scsi_Host_Template uli_sht = { +static struct scsi_host_template uli_sht = { .module = THIS_MODULE, .name = DRV_NAME, .ioctl = ata_scsi_ioctl, diff --git a/drivers/scsi/sata_via.c b/drivers/scsi/sata_via.c index b3ecdbe400e9..ab19d2ba2a4b 100644 --- a/drivers/scsi/sata_via.c +++ b/drivers/scsi/sata_via.c @@ -42,7 +42,6 @@ #include #include #include -#include "scsi.h" #include #include #include @@ -90,7 +89,7 @@ static struct pci_driver svia_pci_driver = { .remove = ata_pci_remove_one, }; -static Scsi_Host_Template svia_sht = { +static struct scsi_host_template svia_sht = { .module = THIS_MODULE, .name = DRV_NAME, .ioctl = ata_scsi_ioctl, diff --git a/drivers/scsi/sata_vsc.c b/drivers/scsi/sata_vsc.c index bb84ba0c7e83..ce8a2fd7da84 100644 --- a/drivers/scsi/sata_vsc.c +++ b/drivers/scsi/sata_vsc.c @@ -43,7 +43,6 @@ #include #include #include -#include "scsi.h" #include #include @@ -219,7 +218,7 @@ static irqreturn_t vsc_sata_interrupt (int irq, void *dev_instance, } -static Scsi_Host_Template vsc_sata_sht = { +static struct scsi_host_template vsc_sata_sht = { .module = THIS_MODULE, .name = DRV_NAME, .ioctl = ata_scsi_ioctl, diff --git a/include/linux/libata.h b/include/linux/libata.h index dcd17e7458ab..6f0752219f64 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -214,7 +214,7 @@ struct ata_probe_ent { struct list_head node; struct device *dev; const struct ata_port_operations *port_ops; - Scsi_Host_Template *sht; + struct scsi_host_template *sht; struct ata_ioports port[ATA_MAX_PORTS]; unsigned int n_ports; unsigned int hard_port_no; @@ -398,7 +398,7 @@ struct ata_port_operations { }; struct ata_port_info { - Scsi_Host_Template *sht; + struct scsi_host_template *sht; unsigned long host_flags; unsigned long pio_mask; unsigned long mwdma_mask; @@ -433,7 +433,7 @@ extern void ata_pci_remove_one (struct pci_dev *pdev); #endif /* CONFIG_PCI */ extern int ata_device_add(const struct ata_probe_ent *ent); extern void ata_host_set_remove(struct ata_host_set *host_set); -extern int ata_scsi_detect(Scsi_Host_Template *sht); +extern int ata_scsi_detect(struct scsi_host_template *sht); extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg); extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)); extern int ata_scsi_error(struct Scsi_Host *host); -- cgit v1.2.2 From c719369350bc566d2643067421fbf05f4b90e70b Mon Sep 17 00:00:00 2001 From: Francois Romieu Date: Mon, 7 Nov 2005 01:50:03 +0100 Subject: [PATCH] b44: b44_start_xmit returns with a lock held when it fails allocating The patch simply factors out the release of the lock. Signed-off-by: Francois Romieu Signed-off-by: Jeff Garzik --- drivers/net/b44.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/net/b44.c b/drivers/net/b44.c index 0ee3e27969c6..b334cc310bc1 100644 --- a/drivers/net/b44.c +++ b/drivers/net/b44.c @@ -948,6 +948,7 @@ static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev) { struct b44 *bp = netdev_priv(dev); struct sk_buff *bounce_skb; + int rc = NETDEV_TX_OK; dma_addr_t mapping; u32 len, entry, ctrl; @@ -957,10 +958,9 @@ static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev) /* This is a hard error, log it. */ if (unlikely(TX_BUFFS_AVAIL(bp) < 1)) { netif_stop_queue(dev); - spin_unlock_irq(&bp->lock); printk(KERN_ERR PFX "%s: BUG! Tx Ring full when queue awake!\n", dev->name); - return 1; + goto err_out; } mapping = pci_map_single(bp->pdev, skb->data, len, PCI_DMA_TODEVICE); @@ -971,7 +971,7 @@ static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev) bounce_skb = __dev_alloc_skb(TX_PKT_BUF_SZ, GFP_ATOMIC|GFP_DMA); if (!bounce_skb) - return NETDEV_TX_BUSY; + goto err_out; mapping = pci_map_single(bp->pdev, bounce_skb->data, len, PCI_DMA_TODEVICE); @@ -979,7 +979,7 @@ static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev) pci_unmap_single(bp->pdev, mapping, len, PCI_DMA_TODEVICE); dev_kfree_skb_any(bounce_skb); - return NETDEV_TX_BUSY; + goto err_out; } memcpy(skb_put(bounce_skb, len), skb->data, skb->len); @@ -1019,11 +1019,16 @@ static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev) if (TX_BUFFS_AVAIL(bp) < 1) netif_stop_queue(dev); + dev->trans_start = jiffies; + +out_unlock: spin_unlock_irq(&bp->lock); - dev->trans_start = jiffies; + return rc; - return 0; +err_out: + rc = NETDEV_TX_BUSY; + goto out_unlock; } static int b44_change_mtu(struct net_device *dev, int new_mtu) -- cgit v1.2.2 From 874a6214bc1477004a0dd6f881b078d0d6b1eae9 Mon Sep 17 00:00:00 2001 From: Francois Romieu Date: Mon, 7 Nov 2005 01:50:46 +0100 Subject: [PATCH] b44: miscellaneous cleanup - remove unneeded forward declarations - s/kmalloc + memset/kzalloc/ - whitespace readjustement can't hurt - wrong comment: b44_init_rings _is_ called with a spinlock held in b44_{open/set_ringparam/set_pauseparam/etc}. Actually, it does not need to be able to sleep - b44_remove_one() can not be issued with a NULL device in its private member: remove the test. Signed-off-by: Francois Romieu Signed-off-by: Jeff Garzik --- drivers/net/b44.c | 67 +++++++++++++++++++++++-------------------------------- 1 file changed, 28 insertions(+), 39 deletions(-) diff --git a/drivers/net/b44.c b/drivers/net/b44.c index b334cc310bc1..3b6428f004f6 100644 --- a/drivers/net/b44.c +++ b/drivers/net/b44.c @@ -102,10 +102,6 @@ MODULE_DEVICE_TABLE(pci, b44_pci_tbl); static void b44_halt(struct b44 *); static void b44_init_rings(struct b44 *); static void b44_init_hw(struct b44 *); -static int b44_poll(struct net_device *dev, int *budget); -#ifdef CONFIG_NET_POLL_CONTROLLER -static void b44_poll_controller(struct net_device *dev); -#endif static int dma_desc_align_mask; static int dma_desc_sync_size; @@ -653,7 +649,7 @@ static int b44_alloc_rx_skb(struct b44 *bp, int src_idx, u32 dest_idx_unmasked) /* Hardware bug work-around, the chip is unable to do PCI DMA to/from anything above 1GB :-( */ - if(mapping+RX_PKT_BUF_SZ > B44_DMA_MASK) { + if (mapping + RX_PKT_BUF_SZ > B44_DMA_MASK) { /* Sigh... */ pci_unmap_single(bp->pdev, mapping, RX_PKT_BUF_SZ,PCI_DMA_FROMDEVICE); dev_kfree_skb_any(skb); @@ -663,7 +659,7 @@ static int b44_alloc_rx_skb(struct b44 *bp, int src_idx, u32 dest_idx_unmasked) mapping = pci_map_single(bp->pdev, skb->data, RX_PKT_BUF_SZ, PCI_DMA_FROMDEVICE); - if(mapping+RX_PKT_BUF_SZ > B44_DMA_MASK) { + if (mapping + RX_PKT_BUF_SZ > B44_DMA_MASK) { pci_unmap_single(bp->pdev, mapping, RX_PKT_BUF_SZ,PCI_DMA_FROMDEVICE); dev_kfree_skb_any(skb); return -ENOMEM; @@ -964,7 +960,7 @@ static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev) } mapping = pci_map_single(bp->pdev, skb->data, len, PCI_DMA_TODEVICE); - if(mapping+len > B44_DMA_MASK) { + if (mapping + len > B44_DMA_MASK) { /* Chip can't handle DMA to/from >1GB, use bounce buffer */ pci_unmap_single(bp->pdev, mapping, len, PCI_DMA_TODEVICE); @@ -975,7 +971,7 @@ static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev) mapping = pci_map_single(bp->pdev, bounce_skb->data, len, PCI_DMA_TODEVICE); - if(mapping+len > B44_DMA_MASK) { + if (mapping + len > B44_DMA_MASK) { pci_unmap_single(bp->pdev, mapping, len, PCI_DMA_TODEVICE); dev_kfree_skb_any(bounce_skb); @@ -1102,8 +1098,7 @@ static void b44_free_rings(struct b44 *bp) * * The chip has been shut down and the driver detached from * the networking, so no interrupts or new tx packets will - * end up in the driver. bp->lock is not held and we are not - * in an interrupt context and thus may sleep. + * end up in the driver. */ static void b44_init_rings(struct b44 *bp) { @@ -1175,16 +1170,14 @@ static int b44_alloc_consistent(struct b44 *bp) int size; size = B44_RX_RING_SIZE * sizeof(struct ring_info); - bp->rx_buffers = kmalloc(size, GFP_KERNEL); + bp->rx_buffers = kzalloc(size, GFP_KERNEL); if (!bp->rx_buffers) goto out_err; - memset(bp->rx_buffers, 0, size); size = B44_TX_RING_SIZE * sizeof(struct ring_info); - bp->tx_buffers = kmalloc(size, GFP_KERNEL); + bp->tx_buffers = kzalloc(size, GFP_KERNEL); if (!bp->tx_buffers) goto out_err; - memset(bp->tx_buffers, 0, size); size = DMA_TABLE_BYTES; bp->rx_ring = pci_alloc_consistent(bp->pdev, size, &bp->rx_ring_dma); @@ -1195,10 +1188,10 @@ static int b44_alloc_consistent(struct b44 *bp) struct dma_desc *rx_ring; dma_addr_t rx_ring_dma; - if (!(rx_ring = (struct dma_desc *)kmalloc(size, GFP_KERNEL))) + rx_ring = kzalloc(size, GFP_KERNEL); + if (!rx_ring) goto out_err; - memset(rx_ring, 0, size); rx_ring_dma = dma_map_single(&bp->pdev->dev, rx_ring, DMA_TABLE_BYTES, DMA_BIDIRECTIONAL); @@ -1221,10 +1214,10 @@ static int b44_alloc_consistent(struct b44 *bp) struct dma_desc *tx_ring; dma_addr_t tx_ring_dma; - if (!(tx_ring = (struct dma_desc *)kmalloc(size, GFP_KERNEL))) + tx_ring = kzalloc(size, GFP_KERNEL); + if (!tx_ring) goto out_err; - memset(tx_ring, 0, size); tx_ring_dma = dma_map_single(&bp->pdev->dev, tx_ring, DMA_TABLE_BYTES, DMA_TO_DEVICE); @@ -1530,8 +1523,6 @@ static void __b44_set_rx_mode(struct net_device *dev) { struct b44 *bp = netdev_priv(dev); u32 val; - int i=0; - unsigned char zero[6] = {0,0,0,0,0,0}; val = br32(bp, B44_RXCONFIG); val &= ~(RXCONFIG_PROMISC | RXCONFIG_ALLMULTI); @@ -1539,14 +1530,17 @@ static void __b44_set_rx_mode(struct net_device *dev) val |= RXCONFIG_PROMISC; bw32(bp, B44_RXCONFIG, val); } else { + unsigned char zero[6] = {0, 0, 0, 0, 0, 0}; + int i = 0; + __b44_set_mac_addr(bp); if (dev->flags & IFF_ALLMULTI) val |= RXCONFIG_ALLMULTI; else - i=__b44_load_mcast(bp, dev); + i = __b44_load_mcast(bp, dev); - for(;i<64;i++) { + for (; i < 64; i++) { __b44_cam_write(bp, zero, i); } bw32(bp, B44_RXCONFIG, val); @@ -1898,9 +1892,9 @@ static int __devinit b44_init_one(struct pci_dev *pdev, err = pci_set_consistent_dma_mask(pdev, (u64) B44_DMA_MASK); if (err) { - printk(KERN_ERR PFX "No usable DMA configuration, " - "aborting.\n"); - goto err_out_free_res; + printk(KERN_ERR PFX "No usable DMA configuration, " + "aborting.\n"); + goto err_out_free_res; } b44reg_base = pci_resource_start(pdev, 0); @@ -1922,10 +1916,8 @@ static int __devinit b44_init_one(struct pci_dev *pdev, bp = netdev_priv(dev); bp->pdev = pdev; bp->dev = dev; - if (b44_debug >= 0) - bp->msg_enable = (1 << b44_debug) - 1; - else - bp->msg_enable = B44_DEF_MSG_ENABLE; + + bp->msg_enable = netif_msg_init(b44_debug, B44_DEF_MSG_ENABLE); spin_lock_init(&bp->lock); @@ -2015,17 +2007,14 @@ err_out_disable_pdev: static void __devexit b44_remove_one(struct pci_dev *pdev) { struct net_device *dev = pci_get_drvdata(pdev); + struct b44 *bp = netdev_priv(dev); - if (dev) { - struct b44 *bp = netdev_priv(dev); - - unregister_netdev(dev); - iounmap(bp->regs); - free_netdev(dev); - pci_release_regions(pdev); - pci_disable_device(pdev); - pci_set_drvdata(pdev, NULL); - } + unregister_netdev(dev); + iounmap(bp->regs); + free_netdev(dev); + pci_release_regions(pdev); + pci_disable_device(pdev); + pci_set_drvdata(pdev, NULL); } static int b44_suspend(struct pci_dev *pdev, pm_message_t state) -- cgit v1.2.2 From 3353930d9d026ca94747d0766f864b2a0a8c714b Mon Sep 17 00:00:00 2001 From: Francois Romieu Date: Mon, 7 Nov 2005 01:51:34 +0100 Subject: [PATCH] b44: expose counters through ethtool Signed-off-by: Francois Romieu Signed-off-by: Jeff Garzik --- drivers/net/b44.c | 45 ++++++++++++++++++++++++++++++++- drivers/net/b44.h | 74 ++++++++++++++++++++++++++++++++++++++++--------------- 2 files changed, 98 insertions(+), 21 deletions(-) diff --git a/drivers/net/b44.c b/drivers/net/b44.c index 3b6428f004f6..ac223fcf9864 100644 --- a/drivers/net/b44.c +++ b/drivers/net/b44.c @@ -106,6 +106,12 @@ static void b44_init_hw(struct b44 *); static int dma_desc_align_mask; static int dma_desc_sync_size; +static const char b44_gstrings[][ETH_GSTRING_LEN] = { +#define _B44(x...) # x, +B44_STAT_REG_DECLARE +#undef _B44 +}; + static inline void b44_sync_dma_desc_for_device(struct pci_dev *pdev, dma_addr_t dma_base, unsigned long offset, @@ -498,7 +504,10 @@ static void b44_stats_update(struct b44 *bp) for (reg = B44_TX_GOOD_O; reg <= B44_TX_PAUSE; reg += 4UL) { *val++ += br32(bp, reg); } - val = &bp->hw_stats.rx_good_octets; + + /* Pad */ + reg += 8*4UL; + for (reg = B44_RX_GOOD_O; reg <= B44_RX_NPAUSE; reg += 4UL) { *val++ += br32(bp, reg); } @@ -1772,6 +1781,37 @@ static int b44_set_pauseparam(struct net_device *dev, return 0; } +static void b44_get_strings(struct net_device *dev, u32 stringset, u8 *data) +{ + switch(stringset) { + case ETH_SS_STATS: + memcpy(data, *b44_gstrings, sizeof(b44_gstrings)); + break; + } +} + +static int b44_get_stats_count(struct net_device *dev) +{ + return ARRAY_SIZE(b44_gstrings); +} + +static void b44_get_ethtool_stats(struct net_device *dev, + struct ethtool_stats *stats, u64 *data) +{ + struct b44 *bp = netdev_priv(dev); + u32 *val = &bp->hw_stats.tx_good_octets; + u32 i; + + spin_lock_irq(&bp->lock); + + b44_stats_update(bp); + + for (i = 0; i < ARRAY_SIZE(b44_gstrings); i++) + *data++ = *val++; + + spin_unlock_irq(&bp->lock); +} + static struct ethtool_ops b44_ethtool_ops = { .get_drvinfo = b44_get_drvinfo, .get_settings = b44_get_settings, @@ -1784,6 +1824,9 @@ static struct ethtool_ops b44_ethtool_ops = { .set_pauseparam = b44_set_pauseparam, .get_msglevel = b44_get_msglevel, .set_msglevel = b44_set_msglevel, + .get_strings = b44_get_strings, + .get_stats_count = b44_get_stats_count, + .get_ethtool_stats = b44_get_ethtool_stats, .get_perm_addr = ethtool_op_get_perm_addr, }; diff --git a/drivers/net/b44.h b/drivers/net/b44.h index 593cb0ad4100..7afeaf608232 100644 --- a/drivers/net/b44.h +++ b/drivers/net/b44.h @@ -346,29 +346,63 @@ struct ring_info { #define B44_MCAST_TABLE_SIZE 32 +#define B44_STAT_REG_DECLARE \ + _B44(tx_good_octets) \ + _B44(tx_good_pkts) \ + _B44(tx_octets) \ + _B44(tx_pkts) \ + _B44(tx_broadcast_pkts) \ + _B44(tx_multicast_pkts) \ + _B44(tx_len_64) \ + _B44(tx_len_65_to_127) \ + _B44(tx_len_128_to_255) \ + _B44(tx_len_256_to_511) \ + _B44(tx_len_512_to_1023) \ + _B44(tx_len_1024_to_max) \ + _B44(tx_jabber_pkts) \ + _B44(tx_oversize_pkts) \ + _B44(tx_fragment_pkts) \ + _B44(tx_underruns) \ + _B44(tx_total_cols) \ + _B44(tx_single_cols) \ + _B44(tx_multiple_cols) \ + _B44(tx_excessive_cols) \ + _B44(tx_late_cols) \ + _B44(tx_defered) \ + _B44(tx_carrier_lost) \ + _B44(tx_pause_pkts) \ + _B44(rx_good_octets) \ + _B44(rx_good_pkts) \ + _B44(rx_octets) \ + _B44(rx_pkts) \ + _B44(rx_broadcast_pkts) \ + _B44(rx_multicast_pkts) \ + _B44(rx_len_64) \ + _B44(rx_len_65_to_127) \ + _B44(rx_len_128_to_255) \ + _B44(rx_len_256_to_511) \ + _B44(rx_len_512_to_1023) \ + _B44(rx_len_1024_to_max) \ + _B44(rx_jabber_pkts) \ + _B44(rx_oversize_pkts) \ + _B44(rx_fragment_pkts) \ + _B44(rx_missed_pkts) \ + _B44(rx_crc_align_errs) \ + _B44(rx_undersize) \ + _B44(rx_crc_errs) \ + _B44(rx_align_errs) \ + _B44(rx_symbol_errs) \ + _B44(rx_pause_pkts) \ + _B44(rx_nonpause_pkts) + /* SW copy of device statistics, kept up to date by periodic timer - * which probes HW values. Must have same relative layout as HW - * register above, because b44_stats_update depends upon this. + * which probes HW values. Check b44_stats_update if you mess with + * the layout */ struct b44_hw_stats { - u32 tx_good_octets, tx_good_pkts, tx_octets; - u32 tx_pkts, tx_broadcast_pkts, tx_multicast_pkts; - u32 tx_len_64, tx_len_65_to_127, tx_len_128_to_255; - u32 tx_len_256_to_511, tx_len_512_to_1023, tx_len_1024_to_max; - u32 tx_jabber_pkts, tx_oversize_pkts, tx_fragment_pkts; - u32 tx_underruns, tx_total_cols, tx_single_cols; - u32 tx_multiple_cols, tx_excessive_cols, tx_late_cols; - u32 tx_defered, tx_carrier_lost, tx_pause_pkts; - u32 __pad1[8]; - - u32 rx_good_octets, rx_good_pkts, rx_octets; - u32 rx_pkts, rx_broadcast_pkts, rx_multicast_pkts; - u32 rx_len_64, rx_len_65_to_127, rx_len_128_to_255; - u32 rx_len_256_to_511, rx_len_512_to_1023, rx_len_1024_to_max; - u32 rx_jabber_pkts, rx_oversize_pkts, rx_fragment_pkts; - u32 rx_missed_pkts, rx_crc_align_errs, rx_undersize; - u32 rx_crc_errs, rx_align_errs, rx_symbol_errs; - u32 rx_pause_pkts, rx_nonpause_pkts; +#define _B44(x) u32 x; +B44_STAT_REG_DECLARE +#undef _B44 }; struct b44 { -- cgit v1.2.2 From 65b984f26f16e97168ee29e53145055412f38a23 Mon Sep 17 00:00:00 2001 From: Francois Romieu Date: Mon, 7 Nov 2005 01:52:06 +0100 Subject: [PATCH] b44: s/spin_lock_irqsave/spin_lock/ in b44_interrupt There is no need to save/restore the irq state as the irq are always locally disabled when b44_interrupt is issued. Signed-off-by: Francois Romieu Signed-off-by: Jeff Garzik --- drivers/net/b44.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/b44.c b/drivers/net/b44.c index ac223fcf9864..09e1b4deae59 100644 --- a/drivers/net/b44.c +++ b/drivers/net/b44.c @@ -895,11 +895,10 @@ static irqreturn_t b44_interrupt(int irq, void *dev_id, struct pt_regs *regs) { struct net_device *dev = dev_id; struct b44 *bp = netdev_priv(dev); - unsigned long flags; u32 istat, imask; int handled = 0; - spin_lock_irqsave(&bp->lock, flags); + spin_lock(&bp->lock); istat = br32(bp, B44_ISTAT); imask = br32(bp, B44_IMASK); @@ -925,7 +924,7 @@ static irqreturn_t b44_interrupt(int irq, void *dev_id, struct pt_regs *regs) bw32(bp, B44_ISTAT, istat); br32(bp, B44_ISTAT); } - spin_unlock_irqrestore(&bp->lock, flags); + spin_unlock(&bp->lock); return IRQ_RETVAL(handled); } -- cgit v1.2.2 From 6c2f4267833f453156f8f439cc32eb4c92f357b4 Mon Sep 17 00:00:00 2001 From: Francois Romieu Date: Mon, 7 Nov 2005 01:52:57 +0100 Subject: [PATCH] b44: late request_irq in b44_open Don't request_irq before the registers are reset/init. Signed-off-by: Francois Romieu Signed-off-by: Jeff Garzik --- drivers/net/b44.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/drivers/net/b44.c b/drivers/net/b44.c index 09e1b4deae59..ecc2e32c38c1 100644 --- a/drivers/net/b44.c +++ b/drivers/net/b44.c @@ -1388,13 +1388,7 @@ static int b44_open(struct net_device *dev) err = b44_alloc_consistent(bp); if (err) - return err; - - err = request_irq(dev->irq, b44_interrupt, SA_SHIRQ, dev->name, dev); - if (err) - goto err_out_free; - - spin_lock_irq(&bp->lock); + goto out; b44_init_rings(bp); b44_init_hw(bp); @@ -1403,7 +1397,13 @@ static int b44_open(struct net_device *dev) netif_carrier_off(dev); b44_check_phy(bp); - spin_unlock_irq(&bp->lock); + err = request_irq(dev->irq, b44_interrupt, SA_SHIRQ, dev->name, dev); + if (unlikely(err < 0)) { + b44_chip_reset(bp); + b44_free_rings(bp); + b44_free_consistent(bp); + goto out; + } init_timer(&bp->timer); bp->timer.expires = jiffies + HZ; @@ -1412,11 +1412,7 @@ static int b44_open(struct net_device *dev) add_timer(&bp->timer); b44_enable_ints(bp); - - return 0; - -err_out_free: - b44_free_consistent(bp); +out: return err; } -- cgit v1.2.2 From 81f875208e7f46d003bedb82d5cfe54458a3ab60 Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Mon, 24 Oct 2005 10:20:53 -0500 Subject: scripts/Lindent on ieee80211 subsystem. Signed-off-by: James Ketrenos --- net/ieee80211/ieee80211_wx.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/net/ieee80211/ieee80211_wx.c b/net/ieee80211/ieee80211_wx.c index 1ce7af9bec35..f5b805355000 100644 --- a/net/ieee80211/ieee80211_wx.c +++ b/net/ieee80211/ieee80211_wx.c @@ -161,9 +161,11 @@ static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee, (ieee->perfect_rssi - ieee->worst_rssi) - (ieee->perfect_rssi - network->stats.rssi) * (15 * (ieee->perfect_rssi - ieee->worst_rssi) + - 62 * (ieee->perfect_rssi - network->stats.rssi))) / - ((ieee->perfect_rssi - ieee->worst_rssi) * - (ieee->perfect_rssi - ieee->worst_rssi)); + 62 * (ieee->perfect_rssi - + network->stats.rssi))) / + ((ieee->perfect_rssi - + ieee->worst_rssi) * (ieee->perfect_rssi - + ieee->worst_rssi)); if (iwe.u.qual.qual > 100) iwe.u.qual.qual = 100; else if (iwe.u.qual.qual < 1) -- cgit v1.2.2 From e189277a3f1cbb0f1282e0f4b8fa8c91e004c286 Mon Sep 17 00:00:00 2001 From: Volker Braun Date: Mon, 24 Oct 2005 10:15:36 -0500 Subject: Fix problem with WEP unicast key > index 0 The functions ieee80211_wx_{get,set}_encodeext fail if one tries to set unicast (IW_ENCODE_EXT_GROUP_KEY not set) keys at key indices>0. But at least some Cisco APs dish out dynamic WEP unicast keys at index !=0. Signed-off-by: Volker Braun Signed-off-by: James Ketrenos --- net/ieee80211/ieee80211_wx.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/ieee80211/ieee80211_wx.c b/net/ieee80211/ieee80211_wx.c index f5b805355000..181755f2aa8b 100644 --- a/net/ieee80211/ieee80211_wx.c +++ b/net/ieee80211/ieee80211_wx.c @@ -522,7 +522,8 @@ int ieee80211_wx_set_encodeext(struct ieee80211_device *ieee, crypt = &ieee->crypt[idx]; group_key = 1; } else { - if (idx != 0) + /* some Cisco APs use idx>0 for unicast in dynamic WEP */ + if (idx != 0 && ext->alg != IW_ENCODE_ALG_WEP) return -EINVAL; if (ieee->iw_mode == IW_MODE_INFRA) crypt = &ieee->crypt[idx]; @@ -690,7 +691,8 @@ int ieee80211_wx_get_encodeext(struct ieee80211_device *ieee, } else idx = ieee->tx_keyidx; - if (!ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) + if (!ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY && + ext->alg != IW_ENCODE_ALG_WEP) if (idx != 0 || ieee->iw_mode != IW_MODE_INFRA) return -EINVAL; -- cgit v1.2.2 From d7e02edbc52bc689279154b117b90fe6635fc14b Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Mon, 24 Oct 2005 20:44:06 -0500 Subject: Update version ieee80211 stamp to 1.1.7 --- include/net/ieee80211.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h index 5e38dca1d082..b93fd8c1d884 100644 --- a/include/net/ieee80211.h +++ b/include/net/ieee80211.h @@ -29,7 +29,7 @@ #include /* ARRAY_SIZE */ #include -#define IEEE80211_VERSION "git-1.1.6" +#define IEEE80211_VERSION "git-1.1.7" #define IEEE80211_DATA_LEN 2304 /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section -- cgit v1.2.2 From ee8e365aa6395e721399127ccf3d28d269136f0e Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Wed, 14 Sep 2005 09:47:29 -0500 Subject: Ran scripts/Lindent on drivers/net/wireless/ipw2{1,2}00.{c,h} No other changes. Signed-off-by: James Ketrenos --- drivers/net/wireless/ipw2100.c | 2217 ++++++++++++++++++++-------------------- drivers/net/wireless/ipw2100.h | 156 ++- 2 files changed, 1155 insertions(+), 1218 deletions(-) diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c index ad7f8cd76db9..a15eef1c2a62 100644 --- a/drivers/net/wireless/ipw2100.c +++ b/drivers/net/wireless/ipw2100.c @@ -174,10 +174,9 @@ that only one external action is invoked at a time. #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" #define DRV_COPYRIGHT "Copyright(c) 2003-2004 Intel Corporation" - /* Debugging stuff */ #ifdef CONFIG_IPW_DEBUG -#define CONFIG_IPW2100_RX_DEBUG /* Reception debugging */ +#define CONFIG_IPW2100_RX_DEBUG /* Reception debugging */ #endif MODULE_DESCRIPTION(DRV_DESCRIPTION); @@ -220,18 +219,18 @@ do { \ } while (0) #else #define IPW_DEBUG(level, message...) do {} while (0) -#endif /* CONFIG_IPW_DEBUG */ +#endif /* CONFIG_IPW_DEBUG */ #ifdef CONFIG_IPW_DEBUG static const char *command_types[] = { "undefined", - "unused", /* HOST_ATTENTION */ + "unused", /* HOST_ATTENTION */ "HOST_COMPLETE", - "unused", /* SLEEP */ - "unused", /* HOST_POWER_DOWN */ + "unused", /* SLEEP */ + "unused", /* HOST_POWER_DOWN */ "unused", "SYSTEM_CONFIG", - "unused", /* SET_IMR */ + "unused", /* SET_IMR */ "SSID", "MANDATORY_BSSID", "AUTHENTICATION_TYPE", @@ -277,17 +276,16 @@ static const char *command_types[] = { "GROUP_ORDINALS", "SHORT_RETRY_LIMIT", "LONG_RETRY_LIMIT", - "unused", /* SAVE_CALIBRATION */ - "unused", /* RESTORE_CALIBRATION */ + "unused", /* SAVE_CALIBRATION */ + "unused", /* RESTORE_CALIBRATION */ "undefined", "undefined", "undefined", "HOST_PRE_POWER_DOWN", - "unused", /* HOST_INTERRUPT_COALESCING */ + "unused", /* HOST_INTERRUPT_COALESCING */ "undefined", "CARD_DISABLE_PHY_OFF", - "MSDU_TX_RATES" - "undefined", + "MSDU_TX_RATES" "undefined", "undefined", "SET_STATION_STAT_BITS", "CLEAR_STATIONS_STAT_BITS", @@ -298,7 +296,6 @@ static const char *command_types[] = { }; #endif - /* Pre-decl until we get the code solid and then we can clean it up */ static void ipw2100_tx_send_commands(struct ipw2100_priv *priv); static void ipw2100_tx_send_data(struct ipw2100_priv *priv); @@ -321,11 +318,10 @@ static void ipw2100_release_firmware(struct ipw2100_priv *priv, static int ipw2100_ucode_download(struct ipw2100_priv *priv, struct ipw2100_fw *fw); static void ipw2100_wx_event_work(struct ipw2100_priv *priv); -static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev); +static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device *dev); static struct iw_handler_def ipw2100_wx_handler_def; - -static inline void read_register(struct net_device *dev, u32 reg, u32 *val) +static inline void read_register(struct net_device *dev, u32 reg, u32 * val) { *val = readl((void __iomem *)(dev->base_addr + reg)); IPW_DEBUG_IO("r: 0x%08X => 0x%08X\n", reg, *val); @@ -337,13 +333,14 @@ static inline void write_register(struct net_device *dev, u32 reg, u32 val) IPW_DEBUG_IO("w: 0x%08X <= 0x%08X\n", reg, val); } -static inline void read_register_word(struct net_device *dev, u32 reg, u16 *val) +static inline void read_register_word(struct net_device *dev, u32 reg, + u16 * val) { *val = readw((void __iomem *)(dev->base_addr + reg)); IPW_DEBUG_IO("r: 0x%08X => %04X\n", reg, *val); } -static inline void read_register_byte(struct net_device *dev, u32 reg, u8 *val) +static inline void read_register_byte(struct net_device *dev, u32 reg, u8 * val) { *val = readb((void __iomem *)(dev->base_addr + reg)); IPW_DEBUG_IO("r: 0x%08X => %02X\n", reg, *val); @@ -355,14 +352,13 @@ static inline void write_register_word(struct net_device *dev, u32 reg, u16 val) IPW_DEBUG_IO("w: 0x%08X <= %04X\n", reg, val); } - static inline void write_register_byte(struct net_device *dev, u32 reg, u8 val) { writeb(val, (void __iomem *)(dev->base_addr + reg)); IPW_DEBUG_IO("w: 0x%08X =< %02X\n", reg, val); } -static inline void read_nic_dword(struct net_device *dev, u32 addr, u32 *val) +static inline void read_nic_dword(struct net_device *dev, u32 addr, u32 * val) { write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, addr & IPW_REG_INDIRECT_ADDR_MASK); @@ -376,7 +372,7 @@ static inline void write_nic_dword(struct net_device *dev, u32 addr, u32 val) write_register(dev, IPW_REG_INDIRECT_ACCESS_DATA, val); } -static inline void read_nic_word(struct net_device *dev, u32 addr, u16 *val) +static inline void read_nic_word(struct net_device *dev, u32 addr, u16 * val) { write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, addr & IPW_REG_INDIRECT_ADDR_MASK); @@ -390,7 +386,7 @@ static inline void write_nic_word(struct net_device *dev, u32 addr, u16 val) write_register_word(dev, IPW_REG_INDIRECT_ACCESS_DATA, val); } -static inline void read_nic_byte(struct net_device *dev, u32 addr, u8 *val) +static inline void read_nic_byte(struct net_device *dev, u32 addr, u8 * val) { write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, addr & IPW_REG_INDIRECT_ADDR_MASK); @@ -416,7 +412,7 @@ static inline void write_nic_dword_auto_inc(struct net_device *dev, u32 val) } static inline void write_nic_memory(struct net_device *dev, u32 addr, u32 len, - const u8 *buf) + const u8 * buf) { u32 aligned_addr; u32 aligned_len; @@ -431,32 +427,30 @@ static inline void write_nic_memory(struct net_device *dev, u32 addr, u32 len, write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, aligned_addr); for (i = dif_len; i < 4; i++, buf++) - write_register_byte( - dev, IPW_REG_INDIRECT_ACCESS_DATA + i, - *buf); + write_register_byte(dev, + IPW_REG_INDIRECT_ACCESS_DATA + i, + *buf); len -= dif_len; aligned_addr += 4; } /* read DWs through autoincrement registers */ - write_register(dev, IPW_REG_AUTOINCREMENT_ADDRESS, - aligned_addr); + write_register(dev, IPW_REG_AUTOINCREMENT_ADDRESS, aligned_addr); aligned_len = len & (~0x3); for (i = 0; i < aligned_len; i += 4, buf += 4, aligned_addr += 4) - write_register( - dev, IPW_REG_AUTOINCREMENT_DATA, *(u32 *)buf); + write_register(dev, IPW_REG_AUTOINCREMENT_DATA, *(u32 *) buf); /* copy the last nibble */ dif_len = len - aligned_len; write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, aligned_addr); for (i = 0; i < dif_len; i++, buf++) - write_register_byte( - dev, IPW_REG_INDIRECT_ACCESS_DATA + i, *buf); + write_register_byte(dev, IPW_REG_INDIRECT_ACCESS_DATA + i, + *buf); } static inline void read_nic_memory(struct net_device *dev, u32 addr, u32 len, - u8 *buf) + u8 * buf) { u32 aligned_addr; u32 aligned_len; @@ -471,39 +465,38 @@ static inline void read_nic_memory(struct net_device *dev, u32 addr, u32 len, write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, aligned_addr); for (i = dif_len; i < 4; i++, buf++) - read_register_byte( - dev, IPW_REG_INDIRECT_ACCESS_DATA + i, buf); + read_register_byte(dev, + IPW_REG_INDIRECT_ACCESS_DATA + i, + buf); len -= dif_len; aligned_addr += 4; } /* read DWs through autoincrement registers */ - write_register(dev, IPW_REG_AUTOINCREMENT_ADDRESS, - aligned_addr); + write_register(dev, IPW_REG_AUTOINCREMENT_ADDRESS, aligned_addr); aligned_len = len & (~0x3); for (i = 0; i < aligned_len; i += 4, buf += 4, aligned_addr += 4) - read_register(dev, IPW_REG_AUTOINCREMENT_DATA, - (u32 *)buf); + read_register(dev, IPW_REG_AUTOINCREMENT_DATA, (u32 *) buf); /* copy the last nibble */ dif_len = len - aligned_len; - write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, - aligned_addr); + write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, aligned_addr); for (i = 0; i < dif_len; i++, buf++) - read_register_byte(dev, IPW_REG_INDIRECT_ACCESS_DATA + - i, buf); + read_register_byte(dev, IPW_REG_INDIRECT_ACCESS_DATA + i, buf); } static inline int ipw2100_hw_is_adapter_in_system(struct net_device *dev) { return (dev->base_addr && - (readl((void __iomem *)(dev->base_addr + IPW_REG_DOA_DEBUG_AREA_START)) + (readl + ((void __iomem *)(dev->base_addr + + IPW_REG_DOA_DEBUG_AREA_START)) == IPW_DATA_DOA_DEBUG_VALUE)); } static int ipw2100_get_ordinal(struct ipw2100_priv *priv, u32 ord, - void *val, u32 *len) + void *val, u32 * len) { struct ipw2100_ordinals *ordinals = &priv->ordinals; u32 addr; @@ -529,8 +522,8 @@ static int ipw2100_get_ordinal(struct ipw2100_priv *priv, u32 ord, return -EINVAL; } - read_nic_dword(priv->net_dev, ordinals->table1_addr + (ord << 2), - &addr); + read_nic_dword(priv->net_dev, + ordinals->table1_addr + (ord << 2), &addr); read_nic_dword(priv->net_dev, addr, val); *len = IPW_ORD_TAB_1_ENTRY_SIZE; @@ -543,8 +536,8 @@ static int ipw2100_get_ordinal(struct ipw2100_priv *priv, u32 ord, ord -= IPW_START_ORD_TAB_2; /* get the address of statistic */ - read_nic_dword(priv->net_dev, ordinals->table2_addr + (ord << 3), - &addr); + read_nic_dword(priv->net_dev, + ordinals->table2_addr + (ord << 3), &addr); /* get the second DW of statistics ; * two 16-bit words - first is length, second is count */ @@ -553,10 +546,10 @@ static int ipw2100_get_ordinal(struct ipw2100_priv *priv, u32 ord, &field_info); /* get each entry length */ - field_len = *((u16 *)&field_info); + field_len = *((u16 *) & field_info); /* get number of entries */ - field_count = *(((u16 *)&field_info) + 1); + field_count = *(((u16 *) & field_info) + 1); /* abort if no enought memory */ total_length = field_len * field_count; @@ -581,8 +574,8 @@ static int ipw2100_get_ordinal(struct ipw2100_priv *priv, u32 ord, return -EINVAL; } -static int ipw2100_set_ordinal(struct ipw2100_priv *priv, u32 ord, u32 *val, - u32 *len) +static int ipw2100_set_ordinal(struct ipw2100_priv *priv, u32 ord, u32 * val, + u32 * len) { struct ipw2100_ordinals *ordinals = &priv->ordinals; u32 addr; @@ -594,8 +587,8 @@ static int ipw2100_set_ordinal(struct ipw2100_priv *priv, u32 ord, u32 *val, return -EINVAL; } - read_nic_dword(priv->net_dev, ordinals->table1_addr + (ord << 2), - &addr); + read_nic_dword(priv->net_dev, + ordinals->table1_addr + (ord << 2), &addr); write_nic_dword(priv->net_dev, addr, *val); @@ -612,7 +605,7 @@ static int ipw2100_set_ordinal(struct ipw2100_priv *priv, u32 ord, u32 *val, } static char *snprint_line(char *buf, size_t count, - const u8 *data, u32 len, u32 ofs) + const u8 * data, u32 len, u32 ofs) { int out, i, j, l; char c; @@ -646,7 +639,7 @@ static char *snprint_line(char *buf, size_t count, return buf; } -static void printk_buf(int level, const u8 *data, u32 len) +static void printk_buf(int level, const u8 * data, u32 len) { char line[81]; u32 ofs = 0; @@ -662,8 +655,6 @@ static void printk_buf(int level, const u8 *data, u32 len) } } - - #define MAX_RESET_BACKOFF 10 static inline void schedule_reset(struct ipw2100_priv *priv) @@ -703,7 +694,7 @@ static inline void schedule_reset(struct ipw2100_priv *priv) #define HOST_COMPLETE_TIMEOUT (2 * HZ) static int ipw2100_hw_send_command(struct ipw2100_priv *priv, - struct host_command * cmd) + struct host_command *cmd) { struct list_head *element; struct ipw2100_tx_packet *packet; @@ -713,25 +704,28 @@ static int ipw2100_hw_send_command(struct ipw2100_priv *priv, IPW_DEBUG_HC("Sending %s command (#%d), %d bytes\n", command_types[cmd->host_command], cmd->host_command, cmd->host_command_length); - printk_buf(IPW_DL_HC, (u8*)cmd->host_command_parameters, + printk_buf(IPW_DL_HC, (u8 *) cmd->host_command_parameters, cmd->host_command_length); spin_lock_irqsave(&priv->low_lock, flags); if (priv->fatal_error) { - IPW_DEBUG_INFO("Attempt to send command while hardware in fatal error condition.\n"); + IPW_DEBUG_INFO + ("Attempt to send command while hardware in fatal error condition.\n"); err = -EIO; goto fail_unlock; } if (!(priv->status & STATUS_RUNNING)) { - IPW_DEBUG_INFO("Attempt to send command while hardware is not running.\n"); + IPW_DEBUG_INFO + ("Attempt to send command while hardware is not running.\n"); err = -EIO; goto fail_unlock; } if (priv->status & STATUS_CMD_ACTIVE) { - IPW_DEBUG_INFO("Attempt to send command while another command is pending.\n"); + IPW_DEBUG_INFO + ("Attempt to send command while another command is pending.\n"); err = -EBUSY; goto fail_unlock; } @@ -752,7 +746,8 @@ static int ipw2100_hw_send_command(struct ipw2100_priv *priv, /* initialize the firmware command packet */ packet->info.c_struct.cmd->host_command_reg = cmd->host_command; packet->info.c_struct.cmd->host_command_reg1 = cmd->host_command1; - packet->info.c_struct.cmd->host_command_len_reg = cmd->host_command_length; + packet->info.c_struct.cmd->host_command_len_reg = + cmd->host_command_length; packet->info.c_struct.cmd->sequence = cmd->host_command_sequence; memcpy(packet->info.c_struct.cmd->host_command_params_reg, @@ -776,9 +771,11 @@ static int ipw2100_hw_send_command(struct ipw2100_priv *priv, * then there is a problem. */ - err = wait_event_interruptible_timeout( - priv->wait_command_queue, !(priv->status & STATUS_CMD_ACTIVE), - HOST_COMPLETE_TIMEOUT); + err = + wait_event_interruptible_timeout(priv->wait_command_queue, + !(priv-> + status & STATUS_CMD_ACTIVE), + HOST_COMPLETE_TIMEOUT); if (err == 0) { IPW_DEBUG_INFO("Command completion failed out after %dms.\n", @@ -804,13 +801,12 @@ static int ipw2100_hw_send_command(struct ipw2100_priv *priv, return 0; - fail_unlock: + fail_unlock: spin_unlock_irqrestore(&priv->low_lock, flags); return err; } - /* * Verify the values and data access of the hardware * No locks needed or used. No functions called. @@ -825,8 +821,7 @@ static int ipw2100_verify(struct ipw2100_priv *priv) /* Domain 0 check - all values should be DOA_DEBUG */ for (address = IPW_REG_DOA_DEBUG_AREA_START; - address < IPW_REG_DOA_DEBUG_AREA_END; - address += sizeof(u32)) { + address < IPW_REG_DOA_DEBUG_AREA_END; address += sizeof(u32)) { read_register(priv->net_dev, address, &data1); if (data1 != IPW_DATA_DOA_DEBUG_VALUE) return -EIO; @@ -898,7 +893,6 @@ static int ipw2100_wait_for_card_state(struct ipw2100_priv *priv, int state) return -EIO; } - /********************************************************************* Procedure : sw_reset_and_clock Purpose : Asserts s/w reset, asserts clock initialization @@ -975,17 +969,16 @@ static int ipw2100_download_firmware(struct ipw2100_priv *priv) if (priv->fatal_error) { IPW_DEBUG_ERROR("%s: ipw2100_download_firmware called after " - "fatal error %d. Interface must be brought down.\n", - priv->net_dev->name, priv->fatal_error); + "fatal error %d. Interface must be brought down.\n", + priv->net_dev->name, priv->fatal_error); return -EINVAL; } - #ifdef CONFIG_PM if (!ipw2100_firmware.version) { err = ipw2100_get_firmware(priv, &ipw2100_firmware); if (err) { IPW_DEBUG_ERROR("%s: ipw2100_get_firmware failed: %d\n", - priv->net_dev->name, err); + priv->net_dev->name, err); priv->fatal_error = IPW2100_ERR_FW_LOAD; goto fail; } @@ -994,7 +987,7 @@ static int ipw2100_download_firmware(struct ipw2100_priv *priv) err = ipw2100_get_firmware(priv, &ipw2100_firmware); if (err) { IPW_DEBUG_ERROR("%s: ipw2100_get_firmware failed: %d\n", - priv->net_dev->name, err); + priv->net_dev->name, err); priv->fatal_error = IPW2100_ERR_FW_LOAD; goto fail; } @@ -1005,21 +998,20 @@ static int ipw2100_download_firmware(struct ipw2100_priv *priv) err = sw_reset_and_clock(priv); if (err) { IPW_DEBUG_ERROR("%s: sw_reset_and_clock failed: %d\n", - priv->net_dev->name, err); + priv->net_dev->name, err); goto fail; } err = ipw2100_verify(priv); if (err) { IPW_DEBUG_ERROR("%s: ipw2100_verify failed: %d\n", - priv->net_dev->name, err); + priv->net_dev->name, err); goto fail; } /* Hold ARC */ write_nic_dword(priv->net_dev, - IPW_INTERNAL_REGISTER_HALT_AND_RESET, - 0x80000000); + IPW_INTERNAL_REGISTER_HALT_AND_RESET, 0x80000000); /* allow ARC to run */ write_register(priv->net_dev, IPW_REG_RESET_REG, 0); @@ -1034,13 +1026,13 @@ static int ipw2100_download_firmware(struct ipw2100_priv *priv) /* release ARC */ write_nic_dword(priv->net_dev, - IPW_INTERNAL_REGISTER_HALT_AND_RESET, - 0x00000000); + IPW_INTERNAL_REGISTER_HALT_AND_RESET, 0x00000000); /* s/w reset and clock stabilization (again!!!) */ err = sw_reset_and_clock(priv); if (err) { - printk(KERN_ERR DRV_NAME ": %s: sw_reset_and_clock failed: %d\n", + printk(KERN_ERR DRV_NAME + ": %s: sw_reset_and_clock failed: %d\n", priv->net_dev->name, err); goto fail; } @@ -1049,10 +1041,9 @@ static int ipw2100_download_firmware(struct ipw2100_priv *priv) err = ipw2100_fw_download(priv, &ipw2100_firmware); if (err) { IPW_DEBUG_ERROR("%s: Error loading firmware: %d\n", - priv->net_dev->name, err); + priv->net_dev->name, err); goto fail; } - #ifndef CONFIG_PM /* * When the .resume method of the driver is called, the other @@ -1084,7 +1075,7 @@ static int ipw2100_download_firmware(struct ipw2100_priv *priv) return 0; - fail: + fail: ipw2100_release_firmware(priv, &ipw2100_firmware); return err; } @@ -1105,7 +1096,6 @@ static inline void ipw2100_disable_interrupts(struct ipw2100_priv *priv) write_register(priv->net_dev, IPW_REG_INTA_MASK, 0x0); } - static void ipw2100_initialize_ordinals(struct ipw2100_priv *priv) { struct ipw2100_ordinals *ord = &priv->ordinals; @@ -1177,11 +1167,10 @@ static int ipw2100_get_hw_features(struct ipw2100_priv *priv) * EEPROM_SRAM_DB_START_ADDRESS using ordinal in ordinal table 1 */ len = sizeof(addr); - if (ipw2100_get_ordinal( - priv, IPW_ORD_EEPROM_SRAM_DB_BLOCK_START_ADDRESS, - &addr, &len)) { + if (ipw2100_get_ordinal + (priv, IPW_ORD_EEPROM_SRAM_DB_BLOCK_START_ADDRESS, &addr, &len)) { IPW_DEBUG_INFO("failed querying ordinals at line %d\n", - __LINE__); + __LINE__); return -EIO; } @@ -1194,7 +1183,7 @@ static int ipw2100_get_hw_features(struct ipw2100_priv *priv) priv->eeprom_version = (val >> 24) & 0xFF; IPW_DEBUG_INFO("EEPROM version: %d\n", priv->eeprom_version); - /* + /* * HW RF Kill enable is bit 0 in byte at offset 0x21 in firmware * * notice that the EEPROM bit is reverse polarity, i.e. @@ -1206,8 +1195,7 @@ static int ipw2100_get_hw_features(struct ipw2100_priv *priv) priv->hw_features |= HW_FEATURE_RFKILL; IPW_DEBUG_INFO("HW RF Kill: %ssupported.\n", - (priv->hw_features & HW_FEATURE_RFKILL) ? - "" : "not "); + (priv->hw_features & HW_FEATURE_RFKILL) ? "" : "not "); return 0; } @@ -1234,7 +1222,8 @@ static int ipw2100_start_adapter(struct ipw2100_priv *priv) * fw & dino ucode */ if (ipw2100_download_firmware(priv)) { - printk(KERN_ERR DRV_NAME ": %s: Failed to power on the adapter.\n", + printk(KERN_ERR DRV_NAME + ": %s: Failed to power on the adapter.\n", priv->net_dev->name); return -EIO; } @@ -1293,7 +1282,8 @@ static int ipw2100_start_adapter(struct ipw2100_priv *priv) i ? "SUCCESS" : "FAILED"); if (!i) { - printk(KERN_WARNING DRV_NAME ": %s: Firmware did not initialize.\n", + printk(KERN_WARNING DRV_NAME + ": %s: Firmware did not initialize.\n", priv->net_dev->name); return -EIO; } @@ -1326,7 +1316,6 @@ static inline void ipw2100_reset_fatalerror(struct ipw2100_priv *priv) priv->fatal_error = 0; } - /* NOTE: Our interrupt is disabled when this method is called */ static int ipw2100_power_cycle_adapter(struct ipw2100_priv *priv) { @@ -1350,19 +1339,19 @@ static int ipw2100_power_cycle_adapter(struct ipw2100_priv *priv) if (reg & IPW_AUX_HOST_RESET_REG_MASTER_DISABLED) break; - } while(i--); + } while (i--); priv->status &= ~STATUS_RESET_PENDING; if (!i) { - IPW_DEBUG_INFO("exit - waited too long for master assert stop\n"); + IPW_DEBUG_INFO + ("exit - waited too long for master assert stop\n"); return -EIO; } write_register(priv->net_dev, IPW_REG_RESET_REG, IPW_AUX_HOST_RESET_REG_SW_RESET); - /* Reset any fatal_error conditions */ ipw2100_reset_fatalerror(priv); @@ -1415,7 +1404,6 @@ static int ipw2100_hw_phy_off(struct ipw2100_priv *priv) return -EIO; } - static int ipw2100_enable_adapter(struct ipw2100_priv *priv) { struct host_command cmd = { @@ -1445,9 +1433,8 @@ static int ipw2100_enable_adapter(struct ipw2100_priv *priv) err = ipw2100_wait_for_card_state(priv, IPW_HW_STATE_ENABLED); if (err) { - IPW_DEBUG_INFO( - "%s: card not responding to init command.\n", - priv->net_dev->name); + IPW_DEBUG_INFO("%s: card not responding to init command.\n", + priv->net_dev->name); goto fail_up; } @@ -1456,7 +1443,7 @@ static int ipw2100_enable_adapter(struct ipw2100_priv *priv) queue_delayed_work(priv->workqueue, &priv->hang_check, HZ / 2); } -fail_up: + fail_up: up(&priv->adapter_sem); return err; } @@ -1488,7 +1475,8 @@ static int ipw2100_hw_stop_adapter(struct ipw2100_priv *priv) err = ipw2100_hw_phy_off(priv); if (err) - printk(KERN_WARNING DRV_NAME ": Error disabling radio %d\n", err); + printk(KERN_WARNING DRV_NAME + ": Error disabling radio %d\n", err); /* * If in D0-standby mode going directly to D3 may cause a @@ -1566,7 +1554,6 @@ static int ipw2100_hw_stop_adapter(struct ipw2100_priv *priv) return 0; } - static int ipw2100_disable_adapter(struct ipw2100_priv *priv) { struct host_command cmd = { @@ -1593,19 +1580,21 @@ static int ipw2100_disable_adapter(struct ipw2100_priv *priv) err = ipw2100_hw_send_command(priv, &cmd); if (err) { - printk(KERN_WARNING DRV_NAME ": exit - failed to send CARD_DISABLE command\n"); + printk(KERN_WARNING DRV_NAME + ": exit - failed to send CARD_DISABLE command\n"); goto fail_up; } err = ipw2100_wait_for_card_state(priv, IPW_HW_STATE_DISABLED); if (err) { - printk(KERN_WARNING DRV_NAME ": exit - card failed to change to DISABLED\n"); + printk(KERN_WARNING DRV_NAME + ": exit - card failed to change to DISABLED\n"); goto fail_up; } IPW_DEBUG_INFO("TODO: implement scan state machine\n"); -fail_up: + fail_up: up(&priv->adapter_sem); return err; } @@ -1709,8 +1698,9 @@ static int ipw2100_up(struct ipw2100_priv *priv, int deferred) (priv->status & STATUS_RESET_PENDING)) { /* Power cycle the card ... */ if (ipw2100_power_cycle_adapter(priv)) { - printk(KERN_WARNING DRV_NAME ": %s: Could not cycle adapter.\n", - priv->net_dev->name); + printk(KERN_WARNING DRV_NAME + ": %s: Could not cycle adapter.\n", + priv->net_dev->name); rc = 1; goto exit; } @@ -1719,8 +1709,9 @@ static int ipw2100_up(struct ipw2100_priv *priv, int deferred) /* Load the firmware, start the clocks, etc. */ if (ipw2100_start_adapter(priv)) { - printk(KERN_ERR DRV_NAME ": %s: Failed to start the firmware.\n", - priv->net_dev->name); + printk(KERN_ERR DRV_NAME + ": %s: Failed to start the firmware.\n", + priv->net_dev->name); rc = 1; goto exit; } @@ -1729,16 +1720,18 @@ static int ipw2100_up(struct ipw2100_priv *priv, int deferred) /* Determine capabilities of this particular HW configuration */ if (ipw2100_get_hw_features(priv)) { - printk(KERN_ERR DRV_NAME ": %s: Failed to determine HW features.\n", - priv->net_dev->name); + printk(KERN_ERR DRV_NAME + ": %s: Failed to determine HW features.\n", + priv->net_dev->name); rc = 1; goto exit; } lock = LOCK_NONE; if (ipw2100_set_ordinal(priv, IPW_ORD_PERS_DB_LOCK, &lock, &ord_len)) { - printk(KERN_ERR DRV_NAME ": %s: Failed to clear ordinal lock.\n", - priv->net_dev->name); + printk(KERN_ERR DRV_NAME + ": %s: Failed to clear ordinal lock.\n", + priv->net_dev->name); rc = 1; goto exit; } @@ -1764,7 +1757,7 @@ static int ipw2100_up(struct ipw2100_priv *priv, int deferred) * HOST_COMPLETE */ if (ipw2100_adapter_setup(priv)) { printk(KERN_ERR DRV_NAME ": %s: Failed to start the card.\n", - priv->net_dev->name); + priv->net_dev->name); rc = 1; goto exit; } @@ -1773,20 +1766,19 @@ static int ipw2100_up(struct ipw2100_priv *priv, int deferred) /* Enable the adapter - sends HOST_COMPLETE */ if (ipw2100_enable_adapter(priv)) { printk(KERN_ERR DRV_NAME ": " - "%s: failed in call to enable adapter.\n", - priv->net_dev->name); + "%s: failed in call to enable adapter.\n", + priv->net_dev->name); ipw2100_hw_stop_adapter(priv); rc = 1; goto exit; } - /* Start a scan . . . */ ipw2100_set_scan_options(priv); ipw2100_start_scan(priv); } - exit: + exit: return rc; } @@ -1802,8 +1794,7 @@ static void ipw2100_down(struct ipw2100_priv *priv) unsigned long flags; union iwreq_data wrqu = { .ap_addr = { - .sa_family = ARPHRD_ETHER - } + .sa_family = ARPHRD_ETHER} }; int associated = priv->status & STATUS_ASSOCIATED; @@ -1862,8 +1853,7 @@ static void ipw2100_reset_adapter(struct ipw2100_priv *priv) unsigned long flags; union iwreq_data wrqu = { .ap_addr = { - .sa_family = ARPHRD_ETHER - } + .sa_family = ARPHRD_ETHER} }; int associated = priv->status & STATUS_ASSOCIATED; @@ -1894,7 +1884,6 @@ static void ipw2100_reset_adapter(struct ipw2100_priv *priv) } - static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status) { @@ -1904,7 +1893,7 @@ static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status) u32 txrate; u32 chan; char *txratename; - u8 bssid[ETH_ALEN]; + u8 bssid[ETH_ALEN]; /* * TBD: BSSID is usually 00:00:00:00:00:00 here and not @@ -1918,16 +1907,15 @@ static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status) essid, &essid_len); if (ret) { IPW_DEBUG_INFO("failed querying ordinals at line %d\n", - __LINE__); + __LINE__); return; } len = sizeof(u32); - ret = ipw2100_get_ordinal(priv, IPW_ORD_CURRENT_TX_RATE, - &txrate, &len); + ret = ipw2100_get_ordinal(priv, IPW_ORD_CURRENT_TX_RATE, &txrate, &len); if (ret) { IPW_DEBUG_INFO("failed querying ordinals at line %d\n", - __LINE__); + __LINE__); return; } @@ -1935,19 +1923,18 @@ static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status) ret = ipw2100_get_ordinal(priv, IPW_ORD_OUR_FREQ, &chan, &len); if (ret) { IPW_DEBUG_INFO("failed querying ordinals at line %d\n", - __LINE__); + __LINE__); return; } len = ETH_ALEN; - ipw2100_get_ordinal(priv, IPW_ORD_STAT_ASSN_AP_BSSID, &bssid, &len); + ipw2100_get_ordinal(priv, IPW_ORD_STAT_ASSN_AP_BSSID, &bssid, &len); if (ret) { IPW_DEBUG_INFO("failed querying ordinals at line %d\n", - __LINE__); + __LINE__); return; } memcpy(priv->ieee->bssid, bssid, ETH_ALEN); - switch (txrate) { case TX_RATE_1_MBIT: txratename = "1Mbps"; @@ -1974,7 +1961,7 @@ static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status) /* now we copy read ssid into dev */ if (!(priv->config & CFG_STATIC_ESSID)) { - priv->essid_len = min((u8)essid_len, (u8)IW_ESSID_MAX_SIZE); + priv->essid_len = min((u8) essid_len, (u8) IW_ESSID_MAX_SIZE); memcpy(priv->essid, essid, priv->essid_len); } priv->channel = chan; @@ -1986,7 +1973,6 @@ static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status) queue_delayed_work(priv->workqueue, &priv->wx_event_work, HZ / 10); } - static int ipw2100_set_essid(struct ipw2100_priv *priv, char *essid, int length, int batch_mode) { @@ -2001,8 +1987,7 @@ static int ipw2100_set_essid(struct ipw2100_priv *priv, char *essid, IPW_DEBUG_HC("SSID: '%s'\n", escape_essid(essid, ssid_len)); if (ssid_len) - memcpy((char*)cmd.host_command_parameters, - essid, ssid_len); + memcpy((char *)cmd.host_command_parameters, essid, ssid_len); if (!batch_mode) { err = ipw2100_disable_adapter(priv); @@ -2014,7 +1999,7 @@ static int ipw2100_set_essid(struct ipw2100_priv *priv, char *essid, * disable auto association -- so we cheat by setting a bogus SSID */ if (!ssid_len && !(priv->config & CFG_ASSOCIATE)) { int i; - u8 *bogus = (u8*)cmd.host_command_parameters; + u8 *bogus = (u8 *) cmd.host_command_parameters; for (i = 0; i < IW_ESSID_MAX_SIZE; i++) bogus[i] = 0x18 + i; cmd.host_command_length = IW_ESSID_MAX_SIZE; @@ -2025,8 +2010,7 @@ static int ipw2100_set_essid(struct ipw2100_priv *priv, char *essid, err = ipw2100_hw_send_command(priv, &cmd); if (!err) { - memset(priv->essid + ssid_len, 0, - IW_ESSID_MAX_SIZE - ssid_len); + memset(priv->essid + ssid_len, 0, IW_ESSID_MAX_SIZE - ssid_len); memcpy(priv->essid, essid, ssid_len); priv->essid_len = ssid_len; } @@ -2071,7 +2055,7 @@ static void isr_indicate_association_lost(struct ipw2100_priv *priv, u32 status) static void isr_indicate_rf_kill(struct ipw2100_priv *priv, u32 status) { IPW_DEBUG_INFO("%s: RF Kill state changed to radio OFF.\n", - priv->net_dev->name); + priv->net_dev->name); /* RF_KILL is now enabled (else we wouldn't be here) */ priv->status |= STATUS_RF_KILL_HW; @@ -2102,16 +2086,16 @@ static void isr_scan_complete(struct ipw2100_priv *priv, u32 status) #define IPW2100_HANDLER(v, f) { v, f, # v } struct ipw2100_status_indicator { int status; - void (*cb)(struct ipw2100_priv *priv, u32 status); + void (*cb) (struct ipw2100_priv * priv, u32 status); char *name; }; #else #define IPW2100_HANDLER(v, f) { v, f } struct ipw2100_status_indicator { int status; - void (*cb)(struct ipw2100_priv *priv, u32 status); + void (*cb) (struct ipw2100_priv * priv, u32 status); }; -#endif /* CONFIG_IPW_DEBUG */ +#endif /* CONFIG_IPW_DEBUG */ static void isr_indicate_scanning(struct ipw2100_priv *priv, u32 status) { @@ -2135,7 +2119,6 @@ static const struct ipw2100_status_indicator status_handlers[] = { IPW2100_HANDLER(-1, NULL) }; - static void isr_status_change(struct ipw2100_priv *priv, int status) { int i; @@ -2153,7 +2136,7 @@ static void isr_status_change(struct ipw2100_priv *priv, int status) for (i = 0; status_handlers[i].status != -1; i++) { if (status == status_handlers[i].status) { IPW_DEBUG_NOTIF("Status change: %s\n", - status_handlers[i].name); + status_handlers[i].name); if (status_handlers[i].cb) status_handlers[i].cb(priv, status); priv->wstats.status = status; @@ -2164,9 +2147,8 @@ static void isr_status_change(struct ipw2100_priv *priv, int status) IPW_DEBUG_NOTIF("unknown status received: %04x\n", status); } -static void isr_rx_complete_command( - struct ipw2100_priv *priv, - struct ipw2100_cmd_header *cmd) +static void isr_rx_complete_command(struct ipw2100_priv *priv, + struct ipw2100_cmd_header *cmd) { #ifdef CONFIG_IPW_DEBUG if (cmd->host_command_reg < ARRAY_SIZE(command_types)) { @@ -2196,10 +2178,8 @@ static const char *frame_types[] = { }; #endif - -static inline int ipw2100_alloc_skb( - struct ipw2100_priv *priv, - struct ipw2100_rx_packet *packet) +static inline int ipw2100_alloc_skb(struct ipw2100_priv *priv, + struct ipw2100_rx_packet *packet) { packet->skb = dev_alloc_skb(sizeof(struct ipw2100_rx)); if (!packet->skb) @@ -2215,7 +2195,6 @@ static inline int ipw2100_alloc_skb( return 0; } - #define SEARCH_ERROR 0xffffffff #define SEARCH_FAIL 0xfffffffe #define SEARCH_SUCCESS 0xfffffff0 @@ -2229,10 +2208,10 @@ static inline int ipw2100_snapshot_alloc(struct ipw2100_priv *priv) if (priv->snapshot[0]) return 1; for (i = 0; i < 0x30; i++) { - priv->snapshot[i] = (u8*)kmalloc(0x1000, GFP_ATOMIC); + priv->snapshot[i] = (u8 *) kmalloc(0x1000, GFP_ATOMIC); if (!priv->snapshot[i]) { IPW_DEBUG_INFO("%s: Error allocating snapshot " - "buffer %d\n", priv->net_dev->name, i); + "buffer %d\n", priv->net_dev->name, i); while (i > 0) kfree(priv->snapshot[--i]); priv->snapshot[0] = NULL; @@ -2253,7 +2232,7 @@ static inline void ipw2100_snapshot_free(struct ipw2100_priv *priv) priv->snapshot[0] = NULL; } -static inline u32 ipw2100_match_buf(struct ipw2100_priv *priv, u8 *in_buf, +static inline u32 ipw2100_match_buf(struct ipw2100_priv *priv, u8 * in_buf, size_t len, int mode) { u32 i, j; @@ -2270,9 +2249,9 @@ static inline u32 ipw2100_match_buf(struct ipw2100_priv *priv, u8 *in_buf, for (ret = SEARCH_FAIL, i = 0; i < 0x30000; i += 4) { read_nic_dword(priv->net_dev, i, &tmp); if (mode == SEARCH_SNAPSHOT) - *(u32 *)SNAPSHOT_ADDR(i) = tmp; + *(u32 *) SNAPSHOT_ADDR(i) = tmp; if (ret == SEARCH_FAIL) { - d = (u8*)&tmp; + d = (u8 *) & tmp; for (j = 0; j < 4; j++) { if (*s != *d) { s = in_buf; @@ -2310,8 +2289,7 @@ static inline u32 ipw2100_match_buf(struct ipw2100_priv *priv, u8 *in_buf, static u8 packet_data[IPW_RX_NIC_BUFFER_LENGTH]; #endif -static inline void ipw2100_corruption_detected(struct ipw2100_priv *priv, - int i) +static inline void ipw2100_corruption_detected(struct ipw2100_priv *priv, int i) { #ifdef CONFIG_IPW_DEBUG_C3 struct ipw2100_status *status = &priv->status_queue.drv[i]; @@ -2346,9 +2324,9 @@ static inline void ipw2100_corruption_detected(struct ipw2100_priv *priv, if (reg & IPW_AUX_HOST_RESET_REG_MASTER_DISABLED) break; - } while (j--); + } while (j--); - match = ipw2100_match_buf(priv, (u8*)status, + match = ipw2100_match_buf(priv, (u8 *) status, sizeof(struct ipw2100_status), SEARCH_SNAPSHOT); if (match < SEARCH_SUCCESS) @@ -2360,7 +2338,7 @@ static inline void ipw2100_corruption_detected(struct ipw2100_priv *priv, IPW_DEBUG_INFO("%s: No DMA status match in " "Firmware.\n", priv->net_dev->name); - printk_buf((u8*)priv->status_queue.drv, + printk_buf((u8 *) priv->status_queue.drv, sizeof(struct ipw2100_status) * RX_QUEUE_LENGTH); #endif @@ -2401,17 +2379,15 @@ static inline void isr_rx(struct ipw2100_priv *priv, int i, } if (unlikely(priv->ieee->iw_mode != IW_MODE_MONITOR && - !(priv->status & STATUS_ASSOCIATED))) { + !(priv->status & STATUS_ASSOCIATED))) { IPW_DEBUG_DROP("Dropping packet while not associated.\n"); priv->wstats.discard.misc++; return; } - pci_unmap_single(priv->pci_dev, packet->dma_addr, - sizeof(struct ipw2100_rx), - PCI_DMA_FROMDEVICE); + sizeof(struct ipw2100_rx), PCI_DMA_FROMDEVICE); skb_put(packet->skb, status->frame_size); @@ -2438,8 +2414,8 @@ static inline void isr_rx(struct ipw2100_priv *priv, int i, /* We need to allocate a new SKB and attach it to the RDB. */ if (unlikely(ipw2100_alloc_skb(priv, packet))) { printk(KERN_WARNING DRV_NAME ": " - "%s: Unable to allocate SKB onto RBD ring - disabling " - "adapter.\n", priv->net_dev->name); + "%s: Unable to allocate SKB onto RBD ring - disabling " + "adapter.\n", priv->net_dev->name); /* TODO: schedule adapter shutdown */ IPW_DEBUG_INFO("TODO: Shutdown adapter...\n"); } @@ -2534,11 +2510,11 @@ static inline void __ipw2100_rx_process(struct ipw2100_priv *priv) /* Sync the DMA for the STATUS buffer so CPU is sure to get * the correct values */ - pci_dma_sync_single_for_cpu( - priv->pci_dev, - sq->nic + sizeof(struct ipw2100_status) * i, - sizeof(struct ipw2100_status), - PCI_DMA_FROMDEVICE); + pci_dma_sync_single_for_cpu(priv->pci_dev, + sq->nic + + sizeof(struct ipw2100_status) * i, + sizeof(struct ipw2100_status), + PCI_DMA_FROMDEVICE); /* Sync the DMA for the RX buffer so CPU is sure to get * the correct values */ @@ -2552,8 +2528,7 @@ static inline void __ipw2100_rx_process(struct ipw2100_priv *priv) } u = packet->rxp; - frame_type = sq->drv[i].status_fields & - STATUS_TYPE_MASK; + frame_type = sq->drv[i].status_fields & STATUS_TYPE_MASK; stats.rssi = sq->drv[i].rssi + IPW2100_RSSI_TO_DBM; stats.len = sq->drv[i].frame_size; @@ -2562,16 +2537,14 @@ static inline void __ipw2100_rx_process(struct ipw2100_priv *priv) stats.mask |= IEEE80211_STATMASK_RSSI; stats.freq = IEEE80211_24GHZ_BAND; - IPW_DEBUG_RX( - "%s: '%s' frame type received (%d).\n", - priv->net_dev->name, frame_types[frame_type], - stats.len); + IPW_DEBUG_RX("%s: '%s' frame type received (%d).\n", + priv->net_dev->name, frame_types[frame_type], + stats.len); switch (frame_type) { case COMMAND_STATUS_VAL: /* Reset Rx watchdog */ - isr_rx_complete_command( - priv, &u->rx_data.command); + isr_rx_complete_command(priv, &u->rx_data.command); break; case STATUS_CHANGE_VAL: @@ -2588,12 +2561,10 @@ static inline void __ipw2100_rx_process(struct ipw2100_priv *priv) #endif if (stats.len < sizeof(u->rx_data.header)) break; - switch (WLAN_FC_GET_TYPE(u->rx_data.header. - frame_ctl)) { + switch (WLAN_FC_GET_TYPE(u->rx_data.header.frame_ctl)) { case IEEE80211_FTYPE_MGMT: ieee80211_rx_mgt(priv->ieee, - &u->rx_data.header, - &stats); + &u->rx_data.header, &stats); break; case IEEE80211_FTYPE_CTL: @@ -2607,7 +2578,7 @@ static inline void __ipw2100_rx_process(struct ipw2100_priv *priv) break; } - increment: + increment: /* clear status field associated with this RBD */ rxq->drv[i].status.info.field = 0; @@ -2619,12 +2590,10 @@ static inline void __ipw2100_rx_process(struct ipw2100_priv *priv) rxq->next = (i ? i : rxq->entries) - 1; write_register(priv->net_dev, - IPW_MEM_HOST_SHARED_RX_WRITE_INDEX, - rxq->next); + IPW_MEM_HOST_SHARED_RX_WRITE_INDEX, rxq->next); } } - /* * __ipw2100_tx_process * @@ -2667,7 +2636,7 @@ static inline void __ipw2100_rx_process(struct ipw2100_priv *priv) static inline int __ipw2100_tx_process(struct ipw2100_priv *priv) { struct ipw2100_bd_queue *txq = &priv->tx_queue; - struct ipw2100_bd *tbd; + struct ipw2100_bd *tbd; struct list_head *element; struct ipw2100_tx_packet *packet; int descriptors_used; @@ -2680,7 +2649,7 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv) element = priv->fw_pend_list.next; packet = list_entry(element, struct ipw2100_tx_packet, list); - tbd = &txq->drv[packet->index]; + tbd = &txq->drv[packet->index]; /* Determine how many TBD entries must be finished... */ switch (packet->type) { @@ -2693,14 +2662,14 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv) case DATA: /* DATA uses two slots; advance and loop position. */ descriptors_used = tbd->num_fragments; - frag_num = tbd->num_fragments - 1; + frag_num = tbd->num_fragments - 1; e = txq->oldest + frag_num; e %= txq->entries; break; default: printk(KERN_WARNING DRV_NAME ": %s: Bad fw_pend_list entry!\n", - priv->net_dev->name); + priv->net_dev->name); return 0; } @@ -2716,13 +2685,12 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv) printk(KERN_WARNING DRV_NAME ": %s: write index mismatch\n", priv->net_dev->name); - /* + /* * txq->next is the index of the last packet written txq->oldest is * the index of the r is the index of the next packet to be read by * firmware */ - /* * Quick graphic to help you visualize the following * if / else statement @@ -2750,23 +2718,20 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv) #ifdef CONFIG_IPW_DEBUG { int i = txq->oldest; - IPW_DEBUG_TX( - "TX%d V=%p P=%04X T=%04X L=%d\n", i, - &txq->drv[i], - (u32)(txq->nic + i * sizeof(struct ipw2100_bd)), - txq->drv[i].host_addr, - txq->drv[i].buf_length); + IPW_DEBUG_TX("TX%d V=%p P=%04X T=%04X L=%d\n", i, + &txq->drv[i], + (u32) (txq->nic + i * sizeof(struct ipw2100_bd)), + txq->drv[i].host_addr, txq->drv[i].buf_length); if (packet->type == DATA) { i = (i + 1) % txq->entries; - IPW_DEBUG_TX( - "TX%d V=%p P=%04X T=%04X L=%d\n", i, - &txq->drv[i], - (u32)(txq->nic + i * - sizeof(struct ipw2100_bd)), - (u32)txq->drv[i].host_addr, - txq->drv[i].buf_length); + IPW_DEBUG_TX("TX%d V=%p P=%04X T=%04X L=%d\n", i, + &txq->drv[i], + (u32) (txq->nic + i * + sizeof(struct ipw2100_bd)), + (u32) txq->drv[i].host_addr, + txq->drv[i].buf_length); } } #endif @@ -2782,21 +2747,19 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv) /* DATA packet; we have to unmap and free the SKB */ priv->ieee->stats.tx_packets++; for (i = 0; i < frag_num; i++) { - tbd = &txq->drv[(packet->index + 1 + i) % - txq->entries]; + tbd = &txq->drv[(packet->index + 1 + i) % txq->entries]; - IPW_DEBUG_TX( - "TX%d P=%08x L=%d\n", - (packet->index + 1 + i) % txq->entries, - tbd->host_addr, tbd->buf_length); + IPW_DEBUG_TX("TX%d P=%08x L=%d\n", + (packet->index + 1 + i) % txq->entries, + tbd->host_addr, tbd->buf_length); pci_unmap_single(priv->pci_dev, tbd->host_addr, - tbd->buf_length, - PCI_DMA_TODEVICE); + tbd->buf_length, PCI_DMA_TODEVICE); } - priv->ieee->stats.tx_bytes += packet->info.d_struct.txb->payload_size; + priv->ieee->stats.tx_bytes += + packet->info.d_struct.txb->payload_size; ieee80211_txb_free(packet->info.d_struct.txb); packet->info.d_struct.txb = NULL; @@ -2808,8 +2771,8 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv) if (priv->status & STATUS_ASSOCIATED && netif_queue_stopped(priv->net_dev)) { IPW_DEBUG_INFO(KERN_INFO - "%s: Waking net queue.\n", - priv->net_dev->name); + "%s: Waking net queue.\n", + priv->net_dev->name); netif_wake_queue(priv->net_dev); } @@ -2829,11 +2792,12 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv) #ifdef CONFIG_IPW_DEBUG if (packet->info.c_struct.cmd->host_command_reg < sizeof(command_types) / sizeof(*command_types)) - IPW_DEBUG_TX( - "Command '%s (%d)' processed: %d.\n", - command_types[packet->info.c_struct.cmd->host_command_reg], - packet->info.c_struct.cmd->host_command_reg, - packet->info.c_struct.cmd->cmd_status_reg); + IPW_DEBUG_TX("Command '%s (%d)' processed: %d.\n", + command_types[packet->info.c_struct.cmd-> + host_command_reg], + packet->info.c_struct.cmd-> + host_command_reg, + packet->info.c_struct.cmd->cmd_status_reg); #endif list_add_tail(element, &priv->msg_free_list); @@ -2848,17 +2812,17 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv) SET_STAT(&priv->txq_stat, txq->available); IPW_DEBUG_TX("packet latency (send to process) %ld jiffies\n", - jiffies - packet->jiffy_start); + jiffies - packet->jiffy_start); return (!list_empty(&priv->fw_pend_list)); } - static inline void __ipw2100_tx_complete(struct ipw2100_priv *priv) { int i = 0; - while (__ipw2100_tx_process(priv) && i < 200) i++; + while (__ipw2100_tx_process(priv) && i < 200) + i++; if (i == 200) { printk(KERN_WARNING DRV_NAME ": " @@ -2867,7 +2831,6 @@ static inline void __ipw2100_tx_complete(struct ipw2100_priv *priv) } } - static void ipw2100_tx_send_commands(struct ipw2100_priv *priv) { struct list_head *element; @@ -2892,13 +2855,12 @@ static void ipw2100_tx_send_commands(struct ipw2100_priv *priv) list_del(element); DEC_STAT(&priv->msg_pend_stat); - packet = list_entry(element, - struct ipw2100_tx_packet, list); + packet = list_entry(element, struct ipw2100_tx_packet, list); IPW_DEBUG_TX("using TBD at virt=%p, phys=%p\n", - &txq->drv[txq->next], - (void*)(txq->nic + txq->next * - sizeof(struct ipw2100_bd))); + &txq->drv[txq->next], + (void *)(txq->nic + txq->next * + sizeof(struct ipw2100_bd))); packet->index = txq->next; @@ -2911,8 +2873,8 @@ static void ipw2100_tx_send_commands(struct ipw2100_priv *priv) * with f/w debug version */ tbd->num_fragments = 1; tbd->status.info.field = - IPW_BD_STATUS_TX_FRAME_COMMAND | - IPW_BD_STATUS_TX_INTERRUPT_ENABLE; + IPW_BD_STATUS_TX_FRAME_COMMAND | + IPW_BD_STATUS_TX_INTERRUPT_ENABLE; /* update TBD queue counters */ txq->next++; @@ -2934,7 +2896,6 @@ static void ipw2100_tx_send_commands(struct ipw2100_priv *priv) } } - /* * ipw2100_tx_send_data * @@ -2946,7 +2907,7 @@ static void ipw2100_tx_send_data(struct ipw2100_priv *priv) struct ipw2100_bd_queue *txq = &priv->tx_queue; struct ipw2100_bd *tbd; int next = txq->next; - int i = 0; + int i = 0; struct ipw2100_data_header *ipw_hdr; struct ieee80211_hdr_3addr *hdr; @@ -2958,20 +2919,18 @@ static void ipw2100_tx_send_data(struct ipw2100_priv *priv) * maintained between the r and w indexes */ element = priv->tx_pend_list.next; - packet = list_entry(element, struct ipw2100_tx_packet, list); + packet = list_entry(element, struct ipw2100_tx_packet, list); if (unlikely(1 + packet->info.d_struct.txb->nr_frags > IPW_MAX_BDS)) { /* TODO: Support merging buffers if more than * IPW_MAX_BDS are used */ - IPW_DEBUG_INFO( - "%s: Maximum BD theshold exceeded. " - "Increase fragmentation level.\n", - priv->net_dev->name); + IPW_DEBUG_INFO("%s: Maximum BD theshold exceeded. " + "Increase fragmentation level.\n", + priv->net_dev->name); } - if (txq->available <= 3 + - packet->info.d_struct.txb->nr_frags) { + if (txq->available <= 3 + packet->info.d_struct.txb->nr_frags) { IPW_DEBUG_TX("no room in tx_queue\n"); break; } @@ -2985,7 +2944,7 @@ static void ipw2100_tx_send_data(struct ipw2100_priv *priv) ipw_hdr = packet->info.d_struct.data; hdr = (struct ieee80211_hdr_3addr *)packet->info.d_struct.txb-> - fragments[0]->data; + fragments[0]->data; if (priv->ieee->iw_mode == IW_MODE_INFRA) { /* To DS: Addr1 = BSSID, Addr2 = SA, @@ -3007,7 +2966,8 @@ static void ipw2100_tx_send_data(struct ipw2100_priv *priv) ipw_hdr->encrypted = packet->info.d_struct.txb->encrypted; if (packet->info.d_struct.txb->nr_frags > 1) ipw_hdr->fragment_size = - packet->info.d_struct.txb->frag_size - IEEE80211_3ADDR_LEN; + packet->info.d_struct.txb->frag_size - + IEEE80211_3ADDR_LEN; else ipw_hdr->fragment_size = 0; @@ -3015,54 +2975,53 @@ static void ipw2100_tx_send_data(struct ipw2100_priv *priv) tbd->buf_length = sizeof(struct ipw2100_data_header); tbd->num_fragments = 1 + packet->info.d_struct.txb->nr_frags; tbd->status.info.field = - IPW_BD_STATUS_TX_FRAME_802_3 | - IPW_BD_STATUS_TX_FRAME_NOT_LAST_FRAGMENT; + IPW_BD_STATUS_TX_FRAME_802_3 | + IPW_BD_STATUS_TX_FRAME_NOT_LAST_FRAGMENT; txq->next++; txq->next %= txq->entries; - IPW_DEBUG_TX( - "data header tbd TX%d P=%08x L=%d\n", - packet->index, tbd->host_addr, - tbd->buf_length); + IPW_DEBUG_TX("data header tbd TX%d P=%08x L=%d\n", + packet->index, tbd->host_addr, tbd->buf_length); #ifdef CONFIG_IPW_DEBUG if (packet->info.d_struct.txb->nr_frags > 1) IPW_DEBUG_FRAG("fragment Tx: %d frames\n", packet->info.d_struct.txb->nr_frags); #endif - for (i = 0; i < packet->info.d_struct.txb->nr_frags; i++) { - tbd = &txq->drv[txq->next]; + for (i = 0; i < packet->info.d_struct.txb->nr_frags; i++) { + tbd = &txq->drv[txq->next]; if (i == packet->info.d_struct.txb->nr_frags - 1) tbd->status.info.field = - IPW_BD_STATUS_TX_FRAME_802_3 | - IPW_BD_STATUS_TX_INTERRUPT_ENABLE; + IPW_BD_STATUS_TX_FRAME_802_3 | + IPW_BD_STATUS_TX_INTERRUPT_ENABLE; else tbd->status.info.field = - IPW_BD_STATUS_TX_FRAME_802_3 | - IPW_BD_STATUS_TX_FRAME_NOT_LAST_FRAGMENT; + IPW_BD_STATUS_TX_FRAME_802_3 | + IPW_BD_STATUS_TX_FRAME_NOT_LAST_FRAGMENT; tbd->buf_length = packet->info.d_struct.txb-> - fragments[i]->len - IEEE80211_3ADDR_LEN; + fragments[i]->len - IEEE80211_3ADDR_LEN; - tbd->host_addr = pci_map_single( - priv->pci_dev, - packet->info.d_struct.txb->fragments[i]->data + - IEEE80211_3ADDR_LEN, - tbd->buf_length, - PCI_DMA_TODEVICE); + tbd->host_addr = pci_map_single(priv->pci_dev, + packet->info.d_struct. + txb->fragments[i]-> + data + + IEEE80211_3ADDR_LEN, + tbd->buf_length, + PCI_DMA_TODEVICE); - IPW_DEBUG_TX( - "data frag tbd TX%d P=%08x L=%d\n", - txq->next, tbd->host_addr, tbd->buf_length); + IPW_DEBUG_TX("data frag tbd TX%d P=%08x L=%d\n", + txq->next, tbd->host_addr, + tbd->buf_length); - pci_dma_sync_single_for_device( - priv->pci_dev, tbd->host_addr, - tbd->buf_length, - PCI_DMA_TODEVICE); + pci_dma_sync_single_for_device(priv->pci_dev, + tbd->host_addr, + tbd->buf_length, + PCI_DMA_TODEVICE); txq->next++; txq->next %= txq->entries; - } + } txq->available -= 1 + packet->info.d_struct.txb->nr_frags; SET_STAT(&priv->txq_stat, txq->available); @@ -3078,7 +3037,7 @@ static void ipw2100_tx_send_data(struct ipw2100_priv *priv) IPW_MEM_HOST_SHARED_TX_QUEUE_WRITE_INDEX, txq->next); } - return; + return; } static void ipw2100_irq_tasklet(struct ipw2100_priv *priv) @@ -3106,11 +3065,9 @@ static void ipw2100_irq_tasklet(struct ipw2100_priv *priv) if (inta & IPW2100_INTA_FATAL_ERROR) { printk(KERN_WARNING DRV_NAME - ": Fatal interrupt. Scheduling firmware restart.\n"); + ": Fatal interrupt. Scheduling firmware restart.\n"); priv->inta_other++; - write_register( - dev, IPW_REG_INTA, - IPW2100_INTA_FATAL_ERROR); + write_register(dev, IPW_REG_INTA, IPW2100_INTA_FATAL_ERROR); read_nic_dword(dev, IPW_NIC_FATAL_ERROR, &priv->fatal_error); IPW_DEBUG_INFO("%s: Fatal error value: 0x%08X\n", @@ -3125,11 +3082,10 @@ static void ipw2100_irq_tasklet(struct ipw2100_priv *priv) } if (inta & IPW2100_INTA_PARITY_ERROR) { - printk(KERN_ERR DRV_NAME ": ***** PARITY ERROR INTERRUPT !!!! \n"); + printk(KERN_ERR DRV_NAME + ": ***** PARITY ERROR INTERRUPT !!!! \n"); priv->inta_other++; - write_register( - dev, IPW_REG_INTA, - IPW2100_INTA_PARITY_ERROR); + write_register(dev, IPW_REG_INTA, IPW2100_INTA_PARITY_ERROR); } if (inta & IPW2100_INTA_RX_TRANSFER) { @@ -3137,9 +3093,7 @@ static void ipw2100_irq_tasklet(struct ipw2100_priv *priv) priv->rx_interrupts++; - write_register( - dev, IPW_REG_INTA, - IPW2100_INTA_RX_TRANSFER); + write_register(dev, IPW_REG_INTA, IPW2100_INTA_RX_TRANSFER); __ipw2100_rx_process(priv); __ipw2100_tx_complete(priv); @@ -3150,8 +3104,7 @@ static void ipw2100_irq_tasklet(struct ipw2100_priv *priv) priv->tx_interrupts++; - write_register(dev, IPW_REG_INTA, - IPW2100_INTA_TX_TRANSFER); + write_register(dev, IPW_REG_INTA, IPW2100_INTA_TX_TRANSFER); __ipw2100_tx_complete(priv); ipw2100_tx_send_commands(priv); @@ -3161,9 +3114,7 @@ static void ipw2100_irq_tasklet(struct ipw2100_priv *priv) if (inta & IPW2100_INTA_TX_COMPLETE) { IPW_DEBUG_ISR("TX complete\n"); priv->inta_other++; - write_register( - dev, IPW_REG_INTA, - IPW2100_INTA_TX_COMPLETE); + write_register(dev, IPW_REG_INTA, IPW2100_INTA_TX_COMPLETE); __ipw2100_tx_complete(priv); } @@ -3171,9 +3122,7 @@ static void ipw2100_irq_tasklet(struct ipw2100_priv *priv) if (inta & IPW2100_INTA_EVENT_INTERRUPT) { /* ipw2100_handle_event(dev); */ priv->inta_other++; - write_register( - dev, IPW_REG_INTA, - IPW2100_INTA_EVENT_INTERRUPT); + write_register(dev, IPW_REG_INTA, IPW2100_INTA_EVENT_INTERRUPT); } if (inta & IPW2100_INTA_FW_INIT_DONE) { @@ -3183,30 +3132,25 @@ static void ipw2100_irq_tasklet(struct ipw2100_priv *priv) read_register(dev, IPW_REG_INTA, &tmp); if (tmp & (IPW2100_INTA_FATAL_ERROR | IPW2100_INTA_PARITY_ERROR)) { - write_register( - dev, IPW_REG_INTA, - IPW2100_INTA_FATAL_ERROR | - IPW2100_INTA_PARITY_ERROR); + write_register(dev, IPW_REG_INTA, + IPW2100_INTA_FATAL_ERROR | + IPW2100_INTA_PARITY_ERROR); } - write_register(dev, IPW_REG_INTA, - IPW2100_INTA_FW_INIT_DONE); + write_register(dev, IPW_REG_INTA, IPW2100_INTA_FW_INIT_DONE); } if (inta & IPW2100_INTA_STATUS_CHANGE) { IPW_DEBUG_ISR("Status change interrupt\n"); priv->inta_other++; - write_register( - dev, IPW_REG_INTA, - IPW2100_INTA_STATUS_CHANGE); + write_register(dev, IPW_REG_INTA, IPW2100_INTA_STATUS_CHANGE); } if (inta & IPW2100_INTA_SLAVE_MODE_HOST_COMMAND_DONE) { IPW_DEBUG_ISR("slave host mode interrupt\n"); priv->inta_other++; - write_register( - dev, IPW_REG_INTA, - IPW2100_INTA_SLAVE_MODE_HOST_COMMAND_DONE); + write_register(dev, IPW_REG_INTA, + IPW2100_INTA_SLAVE_MODE_HOST_COMMAND_DONE); } priv->in_isr--; @@ -3217,9 +3161,7 @@ static void ipw2100_irq_tasklet(struct ipw2100_priv *priv) IPW_DEBUG_ISR("exit\n"); } - -static irqreturn_t ipw2100_interrupt(int irq, void *data, - struct pt_regs *regs) +static irqreturn_t ipw2100_interrupt(int irq, void *data, struct pt_regs *regs) { struct ipw2100_priv *priv = data; u32 inta, inta_mask; @@ -3227,7 +3169,7 @@ static irqreturn_t ipw2100_interrupt(int irq, void *data, if (!data) return IRQ_NONE; - spin_lock(&priv->low_lock); + spin_lock(&priv->low_lock); /* We check to see if we should be ignoring interrupts before * we touch the hardware. During ucode load if we try and handle @@ -3261,10 +3203,10 @@ static irqreturn_t ipw2100_interrupt(int irq, void *data, ipw2100_disable_interrupts(priv); tasklet_schedule(&priv->irq_tasklet); - spin_unlock(&priv->low_lock); + spin_unlock(&priv->low_lock); return IRQ_HANDLED; - none: + none: spin_unlock(&priv->low_lock); return IRQ_NONE; } @@ -3294,10 +3236,8 @@ static int ipw2100_tx(struct ieee80211_txb *txb, struct net_device *dev, packet->info.d_struct.txb = txb; - IPW_DEBUG_TX("Sending fragment (%d bytes):\n", - txb->fragments[0]->len); - printk_buf(IPW_DL_TX, txb->fragments[0]->data, - txb->fragments[0]->len); + IPW_DEBUG_TX("Sending fragment (%d bytes):\n", txb->fragments[0]->len); + printk_buf(IPW_DL_TX, txb->fragments[0]->data, txb->fragments[0]->len); packet->jiffy_start = jiffies; @@ -3312,22 +3252,23 @@ static int ipw2100_tx(struct ieee80211_txb *txb, struct net_device *dev, spin_unlock_irqrestore(&priv->low_lock, flags); return 0; - fail_unlock: + fail_unlock: netif_stop_queue(dev); spin_unlock_irqrestore(&priv->low_lock, flags); return 1; } - static int ipw2100_msg_allocate(struct ipw2100_priv *priv) { int i, j, err = -EINVAL; void *v; dma_addr_t p; - priv->msg_buffers = (struct ipw2100_tx_packet *)kmalloc( - IPW_COMMAND_POOL_SIZE * sizeof(struct ipw2100_tx_packet), - GFP_KERNEL); + priv->msg_buffers = + (struct ipw2100_tx_packet *)kmalloc(IPW_COMMAND_POOL_SIZE * + sizeof(struct + ipw2100_tx_packet), + GFP_KERNEL); if (!priv->msg_buffers) { printk(KERN_ERR DRV_NAME ": %s: PCI alloc failed for msg " "buffers.\n", priv->net_dev->name); @@ -3335,15 +3276,12 @@ static int ipw2100_msg_allocate(struct ipw2100_priv *priv) } for (i = 0; i < IPW_COMMAND_POOL_SIZE; i++) { - v = pci_alloc_consistent( - priv->pci_dev, - sizeof(struct ipw2100_cmd_header), - &p); + v = pci_alloc_consistent(priv->pci_dev, + sizeof(struct ipw2100_cmd_header), &p); if (!v) { printk(KERN_ERR DRV_NAME ": " "%s: PCI alloc failed for msg " - "buffers.\n", - priv->net_dev->name); + "buffers.\n", priv->net_dev->name); err = -ENOMEM; break; } @@ -3352,7 +3290,7 @@ static int ipw2100_msg_allocate(struct ipw2100_priv *priv) priv->msg_buffers[i].type = COMMAND; priv->msg_buffers[i].info.c_struct.cmd = - (struct ipw2100_cmd_header*)v; + (struct ipw2100_cmd_header *)v; priv->msg_buffers[i].info.c_struct.cmd_phys = p; } @@ -3360,11 +3298,11 @@ static int ipw2100_msg_allocate(struct ipw2100_priv *priv) return 0; for (j = 0; j < i; j++) { - pci_free_consistent( - priv->pci_dev, - sizeof(struct ipw2100_cmd_header), - priv->msg_buffers[j].info.c_struct.cmd, - priv->msg_buffers[j].info.c_struct.cmd_phys); + pci_free_consistent(priv->pci_dev, + sizeof(struct ipw2100_cmd_header), + priv->msg_buffers[j].info.c_struct.cmd, + priv->msg_buffers[j].info.c_struct. + cmd_phys); } kfree(priv->msg_buffers); @@ -3398,7 +3336,8 @@ static void ipw2100_msg_free(struct ipw2100_priv *priv) pci_free_consistent(priv->pci_dev, sizeof(struct ipw2100_cmd_header), priv->msg_buffers[i].info.c_struct.cmd, - priv->msg_buffers[i].info.c_struct.cmd_phys); + priv->msg_buffers[i].info.c_struct. + cmd_phys); } kfree(priv->msg_buffers); @@ -3424,6 +3363,7 @@ static ssize_t show_pci(struct device *d, struct device_attribute *attr, return out - buf; } + static DEVICE_ATTR(pci, S_IRUGO, show_pci, NULL); static ssize_t show_cfg(struct device *d, struct device_attribute *attr, @@ -3432,209 +3372,269 @@ static ssize_t show_cfg(struct device *d, struct device_attribute *attr, struct ipw2100_priv *p = d->driver_data; return sprintf(buf, "0x%08x\n", (int)p->config); } + static DEVICE_ATTR(cfg, S_IRUGO, show_cfg, NULL); static ssize_t show_status(struct device *d, struct device_attribute *attr, - char *buf) + char *buf) { struct ipw2100_priv *p = d->driver_data; return sprintf(buf, "0x%08x\n", (int)p->status); } + static DEVICE_ATTR(status, S_IRUGO, show_status, NULL); static ssize_t show_capability(struct device *d, struct device_attribute *attr, - char *buf) + char *buf) { struct ipw2100_priv *p = d->driver_data; return sprintf(buf, "0x%08x\n", (int)p->capability); } -static DEVICE_ATTR(capability, S_IRUGO, show_capability, NULL); +static DEVICE_ATTR(capability, S_IRUGO, show_capability, NULL); #define IPW2100_REG(x) { IPW_ ##x, #x } static const struct { u32 addr; const char *name; } hw_data[] = { - IPW2100_REG(REG_GP_CNTRL), - IPW2100_REG(REG_GPIO), - IPW2100_REG(REG_INTA), - IPW2100_REG(REG_INTA_MASK), - IPW2100_REG(REG_RESET_REG), -}; +IPW2100_REG(REG_GP_CNTRL), + IPW2100_REG(REG_GPIO), + IPW2100_REG(REG_INTA), + IPW2100_REG(REG_INTA_MASK), IPW2100_REG(REG_RESET_REG),}; #define IPW2100_NIC(x, s) { x, #x, s } static const struct { u32 addr; const char *name; size_t size; } nic_data[] = { - IPW2100_NIC(IPW2100_CONTROL_REG, 2), - IPW2100_NIC(0x210014, 1), - IPW2100_NIC(0x210000, 1), -}; +IPW2100_NIC(IPW2100_CONTROL_REG, 2), + IPW2100_NIC(0x210014, 1), IPW2100_NIC(0x210000, 1),}; #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } static const struct { u8 index; const char *name; const char *desc; } ord_data[] = { - IPW2100_ORD(STAT_TX_HOST_REQUESTS, "requested Host Tx's (MSDU)"), - IPW2100_ORD(STAT_TX_HOST_COMPLETE, "successful Host Tx's (MSDU)"), - IPW2100_ORD(STAT_TX_DIR_DATA, "successful Directed Tx's (MSDU)"), - IPW2100_ORD(STAT_TX_DIR_DATA1, "successful Directed Tx's (MSDU) @ 1MB"), - IPW2100_ORD(STAT_TX_DIR_DATA2, "successful Directed Tx's (MSDU) @ 2MB"), - IPW2100_ORD(STAT_TX_DIR_DATA5_5, "successful Directed Tx's (MSDU) @ 5_5MB"), - IPW2100_ORD(STAT_TX_DIR_DATA11, "successful Directed Tx's (MSDU) @ 11MB"), - IPW2100_ORD(STAT_TX_NODIR_DATA1, "successful Non_Directed Tx's (MSDU) @ 1MB"), - IPW2100_ORD(STAT_TX_NODIR_DATA2, "successful Non_Directed Tx's (MSDU) @ 2MB"), - IPW2100_ORD(STAT_TX_NODIR_DATA5_5, "successful Non_Directed Tx's (MSDU) @ 5.5MB"), - IPW2100_ORD(STAT_TX_NODIR_DATA11, "successful Non_Directed Tx's (MSDU) @ 11MB"), - IPW2100_ORD(STAT_NULL_DATA, "successful NULL data Tx's"), - IPW2100_ORD(STAT_TX_RTS, "successful Tx RTS"), - IPW2100_ORD(STAT_TX_CTS, "successful Tx CTS"), - IPW2100_ORD(STAT_TX_ACK, "successful Tx ACK"), - IPW2100_ORD(STAT_TX_ASSN, "successful Association Tx's"), - IPW2100_ORD(STAT_TX_ASSN_RESP, "successful Association response Tx's"), - IPW2100_ORD(STAT_TX_REASSN, "successful Reassociation Tx's"), - IPW2100_ORD(STAT_TX_REASSN_RESP, "successful Reassociation response Tx's"), - IPW2100_ORD(STAT_TX_PROBE, "probes successfully transmitted"), - IPW2100_ORD(STAT_TX_PROBE_RESP, "probe responses successfully transmitted"), - IPW2100_ORD(STAT_TX_BEACON, "tx beacon"), - IPW2100_ORD(STAT_TX_ATIM, "Tx ATIM"), - IPW2100_ORD(STAT_TX_DISASSN, "successful Disassociation TX"), - IPW2100_ORD(STAT_TX_AUTH, "successful Authentication Tx"), - IPW2100_ORD(STAT_TX_DEAUTH, "successful Deauthentication TX"), - IPW2100_ORD(STAT_TX_TOTAL_BYTES, "Total successful Tx data bytes"), - IPW2100_ORD(STAT_TX_RETRIES, "Tx retries"), - IPW2100_ORD(STAT_TX_RETRY1, "Tx retries at 1MBPS"), - IPW2100_ORD(STAT_TX_RETRY2, "Tx retries at 2MBPS"), - IPW2100_ORD(STAT_TX_RETRY5_5, "Tx retries at 5.5MBPS"), - IPW2100_ORD(STAT_TX_RETRY11, "Tx retries at 11MBPS"), - IPW2100_ORD(STAT_TX_FAILURES, "Tx Failures"), - IPW2100_ORD(STAT_TX_MAX_TRIES_IN_HOP,"times max tries in a hop failed"), - IPW2100_ORD(STAT_TX_DISASSN_FAIL, "times disassociation failed"), - IPW2100_ORD(STAT_TX_ERR_CTS, "missed/bad CTS frames"), - IPW2100_ORD(STAT_TX_ERR_ACK, "tx err due to acks"), - IPW2100_ORD(STAT_RX_HOST, "packets passed to host"), - IPW2100_ORD(STAT_RX_DIR_DATA, "directed packets"), - IPW2100_ORD(STAT_RX_DIR_DATA1, "directed packets at 1MB"), - IPW2100_ORD(STAT_RX_DIR_DATA2, "directed packets at 2MB"), - IPW2100_ORD(STAT_RX_DIR_DATA5_5, "directed packets at 5.5MB"), - IPW2100_ORD(STAT_RX_DIR_DATA11, "directed packets at 11MB"), - IPW2100_ORD(STAT_RX_NODIR_DATA,"nondirected packets"), - IPW2100_ORD(STAT_RX_NODIR_DATA1, "nondirected packets at 1MB"), - IPW2100_ORD(STAT_RX_NODIR_DATA2, "nondirected packets at 2MB"), - IPW2100_ORD(STAT_RX_NODIR_DATA5_5, "nondirected packets at 5.5MB"), - IPW2100_ORD(STAT_RX_NODIR_DATA11, "nondirected packets at 11MB"), - IPW2100_ORD(STAT_RX_NULL_DATA, "null data rx's"), - IPW2100_ORD(STAT_RX_RTS, "Rx RTS"), - IPW2100_ORD(STAT_RX_CTS, "Rx CTS"), - IPW2100_ORD(STAT_RX_ACK, "Rx ACK"), - IPW2100_ORD(STAT_RX_CFEND, "Rx CF End"), - IPW2100_ORD(STAT_RX_CFEND_ACK, "Rx CF End + CF Ack"), - IPW2100_ORD(STAT_RX_ASSN, "Association Rx's"), - IPW2100_ORD(STAT_RX_ASSN_RESP, "Association response Rx's"), - IPW2100_ORD(STAT_RX_REASSN, "Reassociation Rx's"), - IPW2100_ORD(STAT_RX_REASSN_RESP, "Reassociation response Rx's"), - IPW2100_ORD(STAT_RX_PROBE, "probe Rx's"), - IPW2100_ORD(STAT_RX_PROBE_RESP, "probe response Rx's"), - IPW2100_ORD(STAT_RX_BEACON, "Rx beacon"), - IPW2100_ORD(STAT_RX_ATIM, "Rx ATIM"), - IPW2100_ORD(STAT_RX_DISASSN, "disassociation Rx"), - IPW2100_ORD(STAT_RX_AUTH, "authentication Rx"), - IPW2100_ORD(STAT_RX_DEAUTH, "deauthentication Rx"), - IPW2100_ORD(STAT_RX_TOTAL_BYTES,"Total rx data bytes received"), - IPW2100_ORD(STAT_RX_ERR_CRC, "packets with Rx CRC error"), - IPW2100_ORD(STAT_RX_ERR_CRC1, "Rx CRC errors at 1MB"), - IPW2100_ORD(STAT_RX_ERR_CRC2, "Rx CRC errors at 2MB"), - IPW2100_ORD(STAT_RX_ERR_CRC5_5, "Rx CRC errors at 5.5MB"), - IPW2100_ORD(STAT_RX_ERR_CRC11, "Rx CRC errors at 11MB"), - IPW2100_ORD(STAT_RX_DUPLICATE1, "duplicate rx packets at 1MB"), - IPW2100_ORD(STAT_RX_DUPLICATE2, "duplicate rx packets at 2MB"), - IPW2100_ORD(STAT_RX_DUPLICATE5_5, "duplicate rx packets at 5.5MB"), - IPW2100_ORD(STAT_RX_DUPLICATE11, "duplicate rx packets at 11MB"), - IPW2100_ORD(STAT_RX_DUPLICATE, "duplicate rx packets"), - IPW2100_ORD(PERS_DB_LOCK, "locking fw permanent db"), - IPW2100_ORD(PERS_DB_SIZE, "size of fw permanent db"), - IPW2100_ORD(PERS_DB_ADDR, "address of fw permanent db"), - IPW2100_ORD(STAT_RX_INVALID_PROTOCOL, "rx frames with invalid protocol"), - IPW2100_ORD(SYS_BOOT_TIME, "Boot time"), - IPW2100_ORD(STAT_RX_NO_BUFFER, "rx frames rejected due to no buffer"), - IPW2100_ORD(STAT_RX_MISSING_FRAG, "rx frames dropped due to missing fragment"), - IPW2100_ORD(STAT_RX_ORPHAN_FRAG, "rx frames dropped due to non-sequential fragment"), - IPW2100_ORD(STAT_RX_ORPHAN_FRAME, "rx frames dropped due to unmatched 1st frame"), - IPW2100_ORD(STAT_RX_FRAG_AGEOUT, "rx frames dropped due to uncompleted frame"), - IPW2100_ORD(STAT_RX_ICV_ERRORS, "ICV errors during decryption"), - IPW2100_ORD(STAT_PSP_SUSPENSION,"times adapter suspended"), - IPW2100_ORD(STAT_PSP_BCN_TIMEOUT, "beacon timeout"), - IPW2100_ORD(STAT_PSP_POLL_TIMEOUT, "poll response timeouts"), - IPW2100_ORD(STAT_PSP_NONDIR_TIMEOUT, "timeouts waiting for last {broad,multi}cast pkt"), - IPW2100_ORD(STAT_PSP_RX_DTIMS, "PSP DTIMs received"), - IPW2100_ORD(STAT_PSP_RX_TIMS, "PSP TIMs received"), - IPW2100_ORD(STAT_PSP_STATION_ID,"PSP Station ID"), - IPW2100_ORD(LAST_ASSN_TIME, "RTC time of last association"), - IPW2100_ORD(STAT_PERCENT_MISSED_BCNS,"current calculation of % missed beacons"), - IPW2100_ORD(STAT_PERCENT_RETRIES,"current calculation of % missed tx retries"), - IPW2100_ORD(ASSOCIATED_AP_PTR, "0 if not associated, else pointer to AP table entry"), - IPW2100_ORD(AVAILABLE_AP_CNT, "AP's decsribed in the AP table"), - IPW2100_ORD(AP_LIST_PTR, "Ptr to list of available APs"), - IPW2100_ORD(STAT_AP_ASSNS, "associations"), - IPW2100_ORD(STAT_ASSN_FAIL, "association failures"), - IPW2100_ORD(STAT_ASSN_RESP_FAIL,"failures due to response fail"), - IPW2100_ORD(STAT_FULL_SCANS, "full scans"), - IPW2100_ORD(CARD_DISABLED, "Card Disabled"), - IPW2100_ORD(STAT_ROAM_INHIBIT, "times roaming was inhibited due to activity"), - IPW2100_ORD(RSSI_AT_ASSN, "RSSI of associated AP at time of association"), - IPW2100_ORD(STAT_ASSN_CAUSE1, "reassociation: no probe response or TX on hop"), - IPW2100_ORD(STAT_ASSN_CAUSE2, "reassociation: poor tx/rx quality"), - IPW2100_ORD(STAT_ASSN_CAUSE3, "reassociation: tx/rx quality (excessive AP load"), - IPW2100_ORD(STAT_ASSN_CAUSE4, "reassociation: AP RSSI level"), - IPW2100_ORD(STAT_ASSN_CAUSE5, "reassociations due to load leveling"), - IPW2100_ORD(STAT_AUTH_FAIL, "times authentication failed"), - IPW2100_ORD(STAT_AUTH_RESP_FAIL,"times authentication response failed"), - IPW2100_ORD(STATION_TABLE_CNT, "entries in association table"), - IPW2100_ORD(RSSI_AVG_CURR, "Current avg RSSI"), - IPW2100_ORD(POWER_MGMT_MODE, "Power mode - 0=CAM, 1=PSP"), - IPW2100_ORD(COUNTRY_CODE, "IEEE country code as recv'd from beacon"), - IPW2100_ORD(COUNTRY_CHANNELS, "channels suported by country"), - IPW2100_ORD(RESET_CNT, "adapter resets (warm)"), - IPW2100_ORD(BEACON_INTERVAL, "Beacon interval"), - IPW2100_ORD(ANTENNA_DIVERSITY, "TRUE if antenna diversity is disabled"), - IPW2100_ORD(DTIM_PERIOD, "beacon intervals between DTIMs"), - IPW2100_ORD(OUR_FREQ, "current radio freq lower digits - channel ID"), - IPW2100_ORD(RTC_TIME, "current RTC time"), - IPW2100_ORD(PORT_TYPE, "operating mode"), - IPW2100_ORD(CURRENT_TX_RATE, "current tx rate"), - IPW2100_ORD(SUPPORTED_RATES, "supported tx rates"), - IPW2100_ORD(ATIM_WINDOW, "current ATIM Window"), - IPW2100_ORD(BASIC_RATES, "basic tx rates"), - IPW2100_ORD(NIC_HIGHEST_RATE, "NIC highest tx rate"), - IPW2100_ORD(AP_HIGHEST_RATE, "AP highest tx rate"), - IPW2100_ORD(CAPABILITIES, "Management frame capability field"), - IPW2100_ORD(AUTH_TYPE, "Type of authentication"), - IPW2100_ORD(RADIO_TYPE, "Adapter card platform type"), - IPW2100_ORD(RTS_THRESHOLD, "Min packet length for RTS handshaking"), - IPW2100_ORD(INT_MODE, "International mode"), - IPW2100_ORD(FRAGMENTATION_THRESHOLD, "protocol frag threshold"), - IPW2100_ORD(EEPROM_SRAM_DB_BLOCK_START_ADDRESS, "EEPROM offset in SRAM"), - IPW2100_ORD(EEPROM_SRAM_DB_BLOCK_SIZE, "EEPROM size in SRAM"), - IPW2100_ORD(EEPROM_SKU_CAPABILITY, "EEPROM SKU Capability"), - IPW2100_ORD(EEPROM_IBSS_11B_CHANNELS, "EEPROM IBSS 11b channel set"), - IPW2100_ORD(MAC_VERSION, "MAC Version"), - IPW2100_ORD(MAC_REVISION, "MAC Revision"), - IPW2100_ORD(RADIO_VERSION, "Radio Version"), - IPW2100_ORD(NIC_MANF_DATE_TIME, "MANF Date/Time STAMP"), - IPW2100_ORD(UCODE_VERSION, "Ucode Version"), -}; - +IPW2100_ORD(STAT_TX_HOST_REQUESTS, "requested Host Tx's (MSDU)"), + IPW2100_ORD(STAT_TX_HOST_COMPLETE, + "successful Host Tx's (MSDU)"), + IPW2100_ORD(STAT_TX_DIR_DATA, + "successful Directed Tx's (MSDU)"), + IPW2100_ORD(STAT_TX_DIR_DATA1, + "successful Directed Tx's (MSDU) @ 1MB"), + IPW2100_ORD(STAT_TX_DIR_DATA2, + "successful Directed Tx's (MSDU) @ 2MB"), + IPW2100_ORD(STAT_TX_DIR_DATA5_5, + "successful Directed Tx's (MSDU) @ 5_5MB"), + IPW2100_ORD(STAT_TX_DIR_DATA11, + "successful Directed Tx's (MSDU) @ 11MB"), + IPW2100_ORD(STAT_TX_NODIR_DATA1, + "successful Non_Directed Tx's (MSDU) @ 1MB"), + IPW2100_ORD(STAT_TX_NODIR_DATA2, + "successful Non_Directed Tx's (MSDU) @ 2MB"), + IPW2100_ORD(STAT_TX_NODIR_DATA5_5, + "successful Non_Directed Tx's (MSDU) @ 5.5MB"), + IPW2100_ORD(STAT_TX_NODIR_DATA11, + "successful Non_Directed Tx's (MSDU) @ 11MB"), + IPW2100_ORD(STAT_NULL_DATA, "successful NULL data Tx's"), + IPW2100_ORD(STAT_TX_RTS, "successful Tx RTS"), + IPW2100_ORD(STAT_TX_CTS, "successful Tx CTS"), + IPW2100_ORD(STAT_TX_ACK, "successful Tx ACK"), + IPW2100_ORD(STAT_TX_ASSN, "successful Association Tx's"), + IPW2100_ORD(STAT_TX_ASSN_RESP, + "successful Association response Tx's"), + IPW2100_ORD(STAT_TX_REASSN, + "successful Reassociation Tx's"), + IPW2100_ORD(STAT_TX_REASSN_RESP, + "successful Reassociation response Tx's"), + IPW2100_ORD(STAT_TX_PROBE, + "probes successfully transmitted"), + IPW2100_ORD(STAT_TX_PROBE_RESP, + "probe responses successfully transmitted"), + IPW2100_ORD(STAT_TX_BEACON, "tx beacon"), + IPW2100_ORD(STAT_TX_ATIM, "Tx ATIM"), + IPW2100_ORD(STAT_TX_DISASSN, + "successful Disassociation TX"), + IPW2100_ORD(STAT_TX_AUTH, "successful Authentication Tx"), + IPW2100_ORD(STAT_TX_DEAUTH, + "successful Deauthentication TX"), + IPW2100_ORD(STAT_TX_TOTAL_BYTES, + "Total successful Tx data bytes"), + IPW2100_ORD(STAT_TX_RETRIES, "Tx retries"), + IPW2100_ORD(STAT_TX_RETRY1, "Tx retries at 1MBPS"), + IPW2100_ORD(STAT_TX_RETRY2, "Tx retries at 2MBPS"), + IPW2100_ORD(STAT_TX_RETRY5_5, "Tx retries at 5.5MBPS"), + IPW2100_ORD(STAT_TX_RETRY11, "Tx retries at 11MBPS"), + IPW2100_ORD(STAT_TX_FAILURES, "Tx Failures"), + IPW2100_ORD(STAT_TX_MAX_TRIES_IN_HOP, + "times max tries in a hop failed"), + IPW2100_ORD(STAT_TX_DISASSN_FAIL, + "times disassociation failed"), + IPW2100_ORD(STAT_TX_ERR_CTS, "missed/bad CTS frames"), + IPW2100_ORD(STAT_TX_ERR_ACK, "tx err due to acks"), + IPW2100_ORD(STAT_RX_HOST, "packets passed to host"), + IPW2100_ORD(STAT_RX_DIR_DATA, "directed packets"), + IPW2100_ORD(STAT_RX_DIR_DATA1, "directed packets at 1MB"), + IPW2100_ORD(STAT_RX_DIR_DATA2, "directed packets at 2MB"), + IPW2100_ORD(STAT_RX_DIR_DATA5_5, + "directed packets at 5.5MB"), + IPW2100_ORD(STAT_RX_DIR_DATA11, "directed packets at 11MB"), + IPW2100_ORD(STAT_RX_NODIR_DATA, "nondirected packets"), + IPW2100_ORD(STAT_RX_NODIR_DATA1, + "nondirected packets at 1MB"), + IPW2100_ORD(STAT_RX_NODIR_DATA2, + "nondirected packets at 2MB"), + IPW2100_ORD(STAT_RX_NODIR_DATA5_5, + "nondirected packets at 5.5MB"), + IPW2100_ORD(STAT_RX_NODIR_DATA11, + "nondirected packets at 11MB"), + IPW2100_ORD(STAT_RX_NULL_DATA, "null data rx's"), + IPW2100_ORD(STAT_RX_RTS, "Rx RTS"), IPW2100_ORD(STAT_RX_CTS, + "Rx CTS"), + IPW2100_ORD(STAT_RX_ACK, "Rx ACK"), + IPW2100_ORD(STAT_RX_CFEND, "Rx CF End"), + IPW2100_ORD(STAT_RX_CFEND_ACK, "Rx CF End + CF Ack"), + IPW2100_ORD(STAT_RX_ASSN, "Association Rx's"), + IPW2100_ORD(STAT_RX_ASSN_RESP, "Association response Rx's"), + IPW2100_ORD(STAT_RX_REASSN, "Reassociation Rx's"), + IPW2100_ORD(STAT_RX_REASSN_RESP, + "Reassociation response Rx's"), + IPW2100_ORD(STAT_RX_PROBE, "probe Rx's"), + IPW2100_ORD(STAT_RX_PROBE_RESP, "probe response Rx's"), + IPW2100_ORD(STAT_RX_BEACON, "Rx beacon"), + IPW2100_ORD(STAT_RX_ATIM, "Rx ATIM"), + IPW2100_ORD(STAT_RX_DISASSN, "disassociation Rx"), + IPW2100_ORD(STAT_RX_AUTH, "authentication Rx"), + IPW2100_ORD(STAT_RX_DEAUTH, "deauthentication Rx"), + IPW2100_ORD(STAT_RX_TOTAL_BYTES, + "Total rx data bytes received"), + IPW2100_ORD(STAT_RX_ERR_CRC, "packets with Rx CRC error"), + IPW2100_ORD(STAT_RX_ERR_CRC1, "Rx CRC errors at 1MB"), + IPW2100_ORD(STAT_RX_ERR_CRC2, "Rx CRC errors at 2MB"), + IPW2100_ORD(STAT_RX_ERR_CRC5_5, "Rx CRC errors at 5.5MB"), + IPW2100_ORD(STAT_RX_ERR_CRC11, "Rx CRC errors at 11MB"), + IPW2100_ORD(STAT_RX_DUPLICATE1, + "duplicate rx packets at 1MB"), + IPW2100_ORD(STAT_RX_DUPLICATE2, + "duplicate rx packets at 2MB"), + IPW2100_ORD(STAT_RX_DUPLICATE5_5, + "duplicate rx packets at 5.5MB"), + IPW2100_ORD(STAT_RX_DUPLICATE11, + "duplicate rx packets at 11MB"), + IPW2100_ORD(STAT_RX_DUPLICATE, "duplicate rx packets"), + IPW2100_ORD(PERS_DB_LOCK, "locking fw permanent db"), + IPW2100_ORD(PERS_DB_SIZE, "size of fw permanent db"), + IPW2100_ORD(PERS_DB_ADDR, "address of fw permanent db"), + IPW2100_ORD(STAT_RX_INVALID_PROTOCOL, + "rx frames with invalid protocol"), + IPW2100_ORD(SYS_BOOT_TIME, "Boot time"), + IPW2100_ORD(STAT_RX_NO_BUFFER, + "rx frames rejected due to no buffer"), + IPW2100_ORD(STAT_RX_MISSING_FRAG, + "rx frames dropped due to missing fragment"), + IPW2100_ORD(STAT_RX_ORPHAN_FRAG, + "rx frames dropped due to non-sequential fragment"), + IPW2100_ORD(STAT_RX_ORPHAN_FRAME, + "rx frames dropped due to unmatched 1st frame"), + IPW2100_ORD(STAT_RX_FRAG_AGEOUT, + "rx frames dropped due to uncompleted frame"), + IPW2100_ORD(STAT_RX_ICV_ERRORS, + "ICV errors during decryption"), + IPW2100_ORD(STAT_PSP_SUSPENSION, "times adapter suspended"), + IPW2100_ORD(STAT_PSP_BCN_TIMEOUT, "beacon timeout"), + IPW2100_ORD(STAT_PSP_POLL_TIMEOUT, + "poll response timeouts"), + IPW2100_ORD(STAT_PSP_NONDIR_TIMEOUT, + "timeouts waiting for last {broad,multi}cast pkt"), + IPW2100_ORD(STAT_PSP_RX_DTIMS, "PSP DTIMs received"), + IPW2100_ORD(STAT_PSP_RX_TIMS, "PSP TIMs received"), + IPW2100_ORD(STAT_PSP_STATION_ID, "PSP Station ID"), + IPW2100_ORD(LAST_ASSN_TIME, "RTC time of last association"), + IPW2100_ORD(STAT_PERCENT_MISSED_BCNS, + "current calculation of % missed beacons"), + IPW2100_ORD(STAT_PERCENT_RETRIES, + "current calculation of % missed tx retries"), + IPW2100_ORD(ASSOCIATED_AP_PTR, + "0 if not associated, else pointer to AP table entry"), + IPW2100_ORD(AVAILABLE_AP_CNT, + "AP's decsribed in the AP table"), + IPW2100_ORD(AP_LIST_PTR, "Ptr to list of available APs"), + IPW2100_ORD(STAT_AP_ASSNS, "associations"), + IPW2100_ORD(STAT_ASSN_FAIL, "association failures"), + IPW2100_ORD(STAT_ASSN_RESP_FAIL, + "failures due to response fail"), + IPW2100_ORD(STAT_FULL_SCANS, "full scans"), + IPW2100_ORD(CARD_DISABLED, "Card Disabled"), + IPW2100_ORD(STAT_ROAM_INHIBIT, + "times roaming was inhibited due to activity"), + IPW2100_ORD(RSSI_AT_ASSN, + "RSSI of associated AP at time of association"), + IPW2100_ORD(STAT_ASSN_CAUSE1, + "reassociation: no probe response or TX on hop"), + IPW2100_ORD(STAT_ASSN_CAUSE2, + "reassociation: poor tx/rx quality"), + IPW2100_ORD(STAT_ASSN_CAUSE3, + "reassociation: tx/rx quality (excessive AP load"), + IPW2100_ORD(STAT_ASSN_CAUSE4, + "reassociation: AP RSSI level"), + IPW2100_ORD(STAT_ASSN_CAUSE5, + "reassociations due to load leveling"), + IPW2100_ORD(STAT_AUTH_FAIL, "times authentication failed"), + IPW2100_ORD(STAT_AUTH_RESP_FAIL, + "times authentication response failed"), + IPW2100_ORD(STATION_TABLE_CNT, + "entries in association table"), + IPW2100_ORD(RSSI_AVG_CURR, "Current avg RSSI"), + IPW2100_ORD(POWER_MGMT_MODE, "Power mode - 0=CAM, 1=PSP"), + IPW2100_ORD(COUNTRY_CODE, + "IEEE country code as recv'd from beacon"), + IPW2100_ORD(COUNTRY_CHANNELS, + "channels suported by country"), + IPW2100_ORD(RESET_CNT, "adapter resets (warm)"), + IPW2100_ORD(BEACON_INTERVAL, "Beacon interval"), + IPW2100_ORD(ANTENNA_DIVERSITY, + "TRUE if antenna diversity is disabled"), + IPW2100_ORD(DTIM_PERIOD, "beacon intervals between DTIMs"), + IPW2100_ORD(OUR_FREQ, + "current radio freq lower digits - channel ID"), + IPW2100_ORD(RTC_TIME, "current RTC time"), + IPW2100_ORD(PORT_TYPE, "operating mode"), + IPW2100_ORD(CURRENT_TX_RATE, "current tx rate"), + IPW2100_ORD(SUPPORTED_RATES, "supported tx rates"), + IPW2100_ORD(ATIM_WINDOW, "current ATIM Window"), + IPW2100_ORD(BASIC_RATES, "basic tx rates"), + IPW2100_ORD(NIC_HIGHEST_RATE, "NIC highest tx rate"), + IPW2100_ORD(AP_HIGHEST_RATE, "AP highest tx rate"), + IPW2100_ORD(CAPABILITIES, + "Management frame capability field"), + IPW2100_ORD(AUTH_TYPE, "Type of authentication"), + IPW2100_ORD(RADIO_TYPE, "Adapter card platform type"), + IPW2100_ORD(RTS_THRESHOLD, + "Min packet length for RTS handshaking"), + IPW2100_ORD(INT_MODE, "International mode"), + IPW2100_ORD(FRAGMENTATION_THRESHOLD, + "protocol frag threshold"), + IPW2100_ORD(EEPROM_SRAM_DB_BLOCK_START_ADDRESS, + "EEPROM offset in SRAM"), + IPW2100_ORD(EEPROM_SRAM_DB_BLOCK_SIZE, + "EEPROM size in SRAM"), + IPW2100_ORD(EEPROM_SKU_CAPABILITY, "EEPROM SKU Capability"), + IPW2100_ORD(EEPROM_IBSS_11B_CHANNELS, + "EEPROM IBSS 11b channel set"), + IPW2100_ORD(MAC_VERSION, "MAC Version"), + IPW2100_ORD(MAC_REVISION, "MAC Revision"), + IPW2100_ORD(RADIO_VERSION, "Radio Version"), + IPW2100_ORD(NIC_MANF_DATE_TIME, "MANF Date/Time STAMP"), + IPW2100_ORD(UCODE_VERSION, "Ucode Version"),}; static ssize_t show_registers(struct device *d, struct device_attribute *attr, - char *buf) + char *buf) { int i; struct ipw2100_priv *priv = dev_get_drvdata(d); struct net_device *dev = priv->net_dev; - char * out = buf; + char *out = buf; u32 val = 0; out += sprintf(out, "%30s [Address ] : Hex\n", "Register"); @@ -3647,15 +3647,15 @@ static ssize_t show_registers(struct device *d, struct device_attribute *attr, return out - buf; } -static DEVICE_ATTR(registers, S_IRUGO, show_registers, NULL); +static DEVICE_ATTR(registers, S_IRUGO, show_registers, NULL); static ssize_t show_hardware(struct device *d, struct device_attribute *attr, - char *buf) + char *buf) { struct ipw2100_priv *priv = dev_get_drvdata(d); struct net_device *dev = priv->net_dev; - char * out = buf; + char *out = buf; int i; out += sprintf(out, "%30s [Address ] : Hex\n", "NIC entry"); @@ -3688,11 +3688,11 @@ static ssize_t show_hardware(struct device *d, struct device_attribute *attr, } return out - buf; } -static DEVICE_ATTR(hardware, S_IRUGO, show_hardware, NULL); +static DEVICE_ATTR(hardware, S_IRUGO, show_hardware, NULL); static ssize_t show_memory(struct device *d, struct device_attribute *attr, - char *buf) + char *buf) { struct ipw2100_priv *priv = dev_get_drvdata(d); struct net_device *dev = priv->net_dev; @@ -3708,10 +3708,13 @@ static ssize_t show_memory(struct device *d, struct device_attribute *attr, /* sysfs provides us PAGE_SIZE buffer */ while (len < PAGE_SIZE - 128 && loop < 0x30000) { - if (priv->snapshot[0]) for (i = 0; i < 4; i++) - buffer[i] = *(u32 *)SNAPSHOT_ADDR(loop + i * 4); - else for (i = 0; i < 4; i++) - read_nic_dword(dev, loop + i * 4, &buffer[i]); + if (priv->snapshot[0]) + for (i = 0; i < 4; i++) + buffer[i] = + *(u32 *) SNAPSHOT_ADDR(loop + i * 4); + else + for (i = 0; i < 4; i++) + read_nic_dword(dev, loop + i * 4, &buffer[i]); if (priv->dump_raw) len += sprintf(buf + len, @@ -3719,26 +3722,26 @@ static ssize_t show_memory(struct device *d, struct device_attribute *attr, "%c%c%c%c" "%c%c%c%c" "%c%c%c%c", - ((u8*)buffer)[0x0], - ((u8*)buffer)[0x1], - ((u8*)buffer)[0x2], - ((u8*)buffer)[0x3], - ((u8*)buffer)[0x4], - ((u8*)buffer)[0x5], - ((u8*)buffer)[0x6], - ((u8*)buffer)[0x7], - ((u8*)buffer)[0x8], - ((u8*)buffer)[0x9], - ((u8*)buffer)[0xa], - ((u8*)buffer)[0xb], - ((u8*)buffer)[0xc], - ((u8*)buffer)[0xd], - ((u8*)buffer)[0xe], - ((u8*)buffer)[0xf]); + ((u8 *) buffer)[0x0], + ((u8 *) buffer)[0x1], + ((u8 *) buffer)[0x2], + ((u8 *) buffer)[0x3], + ((u8 *) buffer)[0x4], + ((u8 *) buffer)[0x5], + ((u8 *) buffer)[0x6], + ((u8 *) buffer)[0x7], + ((u8 *) buffer)[0x8], + ((u8 *) buffer)[0x9], + ((u8 *) buffer)[0xa], + ((u8 *) buffer)[0xb], + ((u8 *) buffer)[0xc], + ((u8 *) buffer)[0xd], + ((u8 *) buffer)[0xe], + ((u8 *) buffer)[0xf]); else len += sprintf(buf + len, "%s\n", snprint_line(line, sizeof(line), - (u8*)buffer, 16, loop)); + (u8 *) buffer, 16, loop)); loop += 16; } @@ -3746,7 +3749,7 @@ static ssize_t show_memory(struct device *d, struct device_attribute *attr, } static ssize_t store_memory(struct device *d, struct device_attribute *attr, - const char *buf, size_t count) + const char *buf, size_t count) { struct ipw2100_priv *priv = dev_get_drvdata(d); struct net_device *dev = priv->net_dev; @@ -3758,32 +3761,30 @@ static ssize_t store_memory(struct device *d, struct device_attribute *attr, if (p[0] == '1' || (count >= 2 && tolower(p[0]) == 'o' && tolower(p[1]) == 'n')) { IPW_DEBUG_INFO("%s: Setting memory dump to RAW mode.\n", - dev->name); + dev->name); priv->dump_raw = 1; } else if (p[0] == '0' || (count >= 2 && tolower(p[0]) == 'o' && - tolower(p[1]) == 'f')) { + tolower(p[1]) == 'f')) { IPW_DEBUG_INFO("%s: Setting memory dump to HEX mode.\n", - dev->name); + dev->name); priv->dump_raw = 0; } else if (tolower(p[0]) == 'r') { - IPW_DEBUG_INFO("%s: Resetting firmware snapshot.\n", - dev->name); + IPW_DEBUG_INFO("%s: Resetting firmware snapshot.\n", dev->name); ipw2100_snapshot_free(priv); } else IPW_DEBUG_INFO("%s: Usage: 0|on = HEX, 1|off = RAW, " - "reset = clear memory snapshot\n", - dev->name); + "reset = clear memory snapshot\n", dev->name); return count; } -static DEVICE_ATTR(memory, S_IWUSR|S_IRUGO, show_memory, store_memory); +static DEVICE_ATTR(memory, S_IWUSR | S_IRUGO, show_memory, store_memory); static ssize_t show_ordinals(struct device *d, struct device_attribute *attr, - char *buf) + char *buf) { struct ipw2100_priv *priv = dev_get_drvdata(d); u32 val = 0; @@ -3814,14 +3815,14 @@ static ssize_t show_ordinals(struct device *d, struct device_attribute *attr, return len; } -static DEVICE_ATTR(ordinals, S_IRUGO, show_ordinals, NULL); +static DEVICE_ATTR(ordinals, S_IRUGO, show_ordinals, NULL); static ssize_t show_stats(struct device *d, struct device_attribute *attr, - char *buf) + char *buf) { struct ipw2100_priv *priv = dev_get_drvdata(d); - char * out = buf; + char *out = buf; out += sprintf(out, "interrupts: %d {tx: %d, rx: %d, other: %d}\n", priv->interrupts, priv->tx_interrupts, @@ -3835,8 +3836,8 @@ static ssize_t show_stats(struct device *d, struct device_attribute *attr, return out - buf; } -static DEVICE_ATTR(stats, S_IRUGO, show_stats, NULL); +static DEVICE_ATTR(stats, S_IRUGO, show_stats, NULL); static int ipw2100_switch_mode(struct ipw2100_priv *priv, u32 mode) { @@ -3864,19 +3865,18 @@ static int ipw2100_switch_mode(struct ipw2100_priv *priv, u32 mode) priv->last_mode = priv->ieee->iw_mode; priv->net_dev->type = ARPHRD_IEEE80211; break; -#endif /* CONFIG_IPW2100_MONITOR */ +#endif /* CONFIG_IPW2100_MONITOR */ } priv->ieee->iw_mode = mode; #ifdef CONFIG_PM - /* Indicate ipw2100_download_firmware download firmware + /* Indicate ipw2100_download_firmware download firmware * from disk instead of memory. */ ipw2100_firmware.version = 0; #endif - printk(KERN_INFO "%s: Reseting on mode change.\n", - priv->net_dev->name); + printk(KERN_INFO "%s: Reseting on mode change.\n", priv->net_dev->name); priv->reset_backoff = 0; schedule_reset(priv); @@ -3884,12 +3884,12 @@ static int ipw2100_switch_mode(struct ipw2100_priv *priv, u32 mode) } static ssize_t show_internals(struct device *d, struct device_attribute *attr, - char *buf) + char *buf) { struct ipw2100_priv *priv = dev_get_drvdata(d); int len = 0; -#define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" # y "\n", priv-> x) +#define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) if (priv->status & STATUS_ASSOCIATED) len += sprintf(buf + len, "connected: %lu\n", @@ -3897,52 +3897,54 @@ static ssize_t show_internals(struct device *d, struct device_attribute *attr, else len += sprintf(buf + len, "not connected\n"); - DUMP_VAR(ieee->crypt[priv->ieee->tx_keyidx], p); - DUMP_VAR(status, 08lx); - DUMP_VAR(config, 08lx); - DUMP_VAR(capability, 08lx); + DUMP_VAR(ieee->crypt[priv->ieee->tx_keyidx], "p"); + DUMP_VAR(status, "08lx"); + DUMP_VAR(config, "08lx"); + DUMP_VAR(capability, "08lx"); - len += sprintf(buf + len, "last_rtc: %lu\n", (unsigned long)priv->last_rtc); + len += + sprintf(buf + len, "last_rtc: %lu\n", + (unsigned long)priv->last_rtc); - DUMP_VAR(fatal_error, d); - DUMP_VAR(stop_hang_check, d); - DUMP_VAR(stop_rf_kill, d); - DUMP_VAR(messages_sent, d); + DUMP_VAR(fatal_error, "d"); + DUMP_VAR(stop_hang_check, "d"); + DUMP_VAR(stop_rf_kill, "d"); + DUMP_VAR(messages_sent, "d"); - DUMP_VAR(tx_pend_stat.value, d); - DUMP_VAR(tx_pend_stat.hi, d); + DUMP_VAR(tx_pend_stat.value, "d"); + DUMP_VAR(tx_pend_stat.hi, "d"); - DUMP_VAR(tx_free_stat.value, d); - DUMP_VAR(tx_free_stat.lo, d); + DUMP_VAR(tx_free_stat.value, "d"); + DUMP_VAR(tx_free_stat.lo, "d"); - DUMP_VAR(msg_free_stat.value, d); - DUMP_VAR(msg_free_stat.lo, d); + DUMP_VAR(msg_free_stat.value, "d"); + DUMP_VAR(msg_free_stat.lo, "d"); - DUMP_VAR(msg_pend_stat.value, d); - DUMP_VAR(msg_pend_stat.hi, d); + DUMP_VAR(msg_pend_stat.value, "d"); + DUMP_VAR(msg_pend_stat.hi, "d"); - DUMP_VAR(fw_pend_stat.value, d); - DUMP_VAR(fw_pend_stat.hi, d); + DUMP_VAR(fw_pend_stat.value, "d"); + DUMP_VAR(fw_pend_stat.hi, "d"); - DUMP_VAR(txq_stat.value, d); - DUMP_VAR(txq_stat.lo, d); + DUMP_VAR(txq_stat.value, "d"); + DUMP_VAR(txq_stat.lo, "d"); - DUMP_VAR(ieee->scans, d); - DUMP_VAR(reset_backoff, d); + DUMP_VAR(ieee->scans, "d"); + DUMP_VAR(reset_backoff, "d"); return len; } -static DEVICE_ATTR(internals, S_IRUGO, show_internals, NULL); +static DEVICE_ATTR(internals, S_IRUGO, show_internals, NULL); static ssize_t show_bssinfo(struct device *d, struct device_attribute *attr, - char *buf) + char *buf) { struct ipw2100_priv *priv = dev_get_drvdata(d); char essid[IW_ESSID_MAX_SIZE + 1]; u8 bssid[ETH_ALEN]; u32 chan = 0; - char * out = buf; + char *out = buf; int length; int ret; @@ -3976,8 +3978,8 @@ static ssize_t show_bssinfo(struct device *d, struct device_attribute *attr, return out - buf; } -static DEVICE_ATTR(bssinfo, S_IRUGO, show_bssinfo, NULL); +static DEVICE_ATTR(bssinfo, S_IRUGO, show_bssinfo, NULL); #ifdef CONFIG_IPW_DEBUG static ssize_t show_debug_level(struct device_driver *d, char *buf) @@ -4000,27 +4002,26 @@ static ssize_t store_debug_level(struct device_driver *d, const char *buf, val = simple_strtoul(p, &p, 10); if (p == buf) IPW_DEBUG_INFO(DRV_NAME - ": %s is not in hex or decimal form.\n", buf); + ": %s is not in hex or decimal form.\n", buf); else ipw2100_debug_level = val; return strnlen(buf, count); } + static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO, show_debug_level, store_debug_level); -#endif /* CONFIG_IPW_DEBUG */ - +#endif /* CONFIG_IPW_DEBUG */ static ssize_t show_fatal_error(struct device *d, - struct device_attribute *attr, char *buf) + struct device_attribute *attr, char *buf) { struct ipw2100_priv *priv = dev_get_drvdata(d); char *out = buf; int i; if (priv->fatal_error) - out += sprintf(out, "0x%08X\n", - priv->fatal_error); + out += sprintf(out, "0x%08X\n", priv->fatal_error); else out += sprintf(out, "0\n"); @@ -4038,24 +4039,26 @@ static ssize_t show_fatal_error(struct device *d, } static ssize_t store_fatal_error(struct device *d, - struct device_attribute *attr, const char *buf, size_t count) + struct device_attribute *attr, const char *buf, + size_t count) { struct ipw2100_priv *priv = dev_get_drvdata(d); schedule_reset(priv); return count; } -static DEVICE_ATTR(fatal_error, S_IWUSR|S_IRUGO, show_fatal_error, store_fatal_error); +static DEVICE_ATTR(fatal_error, S_IWUSR | S_IRUGO, show_fatal_error, + store_fatal_error); static ssize_t show_scan_age(struct device *d, struct device_attribute *attr, - char *buf) + char *buf) { struct ipw2100_priv *priv = dev_get_drvdata(d); return sprintf(buf, "%d\n", priv->ieee->scan_age); } static ssize_t store_scan_age(struct device *d, struct device_attribute *attr, - const char *buf, size_t count) + const char *buf, size_t count) { struct ipw2100_priv *priv = dev_get_drvdata(d); struct net_device *dev = priv->net_dev; @@ -4078,8 +4081,7 @@ static ssize_t store_scan_age(struct device *d, struct device_attribute *attr, } else val = simple_strtoul(p, &p, 10); if (p == buffer) { - IPW_DEBUG_INFO("%s: user supplied invalid value.\n", - dev->name); + IPW_DEBUG_INFO("%s: user supplied invalid value.\n", dev->name); } else { priv->ieee->scan_age = val; IPW_DEBUG_INFO("set scan_age = %u\n", priv->ieee->scan_age); @@ -4088,11 +4090,11 @@ static ssize_t store_scan_age(struct device *d, struct device_attribute *attr, IPW_DEBUG_INFO("exit\n"); return len; } -static DEVICE_ATTR(scan_age, S_IWUSR | S_IRUGO, show_scan_age, store_scan_age); +static DEVICE_ATTR(scan_age, S_IWUSR | S_IRUGO, show_scan_age, store_scan_age); static ssize_t show_rf_kill(struct device *d, struct device_attribute *attr, - char *buf) + char *buf) { /* 0 - RF kill not enabled 1 - SW based RF kill active (sysfs) @@ -4100,7 +4102,7 @@ static ssize_t show_rf_kill(struct device *d, struct device_attribute *attr, 3 - Both HW and SW baed RF kill active */ struct ipw2100_priv *priv = (struct ipw2100_priv *)d->driver_data; int val = ((priv->status & STATUS_RF_KILL_SW) ? 0x1 : 0x0) | - (rf_kill_active(priv) ? 0x2 : 0x0); + (rf_kill_active(priv) ? 0x2 : 0x0); return sprintf(buf, "%i\n", val); } @@ -4108,7 +4110,7 @@ static int ipw_radio_kill_sw(struct ipw2100_priv *priv, int disable_radio) { if ((disable_radio ? 1 : 0) == (priv->status & STATUS_RF_KILL_SW ? 1 : 0)) - return 0 ; + return 0; IPW_DEBUG_RF_KILL("Manual SW RF Kill set to: RADIO %s\n", disable_radio ? "OFF" : "ON"); @@ -4126,8 +4128,7 @@ static int ipw_radio_kill_sw(struct ipw2100_priv *priv, int disable_radio) /* Make sure the RF_KILL check timer is running */ priv->stop_rf_kill = 0; cancel_delayed_work(&priv->rf_kill); - queue_delayed_work(priv->workqueue, &priv->rf_kill, - HZ); + queue_delayed_work(priv->workqueue, &priv->rf_kill, HZ); } else schedule_reset(priv); } @@ -4137,14 +4138,14 @@ static int ipw_radio_kill_sw(struct ipw2100_priv *priv, int disable_radio) } static ssize_t store_rf_kill(struct device *d, struct device_attribute *attr, - const char *buf, size_t count) + const char *buf, size_t count) { struct ipw2100_priv *priv = dev_get_drvdata(d); ipw_radio_kill_sw(priv, buf[0] == '1'); return count; } -static DEVICE_ATTR(rf_kill, S_IWUSR|S_IRUGO, show_rf_kill, store_rf_kill); +static DEVICE_ATTR(rf_kill, S_IWUSR | S_IRUGO, show_rf_kill, store_rf_kill); static struct attribute *ipw2100_sysfs_entries[] = { &dev_attr_hardware.attr, @@ -4168,7 +4169,6 @@ static struct attribute_group ipw2100_attribute_group = { .attrs = ipw2100_sysfs_entries, }; - static int status_queue_allocate(struct ipw2100_priv *priv, int entries) { struct ipw2100_status_queue *q = &priv->status_queue; @@ -4176,11 +4176,11 @@ static int status_queue_allocate(struct ipw2100_priv *priv, int entries) IPW_DEBUG_INFO("enter\n"); q->size = entries * sizeof(struct ipw2100_status); - q->drv = (struct ipw2100_status *)pci_alloc_consistent( - priv->pci_dev, q->size, &q->nic); + q->drv = + (struct ipw2100_status *)pci_alloc_consistent(priv->pci_dev, + q->size, &q->nic); if (!q->drv) { - IPW_DEBUG_WARNING( - "Can not allocate status queue.\n"); + IPW_DEBUG_WARNING("Can not allocate status queue.\n"); return -ENOMEM; } @@ -4196,9 +4196,9 @@ static void status_queue_free(struct ipw2100_priv *priv) IPW_DEBUG_INFO("enter\n"); if (priv->status_queue.drv) { - pci_free_consistent( - priv->pci_dev, priv->status_queue.size, - priv->status_queue.drv, priv->status_queue.nic); + pci_free_consistent(priv->pci_dev, priv->status_queue.size, + priv->status_queue.drv, + priv->status_queue.nic); priv->status_queue.drv = NULL; } @@ -4216,7 +4216,8 @@ static int bd_queue_allocate(struct ipw2100_priv *priv, q->size = entries * sizeof(struct ipw2100_bd); q->drv = pci_alloc_consistent(priv->pci_dev, q->size, &q->nic); if (!q->drv) { - IPW_DEBUG_INFO("can't allocate shared memory for buffer descriptors\n"); + IPW_DEBUG_INFO + ("can't allocate shared memory for buffer descriptors\n"); return -ENOMEM; } memset(q->drv, 0, q->size); @@ -4226,8 +4227,7 @@ static int bd_queue_allocate(struct ipw2100_priv *priv, return 0; } -static void bd_queue_free(struct ipw2100_priv *priv, - struct ipw2100_bd_queue *q) +static void bd_queue_free(struct ipw2100_priv *priv, struct ipw2100_bd_queue *q) { IPW_DEBUG_INFO("enter\n"); @@ -4235,21 +4235,21 @@ static void bd_queue_free(struct ipw2100_priv *priv, return; if (q->drv) { - pci_free_consistent(priv->pci_dev, - q->size, q->drv, q->nic); + pci_free_consistent(priv->pci_dev, q->size, q->drv, q->nic); q->drv = NULL; } IPW_DEBUG_INFO("exit\n"); } -static void bd_queue_initialize( - struct ipw2100_priv *priv, struct ipw2100_bd_queue * q, - u32 base, u32 size, u32 r, u32 w) +static void bd_queue_initialize(struct ipw2100_priv *priv, + struct ipw2100_bd_queue *q, u32 base, u32 size, + u32 r, u32 w) { IPW_DEBUG_INFO("enter\n"); - IPW_DEBUG_INFO("initializing bd queue at virt=%p, phys=%08x\n", q->drv, (u32)q->nic); + IPW_DEBUG_INFO("initializing bd queue at virt=%p, phys=%08x\n", q->drv, + (u32) q->nic); write_register(priv->net_dev, base, q->nic); write_register(priv->net_dev, size, q->entries); @@ -4285,32 +4285,38 @@ static int ipw2100_tx_allocate(struct ipw2100_priv *priv) err = bd_queue_allocate(priv, &priv->tx_queue, TX_QUEUE_LENGTH); if (err) { IPW_DEBUG_ERROR("%s: failed bd_queue_allocate\n", - priv->net_dev->name); + priv->net_dev->name); return err; } - priv->tx_buffers = (struct ipw2100_tx_packet *)kmalloc( - TX_PENDED_QUEUE_LENGTH * sizeof(struct ipw2100_tx_packet), - GFP_ATOMIC); + priv->tx_buffers = + (struct ipw2100_tx_packet *)kmalloc(TX_PENDED_QUEUE_LENGTH * + sizeof(struct + ipw2100_tx_packet), + GFP_ATOMIC); if (!priv->tx_buffers) { - printk(KERN_ERR DRV_NAME ": %s: alloc failed form tx buffers.\n", + printk(KERN_ERR DRV_NAME + ": %s: alloc failed form tx buffers.\n", priv->net_dev->name); bd_queue_free(priv, &priv->tx_queue); return -ENOMEM; } for (i = 0; i < TX_PENDED_QUEUE_LENGTH; i++) { - v = pci_alloc_consistent( - priv->pci_dev, sizeof(struct ipw2100_data_header), &p); + v = pci_alloc_consistent(priv->pci_dev, + sizeof(struct ipw2100_data_header), + &p); if (!v) { - printk(KERN_ERR DRV_NAME ": %s: PCI alloc failed for tx " - "buffers.\n", priv->net_dev->name); + printk(KERN_ERR DRV_NAME + ": %s: PCI alloc failed for tx " "buffers.\n", + priv->net_dev->name); err = -ENOMEM; break; } priv->tx_buffers[i].type = DATA; - priv->tx_buffers[i].info.d_struct.data = (struct ipw2100_data_header*)v; + priv->tx_buffers[i].info.d_struct.data = + (struct ipw2100_data_header *)v; priv->tx_buffers[i].info.d_struct.data_phys = p; priv->tx_buffers[i].info.d_struct.txb = NULL; } @@ -4319,11 +4325,11 @@ static int ipw2100_tx_allocate(struct ipw2100_priv *priv) return 0; for (j = 0; j < i; j++) { - pci_free_consistent( - priv->pci_dev, - sizeof(struct ipw2100_data_header), - priv->tx_buffers[j].info.d_struct.data, - priv->tx_buffers[j].info.d_struct.data_phys); + pci_free_consistent(priv->pci_dev, + sizeof(struct ipw2100_data_header), + priv->tx_buffers[j].info.d_struct.data, + priv->tx_buffers[j].info.d_struct. + data_phys); } kfree(priv->tx_buffers); @@ -4356,7 +4362,8 @@ static void ipw2100_tx_initialize(struct ipw2100_priv *priv) /* We simply drop any SKBs that have been queued for * transmit */ if (priv->tx_buffers[i].info.d_struct.txb) { - ieee80211_txb_free(priv->tx_buffers[i].info.d_struct.txb); + ieee80211_txb_free(priv->tx_buffers[i].info.d_struct. + txb); priv->tx_buffers[i].info.d_struct.txb = NULL; } @@ -4394,15 +4401,17 @@ static void ipw2100_tx_free(struct ipw2100_priv *priv) for (i = 0; i < TX_PENDED_QUEUE_LENGTH; i++) { if (priv->tx_buffers[i].info.d_struct.txb) { - ieee80211_txb_free(priv->tx_buffers[i].info.d_struct.txb); + ieee80211_txb_free(priv->tx_buffers[i].info.d_struct. + txb); priv->tx_buffers[i].info.d_struct.txb = NULL; } if (priv->tx_buffers[i].info.d_struct.data) - pci_free_consistent( - priv->pci_dev, - sizeof(struct ipw2100_data_header), - priv->tx_buffers[i].info.d_struct.data, - priv->tx_buffers[i].info.d_struct.data_phys); + pci_free_consistent(priv->pci_dev, + sizeof(struct ipw2100_data_header), + priv->tx_buffers[i].info.d_struct. + data, + priv->tx_buffers[i].info.d_struct. + data_phys); } kfree(priv->tx_buffers); @@ -4411,8 +4420,6 @@ static void ipw2100_tx_free(struct ipw2100_priv *priv) IPW_DEBUG_INFO("exit\n"); } - - static int ipw2100_rx_allocate(struct ipw2100_priv *priv) { int i, j, err = -EINVAL; @@ -4542,14 +4549,13 @@ static int ipw2100_read_mac_address(struct ipw2100_priv *priv) int err; - err = ipw2100_get_ordinal(priv, IPW_ORD_STAT_ADAPTER_MAC, - mac, &length); + err = ipw2100_get_ordinal(priv, IPW_ORD_STAT_ADAPTER_MAC, mac, &length); if (err) { IPW_DEBUG_INFO("MAC address read failed\n"); return -EIO; } IPW_DEBUG_INFO("card MAC is %02X:%02X:%02X:%02X:%02X:%02X\n", - mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); + mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); memcpy(priv->net_dev->dev_addr, mac, ETH_ALEN); @@ -4576,8 +4582,7 @@ static int ipw2100_set_mac_address(struct ipw2100_priv *priv, int batch_mode) IPW_DEBUG_INFO("enter\n"); if (priv->config & CFG_CUSTOM_MAC) { - memcpy(cmd.host_command_parameters, priv->mac_addr, - ETH_ALEN); + memcpy(cmd.host_command_parameters, priv->mac_addr, ETH_ALEN); memcpy(priv->net_dev->dev_addr, priv->mac_addr, ETH_ALEN); } else memcpy(cmd.host_command_parameters, priv->net_dev->dev_addr, @@ -4614,7 +4619,8 @@ static int ipw2100_set_port_type(struct ipw2100_priv *priv, u32 port_type, if (!batch_mode) { err = ipw2100_disable_adapter(priv); if (err) { - printk(KERN_ERR DRV_NAME ": %s: Could not disable adapter %d\n", + printk(KERN_ERR DRV_NAME + ": %s: Could not disable adapter %d\n", priv->net_dev->name, err); return err; } @@ -4629,7 +4635,6 @@ static int ipw2100_set_port_type(struct ipw2100_priv *priv, u32 port_type, return err; } - static int ipw2100_set_channel(struct ipw2100_priv *priv, u32 channel, int batch_mode) { @@ -4660,8 +4665,7 @@ static int ipw2100_set_channel(struct ipw2100_priv *priv, u32 channel, err = ipw2100_hw_send_command(priv, &cmd); if (err) { - IPW_DEBUG_INFO("Failed to set channel to %d", - channel); + IPW_DEBUG_INFO("Failed to set channel to %d", channel); return err; } @@ -4703,15 +4707,14 @@ static int ipw2100_system_config(struct ipw2100_priv *priv, int batch_mode) cmd.host_command_parameters[0] |= IPW_CFG_IBSS_AUTO_START; cmd.host_command_parameters[0] |= IPW_CFG_IBSS_MASK | - IPW_CFG_BSS_MASK | - IPW_CFG_802_1x_ENABLE; + IPW_CFG_BSS_MASK | IPW_CFG_802_1x_ENABLE; if (!(priv->config & CFG_LONG_PREAMBLE)) cmd.host_command_parameters[0] |= IPW_CFG_PREAMBLE_AUTO; err = ipw2100_get_ordinal(priv, IPW_ORD_EEPROM_IBSS_11B_CHANNELS, - &ibss_mask, &len); + &ibss_mask, &len); if (err) ibss_mask = IPW_IBSS_11B_DEFAULT_MASK; @@ -4719,7 +4722,7 @@ static int ipw2100_system_config(struct ipw2100_priv *priv, int batch_mode) cmd.host_command_parameters[2] = REG_CHANNEL_MASK & ibss_mask; /* 11b only */ - /*cmd.host_command_parameters[0] |= DIVERSITY_ANTENNA_A;*/ + /*cmd.host_command_parameters[0] |= DIVERSITY_ANTENNA_A; */ err = ipw2100_hw_send_command(priv, &cmd); if (err) @@ -4783,8 +4786,7 @@ static int ipw2100_set_tx_rates(struct ipw2100_priv *priv, u32 rate, return 0; } -static int ipw2100_set_power_mode(struct ipw2100_priv *priv, - int power_level) +static int ipw2100_set_power_mode(struct ipw2100_priv *priv, int power_level) { struct host_command cmd = { .host_command = POWER_MODE, @@ -4805,11 +4807,10 @@ static int ipw2100_set_power_mode(struct ipw2100_priv *priv, priv->power_mode = IPW_POWER_ENABLED | power_level; #ifdef CONFIG_IPW2100_TX_POWER - if (priv->port_type == IBSS && - priv->adhoc_power != DFTL_IBSS_TX_POWER) { + if (priv->port_type == IBSS && priv->adhoc_power != DFTL_IBSS_TX_POWER) { /* Set beacon interval */ cmd.host_command = TX_POWER_INDEX; - cmd.host_command_parameters[0] = (u32)priv->adhoc_power; + cmd.host_command_parameters[0] = (u32) priv->adhoc_power; err = ipw2100_hw_send_command(priv, &cmd); if (err) @@ -4820,7 +4821,6 @@ static int ipw2100_set_power_mode(struct ipw2100_priv *priv, return 0; } - static int ipw2100_set_rts_threshold(struct ipw2100_priv *priv, u32 threshold) { struct host_command cmd = { @@ -4925,8 +4925,7 @@ static int ipw2100_set_long_retry(struct ipw2100_priv *priv, u32 retry) return 0; } - -static int ipw2100_set_mandatory_bssid(struct ipw2100_priv *priv, u8 *bssid, +static int ipw2100_set_mandatory_bssid(struct ipw2100_priv *priv, u8 * bssid, int batch_mode) { struct host_command cmd = { @@ -4938,16 +4937,15 @@ static int ipw2100_set_mandatory_bssid(struct ipw2100_priv *priv, u8 *bssid, #ifdef CONFIG_IPW_DEBUG if (bssid != NULL) - IPW_DEBUG_HC( - "MANDATORY_BSSID: %02X:%02X:%02X:%02X:%02X:%02X\n", - bssid[0], bssid[1], bssid[2], bssid[3], bssid[4], - bssid[5]); + IPW_DEBUG_HC("MANDATORY_BSSID: %02X:%02X:%02X:%02X:%02X:%02X\n", + bssid[0], bssid[1], bssid[2], bssid[3], bssid[4], + bssid[5]); else IPW_DEBUG_HC("MANDATORY_BSSID: \n"); #endif /* if BSSID is empty then we disable mandatory bssid mode */ if (bssid != NULL) - memcpy((u8 *)cmd.host_command_parameters, bssid, ETH_ALEN); + memcpy((u8 *) cmd.host_command_parameters, bssid, ETH_ALEN); if (!batch_mode) { err = ipw2100_disable_adapter(priv); @@ -4997,8 +4995,7 @@ void x(struct ieee80211_assoc_frame *wpa_assoc) { struct ipw2100_wpa_assoc_frame frame; frame->fixed_ie_mask = IPW_WPA_CAPABILTIES | - IPW_WPA_LISTENINTERVAL | - IPW_WPA_AP_ADDRESS; + IPW_WPA_LISTENINTERVAL | IPW_WPA_AP_ADDRESS; frame->capab_info = wpa_assoc->capab_info; frame->lisen_interval = wpa_assoc->listent_interval; memcpy(frame->current_ap, wpa_assoc->current_ap, ETH_ALEN); @@ -5011,18 +5008,15 @@ void x(struct ieee80211_assoc_frame *wpa_assoc) * the IEs from wpa_frame into frame. */ frame->var_ie_len = calculate_ie_len(wpa_assoc); - memcpy(frame->var_ie, wpa_assoc->variable, frame->var_ie_len); + memcpy(frame->var_ie, wpa_assoc->variable, frame->var_ie_len); ipw2100_set_wpa_ie(priv, &frame, 0); } #endif - - - static int ipw2100_set_wpa_ie(struct ipw2100_priv *, struct ipw2100_wpa_assoc_frame *, int) -__attribute__ ((unused)); + __attribute__ ((unused)); static int ipw2100_set_wpa_ie(struct ipw2100_priv *priv, struct ipw2100_wpa_assoc_frame *wpa_frame, @@ -5076,7 +5070,7 @@ static int ipw2100_set_security_information(struct ipw2100_priv *priv, .host_command_length = sizeof(struct security_info_params) }; struct security_info_params *security = - (struct security_info_params *)&cmd.host_command_parameters; + (struct security_info_params *)&cmd.host_command_parameters; int err; memset(security, 0, sizeof(*security)); @@ -5094,25 +5088,25 @@ static int ipw2100_set_security_information(struct ipw2100_priv *priv, break; case SEC_LEVEL_1: security->allowed_ciphers = IPW_WEP40_CIPHER | - IPW_WEP104_CIPHER; + IPW_WEP104_CIPHER; break; case SEC_LEVEL_2: security->allowed_ciphers = IPW_WEP40_CIPHER | - IPW_WEP104_CIPHER | IPW_TKIP_CIPHER; + IPW_WEP104_CIPHER | IPW_TKIP_CIPHER; break; case SEC_LEVEL_2_CKIP: security->allowed_ciphers = IPW_WEP40_CIPHER | - IPW_WEP104_CIPHER | IPW_CKIP_CIPHER; + IPW_WEP104_CIPHER | IPW_CKIP_CIPHER; break; case SEC_LEVEL_3: security->allowed_ciphers = IPW_WEP40_CIPHER | - IPW_WEP104_CIPHER | IPW_TKIP_CIPHER | IPW_CCMP_CIPHER; + IPW_WEP104_CIPHER | IPW_TKIP_CIPHER | IPW_CCMP_CIPHER; break; } - IPW_DEBUG_HC( - "SET_SECURITY_INFORMATION: auth:%d cipher:0x%02X (level %d)\n", - security->auth_mode, security->allowed_ciphers, security_level); + IPW_DEBUG_HC + ("SET_SECURITY_INFORMATION: auth:%d cipher:0x%02X (level %d)\n", + security->auth_mode, security->allowed_ciphers, security_level); security->replay_counters_number = 0; @@ -5130,8 +5124,7 @@ static int ipw2100_set_security_information(struct ipw2100_priv *priv, return err; } -static int ipw2100_set_tx_power(struct ipw2100_priv *priv, - u32 tx_power) +static int ipw2100_set_tx_power(struct ipw2100_priv *priv, u32 tx_power) { struct host_command cmd = { .host_command = TX_POWER_INDEX, @@ -5185,7 +5178,6 @@ static int ipw2100_set_ibss_beacon_interval(struct ipw2100_priv *priv, return 0; } - void ipw2100_queues_initialize(struct ipw2100_priv *priv) { ipw2100_tx_initialize(priv); @@ -5203,13 +5195,12 @@ void ipw2100_queues_free(struct ipw2100_priv *priv) int ipw2100_queues_allocate(struct ipw2100_priv *priv) { if (ipw2100_tx_allocate(priv) || - ipw2100_rx_allocate(priv) || - ipw2100_msg_allocate(priv)) + ipw2100_rx_allocate(priv) || ipw2100_msg_allocate(priv)) goto fail; return 0; - fail: + fail: ipw2100_tx_free(priv); ipw2100_rx_free(priv); ipw2100_msg_free(priv); @@ -5235,7 +5226,8 @@ static int ipw2100_set_wep_flags(struct ipw2100_priv *priv, u32 flags, if (!batch_mode) { err = ipw2100_disable_adapter(priv); if (err) { - printk(KERN_ERR DRV_NAME ": %s: Could not disable adapter %d\n", + printk(KERN_ERR DRV_NAME + ": %s: Could not disable adapter %d\n", priv->net_dev->name, err); return err; } @@ -5262,7 +5254,6 @@ struct ipw2100_wep_key { #define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] #define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] - /** * Set a the wep key * @@ -5287,11 +5278,11 @@ static int ipw2100_set_key(struct ipw2100_priv *priv, .host_command_sequence = 0, .host_command_length = sizeof(struct ipw2100_wep_key), }; - struct ipw2100_wep_key *wep_key = (void*)cmd.host_command_parameters; + struct ipw2100_wep_key *wep_key = (void *)cmd.host_command_parameters; int err; IPW_DEBUG_HC("WEP_KEY_INFO: index = %d, len = %d/%d\n", - idx, keylen, len); + idx, keylen, len); /* NOTE: We don't check cached values in case the firmware was reset * or some other problem is occuring. If the user is setting the key, @@ -5308,22 +5299,23 @@ static int ipw2100_set_key(struct ipw2100_priv *priv, /* Will be optimized out on debug not being configured in */ if (keylen == 0) IPW_DEBUG_WEP("%s: Clearing key %d\n", - priv->net_dev->name, wep_key->idx); + priv->net_dev->name, wep_key->idx); else if (keylen == 5) IPW_DEBUG_WEP("%s: idx: %d, len: %d key: " WEP_FMT_64 "\n", - priv->net_dev->name, wep_key->idx, wep_key->len, - WEP_STR_64(wep_key->key)); + priv->net_dev->name, wep_key->idx, wep_key->len, + WEP_STR_64(wep_key->key)); else IPW_DEBUG_WEP("%s: idx: %d, len: %d key: " WEP_FMT_128 - "\n", - priv->net_dev->name, wep_key->idx, wep_key->len, - WEP_STR_128(wep_key->key)); + "\n", + priv->net_dev->name, wep_key->idx, wep_key->len, + WEP_STR_128(wep_key->key)); if (!batch_mode) { err = ipw2100_disable_adapter(priv); /* FIXME: IPG: shouldn't this prink be in _disable_adapter()? */ if (err) { - printk(KERN_ERR DRV_NAME ": %s: Could not disable adapter %d\n", + printk(KERN_ERR DRV_NAME + ": %s: Could not disable adapter %d\n", priv->net_dev->name, err); return err; } @@ -5347,7 +5339,7 @@ static int ipw2100_set_key_index(struct ipw2100_priv *priv, .host_command = WEP_KEY_INDEX, .host_command_sequence = 0, .host_command_length = 4, - .host_command_parameters = { idx }, + .host_command_parameters = {idx}, }; int err; @@ -5359,7 +5351,8 @@ static int ipw2100_set_key_index(struct ipw2100_priv *priv, if (!batch_mode) { err = ipw2100_disable_adapter(priv); if (err) { - printk(KERN_ERR DRV_NAME ": %s: Could not disable adapter %d\n", + printk(KERN_ERR DRV_NAME + ": %s: Could not disable adapter %d\n", priv->net_dev->name, err); return err; } @@ -5374,9 +5367,7 @@ static int ipw2100_set_key_index(struct ipw2100_priv *priv, return err; } - -static int ipw2100_configure_security(struct ipw2100_priv *priv, - int batch_mode) +static int ipw2100_configure_security(struct ipw2100_priv *priv, int batch_mode) { int i, err, auth_mode, sec_level, use_group; @@ -5390,8 +5381,9 @@ static int ipw2100_configure_security(struct ipw2100_priv *priv, } if (!priv->sec.enabled) { - err = ipw2100_set_security_information( - priv, IPW_AUTH_OPEN, SEC_LEVEL_0, 0, 1); + err = + ipw2100_set_security_information(priv, IPW_AUTH_OPEN, + SEC_LEVEL_0, 0, 1); } else { auth_mode = IPW_AUTH_OPEN; if ((priv->sec.flags & SEC_AUTH_MODE) && @@ -5406,8 +5398,9 @@ static int ipw2100_configure_security(struct ipw2100_priv *priv, if (priv->sec.flags & SEC_UNICAST_GROUP) use_group = priv->sec.unicast_uses_group; - err = ipw2100_set_security_information( - priv, auth_mode, sec_level, use_group, 1); + err = + ipw2100_set_security_information(priv, auth_mode, sec_level, + use_group, 1); } if (err) @@ -5433,14 +5426,16 @@ static int ipw2100_configure_security(struct ipw2100_priv *priv, /* Always enable privacy so the Host can filter WEP packets if * encrypted data is sent up */ - err = ipw2100_set_wep_flags( - priv, priv->sec.enabled ? IPW_PRIVACY_CAPABLE : 0, 1); + err = + ipw2100_set_wep_flags(priv, + priv->sec.enabled ? IPW_PRIVACY_CAPABLE : 0, + 1); if (err) goto exit; priv->status &= ~STATUS_SECURITY_UPDATED; - exit: + exit: if (!batch_mode) ipw2100_enable_adapter(priv); @@ -5498,31 +5493,29 @@ static void shim__set_security(struct net_device *dev, priv->status |= STATUS_SECURITY_UPDATED; } - if (sec->flags & SEC_ENABLED && - priv->sec.enabled != sec->enabled) { + if (sec->flags & SEC_ENABLED && priv->sec.enabled != sec->enabled) { priv->sec.flags |= SEC_ENABLED; priv->sec.enabled = sec->enabled; priv->status |= STATUS_SECURITY_UPDATED; force_update = 1; } - if (sec->flags & SEC_LEVEL && - priv->sec.level != sec->level) { + if (sec->flags & SEC_LEVEL && priv->sec.level != sec->level) { priv->sec.level = sec->level; priv->sec.flags |= SEC_LEVEL; priv->status |= STATUS_SECURITY_UPDATED; } IPW_DEBUG_WEP("Security flags: %c %c%c%c%c %c%c%c%c\n", - priv->sec.flags & (1<<8) ? '1' : '0', - priv->sec.flags & (1<<7) ? '1' : '0', - priv->sec.flags & (1<<6) ? '1' : '0', - priv->sec.flags & (1<<5) ? '1' : '0', - priv->sec.flags & (1<<4) ? '1' : '0', - priv->sec.flags & (1<<3) ? '1' : '0', - priv->sec.flags & (1<<2) ? '1' : '0', - priv->sec.flags & (1<<1) ? '1' : '0', - priv->sec.flags & (1<<0) ? '1' : '0'); + priv->sec.flags & (1 << 8) ? '1' : '0', + priv->sec.flags & (1 << 7) ? '1' : '0', + priv->sec.flags & (1 << 6) ? '1' : '0', + priv->sec.flags & (1 << 5) ? '1' : '0', + priv->sec.flags & (1 << 4) ? '1' : '0', + priv->sec.flags & (1 << 3) ? '1' : '0', + priv->sec.flags & (1 << 2) ? '1' : '0', + priv->sec.flags & (1 << 1) ? '1' : '0', + priv->sec.flags & (1 << 0) ? '1' : '0'); /* As a temporary work around to enable WPA until we figure out why * wpa_supplicant toggles the security capability of the driver, which @@ -5531,7 +5524,7 @@ static void shim__set_security(struct net_device *dev, * if (force_update || !(priv->status & STATUS_ASSOCIATED))*/ if (!(priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING))) ipw2100_configure_security(priv, 0); -done: + done: up(&priv->action_sem); } @@ -5556,7 +5549,7 @@ static int ipw2100_adapter_setup(struct ipw2100_priv *priv) return 0; } -#endif /* CONFIG_IPW2100_MONITOR */ +#endif /* CONFIG_IPW2100_MONITOR */ err = ipw2100_read_mac_address(priv); if (err) @@ -5576,7 +5569,7 @@ static int ipw2100_adapter_setup(struct ipw2100_priv *priv) return err; } - err = ipw2100_system_config(priv, batch_mode); + err = ipw2100_system_config(priv, batch_mode); if (err) return err; @@ -5614,8 +5607,10 @@ static int ipw2100_adapter_setup(struct ipw2100_priv *priv) return err; if (priv->ieee->iw_mode == IW_MODE_ADHOC) { - err = ipw2100_set_ibss_beacon_interval( - priv, priv->beacon_interval, batch_mode); + err = + ipw2100_set_ibss_beacon_interval(priv, + priv->beacon_interval, + batch_mode); if (err) return err; @@ -5625,18 +5620,17 @@ static int ipw2100_adapter_setup(struct ipw2100_priv *priv) } /* - err = ipw2100_set_fragmentation_threshold( - priv, priv->frag_threshold, batch_mode); - if (err) - return err; - */ + err = ipw2100_set_fragmentation_threshold( + priv, priv->frag_threshold, batch_mode); + if (err) + return err; + */ IPW_DEBUG_INFO("exit\n"); return 0; } - /************************************************************************* * * EXTERNALLY CALLED METHODS @@ -5669,7 +5663,7 @@ static int ipw2100_set_address(struct net_device *dev, void *p) ipw2100_reset_adapter(priv); return 0; - done: + done: up(&priv->action_sem); return err; } @@ -5708,7 +5702,7 @@ static int ipw2100_close(struct net_device *dev) /* Flush the TX queue ... */ while (!list_empty(&priv->tx_pend_list)) { element = priv->tx_pend_list.next; - packet = list_entry(element, struct ipw2100_tx_packet, list); + packet = list_entry(element, struct ipw2100_tx_packet, list); list_del(element); DEC_STAT(&priv->tx_pend_stat); @@ -5726,8 +5720,6 @@ static int ipw2100_close(struct net_device *dev) return 0; } - - /* * TODO: Fix this function... its just wrong */ @@ -5747,7 +5739,6 @@ static void ipw2100_tx_timeout(struct net_device *dev) schedule_reset(priv); } - /* * TODO: reimplement it so that it reads statistics * from the adapter using ordinal tables @@ -5796,7 +5787,7 @@ static struct net_device_stats *ipw2100_stats(struct net_device *dev) struct ipw2100_param { u32 cmd; u8 sta_addr[ETH_ALEN]; - union { + union { struct { u8 name; u32 value; @@ -5805,16 +5796,16 @@ struct ipw2100_param { u32 len; u8 *data; } wpa_ie; - struct{ + struct { int command; - int reason_code; + int reason_code; } mlme; struct { u8 alg[IPW2100_CRYPT_ALG_NAME_LEN]; u8 set_tx; u32 err; u8 idx; - u8 seq[8]; /* sequence counter (set: RX, get: TX) */ + u8 seq[8]; /* sequence counter (set: RX, get: TX) */ u16 key_len; u8 key[0]; } crypt; @@ -5824,7 +5815,8 @@ struct ipw2100_param { /* end of driver_ipw2100.c code */ -static int ipw2100_wpa_enable(struct ipw2100_priv *priv, int value){ +static int ipw2100_wpa_enable(struct ipw2100_priv *priv, int value) +{ struct ieee80211_device *ieee = priv->ieee; struct ieee80211_security sec = { @@ -5834,7 +5826,7 @@ static int ipw2100_wpa_enable(struct ipw2100_priv *priv, int value){ ieee->wpa_enabled = value; - if (value){ + if (value) { sec.level = SEC_LEVEL_3; sec.enabled = 1; } else { @@ -5853,7 +5845,8 @@ static int ipw2100_wpa_enable(struct ipw2100_priv *priv, int value){ #define AUTH_ALG_OPEN_SYSTEM 0x1 #define AUTH_ALG_SHARED_KEY 0x2 -static int ipw2100_wpa_set_auth_algs(struct ipw2100_priv *priv, int value){ +static int ipw2100_wpa_set_auth_algs(struct ipw2100_priv *priv, int value) +{ struct ieee80211_device *ieee = priv->ieee; struct ieee80211_security sec = { @@ -5861,7 +5854,7 @@ static int ipw2100_wpa_set_auth_algs(struct ipw2100_priv *priv, int value){ }; int ret = 0; - if (value & AUTH_ALG_SHARED_KEY){ + if (value & AUTH_ALG_SHARED_KEY) { sec.auth_mode = WLAN_AUTH_SHARED_KEY; ieee->open_wep = 0; } else { @@ -5877,72 +5870,73 @@ static int ipw2100_wpa_set_auth_algs(struct ipw2100_priv *priv, int value){ return ret; } - -static int ipw2100_wpa_set_param(struct net_device *dev, u8 name, u32 value){ +static int ipw2100_wpa_set_param(struct net_device *dev, u8 name, u32 value) +{ struct ipw2100_priv *priv = ieee80211_priv(dev); - int ret=0; + int ret = 0; - switch(name){ - case IPW2100_PARAM_WPA_ENABLED: - ret = ipw2100_wpa_enable(priv, value); - break; + switch (name) { + case IPW2100_PARAM_WPA_ENABLED: + ret = ipw2100_wpa_enable(priv, value); + break; - case IPW2100_PARAM_TKIP_COUNTERMEASURES: - priv->ieee->tkip_countermeasures=value; - break; + case IPW2100_PARAM_TKIP_COUNTERMEASURES: + priv->ieee->tkip_countermeasures = value; + break; - case IPW2100_PARAM_DROP_UNENCRYPTED: - priv->ieee->drop_unencrypted=value; - break; + case IPW2100_PARAM_DROP_UNENCRYPTED: + priv->ieee->drop_unencrypted = value; + break; - case IPW2100_PARAM_PRIVACY_INVOKED: - priv->ieee->privacy_invoked=value; - break; + case IPW2100_PARAM_PRIVACY_INVOKED: + priv->ieee->privacy_invoked = value; + break; - case IPW2100_PARAM_AUTH_ALGS: - ret = ipw2100_wpa_set_auth_algs(priv, value); - break; + case IPW2100_PARAM_AUTH_ALGS: + ret = ipw2100_wpa_set_auth_algs(priv, value); + break; - case IPW2100_PARAM_IEEE_802_1X: - priv->ieee->ieee802_1x=value; - break; + case IPW2100_PARAM_IEEE_802_1X: + priv->ieee->ieee802_1x = value; + break; - default: - printk(KERN_ERR DRV_NAME ": %s: Unknown WPA param: %d\n", - dev->name, name); - ret = -EOPNOTSUPP; + default: + printk(KERN_ERR DRV_NAME ": %s: Unknown WPA param: %d\n", + dev->name, name); + ret = -EOPNOTSUPP; } return ret; } -static int ipw2100_wpa_mlme(struct net_device *dev, int command, int reason){ +static int ipw2100_wpa_mlme(struct net_device *dev, int command, int reason) +{ struct ipw2100_priv *priv = ieee80211_priv(dev); - int ret=0; + int ret = 0; - switch(command){ - case IPW2100_MLME_STA_DEAUTH: - // silently ignore - break; + switch (command) { + case IPW2100_MLME_STA_DEAUTH: + // silently ignore + break; - case IPW2100_MLME_STA_DISASSOC: - ipw2100_disassociate_bssid(priv); - break; + case IPW2100_MLME_STA_DISASSOC: + ipw2100_disassociate_bssid(priv); + break; - default: - printk(KERN_ERR DRV_NAME ": %s: Unknown MLME request: %d\n", - dev->name, command); - ret = -EOPNOTSUPP; + default: + printk(KERN_ERR DRV_NAME ": %s: Unknown MLME request: %d\n", + dev->name, command); + ret = -EOPNOTSUPP; } return ret; } - void ipw2100_wpa_assoc_frame(struct ipw2100_priv *priv, - char *wpa_ie, int wpa_ie_len){ + char *wpa_ie, int wpa_ie_len) +{ struct ipw2100_wpa_assoc_frame frame; @@ -5957,23 +5951,22 @@ void ipw2100_wpa_assoc_frame(struct ipw2100_priv *priv, ipw2100_set_wpa_ie(priv, &frame, 0); } - static int ipw2100_wpa_set_wpa_ie(struct net_device *dev, - struct ipw2100_param *param, int plen){ + struct ipw2100_param *param, int plen) +{ struct ipw2100_priv *priv = ieee80211_priv(dev); struct ieee80211_device *ieee = priv->ieee; u8 *buf; - if (! ieee->wpa_enabled) - return -EOPNOTSUPP; + if (!ieee->wpa_enabled) + return -EOPNOTSUPP; if (param->u.wpa_ie.len > MAX_WPA_IE_LEN || - (param->u.wpa_ie.len && - param->u.wpa_ie.data==NULL)) + (param->u.wpa_ie.len && param->u.wpa_ie.data == NULL)) return -EINVAL; - if (param->u.wpa_ie.len){ + if (param->u.wpa_ie.len) { buf = kmalloc(param->u.wpa_ie.len, GFP_KERNEL); if (buf == NULL) return -ENOMEM; @@ -5998,7 +5991,9 @@ static int ipw2100_wpa_set_wpa_ie(struct net_device *dev, /* implementation borrowed from hostap driver */ static int ipw2100_wpa_set_encryption(struct net_device *dev, - struct ipw2100_param *param, int param_len){ + struct ipw2100_param *param, + int param_len) +{ int ret = 0; struct ipw2100_priv *priv = ieee80211_priv(dev); @@ -6014,9 +6009,10 @@ static int ipw2100_wpa_set_encryption(struct net_device *dev, param->u.crypt.alg[IPW2100_CRYPT_ALG_NAME_LEN - 1] = '\0'; if (param_len != - (int) ((char *) param->u.crypt.key - (char *) param) + - param->u.crypt.key_len){ - IPW_DEBUG_INFO("Len mismatch %d, %d\n", param_len, param->u.crypt.key_len); + (int)((char *)param->u.crypt.key - (char *)param) + + param->u.crypt.key_len) { + IPW_DEBUG_INFO("Len mismatch %d, %d\n", param_len, + param->u.crypt.key_len); return -EINVAL; } if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && @@ -6030,7 +6026,7 @@ static int ipw2100_wpa_set_encryption(struct net_device *dev, } if (strcmp(param->u.crypt.alg, "none") == 0) { - if (crypt){ + if (crypt) { sec.enabled = 0; sec.level = SEC_LEVEL_0; sec.flags |= SEC_ENABLED | SEC_LEVEL; @@ -6054,7 +6050,7 @@ static int ipw2100_wpa_set_encryption(struct net_device *dev, } if (ops == NULL) { IPW_DEBUG_INFO("%s: unknown crypto alg '%s'\n", - dev->name, param->u.crypt.alg); + dev->name, param->u.crypt.alg); param->u.crypt.err = IPW2100_CRYPT_ERR_UNKNOWN_ALG; ret = -EINVAL; goto done; @@ -6066,7 +6062,7 @@ static int ipw2100_wpa_set_encryption(struct net_device *dev, ieee80211_crypt_delayed_deinit(ieee, crypt); new_crypt = (struct ieee80211_crypt_data *) - kmalloc(sizeof(struct ieee80211_crypt_data), GFP_KERNEL); + kmalloc(sizeof(struct ieee80211_crypt_data), GFP_KERNEL); if (new_crypt == NULL) { ret = -ENOMEM; goto done; @@ -6074,12 +6070,13 @@ static int ipw2100_wpa_set_encryption(struct net_device *dev, memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data)); new_crypt->ops = ops; if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) - new_crypt->priv = new_crypt->ops->init(param->u.crypt.idx); + new_crypt->priv = + new_crypt->ops->init(param->u.crypt.idx); if (new_crypt->priv == NULL) { kfree(new_crypt); param->u.crypt.err = - IPW2100_CRYPT_ERR_CRYPT_INIT_FAILED; + IPW2100_CRYPT_ERR_CRYPT_INIT_FAILED; ret = -EINVAL; goto done; } @@ -6091,24 +6088,25 @@ static int ipw2100_wpa_set_encryption(struct net_device *dev, (*crypt)->ops->set_key(param->u.crypt.key, param->u.crypt.key_len, param->u.crypt.seq, (*crypt)->priv) < 0) { - IPW_DEBUG_INFO("%s: key setting failed\n", - dev->name); + IPW_DEBUG_INFO("%s: key setting failed\n", dev->name); param->u.crypt.err = IPW2100_CRYPT_ERR_KEY_SET_FAILED; ret = -EINVAL; goto done; } - if (param->u.crypt.set_tx){ + if (param->u.crypt.set_tx) { ieee->tx_keyidx = param->u.crypt.idx; sec.active_key = param->u.crypt.idx; sec.flags |= SEC_ACTIVE_KEY; } - if (ops->name != NULL){ + if (ops->name != NULL) { if (strcmp(ops->name, "WEP") == 0) { - memcpy(sec.keys[param->u.crypt.idx], param->u.crypt.key, param->u.crypt.key_len); - sec.key_sizes[param->u.crypt.idx] = param->u.crypt.key_len; + memcpy(sec.keys[param->u.crypt.idx], param->u.crypt.key, + param->u.crypt.key_len); + sec.key_sizes[param->u.crypt.idx] = + param->u.crypt.key_len; sec.flags |= (1 << param->u.crypt.idx); sec.flags |= SEC_LEVEL; sec.level = SEC_LEVEL_1; @@ -6120,7 +6118,7 @@ static int ipw2100_wpa_set_encryption(struct net_device *dev, sec.level = SEC_LEVEL_3; } } - done: + done: if (ieee->set_security) ieee->set_security(ieee->dev, &sec); @@ -6131,8 +6129,7 @@ static int ipw2100_wpa_set_encryption(struct net_device *dev, * the callbacks structures used to initialize the 802.11 stack. */ if (ieee->reset_on_keychange && ieee->iw_mode != IW_MODE_INFRA && - ieee->reset_port && - ieee->reset_port(dev)) { + ieee->reset_port && ieee->reset_port(dev)) { IPW_DEBUG_INFO("%s: reset_port failed\n", dev->name); param->u.crypt.err = IPW2100_CRYPT_ERR_CARD_CONF_FAILED; return -EINVAL; @@ -6141,11 +6138,11 @@ static int ipw2100_wpa_set_encryption(struct net_device *dev, return ret; } - -static int ipw2100_wpa_supplicant(struct net_device *dev, struct iw_point *p){ +static int ipw2100_wpa_supplicant(struct net_device *dev, struct iw_point *p) +{ struct ipw2100_param *param; - int ret=0; + int ret = 0; IPW_DEBUG_IOCTL("wpa_supplicant: len=%d\n", p->length); @@ -6156,12 +6153,12 @@ static int ipw2100_wpa_supplicant(struct net_device *dev, struct iw_point *p){ if (param == NULL) return -ENOMEM; - if (copy_from_user(param, p->pointer, p->length)){ + if (copy_from_user(param, p->pointer, p->length)) { kfree(param); return -EFAULT; } - switch (param->cmd){ + switch (param->cmd) { case IPW2100_CMD_SET_WPA_PARAM: ret = ipw2100_wpa_set_param(dev, param->u.wpa_param.name, @@ -6182,8 +6179,9 @@ static int ipw2100_wpa_supplicant(struct net_device *dev, struct iw_point *p){ break; default: - printk(KERN_ERR DRV_NAME ": %s: Unknown WPA supplicant request: %d\n", - dev->name, param->cmd); + printk(KERN_ERR DRV_NAME + ": %s: Unknown WPA supplicant request: %d\n", dev->name, + param->cmd); ret = -EOPNOTSUPP; } @@ -6194,28 +6192,27 @@ static int ipw2100_wpa_supplicant(struct net_device *dev, struct iw_point *p){ kfree(param); return ret; } -#endif /* CONFIG_IEEE80211_WPA */ +#endif /* CONFIG_IEEE80211_WPA */ static int ipw2100_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { #ifdef CONFIG_IEEE80211_WPA - struct iwreq *wrq = (struct iwreq *) rq; - int ret=-1; - switch (cmd){ - case IPW2100_IOCTL_WPA_SUPPLICANT: + struct iwreq *wrq = (struct iwreq *)rq; + int ret = -1; + switch (cmd) { + case IPW2100_IOCTL_WPA_SUPPLICANT: ret = ipw2100_wpa_supplicant(dev, &wrq->u.data); return ret; - default: + default: return -EOPNOTSUPP; } -#endif /* CONFIG_IEEE80211_WPA */ +#endif /* CONFIG_IEEE80211_WPA */ return -EOPNOTSUPP; } - static void ipw_ethtool_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) { @@ -6236,14 +6233,13 @@ static void ipw_ethtool_get_drvinfo(struct net_device *dev, static u32 ipw2100_ethtool_get_link(struct net_device *dev) { - struct ipw2100_priv *priv = ieee80211_priv(dev); - return (priv->status & STATUS_ASSOCIATED) ? 1 : 0; + struct ipw2100_priv *priv = ieee80211_priv(dev); + return (priv->status & STATUS_ASSOCIATED) ? 1 : 0; } - static struct ethtool_ops ipw2100_ethtool_ops = { - .get_link = ipw2100_ethtool_get_link, - .get_drvinfo = ipw_ethtool_get_drvinfo, + .get_link = ipw2100_ethtool_get_link, + .get_drvinfo = ipw_ethtool_get_drvinfo, }; static void ipw2100_hang_check(void *adapter) @@ -6288,7 +6284,6 @@ static void ipw2100_hang_check(void *adapter) spin_unlock_irqrestore(&priv->low_lock, flags); } - static void ipw2100_rf_kill(void *adapter) { struct ipw2100_priv *priv = adapter; @@ -6313,7 +6308,7 @@ static void ipw2100_rf_kill(void *adapter) IPW_DEBUG_RF_KILL("HW RF Kill deactivated. SW RF Kill still " "enabled\n"); - exit_unlock: + exit_unlock: spin_unlock_irqrestore(&priv->low_lock, flags); } @@ -6321,11 +6316,10 @@ static void ipw2100_irq_tasklet(struct ipw2100_priv *priv); /* Look into using netdev destructor to shutdown ieee80211? */ -static struct net_device *ipw2100_alloc_device( - struct pci_dev *pci_dev, - void __iomem *base_addr, - unsigned long mem_start, - unsigned long mem_len) +static struct net_device *ipw2100_alloc_device(struct pci_dev *pci_dev, + void __iomem * base_addr, + unsigned long mem_start, + unsigned long mem_len) { struct ipw2100_priv *priv; struct net_device *dev; @@ -6351,7 +6345,7 @@ static struct net_device *ipw2100_alloc_device( dev->wireless_handlers = &ipw2100_wx_handler_def; dev->get_wireless_stats = ipw2100_wx_wireless_stats; dev->set_mac_address = ipw2100_set_address; - dev->watchdog_timeo = 3*HZ; + dev->watchdog_timeo = 3 * HZ; dev->irq = 0; dev->base_addr = (unsigned long)base_addr; @@ -6364,22 +6358,19 @@ static struct net_device *ipw2100_alloc_device( * ends up causing problems. So, we just handle * the WX extensions through the ipw2100_ioctl interface */ - /* memset() puts everything to 0, so we only have explicitely set * those values that need to be something else */ /* If power management is turned on, default to AUTO mode */ priv->power_mode = IPW_POWER_AUTO; - - #ifdef CONFIG_IEEE80211_WPA priv->ieee->wpa_enabled = 0; priv->ieee->tkip_countermeasures = 0; priv->ieee->drop_unencrypted = 0; priv->ieee->privacy_invoked = 0; priv->ieee->ieee802_1x = 1; -#endif /* CONFIG_IEEE80211_WPA */ +#endif /* CONFIG_IEEE80211_WPA */ /* Set module parameters */ switch (mode) { @@ -6401,8 +6392,7 @@ static struct net_device *ipw2100_alloc_device( priv->status |= STATUS_RF_KILL_SW; if (channel != 0 && - ((channel >= REG_MIN_CHANNEL) && - (channel <= REG_MAX_CHANNEL))) { + ((channel >= REG_MIN_CHANNEL) && (channel <= REG_MAX_CHANNEL))) { priv->config |= CFG_STATIC_CHANNEL; priv->channel = channel; } @@ -6441,7 +6431,6 @@ static struct net_device *ipw2100_alloc_device( INIT_LIST_HEAD(&priv->fw_pend_list); INIT_STAT(&priv->fw_pend_stat); - #ifdef CONFIG_SOFTWARE_SUSPEND2 priv->workqueue = create_workqueue(DRV_NAME, 0); #else @@ -6535,7 +6524,7 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev, return err; } - /* We disable the RETRY_TIMEOUT register (0x41) to keep + /* We disable the RETRY_TIMEOUT register (0x41) to keep * PCI Tx retries from interfering with C3 CPU state */ pci_read_config_dword(pci_dev, 0x40, &val); if ((val & 0x0000ff00) != 0) @@ -6566,12 +6555,10 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev, ipw2100_queues_initialize(priv); err = request_irq(pci_dev->irq, - ipw2100_interrupt, SA_SHIRQ, - dev->name, priv); + ipw2100_interrupt, SA_SHIRQ, dev->name, priv); if (err) { printk(KERN_WARNING DRV_NAME - "Error calling request_irq: %d.\n", - pci_dev->irq); + "Error calling request_irq: %d.\n", pci_dev->irq); goto fail; } dev->irq = pci_dev->irq; @@ -6634,10 +6621,10 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev, return 0; - fail_unlock: + fail_unlock: up(&priv->action_sem); - fail: + fail: if (dev) { if (registered) unregister_netdev(dev); @@ -6653,7 +6640,8 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev, /* These are safe to call even if they weren't allocated */ ipw2100_queues_free(priv); - sysfs_remove_group(&pci_dev->dev.kobj, &ipw2100_attribute_group); + sysfs_remove_group(&pci_dev->dev.kobj, + &ipw2100_attribute_group); free_ieee80211(dev); pci_set_drvdata(pci_dev, NULL); @@ -6679,7 +6667,8 @@ static void __devexit ipw2100_pci_remove_one(struct pci_dev *pci_dev) priv->status &= ~STATUS_INITIALIZED; dev = priv->net_dev; - sysfs_remove_group(&pci_dev->dev.kobj, &ipw2100_attribute_group); + sysfs_remove_group(&pci_dev->dev.kobj, + &ipw2100_attribute_group); #ifdef CONFIG_PM if (ipw2100_firmware.version) @@ -6721,7 +6710,6 @@ static void __devexit ipw2100_pci_remove_one(struct pci_dev *pci_dev) IPW_DEBUG_INFO("exit\n"); } - #ifdef CONFIG_PM #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11) static int ipw2100_suspend(struct pci_dev *pci_dev, u32 state) @@ -6732,8 +6720,7 @@ static int ipw2100_suspend(struct pci_dev *pci_dev, pm_message_t state) struct ipw2100_priv *priv = pci_get_drvdata(pci_dev); struct net_device *dev = priv->net_dev; - IPW_DEBUG_INFO("%s: Going into suspend...\n", - dev->name); + IPW_DEBUG_INFO("%s: Going into suspend...\n", dev->name); down(&priv->action_sem); if (priv->status & STATUS_INITIALIZED) { @@ -6745,7 +6732,7 @@ static int ipw2100_suspend(struct pci_dev *pci_dev, pm_message_t state) netif_device_detach(dev); pci_save_state(pci_dev); - pci_disable_device (pci_dev); + pci_disable_device(pci_dev); pci_set_power_state(pci_dev, PCI_D3hot); up(&priv->action_sem); @@ -6764,8 +6751,7 @@ static int ipw2100_resume(struct pci_dev *pci_dev) down(&priv->action_sem); - IPW_DEBUG_INFO("%s: Coming out of suspend...\n", - dev->name); + IPW_DEBUG_INFO("%s: Coming out of suspend...\n", dev->name); pci_set_power_state(pci_dev, PCI_D0); pci_enable_device(pci_dev); @@ -6785,9 +6771,9 @@ static int ipw2100_resume(struct pci_dev *pci_dev) * the queue of needed */ netif_device_attach(dev); - /* Bring the device back up */ - if (!(priv->status & STATUS_RF_KILL_SW)) - ipw2100_up(priv, 0); + /* Bring the device back up */ + if (!(priv->status & STATUS_RF_KILL_SW)) + ipw2100_up(priv, 0); up(&priv->action_sem); @@ -6795,56 +6781,55 @@ static int ipw2100_resume(struct pci_dev *pci_dev) } #endif - #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } static struct pci_device_id ipw2100_pci_id_table[] __devinitdata = { - IPW2100_DEV_ID(0x2520), /* IN 2100A mPCI 3A */ - IPW2100_DEV_ID(0x2521), /* IN 2100A mPCI 3B */ - IPW2100_DEV_ID(0x2524), /* IN 2100A mPCI 3B */ - IPW2100_DEV_ID(0x2525), /* IN 2100A mPCI 3B */ - IPW2100_DEV_ID(0x2526), /* IN 2100A mPCI Gen A3 */ - IPW2100_DEV_ID(0x2522), /* IN 2100 mPCI 3B */ - IPW2100_DEV_ID(0x2523), /* IN 2100 mPCI 3A */ - IPW2100_DEV_ID(0x2527), /* IN 2100 mPCI 3B */ - IPW2100_DEV_ID(0x2528), /* IN 2100 mPCI 3B */ - IPW2100_DEV_ID(0x2529), /* IN 2100 mPCI 3B */ - IPW2100_DEV_ID(0x252B), /* IN 2100 mPCI 3A */ - IPW2100_DEV_ID(0x252C), /* IN 2100 mPCI 3A */ - IPW2100_DEV_ID(0x252D), /* IN 2100 mPCI 3A */ - - IPW2100_DEV_ID(0x2550), /* IB 2100A mPCI 3B */ - IPW2100_DEV_ID(0x2551), /* IB 2100 mPCI 3B */ - IPW2100_DEV_ID(0x2553), /* IB 2100 mPCI 3B */ - IPW2100_DEV_ID(0x2554), /* IB 2100 mPCI 3B */ - IPW2100_DEV_ID(0x2555), /* IB 2100 mPCI 3B */ - - IPW2100_DEV_ID(0x2560), /* DE 2100A mPCI 3A */ - IPW2100_DEV_ID(0x2562), /* DE 2100A mPCI 3A */ - IPW2100_DEV_ID(0x2563), /* DE 2100A mPCI 3A */ - IPW2100_DEV_ID(0x2561), /* DE 2100 mPCI 3A */ - IPW2100_DEV_ID(0x2565), /* DE 2100 mPCI 3A */ - IPW2100_DEV_ID(0x2566), /* DE 2100 mPCI 3A */ - IPW2100_DEV_ID(0x2567), /* DE 2100 mPCI 3A */ - - IPW2100_DEV_ID(0x2570), /* GA 2100 mPCI 3B */ - - IPW2100_DEV_ID(0x2580), /* TO 2100A mPCI 3B */ - IPW2100_DEV_ID(0x2582), /* TO 2100A mPCI 3B */ - IPW2100_DEV_ID(0x2583), /* TO 2100A mPCI 3B */ - IPW2100_DEV_ID(0x2581), /* TO 2100 mPCI 3B */ - IPW2100_DEV_ID(0x2585), /* TO 2100 mPCI 3B */ - IPW2100_DEV_ID(0x2586), /* TO 2100 mPCI 3B */ - IPW2100_DEV_ID(0x2587), /* TO 2100 mPCI 3B */ - - IPW2100_DEV_ID(0x2590), /* SO 2100A mPCI 3B */ - IPW2100_DEV_ID(0x2592), /* SO 2100A mPCI 3B */ - IPW2100_DEV_ID(0x2591), /* SO 2100 mPCI 3B */ - IPW2100_DEV_ID(0x2593), /* SO 2100 mPCI 3B */ - IPW2100_DEV_ID(0x2596), /* SO 2100 mPCI 3B */ - IPW2100_DEV_ID(0x2598), /* SO 2100 mPCI 3B */ - - IPW2100_DEV_ID(0x25A0), /* HP 2100 mPCI 3B */ + IPW2100_DEV_ID(0x2520), /* IN 2100A mPCI 3A */ + IPW2100_DEV_ID(0x2521), /* IN 2100A mPCI 3B */ + IPW2100_DEV_ID(0x2524), /* IN 2100A mPCI 3B */ + IPW2100_DEV_ID(0x2525), /* IN 2100A mPCI 3B */ + IPW2100_DEV_ID(0x2526), /* IN 2100A mPCI Gen A3 */ + IPW2100_DEV_ID(0x2522), /* IN 2100 mPCI 3B */ + IPW2100_DEV_ID(0x2523), /* IN 2100 mPCI 3A */ + IPW2100_DEV_ID(0x2527), /* IN 2100 mPCI 3B */ + IPW2100_DEV_ID(0x2528), /* IN 2100 mPCI 3B */ + IPW2100_DEV_ID(0x2529), /* IN 2100 mPCI 3B */ + IPW2100_DEV_ID(0x252B), /* IN 2100 mPCI 3A */ + IPW2100_DEV_ID(0x252C), /* IN 2100 mPCI 3A */ + IPW2100_DEV_ID(0x252D), /* IN 2100 mPCI 3A */ + + IPW2100_DEV_ID(0x2550), /* IB 2100A mPCI 3B */ + IPW2100_DEV_ID(0x2551), /* IB 2100 mPCI 3B */ + IPW2100_DEV_ID(0x2553), /* IB 2100 mPCI 3B */ + IPW2100_DEV_ID(0x2554), /* IB 2100 mPCI 3B */ + IPW2100_DEV_ID(0x2555), /* IB 2100 mPCI 3B */ + + IPW2100_DEV_ID(0x2560), /* DE 2100A mPCI 3A */ + IPW2100_DEV_ID(0x2562), /* DE 2100A mPCI 3A */ + IPW2100_DEV_ID(0x2563), /* DE 2100A mPCI 3A */ + IPW2100_DEV_ID(0x2561), /* DE 2100 mPCI 3A */ + IPW2100_DEV_ID(0x2565), /* DE 2100 mPCI 3A */ + IPW2100_DEV_ID(0x2566), /* DE 2100 mPCI 3A */ + IPW2100_DEV_ID(0x2567), /* DE 2100 mPCI 3A */ + + IPW2100_DEV_ID(0x2570), /* GA 2100 mPCI 3B */ + + IPW2100_DEV_ID(0x2580), /* TO 2100A mPCI 3B */ + IPW2100_DEV_ID(0x2582), /* TO 2100A mPCI 3B */ + IPW2100_DEV_ID(0x2583), /* TO 2100A mPCI 3B */ + IPW2100_DEV_ID(0x2581), /* TO 2100 mPCI 3B */ + IPW2100_DEV_ID(0x2585), /* TO 2100 mPCI 3B */ + IPW2100_DEV_ID(0x2586), /* TO 2100 mPCI 3B */ + IPW2100_DEV_ID(0x2587), /* TO 2100 mPCI 3B */ + + IPW2100_DEV_ID(0x2590), /* SO 2100A mPCI 3B */ + IPW2100_DEV_ID(0x2592), /* SO 2100A mPCI 3B */ + IPW2100_DEV_ID(0x2591), /* SO 2100 mPCI 3B */ + IPW2100_DEV_ID(0x2593), /* SO 2100 mPCI 3B */ + IPW2100_DEV_ID(0x2596), /* SO 2100 mPCI 3B */ + IPW2100_DEV_ID(0x2598), /* SO 2100 mPCI 3B */ + + IPW2100_DEV_ID(0x25A0), /* HP 2100 mPCI 3B */ {0,}, }; @@ -6861,7 +6846,6 @@ static struct pci_driver ipw2100_pci_driver = { #endif }; - /** * Initialize the ipw2100 driver/module * @@ -6893,7 +6877,6 @@ static int __init ipw2100_init(void) return ret; } - /** * Cleanup ipw2100 driver registration */ @@ -6949,7 +6932,6 @@ static int ipw2100_wx_get_name(struct net_device *dev, return 0; } - static int ipw2100_wx_set_freq(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) @@ -6969,8 +6951,7 @@ static int ipw2100_wx_set_freq(struct net_device *dev, /* if setting by freq convert to channel */ if (fwrq->e == 1) { - if ((fwrq->m >= (int) 2.412e8 && - fwrq->m <= (int) 2.487e8)) { + if ((fwrq->m >= (int)2.412e8 && fwrq->m <= (int)2.487e8)) { int f = fwrq->m / 100000; int c = 0; @@ -6986,17 +6967,16 @@ static int ipw2100_wx_set_freq(struct net_device *dev, if (fwrq->e > 0 || fwrq->m > 1000) return -EOPNOTSUPP; - else { /* Set the channel */ + else { /* Set the channel */ IPW_DEBUG_WX("SET Freq/Channel -> %d \n", fwrq->m); err = ipw2100_set_channel(priv, fwrq->m, 0); } - done: + done: up(&priv->action_sem); return err; } - static int ipw2100_wx_get_freq(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) @@ -7045,7 +7025,7 @@ static int ipw2100_wx_set_mode(struct net_device *dev, case IW_MODE_MONITOR: err = ipw2100_switch_mode(priv, IW_MODE_MONITOR); break; -#endif /* CONFIG_IPW2100_MONITOR */ +#endif /* CONFIG_IPW2100_MONITOR */ case IW_MODE_ADHOC: err = ipw2100_switch_mode(priv, IW_MODE_ADHOC); break; @@ -7056,9 +7036,9 @@ static int ipw2100_wx_set_mode(struct net_device *dev, break; } -done: + done: up(&priv->action_sem); - return err; + return err; } static int ipw2100_wx_get_mode(struct net_device *dev, @@ -7077,7 +7057,6 @@ static int ipw2100_wx_get_mode(struct net_device *dev, return 0; } - #define POWER_MODES 5 /* Values are in microsecond */ @@ -7124,19 +7103,19 @@ static int ipw2100_wx_get_range(struct net_device *dev, /* ~5 Mb/s real (802.11b) */ range->throughput = 5 * 1000 * 1000; -// range->sensitivity; /* signal level threshold range */ +// range->sensitivity; /* signal level threshold range */ range->max_qual.qual = 100; /* TODO: Find real max RSSI and stick here */ range->max_qual.level = 0; range->max_qual.noise = 0; - range->max_qual.updated = 7; /* Updated all three */ + range->max_qual.updated = 7; /* Updated all three */ - range->avg_qual.qual = 70; /* > 8% missed beacons is 'bad' */ + range->avg_qual.qual = 70; /* > 8% missed beacons is 'bad' */ /* TODO: Find real 'good' to 'bad' threshol value for RSSI */ range->avg_qual.level = 20 + IPW2100_RSSI_TO_DBM; range->avg_qual.noise = 0; - range->avg_qual.updated = 7; /* Updated all three */ + range->avg_qual.updated = 7; /* Updated all three */ range->num_bitrates = RATE_COUNT; @@ -7150,61 +7129,62 @@ static int ipw2100_wx_get_range(struct net_device *dev, range->max_frag = MAX_FRAG_THRESHOLD; range->min_pmp = period_duration[0]; /* Minimal PM period */ - range->max_pmp = period_duration[POWER_MODES-1];/* Maximal PM period */ - range->min_pmt = timeout_duration[POWER_MODES-1]; /* Minimal PM timeout */ - range->max_pmt = timeout_duration[0];/* Maximal PM timeout */ + range->max_pmp = period_duration[POWER_MODES - 1]; /* Maximal PM period */ + range->min_pmt = timeout_duration[POWER_MODES - 1]; /* Minimal PM timeout */ + range->max_pmt = timeout_duration[0]; /* Maximal PM timeout */ - /* How to decode max/min PM period */ + /* How to decode max/min PM period */ range->pmp_flags = IW_POWER_PERIOD; - /* How to decode max/min PM period */ + /* How to decode max/min PM period */ range->pmt_flags = IW_POWER_TIMEOUT; /* What PM options are supported */ range->pm_capa = IW_POWER_TIMEOUT | IW_POWER_PERIOD; range->encoding_size[0] = 5; - range->encoding_size[1] = 13; /* Different token sizes */ - range->num_encoding_sizes = 2; /* Number of entry in the list */ - range->max_encoding_tokens = WEP_KEYS; /* Max number of tokens */ -// range->encoding_login_index; /* token index for login token */ + range->encoding_size[1] = 13; /* Different token sizes */ + range->num_encoding_sizes = 2; /* Number of entry in the list */ + range->max_encoding_tokens = WEP_KEYS; /* Max number of tokens */ +// range->encoding_login_index; /* token index for login token */ if (priv->ieee->iw_mode == IW_MODE_ADHOC) { range->txpower_capa = IW_TXPOW_DBM; range->num_txpower = IW_MAX_TXPOWER; - for (i = 0, level = (IPW_TX_POWER_MAX_DBM * 16); i < IW_MAX_TXPOWER; - i++, level -= ((IPW_TX_POWER_MAX_DBM - IPW_TX_POWER_MIN_DBM) * 16) / - (IW_MAX_TXPOWER - 1)) + for (i = 0, level = (IPW_TX_POWER_MAX_DBM * 16); + i < IW_MAX_TXPOWER; + i++, level -= + ((IPW_TX_POWER_MAX_DBM - + IPW_TX_POWER_MIN_DBM) * 16) / (IW_MAX_TXPOWER - 1)) range->txpower[i] = level / 16; } else { range->txpower_capa = 0; range->num_txpower = 0; } - /* Set the Wireless Extension versions */ range->we_version_compiled = WIRELESS_EXT; range->we_version_source = 16; -// range->retry_capa; /* What retry options are supported */ -// range->retry_flags; /* How to decode max/min retry limit */ -// range->r_time_flags; /* How to decode max/min retry life */ -// range->min_retry; /* Minimal number of retries */ -// range->max_retry; /* Maximal number of retries */ -// range->min_r_time; /* Minimal retry lifetime */ -// range->max_r_time; /* Maximal retry lifetime */ +// range->retry_capa; /* What retry options are supported */ +// range->retry_flags; /* How to decode max/min retry limit */ +// range->r_time_flags; /* How to decode max/min retry life */ +// range->min_retry; /* Minimal number of retries */ +// range->max_retry; /* Maximal number of retries */ +// range->min_r_time; /* Minimal retry lifetime */ +// range->max_r_time; /* Maximal retry lifetime */ - range->num_channels = FREQ_COUNT; + range->num_channels = FREQ_COUNT; val = 0; for (i = 0; i < FREQ_COUNT; i++) { // TODO: Include only legal frequencies for some countries -// if (local->channel_mask & (1 << i)) { - range->freq[val].i = i + 1; - range->freq[val].m = ipw2100_frequencies[i] * 100000; - range->freq[val].e = 1; - val++; -// } +// if (local->channel_mask & (1 << i)) { + range->freq[val].i = i + 1; + range->freq[val].m = ipw2100_frequencies[i] * 100000; + range->freq[val].e = 1; + val++; +// } if (val == IW_MAX_FREQUENCIES) - break; + break; } range->num_frequency = val; @@ -7259,7 +7239,7 @@ static int ipw2100_wx_set_wap(struct net_device *dev, wrqu->ap_addr.sa_data[4] & 0xff, wrqu->ap_addr.sa_data[5] & 0xff); - done: + done: up(&priv->action_sem); return err; } @@ -7276,8 +7256,7 @@ static int ipw2100_wx_get_wap(struct net_device *dev, /* If we are associated, trying to associate, or have a statically * configured BSSID then return that; otherwise return ANY */ - if (priv->config & CFG_STATIC_BSSID || - priv->status & STATUS_ASSOCIATED) { + if (priv->config & CFG_STATIC_BSSID || priv->status & STATUS_ASSOCIATED) { wrqu->ap_addr.sa_family = ARPHRD_ETHER; memcpy(wrqu->ap_addr.sa_data, &priv->bssid, ETH_ALEN); } else @@ -7293,7 +7272,7 @@ static int ipw2100_wx_set_essid(struct net_device *dev, union iwreq_data *wrqu, char *extra) { struct ipw2100_priv *priv = ieee80211_priv(dev); - char *essid = ""; /* ANY */ + char *essid = ""; /* ANY */ int length = 0; int err = 0; @@ -7333,7 +7312,7 @@ static int ipw2100_wx_set_essid(struct net_device *dev, err = ipw2100_set_essid(priv, essid, length, 0); - done: + done: up(&priv->action_sem); return err; } @@ -7350,17 +7329,16 @@ static int ipw2100_wx_get_essid(struct net_device *dev, /* If we are associated, trying to associate, or have a statically * configured ESSID then return that; otherwise return ANY */ - if (priv->config & CFG_STATIC_ESSID || - priv->status & STATUS_ASSOCIATED) { + if (priv->config & CFG_STATIC_ESSID || priv->status & STATUS_ASSOCIATED) { IPW_DEBUG_WX("Getting essid: '%s'\n", escape_essid(priv->essid, priv->essid_len)); memcpy(extra, priv->essid, priv->essid_len); wrqu->essid.length = priv->essid_len; - wrqu->essid.flags = 1; /* active */ + wrqu->essid.flags = 1; /* active */ } else { IPW_DEBUG_WX("Getting essid: ANY\n"); wrqu->essid.length = 0; - wrqu->essid.flags = 0; /* active */ + wrqu->essid.flags = 0; /* active */ } return 0; @@ -7379,9 +7357,9 @@ static int ipw2100_wx_set_nick(struct net_device *dev, if (wrqu->data.length > IW_ESSID_MAX_SIZE) return -E2BIG; - wrqu->data.length = min((size_t)wrqu->data.length, sizeof(priv->nick)); + wrqu->data.length = min((size_t) wrqu->data.length, sizeof(priv->nick)); memset(priv->nick, 0, sizeof(priv->nick)); - memcpy(priv->nick, extra, wrqu->data.length); + memcpy(priv->nick, extra, wrqu->data.length); IPW_DEBUG_WX("SET Nickname -> %s \n", priv->nick); @@ -7400,7 +7378,7 @@ static int ipw2100_wx_get_nick(struct net_device *dev, wrqu->data.length = strlen(priv->nick) + 1; memcpy(extra, priv->nick, wrqu->data.length); - wrqu->data.flags = 1; /* active */ + wrqu->data.flags = 1; /* active */ IPW_DEBUG_WX("GET Nickname -> %s \n", extra); @@ -7442,12 +7420,11 @@ static int ipw2100_wx_set_rate(struct net_device *dev, err = ipw2100_set_tx_rates(priv, rate, 0); IPW_DEBUG_WX("SET Rate -> %04X \n", rate); - done: + done: up(&priv->action_sem); return err; } - static int ipw2100_wx_get_rate(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) @@ -7495,7 +7472,7 @@ static int ipw2100_wx_get_rate(struct net_device *dev, IPW_DEBUG_WX("GET Rate -> %d \n", wrqu->bitrate.value); - done: + done: up(&priv->action_sem); return err; } @@ -7520,8 +7497,7 @@ static int ipw2100_wx_set_rts(struct net_device *dev, if (wrqu->rts.disabled) value = priv->rts_threshold | RTS_DISABLED; else { - if (wrqu->rts.value < 1 || - wrqu->rts.value > 2304) { + if (wrqu->rts.value < 1 || wrqu->rts.value > 2304) { err = -EINVAL; goto done; } @@ -7531,7 +7507,7 @@ static int ipw2100_wx_set_rts(struct net_device *dev, err = ipw2100_set_rts_threshold(priv, value); IPW_DEBUG_WX("SET RTS Threshold -> 0x%08X \n", value); - done: + done: up(&priv->action_sem); return err; } @@ -7547,7 +7523,7 @@ static int ipw2100_wx_get_rts(struct net_device *dev, struct ipw2100_priv *priv = ieee80211_priv(dev); wrqu->rts.value = priv->rts_threshold & ~RTS_DISABLED; - wrqu->rts.fixed = 1; /* no auto select */ + wrqu->rts.fixed = 1; /* no auto select */ /* If RTS is set to the default value, then it is disabled */ wrqu->rts.disabled = (priv->rts_threshold & RTS_DISABLED) ? 1 : 0; @@ -7575,7 +7551,7 @@ static int ipw2100_wx_set_txpow(struct net_device *dev, return -EINVAL; value = (wrqu->txpower.value - IPW_TX_POWER_MIN_DBM) * 16 / - (IPW_TX_POWER_MAX_DBM - IPW_TX_POWER_MIN_DBM); + (IPW_TX_POWER_MAX_DBM - IPW_TX_POWER_MIN_DBM); } down(&priv->action_sem); @@ -7588,7 +7564,7 @@ static int ipw2100_wx_set_txpow(struct net_device *dev, IPW_DEBUG_WX("SET TX Power -> %d \n", value); - done: + done: up(&priv->action_sem); return err; } @@ -7616,10 +7592,10 @@ static int ipw2100_wx_get_txpow(struct net_device *dev, wrqu->power.disabled = 0; wrqu->power.fixed = 1; wrqu->power.value = - (priv->tx_power * - (IPW_TX_POWER_MAX_DBM - IPW_TX_POWER_MIN_DBM)) / - (IPW_TX_POWER_MAX - IPW_TX_POWER_MIN) + - IPW_TX_POWER_MIN_DBM; + (priv->tx_power * + (IPW_TX_POWER_MAX_DBM - IPW_TX_POWER_MIN_DBM)) / + (IPW_TX_POWER_MAX - IPW_TX_POWER_MIN) + + IPW_TX_POWER_MIN_DBM; } wrqu->power.flags = IW_TXPOW_DBM; @@ -7684,8 +7660,7 @@ static int ipw2100_wx_set_retry(struct net_device *dev, struct ipw2100_priv *priv = ieee80211_priv(dev); int err = 0; - if (wrqu->retry.flags & IW_RETRY_LIFETIME || - wrqu->retry.disabled) + if (wrqu->retry.flags & IW_RETRY_LIFETIME || wrqu->retry.disabled) return -EINVAL; if (!(wrqu->retry.flags & IW_RETRY_LIMIT)) @@ -7700,14 +7675,14 @@ static int ipw2100_wx_set_retry(struct net_device *dev, if (wrqu->retry.flags & IW_RETRY_MIN) { err = ipw2100_set_short_retry(priv, wrqu->retry.value); IPW_DEBUG_WX("SET Short Retry Limit -> %d \n", - wrqu->retry.value); + wrqu->retry.value); goto done; } if (wrqu->retry.flags & IW_RETRY_MAX) { err = ipw2100_set_long_retry(priv, wrqu->retry.value); IPW_DEBUG_WX("SET Long Retry Limit -> %d \n", - wrqu->retry.value); + wrqu->retry.value); goto done; } @@ -7717,7 +7692,7 @@ static int ipw2100_wx_set_retry(struct net_device *dev, IPW_DEBUG_WX("SET Both Retry Limits -> %d \n", wrqu->retry.value); - done: + done: up(&priv->action_sem); return err; } @@ -7732,10 +7707,9 @@ static int ipw2100_wx_get_retry(struct net_device *dev, struct ipw2100_priv *priv = ieee80211_priv(dev); - wrqu->retry.disabled = 0; /* can't be disabled */ + wrqu->retry.disabled = 0; /* can't be disabled */ - if ((wrqu->retry.flags & IW_RETRY_TYPE) == - IW_RETRY_LIFETIME) + if ((wrqu->retry.flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) return -EINVAL; if (wrqu->retry.flags & IW_RETRY_MAX) { @@ -7769,15 +7743,14 @@ static int ipw2100_wx_set_scan(struct net_device *dev, } IPW_DEBUG_WX("Initiating scan...\n"); - if (ipw2100_set_scan_options(priv) || - ipw2100_start_scan(priv)) { + if (ipw2100_set_scan_options(priv) || ipw2100_start_scan(priv)) { IPW_DEBUG_WX("Start scan failed.\n"); /* TODO: Mark a scan as pending so when hardware initialized * a scan starts */ } - done: + done: up(&priv->action_sem); return err; } @@ -7794,7 +7767,6 @@ static int ipw2100_wx_get_scan(struct net_device *dev, return ieee80211_wx_get_scan(priv->ieee, info, wrqu, extra); } - /* * Implementation based on code in hostap-driver v0.1.3 hostap_ioctl.c */ @@ -7823,8 +7795,8 @@ static int ipw2100_wx_get_encode(struct net_device *dev, } static int ipw2100_wx_set_power(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { struct ipw2100_priv *priv = ieee80211_priv(dev); int err = 0; @@ -7843,11 +7815,11 @@ static int ipw2100_wx_set_power(struct net_device *dev, } switch (wrqu->power.flags & IW_POWER_MODE) { - case IW_POWER_ON: /* If not specified */ - case IW_POWER_MODE: /* If set all mask */ - case IW_POWER_ALL_R: /* If explicitely state all */ + case IW_POWER_ON: /* If not specified */ + case IW_POWER_MODE: /* If set all mask */ + case IW_POWER_ALL_R: /* If explicitely state all */ break; - default: /* Otherwise we don't support it */ + default: /* Otherwise we don't support it */ IPW_DEBUG_WX("SET PM Mode: %X not supported.\n", wrqu->power.flags); err = -EOPNOTSUPP; @@ -7859,18 +7831,17 @@ static int ipw2100_wx_set_power(struct net_device *dev, priv->power_mode = IPW_POWER_ENABLED | priv->power_mode; err = ipw2100_set_power_mode(priv, IPW_POWER_LEVEL(priv->power_mode)); - IPW_DEBUG_WX("SET Power Management Mode -> 0x%02X\n", - priv->power_mode); + IPW_DEBUG_WX("SET Power Management Mode -> 0x%02X\n", priv->power_mode); - done: + done: up(&priv->action_sem); return err; } static int ipw2100_wx_get_power(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { /* * This can be called at any time. No action lock required @@ -7890,7 +7861,6 @@ static int ipw2100_wx_get_power(struct net_device *dev, return 0; } - /* * * IWPRIV handlers @@ -7923,7 +7893,7 @@ static int ipw2100_wx_set_promisc(struct net_device *dev, if (priv->ieee->iw_mode == IW_MODE_MONITOR) err = ipw2100_switch_mode(priv, priv->last_mode); } - done: + done: up(&priv->action_sem); return err; } @@ -7958,7 +7928,7 @@ static int ipw2100_wx_set_powermode(struct net_device *dev, if (priv->power_mode != mode) err = ipw2100_set_power_mode(priv, mode); - done: + done: up(&priv->action_sem); return err; } @@ -7986,8 +7956,8 @@ static int ipw2100_wx_get_powermode(struct net_device *dev, "Power save level: %d (None)", level); break; case IPW_POWER_AUTO: - snprintf(extra, MAX_POWER_STRING, - "Power save level: %d (Auto)", 0); + snprintf(extra, MAX_POWER_STRING, + "Power save level: %d (Auto)", 0); break; default: timeout = timeout_duration[level - 1] / 1000; @@ -8004,7 +7974,6 @@ static int ipw2100_wx_get_powermode(struct net_device *dev, return 0; } - static int ipw2100_wx_set_preamble(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) @@ -8029,14 +7998,14 @@ static int ipw2100_wx_set_preamble(struct net_device *dev, err = ipw2100_system_config(priv, 0); -done: + done: up(&priv->action_sem); return err; } static int ipw2100_wx_get_preamble(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { /* * This can be called at any time. No action lock required @@ -8052,54 +8021,53 @@ static int ipw2100_wx_get_preamble(struct net_device *dev, return 0; } -static iw_handler ipw2100_wx_handlers[] = -{ - NULL, /* SIOCSIWCOMMIT */ - ipw2100_wx_get_name, /* SIOCGIWNAME */ - NULL, /* SIOCSIWNWID */ - NULL, /* SIOCGIWNWID */ - ipw2100_wx_set_freq, /* SIOCSIWFREQ */ - ipw2100_wx_get_freq, /* SIOCGIWFREQ */ - ipw2100_wx_set_mode, /* SIOCSIWMODE */ - ipw2100_wx_get_mode, /* SIOCGIWMODE */ - NULL, /* SIOCSIWSENS */ - NULL, /* SIOCGIWSENS */ - NULL, /* SIOCSIWRANGE */ - ipw2100_wx_get_range, /* SIOCGIWRANGE */ - NULL, /* SIOCSIWPRIV */ - NULL, /* SIOCGIWPRIV */ - NULL, /* SIOCSIWSTATS */ - NULL, /* SIOCGIWSTATS */ - NULL, /* SIOCSIWSPY */ - NULL, /* SIOCGIWSPY */ - NULL, /* SIOCGIWTHRSPY */ - NULL, /* SIOCWIWTHRSPY */ - ipw2100_wx_set_wap, /* SIOCSIWAP */ - ipw2100_wx_get_wap, /* SIOCGIWAP */ - NULL, /* -- hole -- */ - NULL, /* SIOCGIWAPLIST -- deprecated */ - ipw2100_wx_set_scan, /* SIOCSIWSCAN */ - ipw2100_wx_get_scan, /* SIOCGIWSCAN */ - ipw2100_wx_set_essid, /* SIOCSIWESSID */ - ipw2100_wx_get_essid, /* SIOCGIWESSID */ - ipw2100_wx_set_nick, /* SIOCSIWNICKN */ - ipw2100_wx_get_nick, /* SIOCGIWNICKN */ - NULL, /* -- hole -- */ - NULL, /* -- hole -- */ - ipw2100_wx_set_rate, /* SIOCSIWRATE */ - ipw2100_wx_get_rate, /* SIOCGIWRATE */ - ipw2100_wx_set_rts, /* SIOCSIWRTS */ - ipw2100_wx_get_rts, /* SIOCGIWRTS */ - ipw2100_wx_set_frag, /* SIOCSIWFRAG */ - ipw2100_wx_get_frag, /* SIOCGIWFRAG */ - ipw2100_wx_set_txpow, /* SIOCSIWTXPOW */ - ipw2100_wx_get_txpow, /* SIOCGIWTXPOW */ - ipw2100_wx_set_retry, /* SIOCSIWRETRY */ - ipw2100_wx_get_retry, /* SIOCGIWRETRY */ - ipw2100_wx_set_encode, /* SIOCSIWENCODE */ - ipw2100_wx_get_encode, /* SIOCGIWENCODE */ - ipw2100_wx_set_power, /* SIOCSIWPOWER */ - ipw2100_wx_get_power, /* SIOCGIWPOWER */ +static iw_handler ipw2100_wx_handlers[] = { + NULL, /* SIOCSIWCOMMIT */ + ipw2100_wx_get_name, /* SIOCGIWNAME */ + NULL, /* SIOCSIWNWID */ + NULL, /* SIOCGIWNWID */ + ipw2100_wx_set_freq, /* SIOCSIWFREQ */ + ipw2100_wx_get_freq, /* SIOCGIWFREQ */ + ipw2100_wx_set_mode, /* SIOCSIWMODE */ + ipw2100_wx_get_mode, /* SIOCGIWMODE */ + NULL, /* SIOCSIWSENS */ + NULL, /* SIOCGIWSENS */ + NULL, /* SIOCSIWRANGE */ + ipw2100_wx_get_range, /* SIOCGIWRANGE */ + NULL, /* SIOCSIWPRIV */ + NULL, /* SIOCGIWPRIV */ + NULL, /* SIOCSIWSTATS */ + NULL, /* SIOCGIWSTATS */ + NULL, /* SIOCSIWSPY */ + NULL, /* SIOCGIWSPY */ + NULL, /* SIOCGIWTHRSPY */ + NULL, /* SIOCWIWTHRSPY */ + ipw2100_wx_set_wap, /* SIOCSIWAP */ + ipw2100_wx_get_wap, /* SIOCGIWAP */ + NULL, /* -- hole -- */ + NULL, /* SIOCGIWAPLIST -- deprecated */ + ipw2100_wx_set_scan, /* SIOCSIWSCAN */ + ipw2100_wx_get_scan, /* SIOCGIWSCAN */ + ipw2100_wx_set_essid, /* SIOCSIWESSID */ + ipw2100_wx_get_essid, /* SIOCGIWESSID */ + ipw2100_wx_set_nick, /* SIOCSIWNICKN */ + ipw2100_wx_get_nick, /* SIOCGIWNICKN */ + NULL, /* -- hole -- */ + NULL, /* -- hole -- */ + ipw2100_wx_set_rate, /* SIOCSIWRATE */ + ipw2100_wx_get_rate, /* SIOCGIWRATE */ + ipw2100_wx_set_rts, /* SIOCSIWRTS */ + ipw2100_wx_get_rts, /* SIOCGIWRTS */ + ipw2100_wx_set_frag, /* SIOCSIWFRAG */ + ipw2100_wx_get_frag, /* SIOCGIWFRAG */ + ipw2100_wx_set_txpow, /* SIOCSIWTXPOW */ + ipw2100_wx_get_txpow, /* SIOCGIWTXPOW */ + ipw2100_wx_set_retry, /* SIOCSIWRETRY */ + ipw2100_wx_get_retry, /* SIOCGIWRETRY */ + ipw2100_wx_set_encode, /* SIOCSIWENCODE */ + ipw2100_wx_get_encode, /* SIOCGIWENCODE */ + ipw2100_wx_set_power, /* SIOCSIWPOWER */ + ipw2100_wx_get_power, /* SIOCGIWPOWER */ }; #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV @@ -8113,55 +8081,49 @@ static const struct iw_priv_args ipw2100_private_args[] = { #ifdef CONFIG_IPW2100_MONITOR { - IPW2100_PRIV_SET_MONITOR, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, "monitor" - }, + IPW2100_PRIV_SET_MONITOR, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, "monitor"}, { - IPW2100_PRIV_RESET, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 0, 0, "reset" - }, -#endif /* CONFIG_IPW2100_MONITOR */ + IPW2100_PRIV_RESET, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 0, 0, "reset"}, +#endif /* CONFIG_IPW2100_MONITOR */ { - IPW2100_PRIV_SET_POWER, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_power" - }, + IPW2100_PRIV_SET_POWER, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_power"}, { - IPW2100_PRIV_GET_POWER, - 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_POWER_STRING, "get_power" - }, + IPW2100_PRIV_GET_POWER, + 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_POWER_STRING, + "get_power"}, { - IPW2100_PRIV_SET_LONGPREAMBLE, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_preamble" - }, + IPW2100_PRIV_SET_LONGPREAMBLE, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_preamble"}, { - IPW2100_PRIV_GET_LONGPREAMBLE, - 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | IFNAMSIZ, "get_preamble" - }, + IPW2100_PRIV_GET_LONGPREAMBLE, + 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | IFNAMSIZ, "get_preamble"}, }; static iw_handler ipw2100_private_handler[] = { #ifdef CONFIG_IPW2100_MONITOR ipw2100_wx_set_promisc, ipw2100_wx_reset, -#else /* CONFIG_IPW2100_MONITOR */ +#else /* CONFIG_IPW2100_MONITOR */ NULL, NULL, -#endif /* CONFIG_IPW2100_MONITOR */ +#endif /* CONFIG_IPW2100_MONITOR */ ipw2100_wx_set_powermode, ipw2100_wx_get_powermode, ipw2100_wx_set_preamble, ipw2100_wx_get_preamble, }; -static struct iw_handler_def ipw2100_wx_handler_def = -{ +static struct iw_handler_def ipw2100_wx_handler_def = { .standard = ipw2100_wx_handlers, .num_standard = sizeof(ipw2100_wx_handlers) / sizeof(iw_handler), .num_private = sizeof(ipw2100_private_handler) / sizeof(iw_handler), - .num_private_args = sizeof(ipw2100_private_args) / - sizeof(struct iw_priv_args), - .private = (iw_handler *)ipw2100_private_handler, + .num_private_args = sizeof(ipw2100_private_args) / + sizeof(struct iw_priv_args), + .private = (iw_handler *) ipw2100_private_handler, .private_args = (struct iw_priv_args *)ipw2100_private_args, }; @@ -8170,7 +8132,7 @@ static struct iw_handler_def ipw2100_wx_handler_def = * Called by /proc/net/wireless * Also called by SIOCGIWSTATS */ -static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev) +static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device *dev) { enum { POOR = 30, @@ -8190,7 +8152,7 @@ static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev) u32 ord_len = sizeof(u32); if (!priv) - return (struct iw_statistics *) NULL; + return (struct iw_statistics *)NULL; wstats = &priv->wstats; @@ -8207,7 +8169,7 @@ static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev) wstats->qual.noise = 0; wstats->qual.updated = 7; wstats->qual.updated |= IW_QUAL_NOISE_INVALID | - IW_QUAL_QUAL_INVALID | IW_QUAL_LEVEL_INVALID; + IW_QUAL_QUAL_INVALID | IW_QUAL_LEVEL_INVALID; return wstats; } @@ -8215,7 +8177,7 @@ static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev) &missed_beacons, &ord_len)) goto fail_get_ordinal; - /* If we don't have a connection the quality and level is 0*/ + /* If we don't have a connection the quality and level is 0 */ if (!(priv->status & STATUS_ASSOCIATED)) { wstats->qual.qual = 0; wstats->qual.level = 0; @@ -8232,10 +8194,10 @@ static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev) rssi_qual = (rssi - 15) * (GOOD - FAIR) / 5 + FAIR; else if (rssi < 30) rssi_qual = (rssi - 20) * (VERY_GOOD - GOOD) / - 10 + GOOD; + 10 + GOOD; else rssi_qual = (rssi - 30) * (PERFECT - VERY_GOOD) / - 10 + VERY_GOOD; + 10 + VERY_GOOD; if (ipw2100_get_ordinal(priv, IPW_ORD_STAT_PERCENT_RETRIES, &tx_retries, &ord_len)) @@ -8249,25 +8211,25 @@ static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev) tx_qual = (70 - tx_retries) * (GOOD - FAIR) / 5 + FAIR; else if (tx_retries > 50) tx_qual = (65 - tx_retries) * (VERY_GOOD - GOOD) / - 15 + GOOD; + 15 + GOOD; else tx_qual = (50 - tx_retries) * - (PERFECT - VERY_GOOD) / 50 + VERY_GOOD; + (PERFECT - VERY_GOOD) / 50 + VERY_GOOD; if (missed_beacons > 50) beacon_qual = (60 - missed_beacons) * POOR / 10; else if (missed_beacons > 40) beacon_qual = (50 - missed_beacons) * (FAIR - POOR) / - 10 + POOR; + 10 + POOR; else if (missed_beacons > 32) beacon_qual = (40 - missed_beacons) * (GOOD - FAIR) / - 18 + FAIR; + 18 + FAIR; else if (missed_beacons > 20) beacon_qual = (32 - missed_beacons) * - (VERY_GOOD - GOOD) / 20 + GOOD; + (VERY_GOOD - GOOD) / 20 + GOOD; else beacon_qual = (20 - missed_beacons) * - (PERFECT - VERY_GOOD) / 20 + VERY_GOOD; + (PERFECT - VERY_GOOD) / 20 + VERY_GOOD; quality = min(beacon_qual, min(tx_qual, rssi_qual)); @@ -8290,7 +8252,7 @@ static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev) wstats->qual.updated = 7; wstats->qual.updated |= IW_QUAL_NOISE_INVALID; - /* FIXME: this is percent and not a # */ + /* FIXME: this is percent and not a # */ wstats->miss.beacon = missed_beacons; if (ipw2100_get_ordinal(priv, IPW_ORD_STAT_TX_FAILURES, @@ -8300,10 +8262,10 @@ static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev) return wstats; - fail_get_ordinal: + fail_get_ordinal: IPW_DEBUG_WX("failed querying ordinals.\n"); - return (struct iw_statistics *) NULL; + return (struct iw_statistics *)NULL; } static void ipw2100_wx_event_work(struct ipw2100_priv *priv) @@ -8326,7 +8288,7 @@ static void ipw2100_wx_event_work(struct ipw2100_priv *priv) if (!(priv->status & (STATUS_ASSOCIATING | STATUS_ASSOCIATED)) || priv->status & STATUS_RF_KILL_MASK || ipw2100_get_ordinal(priv, IPW_ORD_STAT_ASSN_AP_BSSID, - &priv->bssid, &len)) { + &priv->bssid, &len)) { memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); } else { /* We now have the BSSID, so can finish setting to the full @@ -8351,7 +8313,8 @@ static void ipw2100_wx_event_work(struct ipw2100_priv *priv) /* This is a disassociation event, so kick the firmware to * look for another AP */ if (priv->config & CFG_STATIC_ESSID) - ipw2100_set_essid(priv, priv->essid, priv->essid_len, 0); + ipw2100_set_essid(priv, priv->essid, priv->essid_len, + 0); else ipw2100_set_essid(priv, NULL, 0, 0); up(&priv->action_sem); @@ -8374,7 +8337,6 @@ static void ipw2100_wx_event_work(struct ipw2100_priv *priv) #define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" - /* BINARY FIRMWARE HEADER FORMAT @@ -8396,12 +8358,10 @@ struct ipw2100_fw_header { unsigned int uc_size; } __attribute__ ((packed)); - - static int ipw2100_mod_firmware_load(struct ipw2100_fw *fw) { struct ipw2100_fw_header *h = - (struct ipw2100_fw_header *)fw->fw_entry->data; + (struct ipw2100_fw_header *)fw->fw_entry->data; if (IPW2100_FW_MAJOR(h->version) != IPW2100_FW_MAJOR_VERSION) { printk(KERN_WARNING DRV_NAME ": Firmware image not compatible " @@ -8420,7 +8380,6 @@ static int ipw2100_mod_firmware_load(struct ipw2100_fw *fw) return 0; } - static int ipw2100_get_firmware(struct ipw2100_priv *priv, struct ipw2100_fw *fw) { @@ -8428,7 +8387,7 @@ static int ipw2100_get_firmware(struct ipw2100_priv *priv, int rc; IPW_DEBUG_INFO("%s: Using hotplug firmware load.\n", - priv->net_dev->name); + priv->net_dev->name); switch (priv->ieee->iw_mode) { case IW_MODE_ADHOC: @@ -8454,7 +8413,7 @@ static int ipw2100_get_firmware(struct ipw2100_priv *priv, return rc; } IPW_DEBUG_INFO("firmware data %p size %zd\n", fw->fw_entry->data, - fw->fw_entry->size); + fw->fw_entry->size); ipw2100_mod_firmware_load(fw); @@ -8470,7 +8429,6 @@ static void ipw2100_release_firmware(struct ipw2100_priv *priv, fw->fw_entry = NULL; } - static int ipw2100_get_fwversion(struct ipw2100_priv *priv, char *buf, size_t max) { @@ -8479,8 +8437,7 @@ static int ipw2100_get_fwversion(struct ipw2100_priv *priv, char *buf, u32 tmp; int i; /* firmware version is an ascii string (max len of 14) */ - if (ipw2100_get_ordinal(priv, IPW_ORD_STAT_FW_VER_NUM, - ver, &len)) + if (ipw2100_get_ordinal(priv, IPW_ORD_STAT_FW_VER_NUM, ver, &len)) return -EIO; tmp = max; if (len >= max) @@ -8497,8 +8454,7 @@ static int ipw2100_get_ucodeversion(struct ipw2100_priv *priv, char *buf, u32 ver; u32 len = sizeof(ver); /* microcode version is a 32 bit integer */ - if (ipw2100_get_ordinal(priv, IPW_ORD_UCODE_VERSION, - &ver, &len)) + if (ipw2100_get_ordinal(priv, IPW_ORD_UCODE_VERSION, &ver, &len)) return -EIO; return snprintf(buf, max, "%08X", ver); } @@ -8506,8 +8462,7 @@ static int ipw2100_get_ucodeversion(struct ipw2100_priv *priv, char *buf, /* * On exit, the firmware will have been freed from the fw list */ -static int ipw2100_fw_download(struct ipw2100_priv *priv, - struct ipw2100_fw *fw) +static int ipw2100_fw_download(struct ipw2100_priv *priv, struct ipw2100_fw *fw) { /* firmware is constructed of N contiguous entries, each entry is * structured as: @@ -8515,7 +8470,7 @@ static int ipw2100_fw_download(struct ipw2100_priv *priv, * offset sie desc * 0 4 address to write to * 4 2 length of data run - * 6 length data + * 6 length data */ unsigned int addr; unsigned short len; @@ -8524,12 +8479,12 @@ static int ipw2100_fw_download(struct ipw2100_priv *priv, unsigned int firmware_data_left = fw->fw.size; while (firmware_data_left > 0) { - addr = *(u32 *)(firmware_data); - firmware_data += 4; + addr = *(u32 *) (firmware_data); + firmware_data += 4; firmware_data_left -= 4; - len = *(u16 *)(firmware_data); - firmware_data += 2; + len = *(u16 *) (firmware_data); + firmware_data += 2; firmware_data_left -= 2; if (len > 32) { @@ -8540,7 +8495,7 @@ static int ipw2100_fw_download(struct ipw2100_priv *priv, } write_nic_memory(priv->net_dev, addr, len, firmware_data); - firmware_data += len; + firmware_data += len; firmware_data_left -= len; } @@ -8654,21 +8609,19 @@ static int ipw2100_ucode_download(struct ipw2100_priv *priv, for (i = 0; i < 30; i++) { /* Read alive response structure */ for (j = 0; - j < (sizeof(struct symbol_alive_response) >> 1); - j++) - read_nic_word(dev, 0x210004, - ((u16 *)&response) + j); + j < (sizeof(struct symbol_alive_response) >> 1); j++) + read_nic_word(dev, 0x210004, ((u16 *) & response) + j); - if ((response.cmd_id == 1) && - (response.ucode_valid == 0x1)) + if ((response.cmd_id == 1) && (response.ucode_valid == 0x1)) break; udelay(10); } if (i == 30) { - printk(KERN_ERR DRV_NAME ": %s: No response from Symbol - hw not alive\n", + printk(KERN_ERR DRV_NAME + ": %s: No response from Symbol - hw not alive\n", dev->name); - printk_buf(IPW_DL_ERROR, (u8*)&response, sizeof(response)); + printk_buf(IPW_DL_ERROR, (u8 *) & response, sizeof(response)); return -EIO; } diff --git a/drivers/net/wireless/ipw2100.h b/drivers/net/wireless/ipw2100.h index c9e99ce15d66..3eb5c384eaab 100644 --- a/drivers/net/wireless/ipw2100.h +++ b/drivers/net/wireless/ipw2100.h @@ -93,7 +93,6 @@ struct ipw2100_rx_packet; #define IPW_DL_IOCTL (1<<14) #define IPW_DL_RF_KILL (1<<17) - #define IPW_DL_MANAGE (1<<15) #define IPW_DL_FW (1<<16) @@ -156,7 +155,9 @@ extern const char *band_str[]; struct bd_status { union { - struct { u8 nlf:1, txType:2, intEnabled:1, reserved:4;} fields; + struct { + u8 nlf:1, txType:2, intEnabled:1, reserved:4; + } fields; u8 field; } info; } __attribute__ ((packed)); @@ -165,7 +166,7 @@ struct ipw2100_bd { u32 host_addr; u32 buf_length; struct bd_status status; - /* number of fragments for frame (should be set only for + /* number of fragments for frame (should be set only for * 1st TBD) */ u8 num_fragments; u8 reserved[6]; @@ -293,10 +294,10 @@ struct ipw2100_cmd_header { struct ipw2100_data_header { u32 host_command_reg; u32 host_command_reg1; - u8 encrypted; // BOOLEAN in win! TRUE if frame is enc by driver + u8 encrypted; // BOOLEAN in win! TRUE if frame is enc by driver u8 needs_encryption; // BOOLEAN in win! TRUE if frma need to be enc in NIC u8 wep_index; // 0 no key, 1-4 key index, 0xff immediate key - u8 key_size; // 0 no imm key, 0x5 64bit encr, 0xd 128bit encr, 0x10 128bit encr and 128bit IV + u8 key_size; // 0 no imm key, 0x5 64bit encr, 0xd 128bit encr, 0x10 128bit encr and 128bit IV u8 key[16]; u8 reserved[10]; // f/w reserved u8 src_addr[ETH_ALEN]; @@ -306,14 +307,13 @@ struct ipw2100_data_header { /* Host command data structure */ struct host_command { - u32 host_command; // COMMAND ID - u32 host_command1; // COMMAND ID + u32 host_command; // COMMAND ID + u32 host_command1; // COMMAND ID u32 host_command_sequence; // UNIQUE COMMAND NUMBER (ID) u32 host_command_length; // LENGTH u32 host_command_parameters[HOST_COMMAND_PARAMS_REG_LEN]; // COMMAND PARAMETERS } __attribute__ ((packed)); - typedef enum { POWER_ON_RESET, EXIT_POWER_DOWN_RESET, @@ -328,17 +328,16 @@ enum { RX }; - struct ipw2100_tx_packet { int type; int index; union { - struct { /* COMMAND */ - struct ipw2100_cmd_header* cmd; + struct { /* COMMAND */ + struct ipw2100_cmd_header *cmd; dma_addr_t cmd_phys; } c_struct; - struct { /* DATA */ - struct ipw2100_data_header* data; + struct { /* DATA */ + struct ipw2100_data_header *data; dma_addr_t data_phys; struct ieee80211_txb *txb; } d_struct; @@ -348,7 +347,6 @@ struct ipw2100_tx_packet { struct list_head list; }; - struct ipw2100_rx_packet { struct ipw2100_rx *rxp; dma_addr_t dma_addr; @@ -432,13 +430,13 @@ enum { }; #define STATUS_POWERED (1<<0) -#define STATUS_CMD_ACTIVE (1<<1) /**< host command in progress */ -#define STATUS_RUNNING (1<<2) /* Card initialized, but not enabled */ -#define STATUS_ENABLED (1<<3) /* Card enabled -- can scan,Tx,Rx */ -#define STATUS_STOPPING (1<<4) /* Card is in shutdown phase */ -#define STATUS_INITIALIZED (1<<5) /* Card is ready for external calls */ -#define STATUS_ASSOCIATING (1<<9) /* Associated, but no BSSID yet */ -#define STATUS_ASSOCIATED (1<<10) /* Associated and BSSID valid */ +#define STATUS_CMD_ACTIVE (1<<1) /**< host command in progress */ +#define STATUS_RUNNING (1<<2) /* Card initialized, but not enabled */ +#define STATUS_ENABLED (1<<3) /* Card enabled -- can scan,Tx,Rx */ +#define STATUS_STOPPING (1<<4) /* Card is in shutdown phase */ +#define STATUS_INITIALIZED (1<<5) /* Card is ready for external calls */ +#define STATUS_ASSOCIATING (1<<9) /* Associated, but no BSSID yet */ +#define STATUS_ASSOCIATED (1<<10) /* Associated and BSSID valid */ #define STATUS_INT_ENABLED (1<<11) #define STATUS_RF_KILL_HW (1<<12) #define STATUS_RF_KILL_SW (1<<13) @@ -451,9 +449,7 @@ enum { #define STATUS_SCAN_COMPLETE (1<<26) #define STATUS_WX_EVENT_PENDING (1<<27) #define STATUS_RESET_PENDING (1<<29) -#define STATUS_SECURITY_UPDATED (1<<30) /* Security sync needed */ - - +#define STATUS_SECURITY_UPDATED (1<<30) /* Security sync needed */ /* Internal NIC states */ #define IPW_STATE_INITIALIZED (1<<0) @@ -469,11 +465,9 @@ enum { #define IPW_STATE_POWER_DOWN (1<<10) #define IPW_STATE_SCANNING (1<<11) - - -#define CFG_STATIC_CHANNEL (1<<0) /* Restrict assoc. to single channel */ -#define CFG_STATIC_ESSID (1<<1) /* Restrict assoc. to single SSID */ -#define CFG_STATIC_BSSID (1<<2) /* Restrict assoc. to single BSSID */ +#define CFG_STATIC_CHANNEL (1<<0) /* Restrict assoc. to single channel */ +#define CFG_STATIC_ESSID (1<<1) /* Restrict assoc. to single SSID */ +#define CFG_STATIC_BSSID (1<<2) /* Restrict assoc. to single BSSID */ #define CFG_CUSTOM_MAC (1<<3) #define CFG_LONG_PREAMBLE (1<<4) #define CFG_ASSOCIATE (1<<6) @@ -482,13 +476,13 @@ enum { #define CFG_C3_DISABLED (1<<9) #define CFG_PASSIVE_SCAN (1<<10) -#define CAP_SHARED_KEY (1<<0) /* Off = OPEN */ -#define CAP_PRIVACY_ON (1<<1) /* Off = No privacy */ +#define CAP_SHARED_KEY (1<<0) /* Off = OPEN */ +#define CAP_PRIVACY_ON (1<<1) /* Off = No privacy */ struct ipw2100_priv { - int stop_hang_check; /* Set 1 when shutting down to kill hang_check */ - int stop_rf_kill; /* Set 1 when shutting down to kill rf_kill */ + int stop_hang_check; /* Set 1 when shutting down to kill hang_check */ + int stop_rf_kill; /* Set 1 when shutting down to kill rf_kill */ struct ieee80211_device *ieee; unsigned long status; @@ -519,8 +513,8 @@ struct ipw2100_priv { unsigned long hw_features; int hangs; u32 last_rtc; - int dump_raw; /* 1 to dump raw bytes in /sys/.../memory */ - u8* snapshot[0x30]; + int dump_raw; /* 1 to dump raw bytes in /sys/.../memory */ + u8 *snapshot[0x30]; u8 mandatory_bssid_mac[ETH_ALEN]; u8 mac_addr[ETH_ALEN]; @@ -531,7 +525,6 @@ struct ipw2100_priv { struct ieee80211_security sec; int messages_sent; - int short_retry_limit; int long_retry_limit; @@ -599,7 +592,6 @@ struct ipw2100_priv { wait_queue_head_t wait_command_queue; }; - /********************************************************* * Host Command -> From Driver to FW *********************************************************/ @@ -646,7 +638,6 @@ struct ipw2100_priv { #define CARD_DISABLE_PHY_OFF 61 #define MSDU_TX_RATES 62 - /* Rogue AP Detection */ #define SET_STATION_STAT_BITS 64 #define CLEAR_STATIONS_STAT_BITS 65 @@ -655,8 +646,6 @@ struct ipw2100_priv { #define DISASSOCIATION_BSSID 68 #define SET_WPA_IE 69 - - /* system configuration bit mask: */ #define IPW_CFG_MONITOR 0x00004 #define IPW_CFG_PREAMBLE_AUTO 0x00010 @@ -704,7 +693,7 @@ struct ipw2100_priv { #define IPW2100_INTA_TX_TRANSFER (0x00000001) // Bit 0 (LSB) #define IPW2100_INTA_RX_TRANSFER (0x00000002) // Bit 1 #define IPW2100_INTA_TX_COMPLETE (0x00000004) // Bit 2 -#define IPW2100_INTA_EVENT_INTERRUPT (0x00000008) // Bit 3 +#define IPW2100_INTA_EVENT_INTERRUPT (0x00000008) // Bit 3 #define IPW2100_INTA_STATUS_CHANGE (0x00000010) // Bit 4 #define IPW2100_INTA_BEACON_PERIOD_EXPIRED (0x00000020) // Bit 5 #define IPW2100_INTA_SLAVE_MODE_HOST_COMMAND_DONE (0x00010000) // Bit 16 @@ -784,9 +773,6 @@ struct ipw2100_priv { #define IPW_CARD_DISABLE_PHY_OFF_COMPLETE_WAIT 100 // 100 milli #define IPW_PREPARE_POWER_DOWN_COMPLETE_WAIT 100 // 100 milli - - - #define IPW_HEADER_802_11_SIZE sizeof(struct ieee80211_hdr_3addr) #define IPW_MAX_80211_PAYLOAD_SIZE 2304U #define IPW_MAX_802_11_PAYLOAD_LENGTH 2312 @@ -843,8 +829,8 @@ struct ipw2100_rx { #define IPW_TX_POWER_MIN_DBM (-12) #define IPW_TX_POWER_MAX_DBM 16 -#define FW_SCAN_DONOT_ASSOCIATE 0x0001 // Dont Attempt to Associate after Scan -#define FW_SCAN_PASSIVE 0x0008 // Force PASSSIVE Scan +#define FW_SCAN_DONOT_ASSOCIATE 0x0001 // Dont Attempt to Associate after Scan +#define FW_SCAN_PASSIVE 0x0008 // Force PASSSIVE Scan #define REG_MIN_CHANNEL 0 #define REG_MAX_CHANNEL 14 @@ -856,7 +842,6 @@ struct ipw2100_rx { #define DIVERSITY_ANTENNA_A 1 // Use antenna A #define DIVERSITY_ANTENNA_B 2 // Use antenna B - #define HOST_COMMAND_WAIT 0 #define HOST_COMMAND_NO_WAIT 1 @@ -873,7 +858,6 @@ struct ipw2100_rx { #define TYPE_ASSOCIATION_REQUEST 0x0013 #define TYPE_REASSOCIATION_REQUEST 0x0014 - #define HW_FEATURE_RFKILL (0x0001) #define RF_KILLSWITCH_OFF (1) #define RF_KILLSWITCH_ON (0) @@ -895,7 +879,7 @@ struct ipw2100_rx { // Fixed size data: Ordinal Table 1 typedef enum _ORDINAL_TABLE_1 { // NS - means Not Supported by FW // Transmit statistics - IPW_ORD_STAT_TX_HOST_REQUESTS = 1,// # of requested Host Tx's (MSDU) + IPW_ORD_STAT_TX_HOST_REQUESTS = 1, // # of requested Host Tx's (MSDU) IPW_ORD_STAT_TX_HOST_COMPLETE, // # of successful Host Tx's (MSDU) IPW_ORD_STAT_TX_DIR_DATA, // # of successful Directed Tx's (MSDU) @@ -905,42 +889,42 @@ typedef enum _ORDINAL_TABLE_1 { // NS - means Not Supported by FW IPW_ORD_STAT_TX_DIR_DATA11, // # of successful Directed Tx's (MSDU) @ 11MB IPW_ORD_STAT_TX_DIR_DATA22, // # of successful Directed Tx's (MSDU) @ 22MB - IPW_ORD_STAT_TX_NODIR_DATA1 = 13,// # of successful Non_Directed Tx's (MSDU) @ 1MB + IPW_ORD_STAT_TX_NODIR_DATA1 = 13, // # of successful Non_Directed Tx's (MSDU) @ 1MB IPW_ORD_STAT_TX_NODIR_DATA2, // # of successful Non_Directed Tx's (MSDU) @ 2MB IPW_ORD_STAT_TX_NODIR_DATA5_5, // # of successful Non_Directed Tx's (MSDU) @ 5.5MB IPW_ORD_STAT_TX_NODIR_DATA11, // # of successful Non_Directed Tx's (MSDU) @ 11MB IPW_ORD_STAT_NULL_DATA = 21, // # of successful NULL data Tx's - IPW_ORD_STAT_TX_RTS, // # of successful Tx RTS - IPW_ORD_STAT_TX_CTS, // # of successful Tx CTS - IPW_ORD_STAT_TX_ACK, // # of successful Tx ACK - IPW_ORD_STAT_TX_ASSN, // # of successful Association Tx's + IPW_ORD_STAT_TX_RTS, // # of successful Tx RTS + IPW_ORD_STAT_TX_CTS, // # of successful Tx CTS + IPW_ORD_STAT_TX_ACK, // # of successful Tx ACK + IPW_ORD_STAT_TX_ASSN, // # of successful Association Tx's IPW_ORD_STAT_TX_ASSN_RESP, // # of successful Association response Tx's - IPW_ORD_STAT_TX_REASSN, // # of successful Reassociation Tx's + IPW_ORD_STAT_TX_REASSN, // # of successful Reassociation Tx's IPW_ORD_STAT_TX_REASSN_RESP, // # of successful Reassociation response Tx's - IPW_ORD_STAT_TX_PROBE, // # of probes successfully transmitted + IPW_ORD_STAT_TX_PROBE, // # of probes successfully transmitted IPW_ORD_STAT_TX_PROBE_RESP, // # of probe responses successfully transmitted - IPW_ORD_STAT_TX_BEACON, // # of tx beacon - IPW_ORD_STAT_TX_ATIM, // # of Tx ATIM + IPW_ORD_STAT_TX_BEACON, // # of tx beacon + IPW_ORD_STAT_TX_ATIM, // # of Tx ATIM IPW_ORD_STAT_TX_DISASSN, // # of successful Disassociation TX - IPW_ORD_STAT_TX_AUTH, // # of successful Authentication Tx - IPW_ORD_STAT_TX_DEAUTH, // # of successful Deauthentication TX + IPW_ORD_STAT_TX_AUTH, // # of successful Authentication Tx + IPW_ORD_STAT_TX_DEAUTH, // # of successful Deauthentication TX - IPW_ORD_STAT_TX_TOTAL_BYTES = 41,// Total successful Tx data bytes - IPW_ORD_STAT_TX_RETRIES, // # of Tx retries - IPW_ORD_STAT_TX_RETRY1, // # of Tx retries at 1MBPS - IPW_ORD_STAT_TX_RETRY2, // # of Tx retries at 2MBPS - IPW_ORD_STAT_TX_RETRY5_5, // # of Tx retries at 5.5MBPS - IPW_ORD_STAT_TX_RETRY11, // # of Tx retries at 11MBPS + IPW_ORD_STAT_TX_TOTAL_BYTES = 41, // Total successful Tx data bytes + IPW_ORD_STAT_TX_RETRIES, // # of Tx retries + IPW_ORD_STAT_TX_RETRY1, // # of Tx retries at 1MBPS + IPW_ORD_STAT_TX_RETRY2, // # of Tx retries at 2MBPS + IPW_ORD_STAT_TX_RETRY5_5, // # of Tx retries at 5.5MBPS + IPW_ORD_STAT_TX_RETRY11, // # of Tx retries at 11MBPS IPW_ORD_STAT_TX_FAILURES = 51, // # of Tx Failures IPW_ORD_STAT_TX_ABORT_AT_HOP, //NS // # of Tx's aborted at hop time - IPW_ORD_STAT_TX_MAX_TRIES_IN_HOP,// # of times max tries in a hop failed + IPW_ORD_STAT_TX_MAX_TRIES_IN_HOP, // # of times max tries in a hop failed IPW_ORD_STAT_TX_ABORT_LATE_DMA, //NS // # of times tx aborted due to late dma setup IPW_ORD_STAT_TX_ABORT_STX, //NS // # of times backoff aborted IPW_ORD_STAT_TX_DISASSN_FAIL, // # of times disassociation failed - IPW_ORD_STAT_TX_ERR_CTS, // # of missed/bad CTS frames - IPW_ORD_STAT_TX_BPDU, //NS // # of spanning tree BPDUs sent + IPW_ORD_STAT_TX_ERR_CTS, // # of missed/bad CTS frames + IPW_ORD_STAT_TX_BPDU, //NS // # of spanning tree BPDUs sent IPW_ORD_STAT_TX_ERR_ACK, // # of tx err due to acks // Receive statistics @@ -952,7 +936,7 @@ typedef enum _ORDINAL_TABLE_1 { // NS - means Not Supported by FW IPW_ORD_STAT_RX_DIR_DATA11, // # of directed packets at 11MB IPW_ORD_STAT_RX_DIR_DATA22, // # of directed packets at 22MB - IPW_ORD_STAT_RX_NODIR_DATA = 71,// # of nondirected packets + IPW_ORD_STAT_RX_NODIR_DATA = 71, // # of nondirected packets IPW_ORD_STAT_RX_NODIR_DATA1, // # of nondirected packets at 1MB IPW_ORD_STAT_RX_NODIR_DATA2, // # of nondirected packets at 2MB IPW_ORD_STAT_RX_NODIR_DATA5_5, // # of nondirected packets at 5.5MB @@ -977,18 +961,18 @@ typedef enum _ORDINAL_TABLE_1 { // NS - means Not Supported by FW IPW_ORD_STAT_RX_AUTH, // # of authentication Rx IPW_ORD_STAT_RX_DEAUTH, // # of deauthentication Rx - IPW_ORD_STAT_RX_TOTAL_BYTES = 101,// Total rx data bytes received - IPW_ORD_STAT_RX_ERR_CRC, // # of packets with Rx CRC error - IPW_ORD_STAT_RX_ERR_CRC1, // # of Rx CRC errors at 1MB - IPW_ORD_STAT_RX_ERR_CRC2, // # of Rx CRC errors at 2MB - IPW_ORD_STAT_RX_ERR_CRC5_5, // # of Rx CRC errors at 5.5MB - IPW_ORD_STAT_RX_ERR_CRC11, // # of Rx CRC errors at 11MB + IPW_ORD_STAT_RX_TOTAL_BYTES = 101, // Total rx data bytes received + IPW_ORD_STAT_RX_ERR_CRC, // # of packets with Rx CRC error + IPW_ORD_STAT_RX_ERR_CRC1, // # of Rx CRC errors at 1MB + IPW_ORD_STAT_RX_ERR_CRC2, // # of Rx CRC errors at 2MB + IPW_ORD_STAT_RX_ERR_CRC5_5, // # of Rx CRC errors at 5.5MB + IPW_ORD_STAT_RX_ERR_CRC11, // # of Rx CRC errors at 11MB - IPW_ORD_STAT_RX_DUPLICATE1 = 112, // # of duplicate rx packets at 1MB - IPW_ORD_STAT_RX_DUPLICATE2, // # of duplicate rx packets at 2MB - IPW_ORD_STAT_RX_DUPLICATE5_5, // # of duplicate rx packets at 5.5MB - IPW_ORD_STAT_RX_DUPLICATE11, // # of duplicate rx packets at 11MB - IPW_ORD_STAT_RX_DUPLICATE = 119, // # of duplicate rx packets + IPW_ORD_STAT_RX_DUPLICATE1 = 112, // # of duplicate rx packets at 1MB + IPW_ORD_STAT_RX_DUPLICATE2, // # of duplicate rx packets at 2MB + IPW_ORD_STAT_RX_DUPLICATE5_5, // # of duplicate rx packets at 5.5MB + IPW_ORD_STAT_RX_DUPLICATE11, // # of duplicate rx packets at 11MB + IPW_ORD_STAT_RX_DUPLICATE = 119, // # of duplicate rx packets IPW_ORD_PERS_DB_LOCK = 120, // # locking fw permanent db IPW_ORD_PERS_DB_SIZE, // # size of fw permanent db @@ -1006,17 +990,17 @@ typedef enum _ORDINAL_TABLE_1 { // NS - means Not Supported by FW IPW_ORD_STAT_RX_ICV_ERRORS, // # of ICV errors during decryption // PSP Statistics - IPW_ORD_STAT_PSP_SUSPENSION = 137,// # of times adapter suspended + IPW_ORD_STAT_PSP_SUSPENSION = 137, // # of times adapter suspended IPW_ORD_STAT_PSP_BCN_TIMEOUT, // # of beacon timeout IPW_ORD_STAT_PSP_POLL_TIMEOUT, // # of poll response timeouts - IPW_ORD_STAT_PSP_NONDIR_TIMEOUT,// # of timeouts waiting for last broadcast/muticast pkt + IPW_ORD_STAT_PSP_NONDIR_TIMEOUT, // # of timeouts waiting for last broadcast/muticast pkt IPW_ORD_STAT_PSP_RX_DTIMS, // # of PSP DTIMs received IPW_ORD_STAT_PSP_RX_TIMS, // # of PSP TIMs received IPW_ORD_STAT_PSP_STATION_ID, // PSP Station ID // Association and roaming IPW_ORD_LAST_ASSN_TIME = 147, // RTC time of last association - IPW_ORD_STAT_PERCENT_MISSED_BCNS,// current calculation of % missed beacons + IPW_ORD_STAT_PERCENT_MISSED_BCNS, // current calculation of % missed beacons IPW_ORD_STAT_PERCENT_RETRIES, // current calculation of % missed tx retries IPW_ORD_ASSOCIATED_AP_PTR, // If associated, this is ptr to the associated // AP table entry. set to 0 if not associated @@ -1151,7 +1135,7 @@ struct ipw2100_fw_chunk { }; struct ipw2100_fw_chunk_set { - const void *data; + const void *data; unsigned long size; }; @@ -1164,4 +1148,4 @@ struct ipw2100_fw { #define MAX_FW_VERSION_LEN 14 -#endif /* _IPW2100_H */ +#endif /* _IPW2100_H */ -- cgit v1.2.2 From a1e695adca76f5729224242e4f2f9f6ceb6863d1 Mon Sep 17 00:00:00 2001 From: Zhu Yi Date: Mon, 4 Jul 2005 14:06:00 +0800 Subject: IPW_DEBUG has already included DRV_NAME, remove double prefix print. --- drivers/net/wireless/ipw2100.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c index a15eef1c2a62..449c1c085fb9 100644 --- a/drivers/net/wireless/ipw2100.c +++ b/drivers/net/wireless/ipw2100.c @@ -1833,7 +1833,7 @@ static void ipw2100_down(struct ipw2100_priv *priv) #ifdef ACPI_CSTATE_LIMIT_DEFINED if (priv->config & CFG_C3_DISABLED) { - IPW_DEBUG_INFO(DRV_NAME ": Resetting C3 transitions.\n"); + IPW_DEBUG_INFO(": Resetting C3 transitions.\n"); acpi_set_cstate_limit(priv->cstate_limit); priv->config &= ~CFG_C3_DISABLED; } @@ -1858,8 +1858,7 @@ static void ipw2100_reset_adapter(struct ipw2100_priv *priv) int associated = priv->status & STATUS_ASSOCIATED; spin_lock_irqsave(&priv->low_lock, flags); - IPW_DEBUG_INFO(DRV_NAME ": %s: Restarting adapter.\n", - priv->net_dev->name); + IPW_DEBUG_INFO(": %s: Restarting adapter.\n", priv->net_dev->name); priv->resets++; priv->status &= ~(STATUS_ASSOCIATED | STATUS_ASSOCIATING); priv->status |= STATUS_SECURITY_UPDATED; @@ -2062,7 +2061,7 @@ static void isr_indicate_rf_kill(struct ipw2100_priv *priv, u32 status) #ifdef ACPI_CSTATE_LIMIT_DEFINED if (priv->config & CFG_C3_DISABLED) { - IPW_DEBUG_INFO(DRV_NAME ": Resetting C3 transitions.\n"); + IPW_DEBUG_INFO(": Resetting C3 transitions.\n"); acpi_set_cstate_limit(priv->cstate_limit); priv->config &= ~CFG_C3_DISABLED; } @@ -2300,11 +2299,11 @@ static inline void ipw2100_corruption_detected(struct ipw2100_priv *priv, int i) int limit; #endif - IPW_DEBUG_INFO(DRV_NAME ": PCI latency error detected at " - "0x%04zX.\n", i * sizeof(struct ipw2100_status)); + IPW_DEBUG_INFO(": PCI latency error detected at 0x%04zX.\n", + i * sizeof(struct ipw2100_status)); #ifdef ACPI_CSTATE_LIMIT_DEFINED - IPW_DEBUG_INFO(DRV_NAME ": Disabling C3 transitions.\n"); + IPW_DEBUG_INFO(": Disabling C3 transitions.\n"); limit = acpi_get_cstate_limit(); if (limit > 2) { priv->cstate_limit = limit; @@ -4001,8 +4000,7 @@ static ssize_t store_debug_level(struct device_driver *d, const char *buf, } else val = simple_strtoul(p, &p, 10); if (p == buf) - IPW_DEBUG_INFO(DRV_NAME - ": %s is not in hex or decimal form.\n", buf); + IPW_DEBUG_INFO(": %s is not in hex or decimal form.\n", buf); else ipw2100_debug_level = val; -- cgit v1.2.2 From ea2b26e0a0264650e13acac8e66d315bb818897c Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Wed, 24 Aug 2005 21:25:16 -0500 Subject: Catch ipw2200 up to equivelancy with v1.0.1 This commit contains the following fixes: Fixed #559: iwconfig rate support (thanks to Florian Hackenberger) Improved link signal quality calculation (thanks to Bill Moss) Fixed a problem with sensitivity threshold during association Added iwpriv for turning forcing long preamble support: % iwpriv eth1 set_preamble 1|0 Fixed #542 and #377 support for short preamble Fixed locked BSSID reporting channel number (thanks to Pedro Ramalhais) Fixed type-o with scan watchdog timeout message (thanks to Pedro Ramalhais) Changed logic for displaying get_mode output so the code is easier to follow (thanks to Pedro Ramalhais) Added initial support for WPA (thanks to Yi Zhu) -- tested with wpa_supplicant (either tip w/ ipw driver, or with -Dipw2100) with both CCMP and TKIP Fixed problem with CCMP not working due to uninitialized 802.11 header fields (thanks to Pedro Ramalhais) Bug references are to defects stored on http://bughost.org Signed-off-by: James Ketrenos --- drivers/net/wireless/ipw2200.c | 1694 +++++++++++++++++++++++++++++----------- drivers/net/wireless/ipw2200.h | 23 +- 2 files changed, 1247 insertions(+), 470 deletions(-) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 3db0c32afe82..ddbee3edcd8c 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -32,7 +32,7 @@ #include "ipw2200.h" -#define IPW2200_VERSION "1.0.0" +#define IPW2200_VERSION "1.0.1" #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2200/2915 Network Driver" #define DRV_COPYRIGHT "Copyright(c) 2003-2004 Intel Corporation" #define DRV_VERSION IPW2200_VERSION @@ -44,7 +44,6 @@ MODULE_LICENSE("GPL"); static int debug = 0; static int channel = 0; -static char *ifname; static int mode = 0; static u32 ipw_debug_level; @@ -289,32 +288,33 @@ static void _ipw_read_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, { u32 aligned_addr = addr & CX2_INDIRECT_ADDR_MASK; u32 dif_len = addr - aligned_addr; - u32 aligned_len; u32 i; IPW_DEBUG_IO("addr = %i, buf = %p, num = %i\n", addr, buf, num); + if (num <= 0) { + return; + } + /* Read the first nibble byte by byte */ if (unlikely(dif_len)) { - /* Start reading at aligned_addr + dif_len */ _ipw_write32(priv, CX2_INDIRECT_ADDR, aligned_addr); - for (i = dif_len; i < 4; i++, buf++) - *buf = _ipw_read8(priv, CX2_INDIRECT_DATA + i); - num -= dif_len; + /* Start reading at aligned_addr + dif_len */ + for (i = dif_len; ((i < 4) && (num > 0)); i++, num--) + *buf++ = _ipw_read8(priv, CX2_INDIRECT_DATA + i); aligned_addr += 4; } - /* Read DWs through autoinc register */ _ipw_write32(priv, CX2_AUTOINC_ADDR, aligned_addr); - aligned_len = num & CX2_INDIRECT_ADDR_MASK; - for (i = 0; i < aligned_len; i += 4, buf += 4, aligned_addr += 4) - *(u32 *) buf = ipw_read32(priv, CX2_AUTOINC_DATA); + for (; num >= 4; buf += 4, aligned_addr += 4, num -= 4) + *(u32 *) buf = _ipw_read32(priv, CX2_AUTOINC_DATA); /* Copy the last nibble */ - dif_len = num - aligned_len; - _ipw_write32(priv, CX2_INDIRECT_ADDR, aligned_addr); - for (i = 0; i < dif_len; i++, buf++) - *buf = ipw_read8(priv, CX2_INDIRECT_DATA + i); + if (unlikely(num)) { + _ipw_write32(priv, CX2_INDIRECT_ADDR, aligned_addr); + for (i = 0; num > 0; i++, num--) + *buf++ = ipw_read8(priv, CX2_INDIRECT_DATA + i); + } } static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, @@ -322,32 +322,33 @@ static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, { u32 aligned_addr = addr & CX2_INDIRECT_ADDR_MASK; u32 dif_len = addr - aligned_addr; - u32 aligned_len; u32 i; IPW_DEBUG_IO("addr = %i, buf = %p, num = %i\n", addr, buf, num); + if (num <= 0) { + return; + } + /* Write the first nibble byte by byte */ if (unlikely(dif_len)) { - /* Start writing at aligned_addr + dif_len */ _ipw_write32(priv, CX2_INDIRECT_ADDR, aligned_addr); - for (i = dif_len; i < 4; i++, buf++) + /* Start reading at aligned_addr + dif_len */ + for (i = dif_len; ((i < 4) && (num > 0)); i++, num--, buf++) _ipw_write8(priv, CX2_INDIRECT_DATA + i, *buf); - num -= dif_len; aligned_addr += 4; } - /* Write DWs through autoinc register */ _ipw_write32(priv, CX2_AUTOINC_ADDR, aligned_addr); - aligned_len = num & CX2_INDIRECT_ADDR_MASK; - for (i = 0; i < aligned_len; i += 4, buf += 4, aligned_addr += 4) + for (; num >= 4; buf += 4, aligned_addr += 4, num -= 4) _ipw_write32(priv, CX2_AUTOINC_DATA, *(u32 *) buf); /* Copy the last nibble */ - dif_len = num - aligned_len; - _ipw_write32(priv, CX2_INDIRECT_ADDR, aligned_addr); - for (i = 0; i < dif_len; i++, buf++) - _ipw_write8(priv, CX2_INDIRECT_DATA + i, *buf); + if (unlikely(num)) { + _ipw_write32(priv, CX2_INDIRECT_ADDR, aligned_addr); + for (i = 0; num > 0; i++, num--, buf++) + _ipw_write8(priv, CX2_INDIRECT_DATA + i, *buf); + } } static void ipw_write_direct(struct ipw_priv *priv, u32 addr, void *buf, @@ -945,7 +946,7 @@ static ssize_t show_rf_kill(struct device *d, struct device_attribute *attr, static int ipw_radio_kill_sw(struct ipw_priv *priv, int disable_radio) { if ((disable_radio ? 1 : 0) == - (priv->status & STATUS_RF_KILL_SW ? 1 : 0)) + ((priv->status & STATUS_RF_KILL_SW) ? 1 : 0)) return 0; IPW_DEBUG_RF_KILL("Manual SW RF Kill set to: RADIO %s\n", @@ -987,6 +988,17 @@ static ssize_t store_rf_kill(struct device *d, struct device_attribute *attr, static DEVICE_ATTR(rf_kill, S_IWUSR | S_IRUGO, show_rf_kill, store_rf_kill); +static void notify_wx_assoc_event(struct ipw_priv *priv) +{ + union iwreq_data wrqu; + wrqu.ap_addr.sa_family = ARPHRD_ETHER; + if (priv->status & STATUS_ASSOCIATED) + memcpy(wrqu.ap_addr.sa_data, priv->bssid, ETH_ALEN); + else + memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); + wireless_send_event(priv->net_dev, SIOCGIWAP, &wrqu, NULL); +} + static void ipw_irq_tasklet(struct ipw_priv *priv) { u32 inta, inta_mask, handled = 0; @@ -1071,6 +1083,8 @@ static void ipw_irq_tasklet(struct ipw_priv *priv) wake_up_interruptible(&priv->wait_command_queue); netif_carrier_off(priv->net_dev); netif_stop_queue(priv->net_dev); + priv->status &= ~(STATUS_ASSOCIATED | STATUS_ASSOCIATING); + notify_wx_assoc_event(priv); cancel_delayed_work(&priv->request_scan); queue_delayed_work(priv->workqueue, &priv->rf_kill, 2 * HZ); handled |= CX2_INTA_BIT_RF_KILL_DONE; @@ -1162,7 +1176,7 @@ static char *get_cmd_string(u8 cmd) return "UNKNOWN"; } } -#endif /* CONFIG_IPW_DEBUG */ +#endif #define HOST_COMPLETE_TIMEOUT HZ static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) @@ -2445,10 +2459,10 @@ static int ipw_load(struct ipw_priv *priv) rc = ipw_get_fw(priv, &firmware, IPW_FW_NAME("ibss")); break; -#ifdef CONFIG_IPW_PROMISC +#ifdef CONFIG_IPW_MONITOR case IW_MODE_MONITOR: rc = ipw_get_fw(priv, &ucode, - IPW_FW_NAME("ibss_ucode")); + IPW_FW_NAME("sniffer_ucode")); if (rc) goto error; @@ -2929,17 +2943,6 @@ static void ipw_disassociate(void *data) ipw_send_disassociate(data, 0); } -static void notify_wx_assoc_event(struct ipw_priv *priv) -{ - union iwreq_data wrqu; - wrqu.ap_addr.sa_family = ARPHRD_ETHER; - if (priv->status & STATUS_ASSOCIATED) - memcpy(wrqu.ap_addr.sa_data, priv->bssid, ETH_ALEN); - else - memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); - wireless_send_event(priv->net_dev, SIOCGIWAP, &wrqu, NULL); -} - struct ipw_status_code { u16 status; const char *reason; @@ -2997,7 +3000,7 @@ static const char *ipw_get_status_code(u16 status) { int i; for (i = 0; i < ARRAY_SIZE(ipw_status_codes); i++) - if (ipw_status_codes[i].status == status) + if (ipw_status_codes[i].status == (status & 0xff)) return ipw_status_codes[i].reason; return "Unknown status value."; } @@ -3076,18 +3079,30 @@ static inline u32 ipw_get_max_rate(struct ipw_priv *priv) while (i && !(mask & i)) i >>= 1; switch (i) { - case IEEE80211_CCK_RATE_1MB_MASK: return 1000000; - case IEEE80211_CCK_RATE_2MB_MASK: return 2000000; - case IEEE80211_CCK_RATE_5MB_MASK: return 5500000; - case IEEE80211_OFDM_RATE_6MB_MASK: return 6000000; - case IEEE80211_OFDM_RATE_9MB_MASK: return 9000000; - case IEEE80211_CCK_RATE_11MB_MASK: return 11000000; - case IEEE80211_OFDM_RATE_12MB_MASK: return 12000000; - case IEEE80211_OFDM_RATE_18MB_MASK: return 18000000; - case IEEE80211_OFDM_RATE_24MB_MASK: return 24000000; - case IEEE80211_OFDM_RATE_36MB_MASK: return 36000000; - case IEEE80211_OFDM_RATE_48MB_MASK: return 48000000; - case IEEE80211_OFDM_RATE_54MB_MASK: return 54000000; + case IEEE80211_CCK_RATE_1MB_MASK: + return 1000000; + case IEEE80211_CCK_RATE_2MB_MASK: + return 2000000; + case IEEE80211_CCK_RATE_5MB_MASK: + return 5500000; + case IEEE80211_OFDM_RATE_6MB_MASK: + return 6000000; + case IEEE80211_OFDM_RATE_9MB_MASK: + return 9000000; + case IEEE80211_CCK_RATE_11MB_MASK: + return 11000000; + case IEEE80211_OFDM_RATE_12MB_MASK: + return 12000000; + case IEEE80211_OFDM_RATE_18MB_MASK: + return 18000000; + case IEEE80211_OFDM_RATE_24MB_MASK: + return 24000000; + case IEEE80211_OFDM_RATE_36MB_MASK: + return 36000000; + case IEEE80211_OFDM_RATE_48MB_MASK: + return 48000000; + case IEEE80211_OFDM_RATE_54MB_MASK: + return 54000000; } if (priv->ieee->mode == IEEE_B) @@ -3115,24 +3130,36 @@ static u32 ipw_get_current_rate(struct ipw_priv *priv) return ipw_get_max_rate(priv); switch (rate) { - case IPW_TX_RATE_1MB: return 1000000; - case IPW_TX_RATE_2MB: return 2000000; - case IPW_TX_RATE_5MB: return 5500000; - case IPW_TX_RATE_6MB: return 6000000; - case IPW_TX_RATE_9MB: return 9000000; - case IPW_TX_RATE_11MB: return 11000000; - case IPW_TX_RATE_12MB: return 12000000; - case IPW_TX_RATE_18MB: return 18000000; - case IPW_TX_RATE_24MB: return 24000000; - case IPW_TX_RATE_36MB: return 36000000; - case IPW_TX_RATE_48MB: return 48000000; - case IPW_TX_RATE_54MB: return 54000000; + case IPW_TX_RATE_1MB: + return 1000000; + case IPW_TX_RATE_2MB: + return 2000000; + case IPW_TX_RATE_5MB: + return 5500000; + case IPW_TX_RATE_6MB: + return 6000000; + case IPW_TX_RATE_9MB: + return 9000000; + case IPW_TX_RATE_11MB: + return 11000000; + case IPW_TX_RATE_12MB: + return 12000000; + case IPW_TX_RATE_18MB: + return 18000000; + case IPW_TX_RATE_24MB: + return 24000000; + case IPW_TX_RATE_36MB: + return 36000000; + case IPW_TX_RATE_48MB: + return 48000000; + case IPW_TX_RATE_54MB: + return 54000000; } return 0; } -#define PERFECT_RSSI (-50) +#define PERFECT_RSSI (-20) #define WORST_RSSI (-85) #define IPW_STATS_INTERVAL (2 * HZ) static void ipw_gather_stats(struct ipw_priv *priv) @@ -3145,6 +3172,7 @@ static void ipw_gather_stats(struct ipw_priv *priv) s16 rssi; u32 beacon_quality, signal_quality, tx_quality, rx_quality, rate_quality; + u32 max_rate; if (!(priv->status & STATUS_ASSOCIATED)) { priv->quality = 0; @@ -3201,7 +3229,8 @@ static void ipw_gather_stats(struct ipw_priv *priv) beacon_quality, missed_beacons_percent); priv->last_rate = ipw_get_current_rate(priv); - rate_quality = priv->last_rate * 40 / priv->last_rate + 60; + max_rate = ipw_get_max_rate(priv); + rate_quality = priv->last_rate * 40 / max_rate + 60; IPW_DEBUG_STATS("Rate quality : %3d%% (%dMbs)\n", rate_quality, priv->last_rate / 1000000); @@ -3226,9 +3255,16 @@ static void ipw_gather_stats(struct ipw_priv *priv) signal_quality = 100; else if (rssi < WORST_RSSI) signal_quality = 0; - else - signal_quality = (rssi - WORST_RSSI) * 100 / - (PERFECT_RSSI - WORST_RSSI); + else /* qual = 100a^2 - 15ab + 62b^2 / a^2 */ + signal_quality = + (100 * + (PERFECT_RSSI - WORST_RSSI) * + (PERFECT_RSSI - WORST_RSSI) - + (PERFECT_RSSI - rssi) * + (15 * (PERFECT_RSSI - WORST_RSSI) + + 62 * (PERFECT_RSSI - rssi))) / + ((PERFECT_RSSI - WORST_RSSI) * (PERFECT_RSSI - WORST_RSSI)); + IPW_DEBUG_STATS("Signal level : %3d%% (%d dBm)\n", signal_quality, rssi); @@ -3257,6 +3293,62 @@ static void ipw_gather_stats(struct ipw_priv *priv) IPW_STATS_INTERVAL); } +static inline void ipw_handle_missed_beacon(struct ipw_priv *priv, + int missed_count) +{ + priv->notif_missed_beacons = missed_count; + + if (missed_count > priv->missed_beacon_threshold && + priv->status & STATUS_ASSOCIATED) { + /* If associated and we've hit the missed + * beacon threshold, disassociate, turn + * off roaming, and abort any active scans */ + IPW_DEBUG(IPW_DL_INFO | IPW_DL_NOTIF | + IPW_DL_STATE, + "Missed beacon: %d - disassociate\n", missed_count); + priv->status &= ~STATUS_ROAMING; + if (priv->status & STATUS_SCANNING) + queue_work(priv->workqueue, &priv->abort_scan); + queue_work(priv->workqueue, &priv->disassociate); + return; + } + + if (priv->status & STATUS_ROAMING) { + /* If we are currently roaming, then just + * print a debug statement... */ + IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE, + "Missed beacon: %d - roam in progress\n", + missed_count); + return; + } + + if (missed_count > priv->roaming_threshold) { + /* If we are not already roaming, set the ROAM + * bit in the status and kick off a scan */ + IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE, + "Missed beacon: %d - initiate " + "roaming\n", missed_count); + if (!(priv->status & STATUS_ROAMING)) { + priv->status |= STATUS_ROAMING; + if (!(priv->status & STATUS_SCANNING)) + queue_work(priv->workqueue, + &priv->request_scan); + } + return; + } + + if (priv->status & STATUS_SCANNING) { + /* Stop scan to keep fw from getting + * stuck (only if we aren't roaming -- + * otherwise we'll never scan more than 2 or 3 + * channels..) */ + queue_work(priv->workqueue, &priv->abort_scan); + } + + IPW_DEBUG_NOTIF("Missed beacon: %d\n", missed_count); + +} + /** * Handle host notification packet. * Called from interrupt routine @@ -3383,6 +3475,24 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, } case CMAS_INIT:{ + if (priv->status & STATUS_AUTH) { + struct + ieee80211_assoc_response + *resp; + resp = + (struct + ieee80211_assoc_response + *)¬if->u.raw; + IPW_DEBUG(IPW_DL_NOTIF | + IPW_DL_STATE | + IPW_DL_ASSOC, + "association failed (0x%04X): %s\n", + ntohs(resp->status), + ipw_get_status_code + (ntohs + (resp->status))); + } + IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | IPW_DL_ASSOC, "disassociated: '%s' " MAC_FMT @@ -3629,36 +3739,8 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, break; } - if (x->state == HOST_NOTIFICATION_STATUS_BEACON_MISSING) { - if (priv->status & STATUS_SCANNING) { - /* Stop scan to keep fw from getting - * stuck... */ - queue_work(priv->workqueue, - &priv->abort_scan); - } - - if (x->number > priv->missed_beacon_threshold && - priv->status & STATUS_ASSOCIATED) { - IPW_DEBUG(IPW_DL_INFO | IPW_DL_NOTIF | - IPW_DL_STATE, - "Missed beacon: %d - disassociate\n", - x->number); - queue_work(priv->workqueue, - &priv->disassociate); - } else if (x->number > priv->roaming_threshold) { - IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE, - "Missed beacon: %d - initiate " - "roaming\n", x->number); - queue_work(priv->workqueue, - &priv->roam); - } else { - IPW_DEBUG_NOTIF("Missed beacon: %d\n", - x->number); - } - - priv->notif_missed_beacons = x->number; - - } + if (x->state == HOST_NOTIFICATION_STATUS_BEACON_MISSING) + ipw_handle_missed_beacon(priv, x->number); break; } @@ -4137,6 +4219,13 @@ static int ipw_compatible_rates(struct ipw_priv *priv, for (i = 0; i < num_rates; i++) { if (!ipw_is_rate_in_mask (priv, network->mode, network->rates[i])) { + if (network->rates[i] & IEEE80211_BASIC_RATE_MASK) { + IPW_DEBUG_SCAN + ("Basic rate %02X masked: 0x%08X\n", + network->rates[i], priv->rates_mask); + return 0; + } + IPW_DEBUG_SCAN("Rate %02X masked : 0x%08X\n", network->rates[i], priv->rates_mask); continue; @@ -4150,6 +4239,13 @@ static int ipw_compatible_rates(struct ipw_priv *priv, for (i = 0; i < num_rates; i++) { if (!ipw_is_rate_in_mask (priv, network->mode, network->rates_ex[i])) { + if (network->rates_ex[i] & IEEE80211_BASIC_RATE_MASK) { + IPW_DEBUG_SCAN + ("Basic rate %02X masked: 0x%08X\n", + network->rates_ex[i], priv->rates_mask); + return 0; + } + IPW_DEBUG_SCAN("Rate %02X masked : 0x%08X\n", network->rates_ex[i], priv->rates_mask); continue; @@ -4159,7 +4255,7 @@ static int ipw_compatible_rates(struct ipw_priv *priv, network->rates_ex[i]; } - return rates->num_rates; + return 1; } static inline void ipw_copy_rates(struct ipw_supported_rates *dest, @@ -4322,7 +4418,7 @@ static int ipw_best_network(struct ipw_priv *priv, /* If this network has already had an association attempt within the * last 3 seconds, do not try and associate again... */ if (network->last_associate && - time_after(network->last_associate + (HZ * 5UL), jiffies)) { + time_after(network->last_associate + (HZ * 3UL), jiffies)) { IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " "because of storming (%lu since last " "assoc attempt).\n", @@ -4334,7 +4430,7 @@ static int ipw_best_network(struct ipw_priv *priv, /* Now go through and see if the requested network is valid... */ if (priv->ieee->scan_age != 0 && - jiffies - network->last_scanned > priv->ieee->scan_age) { + time_after(jiffies, network->last_scanned + priv->ieee->scan_age)) { IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " "because of age: %lums.\n", escape_essid(network->ssid, network->ssid_len), @@ -4386,7 +4482,17 @@ static int ipw_best_network(struct ipw_priv *priv, return 0; } - ipw_compatible_rates(priv, network, &rates); + /* Ensure that the rates supported by the driver are compatible with + * this AP, including verification of basic rates (mandatory) */ + if (!ipw_compatible_rates(priv, network, &rates)) { + IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " + "because configured rate mask excludes " + "AP mandatory rate.\n", + escape_essid(network->ssid, network->ssid_len), + MAC_ARG(network->bssid)); + return 0; + } + if (rates.num_rates == 0) { IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " "because of no compatible rates.\n", @@ -4448,6 +4554,8 @@ static void ipw_adhoc_create(struct ipw_priv *priv, memcpy(network->ssid, priv->essid, priv->essid_len); memset(&network->stats, 0, sizeof(network->stats)); network->capability = WLAN_CAPABILITY_IBSS; + if (!(priv->config & CFG_PREAMBLE_LONG)) + network->capability |= WLAN_CAPABILITY_SHORT_PREAMBLE; if (priv->capability & CAP_PRIVACY_ON) network->capability |= WLAN_CAPABILITY_PRIVACY; network->rates_len = min(priv->rates.num_rates, MAX_RATES_LENGTH); @@ -4530,7 +4638,8 @@ static void ipw_debug_config(struct ipw_priv *priv) else IPW_DEBUG_INFO("ESSID unlocked.\n"); if (priv->config & CFG_STATIC_BSSID) - IPW_DEBUG_INFO("BSSID locked to %d\n", priv->channel); + IPW_DEBUG_INFO("BSSID locked to " MAC_FMT "\n", + MAC_ARG(priv->bssid)); else IPW_DEBUG_INFO("BSSID unlocked.\n"); if (priv->capability & CAP_PRIVACY_ON) @@ -4561,6 +4670,8 @@ static inline void ipw_set_fixed_rate(struct ipw_priv *priv, /* IEEE_A */ if (priv->rates_mask & ~IEEE80211_OFDM_RATES_MASK) { /* Invalid fixed rate mask */ + IPW_DEBUG_WX + ("invalid fixed rate mask in ipw_set_fixed_rate\n"); fr.tx_rates = 0; break; } @@ -4573,6 +4684,8 @@ static inline void ipw_set_fixed_rate(struct ipw_priv *priv, if (network->mode == IEEE_B) { if (fr.tx_rates & ~IEEE80211_CCK_RATES_MASK) { /* Invalid fixed rate mask */ + IPW_DEBUG_WX + ("invalid fixed rate mask in ipw_set_fixed_rate\n"); fr.tx_rates = 0; } break; @@ -4582,6 +4695,8 @@ static inline void ipw_set_fixed_rate(struct ipw_priv *priv, if (fr.tx_rates & ~(IEEE80211_CCK_RATES_MASK | IEEE80211_OFDM_RATES_MASK)) { /* Invalid fixed rate mask */ + IPW_DEBUG_WX + ("invalid fixed rate mask in ipw_set_fixed_rate\n"); fr.tx_rates = 0; break; } @@ -4609,134 +4724,748 @@ static inline void ipw_set_fixed_rate(struct ipw_priv *priv, ipw_write_reg32(priv, reg, *(u32 *) & fr); } -static int ipw_associate_network(struct ipw_priv *priv, - struct ieee80211_network *network, - struct ipw_supported_rates *rates, int roaming) +static void ipw_abort_scan(struct ipw_priv *priv) { int err; - if (priv->config & CFG_FIXED_RATE) - ipw_set_fixed_rate(priv, network); + if (priv->status & STATUS_SCAN_ABORTING) { + IPW_DEBUG_HC("Ignoring concurrent scan abort request.\n"); + return; + } + priv->status |= STATUS_SCAN_ABORTING; - if (!(priv->config & CFG_STATIC_ESSID)) { - priv->essid_len = min(network->ssid_len, - (u8) IW_ESSID_MAX_SIZE); - memcpy(priv->essid, network->ssid, priv->essid_len); + err = ipw_send_scan_abort(priv); + if (err) + IPW_DEBUG_HC("Request to abort scan failed.\n"); +} + +static int ipw_request_scan(struct ipw_priv *priv) +{ + struct ipw_scan_request_ext scan; + int channel_index = 0; + int i, err, scan_type; + + if (priv->status & STATUS_EXIT_PENDING) { + IPW_DEBUG_SCAN("Aborting scan due to device shutdown\n"); + priv->status |= STATUS_SCAN_PENDING; + return 0; } - network->last_associate = jiffies; + if (priv->status & STATUS_SCANNING) { + IPW_DEBUG_HC("Concurrent scan requested. Aborting first.\n"); + priv->status |= STATUS_SCAN_PENDING; + ipw_abort_scan(priv); + return 0; + } - memset(&priv->assoc_request, 0, sizeof(priv->assoc_request)); - priv->assoc_request.channel = network->channel; - if ((priv->capability & CAP_PRIVACY_ON) && - (priv->capability & CAP_SHARED_KEY)) { - priv->assoc_request.auth_type = AUTH_SHARED_KEY; - priv->assoc_request.auth_key = priv->sec.active_key; - } else { - priv->assoc_request.auth_type = AUTH_OPEN; - priv->assoc_request.auth_key = 0; + if (priv->status & STATUS_SCAN_ABORTING) { + IPW_DEBUG_HC("Scan request while abort pending. Queuing.\n"); + priv->status |= STATUS_SCAN_PENDING; + return 0; } - if (priv->capability & CAP_PRIVACY_ON) - ipw_send_wep_keys(priv); + if (priv->status & STATUS_RF_KILL_MASK) { + IPW_DEBUG_HC("Aborting scan due to RF Kill activation\n"); + priv->status |= STATUS_SCAN_PENDING; + return 0; + } - /* - * It is valid for our ieee device to support multiple modes, but - * when it comes to associating to a given network we have to choose - * just one mode. - */ - if (network->mode & priv->ieee->mode & IEEE_A) - priv->assoc_request.ieee_mode = IPW_A_MODE; - else if (network->mode & priv->ieee->mode & IEEE_G) - priv->assoc_request.ieee_mode = IPW_G_MODE; - else if (network->mode & priv->ieee->mode & IEEE_B) - priv->assoc_request.ieee_mode = IPW_B_MODE; + memset(&scan, 0, sizeof(scan)); - IPW_DEBUG_ASSOC("%sssocation attempt: '%s', channel %d, " - "802.11%c [%d], enc=%s%s%s%c%c\n", - roaming ? "Rea" : "A", - escape_essid(priv->essid, priv->essid_len), - network->channel, - ipw_modes[priv->assoc_request.ieee_mode], - rates->num_rates, - priv->capability & CAP_PRIVACY_ON ? "on " : "off", - priv->capability & CAP_PRIVACY_ON ? - (priv->capability & CAP_SHARED_KEY ? "(shared)" : - "(open)") : "", - priv->capability & CAP_PRIVACY_ON ? " key=" : "", - priv->capability & CAP_PRIVACY_ON ? - '1' + priv->sec.active_key : '.', - priv->capability & CAP_PRIVACY_ON ? '.' : ' '); + scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_SCAN] = 20; + scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN] = 20; + scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] = 20; - priv->assoc_request.beacon_interval = network->beacon_interval; - if ((priv->ieee->iw_mode == IW_MODE_ADHOC) && - (network->time_stamp[0] == 0) && (network->time_stamp[1] == 0)) { - priv->assoc_request.assoc_type = HC_IBSS_START; - priv->assoc_request.assoc_tsf_msw = 0; - priv->assoc_request.assoc_tsf_lsw = 0; - } else { - if (unlikely(roaming)) - priv->assoc_request.assoc_type = HC_REASSOCIATE; - else - priv->assoc_request.assoc_type = HC_ASSOCIATE; - priv->assoc_request.assoc_tsf_msw = network->time_stamp[1]; - priv->assoc_request.assoc_tsf_lsw = network->time_stamp[0]; - } + scan.full_scan_index = ieee80211_get_scans(priv->ieee); - memcpy(&priv->assoc_request.bssid, network->bssid, ETH_ALEN); +#ifdef CONFIG_IPW_MONITOR + if (priv->ieee->iw_mode == IW_MODE_MONITOR) { + u8 band = 0, channel = priv->channel; - if (priv->ieee->iw_mode == IW_MODE_ADHOC) { - memset(&priv->assoc_request.dest, 0xFF, ETH_ALEN); - priv->assoc_request.atim_window = network->atim_window; + if (is_valid_channel(IEEE_A, channel)) + band = (u8) (IPW_A_MODE << 6) | 1; + + if (is_valid_channel(IEEE_B | IEEE_G, channel)) + band = (u8) (IPW_B_MODE << 6) | 1; + + if (band == 0) { + band = (u8) (IPW_B_MODE << 6) | 1; + channel = 9; + } + + scan.channels_list[channel_index++] = band; + scan.channels_list[channel_index] = channel; + ipw_set_scan_type(&scan, channel_index, + IPW_SCAN_PASSIVE_FULL_DWELL_SCAN); + + scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] = 2000; } else { - memcpy(&priv->assoc_request.dest, network->bssid, ETH_ALEN); - priv->assoc_request.atim_window = 0; - } +#endif /* CONFIG_IPW_MONITOR */ + /* If we are roaming, then make this a directed scan for the current + * network. Otherwise, ensure that every other scan is a fast + * channel hop scan */ + if ((priv->status & STATUS_ROAMING) + || (!(priv->status & STATUS_ASSOCIATED) + && (priv->config & CFG_STATIC_ESSID) + && (scan.full_scan_index % 2))) { + err = ipw_send_ssid(priv, priv->essid, priv->essid_len); + if (err) { + IPW_DEBUG_HC + ("Attempt to send SSID command failed.\n"); + return err; + } - priv->assoc_request.capability = network->capability; - priv->assoc_request.listen_interval = network->listen_interval; + scan_type = IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN; + } else { + scan_type = IPW_SCAN_ACTIVE_BROADCAST_SCAN; + } - err = ipw_send_ssid(priv, priv->essid, priv->essid_len); - if (err) { - IPW_DEBUG_HC("Attempt to send SSID command failed.\n"); - return err; - } + if (priv->ieee->freq_band & IEEE80211_52GHZ_BAND) { + int start = channel_index; + for (i = 0; i < MAX_A_CHANNELS; i++) { + if (band_a_active_channel[i] == 0) + break; + if ((priv->status & STATUS_ASSOCIATED) && + band_a_active_channel[i] == priv->channel) + continue; + channel_index++; + scan.channels_list[channel_index] = + band_a_active_channel[i]; + ipw_set_scan_type(&scan, channel_index, + scan_type); + } - rates->ieee_mode = priv->assoc_request.ieee_mode; - rates->purpose = IPW_RATE_CONNECT; - ipw_send_supported_rates(priv, rates); + if (start != channel_index) { + scan.channels_list[start] = + (u8) (IPW_A_MODE << 6) | (channel_index - + start); + channel_index++; + } + } - if (priv->assoc_request.ieee_mode == IPW_G_MODE) - priv->sys_config.dot11g_auto_detection = 1; - else - priv->sys_config.dot11g_auto_detection = 0; - err = ipw_send_system_config(priv, &priv->sys_config); - if (err) { - IPW_DEBUG_HC("Attempt to send sys config command failed.\n"); - return err; + if (priv->ieee->freq_band & IEEE80211_24GHZ_BAND) { + int start = channel_index; + for (i = 0; i < MAX_B_CHANNELS; i++) { + if (band_b_active_channel[i] == 0) + break; + if ((priv->status & STATUS_ASSOCIATED) && + band_b_active_channel[i] == priv->channel) + continue; + channel_index++; + scan.channels_list[channel_index] = + band_b_active_channel[i]; + ipw_set_scan_type(&scan, channel_index, + scan_type); + } + + if (start != channel_index) { + scan.channels_list[start] = + (u8) (IPW_B_MODE << 6) | (channel_index - + start); + } + } +#ifdef CONFIG_IPW_MONITOR } +#endif - IPW_DEBUG_ASSOC("Association sensitivity: %d\n", network->stats.rssi); - err = ipw_set_sensitivity(priv, network->stats.rssi); + err = ipw_send_scan_request_ext(priv, &scan); if (err) { - IPW_DEBUG_HC("Attempt to send associate command failed.\n"); - return err; + IPW_DEBUG_HC("Sending scan command failed: %08X\n", err); + return -EIO; } - /* - * If preemption is enabled, it is possible for the association - * to complete before we return from ipw_send_associate. Therefore - * we have to be sure and update our priviate data first. - */ - priv->channel = network->channel; - memcpy(priv->bssid, network->bssid, ETH_ALEN); - priv->status |= STATUS_ASSOCIATING; - priv->status &= ~STATUS_SECURITY_UPDATED; + priv->status |= STATUS_SCANNING; + priv->status &= ~STATUS_SCAN_PENDING; - priv->assoc_network = network; + return 0; +} - err = ipw_send_associate(priv, &priv->assoc_request); - if (err) { +/* Support for wpa_supplicant. Will be replaced with WEXT once + * they get WPA support. */ +#ifdef CONFIG_IEEE80211_WPA + +/* following definitions must match definitions in driver_ipw.c */ + +#define IPW_IOCTL_WPA_SUPPLICANT SIOCIWFIRSTPRIV+30 + +#define IPW_CMD_SET_WPA_PARAM 1 +#define IPW_CMD_SET_WPA_IE 2 +#define IPW_CMD_SET_ENCRYPTION 3 +#define IPW_CMD_MLME 4 + +#define IPW_PARAM_WPA_ENABLED 1 +#define IPW_PARAM_TKIP_COUNTERMEASURES 2 +#define IPW_PARAM_DROP_UNENCRYPTED 3 +#define IPW_PARAM_PRIVACY_INVOKED 4 +#define IPW_PARAM_AUTH_ALGS 5 +#define IPW_PARAM_IEEE_802_1X 6 + +#define IPW_MLME_STA_DEAUTH 1 +#define IPW_MLME_STA_DISASSOC 2 + +#define IPW_CRYPT_ERR_UNKNOWN_ALG 2 +#define IPW_CRYPT_ERR_UNKNOWN_ADDR 3 +#define IPW_CRYPT_ERR_CRYPT_INIT_FAILED 4 +#define IPW_CRYPT_ERR_KEY_SET_FAILED 5 +#define IPW_CRYPT_ERR_TX_KEY_SET_FAILED 6 +#define IPW_CRYPT_ERR_CARD_CONF_FAILED 7 + +#define IPW_CRYPT_ALG_NAME_LEN 16 + +struct ipw_param { + u32 cmd; + u8 sta_addr[ETH_ALEN]; + union { + struct { + u8 name; + u32 value; + } wpa_param; + struct { + u32 len; + u8 *data; + } wpa_ie; + struct { + int command; + int reason_code; + } mlme; + struct { + u8 alg[IPW_CRYPT_ALG_NAME_LEN]; + u8 set_tx; + u32 err; + u8 idx; + u8 seq[8]; /* sequence counter (set: RX, get: TX) */ + u16 key_len; + u8 key[0]; + } crypt; + + } u; +}; + +/* end of driver_ipw.c code */ + +static int ipw_wpa_enable(struct ipw_priv *priv, int value) +{ + struct ieee80211_device *ieee = priv->ieee; + struct ieee80211_security sec = { + .flags = SEC_LEVEL | SEC_ENABLED, + }; + int ret = 0; + + ieee->wpa_enabled = value; + + if (value) { + sec.level = SEC_LEVEL_3; + sec.enabled = 1; + } else { + sec.level = SEC_LEVEL_0; + sec.enabled = 0; + } + + if (ieee->set_security) + ieee->set_security(ieee->dev, &sec); + else + ret = -EOPNOTSUPP; + + return ret; +} + +#define AUTH_ALG_OPEN_SYSTEM 0x1 +#define AUTH_ALG_SHARED_KEY 0x2 + +static int ipw_wpa_set_auth_algs(struct ipw_priv *priv, int value) +{ + struct ieee80211_device *ieee = priv->ieee; + struct ieee80211_security sec = { + .flags = SEC_AUTH_MODE, + }; + int ret = 0; + + if (value & AUTH_ALG_SHARED_KEY) { + sec.auth_mode = WLAN_AUTH_SHARED_KEY; + ieee->open_wep = 0; + } else { + sec.auth_mode = WLAN_AUTH_OPEN; + ieee->open_wep = 1; + } + + if (ieee->set_security) + ieee->set_security(ieee->dev, &sec); + else + ret = -EOPNOTSUPP; + + return ret; +} + +static int ipw_wpa_set_param(struct net_device *dev, u8 name, u32 value) +{ + struct ipw_priv *priv = ieee80211_priv(dev); + int ret = 0; + + switch (name) { + case IPW_PARAM_WPA_ENABLED: + ret = ipw_wpa_enable(priv, value); + break; + + case IPW_PARAM_TKIP_COUNTERMEASURES: + priv->ieee->tkip_countermeasures = value; + break; + + case IPW_PARAM_DROP_UNENCRYPTED: + priv->ieee->drop_unencrypted = value; + break; + + case IPW_PARAM_PRIVACY_INVOKED: + priv->ieee->privacy_invoked = value; + break; + + case IPW_PARAM_AUTH_ALGS: + ret = ipw_wpa_set_auth_algs(priv, value); + break; + + case IPW_PARAM_IEEE_802_1X: + priv->ieee->ieee802_1x = value; + break; + + default: + IPW_ERROR("%s: Unknown WPA param: %d\n", dev->name, name); + ret = -EOPNOTSUPP; + } + + return ret; +} + +static int ipw_wpa_mlme(struct net_device *dev, int command, int reason) +{ + struct ipw_priv *priv = ieee80211_priv(dev); + int ret = 0; + + switch (command) { + case IPW_MLME_STA_DEAUTH: + // silently ignore + break; + + case IPW_MLME_STA_DISASSOC: + ipw_disassociate(priv); + break; + + default: + IPW_ERROR("%s: Unknown MLME request: %d\n", dev->name, command); + ret = -EOPNOTSUPP; + } + + return ret; +} + +static int ipw_set_rsn_capa(struct ipw_priv *priv, + char *capabilities, int length) +{ + struct host_cmd cmd = { + .cmd = IPW_CMD_RSN_CAPABILITIES, + .len = length, + }; + + IPW_DEBUG_HC("HOST_CMD_RSN_CAPABILITIES\n"); + + memcpy(&cmd.param, capabilities, length); + if (ipw_send_cmd(priv, &cmd)) { + IPW_ERROR("failed to send HOST_CMD_RSN_CAPABILITIES command\n"); + return -1; + } + return 0; +} + +void ipw_wpa_assoc_frame(struct ipw_priv *priv, char *wpa_ie, int wpa_ie_len) +{ + /* make sure WPA is enabled */ + ipw_wpa_enable(priv, 1); + + if (priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) + ipw_disassociate(priv); +} + +static int ipw_wpa_set_wpa_ie(struct net_device *dev, + struct ipw_param *param, int plen) +{ + struct ipw_priv *priv = ieee80211_priv(dev); + struct ieee80211_device *ieee = priv->ieee; + u8 *buf; + + if (!ieee->wpa_enabled) + return -EOPNOTSUPP; + + if (param->u.wpa_ie.len > MAX_WPA_IE_LEN || + (param->u.wpa_ie.len && param->u.wpa_ie.data == NULL)) + return -EINVAL; + + if (param->u.wpa_ie.len) { + buf = kmalloc(param->u.wpa_ie.len, GFP_KERNEL); + if (buf == NULL) + return -ENOMEM; + + memcpy(buf, param->u.wpa_ie.data, param->u.wpa_ie.len); + kfree(ieee->wpa_ie); + ieee->wpa_ie = buf; + ieee->wpa_ie_len = param->u.wpa_ie.len; + } else { + kfree(ieee->wpa_ie); + ieee->wpa_ie = NULL; + ieee->wpa_ie_len = 0; + } + + ipw_wpa_assoc_frame(priv, ieee->wpa_ie, ieee->wpa_ie_len); + return 0; +} + +/* implementation borrowed from hostap driver */ + +static int ipw_wpa_set_encryption(struct net_device *dev, + struct ipw_param *param, int param_len) +{ + int ret = 0; + struct ipw_priv *priv = ieee80211_priv(dev); + struct ieee80211_device *ieee = priv->ieee; + struct ieee80211_crypto_ops *ops; + struct ieee80211_crypt_data **crypt; + + struct ieee80211_security sec = { + .flags = 0, + }; + + param->u.crypt.err = 0; + param->u.crypt.alg[IPW_CRYPT_ALG_NAME_LEN - 1] = '\0'; + + if (param_len != + (int)((char *)param->u.crypt.key - (char *)param) + + param->u.crypt.key_len) { + IPW_DEBUG_INFO("Len mismatch %d, %d\n", param_len, + param->u.crypt.key_len); + return -EINVAL; + } + if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && + param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && + param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { + if (param->u.crypt.idx >= WEP_KEYS) + return -EINVAL; + crypt = &ieee->crypt[param->u.crypt.idx]; + } else { + return -EINVAL; + } + + if (strcmp(param->u.crypt.alg, "none") == 0) { + if (crypt) { + sec.enabled = 0; + sec.level = SEC_LEVEL_0; + sec.flags |= SEC_ENABLED | SEC_LEVEL; + ieee80211_crypt_delayed_deinit(ieee, crypt); + } + goto done; + } + sec.enabled = 1; + sec.flags |= SEC_ENABLED; + + ops = ieee80211_get_crypto_ops(param->u.crypt.alg); + if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) { + request_module("ieee80211_crypt_wep"); + ops = ieee80211_get_crypto_ops(param->u.crypt.alg); + } else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0) { + request_module("ieee80211_crypt_tkip"); + ops = ieee80211_get_crypto_ops(param->u.crypt.alg); + } else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0) { + request_module("ieee80211_crypt_ccmp"); + ops = ieee80211_get_crypto_ops(param->u.crypt.alg); + } + if (ops == NULL) { + IPW_DEBUG_INFO("%s: unknown crypto alg '%s'\n", + dev->name, param->u.crypt.alg); + param->u.crypt.err = IPW_CRYPT_ERR_UNKNOWN_ALG; + ret = -EINVAL; + goto done; + } + + if (*crypt == NULL || (*crypt)->ops != ops) { + struct ieee80211_crypt_data *new_crypt; + + ieee80211_crypt_delayed_deinit(ieee, crypt); + + new_crypt = (struct ieee80211_crypt_data *) + kmalloc(sizeof(*new_crypt), GFP_KERNEL); + if (new_crypt == NULL) { + ret = -ENOMEM; + goto done; + } + memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data)); + new_crypt->ops = ops; + if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) + new_crypt->priv = + new_crypt->ops->init(param->u.crypt.idx); + + if (new_crypt->priv == NULL) { + kfree(new_crypt); + param->u.crypt.err = IPW_CRYPT_ERR_CRYPT_INIT_FAILED; + ret = -EINVAL; + goto done; + } + + *crypt = new_crypt; + } + + if (param->u.crypt.key_len > 0 && (*crypt)->ops->set_key && + (*crypt)->ops->set_key(param->u.crypt.key, + param->u.crypt.key_len, param->u.crypt.seq, + (*crypt)->priv) < 0) { + IPW_DEBUG_INFO("%s: key setting failed\n", dev->name); + param->u.crypt.err = IPW_CRYPT_ERR_KEY_SET_FAILED; + ret = -EINVAL; + goto done; + } + + if (param->u.crypt.set_tx) { + ieee->tx_keyidx = param->u.crypt.idx; + sec.active_key = param->u.crypt.idx; + sec.flags |= SEC_ACTIVE_KEY; + } + + if (ops->name != NULL) { + if (strcmp(ops->name, "WEP") == 0) { + memcpy(sec.keys[param->u.crypt.idx], + param->u.crypt.key, param->u.crypt.key_len); + sec.key_sizes[param->u.crypt.idx] = + param->u.crypt.key_len; + sec.flags |= (1 << param->u.crypt.idx); + sec.flags |= SEC_LEVEL; + sec.level = SEC_LEVEL_1; + } else if (strcmp(ops->name, "TKIP") == 0) { + sec.flags |= SEC_LEVEL; + sec.level = SEC_LEVEL_2; + } else if (strcmp(ops->name, "CCMP") == 0) { + sec.flags |= SEC_LEVEL; + sec.level = SEC_LEVEL_3; + } + } + done: + if (ieee->set_security) + ieee->set_security(ieee->dev, &sec); + + /* Do not reset port if card is in Managed mode since resetting will + * generate new IEEE 802.11 authentication which may end up in looping + * with IEEE 802.1X. If your hardware requires a reset after WEP + * configuration (for example... Prism2), implement the reset_port in + * the callbacks structures used to initialize the 802.11 stack. */ + if (ieee->reset_on_keychange && + ieee->iw_mode != IW_MODE_INFRA && + ieee->reset_port && ieee->reset_port(dev)) { + IPW_DEBUG_INFO("%s: reset_port failed\n", dev->name); + param->u.crypt.err = IPW_CRYPT_ERR_CARD_CONF_FAILED; + return -EINVAL; + } + + return ret; +} + +static int ipw_wpa_supplicant(struct net_device *dev, struct iw_point *p) +{ + struct ipw_param *param; + int ret = 0; + + IPW_DEBUG_INFO("wpa_supplicant: len=%d\n", p->length); + + if (p->length < sizeof(struct ipw_param) || !p->pointer) + return -EINVAL; + + param = (struct ipw_param *)kmalloc(p->length, GFP_KERNEL); + if (param == NULL) + return -ENOMEM; + + if (copy_from_user(param, p->pointer, p->length)) { + kfree(param); + return -EFAULT; + } + + switch (param->cmd) { + + case IPW_CMD_SET_WPA_PARAM: + ret = ipw_wpa_set_param(dev, param->u.wpa_param.name, + param->u.wpa_param.value); + break; + + case IPW_CMD_SET_WPA_IE: + ret = ipw_wpa_set_wpa_ie(dev, param, p->length); + break; + + case IPW_CMD_SET_ENCRYPTION: + ret = ipw_wpa_set_encryption(dev, param, p->length); + break; + + case IPW_CMD_MLME: + ret = ipw_wpa_mlme(dev, param->u.mlme.command, + param->u.mlme.reason_code); + break; + + default: + IPW_ERROR("%s: Unknown WPA supplicant request: %d\n", + dev->name, param->cmd); + ret = -EOPNOTSUPP; + } + + if (ret == 0 && copy_to_user(p->pointer, param, p->length)) + ret = -EFAULT; + + kfree(param); + return ret; +} +#endif /* CONFIG_IEEE80211_WPA */ + +static int ipw_associate_network(struct ipw_priv *priv, + struct ieee80211_network *network, + struct ipw_supported_rates *rates, int roaming) +{ + int err; + + if (priv->config & CFG_FIXED_RATE) + ipw_set_fixed_rate(priv, network); + + if (!(priv->config & CFG_STATIC_ESSID)) { + priv->essid_len = min(network->ssid_len, + (u8) IW_ESSID_MAX_SIZE); + memcpy(priv->essid, network->ssid, priv->essid_len); + } + + network->last_associate = jiffies; + + memset(&priv->assoc_request, 0, sizeof(priv->assoc_request)); + priv->assoc_request.channel = network->channel; + if ((priv->capability & CAP_PRIVACY_ON) && + (priv->capability & CAP_SHARED_KEY)) { + priv->assoc_request.auth_type = AUTH_SHARED_KEY; + priv->assoc_request.auth_key = priv->sec.active_key; + } else { + priv->assoc_request.auth_type = AUTH_OPEN; + priv->assoc_request.auth_key = 0; + } + + if (priv->capability & CAP_PRIVACY_ON) + ipw_send_wep_keys(priv); + +#ifdef CONFIG_IEEE80211_WPA + if (priv->ieee->wpa_enabled) { + priv->assoc_request.policy_support = 0x02; /* RSN active */ + ipw_set_rsn_capa(priv, priv->ieee->wpa_ie, + priv->ieee->wpa_ie_len); + } +#endif + + /* + * It is valid for our ieee device to support multiple modes, but + * when it comes to associating to a given network we have to choose + * just one mode. + */ + if (network->mode & priv->ieee->mode & IEEE_A) + priv->assoc_request.ieee_mode = IPW_A_MODE; + else if (network->mode & priv->ieee->mode & IEEE_G) + priv->assoc_request.ieee_mode = IPW_G_MODE; + else if (network->mode & priv->ieee->mode & IEEE_B) + priv->assoc_request.ieee_mode = IPW_B_MODE; + + priv->assoc_request.capability = network->capability; + if ((network->capability & WLAN_CAPABILITY_SHORT_PREAMBLE) + && !(priv->config & CFG_PREAMBLE_LONG)) { + priv->assoc_request.preamble_length = DCT_FLAG_SHORT_PREAMBLE; + } else { + priv->assoc_request.preamble_length = DCT_FLAG_LONG_PREAMBLE; + + /* Clear the short preamble if we won't be supporting it */ + priv->assoc_request.capability &= + ~WLAN_CAPABILITY_SHORT_PREAMBLE; + } + + IPW_DEBUG_ASSOC("%sssocation attempt: '%s', channel %d, " + "802.11%c [%d], %s[:%s], enc=%s%s%s%c%c\n", + roaming ? "Rea" : "A", + escape_essid(priv->essid, priv->essid_len), + network->channel, + ipw_modes[priv->assoc_request.ieee_mode], + rates->num_rates, + (priv->assoc_request.preamble_length == + DCT_FLAG_LONG_PREAMBLE) ? "long" : "short", + network->capability & + WLAN_CAPABILITY_SHORT_PREAMBLE ? "short" : "long", + priv->capability & CAP_PRIVACY_ON ? "on " : "off", + priv->capability & CAP_PRIVACY_ON ? + (priv->capability & CAP_SHARED_KEY ? "(shared)" : + "(open)") : "", + priv->capability & CAP_PRIVACY_ON ? " key=" : "", + priv->capability & CAP_PRIVACY_ON ? + '1' + priv->sec.active_key : '.', + priv->capability & CAP_PRIVACY_ON ? '.' : ' '); + + priv->assoc_request.beacon_interval = network->beacon_interval; + if ((priv->ieee->iw_mode == IW_MODE_ADHOC) && + (network->time_stamp[0] == 0) && (network->time_stamp[1] == 0)) { + priv->assoc_request.assoc_type = HC_IBSS_START; + priv->assoc_request.assoc_tsf_msw = 0; + priv->assoc_request.assoc_tsf_lsw = 0; + } else { + if (unlikely(roaming)) + priv->assoc_request.assoc_type = HC_REASSOCIATE; + else + priv->assoc_request.assoc_type = HC_ASSOCIATE; + priv->assoc_request.assoc_tsf_msw = network->time_stamp[1]; + priv->assoc_request.assoc_tsf_lsw = network->time_stamp[0]; + } + + memcpy(&priv->assoc_request.bssid, network->bssid, ETH_ALEN); + + if (priv->ieee->iw_mode == IW_MODE_ADHOC) { + memset(&priv->assoc_request.dest, 0xFF, ETH_ALEN); + priv->assoc_request.atim_window = network->atim_window; + } else { + memcpy(&priv->assoc_request.dest, network->bssid, ETH_ALEN); + priv->assoc_request.atim_window = 0; + } + + priv->assoc_request.listen_interval = network->listen_interval; + + err = ipw_send_ssid(priv, priv->essid, priv->essid_len); + if (err) { + IPW_DEBUG_HC("Attempt to send SSID command failed.\n"); + return err; + } + + rates->ieee_mode = priv->assoc_request.ieee_mode; + rates->purpose = IPW_RATE_CONNECT; + ipw_send_supported_rates(priv, rates); + + if (priv->assoc_request.ieee_mode == IPW_G_MODE) + priv->sys_config.dot11g_auto_detection = 1; + else + priv->sys_config.dot11g_auto_detection = 0; + err = ipw_send_system_config(priv, &priv->sys_config); + if (err) { + IPW_DEBUG_HC("Attempt to send sys config command failed.\n"); + return err; + } + + IPW_DEBUG_ASSOC("Association sensitivity: %d\n", network->stats.rssi); + err = ipw_set_sensitivity(priv, network->stats.rssi + IPW_RSSI_TO_DBM); + if (err) { + IPW_DEBUG_HC("Attempt to send associate command failed.\n"); + return err; + } + + /* + * If preemption is enabled, it is possible for the association + * to complete before we return from ipw_send_associate. Therefore + * we have to be sure and update our priviate data first. + */ + priv->channel = network->channel; + memcpy(priv->bssid, network->bssid, ETH_ALEN); + priv->status |= STATUS_ASSOCIATING; + priv->status &= ~STATUS_SECURITY_UPDATED; + + priv->assoc_network = network; + + err = ipw_send_associate(priv, &priv->assoc_request); + if (err) { IPW_DEBUG_HC("Attempt to send associate command failed.\n"); return err; } @@ -4899,6 +5628,32 @@ static inline void ipw_handle_data_packet(struct ipw_priv *priv, rxb->skb = NULL; } +static inline int is_network_packet(struct ipw_priv *priv, + struct ieee80211_hdr_4addr *header) +{ + /* Filter incoming packets to determine if they are targetted toward + * this network, discarding packets coming from ourselves */ + switch (priv->ieee->iw_mode) { + case IW_MODE_ADHOC: + if (is_broadcast_ether_addr(header->addr1) || + is_multicast_ether_addr(header->addr1)) + return !memcmp(header->addr3, priv->bssid, ETH_ALEN); + else + return memcmp(header->addr1, priv->net_dev->dev_addr, + ETH_ALEN); + break; + case IW_MODE_INFRA: + if (is_broadcast_ether_addr(header->addr3) || + is_multicast_ether_addr(header->addr3)) + return !memcmp(header->addr1, priv->bssid, ETH_ALEN); + else + return memcmp(header->addr3, priv->net_dev->dev_addr, + ETH_ALEN); + break; + } + return 1; +} + /* * Main entry function for recieving a packet with 80211 headers. This * should be called when ever the FW has notified us that there is a new @@ -4962,7 +5717,7 @@ static void ipw_rx(struct ipw_priv *priv) priv->rx_packets++; -#ifdef CONFIG_IPW_PROMISC +#ifdef CONFIG_IPW_MONITOR if (priv->ieee->iw_mode == IW_MODE_MONITOR) { ipw_handle_data_packet(priv, rxb, &stats); @@ -4979,35 +5734,9 @@ static void ipw_rx(struct ipw_priv *priv) * correctly -- we should probably use the * frame control of the packet and disregard * the current iw_mode */ - switch (priv->ieee->iw_mode) { - case IW_MODE_ADHOC: - network_packet = - !memcmp(header->addr1, - priv->net_dev->dev_addr, - ETH_ALEN) || - !memcmp(header->addr3, - priv->bssid, ETH_ALEN) || - is_broadcast_ether_addr(header-> - addr1) - || is_multicast_ether_addr(header-> - addr1); - break; - - case IW_MODE_INFRA: - default: - network_packet = - !memcmp(header->addr3, - priv->bssid, ETH_ALEN) || - !memcmp(header->addr1, - priv->net_dev->dev_addr, - ETH_ALEN) || - is_broadcast_ether_addr(header-> - addr1) - || is_multicast_ether_addr(header-> - addr1); - break; - } + network_packet = + is_network_packet(priv, header); if (network_packet && priv->assoc_network) { priv->assoc_network->stats.rssi = stats.rssi; @@ -5108,130 +5837,6 @@ static void ipw_rx(struct ipw_priv *priv) ipw_rx_queue_restock(priv); } -static void ipw_abort_scan(struct ipw_priv *priv) -{ - int err; - - if (priv->status & STATUS_SCAN_ABORTING) { - IPW_DEBUG_HC("Ignoring concurrent scan abort request.\n"); - return; - } - priv->status |= STATUS_SCAN_ABORTING; - - err = ipw_send_scan_abort(priv); - if (err) - IPW_DEBUG_HC("Request to abort scan failed.\n"); -} - -static int ipw_request_scan(struct ipw_priv *priv) -{ - struct ipw_scan_request_ext scan; - int channel_index = 0; - int i, err, scan_type; - - if (priv->status & STATUS_EXIT_PENDING) { - IPW_DEBUG_SCAN("Aborting scan due to device shutdown\n"); - priv->status |= STATUS_SCAN_PENDING; - return 0; - } - - if (priv->status & STATUS_SCANNING) { - IPW_DEBUG_HC("Concurrent scan requested. Aborting first.\n"); - priv->status |= STATUS_SCAN_PENDING; - ipw_abort_scan(priv); - return 0; - } - - if (priv->status & STATUS_SCAN_ABORTING) { - IPW_DEBUG_HC("Scan request while abort pending. Queuing.\n"); - priv->status |= STATUS_SCAN_PENDING; - return 0; - } - - if (priv->status & STATUS_RF_KILL_MASK) { - IPW_DEBUG_HC("Aborting scan due to RF Kill activation\n"); - priv->status |= STATUS_SCAN_PENDING; - return 0; - } - - memset(&scan, 0, sizeof(scan)); - - scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_SCAN] = 20; - scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN] = 20; - scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] = 20; - - scan.full_scan_index = ieee80211_get_scans(priv->ieee); - /* If we are roaming, then make this a directed scan for the current - * network. Otherwise, ensure that every other scan is a fast - * channel hop scan */ - if ((priv->status & STATUS_ROAMING) - || (!(priv->status & STATUS_ASSOCIATED) - && (priv->config & CFG_STATIC_ESSID) - && (scan.full_scan_index % 2))) { - err = ipw_send_ssid(priv, priv->essid, priv->essid_len); - if (err) { - IPW_DEBUG_HC("Attempt to send SSID command failed.\n"); - return err; - } - - scan_type = IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN; - } else { - scan_type = IPW_SCAN_ACTIVE_BROADCAST_SCAN; - } - - if (priv->ieee->freq_band & IEEE80211_52GHZ_BAND) { - int start = channel_index; - for (i = 0; i < MAX_A_CHANNELS; i++) { - if (band_a_active_channel[i] == 0) - break; - if ((priv->status & STATUS_ASSOCIATED) && - band_a_active_channel[i] == priv->channel) - continue; - channel_index++; - scan.channels_list[channel_index] = - band_a_active_channel[i]; - ipw_set_scan_type(&scan, channel_index, scan_type); - } - - if (start != channel_index) { - scan.channels_list[start] = (u8) (IPW_A_MODE << 6) | - (channel_index - start); - channel_index++; - } - } - - if (priv->ieee->freq_band & IEEE80211_24GHZ_BAND) { - int start = channel_index; - for (i = 0; i < MAX_B_CHANNELS; i++) { - if (band_b_active_channel[i] == 0) - break; - if ((priv->status & STATUS_ASSOCIATED) && - band_b_active_channel[i] == priv->channel) - continue; - channel_index++; - scan.channels_list[channel_index] = - band_b_active_channel[i]; - ipw_set_scan_type(&scan, channel_index, scan_type); - } - - if (start != channel_index) { - scan.channels_list[start] = (u8) (IPW_B_MODE << 6) | - (channel_index - start); - } - } - - err = ipw_send_scan_request_ext(priv, &scan); - if (err) { - IPW_DEBUG_HC("Sending scan command failed: %08X\n", err); - return -EIO; - } - - priv->status |= STATUS_SCANNING; - priv->status &= ~STATUS_SCAN_PENDING; - - return 0; -} - /* * This file defines the Wireless Extension handlers. It does not * define any methods of hardware manipulation and relies on the @@ -5357,7 +5962,7 @@ static int ipw_wx_set_mode(struct net_device *dev, return 0; switch (wrqu->mode) { -#ifdef CONFIG_IPW_PROMISC +#ifdef CONFIG_IPW_MONITOR case IW_MODE_MONITOR: #endif case IW_MODE_ADHOC: @@ -5370,13 +5975,13 @@ static int ipw_wx_set_mode(struct net_device *dev, return -EINVAL; } -#ifdef CONFIG_IPW_PROMISC +#ifdef CONFIG_IPW_MONITOR if (priv->ieee->iw_mode == IW_MODE_MONITOR) priv->net_dev->type = ARPHRD_ETHER; if (wrqu->mode == IW_MODE_MONITOR) priv->net_dev->type = ARPHRD_IEEE80211; -#endif /* CONFIG_IPW_PROMISC */ +#endif /* CONFIG_IPW_MONITOR */ #ifdef CONFIG_PM /* Free the existing firmware and reset the fw_loaded @@ -5680,8 +6285,111 @@ static int ipw_wx_set_rate(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - IPW_DEBUG_WX("0x%p, 0x%p, 0x%p\n", dev, info, wrqu); - return -EOPNOTSUPP; + /* TODO: We should use semaphores or locks for access to priv */ + struct ipw_priv *priv = ieee80211_priv(dev); + u32 target_rate = wrqu->bitrate.value; + u32 fixed, mask; + + /* value = -1, fixed = 0 means auto only, so we should use all rates offered by AP */ + /* value = X, fixed = 1 means only rate X */ + /* value = X, fixed = 0 means all rates lower equal X */ + + if (target_rate == -1) { + fixed = 0; + mask = IEEE80211_DEFAULT_RATES_MASK; + /* Now we should reassociate */ + goto apply; + } + + mask = 0; + fixed = wrqu->bitrate.fixed; + + if (target_rate == 1000000 || !fixed) + mask |= IEEE80211_CCK_RATE_1MB_MASK; + if (target_rate == 1000000) + goto apply; + + if (target_rate == 2000000 || !fixed) + mask |= IEEE80211_CCK_RATE_2MB_MASK; + if (target_rate == 2000000) + goto apply; + + if (target_rate == 5500000 || !fixed) + mask |= IEEE80211_CCK_RATE_5MB_MASK; + if (target_rate == 5500000) + goto apply; + + if (target_rate == 6000000 || !fixed) + mask |= IEEE80211_OFDM_RATE_6MB_MASK; + if (target_rate == 6000000) + goto apply; + + if (target_rate == 9000000 || !fixed) + mask |= IEEE80211_OFDM_RATE_9MB_MASK; + if (target_rate == 9000000) + goto apply; + + if (target_rate == 11000000 || !fixed) + mask |= IEEE80211_CCK_RATE_11MB_MASK; + if (target_rate == 11000000) + goto apply; + + if (target_rate == 12000000 || !fixed) + mask |= IEEE80211_OFDM_RATE_12MB_MASK; + if (target_rate == 12000000) + goto apply; + + if (target_rate == 18000000 || !fixed) + mask |= IEEE80211_OFDM_RATE_18MB_MASK; + if (target_rate == 18000000) + goto apply; + + if (target_rate == 24000000 || !fixed) + mask |= IEEE80211_OFDM_RATE_24MB_MASK; + if (target_rate == 24000000) + goto apply; + + if (target_rate == 36000000 || !fixed) + mask |= IEEE80211_OFDM_RATE_36MB_MASK; + if (target_rate == 36000000) + goto apply; + + if (target_rate == 48000000 || !fixed) + mask |= IEEE80211_OFDM_RATE_48MB_MASK; + if (target_rate == 48000000) + goto apply; + + if (target_rate == 54000000 || !fixed) + mask |= IEEE80211_OFDM_RATE_54MB_MASK; + if (target_rate == 54000000) + goto apply; + + IPW_DEBUG_WX("invalid rate specified, returning error\n"); + return -EINVAL; + + apply: + IPW_DEBUG_WX("Setting rate mask to 0x%08X [%s]\n", + mask, fixed ? "fixed" : "sub-rates"); + + if (mask == IEEE80211_DEFAULT_RATES_MASK) + priv->config &= ~CFG_FIXED_RATE; + else + priv->config |= CFG_FIXED_RATE; + + if (priv->rates_mask != mask) { + priv->rates_mask = mask; + /* If we are already associated or are currently trying to + * associate, disassociate and try again */ + if ((priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING))) { + IPW_DEBUG_ASSOC("Disassociating due to RATE change.\n"); + ipw_disassociate(priv); + } + } else { + /* We are not yet associated, so kick one off... */ + ipw_associate(priv); + } + + return 0; } static int ipw_wx_get_rate(struct net_device *dev, @@ -5888,7 +6596,6 @@ static int ipw_wx_set_power(struct net_device *dev, IPW_DEBUG_WX("failed setting power mode.\n"); return err; } - IPW_DEBUG_WX("SET Power Management Mode -> off\n"); return 0; @@ -6069,37 +6776,30 @@ static int ipw_wx_get_wireless_mode(struct net_device *dev, { struct ipw_priv *priv = ieee80211_priv(dev); - switch (priv->ieee->freq_band) { - case IEEE80211_24GHZ_BAND: - switch (priv->ieee->modulation) { - case IEEE80211_CCK_MODULATION: - strncpy(extra, "802.11b (2)", MAX_WX_STRING); - break; - case IEEE80211_OFDM_MODULATION: - strncpy(extra, "802.11g (4)", MAX_WX_STRING); - break; - default: - strncpy(extra, "802.11bg (6)", MAX_WX_STRING); - break; - } - break; - - case IEEE80211_52GHZ_BAND: + switch (priv->ieee->mode) { + case IEEE_A: strncpy(extra, "802.11a (1)", MAX_WX_STRING); break; - - default: /* Mixed Band */ - switch (priv->ieee->modulation) { - case IEEE80211_CCK_MODULATION: - strncpy(extra, "802.11ab (3)", MAX_WX_STRING); - break; - case IEEE80211_OFDM_MODULATION: - strncpy(extra, "802.11ag (5)", MAX_WX_STRING); - break; - default: - strncpy(extra, "802.11abg (7)", MAX_WX_STRING); - break; - } + case IEEE_B: + strncpy(extra, "802.11b (2)", MAX_WX_STRING); + break; + case IEEE_A | IEEE_B: + strncpy(extra, "802.11ab (3)", MAX_WX_STRING); + break; + case IEEE_G: + strncpy(extra, "802.11g (4)", MAX_WX_STRING); + break; + case IEEE_A | IEEE_G: + strncpy(extra, "802.11ag (5)", MAX_WX_STRING); + break; + case IEEE_B | IEEE_G: + strncpy(extra, "802.11bg (6)", MAX_WX_STRING); + break; + case IEEE_A | IEEE_B | IEEE_G: + strncpy(extra, "802.11abg (7)", MAX_WX_STRING); + break; + default: + strncpy(extra, "unknown", MAX_WX_STRING); break; } @@ -6110,8 +6810,55 @@ static int ipw_wx_get_wireless_mode(struct net_device *dev, return 0; } -#ifdef CONFIG_IPW_PROMISC -static int ipw_wx_set_promisc(struct net_device *dev, +static int ipw_wx_set_preamble(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct ipw_priv *priv = ieee80211_priv(dev); + int mode = *(int *)extra; + + /* Switching from SHORT -> LONG requires a disassociation */ + if (mode == 1) { + if (!(priv->config & CFG_PREAMBLE_LONG)) { + priv->config |= CFG_PREAMBLE_LONG; + if (priv->status & + (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { + IPW_DEBUG_ASSOC + ("Disassociating due to preamble " + "change.\n"); + ipw_disassociate(priv); + } + } + goto done; + } + + if (mode == 0) { + priv->config &= ~CFG_PREAMBLE_LONG; + goto done; + } + + return -EINVAL; + + done: + return 0; +} + +static int ipw_wx_get_preamble(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct ipw_priv *priv = ieee80211_priv(dev); + + if (priv->config & CFG_PREAMBLE_LONG) + snprintf(wrqu->name, IFNAMSIZ, "long (1)"); + else + snprintf(wrqu->name, IFNAMSIZ, "auto (0)"); + + return 0; +} + +#ifdef CONFIG_IPW_MONITOR +static int ipw_wx_set_monitor(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { @@ -6119,7 +6866,7 @@ static int ipw_wx_set_promisc(struct net_device *dev, int *parms = (int *)extra; int enable = (parms[0] > 0); - IPW_DEBUG_WX("SET PROMISC: %d %d\n", enable, parms[1]); + IPW_DEBUG_WX("SET MONITOR: %d %d\n", enable, parms[1]); if (enable) { if (priv->ieee->iw_mode != IW_MODE_MONITOR) { priv->net_dev->type = ARPHRD_IEEE80211; @@ -6145,47 +6892,49 @@ static int ipw_wx_reset(struct net_device *dev, ipw_adapter_restart(priv); return 0; } -#endif // CONFIG_IPW_PROMISC +#endif // CONFIG_IPW_MONITOR /* Rebase the WE IOCTLs to zero for the handler array */ #define IW_IOCTL(x) [(x)-SIOCSIWCOMMIT] static iw_handler ipw_wx_handlers[] = { - IW_IOCTL(SIOCGIWNAME) = ipw_wx_get_name, - IW_IOCTL(SIOCSIWFREQ) = ipw_wx_set_freq, - IW_IOCTL(SIOCGIWFREQ) = ipw_wx_get_freq, - IW_IOCTL(SIOCSIWMODE) = ipw_wx_set_mode, - IW_IOCTL(SIOCGIWMODE) = ipw_wx_get_mode, - IW_IOCTL(SIOCGIWRANGE) = ipw_wx_get_range, - IW_IOCTL(SIOCSIWAP) = ipw_wx_set_wap, - IW_IOCTL(SIOCGIWAP) = ipw_wx_get_wap, - IW_IOCTL(SIOCSIWSCAN) = ipw_wx_set_scan, - IW_IOCTL(SIOCGIWSCAN) = ipw_wx_get_scan, - IW_IOCTL(SIOCSIWESSID) = ipw_wx_set_essid, - IW_IOCTL(SIOCGIWESSID) = ipw_wx_get_essid, - IW_IOCTL(SIOCSIWNICKN) = ipw_wx_set_nick, - IW_IOCTL(SIOCGIWNICKN) = ipw_wx_get_nick, - IW_IOCTL(SIOCSIWRATE) = ipw_wx_set_rate, - IW_IOCTL(SIOCGIWRATE) = ipw_wx_get_rate, - IW_IOCTL(SIOCSIWRTS) = ipw_wx_set_rts, - IW_IOCTL(SIOCGIWRTS) = ipw_wx_get_rts, - IW_IOCTL(SIOCSIWFRAG) = ipw_wx_set_frag, - IW_IOCTL(SIOCGIWFRAG) = ipw_wx_get_frag, - IW_IOCTL(SIOCSIWTXPOW) = ipw_wx_set_txpow, - IW_IOCTL(SIOCGIWTXPOW) = ipw_wx_get_txpow, - IW_IOCTL(SIOCSIWRETRY) = ipw_wx_set_retry, - IW_IOCTL(SIOCGIWRETRY) = ipw_wx_get_retry, - IW_IOCTL(SIOCSIWENCODE) = ipw_wx_set_encode, - IW_IOCTL(SIOCGIWENCODE) = ipw_wx_get_encode, - IW_IOCTL(SIOCSIWPOWER) = ipw_wx_set_power, - IW_IOCTL(SIOCGIWPOWER) = ipw_wx_get_power, + IW_IOCTL(SIOCGIWNAME) = ipw_wx_get_name, + IW_IOCTL(SIOCSIWFREQ) = ipw_wx_set_freq, + IW_IOCTL(SIOCGIWFREQ) = ipw_wx_get_freq, + IW_IOCTL(SIOCSIWMODE) = ipw_wx_set_mode, + IW_IOCTL(SIOCGIWMODE) = ipw_wx_get_mode, + IW_IOCTL(SIOCGIWRANGE) = ipw_wx_get_range, + IW_IOCTL(SIOCSIWAP) = ipw_wx_set_wap, + IW_IOCTL(SIOCGIWAP) = ipw_wx_get_wap, + IW_IOCTL(SIOCSIWSCAN) = ipw_wx_set_scan, + IW_IOCTL(SIOCGIWSCAN) = ipw_wx_get_scan, + IW_IOCTL(SIOCSIWESSID) = ipw_wx_set_essid, + IW_IOCTL(SIOCGIWESSID) = ipw_wx_get_essid, + IW_IOCTL(SIOCSIWNICKN) = ipw_wx_set_nick, + IW_IOCTL(SIOCGIWNICKN) = ipw_wx_get_nick, + IW_IOCTL(SIOCSIWRATE) = ipw_wx_set_rate, + IW_IOCTL(SIOCGIWRATE) = ipw_wx_get_rate, + IW_IOCTL(SIOCSIWRTS) = ipw_wx_set_rts, + IW_IOCTL(SIOCGIWRTS) = ipw_wx_get_rts, + IW_IOCTL(SIOCSIWFRAG) = ipw_wx_set_frag, + IW_IOCTL(SIOCGIWFRAG) = ipw_wx_get_frag, + IW_IOCTL(SIOCSIWTXPOW) = ipw_wx_set_txpow, + IW_IOCTL(SIOCGIWTXPOW) = ipw_wx_get_txpow, + IW_IOCTL(SIOCSIWRETRY) = ipw_wx_set_retry, + IW_IOCTL(SIOCGIWRETRY) = ipw_wx_get_retry, + IW_IOCTL(SIOCSIWENCODE) = ipw_wx_set_encode, + IW_IOCTL(SIOCGIWENCODE) = ipw_wx_get_encode, + IW_IOCTL(SIOCSIWPOWER) = ipw_wx_set_power, + IW_IOCTL(SIOCGIWPOWER) = ipw_wx_get_power, }; #define IPW_PRIV_SET_POWER SIOCIWFIRSTPRIV #define IPW_PRIV_GET_POWER SIOCIWFIRSTPRIV+1 #define IPW_PRIV_SET_MODE SIOCIWFIRSTPRIV+2 #define IPW_PRIV_GET_MODE SIOCIWFIRSTPRIV+3 -#define IPW_PRIV_SET_PROMISC SIOCIWFIRSTPRIV+4 -#define IPW_PRIV_RESET SIOCIWFIRSTPRIV+5 +#define IPW_PRIV_SET_PREAMBLE SIOCIWFIRSTPRIV+4 +#define IPW_PRIV_GET_PREAMBLE SIOCIWFIRSTPRIV+5 +#define IPW_PRIV_SET_MONITOR SIOCIWFIRSTPRIV+6 +#define IPW_PRIV_RESET SIOCIWFIRSTPRIV+7 static struct iw_priv_args ipw_priv_args[] = { { @@ -6204,14 +6953,22 @@ static struct iw_priv_args ipw_priv_args[] = { .cmd = IPW_PRIV_GET_MODE, .get_args = IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_WX_STRING, .name = "get_mode"}, -#ifdef CONFIG_IPW_PROMISC { - IPW_PRIV_SET_PROMISC, + .cmd = IPW_PRIV_SET_PREAMBLE, + .set_args = IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, + .name = "set_preamble"}, + { + .cmd = IPW_PRIV_GET_PREAMBLE, + .get_args = IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | IFNAMSIZ, + .name = "get_preamble"}, +#ifdef CONFIG_IPW_MONITOR + { + IPW_PRIV_SET_MONITOR, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, "monitor"}, { IPW_PRIV_RESET, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 0, 0, "reset"}, -#endif /* CONFIG_IPW_PROMISC */ +#endif /* CONFIG_IPW_MONITOR */ }; static iw_handler ipw_priv_handler[] = { @@ -6219,19 +6976,21 @@ static iw_handler ipw_priv_handler[] = { ipw_wx_get_powermode, ipw_wx_set_wireless_mode, ipw_wx_get_wireless_mode, -#ifdef CONFIG_IPW_PROMISC - ipw_wx_set_promisc, + ipw_wx_set_preamble, + ipw_wx_get_preamble, +#ifdef CONFIG_IPW_MONITOR + ipw_wx_set_monitor, ipw_wx_reset, #endif }; static struct iw_handler_def ipw_wx_handler_def = { - .standard = ipw_wx_handlers, - .num_standard = ARRAY_SIZE(ipw_wx_handlers), - .num_private = ARRAY_SIZE(ipw_priv_handler), - .num_private_args = ARRAY_SIZE(ipw_priv_args), - .private = ipw_priv_handler, - .private_args = ipw_priv_args, + .standard = ipw_wx_handlers, + .num_standard = ARRAY_SIZE(ipw_wx_handlers), + .num_private = ARRAY_SIZE(ipw_priv_handler), + .num_private_args = ARRAY_SIZE(ipw_priv_args), + .private = ipw_priv_handler, + .private_args = ipw_priv_args, }; /* @@ -6246,7 +7005,7 @@ static struct iw_statistics *ipw_get_wireless_stats(struct net_device *dev) wstats = &priv->wstats; - /* if hw is disabled, then ipw2100_get_ordinal() can't be called. + /* if hw is disabled, then ipw_get_ordinal() can't be called. * ipw2100_wx_wireless_stats seems to be called before fw is * initialized. STATUS_ASSOCIATED will only be set if the hw is up * and associated; if not associcated, the values are all meaningless @@ -6384,8 +7143,8 @@ static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb) else tfd->u.data.tx_flags_ext = DCT_FLAG_EXT_MODE_OFDM; - if (priv->config & CFG_PREAMBLE) - tfd->u.data.tx_flags |= DCT_FLAG_SHORT_PREMBL; + if (priv->assoc_request.preamble_length == DCT_FLAG_SHORT_PREAMBLE) + tfd->u.data.tx_flags |= DCT_FLAG_SHORT_PREAMBLE; memcpy(&tfd->u.data.tfd.tfd_24.mchdr, hdr, hdr_len); @@ -6568,11 +7327,11 @@ static int ipw_ethtool_set_eeprom(struct net_device *dev, } static struct ethtool_ops ipw_ethtool_ops = { - .get_link = ipw_ethtool_get_link, - .get_drvinfo = ipw_ethtool_get_drvinfo, - .get_eeprom_len = ipw_ethtool_get_eeprom_len, - .get_eeprom = ipw_ethtool_get_eeprom, - .set_eeprom = ipw_ethtool_set_eeprom, + .get_link = ipw_ethtool_get_link, + .get_drvinfo = ipw_ethtool_get_drvinfo, + .get_eeprom_len = ipw_ethtool_get_eeprom_len, + .get_eeprom = ipw_ethtool_get_eeprom, + .set_eeprom = ipw_ethtool_set_eeprom, }; static irqreturn_t ipw_isr(int irq, void *data, struct pt_regs *regs) @@ -6918,6 +7677,25 @@ static void ipw_down(struct ipw_priv *priv) ipw_stop_nic(priv); } +static int ipw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) +{ +#ifdef CONFIG_IEEE80211_WPA + struct iwreq *wrq = (struct iwreq *)rq; + int ret = -1; + switch (cmd) { + case IPW_IOCTL_WPA_SUPPLICANT: + ret = ipw_wpa_supplicant(dev, &wrq->u.data); + return ret; + + default: + return -EOPNOTSUPP; + } + +#endif /* CONFIG_IEEE80211_WPA */ + + return -EOPNOTSUPP; +} + /* Called by register_netdev() */ static int ipw_net_init(struct net_device *dev) { @@ -7065,9 +7843,6 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) } /* Initialize module parameter values here */ - if (ifname) - strncpy(net_dev->name, ifname, IFNAMSIZ); - if (associate) priv->config |= CFG_ASSOCIATE; else @@ -7095,7 +7870,7 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) case 1: priv->ieee->iw_mode = IW_MODE_ADHOC; break; -#ifdef CONFIG_IPW_PROMISC +#ifdef CONFIG_IPW_MONITOR case 2: priv->ieee->iw_mode = IW_MODE_MONITOR; break; @@ -7164,6 +7939,7 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) net_dev->open = ipw_net_open; net_dev->stop = ipw_net_stop; net_dev->init = ipw_net_init; + net_dev->do_ioctl = ipw_ioctl; net_dev->get_stats = ipw_net_get_stats; net_dev->set_multicast_list = ipw_net_set_multicast_list; net_dev->set_mac_address = ipw_net_set_mac_address; @@ -7287,13 +8063,10 @@ static int ipw_pci_resume(struct pci_dev *pdev) printk(KERN_INFO "%s: Coming out of suspend...\n", dev->name); - pci_set_power_state(pdev, 0); + pci_set_power_state(pdev, PCI_D0); pci_enable_device(pdev); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) - pci_restore_state(pdev, priv->pm_state); -#else pci_restore_state(pdev); -#endif + /* * Suspend/Resume resets the PCI configuration space, so we have to * re-disable the RETRY_TIMEOUT register (0x41) to keep PCI Tx retries @@ -7371,10 +8144,7 @@ MODULE_PARM_DESC(debug, "debug output mask"); module_param(channel, int, 0444); MODULE_PARM_DESC(channel, "channel to limit associate to (default 0 [ANY])"); -module_param(ifname, charp, 0444); -MODULE_PARM_DESC(ifname, "network device name (default eth%d)"); - -#ifdef CONFIG_IPW_PROMISC +#ifdef CONFIG_IPW_MONITOR module_param(mode, int, 0444); MODULE_PARM_DESC(mode, "network mode (0=BSS,1=IBSS,2=Monitor)"); #else diff --git a/drivers/net/wireless/ipw2200.h b/drivers/net/wireless/ipw2200.h index e9cf32bf3e31..068027963181 100644 --- a/drivers/net/wireless/ipw2200.h +++ b/drivers/net/wireless/ipw2200.h @@ -168,7 +168,8 @@ enum connection_manager_assoc_states { #define DCT_FLAG_CTS_REQUIRED 0x02 /* use short preamble */ -#define DCT_FLAG_SHORT_PREMBL 0x04 +#define DCT_FLAG_LONG_PREAMBLE 0x00 +#define DCT_FLAG_SHORT_PREAMBLE 0x04 /* RTS/CTS first */ #define DCT_FLAG_RTS_REQD 0x08 @@ -899,7 +900,7 @@ struct ipw_cmd { #define CFG_STATIC_ESSID (1<<1) /* Restrict assoc. to single SSID */ #define CFG_STATIC_BSSID (1<<2) /* Restrict assoc. to single BSSID */ #define CFG_CUSTOM_MAC (1<<3) -#define CFG_PREAMBLE (1<<4) +#define CFG_PREAMBLE_LONG (1<<4) #define CFG_ADHOC_PERSIST (1<<5) #define CFG_ASSOCIATE (1<<6) #define CFG_FIXED_RATE (1<<7) @@ -1206,12 +1207,18 @@ do { if (ipw_debug_level & (level)) \ /* * RESET Register Bit Indexes */ -#define CBD_RESET_REG_PRINCETON_RESET 0x00000001 /* Bit 0 (LSB) */ -#define CX2_RESET_REG_SW_RESET 0x00000080 /* Bit 7 */ -#define CX2_RESET_REG_MASTER_DISABLED 0x00000100 /* Bit 8 */ -#define CX2_RESET_REG_STOP_MASTER 0x00000200 /* Bit 9 */ -#define CX2_ARC_KESHET_CONFIG 0x08000000 /* Bit 27 */ -#define CX2_START_STANDBY 0x00000004 /* Bit 2 */ +#define CBD_RESET_REG_PRINCETON_RESET (1<<0) +#define CX2_START_STANDBY (1<<2) +#define CX2_ACTIVITY_LED (1<<4) +#define CX2_ASSOCIATED_LED (1<<5) +#define CX2_OFDM_LED (1<<6) +#define CX2_RESET_REG_SW_RESET (1<<7) +#define CX2_RESET_REG_MASTER_DISABLED (1<<8) +#define CX2_RESET_REG_STOP_MASTER (1<<9) +#define CX2_GATE_ODMA (1<<25) +#define CX2_GATE_IDMA (1<<26) +#define CX2_ARC_KESHET_CONFIG (1<<27) +#define CX2_GATE_ADMA (1<<29) #define CX2_CSR_CIS_UPPER_BOUND 0x00000200 #define CX2_DOMAIN_0_END 0x1000 -- cgit v1.2.2 From a613bffd3aac89bb0a8c9b7afa72af9b0ae30f0a Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Wed, 24 Aug 2005 21:43:11 -0500 Subject: Catch ipw2200 up to equivelancy with v1.0.2 Removed unneeded parenthesis around numeric constant defines Added support for iwspy Put in fix for Ad-Hoc mode not passing through all packets (thanks to KKH) Put in fix for fragmentation not working for fragment sizes between 441-464 bytes (thanks to Mohamed Abbas) Fixed #592 problem of CONFIG_IEEE80211_WPA_MODULE not including WPA support into the driver -- fixed as a result of no longer limiting WPAs inclusion Fixed #594 problem with user rates mask causing lack of association if AP mandatory rate is masked out. We now add back in as a supported rate any mandatory rate. Fixed #597 kernel oops due to calling dev_kfree_skb on an skb multiple times. Added code to control LEDs that can be controlled through the wireless NIC (vs. non-wireless HW interfaces) -- this is currently disabled by default due to reports by some users of it hanging their laptop. Added some more debug messages around fragmentation logic Added locking around STATUS_HCMD_ACTIVE to prevent re-entry race conditions Moved ipw_adapter_restart to only execute on the priv->workqueue to keep keyboard errors from occuring during adapter restart Added CFG_BACKGROUND_SCAN to easily allow people to play with background scanning implementations Modified WPA logic to send WPA IE if one is set (vs. being based on wpa_enabled) Modified scan result logic to report WPA and RSN IEs if set (vs. being based on wpa_enabled) Fixed issues with endianess compatability between the host and wireless adapter (thanks to York Liu and Yi Zhu) Fixed problem with Ad-Hoc network creation causing a firmware error if a scan was actively running (thanks to Mohamed Abbas) Signed-off-by: James Ketrenos --- drivers/net/wireless/ipw2200.c | 962 +++++++++++++++++++++++++++++++---------- drivers/net/wireless/ipw2200.h | 73 ++-- 2 files changed, 773 insertions(+), 262 deletions(-) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index ddbee3edcd8c..ea7a3dcf1daa 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -32,7 +32,7 @@ #include "ipw2200.h" -#define IPW2200_VERSION "1.0.1" +#define IPW2200_VERSION "1.0.2" #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2200/2915 Network Driver" #define DRV_COPYRIGHT "Copyright(c) 2003-2004 Intel Corporation" #define DRV_VERSION IPW2200_VERSION @@ -49,6 +49,7 @@ static int mode = 0; static u32 ipw_debug_level; static int associate = 1; static int auto_create = 1; +static int led = 0; static int disable = 0; static const char ipw_modes[] = { 'a', 'b', 'g', '?' @@ -637,6 +638,313 @@ static void ipw_init_ordinals(struct ipw_priv *priv) } +u32 ipw_register_toggle(u32 reg) +{ + reg &= ~CX2_START_STANDBY; + if (reg & CX2_GATE_ODMA) + reg &= ~CX2_GATE_ODMA; + if (reg & CX2_GATE_IDMA) + reg &= ~CX2_GATE_IDMA; + if (reg & CX2_GATE_ADMA) + reg &= ~CX2_GATE_ADMA; + return reg; +} + +/* + * LED behavior: + * - On radio ON, turn on any LEDs that require to be on during start + * - On initialization, start unassociated blink + * - On association, disable unassociated blink + * - On disassociation, start unassociated blink + * - On radio OFF, turn off any LEDs started during radio on + * + */ +#define LD_TIME_LINK_ON 300 +#define LD_TIME_LINK_OFF 2700 +#define LD_TIME_ACT_ON 250 + +void ipw_led_link_on(struct ipw_priv *priv) +{ + unsigned long flags; + u32 led; + + /* If configured to not use LEDs, or nic_type is 1, + * then we don't toggle a LINK led */ + if (priv->config & CFG_NO_LED || priv->nic_type == EEPROM_NIC_TYPE_1) + return; + + spin_lock_irqsave(&priv->lock, flags); + + if (!(priv->status & STATUS_RF_KILL_MASK) && + !(priv->status & STATUS_LED_LINK_ON)) { + IPW_DEBUG_LED("Link LED On\n"); + led = ipw_read_reg32(priv, CX2_EVENT_REG); + led |= priv->led_association_on; + + led = ipw_register_toggle(led); + + IPW_DEBUG_LED("Reg: 0x%08X\n", led); + ipw_write_reg32(priv, CX2_EVENT_REG, led); + + priv->status |= STATUS_LED_LINK_ON; + + /* If we aren't associated, schedule turning the LED off */ + if (!(priv->status & STATUS_ASSOCIATED)) + queue_delayed_work(priv->workqueue, + &priv->led_link_off, + LD_TIME_LINK_ON); + } + + spin_unlock_irqrestore(&priv->lock, flags); +} + +void ipw_led_link_off(struct ipw_priv *priv) +{ + unsigned long flags; + u32 led; + + /* If configured not to use LEDs, or nic type is 1, + * then we don't goggle the LINK led. */ + if (priv->config & CFG_NO_LED || priv->nic_type == EEPROM_NIC_TYPE_1) + return; + + spin_lock_irqsave(&priv->lock, flags); + + if (priv->status & STATUS_LED_LINK_ON) { + led = ipw_read_reg32(priv, CX2_EVENT_REG); + led &= priv->led_association_off; + led = ipw_register_toggle(led); + + IPW_DEBUG_LED("Reg: 0x%08X\n", led); + ipw_write_reg32(priv, CX2_EVENT_REG, led); + + IPW_DEBUG_LED("Link LED Off\n"); + + priv->status &= ~STATUS_LED_LINK_ON; + + /* If we aren't associated and the radio is on, schedule + * turning the LED on (blink while unassociated) */ + if (!(priv->status & STATUS_RF_KILL_MASK) && + !(priv->status & STATUS_ASSOCIATED)) + queue_delayed_work(priv->workqueue, &priv->led_link_on, + LD_TIME_LINK_OFF); + + } + + spin_unlock_irqrestore(&priv->lock, flags); +} + +void ipw_led_activity_on(struct ipw_priv *priv) +{ + unsigned long flags; + u32 led; + + if (priv->config & CFG_NO_LED) + return; + + spin_lock_irqsave(&priv->lock, flags); + + if (priv->status & STATUS_RF_KILL_MASK) { + spin_unlock_irqrestore(&priv->lock, flags); + return; + } + + if (!(priv->status & STATUS_LED_ACT_ON)) { + led = ipw_read_reg32(priv, CX2_EVENT_REG); + led |= priv->led_activity_on; + + led = ipw_register_toggle(led); + + IPW_DEBUG_LED("Reg: 0x%08X\n", led); + ipw_write_reg32(priv, CX2_EVENT_REG, led); + + IPW_DEBUG_LED("Activity LED On\n"); + + priv->status |= STATUS_LED_ACT_ON; + + queue_delayed_work(priv->workqueue, &priv->led_act_off, + LD_TIME_ACT_ON); + } else { + /* Reschedule LED off for full time period */ + cancel_delayed_work(&priv->led_act_off); + queue_delayed_work(priv->workqueue, &priv->led_act_off, + LD_TIME_ACT_ON); + } + + spin_unlock_irqrestore(&priv->lock, flags); +} + +void ipw_led_activity_off(struct ipw_priv *priv) +{ + unsigned long flags; + u32 led; + + if (priv->config & CFG_NO_LED) + return; + + spin_lock_irqsave(&priv->lock, flags); + + if (priv->status & STATUS_LED_ACT_ON) { + led = ipw_read_reg32(priv, CX2_EVENT_REG); + led &= priv->led_activity_off; + + led = ipw_register_toggle(led); + + IPW_DEBUG_LED("Reg: 0x%08X\n", led); + ipw_write_reg32(priv, CX2_EVENT_REG, led); + + IPW_DEBUG_LED("Activity LED Off\n"); + + priv->status &= ~STATUS_LED_ACT_ON; + } + + spin_unlock_irqrestore(&priv->lock, flags); +} + +void ipw_led_band_on(struct ipw_priv *priv) +{ + unsigned long flags; + u32 led; + + /* Only nic type 1 supports mode LEDs */ + if (priv->config & CFG_NO_LED || priv->nic_type != EEPROM_NIC_TYPE_1) + return; + + spin_lock_irqsave(&priv->lock, flags); + + led = ipw_read_reg32(priv, CX2_EVENT_REG); + if (priv->assoc_network->mode == IEEE_A) { + led |= priv->led_ofdm_on; + led &= priv->led_association_off; + IPW_DEBUG_LED("Mode LED On: 802.11a\n"); + } else if (priv->assoc_network->mode == IEEE_G) { + led |= priv->led_ofdm_on; + led |= priv->led_association_on; + IPW_DEBUG_LED("Mode LED On: 802.11g\n"); + } else { + led &= priv->led_ofdm_off; + led |= priv->led_association_on; + IPW_DEBUG_LED("Mode LED On: 802.11b\n"); + } + + led = ipw_register_toggle(led); + + IPW_DEBUG_LED("Reg: 0x%08X\n", led); + ipw_write_reg32(priv, CX2_EVENT_REG, led); + + spin_unlock_irqrestore(&priv->lock, flags); +} + +void ipw_led_band_off(struct ipw_priv *priv) +{ + unsigned long flags; + u32 led; + + /* Only nic type 1 supports mode LEDs */ + if (priv->config & CFG_NO_LED || priv->nic_type != EEPROM_NIC_TYPE_1) + return; + + spin_lock_irqsave(&priv->lock, flags); + + led = ipw_read_reg32(priv, CX2_EVENT_REG); + led &= priv->led_ofdm_off; + led &= priv->led_association_off; + + led = ipw_register_toggle(led); + + IPW_DEBUG_LED("Reg: 0x%08X\n", led); + ipw_write_reg32(priv, CX2_EVENT_REG, led); + + spin_unlock_irqrestore(&priv->lock, flags); +} + +void ipw_led_radio_on(struct ipw_priv *priv) +{ + ipw_led_link_on(priv); +} + +void ipw_led_radio_off(struct ipw_priv *priv) +{ + ipw_led_activity_off(priv); + ipw_led_link_off(priv); +} + +void ipw_led_link_up(struct ipw_priv *priv) +{ + /* Set the Link Led on for all nic types */ + ipw_led_link_on(priv); +} + +void ipw_led_link_down(struct ipw_priv *priv) +{ + ipw_led_activity_off(priv); + ipw_led_link_off(priv); + + if (priv->status & STATUS_RF_KILL_MASK) + ipw_led_radio_off(priv); +} + +void ipw_led_init(struct ipw_priv *priv) +{ + priv->nic_type = priv->eeprom[EEPROM_NIC_TYPE]; + + /* Set the default PINs for the link and activity leds */ + priv->led_activity_on = CX2_ACTIVITY_LED; + priv->led_activity_off = ~(CX2_ACTIVITY_LED); + + priv->led_association_on = CX2_ASSOCIATED_LED; + priv->led_association_off = ~(CX2_ASSOCIATED_LED); + + /* Set the default PINs for the OFDM leds */ + priv->led_ofdm_on = CX2_OFDM_LED; + priv->led_ofdm_off = ~(CX2_OFDM_LED); + + switch (priv->nic_type) { + case EEPROM_NIC_TYPE_1: + /* In this NIC type, the LEDs are reversed.... */ + priv->led_activity_on = CX2_ASSOCIATED_LED; + priv->led_activity_off = ~(CX2_ASSOCIATED_LED); + priv->led_association_on = CX2_ACTIVITY_LED; + priv->led_association_off = ~(CX2_ACTIVITY_LED); + + if (!(priv->config & CFG_NO_LED)) + ipw_led_band_on(priv); + + /* And we don't blink link LEDs for this nic, so + * just return here */ + return; + + case EEPROM_NIC_TYPE_3: + case EEPROM_NIC_TYPE_2: + case EEPROM_NIC_TYPE_4: + case EEPROM_NIC_TYPE_0: + break; + + default: + IPW_DEBUG_INFO("Unknown NIC type from EEPROM: %d\n", + priv->nic_type); + priv->nic_type = EEPROM_NIC_TYPE_0; + break; + } + + if (!(priv->config & CFG_NO_LED)) { + if (priv->status & STATUS_ASSOCIATED) + ipw_led_link_on(priv); + else + ipw_led_link_off(priv); + } +} + +void ipw_led_shutdown(struct ipw_priv *priv) +{ + cancel_delayed_work(&priv->led_link_on); + cancel_delayed_work(&priv->led_link_off); + cancel_delayed_work(&priv->led_act_off); + ipw_led_activity_off(priv); + ipw_led_link_off(priv); + ipw_led_band_off(priv); +} + /* * The following adds a new attribute to the sysfs representation * of this device driver (i.e. a new file in /sys/bus/pci/drivers/ipw/) @@ -648,8 +956,9 @@ static ssize_t show_debug_level(struct device_driver *d, char *buf) { return sprintf(buf, "0x%08X\n", ipw_debug_level); } -static ssize_t store_debug_level(struct device_driver *d, - const char *buf, size_t count) + +static ssize_t store_debug_level(struct device_driver *d, const char *buf, + size_t count) { char *p = (char *)buf; u32 val; @@ -673,6 +982,82 @@ static ssize_t store_debug_level(struct device_driver *d, static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO, show_debug_level, store_debug_level); +static ssize_t show_scan_age(struct device *d, struct device_attribute *attr, + char *buf) +{ + struct ipw_priv *priv = dev_get_drvdata(d); + return sprintf(buf, "%d\n", priv->ieee->scan_age); +} + +static ssize_t store_scan_age(struct device *d, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct ipw_priv *priv = dev_get_drvdata(d); + struct net_device *dev = priv->net_dev; + char buffer[] = "00000000"; + unsigned long len = + (sizeof(buffer) - 1) > count ? count : sizeof(buffer) - 1; + unsigned long val; + char *p = buffer; + + IPW_DEBUG_INFO("enter\n"); + + strncpy(buffer, buf, len); + buffer[len] = 0; + + if (p[1] == 'x' || p[1] == 'X' || p[0] == 'x' || p[0] == 'X') { + p++; + if (p[0] == 'x' || p[0] == 'X') + p++; + val = simple_strtoul(p, &p, 16); + } else + val = simple_strtoul(p, &p, 10); + if (p == buffer) { + IPW_DEBUG_INFO("%s: user supplied invalid value.\n", dev->name); + } else { + priv->ieee->scan_age = val; + IPW_DEBUG_INFO("set scan_age = %u\n", priv->ieee->scan_age); + } + + IPW_DEBUG_INFO("exit\n"); + return len; +} + +static DEVICE_ATTR(scan_age, S_IWUSR | S_IRUGO, show_scan_age, store_scan_age); + +static ssize_t show_led(struct device *d, struct device_attribute *attr, + char *buf) +{ + struct ipw_priv *priv = dev_get_drvdata(d); + return sprintf(buf, "%d\n", (priv->config & CFG_NO_LED) ? 0 : 1); +} + +static ssize_t store_led(struct device *d, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct ipw_priv *priv = dev_get_drvdata(d); + + IPW_DEBUG_INFO("enter\n"); + + if (count == 0) + return 0; + + if (*buf == 0) { + IPW_DEBUG_LED("Disabling LED control.\n"); + priv->config |= CFG_NO_LED; + ipw_led_shutdown(priv); + } else { + IPW_DEBUG_LED("Enabling LED control.\n"); + priv->config &= ~CFG_NO_LED; + ipw_led_init(priv); + } + + IPW_DEBUG_INFO("exit\n"); + return count; +} + +static DEVICE_ATTR(led, S_IWUSR | S_IRUGO, show_led, store_led); + static ssize_t show_status(struct device *d, struct device_attribute *attr, char *buf) { @@ -694,23 +1079,8 @@ static DEVICE_ATTR(cfg, S_IRUGO, show_cfg, NULL); static ssize_t show_nic_type(struct device *d, struct device_attribute *attr, char *buf) { - struct ipw_priv *p = d->driver_data; - u8 type = p->eeprom[EEPROM_NIC_TYPE]; - - switch (type) { - case EEPROM_NIC_TYPE_STANDARD: - return sprintf(buf, "STANDARD\n"); - case EEPROM_NIC_TYPE_DELL: - return sprintf(buf, "DELL\n"); - case EEPROM_NIC_TYPE_FUJITSU: - return sprintf(buf, "FUJITSU\n"); - case EEPROM_NIC_TYPE_IBM: - return sprintf(buf, "IBM\n"); - case EEPROM_NIC_TYPE_HP: - return sprintf(buf, "HP\n"); - } - - return sprintf(buf, "UNKNOWN\n"); + struct ipw_priv *priv = d->driver_data; + return sprintf(buf, "TYPE: %d\n", priv->nic_type); } static DEVICE_ATTR(nic_type, S_IRUGO, show_nic_type, NULL); @@ -955,9 +1325,8 @@ static int ipw_radio_kill_sw(struct ipw_priv *priv, int disable_radio) if (disable_radio) { priv->status |= STATUS_RF_KILL_SW; - if (priv->workqueue) { + if (priv->workqueue) cancel_delayed_work(&priv->request_scan); - } wake_up_interruptible(&priv->wait_command_queue); queue_work(priv->workqueue, &priv->down); } else { @@ -1081,11 +1450,9 @@ static void ipw_irq_tasklet(struct ipw_priv *priv) IPW_DEBUG_RF_KILL("RF_KILL_DONE\n"); priv->status |= STATUS_RF_KILL_HW; wake_up_interruptible(&priv->wait_command_queue); - netif_carrier_off(priv->net_dev); - netif_stop_queue(priv->net_dev); priv->status &= ~(STATUS_ASSOCIATED | STATUS_ASSOCIATING); - notify_wx_assoc_event(priv); cancel_delayed_work(&priv->request_scan); + schedule_work(&priv->link_down); queue_delayed_work(priv->workqueue, &priv->rf_kill, 2 * HZ); handled |= CX2_INTA_BIT_RF_KILL_DONE; } @@ -1182,9 +1549,12 @@ static char *get_cmd_string(u8 cmd) static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) { int rc = 0; + unsigned long flags; + spin_lock_irqsave(&priv->lock, flags); if (priv->status & STATUS_HCMD_ACTIVE) { IPW_ERROR("Already sending a command\n"); + spin_unlock_irqrestore(&priv->lock, flags); return -1; } @@ -1195,19 +1565,30 @@ static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) printk_buf(IPW_DL_HOST_COMMAND, (u8 *) cmd->param, cmd->len); rc = ipw_queue_tx_hcmd(priv, cmd->cmd, &cmd->param, cmd->len, 0); - if (rc) + if (rc) { + priv->status &= ~STATUS_HCMD_ACTIVE; + spin_unlock_irqrestore(&priv->lock, flags); return rc; + } + spin_unlock_irqrestore(&priv->lock, flags); rc = wait_event_interruptible_timeout(priv->wait_command_queue, !(priv-> status & STATUS_HCMD_ACTIVE), HOST_COMPLETE_TIMEOUT); if (rc == 0) { - IPW_DEBUG_INFO("Command completion failed out after %dms.\n", - jiffies_to_msecs(HOST_COMPLETE_TIMEOUT)); - priv->status &= ~STATUS_HCMD_ACTIVE; - return -EIO; + spin_lock_irqsave(&priv->lock, flags); + if (priv->status & STATUS_HCMD_ACTIVE) { + IPW_DEBUG_INFO("Command completion failed out after " + "%dms.\n", + 1000 * (HOST_COMPLETE_TIMEOUT / HZ)); + priv->status &= ~STATUS_HCMD_ACTIVE; + spin_unlock_irqrestore(&priv->lock, flags); + return -EIO; + } + spin_unlock_irqrestore(&priv->lock, flags); } + if (priv->status & STATUS_RF_KILL_MASK) { IPW_DEBUG_INFO("Command aborted due to RF Kill Switch\n"); return -EIO; @@ -1304,6 +1685,11 @@ static int ipw_send_adapter_address(struct ipw_priv *priv, u8 * mac) return 0; } +/* + * NOTE: This must be executed from our workqueue as it results in udelay + * being called which may corrupt the keyboard if executed on default + * workqueue + */ static void ipw_adapter_restart(void *adapter) { struct ipw_priv *priv = adapter; @@ -1327,7 +1713,7 @@ static void ipw_scan_check(void *data) IPW_DEBUG_SCAN("Scan completion watchdog resetting " "adapter (%dms).\n", IPW_SCAN_CHECK_WATCHDOG / 100); - ipw_adapter_restart(priv); + queue_work(priv->workqueue, &priv->adapter_restart); } } @@ -1400,12 +1786,25 @@ static int ipw_send_associate(struct ipw_priv *priv, .len = sizeof(*associate) }; + struct ipw_associate tmp_associate; + memcpy(&tmp_associate, associate, sizeof(*associate)); + tmp_associate.policy_support = + cpu_to_le16(tmp_associate.policy_support); + tmp_associate.assoc_tsf_msw = cpu_to_le32(tmp_associate.assoc_tsf_msw); + tmp_associate.assoc_tsf_lsw = cpu_to_le32(tmp_associate.assoc_tsf_lsw); + tmp_associate.capability = cpu_to_le16(tmp_associate.capability); + tmp_associate.listen_interval = + cpu_to_le16(tmp_associate.listen_interval); + tmp_associate.beacon_interval = + cpu_to_le16(tmp_associate.beacon_interval); + tmp_associate.atim_window = cpu_to_le16(tmp_associate.atim_window); + if (!priv || !associate) { IPW_ERROR("Invalid args\n"); return -1; } - memcpy(&cmd.param, associate, sizeof(*associate)); + memcpy(&cmd.param, &tmp_associate, sizeof(*associate)); if (ipw_send_cmd(priv, &cmd)) { IPW_ERROR("failed to send ASSOCIATE command\n"); return -1; @@ -1706,7 +2105,7 @@ static void ipw_eeprom_init_sram(struct ipw_priv *priv) /* read entire contents of eeprom into private buffer */ for (i = 0; i < 128; i++) - eeprom[i] = eeprom_read_u16(priv, (u8) i); + eeprom[i] = le16_to_cpu(eeprom_read_u16(priv, (u8) i)); /* If the data looks correct, then copy it to our private @@ -2001,6 +2400,9 @@ static void ipw_remove_current_network(struct ipw_priv *priv) { struct list_head *element, *safe; struct ieee80211_network *network = NULL; + unsigned long flags; + + spin_lock_irqsave(&priv->ieee->lock, flags); list_for_each_safe(element, safe, &priv->ieee->network_list) { network = list_entry(element, struct ieee80211_network, list); if (!memcmp(network->bssid, priv->bssid, ETH_ALEN)) { @@ -2009,6 +2411,7 @@ static void ipw_remove_current_network(struct ipw_priv *priv) &priv->ieee->network_free_list); } } + spin_unlock_irqrestore(&priv->ieee->lock, flags); } /** @@ -2158,7 +2561,8 @@ static int ipw_load_ucode(struct ipw_priv *priv, u8 * data, size_t len) */ /* load new ipw uCode */ for (i = 0; i < len / 2; i++) - ipw_write_reg16(priv, CX2_BASEBAND_CONTROL_STORE, image[i]); + ipw_write_reg16(priv, CX2_BASEBAND_CONTROL_STORE, + cpu_to_le16(image[i])); /* enable DINO */ ipw_write_reg8(priv, CX2_BASEBAND_CONTROL_STATUS, 0); @@ -2181,7 +2585,8 @@ static int ipw_load_ucode(struct ipw_priv *priv, u8 * data, size_t len) for (i = 0; i < ARRAY_SIZE(response_buffer); i++) response_buffer[i] = - ipw_read_reg32(priv, CX2_BASEBAND_RX_FIFO_READ); + le32_to_cpu(ipw_read_reg32(priv, + CX2_BASEBAND_RX_FIFO_READ)); memcpy(&priv->dino_alive, response_buffer, sizeof(priv->dino_alive)); if (priv->dino_alive.alive_command == 1 @@ -2250,13 +2655,14 @@ static int ipw_load_firmware(struct ipw_priv *priv, u8 * data, size_t len) * offeset*/ /* Dma loading */ rc = ipw_fw_dma_add_buffer(priv, shared_phys + offset, - chunk->address, chunk->length); + le32_to_cpu(chunk->address), + le32_to_cpu(chunk->length)); if (rc) { IPW_DEBUG_INFO("dmaAddBuffer Failed\n"); goto out; } - offset += chunk->length; + offset += le32_to_cpu(chunk->length); } while (offset < len); /* Run the DMA and wait for the answer */ @@ -2351,14 +2757,17 @@ static int ipw_init_nic(struct ipw_priv *priv) static int ipw_reset_nic(struct ipw_priv *priv) { int rc = 0; + unsigned long flags; IPW_DEBUG_TRACE(">>\n"); rc = ipw_init_nic(priv); + spin_lock_irqsave(&priv->lock, flags); /* Clear the 'host command active' bit... */ priv->status &= ~STATUS_HCMD_ACTIVE; wake_up_interruptible(&priv->wait_command_queue); + spin_unlock_irqrestore(&priv->lock, flags); IPW_DEBUG_TRACE("<<\n"); return rc; @@ -2378,17 +2787,18 @@ static int ipw_get_fw(struct ipw_priv *priv, } header = (struct fw_header *)(*fw)->data; - if (IPW_FW_MAJOR(header->version) != IPW_FW_MAJOR_VERSION) { + if (IPW_FW_MAJOR(le32_to_cpu(header->version)) != IPW_FW_MAJOR_VERSION) { IPW_ERROR("'%s' firmware version not compatible (%d != %d)\n", name, - IPW_FW_MAJOR(header->version), IPW_FW_MAJOR_VERSION); + IPW_FW_MAJOR(le32_to_cpu(header->version)), + IPW_FW_MAJOR_VERSION); return -EINVAL; } IPW_DEBUG_INFO("Loading firmware '%s' file v%d.%d (%zd bytes)\n", name, - IPW_FW_MAJOR(header->version), - IPW_FW_MINOR(header->version), + IPW_FW_MAJOR(le32_to_cpu(header->version)), + IPW_FW_MINOR(le32_to_cpu(header->version)), (*fw)->size - sizeof(struct fw_header)); return 0; } @@ -2414,6 +2824,7 @@ static inline void ipw_rx_queue_reset(struct ipw_priv *priv, pci_unmap_single(priv->pci_dev, rxq->pool[i].dma_addr, CX2_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); dev_kfree_skb(rxq->pool[i].skb); + rxq->pool[i].skb = NULL; } list_add_tail(&rxq->pool[i].list, &rxq->rx_used); } @@ -2769,16 +3180,18 @@ static void ipw_queue_tx_free_tfd(struct ipw_priv *priv, return; /* sanity check */ - if (bd->u.data.num_chunks > NUM_TFD_CHUNKS) { - IPW_ERROR("Too many chunks: %i\n", bd->u.data.num_chunks); + if (le32_to_cpu(bd->u.data.num_chunks) > NUM_TFD_CHUNKS) { + IPW_ERROR("Too many chunks: %i\n", + le32_to_cpu(bd->u.data.num_chunks)); /** @todo issue fatal error, it is quite serious situation */ return; } /* unmap chunks if any */ - for (i = 0; i < bd->u.data.num_chunks; i++) { - pci_unmap_single(dev, bd->u.data.chunk_ptr[i], - bd->u.data.chunk_len[i], PCI_DMA_TODEVICE); + for (i = 0; i < le32_to_cpu(bd->u.data.num_chunks); i++) { + pci_unmap_single(dev, le32_to_cpu(bd->u.data.chunk_ptr[i]), + le16_to_cpu(bd->u.data.chunk_len[i]), + PCI_DMA_TODEVICE); if (txq->txb[txq->q.last_used]) { ieee80211_txb_free(txq->txb[txq->q.last_used]); txq->txb[txq->q.last_used] = NULL; @@ -2841,9 +3254,8 @@ static void inline __maybe_wake_tx(struct ipw_priv *priv) switch (priv->port_type) { case DCR_TYPE_MU_BSS: case DCR_TYPE_MU_IBSS: - if (!(priv->status & STATUS_ASSOCIATED)) { + if (!(priv->status & STATUS_ASSOCIATED)) return; - } } netif_wake_queue(priv->net_dev); } @@ -3307,8 +3719,13 @@ static inline void ipw_handle_missed_beacon(struct ipw_priv *priv, IPW_DL_STATE, "Missed beacon: %d - disassociate\n", missed_count); priv->status &= ~STATUS_ROAMING; - if (priv->status & STATUS_SCANNING) + if (priv->status & STATUS_SCANNING) { + IPW_DEBUG(IPW_DL_INFO | IPW_DL_NOTIF | + IPW_DL_STATE, + "Aborting scan with missed beacon.\n"); queue_work(priv->workqueue, &priv->abort_scan); + } + queue_work(priv->workqueue, &priv->disassociate); return; } @@ -3342,6 +3759,8 @@ static inline void ipw_handle_missed_beacon(struct ipw_priv *priv, * stuck (only if we aren't roaming -- * otherwise we'll never scan more than 2 or 3 * channels..) */ + IPW_DEBUG(IPW_DL_INFO | IPW_DL_NOTIF | + IPW_DL_STATE, "Aborting scan with missed beacon.\n"); queue_work(priv->workqueue, &priv->abort_scan); } @@ -3356,6 +3775,8 @@ static inline void ipw_handle_missed_beacon(struct ipw_priv *priv, static inline void ipw_rx_notification(struct ipw_priv *priv, struct ipw_rx_notification *notif) { + notif->size = le16_to_cpu(notif->size); + IPW_DEBUG_NOTIF("type = %i (%d bytes)\n", notif->subtype, notif->size); switch (notif->subtype) { @@ -3400,29 +3821,8 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, priv->status &= ~STATUS_ASSOCIATING; priv->status |= STATUS_ASSOCIATED; - netif_carrier_on(priv->net_dev); - if (netif_queue_stopped(priv->net_dev)) { - IPW_DEBUG_NOTIF - ("waking queue\n"); - netif_wake_queue(priv->net_dev); - } else { - IPW_DEBUG_NOTIF - ("starting queue\n"); - netif_start_queue(priv-> - net_dev); - } + schedule_work(&priv->link_up); - ipw_reset_stats(priv); - /* Ensure the rate is updated immediately */ - priv->last_rate = - ipw_get_current_rate(priv); - schedule_work(&priv->gather_stats); - notify_wx_assoc_event(priv); - -/* queue_delayed_work(priv->workqueue, - &priv->request_scan, - SCAN_ASSOCIATED_INTERVAL); -*/ break; } @@ -3455,12 +3855,7 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, STATUS_AUTH | STATUS_ASSOCIATED); - netif_carrier_off(priv-> - net_dev); - netif_stop_queue(priv->net_dev); - queue_work(priv->workqueue, - &priv->request_scan); - notify_wx_assoc_event(priv); + schedule_work(&priv->link_down); break; } @@ -3506,31 +3901,8 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, STATUS_ASSOCIATING | STATUS_ASSOCIATED | STATUS_AUTH); - netif_stop_queue(priv->net_dev); - if (!(priv->status & STATUS_ROAMING)) { - netif_carrier_off(priv-> - net_dev); - notify_wx_assoc_event(priv); - - /* Cancel any queued work ... */ - cancel_delayed_work(&priv-> - request_scan); - cancel_delayed_work(&priv-> - adhoc_check); - - /* Queue up another scan... */ - queue_work(priv->workqueue, - &priv->request_scan); - - cancel_delayed_work(&priv-> - gather_stats); - } else { - priv->status |= STATUS_ROAMING; - queue_work(priv->workqueue, - &priv->request_scan); - } + schedule_work(&priv->link_down); - ipw_reset_stats(priv); break; } @@ -3576,11 +3948,7 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, STATUS_AUTH | STATUS_ASSOCIATED); - netif_carrier_off(priv->net_dev); - netif_stop_queue(priv->net_dev); - queue_work(priv->workqueue, - &priv->request_scan); - notify_wx_assoc_event(priv); + schedule_work(&priv->link_down); break; case CMAS_TX_AUTH_SEQ_1: @@ -3682,6 +4050,10 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, } else if (priv->status & STATUS_SCAN_PENDING) queue_work(priv->workqueue, &priv->request_scan); + else if (priv->config & CFG_BACKGROUND_SCAN + && priv->status & STATUS_ASSOCIATED) + queue_delayed_work(priv->workqueue, + &priv->request_scan, HZ); priv->ieee->scans++; break; @@ -3690,13 +4062,13 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, case HOST_NOTIFICATION_STATUS_FRAG_LENGTH:{ struct notif_frag_length *x = ¬if->u.frag_len; - if (notif->size == sizeof(*x)) { - IPW_ERROR("Frag length: %d\n", x->frag_length); - } else { + if (notif->size == sizeof(*x)) + IPW_ERROR("Frag length: %d\n", + le16_to_cpu(x->frag_length)); + else IPW_ERROR("Frag length of wrong size %d " "(should be %zd)\n", notif->size, sizeof(*x)); - } break; } @@ -3722,11 +4094,9 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, case HOST_NOTIFICATION_DINO_CONFIG_RESPONSE:{ IPW_ERROR("Dino config\n"); if (priv->hcmd - && priv->hcmd->cmd == HOST_CMD_DINO_CONFIG) { - /* TODO: Do anything special? */ - } else { + && priv->hcmd->cmd != HOST_CMD_DINO_CONFIG) IPW_ERROR("Unexpected DINO_CONFIG_RESPONSE\n"); - } + break; } @@ -3739,8 +4109,11 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, break; } - if (x->state == HOST_NOTIFICATION_STATUS_BEACON_MISSING) - ipw_handle_missed_beacon(priv, x->number); + if (le32_to_cpu(x->state) == + HOST_NOTIFICATION_STATUS_BEACON_MISSING) + ipw_handle_missed_beacon(priv, + le32_to_cpu(x-> + number)); break; } @@ -3779,7 +4152,8 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, case HOST_NOTIFICATION_NOISE_STATS:{ if (notif->size == sizeof(u32)) { priv->last_noise = - (u8) (notif->u.noise.value & 0xff); + (u8) (le32_to_cpu(notif->u.noise.value) & + 0xff); average_add(&priv->average_noise, priv->last_noise); break; @@ -3896,9 +4270,8 @@ static int ipw_queue_tx_reclaim(struct ipw_priv *priv, priv->tx_packets++; } done: - if (ipw_queue_space(q) > q->low_mark && qindex >= 0) { + if (ipw_queue_space(q) > q->low_mark && qindex >= 0) __maybe_wake_tx(priv); - } used = q->first_empty - q->last_used; if (used < 0) used += q->n_bd; @@ -4217,13 +4590,16 @@ static int ipw_compatible_rates(struct ipw_priv *priv, num_rates = min(network->rates_len, (u8) IPW_MAX_RATES); rates->num_rates = 0; for (i = 0; i < num_rates; i++) { - if (!ipw_is_rate_in_mask - (priv, network->mode, network->rates[i])) { + if (!ipw_is_rate_in_mask(priv, network->mode, + network->rates[i])) { + if (network->rates[i] & IEEE80211_BASIC_RATE_MASK) { - IPW_DEBUG_SCAN - ("Basic rate %02X masked: 0x%08X\n", - network->rates[i], priv->rates_mask); - return 0; + IPW_DEBUG_SCAN("Adding masked mandatory " + "rate %02X\n", + network->rates[i]); + rates->supported_rates[rates->num_rates++] = + network->rates[i]; + continue; } IPW_DEBUG_SCAN("Rate %02X masked : 0x%08X\n", @@ -4234,16 +4610,18 @@ static int ipw_compatible_rates(struct ipw_priv *priv, rates->supported_rates[rates->num_rates++] = network->rates[i]; } - num_rates = - min(network->rates_ex_len, (u8) (IPW_MAX_RATES - num_rates)); + num_rates = min(network->rates_ex_len, + (u8) (IPW_MAX_RATES - num_rates)); for (i = 0; i < num_rates; i++) { - if (!ipw_is_rate_in_mask - (priv, network->mode, network->rates_ex[i])) { + if (!ipw_is_rate_in_mask(priv, network->mode, + network->rates_ex[i])) { if (network->rates_ex[i] & IEEE80211_BASIC_RATE_MASK) { - IPW_DEBUG_SCAN - ("Basic rate %02X masked: 0x%08X\n", - network->rates_ex[i], priv->rates_mask); - return 0; + IPW_DEBUG_SCAN("Adding masked mandatory " + "rate %02X\n", + network->rates_ex[i]); + rates->supported_rates[rates->num_rates++] = + network->rates[i]; + continue; } IPW_DEBUG_SCAN("Rate %02X masked : 0x%08X\n", @@ -4531,9 +4909,7 @@ static void ipw_adhoc_create(struct ipw_priv *priv, * FW fatal error. */ network->mode = is_valid_channel(priv->ieee->mode, priv->channel); - if (network->mode) { - network->channel = priv->channel; - } else { + if (!network->mode) { IPW_WARNING("Overriding invalid channel\n"); if (priv->ieee->mode & IEEE_A) { network->mode = IEEE_A; @@ -4572,10 +4948,8 @@ static void ipw_adhoc_create(struct ipw_priv *priv, network->beacon_interval = 100; /* Default */ network->listen_interval = 10; /* Default */ network->atim_window = 0; /* Default */ -#ifdef CONFIG_IEEE80211_WPA network->wpa_ie_len = 0; network->rsn_ie_len = 0; -#endif /* CONFIG_IEEE80211_WPA */ } static void ipw_send_wep_keys(struct ipw_priv *priv) @@ -4593,9 +4967,9 @@ static void ipw_send_wep_keys(struct ipw_priv *priv) for (i = 0; i < 4; i++) { key->key_index = i; - if (!(priv->sec.flags & (1 << i))) { + if (!(priv->sec.flags & (1 << i))) key->key_size = 0; - } else { + else { key->key_size = priv->sec.key_sizes[i]; memcpy(key->key, priv->sec.keys[i], key->key_size); } @@ -4752,9 +5126,10 @@ static int ipw_request_scan(struct ipw_priv *priv) } if (priv->status & STATUS_SCANNING) { - IPW_DEBUG_HC("Concurrent scan requested. Aborting first.\n"); + IPW_DEBUG_HC("Concurrent scan requested. Ignoring.\n"); +// IPW_DEBUG_HC("Concurrent scan requested. Aborting first.\n"); priv->status |= STATUS_SCAN_PENDING; - ipw_abort_scan(priv); +// ipw_abort_scan(priv); return 0; } @@ -4772,11 +5147,12 @@ static int ipw_request_scan(struct ipw_priv *priv) memset(&scan, 0, sizeof(scan)); - scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_SCAN] = 20; - scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN] = 20; - scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] = 20; + scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_SCAN] = cpu_to_le16(20); + scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN] = + cpu_to_le16(20); + scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] = cpu_to_le16(20); - scan.full_scan_index = ieee80211_get_scans(priv->ieee); + scan.full_scan_index = cpu_to_le32(ieee80211_get_scans(priv->ieee)); #ifdef CONFIG_IPW_MONITOR if (priv->ieee->iw_mode == IW_MODE_MONITOR) { @@ -4798,7 +5174,8 @@ static int ipw_request_scan(struct ipw_priv *priv) ipw_set_scan_type(&scan, channel_index, IPW_SCAN_PASSIVE_FULL_DWELL_SCAN); - scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] = 2000; + scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] = + cpu_to_le16(2000); } else { #endif /* CONFIG_IPW_MONITOR */ /* If we are roaming, then make this a directed scan for the current @@ -4807,7 +5184,7 @@ static int ipw_request_scan(struct ipw_priv *priv) if ((priv->status & STATUS_ROAMING) || (!(priv->status & STATUS_ASSOCIATED) && (priv->config & CFG_STATIC_ESSID) - && (scan.full_scan_index % 2))) { + && (le32_to_cpu(scan.full_scan_index) % 2))) { err = ipw_send_ssid(priv, priv->essid, priv->essid_len); if (err) { IPW_DEBUG_HC @@ -4882,7 +5259,6 @@ static int ipw_request_scan(struct ipw_priv *priv) /* Support for wpa_supplicant. Will be replaced with WEXT once * they get WPA support. */ -#ifdef CONFIG_IEEE80211_WPA /* following definitions must match definitions in driver_ipw.c */ @@ -4959,6 +5335,7 @@ static int ipw_wpa_enable(struct ipw_priv *priv, int value) } else { sec.level = SEC_LEVEL_0; sec.enabled = 0; + ieee->wpa_ie_len = 0; } if (ieee->set_security) @@ -4999,6 +5376,8 @@ static int ipw_wpa_set_auth_algs(struct ipw_priv *priv, int value) static int ipw_wpa_set_param(struct net_device *dev, u8 name, u32 value) { struct ipw_priv *priv = ieee80211_priv(dev); + struct ieee80211_crypt_data *crypt; + unsigned long flags; int ret = 0; switch (name) { @@ -5007,7 +5386,22 @@ static int ipw_wpa_set_param(struct net_device *dev, u8 name, u32 value) break; case IPW_PARAM_TKIP_COUNTERMEASURES: - priv->ieee->tkip_countermeasures = value; + crypt = priv->ieee->crypt[priv->ieee->tx_keyidx]; + if (!crypt || !crypt->ops->set_flags || !crypt->ops->get_flags) { + IPW_WARNING("Can't set TKIP countermeasures: " + "crypt not set!\n"); + break; + } + + flags = crypt->ops->get_flags(crypt->priv); + + if (value) + flags |= IEEE80211_CRYPTO_TKIP_COUNTERMEASURES; + else + flags &= ~IEEE80211_CRYPTO_TKIP_COUNTERMEASURES; + + crypt->ops->set_flags(flags, crypt->priv); + break; case IPW_PARAM_DROP_UNENCRYPTED: @@ -5313,7 +5707,6 @@ static int ipw_wpa_supplicant(struct net_device *dev, struct iw_point *p) kfree(param); return ret; } -#endif /* CONFIG_IEEE80211_WPA */ static int ipw_associate_network(struct ipw_priv *priv, struct ieee80211_network *network, @@ -5346,13 +5739,11 @@ static int ipw_associate_network(struct ipw_priv *priv, if (priv->capability & CAP_PRIVACY_ON) ipw_send_wep_keys(priv); -#ifdef CONFIG_IEEE80211_WPA - if (priv->ieee->wpa_enabled) { + if (priv->ieee->wpa_ie_len) { priv->assoc_request.policy_support = 0x02; /* RSN active */ ipw_set_rsn_capa(priv, priv->ieee->wpa_ie, priv->ieee->wpa_ie_len); } -#endif /* * It is valid for our ieee device to support multiple modes, but @@ -5511,12 +5902,15 @@ static void ipw_roam(void *data) if (priv->status & STATUS_ASSOCIATED) { /* First pass through ROAM process -- look for a better * network */ + unsigned long flags; u8 rssi = priv->assoc_network->stats.rssi; priv->assoc_network->stats.rssi = -128; + spin_lock_irqsave(&priv->ieee->lock, flags); list_for_each_entry(network, &priv->ieee->network_list, list) { if (network != priv->assoc_network) ipw_best_network(priv, &match, network, 1); } + spin_unlock_irqrestore(&priv->ieee->lock, flags); priv->assoc_network->stats.rssi = rssi; if (match.network == priv->assoc_network) { @@ -5549,6 +5943,7 @@ static void ipw_associate(void *data) }; struct ipw_supported_rates *rates; struct list_head *element; + unsigned long flags; if (!(priv->config & CFG_ASSOCIATE) && !(priv->config & (CFG_STATIC_ESSID | @@ -5557,6 +5952,8 @@ static void ipw_associate(void *data) return; } + /* Protect our use of the network_list */ + spin_lock_irqsave(&priv->ieee->lock, flags); list_for_each_entry(network, &priv->ieee->network_list, list) ipw_best_network(priv, &match, network, 0); @@ -5567,6 +5964,7 @@ static void ipw_associate(void *data) priv->ieee->iw_mode == IW_MODE_ADHOC && priv->config & CFG_ADHOC_CREATE && priv->config & CFG_STATIC_ESSID && + priv->config & CFG_STATIC_CHANNEL && !list_empty(&priv->ieee->network_free_list)) { element = priv->ieee->network_free_list.next; network = list_entry(element, struct ieee80211_network, list); @@ -5575,14 +5973,16 @@ static void ipw_associate(void *data) list_del(element); list_add_tail(&network->list, &priv->ieee->network_list); } + spin_unlock_irqrestore(&priv->ieee->lock, flags); /* If we reached the end of the list, then we don't have any valid * matching APs */ if (!network) { ipw_debug_config(priv); - queue_delayed_work(priv->workqueue, &priv->request_scan, - SCAN_INTERVAL); + if (!(priv->status & STATUS_SCANNING)) + queue_delayed_work(priv->workqueue, &priv->request_scan, + SCAN_INTERVAL); return; } @@ -5601,7 +6001,7 @@ static inline void ipw_handle_data_packet(struct ipw_priv *priv, /* We only process data packets if the * interface is open */ - if (unlikely((pkt->u.frame.length + IPW_RX_FRAME_SIZE) > + if (unlikely((le16_to_cpu(pkt->u.frame.length) + IPW_RX_FRAME_SIZE) > skb_tailroom(rxb->skb))) { priv->ieee->stats.rx_errors++; priv->wstats.discard.misc++; @@ -5618,14 +6018,16 @@ static inline void ipw_handle_data_packet(struct ipw_priv *priv, skb_reserve(rxb->skb, offsetof(struct ipw_rx_packet, u.frame.data)); /* Set the size of the skb to the size of the frame */ - skb_put(rxb->skb, pkt->u.frame.length); + skb_put(rxb->skb, le16_to_cpu(pkt->u.frame.length)); IPW_DEBUG_RX("Rx packet of %d bytes.\n", rxb->skb->len); if (!ieee80211_rx(priv->ieee, rxb->skb, stats)) priv->ieee->stats.rx_errors++; - else /* ieee80211_rx succeeded, so it now owns the SKB */ + else { /* ieee80211_rx succeeded, so it now owns the SKB */ rxb->skb = NULL; + ipw_led_activity_on(priv); + } } static inline int is_network_packet(struct ipw_priv *priv, @@ -5634,23 +6036,29 @@ static inline int is_network_packet(struct ipw_priv *priv, /* Filter incoming packets to determine if they are targetted toward * this network, discarding packets coming from ourselves */ switch (priv->ieee->iw_mode) { - case IW_MODE_ADHOC: + case IW_MODE_ADHOC: /* Header: Dest. | Source | BSSID */ + /* {broad,multi}cast packets to our IBSS go through */ if (is_broadcast_ether_addr(header->addr1) || is_multicast_ether_addr(header->addr1)) return !memcmp(header->addr3, priv->bssid, ETH_ALEN); - else - return memcmp(header->addr1, priv->net_dev->dev_addr, - ETH_ALEN); + + /* packets to our adapter go through */ + return !memcmp(header->addr1, priv->net_dev->dev_addr, + ETH_ALEN); break; - case IW_MODE_INFRA: - if (is_broadcast_ether_addr(header->addr3) || - is_multicast_ether_addr(header->addr3)) - return !memcmp(header->addr1, priv->bssid, ETH_ALEN); - else - return memcmp(header->addr3, priv->net_dev->dev_addr, - ETH_ALEN); + + case IW_MODE_INFRA: /* Header: Dest. | AP{BSSID} | Source */ + /* {broad,multi}cast packets to our IBSS go through */ + if (is_broadcast_ether_addr(header->addr1) || + is_multicast_ether_addr(header->addr1)) + return !memcmp(header->addr2, priv->bssid, ETH_ALEN); + + /* packets to our adapter go through */ + return !memcmp(header->addr1, priv->net_dev->dev_addr, + ETH_ALEN); break; } + return 1; } @@ -5695,7 +6103,7 @@ static void ipw_rx(struct ipw_priv *priv) struct ieee80211_rx_stats stats = { .rssi = pkt->u.frame.rssi_dbm - IPW_RSSI_TO_DBM, - .signal = pkt->u.frame.signal, + /* .signal = le16_to_cpu(pkt->u.frame.signal), */ .rate = pkt->u.frame.rate, .mac_time = jiffies, .received_channel = @@ -5705,7 +6113,7 @@ static void ipw_rx(struct ipw_priv *priv) control & (1 << 0)) ? IEEE80211_24GHZ_BAND : IEEE80211_52GHZ_BAND, - .len = pkt->u.frame.length, + .len = le16_to_cpu(pkt->u.frame.length), }; if (stats.rssi != 0) @@ -5746,9 +6154,10 @@ static void ipw_rx(struct ipw_priv *priv) } IPW_DEBUG_RX("Frame: len=%u\n", - pkt->u.frame.length); + le16_to_cpu(pkt->u.frame.length)); - if (pkt->u.frame.length < frame_hdr_len(header)) { + if (le16_to_cpu(pkt->u.frame.length) < + frame_hdr_len(header)) { IPW_DEBUG_DROP ("Received packet is too small. " "Dropping.\n"); @@ -5757,19 +6166,20 @@ static void ipw_rx(struct ipw_priv *priv) break; } - switch (WLAN_FC_GET_TYPE(header->frame_ctl)) { + switch (WLAN_FC_GET_TYPE + (le16_to_cpu(header->frame_ctl))) { case IEEE80211_FTYPE_MGMT: ieee80211_rx_mgt(priv->ieee, header, &stats); if (priv->ieee->iw_mode == IW_MODE_ADHOC && ((WLAN_FC_GET_STYPE - (header->frame_ctl) == - IEEE80211_STYPE_PROBE_RESP) + (le16_to_cpu(header->frame_ctl)) + == IEEE80211_STYPE_PROBE_RESP) || (WLAN_FC_GET_STYPE - (header->frame_ctl) == - IEEE80211_STYPE_BEACON)) + (le16_to_cpu(header->frame_ctl)) + == IEEE80211_STYPE_BEACON)) && !memcmp(header->addr3, priv->bssid, ETH_ALEN)) ipw_add_station(priv, @@ -5852,7 +6262,9 @@ static int ipw_wx_get_name(struct net_device *dev, union iwreq_data *wrqu, char *extra) { struct ipw_priv *priv = ieee80211_priv(dev); - if (!(priv->status & STATUS_ASSOCIATED)) + if (priv->status & STATUS_RF_KILL_MASK) { + strcpy(wrqu->name, "radio off"); + } else if (!(priv->status & STATUS_ASSOCIATED)) strcpy(wrqu->name, "unassociated"); else snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11%c", @@ -5892,9 +6304,8 @@ static int ipw_set_channel(struct ipw_priv *priv, u8 channel) if (priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { IPW_DEBUG_ASSOC("Disassociating due to channel change.\n"); ipw_disassociate(priv); - } else { + } else if (!(priv->status & (STATUS_SCANNING))) ipw_associate(priv); - } return 0; } @@ -5986,9 +6397,8 @@ static int ipw_wx_set_mode(struct net_device *dev, #ifdef CONFIG_PM /* Free the existing firmware and reset the fw_loaded * flag so ipw_load() will bring in the new firmawre */ - if (fw_loaded) { + if (fw_loaded) fw_loaded = 0; - } release_firmware(bootfw); release_firmware(ucode); @@ -5997,7 +6407,7 @@ static int ipw_wx_set_mode(struct net_device *dev, #endif priv->ieee->iw_mode = wrqu->mode; - ipw_adapter_restart(priv); + queue_work(priv->workqueue, &priv->adapter_restart); return err; } @@ -6149,9 +6559,8 @@ static int ipw_wx_set_wap(struct net_device *dev, if (priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { IPW_DEBUG_ASSOC("Disassociating due to BSSID change.\n"); ipw_disassociate(priv); - } else { + } else if (!(priv->status & (STATUS_SCANNING))) ipw_associate(priv); - } return 0; } @@ -6220,9 +6629,8 @@ static int ipw_wx_set_essid(struct net_device *dev, if (priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { IPW_DEBUG_ASSOC("Disassociating due to ESSID change.\n"); ipw_disassociate(priv); - } else { + } else if (!(priv->status & (STATUS_SCANNING))) ipw_associate(priv); - } return 0; } @@ -6383,10 +6791,10 @@ static int ipw_wx_set_rate(struct net_device *dev, if ((priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING))) { IPW_DEBUG_ASSOC("Disassociating due to RATE change.\n"); ipw_disassociate(priv); + } else if (!(priv->status & (STATUS_SCANNING))) { + /* We are not yet associated, so kick one off... */ + ipw_associate(priv); } - } else { - /* We are not yet associated, so kick one off... */ - ipw_associate(priv); } return 0; @@ -6635,11 +7043,10 @@ static int ipw_wx_get_power(struct net_device *dev, { struct ipw_priv *priv = ieee80211_priv(dev); - if (!(priv->power_mode & IPW_POWER_ENABLED)) { + if (!(priv->power_mode & IPW_POWER_ENABLED)) wrqu->power.disabled = 1; - } else { + else wrqu->power.disabled = 0; - } IPW_DEBUG_WX("GET Power Management Mode -> %02X\n", priv->power_mode); @@ -6764,6 +7171,9 @@ static int ipw_wx_set_wireless_mode(struct net_device *dev, } else ipw_send_supported_rates(priv, &priv->rates); + /* Update the band LEDs */ + ipw_led_band_on(priv); + IPW_DEBUG_WX("PRIV SET MODE: %c%c%c\n", mode & IEEE_A ? 'a' : '.', mode & IEEE_B ? 'b' : '.', mode & IEEE_G ? 'g' : '.'); @@ -6870,7 +7280,7 @@ static int ipw_wx_set_monitor(struct net_device *dev, if (enable) { if (priv->ieee->iw_mode != IW_MODE_MONITOR) { priv->net_dev->type = ARPHRD_IEEE80211; - ipw_adapter_restart(priv); + queue_work(priv->workqueue, &priv->adapter_restart); } ipw_set_channel(priv, parms[1]); @@ -6878,7 +7288,7 @@ static int ipw_wx_set_monitor(struct net_device *dev, if (priv->ieee->iw_mode != IW_MODE_MONITOR) return 0; priv->net_dev->type = ARPHRD_ETHER; - ipw_adapter_restart(priv); + queue_work(priv->workqueue, &priv->adapter_restart); } return 0; } @@ -6889,7 +7299,7 @@ static int ipw_wx_reset(struct net_device *dev, { struct ipw_priv *priv = ieee80211_priv(dev); IPW_DEBUG_WX("RESET\n"); - ipw_adapter_restart(priv); + queue_work(priv->workqueue, &priv->adapter_restart); return 0; } #endif // CONFIG_IPW_MONITOR @@ -6925,6 +7335,10 @@ static iw_handler ipw_wx_handlers[] = { IW_IOCTL(SIOCGIWENCODE) = ipw_wx_get_encode, IW_IOCTL(SIOCSIWPOWER) = ipw_wx_set_power, IW_IOCTL(SIOCGIWPOWER) = ipw_wx_get_power, + IW_IOCTL(SIOCSIWSPY) = iw_handler_set_spy, + IW_IOCTL(SIOCGIWSPY) = iw_handler_get_spy, + IW_IOCTL(SIOCSIWTHRSPY) = iw_handler_set_thrspy, + IW_IOCTL(SIOCGIWTHRSPY) = iw_handler_get_thrspy, }; #define IPW_PRIV_SET_POWER SIOCIWFIRSTPRIV @@ -6993,6 +7407,8 @@ static struct iw_handler_def ipw_wx_handler_def = { .private_args = ipw_priv_args, }; +static struct iw_public_data ipw_wx_data; + /* * Get wireless statistics. * Called by /proc/net/wireless @@ -7057,7 +7473,7 @@ static inline void init_sys_config(struct ipw_sys_config *sys_config) sys_config->dot11g_auto_detection = 0; sys_config->enable_cts_to_self = 0; sys_config->bt_coexist_collision_thr = 0; - sys_config->pass_noise_stats_to_host = 1; + sys_config->pass_noise_stats_to_host = 0; //1 -- fix for 256 } static int ipw_net_open(struct net_device *dev) @@ -7131,7 +7547,7 @@ static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb) tfd->control_flags.control_bits = TFD_NEED_IRQ_MASK; tfd->u.data.cmd_id = DINO_CMD_TX; - tfd->u.data.len = txb->payload_size; + tfd->u.data.len = cpu_to_le16(txb->payload_size); remaining_bytes = txb->payload_size; if (unlikely(!unicast)) tfd->u.data.tx_flags = DCT_FLAG_NO_WEP; @@ -7149,8 +7565,14 @@ static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb) memcpy(&tfd->u.data.tfd.tfd_24.mchdr, hdr, hdr_len); /* payload */ - tfd->u.data.num_chunks = min((u8) (NUM_TFD_CHUNKS - 2), txb->nr_frags); - for (i = 0; i < tfd->u.data.num_chunks; i++) { + tfd->u.data.num_chunks = cpu_to_le32(min((u8) (NUM_TFD_CHUNKS - 2), + txb->nr_frags)); + IPW_DEBUG_FRAG("%i fragments being sent as %i chunks.\n", + txb->nr_frags, le32_to_cpu(tfd->u.data.num_chunks)); + for (i = 0; i < le32_to_cpu(tfd->u.data.num_chunks); i++) { + IPW_DEBUG_FRAG("Adding fragment %i of %i (%d bytes).\n", + i, le32_to_cpu(tfd->u.data.num_chunks), + txb->fragments[i]->len - hdr_len); IPW_DEBUG_TX("Dumping TX packet frag %i of %i (%d bytes):\n", i, tfd->u.data.num_chunks, txb->fragments[i]->len - hdr_len); @@ -7158,11 +7580,13 @@ static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb) txb->fragments[i]->len - hdr_len); tfd->u.data.chunk_ptr[i] = - pci_map_single(priv->pci_dev, - txb->fragments[i]->data + hdr_len, - txb->fragments[i]->len - hdr_len, - PCI_DMA_TODEVICE); - tfd->u.data.chunk_len[i] = txb->fragments[i]->len - hdr_len; + cpu_to_le32(pci_map_single + (priv->pci_dev, + txb->fragments[i]->data + hdr_len, + txb->fragments[i]->len - hdr_len, + PCI_DMA_TODEVICE)); + tfd->u.data.chunk_len[i] = + cpu_to_le16(txb->fragments[i]->len - hdr_len); } if (i != txb->nr_frags) { @@ -7177,7 +7601,7 @@ static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb) remaining_bytes); skb = alloc_skb(remaining_bytes, GFP_ATOMIC); if (skb != NULL) { - tfd->u.data.chunk_len[i] = remaining_bytes; + tfd->u.data.chunk_len[i] = cpu_to_le16(remaining_bytes); for (j = i; j < txb->nr_frags; j++) { int size = txb->fragments[j]->len - hdr_len; printk(KERN_INFO "Adding frag %d %d...\n", @@ -7188,10 +7612,14 @@ static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb) dev_kfree_skb_any(txb->fragments[i]); txb->fragments[i] = skb; tfd->u.data.chunk_ptr[i] = - pci_map_single(priv->pci_dev, skb->data, - tfd->u.data.chunk_len[i], - PCI_DMA_TODEVICE); - tfd->u.data.num_chunks++; + cpu_to_le32(pci_map_single + (priv->pci_dev, skb->data, + tfd->u.data.chunk_len[i], + PCI_DMA_TODEVICE)); + + tfd->u.data.num_chunks = + cpu_to_le32(le32_to_cpu(tfd->u.data.num_chunks) + + 1); } } @@ -7227,6 +7655,7 @@ static int ipw_net_hard_start_xmit(struct ieee80211_txb *txb, } ipw_tx_skb(priv, txb); + ipw_led_activity_on(priv); spin_unlock_irqrestore(&priv->lock, flags); return 0; @@ -7260,7 +7689,7 @@ static int ipw_net_set_mac_address(struct net_device *dev, void *p) memcpy(priv->mac_addr, addr->sa_data, ETH_ALEN); printk(KERN_INFO "%s: Setting MAC to " MAC_FMT "\n", priv->net_dev->name, MAC_ARG(priv->mac_addr)); - ipw_adapter_restart(priv); + queue_work(priv->workqueue, &priv->adapter_restart); return 0; } @@ -7414,6 +7843,46 @@ static void ipw_rf_kill(void *adapter) spin_unlock_irqrestore(&priv->lock, flags); } +void ipw_link_up(struct ipw_priv *priv) +{ + netif_carrier_on(priv->net_dev); + if (netif_queue_stopped(priv->net_dev)) { + IPW_DEBUG_NOTIF("waking queue\n"); + netif_wake_queue(priv->net_dev); + } else { + IPW_DEBUG_NOTIF("starting queue\n"); + netif_start_queue(priv->net_dev); + } + + ipw_reset_stats(priv); + /* Ensure the rate is updated immediately */ + priv->last_rate = ipw_get_current_rate(priv); + ipw_gather_stats(priv); + ipw_led_link_up(priv); + notify_wx_assoc_event(priv); + + if (priv->config & CFG_BACKGROUND_SCAN) + queue_delayed_work(priv->workqueue, &priv->request_scan, HZ); +} + +void ipw_link_down(struct ipw_priv *priv) +{ + ipw_led_link_down(priv); + netif_carrier_off(priv->net_dev); + netif_stop_queue(priv->net_dev); + notify_wx_assoc_event(priv); + + /* Cancel any queued work ... */ + cancel_delayed_work(&priv->request_scan); + cancel_delayed_work(&priv->adhoc_check); + cancel_delayed_work(&priv->gather_stats); + + ipw_reset_stats(priv); + + /* Queue up another scan... */ + queue_work(priv->workqueue, &priv->request_scan); +} + static int ipw_setup_deferred_work(struct ipw_priv *priv) { int ret = 0; @@ -7436,6 +7905,13 @@ static int ipw_setup_deferred_work(struct ipw_priv *priv) INIT_WORK(&priv->abort_scan, (void (*)(void *))ipw_abort_scan, priv); INIT_WORK(&priv->roam, ipw_roam, priv); INIT_WORK(&priv->scan_check, ipw_scan_check, priv); + INIT_WORK(&priv->link_up, (void (*)(void *))ipw_link_up, priv); + INIT_WORK(&priv->link_down, (void (*)(void *))ipw_link_down, priv); + INIT_WORK(&priv->led_link_on, (void (*)(void *))ipw_led_link_on, priv); + INIT_WORK(&priv->led_link_off, (void (*)(void *))ipw_led_link_off, + priv); + INIT_WORK(&priv->led_act_off, (void (*)(void *))ipw_led_activity_off, + priv); tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long)) ipw_irq_tasklet, (unsigned long)priv); @@ -7636,8 +8112,9 @@ static int ipw_up(struct ipw_priv *priv) rc = ipw_config(priv); if (!rc) { IPW_DEBUG_INFO("Configured device on count %i\n", i); + ipw_led_init(priv); + ipw_led_radio_on(priv); priv->notif_missed_beacons = 0; - netif_start_queue(priv->net_dev); return 0; } else { IPW_DEBUG_INFO("Device configuration failed: 0x%08X\n", @@ -7675,11 +8152,12 @@ static void ipw_down(struct ipw_priv *priv) netif_stop_queue(priv->net_dev); ipw_stop_nic(priv); + + ipw_led_radio_off(priv); } static int ipw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { -#ifdef CONFIG_IEEE80211_WPA struct iwreq *wrq = (struct iwreq *)rq; int ret = -1; switch (cmd) { @@ -7691,8 +8169,6 @@ static int ipw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) return -EOPNOTSUPP; } -#endif /* CONFIG_IEEE80211_WPA */ - return -EOPNOTSUPP; } @@ -7739,7 +8215,7 @@ static struct pci_device_id card_ids[] = { {PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, 0x2762, 0, 0, 0}, {PCI_VENDOR_ID_INTEL, 0x104f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {PCI_VENDOR_ID_INTEL, 0x4220, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, /* BG */ - {PCI_VENDOR_ID_INTEL, 0x4221, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, /* 2225BG */ + {PCI_VENDOR_ID_INTEL, 0x4221, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, /* BG */ {PCI_VENDOR_ID_INTEL, 0x4223, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, /* ABG */ {PCI_VENDOR_ID_INTEL, 0x4224, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, /* ABG */ @@ -7764,6 +8240,8 @@ static struct attribute *ipw_sysfs_entries[] = { &dev_attr_eeprom_delay.attr, &dev_attr_ucode_version.attr, &dev_attr_rtc.attr, + &dev_attr_scan_age.attr, + &dev_attr_led.attr, NULL }; @@ -7789,6 +8267,7 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) priv = ieee80211_priv(net_dev); priv->ieee = netdev_priv(net_dev); + priv->net_dev = net_dev; priv->pci_dev = pdev; #ifdef CONFIG_IPW_DEBUG @@ -7843,6 +8322,12 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) } /* Initialize module parameter values here */ + + /* We default to disabling the LED code as right now it causes + * too many systems to lock up... */ + if (!led) + priv->config |= CFG_NO_LED; + if (associate) priv->config |= CFG_ASSOCIATE; else @@ -7893,14 +8378,9 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) priv->adapter = IPW_2915ABG; priv->ieee->mode = IEEE_A | IEEE_G | IEEE_B; } else { - if (priv->pci_dev->device == 0x4221) - printk(KERN_INFO DRV_NAME - ": Detected Intel PRO/Wireless 2225BG Network " - "Connection\n"); - else - printk(KERN_INFO DRV_NAME - ": Detected Intel PRO/Wireless 2200BG Network " - "Connection\n"); + printk(KERN_INFO DRV_NAME + ": Detected Intel PRO/Wireless 2200BG Network " + "Connection\n"); priv->ieee->abg_true = 0; band = IEEE80211_24GHZ_BAND; @@ -7933,6 +8413,9 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) SET_MODULE_OWNER(net_dev); SET_NETDEV_DEV(net_dev, &pdev->dev); + ipw_wx_data.spy_data = &priv->ieee->spy_data; + ipw_wx_data.ieee80211 = priv->ieee; + priv->ieee->hard_start_xmit = ipw_net_hard_start_xmit; priv->ieee->set_security = shim__set_security; @@ -7944,6 +8427,7 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) net_dev->set_multicast_list = ipw_net_set_multicast_list; net_dev->set_mac_address = ipw_net_set_mac_address; net_dev->get_wireless_stats = ipw_get_wireless_stats; + net_dev->wireless_data = &ipw_wx_data; net_dev->wireless_handlers = &ipw_wx_handler_def; net_dev->ethtool_ops = &ipw_ethtool_ops; net_dev->irq = pdev->irq; @@ -7960,12 +8444,12 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) err = register_netdev(net_dev); if (err) { IPW_ERROR("failed to register network device\n"); - goto out_remove_group; + goto out_remove_sysfs; } return 0; - out_remove_group: + out_remove_sysfs: sysfs_remove_group(&pdev->dev.kobj, &ipw_attribute_group); out_release_irq: free_irq(pdev->irq, priv); @@ -8005,17 +8489,17 @@ static void ipw_pci_remove(struct pci_dev *pdev) } ipw_tx_queue_free(priv); + ipw_led_shutdown(priv); + /* ipw_down will ensure that there is no more pending work * in the workqueue's, so we can safely remove them now. */ - if (priv->workqueue) { - cancel_delayed_work(&priv->adhoc_check); - cancel_delayed_work(&priv->gather_stats); - cancel_delayed_work(&priv->request_scan); - cancel_delayed_work(&priv->rf_kill); - cancel_delayed_work(&priv->scan_check); - destroy_workqueue(priv->workqueue); - priv->workqueue = NULL; - } + cancel_delayed_work(&priv->adhoc_check); + cancel_delayed_work(&priv->gather_stats); + cancel_delayed_work(&priv->request_scan); + cancel_delayed_work(&priv->rf_kill); + cancel_delayed_work(&priv->scan_check); + destroy_workqueue(priv->workqueue); + priv->workqueue = NULL; free_irq(pdev->irq, priv); iounmap(priv->hw_base); @@ -8138,6 +8622,10 @@ MODULE_PARM_DESC(associate, "auto associate when scanning (default on)"); module_param(auto_create, int, 0444); MODULE_PARM_DESC(auto_create, "auto create adhoc network (default on)"); +module_param(led, int, 0444); +MODULE_PARM_DESC(auto_create, + "enable led control on some systems (default 0 off)\n"); + module_param(debug, int, 0444); MODULE_PARM_DESC(debug, "debug output mask"); diff --git a/drivers/net/wireless/ipw2200.h b/drivers/net/wireless/ipw2200.h index 068027963181..1b339cb7a522 100644 --- a/drivers/net/wireless/ipw2200.h +++ b/drivers/net/wireless/ipw2200.h @@ -403,9 +403,9 @@ struct clx2_tx_queue { #define RX_FREE_BUFFERS 32 #define RX_LOW_WATERMARK 8 -#define SUP_RATE_11A_MAX_NUM_CHANNELS (8) -#define SUP_RATE_11B_MAX_NUM_CHANNELS (4) -#define SUP_RATE_11G_MAX_NUM_CHANNELS (12) +#define SUP_RATE_11A_MAX_NUM_CHANNELS 8 +#define SUP_RATE_11B_MAX_NUM_CHANNELS 4 +#define SUP_RATE_11G_MAX_NUM_CHANNELS 12 // Used for passing to driver number of successes and failures per rate struct rate_histogram { @@ -890,6 +890,9 @@ struct ipw_cmd { #define STATUS_SCANNING (1<<21) #define STATUS_SCAN_ABORTING (1<<22) +#define STATUS_LED_LINK_ON (1<<24) +#define STATUS_LED_ACT_ON (1<<25) + #define STATUS_INDIRECT_BYTE (1<<28) /* sysfs entry configured for access */ #define STATUS_INDIRECT_DWORD (1<<29) /* sysfs entry configured for access */ #define STATUS_DIRECT_DWORD (1<<30) /* sysfs entry configured for access */ @@ -905,6 +908,8 @@ struct ipw_cmd { #define CFG_ASSOCIATE (1<<6) #define CFG_FIXED_RATE (1<<7) #define CFG_ADHOC_CREATE (1<<8) +#define CFG_NO_LED (1<<9) +#define CFG_BACKGROUND_SCAN (1<<10) #define CAP_SHARED_KEY (1<<0) /* Off = OPEN */ #define CAP_PRIVACY_ON (1<<1) /* Off = No privacy */ @@ -1046,9 +1051,24 @@ struct ipw_priv { struct work_struct abort_scan; struct work_struct roam; struct work_struct scan_check; + struct work_struct link_up; + struct work_struct link_down; struct tasklet_struct irq_tasklet; + /* LED related variables and work_struct */ + u8 nic_type; + u32 led_activity_on; + u32 led_activity_off; + u32 led_association_on; + u32 led_association_off; + u32 led_ofdm_on; + u32 led_ofdm_off; + + struct work_struct led_link_on; + struct work_struct led_link_off; + struct work_struct led_act_off; + #define IPW_2200BG 1 #define IPW_2915ABG 2 u8 adapter; @@ -1126,6 +1146,8 @@ do { if (ipw_debug_level & (level)) \ #define IPW_DL_RF_KILL (1<<17) #define IPW_DL_FW_ERRORS (1<<18) +#define IPW_DL_LED (1<<19) + #define IPW_DL_ORD (1<<20) #define IPW_DL_FRAG (1<<21) @@ -1151,6 +1173,7 @@ do { if (ipw_debug_level & (level)) \ #define IPW_DEBUG_TX(f, a...) IPW_DEBUG(IPW_DL_TX, f, ## a) #define IPW_DEBUG_ISR(f, a...) IPW_DEBUG(IPW_DL_ISR, f, ## a) #define IPW_DEBUG_MANAGEMENT(f, a...) IPW_DEBUG(IPW_DL_MANAGE, f, ## a) +#define IPW_DEBUG_LED(f, a...) IPW_DEBUG(IPW_DL_LED, f, ## a) #define IPW_DEBUG_WEP(f, a...) IPW_DEBUG(IPW_DL_WEP, f, ## a) #define IPW_DEBUG_HC(f, a...) IPW_DEBUG(IPW_DL_HOST_COMMAND, f, ## a) #define IPW_DEBUG_FRAG(f, a...) IPW_DEBUG(IPW_DL_FRAG, f, ## a) @@ -1268,25 +1291,25 @@ do { if (ipw_debug_level & (level)) \ #define CX2_DMA_I_DMA_CONTROL 0x003000A4 #define CX2_DMA_I_CB_BASE 0x003000A0 -#define CX2_TX_CMD_QUEUE_BD_BASE (0x00000200) -#define CX2_TX_CMD_QUEUE_BD_SIZE (0x00000204) -#define CX2_TX_QUEUE_0_BD_BASE (0x00000208) +#define CX2_TX_CMD_QUEUE_BD_BASE 0x00000200 +#define CX2_TX_CMD_QUEUE_BD_SIZE 0x00000204 +#define CX2_TX_QUEUE_0_BD_BASE 0x00000208 #define CX2_TX_QUEUE_0_BD_SIZE (0x0000020C) -#define CX2_TX_QUEUE_1_BD_BASE (0x00000210) -#define CX2_TX_QUEUE_1_BD_SIZE (0x00000214) -#define CX2_TX_QUEUE_2_BD_BASE (0x00000218) +#define CX2_TX_QUEUE_1_BD_BASE 0x00000210 +#define CX2_TX_QUEUE_1_BD_SIZE 0x00000214 +#define CX2_TX_QUEUE_2_BD_BASE 0x00000218 #define CX2_TX_QUEUE_2_BD_SIZE (0x0000021C) -#define CX2_TX_QUEUE_3_BD_BASE (0x00000220) -#define CX2_TX_QUEUE_3_BD_SIZE (0x00000224) -#define CX2_RX_BD_BASE (0x00000240) -#define CX2_RX_BD_SIZE (0x00000244) -#define CX2_RFDS_TABLE_LOWER (0x00000500) - -#define CX2_TX_CMD_QUEUE_READ_INDEX (0x00000280) -#define CX2_TX_QUEUE_0_READ_INDEX (0x00000284) -#define CX2_TX_QUEUE_1_READ_INDEX (0x00000288) +#define CX2_TX_QUEUE_3_BD_BASE 0x00000220 +#define CX2_TX_QUEUE_3_BD_SIZE 0x00000224 +#define CX2_RX_BD_BASE 0x00000240 +#define CX2_RX_BD_SIZE 0x00000244 +#define CX2_RFDS_TABLE_LOWER 0x00000500 + +#define CX2_TX_CMD_QUEUE_READ_INDEX 0x00000280 +#define CX2_TX_QUEUE_0_READ_INDEX 0x00000284 +#define CX2_TX_QUEUE_1_READ_INDEX 0x00000288 #define CX2_TX_QUEUE_2_READ_INDEX (0x0000028C) -#define CX2_TX_QUEUE_3_READ_INDEX (0x00000290) +#define CX2_TX_QUEUE_3_READ_INDEX 0x00000290 #define CX2_RX_READ_INDEX (0x000002A0) #define CX2_TX_CMD_QUEUE_WRITE_INDEX (0x00000F80) @@ -1333,15 +1356,15 @@ do { if (ipw_debug_level & (level)) \ #define EEPROM_HW_VERSION (GET_EEPROM_ADDR(0x72,LSB)) /* 2 bytes */ /* NIC type as found in the one byte EEPROM_NIC_TYPE offset*/ -#define EEPROM_NIC_TYPE_STANDARD 0 -#define EEPROM_NIC_TYPE_DELL 1 -#define EEPROM_NIC_TYPE_FUJITSU 2 -#define EEPROM_NIC_TYPE_IBM 3 -#define EEPROM_NIC_TYPE_HP 4 +#define EEPROM_NIC_TYPE_0 0 +#define EEPROM_NIC_TYPE_1 1 +#define EEPROM_NIC_TYPE_2 2 +#define EEPROM_NIC_TYPE_3 3 +#define EEPROM_NIC_TYPE_4 4 #define FW_MEM_REG_LOWER_BOUND 0x00300000 #define FW_MEM_REG_EEPROM_ACCESS (FW_MEM_REG_LOWER_BOUND + 0x40) - +#define CX2_EVENT_REG (FW_MEM_REG_LOWER_BOUND + 0x04) #define EEPROM_BIT_SK (1<<0) #define EEPROM_BIT_CS (1<<1) #define EEPROM_BIT_DI (1<<2) -- cgit v1.2.2 From c848d0af404f00835f038e370005733d90a186fd Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Wed, 24 Aug 2005 21:56:24 -0500 Subject: Catch ipw2200 up to equivelancy with v1.0.3 * Fix #616 problem with OOPS on module load (thanks to Yi Zhu) * Fixed problem with led module parameter being described as 'auto_create' * Added support to merge between adhoc networks (thanks to Mohamed Abbas) * Added semaphore lock at the driver's entry points to protect against re-entry (thanks to Mohamed Abbas) * Added semaphore lock to background scheduled driver actions (thanks to Mohamed Abbas) * Changed how signal quality is reported for scan output (thanks to Peter Jones) * Fixed how high/low clamp values of signal quality are reported so a more consistent ramp is provided (thanks to Bill Moss) * Fix #624 problem with duplicate addresses (again) (thanks to Bernard Blackham) * Fix #385 problem with fragmentation and certain sized packets (thanks to Mohamed Abbas) * Modified iwconfig network name if RF kill is enabled to say 'radio off' * Fix #382 problem with driver not responding to probe requests in Ad-Hoc mode (thanks to Mohamed Abbas) Signed-off-by: James Ketrenos --- drivers/net/wireless/ipw2200.c | 841 ++++++++++++++++++++++++++++++++--------- drivers/net/wireless/ipw2200.h | 5 +- 2 files changed, 668 insertions(+), 178 deletions(-) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index ea7a3dcf1daa..0bf1931ac5f3 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -32,7 +32,7 @@ #include "ipw2200.h" -#define IPW2200_VERSION "1.0.2" +#define IPW2200_VERSION "1.0.3" #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2200/2915 Network Driver" #define DRV_COPYRIGHT "Copyright(c) 2003-2004 Intel Corporation" #define DRV_VERSION IPW2200_VERSION @@ -68,9 +68,10 @@ static void ipw_tx_queue_free(struct ipw_priv *); static struct ipw_rx_queue *ipw_rx_queue_alloc(struct ipw_priv *); static void ipw_rx_queue_free(struct ipw_priv *, struct ipw_rx_queue *); static void ipw_rx_queue_replenish(void *); - static int ipw_up(struct ipw_priv *); +static void ipw_bg_up(void *); static void ipw_down(struct ipw_priv *); +static void ipw_bg_down(void *); static int ipw_config(struct ipw_priv *); static int init_supported_rates(struct ipw_priv *priv, struct ipw_supported_rates *prates); @@ -473,6 +474,11 @@ static void ipw_dump_nic_event_log(struct ipw_priv *priv) } } +static inline int ipw_is_init(struct ipw_priv *priv) +{ + return (priv->status & STATUS_INIT) ? 1 : 0; +} + static int ipw_get_ordinal(struct ipw_priv *priv, u32 ord, void *val, u32 * len) { u32 addr, field_info, field_len, field_count, total_len; @@ -698,6 +704,14 @@ void ipw_led_link_on(struct ipw_priv *priv) spin_unlock_irqrestore(&priv->lock, flags); } +static void ipw_bg_led_link_on(void *data) +{ + struct ipw_priv *priv = data; + down(&priv->sem); + ipw_led_link_on(data); + up(&priv->sem); +} + void ipw_led_link_off(struct ipw_priv *priv) { unsigned long flags; @@ -734,6 +748,14 @@ void ipw_led_link_off(struct ipw_priv *priv) spin_unlock_irqrestore(&priv->lock, flags); } +static void ipw_bg_led_link_off(void *data) +{ + struct ipw_priv *priv = data; + down(&priv->sem); + ipw_led_link_off(data); + up(&priv->sem); +} + void ipw_led_activity_on(struct ipw_priv *priv) { unsigned long flags; @@ -762,6 +784,7 @@ void ipw_led_activity_on(struct ipw_priv *priv) priv->status |= STATUS_LED_ACT_ON; + cancel_delayed_work(&priv->led_act_off); queue_delayed_work(priv->workqueue, &priv->led_act_off, LD_TIME_ACT_ON); } else { @@ -801,13 +824,22 @@ void ipw_led_activity_off(struct ipw_priv *priv) spin_unlock_irqrestore(&priv->lock, flags); } +static void ipw_bg_led_activity_off(void *data) +{ + struct ipw_priv *priv = data; + down(&priv->sem); + ipw_led_activity_off(data); + up(&priv->sem); +} + void ipw_led_band_on(struct ipw_priv *priv) { unsigned long flags; u32 led; /* Only nic type 1 supports mode LEDs */ - if (priv->config & CFG_NO_LED || priv->nic_type != EEPROM_NIC_TYPE_1) + if (priv->config & CFG_NO_LED || + priv->nic_type != EEPROM_NIC_TYPE_1 || !priv->assoc_network) return; spin_lock_irqsave(&priv->lock, flags); @@ -993,7 +1025,9 @@ static ssize_t store_scan_age(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { struct ipw_priv *priv = dev_get_drvdata(d); +#ifdef CONFIG_IPW_DEBUG struct net_device *dev = priv->net_dev; +#endif char buffer[] = "00000000"; unsigned long len = (sizeof(buffer) - 1) > count ? count : sizeof(buffer) - 1; @@ -1704,6 +1738,14 @@ static void ipw_adapter_restart(void *adapter) } } +static void ipw_bg_adapter_restart(void *data) +{ + struct ipw_priv *priv = data; + down(&priv->sem); + ipw_adapter_restart(data); + up(&priv->sem); +} + #define IPW_SCAN_CHECK_WATCHDOG (5 * HZ) static void ipw_scan_check(void *data) @@ -1717,6 +1759,14 @@ static void ipw_scan_check(void *data) } } +static void ipw_bg_scan_check(void *data) +{ + struct ipw_priv *priv = data; + down(&priv->sem); + ipw_scan_check(data); + up(&priv->sem); +} + static int ipw_send_scan_request_ext(struct ipw_priv *priv, struct ipw_scan_request_ext *request) { @@ -2982,6 +3032,8 @@ static int ipw_load(struct ipw_priv *priv) /* Ensure interrupts are disabled */ ipw_write32(priv, CX2_INTA_MASK_R, ~CX2_INTA_MASK_ALL); + /* ack pending interrupts */ + ipw_write32(priv, CX2_INTA_RW, CX2_INTA_MASK_ALL); /* kick start the device */ ipw_start_nic(priv); @@ -3350,9 +3402,21 @@ static void ipw_send_disassociate(struct ipw_priv *priv, int quiet) } -static void ipw_disassociate(void *data) +static int ipw_disassociate(void *data) { + struct ipw_priv *priv = data; + if (!(priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING))) + return 0; ipw_send_disassociate(data, 0); + return 1; +} + +static void ipw_bg_disassociate(void *data) +{ + struct ipw_priv *priv = data; + down(&priv->sem); + ipw_disassociate(data); + up(&priv->sem); } struct ipw_status_code { @@ -3571,8 +3635,6 @@ static u32 ipw_get_current_rate(struct ipw_priv *priv) return 0; } -#define PERFECT_RSSI (-20) -#define WORST_RSSI (-85) #define IPW_STATS_INTERVAL (2 * HZ) static void ipw_gather_stats(struct ipw_priv *priv) { @@ -3663,19 +3725,19 @@ static void ipw_gather_stats(struct ipw_priv *priv) tx_quality, tx_failures_delta, tx_packets_delta); rssi = average_value(&priv->average_rssi); - if (rssi > PERFECT_RSSI) + signal_quality = + (100 * + (priv->ieee->perfect_rssi - priv->ieee->worst_rssi) * + (priv->ieee->perfect_rssi - priv->ieee->worst_rssi) - + (priv->ieee->perfect_rssi - rssi) * + (15 * (priv->ieee->perfect_rssi - priv->ieee->worst_rssi) + + 62 * (priv->ieee->perfect_rssi - rssi))) / + ((priv->ieee->perfect_rssi - priv->ieee->worst_rssi) * + (priv->ieee->perfect_rssi - priv->ieee->worst_rssi)); + if (signal_quality > 100) signal_quality = 100; - else if (rssi < WORST_RSSI) + else if (signal_quality < 1) signal_quality = 0; - else /* qual = 100a^2 - 15ab + 62b^2 / a^2 */ - signal_quality = - (100 * - (PERFECT_RSSI - WORST_RSSI) * - (PERFECT_RSSI - WORST_RSSI) - - (PERFECT_RSSI - rssi) * - (15 * (PERFECT_RSSI - WORST_RSSI) + - 62 * (PERFECT_RSSI - rssi))) / - ((PERFECT_RSSI - WORST_RSSI) * (PERFECT_RSSI - WORST_RSSI)); IPW_DEBUG_STATS("Signal level : %3d%% (%d dBm)\n", signal_quality, rssi); @@ -3705,6 +3767,14 @@ static void ipw_gather_stats(struct ipw_priv *priv) IPW_STATS_INTERVAL); } +static void ipw_bg_gather_stats(void *data) +{ + struct ipw_priv *priv = data; + down(&priv->sem); + ipw_gather_stats(data); + up(&priv->sem); +} + static inline void ipw_handle_missed_beacon(struct ipw_priv *priv, int missed_count) { @@ -4456,6 +4526,14 @@ static void ipw_rx_queue_replenish(void *data) ipw_rx_queue_restock(priv); } +static void ipw_bg_rx_queue_replenish(void *data) +{ + struct ipw_priv *priv = data; + down(&priv->sem); + ipw_rx_queue_replenish(data); + up(&priv->sem); +} + /* Assumes that the skb field of the buffers in 'pool' is kept accurate. * If an SKB has been detached, the POOL needs to have it's SKB set to NULL * This free routine walks the list of POOL entries and if SKB is set to @@ -4715,6 +4793,215 @@ struct ipw_network_match { struct ipw_supported_rates rates; }; +static int ipw_find_adhoc_network(struct ipw_priv *priv, + struct ipw_network_match *match, + struct ieee80211_network *network, + int roaming) +{ + struct ipw_supported_rates rates; + + /* Verify that this network's capability is compatible with the + * current mode (AdHoc or Infrastructure) */ + if ((priv->ieee->iw_mode == IW_MODE_ADHOC && + !(network->capability & WLAN_CAPABILITY_IBSS))) { + IPW_DEBUG_MERGE("Network '%s (" MAC_FMT ")' excluded due to " + "capability mismatch.\n", + escape_essid(network->ssid, network->ssid_len), + MAC_ARG(network->bssid)); + return 0; + } + + /* If we do not have an ESSID for this AP, we can not associate with + * it */ + if (network->flags & NETWORK_EMPTY_ESSID) { + IPW_DEBUG_MERGE("Network '%s (" MAC_FMT ")' excluded " + "because of hidden ESSID.\n", + escape_essid(network->ssid, network->ssid_len), + MAC_ARG(network->bssid)); + return 0; + } + + if (unlikely(roaming)) { + /* If we are roaming, then ensure check if this is a valid + * network to try and roam to */ + if ((network->ssid_len != match->network->ssid_len) || + memcmp(network->ssid, match->network->ssid, + network->ssid_len)) { + IPW_DEBUG_MERGE("Netowrk '%s (" MAC_FMT ")' excluded " + "because of non-network ESSID.\n", + escape_essid(network->ssid, + network->ssid_len), + MAC_ARG(network->bssid)); + return 0; + } + } else { + /* If an ESSID has been configured then compare the broadcast + * ESSID to ours */ + if ((priv->config & CFG_STATIC_ESSID) && + ((network->ssid_len != priv->essid_len) || + memcmp(network->ssid, priv->essid, + min(network->ssid_len, priv->essid_len)))) { + char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; + strncpy(escaped, + escape_essid(network->ssid, network->ssid_len), + sizeof(escaped)); + IPW_DEBUG_MERGE("Network '%s (" MAC_FMT ")' excluded " + "because of ESSID mismatch: '%s'.\n", + escaped, MAC_ARG(network->bssid), + escape_essid(priv->essid, + priv->essid_len)); + return 0; + } + } + + /* If the old network rate is better than this one, don't bother + * testing everything else. */ + + if (network->time_stamp[0] < match->network->time_stamp[0]) { + IPW_DEBUG_MERGE + ("Network '%s excluded because newer than current network.\n", + escape_essid(match->network->ssid, + match->network->ssid_len)); + return 0; + } else if (network->time_stamp[1] < match->network->time_stamp[1]) { + IPW_DEBUG_MERGE + ("Network '%s excluded because newer than current network.\n", + escape_essid(match->network->ssid, + match->network->ssid_len)); + return 0; + } + + /* Now go through and see if the requested network is valid... */ + if (priv->ieee->scan_age != 0 && + time_after(jiffies, network->last_scanned + priv->ieee->scan_age)) { + IPW_DEBUG_MERGE("Network '%s (" MAC_FMT ")' excluded " + "because of age: %lums.\n", + escape_essid(network->ssid, network->ssid_len), + MAC_ARG(network->bssid), + (jiffies - network->last_scanned) / (HZ / 100)); + return 0; + } + + if ((priv->config & CFG_STATIC_CHANNEL) && + (network->channel != priv->channel)) { + IPW_DEBUG_MERGE("Network '%s (" MAC_FMT ")' excluded " + "because of channel mismatch: %d != %d.\n", + escape_essid(network->ssid, network->ssid_len), + MAC_ARG(network->bssid), + network->channel, priv->channel); + return 0; + } + + /* Verify privacy compatability */ + if (((priv->capability & CAP_PRIVACY_ON) ? 1 : 0) != + ((network->capability & WLAN_CAPABILITY_PRIVACY) ? 1 : 0)) { + IPW_DEBUG_MERGE("Network '%s (" MAC_FMT ")' excluded " + "because of privacy mismatch: %s != %s.\n", + escape_essid(network->ssid, network->ssid_len), + MAC_ARG(network->bssid), + priv->capability & CAP_PRIVACY_ON ? "on" : + "off", + network->capability & + WLAN_CAPABILITY_PRIVACY ? "on" : "off"); + return 0; + } + + if (!memcmp(network->bssid, priv->bssid, ETH_ALEN)) { + IPW_DEBUG_MERGE("Network '%s (" MAC_FMT ")' excluded " + "because of the same BSSID match: " MAC_FMT + ".\n", escape_essid(network->ssid, + network->ssid_len), + MAC_ARG(network->bssid), MAC_ARG(priv->bssid)); + return 0; + } + + /* Filter out any incompatible freq / mode combinations */ + if (!ieee80211_is_valid_mode(priv->ieee, network->mode)) { + IPW_DEBUG_MERGE("Network '%s (" MAC_FMT ")' excluded " + "because of invalid frequency/mode " + "combination.\n", + escape_essid(network->ssid, network->ssid_len), + MAC_ARG(network->bssid)); + return 0; + } + + /* Ensure that the rates supported by the driver are compatible with + * this AP, including verification of basic rates (mandatory) */ + if (!ipw_compatible_rates(priv, network, &rates)) { + IPW_DEBUG_MERGE("Network '%s (" MAC_FMT ")' excluded " + "because configured rate mask excludes " + "AP mandatory rate.\n", + escape_essid(network->ssid, network->ssid_len), + MAC_ARG(network->bssid)); + return 0; + } + + if (rates.num_rates == 0) { + IPW_DEBUG_MERGE("Network '%s (" MAC_FMT ")' excluded " + "because of no compatible rates.\n", + escape_essid(network->ssid, network->ssid_len), + MAC_ARG(network->bssid)); + return 0; + } + + /* TODO: Perform any further minimal comparititive tests. We do not + * want to put too much policy logic here; intelligent scan selection + * should occur within a generic IEEE 802.11 user space tool. */ + + /* Set up 'new' AP to this network */ + ipw_copy_rates(&match->rates, &rates); + match->network = network; + IPW_DEBUG_MERGE("Network '%s (" MAC_FMT ")' is a viable match.\n", + escape_essid(network->ssid, network->ssid_len), + MAC_ARG(network->bssid)); + + return 1; +} + +static void ipw_merge_adhoc_network(void *data) +{ + struct ipw_priv *priv = data; + struct ieee80211_network *network = NULL; + struct ipw_network_match match = { + .network = priv->assoc_network + }; + + if ((priv->status & STATUS_ASSOCIATED) + && (priv->ieee->iw_mode == IW_MODE_ADHOC)) { + /* First pass through ROAM process -- look for a better + * network */ + unsigned long flags; + + spin_lock_irqsave(&priv->ieee->lock, flags); + list_for_each_entry(network, &priv->ieee->network_list, list) { + if (network != priv->assoc_network) + ipw_find_adhoc_network(priv, &match, network, + 1); + } + spin_unlock_irqrestore(&priv->ieee->lock, flags); + + if (match.network == priv->assoc_network) { + IPW_DEBUG_MERGE("No better ADHOC in this network to " + "merge to.\n"); + return; + } + + down(&priv->sem); + if ((priv->ieee->iw_mode == IW_MODE_ADHOC)) { + IPW_DEBUG_MERGE("remove network %s\n", + escape_essid(priv->essid, + priv->essid_len)); + ipw_remove_current_network(priv); + } + + ipw_disassociate(priv); + priv->assoc_network = match.network; + up(&priv->sem); + return; + } + +} + static int ipw_best_network(struct ipw_priv *priv, struct ipw_network_match *match, struct ieee80211_network *network, int roaming) @@ -4997,6 +5284,14 @@ static void ipw_adhoc_check(void *data) priv->assoc_request.beacon_interval); } +static void ipw_bg_adhoc_check(void *data) +{ + struct ipw_priv *priv = data; + down(&priv->sem); + ipw_adhoc_check(data); + up(&priv->sem); +} + #ifdef CONFIG_IPW_DEBUG static void ipw_debug_config(struct ipw_priv *priv) { @@ -5181,10 +5476,9 @@ static int ipw_request_scan(struct ipw_priv *priv) /* If we are roaming, then make this a directed scan for the current * network. Otherwise, ensure that every other scan is a fast * channel hop scan */ - if ((priv->status & STATUS_ROAMING) - || (!(priv->status & STATUS_ASSOCIATED) - && (priv->config & CFG_STATIC_ESSID) - && (le32_to_cpu(scan.full_scan_index) % 2))) { + if ((priv->status & STATUS_ROAMING) || (!(priv->status & STATUS_ASSOCIATED) && (priv->config & CFG_STATIC_ESSID) && (le32_to_cpu(scan.full_scan_index) % 2))) { /* || ( + (priv->status & STATUS_ASSOCIATED) && + (priv->ieee->iw_mode == IW_MODE_ADHOC))) { */ err = ipw_send_ssid(priv, priv->essid, priv->essid_len); if (err) { IPW_DEBUG_HC @@ -5257,6 +5551,22 @@ static int ipw_request_scan(struct ipw_priv *priv) return 0; } +static void ipw_bg_request_scan(void *data) +{ + struct ipw_priv *priv = data; + down(&priv->sem); + ipw_request_scan(data); + up(&priv->sem); +} + +static void ipw_bg_abort_scan(void *data) +{ + struct ipw_priv *priv = data; + down(&priv->sem); + ipw_abort_scan(data); + up(&priv->sem); +} + /* Support for wpa_supplicant. Will be replaced with WEXT once * they get WPA support. */ @@ -5473,8 +5783,7 @@ void ipw_wpa_assoc_frame(struct ipw_priv *priv, char *wpa_ie, int wpa_ie_len) /* make sure WPA is enabled */ ipw_wpa_enable(priv, 1); - if (priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) - ipw_disassociate(priv); + ipw_disassociate(priv); } static int ipw_wpa_set_wpa_ie(struct net_device *dev, @@ -5830,6 +6139,12 @@ static int ipw_associate_network(struct ipw_priv *priv, priv->sys_config.dot11g_auto_detection = 1; else priv->sys_config.dot11g_auto_detection = 0; + + if (priv->ieee->iw_mode == IW_MODE_ADHOC) + priv->sys_config.answer_broadcast_ssid_probe = 1; + else + priv->sys_config.answer_broadcast_ssid_probe = 0; + err = ipw_send_system_config(priv, &priv->sys_config); if (err) { IPW_DEBUG_HC("Attempt to send sys config command failed.\n"); @@ -5933,7 +6248,15 @@ static void ipw_roam(void *data) priv->status &= ~STATUS_ROAMING; } -static void ipw_associate(void *data) +static void ipw_bg_roam(void *data) +{ + struct ipw_priv *priv = data; + down(&priv->sem); + ipw_roam(data); + up(&priv->sem); +} + +static int ipw_associate(void *data) { struct ipw_priv *priv = data; @@ -5945,11 +6268,23 @@ static void ipw_associate(void *data) struct list_head *element; unsigned long flags; + if (priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { + IPW_DEBUG_ASSOC + ("Not attempting association (already in progress)\n"); + return 0; + } + + if (!ipw_is_init(priv) || (priv->status & STATUS_SCANNING)) { + IPW_DEBUG_ASSOC + ("Not attempting association (scanning or not initialized)\n"); + return 0; + } + if (!(priv->config & CFG_ASSOCIATE) && !(priv->config & (CFG_STATIC_ESSID | CFG_STATIC_CHANNEL | CFG_STATIC_BSSID))) { IPW_DEBUG_ASSOC("Not attempting association (associate=0)\n"); - return; + return 0; } /* Protect our use of the network_list */ @@ -5984,10 +6319,20 @@ static void ipw_associate(void *data) queue_delayed_work(priv->workqueue, &priv->request_scan, SCAN_INTERVAL); - return; + return 0; } ipw_associate_network(priv, network, rates, 0); + + return 1; +} + +static void ipw_bg_associate(void *data) +{ + struct ipw_priv *priv = data; + down(&priv->sem); + ipw_associate(data); + up(&priv->sem); } static inline void ipw_handle_data_packet(struct ipw_priv *priv, @@ -6037,6 +6382,10 @@ static inline int is_network_packet(struct ipw_priv *priv, * this network, discarding packets coming from ourselves */ switch (priv->ieee->iw_mode) { case IW_MODE_ADHOC: /* Header: Dest. | Source | BSSID */ + /* packets from our adapter are dropped (echo) */ + if (!memcmp(header->addr2, priv->net_dev->dev_addr, ETH_ALEN)) + return 0; + /* {broad,multi}cast packets to our IBSS go through */ if (is_broadcast_ether_addr(header->addr1) || is_multicast_ether_addr(header->addr1)) @@ -6045,9 +6394,12 @@ static inline int is_network_packet(struct ipw_priv *priv, /* packets to our adapter go through */ return !memcmp(header->addr1, priv->net_dev->dev_addr, ETH_ALEN); - break; case IW_MODE_INFRA: /* Header: Dest. | AP{BSSID} | Source */ + /* packets from our adapter are dropped (echo) */ + if (!memcmp(header->addr3, priv->net_dev->dev_addr, ETH_ALEN)) + return 0; + /* {broad,multi}cast packets to our IBSS go through */ if (is_broadcast_ether_addr(header->addr1) || is_multicast_ether_addr(header->addr1)) @@ -6056,7 +6408,6 @@ static inline int is_network_packet(struct ipw_priv *priv, /* packets to our adapter go through */ return !memcmp(header->addr1, priv->net_dev->dev_addr, ETH_ALEN); - break; } return 1; @@ -6101,9 +6452,13 @@ static void ipw_rx(struct ipw_priv *priv) switch (pkt->header.message_type) { case RX_FRAME_TYPE: /* 802.11 frame */ { struct ieee80211_rx_stats stats = { - .rssi = pkt->u.frame.rssi_dbm - + .rssi = + le16_to_cpu(pkt->u.frame.rssi_dbm) - IPW_RSSI_TO_DBM, - /* .signal = le16_to_cpu(pkt->u.frame.signal), */ + .signal = + le16_to_cpu(pkt->u.frame.signal), + .noise = + le16_to_cpu(pkt->u.frame.noise), .rate = pkt->u.frame.rate, .mac_time = jiffies, .received_channel = @@ -6120,6 +6475,8 @@ static void ipw_rx(struct ipw_priv *priv) stats.mask |= IEEE80211_STATMASK_RSSI; if (stats.signal != 0) stats.mask |= IEEE80211_STATMASK_SIGNAL; + if (stats.noise != 0) + stats.mask |= IEEE80211_STATMASK_NOISE; if (stats.rate != 0) stats.mask |= IEEE80211_STATMASK_RATE; @@ -6179,11 +6536,34 @@ static void ipw_rx(struct ipw_priv *priv) || (WLAN_FC_GET_STYPE (le16_to_cpu(header->frame_ctl)) - == IEEE80211_STYPE_BEACON)) - && !memcmp(header->addr3, - priv->bssid, ETH_ALEN)) - ipw_add_station(priv, - header->addr2); + == IEEE80211_STYPE_BEACON))) { + if (!memcmp + (header->addr3, priv->bssid, + ETH_ALEN)) + ipw_add_station(priv, + header-> + addr2); + else { + struct + ieee80211_probe_response + *beacon; + beacon = + (struct + ieee80211_probe_response + *)header; + if (le16_to_cpu + (beacon-> + capability) & + WLAN_CAPABILITY_IBSS) + { + queue_work + (priv-> + workqueue, + &priv-> + merge_networks); + } + } + } break; case IEEE80211_FTYPE_CTL: @@ -6262,14 +6642,16 @@ static int ipw_wx_get_name(struct net_device *dev, union iwreq_data *wrqu, char *extra) { struct ipw_priv *priv = ieee80211_priv(dev); - if (priv->status & STATUS_RF_KILL_MASK) { + down(&priv->sem); + if (priv->status & STATUS_RF_KILL_MASK) strcpy(wrqu->name, "radio off"); - } else if (!(priv->status & STATUS_ASSOCIATED)) + else if (!(priv->status & STATUS_ASSOCIATED)) strcpy(wrqu->name, "unassociated"); else snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11%c", ipw_modes[priv->assoc_request.ieee_mode]); IPW_DEBUG_WX("Name: %s\n", wrqu->name); + up(&priv->sem); return 0; } @@ -6278,13 +6660,9 @@ static int ipw_set_channel(struct ipw_priv *priv, u8 channel) if (channel == 0) { IPW_DEBUG_INFO("Setting channel to ANY (0)\n"); priv->config &= ~CFG_STATIC_CHANNEL; - if (!(priv->status & (STATUS_SCANNING | STATUS_ASSOCIATED | - STATUS_ASSOCIATING))) { - IPW_DEBUG_ASSOC("Attempting to associate with new " - "parameters.\n"); - ipw_associate(priv); - } - + IPW_DEBUG_ASSOC("Attempting to associate with new " + "parameters.\n"); + ipw_associate(priv); return 0; } @@ -6299,12 +6677,9 @@ static int ipw_set_channel(struct ipw_priv *priv, u8 channel) IPW_DEBUG_INFO("Setting channel to %i\n", (int)channel); priv->channel = channel; - /* If we are currently associated, or trying to associate - * then see if this is a new channel (causing us to disassociate) */ - if (priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { - IPW_DEBUG_ASSOC("Disassociating due to channel change.\n"); - ipw_disassociate(priv); - } else if (!(priv->status & (STATUS_SCANNING))) + /* Network configuration changed -- force [re]association */ + IPW_DEBUG_ASSOC("[re]association triggered due to channel change.\n"); + if (!ipw_disassociate(priv)) ipw_associate(priv); return 0; @@ -6316,6 +6691,7 @@ static int ipw_wx_set_freq(struct net_device *dev, { struct ipw_priv *priv = ieee80211_priv(dev); struct iw_freq *fwrq = &wrqu->freq; + int ret = 0; /* if setting by freq convert to channel */ if (fwrq->e == 1) { @@ -6337,7 +6713,10 @@ static int ipw_wx_set_freq(struct net_device *dev, return -EOPNOTSUPP; IPW_DEBUG_WX("SET Freq/Channel -> %d \n", fwrq->m); - return ipw_set_channel(priv, (u8) fwrq->m); + down(&priv->sem); + ret = ipw_set_channel(priv, (u8) fwrq->m); + up(&priv->sem); + return ret; } static int ipw_wx_get_freq(struct net_device *dev, @@ -6350,12 +6729,14 @@ static int ipw_wx_get_freq(struct net_device *dev, /* If we are associated, trying to associate, or have a statically * configured CHANNEL then return that; otherwise return ANY */ + down(&priv->sem); if (priv->config & CFG_STATIC_CHANNEL || priv->status & (STATUS_ASSOCIATING | STATUS_ASSOCIATED)) wrqu->freq.m = priv->channel; else wrqu->freq.m = 0; + up(&priv->sem); IPW_DEBUG_WX("GET Freq/Channel -> %d \n", priv->channel); return 0; } @@ -6368,9 +6749,11 @@ static int ipw_wx_set_mode(struct net_device *dev, int err = 0; IPW_DEBUG_WX("Set MODE: %d\n", wrqu->mode); - - if (wrqu->mode == priv->ieee->iw_mode) + down(&priv->sem); + if (wrqu->mode == priv->ieee->iw_mode) { + up(&priv->sem); return 0; + } switch (wrqu->mode) { #ifdef CONFIG_IPW_MONITOR @@ -6383,6 +6766,7 @@ static int ipw_wx_set_mode(struct net_device *dev, wrqu->mode = IW_MODE_INFRA; break; default: + up(&priv->sem); return -EINVAL; } @@ -6407,8 +6791,9 @@ static int ipw_wx_set_mode(struct net_device *dev, #endif priv->ieee->iw_mode = wrqu->mode; - queue_work(priv->workqueue, &priv->adapter_restart); + queue_work(priv->workqueue, &priv->adapter_restart); + up(&priv->sem); return err; } @@ -6417,10 +6802,10 @@ static int ipw_wx_get_mode(struct net_device *dev, union iwreq_data *wrqu, char *extra) { struct ipw_priv *priv = ieee80211_priv(dev); - + down(&priv->sem); wrqu->mode = priv->ieee->iw_mode; IPW_DEBUG_WX("Get MODE -> %d\n", wrqu->mode); - + up(&priv->sem); return 0; } @@ -6466,7 +6851,7 @@ static int ipw_wx_get_range(struct net_device *dev, range->max_qual.qual = 100; /* TODO: Find real max RSSI and stick here */ range->max_qual.level = 0; - range->max_qual.noise = 0; + range->max_qual.noise = priv->ieee->worst_rssi + 0x100; range->max_qual.updated = 7; /* Updated all three */ range->avg_qual.qual = 70; @@ -6474,7 +6859,7 @@ static int ipw_wx_get_range(struct net_device *dev, range->avg_qual.level = 0; /* FIXME to real average level */ range->avg_qual.noise = 0; range->avg_qual.updated = 7; /* Updated all three */ - + down(&priv->sem); range->num_bitrates = min(priv->rates.num_rates, (u8) IW_MAX_BITRATES); for (i = 0; i < range->num_bitrates; i++) @@ -6507,7 +6892,7 @@ static int ipw_wx_get_range(struct net_device *dev, break; } range->num_frequency = val; - + up(&priv->sem); IPW_DEBUG_WX("GET Range\n"); return 0; } @@ -6527,25 +6912,23 @@ static int ipw_wx_set_wap(struct net_device *dev, if (wrqu->ap_addr.sa_family != ARPHRD_ETHER) return -EINVAL; - + down(&priv->sem); if (!memcmp(any, wrqu->ap_addr.sa_data, ETH_ALEN) || !memcmp(off, wrqu->ap_addr.sa_data, ETH_ALEN)) { /* we disable mandatory BSSID association */ IPW_DEBUG_WX("Setting AP BSSID to ANY\n"); priv->config &= ~CFG_STATIC_BSSID; - if (!(priv->status & (STATUS_SCANNING | STATUS_ASSOCIATED | - STATUS_ASSOCIATING))) { - IPW_DEBUG_ASSOC("Attempting to associate with new " - "parameters.\n"); - ipw_associate(priv); - } - + IPW_DEBUG_ASSOC("Attempting to associate with new " + "parameters.\n"); + ipw_associate(priv); + up(&priv->sem); return 0; } priv->config |= CFG_STATIC_BSSID; if (!memcmp(priv->bssid, wrqu->ap_addr.sa_data, ETH_ALEN)) { IPW_DEBUG_WX("BSSID set to current BSSID.\n"); + up(&priv->sem); return 0; } @@ -6554,14 +6937,12 @@ static int ipw_wx_set_wap(struct net_device *dev, memcpy(priv->bssid, wrqu->ap_addr.sa_data, ETH_ALEN); - /* If we are currently associated, or trying to associate - * then see if this is a new BSSID (causing us to disassociate) */ - if (priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { - IPW_DEBUG_ASSOC("Disassociating due to BSSID change.\n"); - ipw_disassociate(priv); - } else if (!(priv->status & (STATUS_SCANNING))) + /* Network configuration changed -- force [re]association */ + IPW_DEBUG_ASSOC("[re]association triggered due to BSSID change.\n"); + if (!ipw_disassociate(priv)) ipw_associate(priv); + up(&priv->sem); return 0; } @@ -6572,6 +6953,7 @@ static int ipw_wx_get_wap(struct net_device *dev, struct ipw_priv *priv = ieee80211_priv(dev); /* If we are associated, trying to associate, or have a statically * configured BSSID then return that; otherwise return ANY */ + down(&priv->sem); if (priv->config & CFG_STATIC_BSSID || priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { wrqu->ap_addr.sa_family = ARPHRD_ETHER; @@ -6581,6 +6963,7 @@ static int ipw_wx_get_wap(struct net_device *dev, IPW_DEBUG_WX("Getting WAP BSSID: " MAC_FMT "\n", MAC_ARG(wrqu->ap_addr.sa_data)); + up(&priv->sem); return 0; } @@ -6591,7 +6974,7 @@ static int ipw_wx_set_essid(struct net_device *dev, struct ipw_priv *priv = ieee80211_priv(dev); char *essid = ""; /* ANY */ int length = 0; - + down(&priv->sem); if (wrqu->essid.flags && wrqu->essid.length) { length = wrqu->essid.length - 1; essid = extra; @@ -6599,13 +6982,12 @@ static int ipw_wx_set_essid(struct net_device *dev, if (length == 0) { IPW_DEBUG_WX("Setting ESSID to ANY\n"); priv->config &= ~CFG_STATIC_ESSID; - if (!(priv->status & (STATUS_SCANNING | STATUS_ASSOCIATED | - STATUS_ASSOCIATING))) { + if (!(priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING))) { IPW_DEBUG_ASSOC("Attempting to associate with new " "parameters.\n"); ipw_associate(priv); } - + up(&priv->sem); return 0; } @@ -6615,6 +6997,7 @@ static int ipw_wx_set_essid(struct net_device *dev, if (priv->essid_len == length && !memcmp(priv->essid, extra, length)) { IPW_DEBUG_WX("ESSID set to current ESSID.\n"); + up(&priv->sem); return 0; } @@ -6624,14 +7007,12 @@ static int ipw_wx_set_essid(struct net_device *dev, priv->essid_len = length; memcpy(priv->essid, essid, priv->essid_len); - /* If we are currently associated, or trying to associate - * then see if this is a new ESSID (causing us to disassociate) */ - if (priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { - IPW_DEBUG_ASSOC("Disassociating due to ESSID change.\n"); - ipw_disassociate(priv); - } else if (!(priv->status & (STATUS_SCANNING))) + /* Network configuration changed -- force [re]association */ + IPW_DEBUG_ASSOC("[re]association triggered due to ESSID change.\n"); + if (!ipw_disassociate(priv)) ipw_associate(priv); + up(&priv->sem); return 0; } @@ -6643,6 +7024,7 @@ static int ipw_wx_get_essid(struct net_device *dev, /* If we are associated, trying to associate, or have a statically * configured ESSID then return that; otherwise return ANY */ + down(&priv->sem); if (priv->config & CFG_STATIC_ESSID || priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { IPW_DEBUG_WX("Getting essid: '%s'\n", @@ -6655,7 +7037,7 @@ static int ipw_wx_get_essid(struct net_device *dev, wrqu->essid.length = 0; wrqu->essid.flags = 0; /* active */ } - + up(&priv->sem); return 0; } @@ -6668,11 +7050,12 @@ static int ipw_wx_set_nick(struct net_device *dev, IPW_DEBUG_WX("Setting nick to '%s'\n", extra); if (wrqu->data.length > IW_ESSID_MAX_SIZE) return -E2BIG; - + down(&priv->sem); wrqu->data.length = min((size_t) wrqu->data.length, sizeof(priv->nick)); memset(priv->nick, 0, sizeof(priv->nick)); memcpy(priv->nick, extra, wrqu->data.length); IPW_DEBUG_TRACE("<<\n"); + up(&priv->sem); return 0; } @@ -6683,9 +7066,11 @@ static int ipw_wx_get_nick(struct net_device *dev, { struct ipw_priv *priv = ieee80211_priv(dev); IPW_DEBUG_WX("Getting nick\n"); + down(&priv->sem); wrqu->data.length = strlen(priv->nick) + 1; memcpy(extra, priv->nick, wrqu->data.length); wrqu->data.flags = 1; /* active */ + up(&priv->sem); return 0; } @@ -6778,25 +7163,26 @@ static int ipw_wx_set_rate(struct net_device *dev, apply: IPW_DEBUG_WX("Setting rate mask to 0x%08X [%s]\n", mask, fixed ? "fixed" : "sub-rates"); - + down(&priv->sem); if (mask == IEEE80211_DEFAULT_RATES_MASK) priv->config &= ~CFG_FIXED_RATE; else priv->config |= CFG_FIXED_RATE; - if (priv->rates_mask != mask) { - priv->rates_mask = mask; - /* If we are already associated or are currently trying to - * associate, disassociate and try again */ - if ((priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING))) { - IPW_DEBUG_ASSOC("Disassociating due to RATE change.\n"); - ipw_disassociate(priv); - } else if (!(priv->status & (STATUS_SCANNING))) { - /* We are not yet associated, so kick one off... */ - ipw_associate(priv); - } + if (priv->rates_mask == mask) { + IPW_DEBUG_WX("Mask set to current mask.\n"); + up(&priv->sem); + return 0; } + priv->rates_mask = mask; + + /* Network configuration changed -- force [re]association */ + IPW_DEBUG_ASSOC("[re]association triggered due to rates change.\n"); + if (!ipw_disassociate(priv)) + ipw_associate(priv); + + up(&priv->sem); return 0; } @@ -6805,8 +7191,9 @@ static int ipw_wx_get_rate(struct net_device *dev, union iwreq_data *wrqu, char *extra) { struct ipw_priv *priv = ieee80211_priv(dev); + down(&priv->sem); wrqu->bitrate.value = priv->last_rate; - + up(&priv->sem); IPW_DEBUG_WX("GET Rate -> %d \n", wrqu->bitrate.value); return 0; } @@ -6816,18 +7203,20 @@ static int ipw_wx_set_rts(struct net_device *dev, union iwreq_data *wrqu, char *extra) { struct ipw_priv *priv = ieee80211_priv(dev); - + down(&priv->sem); if (wrqu->rts.disabled) priv->rts_threshold = DEFAULT_RTS_THRESHOLD; else { if (wrqu->rts.value < MIN_RTS_THRESHOLD || - wrqu->rts.value > MAX_RTS_THRESHOLD) + wrqu->rts.value > MAX_RTS_THRESHOLD) { + up(&priv->sem); return -EINVAL; - + } priv->rts_threshold = wrqu->rts.value; } ipw_send_rts_threshold(priv, priv->rts_threshold); + up(&priv->sem); IPW_DEBUG_WX("SET RTS Threshold -> %d \n", priv->rts_threshold); return 0; } @@ -6837,10 +7226,11 @@ static int ipw_wx_get_rts(struct net_device *dev, union iwreq_data *wrqu, char *extra) { struct ipw_priv *priv = ieee80211_priv(dev); + down(&priv->sem); wrqu->rts.value = priv->rts_threshold; wrqu->rts.fixed = 0; /* no auto select */ wrqu->rts.disabled = (wrqu->rts.value == DEFAULT_RTS_THRESHOLD); - + up(&priv->sem); IPW_DEBUG_WX("GET RTS Threshold -> %d \n", wrqu->rts.value); return 0; } @@ -6852,15 +7242,21 @@ static int ipw_wx_set_txpow(struct net_device *dev, struct ipw_priv *priv = ieee80211_priv(dev); struct ipw_tx_power tx_power; int i; - - if (ipw_radio_kill_sw(priv, wrqu->power.disabled)) + down(&priv->sem); + if (ipw_radio_kill_sw(priv, wrqu->power.disabled)) { + up(&priv->sem); return -EINPROGRESS; + } - if (wrqu->power.flags != IW_TXPOW_DBM) + if (wrqu->power.flags != IW_TXPOW_DBM) { + up(&priv->sem); return -EINVAL; + } - if ((wrqu->power.value > 20) || (wrqu->power.value < -12)) + if ((wrqu->power.value > 20) || (wrqu->power.value < -12)) { + up(&priv->sem); return -EINVAL; + } priv->tx_power = wrqu->power.value; @@ -6881,9 +7277,11 @@ static int ipw_wx_set_txpow(struct net_device *dev, if (ipw_send_tx_power(priv, &tx_power)) goto error; + up(&priv->sem); return 0; error: + up(&priv->sem); return -EIO; } @@ -6892,11 +7290,12 @@ static int ipw_wx_get_txpow(struct net_device *dev, union iwreq_data *wrqu, char *extra) { struct ipw_priv *priv = ieee80211_priv(dev); - + down(&priv->sem); wrqu->power.value = priv->tx_power; wrqu->power.fixed = 1; wrqu->power.flags = IW_TXPOW_DBM; wrqu->power.disabled = (priv->status & STATUS_RF_KILL_MASK) ? 1 : 0; + up(&priv->sem); IPW_DEBUG_WX("GET TX Power -> %s %d \n", wrqu->power.disabled ? "ON" : "OFF", wrqu->power.value); @@ -6909,7 +7308,7 @@ static int ipw_wx_set_frag(struct net_device *dev, union iwreq_data *wrqu, char *extra) { struct ipw_priv *priv = ieee80211_priv(dev); - + down(&priv->sem); if (wrqu->frag.disabled) priv->ieee->fts = DEFAULT_FTS; else { @@ -6921,6 +7320,7 @@ static int ipw_wx_set_frag(struct net_device *dev, } ipw_send_frag_threshold(priv, wrqu->frag.value); + up(&priv->sem); IPW_DEBUG_WX("SET Frag Threshold -> %d \n", wrqu->frag.value); return 0; } @@ -6930,10 +7330,11 @@ static int ipw_wx_get_frag(struct net_device *dev, union iwreq_data *wrqu, char *extra) { struct ipw_priv *priv = ieee80211_priv(dev); + down(&priv->sem); wrqu->frag.value = priv->ieee->fts; wrqu->frag.fixed = 0; /* no auto select */ wrqu->frag.disabled = (wrqu->frag.value == DEFAULT_FTS); - + up(&priv->sem); IPW_DEBUG_WX("GET Frag Threshold -> %d \n", wrqu->frag.value); return 0; @@ -6961,8 +7362,12 @@ static int ipw_wx_set_scan(struct net_device *dev, { struct ipw_priv *priv = ieee80211_priv(dev); IPW_DEBUG_WX("Start scan\n"); - if (ipw_request_scan(priv)) + down(&priv->sem); + if (ipw_request_scan(priv)) { + up(&priv->sem); return -EIO; + } + up(&priv->sem); return 0; } @@ -6996,16 +7401,17 @@ static int ipw_wx_set_power(struct net_device *dev, { struct ipw_priv *priv = ieee80211_priv(dev); int err; - + down(&priv->sem); if (wrqu->power.disabled) { priv->power_mode = IPW_POWER_LEVEL(priv->power_mode); err = ipw_send_power_mode(priv, IPW_POWER_MODE_CAM); if (err) { IPW_DEBUG_WX("failed setting power mode.\n"); + up(&priv->sem); return err; } IPW_DEBUG_WX("SET Power Management Mode -> off\n"); - + up(&priv->sem); return 0; } @@ -7017,6 +7423,7 @@ static int ipw_wx_set_power(struct net_device *dev, default: /* Otherwise we don't support it */ IPW_DEBUG_WX("SET PM Mode: %X not supported.\n", wrqu->power.flags); + up(&priv->sem); return -EOPNOTSUPP; } @@ -7029,11 +7436,12 @@ static int ipw_wx_set_power(struct net_device *dev, err = ipw_send_power_mode(priv, IPW_POWER_LEVEL(priv->power_mode)); if (err) { IPW_DEBUG_WX("failed setting power mode.\n"); + up(&priv->sem); return err; } IPW_DEBUG_WX("SET Power Management Mode -> 0x%02X\n", priv->power_mode); - + up(&priv->sem); return 0; } @@ -7042,12 +7450,13 @@ static int ipw_wx_get_power(struct net_device *dev, union iwreq_data *wrqu, char *extra) { struct ipw_priv *priv = ieee80211_priv(dev); - + down(&priv->sem); if (!(priv->power_mode & IPW_POWER_ENABLED)) wrqu->power.disabled = 1; else wrqu->power.disabled = 0; + up(&priv->sem); IPW_DEBUG_WX("GET Power Management Mode -> %02X\n", priv->power_mode); return 0; @@ -7060,7 +7469,7 @@ static int ipw_wx_set_powermode(struct net_device *dev, struct ipw_priv *priv = ieee80211_priv(dev); int mode = *(int *)extra; int err; - + down(&priv->sem); if ((mode < 1) || (mode > IPW_POWER_LIMIT)) { mode = IPW_POWER_AC; priv->power_mode = mode; @@ -7073,10 +7482,11 @@ static int ipw_wx_set_powermode(struct net_device *dev, if (err) { IPW_DEBUG_WX("failed setting power mode.\n"); + up(&priv->sem); return err; } } - + up(&priv->sem); return 0; } @@ -7125,7 +7535,7 @@ static int ipw_wx_set_wireless_mode(struct net_device *dev, IPW_WARNING("Attempt to set invalid wireless mode: %d\n", mode); return -EINVAL; } - + down(&priv->sem); if (priv->adapter == IPW_2915ABG) { priv->ieee->abg_true = 1; if (mode & IEEE_A) { @@ -7137,6 +7547,7 @@ static int ipw_wx_set_wireless_mode(struct net_device *dev, if (mode & IEEE_A) { IPW_WARNING("Attempt to set 2200BG into " "802.11a mode\n"); + up(&priv->sem); return -EINVAL; } @@ -7160,16 +7571,12 @@ static int ipw_wx_set_wireless_mode(struct net_device *dev, priv->ieee->modulation = modulation; init_supported_rates(priv, &priv->rates); - /* If we are currently associated, or trying to associate - * then see if this is a new configuration (causing us to - * disassociate) */ - if (priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { - /* The resulting association will trigger - * the new rates to be sent to the device */ - IPW_DEBUG_ASSOC("Disassociating due to mode change.\n"); - ipw_disassociate(priv); - } else + /* Network configuration changed -- force [re]association */ + IPW_DEBUG_ASSOC("[re]association triggered due to mode change.\n"); + if (!ipw_disassociate(priv)) { ipw_send_supported_rates(priv, &priv->rates); + ipw_associate(priv); + } /* Update the band LEDs */ ipw_led_band_on(priv); @@ -7177,6 +7584,7 @@ static int ipw_wx_set_wireless_mode(struct net_device *dev, IPW_DEBUG_WX("PRIV SET MODE: %c%c%c\n", mode & IEEE_A ? 'a' : '.', mode & IEEE_B ? 'b' : '.', mode & IEEE_G ? 'g' : '.'); + up(&priv->sem); return 0; } @@ -7185,7 +7593,7 @@ static int ipw_wx_get_wireless_mode(struct net_device *dev, union iwreq_data *wrqu, char *extra) { struct ipw_priv *priv = ieee80211_priv(dev); - + down(&priv->sem); switch (priv->ieee->mode) { case IEEE_A: strncpy(extra, "802.11a (1)", MAX_WX_STRING); @@ -7216,6 +7624,7 @@ static int ipw_wx_get_wireless_mode(struct net_device *dev, IPW_DEBUG_WX("PRIV GET MODE: %s\n", extra); wrqu->data.length = strlen(extra) + 1; + up(&priv->sem); return 0; } @@ -7226,18 +7635,17 @@ static int ipw_wx_set_preamble(struct net_device *dev, { struct ipw_priv *priv = ieee80211_priv(dev); int mode = *(int *)extra; - + down(&priv->sem); /* Switching from SHORT -> LONG requires a disassociation */ if (mode == 1) { if (!(priv->config & CFG_PREAMBLE_LONG)) { priv->config |= CFG_PREAMBLE_LONG; - if (priv->status & - (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { - IPW_DEBUG_ASSOC - ("Disassociating due to preamble " - "change.\n"); - ipw_disassociate(priv); - } + + /* Network configuration changed -- force [re]association */ + IPW_DEBUG_ASSOC + ("[re]association triggered due to preamble change.\n"); + if (!ipw_disassociate(priv)) + ipw_associate(priv); } goto done; } @@ -7246,10 +7654,11 @@ static int ipw_wx_set_preamble(struct net_device *dev, priv->config &= ~CFG_PREAMBLE_LONG; goto done; } - + up(&priv->sem); return -EINVAL; done: + up(&priv->sem); return 0; } @@ -7258,12 +7667,12 @@ static int ipw_wx_get_preamble(struct net_device *dev, union iwreq_data *wrqu, char *extra) { struct ipw_priv *priv = ieee80211_priv(dev); - + down(&priv->sem); if (priv->config & CFG_PREAMBLE_LONG) snprintf(wrqu->name, IFNAMSIZ, "long (1)"); else snprintf(wrqu->name, IFNAMSIZ, "auto (0)"); - + up(&priv->sem); return 0; } @@ -7275,7 +7684,7 @@ static int ipw_wx_set_monitor(struct net_device *dev, struct ipw_priv *priv = ieee80211_priv(dev); int *parms = (int *)extra; int enable = (parms[0] > 0); - + down(&priv->sem); IPW_DEBUG_WX("SET MONITOR: %d %d\n", enable, parms[1]); if (enable) { if (priv->ieee->iw_mode != IW_MODE_MONITOR) { @@ -7285,11 +7694,14 @@ static int ipw_wx_set_monitor(struct net_device *dev, ipw_set_channel(priv, parms[1]); } else { - if (priv->ieee->iw_mode != IW_MODE_MONITOR) + if (priv->ieee->iw_mode != IW_MODE_MONITOR) { + up(&priv->sem); return 0; + } priv->net_dev->type = ARPHRD_ETHER; queue_work(priv->workqueue, &priv->adapter_restart); } + up(&priv->sem); return 0; } @@ -7473,7 +7885,7 @@ static inline void init_sys_config(struct ipw_sys_config *sys_config) sys_config->dot11g_auto_detection = 0; sys_config->enable_cts_to_self = 0; sys_config->bt_coexist_collision_thr = 0; - sys_config->pass_noise_stats_to_host = 0; //1 -- fix for 256 + sys_config->pass_noise_stats_to_host = 1; //1 -- fix for 256 } static int ipw_net_open(struct net_device *dev) @@ -7481,9 +7893,11 @@ static int ipw_net_open(struct net_device *dev) struct ipw_priv *priv = ieee80211_priv(dev); IPW_DEBUG_INFO("dev->open\n"); /* we should be verifying the device is ready to be opened */ + down(&priv->sem); if (!(priv->status & STATUS_RF_KILL_MASK) && (priv->status & STATUS_ASSOCIATED)) netif_start_queue(dev); + up(&priv->sem); return 0; } @@ -7511,6 +7925,7 @@ static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb) struct clx2_queue *q = &txq->q; u8 id, hdr_len, unicast; u16 remaining_bytes; + int fc; switch (priv->ieee->iw_mode) { case IW_MODE_ADHOC: @@ -7562,6 +7977,9 @@ static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb) if (priv->assoc_request.preamble_length == DCT_FLAG_SHORT_PREAMBLE) tfd->u.data.tx_flags |= DCT_FLAG_SHORT_PREAMBLE; + fc = le16_to_cpu(hdr->frame_ctl); + hdr->frame_ctl = cpu_to_le16(fc & ~IEEE80211_FCTL_MOREFRAGS); + memcpy(&tfd->u.data.tfd.tfd_24.mchdr, hdr, hdr_len); /* payload */ @@ -7644,7 +8062,6 @@ static int ipw_net_hard_start_xmit(struct ieee80211_txb *txb, unsigned long flags; IPW_DEBUG_TX("dev->xmit(%d bytes)\n", txb->payload_size); - spin_lock_irqsave(&priv->lock, flags); if (!(priv->status & STATUS_ASSOCIATED)) { @@ -7655,13 +8072,15 @@ static int ipw_net_hard_start_xmit(struct ieee80211_txb *txb, } ipw_tx_skb(priv, txb); + spin_unlock_irqrestore(&priv->lock, flags); ipw_led_activity_on(priv); - spin_unlock_irqrestore(&priv->lock, flags); +// up(&priv->sem); return 0; fail_unlock: spin_unlock_irqrestore(&priv->lock, flags); +// up(&priv->sem); return 1; } @@ -7685,11 +8104,13 @@ static int ipw_net_set_mac_address(struct net_device *dev, void *p) struct sockaddr *addr = p; if (!is_valid_ether_addr(addr->sa_data)) return -EADDRNOTAVAIL; + down(&priv->sem); priv->config |= CFG_CUSTOM_MAC; memcpy(priv->mac_addr, addr->sa_data, ETH_ALEN); printk(KERN_INFO "%s: Setting MAC to " MAC_FMT "\n", priv->net_dev->name, MAC_ARG(priv->mac_addr)); queue_work(priv->workqueue, &priv->adapter_restart); + up(&priv->sem); return 0; } @@ -7733,8 +8154,9 @@ static int ipw_ethtool_get_eeprom(struct net_device *dev, if (eeprom->offset + eeprom->len > CX2_EEPROM_IMAGE_SIZE) return -EINVAL; - + down(&p->sem); memcpy(bytes, &((u8 *) p->eeprom)[eeprom->offset], eeprom->len); + up(&p->sem); return 0; } @@ -7746,12 +8168,12 @@ static int ipw_ethtool_set_eeprom(struct net_device *dev, if (eeprom->offset + eeprom->len > CX2_EEPROM_IMAGE_SIZE) return -EINVAL; - + down(&p->sem); memcpy(&((u8 *) p->eeprom)[eeprom->offset], bytes, eeprom->len); for (i = IPW_EEPROM_DATA; i < IPW_EEPROM_DATA + CX2_EEPROM_IMAGE_SIZE; i++) ipw_write8(p, i, p->eeprom[i]); - + up(&p->sem); return 0; } @@ -7775,6 +8197,8 @@ static irqreturn_t ipw_isr(int irq, void *data, struct pt_regs *regs) if (!(priv->status & STATUS_INT_ENABLED)) { /* Shared IRQ */ +// ipw_write32(priv, CX2_INTA_RW, CX2_INTA_MASK_ALL); +// return IRQ_HANDLED; goto none; } @@ -7843,6 +8267,14 @@ static void ipw_rf_kill(void *adapter) spin_unlock_irqrestore(&priv->lock, flags); } +static void ipw_bg_rf_kill(void *data) +{ + struct ipw_priv *priv = data; + down(&priv->sem); + ipw_rf_kill(data); + up(&priv->sem); +} + void ipw_link_up(struct ipw_priv *priv) { netif_carrier_on(priv->net_dev); @@ -7854,6 +8286,7 @@ void ipw_link_up(struct ipw_priv *priv) netif_start_queue(priv->net_dev); } + cancel_delayed_work(&priv->request_scan); ipw_reset_stats(priv); /* Ensure the rate is updated immediately */ priv->last_rate = ipw_get_current_rate(priv); @@ -7865,6 +8298,14 @@ void ipw_link_up(struct ipw_priv *priv) queue_delayed_work(priv->workqueue, &priv->request_scan, HZ); } +static void ipw_bg_link_up(void *data) +{ + struct ipw_priv *priv = data; + down(&priv->sem); + ipw_link_up(data); + up(&priv->sem); +} + void ipw_link_down(struct ipw_priv *priv) { ipw_led_link_down(priv); @@ -7883,6 +8324,14 @@ void ipw_link_down(struct ipw_priv *priv) queue_work(priv->workqueue, &priv->request_scan); } +static void ipw_bg_link_down(void *data) +{ + struct ipw_priv *priv = data; + down(&priv->sem); + ipw_link_down(data); + up(&priv->sem); +} + static int ipw_setup_deferred_work(struct ipw_priv *priv) { int ret = 0; @@ -7890,28 +8339,31 @@ static int ipw_setup_deferred_work(struct ipw_priv *priv) priv->workqueue = create_workqueue(DRV_NAME); init_waitqueue_head(&priv->wait_command_queue); - INIT_WORK(&priv->adhoc_check, ipw_adhoc_check, priv); - INIT_WORK(&priv->associate, ipw_associate, priv); - INIT_WORK(&priv->disassociate, ipw_disassociate, priv); - INIT_WORK(&priv->rx_replenish, ipw_rx_queue_replenish, priv); - INIT_WORK(&priv->adapter_restart, ipw_adapter_restart, priv); - INIT_WORK(&priv->rf_kill, ipw_rf_kill, priv); - INIT_WORK(&priv->up, (void (*)(void *))ipw_up, priv); - INIT_WORK(&priv->down, (void (*)(void *))ipw_down, priv); + INIT_WORK(&priv->adhoc_check, ipw_bg_adhoc_check, priv); + INIT_WORK(&priv->associate, ipw_bg_associate, priv); + INIT_WORK(&priv->disassociate, ipw_bg_disassociate, priv); + INIT_WORK(&priv->rx_replenish, ipw_bg_rx_queue_replenish, priv); + INIT_WORK(&priv->adapter_restart, ipw_bg_adapter_restart, priv); + INIT_WORK(&priv->rf_kill, ipw_bg_rf_kill, priv); + INIT_WORK(&priv->up, (void (*)(void *))ipw_bg_up, priv); + INIT_WORK(&priv->down, (void (*)(void *))ipw_bg_down, priv); INIT_WORK(&priv->request_scan, - (void (*)(void *))ipw_request_scan, priv); + (void (*)(void *))ipw_bg_request_scan, priv); INIT_WORK(&priv->gather_stats, - (void (*)(void *))ipw_gather_stats, priv); - INIT_WORK(&priv->abort_scan, (void (*)(void *))ipw_abort_scan, priv); - INIT_WORK(&priv->roam, ipw_roam, priv); - INIT_WORK(&priv->scan_check, ipw_scan_check, priv); - INIT_WORK(&priv->link_up, (void (*)(void *))ipw_link_up, priv); - INIT_WORK(&priv->link_down, (void (*)(void *))ipw_link_down, priv); - INIT_WORK(&priv->led_link_on, (void (*)(void *))ipw_led_link_on, priv); - INIT_WORK(&priv->led_link_off, (void (*)(void *))ipw_led_link_off, + (void (*)(void *))ipw_bg_gather_stats, priv); + INIT_WORK(&priv->abort_scan, (void (*)(void *))ipw_bg_abort_scan, priv); + INIT_WORK(&priv->roam, ipw_bg_roam, priv); + INIT_WORK(&priv->scan_check, ipw_bg_scan_check, priv); + INIT_WORK(&priv->link_up, (void (*)(void *))ipw_bg_link_up, priv); + INIT_WORK(&priv->link_down, (void (*)(void *))ipw_bg_link_down, priv); + INIT_WORK(&priv->led_link_on, (void (*)(void *))ipw_bg_led_link_on, + priv); + INIT_WORK(&priv->led_link_off, (void (*)(void *))ipw_bg_led_link_off, priv); - INIT_WORK(&priv->led_act_off, (void (*)(void *))ipw_led_activity_off, + INIT_WORK(&priv->led_act_off, (void (*)(void *))ipw_bg_led_activity_off, priv); + INIT_WORK(&priv->merge_networks, + (void (*)(void *))ipw_merge_adhoc_network, priv); tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long)) ipw_irq_tasklet, (unsigned long)priv); @@ -7924,7 +8376,7 @@ static void shim__set_security(struct net_device *dev, { struct ipw_priv *priv = ieee80211_priv(dev); int i; - + down(&priv->sem); for (i = 0; i < 4; i++) { if (sec->flags & (1 << i)) { priv->sec.key_sizes[i] = sec->key_sizes[i]; @@ -7989,6 +8441,7 @@ static void shim__set_security(struct net_device *dev, ipw_disassociate(priv); } #endif + up(&priv->sem); } static int init_supported_rates(struct ipw_priv *priv, @@ -8054,6 +8507,11 @@ static int ipw_config(struct ipw_priv *priv) /* set basic system config settings */ init_sys_config(&priv->sys_config); + if (priv->ieee->iw_mode == IW_MODE_ADHOC) + priv->sys_config.answer_broadcast_ssid_probe = 1; + else + priv->sys_config.answer_broadcast_ssid_probe = 0; + if (ipw_send_system_config(priv, &priv->sys_config)) goto error; @@ -8075,8 +8533,10 @@ static int ipw_config(struct ipw_priv *priv) goto error; /* If configured to try and auto-associate, kick off a scan */ - if ((priv->config & CFG_ASSOCIATE) && ipw_request_scan(priv)) + if ((priv->config & CFG_ASSOCIATE) && ipw_request_scan(priv)) { + IPW_WARNING("error sending scan request\n"); goto error; + } return 0; @@ -8106,8 +8566,9 @@ static int ipw_up(struct ipw_priv *priv) eeprom_parse_mac(priv, priv->mac_addr); memcpy(priv->net_dev->dev_addr, priv->mac_addr, ETH_ALEN); - if (priv->status & STATUS_RF_KILL_MASK) + if (priv->status & STATUS_RF_KILL_MASK) { return 0; + } rc = ipw_config(priv); if (!rc) { @@ -8115,12 +8576,11 @@ static int ipw_up(struct ipw_priv *priv) ipw_led_init(priv); ipw_led_radio_on(priv); priv->notif_missed_beacons = 0; + priv->status |= STATUS_INIT; return 0; - } else { - IPW_DEBUG_INFO("Device configuration failed: 0x%08X\n", - rc); } + IPW_DEBUG_INFO("Device configuration failed: 0x%08X\n", rc); IPW_DEBUG_INFO("Failed to config device on retry %d of %d\n", i, MAX_HW_RESTARTS); @@ -8132,13 +8592,22 @@ static int ipw_up(struct ipw_priv *priv) /* tried to restart and config the device for as long as our * patience could withstand */ IPW_ERROR("Unable to initialize device after %d attempts.\n", i); + return -EIO; } +static void ipw_bg_up(void *data) +{ + struct ipw_priv *priv = data; + down(&priv->sem); + ipw_up(data); + up(&priv->sem); +} + static void ipw_down(struct ipw_priv *priv) { - /* Attempt to disable the card */ #if 0 + /* Attempt to disable the card */ ipw_send_card_disable(priv, 0); #endif @@ -8147,7 +8616,6 @@ static void ipw_down(struct ipw_priv *priv) /* Clear all bits but the RF Kill */ priv->status &= STATUS_RF_KILL_MASK; - netif_carrier_off(priv->net_dev); netif_stop_queue(priv->net_dev); @@ -8156,6 +8624,14 @@ static void ipw_down(struct ipw_priv *priv) ipw_led_radio_off(priv); } +static void ipw_bg_down(void *data) +{ + struct ipw_priv *priv = data; + down(&priv->sem); + ipw_down(data); + up(&priv->sem); +} + static int ipw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { struct iwreq *wrq = (struct iwreq *)rq; @@ -8176,21 +8652,26 @@ static int ipw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) static int ipw_net_init(struct net_device *dev) { struct ipw_priv *priv = ieee80211_priv(dev); - + down(&priv->sem); if (priv->status & STATUS_RF_KILL_SW) { IPW_WARNING("Radio disabled by module parameter.\n"); + up(&priv->sem); return 0; } else if (rf_kill_active(priv)) { IPW_WARNING("Radio Frequency Kill Switch is On:\n" "Kill switch must be turned off for " "wireless networking to work.\n"); queue_delayed_work(priv->workqueue, &priv->rf_kill, 2 * HZ); + up(&priv->sem); return 0; } - if (ipw_up(priv)) + if (ipw_up(priv)) { + up(&priv->sem); return -EIO; + } + up(&priv->sem); return 0; } @@ -8275,6 +8756,7 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) #endif spin_lock_init(&priv->lock); + init_MUTEX(&priv->sem); if (pci_enable_device(pdev)) { err = -ENODEV; goto out_free_ieee80211; @@ -8416,9 +8898,14 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ipw_wx_data.spy_data = &priv->ieee->spy_data; ipw_wx_data.ieee80211 = priv->ieee; + down(&priv->sem); + priv->ieee->hard_start_xmit = ipw_net_hard_start_xmit; priv->ieee->set_security = shim__set_security; + priv->ieee->perfect_rssi = -20; + priv->ieee->worst_rssi = -85; + net_dev->open = ipw_net_open; net_dev->stop = ipw_net_stop; net_dev->init = ipw_net_init; @@ -8438,15 +8925,16 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) err = sysfs_create_group(&pdev->dev.kobj, &ipw_attribute_group); if (err) { IPW_ERROR("failed to create sysfs device attributes\n"); + up(&priv->sem); goto out_release_irq; } + up(&priv->sem); err = register_netdev(net_dev); if (err) { IPW_ERROR("failed to register network device\n"); goto out_remove_sysfs; } - return 0; out_remove_sysfs: @@ -8623,8 +9111,7 @@ module_param(auto_create, int, 0444); MODULE_PARM_DESC(auto_create, "auto create adhoc network (default on)"); module_param(led, int, 0444); -MODULE_PARM_DESC(auto_create, - "enable led control on some systems (default 0 off)\n"); +MODULE_PARM_DESC(led, "enable led control on some systems (default 0 off)\n"); module_param(debug, int, 0444); MODULE_PARM_DESC(debug, "debug output mask"); diff --git a/drivers/net/wireless/ipw2200.h b/drivers/net/wireless/ipw2200.h index 1b339cb7a522..243b8ea14140 100644 --- a/drivers/net/wireless/ipw2200.h +++ b/drivers/net/wireless/ipw2200.h @@ -936,8 +936,8 @@ struct ipw_priv { struct ieee80211_device *ieee; struct ieee80211_security sec; - /* spinlock */ spinlock_t lock; + struct semaphore sem; /* basic pci-network driver stuff */ struct pci_dev *pci_dev; @@ -1068,6 +1068,7 @@ struct ipw_priv { struct work_struct led_link_on; struct work_struct led_link_off; struct work_struct led_act_off; + struct work_struct merge_networks; #define IPW_2200BG 1 #define IPW_2915ABG 2 @@ -1160,6 +1161,7 @@ do { if (ipw_debug_level & (level)) \ #define IPW_DL_TRACE (1<<28) #define IPW_DL_STATS (1<<29) +#define IPW_DL_MERGE (1<<30) #define IPW_ERROR(f, a...) printk(KERN_ERR DRV_NAME ": " f, ## a) #define IPW_WARNING(f, a...) printk(KERN_WARNING DRV_NAME ": " f, ## a) @@ -1187,6 +1189,7 @@ do { if (ipw_debug_level & (level)) \ #define IPW_DEBUG_STATE(f, a...) IPW_DEBUG(IPW_DL_STATE | IPW_DL_ASSOC | IPW_DL_INFO, f, ## a) #define IPW_DEBUG_ASSOC(f, a...) IPW_DEBUG(IPW_DL_ASSOC | IPW_DL_INFO, f, ## a) #define IPW_DEBUG_STATS(f, a...) IPW_DEBUG(IPW_DL_STATS, f, ## a) +#define IPW_DEBUG_MERGE(f, a...) IPW_DEBUG(IPW_DL_MERGE, f, ## a) #include -- cgit v1.2.2 From b095c3819805f87d73d41641a53e4c070360d783 Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Wed, 24 Aug 2005 22:04:42 -0500 Subject: Catch ipw2200 up to equivelancy with v1.0.4 * Fixed #627 problem with open APs not working with wpa_supplicant * Fixed #632 problem with 'txpower auto' setting power incorrectly (thanks to Kai Groner) * Fixed #634 problem with 'iwconfig eth1 frag 0' hanging the shell * Fixed problem with adapter not fully powering off during suspend to RAM or when module unloaded. * Fixed #645 problem with turning fixed rates off not taking effect until you reload the driver * Fixed problem with firmware restart if wpa_supplicant was used to set a key that wasn't exactly 5 or 13 bytes in length. * Fixed #623 Added iwpriv sw_reset extension to reset sw parameters * Added managment frame export to user space with frame statistics * Fixed #652 Modified the driver to load the EEPROM data even if RF KILL is active during driver load * Global s:CX2_:IPW_:g to make code more consistent * Fixed #572 problem with setting txpower to auto * Fixed #656 problem with kernel oops if mode auto; modprobe -r ipw2200 * Added QoS (CONFIG_IPW_QOS) support. This is being actively developed but is the first step in getting WMM support into the driver and the kernel. * Fixed some race conditions with channel changes, association, and scan abort that could periodically cause a firmware restart. * Added some extensions to export scan and network statistics to user space (exposed through speed_scan and net_stats sysfs entries) * Fixed a few bugs in how monitor mode was supported (scan lists weren't quite right) * Updated the firmware requirement from 2.2 to 2.3 which supports monitor mode. Signed-off-by: James Ketrenos --- drivers/net/wireless/ipw2200.c | 2604 +++++++++++++++++++++++++++++----------- drivers/net/wireless/ipw2200.h | 457 ++++--- 2 files changed, 2177 insertions(+), 884 deletions(-) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 0bf1931ac5f3..0a583afbcddf 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -32,11 +32,13 @@ #include "ipw2200.h" -#define IPW2200_VERSION "1.0.3" +#define IPW2200_VERSION "1.0.4" #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2200/2915 Network Driver" #define DRV_COPYRIGHT "Copyright(c) 2003-2004 Intel Corporation" #define DRV_VERSION IPW2200_VERSION +#define ETH_P_80211_STATS (ETH_P_80211_RAW + 1) + MODULE_DESCRIPTION(DRV_DESCRIPTION); MODULE_VERSION(DRV_VERSION); MODULE_AUTHOR(DRV_COPYRIGHT); @@ -51,10 +53,78 @@ static int associate = 1; static int auto_create = 1; static int led = 0; static int disable = 0; +static int hwcrypto = 1; static const char ipw_modes[] = { 'a', 'b', 'g', '?' }; +#ifdef CONFIG_IPW_QOS +static int qos_enable = 0; +static int qos_burst_enable = 0; +static int qos_no_ack_mask = 0; +static int burst_duration_CCK = 0; +static int burst_duration_OFDM = 0; + +static struct ieee80211_qos_parameters def_qos_parameters_OFDM = { + {QOS_TX0_CW_MIN_OFDM, QOS_TX1_CW_MIN_OFDM, QOS_TX2_CW_MIN_OFDM, + QOS_TX3_CW_MIN_OFDM}, + {QOS_TX0_CW_MAX_OFDM, QOS_TX1_CW_MAX_OFDM, QOS_TX2_CW_MAX_OFDM, + QOS_TX3_CW_MAX_OFDM}, + {QOS_TX0_AIFS, QOS_TX1_AIFS, QOS_TX2_AIFS, QOS_TX3_AIFS}, + {QOS_TX0_ACM, QOS_TX1_ACM, QOS_TX2_ACM, QOS_TX3_ACM}, + {QOS_TX0_TXOP_LIMIT_OFDM, QOS_TX1_TXOP_LIMIT_OFDM, + QOS_TX2_TXOP_LIMIT_OFDM, QOS_TX3_TXOP_LIMIT_OFDM} +}; + +static struct ieee80211_qos_parameters def_qos_parameters_CCK = { + {QOS_TX0_CW_MIN_CCK, QOS_TX1_CW_MIN_CCK, QOS_TX2_CW_MIN_CCK, + QOS_TX3_CW_MIN_CCK}, + {QOS_TX0_CW_MAX_CCK, QOS_TX1_CW_MAX_CCK, QOS_TX2_CW_MAX_CCK, + QOS_TX3_CW_MAX_CCK}, + {QOS_TX0_AIFS, QOS_TX1_AIFS, QOS_TX2_AIFS, QOS_TX3_AIFS}, + {QOS_TX0_ACM, QOS_TX1_ACM, QOS_TX2_ACM, QOS_TX3_ACM}, + {QOS_TX0_TXOP_LIMIT_CCK, QOS_TX1_TXOP_LIMIT_CCK, QOS_TX2_TXOP_LIMIT_CCK, + QOS_TX3_TXOP_LIMIT_CCK} +}; + +static struct ieee80211_qos_parameters def_parameters_OFDM = { + {DEF_TX0_CW_MIN_OFDM, DEF_TX1_CW_MIN_OFDM, DEF_TX2_CW_MIN_OFDM, + DEF_TX3_CW_MIN_OFDM}, + {DEF_TX0_CW_MAX_OFDM, DEF_TX1_CW_MAX_OFDM, DEF_TX2_CW_MAX_OFDM, + DEF_TX3_CW_MAX_OFDM}, + {DEF_TX0_AIFS, DEF_TX1_AIFS, DEF_TX2_AIFS, DEF_TX3_AIFS}, + {DEF_TX0_ACM, DEF_TX1_ACM, DEF_TX2_ACM, DEF_TX3_ACM}, + {DEF_TX0_TXOP_LIMIT_OFDM, DEF_TX1_TXOP_LIMIT_OFDM, + DEF_TX2_TXOP_LIMIT_OFDM, DEF_TX3_TXOP_LIMIT_OFDM} +}; + +static struct ieee80211_qos_parameters def_parameters_CCK = { + {DEF_TX0_CW_MIN_CCK, DEF_TX1_CW_MIN_CCK, DEF_TX2_CW_MIN_CCK, + DEF_TX3_CW_MIN_CCK}, + {DEF_TX0_CW_MAX_CCK, DEF_TX1_CW_MAX_CCK, DEF_TX2_CW_MAX_CCK, + DEF_TX3_CW_MAX_CCK}, + {DEF_TX0_AIFS, DEF_TX1_AIFS, DEF_TX2_AIFS, DEF_TX3_AIFS}, + {DEF_TX0_ACM, DEF_TX1_ACM, DEF_TX2_ACM, DEF_TX3_ACM}, + {DEF_TX0_TXOP_LIMIT_CCK, DEF_TX1_TXOP_LIMIT_CCK, DEF_TX2_TXOP_LIMIT_CCK, + DEF_TX3_TXOP_LIMIT_CCK} +}; + +static u8 qos_oui[QOS_OUI_LEN] = { 0x00, 0x50, 0xF2 }; + +static int from_priority_to_tx_queue[] = { + IPW_TX_QUEUE_1, IPW_TX_QUEUE_2, IPW_TX_QUEUE_2, IPW_TX_QUEUE_1, + IPW_TX_QUEUE_3, IPW_TX_QUEUE_3, IPW_TX_QUEUE_4, IPW_TX_QUEUE_4 +}; + +static u32 ipw_qos_get_burst_duration(struct ipw_priv *priv); + +static int ipw_send_qos_params_command(struct ipw_priv *priv, struct ieee80211_qos_parameters + *qos_param); +static int ipw_send_qos_info_command(struct ipw_priv *priv, struct ieee80211_qos_information_element + *qos_param); +#endif /* CONFIG_IPW_QOS */ + +static void ipw_remove_current_network(struct ipw_priv *priv); static void ipw_rx(struct ipw_priv *priv); static int ipw_queue_tx_reclaim(struct ipw_priv *priv, struct clx2_tx_queue *txq, int qindex); @@ -75,33 +145,8 @@ static void ipw_bg_down(void *); static int ipw_config(struct ipw_priv *); static int init_supported_rates(struct ipw_priv *priv, struct ipw_supported_rates *prates); - -static u8 band_b_active_channel[MAX_B_CHANNELS] = { - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0 -}; -static u8 band_a_active_channel[MAX_A_CHANNELS] = { - 36, 40, 44, 48, 149, 153, 157, 161, 165, 52, 56, 60, 64, 0 -}; - -static int is_valid_channel(int mode_mask, int channel) -{ - int i; - - if (!channel) - return 0; - - if (mode_mask & IEEE_A) - for (i = 0; i < MAX_A_CHANNELS; i++) - if (band_a_active_channel[i] == channel) - return IEEE_A; - - if (mode_mask & (IEEE_B | IEEE_G)) - for (i = 0; i < MAX_B_CHANNELS; i++) - if (band_b_active_channel[i] == channel) - return mode_mask & (IEEE_B | IEEE_G); - - return 0; -} +static void ipw_set_hwcrypto_keys(struct ipw_priv *); +static void ipw_send_wep_keys(struct ipw_priv *, int); static char *snprint_line(char *buf, size_t count, const u8 * data, u32 len, u32 ofs) @@ -241,24 +286,24 @@ static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 * data, static void _ipw_write_reg32(struct ipw_priv *priv, u32 reg, u32 value) { IPW_DEBUG_IO(" %p : reg = 0x%8X : value = 0x%8X\n", priv, reg, value); - _ipw_write32(priv, CX2_INDIRECT_ADDR, reg); - _ipw_write32(priv, CX2_INDIRECT_DATA, value); + _ipw_write32(priv, IPW_INDIRECT_ADDR, reg); + _ipw_write32(priv, IPW_INDIRECT_DATA, value); } static void _ipw_write_reg8(struct ipw_priv *priv, u32 reg, u8 value) { IPW_DEBUG_IO(" reg = 0x%8X : value = 0x%8X\n", reg, value); - _ipw_write32(priv, CX2_INDIRECT_ADDR, reg & CX2_INDIRECT_ADDR_MASK); - _ipw_write8(priv, CX2_INDIRECT_DATA, value); + _ipw_write32(priv, IPW_INDIRECT_ADDR, reg & IPW_INDIRECT_ADDR_MASK); + _ipw_write8(priv, IPW_INDIRECT_DATA, value); IPW_DEBUG_IO(" reg = 0x%8lX : value = 0x%8X\n", - (unsigned long)(priv->hw_base + CX2_INDIRECT_DATA), value); + (unsigned long)(priv->hw_base + IPW_INDIRECT_DATA), value); } static void _ipw_write_reg16(struct ipw_priv *priv, u32 reg, u16 value) { IPW_DEBUG_IO(" reg = 0x%8X : value = 0x%8X\n", reg, value); - _ipw_write32(priv, CX2_INDIRECT_ADDR, reg & CX2_INDIRECT_ADDR_MASK); - _ipw_write16(priv, CX2_INDIRECT_DATA, value); + _ipw_write32(priv, IPW_INDIRECT_ADDR, reg & IPW_INDIRECT_ADDR_MASK); + _ipw_write16(priv, IPW_INDIRECT_DATA, value); } /* indirect read s */ @@ -266,9 +311,9 @@ static void _ipw_write_reg16(struct ipw_priv *priv, u32 reg, u16 value) static u8 _ipw_read_reg8(struct ipw_priv *priv, u32 reg) { u32 word; - _ipw_write32(priv, CX2_INDIRECT_ADDR, reg & CX2_INDIRECT_ADDR_MASK); + _ipw_write32(priv, IPW_INDIRECT_ADDR, reg & IPW_INDIRECT_ADDR_MASK); IPW_DEBUG_IO(" reg = 0x%8X : \n", reg); - word = _ipw_read32(priv, CX2_INDIRECT_DATA); + word = _ipw_read32(priv, IPW_INDIRECT_DATA); return (word >> ((reg & 0x3) * 8)) & 0xff; } @@ -278,8 +323,8 @@ static u32 _ipw_read_reg32(struct ipw_priv *priv, u32 reg) IPW_DEBUG_IO("%p : reg = 0x%08x\n", priv, reg); - _ipw_write32(priv, CX2_INDIRECT_ADDR, reg); - value = _ipw_read32(priv, CX2_INDIRECT_DATA); + _ipw_write32(priv, IPW_INDIRECT_ADDR, reg); + value = _ipw_read32(priv, IPW_INDIRECT_DATA); IPW_DEBUG_IO(" reg = 0x%4X : value = 0x%4x \n", reg, value); return value; } @@ -288,7 +333,7 @@ static u32 _ipw_read_reg32(struct ipw_priv *priv, u32 reg) static void _ipw_read_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, int num) { - u32 aligned_addr = addr & CX2_INDIRECT_ADDR_MASK; + u32 aligned_addr = addr & IPW_INDIRECT_ADDR_MASK; u32 dif_len = addr - aligned_addr; u32 i; @@ -300,29 +345,29 @@ static void _ipw_read_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, /* Read the first nibble byte by byte */ if (unlikely(dif_len)) { - _ipw_write32(priv, CX2_INDIRECT_ADDR, aligned_addr); + _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); /* Start reading at aligned_addr + dif_len */ for (i = dif_len; ((i < 4) && (num > 0)); i++, num--) - *buf++ = _ipw_read8(priv, CX2_INDIRECT_DATA + i); + *buf++ = _ipw_read8(priv, IPW_INDIRECT_DATA + i); aligned_addr += 4; } - _ipw_write32(priv, CX2_AUTOINC_ADDR, aligned_addr); + _ipw_write32(priv, IPW_AUTOINC_ADDR, aligned_addr); for (; num >= 4; buf += 4, aligned_addr += 4, num -= 4) - *(u32 *) buf = _ipw_read32(priv, CX2_AUTOINC_DATA); + *(u32 *) buf = _ipw_read32(priv, IPW_AUTOINC_DATA); /* Copy the last nibble */ if (unlikely(num)) { - _ipw_write32(priv, CX2_INDIRECT_ADDR, aligned_addr); + _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); for (i = 0; num > 0; i++, num--) - *buf++ = ipw_read8(priv, CX2_INDIRECT_DATA + i); + *buf++ = ipw_read8(priv, IPW_INDIRECT_DATA + i); } } static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, int num) { - u32 aligned_addr = addr & CX2_INDIRECT_ADDR_MASK; + u32 aligned_addr = addr & IPW_INDIRECT_ADDR_MASK; u32 dif_len = addr - aligned_addr; u32 i; @@ -334,22 +379,22 @@ static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, /* Write the first nibble byte by byte */ if (unlikely(dif_len)) { - _ipw_write32(priv, CX2_INDIRECT_ADDR, aligned_addr); + _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); /* Start reading at aligned_addr + dif_len */ for (i = dif_len; ((i < 4) && (num > 0)); i++, num--, buf++) - _ipw_write8(priv, CX2_INDIRECT_DATA + i, *buf); + _ipw_write8(priv, IPW_INDIRECT_DATA + i, *buf); aligned_addr += 4; } - _ipw_write32(priv, CX2_AUTOINC_ADDR, aligned_addr); + _ipw_write32(priv, IPW_AUTOINC_ADDR, aligned_addr); for (; num >= 4; buf += 4, aligned_addr += 4, num -= 4) - _ipw_write32(priv, CX2_AUTOINC_DATA, *(u32 *) buf); + _ipw_write32(priv, IPW_AUTOINC_DATA, *(u32 *) buf); /* Copy the last nibble */ if (unlikely(num)) { - _ipw_write32(priv, CX2_INDIRECT_ADDR, aligned_addr); + _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); for (i = 0; num > 0; i++, num--, buf++) - _ipw_write8(priv, CX2_INDIRECT_DATA + i, *buf); + _ipw_write8(priv, IPW_INDIRECT_DATA + i, *buf); } } @@ -374,7 +419,7 @@ static inline void ipw_enable_interrupts(struct ipw_priv *priv) if (priv->status & STATUS_INT_ENABLED) return; priv->status |= STATUS_INT_ENABLED; - ipw_write32(priv, CX2_INTA_MASK_R, CX2_INTA_MASK_ALL); + ipw_write32(priv, IPW_INTA_MASK_R, IPW_INTA_MASK_ALL); } static inline void ipw_disable_interrupts(struct ipw_priv *priv) @@ -382,7 +427,7 @@ static inline void ipw_disable_interrupts(struct ipw_priv *priv) if (!(priv->status & STATUS_INT_ENABLED)) return; priv->status &= ~STATUS_INT_ENABLED; - ipw_write32(priv, CX2_INTA_MASK_R, ~CX2_INTA_MASK_ALL); + ipw_write32(priv, IPW_INTA_MASK_R, ~IPW_INTA_MASK_ALL); } static char *ipw_error_desc(u32 val) @@ -397,29 +442,29 @@ static char *ipw_error_desc(u32 val) case IPW_FW_ERROR_MEMORY_OVERFLOW: return "MEMORY_OVERFLOW"; case IPW_FW_ERROR_BAD_PARAM: - return "ERROR_BAD_PARAM"; + return "BAD_PARAM"; case IPW_FW_ERROR_BAD_CHECKSUM: - return "ERROR_BAD_CHECKSUM"; + return "BAD_CHECKSUM"; case IPW_FW_ERROR_NMI_INTERRUPT: - return "ERROR_NMI_INTERRUPT"; + return "NMI_INTERRUPT"; case IPW_FW_ERROR_BAD_DATABASE: - return "ERROR_BAD_DATABASE"; + return "BAD_DATABASE"; case IPW_FW_ERROR_ALLOC_FAIL: - return "ERROR_ALLOC_FAIL"; + return "ALLOC_FAIL"; case IPW_FW_ERROR_DMA_UNDERRUN: - return "ERROR_DMA_UNDERRUN"; + return "DMA_UNDERRUN"; case IPW_FW_ERROR_DMA_STATUS: - return "ERROR_DMA_STATUS"; - case IPW_FW_ERROR_DINOSTATUS_ERROR: - return "ERROR_DINOSTATUS_ERROR"; - case IPW_FW_ERROR_EEPROMSTATUS_ERROR: - return "ERROR_EEPROMSTATUS_ERROR"; + return "DMA_STATUS"; + case IPW_FW_ERROR_DINO_ERROR: + return "DINO_ERROR"; + case IPW_FW_ERROR_EEPROM_ERROR: + return "EEPROM_ERROR"; case IPW_FW_ERROR_SYSASSERT: - return "ERROR_SYSASSERT"; + return "SYSASSERT"; case IPW_FW_ERROR_FATAL_ERROR: - return "ERROR_FATALSTATUS_ERROR"; + return "FATAL_ERROR"; default: - return "UNKNOWNSTATUS_ERROR"; + return "UNKNOWN_ERROR"; } } @@ -646,13 +691,13 @@ static void ipw_init_ordinals(struct ipw_priv *priv) u32 ipw_register_toggle(u32 reg) { - reg &= ~CX2_START_STANDBY; - if (reg & CX2_GATE_ODMA) - reg &= ~CX2_GATE_ODMA; - if (reg & CX2_GATE_IDMA) - reg &= ~CX2_GATE_IDMA; - if (reg & CX2_GATE_ADMA) - reg &= ~CX2_GATE_ADMA; + reg &= ~IPW_START_STANDBY; + if (reg & IPW_GATE_ODMA) + reg &= ~IPW_GATE_ODMA; + if (reg & IPW_GATE_IDMA) + reg &= ~IPW_GATE_IDMA; + if (reg & IPW_GATE_ADMA) + reg &= ~IPW_GATE_ADMA; return reg; } @@ -684,13 +729,13 @@ void ipw_led_link_on(struct ipw_priv *priv) if (!(priv->status & STATUS_RF_KILL_MASK) && !(priv->status & STATUS_LED_LINK_ON)) { IPW_DEBUG_LED("Link LED On\n"); - led = ipw_read_reg32(priv, CX2_EVENT_REG); + led = ipw_read_reg32(priv, IPW_EVENT_REG); led |= priv->led_association_on; led = ipw_register_toggle(led); IPW_DEBUG_LED("Reg: 0x%08X\n", led); - ipw_write_reg32(priv, CX2_EVENT_REG, led); + ipw_write_reg32(priv, IPW_EVENT_REG, led); priv->status |= STATUS_LED_LINK_ON; @@ -725,12 +770,12 @@ void ipw_led_link_off(struct ipw_priv *priv) spin_lock_irqsave(&priv->lock, flags); if (priv->status & STATUS_LED_LINK_ON) { - led = ipw_read_reg32(priv, CX2_EVENT_REG); + led = ipw_read_reg32(priv, IPW_EVENT_REG); led &= priv->led_association_off; led = ipw_register_toggle(led); IPW_DEBUG_LED("Reg: 0x%08X\n", led); - ipw_write_reg32(priv, CX2_EVENT_REG, led); + ipw_write_reg32(priv, IPW_EVENT_REG, led); IPW_DEBUG_LED("Link LED Off\n"); @@ -756,29 +801,24 @@ static void ipw_bg_led_link_off(void *data) up(&priv->sem); } -void ipw_led_activity_on(struct ipw_priv *priv) +static inline void __ipw_led_activity_on(struct ipw_priv *priv) { - unsigned long flags; u32 led; if (priv->config & CFG_NO_LED) return; - spin_lock_irqsave(&priv->lock, flags); - - if (priv->status & STATUS_RF_KILL_MASK) { - spin_unlock_irqrestore(&priv->lock, flags); + if (priv->status & STATUS_RF_KILL_MASK) return; - } if (!(priv->status & STATUS_LED_ACT_ON)) { - led = ipw_read_reg32(priv, CX2_EVENT_REG); + led = ipw_read_reg32(priv, IPW_EVENT_REG); led |= priv->led_activity_on; led = ipw_register_toggle(led); IPW_DEBUG_LED("Reg: 0x%08X\n", led); - ipw_write_reg32(priv, CX2_EVENT_REG, led); + ipw_write_reg32(priv, IPW_EVENT_REG, led); IPW_DEBUG_LED("Activity LED On\n"); @@ -793,7 +833,13 @@ void ipw_led_activity_on(struct ipw_priv *priv) queue_delayed_work(priv->workqueue, &priv->led_act_off, LD_TIME_ACT_ON); } +} +void ipw_led_activity_on(struct ipw_priv *priv) +{ + unsigned long flags; + spin_lock_irqsave(&priv->lock, flags); + __ipw_led_activity_on(priv); spin_unlock_irqrestore(&priv->lock, flags); } @@ -808,13 +854,13 @@ void ipw_led_activity_off(struct ipw_priv *priv) spin_lock_irqsave(&priv->lock, flags); if (priv->status & STATUS_LED_ACT_ON) { - led = ipw_read_reg32(priv, CX2_EVENT_REG); + led = ipw_read_reg32(priv, IPW_EVENT_REG); led &= priv->led_activity_off; led = ipw_register_toggle(led); IPW_DEBUG_LED("Reg: 0x%08X\n", led); - ipw_write_reg32(priv, CX2_EVENT_REG, led); + ipw_write_reg32(priv, IPW_EVENT_REG, led); IPW_DEBUG_LED("Activity LED Off\n"); @@ -844,7 +890,7 @@ void ipw_led_band_on(struct ipw_priv *priv) spin_lock_irqsave(&priv->lock, flags); - led = ipw_read_reg32(priv, CX2_EVENT_REG); + led = ipw_read_reg32(priv, IPW_EVENT_REG); if (priv->assoc_network->mode == IEEE_A) { led |= priv->led_ofdm_on; led &= priv->led_association_off; @@ -862,7 +908,7 @@ void ipw_led_band_on(struct ipw_priv *priv) led = ipw_register_toggle(led); IPW_DEBUG_LED("Reg: 0x%08X\n", led); - ipw_write_reg32(priv, CX2_EVENT_REG, led); + ipw_write_reg32(priv, IPW_EVENT_REG, led); spin_unlock_irqrestore(&priv->lock, flags); } @@ -878,14 +924,14 @@ void ipw_led_band_off(struct ipw_priv *priv) spin_lock_irqsave(&priv->lock, flags); - led = ipw_read_reg32(priv, CX2_EVENT_REG); + led = ipw_read_reg32(priv, IPW_EVENT_REG); led &= priv->led_ofdm_off; led &= priv->led_association_off; led = ipw_register_toggle(led); IPW_DEBUG_LED("Reg: 0x%08X\n", led); - ipw_write_reg32(priv, CX2_EVENT_REG, led); + ipw_write_reg32(priv, IPW_EVENT_REG, led); spin_unlock_irqrestore(&priv->lock, flags); } @@ -921,23 +967,23 @@ void ipw_led_init(struct ipw_priv *priv) priv->nic_type = priv->eeprom[EEPROM_NIC_TYPE]; /* Set the default PINs for the link and activity leds */ - priv->led_activity_on = CX2_ACTIVITY_LED; - priv->led_activity_off = ~(CX2_ACTIVITY_LED); + priv->led_activity_on = IPW_ACTIVITY_LED; + priv->led_activity_off = ~(IPW_ACTIVITY_LED); - priv->led_association_on = CX2_ASSOCIATED_LED; - priv->led_association_off = ~(CX2_ASSOCIATED_LED); + priv->led_association_on = IPW_ASSOCIATED_LED; + priv->led_association_off = ~(IPW_ASSOCIATED_LED); /* Set the default PINs for the OFDM leds */ - priv->led_ofdm_on = CX2_OFDM_LED; - priv->led_ofdm_off = ~(CX2_OFDM_LED); + priv->led_ofdm_on = IPW_OFDM_LED; + priv->led_ofdm_off = ~(IPW_OFDM_LED); switch (priv->nic_type) { case EEPROM_NIC_TYPE_1: /* In this NIC type, the LEDs are reversed.... */ - priv->led_activity_on = CX2_ASSOCIATED_LED; - priv->led_activity_off = ~(CX2_ASSOCIATED_LED); - priv->led_association_on = CX2_ACTIVITY_LED; - priv->led_association_off = ~(CX2_ACTIVITY_LED); + priv->led_activity_on = IPW_ASSOCIATED_LED; + priv->led_activity_off = ~(IPW_ASSOCIATED_LED); + priv->led_association_on = IPW_ACTIVITY_LED; + priv->led_association_off = ~(IPW_ACTIVITY_LED); if (!(priv->config & CFG_NO_LED)) ipw_led_band_on(priv); @@ -1203,7 +1249,7 @@ static ssize_t show_command_event_reg(struct device *d, u32 reg = 0; struct ipw_priv *p = d->driver_data; - reg = ipw_read_reg32(p, CX2_INTERNAL_CMD_EVENT); + reg = ipw_read_reg32(p, IPW_INTERNAL_CMD_EVENT); return sprintf(buf, "0x%08x\n", reg); } static ssize_t store_command_event_reg(struct device *d, @@ -1214,7 +1260,7 @@ static ssize_t store_command_event_reg(struct device *d, struct ipw_priv *p = d->driver_data; sscanf(buf, "%x", ®); - ipw_write_reg32(p, CX2_INTERNAL_CMD_EVENT, reg); + ipw_write_reg32(p, IPW_INTERNAL_CMD_EVENT, reg); return strnlen(buf, count); } @@ -1361,7 +1407,6 @@ static int ipw_radio_kill_sw(struct ipw_priv *priv, int disable_radio) if (priv->workqueue) cancel_delayed_work(&priv->request_scan); - wake_up_interruptible(&priv->wait_command_queue); queue_work(priv->workqueue, &priv->down); } else { priv->status &= ~STATUS_RF_KILL_SW; @@ -1391,6 +1436,82 @@ static ssize_t store_rf_kill(struct device *d, struct device_attribute *attr, static DEVICE_ATTR(rf_kill, S_IWUSR | S_IRUGO, show_rf_kill, store_rf_kill); +static ssize_t show_speed_scan(struct device *d, struct device_attribute *attr, + char *buf) +{ + struct ipw_priv *priv = (struct ipw_priv *)d->driver_data; + int pos = 0, len = 0; + if (priv->config & CFG_SPEED_SCAN) { + while (priv->speed_scan[pos] != 0) + len += sprintf(&buf[len], "%d ", + priv->speed_scan[pos++]); + return len + sprintf(&buf[len], "\n"); + } + + return sprintf(buf, "0\n"); +} + +static ssize_t store_speed_scan(struct device *d, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct ipw_priv *priv = (struct ipw_priv *)d->driver_data; + int channel, pos = 0; + const char *p = buf; + + /* list of space separated channels to scan, optionally ending with 0 */ + while ((channel = simple_strtol(p, NULL, 0))) { + if (pos == MAX_SPEED_SCAN - 1) { + priv->speed_scan[pos] = 0; + break; + } + + if (ieee80211_is_valid_channel(priv->ieee, channel)) + priv->speed_scan[pos++] = channel; + else + IPW_WARNING("Skipping invalid channel request: %d\n", + channel); + p = strchr(p, ' '); + if (!p) + break; + while (*p == ' ' || *p == '\t') + p++; + } + + if (pos == 0) + priv->config &= ~CFG_SPEED_SCAN; + else { + priv->speed_scan_pos = 0; + priv->config |= CFG_SPEED_SCAN; + } + + return count; +} + +static DEVICE_ATTR(speed_scan, S_IWUSR | S_IRUGO, show_speed_scan, + store_speed_scan); + +static ssize_t show_net_stats(struct device *d, struct device_attribute *attr, + char *buf) +{ + struct ipw_priv *priv = (struct ipw_priv *)d->driver_data; + return sprintf(buf, "%c\n", (priv->config & CFG_NET_STATS) ? '1' : '0'); +} + +static ssize_t store_net_stats(struct device *d, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct ipw_priv *priv = (struct ipw_priv *)d->driver_data; + if (buf[0] == '1') + priv->config |= CFG_NET_STATS; + else + priv->config &= ~CFG_NET_STATS; + + return count; +} + +static DEVICE_ATTR(net_stats, S_IWUSR | S_IRUGO, show_net_stats, + store_net_stats); + static void notify_wx_assoc_event(struct ipw_priv *priv) { union iwreq_data wrqu; @@ -1410,77 +1531,77 @@ static void ipw_irq_tasklet(struct ipw_priv *priv) spin_lock_irqsave(&priv->lock, flags); - inta = ipw_read32(priv, CX2_INTA_RW); - inta_mask = ipw_read32(priv, CX2_INTA_MASK_R); - inta &= (CX2_INTA_MASK_ALL & inta_mask); + inta = ipw_read32(priv, IPW_INTA_RW); + inta_mask = ipw_read32(priv, IPW_INTA_MASK_R); + inta &= (IPW_INTA_MASK_ALL & inta_mask); /* Add any cached INTA values that need to be handled */ inta |= priv->isr_inta; /* handle all the justifications for the interrupt */ - if (inta & CX2_INTA_BIT_RX_TRANSFER) { + if (inta & IPW_INTA_BIT_RX_TRANSFER) { ipw_rx(priv); - handled |= CX2_INTA_BIT_RX_TRANSFER; + handled |= IPW_INTA_BIT_RX_TRANSFER; } - if (inta & CX2_INTA_BIT_TX_CMD_QUEUE) { + if (inta & IPW_INTA_BIT_TX_CMD_QUEUE) { IPW_DEBUG_HC("Command completed.\n"); rc = ipw_queue_tx_reclaim(priv, &priv->txq_cmd, -1); priv->status &= ~STATUS_HCMD_ACTIVE; wake_up_interruptible(&priv->wait_command_queue); - handled |= CX2_INTA_BIT_TX_CMD_QUEUE; + handled |= IPW_INTA_BIT_TX_CMD_QUEUE; } - if (inta & CX2_INTA_BIT_TX_QUEUE_1) { + if (inta & IPW_INTA_BIT_TX_QUEUE_1) { IPW_DEBUG_TX("TX_QUEUE_1\n"); rc = ipw_queue_tx_reclaim(priv, &priv->txq[0], 0); - handled |= CX2_INTA_BIT_TX_QUEUE_1; + handled |= IPW_INTA_BIT_TX_QUEUE_1; } - if (inta & CX2_INTA_BIT_TX_QUEUE_2) { + if (inta & IPW_INTA_BIT_TX_QUEUE_2) { IPW_DEBUG_TX("TX_QUEUE_2\n"); rc = ipw_queue_tx_reclaim(priv, &priv->txq[1], 1); - handled |= CX2_INTA_BIT_TX_QUEUE_2; + handled |= IPW_INTA_BIT_TX_QUEUE_2; } - if (inta & CX2_INTA_BIT_TX_QUEUE_3) { + if (inta & IPW_INTA_BIT_TX_QUEUE_3) { IPW_DEBUG_TX("TX_QUEUE_3\n"); rc = ipw_queue_tx_reclaim(priv, &priv->txq[2], 2); - handled |= CX2_INTA_BIT_TX_QUEUE_3; + handled |= IPW_INTA_BIT_TX_QUEUE_3; } - if (inta & CX2_INTA_BIT_TX_QUEUE_4) { + if (inta & IPW_INTA_BIT_TX_QUEUE_4) { IPW_DEBUG_TX("TX_QUEUE_4\n"); rc = ipw_queue_tx_reclaim(priv, &priv->txq[3], 3); - handled |= CX2_INTA_BIT_TX_QUEUE_4; + handled |= IPW_INTA_BIT_TX_QUEUE_4; } - if (inta & CX2_INTA_BIT_STATUS_CHANGE) { + if (inta & IPW_INTA_BIT_STATUS_CHANGE) { IPW_WARNING("STATUS_CHANGE\n"); - handled |= CX2_INTA_BIT_STATUS_CHANGE; + handled |= IPW_INTA_BIT_STATUS_CHANGE; } - if (inta & CX2_INTA_BIT_BEACON_PERIOD_EXPIRED) { + if (inta & IPW_INTA_BIT_BEACON_PERIOD_EXPIRED) { IPW_WARNING("TX_PERIOD_EXPIRED\n"); - handled |= CX2_INTA_BIT_BEACON_PERIOD_EXPIRED; + handled |= IPW_INTA_BIT_BEACON_PERIOD_EXPIRED; } - if (inta & CX2_INTA_BIT_SLAVE_MODE_HOST_CMD_DONE) { + if (inta & IPW_INTA_BIT_SLAVE_MODE_HOST_CMD_DONE) { IPW_WARNING("HOST_CMD_DONE\n"); - handled |= CX2_INTA_BIT_SLAVE_MODE_HOST_CMD_DONE; + handled |= IPW_INTA_BIT_SLAVE_MODE_HOST_CMD_DONE; } - if (inta & CX2_INTA_BIT_FW_INITIALIZATION_DONE) { + if (inta & IPW_INTA_BIT_FW_INITIALIZATION_DONE) { IPW_WARNING("FW_INITIALIZATION_DONE\n"); - handled |= CX2_INTA_BIT_FW_INITIALIZATION_DONE; + handled |= IPW_INTA_BIT_FW_INITIALIZATION_DONE; } - if (inta & CX2_INTA_BIT_FW_CARD_DISABLE_PHY_OFF_DONE) { + if (inta & IPW_INTA_BIT_FW_CARD_DISABLE_PHY_OFF_DONE) { IPW_WARNING("PHY_OFF_DONE\n"); - handled |= CX2_INTA_BIT_FW_CARD_DISABLE_PHY_OFF_DONE; + handled |= IPW_INTA_BIT_FW_CARD_DISABLE_PHY_OFF_DONE; } - if (inta & CX2_INTA_BIT_RF_KILL_DONE) { + if (inta & IPW_INTA_BIT_RF_KILL_DONE) { IPW_DEBUG_RF_KILL("RF_KILL_DONE\n"); priv->status |= STATUS_RF_KILL_HW; wake_up_interruptible(&priv->wait_command_queue); @@ -1488,10 +1609,10 @@ static void ipw_irq_tasklet(struct ipw_priv *priv) cancel_delayed_work(&priv->request_scan); schedule_work(&priv->link_down); queue_delayed_work(priv->workqueue, &priv->rf_kill, 2 * HZ); - handled |= CX2_INTA_BIT_RF_KILL_DONE; + handled |= IPW_INTA_BIT_RF_KILL_DONE; } - if (inta & CX2_INTA_BIT_FATAL_ERROR) { + if (inta & IPW_INTA_BIT_FATAL_ERROR) { IPW_ERROR("Firmware error detected. Restarting.\n"); #ifdef CONFIG_IPW_DEBUG if (ipw_debug_level & IPW_DL_FW_ERRORS) { @@ -1499,13 +1620,23 @@ static void ipw_irq_tasklet(struct ipw_priv *priv) ipw_dump_nic_event_log(priv); } #endif + /* XXX: If hardware encryption is for WPA/WPA2, + * we have to notify the supplicant. */ + if (priv->ieee->sec.encrypt) { + priv->status &= ~STATUS_ASSOCIATED; + notify_wx_assoc_event(priv); + } + + /* Keep the restart process from trying to send host + * commands by clearing the INIT status bit */ + priv->status &= ~STATUS_INIT; queue_work(priv->workqueue, &priv->adapter_restart); - handled |= CX2_INTA_BIT_FATAL_ERROR; + handled |= IPW_INTA_BIT_FATAL_ERROR; } - if (inta & CX2_INTA_BIT_PARITY_ERROR) { + if (inta & IPW_INTA_BIT_PARITY_ERROR) { IPW_ERROR("Parity error\n"); - handled |= CX2_INTA_BIT_PARITY_ERROR; + handled |= IPW_INTA_BIT_PARITY_ERROR; } if (handled != inta) { @@ -1594,8 +1725,9 @@ static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) priv->status |= STATUS_HCMD_ACTIVE; - IPW_DEBUG_HC("Sending %s command (#%d), %d bytes\n", - get_cmd_string(cmd->cmd), cmd->cmd, cmd->len); + IPW_DEBUG_HC("%s command (#%d) %d bytes: 0x%08X\n", + get_cmd_string(cmd->cmd), cmd->cmd, cmd->len, + priv->status); printk_buf(IPW_DL_HOST_COMMAND, (u8 *) cmd->param, cmd->len); rc = ipw_queue_tx_hcmd(priv, cmd->cmd, &cmd->param, cmd->len, 0); @@ -1623,7 +1755,7 @@ static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) spin_unlock_irqrestore(&priv->lock, flags); } - if (priv->status & STATUS_RF_KILL_MASK) { + if (priv->status & STATUS_RF_KILL_HW) { IPW_DEBUG_INFO("Command aborted due to RF Kill Switch\n"); return -EIO; } @@ -1732,10 +1864,20 @@ static void ipw_adapter_restart(void *adapter) return; ipw_down(priv); + + if (priv->assoc_network && + (priv->assoc_network->capability & WLAN_CAPABILITY_IBSS)) + ipw_remove_current_network(priv); + if (ipw_up(priv)) { IPW_ERROR("Failed to up device\n"); return; } + + if ((priv->capability & CAP_PRIVACY_ON) && + (priv->ieee->sec.level == SEC_LEVEL_1) && + !(priv->ieee->host_encrypt || priv->ieee->host_decrypt)) + ipw_set_hwcrypto_keys(priv); } static void ipw_bg_adapter_restart(void *data) @@ -1775,11 +1917,6 @@ static int ipw_send_scan_request_ext(struct ipw_priv *priv, .len = sizeof(*request) }; - if (!priv || !request) { - IPW_ERROR("Invalid args\n"); - return -1; - } - memcpy(&cmd.param, request, sizeof(*request)); if (ipw_send_cmd(priv, &cmd)) { IPW_ERROR("failed to send SCAN_REQUEST_EXT command\n"); @@ -1907,7 +2044,6 @@ static int ipw_set_random_seed(struct ipw_priv *priv) return 0; } -#if 0 static int ipw_send_card_disable(struct ipw_priv *priv, u32 phy_off) { struct host_cmd cmd = { @@ -1929,7 +2065,6 @@ static int ipw_send_card_disable(struct ipw_priv *priv, u32 phy_off) return 0; } -#endif static int ipw_send_tx_power(struct ipw_priv *priv, struct ipw_tx_power *power) { @@ -2166,7 +2301,7 @@ static void ipw_eeprom_init_sram(struct ipw_priv *priv) IPW_DEBUG_INFO("Writing EEPROM data into SRAM\n"); /* write the eeprom data to sram */ - for (i = 0; i < CX2_EEPROM_IMAGE_SIZE; i++) + for (i = 0; i < IPW_EEPROM_IMAGE_SIZE; i++) ipw_write8(priv, IPW_EEPROM_DATA + i, priv->eeprom[i]); /* Do not load eeprom data on fatal error or suspend */ @@ -2186,14 +2321,14 @@ static inline void ipw_zero_memory(struct ipw_priv *priv, u32 start, u32 count) count >>= 2; if (!count) return; - _ipw_write32(priv, CX2_AUTOINC_ADDR, start); + _ipw_write32(priv, IPW_AUTOINC_ADDR, start); while (count--) - _ipw_write32(priv, CX2_AUTOINC_DATA, 0); + _ipw_write32(priv, IPW_AUTOINC_DATA, 0); } static inline void ipw_fw_dma_reset_command_blocks(struct ipw_priv *priv) { - ipw_zero_memory(priv, CX2_SHARED_SRAM_DMA_CONTROL, + ipw_zero_memory(priv, IPW_SHARED_SRAM_DMA_CONTROL, CB_NUMBER_OF_ELEMENTS_SMALL * sizeof(struct command_block)); } @@ -2207,7 +2342,7 @@ static int ipw_fw_dma_enable(struct ipw_priv *priv) ipw_fw_dma_reset_command_blocks(priv); /* Write CB base address */ - ipw_write_reg32(priv, CX2_DMA_I_CB_BASE, CX2_SHARED_SRAM_DMA_CONTROL); + ipw_write_reg32(priv, IPW_DMA_I_CB_BASE, IPW_SHARED_SRAM_DMA_CONTROL); IPW_DEBUG_FW("<< : \n"); return 0; @@ -2221,7 +2356,7 @@ static void ipw_fw_dma_abort(struct ipw_priv *priv) //set the Stop and Abort bit control = DMA_CONTROL_SMALL_CB_CONST_VALUE | DMA_CB_STOP_AND_ABORT; - ipw_write_reg32(priv, CX2_DMA_I_DMA_CONTROL, control); + ipw_write_reg32(priv, IPW_DMA_I_DMA_CONTROL, control); priv->sram_desc.last_cb_index = 0; IPW_DEBUG_FW("<< \n"); @@ -2231,7 +2366,7 @@ static int ipw_fw_dma_write_command_block(struct ipw_priv *priv, int index, struct command_block *cb) { u32 address = - CX2_SHARED_SRAM_DMA_CONTROL + + IPW_SHARED_SRAM_DMA_CONTROL + (sizeof(struct command_block) * index); IPW_DEBUG_FW(">> :\n"); @@ -2255,13 +2390,13 @@ static int ipw_fw_dma_kick(struct ipw_priv *priv) &priv->sram_desc.cb_list[index]); /* Enable the DMA in the CSR register */ - ipw_clear_bit(priv, CX2_RESET_REG, - CX2_RESET_REG_MASTER_DISABLED | - CX2_RESET_REG_STOP_MASTER); + ipw_clear_bit(priv, IPW_RESET_REG, + IPW_RESET_REG_MASTER_DISABLED | + IPW_RESET_REG_STOP_MASTER); /* Set the Start bit. */ control = DMA_CONTROL_SMALL_CB_CONST_VALUE | DMA_CB_START; - ipw_write_reg32(priv, CX2_DMA_I_DMA_CONTROL, control); + ipw_write_reg32(priv, IPW_DMA_I_DMA_CONTROL, control); IPW_DEBUG_FW("<< :\n"); return 0; @@ -2274,12 +2409,12 @@ static void ipw_fw_dma_dump_command_block(struct ipw_priv *priv) u32 cb_fields_address = 0; IPW_DEBUG_FW(">> :\n"); - address = ipw_read_reg32(priv, CX2_DMA_I_CURRENT_CB); + address = ipw_read_reg32(priv, IPW_DMA_I_CURRENT_CB); IPW_DEBUG_FW_INFO("Current CB is 0x%x \n", address); /* Read the DMA Controlor register */ - register_value = ipw_read_reg32(priv, CX2_DMA_I_DMA_CONTROL); - IPW_DEBUG_FW_INFO("CX2_DMA_I_DMA_CONTROL is 0x%x \n", register_value); + register_value = ipw_read_reg32(priv, IPW_DMA_I_DMA_CONTROL); + IPW_DEBUG_FW_INFO("IPW_DMA_I_DMA_CONTROL is 0x%x \n", register_value); /* Print the CB values */ cb_fields_address = address; @@ -2308,9 +2443,9 @@ static int ipw_fw_dma_command_block_index(struct ipw_priv *priv) u32 current_cb_index = 0; IPW_DEBUG_FW("<< :\n"); - current_cb_address = ipw_read_reg32(priv, CX2_DMA_I_CURRENT_CB); + current_cb_address = ipw_read_reg32(priv, IPW_DMA_I_CURRENT_CB); - current_cb_index = (current_cb_address - CX2_SHARED_SRAM_DMA_CONTROL) / + current_cb_index = (current_cb_address - IPW_SHARED_SRAM_DMA_CONTROL) / sizeof(struct command_block); IPW_DEBUG_FW_INFO("Current CB index 0x%x address = 0x%X \n", @@ -2439,8 +2574,8 @@ static int ipw_fw_dma_wait(struct ipw_priv *priv) ipw_fw_dma_abort(priv); /*Disable the DMA in the CSR register */ - ipw_set_bit(priv, CX2_RESET_REG, - CX2_RESET_REG_MASTER_DISABLED | CX2_RESET_REG_STOP_MASTER); + ipw_set_bit(priv, IPW_RESET_REG, + IPW_RESET_REG_MASTER_DISABLED | IPW_RESET_REG_STOP_MASTER); IPW_DEBUG_FW("<< dmaWaitSync \n"); return 0; @@ -2504,10 +2639,10 @@ static int ipw_stop_master(struct ipw_priv *priv) IPW_DEBUG_TRACE(">> \n"); /* stop master. typical delay - 0 */ - ipw_set_bit(priv, CX2_RESET_REG, CX2_RESET_REG_STOP_MASTER); + ipw_set_bit(priv, IPW_RESET_REG, IPW_RESET_REG_STOP_MASTER); - rc = ipw_poll_bit(priv, CX2_RESET_REG, - CX2_RESET_REG_MASTER_DISABLED, 100); + rc = ipw_poll_bit(priv, IPW_RESET_REG, + IPW_RESET_REG_MASTER_DISABLED, 100); if (rc < 0) { IPW_ERROR("stop master failed in 10ms\n"); return -1; @@ -2523,7 +2658,7 @@ static void ipw_arc_release(struct ipw_priv *priv) IPW_DEBUG_TRACE(">> \n"); mdelay(5); - ipw_clear_bit(priv, CX2_RESET_REG, CBD_RESET_REG_PRINCETON_RESET); + ipw_clear_bit(priv, IPW_RESET_REG, CBD_RESET_REG_PRINCETON_RESET); /* no one knows timing, for safety add some delay */ mdelay(5); @@ -2540,7 +2675,7 @@ struct fw_chunk { }; #define IPW_FW_MAJOR_VERSION 2 -#define IPW_FW_MINOR_VERSION 2 +#define IPW_FW_MINOR_VERSION 3 #define IPW_FW_MINOR(x) ((x & 0xff) >> 8) #define IPW_FW_MAJOR(x) (x & 0xff) @@ -2574,8 +2709,8 @@ static int ipw_load_ucode(struct ipw_priv *priv, u8 * data, size_t len) // spin_lock_irqsave(&priv->lock, flags); - for (addr = CX2_SHARED_LOWER_BOUND; - addr < CX2_REGISTER_DOMAIN1_END; addr += 4) { + for (addr = IPW_SHARED_LOWER_BOUND; + addr < IPW_REGISTER_DOMAIN1_END; addr += 4) { ipw_write32(priv, addr, 0); } @@ -2584,16 +2719,16 @@ static int ipw_load_ucode(struct ipw_priv *priv, u8 * data, size_t len) /* destroy DMA queues */ /* reset sequence */ - ipw_write_reg32(priv, CX2_MEM_HALT_AND_RESET, CX2_BIT_HALT_RESET_ON); + ipw_write_reg32(priv, IPW_MEM_HALT_AND_RESET, IPW_BIT_HALT_RESET_ON); ipw_arc_release(priv); - ipw_write_reg32(priv, CX2_MEM_HALT_AND_RESET, CX2_BIT_HALT_RESET_OFF); + ipw_write_reg32(priv, IPW_MEM_HALT_AND_RESET, IPW_BIT_HALT_RESET_OFF); mdelay(1); /* reset PHY */ - ipw_write_reg32(priv, CX2_INTERNAL_CMD_EVENT, CX2_BASEBAND_POWER_DOWN); + ipw_write_reg32(priv, IPW_INTERNAL_CMD_EVENT, IPW_BASEBAND_POWER_DOWN); mdelay(1); - ipw_write_reg32(priv, CX2_INTERNAL_CMD_EVENT, 0); + ipw_write_reg32(priv, IPW_INTERNAL_CMD_EVENT, 0); mdelay(1); /* enable ucode store */ @@ -2611,19 +2746,19 @@ static int ipw_load_ucode(struct ipw_priv *priv, u8 * data, size_t len) */ /* load new ipw uCode */ for (i = 0; i < len / 2; i++) - ipw_write_reg16(priv, CX2_BASEBAND_CONTROL_STORE, + ipw_write_reg16(priv, IPW_BASEBAND_CONTROL_STORE, cpu_to_le16(image[i])); /* enable DINO */ - ipw_write_reg8(priv, CX2_BASEBAND_CONTROL_STATUS, 0); - ipw_write_reg8(priv, CX2_BASEBAND_CONTROL_STATUS, DINO_ENABLE_SYSTEM); + ipw_write_reg8(priv, IPW_BASEBAND_CONTROL_STATUS, 0); + ipw_write_reg8(priv, IPW_BASEBAND_CONTROL_STATUS, DINO_ENABLE_SYSTEM); /* this is where the igx / win driver deveates from the VAP driver. */ /* wait for alive response */ for (i = 0; i < 100; i++) { /* poll for incoming data */ - cr = ipw_read_reg8(priv, CX2_BASEBAND_CONTROL_STATUS); + cr = ipw_read_reg8(priv, IPW_BASEBAND_CONTROL_STATUS); if (cr & DINO_RXFIFO_DATA) break; mdelay(1); @@ -2636,7 +2771,7 @@ static int ipw_load_ucode(struct ipw_priv *priv, u8 * data, size_t len) for (i = 0; i < ARRAY_SIZE(response_buffer); i++) response_buffer[i] = le32_to_cpu(ipw_read_reg32(priv, - CX2_BASEBAND_RX_FIFO_READ)); + IPW_BASEBAND_RX_FIFO_READ)); memcpy(&priv->dino_alive, response_buffer, sizeof(priv->dino_alive)); if (priv->dino_alive.alive_command == 1 @@ -2665,7 +2800,7 @@ static int ipw_load_ucode(struct ipw_priv *priv, u8 * data, size_t len) /* disable DINO, otherwise for some reason firmware have problem getting alive resp. */ - ipw_write_reg8(priv, CX2_BASEBAND_CONTROL_STATUS, 0); + ipw_write_reg8(priv, IPW_BASEBAND_CONTROL_STATUS, 0); // spin_unlock_irqrestore(&priv->lock, flags); @@ -2738,16 +2873,16 @@ static int ipw_stop_nic(struct ipw_priv *priv) int rc = 0; /* stop */ - ipw_write32(priv, CX2_RESET_REG, CX2_RESET_REG_STOP_MASTER); + ipw_write32(priv, IPW_RESET_REG, IPW_RESET_REG_STOP_MASTER); - rc = ipw_poll_bit(priv, CX2_RESET_REG, - CX2_RESET_REG_MASTER_DISABLED, 500); + rc = ipw_poll_bit(priv, IPW_RESET_REG, + IPW_RESET_REG_MASTER_DISABLED, 500); if (rc < 0) { IPW_ERROR("wait for reg master disabled failed\n"); return rc; } - ipw_set_bit(priv, CX2_RESET_REG, CBD_RESET_REG_PRINCETON_RESET); + ipw_set_bit(priv, IPW_RESET_REG, CBD_RESET_REG_PRINCETON_RESET); return rc; } @@ -2757,14 +2892,14 @@ static void ipw_start_nic(struct ipw_priv *priv) IPW_DEBUG_TRACE(">>\n"); /* prvHwStartNic release ARC */ - ipw_clear_bit(priv, CX2_RESET_REG, - CX2_RESET_REG_MASTER_DISABLED | - CX2_RESET_REG_STOP_MASTER | + ipw_clear_bit(priv, IPW_RESET_REG, + IPW_RESET_REG_MASTER_DISABLED | + IPW_RESET_REG_STOP_MASTER | CBD_RESET_REG_PRINCETON_RESET); /* enable power management */ - ipw_set_bit(priv, CX2_GP_CNTRL_RW, - CX2_GP_CNTRL_BIT_HOST_ALLOWS_STANDBY); + ipw_set_bit(priv, IPW_GP_CNTRL_RW, + IPW_GP_CNTRL_BIT_HOST_ALLOWS_STANDBY); IPW_DEBUG_TRACE("<<\n"); } @@ -2777,25 +2912,25 @@ static int ipw_init_nic(struct ipw_priv *priv) /* reset */ /*prvHwInitNic */ /* set "initialization complete" bit to move adapter to D0 state */ - ipw_set_bit(priv, CX2_GP_CNTRL_RW, CX2_GP_CNTRL_BIT_INIT_DONE); + ipw_set_bit(priv, IPW_GP_CNTRL_RW, IPW_GP_CNTRL_BIT_INIT_DONE); /* low-level PLL activation */ - ipw_write32(priv, CX2_READ_INT_REGISTER, - CX2_BIT_INT_HOST_SRAM_READ_INT_REGISTER); + ipw_write32(priv, IPW_READ_INT_REGISTER, + IPW_BIT_INT_HOST_SRAM_READ_INT_REGISTER); /* wait for clock stabilization */ - rc = ipw_poll_bit(priv, CX2_GP_CNTRL_RW, - CX2_GP_CNTRL_BIT_CLOCK_READY, 250); + rc = ipw_poll_bit(priv, IPW_GP_CNTRL_RW, + IPW_GP_CNTRL_BIT_CLOCK_READY, 250); if (rc < 0) IPW_DEBUG_INFO("FAILED wait for clock stablization\n"); /* assert SW reset */ - ipw_set_bit(priv, CX2_RESET_REG, CX2_RESET_REG_SW_RESET); + ipw_set_bit(priv, IPW_RESET_REG, IPW_RESET_REG_SW_RESET); udelay(10); /* set "initialization complete" bit to move adapter to D0 state */ - ipw_set_bit(priv, CX2_GP_CNTRL_RW, CX2_GP_CNTRL_BIT_INIT_DONE); + ipw_set_bit(priv, IPW_GP_CNTRL_RW, IPW_GP_CNTRL_BIT_INIT_DONE); IPW_DEBUG_TRACE(">>\n"); return 0; @@ -2853,7 +2988,7 @@ static int ipw_get_fw(struct ipw_priv *priv, return 0; } -#define CX2_RX_BUF_SIZE (3000) +#define IPW_RX_BUF_SIZE (3000) static inline void ipw_rx_queue_reset(struct ipw_priv *priv, struct ipw_rx_queue *rxq) @@ -2872,7 +3007,7 @@ static inline void ipw_rx_queue_reset(struct ipw_priv *priv, * to an SKB, so we need to unmap and free potential storage */ if (rxq->pool[i].skb != NULL) { pci_unmap_single(priv->pci_dev, rxq->pool[i].dma_addr, - CX2_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); + IPW_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); dev_kfree_skb(rxq->pool[i].skb); rxq->pool[i].skb = NULL; } @@ -2920,7 +3055,7 @@ static int ipw_load(struct ipw_priv *priv) rc = ipw_get_fw(priv, &firmware, IPW_FW_NAME("ibss")); break; -#ifdef CONFIG_IPW_MONITOR +#ifdef CONFIG_IPW2200_MONITOR case IW_MODE_MONITOR: rc = ipw_get_fw(priv, &ucode, IPW_FW_NAME("sniffer_ucode")); @@ -2962,11 +3097,11 @@ static int ipw_load(struct ipw_priv *priv) retry: /* Ensure interrupts are disabled */ - ipw_write32(priv, CX2_INTA_MASK_R, ~CX2_INTA_MASK_ALL); + ipw_write32(priv, IPW_INTA_MASK_R, ~IPW_INTA_MASK_ALL); priv->status &= ~STATUS_INT_ENABLED; /* ack pending interrupts */ - ipw_write32(priv, CX2_INTA_RW, CX2_INTA_MASK_ALL); + ipw_write32(priv, IPW_INTA_RW, IPW_INTA_MASK_ALL); ipw_stop_nic(priv); @@ -2976,8 +3111,8 @@ static int ipw_load(struct ipw_priv *priv) goto error; } - ipw_zero_memory(priv, CX2_NIC_SRAM_LOWER_BOUND, - CX2_NIC_SRAM_UPPER_BOUND - CX2_NIC_SRAM_LOWER_BOUND); + ipw_zero_memory(priv, IPW_NIC_SRAM_LOWER_BOUND, + IPW_NIC_SRAM_UPPER_BOUND - IPW_NIC_SRAM_LOWER_BOUND); /* DMA the initial boot firmware into the device */ rc = ipw_load_firmware(priv, bootfw->data + sizeof(struct fw_header), @@ -2991,8 +3126,8 @@ static int ipw_load(struct ipw_priv *priv) ipw_start_nic(priv); /* wait for the device to finish it's initial startup sequence */ - rc = ipw_poll_bit(priv, CX2_INTA_RW, - CX2_INTA_BIT_FW_INITIALIZATION_DONE, 500); + rc = ipw_poll_bit(priv, IPW_INTA_RW, + IPW_INTA_BIT_FW_INITIALIZATION_DONE, 500); if (rc < 0) { IPW_ERROR("device failed to boot initial fw image\n"); goto error; @@ -3000,7 +3135,7 @@ static int ipw_load(struct ipw_priv *priv) IPW_DEBUG_INFO("initial device response after %dms\n", rc); /* ack fw init done interrupt */ - ipw_write32(priv, CX2_INTA_RW, CX2_INTA_BIT_FW_INITIALIZATION_DONE); + ipw_write32(priv, IPW_INTA_RW, IPW_INTA_BIT_FW_INITIALIZATION_DONE); /* DMA the ucode into the device */ rc = ipw_load_ucode(priv, ucode->data + sizeof(struct fw_header), @@ -3031,14 +3166,14 @@ static int ipw_load(struct ipw_priv *priv) } /* Ensure interrupts are disabled */ - ipw_write32(priv, CX2_INTA_MASK_R, ~CX2_INTA_MASK_ALL); + ipw_write32(priv, IPW_INTA_MASK_R, ~IPW_INTA_MASK_ALL); /* ack pending interrupts */ - ipw_write32(priv, CX2_INTA_RW, CX2_INTA_MASK_ALL); + ipw_write32(priv, IPW_INTA_RW, IPW_INTA_MASK_ALL); /* kick start the device */ ipw_start_nic(priv); - if (ipw_read32(priv, CX2_INTA_RW) & CX2_INTA_BIT_PARITY_ERROR) { + if (ipw_read32(priv, IPW_INTA_RW) & IPW_INTA_BIT_PARITY_ERROR) { if (retries > 0) { IPW_WARNING("Parity error. Retrying init.\n"); retries--; @@ -3051,8 +3186,8 @@ static int ipw_load(struct ipw_priv *priv) } /* wait for the device */ - rc = ipw_poll_bit(priv, CX2_INTA_RW, - CX2_INTA_BIT_FW_INITIALIZATION_DONE, 500); + rc = ipw_poll_bit(priv, IPW_INTA_RW, + IPW_INTA_BIT_FW_INITIALIZATION_DONE, 500); if (rc < 0) { IPW_ERROR("device failed to start after 500ms\n"); goto error; @@ -3060,7 +3195,7 @@ static int ipw_load(struct ipw_priv *priv) IPW_DEBUG_INFO("device response after %dms\n", rc); /* ack fw init done interrupt */ - ipw_write32(priv, CX2_INTA_RW, CX2_INTA_BIT_FW_INITIALIZATION_DONE); + ipw_write32(priv, IPW_INTA_RW, IPW_INTA_BIT_FW_INITIALIZATION_DONE); /* read eeprom data and initialize the eeprom region of sram */ priv->eeprom_delay = 1; @@ -3072,10 +3207,10 @@ static int ipw_load(struct ipw_priv *priv) /* Ensure our queue has valid packets */ ipw_rx_queue_replenish(priv); - ipw_write32(priv, CX2_RX_READ_INDEX, priv->rxq->read); + ipw_write32(priv, IPW_RX_READ_INDEX, priv->rxq->read); /* ack pending interrupts */ - ipw_write32(priv, CX2_INTA_RW, CX2_INTA_MASK_ALL); + ipw_write32(priv, IPW_INTA_RW, IPW_INTA_MASK_ALL); #ifndef CONFIG_PM release_firmware(bootfw); @@ -3829,8 +3964,8 @@ static inline void ipw_handle_missed_beacon(struct ipw_priv *priv, * stuck (only if we aren't roaming -- * otherwise we'll never scan more than 2 or 3 * channels..) */ - IPW_DEBUG(IPW_DL_INFO | IPW_DL_NOTIF | - IPW_DL_STATE, "Aborting scan with missed beacon.\n"); + IPW_DEBUG(IPW_DL_INFO | IPW_DL_NOTIF | IPW_DL_STATE, + "Aborting scan with missed beacon.\n"); queue_work(priv->workqueue, &priv->abort_scan); } @@ -3891,6 +4026,35 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, priv->status &= ~STATUS_ASSOCIATING; priv->status |= STATUS_ASSOCIATED; +#ifdef CONFIG_IPW_QOS + if (priv->status & STATUS_AUTH) { + if ((sizeof + (struct + ieee80211_assoc_response_frame) + <= notif->size) + && (notif->size <= 2314)) { + struct + ieee80211_rx_stats + stats = { + .len = + notif-> + size - 1, + }; + + IPW_DEBUG_QOS + ("QoS Associate " + "size %d\n", + notif->size); + ieee80211_rx_mgt(priv-> + ieee, + (struct + ieee80211_hdr + *) + ¬if->u.raw, &stats); + } + } +#endif + schedule_work(&priv->link_up); break; @@ -3970,12 +4134,21 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, ~(STATUS_DISASSOCIATING | STATUS_ASSOCIATING | STATUS_ASSOCIATED | STATUS_AUTH); + if (priv->assoc_network + && (priv->assoc_network-> + capability & + WLAN_CAPABILITY_IBSS)) + ipw_remove_current_network + (priv); schedule_work(&priv->link_down); break; } + case CMAS_RX_ASSOC_RESP: + break; + default: IPW_ERROR("assoc: unknown (%d)\n", assoc->state); @@ -4060,6 +4233,7 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, case CMAS_RX_ASSOC_RESP: IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | IPW_DL_ASSOC, "RX_ASSOC_RESP\n"); + break; case CMAS_ASSOCIATED: IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | @@ -4106,6 +4280,19 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, cancel_delayed_work(&priv->scan_check); + if (priv->status & STATUS_EXIT_PENDING) + break; + + priv->ieee->scans++; + +#ifdef CONFIG_IPW2200_MONITOR + if (priv->ieee->iw_mode == IW_MODE_MONITOR) { + queue_work(priv->workqueue, + &priv->request_scan); + break; + } +#endif /* CONFIG_IPW2200_MONITOR */ + if (!(priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING | STATUS_ROAMING | @@ -4124,8 +4311,6 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, && priv->status & STATUS_ASSOCIATED) queue_delayed_work(priv->workqueue, &priv->request_scan, HZ); - - priv->ieee->scans++; break; } @@ -4256,43 +4441,43 @@ static int ipw_queue_reset(struct ipw_priv *priv) ipw_tx_queue_free(priv); /* Tx CMD queue */ rc = ipw_queue_tx_init(priv, &priv->txq_cmd, nTxCmd, - CX2_TX_CMD_QUEUE_READ_INDEX, - CX2_TX_CMD_QUEUE_WRITE_INDEX, - CX2_TX_CMD_QUEUE_BD_BASE, - CX2_TX_CMD_QUEUE_BD_SIZE); + IPW_TX_CMD_QUEUE_READ_INDEX, + IPW_TX_CMD_QUEUE_WRITE_INDEX, + IPW_TX_CMD_QUEUE_BD_BASE, + IPW_TX_CMD_QUEUE_BD_SIZE); if (rc) { IPW_ERROR("Tx Cmd queue init failed\n"); goto error; } /* Tx queue(s) */ rc = ipw_queue_tx_init(priv, &priv->txq[0], nTx, - CX2_TX_QUEUE_0_READ_INDEX, - CX2_TX_QUEUE_0_WRITE_INDEX, - CX2_TX_QUEUE_0_BD_BASE, CX2_TX_QUEUE_0_BD_SIZE); + IPW_TX_QUEUE_0_READ_INDEX, + IPW_TX_QUEUE_0_WRITE_INDEX, + IPW_TX_QUEUE_0_BD_BASE, IPW_TX_QUEUE_0_BD_SIZE); if (rc) { IPW_ERROR("Tx 0 queue init failed\n"); goto error; } rc = ipw_queue_tx_init(priv, &priv->txq[1], nTx, - CX2_TX_QUEUE_1_READ_INDEX, - CX2_TX_QUEUE_1_WRITE_INDEX, - CX2_TX_QUEUE_1_BD_BASE, CX2_TX_QUEUE_1_BD_SIZE); + IPW_TX_QUEUE_1_READ_INDEX, + IPW_TX_QUEUE_1_WRITE_INDEX, + IPW_TX_QUEUE_1_BD_BASE, IPW_TX_QUEUE_1_BD_SIZE); if (rc) { IPW_ERROR("Tx 1 queue init failed\n"); goto error; } rc = ipw_queue_tx_init(priv, &priv->txq[2], nTx, - CX2_TX_QUEUE_2_READ_INDEX, - CX2_TX_QUEUE_2_WRITE_INDEX, - CX2_TX_QUEUE_2_BD_BASE, CX2_TX_QUEUE_2_BD_SIZE); + IPW_TX_QUEUE_2_READ_INDEX, + IPW_TX_QUEUE_2_WRITE_INDEX, + IPW_TX_QUEUE_2_BD_BASE, IPW_TX_QUEUE_2_BD_SIZE); if (rc) { IPW_ERROR("Tx 2 queue init failed\n"); goto error; } rc = ipw_queue_tx_init(priv, &priv->txq[3], nTx, - CX2_TX_QUEUE_3_READ_INDEX, - CX2_TX_QUEUE_3_WRITE_INDEX, - CX2_TX_QUEUE_3_BD_BASE, CX2_TX_QUEUE_3_BD_SIZE); + IPW_TX_QUEUE_3_READ_INDEX, + IPW_TX_QUEUE_3_WRITE_INDEX, + IPW_TX_QUEUE_3_BD_BASE, IPW_TX_QUEUE_3_BD_SIZE); if (rc) { IPW_ERROR("Tx 3 queue init failed\n"); goto error; @@ -4382,7 +4567,7 @@ static int ipw_queue_tx_hcmd(struct ipw_priv *priv, int hcmd, void *buf, * Rx theory of operation * * The host allocates 32 DMA target addresses and passes the host address - * to the firmware at register CX2_RFDS_TABLE_LOWER + N * RFD_SIZE where N is + * to the firmware at register IPW_RFDS_TABLE_LOWER + N * RFD_SIZE where N is * 0 to 31 * * Rx Queue Indexes @@ -4466,7 +4651,7 @@ static void ipw_rx_queue_restock(struct ipw_priv *priv) rxb = list_entry(element, struct ipw_rx_mem_buffer, list); list_del(element); - ipw_write32(priv, CX2_RFDS_TABLE_LOWER + rxq->write * RFD_SIZE, + ipw_write32(priv, IPW_RFDS_TABLE_LOWER + rxq->write * RFD_SIZE, rxb->dma_addr); rxq->queue[rxq->write] = rxb; rxq->write = (rxq->write + 1) % RX_QUEUE_SIZE; @@ -4481,7 +4666,7 @@ static void ipw_rx_queue_restock(struct ipw_priv *priv) /* If we've added more space for the firmware to place data, tell it */ if (write != rxq->write) - ipw_write32(priv, CX2_RX_WRITE_INDEX, rxq->write); + ipw_write32(priv, IPW_RX_WRITE_INDEX, rxq->write); } /* @@ -4502,7 +4687,7 @@ static void ipw_rx_queue_replenish(void *data) while (!list_empty(&rxq->rx_used)) { element = rxq->rx_used.next; rxb = list_entry(element, struct ipw_rx_mem_buffer, list); - rxb->skb = alloc_skb(CX2_RX_BUF_SIZE, GFP_ATOMIC); + rxb->skb = alloc_skb(IPW_RX_BUF_SIZE, GFP_ATOMIC); if (!rxb->skb) { printk(KERN_CRIT "%s: Can not allocate SKB buffers.\n", priv->net_dev->name); @@ -4516,7 +4701,7 @@ static void ipw_rx_queue_replenish(void *data) rxb->rxb = (struct ipw_rx_buffer *)rxb->skb->data; rxb->dma_addr = pci_map_single(priv->pci_dev, rxb->skb->data, - CX2_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); + IPW_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); list_add_tail(&rxb->list, &rxq->rx_free); rxq->free_count++; @@ -4549,7 +4734,7 @@ static void ipw_rx_queue_free(struct ipw_priv *priv, struct ipw_rx_queue *rxq) for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) { if (rxq->pool[i].skb != NULL) { pci_unmap_single(priv->pci_dev, rxq->pool[i].dma_addr, - CX2_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); + IPW_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); dev_kfree_skb(rxq->pool[i].skb); } } @@ -5195,20 +5380,21 @@ static void ipw_adhoc_create(struct ipw_priv *priv, * with an invalid channel for wireless mode will trigger a * FW fatal error. */ - network->mode = is_valid_channel(priv->ieee->mode, priv->channel); - if (!network->mode) { + if (!ieee80211_is_valid_channel(priv->ieee, priv->channel)) { + const struct ieee80211_geo *geo = ieee80211_get_geo(priv->ieee); IPW_WARNING("Overriding invalid channel\n"); if (priv->ieee->mode & IEEE_A) { network->mode = IEEE_A; - priv->channel = band_a_active_channel[0]; + priv->channel = geo->a[0].channel; } else if (priv->ieee->mode & IEEE_G) { network->mode = IEEE_G; - priv->channel = band_b_active_channel[0]; + priv->channel = geo->bg[0].channel; } else { network->mode = IEEE_B; - priv->channel = band_b_active_channel[0]; + priv->channel = geo->bg[0].channel; } - } + } else + network->mode = priv->ieee->mode; network->channel = priv->channel; priv->config |= CFG_ADHOC_PERSIST; @@ -5239,7 +5425,34 @@ static void ipw_adhoc_create(struct ipw_priv *priv, network->rsn_ie_len = 0; } -static void ipw_send_wep_keys(struct ipw_priv *priv) +static void ipw_send_tgi_tx_key(struct ipw_priv *priv, int type, int index) +{ + struct ipw_tgi_tx_key *key; + struct host_cmd cmd = { + .cmd = IPW_CMD_TGI_TX_KEY, + .len = sizeof(*key) + }; + + if (!(priv->ieee->sec.flags & (1 << index))) + return; + + key = (struct ipw_tgi_tx_key *)&cmd.param; + key->key_id = index; + memcpy(key->key, priv->ieee->sec.keys[index], SCM_TEMPORAL_KEY_LENGTH); + key->security_type = type; + key->station_index = 0; /* always 0 for BSS */ + key->flags = 0; + /* 0 for new key; previous value of counter (after fatal error) */ + key->tx_counter[0] = 0; + key->tx_counter[1] = 0; + + if (ipw_send_cmd(priv, &cmd)) { + IPW_ERROR("failed to send TGI_TX_KEY command\n"); + return; + } +} + +static void ipw_send_wep_keys(struct ipw_priv *priv, int type) { struct ipw_wep_key *key; int i; @@ -5252,15 +5465,18 @@ static void ipw_send_wep_keys(struct ipw_priv *priv) key->cmd_id = DINO_CMD_WEP_KEY; key->seq_num = 0; + /* Note: AES keys cannot be set for multiple times. + * Only set it at the first time. */ for (i = 0; i < 4; i++) { - key->key_index = i; - if (!(priv->sec.flags & (1 << i))) + key->key_index = i | type; + if (!(priv->ieee->sec.flags & (1 << i))) { key->key_size = 0; - else { - key->key_size = priv->sec.key_sizes[i]; - memcpy(key->key, priv->sec.keys[i], key->key_size); + continue; } + key->key_size = priv->ieee->sec.key_sizes[i]; + memcpy(key->key, priv->ieee->sec.keys[i], key->key_size); + if (ipw_send_cmd(priv, &cmd)) { IPW_ERROR("failed to send WEP_KEY command\n"); return; @@ -5268,6 +5484,52 @@ static void ipw_send_wep_keys(struct ipw_priv *priv) } } +static void ipw_set_hwcrypto_keys(struct ipw_priv *priv) +{ + switch (priv->ieee->sec.level) { + case SEC_LEVEL_3: + if (priv->ieee->sec.flags & SEC_ACTIVE_KEY) + ipw_send_tgi_tx_key(priv, + DCT_FLAG_EXT_SECURITY_CCM, + priv->ieee->sec.active_key); + ipw_send_wep_keys(priv, DCW_WEP_KEY_SEC_TYPE_CCM); + + priv->sys_config.disable_unicast_decryption = 0; + priv->sys_config.disable_multicast_decryption = 0; + priv->ieee->host_decrypt = 0; + if (ipw_send_system_config(priv, &priv->sys_config)) + IPW_ERROR("ipw_send_system_config failed\n"); + + break; + case SEC_LEVEL_2: + if (priv->ieee->sec.flags & SEC_ACTIVE_KEY) + ipw_send_tgi_tx_key(priv, + DCT_FLAG_EXT_SECURITY_TKIP, + priv->ieee->sec.active_key); + + priv->sys_config.disable_unicast_decryption = 1; + priv->sys_config.disable_multicast_decryption = 1; + priv->ieee->host_decrypt = 1; + if (ipw_send_system_config(priv, &priv->sys_config)) + IPW_ERROR("ipw_send_system_config failed\n"); + + break; + case SEC_LEVEL_1: + ipw_send_wep_keys(priv, DCW_WEP_KEY_SEC_TYPE_WEP); + + priv->sys_config.disable_unicast_decryption = 0; + priv->sys_config.disable_multicast_decryption = 0; + priv->ieee->host_decrypt = 0; + if (ipw_send_system_config(priv, &priv->sys_config)) + IPW_ERROR("ipw_send_system_config failed\n"); + + break; + case SEC_LEVEL_0: + default: + break; + } +} + static void ipw_adhoc_check(void *data) { struct ipw_priv *priv = data; @@ -5321,8 +5583,7 @@ static void ipw_debug_config(struct ipw_priv *priv) #define ipw_debug_config(x) do {} while (0) #endif -static inline void ipw_set_fixed_rate(struct ipw_priv *priv, - struct ieee80211_network *network) +static inline void ipw_set_fixed_rate(struct ipw_priv *priv, int mode) { /* TODO: Verify that this works... */ struct ipw_fixed_rate fr = { @@ -5350,7 +5611,7 @@ static inline void ipw_set_fixed_rate(struct ipw_priv *priv, default: /* 2.4Ghz or Mixed */ /* IEEE_B */ - if (network->mode == IEEE_B) { + if (mode == IEEE_B) { if (fr.tx_rates & ~IEEE80211_CCK_RATES_MASK) { /* Invalid fixed rate mask */ IPW_DEBUG_WX @@ -5412,78 +5673,98 @@ static int ipw_request_scan(struct ipw_priv *priv) { struct ipw_scan_request_ext scan; int channel_index = 0; - int i, err, scan_type; + int i, err = 0, scan_type; + const struct ieee80211_geo *geo; +#ifdef CONFIG_IPW2200_MONITOR + u8 channel; +#endif - if (priv->status & STATUS_EXIT_PENDING) { - IPW_DEBUG_SCAN("Aborting scan due to device shutdown\n"); - priv->status |= STATUS_SCAN_PENDING; - return 0; - } + down(&priv->sem); + + geo = ieee80211_get_geo(priv->ieee); if (priv->status & STATUS_SCANNING) { IPW_DEBUG_HC("Concurrent scan requested. Ignoring.\n"); -// IPW_DEBUG_HC("Concurrent scan requested. Aborting first.\n"); priv->status |= STATUS_SCAN_PENDING; -// ipw_abort_scan(priv); - return 0; + goto done; } if (priv->status & STATUS_SCAN_ABORTING) { IPW_DEBUG_HC("Scan request while abort pending. Queuing.\n"); priv->status |= STATUS_SCAN_PENDING; - return 0; + goto done; } if (priv->status & STATUS_RF_KILL_MASK) { IPW_DEBUG_HC("Aborting scan due to RF Kill activation\n"); priv->status |= STATUS_SCAN_PENDING; - return 0; + goto done; } memset(&scan, 0, sizeof(scan)); - scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_SCAN] = cpu_to_le16(20); + if (priv->config & CFG_SPEED_SCAN) + scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_SCAN] = + cpu_to_le16(30); + else + scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_SCAN] = + cpu_to_le16(20); + scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN] = cpu_to_le16(20); scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] = cpu_to_le16(20); scan.full_scan_index = cpu_to_le32(ieee80211_get_scans(priv->ieee)); -#ifdef CONFIG_IPW_MONITOR +#ifdef CONFIG_IPW2200_MONITOR if (priv->ieee->iw_mode == IW_MODE_MONITOR) { - u8 band = 0, channel = priv->channel; + u8 band = 0; - if (is_valid_channel(IEEE_A, channel)) + switch (ieee80211_is_valid_channel(priv->ieee, priv->channel)) { + case IEEE80211_52GHZ_BAND: band = (u8) (IPW_A_MODE << 6) | 1; + channel = priv->channel; + break; - if (is_valid_channel(IEEE_B | IEEE_G, channel)) + case IEEE80211_24GHZ_BAND: band = (u8) (IPW_B_MODE << 6) | 1; + channel = priv->channel; + break; - if (band == 0) { + default: band = (u8) (IPW_B_MODE << 6) | 1; channel = 9; + break; } - scan.channels_list[channel_index++] = band; - scan.channels_list[channel_index] = channel; - ipw_set_scan_type(&scan, channel_index, - IPW_SCAN_PASSIVE_FULL_DWELL_SCAN); + scan.channels_list[0] = band; + scan.channels_list[1] = channel; + ipw_set_scan_type(&scan, 1, IPW_SCAN_PASSIVE_FULL_DWELL_SCAN); + /* NOTE: The card will sit on this channel for this time + * period. Scan aborts are timing sensitive and frequently + * result in firmware restarts. As such, it is best to + * set a small dwell_time here and just keep re-issuing + * scans. Otherwise fast channel hopping will not actually + * hop channels. + * + * TODO: Move SPEED SCAN support to all modes and bands */ scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] = cpu_to_le16(2000); } else { -#endif /* CONFIG_IPW_MONITOR */ - /* If we are roaming, then make this a directed scan for the current - * network. Otherwise, ensure that every other scan is a fast - * channel hop scan */ - if ((priv->status & STATUS_ROAMING) || (!(priv->status & STATUS_ASSOCIATED) && (priv->config & CFG_STATIC_ESSID) && (le32_to_cpu(scan.full_scan_index) % 2))) { /* || ( - (priv->status & STATUS_ASSOCIATED) && - (priv->ieee->iw_mode == IW_MODE_ADHOC))) { */ +#endif /* CONFIG_IPW2200_MONITOR */ + /* If we are roaming, then make this a directed scan for the + * current network. Otherwise, ensure that every other scan + * is a fast channel hop scan */ + if ((priv->status & STATUS_ROAMING) + || (!(priv->status & STATUS_ASSOCIATED) + && (priv->config & CFG_STATIC_ESSID) + && (le32_to_cpu(scan.full_scan_index) % 2))) { err = ipw_send_ssid(priv, priv->essid, priv->essid_len); if (err) { - IPW_DEBUG_HC - ("Attempt to send SSID command failed.\n"); - return err; + IPW_DEBUG_HC("Attempt to send SSID command " + "failed.\n"); + goto done; } scan_type = IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN; @@ -5491,17 +5772,16 @@ static int ipw_request_scan(struct ipw_priv *priv) scan_type = IPW_SCAN_ACTIVE_BROADCAST_SCAN; } + /* Add channels to the scan list */ if (priv->ieee->freq_band & IEEE80211_52GHZ_BAND) { int start = channel_index; - for (i = 0; i < MAX_A_CHANNELS; i++) { - if (band_a_active_channel[i] == 0) - break; + for (i = 0; i < geo->a_channels; i++) { if ((priv->status & STATUS_ASSOCIATED) && - band_a_active_channel[i] == priv->channel) + geo->a[i].channel == priv->channel) continue; channel_index++; scan.channels_list[channel_index] = - band_a_active_channel[i]; + geo->a[i].channel; ipw_set_scan_type(&scan, channel_index, scan_type); } @@ -5516,17 +5796,55 @@ static int ipw_request_scan(struct ipw_priv *priv) if (priv->ieee->freq_band & IEEE80211_24GHZ_BAND) { int start = channel_index; - for (i = 0; i < MAX_B_CHANNELS; i++) { - if (band_b_active_channel[i] == 0) - break; - if ((priv->status & STATUS_ASSOCIATED) && - band_b_active_channel[i] == priv->channel) - continue; - channel_index++; - scan.channels_list[channel_index] = - band_b_active_channel[i]; - ipw_set_scan_type(&scan, channel_index, - scan_type); + if (priv->config & CFG_SPEED_SCAN) { + u8 channels[IEEE80211_24GHZ_CHANNELS] = { + /* nop out the list */ + [0] = 0 + }; + + u8 channel; + while (channel_index < IPW_SCAN_CHANNELS) { + channel = + priv->speed_scan[priv-> + speed_scan_pos]; + if (channel == 0) { + priv->speed_scan_pos = 0; + channel = priv->speed_scan[0]; + } + if ((priv->status & STATUS_ASSOCIATED) + && channel == priv->channel) { + priv->speed_scan_pos++; + continue; + } + + /* If this channel has already been + * added in scan, break from loop + * and this will be the first channel + * in the next scan. + */ + if (channels[channel - 1] != 0) + break; + + channels[channel - 1] = 1; + priv->speed_scan_pos++; + channel_index++; + scan.channels_list[channel_index] = + channel; + ipw_set_scan_type(&scan, channel_index, + scan_type); + } + } else { + for (i = 0; i < geo->bg_channels; i++) { + if ((priv->status & STATUS_ASSOCIATED) + && geo->bg[i].channel == + priv->channel) + continue; + channel_index++; + scan.channels_list[channel_index] = + geo->bg[i].channel; + ipw_set_scan_type(&scan, channel_index, + scan_type); + } } if (start != channel_index) { @@ -5535,28 +5853,22 @@ static int ipw_request_scan(struct ipw_priv *priv) start); } } -#ifdef CONFIG_IPW_MONITOR +#ifdef CONFIG_IPW2200_MONITOR } #endif err = ipw_send_scan_request_ext(priv, &scan); if (err) { IPW_DEBUG_HC("Sending scan command failed: %08X\n", err); - return -EIO; + goto done; } priv->status |= STATUS_SCANNING; priv->status &= ~STATUS_SCAN_PENDING; - return 0; -} - -static void ipw_bg_request_scan(void *data) -{ - struct ipw_priv *priv = data; - down(&priv->sem); - ipw_request_scan(data); + done: up(&priv->sem); + return err; } static void ipw_bg_abort_scan(void *data) @@ -5608,7 +5920,8 @@ struct ipw_param { } wpa_param; struct { u32 len; - u8 *data; + u8 reserved[32]; + u8 data[0]; } wpa_ie; struct { int command; @@ -5631,29 +5944,9 @@ struct ipw_param { static int ipw_wpa_enable(struct ipw_priv *priv, int value) { - struct ieee80211_device *ieee = priv->ieee; - struct ieee80211_security sec = { - .flags = SEC_LEVEL | SEC_ENABLED, - }; - int ret = 0; - - ieee->wpa_enabled = value; - - if (value) { - sec.level = SEC_LEVEL_3; - sec.enabled = 1; - } else { - sec.level = SEC_LEVEL_0; - sec.enabled = 0; - ieee->wpa_ie_len = 0; - } - - if (ieee->set_security) - ieee->set_security(ieee->dev, &sec); - else - ret = -EOPNOTSUPP; - - return ret; + /* This is called when wpa_supplicant loads and closes the driver + * interface. */ + return 0; } #define AUTH_ALG_OPEN_SYSTEM 0x1 @@ -5714,9 +6007,37 @@ static int ipw_wpa_set_param(struct net_device *dev, u8 name, u32 value) break; - case IPW_PARAM_DROP_UNENCRYPTED: - priv->ieee->drop_unencrypted = value; - break; + case IPW_PARAM_DROP_UNENCRYPTED:{ + /* HACK: + * + * wpa_supplicant calls set_wpa_enabled when the driver + * is loaded and unloaded, regardless of if WPA is being + * used. No other calls are made which can be used to + * determine if encryption will be used or not prior to + * association being expected. If encryption is not being + * used, drop_unencrypted is set to false, else true -- we + * can use this to determine if the CAP_PRIVACY_ON bit should + * be set. + */ + struct ieee80211_security sec = { + .flags = SEC_ENABLED, + .enabled = value, + }; + priv->ieee->drop_unencrypted = value; + /* We only change SEC_LEVEL for open mode. Others + * are set by ipw_wpa_set_encryption. + */ + if (!value) { + sec.flags |= SEC_LEVEL; + sec.level = SEC_LEVEL_0; + } else { + sec.flags |= SEC_LEVEL; + sec.level = SEC_LEVEL_1; + } + if (priv->ieee->set_security) + priv->ieee->set_security(priv->ieee->dev, &sec); + break; + } case IPW_PARAM_PRIVACY_INVOKED: priv->ieee->privacy_invoked = value; @@ -5793,9 +6114,6 @@ static int ipw_wpa_set_wpa_ie(struct net_device *dev, struct ieee80211_device *ieee = priv->ieee; u8 *buf; - if (!ieee->wpa_enabled) - return -EOPNOTSUPP; - if (param->u.wpa_ie.len > MAX_WPA_IE_LEN || (param->u.wpa_ie.len && param->u.wpa_ie.data == NULL)) return -EINVAL; @@ -5857,6 +6175,7 @@ static int ipw_wpa_set_encryption(struct net_device *dev, if (strcmp(param->u.crypt.alg, "none") == 0) { if (crypt) { sec.enabled = 0; + sec.encrypt = 0; sec.level = SEC_LEVEL_0; sec.flags |= SEC_ENABLED | SEC_LEVEL; ieee80211_crypt_delayed_deinit(ieee, crypt); @@ -5864,8 +6183,14 @@ static int ipw_wpa_set_encryption(struct net_device *dev, goto done; } sec.enabled = 1; + sec.encrypt = 1; sec.flags |= SEC_ENABLED; + /* IPW HW cannot build TKIP MIC, host decryption still needed. */ + if (!(ieee->host_encrypt || ieee->host_decrypt) && + strcmp(param->u.crypt.alg, "TKIP")) + goto skip_host_crypt; + ops = ieee80211_get_crypto_ops(param->u.crypt.alg); if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) { request_module("ieee80211_crypt_wep"); @@ -5922,25 +6247,27 @@ static int ipw_wpa_set_encryption(struct net_device *dev, goto done; } + skip_host_crypt: if (param->u.crypt.set_tx) { ieee->tx_keyidx = param->u.crypt.idx; sec.active_key = param->u.crypt.idx; sec.flags |= SEC_ACTIVE_KEY; - } + } else + sec.flags &= ~SEC_ACTIVE_KEY; - if (ops->name != NULL) { - if (strcmp(ops->name, "WEP") == 0) { - memcpy(sec.keys[param->u.crypt.idx], - param->u.crypt.key, param->u.crypt.key_len); - sec.key_sizes[param->u.crypt.idx] = - param->u.crypt.key_len; - sec.flags |= (1 << param->u.crypt.idx); + if (param->u.crypt.alg != NULL) { + memcpy(sec.keys[param->u.crypt.idx], + param->u.crypt.key, param->u.crypt.key_len); + sec.key_sizes[param->u.crypt.idx] = param->u.crypt.key_len; + sec.flags |= (1 << param->u.crypt.idx); + + if (strcmp(param->u.crypt.alg, "WEP") == 0) { sec.flags |= SEC_LEVEL; sec.level = SEC_LEVEL_1; - } else if (strcmp(ops->name, "TKIP") == 0) { + } else if (strcmp(param->u.crypt.alg, "TKIP") == 0) { sec.flags |= SEC_LEVEL; sec.level = SEC_LEVEL_2; - } else if (strcmp(ops->name, "CCMP") == 0) { + } else if (strcmp(param->u.crypt.alg, "CCMP") == 0) { sec.flags |= SEC_LEVEL; sec.level = SEC_LEVEL_3; } @@ -6017,38 +6344,552 @@ static int ipw_wpa_supplicant(struct net_device *dev, struct iw_point *p) return ret; } -static int ipw_associate_network(struct ipw_priv *priv, - struct ieee80211_network *network, - struct ipw_supported_rates *rates, int roaming) +#ifdef CONFIG_IPW_QOS + +/* QoS */ +/* +* get the modulation type of the current network or +* the card current mode +*/ +u8 ipw_qos_current_mode(struct ipw_priv * priv) { - int err; + u8 mode = 0; - if (priv->config & CFG_FIXED_RATE) - ipw_set_fixed_rate(priv, network); + if (priv->status & STATUS_ASSOCIATED) { + unsigned long flags; - if (!(priv->config & CFG_STATIC_ESSID)) { - priv->essid_len = min(network->ssid_len, - (u8) IW_ESSID_MAX_SIZE); - memcpy(priv->essid, network->ssid, priv->essid_len); + spin_lock_irqsave(&priv->ieee->lock, flags); + mode = priv->assoc_network->mode; + spin_unlock_irqrestore(&priv->ieee->lock, flags); + } else { + mode = priv->ieee->mode; } + IPW_DEBUG_QOS("QoS network/card mode %d \n", mode); + return mode; +} - network->last_associate = jiffies; - - memset(&priv->assoc_request, 0, sizeof(priv->assoc_request)); - priv->assoc_request.channel = network->channel; - if ((priv->capability & CAP_PRIVACY_ON) && - (priv->capability & CAP_SHARED_KEY)) { - priv->assoc_request.auth_type = AUTH_SHARED_KEY; - priv->assoc_request.auth_key = priv->sec.active_key; +/* +* Handle management frame beacon and probe response +*/ +static int ipw_qos_handle_probe_reponse(struct ipw_priv *priv, + int active_network, + struct ieee80211_network *network) +{ + u32 size = sizeof(struct ieee80211_qos_parameters); + + if ((network->capability & WLAN_CAPABILITY_IBSS)) + network->qos_data.active = network->qos_data.supported; + + if (network->flags & NETWORK_HAS_QOS_MASK) { + if (active_network + && (network->flags & NETWORK_HAS_QOS_PARAMETERS)) + network->qos_data.active = network->qos_data.supported; + + if ((network->qos_data.active == 1) && (active_network == 1) && + (network->flags & NETWORK_HAS_QOS_PARAMETERS) && + (network->qos_data.old_param_count != + network->qos_data.param_count)) { + network->qos_data.old_param_count = + network->qos_data.param_count; + schedule_work(&priv->qos_activate); + IPW_DEBUG_QOS + ("QoS parameters change call qos_activate\n"); + } } else { - priv->assoc_request.auth_type = AUTH_OPEN; - priv->assoc_request.auth_key = 0; + if ((priv->ieee->mode == IEEE_B) || (network->mode == IEEE_B)) { + memcpy(&(network->qos_data.parameters), + &def_parameters_CCK, size); + } else { + memcpy(&(network->qos_data.parameters), + &def_parameters_OFDM, size); + } + if ((network->qos_data.active == 1) && (active_network == 1)) { + IPW_DEBUG_QOS("QoS was disabled call qos_activate \n"); + schedule_work(&priv->qos_activate); + } + + network->qos_data.active = 0; + network->qos_data.supported = 0; } + if ((priv->status & STATUS_ASSOCIATED) + && (priv->ieee->iw_mode == IW_MODE_ADHOC) + && (active_network == 0)) { + + if (memcmp(network->bssid, priv->bssid, ETH_ALEN)) { + if ((network->capability & WLAN_CAPABILITY_IBSS) + && !(network->flags & NETWORK_EMPTY_ESSID)) { + if ((network->ssid_len == + priv->assoc_network->ssid_len) + && !memcmp(network->ssid, + priv->assoc_network->ssid, + network->ssid_len)) { + queue_work(priv->workqueue, + &priv->merge_networks); + } - if (priv->capability & CAP_PRIVACY_ON) - ipw_send_wep_keys(priv); + } + } + } - if (priv->ieee->wpa_ie_len) { + return 0; +} + +/* +* This function set up the firmware to support QoS. It sends +* IPW_CMD_QOS_PARAMETERS and IPW_CMD_WME_INFO +*/ +static int ipw_qos_activate(struct ipw_priv *priv, + struct ieee80211_qos_data *qos_network_data) +{ + int err; + struct ieee80211_qos_parameters qos_parameters[QOS_QOS_SETS]; + struct ieee80211_qos_parameters *active_one = NULL; + u32 size = sizeof(struct ieee80211_qos_parameters); + u32 burst_duration; + int i; + u8 type; + + type = ipw_qos_current_mode(priv); + + active_one = &(qos_parameters[QOS_PARAM_SET_DEF_CCK]); + memcpy(active_one, priv->qos_data.def_qos_parm_CCK, size); + active_one = &(qos_parameters[QOS_PARAM_SET_DEF_OFDM]); + memcpy(active_one, priv->qos_data.def_qos_parm_OFDM, size); + + if (qos_network_data == NULL) { + if (type == IEEE_B) { + IPW_DEBUG_QOS("QoS activate network mode %d\n", type); + active_one = &def_parameters_CCK; + } else + active_one = &def_parameters_OFDM; + + memcpy(&(qos_parameters[QOS_PARAM_SET_ACTIVE]), active_one, + size); + burst_duration = ipw_qos_get_burst_duration(priv); + for (i = 0; i < QOS_QUEUE_NUM; i++) + qos_parameters[QOS_PARAM_SET_ACTIVE]. + tx_op_limit[i] = (u16) burst_duration; + } else if ((priv->ieee->iw_mode == IW_MODE_ADHOC)) { + if (type == IEEE_B) { + IPW_DEBUG_QOS("QoS activate IBSS nework mode %d\n", + type); + if (priv->qos_data.qos_enable == 0) + active_one = &def_parameters_CCK; + else + active_one = priv->qos_data.def_qos_parm_CCK; + } else { + if (priv->qos_data.qos_enable == 0) + active_one = &def_parameters_OFDM; + else + active_one = priv->qos_data.def_qos_parm_OFDM; + } + memcpy(&(qos_parameters[QOS_PARAM_SET_ACTIVE]), active_one, + size); + } else { + unsigned long flags; + int active; + + spin_lock_irqsave(&priv->ieee->lock, flags); + active_one = &(qos_network_data->parameters); + qos_network_data->old_param_count = + qos_network_data->param_count; + memcpy(&(qos_parameters[QOS_PARAM_SET_ACTIVE]), active_one, + size); + active = qos_network_data->supported; + spin_unlock_irqrestore(&priv->ieee->lock, flags); + + if (active == 0) { + burst_duration = ipw_qos_get_burst_duration(priv); + for (i = 0; i < QOS_QUEUE_NUM; i++) + qos_parameters[QOS_PARAM_SET_ACTIVE]. + tx_op_limit[i] = (u16) burst_duration; + } + } + + IPW_DEBUG_QOS("QoS sending IPW_CMD_QOS_PARAMETERS\n"); + err = + ipw_send_qos_params_command(priv, + (struct ieee80211_qos_parameters *) + &(qos_parameters[0])); + if (err) + IPW_DEBUG_QOS("QoS IPW_CMD_QOS_PARAMETERS failed\n"); + + return err; +} + +/* +* send IPW_CMD_WME_INFO to the firmware +*/ +static int ipw_qos_set_info_element(struct ipw_priv *priv) +{ + int ret = 0; + struct ieee80211_qos_information_element qos_info; + + if (priv == NULL) + return -1; + + qos_info.elementID = QOS_ELEMENT_ID; + qos_info.length = sizeof(struct ieee80211_qos_information_element) - 2; + + qos_info.version = QOS_VERSION_1; + qos_info.ac_info = 0; + + memcpy(qos_info.qui, qos_oui, QOS_OUI_LEN); + qos_info.qui_type = QOS_OUI_TYPE; + qos_info.qui_subtype = QOS_OUI_INFO_SUB_TYPE; + + ret = ipw_send_qos_info_command(priv, &qos_info); + if (ret != 0) { + IPW_DEBUG_QOS("QoS error calling ipw_send_qos_info_command\n"); + } + return ret; +} + +/* +* Set the QoS parameter with the association request structure +*/ +static int ipw_qos_association(struct ipw_priv *priv, + struct ieee80211_network *network) +{ + int err = 0; + struct ieee80211_qos_data *qos_data = NULL; + struct ieee80211_qos_data ibss_data = { + .supported = 1, + .active = 1, + }; + + switch (priv->ieee->iw_mode) { + case IW_MODE_ADHOC: + if (!(network->capability & WLAN_CAPABILITY_IBSS)) + BUG(); + + qos_data = &ibss_data; + break; + + case IW_MODE_INFRA: + qos_data = &network->qos_data; + break; + + default: + BUG(); + break; + } + + err = ipw_qos_activate(priv, qos_data); + if (err) { + priv->assoc_request.policy_support &= ~HC_QOS_SUPPORT_ASSOC; + return err; + } + + if (priv->qos_data.qos_enable && qos_data->supported) { + IPW_DEBUG_QOS("QoS will be enabled for this association\n"); + priv->assoc_request.policy_support |= HC_QOS_SUPPORT_ASSOC; + return ipw_qos_set_info_element(priv); + } + + return 0; +} + +/* +* handling the beaconing responces. if we get different QoS setting +* of the network from the the associated setting adjust the QoS +* setting +*/ +static int ipw_qos_association_resp(struct ipw_priv *priv, + struct ieee80211_network *network) +{ + int ret = 0; + unsigned long flags; + u32 size = sizeof(struct ieee80211_qos_parameters); + int set_qos_param = 0; + + if ((priv == NULL) || (network == NULL) + || (priv->assoc_network == NULL)) + + return ret; + + if (!(priv->status & STATUS_ASSOCIATED)) + return ret; + + if ((priv->ieee->iw_mode != IW_MODE_INFRA)) { + return ret; + } + + spin_lock_irqsave(&priv->ieee->lock, flags); + if (network->flags & NETWORK_HAS_QOS_PARAMETERS) { + memcpy(&(priv->assoc_network->qos_data), &(network->qos_data), + sizeof(struct ieee80211_qos_data)); + priv->assoc_network->qos_data.active = 1; + if ((network->qos_data.old_param_count != + network->qos_data.param_count)) { + set_qos_param = 1; + network->qos_data.old_param_count = + network->qos_data.param_count; + } + + } else { + if ((network->mode == IEEE_B) || (priv->ieee->mode == IEEE_B)) { + memcpy(&(priv->assoc_network->qos_data.parameters), + &def_parameters_CCK, size); + } else { + memcpy(&(priv->assoc_network->qos_data.parameters), + &def_parameters_OFDM, size); + } + priv->assoc_network->qos_data.active = 0; + priv->assoc_network->qos_data.supported = 0; + set_qos_param = 1; + } + + spin_unlock_irqrestore(&priv->ieee->lock, flags); + + if (set_qos_param == 1) + schedule_work(&priv->qos_activate); + + return ret; +} + +static u32 ipw_qos_get_burst_duration(struct ipw_priv *priv) +{ + u32 ret = 0; + + if ((priv == NULL)) + return 0; + + if (!(priv->ieee->modulation & IEEE80211_OFDM_MODULATION)) { + ret = priv->qos_data.burst_duration_CCK; + } else { + ret = priv->qos_data.burst_duration_OFDM; + } + return ret; +} + +/* +* Initialize the setting of QoS global +*/ +static void ipw_qos_init(struct ipw_priv *priv, int enable, + int burst_enable, u32 burst_duration_CCK, + u32 burst_duration_OFDM) +{ + priv->qos_data.qos_enable = enable; + + if (priv->qos_data.qos_enable) { + priv->qos_data.def_qos_parm_CCK = &def_qos_parameters_CCK; + priv->qos_data.def_qos_parm_OFDM = &def_qos_parameters_OFDM; + IPW_DEBUG_QOS("QoS is enabled\n"); + } else { + priv->qos_data.def_qos_parm_CCK = &def_parameters_CCK; + priv->qos_data.def_qos_parm_OFDM = &def_parameters_OFDM; + IPW_DEBUG_QOS("QoS is not enabled\n"); + } + + priv->qos_data.burst_enable = burst_enable; + + if (burst_enable) { + priv->qos_data.burst_duration_CCK = burst_duration_CCK; + priv->qos_data.burst_duration_OFDM = burst_duration_OFDM; + } else { + priv->qos_data.burst_duration_CCK = 0; + priv->qos_data.burst_duration_OFDM = 0; + } +} + +/* +* map the packet priority to the right TX Queue +*/ +static int ipw_get_tx_queue_number(struct ipw_priv *priv, u16 priority) +{ + if (priority > 7 || !priv->qos_data.qos_enable) + priority = 0; + + return from_priority_to_tx_queue[priority] - 1; +} + +/* +* add QoS parameter to the TX command +*/ +static int ipw_qos_set_tx_queue_command(struct ipw_priv *priv, + u16 priority, + struct tfd_data *tfd, u8 unicast) +{ + int ret = 0; + int tx_queue_id = 0; + struct ieee80211_qos_data *qos_data = NULL; + int active, supported; + unsigned long flags; + + if (!(priv->status & STATUS_ASSOCIATED)) + return 0; + + qos_data = &priv->assoc_network->qos_data; + + spin_lock_irqsave(&priv->ieee->lock, flags); + + if (priv->ieee->iw_mode == IW_MODE_ADHOC) { + if (unicast == 0) + qos_data->active = 0; + else + qos_data->active = qos_data->supported; + } + + active = qos_data->active; + supported = qos_data->supported; + + spin_unlock_irqrestore(&priv->ieee->lock, flags); + + IPW_DEBUG_QOS + ("QoS %d network is QoS active %d supported %d unicast %d\n", + priv->qos_data.qos_enable, active, supported, unicast); + if (active && priv->qos_data.qos_enable) { + ret = from_priority_to_tx_queue[priority]; + tx_queue_id = ret - 1; + IPW_DEBUG_QOS("QoS packet priority is %d \n", priority); + if (priority <= 7) { + tfd->tx_flags_ext |= DCT_FLAG_EXT_QOS_ENABLED; + tfd->tfd.tfd_26.mchdr.qos_ctrl = priority; + tfd->tfd.tfd_26.mchdr.frame_ctl |= + IEEE80211_STYPE_QOS_DATA; + + if (priv->qos_data.qos_no_ack_mask & + (1UL << tx_queue_id)) { + tfd->tx_flags &= ~DCT_FLAG_ACK_REQD; + tfd->tfd.tfd_26.mchdr.qos_ctrl |= + CTRL_QOS_NO_ACK; + } + } + } + + return ret; +} + +/* +* background support to run QoS activate functionality +*/ +static void ipw_bg_qos_activate(void *data) +{ + struct ipw_priv *priv = data; + + if (priv == NULL) + return; + + down(&priv->sem); + + if (priv->status & STATUS_ASSOCIATED) + ipw_qos_activate(priv, &(priv->assoc_network->qos_data)); + + up(&priv->sem); +} + +/* +* Handler for probe responce and beacon frame +*/ +static int ipw_handle_management_frame(struct net_device *dev, + struct ieee80211_network *network, + u16 type) +{ + struct ipw_priv *priv = ieee80211_priv(dev); + int active_network; + + if (priv->status & STATUS_ASSOCIATED && network == priv->assoc_network) + active_network = 1; + else + active_network = 0; + + switch (type) { + case IEEE80211_STYPE_PROBE_RESP: + case IEEE80211_STYPE_BEACON: + ipw_qos_handle_probe_reponse(priv, active_network, network); + break; + case IEEE80211_STYPE_ASSOC_RESP: + ipw_qos_association_resp(priv, network); + break; + default: + break; + } + + return 0; +} + +static int ipw_send_qos_params_command(struct ipw_priv *priv, struct ieee80211_qos_parameters + *qos_param) +{ + struct host_cmd cmd = { + .cmd = IPW_CMD_QOS_PARAMETERS, + .len = (sizeof(struct ieee80211_qos_parameters) * 3) + }; + + if (!priv || !qos_param) { + IPW_ERROR("Invalid args\n"); + return -1; + } + + memcpy(&cmd.param, qos_param, + (sizeof(struct ieee80211_qos_parameters) * 3)); + if (ipw_send_cmd(priv, &cmd)) { + IPW_ERROR("failed to send IPW_CMD_QOS_PARAMETERS command\n"); + return -1; + } + + return 0; +} + +static int ipw_send_qos_info_command(struct ipw_priv *priv, struct ieee80211_qos_information_element + *qos_param) +{ + struct host_cmd cmd = { + .cmd = IPW_CMD_WME_INFO, + .len = sizeof(*qos_param) + }; + + if (!priv || !qos_param) { + IPW_ERROR("Invalid args\n"); + return -1; + } + + memcpy(&cmd.param, qos_param, sizeof(*qos_param)); + if (ipw_send_cmd(priv, &cmd)) { + IPW_ERROR("failed to send CMD_QOS_INFO command\n"); + return -1; + } + + return 0; +} + +#endif /* CONFIG_IPW_QOS */ + +static int ipw_associate_network(struct ipw_priv *priv, + struct ieee80211_network *network, + struct ipw_supported_rates *rates, int roaming) +{ + int err; + + if (priv->config & CFG_FIXED_RATE) + ipw_set_fixed_rate(priv, network->mode); + + if (!(priv->config & CFG_STATIC_ESSID)) { + priv->essid_len = min(network->ssid_len, + (u8) IW_ESSID_MAX_SIZE); + memcpy(priv->essid, network->ssid, priv->essid_len); + } + + network->last_associate = jiffies; + + memset(&priv->assoc_request, 0, sizeof(priv->assoc_request)); + priv->assoc_request.channel = network->channel; + if ((priv->capability & CAP_PRIVACY_ON) && + (priv->capability & CAP_SHARED_KEY)) { + priv->assoc_request.auth_type = AUTH_SHARED_KEY; + priv->assoc_request.auth_key = priv->ieee->sec.active_key; + + if ((priv->capability & CAP_PRIVACY_ON) && + (priv->ieee->sec.level == SEC_LEVEL_1) && + !(priv->ieee->host_encrypt || priv->ieee->host_decrypt)) + ipw_send_wep_keys(priv, DCW_WEP_KEY_SEC_TYPE_WEP); + } else { + priv->assoc_request.auth_type = AUTH_OPEN; + priv->assoc_request.auth_key = 0; + } + + if (priv->ieee->wpa_ie_len) { priv->assoc_request.policy_support = 0x02; /* RSN active */ ipw_set_rsn_capa(priv, priv->ieee->wpa_ie, priv->ieee->wpa_ie_len); @@ -6095,7 +6936,7 @@ static int ipw_associate_network(struct ipw_priv *priv, "(open)") : "", priv->capability & CAP_PRIVACY_ON ? " key=" : "", priv->capability & CAP_PRIVACY_ON ? - '1' + priv->sec.active_key : '.', + '1' + priv->ieee->sec.active_key : '.', priv->capability & CAP_PRIVACY_ON ? '.' : ' '); priv->assoc_request.beacon_interval = network->beacon_interval; @@ -6170,6 +7011,10 @@ static int ipw_associate_network(struct ipw_priv *priv, priv->assoc_network = network; +#ifdef CONFIG_IPW_QOS + ipw_qos_association(priv, network); +#endif + err = ipw_send_associate(priv, &priv->assoc_request); if (err) { IPW_DEBUG_HC("Attempt to send associate command failed.\n"); @@ -6268,6 +7113,11 @@ static int ipw_associate(void *data) struct list_head *element; unsigned long flags; + if (priv->ieee->iw_mode == IW_MODE_MONITOR) { + IPW_DEBUG_ASSOC("Not attempting association (monitor mode)\n"); + return 0; + } + if (priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { IPW_DEBUG_ASSOC ("Not attempting association (already in progress)\n"); @@ -6315,9 +7165,15 @@ static int ipw_associate(void *data) if (!network) { ipw_debug_config(priv); - if (!(priv->status & STATUS_SCANNING)) - queue_delayed_work(priv->workqueue, &priv->request_scan, - SCAN_INTERVAL); + if (!(priv->status & STATUS_SCANNING)) { + if (!(priv->config & CFG_SPEED_SCAN)) + queue_delayed_work(priv->workqueue, + &priv->request_scan, + SCAN_INTERVAL); + else + queue_work(priv->workqueue, + &priv->request_scan); + } return 0; } @@ -6335,9 +7191,48 @@ static void ipw_bg_associate(void *data) up(&priv->sem); } -static inline void ipw_handle_data_packet(struct ipw_priv *priv, - struct ipw_rx_mem_buffer *rxb, - struct ieee80211_rx_stats *stats) +static void ipw_rebuild_decrypted_skb(struct ipw_priv *priv, + struct sk_buff *skb) +{ + struct ieee80211_hdr *hdr; + u16 fc; + + hdr = (struct ieee80211_hdr *)skb->data; + fc = le16_to_cpu(hdr->frame_ctl); + if (!(fc & IEEE80211_FCTL_PROTECTED)) + return; + + fc &= ~IEEE80211_FCTL_PROTECTED; + hdr->frame_ctl = cpu_to_le16(fc); + switch (priv->ieee->sec.level) { + case SEC_LEVEL_3: + /* Remove CCMP HDR */ + memmove(skb->data + IEEE80211_3ADDR_LEN, + skb->data + IEEE80211_3ADDR_LEN + 8, + skb->len - IEEE80211_3ADDR_LEN - 8); + skb_trim(skb, skb->len - 8); /* MIC */ + break; + case SEC_LEVEL_2: + break; + case SEC_LEVEL_1: + /* Remove IV */ + memmove(skb->data + IEEE80211_3ADDR_LEN, + skb->data + IEEE80211_3ADDR_LEN + 4, + skb->len - IEEE80211_3ADDR_LEN - 4); + skb_trim(skb, skb->len - 4); /* ICV */ + break; + case SEC_LEVEL_0: + break; + default: + printk(KERN_ERR "Unknow security level %d\n", + priv->ieee->sec.level); + break; + } +} + +static void ipw_handle_data_packet(struct ipw_priv *priv, + struct ipw_rx_mem_buffer *rxb, + struct ieee80211_rx_stats *stats) { struct ipw_rx_packet *pkt = (struct ipw_rx_packet *)rxb->skb->data; @@ -6367,11 +7262,15 @@ static inline void ipw_handle_data_packet(struct ipw_priv *priv, IPW_DEBUG_RX("Rx packet of %d bytes.\n", rxb->skb->len); + /* HW decrypt will not clear the WEP bit, MIC, PN, etc. */ + if (!priv->ieee->host_decrypt) + ipw_rebuild_decrypted_skb(priv, rxb->skb); + if (!ieee80211_rx(priv->ieee, rxb->skb, stats)) priv->ieee->stats.rx_errors++; else { /* ieee80211_rx succeeded, so it now owns the SKB */ rxb->skb = NULL; - ipw_led_activity_on(priv); + __ipw_led_activity_on(priv); } } @@ -6413,6 +7312,53 @@ static inline int is_network_packet(struct ipw_priv *priv, return 1; } +static void ipw_handle_mgmt_packet(struct ipw_priv *priv, + struct ipw_rx_mem_buffer *rxb, + struct ieee80211_rx_stats *stats) +{ + struct sk_buff *skb = rxb->skb; + struct ipw_rx_packet *pkt = (struct ipw_rx_packet *)skb->data; + struct ieee80211_hdr_4addr *header = (struct ieee80211_hdr_4addr *) + (skb->data + IPW_RX_FRAME_SIZE); + + ieee80211_rx_mgt(priv->ieee, header, stats); + + if (priv->ieee->iw_mode == IW_MODE_ADHOC && + ((WLAN_FC_GET_STYPE(le16_to_cpu(header->frame_ctl)) == + IEEE80211_STYPE_PROBE_RESP) || + (WLAN_FC_GET_STYPE(le16_to_cpu(header->frame_ctl)) == + IEEE80211_STYPE_BEACON))) { + if (!memcmp(header->addr3, priv->bssid, ETH_ALEN)) + ipw_add_station(priv, header->addr2); + } + + if (priv->config & CFG_NET_STATS) { + IPW_DEBUG_HC("sending stat packet\n"); + + /* Set the size of the skb to the size of the full + * ipw header and 802.11 frame */ + skb_put(skb, le16_to_cpu(pkt->u.frame.length) + + IPW_RX_FRAME_SIZE); + + /* Advance past the ipw packet header to the 802.11 frame */ + skb_pull(skb, IPW_RX_FRAME_SIZE); + + /* Push the ieee80211_rx_stats before the 802.11 frame */ + memcpy(skb_push(skb, sizeof(*stats)), stats, sizeof(*stats)); + + skb->dev = priv->ieee->dev; + + /* Point raw at the ieee80211_stats */ + skb->mac.raw = skb->data; + + skb->pkt_type = PACKET_OTHERHOST; + skb->protocol = __constant_htons(ETH_P_80211_STATS); + memset(skb->cb, 0, sizeof(rxb->skb->cb)); + netif_rx(skb); + rxb->skb = NULL; + } +} + /* * Main entry function for recieving a packet with 80211 headers. This * should be called when ever the FW has notified us that there is a new @@ -6426,8 +7372,8 @@ static void ipw_rx(struct ipw_priv *priv) u32 r, w, i; u8 network_packet; - r = ipw_read32(priv, CX2_RX_READ_INDEX); - w = ipw_read32(priv, CX2_RX_WRITE_INDEX); + r = ipw_read32(priv, IPW_RX_READ_INDEX); + w = ipw_read32(priv, IPW_RX_WRITE_INDEX); i = (priv->rxq->processed + 1) % RX_QUEUE_SIZE; while (i != r) { @@ -6441,7 +7387,7 @@ static void ipw_rx(struct ipw_priv *priv) priv->rxq->queue[i] = NULL; pci_dma_sync_single_for_cpu(priv->pci_dev, rxb->dma_addr, - CX2_RX_BUF_SIZE, + IPW_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); pkt = (struct ipw_rx_packet *)rxb->skb->data; @@ -6482,7 +7428,7 @@ static void ipw_rx(struct ipw_priv *priv) priv->rx_packets++; -#ifdef CONFIG_IPW_MONITOR +#ifdef CONFIG_IPW2200_MONITOR if (priv->ieee->iw_mode == IW_MODE_MONITOR) { ipw_handle_data_packet(priv, rxb, &stats); @@ -6525,56 +7471,17 @@ static void ipw_rx(struct ipw_priv *priv) switch (WLAN_FC_GET_TYPE (le16_to_cpu(header->frame_ctl))) { + case IEEE80211_FTYPE_MGMT: - ieee80211_rx_mgt(priv->ieee, header, - &stats); - if (priv->ieee->iw_mode == IW_MODE_ADHOC - && - ((WLAN_FC_GET_STYPE - (le16_to_cpu(header->frame_ctl)) - == IEEE80211_STYPE_PROBE_RESP) - || - (WLAN_FC_GET_STYPE - (le16_to_cpu(header->frame_ctl)) - == IEEE80211_STYPE_BEACON))) { - if (!memcmp - (header->addr3, priv->bssid, - ETH_ALEN)) - ipw_add_station(priv, - header-> - addr2); - else { - struct - ieee80211_probe_response - *beacon; - beacon = - (struct - ieee80211_probe_response - *)header; - if (le16_to_cpu - (beacon-> - capability) & - WLAN_CAPABILITY_IBSS) - { - queue_work - (priv-> - workqueue, - &priv-> - merge_networks); - } - } - } + ipw_handle_mgmt_packet(priv, rxb, + &stats); break; case IEEE80211_FTYPE_CTL: break; case IEEE80211_FTYPE_DATA: - if (network_packet) - ipw_handle_data_packet(priv, - rxb, - &stats); - else + if (unlikely(!network_packet)) { IPW_DEBUG_DROP("Dropping: " MAC_FMT ", " MAC_FMT ", " @@ -6585,6 +7492,12 @@ static void ipw_rx(struct ipw_priv *priv) addr2), MAC_ARG(header-> addr3)); + break; + } + + ipw_handle_data_packet(priv, rxb, + &stats); + break; } break; @@ -6615,7 +7528,7 @@ static void ipw_rx(struct ipw_priv *priv) } pci_unmap_single(priv->pci_dev, rxb->dma_addr, - CX2_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); + IPW_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); list_add_tail(&rxb->list, &priv->rxq->rx_used); i = (i + 1) % RX_QUEUE_SIZE; @@ -6657,6 +7570,8 @@ static int ipw_wx_get_name(struct net_device *dev, static int ipw_set_channel(struct ipw_priv *priv, u8 channel) { + int i; + if (channel == 0) { IPW_DEBUG_INFO("Setting channel to ANY (0)\n"); priv->config &= ~CFG_STATIC_CHANNEL; @@ -6677,6 +7592,27 @@ static int ipw_set_channel(struct ipw_priv *priv, u8 channel) IPW_DEBUG_INFO("Setting channel to %i\n", (int)channel); priv->channel = channel; +#ifdef CONFIG_IPW2200_MONITOR + if (priv->ieee->iw_mode == IW_MODE_MONITOR) { + if (priv->status & STATUS_SCANNING) { + IPW_DEBUG_SCAN("scan abort triggered due to " + "channel change.\n"); + queue_work(priv->workqueue, &priv->abort_scan); + } + + for (i = 1000; i && (priv->status & STATUS_SCANNING); i--) + udelay(10); + + if (priv->status & STATUS_SCANNING) + IPW_DEBUG_SCAN("Still scanning...\n"); + else + IPW_DEBUG_SCAN("Took %dms to abort current scan\n", + 1000 - i); + + return 0; + } +#endif /* CONFIG_IPW2200_MONITOR */ + /* Network configuration changed -- force [re]association */ IPW_DEBUG_ASSOC("[re]association triggered due to channel change.\n"); if (!ipw_disassociate(priv)) @@ -6692,29 +7628,30 @@ static int ipw_wx_set_freq(struct net_device *dev, struct ipw_priv *priv = ieee80211_priv(dev); struct iw_freq *fwrq = &wrqu->freq; int ret = 0; + u8 channel; + + if (fwrq->m == 0) { + IPW_DEBUG_WX("SET Freq/Channel -> any\n"); + down(&priv->sem); + ret = ipw_set_channel(priv, 0); + up(&priv->sem); + return ret; + } /* if setting by freq convert to channel */ if (fwrq->e == 1) { - if ((fwrq->m >= (int)2.412e8 && fwrq->m <= (int)2.487e8)) { - int f = fwrq->m / 100000; - int c = 0; - - while ((c < REG_MAX_CHANNEL) && - (f != ipw_frequencies[c])) - c++; - - /* hack to fall through */ - fwrq->e = 0; - fwrq->m = c + 1; - } - } + channel = ieee80211_freq_to_channel(priv->ieee, fwrq->m); + if (channel == 0) + return -EINVAL; + } else + channel = fwrq->m; - if (fwrq->e > 0 || fwrq->m > 1000) - return -EOPNOTSUPP; + if (!ieee80211_is_valid_channel(priv->ieee, channel)) + return -EINVAL; IPW_DEBUG_WX("SET Freq/Channel -> %d \n", fwrq->m); down(&priv->sem); - ret = ipw_set_channel(priv, (u8) fwrq->m); + ret = ipw_set_channel(priv, channel); up(&priv->sem); return ret; } @@ -6749,14 +7686,9 @@ static int ipw_wx_set_mode(struct net_device *dev, int err = 0; IPW_DEBUG_WX("Set MODE: %d\n", wrqu->mode); - down(&priv->sem); - if (wrqu->mode == priv->ieee->iw_mode) { - up(&priv->sem); - return 0; - } switch (wrqu->mode) { -#ifdef CONFIG_IPW_MONITOR +#ifdef CONFIG_IPW2200_MONITOR case IW_MODE_MONITOR: #endif case IW_MODE_ADHOC: @@ -6766,17 +7698,19 @@ static int ipw_wx_set_mode(struct net_device *dev, wrqu->mode = IW_MODE_INFRA; break; default: - up(&priv->sem); return -EINVAL; } + if (wrqu->mode == priv->ieee->iw_mode) + return 0; -#ifdef CONFIG_IPW_MONITOR + down(&priv->sem); +#ifdef CONFIG_IPW2200_MONITOR if (priv->ieee->iw_mode == IW_MODE_MONITOR) priv->net_dev->type = ARPHRD_ETHER; if (wrqu->mode == IW_MODE_MONITOR) priv->net_dev->type = ARPHRD_IEEE80211; -#endif /* CONFIG_IPW_MONITOR */ +#endif /* CONFIG_IPW2200_MONITOR */ #ifdef CONFIG_PM /* Free the existing firmware and reset the fw_loaded @@ -6839,8 +7773,8 @@ static int ipw_wx_get_range(struct net_device *dev, { struct ipw_priv *priv = ieee80211_priv(dev); struct iw_range *range = (struct iw_range *)extra; - u16 val; - int i; + const struct ieee80211_geo *geo = ieee80211_get_geo(priv->ieee); + int i = 0, j; wrqu->data.length = sizeof(*range); memset(range, 0, sizeof(*range)); @@ -6879,19 +7813,28 @@ static int ipw_wx_get_range(struct net_device *dev, range->we_version_compiled = WIRELESS_EXT; range->we_version_source = 16; - range->num_channels = FREQ_COUNT; - - val = 0; - for (i = 0; i < FREQ_COUNT; i++) { - range->freq[val].i = i + 1; - range->freq[val].m = ipw_frequencies[i] * 100000; - range->freq[val].e = 1; - val++; + i = 0; + if (priv->ieee->mode & (IEEE_B | IEEE_G)) { + for (j = 0; j < geo->bg_channels && i < IW_MAX_FREQUENCIES; + i++, j++) { + range->freq[i].i = geo->bg[j].channel; + range->freq[i].m = geo->bg[j].freq * 100000; + range->freq[i].e = 1; + } + } - if (val == IW_MAX_FREQUENCIES) - break; + if (priv->ieee->mode & IEEE_A) { + for (j = 0; j < geo->a_channels && i < IW_MAX_FREQUENCIES; + i++, j++) { + range->freq[i].i = geo->a[j].channel; + range->freq[i].m = geo->a[j].freq * 100000; + range->freq[i].e = 1; + } } - range->num_frequency = val; + + range->num_channels = i; + range->num_frequency = i; + up(&priv->sem); IPW_DEBUG_WX("GET Range\n"); return 0; @@ -7164,9 +8107,10 @@ static int ipw_wx_set_rate(struct net_device *dev, IPW_DEBUG_WX("Setting rate mask to 0x%08X [%s]\n", mask, fixed ? "fixed" : "sub-rates"); down(&priv->sem); - if (mask == IEEE80211_DEFAULT_RATES_MASK) + if (mask == IEEE80211_DEFAULT_RATES_MASK) { priv->config &= ~CFG_FIXED_RATE; - else + ipw_set_fixed_rate(priv, priv->ieee->mode); + } else priv->config |= CFG_FIXED_RATE; if (priv->rates_mask == mask) { @@ -7242,18 +8186,23 @@ static int ipw_wx_set_txpow(struct net_device *dev, struct ipw_priv *priv = ieee80211_priv(dev); struct ipw_tx_power tx_power; int i; + down(&priv->sem); if (ipw_radio_kill_sw(priv, wrqu->power.disabled)) { up(&priv->sem); return -EINPROGRESS; } + if (!wrqu->power.fixed) + wrqu->power.value = IPW_TX_POWER_DEFAULT; + if (wrqu->power.flags != IW_TXPOW_DBM) { up(&priv->sem); return -EINVAL; } - if ((wrqu->power.value > 20) || (wrqu->power.value < -12)) { + if ((wrqu->power.value > IPW_TX_POWER_MAX) || + (wrqu->power.value < -IPW_TX_POWER_MAX) || !wrqu->power.fixed) { up(&priv->sem); return -EINVAL; } @@ -7313,8 +8262,10 @@ static int ipw_wx_set_frag(struct net_device *dev, priv->ieee->fts = DEFAULT_FTS; else { if (wrqu->frag.value < MIN_FRAG_THRESHOLD || - wrqu->frag.value > MAX_FRAG_THRESHOLD) + wrqu->frag.value > MAX_FRAG_THRESHOLD) { + up(&priv->sem); return -EINVAL; + } priv->ieee->fts = wrqu->frag.value & ~0x1; } @@ -7362,12 +8313,9 @@ static int ipw_wx_set_scan(struct net_device *dev, { struct ipw_priv *priv = ieee80211_priv(dev); IPW_DEBUG_WX("Start scan\n"); - down(&priv->sem); - if (ipw_request_scan(priv)) { - up(&priv->sem); - return -EIO; - } - up(&priv->sem); + + queue_work(priv->workqueue, &priv->request_scan); + return 0; } @@ -7621,100 +8569,243 @@ static int ipw_wx_get_wireless_mode(struct net_device *dev, break; } - IPW_DEBUG_WX("PRIV GET MODE: %s\n", extra); + IPW_DEBUG_WX("PRIV GET MODE: %s\n", extra); + + wrqu->data.length = strlen(extra) + 1; + up(&priv->sem); + + return 0; +} + +static int ipw_wx_set_preamble(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct ipw_priv *priv = ieee80211_priv(dev); + int mode = *(int *)extra; + down(&priv->sem); + /* Switching from SHORT -> LONG requires a disassociation */ + if (mode == 1) { + if (!(priv->config & CFG_PREAMBLE_LONG)) { + priv->config |= CFG_PREAMBLE_LONG; + + /* Network configuration changed -- force [re]association */ + IPW_DEBUG_ASSOC + ("[re]association triggered due to preamble change.\n"); + if (!ipw_disassociate(priv)) + ipw_associate(priv); + } + goto done; + } + + if (mode == 0) { + priv->config &= ~CFG_PREAMBLE_LONG; + goto done; + } + up(&priv->sem); + return -EINVAL; + + done: + up(&priv->sem); + return 0; +} + +static int ipw_wx_get_preamble(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct ipw_priv *priv = ieee80211_priv(dev); + down(&priv->sem); + if (priv->config & CFG_PREAMBLE_LONG) + snprintf(wrqu->name, IFNAMSIZ, "long (1)"); + else + snprintf(wrqu->name, IFNAMSIZ, "auto (0)"); + up(&priv->sem); + return 0; +} + +#ifdef CONFIG_IPW2200_MONITOR +static int ipw_wx_set_monitor(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct ipw_priv *priv = ieee80211_priv(dev); + int *parms = (int *)extra; + int enable = (parms[0] > 0); + down(&priv->sem); + IPW_DEBUG_WX("SET MONITOR: %d %d\n", enable, parms[1]); + if (enable) { + if (priv->ieee->iw_mode != IW_MODE_MONITOR) { + priv->net_dev->type = ARPHRD_IEEE80211; + queue_work(priv->workqueue, &priv->adapter_restart); + } + + ipw_set_channel(priv, parms[1]); + } else { + if (priv->ieee->iw_mode != IW_MODE_MONITOR) { + up(&priv->sem); + return 0; + } + priv->net_dev->type = ARPHRD_ETHER; + queue_work(priv->workqueue, &priv->adapter_restart); + } + up(&priv->sem); + return 0; +} + +#endif // CONFIG_IPW2200_MONITOR + +static int ipw_wx_reset(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct ipw_priv *priv = ieee80211_priv(dev); + IPW_DEBUG_WX("RESET\n"); + queue_work(priv->workqueue, &priv->adapter_restart); + return 0; +} + +static void ipw_sw_reset(struct ipw_priv *priv, int init) +{ + int band, modulation; + + /* Initialize module parameter values here */ + priv->config = 0; + + /* We default to disabling the LED code as right now it causes + * too many systems to lock up... */ + if (!led) + priv->config |= CFG_NO_LED; + + if (associate) + priv->config |= CFG_ASSOCIATE; + else + IPW_DEBUG_INFO("Auto associate disabled.\n"); + + if (auto_create) + priv->config |= CFG_ADHOC_CREATE; + else + IPW_DEBUG_INFO("Auto adhoc creation disabled.\n"); + + if (disable) { + priv->status |= STATUS_RF_KILL_SW; + IPW_DEBUG_INFO("Radio disabled.\n"); + } + + if (channel != 0) { + priv->config |= CFG_STATIC_CHANNEL; + priv->channel = channel; + IPW_DEBUG_INFO("Bind to static channel %d\n", channel); + /* TODO: Validate that provided channel is in range */ + } +#ifdef CONFIG_IPW_QOS + ipw_qos_init(priv, qos_enable, qos_burst_enable, + burst_duration_CCK, burst_duration_OFDM); +#endif /* CONFIG_IPW_QOS */ + + switch (mode) { + case 1: + priv->ieee->iw_mode = IW_MODE_ADHOC; + priv->net_dev->type = ARPHRD_ETHER; + + break; +#ifdef CONFIG_IPW2200_MONITOR + case 2: + priv->ieee->iw_mode = IW_MODE_MONITOR; + priv->net_dev->type = ARPHRD_IEEE80211; + break; +#endif + default: + case 0: + priv->net_dev->type = ARPHRD_ETHER; + priv->ieee->iw_mode = IW_MODE_INFRA; + break; + } + + if (hwcrypto) { + priv->ieee->host_encrypt = 0; + priv->ieee->host_decrypt = 0; + } + IPW_DEBUG_INFO("Hardware crypto [%s]\n", hwcrypto ? "on" : "off"); + + if ((priv->pci_dev->device == 0x4223) || + (priv->pci_dev->device == 0x4224)) { + if (init) + printk(KERN_INFO DRV_NAME + ": Detected Intel PRO/Wireless 2915ABG Network " + "Connection\n"); + priv->ieee->abg_true = 1; + band = IEEE80211_52GHZ_BAND | IEEE80211_24GHZ_BAND; + modulation = IEEE80211_OFDM_MODULATION | + IEEE80211_CCK_MODULATION; + priv->adapter = IPW_2915ABG; + priv->ieee->mode = IEEE_A | IEEE_G | IEEE_B; + } else { + if (init) + printk(KERN_INFO DRV_NAME + ": Detected Intel PRO/Wireless 2200BG Network " + "Connection\n"); + + priv->ieee->abg_true = 0; + band = IEEE80211_24GHZ_BAND; + modulation = IEEE80211_OFDM_MODULATION | + IEEE80211_CCK_MODULATION; + priv->adapter = IPW_2200BG; + priv->ieee->mode = IEEE_G | IEEE_B; + } + + priv->ieee->freq_band = band; + priv->ieee->modulation = modulation; - wrqu->data.length = strlen(extra) + 1; - up(&priv->sem); + priv->rates_mask = IEEE80211_DEFAULT_RATES_MASK; - return 0; + priv->missed_beacon_threshold = IPW_MB_DISASSOCIATE_THRESHOLD_DEFAULT; + priv->roaming_threshold = IPW_MB_ROAMING_THRESHOLD_DEFAULT; + + priv->rts_threshold = DEFAULT_RTS_THRESHOLD; + + /* If power management is turned on, default to AC mode */ + priv->power_mode = IPW_POWER_AC; + priv->tx_power = IPW_TX_POWER_DEFAULT; } -static int ipw_wx_set_preamble(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) +static int ipw_wx_sw_reset(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { struct ipw_priv *priv = ieee80211_priv(dev); - int mode = *(int *)extra; - down(&priv->sem); - /* Switching from SHORT -> LONG requires a disassociation */ - if (mode == 1) { - if (!(priv->config & CFG_PREAMBLE_LONG)) { - priv->config |= CFG_PREAMBLE_LONG; + union iwreq_data wrqu_sec = { + .encoding = { + .flags = IW_ENCODE_DISABLED, + }, + }; - /* Network configuration changed -- force [re]association */ - IPW_DEBUG_ASSOC - ("[re]association triggered due to preamble change.\n"); - if (!ipw_disassociate(priv)) - ipw_associate(priv); - } - goto done; - } + IPW_DEBUG_WX("SW_RESET\n"); - if (mode == 0) { - priv->config &= ~CFG_PREAMBLE_LONG; - goto done; - } - up(&priv->sem); - return -EINVAL; + down(&priv->sem); - done: - up(&priv->sem); - return 0; -} + ipw_sw_reset(priv, 0); -static int ipw_wx_get_preamble(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = ieee80211_priv(dev); - down(&priv->sem); - if (priv->config & CFG_PREAMBLE_LONG) - snprintf(wrqu->name, IFNAMSIZ, "long (1)"); - else - snprintf(wrqu->name, IFNAMSIZ, "auto (0)"); - up(&priv->sem); - return 0; -} + /* The SW reset bit might have been toggled on by the 'disable' + * module parameter, so take appropriate action */ + ipw_radio_kill_sw(priv, priv->status & STATUS_RF_KILL_SW); -#ifdef CONFIG_IPW_MONITOR -static int ipw_wx_set_monitor(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = ieee80211_priv(dev); - int *parms = (int *)extra; - int enable = (parms[0] > 0); + up(&priv->sem); + ieee80211_wx_set_encode(priv->ieee, info, &wrqu_sec, NULL); down(&priv->sem); - IPW_DEBUG_WX("SET MONITOR: %d %d\n", enable, parms[1]); - if (enable) { - if (priv->ieee->iw_mode != IW_MODE_MONITOR) { - priv->net_dev->type = ARPHRD_IEEE80211; - queue_work(priv->workqueue, &priv->adapter_restart); - } - ipw_set_channel(priv, parms[1]); - } else { - if (priv->ieee->iw_mode != IW_MODE_MONITOR) { - up(&priv->sem); - return 0; - } - priv->net_dev->type = ARPHRD_ETHER; - queue_work(priv->workqueue, &priv->adapter_restart); + if (!(priv->status & STATUS_RF_KILL_MASK)) { + /* Configuration likely changed -- force [re]association */ + IPW_DEBUG_ASSOC("[re]association triggered due to sw " + "reset.\n"); + if (!ipw_disassociate(priv)) + ipw_associate(priv); } + up(&priv->sem); - return 0; -} -static int ipw_wx_reset(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = ieee80211_priv(dev); - IPW_DEBUG_WX("RESET\n"); - queue_work(priv->workqueue, &priv->adapter_restart); return 0; } -#endif // CONFIG_IPW_MONITOR /* Rebase the WE IOCTLs to zero for the handler array */ #define IW_IOCTL(x) [(x)-SIOCSIWCOMMIT] @@ -7753,14 +8844,19 @@ static iw_handler ipw_wx_handlers[] = { IW_IOCTL(SIOCGIWTHRSPY) = iw_handler_get_thrspy, }; -#define IPW_PRIV_SET_POWER SIOCIWFIRSTPRIV -#define IPW_PRIV_GET_POWER SIOCIWFIRSTPRIV+1 -#define IPW_PRIV_SET_MODE SIOCIWFIRSTPRIV+2 -#define IPW_PRIV_GET_MODE SIOCIWFIRSTPRIV+3 -#define IPW_PRIV_SET_PREAMBLE SIOCIWFIRSTPRIV+4 -#define IPW_PRIV_GET_PREAMBLE SIOCIWFIRSTPRIV+5 -#define IPW_PRIV_SET_MONITOR SIOCIWFIRSTPRIV+6 -#define IPW_PRIV_RESET SIOCIWFIRSTPRIV+7 +enum { + IPW_PRIV_SET_POWER = SIOCIWFIRSTPRIV, + IPW_PRIV_GET_POWER, + IPW_PRIV_SET_MODE, + IPW_PRIV_GET_MODE, + IPW_PRIV_SET_PREAMBLE, + IPW_PRIV_GET_PREAMBLE, + IPW_PRIV_RESET, + IPW_PRIV_SW_RESET, +#ifdef CONFIG_IPW2200_MONITOR + IPW_PRIV_SET_MONITOR, +#endif +}; static struct iw_priv_args ipw_priv_args[] = { { @@ -7787,14 +8883,17 @@ static struct iw_priv_args ipw_priv_args[] = { .cmd = IPW_PRIV_GET_PREAMBLE, .get_args = IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | IFNAMSIZ, .name = "get_preamble"}, -#ifdef CONFIG_IPW_MONITOR - { - IPW_PRIV_SET_MONITOR, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, "monitor"}, { IPW_PRIV_RESET, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 0, 0, "reset"}, -#endif /* CONFIG_IPW_MONITOR */ + { + IPW_PRIV_SW_RESET, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 0, 0, "sw_reset"}, +#ifdef CONFIG_IPW2200_MONITOR + { + IPW_PRIV_SET_MONITOR, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, "monitor"}, +#endif /* CONFIG_IPW2200_MONITOR */ }; static iw_handler ipw_priv_handler[] = { @@ -7804,9 +8903,10 @@ static iw_handler ipw_priv_handler[] = { ipw_wx_get_wireless_mode, ipw_wx_set_preamble, ipw_wx_get_preamble, -#ifdef CONFIG_IPW_MONITOR - ipw_wx_set_monitor, ipw_wx_reset, + ipw_wx_sw_reset, +#ifdef CONFIG_IPW2200_MONITOR + ipw_wx_set_monitor, #endif }; @@ -7915,13 +9015,19 @@ modify to send one tfd per fragment instead of using chunking. otherwise we need to heavily modify the ieee80211_skb_to_txb. */ -static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb) +static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb, + int pri) { struct ieee80211_hdr_3addr *hdr = (struct ieee80211_hdr_3addr *) txb->fragments[0]->data; int i = 0; struct tfd_frame *tfd; +#ifdef CONFIG_IPW_QOS + int tx_id = ipw_get_tx_queue_number(priv, pri); + struct clx2_tx_queue *txq = &priv->txq[tx_id]; +#else struct clx2_tx_queue *txq = &priv->txq[0]; +#endif struct clx2_queue *q = &txq->q; u8 id, hdr_len, unicast; u16 remaining_bytes; @@ -7964,15 +9070,11 @@ static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb) tfd->u.data.cmd_id = DINO_CMD_TX; tfd->u.data.len = cpu_to_le16(txb->payload_size); remaining_bytes = txb->payload_size; - if (unlikely(!unicast)) - tfd->u.data.tx_flags = DCT_FLAG_NO_WEP; - else - tfd->u.data.tx_flags = DCT_FLAG_NO_WEP | DCT_FLAG_ACK_REQD; if (priv->assoc_request.ieee_mode == IPW_B_MODE) - tfd->u.data.tx_flags_ext = DCT_FLAG_EXT_MODE_CCK; + tfd->u.data.tx_flags_ext |= DCT_FLAG_EXT_MODE_CCK; else - tfd->u.data.tx_flags_ext = DCT_FLAG_EXT_MODE_OFDM; + tfd->u.data.tx_flags_ext |= DCT_FLAG_EXT_MODE_OFDM; if (priv->assoc_request.preamble_length == DCT_FLAG_SHORT_PREAMBLE) tfd->u.data.tx_flags |= DCT_FLAG_SHORT_PREAMBLE; @@ -7982,6 +9084,58 @@ static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb) memcpy(&tfd->u.data.tfd.tfd_24.mchdr, hdr, hdr_len); + if (likely(unicast)) + tfd->u.data.tx_flags |= DCT_FLAG_ACK_REQD; + + if (txb->encrypted && !priv->ieee->host_encrypt) { + switch (priv->ieee->sec.level) { + case SEC_LEVEL_3: + tfd->u.data.tfd.tfd_24.mchdr.frame_ctl |= + IEEE80211_FCTL_PROTECTED; + /* XXX: ACK flag must be set for CCMP even if it + * is a multicast/broadcast packet, because CCMP + * group communication encrypted by GTK is + * actually done by the AP. */ + if (!unicast) + tfd->u.data.tx_flags |= DCT_FLAG_ACK_REQD; + + tfd->u.data.tx_flags &= ~DCT_FLAG_NO_WEP; + tfd->u.data.tx_flags_ext |= DCT_FLAG_EXT_SECURITY_CCM; + tfd->u.data.key_index = 0; + tfd->u.data.key_index |= DCT_WEP_INDEX_USE_IMMEDIATE; + break; + case SEC_LEVEL_2: + tfd->u.data.tfd.tfd_24.mchdr.frame_ctl |= + IEEE80211_FCTL_PROTECTED; + tfd->u.data.tx_flags &= ~DCT_FLAG_NO_WEP; + tfd->u.data.tx_flags_ext |= DCT_FLAG_EXT_SECURITY_TKIP; + tfd->u.data.key_index = DCT_WEP_INDEX_USE_IMMEDIATE; + break; + case SEC_LEVEL_1: + tfd->u.data.tfd.tfd_24.mchdr.frame_ctl |= + IEEE80211_FCTL_PROTECTED; + tfd->u.data.key_index = priv->ieee->tx_keyidx; + if (priv->ieee->sec.key_sizes[priv->ieee->tx_keyidx] <= + 40) + tfd->u.data.key_index |= DCT_WEP_KEY_64Bit; + else + tfd->u.data.key_index |= DCT_WEP_KEY_128Bit; + break; + case SEC_LEVEL_0: + break; + default: + printk(KERN_ERR "Unknow security level %d\n", + priv->ieee->sec.level); + break; + } + } else + /* No hardware encryption */ + tfd->u.data.tx_flags |= DCT_FLAG_NO_WEP; + +#ifdef CONFIG_IPW_QOS + ipw_qos_set_tx_queue_command(priv, pri, &(tfd->u.data), unicast); +#endif /* CONFIG_IPW_QOS */ + /* payload */ tfd->u.data.num_chunks = cpu_to_le32(min((u8) (NUM_TFD_CHUNKS - 2), txb->nr_frags)); @@ -8071,16 +9225,14 @@ static int ipw_net_hard_start_xmit(struct ieee80211_txb *txb, goto fail_unlock; } - ipw_tx_skb(priv, txb); + ipw_tx_skb(priv, txb, pri); + __ipw_led_activity_on(priv); spin_unlock_irqrestore(&priv->lock, flags); - ipw_led_activity_on(priv); -// up(&priv->sem); return 0; fail_unlock: spin_unlock_irqrestore(&priv->lock, flags); -// up(&priv->sem); return 1; } @@ -8133,7 +9285,7 @@ static void ipw_ethtool_get_drvinfo(struct net_device *dev, snprintf(info->fw_version, sizeof(info->fw_version), "%s (%s)", vers, date); strcpy(info->bus_info, pci_name(p->pci_dev)); - info->eedump_len = CX2_EEPROM_IMAGE_SIZE; + info->eedump_len = IPW_EEPROM_IMAGE_SIZE; } static u32 ipw_ethtool_get_link(struct net_device *dev) @@ -8144,7 +9296,7 @@ static u32 ipw_ethtool_get_link(struct net_device *dev) static int ipw_ethtool_get_eeprom_len(struct net_device *dev) { - return CX2_EEPROM_IMAGE_SIZE; + return IPW_EEPROM_IMAGE_SIZE; } static int ipw_ethtool_get_eeprom(struct net_device *dev, @@ -8152,7 +9304,7 @@ static int ipw_ethtool_get_eeprom(struct net_device *dev, { struct ipw_priv *p = ieee80211_priv(dev); - if (eeprom->offset + eeprom->len > CX2_EEPROM_IMAGE_SIZE) + if (eeprom->offset + eeprom->len > IPW_EEPROM_IMAGE_SIZE) return -EINVAL; down(&p->sem); memcpy(bytes, &((u8 *) p->eeprom)[eeprom->offset], eeprom->len); @@ -8166,12 +9318,12 @@ static int ipw_ethtool_set_eeprom(struct net_device *dev, struct ipw_priv *p = ieee80211_priv(dev); int i; - if (eeprom->offset + eeprom->len > CX2_EEPROM_IMAGE_SIZE) + if (eeprom->offset + eeprom->len > IPW_EEPROM_IMAGE_SIZE) return -EINVAL; down(&p->sem); memcpy(&((u8 *) p->eeprom)[eeprom->offset], bytes, eeprom->len); for (i = IPW_EEPROM_DATA; - i < IPW_EEPROM_DATA + CX2_EEPROM_IMAGE_SIZE; i++) + i < IPW_EEPROM_DATA + IPW_EEPROM_IMAGE_SIZE; i++) ipw_write8(p, i, p->eeprom[i]); up(&p->sem); return 0; @@ -8197,13 +9349,11 @@ static irqreturn_t ipw_isr(int irq, void *data, struct pt_regs *regs) if (!(priv->status & STATUS_INT_ENABLED)) { /* Shared IRQ */ -// ipw_write32(priv, CX2_INTA_RW, CX2_INTA_MASK_ALL); -// return IRQ_HANDLED; goto none; } - inta = ipw_read32(priv, CX2_INTA_RW); - inta_mask = ipw_read32(priv, CX2_INTA_MASK_R); + inta = ipw_read32(priv, IPW_INTA_RW); + inta_mask = ipw_read32(priv, IPW_INTA_MASK_R); if (inta == 0xFFFFFFFF) { /* Hardware disappeared */ @@ -8211,7 +9361,7 @@ static irqreturn_t ipw_isr(int irq, void *data, struct pt_regs *regs) goto none; } - if (!(inta & (CX2_INTA_MASK_ALL & inta_mask))) { + if (!(inta & (IPW_INTA_MASK_ALL & inta_mask))) { /* Shared interrupt */ goto none; } @@ -8220,8 +9370,8 @@ static irqreturn_t ipw_isr(int irq, void *data, struct pt_regs *regs) ipw_disable_interrupts(priv); /* ack current interrupts */ - inta &= (CX2_INTA_MASK_ALL & inta_mask); - ipw_write32(priv, CX2_INTA_RW, inta); + inta &= (IPW_INTA_MASK_ALL & inta_mask); + ipw_write32(priv, IPW_INTA_RW, inta); /* Cache INTA value for our tasklet */ priv->isr_inta = inta; @@ -8348,7 +9498,7 @@ static int ipw_setup_deferred_work(struct ipw_priv *priv) INIT_WORK(&priv->up, (void (*)(void *))ipw_bg_up, priv); INIT_WORK(&priv->down, (void (*)(void *))ipw_bg_down, priv); INIT_WORK(&priv->request_scan, - (void (*)(void *))ipw_bg_request_scan, priv); + (void (*)(void *))ipw_request_scan, priv); INIT_WORK(&priv->gather_stats, (void (*)(void *))ipw_bg_gather_stats, priv); INIT_WORK(&priv->abort_scan, (void (*)(void *))ipw_bg_abort_scan, priv); @@ -8365,6 +9515,11 @@ static int ipw_setup_deferred_work(struct ipw_priv *priv) INIT_WORK(&priv->merge_networks, (void (*)(void *))ipw_merge_adhoc_network, priv); +#ifdef CONFIG_IPW_QOS + INIT_WORK(&priv->qos_activate, (void (*)(void *))ipw_bg_qos_activate, + priv); +#endif /* CONFIG_IPW_QOS */ + tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long)) ipw_irq_tasklet, (unsigned long)priv); @@ -8379,31 +9534,33 @@ static void shim__set_security(struct net_device *dev, down(&priv->sem); for (i = 0; i < 4; i++) { if (sec->flags & (1 << i)) { - priv->sec.key_sizes[i] = sec->key_sizes[i]; + priv->ieee->sec.key_sizes[i] = sec->key_sizes[i]; if (sec->key_sizes[i] == 0) - priv->sec.flags &= ~(1 << i); - else - memcpy(priv->sec.keys[i], sec->keys[i], + priv->ieee->sec.flags &= ~(1 << i); + else { + memcpy(priv->ieee->sec.keys[i], sec->keys[i], sec->key_sizes[i]); - priv->sec.flags |= (1 << i); + priv->ieee->sec.flags |= (1 << i); + } priv->status |= STATUS_SECURITY_UPDATED; - } + } else if (sec->level != SEC_LEVEL_1) + priv->ieee->sec.flags &= ~(1 << i); } - if ((sec->flags & SEC_ACTIVE_KEY) && - priv->sec.active_key != sec->active_key) { + if (sec->flags & SEC_ACTIVE_KEY) { if (sec->active_key <= 3) { - priv->sec.active_key = sec->active_key; - priv->sec.flags |= SEC_ACTIVE_KEY; + priv->ieee->sec.active_key = sec->active_key; + priv->ieee->sec.flags |= SEC_ACTIVE_KEY; } else - priv->sec.flags &= ~SEC_ACTIVE_KEY; + priv->ieee->sec.flags &= ~SEC_ACTIVE_KEY; priv->status |= STATUS_SECURITY_UPDATED; - } + } else + priv->ieee->sec.flags &= ~SEC_ACTIVE_KEY; if ((sec->flags & SEC_AUTH_MODE) && - (priv->sec.auth_mode != sec->auth_mode)) { - priv->sec.auth_mode = sec->auth_mode; - priv->sec.flags |= SEC_AUTH_MODE; + (priv->ieee->sec.auth_mode != sec->auth_mode)) { + priv->ieee->sec.auth_mode = sec->auth_mode; + priv->ieee->sec.flags |= SEC_AUTH_MODE; if (sec->auth_mode == WLAN_AUTH_SHARED_KEY) priv->capability |= CAP_SHARED_KEY; else @@ -8411,22 +9568,26 @@ static void shim__set_security(struct net_device *dev, priv->status |= STATUS_SECURITY_UPDATED; } - if (sec->flags & SEC_ENABLED && priv->sec.enabled != sec->enabled) { - priv->sec.flags |= SEC_ENABLED; - priv->sec.enabled = sec->enabled; + if (sec->flags & SEC_ENABLED && priv->ieee->sec.enabled != sec->enabled) { + priv->ieee->sec.flags |= SEC_ENABLED; + priv->ieee->sec.enabled = sec->enabled; priv->status |= STATUS_SECURITY_UPDATED; if (sec->enabled) priv->capability |= CAP_PRIVACY_ON; else priv->capability &= ~CAP_PRIVACY_ON; } + priv->ieee->sec.encrypt = sec->encrypt; - if (sec->flags & SEC_LEVEL && priv->sec.level != sec->level) { - priv->sec.level = sec->level; - priv->sec.flags |= SEC_LEVEL; + if (sec->flags & SEC_LEVEL && priv->ieee->sec.level != sec->level) { + priv->ieee->sec.level = sec->level; + priv->ieee->sec.flags |= SEC_LEVEL; priv->status |= STATUS_SECURITY_UPDATED; } + if (!priv->ieee->host_encrypt) + ipw_set_hwcrypto_keys(priv); + /* To match current functionality of ipw2100 (which works well w/ * various supplicants, we don't force a disassociate if the * privacy capability changes ... */ @@ -8524,6 +9685,10 @@ static int ipw_config(struct ipw_priv *priv) if (ipw_send_rts_threshold(priv, priv->rts_threshold)) goto error; } +#ifdef CONFIG_IPW_QOS + IPW_DEBUG_QOS("QoS: call ipw_qos_activate\n"); + ipw_qos_activate(priv, NULL); +#endif /* CONFIG_IPW_QOS */ if (ipw_set_random_seed(priv)) goto error; @@ -8533,10 +9698,8 @@ static int ipw_config(struct ipw_priv *priv) goto error; /* If configured to try and auto-associate, kick off a scan */ - if ((priv->config & CFG_ASSOCIATE) && ipw_request_scan(priv)) { - IPW_WARNING("error sending scan request\n"); - goto error; - } + if (priv->config & CFG_ASSOCIATE) + queue_work(priv->workqueue, &priv->request_scan); return 0; @@ -8566,7 +9729,15 @@ static int ipw_up(struct ipw_priv *priv) eeprom_parse_mac(priv, priv->mac_addr); memcpy(priv->net_dev->dev_addr, priv->mac_addr, ETH_ALEN); - if (priv->status & STATUS_RF_KILL_MASK) { + if (priv->status & STATUS_RF_KILL_SW) { + IPW_WARNING("Radio disabled by module parameter.\n"); + return 0; + } else if (rf_kill_active(priv)) { + IPW_WARNING("Radio Frequency Kill Switch is On:\n" + "Kill switch must be turned off for " + "wireless networking to work.\n"); + queue_delayed_work(priv->workqueue, &priv->rf_kill, + 2 * HZ); return 0; } @@ -8604,18 +9775,61 @@ static void ipw_bg_up(void *data) up(&priv->sem); } -static void ipw_down(struct ipw_priv *priv) +static void ipw_deinit(struct ipw_priv *priv) { -#if 0 + int i; + + if (priv->status & STATUS_SCANNING) { + IPW_DEBUG_INFO("Aborting scan during shutdown.\n"); + ipw_abort_scan(priv); + } + + if (priv->status & STATUS_ASSOCIATED) { + IPW_DEBUG_INFO("Disassociating during shutdown.\n"); + ipw_disassociate(priv); + } + + ipw_led_shutdown(priv); + + /* Wait up to 1s for status to change to not scanning and not + * associated (disassociation can take a while for a ful 802.11 + * exchange */ + for (i = 1000; i && (priv->status & + (STATUS_DISASSOCIATING | + STATUS_ASSOCIATED | STATUS_SCANNING)); i--) + udelay(10); + + if (priv->status & (STATUS_DISASSOCIATING | + STATUS_ASSOCIATED | STATUS_SCANNING)) + IPW_DEBUG_INFO("Still associated or scanning...\n"); + else + IPW_DEBUG_INFO("Took %dms to de-init\n", 1000 - i); + /* Attempt to disable the card */ ipw_send_card_disable(priv, 0); -#endif + + priv->status &= ~STATUS_INIT; +} + +static void ipw_down(struct ipw_priv *priv) +{ + int exit_pending = priv->status & STATUS_EXIT_PENDING; + + priv->status |= STATUS_EXIT_PENDING; + + if (ipw_is_init(priv)) + ipw_deinit(priv); + + /* Wipe out the EXIT_PENDING status bit if we are not actually + * exiting the module */ + if (!exit_pending) + priv->status &= ~STATUS_EXIT_PENDING; /* tell the device to stop sending interrupts */ ipw_disable_interrupts(priv); /* Clear all bits but the RF Kill */ - priv->status &= STATUS_RF_KILL_MASK; + priv->status &= STATUS_RF_KILL_MASK | STATUS_EXIT_PENDING; netif_carrier_off(priv->net_dev); netif_stop_queue(priv->net_dev); @@ -8653,18 +9867,6 @@ static int ipw_net_init(struct net_device *dev) { struct ipw_priv *priv = ieee80211_priv(dev); down(&priv->sem); - if (priv->status & STATUS_RF_KILL_SW) { - IPW_WARNING("Radio disabled by module parameter.\n"); - up(&priv->sem); - return 0; - } else if (rf_kill_active(priv)) { - IPW_WARNING("Radio Frequency Kill Switch is On:\n" - "Kill switch must be turned off for " - "wireless networking to work.\n"); - queue_delayed_work(priv->workqueue, &priv->rf_kill, 2 * HZ); - up(&priv->sem); - return 0; - } if (ipw_up(priv)) { up(&priv->sem); @@ -8723,6 +9925,8 @@ static struct attribute *ipw_sysfs_entries[] = { &dev_attr_rtc.attr, &dev_attr_scan_age.attr, &dev_attr_led.attr, + &dev_attr_speed_scan.attr, + &dev_attr_net_stats.attr, NULL }; @@ -8738,7 +9942,6 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) void __iomem *base; u32 length, val; struct ipw_priv *priv; - int band, modulation; net_dev = alloc_ieee80211(sizeof(struct ipw_priv)); if (net_dev == NULL) { @@ -8803,88 +10006,7 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto out_iounmap; } - /* Initialize module parameter values here */ - - /* We default to disabling the LED code as right now it causes - * too many systems to lock up... */ - if (!led) - priv->config |= CFG_NO_LED; - - if (associate) - priv->config |= CFG_ASSOCIATE; - else - IPW_DEBUG_INFO("Auto associate disabled.\n"); - - if (auto_create) - priv->config |= CFG_ADHOC_CREATE; - else - IPW_DEBUG_INFO("Auto adhoc creation disabled.\n"); - - if (disable) { - priv->status |= STATUS_RF_KILL_SW; - IPW_DEBUG_INFO("Radio disabled.\n"); - } - - if (channel != 0) { - priv->config |= CFG_STATIC_CHANNEL; - priv->channel = channel; - IPW_DEBUG_INFO("Bind to static channel %d\n", channel); - IPW_DEBUG_INFO("Bind to static channel %d\n", channel); - /* TODO: Validate that provided channel is in range */ - } - - switch (mode) { - case 1: - priv->ieee->iw_mode = IW_MODE_ADHOC; - break; -#ifdef CONFIG_IPW_MONITOR - case 2: - priv->ieee->iw_mode = IW_MODE_MONITOR; - break; -#endif - default: - case 0: - priv->ieee->iw_mode = IW_MODE_INFRA; - break; - } - - if ((priv->pci_dev->device == 0x4223) || - (priv->pci_dev->device == 0x4224)) { - printk(KERN_INFO DRV_NAME - ": Detected Intel PRO/Wireless 2915ABG Network " - "Connection\n"); - priv->ieee->abg_true = 1; - band = IEEE80211_52GHZ_BAND | IEEE80211_24GHZ_BAND; - modulation = IEEE80211_OFDM_MODULATION | - IEEE80211_CCK_MODULATION; - priv->adapter = IPW_2915ABG; - priv->ieee->mode = IEEE_A | IEEE_G | IEEE_B; - } else { - printk(KERN_INFO DRV_NAME - ": Detected Intel PRO/Wireless 2200BG Network " - "Connection\n"); - - priv->ieee->abg_true = 0; - band = IEEE80211_24GHZ_BAND; - modulation = IEEE80211_OFDM_MODULATION | - IEEE80211_CCK_MODULATION; - priv->adapter = IPW_2200BG; - priv->ieee->mode = IEEE_G | IEEE_B; - } - - priv->ieee->freq_band = band; - priv->ieee->modulation = modulation; - - priv->rates_mask = IEEE80211_DEFAULT_RATES_MASK; - - priv->missed_beacon_threshold = IPW_MB_DISASSOCIATE_THRESHOLD_DEFAULT; - priv->roaming_threshold = IPW_MB_ROAMING_THRESHOLD_DEFAULT; - - priv->rts_threshold = DEFAULT_RTS_THRESHOLD; - - /* If power management is turned on, default to AC mode */ - priv->power_mode = IPW_POWER_AC; - priv->tx_power = IPW_DEFAULT_TX_POWER; + ipw_sw_reset(priv, 1); err = request_irq(pdev->irq, ipw_isr, SA_SHIRQ, DRV_NAME, priv); if (err) { @@ -8903,6 +10025,10 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) priv->ieee->hard_start_xmit = ipw_net_hard_start_xmit; priv->ieee->set_security = shim__set_security; +#ifdef CONFIG_IPW_QOS + priv->ieee->handle_management_frame = ipw_handle_management_frame; +#endif /* CONFIG_IPW_QOS */ + priv->ieee->perfect_rssi = -20; priv->ieee->worst_rssi = -85; @@ -8960,14 +10086,14 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) static void ipw_pci_remove(struct pci_dev *pdev) { struct ipw_priv *priv = pci_get_drvdata(pdev); + if (!priv) return; - priv->status |= STATUS_EXIT_PENDING; - - sysfs_remove_group(&pdev->dev.kobj, &ipw_attribute_group); - + down(&priv->sem); ipw_down(priv); + sysfs_remove_group(&pdev->dev.kobj, &ipw_attribute_group); + up(&priv->sem); unregister_netdev(priv->net_dev); @@ -8977,8 +10103,6 @@ static void ipw_pci_remove(struct pci_dev *pdev) } ipw_tx_queue_free(priv); - ipw_led_shutdown(priv); - /* ipw_down will ensure that there is no more pending work * in the workqueue's, so we can safely remove them now. */ cancel_delayed_work(&priv->adhoc_check); @@ -9119,7 +10243,24 @@ MODULE_PARM_DESC(debug, "debug output mask"); module_param(channel, int, 0444); MODULE_PARM_DESC(channel, "channel to limit associate to (default 0 [ANY])"); -#ifdef CONFIG_IPW_MONITOR +#ifdef CONFIG_IPW_QOS +module_param(qos_enable, int, 0444); +MODULE_PARM_DESC(qos_enable, "enable all QoS functionalitis"); + +module_param(qos_burst_enable, int, 0444); +MODULE_PARM_DESC(qos_burst_enable, "enable QoS burst mode"); + +module_param(qos_no_ack_mask, int, 0444); +MODULE_PARM_DESC(qos_no_ack_mask, "mask Tx_Queue to no ack"); + +module_param(burst_duration_CCK, int, 0444); +MODULE_PARM_DESC(burst_duration_CCK, "set CCK burst value"); + +module_param(burst_duration_OFDM, int, 0444); +MODULE_PARM_DESC(burst_duration_OFDM, "set OFDM burst value"); +#endif /* CONFIG_IPW_QOS */ + +#ifdef CONFIG_IPW2200_MONITOR module_param(mode, int, 0444); MODULE_PARM_DESC(mode, "network mode (0=BSS,1=IBSS,2=Monitor)"); #else @@ -9127,5 +10268,8 @@ module_param(mode, int, 0444); MODULE_PARM_DESC(mode, "network mode (0=BSS,1=IBSS)"); #endif +module_param(hwcrypto, int, 0444); +MODULE_PARM_DESC(hwcrypto, "enable hardware crypto (default on)"); + module_exit(ipw_exit); module_init(ipw_init); diff --git a/drivers/net/wireless/ipw2200.h b/drivers/net/wireless/ipw2200.h index 243b8ea14140..9dbd73a42094 100644 --- a/drivers/net/wireless/ipw2200.h +++ b/drivers/net/wireless/ipw2200.h @@ -161,6 +161,16 @@ enum connection_manager_assoc_states { * TX Queue Flag Definitions */ +/* tx wep key definition */ +#define DCT_WEP_KEY_NOT_IMMIDIATE 0x00 +#define DCT_WEP_KEY_64Bit 0x40 +#define DCT_WEP_KEY_128Bit 0x80 +#define DCT_WEP_KEY_128bitIV 0xC0 +#define DCT_WEP_KEY_SIZE_MASK 0xC0 + +#define DCT_WEP_KEY_INDEX_MASK 0x0F +#define DCT_WEP_INDEX_USE_IMMEDIATE 0x20 + /* abort attempt if mgmt frame is rx'd */ #define DCT_FLAG_ABORT_MGMT 0x01 @@ -186,9 +196,23 @@ enum connection_manager_assoc_states { /* ACK rx is expected to follow */ #define DCT_FLAG_ACK_REQD 0x80 +/* TX flags extension */ #define DCT_FLAG_EXT_MODE_CCK 0x01 #define DCT_FLAG_EXT_MODE_OFDM 0x00 +#define DCT_FLAG_EXT_SECURITY_WEP 0x00 +#define DCT_FLAG_EXT_SECURITY_NO DCT_FLAG_EXT_SECURITY_WEP +#define DCT_FLAG_EXT_SECURITY_CKIP 0x04 +#define DCT_FLAG_EXT_SECURITY_CCM 0x08 +#define DCT_FLAG_EXT_SECURITY_TKIP 0x0C +#define DCT_FLAG_EXT_SECURITY_MASK 0x0C + +#define DCT_FLAG_EXT_QOS_ENABLED 0x10 + +#define DCT_FLAG_EXT_HC_NO_SIFS_PIFS 0x00 +#define DCT_FLAG_EXT_HC_SIFS 0x20 +#define DCT_FLAG_EXT_HC_PIFS 0x40 + #define TX_RX_TYPE_MASK 0xFF #define TX_FRAME_TYPE 0x00 #define TX_HOST_COMMAND_TYPE 0x01 @@ -234,6 +258,117 @@ enum connection_manager_assoc_states { #define DCR_TYPE_SNIFFER 0x06 #define DCR_TYPE_MU_BSS DCR_TYPE_MU_ESS +/* QoS definitions */ + +#define CW_MIN_OFDM 15 +#define CW_MAX_OFDM 1023 +#define CW_MIN_CCK 31 +#define CW_MAX_CCK 1023 + +#define QOS_TX0_CW_MIN_OFDM CW_MIN_OFDM +#define QOS_TX1_CW_MIN_OFDM CW_MIN_OFDM +#define QOS_TX2_CW_MIN_OFDM ( (CW_MIN_OFDM + 1) / 2 - 1 ) +#define QOS_TX3_CW_MIN_OFDM ( (CW_MIN_OFDM + 1) / 4 - 1 ) + +#define QOS_TX0_CW_MIN_CCK CW_MIN_CCK +#define QOS_TX1_CW_MIN_CCK CW_MIN_CCK +#define QOS_TX2_CW_MIN_CCK ( (CW_MIN_CCK + 1) / 2 - 1 ) +#define QOS_TX3_CW_MIN_CCK ( (CW_MIN_CCK + 1) / 4 - 1 ) + +#define QOS_TX0_CW_MAX_OFDM CW_MAX_OFDM +#define QOS_TX1_CW_MAX_OFDM CW_MAX_OFDM +#define QOS_TX2_CW_MAX_OFDM CW_MIN_OFDM +#define QOS_TX3_CW_MAX_OFDM ( (CW_MIN_OFDM + 1) / 2 - 1 ) + +#define QOS_TX0_CW_MAX_CCK CW_MAX_CCK +#define QOS_TX1_CW_MAX_CCK CW_MAX_CCK +#define QOS_TX2_CW_MAX_CCK CW_MIN_CCK +#define QOS_TX3_CW_MAX_CCK ( (CW_MIN_CCK + 1) / 2 - 1 ) + +#define QOS_TX0_AIFS (3 - QOS_AIFSN_MIN_VALUE) +#define QOS_TX1_AIFS (7 - QOS_AIFSN_MIN_VALUE) +#define QOS_TX2_AIFS (2 - QOS_AIFSN_MIN_VALUE) +#define QOS_TX3_AIFS (2 - QOS_AIFSN_MIN_VALUE) + +#define QOS_TX0_ACM 0 +#define QOS_TX1_ACM 0 +#define QOS_TX2_ACM 0 +#define QOS_TX3_ACM 0 + +#define QOS_TX0_TXOP_LIMIT_CCK 0 +#define QOS_TX1_TXOP_LIMIT_CCK 0 +#define QOS_TX2_TXOP_LIMIT_CCK 6016 +#define QOS_TX3_TXOP_LIMIT_CCK 3264 + +#define QOS_TX0_TXOP_LIMIT_OFDM 0 +#define QOS_TX1_TXOP_LIMIT_OFDM 0 +#define QOS_TX2_TXOP_LIMIT_OFDM 3008 +#define QOS_TX3_TXOP_LIMIT_OFDM 1504 + +#define DEF_TX0_CW_MIN_OFDM CW_MIN_OFDM +#define DEF_TX1_CW_MIN_OFDM CW_MIN_OFDM +#define DEF_TX2_CW_MIN_OFDM CW_MIN_OFDM +#define DEF_TX3_CW_MIN_OFDM CW_MIN_OFDM + +#define DEF_TX0_CW_MIN_CCK CW_MIN_CCK +#define DEF_TX1_CW_MIN_CCK CW_MIN_CCK +#define DEF_TX2_CW_MIN_CCK CW_MIN_CCK +#define DEF_TX3_CW_MIN_CCK CW_MIN_CCK + +#define DEF_TX0_CW_MAX_OFDM CW_MAX_OFDM +#define DEF_TX1_CW_MAX_OFDM CW_MAX_OFDM +#define DEF_TX2_CW_MAX_OFDM CW_MAX_OFDM +#define DEF_TX3_CW_MAX_OFDM CW_MAX_OFDM + +#define DEF_TX0_CW_MAX_CCK CW_MAX_CCK +#define DEF_TX1_CW_MAX_CCK CW_MAX_CCK +#define DEF_TX2_CW_MAX_CCK CW_MAX_CCK +#define DEF_TX3_CW_MAX_CCK CW_MAX_CCK + +#define DEF_TX0_AIFS 0 +#define DEF_TX1_AIFS 0 +#define DEF_TX2_AIFS 0 +#define DEF_TX3_AIFS 0 + +#define DEF_TX0_ACM 0 +#define DEF_TX1_ACM 0 +#define DEF_TX2_ACM 0 +#define DEF_TX3_ACM 0 + +#define DEF_TX0_TXOP_LIMIT_CCK 0 +#define DEF_TX1_TXOP_LIMIT_CCK 0 +#define DEF_TX2_TXOP_LIMIT_CCK 0 +#define DEF_TX3_TXOP_LIMIT_CCK 0 + +#define DEF_TX0_TXOP_LIMIT_OFDM 0 +#define DEF_TX1_TXOP_LIMIT_OFDM 0 +#define DEF_TX2_TXOP_LIMIT_OFDM 0 +#define DEF_TX3_TXOP_LIMIT_OFDM 0 + +#define QOS_QOS_SETS 3 +#define QOS_PARAM_SET_ACTIVE 0 +#define QOS_PARAM_SET_DEF_CCK 1 +#define QOS_PARAM_SET_DEF_OFDM 2 + +#define CTRL_QOS_NO_ACK (0x0020) + +#define IPW_TX_QUEUE_1 1 +#define IPW_TX_QUEUE_2 2 +#define IPW_TX_QUEUE_3 3 +#define IPW_TX_QUEUE_4 4 + +/* QoS sturctures */ +struct ipw_qos_info { + int qos_enable; + struct ieee80211_qos_parameters *def_qos_parm_OFDM; + struct ieee80211_qos_parameters *def_qos_parm_CCK; + u32 burst_duration_CCK; + u32 burst_duration_OFDM; + u16 qos_no_ack_mask; + int burst_enable; +}; + +/**************************************************************/ /** * Generic queue structure * @@ -658,6 +793,19 @@ struct ipw_multicast_addr { u8 mac4[6]; } __attribute__ ((packed)); +#define DCW_WEP_KEY_INDEX_MASK 0x03 /* bits [0:1] */ +#define DCW_WEP_KEY_SEC_TYPE_MASK 0x30 /* bits [4:5] */ + +#define DCW_WEP_KEY_SEC_TYPE_WEP 0x00 +#define DCW_WEP_KEY_SEC_TYPE_CCM 0x20 +#define DCW_WEP_KEY_SEC_TYPE_TKIP 0x30 + +#define DCW_WEP_KEY_INVALID_SIZE 0x00 /* 0 = Invalid key */ +#define DCW_WEP_KEY64Bit_SIZE 0x05 /* 64-bit encryption */ +#define DCW_WEP_KEY128Bit_SIZE 0x0D /* 128-bit encryption */ +#define DCW_CCM_KEY128Bit_SIZE 0x10 /* 128-bit key */ +//#define DCW_WEP_KEY128BitIV_SIZE 0x10 /* 128-bit key and 128-bit IV */ + struct ipw_wep_key { u8 cmd_id; u8 seq_num; @@ -819,14 +967,6 @@ struct ipw_tx_power { struct ipw_channel_tx_power channels_tx_power[MAX_A_CHANNELS]; } __attribute__ ((packed)); -struct ipw_qos_parameters { - u16 cw_min[4]; - u16 cw_max[4]; - u8 aifs[4]; - u8 flag[4]; - u16 tx_op_limit[4]; -} __attribute__ ((packed)); - struct ipw_rsn_capabilities { u8 id; u8 length; @@ -910,6 +1050,8 @@ struct ipw_cmd { #define CFG_ADHOC_CREATE (1<<8) #define CFG_NO_LED (1<<9) #define CFG_BACKGROUND_SCAN (1<<10) +#define CFG_SPEED_SCAN (1<<11) +#define CFG_NET_STATS (1<<12) #define CAP_SHARED_KEY (1<<0) /* Off = OPEN */ #define CAP_PRIVACY_ON (1<<1) /* Off = No privacy */ @@ -931,10 +1073,11 @@ struct average { s32 sum; }; +#define MAX_SPEED_SCAN 100 + struct ipw_priv { /* ieee device used by generic ieee processing code */ struct ieee80211_device *ieee; - struct ieee80211_security sec; spinlock_t lock; struct semaphore sem; @@ -1030,6 +1173,9 @@ struct ipw_priv { u32 tx_packets; u32 quality; + u8 speed_scan[MAX_SPEED_SCAN]; + u8 speed_scan_pos; + /* eeprom */ u8 eeprom[0x100]; /* 256 bytes of eeprom */ int eeprom_delay; @@ -1074,8 +1220,7 @@ struct ipw_priv { #define IPW_2915ABG 2 u8 adapter; -#define IPW_DEFAULT_TX_POWER 0x14 - u8 tx_power; + s8 tx_power; #ifdef CONFIG_PM u32 pm_state[16]; @@ -1086,6 +1231,11 @@ struct ipw_priv { /* Used to pass the current INTA value from ISR to Tasklet */ u32 isr_inta; + /* QoS */ + struct ipw_qos_info qos_data; + struct work_struct qos_activate; + /*********************************/ + /* debugging info */ u32 indirect_dword; u32 direct_dword; @@ -1162,6 +1312,7 @@ do { if (ipw_debug_level & (level)) \ #define IPW_DL_STATS (1<<29) #define IPW_DL_MERGE (1<<30) +#define IPW_DL_QOS (1<<31) #define IPW_ERROR(f, a...) printk(KERN_ERR DRV_NAME ": " f, ## a) #define IPW_WARNING(f, a...) printk(KERN_WARNING DRV_NAME ": " f, ## a) @@ -1190,6 +1341,7 @@ do { if (ipw_debug_level & (level)) \ #define IPW_DEBUG_ASSOC(f, a...) IPW_DEBUG(IPW_DL_ASSOC | IPW_DL_INFO, f, ## a) #define IPW_DEBUG_STATS(f, a...) IPW_DEBUG(IPW_DL_STATS, f, ## a) #define IPW_DEBUG_MERGE(f, a...) IPW_DEBUG(IPW_DL_MERGE, f, ## a) +#define IPW_DEBUG_QOS(f, a...) IPW_DEBUG(IPW_DL_QOS, f, ## a) #include @@ -1204,65 +1356,65 @@ do { if (ipw_debug_level & (level)) \ #define DINO_RXFIFO_DATA 0x01 #define DINO_CONTROL_REG 0x00200000 -#define CX2_INTA_RW 0x00000008 -#define CX2_INTA_MASK_R 0x0000000C -#define CX2_INDIRECT_ADDR 0x00000010 -#define CX2_INDIRECT_DATA 0x00000014 -#define CX2_AUTOINC_ADDR 0x00000018 -#define CX2_AUTOINC_DATA 0x0000001C -#define CX2_RESET_REG 0x00000020 -#define CX2_GP_CNTRL_RW 0x00000024 +#define IPW_INTA_RW 0x00000008 +#define IPW_INTA_MASK_R 0x0000000C +#define IPW_INDIRECT_ADDR 0x00000010 +#define IPW_INDIRECT_DATA 0x00000014 +#define IPW_AUTOINC_ADDR 0x00000018 +#define IPW_AUTOINC_DATA 0x0000001C +#define IPW_RESET_REG 0x00000020 +#define IPW_GP_CNTRL_RW 0x00000024 -#define CX2_READ_INT_REGISTER 0xFF4 +#define IPW_READ_INT_REGISTER 0xFF4 -#define CX2_GP_CNTRL_BIT_INIT_DONE 0x00000004 +#define IPW_GP_CNTRL_BIT_INIT_DONE 0x00000004 -#define CX2_REGISTER_DOMAIN1_END 0x00001000 -#define CX2_SRAM_READ_INT_REGISTER 0x00000ff4 +#define IPW_REGISTER_DOMAIN1_END 0x00001000 +#define IPW_SRAM_READ_INT_REGISTER 0x00000ff4 -#define CX2_SHARED_LOWER_BOUND 0x00000200 -#define CX2_INTERRUPT_AREA_LOWER_BOUND 0x00000f80 +#define IPW_SHARED_LOWER_BOUND 0x00000200 +#define IPW_INTERRUPT_AREA_LOWER_BOUND 0x00000f80 -#define CX2_NIC_SRAM_LOWER_BOUND 0x00000000 -#define CX2_NIC_SRAM_UPPER_BOUND 0x00030000 +#define IPW_NIC_SRAM_LOWER_BOUND 0x00000000 +#define IPW_NIC_SRAM_UPPER_BOUND 0x00030000 -#define CX2_BIT_INT_HOST_SRAM_READ_INT_REGISTER (1 << 29) -#define CX2_GP_CNTRL_BIT_CLOCK_READY 0x00000001 -#define CX2_GP_CNTRL_BIT_HOST_ALLOWS_STANDBY 0x00000002 +#define IPW_BIT_INT_HOST_SRAM_READ_INT_REGISTER (1 << 29) +#define IPW_GP_CNTRL_BIT_CLOCK_READY 0x00000001 +#define IPW_GP_CNTRL_BIT_HOST_ALLOWS_STANDBY 0x00000002 /* * RESET Register Bit Indexes */ #define CBD_RESET_REG_PRINCETON_RESET (1<<0) -#define CX2_START_STANDBY (1<<2) -#define CX2_ACTIVITY_LED (1<<4) -#define CX2_ASSOCIATED_LED (1<<5) -#define CX2_OFDM_LED (1<<6) -#define CX2_RESET_REG_SW_RESET (1<<7) -#define CX2_RESET_REG_MASTER_DISABLED (1<<8) -#define CX2_RESET_REG_STOP_MASTER (1<<9) -#define CX2_GATE_ODMA (1<<25) -#define CX2_GATE_IDMA (1<<26) -#define CX2_ARC_KESHET_CONFIG (1<<27) -#define CX2_GATE_ADMA (1<<29) - -#define CX2_CSR_CIS_UPPER_BOUND 0x00000200 -#define CX2_DOMAIN_0_END 0x1000 +#define IPW_START_STANDBY (1<<2) +#define IPW_ACTIVITY_LED (1<<4) +#define IPW_ASSOCIATED_LED (1<<5) +#define IPW_OFDM_LED (1<<6) +#define IPW_RESET_REG_SW_RESET (1<<7) +#define IPW_RESET_REG_MASTER_DISABLED (1<<8) +#define IPW_RESET_REG_STOP_MASTER (1<<9) +#define IPW_GATE_ODMA (1<<25) +#define IPW_GATE_IDMA (1<<26) +#define IPW_ARC_KESHET_CONFIG (1<<27) +#define IPW_GATE_ADMA (1<<29) + +#define IPW_CSR_CIS_UPPER_BOUND 0x00000200 +#define IPW_DOMAIN_0_END 0x1000 #define CLX_MEM_BAR_SIZE 0x1000 -#define CX2_BASEBAND_CONTROL_STATUS 0X00200000 -#define CX2_BASEBAND_TX_FIFO_WRITE 0X00200004 -#define CX2_BASEBAND_RX_FIFO_READ 0X00200004 -#define CX2_BASEBAND_CONTROL_STORE 0X00200010 +#define IPW_BASEBAND_CONTROL_STATUS 0X00200000 +#define IPW_BASEBAND_TX_FIFO_WRITE 0X00200004 +#define IPW_BASEBAND_RX_FIFO_READ 0X00200004 +#define IPW_BASEBAND_CONTROL_STORE 0X00200010 -#define CX2_INTERNAL_CMD_EVENT 0X00300004 -#define CX2_BASEBAND_POWER_DOWN 0x00000001 +#define IPW_INTERNAL_CMD_EVENT 0X00300004 +#define IPW_BASEBAND_POWER_DOWN 0x00000001 -#define CX2_MEM_HALT_AND_RESET 0x003000e0 +#define IPW_MEM_HALT_AND_RESET 0x003000e0 /* defgroup bits_halt_reset MEM_HALT_AND_RESET register bits */ -#define CX2_BIT_HALT_RESET_ON 0x80000000 -#define CX2_BIT_HALT_RESET_OFF 0x00000000 +#define IPW_BIT_HALT_RESET_ON 0x80000000 +#define IPW_BIT_HALT_RESET_OFF 0x00000000 #define CB_LAST_VALID 0x20000000 #define CB_INT_ENABLED 0x40000000 @@ -1281,63 +1433,63 @@ do { if (ipw_debug_level & (level)) \ #define DMA_CB_STOP_AND_ABORT 0x00000C00 #define DMA_CB_START 0x00000100 -#define CX2_SHARED_SRAM_SIZE 0x00030000 -#define CX2_SHARED_SRAM_DMA_CONTROL 0x00027000 +#define IPW_SHARED_SRAM_SIZE 0x00030000 +#define IPW_SHARED_SRAM_DMA_CONTROL 0x00027000 #define CB_MAX_LENGTH 0x1FFF -#define CX2_HOST_EEPROM_DATA_SRAM_SIZE 0xA18 -#define CX2_EEPROM_IMAGE_SIZE 0x100 +#define IPW_HOST_EEPROM_DATA_SRAM_SIZE 0xA18 +#define IPW_EEPROM_IMAGE_SIZE 0x100 /* DMA defs */ -#define CX2_DMA_I_CURRENT_CB 0x003000D0 -#define CX2_DMA_O_CURRENT_CB 0x003000D4 -#define CX2_DMA_I_DMA_CONTROL 0x003000A4 -#define CX2_DMA_I_CB_BASE 0x003000A0 - -#define CX2_TX_CMD_QUEUE_BD_BASE 0x00000200 -#define CX2_TX_CMD_QUEUE_BD_SIZE 0x00000204 -#define CX2_TX_QUEUE_0_BD_BASE 0x00000208 -#define CX2_TX_QUEUE_0_BD_SIZE (0x0000020C) -#define CX2_TX_QUEUE_1_BD_BASE 0x00000210 -#define CX2_TX_QUEUE_1_BD_SIZE 0x00000214 -#define CX2_TX_QUEUE_2_BD_BASE 0x00000218 -#define CX2_TX_QUEUE_2_BD_SIZE (0x0000021C) -#define CX2_TX_QUEUE_3_BD_BASE 0x00000220 -#define CX2_TX_QUEUE_3_BD_SIZE 0x00000224 -#define CX2_RX_BD_BASE 0x00000240 -#define CX2_RX_BD_SIZE 0x00000244 -#define CX2_RFDS_TABLE_LOWER 0x00000500 - -#define CX2_TX_CMD_QUEUE_READ_INDEX 0x00000280 -#define CX2_TX_QUEUE_0_READ_INDEX 0x00000284 -#define CX2_TX_QUEUE_1_READ_INDEX 0x00000288 -#define CX2_TX_QUEUE_2_READ_INDEX (0x0000028C) -#define CX2_TX_QUEUE_3_READ_INDEX 0x00000290 -#define CX2_RX_READ_INDEX (0x000002A0) - -#define CX2_TX_CMD_QUEUE_WRITE_INDEX (0x00000F80) -#define CX2_TX_QUEUE_0_WRITE_INDEX (0x00000F84) -#define CX2_TX_QUEUE_1_WRITE_INDEX (0x00000F88) -#define CX2_TX_QUEUE_2_WRITE_INDEX (0x00000F8C) -#define CX2_TX_QUEUE_3_WRITE_INDEX (0x00000F90) -#define CX2_RX_WRITE_INDEX (0x00000FA0) +#define IPW_DMA_I_CURRENT_CB 0x003000D0 +#define IPW_DMA_O_CURRENT_CB 0x003000D4 +#define IPW_DMA_I_DMA_CONTROL 0x003000A4 +#define IPW_DMA_I_CB_BASE 0x003000A0 + +#define IPW_TX_CMD_QUEUE_BD_BASE 0x00000200 +#define IPW_TX_CMD_QUEUE_BD_SIZE 0x00000204 +#define IPW_TX_QUEUE_0_BD_BASE 0x00000208 +#define IPW_TX_QUEUE_0_BD_SIZE (0x0000020C) +#define IPW_TX_QUEUE_1_BD_BASE 0x00000210 +#define IPW_TX_QUEUE_1_BD_SIZE 0x00000214 +#define IPW_TX_QUEUE_2_BD_BASE 0x00000218 +#define IPW_TX_QUEUE_2_BD_SIZE (0x0000021C) +#define IPW_TX_QUEUE_3_BD_BASE 0x00000220 +#define IPW_TX_QUEUE_3_BD_SIZE 0x00000224 +#define IPW_RX_BD_BASE 0x00000240 +#define IPW_RX_BD_SIZE 0x00000244 +#define IPW_RFDS_TABLE_LOWER 0x00000500 + +#define IPW_TX_CMD_QUEUE_READ_INDEX 0x00000280 +#define IPW_TX_QUEUE_0_READ_INDEX 0x00000284 +#define IPW_TX_QUEUE_1_READ_INDEX 0x00000288 +#define IPW_TX_QUEUE_2_READ_INDEX (0x0000028C) +#define IPW_TX_QUEUE_3_READ_INDEX 0x00000290 +#define IPW_RX_READ_INDEX (0x000002A0) + +#define IPW_TX_CMD_QUEUE_WRITE_INDEX (0x00000F80) +#define IPW_TX_QUEUE_0_WRITE_INDEX (0x00000F84) +#define IPW_TX_QUEUE_1_WRITE_INDEX (0x00000F88) +#define IPW_TX_QUEUE_2_WRITE_INDEX (0x00000F8C) +#define IPW_TX_QUEUE_3_WRITE_INDEX (0x00000F90) +#define IPW_RX_WRITE_INDEX (0x00000FA0) /* * EEPROM Related Definitions */ -#define IPW_EEPROM_DATA_SRAM_ADDRESS (CX2_SHARED_LOWER_BOUND + 0x814) -#define IPW_EEPROM_DATA_SRAM_SIZE (CX2_SHARED_LOWER_BOUND + 0x818) -#define IPW_EEPROM_LOAD_DISABLE (CX2_SHARED_LOWER_BOUND + 0x81C) -#define IPW_EEPROM_DATA (CX2_SHARED_LOWER_BOUND + 0x820) -#define IPW_EEPROM_UPPER_ADDRESS (CX2_SHARED_LOWER_BOUND + 0x9E0) +#define IPW_EEPROM_DATA_SRAM_ADDRESS (IPW_SHARED_LOWER_BOUND + 0x814) +#define IPW_EEPROM_DATA_SRAM_SIZE (IPW_SHARED_LOWER_BOUND + 0x818) +#define IPW_EEPROM_LOAD_DISABLE (IPW_SHARED_LOWER_BOUND + 0x81C) +#define IPW_EEPROM_DATA (IPW_SHARED_LOWER_BOUND + 0x820) +#define IPW_EEPROM_UPPER_ADDRESS (IPW_SHARED_LOWER_BOUND + 0x9E0) -#define IPW_STATION_TABLE_LOWER (CX2_SHARED_LOWER_BOUND + 0xA0C) -#define IPW_STATION_TABLE_UPPER (CX2_SHARED_LOWER_BOUND + 0xB0C) -#define IPW_REQUEST_ATIM (CX2_SHARED_LOWER_BOUND + 0xB0C) -#define IPW_ATIM_SENT (CX2_SHARED_LOWER_BOUND + 0xB10) -#define IPW_WHO_IS_AWAKE (CX2_SHARED_LOWER_BOUND + 0xB14) -#define IPW_DURING_ATIM_WINDOW (CX2_SHARED_LOWER_BOUND + 0xB18) +#define IPW_STATION_TABLE_LOWER (IPW_SHARED_LOWER_BOUND + 0xA0C) +#define IPW_STATION_TABLE_UPPER (IPW_SHARED_LOWER_BOUND + 0xB0C) +#define IPW_REQUEST_ATIM (IPW_SHARED_LOWER_BOUND + 0xB0C) +#define IPW_ATIM_SENT (IPW_SHARED_LOWER_BOUND + 0xB10) +#define IPW_WHO_IS_AWAKE (IPW_SHARED_LOWER_BOUND + 0xB14) +#define IPW_DURING_ATIM_WINDOW (IPW_SHARED_LOWER_BOUND + 0xB18) #define MSB 1 #define LSB 0 @@ -1367,7 +1519,7 @@ do { if (ipw_debug_level & (level)) \ #define FW_MEM_REG_LOWER_BOUND 0x00300000 #define FW_MEM_REG_EEPROM_ACCESS (FW_MEM_REG_LOWER_BOUND + 0x40) -#define CX2_EVENT_REG (FW_MEM_REG_LOWER_BOUND + 0x04) +#define IPW_EVENT_REG (FW_MEM_REG_LOWER_BOUND + 0x04) #define EEPROM_BIT_SK (1<<0) #define EEPROM_BIT_CS (1<<1) #define EEPROM_BIT_DI (1<<2) @@ -1376,50 +1528,47 @@ do { if (ipw_debug_level & (level)) \ #define EEPROM_CMD_READ 0x2 /* Interrupts masks */ -#define CX2_INTA_NONE 0x00000000 +#define IPW_INTA_NONE 0x00000000 -#define CX2_INTA_BIT_RX_TRANSFER 0x00000002 -#define CX2_INTA_BIT_STATUS_CHANGE 0x00000010 -#define CX2_INTA_BIT_BEACON_PERIOD_EXPIRED 0x00000020 +#define IPW_INTA_BIT_RX_TRANSFER 0x00000002 +#define IPW_INTA_BIT_STATUS_CHANGE 0x00000010 +#define IPW_INTA_BIT_BEACON_PERIOD_EXPIRED 0x00000020 //Inta Bits for CF -#define CX2_INTA_BIT_TX_CMD_QUEUE 0x00000800 -#define CX2_INTA_BIT_TX_QUEUE_1 0x00001000 -#define CX2_INTA_BIT_TX_QUEUE_2 0x00002000 -#define CX2_INTA_BIT_TX_QUEUE_3 0x00004000 -#define CX2_INTA_BIT_TX_QUEUE_4 0x00008000 +#define IPW_INTA_BIT_TX_CMD_QUEUE 0x00000800 +#define IPW_INTA_BIT_TX_QUEUE_1 0x00001000 +#define IPW_INTA_BIT_TX_QUEUE_2 0x00002000 +#define IPW_INTA_BIT_TX_QUEUE_3 0x00004000 +#define IPW_INTA_BIT_TX_QUEUE_4 0x00008000 -#define CX2_INTA_BIT_SLAVE_MODE_HOST_CMD_DONE 0x00010000 +#define IPW_INTA_BIT_SLAVE_MODE_HOST_CMD_DONE 0x00010000 -#define CX2_INTA_BIT_PREPARE_FOR_POWER_DOWN 0x00100000 -#define CX2_INTA_BIT_POWER_DOWN 0x00200000 +#define IPW_INTA_BIT_PREPARE_FOR_POWER_DOWN 0x00100000 +#define IPW_INTA_BIT_POWER_DOWN 0x00200000 -#define CX2_INTA_BIT_FW_INITIALIZATION_DONE 0x01000000 -#define CX2_INTA_BIT_FW_CARD_DISABLE_PHY_OFF_DONE 0x02000000 -#define CX2_INTA_BIT_RF_KILL_DONE 0x04000000 -#define CX2_INTA_BIT_FATAL_ERROR 0x40000000 -#define CX2_INTA_BIT_PARITY_ERROR 0x80000000 +#define IPW_INTA_BIT_FW_INITIALIZATION_DONE 0x01000000 +#define IPW_INTA_BIT_FW_CARD_DISABLE_PHY_OFF_DONE 0x02000000 +#define IPW_INTA_BIT_RF_KILL_DONE 0x04000000 +#define IPW_INTA_BIT_FATAL_ERROR 0x40000000 +#define IPW_INTA_BIT_PARITY_ERROR 0x80000000 /* Interrupts enabled at init time. */ -#define CX2_INTA_MASK_ALL \ - (CX2_INTA_BIT_TX_QUEUE_1 | \ - CX2_INTA_BIT_TX_QUEUE_2 | \ - CX2_INTA_BIT_TX_QUEUE_3 | \ - CX2_INTA_BIT_TX_QUEUE_4 | \ - CX2_INTA_BIT_TX_CMD_QUEUE | \ - CX2_INTA_BIT_RX_TRANSFER | \ - CX2_INTA_BIT_FATAL_ERROR | \ - CX2_INTA_BIT_PARITY_ERROR | \ - CX2_INTA_BIT_STATUS_CHANGE | \ - CX2_INTA_BIT_FW_INITIALIZATION_DONE | \ - CX2_INTA_BIT_BEACON_PERIOD_EXPIRED | \ - CX2_INTA_BIT_SLAVE_MODE_HOST_CMD_DONE | \ - CX2_INTA_BIT_PREPARE_FOR_POWER_DOWN | \ - CX2_INTA_BIT_POWER_DOWN | \ - CX2_INTA_BIT_RF_KILL_DONE ) - -#define IPWSTATUS_ERROR_LOG (CX2_SHARED_LOWER_BOUND + 0x410) -#define IPW_EVENT_LOG (CX2_SHARED_LOWER_BOUND + 0x414) +#define IPW_INTA_MASK_ALL \ + (IPW_INTA_BIT_TX_QUEUE_1 | \ + IPW_INTA_BIT_TX_QUEUE_2 | \ + IPW_INTA_BIT_TX_QUEUE_3 | \ + IPW_INTA_BIT_TX_QUEUE_4 | \ + IPW_INTA_BIT_TX_CMD_QUEUE | \ + IPW_INTA_BIT_RX_TRANSFER | \ + IPW_INTA_BIT_FATAL_ERROR | \ + IPW_INTA_BIT_PARITY_ERROR | \ + IPW_INTA_BIT_STATUS_CHANGE | \ + IPW_INTA_BIT_FW_INITIALIZATION_DONE | \ + IPW_INTA_BIT_BEACON_PERIOD_EXPIRED | \ + IPW_INTA_BIT_SLAVE_MODE_HOST_CMD_DONE | \ + IPW_INTA_BIT_PREPARE_FOR_POWER_DOWN | \ + IPW_INTA_BIT_POWER_DOWN | \ + IPW_INTA_BIT_RF_KILL_DONE ) /* FW event log definitions */ #define EVENT_ELEM_SIZE (3 * sizeof(u32)) @@ -1429,6 +1578,11 @@ do { if (ipw_debug_level & (level)) \ #define ERROR_ELEM_SIZE (7 * sizeof(u32)) #define ERROR_START_OFFSET (1 * sizeof(u32)) +/* TX power level (dbm) */ +#define IPW_TX_POWER_MIN -12 +#define IPW_TX_POWER_MAX 20 +#define IPW_TX_POWER_DEFAULT IPW_TX_POWER_MAX + enum { IPW_FW_ERROR_OK = 0, IPW_FW_ERROR_FAIL, @@ -1441,8 +1595,8 @@ enum { IPW_FW_ERROR_ALLOC_FAIL, IPW_FW_ERROR_DMA_UNDERRUN, IPW_FW_ERROR_DMA_STATUS, - IPW_FW_ERROR_DINOSTATUS_ERROR, - IPW_FW_ERROR_EEPROMSTATUS_ERROR, + IPW_FW_ERROR_DINO_ERROR, + IPW_FW_ERROR_EEPROM_ERROR, IPW_FW_ERROR_SYSASSERT, IPW_FW_ERROR_FATAL_ERROR }; @@ -1458,6 +1612,8 @@ enum { #define HC_IBSS_RECONF 4 #define HC_DISASSOC_QUIET 5 +#define HC_QOS_SUPPORT_ASSOC 0x01 + #define IPW_RATE_CAPABILITIES 1 #define IPW_RATE_CONNECT 0 @@ -1628,18 +1784,20 @@ enum { IPW_ORD_TABLE_7_LAST }; -#define IPW_ORDINALS_TABLE_LOWER (CX2_SHARED_LOWER_BOUND + 0x500) -#define IPW_ORDINALS_TABLE_0 (CX2_SHARED_LOWER_BOUND + 0x180) -#define IPW_ORDINALS_TABLE_1 (CX2_SHARED_LOWER_BOUND + 0x184) -#define IPW_ORDINALS_TABLE_2 (CX2_SHARED_LOWER_BOUND + 0x188) -#define IPW_MEM_FIXED_OVERRIDE (CX2_SHARED_LOWER_BOUND + 0x41C) +#define IPWSTATUS_ERROR_LOG (IPW_SHARED_LOWER_BOUND + 0x410) +#define IPW_EVENT_LOG (IPW_SHARED_LOWER_BOUND + 0x414) +#define IPW_ORDINALS_TABLE_LOWER (IPW_SHARED_LOWER_BOUND + 0x500) +#define IPW_ORDINALS_TABLE_0 (IPW_SHARED_LOWER_BOUND + 0x180) +#define IPW_ORDINALS_TABLE_1 (IPW_SHARED_LOWER_BOUND + 0x184) +#define IPW_ORDINALS_TABLE_2 (IPW_SHARED_LOWER_BOUND + 0x188) +#define IPW_MEM_FIXED_OVERRIDE (IPW_SHARED_LOWER_BOUND + 0x41C) struct ipw_fixed_rate { u16 tx_rates; u16 reserved; } __attribute__ ((packed)); -#define CX2_INDIRECT_ADDR_MASK (~0x3ul) +#define IPW_INDIRECT_ADDR_MASK (~0x3ul) struct host_cmd { u8 cmd; @@ -1676,15 +1834,6 @@ struct host_cmd { #define REG_CHANNEL_MASK 0x00003FFF #define IPW_IBSS_11B_DEFAULT_MASK 0x87ff -static const long ipw_frequencies[] = { - 2412, 2417, 2422, 2427, - 2432, 2437, 2442, 2447, - 2452, 2457, 2462, 2467, - 2472, 2484 -}; - -#define FREQ_COUNT ARRAY_SIZE(ipw_frequencies) - #define IPW_MAX_CONFIG_RETRIES 10 static inline u32 frame_hdr_len(struct ieee80211_hdr_4addr *hdr) -- cgit v1.2.2 From 823283549da144ff49e65c6e4a670b7784203e0b Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Wed, 24 Aug 2005 22:33:31 -0500 Subject: Catch ipw2100 up to equivelancy with v1.1.1 * Added WE-18 support. This allows the use of -Dext with wpa_supplicant > 0.4.x (thanks to Hong Liu) * Fixed #339 problem with iwconfig set/get txpower (thanks to Hong Liu) * Fixed #598 problem when with error messages when module loaded with 'disable=1' (thanks to Hong Liu) * Fixed #640 problem with 'iwlist retry' now showing min/max retry * Fixed compatibility with wpa_supplicant and the new -Dipw interface (that included a fix for 64-bit compatibility) * Added CFG_CRC_CHECK which allows passing through packets with bad CRCs while in monitor mode. Signed-off-by: James Ketrenos --- drivers/net/wireless/ipw2100.c | 577 +++++++++++++++++++++++++++++++---------- drivers/net/wireless/ipw2100.h | 11 +- 2 files changed, 451 insertions(+), 137 deletions(-) diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c index 449c1c085fb9..e7c222119da6 100644 --- a/drivers/net/wireless/ipw2100.c +++ b/drivers/net/wireless/ipw2100.c @@ -167,12 +167,12 @@ that only one external action is invoked at a time. #include "ipw2100.h" -#define IPW2100_VERSION "1.1.0" +#define IPW2100_VERSION "1.1.1" #define DRV_NAME "ipw2100" #define DRV_VERSION IPW2100_VERSION #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" -#define DRV_COPYRIGHT "Copyright(c) 2003-2004 Intel Corporation" +#define DRV_COPYRIGHT "Copyright(c) 2003-2005 Intel Corporation" /* Debugging stuff */ #ifdef CONFIG_IPW_DEBUG @@ -779,7 +779,7 @@ static int ipw2100_hw_send_command(struct ipw2100_priv *priv, if (err == 0) { IPW_DEBUG_INFO("Command completion failed out after %dms.\n", - HOST_COMPLETE_TIMEOUT / (HZ / 100)); + 1000 * (HOST_COMPLETE_TIMEOUT / HZ)); priv->fatal_error = IPW2100_ERR_MSG_TIMEOUT; priv->status &= ~STATUS_CMD_ACTIVE; schedule_reset(priv); @@ -1986,7 +1986,7 @@ static int ipw2100_set_essid(struct ipw2100_priv *priv, char *essid, IPW_DEBUG_HC("SSID: '%s'\n", escape_essid(essid, ssid_len)); if (ssid_len) - memcpy((char *)cmd.host_command_parameters, essid, ssid_len); + memcpy(cmd.host_command_parameters, essid, ssid_len); if (!batch_mode) { err = ipw2100_disable_adapter(priv); @@ -2369,13 +2369,15 @@ static inline void isr_rx(struct ipw2100_priv *priv, int i, IPW_DEBUG_DROP("Dropping packet while interface is not up.\n"); return; } - +#ifdef CONFIG_IPW2100_MONITOR if (unlikely(priv->ieee->iw_mode == IW_MODE_MONITOR && + priv->config & CFG_CRC_CHECK && status->flags & IPW_STATUS_FLAG_CRC_ERROR)) { IPW_DEBUG_RX("CRC error in packet. Dropping.\n"); priv->ieee->stats.rx_errors++; return; } +#endif if (unlikely(priv->ieee->iw_mode != IW_MODE_MONITOR && !(priv->status & STATUS_ASSOCIATED))) { @@ -2744,7 +2746,6 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv) priv->net_dev->name, txq->oldest, packet->index); /* DATA packet; we have to unmap and free the SKB */ - priv->ieee->stats.tx_packets++; for (i = 0; i < frag_num; i++) { tbd = &txq->drv[(packet->index + 1 + i) % txq->entries]; @@ -2757,8 +2758,6 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv) tbd->buf_length, PCI_DMA_TODEVICE); } - priv->ieee->stats.tx_bytes += - packet->info.d_struct.txb->payload_size; ieee80211_txb_free(packet->info.d_struct.txb); packet->info.d_struct.txb = NULL; @@ -2767,13 +2766,8 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv) /* We have a free slot in the Tx queue, so wake up the * transmit layer if it is stopped. */ - if (priv->status & STATUS_ASSOCIATED && - netif_queue_stopped(priv->net_dev)) { - IPW_DEBUG_INFO(KERN_INFO - "%s: Waking net queue.\n", - priv->net_dev->name); + if (priv->status & STATUS_ASSOCIATED) netif_wake_queue(priv->net_dev); - } /* A packet was processed by the hardware, so update the * watchdog */ @@ -3791,6 +3785,9 @@ static ssize_t show_ordinals(struct device *d, struct device_attribute *attr, u32 val_len; static int loop = 0; + if (priv->status & STATUS_RF_KILL_MASK) + return 0; + if (loop >= sizeof(ord_data) / sizeof(*ord_data)) loop = 0; @@ -3947,6 +3944,9 @@ static ssize_t show_bssinfo(struct device *d, struct device_attribute *attr, int length; int ret; + if (priv->status & STATUS_RF_KILL_MASK) + return 0; + memset(essid, 0, sizeof(essid)); memset(bssid, 0, sizeof(bssid)); @@ -3986,8 +3986,8 @@ static ssize_t show_debug_level(struct device_driver *d, char *buf) return sprintf(buf, "0x%08X\n", ipw2100_debug_level); } -static ssize_t store_debug_level(struct device_driver *d, const char *buf, - size_t count) +static ssize_t store_debug_level(struct device_driver *d, + const char *buf, size_t count) { char *p = (char *)buf; u32 val; @@ -4943,7 +4943,7 @@ static int ipw2100_set_mandatory_bssid(struct ipw2100_priv *priv, u8 * bssid, #endif /* if BSSID is empty then we disable mandatory bssid mode */ if (bssid != NULL) - memcpy((u8 *) cmd.host_command_parameters, bssid, ETH_ALEN); + memcpy(cmd.host_command_parameters, bssid, ETH_ALEN); if (!batch_mode) { err = ipw2100_disable_adapter(priv); @@ -4959,7 +4959,6 @@ static int ipw2100_set_mandatory_bssid(struct ipw2100_priv *priv, u8 * bssid, return err; } -#ifdef CONFIG_IEEE80211_WPA static int ipw2100_disassociate_bssid(struct ipw2100_priv *priv) { struct host_command cmd = { @@ -4983,34 +4982,6 @@ static int ipw2100_disassociate_bssid(struct ipw2100_priv *priv) return err; } -#endif - -/* - * Pseudo code for setting up wpa_frame: - */ -#if 0 -void x(struct ieee80211_assoc_frame *wpa_assoc) -{ - struct ipw2100_wpa_assoc_frame frame; - frame->fixed_ie_mask = IPW_WPA_CAPABILTIES | - IPW_WPA_LISTENINTERVAL | IPW_WPA_AP_ADDRESS; - frame->capab_info = wpa_assoc->capab_info; - frame->lisen_interval = wpa_assoc->listent_interval; - memcpy(frame->current_ap, wpa_assoc->current_ap, ETH_ALEN); - - /* UNKNOWN -- I'm not postivive about this part; don't have any WPA - * setup here to test it with. - * - * Walk the IEs in the wpa_assoc and figure out the total size of all - * that data. Stick that into frame->var_ie_len. Then memcpy() all of - * the IEs from wpa_frame into frame. - */ - frame->var_ie_len = calculate_ie_len(wpa_assoc); - memcpy(frame->var_ie, wpa_assoc->variable, frame->var_ie_len); - - ipw2100_set_wpa_ie(priv, &frame, 0); -} -#endif static int ipw2100_set_wpa_ie(struct ipw2100_priv *, struct ipw2100_wpa_assoc_frame *, int) @@ -5750,11 +5721,10 @@ static struct net_device_stats *ipw2100_stats(struct net_device *dev) return &priv->ieee->stats; } -/* Support for wpa_supplicant. Will be replaced with WEXT once - * they get WPA support. */ -#ifdef CONFIG_IEEE80211_WPA +#if WIRELESS_EXT < 18 +/* Support for wpa_supplicant before WE-18, deprecated. */ -/* following definitions must match definitions in driver_ipw2100.c */ +/* following definitions must match definitions in driver_ipw.c */ #define IPW2100_IOCTL_WPA_SUPPLICANT SIOCIWFIRSTPRIV+30 @@ -5792,11 +5762,12 @@ struct ipw2100_param { } wpa_param; struct { u32 len; - u8 *data; + u8 reserved[32]; + u8 data[0]; } wpa_ie; struct { - int command; - int reason_code; + u32 command; + u32 reason_code; } mlme; struct { u8 alg[IPW2100_CRYPT_ALG_NAME_LEN]; @@ -5811,37 +5782,21 @@ struct ipw2100_param { } u; }; -/* end of driver_ipw2100.c code */ +/* end of driver_ipw.c code */ +#endif /* WIRELESS_EXT < 18 */ static int ipw2100_wpa_enable(struct ipw2100_priv *priv, int value) { - - struct ieee80211_device *ieee = priv->ieee; - struct ieee80211_security sec = { - .flags = SEC_LEVEL | SEC_ENABLED, - }; - int ret = 0; - - ieee->wpa_enabled = value; - - if (value) { - sec.level = SEC_LEVEL_3; - sec.enabled = 1; - } else { - sec.level = SEC_LEVEL_0; - sec.enabled = 0; - } - - if (ieee->set_security) - ieee->set_security(ieee->dev, &sec); - else - ret = -EOPNOTSUPP; - - return ret; + /* This is called when wpa_supplicant loads and closes the driver + * interface. */ + priv->ieee->wpa_enabled = value; + return 0; } -#define AUTH_ALG_OPEN_SYSTEM 0x1 -#define AUTH_ALG_SHARED_KEY 0x2 +#if WIRELESS_EXT < 18 +#define IW_AUTH_ALG_OPEN_SYSTEM 0x1 +#define IW_AUTH_ALG_SHARED_KEY 0x2 +#endif static int ipw2100_wpa_set_auth_algs(struct ipw2100_priv *priv, int value) { @@ -5852,13 +5807,14 @@ static int ipw2100_wpa_set_auth_algs(struct ipw2100_priv *priv, int value) }; int ret = 0; - if (value & AUTH_ALG_SHARED_KEY) { + if (value & IW_AUTH_ALG_SHARED_KEY) { sec.auth_mode = WLAN_AUTH_SHARED_KEY; ieee->open_wep = 0; - } else { + } else if (value & IW_AUTH_ALG_OPEN_SYSTEM) { sec.auth_mode = WLAN_AUTH_OPEN; ieee->open_wep = 1; - } + } else + return -EINVAL; if (ieee->set_security) ieee->set_security(ieee->dev, &sec); @@ -5868,10 +5824,29 @@ static int ipw2100_wpa_set_auth_algs(struct ipw2100_priv *priv, int value) return ret; } -static int ipw2100_wpa_set_param(struct net_device *dev, u8 name, u32 value) +void ipw2100_wpa_assoc_frame(struct ipw2100_priv *priv, + char *wpa_ie, int wpa_ie_len) { + struct ipw2100_wpa_assoc_frame frame; + + frame.fixed_ie_mask = 0; + + /* copy WPA IE */ + memcpy(frame.var_ie, wpa_ie, wpa_ie_len); + frame.var_ie_len = wpa_ie_len; + + /* make sure WPA is enabled */ + ipw2100_wpa_enable(priv, 1); + ipw2100_set_wpa_ie(priv, &frame, 0); +} + +#if WIRELESS_EXT < 18 +static int ipw2100_wpa_set_param(struct net_device *dev, u8 name, u32 value) +{ struct ipw2100_priv *priv = ieee80211_priv(dev); + struct ieee80211_crypt_data *crypt; + unsigned long flags; int ret = 0; switch (name) { @@ -5880,7 +5855,22 @@ static int ipw2100_wpa_set_param(struct net_device *dev, u8 name, u32 value) break; case IPW2100_PARAM_TKIP_COUNTERMEASURES: - priv->ieee->tkip_countermeasures = value; + crypt = priv->ieee->crypt[priv->ieee->tx_keyidx]; + if (!crypt || !crypt->ops->set_flags || !crypt->ops->get_flags) { + IPW_DEBUG_WARNING("Can't set TKIP countermeasures: " + "crypt not set!\n"); + break; + } + + flags = crypt->ops->get_flags(crypt->priv); + + if (value) + flags |= IEEE80211_CRYPTO_TKIP_COUNTERMEASURES; + else + flags &= ~IEEE80211_CRYPTO_TKIP_COUNTERMEASURES; + + crypt->ops->set_flags(flags, crypt->priv); + break; case IPW2100_PARAM_DROP_UNENCRYPTED: @@ -5932,23 +5922,6 @@ static int ipw2100_wpa_mlme(struct net_device *dev, int command, int reason) return ret; } -void ipw2100_wpa_assoc_frame(struct ipw2100_priv *priv, - char *wpa_ie, int wpa_ie_len) -{ - - struct ipw2100_wpa_assoc_frame frame; - - frame.fixed_ie_mask = 0; - - /* copy WPA IE */ - memcpy(frame.var_ie, wpa_ie, wpa_ie_len); - frame.var_ie_len = wpa_ie_len; - - /* make sure WPA is enabled */ - ipw2100_wpa_enable(priv, 1); - ipw2100_set_wpa_ie(priv, &frame, 0); -} - static int ipw2100_wpa_set_wpa_ie(struct net_device *dev, struct ipw2100_param *param, int plen) { @@ -5992,7 +5965,6 @@ static int ipw2100_wpa_set_encryption(struct net_device *dev, struct ipw2100_param *param, int param_len) { - int ret = 0; struct ipw2100_priv *priv = ieee80211_priv(dev); struct ieee80211_device *ieee = priv->ieee; @@ -6101,8 +6073,8 @@ static int ipw2100_wpa_set_encryption(struct net_device *dev, if (ops->name != NULL) { if (strcmp(ops->name, "WEP") == 0) { - memcpy(sec.keys[param->u.crypt.idx], param->u.crypt.key, - param->u.crypt.key_len); + memcpy(sec.keys[param->u.crypt.idx], + param->u.crypt.key, param->u.crypt.key_len); sec.key_sizes[param->u.crypt.idx] = param->u.crypt.key_len; sec.flags |= (1 << param->u.crypt.idx); @@ -6190,11 +6162,9 @@ static int ipw2100_wpa_supplicant(struct net_device *dev, struct iw_point *p) kfree(param); return ret; } -#endif /* CONFIG_IEEE80211_WPA */ static int ipw2100_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { -#ifdef CONFIG_IEEE80211_WPA struct iwreq *wrq = (struct iwreq *)rq; int ret = -1; switch (cmd) { @@ -6206,10 +6176,9 @@ static int ipw2100_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) return -EOPNOTSUPP; } -#endif /* CONFIG_IEEE80211_WPA */ - return -EOPNOTSUPP; } +#endif /* WIRELESS_EXT < 18 */ static void ipw_ethtool_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) @@ -6333,10 +6302,15 @@ static struct net_device *ipw2100_alloc_device(struct pci_dev *pci_dev, priv->ieee->hard_start_xmit = ipw2100_tx; priv->ieee->set_security = shim__set_security; + priv->ieee->perfect_rssi = -20; + priv->ieee->worst_rssi = -85; + dev->open = ipw2100_open; dev->stop = ipw2100_close; dev->init = ipw2100_net_init; +#if WIRELESS_EXT < 18 dev->do_ioctl = ipw2100_ioctl; +#endif dev->get_stats = ipw2100_stats; dev->ethtool_ops = &ipw2100_ethtool_ops; dev->tx_timeout = ipw2100_tx_timeout; @@ -6362,13 +6336,13 @@ static struct net_device *ipw2100_alloc_device(struct pci_dev *pci_dev, /* If power management is turned on, default to AUTO mode */ priv->power_mode = IPW_POWER_AUTO; -#ifdef CONFIG_IEEE80211_WPA +#ifdef CONFIG_IPW2100_MONITOR + priv->config |= CFG_CRC_CHECK; +#endif priv->ieee->wpa_enabled = 0; - priv->ieee->tkip_countermeasures = 0; priv->ieee->drop_unencrypted = 0; priv->ieee->privacy_invoked = 0; priv->ieee->ieee802_1x = 1; -#endif /* CONFIG_IEEE80211_WPA */ /* Set module parameters */ switch (mode) { @@ -6429,7 +6403,7 @@ static struct net_device *ipw2100_alloc_device(struct pci_dev *pci_dev, INIT_LIST_HEAD(&priv->fw_pend_list); INIT_STAT(&priv->fw_pend_stat); -#ifdef CONFIG_SOFTWARE_SUSPEND2 +#ifdef PF_SYNCTHREAD priv->workqueue = create_workqueue(DRV_NAME, 0); #else priv->workqueue = create_workqueue(DRV_NAME); @@ -6591,7 +6565,6 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev, /* perform this after register_netdev so that dev->name is set */ sysfs_create_group(&pci_dev->dev.kobj, &ipw2100_attribute_group); - netif_carrier_off(dev); /* If the RF Kill switch is disabled, go ahead and complete the * startup sequence */ @@ -6860,10 +6833,6 @@ static int __init ipw2100_init(void) printk(KERN_INFO DRV_NAME ": %s, %s\n", DRV_DESCRIPTION, DRV_VERSION); printk(KERN_INFO DRV_NAME ": %s\n", DRV_COPYRIGHT); -#ifdef CONFIG_IEEE80211_NOWEP - IPW_DEBUG_INFO(DRV_NAME ": Compiled with WEP disabled.\n"); -#endif - ret = pci_module_init(&ipw2100_pci_driver); #ifdef CONFIG_IPW_DEBUG @@ -6963,9 +6932,10 @@ static int ipw2100_wx_set_freq(struct net_device *dev, } } - if (fwrq->e > 0 || fwrq->m > 1000) - return -EOPNOTSUPP; - else { /* Set the channel */ + if (fwrq->e > 0 || fwrq->m > 1000) { + err = -EOPNOTSUPP; + goto done; + } else { /* Set the channel */ IPW_DEBUG_WX("SET Freq/Channel -> %d \n", fwrq->m); err = ipw2100_set_channel(priv, fwrq->m, 0); } @@ -7256,7 +7226,7 @@ static int ipw2100_wx_get_wap(struct net_device *dev, * configured BSSID then return that; otherwise return ANY */ if (priv->config & CFG_STATIC_BSSID || priv->status & STATUS_ASSOCIATED) { wrqu->ap_addr.sa_family = ARPHRD_ETHER; - memcpy(wrqu->ap_addr.sa_data, &priv->bssid, ETH_ALEN); + memcpy(wrqu->ap_addr.sa_data, priv->bssid, ETH_ALEN); } else memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN); @@ -7711,13 +7681,13 @@ static int ipw2100_wx_get_retry(struct net_device *dev, return -EINVAL; if (wrqu->retry.flags & IW_RETRY_MAX) { - wrqu->retry.flags = IW_RETRY_LIMIT & IW_RETRY_MAX; + wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_MAX; wrqu->retry.value = priv->long_retry_limit; } else { wrqu->retry.flags = (priv->short_retry_limit != priv->long_retry_limit) ? - IW_RETRY_LIMIT & IW_RETRY_MIN : IW_RETRY_LIMIT; + IW_RETRY_LIMIT | IW_RETRY_MIN : IW_RETRY_LIMIT; wrqu->retry.value = priv->short_retry_limit; } @@ -7847,9 +7817,9 @@ static int ipw2100_wx_get_power(struct net_device *dev, struct ipw2100_priv *priv = ieee80211_priv(dev); - if (!(priv->power_mode & IPW_POWER_ENABLED)) { + if (!(priv->power_mode & IPW_POWER_ENABLED)) wrqu->power.disabled = 1; - } else { + else { wrqu->power.disabled = 0; wrqu->power.flags = 0; } @@ -7859,6 +7829,273 @@ static int ipw2100_wx_get_power(struct net_device *dev, return 0; } +#if WIRELESS_EXT > 17 +/* + * WE-18 WPA support + */ + +/* SIOCSIWGENIE */ +static int ipw2100_wx_set_genie(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + + struct ipw2100_priv *priv = ieee80211_priv(dev); + struct ieee80211_device *ieee = priv->ieee; + u8 *buf; + + if (!ieee->wpa_enabled) + return -EOPNOTSUPP; + + if (wrqu->data.length > MAX_WPA_IE_LEN || + (wrqu->data.length && extra == NULL)) + return -EINVAL; + + if (wrqu->data.length) { + buf = kmalloc(wrqu->data.length, GFP_KERNEL); + if (buf == NULL) + return -ENOMEM; + + memcpy(buf, extra, wrqu->data.length); + kfree(ieee->wpa_ie); + ieee->wpa_ie = buf; + ieee->wpa_ie_len = wrqu->data.length; + } else { + kfree(ieee->wpa_ie); + ieee->wpa_ie = NULL; + ieee->wpa_ie_len = 0; + } + + ipw2100_wpa_assoc_frame(priv, ieee->wpa_ie, ieee->wpa_ie_len); + + return 0; +} + +/* SIOCGIWGENIE */ +static int ipw2100_wx_get_genie(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct ipw2100_priv *priv = ieee80211_priv(dev); + struct ieee80211_device *ieee = priv->ieee; + + if (ieee->wpa_ie_len == 0 || ieee->wpa_ie == NULL) { + wrqu->data.length = 0; + return 0; + } + + if (wrqu->data.length < ieee->wpa_ie_len) + return -E2BIG; + + wrqu->data.length = ieee->wpa_ie_len; + memcpy(extra, ieee->wpa_ie, ieee->wpa_ie_len); + + return 0; +} + +/* SIOCSIWAUTH */ +static int ipw2100_wx_set_auth(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct ipw2100_priv *priv = ieee80211_priv(dev); + struct ieee80211_device *ieee = priv->ieee; + struct iw_param *param = &wrqu->param; + struct ieee80211_crypt_data *crypt; + unsigned long flags; + int ret = 0; + + switch (param->flags & IW_AUTH_INDEX) { + case IW_AUTH_WPA_VERSION: + case IW_AUTH_CIPHER_PAIRWISE: + case IW_AUTH_CIPHER_GROUP: + case IW_AUTH_KEY_MGMT: + /* + * ipw2200 does not use these parameters + */ + break; + + case IW_AUTH_TKIP_COUNTERMEASURES: + crypt = priv->ieee->crypt[priv->ieee->tx_keyidx]; + if (!crypt || !crypt->ops->set_flags || !crypt->ops->get_flags) { + IPW_DEBUG_WARNING("Can't set TKIP countermeasures: " + "crypt not set!\n"); + break; + } + + flags = crypt->ops->get_flags(crypt->priv); + + if (param->value) + flags |= IEEE80211_CRYPTO_TKIP_COUNTERMEASURES; + else + flags &= ~IEEE80211_CRYPTO_TKIP_COUNTERMEASURES; + + crypt->ops->set_flags(flags, crypt->priv); + + break; + + case IW_AUTH_DROP_UNENCRYPTED:{ + /* HACK: + * + * wpa_supplicant calls set_wpa_enabled when the driver + * is loaded and unloaded, regardless of if WPA is being + * used. No other calls are made which can be used to + * determine if encryption will be used or not prior to + * association being expected. If encryption is not being + * used, drop_unencrypted is set to false, else true -- we + * can use this to determine if the CAP_PRIVACY_ON bit should + * be set. + */ + struct ieee80211_security sec = { + .flags = SEC_ENABLED, + .enabled = param->value, + }; + priv->ieee->drop_unencrypted = param->value; + /* We only change SEC_LEVEL for open mode. Others + * are set by ipw_wpa_set_encryption. + */ + if (!param->value) { + sec.flags |= SEC_LEVEL; + sec.level = SEC_LEVEL_0; + } else { + sec.flags |= SEC_LEVEL; + sec.level = SEC_LEVEL_1; + } + if (priv->ieee->set_security) + priv->ieee->set_security(priv->ieee->dev, &sec); + break; + } + + case IW_AUTH_80211_AUTH_ALG: + ret = ipw2100_wpa_set_auth_algs(priv, param->value); + break; + + case IW_AUTH_WPA_ENABLED: + ret = ipw2100_wpa_enable(priv, param->value); + break; + + case IW_AUTH_RX_UNENCRYPTED_EAPOL: + ieee->ieee802_1x = param->value; + break; + + //case IW_AUTH_ROAMING_CONTROL: + case IW_AUTH_PRIVACY_INVOKED: + ieee->privacy_invoked = param->value; + break; + + default: + return -EOPNOTSUPP; + } + return ret; +} + +/* SIOCGIWAUTH */ +static int ipw2100_wx_get_auth(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct ipw2100_priv *priv = ieee80211_priv(dev); + struct ieee80211_device *ieee = priv->ieee; + struct ieee80211_crypt_data *crypt; + struct iw_param *param = &wrqu->param; + int ret = 0; + + switch (param->flags & IW_AUTH_INDEX) { + case IW_AUTH_WPA_VERSION: + case IW_AUTH_CIPHER_PAIRWISE: + case IW_AUTH_CIPHER_GROUP: + case IW_AUTH_KEY_MGMT: + /* + * wpa_supplicant will control these internally + */ + ret = -EOPNOTSUPP; + break; + + case IW_AUTH_TKIP_COUNTERMEASURES: + crypt = priv->ieee->crypt[priv->ieee->tx_keyidx]; + if (!crypt || !crypt->ops->get_flags) { + IPW_DEBUG_WARNING("Can't get TKIP countermeasures: " + "crypt not set!\n"); + break; + } + + param->value = (crypt->ops->get_flags(crypt->priv) & + IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) ? 1 : 0; + + break; + + case IW_AUTH_DROP_UNENCRYPTED: + param->value = ieee->drop_unencrypted; + break; + + case IW_AUTH_80211_AUTH_ALG: + param->value = priv->sec.auth_mode; + break; + + case IW_AUTH_WPA_ENABLED: + param->value = ieee->wpa_enabled; + break; + + case IW_AUTH_RX_UNENCRYPTED_EAPOL: + param->value = ieee->ieee802_1x; + break; + + case IW_AUTH_ROAMING_CONTROL: + case IW_AUTH_PRIVACY_INVOKED: + param->value = ieee->privacy_invoked; + break; + + default: + return -EOPNOTSUPP; + } + return 0; +} + +/* SIOCSIWENCODEEXT */ +static int ipw2100_wx_set_encodeext(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct ipw2100_priv *priv = ieee80211_priv(dev); + return ieee80211_wx_set_encodeext(priv->ieee, info, wrqu, extra); +} + +/* SIOCGIWENCODEEXT */ +static int ipw2100_wx_get_encodeext(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct ipw2100_priv *priv = ieee80211_priv(dev); + return ieee80211_wx_get_encodeext(priv->ieee, info, wrqu, extra); +} + +/* SIOCSIWMLME */ +static int ipw2100_wx_set_mlme(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct ipw2100_priv *priv = ieee80211_priv(dev); + struct iw_mlme *mlme = (struct iw_mlme *)extra; + u16 reason; + + reason = cpu_to_le16(mlme->reason_code); + + switch (mlme->cmd) { + case IW_MLME_DEAUTH: + // silently ignore + break; + + case IW_MLME_DISASSOC: + ipw2100_disassociate_bssid(priv); + break; + + default: + return -EOPNOTSUPP; + } + return 0; +} +#endif /* WIRELESS_EXT > 17 */ + /* * * IWPRIV handlers @@ -8019,6 +8256,54 @@ static int ipw2100_wx_get_preamble(struct net_device *dev, return 0; } +#ifdef CONFIG_IPW2100_MONITOR +static int ipw2100_wx_set_crc_check(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct ipw2100_priv *priv = ieee80211_priv(dev); + int err, mode = *(int *)extra; + + down(&priv->action_sem); + if (!(priv->status & STATUS_INITIALIZED)) { + err = -EIO; + goto done; + } + + if (mode == 1) + priv->config |= CFG_CRC_CHECK; + else if (mode == 0) + priv->config &= ~CFG_CRC_CHECK; + else { + err = -EINVAL; + goto done; + } + err = 0; + + done: + up(&priv->action_sem); + return err; +} + +static int ipw2100_wx_get_crc_check(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + /* + * This can be called at any time. No action lock required + */ + + struct ipw2100_priv *priv = ieee80211_priv(dev); + + if (priv->config & CFG_CRC_CHECK) + snprintf(wrqu->name, IFNAMSIZ, "CRC checked (1)"); + else + snprintf(wrqu->name, IFNAMSIZ, "CRC ignored (0)"); + + return 0; +} +#endif /* CONFIG_IPW2100_MONITOR */ + static iw_handler ipw2100_wx_handlers[] = { NULL, /* SIOCSIWCOMMIT */ ipw2100_wx_get_name, /* SIOCGIWNAME */ @@ -8042,7 +8327,11 @@ static iw_handler ipw2100_wx_handlers[] = { NULL, /* SIOCWIWTHRSPY */ ipw2100_wx_set_wap, /* SIOCSIWAP */ ipw2100_wx_get_wap, /* SIOCGIWAP */ +#if WIRELESS_EXT > 17 + ipw2100_wx_set_mlme, /* SIOCSIWMLME */ +#else NULL, /* -- hole -- */ +#endif NULL, /* SIOCGIWAPLIST -- deprecated */ ipw2100_wx_set_scan, /* SIOCSIWSCAN */ ipw2100_wx_get_scan, /* SIOCGIWSCAN */ @@ -8066,6 +8355,17 @@ static iw_handler ipw2100_wx_handlers[] = { ipw2100_wx_get_encode, /* SIOCGIWENCODE */ ipw2100_wx_set_power, /* SIOCSIWPOWER */ ipw2100_wx_get_power, /* SIOCGIWPOWER */ +#if WIRELESS_EXT > 17 + NULL, /* -- hole -- */ + NULL, /* -- hole -- */ + ipw2100_wx_set_genie, /* SIOCSIWGENIE */ + ipw2100_wx_get_genie, /* SIOCGIWGENIE */ + ipw2100_wx_set_auth, /* SIOCSIWAUTH */ + ipw2100_wx_get_auth, /* SIOCGIWAUTH */ + ipw2100_wx_set_encodeext, /* SIOCSIWENCODEEXT */ + ipw2100_wx_get_encodeext, /* SIOCGIWENCODEEXT */ + NULL, /* SIOCSIWPMKSA */ +#endif }; #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV @@ -8074,6 +8374,8 @@ static iw_handler ipw2100_wx_handlers[] = { #define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 #define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 #define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 +#define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 +#define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 static const struct iw_priv_args ipw2100_private_args[] = { @@ -8099,6 +8401,14 @@ static const struct iw_priv_args ipw2100_private_args[] = { { IPW2100_PRIV_GET_LONGPREAMBLE, 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | IFNAMSIZ, "get_preamble"}, +#ifdef CONFIG_IPW2100_MONITOR + { + IPW2100_PRIV_SET_CRC_CHECK, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_crc_check"}, + { + IPW2100_PRIV_GET_CRC_CHECK, + 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | IFNAMSIZ, "get_crc_check"}, +#endif /* CONFIG_IPW2100_MONITOR */ }; static iw_handler ipw2100_private_handler[] = { @@ -8113,6 +8423,13 @@ static iw_handler ipw2100_private_handler[] = { ipw2100_wx_get_powermode, ipw2100_wx_set_preamble, ipw2100_wx_get_preamble, +#ifdef CONFIG_IPW2100_MONITOR + ipw2100_wx_set_crc_check, + ipw2100_wx_get_crc_check, +#else /* CONFIG_IPW2100_MONITOR */ + NULL, + NULL, +#endif /* CONFIG_IPW2100_MONITOR */ }; static struct iw_handler_def ipw2100_wx_handler_def = { @@ -8292,17 +8609,11 @@ static void ipw2100_wx_event_work(struct ipw2100_priv *priv) /* We now have the BSSID, so can finish setting to the full * associated state */ memcpy(wrqu.ap_addr.sa_data, priv->bssid, ETH_ALEN); - memcpy(&priv->ieee->bssid, priv->bssid, ETH_ALEN); + memcpy(priv->ieee->bssid, priv->bssid, ETH_ALEN); priv->status &= ~STATUS_ASSOCIATING; priv->status |= STATUS_ASSOCIATED; netif_carrier_on(priv->net_dev); - if (netif_queue_stopped(priv->net_dev)) { - IPW_DEBUG_INFO("Waking net queue.\n"); - netif_wake_queue(priv->net_dev); - } else { - IPW_DEBUG_INFO("Starting net queue.\n"); - netif_start_queue(priv->net_dev); - } + netif_wake_queue(priv->net_dev); } if (!(priv->status & STATUS_ASSOCIATED)) { diff --git a/drivers/net/wireless/ipw2100.h b/drivers/net/wireless/ipw2100.h index 3eb5c384eaab..99fce99b701a 100644 --- a/drivers/net/wireless/ipw2100.h +++ b/drivers/net/wireless/ipw2100.h @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright(c) 2003 - 2005 Intel Corporation. All rights reserved. + Copyright(c) 2003 - 2004 Intel Corporation. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as @@ -475,6 +475,9 @@ enum { #define CFG_ADHOC_CREATE (1<<8) #define CFG_C3_DISABLED (1<<9) #define CFG_PASSIVE_SCAN (1<<10) +#ifdef CONFIG_IPW2100_MONITOR +#define CFG_CRC_CHECK (1<<11) +#endif #define CAP_SHARED_KEY (1<<0) /* Off = OPEN */ #define CAP_PRIVACY_ON (1<<1) /* Off = No privacy */ @@ -858,9 +861,9 @@ struct ipw2100_rx { #define TYPE_ASSOCIATION_REQUEST 0x0013 #define TYPE_REASSOCIATION_REQUEST 0x0014 -#define HW_FEATURE_RFKILL (0x0001) -#define RF_KILLSWITCH_OFF (1) -#define RF_KILLSWITCH_ON (0) +#define HW_FEATURE_RFKILL 0x0001 +#define RF_KILLSWITCH_OFF 1 +#define RF_KILLSWITCH_ON 0 #define IPW_COMMAND_POOL_SIZE 40 -- cgit v1.2.2 From 25b645be1e25e16ea7a25678ac195a0e7595c629 Mon Sep 17 00:00:00 2001 From: Date: Tue, 12 Jul 2005 15:45:30 -0500 Subject: Fixed WEP on ipw2100 (priv->sec was being used instead of priv->ieee->sec) --- drivers/net/wireless/ipw2100.c | 97 ++++++++++++++++++++++-------------------- drivers/net/wireless/ipw2100.h | 2 - 2 files changed, 51 insertions(+), 48 deletions(-) diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c index e7c222119da6..cf5da20d1d45 100644 --- a/drivers/net/wireless/ipw2100.c +++ b/drivers/net/wireless/ipw2100.c @@ -1616,7 +1616,7 @@ static int ipw2100_set_scan_options(struct ipw2100_priv *priv) if (!(priv->config & CFG_ASSOCIATE)) cmd.host_command_parameters[0] |= IPW_SCAN_NOASSOCIATE; - if ((priv->sec.flags & SEC_ENABLED) && priv->sec.enabled) + if ((priv->ieee->sec.flags & SEC_ENABLED) && priv->ieee->sec.enabled) cmd.host_command_parameters[0] |= IPW_SCAN_MIXED_CELL; if (priv->config & CFG_PASSIVE_SCAN) cmd.host_command_parameters[0] |= IPW_SCAN_PASSIVE; @@ -5349,23 +5349,23 @@ static int ipw2100_configure_security(struct ipw2100_priv *priv, int batch_mode) return err; } - if (!priv->sec.enabled) { + if (!priv->ieee->sec.enabled) { err = ipw2100_set_security_information(priv, IPW_AUTH_OPEN, SEC_LEVEL_0, 0, 1); } else { auth_mode = IPW_AUTH_OPEN; - if ((priv->sec.flags & SEC_AUTH_MODE) && - (priv->sec.auth_mode == WLAN_AUTH_SHARED_KEY)) + if ((priv->ieee->sec.flags & SEC_AUTH_MODE) && + (priv->ieee->sec.auth_mode == WLAN_AUTH_SHARED_KEY)) auth_mode = IPW_AUTH_SHARED; sec_level = SEC_LEVEL_0; - if (priv->sec.flags & SEC_LEVEL) - sec_level = priv->sec.level; + if (priv->ieee->sec.flags & SEC_LEVEL) + sec_level = priv->ieee->sec.level; use_group = 0; - if (priv->sec.flags & SEC_UNICAST_GROUP) - use_group = priv->sec.unicast_uses_group; + if (priv->ieee->sec.flags & SEC_UNICAST_GROUP) + use_group = priv->ieee->sec.unicast_uses_group; err = ipw2100_set_security_information(priv, auth_mode, sec_level, @@ -5375,16 +5375,16 @@ static int ipw2100_configure_security(struct ipw2100_priv *priv, int batch_mode) if (err) goto exit; - if (priv->sec.enabled) { + if (priv->ieee->sec.enabled) { for (i = 0; i < 4; i++) { - if (!(priv->sec.flags & (1 << i))) { - memset(priv->sec.keys[i], 0, WEP_KEY_LEN); - priv->sec.key_sizes[i] = 0; + if (!(priv->ieee->sec.flags & (1 << i))) { + memset(priv->ieee->sec.keys[i], 0, WEP_KEY_LEN); + priv->ieee->sec.key_sizes[i] = 0; } else { err = ipw2100_set_key(priv, i, - priv->sec.keys[i], - priv->sec.key_sizes[i], - 1); + priv->ieee->sec.keys[i], + priv->ieee->sec. + key_sizes[i], 1); if (err) goto exit; } @@ -5397,8 +5397,8 @@ static int ipw2100_configure_security(struct ipw2100_priv *priv, int batch_mode) * encrypted data is sent up */ err = ipw2100_set_wep_flags(priv, - priv->sec.enabled ? IPW_PRIVACY_CAPABLE : 0, - 1); + priv->ieee->sec. + enabled ? IPW_PRIVACY_CAPABLE : 0, 1); if (err) goto exit; @@ -5433,58 +5433,61 @@ static void shim__set_security(struct net_device *dev, for (i = 0; i < 4; i++) { if (sec->flags & (1 << i)) { - priv->sec.key_sizes[i] = sec->key_sizes[i]; + priv->ieee->sec.key_sizes[i] = sec->key_sizes[i]; if (sec->key_sizes[i] == 0) - priv->sec.flags &= ~(1 << i); + priv->ieee->sec.flags &= ~(1 << i); else - memcpy(priv->sec.keys[i], sec->keys[i], + memcpy(priv->ieee->sec.keys[i], sec->keys[i], sec->key_sizes[i]); - priv->sec.flags |= (1 << i); + priv->ieee->sec.flags |= (1 << i); priv->status |= STATUS_SECURITY_UPDATED; } } if ((sec->flags & SEC_ACTIVE_KEY) && - priv->sec.active_key != sec->active_key) { + priv->ieee->sec.active_key != sec->active_key) { if (sec->active_key <= 3) { - priv->sec.active_key = sec->active_key; - priv->sec.flags |= SEC_ACTIVE_KEY; + priv->ieee->sec.active_key = sec->active_key; + priv->ieee->sec.flags |= SEC_ACTIVE_KEY; } else - priv->sec.flags &= ~SEC_ACTIVE_KEY; + priv->ieee->sec.flags &= ~SEC_ACTIVE_KEY; priv->status |= STATUS_SECURITY_UPDATED; } if ((sec->flags & SEC_AUTH_MODE) && - (priv->sec.auth_mode != sec->auth_mode)) { - priv->sec.auth_mode = sec->auth_mode; - priv->sec.flags |= SEC_AUTH_MODE; + (priv->ieee->sec.auth_mode != sec->auth_mode)) { + priv->ieee->sec.auth_mode = sec->auth_mode; + priv->ieee->sec.flags |= SEC_AUTH_MODE; priv->status |= STATUS_SECURITY_UPDATED; } - if (sec->flags & SEC_ENABLED && priv->sec.enabled != sec->enabled) { - priv->sec.flags |= SEC_ENABLED; - priv->sec.enabled = sec->enabled; + if (sec->flags & SEC_ENABLED && priv->ieee->sec.enabled != sec->enabled) { + priv->ieee->sec.flags |= SEC_ENABLED; + priv->ieee->sec.enabled = sec->enabled; priv->status |= STATUS_SECURITY_UPDATED; force_update = 1; } - if (sec->flags & SEC_LEVEL && priv->sec.level != sec->level) { - priv->sec.level = sec->level; - priv->sec.flags |= SEC_LEVEL; + if (sec->flags & SEC_ENCRYPT) + priv->ieee->sec.encrypt = sec->encrypt; + + if (sec->flags & SEC_LEVEL && priv->ieee->sec.level != sec->level) { + priv->ieee->sec.level = sec->level; + priv->ieee->sec.flags |= SEC_LEVEL; priv->status |= STATUS_SECURITY_UPDATED; } IPW_DEBUG_WEP("Security flags: %c %c%c%c%c %c%c%c%c\n", - priv->sec.flags & (1 << 8) ? '1' : '0', - priv->sec.flags & (1 << 7) ? '1' : '0', - priv->sec.flags & (1 << 6) ? '1' : '0', - priv->sec.flags & (1 << 5) ? '1' : '0', - priv->sec.flags & (1 << 4) ? '1' : '0', - priv->sec.flags & (1 << 3) ? '1' : '0', - priv->sec.flags & (1 << 2) ? '1' : '0', - priv->sec.flags & (1 << 1) ? '1' : '0', - priv->sec.flags & (1 << 0) ? '1' : '0'); + priv->ieee->sec.flags & (1 << 8) ? '1' : '0', + priv->ieee->sec.flags & (1 << 7) ? '1' : '0', + priv->ieee->sec.flags & (1 << 6) ? '1' : '0', + priv->ieee->sec.flags & (1 << 5) ? '1' : '0', + priv->ieee->sec.flags & (1 << 4) ? '1' : '0', + priv->ieee->sec.flags & (1 << 3) ? '1' : '0', + priv->ieee->sec.flags & (1 << 2) ? '1' : '0', + priv->ieee->sec.flags & (1 << 1) ? '1' : '0', + priv->ieee->sec.flags & (1 << 0) ? '1' : '0'); /* As a temporary work around to enable WPA until we figure out why * wpa_supplicant toggles the security capability of the driver, which @@ -5995,17 +5998,19 @@ static int ipw2100_wpa_set_encryption(struct net_device *dev, return -EINVAL; } + sec.flags |= SEC_ENABLED | SEC_ENCRYPT; if (strcmp(param->u.crypt.alg, "none") == 0) { if (crypt) { sec.enabled = 0; + sec.encrypt = 0; sec.level = SEC_LEVEL_0; - sec.flags |= SEC_ENABLED | SEC_LEVEL; + sec.flags |= SEC_LEVEL; ieee80211_crypt_delayed_deinit(ieee, crypt); } goto done; } sec.enabled = 1; - sec.flags |= SEC_ENABLED; + sec.encrypt = 1; ops = ieee80211_get_crypto_ops(param->u.crypt.alg); if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) { @@ -8029,7 +8034,7 @@ static int ipw2100_wx_get_auth(struct net_device *dev, break; case IW_AUTH_80211_AUTH_ALG: - param->value = priv->sec.auth_mode; + param->value = priv->ieee->sec.auth_mode; break; case IW_AUTH_WPA_ENABLED: diff --git a/drivers/net/wireless/ipw2100.h b/drivers/net/wireless/ipw2100.h index 99fce99b701a..a1a9cbcf6c2f 100644 --- a/drivers/net/wireless/ipw2100.h +++ b/drivers/net/wireless/ipw2100.h @@ -524,8 +524,6 @@ struct ipw2100_priv { int power_mode; - /* WEP data */ - struct ieee80211_security sec; int messages_sent; int short_retry_limit; -- cgit v1.2.2 From f75459e6f64ca0632f23029e2ca47b424dd33373 Mon Sep 17 00:00:00 2001 From: Liu Hong Date: Wed, 13 Jul 2005 12:29:21 -0500 Subject: [Bug 339] Fix ipw2100 iwconfig set/get txpower. Signed-off-by: James Ketrenos --- drivers/net/wireless/ipw2100.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c index cf5da20d1d45..73287ab7bff1 100644 --- a/drivers/net/wireless/ipw2100.c +++ b/drivers/net/wireless/ipw2100.c @@ -5102,6 +5102,10 @@ static int ipw2100_set_tx_power(struct ipw2100_priv *priv, u32 tx_power) }; int err = 0; + if (tx_power != IPW_TX_POWER_DEFAULT) + tx_power = (tx_power - IPW_TX_POWER_MIN_DBM) * 16 / + (IPW_TX_POWER_MAX_DBM - IPW_TX_POWER_MIN_DBM); + cmd.host_command_parameters[0] = tx_power; if (priv->ieee->iw_mode == IW_MODE_ADHOC) @@ -7523,8 +7527,7 @@ static int ipw2100_wx_set_txpow(struct net_device *dev, wrqu->txpower.value > IPW_TX_POWER_MAX_DBM) return -EINVAL; - value = (wrqu->txpower.value - IPW_TX_POWER_MIN_DBM) * 16 / - (IPW_TX_POWER_MAX_DBM - IPW_TX_POWER_MIN_DBM); + value = wrqu->txpower.value; } down(&priv->action_sem); @@ -7564,11 +7567,7 @@ static int ipw2100_wx_get_txpow(struct net_device *dev, } else { wrqu->power.disabled = 0; wrqu->power.fixed = 1; - wrqu->power.value = - (priv->tx_power * - (IPW_TX_POWER_MAX_DBM - IPW_TX_POWER_MIN_DBM)) / - (IPW_TX_POWER_MAX - IPW_TX_POWER_MIN) + - IPW_TX_POWER_MIN_DBM; + wrqu->power.value = priv->tx_power; } wrqu->power.flags = IW_TXPOW_DBM; -- cgit v1.2.2 From e4cc28998724661c19cd979a78eaf9a424da52ef Mon Sep 17 00:00:00 2001 From: Zhu Yi Date: Wed, 13 Jul 2005 12:30:34 -0500 Subject: Move code from ipw2100_wpa_enable to IPW2100_PARAM_DROP_UNENCRYPTED to support wpa_supplicant with open AP. We need this to make driver_ipw work. driver_ext has already had the similar code with the WE-18 support added. Signed-off-by: James Ketrenos --- drivers/net/wireless/ipw2100.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c index 73287ab7bff1..eaf47078ee56 100644 --- a/drivers/net/wireless/ipw2100.c +++ b/drivers/net/wireless/ipw2100.c @@ -5880,9 +5880,27 @@ static int ipw2100_wpa_set_param(struct net_device *dev, u8 name, u32 value) break; - case IPW2100_PARAM_DROP_UNENCRYPTED: - priv->ieee->drop_unencrypted = value; - break; + case IPW2100_PARAM_DROP_UNENCRYPTED:{ + /* See IW_AUTH_DROP_UNENCRYPTED handling for details */ + struct ieee80211_security sec = { + .flags = SEC_ENABLED, + .enabled = value, + }; + priv->ieee->drop_unencrypted = value; + /* We only change SEC_LEVEL for open mode. Others + * are set by ipw_wpa_set_encryption. + */ + if (!value) { + sec.flags |= SEC_LEVEL; + sec.level = SEC_LEVEL_0; + } else { + sec.flags |= SEC_LEVEL; + sec.level = SEC_LEVEL_1; + } + if (priv->ieee->set_security) + priv->ieee->set_security(priv->ieee->dev, &sec); + break; + } case IPW2100_PARAM_PRIVACY_INVOKED: priv->ieee->privacy_invoked = value; -- cgit v1.2.2 From afbf30a2b78cac38e6ddae10a73063943b4783ee Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Thu, 25 Aug 2005 00:05:33 -0500 Subject: Catch ipw2200 up to equivelancy with v1.0.5 * Fixed #452 problem with setting retry limit (thanks to Hong Liu) * Fixed #592 race condition during association causing firmware errors * Fixed #602 problem with building in 64-bit environment * Fixed #625 problem with SCAN_REQUEST_EXT sometimes failing * Fixed #645 problem with bit rate not decreasing when moving laptop farther from AP * Fixed #656 problem with 'iwconfig eth1 mode auto' and 'modprobe' locking the system * Fixed #667 problem with "No space for Tx" for hwcrypto=1 * Fixed #685 kernel panic in rmmod caused by led work is still queued * Fixed #695 problem with network doesn't reassociate after suspend/resume * Fixed #701 problem with 'iwprvi sw_reset' not resetting the card from monitor mode * Fixed #710 problem with monitor mode being used after a WEP key has been configured * Fixed network->mode vs. priv->ieee->iw_mode checking (thanks to Ben Cahill) * Fixed "Unknown management packet %d" warning * Fixed setting channels multiple times in monitor mode causes scan stopped * Fixed ipw_wx_sw_reset doesn't switch firmware if mode is changed. * Add duplicate packet checking code (kill ping DUP! and TKIP replay warning) * Fix hardware encryption (both WEP and AES) doesn't work with fragmentation. Signed-off-by: James Ketrenos --- drivers/net/wireless/ipw2200.c | 1544 ++++++++++++++++++++++++++++------------ drivers/net/wireless/ipw2200.h | 26 +- 2 files changed, 1123 insertions(+), 447 deletions(-) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 0a583afbcddf..1b6f0277a3e9 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright(c) 2003 - 2004 Intel Corporation. All rights reserved. + Copyright(c) 2003 - 2005 Intel Corporation. All rights reserved. 802.11 status code portion of this file from ethereal-0.10.6: Copyright 2000, Axis Communications AB @@ -32,7 +32,7 @@ #include "ipw2200.h" -#define IPW2200_VERSION "1.0.4" +#define IPW2200_VERSION "1.0.5" #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2200/2915 Network Driver" #define DRV_COPYRIGHT "Copyright(c) 2003-2004 Intel Corporation" #define DRV_VERSION IPW2200_VERSION @@ -273,14 +273,14 @@ static inline u32 __ipw_read32(char *f, u32 l, struct ipw_priv *ipw, u32 ofs) static void _ipw_read_indirect(struct ipw_priv *, u32, u8 *, int); #define ipw_read_indirect(a, b, c, d) \ - IPW_DEBUG_IO("%s %d: read_inddirect(0x%08X) %d bytes\n", __FILE__, __LINE__, (u32)(b), d); \ + IPW_DEBUG_IO("%s %d: read_indirect(0x%08X) %d bytes\n", __FILE__, __LINE__, (u32)(b), d); \ _ipw_read_indirect(a, b, c, d) static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 * data, int num); #define ipw_write_indirect(a, b, c, d) \ IPW_DEBUG_IO("%s %d: write_indirect(0x%08X) %d bytes\n", __FILE__, __LINE__, (u32)(b), d); \ - _ipw_write_indirect(a, b, c, d) + _ipw_write_indirect(a, b, c, d) /* indirect write s */ static void _ipw_write_reg32(struct ipw_priv *priv, u32 reg, u32 value) @@ -295,8 +295,6 @@ static void _ipw_write_reg8(struct ipw_priv *priv, u32 reg, u8 value) IPW_DEBUG_IO(" reg = 0x%8X : value = 0x%8X\n", reg, value); _ipw_write32(priv, IPW_INDIRECT_ADDR, reg & IPW_INDIRECT_ADDR_MASK); _ipw_write8(priv, IPW_INDIRECT_DATA, value); - IPW_DEBUG_IO(" reg = 0x%8lX : value = 0x%8X\n", - (unsigned long)(priv->hw_base + IPW_INDIRECT_DATA), value); } static void _ipw_write_reg16(struct ipw_priv *priv, u32 reg, u16 value) @@ -1015,12 +1013,12 @@ void ipw_led_init(struct ipw_priv *priv) void ipw_led_shutdown(struct ipw_priv *priv) { - cancel_delayed_work(&priv->led_link_on); - cancel_delayed_work(&priv->led_link_off); - cancel_delayed_work(&priv->led_act_off); ipw_led_activity_off(priv); ipw_led_link_off(priv); ipw_led_band_off(priv); + cancel_delayed_work(&priv->led_link_on); + cancel_delayed_work(&priv->led_link_off); + cancel_delayed_work(&priv->led_act_off); } /* @@ -1296,6 +1294,7 @@ static ssize_t show_indirect_dword(struct device *d, { u32 reg = 0; struct ipw_priv *priv = d->driver_data; + if (priv->status & STATUS_INDIRECT_DWORD) reg = ipw_read_reg32(priv, priv->indirect_dword); else @@ -1322,6 +1321,7 @@ static ssize_t show_indirect_byte(struct device *d, { u8 reg = 0; struct ipw_priv *priv = d->driver_data; + if (priv->status & STATUS_INDIRECT_BYTE) reg = ipw_read_reg8(priv, priv->indirect_byte); else @@ -1509,8 +1509,8 @@ static ssize_t store_net_stats(struct device *d, struct device_attribute *attr, return count; } -static DEVICE_ATTR(net_stats, S_IWUSR | S_IRUGO, show_net_stats, - store_net_stats); +static DEVICE_ATTR(net_stats, S_IWUSR | S_IRUGO, + show_net_stats, store_net_stats); static void notify_wx_assoc_event(struct ipw_priv *priv) { @@ -1630,6 +1630,11 @@ static void ipw_irq_tasklet(struct ipw_priv *priv) /* Keep the restart process from trying to send host * commands by clearing the INIT status bit */ priv->status &= ~STATUS_INIT; + + /* Cancel currently queued command. */ + priv->status &= ~STATUS_HCMD_ACTIVE; + wake_up_interruptible(&priv->wait_command_queue); + queue_work(priv->workqueue, &priv->adapter_restart); handled |= IPW_INTA_BIT_FATAL_ERROR; } @@ -1796,7 +1801,7 @@ static int ipw_send_system_config(struct ipw_priv *priv, return -1; } - memcpy(&cmd.param, config, sizeof(*config)); + memcpy(cmd.param, config, sizeof(*config)); if (ipw_send_cmd(priv, &cmd)) { IPW_ERROR("failed to send SYSTEM_CONFIG command\n"); return -1; @@ -1817,7 +1822,7 @@ static int ipw_send_ssid(struct ipw_priv *priv, u8 * ssid, int len) return -1; } - memcpy(&cmd.param, ssid, cmd.len); + memcpy(cmd.param, ssid, cmd.len); if (ipw_send_cmd(priv, &cmd)) { IPW_ERROR("failed to send SSID command\n"); return -1; @@ -1841,8 +1846,7 @@ static int ipw_send_adapter_address(struct ipw_priv *priv, u8 * mac) IPW_DEBUG_INFO("%s: Setting MAC to " MAC_FMT "\n", priv->net_dev->name, MAC_ARG(mac)); - memcpy(&cmd.param, mac, ETH_ALEN); - + memcpy(cmd.param, mac, ETH_ALEN); if (ipw_send_cmd(priv, &cmd)) { IPW_ERROR("failed to send ADAPTER_ADDRESS command\n"); return -1; @@ -1873,11 +1877,6 @@ static void ipw_adapter_restart(void *adapter) IPW_ERROR("Failed to up device\n"); return; } - - if ((priv->capability & CAP_PRIVACY_ON) && - (priv->ieee->sec.level == SEC_LEVEL_1) && - !(priv->ieee->host_encrypt || priv->ieee->host_decrypt)) - ipw_set_hwcrypto_keys(priv); } static void ipw_bg_adapter_restart(void *data) @@ -1917,14 +1916,12 @@ static int ipw_send_scan_request_ext(struct ipw_priv *priv, .len = sizeof(*request) }; - memcpy(&cmd.param, request, sizeof(*request)); + memcpy(cmd.param, request, sizeof(*request)); if (ipw_send_cmd(priv, &cmd)) { IPW_ERROR("failed to send SCAN_REQUEST_EXT command\n"); return -1; } - queue_delayed_work(priv->workqueue, &priv->scan_check, - IPW_SCAN_CHECK_WATCHDOG); return 0; } @@ -1991,7 +1988,7 @@ static int ipw_send_associate(struct ipw_priv *priv, return -1; } - memcpy(&cmd.param, &tmp_associate, sizeof(*associate)); + memcpy(cmd.param, &tmp_associate, sizeof(*associate)); if (ipw_send_cmd(priv, &cmd)) { IPW_ERROR("failed to send ASSOCIATE command\n"); return -1; @@ -2013,7 +2010,7 @@ static int ipw_send_supported_rates(struct ipw_priv *priv, return -1; } - memcpy(&cmd.param, rates, sizeof(*rates)); + memcpy(cmd.param, rates, sizeof(*rates)); if (ipw_send_cmd(priv, &cmd)) { IPW_ERROR("failed to send SUPPORTED_RATES command\n"); return -1; @@ -2078,7 +2075,7 @@ static int ipw_send_tx_power(struct ipw_priv *priv, struct ipw_tx_power *power) return -1; } - memcpy(&cmd.param, power, sizeof(*power)); + memcpy(cmd.param, power, sizeof(*power)); if (ipw_send_cmd(priv, &cmd)) { IPW_ERROR("failed to send TX_POWER command\n"); return -1; @@ -2102,7 +2099,7 @@ static int ipw_send_rts_threshold(struct ipw_priv *priv, u16 rts) return -1; } - memcpy(&cmd.param, &rts_threshold, sizeof(rts_threshold)); + memcpy(cmd.param, &rts_threshold, sizeof(rts_threshold)); if (ipw_send_cmd(priv, &cmd)) { IPW_ERROR("failed to send RTS_THRESHOLD command\n"); return -1; @@ -2126,7 +2123,7 @@ static int ipw_send_frag_threshold(struct ipw_priv *priv, u16 frag) return -1; } - memcpy(&cmd.param, &frag_threshold, sizeof(frag_threshold)); + memcpy(cmd.param, &frag_threshold, sizeof(frag_threshold)); if (ipw_send_cmd(priv, &cmd)) { IPW_ERROR("failed to send FRAG_THRESHOLD command\n"); return -1; @@ -2170,6 +2167,31 @@ static int ipw_send_power_mode(struct ipw_priv *priv, u32 mode) return 0; } +static int ipw_send_retry_limit(struct ipw_priv *priv, u8 slimit, u8 llimit) +{ + struct ipw_retry_limit retry_limit = { + .short_retry_limit = slimit, + .long_retry_limit = llimit + }; + struct host_cmd cmd = { + .cmd = IPW_CMD_RETRY_LIMIT, + .len = sizeof(retry_limit) + }; + + if (!priv) { + IPW_ERROR("Invalid args\n"); + return -1; + } + + memcpy(cmd.param, &retry_limit, sizeof(retry_limit)); + if (ipw_send_cmd(priv, &cmd)) { + IPW_ERROR("failed to send RETRY_LIMIT command\n"); + return -1; + } + + return 0; +} + /* * The IPW device contains a Microwire compatible EEPROM that stores * various data like the MAC address. Usually the firmware has exclusive @@ -2269,8 +2291,7 @@ static u16 eeprom_read_u16(struct ipw_priv *priv, u8 addr) /* data's copy of the eeprom data */ static void eeprom_parse_mac(struct ipw_priv *priv, u8 * mac) { - u8 *ee = (u8 *) priv->eeprom; - memcpy(mac, &ee[EEPROM_MAC_ADDRESS], 6); + memcpy(mac, &priv->eeprom[EEPROM_MAC_ADDRESS], 6); } /* @@ -2680,8 +2701,7 @@ struct fw_chunk { #define IPW_FW_MINOR(x) ((x & 0xff) >> 8) #define IPW_FW_MAJOR(x) (x & 0xff) -#define IPW_FW_VERSION ((IPW_FW_MINOR_VERSION << 8) | \ - IPW_FW_MAJOR_VERSION) +#define IPW_FW_VERSION ((IPW_FW_MINOR_VERSION << 8) | IPW_FW_MAJOR_VERSION) #define IPW_FW_PREFIX "ipw-" __stringify(IPW_FW_MAJOR_VERSION) \ "." __stringify(IPW_FW_MINOR_VERSION) "-" @@ -2952,6 +2972,8 @@ static int ipw_reset_nic(struct ipw_priv *priv) /* Clear the 'host command active' bit... */ priv->status &= ~STATUS_HCMD_ACTIVE; wake_up_interruptible(&priv->wait_command_queue); + priv->status &= ~(STATUS_SCANNING | STATUS_SCAN_ABORTING); + wake_up_interruptible(&priv->wait_state); spin_unlock_irqrestore(&priv->lock, flags); IPW_DEBUG_TRACE("<<\n"); @@ -3027,6 +3049,19 @@ static int fw_loaded = 0; static const struct firmware *bootfw = NULL; static const struct firmware *firmware = NULL; static const struct firmware *ucode = NULL; + +static void free_firmware(void) +{ + if (fw_loaded) { + release_firmware(bootfw); + release_firmware(ucode); + release_firmware(firmware); + bootfw = ucode = firmware = NULL; + fw_loaded = 0; + } +} +#else +#define free_firmware() do {} while (0) #endif static int ipw_load(struct ipw_priv *priv) @@ -3915,13 +3950,13 @@ static inline void ipw_handle_missed_beacon(struct ipw_priv *priv, { priv->notif_missed_beacons = missed_count; - if (missed_count > priv->missed_beacon_threshold && + if (missed_count > priv->disassociate_threshold && priv->status & STATUS_ASSOCIATED) { /* If associated and we've hit the missed * beacon threshold, disassociate, turn * off roaming, and abort any active scans */ IPW_DEBUG(IPW_DL_INFO | IPW_DL_NOTIF | - IPW_DL_STATE, + IPW_DL_STATE | IPW_DL_ASSOC, "Missed beacon: %d - disassociate\n", missed_count); priv->status &= ~STATUS_ROAMING; if (priv->status & STATUS_SCANNING) { @@ -4027,7 +4062,11 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, priv->status |= STATUS_ASSOCIATED; #ifdef CONFIG_IPW_QOS - if (priv->status & STATUS_AUTH) { +#define IPW_GET_PACKET_STYPE(x) WLAN_FC_GET_STYPE( \ + le16_to_cpu(((struct ieee80211_hdr *)(x))->frame_ctl)) + if ((priv->status & STATUS_AUTH) && + (IPW_GET_PACKET_STYPE(¬if->u.raw) + == IEEE80211_STYPE_ASSOC_RESP)) { if ((sizeof (struct ieee80211_assoc_response_frame) @@ -4287,10 +4326,12 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, #ifdef CONFIG_IPW2200_MONITOR if (priv->ieee->iw_mode == IW_MODE_MONITOR) { + priv->status |= STATUS_SCAN_FORCED; queue_work(priv->workqueue, &priv->request_scan); break; } + priv->status &= ~STATUS_SCAN_FORCED; #endif /* CONFIG_IPW2200_MONITOR */ if (!(priv->status & (STATUS_ASSOCIATED | @@ -4330,6 +4371,7 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, case HOST_NOTIFICATION_STATUS_LINK_DETERIORATION:{ struct notif_link_deterioration *x = ¬if->u.link_deterioration; + if (notif->size == sizeof(*x)) { IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE, "link deterioration: '%s' " MAC_FMT @@ -5027,6 +5069,7 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv, memcmp(network->ssid, priv->essid, min(network->ssid_len, priv->essid_len)))) { char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; + strncpy(escaped, escape_essid(network->ssid, network->ssid_len), sizeof(escaped)); @@ -5043,16 +5086,16 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv, * testing everything else. */ if (network->time_stamp[0] < match->network->time_stamp[0]) { - IPW_DEBUG_MERGE - ("Network '%s excluded because newer than current network.\n", - escape_essid(match->network->ssid, - match->network->ssid_len)); + IPW_DEBUG_MERGE("Network '%s excluded because newer than " + "current network.\n", + escape_essid(match->network->ssid, + match->network->ssid_len)); return 0; } else if (network->time_stamp[1] < match->network->time_stamp[1]) { - IPW_DEBUG_MERGE - ("Network '%s excluded because newer than current network.\n", - escape_essid(match->network->ssid, - match->network->ssid_len)); + IPW_DEBUG_MERGE("Network '%s excluded because newer than " + "current network.\n", + escape_essid(match->network->ssid, + match->network->ssid_len)); return 0; } @@ -5063,7 +5106,7 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv, "because of age: %lums.\n", escape_essid(network->ssid, network->ssid_len), MAC_ARG(network->bssid), - (jiffies - network->last_scanned) / (HZ / 100)); + 1000 * (jiffies - network->last_scanned) / HZ); return 0; } @@ -5084,10 +5127,11 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv, "because of privacy mismatch: %s != %s.\n", escape_essid(network->ssid, network->ssid_len), MAC_ARG(network->bssid), - priv->capability & CAP_PRIVACY_ON ? "on" : - "off", - network->capability & - WLAN_CAPABILITY_PRIVACY ? "on" : "off"); + priv-> + capability & CAP_PRIVACY_ON ? "on" : "off", + network-> + capability & WLAN_CAPABILITY_PRIVACY ? "on" : + "off"); return 0; } @@ -5151,8 +5195,8 @@ static void ipw_merge_adhoc_network(void *data) .network = priv->assoc_network }; - if ((priv->status & STATUS_ASSOCIATED) - && (priv->ieee->iw_mode == IW_MODE_ADHOC)) { + if ((priv->status & STATUS_ASSOCIATED) && + (priv->ieee->iw_mode == IW_MODE_ADHOC)) { /* First pass through ROAM process -- look for a better * network */ unsigned long flags; @@ -5184,7 +5228,6 @@ static void ipw_merge_adhoc_network(void *data) up(&priv->sem); return; } - } static int ipw_best_network(struct ipw_priv *priv, @@ -5270,7 +5313,7 @@ static int ipw_best_network(struct ipw_priv *priv, if (network->last_associate && time_after(network->last_associate + (HZ * 3UL), jiffies)) { IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " - "because of storming (%lu since last " + "because of storming (%lus since last " "assoc attempt).\n", escape_essid(network->ssid, network->ssid_len), MAC_ARG(network->bssid), @@ -5285,7 +5328,7 @@ static int ipw_best_network(struct ipw_priv *priv, "because of age: %lums.\n", escape_essid(network->ssid, network->ssid_len), MAC_ARG(network->bssid), - (jiffies - network->last_scanned) / (HZ / 100)); + 1000 * (jiffies - network->last_scanned) / HZ); return 0; } @@ -5369,6 +5412,9 @@ static int ipw_best_network(struct ipw_priv *priv, static void ipw_adhoc_create(struct ipw_priv *priv, struct ieee80211_network *network) { + const struct ieee80211_geo *geo = ieee80211_get_geo(priv->ieee); + int i; + /* * For the purposes of scanning, we can set our wireless mode * to trigger scans across combinations of bands, but when it @@ -5379,9 +5425,28 @@ static void ipw_adhoc_create(struct ipw_priv *priv, * chossen band. Attempting to create a new ad-hoc network * with an invalid channel for wireless mode will trigger a * FW fatal error. + * */ - if (!ieee80211_is_valid_channel(priv->ieee, priv->channel)) { - const struct ieee80211_geo *geo = ieee80211_get_geo(priv->ieee); + switch (ieee80211_is_valid_channel(priv->ieee, priv->channel)) { + case IEEE80211_52GHZ_BAND: + network->mode = IEEE_A; + i = ieee80211_channel_to_index(priv->ieee, priv->channel); + if (i == -1) + BUG(); + if (geo->a[i].flags & IEEE80211_CH_PASSIVE_ONLY) { + IPW_WARNING("Overriding invalid channel\n"); + priv->channel = geo->a[0].channel; + } + break; + + case IEEE80211_24GHZ_BAND: + if (priv->ieee->mode & IEEE_G) + network->mode = IEEE_G; + else + network->mode = IEEE_B; + break; + + default: IPW_WARNING("Overriding invalid channel\n"); if (priv->ieee->mode & IEEE_A) { network->mode = IEEE_A; @@ -5393,8 +5458,8 @@ static void ipw_adhoc_create(struct ipw_priv *priv, network->mode = IEEE_B; priv->channel = geo->bg[0].channel; } - } else - network->mode = priv->ieee->mode; + break; + } network->channel = priv->channel; priv->config |= CFG_ADHOC_PERSIST; @@ -5488,10 +5553,11 @@ static void ipw_set_hwcrypto_keys(struct ipw_priv *priv) { switch (priv->ieee->sec.level) { case SEC_LEVEL_3: - if (priv->ieee->sec.flags & SEC_ACTIVE_KEY) - ipw_send_tgi_tx_key(priv, - DCT_FLAG_EXT_SECURITY_CCM, - priv->ieee->sec.active_key); + if (!(priv->ieee->sec.flags & SEC_ACTIVE_KEY)) + break; + + ipw_send_tgi_tx_key(priv, DCT_FLAG_EXT_SECURITY_CCM, + priv->ieee->sec.active_key); ipw_send_wep_keys(priv, DCW_WEP_KEY_SEC_TYPE_CCM); priv->sys_config.disable_unicast_decryption = 0; @@ -5502,10 +5568,11 @@ static void ipw_set_hwcrypto_keys(struct ipw_priv *priv) break; case SEC_LEVEL_2: - if (priv->ieee->sec.flags & SEC_ACTIVE_KEY) - ipw_send_tgi_tx_key(priv, - DCT_FLAG_EXT_SECURITY_TKIP, - priv->ieee->sec.active_key); + if (!(priv->ieee->sec.flags & SEC_ACTIVE_KEY)) + break; + + ipw_send_tgi_tx_key(priv, DCT_FLAG_EXT_SECURITY_TKIP, + priv->ieee->sec.active_key); priv->sys_config.disable_unicast_decryption = 1; priv->sys_config.disable_multicast_decryption = 1; @@ -5534,9 +5601,12 @@ static void ipw_adhoc_check(void *data) { struct ipw_priv *priv = data; - if (priv->missed_adhoc_beacons++ > priv->missed_beacon_threshold && + if (priv->missed_adhoc_beacons++ > priv->disassociate_threshold && !(priv->config & CFG_ADHOC_PERSIST)) { - IPW_DEBUG_SCAN("Disassociating due to missed beacons\n"); + IPW_DEBUG(IPW_DL_INFO | IPW_DL_NOTIF | + IPW_DL_STATE | IPW_DL_ASSOC, + "Missed beacon: %d - disassociate\n", + priv->missed_adhoc_beacons); ipw_remove_current_network(priv); ipw_disassociate(priv); return; @@ -5669,27 +5739,110 @@ static void ipw_abort_scan(struct ipw_priv *priv) IPW_DEBUG_HC("Request to abort scan failed.\n"); } -static int ipw_request_scan(struct ipw_priv *priv) +static void ipw_add_scan_channels(struct ipw_priv *priv, + struct ipw_scan_request_ext *scan, + int scan_type) { - struct ipw_scan_request_ext scan; int channel_index = 0; - int i, err = 0, scan_type; const struct ieee80211_geo *geo; -#ifdef CONFIG_IPW2200_MONITOR - u8 channel; -#endif - - down(&priv->sem); + int i; geo = ieee80211_get_geo(priv->ieee); + if (priv->ieee->freq_band & IEEE80211_52GHZ_BAND) { + int start = channel_index; + for (i = 0; i < geo->a_channels; i++) { + if ((priv->status & STATUS_ASSOCIATED) && + geo->a[i].channel == priv->channel) + continue; + channel_index++; + scan->channels_list[channel_index] = geo->a[i].channel; + ipw_set_scan_type(scan, channel_index, scan_type); + } + + if (start != channel_index) { + scan->channels_list[start] = (u8) (IPW_A_MODE << 6) | + (channel_index - start); + channel_index++; + } + } + + if (priv->ieee->freq_band & IEEE80211_24GHZ_BAND) { + int start = channel_index; + if (priv->config & CFG_SPEED_SCAN) { + u8 channels[IEEE80211_24GHZ_CHANNELS] = { + /* nop out the list */ + [0] = 0 + }; + + u8 channel; + while (channel_index < IPW_SCAN_CHANNELS) { + channel = + priv->speed_scan[priv->speed_scan_pos]; + if (channel == 0) { + priv->speed_scan_pos = 0; + channel = priv->speed_scan[0]; + } + if ((priv->status & STATUS_ASSOCIATED) && + channel == priv->channel) { + priv->speed_scan_pos++; + continue; + } + + /* If this channel has already been + * added in scan, break from loop + * and this will be the first channel + * in the next scan. + */ + if (channels[channel - 1] != 0) + break; + + channels[channel - 1] = 1; + priv->speed_scan_pos++; + channel_index++; + scan->channels_list[channel_index] = channel; + ipw_set_scan_type(scan, channel_index, + scan_type); + } + } else { + for (i = 0; i < geo->bg_channels; i++) { + if ((priv->status & STATUS_ASSOCIATED) && + geo->bg[i].channel == priv->channel) + continue; + channel_index++; + scan->channels_list[channel_index] = + geo->bg[i].channel; + ipw_set_scan_type(scan, channel_index, + scan_type); + } + } + + if (start != channel_index) { + scan->channels_list[start] = (u8) (IPW_B_MODE << 6) | + (channel_index - start); + } + } +} + +static int ipw_request_scan(struct ipw_priv *priv) +{ + struct ipw_scan_request_ext scan; + int err = 0, scan_type; + + if (!(priv->status & STATUS_INIT) || + (priv->status & STATUS_EXIT_PENDING)) + return 0; + + down(&priv->sem); + if (priv->status & STATUS_SCANNING) { IPW_DEBUG_HC("Concurrent scan requested. Ignoring.\n"); priv->status |= STATUS_SCAN_PENDING; goto done; } - if (priv->status & STATUS_SCAN_ABORTING) { + if (!(priv->status & STATUS_SCAN_FORCED) && + priv->status & STATUS_SCAN_ABORTING) { IPW_DEBUG_HC("Scan request while abort pending. Queuing.\n"); priv->status |= STATUS_SCAN_PENDING; goto done; @@ -5718,6 +5871,7 @@ static int ipw_request_scan(struct ipw_priv *priv) #ifdef CONFIG_IPW2200_MONITOR if (priv->ieee->iw_mode == IW_MODE_MONITOR) { + u8 channel; u8 band = 0; switch (ieee80211_is_valid_channel(priv->ieee, priv->channel)) { @@ -5768,91 +5922,10 @@ static int ipw_request_scan(struct ipw_priv *priv) } scan_type = IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN; - } else { + } else scan_type = IPW_SCAN_ACTIVE_BROADCAST_SCAN; - } - - /* Add channels to the scan list */ - if (priv->ieee->freq_band & IEEE80211_52GHZ_BAND) { - int start = channel_index; - for (i = 0; i < geo->a_channels; i++) { - if ((priv->status & STATUS_ASSOCIATED) && - geo->a[i].channel == priv->channel) - continue; - channel_index++; - scan.channels_list[channel_index] = - geo->a[i].channel; - ipw_set_scan_type(&scan, channel_index, - scan_type); - } - - if (start != channel_index) { - scan.channels_list[start] = - (u8) (IPW_A_MODE << 6) | (channel_index - - start); - channel_index++; - } - } - - if (priv->ieee->freq_band & IEEE80211_24GHZ_BAND) { - int start = channel_index; - if (priv->config & CFG_SPEED_SCAN) { - u8 channels[IEEE80211_24GHZ_CHANNELS] = { - /* nop out the list */ - [0] = 0 - }; - - u8 channel; - while (channel_index < IPW_SCAN_CHANNELS) { - channel = - priv->speed_scan[priv-> - speed_scan_pos]; - if (channel == 0) { - priv->speed_scan_pos = 0; - channel = priv->speed_scan[0]; - } - if ((priv->status & STATUS_ASSOCIATED) - && channel == priv->channel) { - priv->speed_scan_pos++; - continue; - } - - /* If this channel has already been - * added in scan, break from loop - * and this will be the first channel - * in the next scan. - */ - if (channels[channel - 1] != 0) - break; - - channels[channel - 1] = 1; - priv->speed_scan_pos++; - channel_index++; - scan.channels_list[channel_index] = - channel; - ipw_set_scan_type(&scan, channel_index, - scan_type); - } - } else { - for (i = 0; i < geo->bg_channels; i++) { - if ((priv->status & STATUS_ASSOCIATED) - && geo->bg[i].channel == - priv->channel) - continue; - channel_index++; - scan.channels_list[channel_index] = - geo->bg[i].channel; - ipw_set_scan_type(&scan, channel_index, - scan_type); - } - } - if (start != channel_index) { - scan.channels_list[start] = - (u8) (IPW_B_MODE << 6) | (channel_index - - start); - } - } + ipw_add_scan_channels(priv, &scan, scan_type); #ifdef CONFIG_IPW2200_MONITOR } #endif @@ -5865,7 +5938,8 @@ static int ipw_request_scan(struct ipw_priv *priv) priv->status |= STATUS_SCANNING; priv->status &= ~STATUS_SCAN_PENDING; - + queue_delayed_work(priv->workqueue, &priv->scan_check, + IPW_SCAN_CHECK_WATCHDOG); done: up(&priv->sem); return err; @@ -5879,8 +5953,8 @@ static void ipw_bg_abort_scan(void *data) up(&priv->sem); } -/* Support for wpa_supplicant. Will be replaced with WEXT once - * they get WPA support. */ +#if WIRELESS_EXT < 18 +/* Support for wpa_supplicant before WE-18, deprecated. */ /* following definitions must match definitions in driver_ipw.c */ @@ -5924,8 +5998,8 @@ struct ipw_param { u8 data[0]; } wpa_ie; struct { - int command; - int reason_code; + u32 command; + u32 reason_code; } mlme; struct { u8 alg[IPW_CRYPT_ALG_NAME_LEN]; @@ -5941,6 +6015,7 @@ struct ipw_param { }; /* end of driver_ipw.c code */ +#endif static int ipw_wpa_enable(struct ipw_priv *priv, int value) { @@ -5949,8 +6024,10 @@ static int ipw_wpa_enable(struct ipw_priv *priv, int value) return 0; } -#define AUTH_ALG_OPEN_SYSTEM 0x1 -#define AUTH_ALG_SHARED_KEY 0x2 +#if WIRELESS_EXT < 18 +#define IW_AUTH_ALG_OPEN_SYSTEM 0x1 +#define IW_AUTH_ALG_SHARED_KEY 0x2 +#endif static int ipw_wpa_set_auth_algs(struct ipw_priv *priv, int value) { @@ -5960,13 +6037,14 @@ static int ipw_wpa_set_auth_algs(struct ipw_priv *priv, int value) }; int ret = 0; - if (value & AUTH_ALG_SHARED_KEY) { + if (value & IW_AUTH_ALG_SHARED_KEY) { sec.auth_mode = WLAN_AUTH_SHARED_KEY; ieee->open_wep = 0; - } else { + } else if (value & IW_AUTH_ALG_OPEN_SYSTEM) { sec.auth_mode = WLAN_AUTH_OPEN; ieee->open_wep = 1; - } + } else + return -EINVAL; if (ieee->set_security) ieee->set_security(ieee->dev, &sec); @@ -5976,6 +6054,33 @@ static int ipw_wpa_set_auth_algs(struct ipw_priv *priv, int value) return ret; } +void ipw_wpa_assoc_frame(struct ipw_priv *priv, char *wpa_ie, int wpa_ie_len) +{ + /* make sure WPA is enabled */ + ipw_wpa_enable(priv, 1); + + ipw_disassociate(priv); +} + +static int ipw_set_rsn_capa(struct ipw_priv *priv, + char *capabilities, int length) +{ + struct host_cmd cmd = { + .cmd = IPW_CMD_RSN_CAPABILITIES, + .len = length, + }; + + IPW_DEBUG_HC("HOST_CMD_RSN_CAPABILITIES\n"); + + memcpy(cmd.param, capabilities, length); + if (ipw_send_cmd(priv, &cmd)) { + IPW_ERROR("failed to send HOST_CMD_RSN_CAPABILITIES command\n"); + return -1; + } + return 0; +} + +#if WIRELESS_EXT < 18 static int ipw_wpa_set_param(struct net_device *dev, u8 name, u32 value) { struct ipw_priv *priv = ieee80211_priv(dev); @@ -6081,32 +6186,6 @@ static int ipw_wpa_mlme(struct net_device *dev, int command, int reason) return ret; } -static int ipw_set_rsn_capa(struct ipw_priv *priv, - char *capabilities, int length) -{ - struct host_cmd cmd = { - .cmd = IPW_CMD_RSN_CAPABILITIES, - .len = length, - }; - - IPW_DEBUG_HC("HOST_CMD_RSN_CAPABILITIES\n"); - - memcpy(&cmd.param, capabilities, length); - if (ipw_send_cmd(priv, &cmd)) { - IPW_ERROR("failed to send HOST_CMD_RSN_CAPABILITIES command\n"); - return -1; - } - return 0; -} - -void ipw_wpa_assoc_frame(struct ipw_priv *priv, char *wpa_ie, int wpa_ie_len) -{ - /* make sure WPA is enabled */ - ipw_wpa_enable(priv, 1); - - ipw_disassociate(priv); -} - static int ipw_wpa_set_wpa_ie(struct net_device *dev, struct ipw_param *param, int plen) { @@ -6172,23 +6251,26 @@ static int ipw_wpa_set_encryption(struct net_device *dev, return -EINVAL; } + sec.flags |= SEC_ENABLED | SEC_ENCRYPT; if (strcmp(param->u.crypt.alg, "none") == 0) { if (crypt) { sec.enabled = 0; sec.encrypt = 0; sec.level = SEC_LEVEL_0; - sec.flags |= SEC_ENABLED | SEC_LEVEL; + sec.flags |= SEC_LEVEL; ieee80211_crypt_delayed_deinit(ieee, crypt); } goto done; } sec.enabled = 1; sec.encrypt = 1; - sec.flags |= SEC_ENABLED; /* IPW HW cannot build TKIP MIC, host decryption still needed. */ - if (!(ieee->host_encrypt || ieee->host_decrypt) && - strcmp(param->u.crypt.alg, "TKIP")) + if (strcmp(param->u.crypt.alg, "TKIP") == 0) + ieee->host_encrypt_msdu = 1; + + if (!(ieee->host_encrypt || ieee->host_encrypt_msdu || + ieee->host_decrypt)) goto skip_host_crypt; ops = ieee80211_get_crypto_ops(param->u.crypt.alg); @@ -6295,6 +6377,7 @@ static int ipw_wpa_set_encryption(struct net_device *dev, static int ipw_wpa_supplicant(struct net_device *dev, struct iw_point *p) { struct ipw_param *param; + struct ipw_priv *priv = ieee80211_priv(dev); int ret = 0; IPW_DEBUG_INFO("wpa_supplicant: len=%d\n", p->length); @@ -6311,6 +6394,7 @@ static int ipw_wpa_supplicant(struct net_device *dev, struct iw_point *p) return -EFAULT; } + down(&priv->sem); switch (param->cmd) { case IPW_CMD_SET_WPA_PARAM: @@ -6337,35 +6421,336 @@ static int ipw_wpa_supplicant(struct net_device *dev, struct iw_point *p) ret = -EOPNOTSUPP; } + up(&priv->sem); if (ret == 0 && copy_to_user(p->pointer, param, p->length)) ret = -EFAULT; kfree(param); return ret; } - -#ifdef CONFIG_IPW_QOS - -/* QoS */ +#else /* -* get the modulation type of the current network or -* the card current mode -*/ -u8 ipw_qos_current_mode(struct ipw_priv * priv) + * WE-18 support + */ + +/* SIOCSIWGENIE */ +static int ipw_wx_set_genie(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { - u8 mode = 0; + struct ipw_priv *priv = ieee80211_priv(dev); + struct ieee80211_device *ieee = priv->ieee; + u8 *buf; + int err = 0; - if (priv->status & STATUS_ASSOCIATED) { - unsigned long flags; + if (wrqu->data.length > MAX_WPA_IE_LEN || + (wrqu->data.length && extra == NULL)) + return -EINVAL; - spin_lock_irqsave(&priv->ieee->lock, flags); - mode = priv->assoc_network->mode; - spin_unlock_irqrestore(&priv->ieee->lock, flags); + //down(&priv->sem); + + //if (!ieee->wpa_enabled) { + // err = -EOPNOTSUPP; + // goto out; + //} + + if (wrqu->data.length) { + buf = kmalloc(wrqu->data.length, GFP_KERNEL); + if (buf == NULL) { + err = -ENOMEM; + goto out; + } + + memcpy(buf, extra, wrqu->data.length); + kfree(ieee->wpa_ie); + ieee->wpa_ie = buf; + ieee->wpa_ie_len = wrqu->data.length; } else { - mode = priv->ieee->mode; + kfree(ieee->wpa_ie); + ieee->wpa_ie = NULL; + ieee->wpa_ie_len = 0; } - IPW_DEBUG_QOS("QoS network/card mode %d \n", mode); - return mode; + + ipw_wpa_assoc_frame(priv, ieee->wpa_ie, ieee->wpa_ie_len); + out: + //up(&priv->sem); + return err; +} + +/* SIOCGIWGENIE */ +static int ipw_wx_get_genie(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct ipw_priv *priv = ieee80211_priv(dev); + struct ieee80211_device *ieee = priv->ieee; + int err = 0; + + //down(&priv->sem); + + //if (!ieee->wpa_enabled) { + // err = -EOPNOTSUPP; + // goto out; + //} + + if (ieee->wpa_ie_len == 0 || ieee->wpa_ie == NULL) { + wrqu->data.length = 0; + goto out; + } + + if (wrqu->data.length < ieee->wpa_ie_len) { + err = -E2BIG; + goto out; + } + + wrqu->data.length = ieee->wpa_ie_len; + memcpy(extra, ieee->wpa_ie, ieee->wpa_ie_len); + + out: + //up(&priv->sem); + return err; +} + +/* SIOCSIWAUTH */ +static int ipw_wx_set_auth(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct ipw_priv *priv = ieee80211_priv(dev); + struct ieee80211_device *ieee = priv->ieee; + struct iw_param *param = &wrqu->param; + struct ieee80211_crypt_data *crypt; + unsigned long flags; + int ret = 0; + + switch (param->flags & IW_AUTH_INDEX) { + case IW_AUTH_WPA_VERSION: + case IW_AUTH_CIPHER_PAIRWISE: + case IW_AUTH_CIPHER_GROUP: + case IW_AUTH_KEY_MGMT: + /* + * ipw2200 does not use these parameters + */ + break; + + case IW_AUTH_TKIP_COUNTERMEASURES: + crypt = priv->ieee->crypt[priv->ieee->tx_keyidx]; + if (!crypt || !crypt->ops->set_flags || !crypt->ops->get_flags) { + IPW_WARNING("Can't set TKIP countermeasures: " + "crypt not set!\n"); + break; + } + + flags = crypt->ops->get_flags(crypt->priv); + + if (param->value) + flags |= IEEE80211_CRYPTO_TKIP_COUNTERMEASURES; + else + flags &= ~IEEE80211_CRYPTO_TKIP_COUNTERMEASURES; + + crypt->ops->set_flags(flags, crypt->priv); + + break; + + case IW_AUTH_DROP_UNENCRYPTED:{ + /* HACK: + * + * wpa_supplicant calls set_wpa_enabled when the driver + * is loaded and unloaded, regardless of if WPA is being + * used. No other calls are made which can be used to + * determine if encryption will be used or not prior to + * association being expected. If encryption is not being + * used, drop_unencrypted is set to false, else true -- we + * can use this to determine if the CAP_PRIVACY_ON bit should + * be set. + */ + struct ieee80211_security sec = { + .flags = SEC_ENABLED, + .enabled = param->value, + }; + priv->ieee->drop_unencrypted = param->value; + /* We only change SEC_LEVEL for open mode. Others + * are set by ipw_wpa_set_encryption. + */ + if (!param->value) { + sec.flags |= SEC_LEVEL; + sec.level = SEC_LEVEL_0; + } else { + sec.flags |= SEC_LEVEL; + sec.level = SEC_LEVEL_1; + } + if (priv->ieee->set_security) + priv->ieee->set_security(priv->ieee->dev, &sec); + break; + } + + case IW_AUTH_80211_AUTH_ALG: + ret = ipw_wpa_set_auth_algs(priv, param->value); + break; + + case IW_AUTH_WPA_ENABLED: + ret = ipw_wpa_enable(priv, param->value); + break; + + case IW_AUTH_RX_UNENCRYPTED_EAPOL: + ieee->ieee802_1x = param->value; + break; + + //case IW_AUTH_ROAMING_CONTROL: + case IW_AUTH_PRIVACY_INVOKED: + ieee->privacy_invoked = param->value; + break; + + default: + return -EOPNOTSUPP; + } + return ret; +} + +/* SIOCGIWAUTH */ +static int ipw_wx_get_auth(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct ipw_priv *priv = ieee80211_priv(dev); + struct ieee80211_device *ieee = priv->ieee; + struct ieee80211_crypt_data *crypt; + struct iw_param *param = &wrqu->param; + int ret = 0; + + switch (param->flags & IW_AUTH_INDEX) { + case IW_AUTH_WPA_VERSION: + case IW_AUTH_CIPHER_PAIRWISE: + case IW_AUTH_CIPHER_GROUP: + case IW_AUTH_KEY_MGMT: + /* + * wpa_supplicant will control these internally + */ + ret = -EOPNOTSUPP; + break; + + case IW_AUTH_TKIP_COUNTERMEASURES: + crypt = priv->ieee->crypt[priv->ieee->tx_keyidx]; + if (!crypt || !crypt->ops->get_flags) { + IPW_WARNING("Can't get TKIP countermeasures: " + "crypt not set!\n"); + break; + } + + param->value = (crypt->ops->get_flags(crypt->priv) & + IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) ? 1 : 0; + + break; + + case IW_AUTH_DROP_UNENCRYPTED: + param->value = ieee->drop_unencrypted; + break; + + case IW_AUTH_80211_AUTH_ALG: + param->value = ieee->sec.auth_mode; + break; + + case IW_AUTH_WPA_ENABLED: + param->value = ieee->wpa_enabled; + break; + + case IW_AUTH_RX_UNENCRYPTED_EAPOL: + param->value = ieee->ieee802_1x; + break; + + case IW_AUTH_ROAMING_CONTROL: + case IW_AUTH_PRIVACY_INVOKED: + param->value = ieee->privacy_invoked; + break; + + default: + return -EOPNOTSUPP; + } + return 0; +} + +/* SIOCSIWENCODEEXT */ +static int ipw_wx_set_encodeext(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct ipw_priv *priv = ieee80211_priv(dev); + struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; + + if (hwcrypto) { + /* IPW HW can't build TKIP MIC, host decryption still needed */ + if (ext->alg == IW_ENCODE_ALG_TKIP) { + priv->ieee->host_encrypt = 0; + priv->ieee->host_encrypt_msdu = 1; + priv->ieee->host_decrypt = 1; + } else { + priv->ieee->host_encrypt = 0; + priv->ieee->host_encrypt_msdu = 0; + priv->ieee->host_decrypt = 0; + } + } + + return ieee80211_wx_set_encodeext(priv->ieee, info, wrqu, extra); +} + +/* SIOCGIWENCODEEXT */ +static int ipw_wx_get_encodeext(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct ipw_priv *priv = ieee80211_priv(dev); + return ieee80211_wx_get_encodeext(priv->ieee, info, wrqu, extra); +} + +/* SIOCSIWMLME */ +static int ipw_wx_set_mlme(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct ipw_priv *priv = ieee80211_priv(dev); + struct iw_mlme *mlme = (struct iw_mlme *)extra; + u16 reason; + + reason = cpu_to_le16(mlme->reason_code); + + switch (mlme->cmd) { + case IW_MLME_DEAUTH: + // silently ignore + break; + + case IW_MLME_DISASSOC: + ipw_disassociate(priv); + break; + + default: + return -EOPNOTSUPP; + } + return 0; +} +#endif + +#ifdef CONFIG_IPW_QOS + +/* QoS */ +/* +* get the modulation type of the current network or +* the card current mode +*/ +u8 ipw_qos_current_mode(struct ipw_priv * priv) +{ + u8 mode = 0; + + if (priv->status & STATUS_ASSOCIATED) { + unsigned long flags; + + spin_lock_irqsave(&priv->ieee->lock, flags); + mode = priv->assoc_network->mode; + spin_unlock_irqrestore(&priv->ieee->lock, flags); + } else { + mode = priv->ieee->mode; + } + IPW_DEBUG_QOS("QoS network/card mode %d \n", mode); + return mode; } /* @@ -6377,12 +6762,12 @@ static int ipw_qos_handle_probe_reponse(struct ipw_priv *priv, { u32 size = sizeof(struct ieee80211_qos_parameters); - if ((network->capability & WLAN_CAPABILITY_IBSS)) + if (network->capability & WLAN_CAPABILITY_IBSS) network->qos_data.active = network->qos_data.supported; if (network->flags & NETWORK_HAS_QOS_MASK) { - if (active_network - && (network->flags & NETWORK_HAS_QOS_PARAMETERS)) + if (active_network && + (network->flags & NETWORK_HAS_QOS_PARAMETERS)) network->qos_data.active = network->qos_data.supported; if ((network->qos_data.active == 1) && (active_network == 1) && @@ -6392,17 +6777,17 @@ static int ipw_qos_handle_probe_reponse(struct ipw_priv *priv, network->qos_data.old_param_count = network->qos_data.param_count; schedule_work(&priv->qos_activate); - IPW_DEBUG_QOS - ("QoS parameters change call qos_activate\n"); + IPW_DEBUG_QOS("QoS parameters change call " + "qos_activate\n"); } } else { - if ((priv->ieee->mode == IEEE_B) || (network->mode == IEEE_B)) { - memcpy(&(network->qos_data.parameters), + if ((priv->ieee->mode == IEEE_B) || (network->mode == IEEE_B)) + memcpy(&network->qos_data.parameters, &def_parameters_CCK, size); - } else { - memcpy(&(network->qos_data.parameters), + else + memcpy(&network->qos_data.parameters, &def_parameters_OFDM, size); - } + if ((network->qos_data.active == 1) && (active_network == 1)) { IPW_DEBUG_QOS("QoS was disabled call qos_activate \n"); schedule_work(&priv->qos_activate); @@ -6411,24 +6796,19 @@ static int ipw_qos_handle_probe_reponse(struct ipw_priv *priv, network->qos_data.active = 0; network->qos_data.supported = 0; } - if ((priv->status & STATUS_ASSOCIATED) - && (priv->ieee->iw_mode == IW_MODE_ADHOC) - && (active_network == 0)) { - - if (memcmp(network->bssid, priv->bssid, ETH_ALEN)) { - if ((network->capability & WLAN_CAPABILITY_IBSS) - && !(network->flags & NETWORK_EMPTY_ESSID)) { + if ((priv->status & STATUS_ASSOCIATED) && + (priv->ieee->iw_mode == IW_MODE_ADHOC) && (active_network == 0)) { + if (memcmp(network->bssid, priv->bssid, ETH_ALEN)) + if ((network->capability & WLAN_CAPABILITY_IBSS) && + !(network->flags & NETWORK_EMPTY_ESSID)) if ((network->ssid_len == - priv->assoc_network->ssid_len) - && !memcmp(network->ssid, - priv->assoc_network->ssid, - network->ssid_len)) { + priv->assoc_network->ssid_len) && + !memcmp(network->ssid, + priv->assoc_network->ssid, + network->ssid_len)) { queue_work(priv->workqueue, &priv->merge_networks); } - - } - } } return 0; @@ -6463,13 +6843,12 @@ static int ipw_qos_activate(struct ipw_priv *priv, } else active_one = &def_parameters_OFDM; - memcpy(&(qos_parameters[QOS_PARAM_SET_ACTIVE]), active_one, - size); + memcpy(&qos_parameters[QOS_PARAM_SET_ACTIVE], active_one, size); burst_duration = ipw_qos_get_burst_duration(priv); for (i = 0; i < QOS_QUEUE_NUM; i++) - qos_parameters[QOS_PARAM_SET_ACTIVE]. - tx_op_limit[i] = (u16) burst_duration; - } else if ((priv->ieee->iw_mode == IW_MODE_ADHOC)) { + qos_parameters[QOS_PARAM_SET_ACTIVE].tx_op_limit[i] = + (u16) burst_duration; + } else if (priv->ieee->iw_mode == IW_MODE_ADHOC) { if (type == IEEE_B) { IPW_DEBUG_QOS("QoS activate IBSS nework mode %d\n", type); @@ -6483,8 +6862,7 @@ static int ipw_qos_activate(struct ipw_priv *priv, else active_one = priv->qos_data.def_qos_parm_OFDM; } - memcpy(&(qos_parameters[QOS_PARAM_SET_ACTIVE]), active_one, - size); + memcpy(&qos_parameters[QOS_PARAM_SET_ACTIVE], active_one, size); } else { unsigned long flags; int active; @@ -6493,8 +6871,7 @@ static int ipw_qos_activate(struct ipw_priv *priv, active_one = &(qos_network_data->parameters); qos_network_data->old_param_count = qos_network_data->param_count; - memcpy(&(qos_parameters[QOS_PARAM_SET_ACTIVE]), active_one, - size); + memcpy(&qos_parameters[QOS_PARAM_SET_ACTIVE], active_one, size); active = qos_network_data->supported; spin_unlock_irqrestore(&priv->ieee->lock, flags); @@ -6507,10 +6884,9 @@ static int ipw_qos_activate(struct ipw_priv *priv, } IPW_DEBUG_QOS("QoS sending IPW_CMD_QOS_PARAMETERS\n"); - err = - ipw_send_qos_params_command(priv, - (struct ieee80211_qos_parameters *) - &(qos_parameters[0])); + err = ipw_send_qos_params_command(priv, + (struct ieee80211_qos_parameters *) + &(qos_parameters[0])); if (err) IPW_DEBUG_QOS("QoS IPW_CMD_QOS_PARAMETERS failed\n"); @@ -6603,21 +6979,19 @@ static int ipw_qos_association_resp(struct ipw_priv *priv, u32 size = sizeof(struct ieee80211_qos_parameters); int set_qos_param = 0; - if ((priv == NULL) || (network == NULL) - || (priv->assoc_network == NULL)) - + if ((priv == NULL) || (network == NULL) || + (priv->assoc_network == NULL)) return ret; if (!(priv->status & STATUS_ASSOCIATED)) return ret; - if ((priv->ieee->iw_mode != IW_MODE_INFRA)) { + if ((priv->ieee->iw_mode != IW_MODE_INFRA)) return ret; - } spin_lock_irqsave(&priv->ieee->lock, flags); if (network->flags & NETWORK_HAS_QOS_PARAMETERS) { - memcpy(&(priv->assoc_network->qos_data), &(network->qos_data), + memcpy(&priv->assoc_network->qos_data, &network->qos_data, sizeof(struct ieee80211_qos_data)); priv->assoc_network->qos_data.active = 1; if ((network->qos_data.old_param_count != @@ -6628,13 +7002,12 @@ static int ipw_qos_association_resp(struct ipw_priv *priv, } } else { - if ((network->mode == IEEE_B) || (priv->ieee->mode == IEEE_B)) { - memcpy(&(priv->assoc_network->qos_data.parameters), + if ((network->mode == IEEE_B) || (priv->ieee->mode == IEEE_B)) + memcpy(&priv->assoc_network->qos_data.parameters, &def_parameters_CCK, size); - } else { - memcpy(&(priv->assoc_network->qos_data.parameters), + else + memcpy(&priv->assoc_network->qos_data.parameters, &def_parameters_OFDM, size); - } priv->assoc_network->qos_data.active = 0; priv->assoc_network->qos_data.supported = 0; set_qos_param = 1; @@ -6655,11 +7028,11 @@ static u32 ipw_qos_get_burst_duration(struct ipw_priv *priv) if ((priv == NULL)) return 0; - if (!(priv->ieee->modulation & IEEE80211_OFDM_MODULATION)) { + if (!(priv->ieee->modulation & IEEE80211_OFDM_MODULATION)) ret = priv->qos_data.burst_duration_CCK; - } else { + else ret = priv->qos_data.burst_duration_OFDM; - } + return ret; } @@ -6736,9 +7109,9 @@ static int ipw_qos_set_tx_queue_command(struct ipw_priv *priv, spin_unlock_irqrestore(&priv->ieee->lock, flags); - IPW_DEBUG_QOS - ("QoS %d network is QoS active %d supported %d unicast %d\n", - priv->qos_data.qos_enable, active, supported, unicast); + IPW_DEBUG_QOS("QoS %d network is QoS active %d supported %d " + "unicast %d\n", + priv->qos_data.qos_enable, active, supported, unicast); if (active && priv->qos_data.qos_enable) { ret = from_priority_to_tx_queue[priority]; tx_queue_id = ret - 1; @@ -6822,8 +7195,7 @@ static int ipw_send_qos_params_command(struct ipw_priv *priv, struct ieee80211_q return -1; } - memcpy(&cmd.param, qos_param, - (sizeof(struct ieee80211_qos_parameters) * 3)); + memcpy(cmd.param, qos_param, sizeof(*qos_param) * 3); if (ipw_send_cmd(priv, &cmd)) { IPW_ERROR("failed to send IPW_CMD_QOS_PARAMETERS command\n"); return -1; @@ -6845,7 +7217,7 @@ static int ipw_send_qos_info_command(struct ipw_priv *priv, struct ieee80211_qos return -1; } - memcpy(&cmd.param, qos_param, sizeof(*qos_param)); + memcpy(cmd.param, qos_param, sizeof(*qos_param)); if (ipw_send_cmd(priv, &cmd)) { IPW_ERROR("failed to send CMD_QOS_INFO command\n"); return -1; @@ -6919,6 +7291,11 @@ static int ipw_associate_network(struct ipw_priv *priv, ~WLAN_CAPABILITY_SHORT_PREAMBLE; } + /* Clear capability bits that aren't used in Ad Hoc */ + if (priv->ieee->iw_mode == IW_MODE_ADHOC) + priv->assoc_request.capability &= + ~WLAN_CAPABILITY_SHORT_SLOT_TIME; + IPW_DEBUG_ASSOC("%sssocation attempt: '%s', channel %d, " "802.11%c [%d], %s[:%s], enc=%s%s%s%c%c\n", roaming ? "Rea" : "A", @@ -6954,13 +7331,13 @@ static int ipw_associate_network(struct ipw_priv *priv, priv->assoc_request.assoc_tsf_lsw = network->time_stamp[0]; } - memcpy(&priv->assoc_request.bssid, network->bssid, ETH_ALEN); + memcpy(priv->assoc_request.bssid, network->bssid, ETH_ALEN); if (priv->ieee->iw_mode == IW_MODE_ADHOC) { memset(&priv->assoc_request.dest, 0xFF, ETH_ALEN); priv->assoc_request.atim_window = network->atim_window; } else { - memcpy(&priv->assoc_request.dest, network->bssid, ETH_ALEN); + memcpy(priv->assoc_request.dest, network->bssid, ETH_ALEN); priv->assoc_request.atim_window = 0; } @@ -7119,14 +7496,14 @@ static int ipw_associate(void *data) } if (priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { - IPW_DEBUG_ASSOC - ("Not attempting association (already in progress)\n"); + IPW_DEBUG_ASSOC("Not attempting association (already in " + "progress)\n"); return 0; } if (!ipw_is_init(priv) || (priv->status & STATUS_SCANNING)) { - IPW_DEBUG_ASSOC - ("Not attempting association (scanning or not initialized)\n"); + IPW_DEBUG_ASSOC("Not attempting association (scanning or not " + "initialized)\n"); return 0; } @@ -7285,9 +7662,8 @@ static inline int is_network_packet(struct ipw_priv *priv, if (!memcmp(header->addr2, priv->net_dev->dev_addr, ETH_ALEN)) return 0; - /* {broad,multi}cast packets to our IBSS go through */ - if (is_broadcast_ether_addr(header->addr1) || - is_multicast_ether_addr(header->addr1)) + /* multicast packets to our IBSS go through */ + if (is_multicast_ether_addr(header->addr1)) return !memcmp(header->addr3, priv->bssid, ETH_ALEN); /* packets to our adapter go through */ @@ -7300,8 +7676,7 @@ static inline int is_network_packet(struct ipw_priv *priv, return 0; /* {broad,multi}cast packets to our IBSS go through */ - if (is_broadcast_ether_addr(header->addr1) || - is_multicast_ether_addr(header->addr1)) + if (is_multicast_ether_addr(header->addr1)) return !memcmp(header->addr2, priv->bssid, ETH_ALEN); /* packets to our adapter go through */ @@ -7312,6 +7687,79 @@ static inline int is_network_packet(struct ipw_priv *priv, return 1; } +#define IPW_PACKET_RETRY_TIME HZ + +static inline int is_duplicate_packet(struct ipw_priv *priv, + struct ieee80211_hdr_4addr *header) +{ + u16 fc = le16_to_cpu(header->frame_ctl); + u16 sc = le16_to_cpu(header->seq_ctl); + u16 seq = WLAN_GET_SEQ_SEQ(sc); + u16 frag = WLAN_GET_SEQ_FRAG(sc); + u16 *last_seq, *last_frag; + unsigned long *last_time; + + switch (priv->ieee->iw_mode) { + case IW_MODE_ADHOC: + { + struct list_head *p; + struct ipw_ibss_seq *entry = NULL; + u8 *mac = header->addr2; + int index = mac[5] % IPW_IBSS_MAC_HASH_SIZE; + + __list_for_each(p, &priv->ibss_mac_hash[index]) { + entry = + list_entry(p, struct ipw_ibss_seq, list); + if (!memcmp(entry->mac, mac, ETH_ALEN)) + break; + } + if (p == &priv->ibss_mac_hash[index]) { + entry = kmalloc(sizeof(*entry), GFP_ATOMIC); + if (!entry) { + IPW_ERROR + ("Cannot malloc new mac entry\n"); + return 0; + } + memcpy(entry->mac, mac, ETH_ALEN); + entry->seq_num = seq; + entry->frag_num = frag; + entry->packet_time = jiffies; + list_add(&entry->list, + &priv->ibss_mac_hash[index]); + return 0; + } + last_seq = &entry->seq_num; + last_frag = &entry->frag_num; + last_time = &entry->packet_time; + break; + } + case IW_MODE_INFRA: + last_seq = &priv->last_seq_num; + last_frag = &priv->last_frag_num; + last_time = &priv->last_packet_time; + break; + default: + return 0; + } + if ((*last_seq == seq) && + time_after(*last_time + IPW_PACKET_RETRY_TIME, jiffies)) { + if (*last_frag == frag) + goto drop; + if (*last_frag + 1 != frag) + /* out-of-order fragment */ + goto drop; + *last_frag = frag; + } else + *last_seq = seq; + + *last_time = jiffies; + return 0; + + drop: + BUG_ON(!(fc & IEEE80211_FCTL_RETRY)); + return 1; +} + static void ipw_handle_mgmt_packet(struct ipw_priv *priv, struct ipw_rx_mem_buffer *rxb, struct ieee80211_rx_stats *stats) @@ -7481,7 +7929,10 @@ static void ipw_rx(struct ipw_priv *priv) break; case IEEE80211_FTYPE_DATA: - if (unlikely(!network_packet)) { + if (unlikely(!network_packet || + is_duplicate_packet(priv, + header))) + { IPW_DEBUG_DROP("Dropping: " MAC_FMT ", " MAC_FMT ", " @@ -7540,6 +7991,123 @@ static void ipw_rx(struct ipw_priv *priv) ipw_rx_queue_restock(priv); } +#define DEFAULT_RTS_THRESHOLD 2304U +#define MIN_RTS_THRESHOLD 1U +#define MAX_RTS_THRESHOLD 2304U +#define DEFAULT_BEACON_INTERVAL 100U +#define DEFAULT_SHORT_RETRY_LIMIT 7U +#define DEFAULT_LONG_RETRY_LIMIT 4U + +static int ipw_sw_reset(struct ipw_priv *priv, int init) +{ + int band, modulation; + int old_mode = priv->ieee->iw_mode; + + /* Initialize module parameter values here */ + priv->config = 0; + + /* We default to disabling the LED code as right now it causes + * too many systems to lock up... */ + if (!led) + priv->config |= CFG_NO_LED; + + if (associate) + priv->config |= CFG_ASSOCIATE; + else + IPW_DEBUG_INFO("Auto associate disabled.\n"); + + if (auto_create) + priv->config |= CFG_ADHOC_CREATE; + else + IPW_DEBUG_INFO("Auto adhoc creation disabled.\n"); + + if (disable) { + priv->status |= STATUS_RF_KILL_SW; + IPW_DEBUG_INFO("Radio disabled.\n"); + } + + if (channel != 0) { + priv->config |= CFG_STATIC_CHANNEL; + priv->channel = channel; + IPW_DEBUG_INFO("Bind to static channel %d\n", channel); + /* TODO: Validate that provided channel is in range */ + } +#ifdef CONFIG_IPW_QOS + ipw_qos_init(priv, qos_enable, qos_burst_enable, + burst_duration_CCK, burst_duration_OFDM); +#endif /* CONFIG_IPW_QOS */ + + switch (mode) { + case 1: + priv->ieee->iw_mode = IW_MODE_ADHOC; + priv->net_dev->type = ARPHRD_ETHER; + + break; +#ifdef CONFIG_IPW2200_MONITOR + case 2: + priv->ieee->iw_mode = IW_MODE_MONITOR; + priv->net_dev->type = ARPHRD_IEEE80211; + break; +#endif + default: + case 0: + priv->net_dev->type = ARPHRD_ETHER; + priv->ieee->iw_mode = IW_MODE_INFRA; + break; + } + + if (hwcrypto) { + priv->ieee->host_encrypt = 0; + priv->ieee->host_encrypt_msdu = 0; + priv->ieee->host_decrypt = 0; + } + IPW_DEBUG_INFO("Hardware crypto [%s]\n", hwcrypto ? "on" : "off"); + + if ((priv->pci_dev->device == 0x4223) || + (priv->pci_dev->device == 0x4224)) { + if (init) + printk(KERN_INFO DRV_NAME + ": Detected Intel PRO/Wireless 2915ABG Network " + "Connection\n"); + priv->ieee->abg_true = 1; + band = IEEE80211_52GHZ_BAND | IEEE80211_24GHZ_BAND; + modulation = IEEE80211_OFDM_MODULATION | + IEEE80211_CCK_MODULATION; + priv->adapter = IPW_2915ABG; + priv->ieee->mode = IEEE_A | IEEE_G | IEEE_B; + } else { + if (init) + printk(KERN_INFO DRV_NAME + ": Detected Intel PRO/Wireless 2200BG Network " + "Connection\n"); + + priv->ieee->abg_true = 0; + band = IEEE80211_24GHZ_BAND; + modulation = IEEE80211_OFDM_MODULATION | + IEEE80211_CCK_MODULATION; + priv->adapter = IPW_2200BG; + priv->ieee->mode = IEEE_G | IEEE_B; + } + + priv->ieee->freq_band = band; + priv->ieee->modulation = modulation; + + priv->rates_mask = IEEE80211_DEFAULT_RATES_MASK; + + priv->disassociate_threshold = IPW_MB_DISASSOCIATE_THRESHOLD_DEFAULT; + priv->roaming_threshold = IPW_MB_ROAMING_THRESHOLD_DEFAULT; + + priv->rts_threshold = DEFAULT_RTS_THRESHOLD; + priv->short_retry_limit = DEFAULT_SHORT_RETRY_LIMIT; + priv->long_retry_limit = DEFAULT_LONG_RETRY_LIMIT; + + /* If power management is turned on, default to AC mode */ + priv->power_mode = IPW_POWER_AC; + priv->tx_power = IPW_TX_POWER_DEFAULT; + + return old_mode == priv->ieee->mode; +} + /* * This file defines the Wireless Extension handlers. It does not * define any methods of hardware manipulation and relies on the @@ -7569,9 +8137,7 @@ static int ipw_wx_get_name(struct net_device *dev, } static int ipw_set_channel(struct ipw_priv *priv, u8 channel) -{ - int i; - +{ if (channel == 0) { IPW_DEBUG_INFO("Setting channel to ANY (0)\n"); priv->config &= ~CFG_STATIC_CHANNEL; @@ -7594,10 +8160,11 @@ static int ipw_set_channel(struct ipw_priv *priv, u8 channel) #ifdef CONFIG_IPW2200_MONITOR if (priv->ieee->iw_mode == IW_MODE_MONITOR) { + int i; if (priv->status & STATUS_SCANNING) { - IPW_DEBUG_SCAN("scan abort triggered due to " + IPW_DEBUG_SCAN("Scan abort triggered due to " "channel change.\n"); - queue_work(priv->workqueue, &priv->abort_scan); + ipw_abort_scan(priv); } for (i = 1000; i && (priv->status & STATUS_SCANNING); i--) @@ -7626,8 +8193,9 @@ static int ipw_wx_set_freq(struct net_device *dev, union iwreq_data *wrqu, char *extra) { struct ipw_priv *priv = ieee80211_priv(dev); + const struct ieee80211_geo *geo = ieee80211_get_geo(priv->ieee); struct iw_freq *fwrq = &wrqu->freq; - int ret = 0; + int ret = 0, i; u8 channel; if (fwrq->m == 0) { @@ -7637,7 +8205,6 @@ static int ipw_wx_set_freq(struct net_device *dev, up(&priv->sem); return ret; } - /* if setting by freq convert to channel */ if (fwrq->e == 1) { channel = ieee80211_freq_to_channel(priv->ieee, fwrq->m); @@ -7649,6 +8216,16 @@ static int ipw_wx_set_freq(struct net_device *dev, if (!ieee80211_is_valid_channel(priv->ieee, channel)) return -EINVAL; + if (priv->ieee->iw_mode == IW_MODE_ADHOC && priv->ieee->mode & IEEE_A) { + i = ieee80211_channel_to_index(priv->ieee, channel); + if (i == -1) + return -EINVAL; + if (geo->a[i].flags & IEEE80211_CH_PASSIVE_ONLY) { + IPW_DEBUG_WX("Invalid Ad-Hoc channel for 802.11a\n"); + return -EINVAL; + } + } + IPW_DEBUG_WX("SET Freq/Channel -> %d \n", fwrq->m); down(&priv->sem); ret = ipw_set_channel(priv, channel); @@ -7704,6 +8281,9 @@ static int ipw_wx_set_mode(struct net_device *dev, return 0; down(&priv->sem); + + ipw_sw_reset(priv, 0); + #ifdef CONFIG_IPW2200_MONITOR if (priv->ieee->iw_mode == IW_MODE_MONITOR) priv->net_dev->type = ARPHRD_ETHER; @@ -7712,17 +8292,9 @@ static int ipw_wx_set_mode(struct net_device *dev, priv->net_dev->type = ARPHRD_IEEE80211; #endif /* CONFIG_IPW2200_MONITOR */ -#ifdef CONFIG_PM /* Free the existing firmware and reset the fw_loaded * flag so ipw_load() will bring in the new firmawre */ - if (fw_loaded) - fw_loaded = 0; - - release_firmware(bootfw); - release_firmware(ucode); - release_firmware(firmware); - bootfw = ucode = firmware = NULL; -#endif + free_firmware(); priv->ieee->iw_mode = wrqu->mode; @@ -7743,13 +8315,6 @@ static int ipw_wx_get_mode(struct net_device *dev, return 0; } -#define DEFAULT_RTS_THRESHOLD 2304U -#define MIN_RTS_THRESHOLD 1U -#define MAX_RTS_THRESHOLD 2304U -#define DEFAULT_BEACON_INTERVAL 100U -#define DEFAULT_SHORT_RETRY_LIMIT 7U -#define DEFAULT_LONG_RETRY_LIMIT 4U - /* Values are in microsecond */ static const s32 timeout_duration[] = { 350000, @@ -7900,7 +8465,7 @@ static int ipw_wx_get_wap(struct net_device *dev, if (priv->config & CFG_STATIC_BSSID || priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { wrqu->ap_addr.sa_family = ARPHRD_ETHER; - memcpy(wrqu->ap_addr.sa_data, &priv->bssid, ETH_ALEN); + memcpy(wrqu->ap_addr.sa_data, priv->bssid, ETH_ALEN); } else memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN); @@ -7924,10 +8489,12 @@ static int ipw_wx_set_essid(struct net_device *dev, } if (length == 0) { IPW_DEBUG_WX("Setting ESSID to ANY\n"); - priv->config &= ~CFG_STATIC_ESSID; - if (!(priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING))) { + if ((priv->config & CFG_STATIC_ESSID) && + !(priv->status & (STATUS_ASSOCIATED | + STATUS_ASSOCIATING))) { IPW_DEBUG_ASSOC("Attempting to associate with new " "parameters.\n"); + priv->config &= ~CFG_STATIC_ESSID; ipw_associate(priv); } up(&priv->sem); @@ -8202,7 +8769,7 @@ static int ipw_wx_set_txpow(struct net_device *dev, } if ((wrqu->power.value > IPW_TX_POWER_MAX) || - (wrqu->power.value < -IPW_TX_POWER_MAX) || !wrqu->power.fixed) { + (wrqu->power.value < IPW_TX_POWER_MIN)) { up(&priv->sem); return -EINVAL; } @@ -8295,23 +8862,149 @@ static int ipw_wx_set_retry(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - IPW_DEBUG_WX("0x%p, 0x%p, 0x%p\n", dev, info, wrqu); - return -EOPNOTSUPP; + struct ipw_priv *priv = ieee80211_priv(dev); + + if (wrqu->retry.flags & IW_RETRY_LIFETIME || wrqu->retry.disabled) + return -EINVAL; + + if (!(wrqu->retry.flags & IW_RETRY_LIMIT)) + return 0; + + if (wrqu->retry.value < 0 || wrqu->retry.value > 255) + return -EINVAL; + + down(&priv->sem); + if (wrqu->retry.flags & IW_RETRY_MIN) + priv->short_retry_limit = (u8) wrqu->retry.value; + else if (wrqu->retry.flags & IW_RETRY_MAX) + priv->long_retry_limit = (u8) wrqu->retry.value; + else { + priv->short_retry_limit = (u8) wrqu->retry.value; + priv->long_retry_limit = (u8) wrqu->retry.value; + } + + ipw_send_retry_limit(priv, priv->short_retry_limit, + priv->long_retry_limit); + up(&priv->sem); + IPW_DEBUG_WX("SET retry limit -> short:%d long:%d\n", + priv->short_retry_limit, priv->long_retry_limit); + return 0; } static int ipw_wx_get_retry(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - IPW_DEBUG_WX("0x%p, 0x%p, 0x%p\n", dev, info, wrqu); - return -EOPNOTSUPP; + struct ipw_priv *priv = ieee80211_priv(dev); + + down(&priv->sem); + wrqu->retry.disabled = 0; + + if ((wrqu->retry.flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) { + up(&priv->sem); + return -EINVAL; + } + + if (wrqu->retry.flags & IW_RETRY_MAX) { + wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_MAX; + wrqu->retry.value = priv->long_retry_limit; + } else if (wrqu->retry.flags & IW_RETRY_MIN) { + wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_MIN; + wrqu->retry.value = priv->short_retry_limit; + } else { + wrqu->retry.flags = IW_RETRY_LIMIT; + wrqu->retry.value = priv->short_retry_limit; + } + up(&priv->sem); + + IPW_DEBUG_WX("GET retry -> %d \n", wrqu->retry.value); + + return 0; +} + +#if WIRELESS_EXT > 17 +static int ipw_request_direct_scan(struct ipw_priv *priv, char *essid, + int essid_len) +{ + struct ipw_scan_request_ext scan; + int err = 0, scan_type; + + down(&priv->sem); + + if (priv->status & STATUS_RF_KILL_MASK) { + IPW_DEBUG_HC("Aborting scan due to RF kill activation\n"); + priv->status |= STATUS_SCAN_PENDING; + goto done; + } + + IPW_DEBUG_HC("starting request direct scan!\n"); + + if (priv->status & (STATUS_SCANNING | STATUS_SCAN_ABORTING)) { + err = wait_event_interruptible(priv->wait_state, + !(priv-> + status & (STATUS_SCANNING | + STATUS_SCAN_ABORTING))); + if (err) { + IPW_DEBUG_HC("aborting direct scan"); + goto done; + } + } + memset(&scan, 0, sizeof(scan)); + + if (priv->config & CFG_SPEED_SCAN) + scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_SCAN] = + cpu_to_le16(30); + else + scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_SCAN] = + cpu_to_le16(20); + + scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN] = + cpu_to_le16(20); + scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] = cpu_to_le16(20); + scan.dwell_time[IPW_SCAN_ACTIVE_DIRECT_SCAN] = cpu_to_le16(20); + + scan.full_scan_index = cpu_to_le32(ieee80211_get_scans(priv->ieee)); + + err = ipw_send_ssid(priv, essid, essid_len); + if (err) { + IPW_DEBUG_HC("Attempt to send SSID command failed\n"); + goto done; + } + scan_type = IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN; + + ipw_add_scan_channels(priv, &scan, scan_type); + + err = ipw_send_scan_request_ext(priv, &scan); + if (err) { + IPW_DEBUG_HC("Sending scan command failed: %08X\n", err); + goto done; + } + + priv->status |= STATUS_SCANNING; + + done: + up(&priv->sem); + return err; } +#endif /* WIRELESS_EXT > 17 */ static int ipw_wx_set_scan(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { struct ipw_priv *priv = ieee80211_priv(dev); +#if WIRELESS_EXT > 17 + struct iw_scan_req *req = NULL; + if (wrqu->data.length + && wrqu->data.length == sizeof(struct iw_scan_req)) { + req = (struct iw_scan_req *)extra; + if (wrqu->data.flags & IW_SCAN_THIS_ESSID) { + ipw_request_direct_scan(priv, req->essid, + req->essid_len); + return 0; + } + } +#endif IPW_DEBUG_WX("Start scan\n"); queue_work(priv->workqueue, &priv->request_scan); @@ -8332,7 +9025,13 @@ static int ipw_wx_set_encode(struct net_device *dev, union iwreq_data *wrqu, char *key) { struct ipw_priv *priv = ieee80211_priv(dev); - return ieee80211_wx_set_encode(priv->ieee, info, wrqu, key); + int ret; + + down(&priv->sem); + ret = ieee80211_wx_set_encode(priv->ieee, info, wrqu, key); + up(&priv->sem); + + return ret; } static int ipw_wx_get_encode(struct net_device *dev, @@ -8665,110 +9364,6 @@ static int ipw_wx_reset(struct net_device *dev, return 0; } -static void ipw_sw_reset(struct ipw_priv *priv, int init) -{ - int band, modulation; - - /* Initialize module parameter values here */ - priv->config = 0; - - /* We default to disabling the LED code as right now it causes - * too many systems to lock up... */ - if (!led) - priv->config |= CFG_NO_LED; - - if (associate) - priv->config |= CFG_ASSOCIATE; - else - IPW_DEBUG_INFO("Auto associate disabled.\n"); - - if (auto_create) - priv->config |= CFG_ADHOC_CREATE; - else - IPW_DEBUG_INFO("Auto adhoc creation disabled.\n"); - - if (disable) { - priv->status |= STATUS_RF_KILL_SW; - IPW_DEBUG_INFO("Radio disabled.\n"); - } - - if (channel != 0) { - priv->config |= CFG_STATIC_CHANNEL; - priv->channel = channel; - IPW_DEBUG_INFO("Bind to static channel %d\n", channel); - /* TODO: Validate that provided channel is in range */ - } -#ifdef CONFIG_IPW_QOS - ipw_qos_init(priv, qos_enable, qos_burst_enable, - burst_duration_CCK, burst_duration_OFDM); -#endif /* CONFIG_IPW_QOS */ - - switch (mode) { - case 1: - priv->ieee->iw_mode = IW_MODE_ADHOC; - priv->net_dev->type = ARPHRD_ETHER; - - break; -#ifdef CONFIG_IPW2200_MONITOR - case 2: - priv->ieee->iw_mode = IW_MODE_MONITOR; - priv->net_dev->type = ARPHRD_IEEE80211; - break; -#endif - default: - case 0: - priv->net_dev->type = ARPHRD_ETHER; - priv->ieee->iw_mode = IW_MODE_INFRA; - break; - } - - if (hwcrypto) { - priv->ieee->host_encrypt = 0; - priv->ieee->host_decrypt = 0; - } - IPW_DEBUG_INFO("Hardware crypto [%s]\n", hwcrypto ? "on" : "off"); - - if ((priv->pci_dev->device == 0x4223) || - (priv->pci_dev->device == 0x4224)) { - if (init) - printk(KERN_INFO DRV_NAME - ": Detected Intel PRO/Wireless 2915ABG Network " - "Connection\n"); - priv->ieee->abg_true = 1; - band = IEEE80211_52GHZ_BAND | IEEE80211_24GHZ_BAND; - modulation = IEEE80211_OFDM_MODULATION | - IEEE80211_CCK_MODULATION; - priv->adapter = IPW_2915ABG; - priv->ieee->mode = IEEE_A | IEEE_G | IEEE_B; - } else { - if (init) - printk(KERN_INFO DRV_NAME - ": Detected Intel PRO/Wireless 2200BG Network " - "Connection\n"); - - priv->ieee->abg_true = 0; - band = IEEE80211_24GHZ_BAND; - modulation = IEEE80211_OFDM_MODULATION | - IEEE80211_CCK_MODULATION; - priv->adapter = IPW_2200BG; - priv->ieee->mode = IEEE_G | IEEE_B; - } - - priv->ieee->freq_band = band; - priv->ieee->modulation = modulation; - - priv->rates_mask = IEEE80211_DEFAULT_RATES_MASK; - - priv->missed_beacon_threshold = IPW_MB_DISASSOCIATE_THRESHOLD_DEFAULT; - priv->roaming_threshold = IPW_MB_ROAMING_THRESHOLD_DEFAULT; - - priv->rts_threshold = DEFAULT_RTS_THRESHOLD; - - /* If power management is turned on, default to AC mode */ - priv->power_mode = IPW_POWER_AC; - priv->tx_power = IPW_TX_POWER_DEFAULT; -} - static int ipw_wx_sw_reset(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) @@ -8779,12 +9374,17 @@ static int ipw_wx_sw_reset(struct net_device *dev, .flags = IW_ENCODE_DISABLED, }, }; + int ret; IPW_DEBUG_WX("SW_RESET\n"); down(&priv->sem); - ipw_sw_reset(priv, 0); + ret = ipw_sw_reset(priv, 0); + if (!ret) { + free_firmware(); + ipw_adapter_restart(priv); + } /* The SW reset bit might have been toggled on by the 'disable' * module parameter, so take appropriate action */ @@ -8842,6 +9442,15 @@ static iw_handler ipw_wx_handlers[] = { IW_IOCTL(SIOCGIWSPY) = iw_handler_get_spy, IW_IOCTL(SIOCSIWTHRSPY) = iw_handler_set_thrspy, IW_IOCTL(SIOCGIWTHRSPY) = iw_handler_get_thrspy, +#if WIRELESS_EXT > 17 + IW_IOCTL(SIOCSIWGENIE) = ipw_wx_set_genie, + IW_IOCTL(SIOCGIWGENIE) = ipw_wx_get_genie, + IW_IOCTL(SIOCSIWMLME) = ipw_wx_set_mlme, + IW_IOCTL(SIOCSIWAUTH) = ipw_wx_set_auth, + IW_IOCTL(SIOCGIWAUTH) = ipw_wx_get_auth, + IW_IOCTL(SIOCSIWENCODEEXT) = ipw_wx_set_encodeext, + IW_IOCTL(SIOCGIWENCODEEXT) = ipw_wx_get_encodeext, +#endif }; enum { @@ -8934,7 +9543,7 @@ static struct iw_statistics *ipw_get_wireless_stats(struct net_device *dev) wstats = &priv->wstats; /* if hw is disabled, then ipw_get_ordinal() can't be called. - * ipw2100_wx_wireless_stats seems to be called before fw is + * netdev->get_wireless_stats seems to be called before fw is * initialized. STATUS_ASSOCIATED will only be set if the hw is up * and associated; if not associcated, the values are all meaningless * anyway, so set them all to NULL and INVALID */ @@ -9036,8 +9645,7 @@ static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb, switch (priv->ieee->iw_mode) { case IW_MODE_ADHOC: hdr_len = IEEE80211_3ADDR_LEN; - unicast = !is_broadcast_ether_addr(hdr->addr1) && - !is_multicast_ether_addr(hdr->addr1); + unicast = !is_multicast_ether_addr(hdr->addr1); id = ipw_find_station(priv, hdr->addr1); if (id == IPW_INVALID_STATION) { id = ipw_add_station(priv, hdr->addr1); @@ -9052,8 +9660,7 @@ static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb, case IW_MODE_INFRA: default: - unicast = !is_broadcast_ether_addr(hdr->addr3) && - !is_multicast_ether_addr(hdr->addr3); + unicast = !is_multicast_ether_addr(hdr->addr3); hdr_len = IEEE80211_3ADDR_LEN; id = 0; break; @@ -9176,6 +9783,7 @@ static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb, tfd->u.data.chunk_len[i] = cpu_to_le16(remaining_bytes); for (j = i; j < txb->nr_frags; j++) { int size = txb->fragments[j]->len - hdr_len; + printk(KERN_INFO "Adding frag %d %d...\n", j, size); memcpy(skb_put(skb, size), @@ -9307,7 +9915,7 @@ static int ipw_ethtool_get_eeprom(struct net_device *dev, if (eeprom->offset + eeprom->len > IPW_EEPROM_IMAGE_SIZE) return -EINVAL; down(&p->sem); - memcpy(bytes, &((u8 *) p->eeprom)[eeprom->offset], eeprom->len); + memcpy(bytes, &p->eeprom[eeprom->offset], eeprom->len); up(&p->sem); return 0; } @@ -9321,7 +9929,7 @@ static int ipw_ethtool_set_eeprom(struct net_device *dev, if (eeprom->offset + eeprom->len > IPW_EEPROM_IMAGE_SIZE) return -EINVAL; down(&p->sem); - memcpy(&((u8 *) p->eeprom)[eeprom->offset], bytes, eeprom->len); + memcpy(&p->eeprom[eeprom->offset], bytes, eeprom->len); for (i = IPW_EEPROM_DATA; i < IPW_EEPROM_DATA + IPW_EEPROM_IMAGE_SIZE; i++) ipw_write8(p, i, p->eeprom[i]); @@ -9427,6 +10035,10 @@ static void ipw_bg_rf_kill(void *data) void ipw_link_up(struct ipw_priv *priv) { + priv->last_seq_num = -1; + priv->last_frag_num = -1; + priv->last_packet_time = 0; + netif_carrier_on(priv->net_dev); if (netif_queue_stopped(priv->net_dev)) { IPW_DEBUG_NOTIF("waking queue\n"); @@ -9470,8 +10082,10 @@ void ipw_link_down(struct ipw_priv *priv) ipw_reset_stats(priv); - /* Queue up another scan... */ - queue_work(priv->workqueue, &priv->request_scan); + if (!(priv->status & STATUS_EXIT_PENDING)) { + /* Queue up another scan... */ + queue_work(priv->workqueue, &priv->request_scan); + } } static void ipw_bg_link_down(void *data) @@ -9488,6 +10102,7 @@ static int ipw_setup_deferred_work(struct ipw_priv *priv) priv->workqueue = create_workqueue(DRV_NAME); init_waitqueue_head(&priv->wait_command_queue); + init_waitqueue_head(&priv->wait_state); INIT_WORK(&priv->adhoc_check, ipw_bg_adhoc_check, priv); INIT_WORK(&priv->associate, ipw_bg_associate, priv); @@ -9531,9 +10146,9 @@ static void shim__set_security(struct net_device *dev, { struct ipw_priv *priv = ieee80211_priv(dev); int i; - down(&priv->sem); for (i = 0; i < 4; i++) { if (sec->flags & (1 << i)) { + priv->ieee->sec.encode_alg[i] = sec->encode_alg[i]; priv->ieee->sec.key_sizes[i] = sec->key_sizes[i]; if (sec->key_sizes[i] == 0) priv->ieee->sec.flags &= ~(1 << i); @@ -9577,7 +10192,9 @@ static void shim__set_security(struct net_device *dev, else priv->capability &= ~CAP_PRIVACY_ON; } - priv->ieee->sec.encrypt = sec->encrypt; + + if (sec->flags & SEC_ENCRYPT) + priv->ieee->sec.encrypt = sec->encrypt; if (sec->flags & SEC_LEVEL && priv->ieee->sec.level != sec->level) { priv->ieee->sec.level = sec->level; @@ -9602,7 +10219,6 @@ static void shim__set_security(struct net_device *dev, ipw_disassociate(priv); } #endif - up(&priv->sem); } static int init_supported_rates(struct ipw_priv *priv, @@ -9707,6 +10323,24 @@ static int ipw_config(struct ipw_priv *priv) return -EIO; } +static const struct ieee80211_geo ipw_geo = { + "---", + .bg_channels = 11, + .bg = {{2412, 1}, {2417, 2}, {2422, 3}, + {2427, 4}, {2432, 5}, {2437, 6}, + {2442, 7}, {2447, 8}, {2452, 9}, + {2457, 10}, {2462, 11}}, + .a_channels = 8, + .a = {{5180, 36}, + {5200, 40}, + {5220, 44}, + {5240, 48}, + {5260, 52, IEEE80211_CH_PASSIVE_ONLY}, + {5280, 56, IEEE80211_CH_PASSIVE_ONLY}, + {5300, 60, IEEE80211_CH_PASSIVE_ONLY}, + {5320, 64, IEEE80211_CH_PASSIVE_ONLY}}, +}; + #define MAX_HW_RESTARTS 5 static int ipw_up(struct ipw_priv *priv) { @@ -9729,6 +10363,10 @@ static int ipw_up(struct ipw_priv *priv) eeprom_parse_mac(priv, priv->mac_addr); memcpy(priv->net_dev->dev_addr, priv->mac_addr, ETH_ALEN); + memcpy(priv->country, &priv->eeprom[EEPROM_COUNTRY_CODE], 3); + priv->country[3] = '\0'; + ieee80211_set_geo(priv->ieee, &ipw_geo); + if (priv->status & STATUS_RF_KILL_SW) { IPW_WARNING("Radio disabled by module parameter.\n"); return 0; @@ -9748,6 +10386,14 @@ static int ipw_up(struct ipw_priv *priv) ipw_led_radio_on(priv); priv->notif_missed_beacons = 0; priv->status |= STATUS_INIT; + + /* Set hardware WEP key if it is configured. */ + if ((priv->capability & CAP_PRIVACY_ON) && + (priv->ieee->sec.level == SEC_LEVEL_1) && + !(priv->ieee->host_encrypt || + priv->ieee->host_decrypt)) + ipw_set_hwcrypto_keys(priv); + return 0; } @@ -9846,6 +10492,7 @@ static void ipw_bg_down(void *data) up(&priv->sem); } +#if WIRELESS_EXT < 18 static int ipw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { struct iwreq *wrq = (struct iwreq *)rq; @@ -9861,6 +10508,7 @@ static int ipw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) return -EOPNOTSUPP; } +#endif /* Called by register_netdev() */ static int ipw_net_init(struct net_device *dev) @@ -9942,6 +10590,7 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) void __iomem *base; u32 length, val; struct ipw_priv *priv; + int i; net_dev = alloc_ieee80211(sizeof(struct ipw_priv)); if (net_dev == NULL) { @@ -9958,6 +10607,8 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ipw_debug_level = debug; #endif spin_lock_init(&priv->lock); + for (i = 0; i < IPW_IBSS_MAC_HASH_SIZE; i++) + INIT_LIST_HEAD(&priv->ibss_mac_hash[i]); init_MUTEX(&priv->sem); if (pci_enable_device(pdev)) { @@ -10035,7 +10686,9 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) net_dev->open = ipw_net_open; net_dev->stop = ipw_net_stop; net_dev->init = ipw_net_init; +#if WIRELESS_EXT < 18 net_dev->do_ioctl = ipw_ioctl; +#endif net_dev->get_stats = ipw_net_get_stats; net_dev->set_multicast_list = ipw_net_set_multicast_list; net_dev->set_mac_address = ipw_net_set_mac_address; @@ -10086,13 +10739,18 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) static void ipw_pci_remove(struct pci_dev *pdev) { struct ipw_priv *priv = pci_get_drvdata(pdev); + struct list_head *p, *q; + int i; if (!priv) return; down(&priv->sem); + + priv->status |= STATUS_EXIT_PENDING; ipw_down(priv); sysfs_remove_group(&pdev->dev.kobj, &ipw_attribute_group); + up(&priv->sem); unregister_netdev(priv->net_dev); @@ -10113,21 +10771,21 @@ static void ipw_pci_remove(struct pci_dev *pdev) destroy_workqueue(priv->workqueue); priv->workqueue = NULL; + /* Free MAC hash list for ADHOC */ + for (i = 0; i < IPW_IBSS_MAC_HASH_SIZE; i++) { + list_for_each_safe(p, q, &priv->ibss_mac_hash[i]) { + kfree(list_entry(p, struct ipw_ibss_seq, list)); + list_del(p); + } + } + free_irq(pdev->irq, priv); iounmap(priv->hw_base); pci_release_regions(pdev); pci_disable_device(pdev); pci_set_drvdata(pdev, NULL); free_ieee80211(priv->net_dev); - -#ifdef CONFIG_PM - if (fw_loaded) { - release_firmware(bootfw); - release_firmware(ucode); - release_firmware(firmware); - fw_loaded = 0; - } -#endif + free_firmware(); } #ifdef CONFIG_PM diff --git a/drivers/net/wireless/ipw2200.h b/drivers/net/wireless/ipw2200.h index 9dbd73a42094..915f469fa1d6 100644 --- a/drivers/net/wireless/ipw2200.h +++ b/drivers/net/wireless/ipw2200.h @@ -244,7 +244,7 @@ enum connection_manager_assoc_states { #define HOST_NOTIFICATION_S36_MEASUREMENT_REFUSED 31 #define HOST_NOTIFICATION_STATUS_BEACON_MISSING 1 -#define IPW_MB_DISASSOCIATE_THRESHOLD_DEFAULT 24 +#define IPW_MB_DISASSOCIATE_THRESHOLD_DEFAULT 9 #define IPW_MB_ROAMING_THRESHOLD_DEFAULT 8 #define IPW_REAL_RATE_RX_PACKET_THRESHOLD 300 @@ -699,8 +699,8 @@ struct ipw_rx_packet { } __attribute__ ((packed)); #define IPW_RX_NOTIFICATION_SIZE sizeof(struct ipw_rx_header) + 12 -#define IPW_RX_FRAME_SIZE sizeof(struct ipw_rx_header) + \ - sizeof(struct ipw_rx_frame) +#define IPW_RX_FRAME_SIZE (unsigned int)(sizeof(struct ipw_rx_header) + \ + sizeof(struct ipw_rx_frame)) struct ipw_rx_mem_buffer { dma_addr_t dma_addr; @@ -1029,6 +1029,7 @@ struct ipw_cmd { #define STATUS_SCAN_PENDING (1<<20) #define STATUS_SCANNING (1<<21) #define STATUS_SCAN_ABORTING (1<<22) +#define STATUS_SCAN_FORCED (1<<23) #define STATUS_LED_LINK_ON (1<<24) #define STATUS_LED_ACT_ON (1<<25) @@ -1074,6 +1075,15 @@ struct average { }; #define MAX_SPEED_SCAN 100 +#define IPW_IBSS_MAC_HASH_SIZE 31 + +struct ipw_ibss_seq { + u8 mac[ETH_ALEN]; + u16 seq_num; + u16 frag_num; + unsigned long packet_time; + struct list_head list; +}; struct ipw_priv { /* ieee device used by generic ieee processing code */ @@ -1115,7 +1125,7 @@ struct ipw_priv { int rx_bufs_min; /**< minimum number of bufs in Rx queue */ int rx_pend_max; /**< maximum pending buffers for one IRQ */ u32 hcmd_seq; /**< sequence number for hcmd */ - u32 missed_beacon_threshold; + u32 disassociate_threshold; u32 roaming_threshold; struct ipw_associate assoc_request; @@ -1156,6 +1166,8 @@ struct ipw_priv { u8 mac_addr[ETH_ALEN]; u8 num_stations; u8 stations[MAX_STATIONS][ETH_ALEN]; + u8 short_retry_limit; + u8 long_retry_limit; u32 notif_missed_beacons; @@ -1176,8 +1188,14 @@ struct ipw_priv { u8 speed_scan[MAX_SPEED_SCAN]; u8 speed_scan_pos; + u16 last_seq_num; + u16 last_frag_num; + unsigned long last_packet_time; + struct list_head ibss_mac_hash[IPW_IBSS_MAC_HASH_SIZE]; + /* eeprom */ u8 eeprom[0x100]; /* 256 bytes of eeprom */ + u8 country[4]; int eeprom_delay; struct iw_statistics wstats; -- cgit v1.2.2 From a2d73e60bb018da74ba508943c79c83659f3a883 Mon Sep 17 00:00:00 2001 From: Zhu Yi Date: Wed, 13 Jul 2005 12:24:51 -0500 Subject: Fix hardware encryption (both WEP and AES) doesn't work with fragmentation. Firmware sends received packets with double sized ICV/MIC. Signed-off-by: James Ketrenos --- drivers/net/wireless/ipw2200.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 1b6f0277a3e9..8f7e9ac37f86 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -7587,7 +7587,10 @@ static void ipw_rebuild_decrypted_skb(struct ipw_priv *priv, memmove(skb->data + IEEE80211_3ADDR_LEN, skb->data + IEEE80211_3ADDR_LEN + 8, skb->len - IEEE80211_3ADDR_LEN - 8); - skb_trim(skb, skb->len - 8); /* MIC */ + if (fc & IEEE80211_FCTL_MOREFRAGS) + skb_trim(skb, skb->len - 16); /* 2*MIC */ + else + skb_trim(skb, skb->len - 8); /* MIC */ break; case SEC_LEVEL_2: break; @@ -7596,7 +7599,10 @@ static void ipw_rebuild_decrypted_skb(struct ipw_priv *priv, memmove(skb->data + IEEE80211_3ADDR_LEN, skb->data + IEEE80211_3ADDR_LEN + 4, skb->len - IEEE80211_3ADDR_LEN - 4); - skb_trim(skb, skb->len - 4); /* ICV */ + if (fc & IEEE80211_FCTL_MOREFRAGS) + skb_trim(skb, skb->len - 8); /* 2*ICV */ + else + skb_trim(skb, skb->len - 4); /* ICV */ break; case SEC_LEVEL_0: break; -- cgit v1.2.2 From f57ce7ce9c7498fe9c4090aaf389c89f3bd70f7e Mon Sep 17 00:00:00 2001 From: Zhu Yi Date: Wed, 13 Jul 2005 12:22:15 -0500 Subject: Fix is_duplicate_packet() bug for fragmentation number setting. Signed-off-by: James Ketrenos --- drivers/net/wireless/ipw2200.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 8f7e9ac37f86..93ed8718fd6b 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -7754,10 +7754,10 @@ static inline int is_duplicate_packet(struct ipw_priv *priv, if (*last_frag + 1 != frag) /* out-of-order fragment */ goto drop; - *last_frag = frag; } else *last_seq = seq; + *last_frag = frag; *last_time = jiffies; return 0; -- cgit v1.2.2 From d8bad6df045249cd1cff6a0d167c8f1b9caade7e Mon Sep 17 00:00:00 2001 From: Zhu Yi Date: Wed, 13 Jul 2005 12:25:38 -0500 Subject: [bug 667] Fix the notorious "No space for Tx" bug. We send SYSTEM_CONFIG command after the TGI_KEY command if hardware encryption is enabled. It sometimes causes a firmware stall (firmware doesn't respond to any request) and finally bungs up the Tx send queue. The solution is to send SYSTEM_CONFIG command in the post association stage from a workqueue. Signed-off-by: James Ketrenos --- drivers/net/wireless/ipw2200.c | 46 +++++++++++++++++++++--------------------- drivers/net/wireless/ipw2200.h | 1 + 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 93ed8718fd6b..f3048f8e8238 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -3589,6 +3589,12 @@ static void ipw_bg_disassociate(void *data) up(&priv->sem); } +static void ipw_system_config(void *data) +{ + struct ipw_priv *priv = data; + ipw_send_system_config(priv, &priv->sys_config); +} + struct ipw_status_code { u16 status; const char *reason; @@ -4060,6 +4066,8 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, priv->status &= ~STATUS_ASSOCIATING; priv->status |= STATUS_ASSOCIATED; + queue_work(priv->workqueue, + &priv->system_config); #ifdef CONFIG_IPW_QOS #define IPW_GET_PACKET_STYPE(x) WLAN_FC_GET_STYPE( \ @@ -5553,45 +5561,36 @@ static void ipw_set_hwcrypto_keys(struct ipw_priv *priv) { switch (priv->ieee->sec.level) { case SEC_LEVEL_3: - if (!(priv->ieee->sec.flags & SEC_ACTIVE_KEY)) - break; + if (priv->ieee->sec.flags & SEC_ACTIVE_KEY) + ipw_send_tgi_tx_key(priv, + DCT_FLAG_EXT_SECURITY_CCM, + priv->ieee->sec.active_key); - ipw_send_tgi_tx_key(priv, DCT_FLAG_EXT_SECURITY_CCM, - priv->ieee->sec.active_key); ipw_send_wep_keys(priv, DCW_WEP_KEY_SEC_TYPE_CCM); - priv->sys_config.disable_unicast_decryption = 0; priv->sys_config.disable_multicast_decryption = 0; priv->ieee->host_decrypt = 0; - if (ipw_send_system_config(priv, &priv->sys_config)) - IPW_ERROR("ipw_send_system_config failed\n"); - break; case SEC_LEVEL_2: - if (!(priv->ieee->sec.flags & SEC_ACTIVE_KEY)) - break; - - ipw_send_tgi_tx_key(priv, DCT_FLAG_EXT_SECURITY_TKIP, - priv->ieee->sec.active_key); + if (priv->ieee->sec.flags & SEC_ACTIVE_KEY) + ipw_send_tgi_tx_key(priv, + DCT_FLAG_EXT_SECURITY_TKIP, + priv->ieee->sec.active_key); priv->sys_config.disable_unicast_decryption = 1; priv->sys_config.disable_multicast_decryption = 1; priv->ieee->host_decrypt = 1; - if (ipw_send_system_config(priv, &priv->sys_config)) - IPW_ERROR("ipw_send_system_config failed\n"); - break; case SEC_LEVEL_1: ipw_send_wep_keys(priv, DCW_WEP_KEY_SEC_TYPE_WEP); - priv->sys_config.disable_unicast_decryption = 0; priv->sys_config.disable_multicast_decryption = 0; priv->ieee->host_decrypt = 0; - if (ipw_send_system_config(priv, &priv->sys_config)) - IPW_ERROR("ipw_send_system_config failed\n"); - break; case SEC_LEVEL_0: + priv->sys_config.disable_unicast_decryption = 1; + priv->sys_config.disable_multicast_decryption = 1; + break; default: break; } @@ -10113,6 +10112,7 @@ static int ipw_setup_deferred_work(struct ipw_priv *priv) INIT_WORK(&priv->adhoc_check, ipw_bg_adhoc_check, priv); INIT_WORK(&priv->associate, ipw_bg_associate, priv); INIT_WORK(&priv->disassociate, ipw_bg_disassociate, priv); + INIT_WORK(&priv->system_config, ipw_system_config, priv); INIT_WORK(&priv->rx_replenish, ipw_bg_rx_queue_replenish, priv); INIT_WORK(&priv->adapter_restart, ipw_bg_adapter_restart, priv); INIT_WORK(&priv->rf_kill, ipw_bg_rf_kill, priv); @@ -10206,10 +10206,10 @@ static void shim__set_security(struct net_device *dev, priv->ieee->sec.level = sec->level; priv->ieee->sec.flags |= SEC_LEVEL; priv->status |= STATUS_SECURITY_UPDATED; - } - if (!priv->ieee->host_encrypt) - ipw_set_hwcrypto_keys(priv); + if (!priv->ieee->host_encrypt && (sec->flags & SEC_ENCRYPT)) + ipw_set_hwcrypto_keys(priv); + } /* To match current functionality of ipw2100 (which works well w/ * various supplicants, we don't force a disassociate if the diff --git a/drivers/net/wireless/ipw2200.h b/drivers/net/wireless/ipw2200.h index 915f469fa1d6..28667d3c946a 100644 --- a/drivers/net/wireless/ipw2200.h +++ b/drivers/net/wireless/ipw2200.h @@ -1205,6 +1205,7 @@ struct ipw_priv { struct work_struct adhoc_check; struct work_struct associate; struct work_struct disassociate; + struct work_struct system_config; struct work_struct rx_replenish; struct work_struct request_scan; struct work_struct adapter_restart; -- cgit v1.2.2 From 8400a1ceb445f2ace4b8d3c35c181b2b416a81ce Mon Sep 17 00:00:00 2001 From: Liu Hong Date: Wed, 13 Jul 2005 12:27:17 -0500 Subject: [Bug 637] Set tx power for A band. It uses the ieee80211-geo info to set the tx power of the a/b/g band. Signed-off-by: James Ketrenos --- drivers/net/wireless/ipw2200.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index f3048f8e8238..0923038ca788 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -8756,6 +8756,7 @@ static int ipw_wx_set_txpow(struct net_device *dev, union iwreq_data *wrqu, char *extra) { struct ipw_priv *priv = ieee80211_priv(dev); + const struct ieee80211_geo *geo = ieee80211_get_geo(priv->ieee); struct ipw_tx_power tx_power; int i; @@ -8785,10 +8786,15 @@ static int ipw_wx_set_txpow(struct net_device *dev, /* configure device for 'G' band */ tx_power.ieee_mode = IPW_G_MODE; - tx_power.num_channels = 11; - for (i = 0; i < 11; i++) { + tx_power.num_channels = geo->bg_channels; + for (i = 0; i < geo->bg_channels; i++) { + int max_power = geo->bg[i].max_power; + tx_power.channels_tx_power[i].channel_number = i + 1; - tx_power.channels_tx_power[i].tx_power = priv->tx_power; + if (max_power != 0 && priv->tx_power > max_power) + tx_power.channels_tx_power[i].tx_power = max_power; + else + tx_power.channels_tx_power[i].tx_power = priv->tx_power; } if (ipw_send_tx_power(priv, &tx_power)) goto error; @@ -8798,6 +8804,25 @@ static int ipw_wx_set_txpow(struct net_device *dev, if (ipw_send_tx_power(priv, &tx_power)) goto error; + /* configure device to also handle 'A' band */ + if (priv->ieee->abg_true) { + tx_power.ieee_mode = IPW_A_MODE; + tx_power.num_channels = geo->a_channels; + for (i = 0; i < geo->a_channels; i++) { + int max_power = geo->a[i].max_power; + + tx_power.channels_tx_power[i].channel_number = i + 1; + if (max_power != 0 && priv->tx_power > max_power) + tx_power.channels_tx_power[i].tx_power = + max_power; + else + tx_power.channels_tx_power[i].tx_power = + priv->tx_power; + } + if (ipw_send_tx_power(priv, &tx_power)) + goto error; + } + up(&priv->sem); return 0; -- cgit v1.2.2 From d2021cb4e28c512c395a439d65556c260b94e47e Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Thu, 14 Jul 2005 10:35:05 -0500 Subject: Changed default # of missed beacons to miss before disassociation to 24 (vs. 9 which is too low in most environments) Signed-off-by: James Ketrenos --- drivers/net/wireless/ipw2200.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/ipw2200.h b/drivers/net/wireless/ipw2200.h index 28667d3c946a..9bf8aa427d8c 100644 --- a/drivers/net/wireless/ipw2200.h +++ b/drivers/net/wireless/ipw2200.h @@ -244,7 +244,7 @@ enum connection_manager_assoc_states { #define HOST_NOTIFICATION_S36_MEASUREMENT_REFUSED 31 #define HOST_NOTIFICATION_STATUS_BEACON_MISSING 1 -#define IPW_MB_DISASSOCIATE_THRESHOLD_DEFAULT 9 +#define IPW_MB_DISASSOCIATE_THRESHOLD_DEFAULT 24 #define IPW_MB_ROAMING_THRESHOLD_DEFAULT 8 #define IPW_REAL_RATE_RX_PACKET_THRESHOLD 300 -- cgit v1.2.2 From 227d2dc1f109e3348564320cf42fc56770428ed3 Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Thu, 28 Jul 2005 16:25:55 -0500 Subject: Updated to support ieee80211 callback to is_queue_full for 802.11e support. Signed-off-by: James Ketrenos --- drivers/net/wireless/ipw2200.c | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 0923038ca788..3b3a4a077c0e 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -9654,8 +9654,8 @@ modify to send one tfd per fragment instead of using chunking. otherwise we need to heavily modify the ieee80211_skb_to_txb. */ -static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb, - int pri) +static inline int ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb, + int pri) { struct ieee80211_hdr_3addr *hdr = (struct ieee80211_hdr_3addr *) txb->fragments[0]->data; @@ -9672,6 +9672,11 @@ static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb, u16 remaining_bytes; int fc; + /* If there isn't room in the queue, we return busy and let the + * network stack requeue the packet for us */ + if (ipw_queue_space(q) < q->high_mark) + return NETDEV_TX_BUSY; + switch (priv->ieee->iw_mode) { case IW_MODE_ADHOC: hdr_len = IEEE80211_3ADDR_LEN; @@ -9837,14 +9842,28 @@ static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb, q->first_empty = ipw_queue_inc_wrap(q->first_empty, q->n_bd); ipw_write32(priv, q->reg_w, q->first_empty); - if (ipw_queue_space(q) < q->high_mark) - netif_stop_queue(priv->net_dev); - - return; + return NETDEV_TX_OK; drop: IPW_DEBUG_DROP("Silently dropping Tx packet.\n"); ieee80211_txb_free(txb); + return NETDEV_TX_OK; +} + +static int ipw_net_is_queue_full(struct net_device *dev, int pri) +{ + struct ipw_priv *priv = ieee80211_priv(dev); +#ifdef CONFIG_IPW_QOS + int tx_id = ipw_get_tx_queue_number(priv, pri); + struct clx2_tx_queue *txq = &priv->txq[tx_id]; +#else + struct clx2_tx_queue *txq = &priv->txq[0]; +#endif /* CONFIG_IPW_QOS */ + + if (ipw_queue_space(&txq->q) < txq->q.high_mark) + return 1; + + return 0; } static int ipw_net_hard_start_xmit(struct ieee80211_txb *txb, @@ -9852,6 +9871,7 @@ static int ipw_net_hard_start_xmit(struct ieee80211_txb *txb, { struct ipw_priv *priv = ieee80211_priv(dev); unsigned long flags; + int ret; IPW_DEBUG_TX("dev->xmit(%d bytes)\n", txb->payload_size); spin_lock_irqsave(&priv->lock, flags); @@ -9863,11 +9883,12 @@ static int ipw_net_hard_start_xmit(struct ieee80211_txb *txb, goto fail_unlock; } - ipw_tx_skb(priv, txb, pri); - __ipw_led_activity_on(priv); + ret = ipw_tx_skb(priv, txb, pri); + if (ret == NETDEV_TX_OK) + __ipw_led_activity_on(priv); spin_unlock_irqrestore(&priv->lock, flags); - return 0; + return ret; fail_unlock: spin_unlock_irqrestore(&priv->lock, flags); @@ -10706,6 +10727,7 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) priv->ieee->hard_start_xmit = ipw_net_hard_start_xmit; priv->ieee->set_security = shim__set_security; + priv->ieee->is_queue_full = ipw_net_is_queue_full; #ifdef CONFIG_IPW_QOS priv->ieee->handle_management_frame = ipw_handle_management_frame; -- cgit v1.2.2 From 2b184d5b5401bf87036cd0c2a0242fa5320129d7 Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Wed, 3 Aug 2005 20:33:14 -0500 Subject: Fixed some compiler issues if CONFIG_IPW2200_QOS is enabled. Updated a copyright date. Signed-off-by: James Ketrenos --- drivers/net/wireless/ipw2200.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 3b3a4a077c0e..073721f10577 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -34,7 +34,7 @@ #define IPW2200_VERSION "1.0.5" #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2200/2915 Network Driver" -#define DRV_COPYRIGHT "Copyright(c) 2003-2004 Intel Corporation" +#define DRV_COPYRIGHT "Copyright(c) 2003-2005 Intel Corporation" #define DRV_VERSION IPW2200_VERSION #define ETH_P_80211_STATS (ETH_P_80211_RAW + 1) @@ -4077,7 +4077,7 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, == IEEE80211_STYPE_ASSOC_RESP)) { if ((sizeof (struct - ieee80211_assoc_response_frame) + ieee80211_assoc_response) <= notif->size) && (notif->size <= 2314)) { struct @@ -4095,7 +4095,7 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, ieee80211_rx_mgt(priv-> ieee, (struct - ieee80211_hdr + ieee80211_hdr_4addr *) ¬if->u.raw, &stats); } @@ -7154,9 +7154,8 @@ static void ipw_bg_qos_activate(void *data) /* * Handler for probe responce and beacon frame */ -static int ipw_handle_management_frame(struct net_device *dev, - struct ieee80211_network *network, - u16 type) +static int ipw_handle_management(struct net_device *dev, + struct ieee80211_network *network, u16 type) { struct ipw_priv *priv = ieee80211_priv(dev); int active_network; @@ -10730,7 +10729,7 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) priv->ieee->is_queue_full = ipw_net_is_queue_full; #ifdef CONFIG_IPW_QOS - priv->ieee->handle_management_frame = ipw_handle_management_frame; + priv->ieee->handle_management = ipw_handle_management; #endif /* CONFIG_IPW_QOS */ priv->ieee->perfect_rssi = -20; -- cgit v1.2.2 From 4f36f8088ada6c63719a970616078887f82e226c Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Wed, 3 Aug 2005 20:36:56 -0500 Subject: Added more useful geography encoding so people's experience with iwconfig matches what their hardware can actually do in regard to supported channel maps, etc. Signed-off-by: James Ketrenos --- drivers/net/wireless/ipw2200.c | 279 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 259 insertions(+), 20 deletions(-) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 073721f10577..6e79ae24ee1c 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -10374,28 +10374,256 @@ static int ipw_config(struct ipw_priv *priv) return -EIO; } -static const struct ieee80211_geo ipw_geo = { - "---", - .bg_channels = 11, - .bg = {{2412, 1}, {2417, 2}, {2422, 3}, - {2427, 4}, {2432, 5}, {2437, 6}, - {2442, 7}, {2447, 8}, {2452, 9}, - {2457, 10}, {2462, 11}}, - .a_channels = 8, - .a = {{5180, 36}, - {5200, 40}, - {5220, 44}, - {5240, 48}, - {5260, 52, IEEE80211_CH_PASSIVE_ONLY}, - {5280, 56, IEEE80211_CH_PASSIVE_ONLY}, - {5300, 60, IEEE80211_CH_PASSIVE_ONLY}, - {5320, 64, IEEE80211_CH_PASSIVE_ONLY}}, +/* + * NOTE: + * + * These tables have been tested in conjunction with the + * Intel PRO/Wireless 2200BG and 2915ABG Network Connection Adapters. + * + * Altering this values, using it on other hardware, or in geographies + * not intended for resale of the above mentioned Intel adapters has + * not been tested. + * + */ +static const struct ieee80211_geo ipw_geos[] = { + { /* Restricted */ + "---", + .bg_channels = 11, + .bg = {{2412, 1}, {2417, 2}, {2422, 3}, + {2427, 4}, {2432, 5}, {2437, 6}, + {2442, 7}, {2447, 8}, {2452, 9}, + {2457, 10}, {2462, 11}}, + }, + + { /* Custom US/Canada */ + "ZZF", + .bg_channels = 11, + .bg = {{2412, 1}, {2417, 2}, {2422, 3}, + {2427, 4}, {2432, 5}, {2437, 6}, + {2442, 7}, {2447, 8}, {2452, 9}, + {2457, 10}, {2462, 11}}, + .a_channels = 8, + .a = {{5180, 36}, + {5200, 40}, + {5220, 44}, + {5240, 48}, + {5260, 52, IEEE80211_CH_PASSIVE_ONLY}, + {5280, 56, IEEE80211_CH_PASSIVE_ONLY}, + {5300, 60, IEEE80211_CH_PASSIVE_ONLY}, + {5320, 64, IEEE80211_CH_PASSIVE_ONLY}}, + }, + + { /* Rest of World */ + "ZZD", + .bg_channels = 13, + .bg = {{2412, 1}, {2417, 2}, {2422, 3}, + {2427, 4}, {2432, 5}, {2437, 6}, + {2442, 7}, {2447, 8}, {2452, 9}, + {2457, 10}, {2462, 11}, {2467, 12}, + {2472, 13}}, + }, + + { /* Custom USA & Europe & High */ + "ZZA", + .bg_channels = 11, + .bg = {{2412, 1}, {2417, 2}, {2422, 3}, + {2427, 4}, {2432, 5}, {2437, 6}, + {2442, 7}, {2447, 8}, {2452, 9}, + {2457, 10}, {2462, 11}}, + .a_channels = 13, + .a = {{5180, 36}, + {5200, 40}, + {5220, 44}, + {5240, 48}, + {5260, 52, IEEE80211_CH_PASSIVE_ONLY}, + {5280, 56, IEEE80211_CH_PASSIVE_ONLY}, + {5300, 60, IEEE80211_CH_PASSIVE_ONLY}, + {5320, 64, IEEE80211_CH_PASSIVE_ONLY}, + {5745, 149}, + {5765, 153}, + {5785, 157}, + {5805, 161}, + {5825, 165}}, + }, + + { /* Custom NA & Europe */ + "ZZB", + .bg_channels = 11, + .bg = {{2412, 1}, {2417, 2}, {2422, 3}, + {2427, 4}, {2432, 5}, {2437, 6}, + {2442, 7}, {2447, 8}, {2452, 9}, + {2457, 10}, {2462, 11}}, + .a_channels = 13, + .a = {{5180, 36}, + {5200, 40}, + {5220, 44}, + {5240, 48}, + {5260, 52, IEEE80211_CH_PASSIVE_ONLY}, + {5280, 56, IEEE80211_CH_PASSIVE_ONLY}, + {5300, 60, IEEE80211_CH_PASSIVE_ONLY}, + {5320, 64, IEEE80211_CH_PASSIVE_ONLY}, + {5745, 149, IEEE80211_CH_PASSIVE_ONLY}, + {5765, 153, IEEE80211_CH_PASSIVE_ONLY}, + {5785, 157, IEEE80211_CH_PASSIVE_ONLY}, + {5805, 161, IEEE80211_CH_PASSIVE_ONLY}, + {5825, 165, IEEE80211_CH_PASSIVE_ONLY}}, + }, + + { /* Custom Japan */ + "ZZC", + .bg_channels = 11, + .bg = {{2412, 1}, {2417, 2}, {2422, 3}, + {2427, 4}, {2432, 5}, {2437, 6}, + {2442, 7}, {2447, 8}, {2452, 9}, + {2457, 10}, {2462, 11}}, + .a_channels = 4, + .a = {{5170, 34}, {5190, 38}, + {5210, 42}, {5230, 46}}, + }, + + { /* Custom */ + "ZZM", + .bg_channels = 11, + .bg = {{2412, 1}, {2417, 2}, {2422, 3}, + {2427, 4}, {2432, 5}, {2437, 6}, + {2442, 7}, {2447, 8}, {2452, 9}, + {2457, 10}, {2462, 11}}, + }, + + { /* Europe */ + "ZZE", + .bg_channels = 13, + .bg = {{2412, 1}, {2417, 2}, {2422, 3}, + {2427, 4}, {2432, 5}, {2437, 6}, + {2442, 7}, {2447, 8}, {2452, 9}, + {2457, 10}, {2462, 11}, {2467, 12}, + {2472, 13}}, + .a_channels = 19, + .a = {{5180, 36}, + {5200, 40}, + {5220, 44}, + {5240, 48}, + {5260, 52, IEEE80211_CH_PASSIVE_ONLY}, + {5280, 56, IEEE80211_CH_PASSIVE_ONLY}, + {5300, 60, IEEE80211_CH_PASSIVE_ONLY}, + {5320, 64, IEEE80211_CH_PASSIVE_ONLY}, + {5500, 100, IEEE80211_CH_PASSIVE_ONLY}, + {5520, 104, IEEE80211_CH_PASSIVE_ONLY}, + {5540, 108, IEEE80211_CH_PASSIVE_ONLY}, + {5560, 112, IEEE80211_CH_PASSIVE_ONLY}, + {5580, 116, IEEE80211_CH_PASSIVE_ONLY}, + {5600, 120, IEEE80211_CH_PASSIVE_ONLY}, + {5620, 124, IEEE80211_CH_PASSIVE_ONLY}, + {5640, 128, IEEE80211_CH_PASSIVE_ONLY}, + {5660, 132, IEEE80211_CH_PASSIVE_ONLY}, + {5680, 136, IEEE80211_CH_PASSIVE_ONLY}, + {5700, 140, IEEE80211_CH_PASSIVE_ONLY}}, + }, + + { /* Custom Japan */ + "ZZJ", + .bg_channels = 14, + .bg = {{2412, 1}, {2417, 2}, {2422, 3}, + {2427, 4}, {2432, 5}, {2437, 6}, + {2442, 7}, {2447, 8}, {2452, 9}, + {2457, 10}, {2462, 11}, {2467, 12}, + {2472, 13}, {2484, 14, IEEE80211_CH_B_ONLY}}, + .a_channels = 4, + .a = {{5170, 34}, {5190, 38}, + {5210, 42}, {5230, 46}}, + }, + + { /* High Band */ + "ZZH", + .bg_channels = 13, + .bg = {{2412, 1}, {2417, 2}, {2422, 3}, + {2427, 4}, {2432, 5}, {2437, 6}, + {2442, 7}, {2447, 8}, {2452, 9}, + {2457, 10}, {2462, 11}, + {2467, 12, IEEE80211_CH_PASSIVE_ONLY}, + {2472, 13, IEEE80211_CH_PASSIVE_ONLY}}, + .a_channels = 4, + .a = {{5745, 149}, {5765, 153}, + {5785, 157}, {5805, 161}}, + }, + + { /* Custom Europe */ + "ZZG", + .bg_channels = 13, + .bg = {{2412, 1}, {2417, 2}, {2422, 3}, + {2427, 4}, {2432, 5}, {2437, 6}, + {2442, 7}, {2447, 8}, {2452, 9}, + {2457, 10}, {2462, 11}, + {2467, 12}, {2472, 13}}, + .a_channels = 4, + .a = {{5180, 36}, {5200, 40}, + {5220, 44}, {5240, 48}}, + }, + + { /* Europe */ + "ZZK", + .bg_channels = 13, + .bg = {{2412, 1}, {2417, 2}, {2422, 3}, + {2427, 4}, {2432, 5}, {2437, 6}, + {2442, 7}, {2447, 8}, {2452, 9}, + {2457, 10}, {2462, 11}, + {2467, 12, IEEE80211_CH_PASSIVE_ONLY}, + {2472, 13, IEEE80211_CH_PASSIVE_ONLY}}, + .a_channels = 24, + .a = {{5180, 36, IEEE80211_CH_PASSIVE_ONLY}, + {5200, 40, IEEE80211_CH_PASSIVE_ONLY}, + {5220, 44, IEEE80211_CH_PASSIVE_ONLY}, + {5240, 48, IEEE80211_CH_PASSIVE_ONLY}, + {5260, 52, IEEE80211_CH_PASSIVE_ONLY}, + {5280, 56, IEEE80211_CH_PASSIVE_ONLY}, + {5300, 60, IEEE80211_CH_PASSIVE_ONLY}, + {5320, 64, IEEE80211_CH_PASSIVE_ONLY}, + {5500, 100, IEEE80211_CH_PASSIVE_ONLY}, + {5520, 104, IEEE80211_CH_PASSIVE_ONLY}, + {5540, 108, IEEE80211_CH_PASSIVE_ONLY}, + {5560, 112, IEEE80211_CH_PASSIVE_ONLY}, + {5580, 116, IEEE80211_CH_PASSIVE_ONLY}, + {5600, 120, IEEE80211_CH_PASSIVE_ONLY}, + {5620, 124, IEEE80211_CH_PASSIVE_ONLY}, + {5640, 128, IEEE80211_CH_PASSIVE_ONLY}, + {5660, 132, IEEE80211_CH_PASSIVE_ONLY}, + {5680, 136, IEEE80211_CH_PASSIVE_ONLY}, + {5700, 140, IEEE80211_CH_PASSIVE_ONLY}, + {5745, 149, IEEE80211_CH_PASSIVE_ONLY}, + {5765, 153, IEEE80211_CH_PASSIVE_ONLY}, + {5785, 157, IEEE80211_CH_PASSIVE_ONLY}, + {5805, 161, IEEE80211_CH_PASSIVE_ONLY}, + {5825, 165, IEEE80211_CH_PASSIVE_ONLY}}, + }, + + { /* Europe */ + "ZZL", + .bg_channels = 11, + .bg = {{2412, 1}, {2417, 2}, {2422, 3}, + {2427, 4}, {2432, 5}, {2437, 6}, + {2442, 7}, {2447, 8}, {2452, 9}, + {2457, 10}, {2462, 11}}, + .a_channels = 13, + .a = {{5180, 36, IEEE80211_CH_PASSIVE_ONLY}, + {5200, 40, IEEE80211_CH_PASSIVE_ONLY}, + {5220, 44, IEEE80211_CH_PASSIVE_ONLY}, + {5240, 48, IEEE80211_CH_PASSIVE_ONLY}, + {5260, 52, IEEE80211_CH_PASSIVE_ONLY}, + {5280, 56, IEEE80211_CH_PASSIVE_ONLY}, + {5300, 60, IEEE80211_CH_PASSIVE_ONLY}, + {5320, 64, IEEE80211_CH_PASSIVE_ONLY}, + {5745, 149, IEEE80211_CH_PASSIVE_ONLY}, + {5765, 153, IEEE80211_CH_PASSIVE_ONLY}, + {5785, 157, IEEE80211_CH_PASSIVE_ONLY}, + {5805, 161, IEEE80211_CH_PASSIVE_ONLY}, + {5825, 165, IEEE80211_CH_PASSIVE_ONLY}}, + } }; #define MAX_HW_RESTARTS 5 static int ipw_up(struct ipw_priv *priv) { - int rc, i; + int rc, i, j; if (priv->status & STATUS_EXIT_PENDING) return -EIO; @@ -10414,9 +10642,20 @@ static int ipw_up(struct ipw_priv *priv) eeprom_parse_mac(priv, priv->mac_addr); memcpy(priv->net_dev->dev_addr, priv->mac_addr, ETH_ALEN); - memcpy(priv->country, &priv->eeprom[EEPROM_COUNTRY_CODE], 3); - priv->country[3] = '\0'; - ieee80211_set_geo(priv->ieee, &ipw_geo); + for (j = 0; j < ARRAY_SIZE(ipw_geos); j++) { + if (!memcmp(&priv->eeprom[EEPROM_COUNTRY_CODE], + ipw_geos[j].name, 3)) + break; + } + if (j == ARRAY_SIZE(ipw_geos)) + j = 0; + if (ieee80211_set_geo(priv->ieee, &ipw_geos[j])) { + IPW_WARNING("Could not set geography."); + return 0; + } + + IPW_DEBUG_INFO("Geography %03d [%s] detected.\n", + j, priv->ieee->geo.name); if (priv->status & STATUS_RF_KILL_SW) { IPW_WARNING("Radio disabled by module parameter.\n"); -- cgit v1.2.2 From 87b016cb64b267a6f791494a4cfd84e84e022ebb Mon Sep 17 00:00:00 2001 From: Zhu Yi Date: Fri, 5 Aug 2005 17:17:35 +0800 Subject: Workaround kernel BUG_ON panic caused by unexpected duplicate packets. Signed-off-by: Zhu Yi --- drivers/net/wireless/ipw2200.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 6e79ae24ee1c..483993a4ca4b 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -7696,7 +7696,6 @@ static inline int is_network_packet(struct ipw_priv *priv, static inline int is_duplicate_packet(struct ipw_priv *priv, struct ieee80211_hdr_4addr *header) { - u16 fc = le16_to_cpu(header->frame_ctl); u16 sc = le16_to_cpu(header->seq_ctl); u16 seq = WLAN_GET_SEQ_SEQ(sc); u16 frag = WLAN_GET_SEQ_FRAG(sc); @@ -7760,7 +7759,10 @@ static inline int is_duplicate_packet(struct ipw_priv *priv, return 0; drop: - BUG_ON(!(fc & IEEE80211_FCTL_RETRY)); + /* Comment this line now since we observed the card receives + * duplicate packets but the FCTL_RETRY bit is not set in the + * IBSS mode with fragmentation enabled. + BUG_ON(!(le16_to_cpu(header->frame_ctl) & IEEE80211_FCTL_RETRY)); */ return 1; } -- cgit v1.2.2 From e402c9374112aaf1fc5796013dc3040ebb3954ca Mon Sep 17 00:00:00 2001 From: Zhu Yi Date: Fri, 5 Aug 2005 17:20:40 +0800 Subject: Disable host fragmentation in open mode since IPW2200/2915 hardware support hardware fragmentation. Signed-off-by: Zhu Yi --- drivers/net/wireless/ipw2200.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 483993a4ca4b..f8dac52df93a 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -8069,6 +8069,9 @@ static int ipw_sw_reset(struct ipw_priv *priv, int init) } IPW_DEBUG_INFO("Hardware crypto [%s]\n", hwcrypto ? "on" : "off"); + /* IPW2200/2915 is abled to do hardware fragmentation. */ + priv->ieee->host_open_frag = 0; + if ((priv->pci_dev->device == 0x4223) || (priv->pci_dev->device == 0x4224)) { if (init) -- cgit v1.2.2 From 1fbfea549f07f1f7afd436f1e45b25437f0172c2 Mon Sep 17 00:00:00 2001 From: Zhu Yi Date: Fri, 5 Aug 2005 17:22:56 +0800 Subject: [Bug 792] Fix WPA-PSK AES both for -Dipw and -Dwext. Signed-off-by: Zhu Yi --- drivers/net/wireless/ipw2200.c | 141 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 125 insertions(+), 16 deletions(-) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index f8dac52df93a..c6da5f534250 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -5557,6 +5557,55 @@ static void ipw_send_wep_keys(struct ipw_priv *priv, int type) } } +static void ipw_set_hw_decrypt_unicast(struct ipw_priv *priv, int level) +{ + if (priv->ieee->host_encrypt) + return; + + switch (level) { + case SEC_LEVEL_3: + priv->sys_config.disable_unicast_decryption = 0; + priv->ieee->host_decrypt = 0; + break; + case SEC_LEVEL_2: + priv->sys_config.disable_unicast_decryption = 1; + priv->ieee->host_decrypt = 1; + break; + case SEC_LEVEL_1: + priv->sys_config.disable_unicast_decryption = 0; + priv->ieee->host_decrypt = 0; + break; + case SEC_LEVEL_0: + priv->sys_config.disable_unicast_decryption = 1; + break; + default: + break; + } +} + +static void ipw_set_hw_decrypt_multicast(struct ipw_priv *priv, int level) +{ + if (priv->ieee->host_encrypt) + return; + + switch (level) { + case SEC_LEVEL_3: + priv->sys_config.disable_multicast_decryption = 0; + break; + case SEC_LEVEL_2: + priv->sys_config.disable_multicast_decryption = 1; + break; + case SEC_LEVEL_1: + priv->sys_config.disable_multicast_decryption = 0; + break; + case SEC_LEVEL_0: + priv->sys_config.disable_multicast_decryption = 1; + break; + default: + break; + } +} + static void ipw_set_hwcrypto_keys(struct ipw_priv *priv) { switch (priv->ieee->sec.level) { @@ -5567,33 +5616,23 @@ static void ipw_set_hwcrypto_keys(struct ipw_priv *priv) priv->ieee->sec.active_key); ipw_send_wep_keys(priv, DCW_WEP_KEY_SEC_TYPE_CCM); - priv->sys_config.disable_unicast_decryption = 0; - priv->sys_config.disable_multicast_decryption = 0; - priv->ieee->host_decrypt = 0; break; case SEC_LEVEL_2: if (priv->ieee->sec.flags & SEC_ACTIVE_KEY) ipw_send_tgi_tx_key(priv, DCT_FLAG_EXT_SECURITY_TKIP, priv->ieee->sec.active_key); - - priv->sys_config.disable_unicast_decryption = 1; - priv->sys_config.disable_multicast_decryption = 1; - priv->ieee->host_decrypt = 1; break; case SEC_LEVEL_1: ipw_send_wep_keys(priv, DCW_WEP_KEY_SEC_TYPE_WEP); - priv->sys_config.disable_unicast_decryption = 0; - priv->sys_config.disable_multicast_decryption = 0; - priv->ieee->host_decrypt = 0; break; case SEC_LEVEL_0: - priv->sys_config.disable_unicast_decryption = 1; - priv->sys_config.disable_multicast_decryption = 1; - break; default: break; } + + ipw_set_hw_decrypt_unicast(priv, priv->ieee->sec.level); + ipw_set_hw_decrypt_multicast(priv, priv->ieee->sec.level); } static void ipw_adhoc_check(void *data) @@ -6185,12 +6224,31 @@ static int ipw_wpa_mlme(struct net_device *dev, int command, int reason) return ret; } +static int ipw_wpa_ie_cipher2level(u8 cipher) +{ + switch (cipher) { + case 4: /* CCMP */ + return SEC_LEVEL_3; + case 2: /* TKIP */ + return SEC_LEVEL_2; + case 5: /* WEP104 */ + case 1: /* WEP40 */ + return SEC_LEVEL_1; + case 0: /* NONE */ + return SEC_LEVEL_0; + default: + return -1; + } +} + static int ipw_wpa_set_wpa_ie(struct net_device *dev, struct ipw_param *param, int plen) { struct ipw_priv *priv = ieee80211_priv(dev); struct ieee80211_device *ieee = priv->ieee; u8 *buf; + u8 *ptk, *gtk; + int level; if (param->u.wpa_ie.len > MAX_WPA_IE_LEN || (param->u.wpa_ie.len && param->u.wpa_ie.data == NULL)) @@ -6209,8 +6267,35 @@ static int ipw_wpa_set_wpa_ie(struct net_device *dev, kfree(ieee->wpa_ie); ieee->wpa_ie = NULL; ieee->wpa_ie_len = 0; + goto done; + } + + if (priv->ieee->host_encrypt) + goto done; + + /* HACK: Parse wpa_ie here to get pairwise suite, otherwise + * we need to change driver_ipw.c from wpa_supplicant. This + * is OK since -Dipw is deprecated. The -Dwext driver has a + * clean way to handle this. */ + gtk = ptk = (u8 *) ieee->wpa_ie; + if (ieee->wpa_ie[0] == 0x30) { /* RSN IE */ + gtk += 4 + 3; + ptk += 4 + 4 + 2 + 3; + } else { /* WPA IE */ + gtk += 8 + 3; + ptk += 8 + 4 + 2 + 3; } + if (ptk - (u8 *) ieee->wpa_ie > ieee->wpa_ie_len) + return -EINVAL; + + level = ipw_wpa_ie_cipher2level(*gtk); + ipw_set_hw_decrypt_multicast(priv, level); + + level = ipw_wpa_ie_cipher2level(*ptk); + ipw_set_hw_decrypt_unicast(priv, level); + + done: ipw_wpa_assoc_frame(priv, ieee->wpa_ie, ieee->wpa_ie_len); return 0; } @@ -6510,6 +6595,23 @@ static int ipw_wx_get_genie(struct net_device *dev, return err; } +static int wext_cipher2level(int cipher) +{ + switch (cipher) { + case IW_AUTH_CIPHER_NONE: + return SEC_LEVEL_0; + case IW_AUTH_CIPHER_WEP40: + case IW_AUTH_CIPHER_WEP104: + return SEC_LEVEL_1; + case IW_AUTH_CIPHER_TKIP: + return SEC_LEVEL_2; + case IW_AUTH_CIPHER_CCMP: + return SEC_LEVEL_3; + default: + return -1; + } +} + /* SIOCSIWAUTH */ static int ipw_wx_set_auth(struct net_device *dev, struct iw_request_info *info, @@ -6524,8 +6626,15 @@ static int ipw_wx_set_auth(struct net_device *dev, switch (param->flags & IW_AUTH_INDEX) { case IW_AUTH_WPA_VERSION: + break; case IW_AUTH_CIPHER_PAIRWISE: + ipw_set_hw_decrypt_unicast(priv, + wext_cipher2level(param->value)); + break; case IW_AUTH_CIPHER_GROUP: + ipw_set_hw_decrypt_multicast(priv, + wext_cipher2level(param->value)); + break; case IW_AUTH_KEY_MGMT: /* * ipw2200 does not use these parameters @@ -10256,11 +10365,11 @@ static void shim__set_security(struct net_device *dev, priv->ieee->sec.level = sec->level; priv->ieee->sec.flags |= SEC_LEVEL; priv->status |= STATUS_SECURITY_UPDATED; - - if (!priv->ieee->host_encrypt && (sec->flags & SEC_ENCRYPT)) - ipw_set_hwcrypto_keys(priv); } + if (!priv->ieee->host_encrypt && (sec->flags & SEC_ENCRYPT)) + ipw_set_hwcrypto_keys(priv); + /* To match current functionality of ipw2100 (which works well w/ * various supplicants, we don't force a disassociate if the * privacy capability changes ... */ -- cgit v1.2.2 From caeff81b4e6479884f3cd2ced526bebd4f0c5eff Mon Sep 17 00:00:00 2001 From: Hong Liu Date: Fri, 5 Aug 2005 17:25:50 +0800 Subject: Fixes the ad-hoc network WEP key list issue. If we configure the wep keys after creating the ibss network, the beacons of this network will not show correctly (it still shows "key off" in iwlist scan report). This is because we don't update the beacon info in firmware. Signed-off-by: Hong Liu Signed-off-by: Zhu Yi --- drivers/net/wireless/ipw2200.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index c6da5f534250..626e78a336eb 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -9169,11 +9169,19 @@ static int ipw_wx_set_encode(struct net_device *dev, { struct ipw_priv *priv = ieee80211_priv(dev); int ret; + u32 cap = priv->capability; down(&priv->sem); ret = ieee80211_wx_set_encode(priv->ieee, info, wrqu, key); - up(&priv->sem); + /* In IBSS mode, we need to notify the firmware to update + * the beacon info after we changed the capability. */ + if (cap != priv->capability && + priv->ieee->iw_mode == IW_MODE_ADHOC && + priv->status & STATUS_ASSOCIATED) + ipw_disassociate(priv); + + up(&priv->sem); return ret; } -- cgit v1.2.2 From 0ece35b557c5097c90df9e8fbf47e4da46377df1 Mon Sep 17 00:00:00 2001 From: Zhu Yi Date: Fri, 5 Aug 2005 17:26:51 +0800 Subject: [Bug 701] Fix a misuse of ieee->mode with ieee->iw_mode. Signed-off-by: Zhu Yi --- drivers/net/wireless/ipw2200.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 626e78a336eb..2633e0de7f79 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -8223,7 +8223,7 @@ static int ipw_sw_reset(struct ipw_priv *priv, int init) priv->power_mode = IPW_POWER_AC; priv->tx_power = IPW_TX_POWER_DEFAULT; - return old_mode == priv->ieee->mode; + return old_mode == priv->ieee->iw_mode; } /* -- cgit v1.2.2 From 22501c8ed70398178e8c8d55e65da97b7e7fb610 Mon Sep 17 00:00:00 2001 From: Zhu Yi Date: Thu, 11 Aug 2005 10:49:17 +0800 Subject: Fix ipw_wx_get_txpow shows wrong disabled value. Signed-off-by: Zhu Yi --- drivers/net/wireless/ipw2200.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 2633e0de7f79..105b1146f396 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -8957,7 +8957,7 @@ static int ipw_wx_get_txpow(struct net_device *dev, up(&priv->sem); IPW_DEBUG_WX("GET TX Power -> %s %d \n", - wrqu->power.disabled ? "ON" : "OFF", wrqu->power.value); + wrqu->power.disabled ? "OFF" : "ON", wrqu->power.value); return 0; } -- cgit v1.2.2 From 6de9f7f27defe6f1a2d33d0b78af6b1a0ad18330 Mon Sep 17 00:00:00 2001 From: Zhu Yi Date: Thu, 11 Aug 2005 14:39:33 +0800 Subject: Fix firmware error when setting tx_power. Signed-off-by: Zhu Yi --- drivers/net/wireless/ipw2200.c | 131 +++++++++++++++++------------------------ 1 file changed, 55 insertions(+), 76 deletions(-) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 105b1146f396..f825aa462c99 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -2084,6 +2084,50 @@ static int ipw_send_tx_power(struct ipw_priv *priv, struct ipw_tx_power *power) return 0; } +static int ipw_set_tx_power(struct ipw_priv *priv) +{ + const struct ieee80211_geo *geo = ieee80211_get_geo(priv->ieee); + struct ipw_tx_power tx_power; + s8 max_power; + int i; + + memset(&tx_power, 0, sizeof(tx_power)); + + /* configure device for 'G' band */ + tx_power.ieee_mode = IPW_G_MODE; + tx_power.num_channels = geo->bg_channels; + for (i = 0; i < geo->bg_channels; i++) { + max_power = geo->bg[i].max_power; + tx_power.channels_tx_power[i].channel_number = + geo->bg[i].channel; + tx_power.channels_tx_power[i].tx_power = max_power ? + min(max_power, priv->tx_power) : priv->tx_power; + } + if (ipw_send_tx_power(priv, &tx_power)) + return -EIO; + + /* configure device to also handle 'B' band */ + tx_power.ieee_mode = IPW_B_MODE; + if (ipw_send_tx_power(priv, &tx_power)) + return -EIO; + + /* configure device to also handle 'A' band */ + if (priv->ieee->abg_true) { + tx_power.ieee_mode = IPW_A_MODE; + tx_power.num_channels = geo->a_channels; + for (i = 0; i < tx_power.num_channels; i++) { + max_power = geo->a[i].max_power; + tx_power.channels_tx_power[i].channel_number = + geo->a[i].channel; + tx_power.channels_tx_power[i].tx_power = max_power ? + min(max_power, priv->tx_power) : priv->tx_power; + } + if (ipw_send_tx_power(priv, &tx_power)) + return -EIO; + } + return 0; +} + static int ipw_send_rts_threshold(struct ipw_priv *priv, u16 rts) { struct ipw_rts_threshold rts_threshold = { @@ -8869,79 +8913,33 @@ static int ipw_wx_set_txpow(struct net_device *dev, union iwreq_data *wrqu, char *extra) { struct ipw_priv *priv = ieee80211_priv(dev); - const struct ieee80211_geo *geo = ieee80211_get_geo(priv->ieee); - struct ipw_tx_power tx_power; - int i; + int err = 0; down(&priv->sem); if (ipw_radio_kill_sw(priv, wrqu->power.disabled)) { - up(&priv->sem); - return -EINPROGRESS; + err = -EINPROGRESS; + goto out; } if (!wrqu->power.fixed) wrqu->power.value = IPW_TX_POWER_DEFAULT; if (wrqu->power.flags != IW_TXPOW_DBM) { - up(&priv->sem); - return -EINVAL; + err = -EINVAL; + goto out; } if ((wrqu->power.value > IPW_TX_POWER_MAX) || (wrqu->power.value < IPW_TX_POWER_MIN)) { - up(&priv->sem); - return -EINVAL; + err = -EINVAL; + goto out; } priv->tx_power = wrqu->power.value; - - memset(&tx_power, 0, sizeof(tx_power)); - - /* configure device for 'G' band */ - tx_power.ieee_mode = IPW_G_MODE; - tx_power.num_channels = geo->bg_channels; - for (i = 0; i < geo->bg_channels; i++) { - int max_power = geo->bg[i].max_power; - - tx_power.channels_tx_power[i].channel_number = i + 1; - if (max_power != 0 && priv->tx_power > max_power) - tx_power.channels_tx_power[i].tx_power = max_power; - else - tx_power.channels_tx_power[i].tx_power = priv->tx_power; - } - if (ipw_send_tx_power(priv, &tx_power)) - goto error; - - /* configure device to also handle 'B' band */ - tx_power.ieee_mode = IPW_B_MODE; - if (ipw_send_tx_power(priv, &tx_power)) - goto error; - - /* configure device to also handle 'A' band */ - if (priv->ieee->abg_true) { - tx_power.ieee_mode = IPW_A_MODE; - tx_power.num_channels = geo->a_channels; - for (i = 0; i < geo->a_channels; i++) { - int max_power = geo->a[i].max_power; - - tx_power.channels_tx_power[i].channel_number = i + 1; - if (max_power != 0 && priv->tx_power > max_power) - tx_power.channels_tx_power[i].tx_power = - max_power; - else - tx_power.channels_tx_power[i].tx_power = - priv->tx_power; - } - if (ipw_send_tx_power(priv, &tx_power)) - goto error; - } - - up(&priv->sem); - return 0; - - error: + err = ipw_set_tx_power(priv); + out: up(&priv->sem); - return -EIO; + return err; } static int ipw_wx_get_txpow(struct net_device *dev, @@ -10426,29 +10424,10 @@ static int init_supported_rates(struct ipw_priv *priv, static int ipw_config(struct ipw_priv *priv) { - int i; - struct ipw_tx_power tx_power; - - memset(&priv->sys_config, 0, sizeof(priv->sys_config)); - memset(&tx_power, 0, sizeof(tx_power)); - /* This is only called from ipw_up, which resets/reloads the firmware so, we don't need to first disable the card before we configure it */ - - /* configure device for 'G' band */ - tx_power.ieee_mode = IPW_G_MODE; - tx_power.num_channels = 11; - for (i = 0; i < 11; i++) { - tx_power.channels_tx_power[i].channel_number = i + 1; - tx_power.channels_tx_power[i].tx_power = priv->tx_power; - } - if (ipw_send_tx_power(priv, &tx_power)) - goto error; - - /* configure device to also handle 'B' band */ - tx_power.ieee_mode = IPW_B_MODE; - if (ipw_send_tx_power(priv, &tx_power)) + if (ipw_set_tx_power(priv)) goto error; /* initialize adapter address */ -- cgit v1.2.2 From e666619e232308c8ee2aba6b87f28ad26b38d905 Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Fri, 12 Aug 2005 09:17:04 -0500 Subject: Modified ipw_config and STATUS_INIT setting to correct race condition with request_scan being called before initialized if invoked from insmod, resulting in no association occurring during boot until iwlist scan is run. Signed-off-by: James Ketrenos --- drivers/net/wireless/ipw2200.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index f825aa462c99..6e862c2905de 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -10465,9 +10465,17 @@ static int ipw_config(struct ipw_priv *priv) if (ipw_send_host_complete(priv)) goto error; - /* If configured to try and auto-associate, kick off a scan */ - if (priv->config & CFG_ASSOCIATE) - queue_work(priv->workqueue, &priv->request_scan); + priv->status |= STATUS_INIT; + + ipw_led_init(priv); + ipw_led_radio_on(priv); + priv->notif_missed_beacons = 0; + + /* Set hardware WEP key if it is configured. */ + if ((priv->capability & CAP_PRIVACY_ON) && + (priv->ieee->sec.level == SEC_LEVEL_1) && + !(priv->ieee->host_encrypt || priv->ieee->host_decrypt)) + ipw_set_hwcrypto_keys(priv); return 0; @@ -10773,17 +10781,10 @@ static int ipw_up(struct ipw_priv *priv) rc = ipw_config(priv); if (!rc) { IPW_DEBUG_INFO("Configured device on count %i\n", i); - ipw_led_init(priv); - ipw_led_radio_on(priv); - priv->notif_missed_beacons = 0; - priv->status |= STATUS_INIT; - - /* Set hardware WEP key if it is configured. */ - if ((priv->capability & CAP_PRIVACY_ON) && - (priv->ieee->sec.level == SEC_LEVEL_1) && - !(priv->ieee->host_encrypt || - priv->ieee->host_decrypt)) - ipw_set_hwcrypto_keys(priv); + + /* If configure to try and auto-associate, kick + * off a scan. */ + queue_work(priv->workqueue, &priv->request_scan); return 0; } -- cgit v1.2.2 From b39860c60b135ef16c1c16a3e2a757ff8070c5ad Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Fri, 12 Aug 2005 09:36:32 -0500 Subject: Switched firmware error dumping so that it will capture a log available via sysfs even if debugging disabled. When a firmware error is captured, it will be dumped to the kernel log (if debug enabled) and captured in memory to be retrieved via sysfs. If an error has already been captured, subsequent errors will be dropped. The existing error can be cleared by writing to the error log entry. Signed-off-by: James Ketrenos --- drivers/net/wireless/ipw2200.c | 251 ++++++++++++++++++++++++++++------------- drivers/net/wireless/ipw2200.h | 30 ++++- 2 files changed, 204 insertions(+), 77 deletions(-) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 6e862c2905de..a3283caaa872 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -428,6 +428,7 @@ static inline void ipw_disable_interrupts(struct ipw_priv *priv) ipw_write32(priv, IPW_INTA_MASK_R, ~IPW_INTA_MASK_ALL); } +#ifdef CONFIG_IPW_DEBUG static char *ipw_error_desc(u32 val) { switch (val) { @@ -466,56 +467,35 @@ static char *ipw_error_desc(u32 val) } } -static void ipw_dump_nic_error_log(struct ipw_priv *priv) +static void ipw_dump_error_log(struct ipw_priv *priv, + struct ipw_fw_error *error) { - u32 desc, time, blink1, blink2, ilink1, ilink2, idata, i, count, base; - - base = ipw_read32(priv, IPWSTATUS_ERROR_LOG); - count = ipw_read_reg32(priv, base); + u32 i; - if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) { - IPW_ERROR("Start IPW Error Log Dump:\n"); - IPW_ERROR("Status: 0x%08X, Config: %08X\n", - priv->status, priv->config); + if (!error) { + IPW_ERROR("Error allocating and capturing error log. " + "Nothing to dump.\n"); + return; } - for (i = ERROR_START_OFFSET; - i <= count * ERROR_ELEM_SIZE; i += ERROR_ELEM_SIZE) { - desc = ipw_read_reg32(priv, base + i); - time = ipw_read_reg32(priv, base + i + 1 * sizeof(u32)); - blink1 = ipw_read_reg32(priv, base + i + 2 * sizeof(u32)); - blink2 = ipw_read_reg32(priv, base + i + 3 * sizeof(u32)); - ilink1 = ipw_read_reg32(priv, base + i + 4 * sizeof(u32)); - ilink2 = ipw_read_reg32(priv, base + i + 5 * sizeof(u32)); - idata = ipw_read_reg32(priv, base + i + 6 * sizeof(u32)); + IPW_ERROR("Start IPW Error Log Dump:\n"); + IPW_ERROR("Status: 0x%08X, Config: %08X\n", + error->status, error->config); + for (i = 0; i < error->elem_len; i++) IPW_ERROR("%s %i 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n", - ipw_error_desc(desc), time, blink1, blink2, - ilink1, ilink2, idata); - } + ipw_error_desc(error->elem[i].desc), + error->elem[i].time, + error->elem[i].blink1, + error->elem[i].blink2, + error->elem[i].link1, + error->elem[i].link2, error->elem[i].data); + for (i = 0; i < error->log_len; i++) + IPW_ERROR("%i\t0x%08x\t%i\n", + error->log[i].time, + error->log[i].event, error->log[i].data); } - -static void ipw_dump_nic_event_log(struct ipw_priv *priv) -{ - u32 ev, time, data, i, count, base; - - base = ipw_read32(priv, IPW_EVENT_LOG); - count = ipw_read_reg32(priv, base); - - if (EVENT_START_OFFSET <= count * EVENT_ELEM_SIZE) - IPW_ERROR("Start IPW Event Log Dump:\n"); - - for (i = EVENT_START_OFFSET; - i <= count * EVENT_ELEM_SIZE; i += EVENT_ELEM_SIZE) { - ev = ipw_read_reg32(priv, base + i); - time = ipw_read_reg32(priv, base + i + 1 * sizeof(u32)); - data = ipw_read_reg32(priv, base + i + 2 * sizeof(u32)); - -#ifdef CONFIG_IPW_DEBUG - IPW_ERROR("%i\t0x%08x\t%i\n", time, data, ev); #endif - } -} static inline int ipw_is_init(struct ipw_priv *priv) { @@ -1058,6 +1038,130 @@ static ssize_t store_debug_level(struct device_driver *d, const char *buf, static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO, show_debug_level, store_debug_level); +static inline u32 ipw_get_event_log_len(struct ipw_priv *priv) +{ + return ipw_read_reg32(priv, ipw_read32(priv, IPW_EVENT_LOG)); +} + +static void ipw_capture_event_log(struct ipw_priv *priv, + u32 log_len, struct ipw_event *log) +{ + u32 base; + + if (log_len) { + base = ipw_read32(priv, IPW_EVENT_LOG); + ipw_read_indirect(priv, base + sizeof(base) + sizeof(u32), + (u8 *) log, sizeof(*log) * log_len); + } +} + +static struct ipw_fw_error *ipw_alloc_error_log(struct ipw_priv *priv) +{ + struct ipw_fw_error *error; + u32 log_len = ipw_get_event_log_len(priv); + u32 base = ipw_read32(priv, IPW_ERROR_LOG); + u32 elem_len = ipw_read_reg32(priv, base); + + error = kmalloc(sizeof(*error) + + sizeof(*error->elem) * elem_len + + sizeof(*error->log) * log_len, GFP_ATOMIC); + if (!error) { + IPW_ERROR("Memory allocation for firmware error log " + "failed.\n"); + return NULL; + } + error->status = priv->status; + error->config = priv->config; + error->elem_len = elem_len; + error->log_len = log_len; + error->elem = (struct ipw_error_elem *)error->payload; + error->log = (struct ipw_event *)(error->elem + + (sizeof(*error->elem) * elem_len)); + + ipw_capture_event_log(priv, log_len, error->log); + + if (elem_len) + ipw_read_indirect(priv, base + sizeof(base), (u8 *) error->elem, + sizeof(*error->elem) * elem_len); + + return error; +} + +static void ipw_free_error_log(struct ipw_fw_error *error) +{ + if (error) + kfree(error); +} + +static ssize_t show_event_log(struct device *d, + struct device_attribute *attr, char *buf) +{ + struct ipw_priv *priv = dev_get_drvdata(d); + u32 log_len = ipw_get_event_log_len(priv); + struct ipw_event log[log_len]; + u32 len = 0, i; + + ipw_capture_event_log(priv, log_len, log); + + len += snprintf(buf + len, PAGE_SIZE - len, "%08X", log_len); + for (i = 0; i < log_len; i++) + len += snprintf(buf + len, PAGE_SIZE - len, + "\n%08X%08X%08X", + log[i].time, log[i].event, log[i].data); + len += snprintf(buf + len, PAGE_SIZE - len, "\n"); + return len; +} + +static DEVICE_ATTR(event_log, S_IRUGO, show_event_log, NULL); + +static ssize_t show_error(struct device *d, + struct device_attribute *attr, char *buf) +{ + struct ipw_priv *priv = dev_get_drvdata(d); + u32 len = 0, i; + if (!priv->error) + return 0; + len += snprintf(buf + len, PAGE_SIZE - len, + "%08X%08X%08X", + priv->error->status, + priv->error->config, priv->error->elem_len); + for (i = 0; i < priv->error->elem_len; i++) + len += snprintf(buf + len, PAGE_SIZE - len, + "\n%08X%08X%08X%08X%08X%08X%08X", + priv->error->elem[i].time, + priv->error->elem[i].desc, + priv->error->elem[i].blink1, + priv->error->elem[i].blink2, + priv->error->elem[i].link1, + priv->error->elem[i].link2, + priv->error->elem[i].data); + + len += snprintf(buf + len, PAGE_SIZE - len, + "\n%08X", priv->error->log_len); + for (i = 0; i < priv->error->log_len; i++) + len += snprintf(buf + len, PAGE_SIZE - len, + "\n%08X%08X%08X", + priv->error->log[i].time, + priv->error->log[i].event, + priv->error->log[i].data); + len += snprintf(buf + len, PAGE_SIZE - len, "\n"); + return len; +} + +static ssize_t clear_error(struct device *d, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct ipw_priv *priv = dev_get_drvdata(d); + if (priv->error) { + ipw_free_error_log(priv->error); + priv->error = NULL; + } + return count; +} + +static DEVICE_ATTR(error, S_IRUGO | S_IWUSR, show_error, clear_error); + static ssize_t show_scan_age(struct device *d, struct device_attribute *attr, char *buf) { @@ -1163,34 +1267,6 @@ static ssize_t show_nic_type(struct device *d, static DEVICE_ATTR(nic_type, S_IRUGO, show_nic_type, NULL); -static ssize_t dump_error_log(struct device *d, - struct device_attribute *attr, const char *buf, - size_t count) -{ - char *p = (char *)buf; - - if (p[0] == '1') - ipw_dump_nic_error_log((struct ipw_priv *)d->driver_data); - - return strnlen(buf, count); -} - -static DEVICE_ATTR(dump_errors, S_IWUSR, NULL, dump_error_log); - -static ssize_t dump_event_log(struct device *d, - struct device_attribute *attr, const char *buf, - size_t count) -{ - char *p = (char *)buf; - - if (p[0] == '1') - ipw_dump_nic_event_log((struct ipw_priv *)d->driver_data); - - return strnlen(buf, count); -} - -static DEVICE_ATTR(dump_events, S_IWUSR, NULL, dump_event_log); - static ssize_t show_ucode_version(struct device *d, struct device_attribute *attr, char *buf) { @@ -1614,12 +1690,30 @@ static void ipw_irq_tasklet(struct ipw_priv *priv) if (inta & IPW_INTA_BIT_FATAL_ERROR) { IPW_ERROR("Firmware error detected. Restarting.\n"); + if (priv->error) { + IPW_ERROR("Sysfs 'error' log already exists.\n"); #ifdef CONFIG_IPW_DEBUG - if (ipw_debug_level & IPW_DL_FW_ERRORS) { - ipw_dump_nic_error_log(priv); - ipw_dump_nic_event_log(priv); - } + if (ipw_debug_level & IPW_DL_FW_ERRORS) { + struct ipw_fw_error *error = + ipw_alloc_error_log(priv); + ipw_dump_error_log(priv, error); + if (error) + ipw_free_error_log(error); + } +#endif + } else { + priv->error = ipw_alloc_error_log(priv); + if (priv->error) + IPW_ERROR("Sysfs 'error' log captured.\n"); + else + IPW_ERROR("Error allocating sysfs 'error' " + "log.\n"); +#ifdef CONFIG_IPW_DEBUG + if (ipw_debug_level & IPW_DL_FW_ERRORS) + ipw_dump_error_log(priv, priv->error); #endif + } + /* XXX: If hardware encryption is for WPA/WPA2, * we have to notify the supplicant. */ if (priv->ieee->sec.encrypt) { @@ -10958,8 +11052,8 @@ static struct attribute *ipw_sysfs_entries[] = { &dev_attr_nic_type.attr, &dev_attr_status.attr, &dev_attr_cfg.attr, - &dev_attr_dump_errors.attr, - &dev_attr_dump_events.attr, + &dev_attr_error.attr, + &dev_attr_event_log.attr, &dev_attr_eeprom_delay.attr, &dev_attr_ucode_version.attr, &dev_attr_rtc.attr, @@ -11172,6 +11266,11 @@ static void ipw_pci_remove(struct pci_dev *pdev) } } + if (priv->error) { + ipw_free_error_log(priv->error); + priv->error = NULL; + } + free_irq(pdev->irq, priv); iounmap(priv->hw_base); pci_release_regions(pdev); diff --git a/drivers/net/wireless/ipw2200.h b/drivers/net/wireless/ipw2200.h index 9bf8aa427d8c..9bf03ac55390 100644 --- a/drivers/net/wireless/ipw2200.h +++ b/drivers/net/wireless/ipw2200.h @@ -1085,6 +1085,32 @@ struct ipw_ibss_seq { struct list_head list; }; +struct ipw_error_elem { + u32 desc; + u32 time; + u32 blink1; + u32 blink2; + u32 link1; + u32 link2; + u32 data; +}; + +struct ipw_event { + u32 event; + u32 time; + u32 data; +} __attribute__ ((packed)); + +struct ipw_fw_error { + u32 status; + u32 config; + u32 elem_len; + u32 log_len; + struct ipw_error_elem *elem; + struct ipw_event *log; + u8 payload[0]; +} __attribute__ ((packed)); + struct ipw_priv { /* ieee device used by generic ieee processing code */ struct ieee80211_device *ieee; @@ -1245,6 +1271,8 @@ struct ipw_priv { u32 pm_state[16]; #endif + struct ipw_fw_error *error; + /* network state */ /* Used to pass the current INTA value from ISR to Tasklet */ @@ -1803,7 +1831,7 @@ enum { IPW_ORD_TABLE_7_LAST }; -#define IPWSTATUS_ERROR_LOG (IPW_SHARED_LOWER_BOUND + 0x410) +#define IPW_ERROR_LOG (IPW_SHARED_LOWER_BOUND + 0x410) #define IPW_EVENT_LOG (IPW_SHARED_LOWER_BOUND + 0x414) #define IPW_ORDINALS_TABLE_LOWER (IPW_SHARED_LOWER_BOUND + 0x500) #define IPW_ORDINALS_TABLE_0 (IPW_SHARED_LOWER_BOUND + 0x180) -- cgit v1.2.2 From 9ddf84f6f20335ce896feb459b19c3258bbf2e96 Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Tue, 16 Aug 2005 17:07:11 -0500 Subject: Changed all of the ipw_send_cmd() calls to return any ipw_send_cmd error codes to the caller and changed ipw_send_cmd itself to print the error message to the syslog indicating which command failed to be sent. Signed-off-by: James Ketrenos --- drivers/net/wireless/ipw2200.c | 187 ++++++++--------------------------------- 1 file changed, 34 insertions(+), 153 deletions(-) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index a3283caaa872..ef1007785030 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -1817,9 +1817,10 @@ static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) spin_lock_irqsave(&priv->lock, flags); if (priv->status & STATUS_HCMD_ACTIVE) { - IPW_ERROR("Already sending a command\n"); + IPW_ERROR("Failed to send %s: Already sending a command.\n", + get_cmd_string(cmd->cmd)); spin_unlock_irqrestore(&priv->lock, flags); - return -1; + return -EAGAIN; } priv->status |= STATUS_HCMD_ACTIVE; @@ -1832,6 +1833,8 @@ static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) rc = ipw_queue_tx_hcmd(priv, cmd->cmd, &cmd->param, cmd->len, 0); if (rc) { priv->status &= ~STATUS_HCMD_ACTIVE; + IPW_ERROR("Failed to send %s: Reason %d\n", + get_cmd_string(cmd->cmd), rc); spin_unlock_irqrestore(&priv->lock, flags); return rc; } @@ -1844,9 +1847,8 @@ static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) if (rc == 0) { spin_lock_irqsave(&priv->lock, flags); if (priv->status & STATUS_HCMD_ACTIVE) { - IPW_DEBUG_INFO("Command completion failed out after " - "%dms.\n", - 1000 * (HOST_COMPLETE_TIMEOUT / HZ)); + IPW_ERROR("Failed to send %s: Command timed out.\n", + get_cmd_string(cmd->cmd)); priv->status &= ~STATUS_HCMD_ACTIVE; spin_unlock_irqrestore(&priv->lock, flags); return -EIO; @@ -1855,7 +1857,8 @@ static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) } if (priv->status & STATUS_RF_KILL_HW) { - IPW_DEBUG_INFO("Command aborted due to RF Kill Switch\n"); + IPW_ERROR("Failed to send %s: Aborted due to RF kill switch.\n", + get_cmd_string(cmd->cmd)); return -EIO; } @@ -1874,12 +1877,7 @@ static int ipw_send_host_complete(struct ipw_priv *priv) return -1; } - if (ipw_send_cmd(priv, &cmd)) { - IPW_ERROR("failed to send HOST_COMPLETE command\n"); - return -1; - } - - return 0; + return ipw_send_cmd(priv, &cmd); } static int ipw_send_system_config(struct ipw_priv *priv, @@ -1896,12 +1894,7 @@ static int ipw_send_system_config(struct ipw_priv *priv, } memcpy(cmd.param, config, sizeof(*config)); - if (ipw_send_cmd(priv, &cmd)) { - IPW_ERROR("failed to send SYSTEM_CONFIG command\n"); - return -1; - } - - return 0; + return ipw_send_cmd(priv, &cmd); } static int ipw_send_ssid(struct ipw_priv *priv, u8 * ssid, int len) @@ -1917,12 +1910,7 @@ static int ipw_send_ssid(struct ipw_priv *priv, u8 * ssid, int len) } memcpy(cmd.param, ssid, cmd.len); - if (ipw_send_cmd(priv, &cmd)) { - IPW_ERROR("failed to send SSID command\n"); - return -1; - } - - return 0; + return ipw_send_cmd(priv, &cmd); } static int ipw_send_adapter_address(struct ipw_priv *priv, u8 * mac) @@ -1941,12 +1929,7 @@ static int ipw_send_adapter_address(struct ipw_priv *priv, u8 * mac) priv->net_dev->name, MAC_ARG(mac)); memcpy(cmd.param, mac, ETH_ALEN); - if (ipw_send_cmd(priv, &cmd)) { - IPW_ERROR("failed to send ADAPTER_ADDRESS command\n"); - return -1; - } - - return 0; + return ipw_send_cmd(priv, &cmd); } /* @@ -2011,12 +1994,7 @@ static int ipw_send_scan_request_ext(struct ipw_priv *priv, }; memcpy(cmd.param, request, sizeof(*request)); - if (ipw_send_cmd(priv, &cmd)) { - IPW_ERROR("failed to send SCAN_REQUEST_EXT command\n"); - return -1; - } - - return 0; + return ipw_send_cmd(priv, &cmd); } static int ipw_send_scan_abort(struct ipw_priv *priv) @@ -2031,12 +2009,7 @@ static int ipw_send_scan_abort(struct ipw_priv *priv) return -1; } - if (ipw_send_cmd(priv, &cmd)) { - IPW_ERROR("failed to send SCAN_ABORT command\n"); - return -1; - } - - return 0; + return ipw_send_cmd(priv, &cmd); } static int ipw_set_sensitivity(struct ipw_priv *priv, u16 sens) @@ -2048,12 +2021,7 @@ static int ipw_set_sensitivity(struct ipw_priv *priv, u16 sens) struct ipw_sensitivity_calib *calib = (struct ipw_sensitivity_calib *) &cmd.param; calib->beacon_rssi_raw = sens; - if (ipw_send_cmd(priv, &cmd)) { - IPW_ERROR("failed to send SENSITIVITY CALIB command\n"); - return -1; - } - - return 0; + return ipw_send_cmd(priv, &cmd); } static int ipw_send_associate(struct ipw_priv *priv, @@ -2083,12 +2051,7 @@ static int ipw_send_associate(struct ipw_priv *priv, } memcpy(cmd.param, &tmp_associate, sizeof(*associate)); - if (ipw_send_cmd(priv, &cmd)) { - IPW_ERROR("failed to send ASSOCIATE command\n"); - return -1; - } - - return 0; + return ipw_send_cmd(priv, &cmd); } static int ipw_send_supported_rates(struct ipw_priv *priv, @@ -2105,12 +2068,7 @@ static int ipw_send_supported_rates(struct ipw_priv *priv, } memcpy(cmd.param, rates, sizeof(*rates)); - if (ipw_send_cmd(priv, &cmd)) { - IPW_ERROR("failed to send SUPPORTED_RATES command\n"); - return -1; - } - - return 0; + return ipw_send_cmd(priv, &cmd); } static int ipw_set_random_seed(struct ipw_priv *priv) @@ -2127,12 +2085,7 @@ static int ipw_set_random_seed(struct ipw_priv *priv) get_random_bytes(&cmd.param, sizeof(u32)); - if (ipw_send_cmd(priv, &cmd)) { - IPW_ERROR("failed to send SEED_NUMBER command\n"); - return -1; - } - - return 0; + return ipw_send_cmd(priv, &cmd); } static int ipw_send_card_disable(struct ipw_priv *priv, u32 phy_off) @@ -2149,12 +2102,7 @@ static int ipw_send_card_disable(struct ipw_priv *priv, u32 phy_off) *((u32 *) & cmd.param) = phy_off; - if (ipw_send_cmd(priv, &cmd)) { - IPW_ERROR("failed to send CARD_DISABLE command\n"); - return -1; - } - - return 0; + return ipw_send_cmd(priv, &cmd); } static int ipw_send_tx_power(struct ipw_priv *priv, struct ipw_tx_power *power) @@ -2170,12 +2118,7 @@ static int ipw_send_tx_power(struct ipw_priv *priv, struct ipw_tx_power *power) } memcpy(cmd.param, power, sizeof(*power)); - if (ipw_send_cmd(priv, &cmd)) { - IPW_ERROR("failed to send TX_POWER command\n"); - return -1; - } - - return 0; + return ipw_send_cmd(priv, &cmd); } static int ipw_set_tx_power(struct ipw_priv *priv) @@ -2238,12 +2181,7 @@ static int ipw_send_rts_threshold(struct ipw_priv *priv, u16 rts) } memcpy(cmd.param, &rts_threshold, sizeof(rts_threshold)); - if (ipw_send_cmd(priv, &cmd)) { - IPW_ERROR("failed to send RTS_THRESHOLD command\n"); - return -1; - } - - return 0; + return ipw_send_cmd(priv, &cmd); } static int ipw_send_frag_threshold(struct ipw_priv *priv, u16 frag) @@ -2262,12 +2200,7 @@ static int ipw_send_frag_threshold(struct ipw_priv *priv, u16 frag) } memcpy(cmd.param, &frag_threshold, sizeof(frag_threshold)); - if (ipw_send_cmd(priv, &cmd)) { - IPW_ERROR("failed to send FRAG_THRESHOLD command\n"); - return -1; - } - - return 0; + return ipw_send_cmd(priv, &cmd); } static int ipw_send_power_mode(struct ipw_priv *priv, u32 mode) @@ -2297,12 +2230,7 @@ static int ipw_send_power_mode(struct ipw_priv *priv, u32 mode) break; } - if (ipw_send_cmd(priv, &cmd)) { - IPW_ERROR("failed to send POWER_MODE command\n"); - return -1; - } - - return 0; + return ipw_send_cmd(priv, &cmd); } static int ipw_send_retry_limit(struct ipw_priv *priv, u8 slimit, u8 llimit) @@ -2322,12 +2250,7 @@ static int ipw_send_retry_limit(struct ipw_priv *priv, u8 slimit, u8 llimit) } memcpy(cmd.param, &retry_limit, sizeof(retry_limit)); - if (ipw_send_cmd(priv, &cmd)) { - IPW_ERROR("failed to send RETRY_LIMIT command\n"); - return -1; - } - - return 0; + return ipw_send_cmd(priv, &cmd); } /* @@ -3608,20 +3531,6 @@ static void ipw_tx_queue_free(struct ipw_priv *priv) ipw_queue_tx_free(priv, &priv->txq[3]); } -static void inline __maybe_wake_tx(struct ipw_priv *priv) -{ - if (netif_running(priv->net_dev)) { - switch (priv->port_type) { - case DCR_TYPE_MU_BSS: - case DCR_TYPE_MU_IBSS: - if (!(priv->status & STATUS_ASSOCIATED)) - return; - } - netif_wake_queue(priv->net_dev); - } - -} - static inline void ipw_create_bssid(struct ipw_priv *priv, u8 * bssid) { /* First 3 bytes are manufacturer */ @@ -4713,8 +4622,10 @@ static int ipw_queue_tx_reclaim(struct ipw_priv *priv, priv->tx_packets++; } done: - if (ipw_queue_space(q) > q->low_mark && qindex >= 0) - __maybe_wake_tx(priv); + if ((ipw_queue_space(q) > q->low_mark) && + (qindex >= 0) && + (priv->status & STATUS_ASSOCIATED) && netif_running(priv->net_dev)) + netif_wake_queue(priv->net_dev); used = q->first_empty - q->last_used; if (used < 0) used += q->n_bd; @@ -5657,10 +5568,7 @@ static void ipw_send_tgi_tx_key(struct ipw_priv *priv, int type, int index) key->tx_counter[0] = 0; key->tx_counter[1] = 0; - if (ipw_send_cmd(priv, &cmd)) { - IPW_ERROR("failed to send TGI_TX_KEY command\n"); - return; - } + ipw_send_cmd(priv, &cmd); } static void ipw_send_wep_keys(struct ipw_priv *priv, int type) @@ -5688,10 +5596,7 @@ static void ipw_send_wep_keys(struct ipw_priv *priv, int type) key->key_size = priv->ieee->sec.key_sizes[i]; memcpy(key->key, priv->ieee->sec.keys[i], key->key_size); - if (ipw_send_cmd(priv, &cmd)) { - IPW_ERROR("failed to send WEP_KEY command\n"); - return; - } + ipw_send_cmd(priv, &cmd); } } @@ -6249,11 +6154,7 @@ static int ipw_set_rsn_capa(struct ipw_priv *priv, IPW_DEBUG_HC("HOST_CMD_RSN_CAPABILITIES\n"); memcpy(cmd.param, capabilities, length); - if (ipw_send_cmd(priv, &cmd)) { - IPW_ERROR("failed to send HOST_CMD_RSN_CAPABILITIES command\n"); - return -1; - } - return 0; + return ipw_send_cmd(priv, &cmd); } #if WIRELESS_EXT < 18 @@ -7435,18 +7336,8 @@ static int ipw_send_qos_params_command(struct ipw_priv *priv, struct ieee80211_q .len = (sizeof(struct ieee80211_qos_parameters) * 3) }; - if (!priv || !qos_param) { - IPW_ERROR("Invalid args\n"); - return -1; - } - memcpy(cmd.param, qos_param, sizeof(*qos_param) * 3); - if (ipw_send_cmd(priv, &cmd)) { - IPW_ERROR("failed to send IPW_CMD_QOS_PARAMETERS command\n"); - return -1; - } - - return 0; + return ipw_send_cmd(priv, &cmd); } static int ipw_send_qos_info_command(struct ipw_priv *priv, struct ieee80211_qos_information_element @@ -7457,18 +7348,8 @@ static int ipw_send_qos_info_command(struct ipw_priv *priv, struct ieee80211_qos .len = sizeof(*qos_param) }; - if (!priv || !qos_param) { - IPW_ERROR("Invalid args\n"); - return -1; - } - memcpy(cmd.param, qos_param, sizeof(*qos_param)); - if (ipw_send_cmd(priv, &cmd)) { - IPW_ERROR("failed to send CMD_QOS_INFO command\n"); - return -1; - } - - return 0; + return ipw_send_cmd(priv, &cmd); } #endif /* CONFIG_IPW_QOS */ -- cgit v1.2.2 From f6c5cb7c6f8a85045996bfc3442af963d6578d60 Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Thu, 25 Aug 2005 00:39:09 -0500 Subject: Added cmdlog in non-debug systems. You can now specify via the module parameter 'cmdlog' to allocate a ring buffer for caching host commands sent to the firmware. They can then be dumped at any time via the sysfs entry 'cmd_log' Signed-off-by: James Ketrenos --- drivers/net/wireless/ipw2200.c | 120 ++++++++++++++++++++++++++++++++++++----- drivers/net/wireless/ipw2200.h | 11 ++++ 2 files changed, 117 insertions(+), 14 deletions(-) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index ef1007785030..bcb5993b68bd 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -44,6 +44,7 @@ MODULE_VERSION(DRV_VERSION); MODULE_AUTHOR(DRV_COPYRIGHT); MODULE_LICENSE("GPL"); +static int cmdlog = 0; static int debug = 0; static int channel = 0; static int mode = 0; @@ -148,8 +149,8 @@ static int init_supported_rates(struct ipw_priv *priv, static void ipw_set_hwcrypto_keys(struct ipw_priv *); static void ipw_send_wep_keys(struct ipw_priv *, int); -static char *snprint_line(char *buf, size_t count, - const u8 * data, u32 len, u32 ofs) +static int snprint_line(char *buf, size_t count, + const u8 * data, u32 len, u32 ofs) { int out, i, j, l; char c; @@ -180,7 +181,7 @@ static char *snprint_line(char *buf, size_t count, out += snprintf(buf + out, count - out, " "); } - return buf; + return out; } static void printk_buf(int level, const u8 * data, u32 len) @@ -191,14 +192,33 @@ static void printk_buf(int level, const u8 * data, u32 len) return; while (len) { - printk(KERN_DEBUG "%s\n", - snprint_line(line, sizeof(line), &data[ofs], - min(len, 16U), ofs)); + snprint_line(line, sizeof(line), &data[ofs], + min(len, 16U), ofs); + printk(KERN_DEBUG "%s\n", line); ofs += 16; len -= min(len, 16U); } } +static int snprintk_buf(u8 * output, size_t size, const u8 * data, size_t len) +{ + size_t out = size; + u32 ofs = 0; + int total = 0; + + while (size && len) { + out = snprint_line(output, size, &data[ofs], + min_t(size_t, len, 16U), ofs); + + ofs += 16; + output += out; + size -= out; + len -= min_t(size_t, len, 16U); + total += out; + } + return total; +} + static u32 _ipw_read_reg32(struct ipw_priv *priv, u32 reg); #define ipw_read_reg32(a, b) _ipw_read_reg32(a, b) @@ -272,9 +292,15 @@ static inline u32 __ipw_read32(char *f, u32 l, struct ipw_priv *ipw, u32 ofs) #define ipw_read32(ipw, ofs) __ipw_read32(__FILE__, __LINE__, ipw, ofs) static void _ipw_read_indirect(struct ipw_priv *, u32, u8 *, int); -#define ipw_read_indirect(a, b, c, d) \ - IPW_DEBUG_IO("%s %d: read_indirect(0x%08X) %d bytes\n", __FILE__, __LINE__, (u32)(b), d); \ - _ipw_read_indirect(a, b, c, d) +static inline void __ipw_read_indirect(const char *f, int l, + struct ipw_priv *a, u32 b, u8 * c, int d) +{ + IPW_DEBUG_IO("%s %d: read_indirect(0x%08X) %d bytes\n", f, l, (u32) (b), + d); + _ipw_read_indirect(a, b, c, d); +} + +#define ipw_read_indirect(a, b, c, d) __ipw_read_indirect(__FILE__, __LINE__, a, b, c, d) static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 * data, int num); @@ -1070,6 +1096,7 @@ static struct ipw_fw_error *ipw_alloc_error_log(struct ipw_priv *priv) "failed.\n"); return NULL; } + error->jiffies = jiffies; error->status = priv->status; error->config = priv->config; error->elem_len = elem_len; @@ -1122,7 +1149,8 @@ static ssize_t show_error(struct device *d, if (!priv->error) return 0; len += snprintf(buf + len, PAGE_SIZE - len, - "%08X%08X%08X", + "%08lX%08X%08X%08X", + priv->error->jiffies, priv->error->status, priv->error->config, priv->error->elem_len); for (i = 0; i < priv->error->elem_len; i++) @@ -1162,6 +1190,33 @@ static ssize_t clear_error(struct device *d, static DEVICE_ATTR(error, S_IRUGO | S_IWUSR, show_error, clear_error); +static ssize_t show_cmd_log(struct device *d, + struct device_attribute *attr, char *buf) +{ + struct ipw_priv *priv = dev_get_drvdata(d); + u32 len = 0, i; + if (!priv->cmdlog) + return 0; + for (i = (priv->cmdlog_pos + 1) % priv->cmdlog_len; + (i != priv->cmdlog_pos) && (PAGE_SIZE - len); + i = (i + 1) % priv->cmdlog_len) { + len += + snprintf(buf + len, PAGE_SIZE - len, + "\n%08lX%08X%08X%08X\n", priv->cmdlog[i].jiffies, + priv->cmdlog[i].retcode, priv->cmdlog[i].cmd.cmd, + priv->cmdlog[i].cmd.len); + len += + snprintk_buf(buf + len, PAGE_SIZE - len, + (u8 *) priv->cmdlog[i].cmd.param, + priv->cmdlog[i].cmd.len); + len += snprintf(buf + len, PAGE_SIZE - len, "\n"); + } + len += snprintf(buf + len, PAGE_SIZE - len, "\n"); + return len; +} + +static DEVICE_ATTR(cmd_log, S_IRUGO, show_cmd_log, NULL); + static ssize_t show_scan_age(struct device *d, struct device_attribute *attr, char *buf) { @@ -1825,6 +1880,15 @@ static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) priv->status |= STATUS_HCMD_ACTIVE; + if (priv->cmdlog) { + priv->cmdlog[priv->cmdlog_pos].jiffies = jiffies; + priv->cmdlog[priv->cmdlog_pos].cmd.cmd = cmd->cmd; + priv->cmdlog[priv->cmdlog_pos].cmd.len = cmd->len; + memcpy(priv->cmdlog[priv->cmdlog_pos].cmd.param, cmd->param, + cmd->len); + priv->cmdlog[priv->cmdlog_pos].retcode = -1; + } + IPW_DEBUG_HC("%s command (#%d) %d bytes: 0x%08X\n", get_cmd_string(cmd->cmd), cmd->cmd, cmd->len, priv->status); @@ -1836,7 +1900,7 @@ static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) IPW_ERROR("Failed to send %s: Reason %d\n", get_cmd_string(cmd->cmd), rc); spin_unlock_irqrestore(&priv->lock, flags); - return rc; + goto exit; } spin_unlock_irqrestore(&priv->lock, flags); @@ -1851,7 +1915,8 @@ static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) get_cmd_string(cmd->cmd)); priv->status &= ~STATUS_HCMD_ACTIVE; spin_unlock_irqrestore(&priv->lock, flags); - return -EIO; + rc = -EIO; + goto exit; } spin_unlock_irqrestore(&priv->lock, flags); } @@ -1859,10 +1924,16 @@ static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) if (priv->status & STATUS_RF_KILL_HW) { IPW_ERROR("Failed to send %s: Aborted due to RF kill switch.\n", get_cmd_string(cmd->cmd)); - return -EIO; + rc = -EIO; + goto exit; } - return 0; + exit: + if (priv->cmdlog) { + priv->cmdlog[priv->cmdlog_pos++].retcode = rc; + priv->cmdlog_pos %= priv->cmdlog_len; + } + return rc; } static int ipw_send_host_complete(struct ipw_priv *priv) @@ -10712,6 +10783,18 @@ static int ipw_up(struct ipw_priv *priv) if (priv->status & STATUS_EXIT_PENDING) return -EIO; + if (cmdlog && !priv->cmdlog) { + priv->cmdlog = kmalloc(sizeof(*priv->cmdlog) * cmdlog, + GFP_KERNEL); + if (priv->cmdlog == NULL) { + IPW_ERROR("Error allocating %d command log entries.\n", + cmdlog); + } else { + memset(priv->cmdlog, 0, sizeof(*priv->cmdlog) * cmdlog); + priv->cmdlog_len = cmdlog; + } + } + for (i = 0; i < MAX_HW_RESTARTS; i++) { /* Load the microcode, firmware, and eeprom. * Also start the clocks. */ @@ -10935,6 +11018,7 @@ static struct attribute *ipw_sysfs_entries[] = { &dev_attr_cfg.attr, &dev_attr_error.attr, &dev_attr_event_log.attr, + &dev_attr_cmd_log.attr, &dev_attr_eeprom_delay.attr, &dev_attr_ucode_version.attr, &dev_attr_rtc.attr, @@ -11129,6 +11213,10 @@ static void ipw_pci_remove(struct pci_dev *pdev) } ipw_tx_queue_free(priv); + if (priv->cmdlog) { + kfree(priv->cmdlog); + priv->cmdlog = NULL; + } /* ipw_down will ensure that there is no more pending work * in the workqueue's, so we can safely remove them now. */ cancel_delayed_work(&priv->adhoc_check); @@ -11302,5 +11390,9 @@ MODULE_PARM_DESC(mode, "network mode (0=BSS,1=IBSS)"); module_param(hwcrypto, int, 0444); MODULE_PARM_DESC(hwcrypto, "enable hardware crypto (default on)"); +module_param(cmdlog, int, 0444); +MODULE_PARM_DESC(cmdlog, + "allocate a ring buffer for logging firmware commands"); + module_exit(ipw_exit); module_init(ipw_init); diff --git a/drivers/net/wireless/ipw2200.h b/drivers/net/wireless/ipw2200.h index 9bf03ac55390..255f0cb66f64 100644 --- a/drivers/net/wireless/ipw2200.h +++ b/drivers/net/wireless/ipw2200.h @@ -1102,6 +1102,7 @@ struct ipw_event { } __attribute__ ((packed)); struct ipw_fw_error { + unsigned long jiffies; u32 status; u32 config; u32 elem_len; @@ -1261,6 +1262,10 @@ struct ipw_priv { struct work_struct led_act_off; struct work_struct merge_networks; + struct ipw_cmd_log *cmdlog; + int cmdlog_len; + int cmdlog_pos; + #define IPW_2200BG 1 #define IPW_2915ABG 2 u8 adapter; @@ -1853,6 +1858,12 @@ struct host_cmd { u32 param[TFD_CMD_IMMEDIATE_PAYLOAD_LENGTH]; } __attribute__ ((packed)); +struct ipw_cmd_log { + unsigned long jiffies; + int retcode; + struct host_cmd cmd; +}; + #define CFG_BT_COEXISTENCE_MIN 0x00 #define CFG_BT_COEXISTENCE_DEFER 0x02 #define CFG_BT_COEXISTENCE_KILL 0x04 -- cgit v1.2.2 From 1fe0adb4314009362d28205bbf09f6d758e82002 Mon Sep 17 00:00:00 2001 From: Liu Hong Date: Fri, 19 Aug 2005 09:33:10 -0500 Subject: Migrated some of the channel verification code back into the driver to keep regulatory consistency in one location. Signed-off-by: James Ketrenos --- drivers/net/wireless/ipw2200.c | 173 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 152 insertions(+), 21 deletions(-) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index bcb5993b68bd..40759e5f3cc5 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -149,6 +149,12 @@ static int init_supported_rates(struct ipw_priv *priv, static void ipw_set_hwcrypto_keys(struct ipw_priv *); static void ipw_send_wep_keys(struct ipw_priv *, int); +static int ipw_is_valid_channel(struct ieee80211_device *, u8); +static int ipw_channel_to_index(struct ieee80211_device *, u8); +static u8 ipw_freq_to_channel(struct ieee80211_device *, u32); +static int ipw_set_geo(struct ieee80211_device *, const struct ieee80211_geo *); +static const struct ieee80211_geo *ipw_get_geo(struct ieee80211_device *); + static int snprint_line(char *buf, size_t count, const u8 * data, u32 len, u32 ofs) { @@ -1596,7 +1602,7 @@ static ssize_t store_speed_scan(struct device *d, struct device_attribute *attr, break; } - if (ieee80211_is_valid_channel(priv->ieee, channel)) + if (ipw_is_valid_channel(priv->ieee, channel)) priv->speed_scan[pos++] = channel; else IPW_WARNING("Skipping invalid channel request: %d\n", @@ -2194,7 +2200,7 @@ static int ipw_send_tx_power(struct ipw_priv *priv, struct ipw_tx_power *power) static int ipw_set_tx_power(struct ipw_priv *priv) { - const struct ieee80211_geo *geo = ieee80211_get_geo(priv->ieee); + const struct ieee80211_geo *geo = ipw_get_geo(priv->ieee); struct ipw_tx_power tx_power; s8 max_power; int i; @@ -5503,6 +5509,15 @@ static int ipw_best_network(struct ipw_priv *priv, return 0; } + /* Filter out invalid channel in current GEO */ + if (!ipw_is_valid_channel(priv->ieee, network->channel)) { + IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " + "because of invalid channel in current GEO\n", + escape_essid(network->ssid, network->ssid_len), + MAC_ARG(network->bssid)); + return 0; + } + /* Ensure that the rates supported by the driver are compatible with * this AP, including verification of basic rates (mandatory) */ if (!ipw_compatible_rates(priv, network, &rates)) { @@ -5540,7 +5555,7 @@ static int ipw_best_network(struct ipw_priv *priv, static void ipw_adhoc_create(struct ipw_priv *priv, struct ieee80211_network *network) { - const struct ieee80211_geo *geo = ieee80211_get_geo(priv->ieee); + const struct ieee80211_geo *geo = ipw_get_geo(priv->ieee); int i; /* @@ -5555,10 +5570,10 @@ static void ipw_adhoc_create(struct ipw_priv *priv, * FW fatal error. * */ - switch (ieee80211_is_valid_channel(priv->ieee, priv->channel)) { + switch (ipw_is_valid_channel(priv->ieee, priv->channel)) { case IEEE80211_52GHZ_BAND: network->mode = IEEE_A; - i = ieee80211_channel_to_index(priv->ieee, priv->channel); + i = ipw_channel_to_index(priv->ieee, priv->channel); if (i == -1) BUG(); if (geo->a[i].flags & IEEE80211_CH_PASSIVE_ONLY) { @@ -5572,6 +5587,13 @@ static void ipw_adhoc_create(struct ipw_priv *priv, network->mode = IEEE_G; else network->mode = IEEE_B; + i = ipw_channel_to_index(priv->ieee, priv->channel); + if (i == -1) + BUG(); + if (geo->bg[i].flags & IEEE80211_CH_PASSIVE_ONLY) { + IPW_WARNING("Overriding invalid channel\n"); + priv->channel = geo->bg[0].channel; + } break; default: @@ -5899,7 +5921,7 @@ static void ipw_add_scan_channels(struct ipw_priv *priv, const struct ieee80211_geo *geo; int i; - geo = ieee80211_get_geo(priv->ieee); + geo = ipw_get_geo(priv->ieee); if (priv->ieee->freq_band & IEEE80211_52GHZ_BAND) { int start = channel_index; @@ -5909,7 +5931,11 @@ static void ipw_add_scan_channels(struct ipw_priv *priv, continue; channel_index++; scan->channels_list[channel_index] = geo->a[i].channel; - ipw_set_scan_type(scan, channel_index, scan_type); + ipw_set_scan_type(scan, channel_index, + geo->a[i]. + flags & IEEE80211_CH_PASSIVE_ONLY ? + IPW_SCAN_PASSIVE_FULL_DWELL_SCAN : + scan_type); } if (start != channel_index) { @@ -5922,6 +5948,7 @@ static void ipw_add_scan_channels(struct ipw_priv *priv, if (priv->ieee->freq_band & IEEE80211_24GHZ_BAND) { int start = channel_index; if (priv->config & CFG_SPEED_SCAN) { + int index; u8 channels[IEEE80211_24GHZ_CHANNELS] = { /* nop out the list */ [0] = 0 @@ -5953,8 +5980,14 @@ static void ipw_add_scan_channels(struct ipw_priv *priv, priv->speed_scan_pos++; channel_index++; scan->channels_list[channel_index] = channel; + index = + ipw_channel_to_index(priv->ieee, channel); ipw_set_scan_type(scan, channel_index, - scan_type); + geo->bg[index]. + flags & + IEEE80211_CH_PASSIVE_ONLY ? + IPW_SCAN_PASSIVE_FULL_DWELL_SCAN + : scan_type); } } else { for (i = 0; i < geo->bg_channels; i++) { @@ -5965,7 +5998,11 @@ static void ipw_add_scan_channels(struct ipw_priv *priv, scan->channels_list[channel_index] = geo->bg[i].channel; ipw_set_scan_type(scan, channel_index, - scan_type); + geo->bg[i]. + flags & + IEEE80211_CH_PASSIVE_ONLY ? + IPW_SCAN_PASSIVE_FULL_DWELL_SCAN + : scan_type); } } @@ -6017,7 +6054,7 @@ static int ipw_request_scan(struct ipw_priv *priv) scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN] = cpu_to_le16(20); - scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] = cpu_to_le16(20); + scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] = cpu_to_le16(120); scan.full_scan_index = cpu_to_le32(ieee80211_get_scans(priv->ieee)); @@ -6026,7 +6063,7 @@ static int ipw_request_scan(struct ipw_priv *priv) u8 channel; u8 band = 0; - switch (ieee80211_is_valid_channel(priv->ieee, priv->channel)) { + switch (ipw_is_valid_channel(priv->ieee, priv->channel)) { case IEEE80211_52GHZ_BAND: band = (u8) (IPW_A_MODE << 6) | 1; channel = priv->channel; @@ -8401,10 +8438,11 @@ static int ipw_wx_set_freq(struct net_device *dev, union iwreq_data *wrqu, char *extra) { struct ipw_priv *priv = ieee80211_priv(dev); - const struct ieee80211_geo *geo = ieee80211_get_geo(priv->ieee); + const struct ieee80211_geo *geo = ipw_get_geo(priv->ieee); struct iw_freq *fwrq = &wrqu->freq; int ret = 0, i; - u8 channel; + u8 channel, flags; + int band; if (fwrq->m == 0) { IPW_DEBUG_WX("SET Freq/Channel -> any\n"); @@ -8415,20 +8453,23 @@ static int ipw_wx_set_freq(struct net_device *dev, } /* if setting by freq convert to channel */ if (fwrq->e == 1) { - channel = ieee80211_freq_to_channel(priv->ieee, fwrq->m); + channel = ipw_freq_to_channel(priv->ieee, fwrq->m); if (channel == 0) return -EINVAL; } else channel = fwrq->m; - if (!ieee80211_is_valid_channel(priv->ieee, channel)) + if (!(band = ipw_is_valid_channel(priv->ieee, channel))) return -EINVAL; - if (priv->ieee->iw_mode == IW_MODE_ADHOC && priv->ieee->mode & IEEE_A) { - i = ieee80211_channel_to_index(priv->ieee, channel); + if (priv->ieee->iw_mode == IW_MODE_ADHOC) { + i = ipw_channel_to_index(priv->ieee, channel); if (i == -1) return -EINVAL; - if (geo->a[i].flags & IEEE80211_CH_PASSIVE_ONLY) { + + flags = (band == IEEE80211_24GHZ_BAND) ? + geo->bg[i].flags : geo->a[i].flags; + if (flags & IEEE80211_CH_PASSIVE_ONLY) { IPW_DEBUG_WX("Invalid Ad-Hoc channel for 802.11a\n"); return -EINVAL; } @@ -8546,7 +8587,7 @@ static int ipw_wx_get_range(struct net_device *dev, { struct ipw_priv *priv = ieee80211_priv(dev); struct iw_range *range = (struct iw_range *)extra; - const struct ieee80211_geo *geo = ieee80211_get_geo(priv->ieee); + const struct ieee80211_geo *geo = ipw_get_geo(priv->ieee); int i = 0, j; wrqu->data.length = sizeof(*range); @@ -9147,7 +9188,7 @@ static int ipw_request_direct_scan(struct ipw_priv *priv, char *essid, scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN] = cpu_to_le16(20); - scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] = cpu_to_le16(20); + scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] = cpu_to_le16(120); scan.dwell_time[IPW_SCAN_ACTIVE_DIRECT_SCAN] = cpu_to_le16(20); scan.full_scan_index = cpu_to_le32(ieee80211_get_scans(priv->ieee)); @@ -10775,6 +10816,96 @@ static const struct ieee80211_geo ipw_geos[] = { } }; +/* GEO code borrowed from ieee80211_geo.c */ +static int ipw_is_valid_channel(struct ieee80211_device *ieee, u8 channel) +{ + int i; + + /* Driver needs to initialize the geography map before using + * these helper functions */ + BUG_ON(ieee->geo.bg_channels == 0 && ieee->geo.a_channels == 0); + + if (ieee->freq_band & IEEE80211_24GHZ_BAND) + for (i = 0; i < ieee->geo.bg_channels; i++) + /* NOTE: If G mode is currently supported but + * this is a B only channel, we don't see it + * as valid. */ + if ((ieee->geo.bg[i].channel == channel) && + (!(ieee->mode & IEEE_G) || + !(ieee->geo.bg[i].flags & IEEE80211_CH_B_ONLY))) + return IEEE80211_24GHZ_BAND; + + if (ieee->freq_band & IEEE80211_52GHZ_BAND) + for (i = 0; i < ieee->geo.a_channels; i++) + if (ieee->geo.a[i].channel == channel) + return IEEE80211_52GHZ_BAND; + + return 0; +} + +static int ipw_channel_to_index(struct ieee80211_device *ieee, u8 channel) +{ + int i; + + /* Driver needs to initialize the geography map before using + * these helper functions */ + BUG_ON(ieee->geo.bg_channels == 0 && ieee->geo.a_channels == 0); + + if (ieee->freq_band & IEEE80211_24GHZ_BAND) + for (i = 0; i < ieee->geo.bg_channels; i++) + if (ieee->geo.bg[i].channel == channel) + return i; + + if (ieee->freq_band & IEEE80211_52GHZ_BAND) + for (i = 0; i < ieee->geo.a_channels; i++) + if (ieee->geo.a[i].channel == channel) + return i; + + return -1; +} + +static u8 ipw_freq_to_channel(struct ieee80211_device *ieee, u32 freq) +{ + int i; + + /* Driver needs to initialize the geography map before using + * these helper functions */ + BUG_ON(ieee->geo.bg_channels == 0 && ieee->geo.a_channels == 0); + + freq /= 100000; + + if (ieee->freq_band & IEEE80211_24GHZ_BAND) + for (i = 0; i < ieee->geo.bg_channels; i++) + if (ieee->geo.bg[i].freq == freq) + return ieee->geo.bg[i].channel; + + if (ieee->freq_band & IEEE80211_52GHZ_BAND) + for (i = 0; i < ieee->geo.a_channels; i++) + if (ieee->geo.a[i].freq == freq) + return ieee->geo.a[i].channel; + + return 0; +} + +static int ipw_set_geo(struct ieee80211_device *ieee, + const struct ieee80211_geo *geo) +{ + memcpy(ieee->geo.name, geo->name, 3); + ieee->geo.name[3] = '\0'; + ieee->geo.bg_channels = geo->bg_channels; + ieee->geo.a_channels = geo->a_channels; + memcpy(ieee->geo.bg, geo->bg, geo->bg_channels * + sizeof(struct ieee80211_channel)); + memcpy(ieee->geo.a, geo->a, ieee->geo.a_channels * + sizeof(struct ieee80211_channel)); + return 0; +} + +static const struct ieee80211_geo *ipw_get_geo(struct ieee80211_device *ieee) +{ + return &ieee->geo; +} + #define MAX_HW_RESTARTS 5 static int ipw_up(struct ipw_priv *priv) { @@ -10816,7 +10947,7 @@ static int ipw_up(struct ipw_priv *priv) } if (j == ARRAY_SIZE(ipw_geos)) j = 0; - if (ieee80211_set_geo(priv->ieee, &ipw_geos[j])) { + if (ipw_set_geo(priv->ieee, &ipw_geos[j])) { IPW_WARNING("Could not set geography."); return 0; } -- cgit v1.2.2 From 3b9990cb1751d3d267c0e5c94bff0f155c944c66 Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Fri, 19 Aug 2005 13:18:55 -0500 Subject: Updated ipw2200 to use the new ieee80211 callbacks (handle_probe_response, handle_beacon, handle_association_response). Fixed a problem with ipw_send_cmd() returning non-zero on success. Signed-off-by: James Ketrenos --- drivers/net/wireless/ipw2200.c | 61 ++++++++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 26 deletions(-) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 40759e5f3cc5..53a6bb2dbd4c 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -1925,7 +1925,8 @@ static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) goto exit; } spin_unlock_irqrestore(&priv->lock, flags); - } + } else + rc = 0; if (priv->status & STATUS_RF_KILL_HW) { IPW_ERROR("Failed to send %s: Aborted due to RF kill switch.\n", @@ -7011,9 +7012,9 @@ u8 ipw_qos_current_mode(struct ipw_priv * priv) /* * Handle management frame beacon and probe response */ -static int ipw_qos_handle_probe_reponse(struct ipw_priv *priv, - int active_network, - struct ieee80211_network *network) +static int ipw_qos_handle_probe_response(struct ipw_priv *priv, + int active_network, + struct ieee80211_network *network) { u32 size = sizeof(struct ieee80211_qos_parameters); @@ -7407,35 +7408,41 @@ static void ipw_bg_qos_activate(void *data) up(&priv->sem); } -/* -* Handler for probe responce and beacon frame -*/ -static int ipw_handle_management(struct net_device *dev, - struct ieee80211_network *network, u16 type) +static int ipw_handle_probe_response(struct net_device *dev, + struct ieee80211_probe_response *resp, + struct ieee80211_network *network) { struct ipw_priv *priv = ieee80211_priv(dev); - int active_network; + int active_network = ((priv->status & STATUS_ASSOCIATED) && + (network == priv->assoc_network)); - if (priv->status & STATUS_ASSOCIATED && network == priv->assoc_network) - active_network = 1; - else - active_network = 0; + ipw_qos_handle_probe_response(priv, active_network, network); - switch (type) { - case IEEE80211_STYPE_PROBE_RESP: - case IEEE80211_STYPE_BEACON: - ipw_qos_handle_probe_reponse(priv, active_network, network); - break; - case IEEE80211_STYPE_ASSOC_RESP: - ipw_qos_association_resp(priv, network); - break; - default: - break; - } + return 0; +} + +static int ipw_handle_beacon(struct net_device *dev, + struct ieee80211_beacon *resp, + struct ieee80211_network *network) +{ + struct ipw_priv *priv = ieee80211_priv(dev); + int active_network = ((priv->status & STATUS_ASSOCIATED) && + (network == priv->assoc_network)); + + ipw_qos_handle_probe_response(priv, active_network, network); return 0; } +static int ipw_handle_assoc_response(struct net_device *dev, + struct ieee80211_assoc_response *resp, + struct ieee80211_network *network) +{ + struct ipw_priv *priv = ieee80211_priv(dev); + ipw_qos_association_resp(priv, network); + return 0; +} + static int ipw_send_qos_params_command(struct ipw_priv *priv, struct ieee80211_qos_parameters *qos_param) { @@ -11260,7 +11267,9 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) priv->ieee->is_queue_full = ipw_net_is_queue_full; #ifdef CONFIG_IPW_QOS - priv->ieee->handle_management = ipw_handle_management; + priv->ieee->handle_probe_response = ipw_handle_beacon; + priv->ieee->handle_beacon = ipw_handle_probe_response; + priv->ieee->handle_assoc_response = ipw_handle_assoc_response; #endif /* CONFIG_IPW_QOS */ priv->ieee->perfect_rssi = -20; -- cgit v1.2.2 From a0e04ab36048eb1c3da2524b5b0b802b6ab064f0 Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Thu, 25 Aug 2005 00:49:43 -0500 Subject: Added wait_state wakeup on scan completion. Fixed copyright date in ipw2200.h Signed-off-by: James Ketrenos --- drivers/net/wireless/ipw2200.c | 1 + drivers/net/wireless/ipw2200.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 53a6bb2dbd4c..9ced5b778a77 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -4450,6 +4450,7 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, priv->status &= ~(STATUS_SCANNING | STATUS_SCAN_ABORTING); + wake_up_interruptible(&priv->wait_state); cancel_delayed_work(&priv->scan_check); if (priv->status & STATUS_EXIT_PENDING) diff --git a/drivers/net/wireless/ipw2200.h b/drivers/net/wireless/ipw2200.h index 255f0cb66f64..f2056b62254e 100644 --- a/drivers/net/wireless/ipw2200.h +++ b/drivers/net/wireless/ipw2200.h @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright(c) 2003 - 2004 Intel Corporation. All rights reserved. + Copyright(c) 2003 - 2005 Intel Corporation. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as -- cgit v1.2.2 From 7b99659f97ca20e5f1ea56253a9449d278d825d5 Mon Sep 17 00:00:00 2001 From: Hong Liu Date: Thu, 25 Aug 2005 17:36:13 +0800 Subject: [Bug 455] Fix frequent channel change generates firmware fatal error. Because of the frequent channel change, it is possible that when we are try to associate with channel 1 (authenticated but not associated). Another channel change comes at this time, then the driver will issue disassociate command to the firmware which will cause the fatal error. It seems that the association/disassociation procedure should not be interrupted. The patch attached adds test on STATUS_ASSOCIATING | STATUS_DISASSOCIATING in ipw_send_cmd(), when ensures that commands will not be sent to firmware when we are in these two status. Signed-off-by: Hong Liu Signed-off-by: Zhu Yi --- drivers/net/wireless/ipw2200.c | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 9ced5b778a77..4cdb4748b761 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -1884,6 +1884,18 @@ static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) return -EAGAIN; } + if (priv->status & STATUS_ASSOCIATING) { + IPW_DEBUG_HC("abandon a command while associating\n"); + spin_unlock_irqrestore(&priv->lock, flags); + return -1; + } + + if (priv->status & STATUS_DISASSOCIATING) { + IPW_DEBUG_HC("abandon a command while disassociating\n"); + spin_unlock_irqrestore(&priv->lock, flags); + return -1; + } + priv->status |= STATUS_HCMD_ACTIVE; if (priv->cmdlog) { @@ -3671,7 +3683,13 @@ static void ipw_send_disassociate(struct ipw_priv *priv, int quiet) { int err; - if (!(priv->status & (STATUS_ASSOCIATING | STATUS_ASSOCIATED))) { + if (priv->status & STATUS_ASSOCIATING) { + IPW_DEBUG_ASSOC("Disassociating while associating.\n"); + queue_work(priv->workqueue, &priv->disassociate); + return; + } + + if (!(priv->status & STATUS_ASSOCIATED)) { IPW_DEBUG_ASSOC("Disassociating while not associated.\n"); return; } @@ -3681,9 +3699,6 @@ static void ipw_send_disassociate(struct ipw_priv *priv, int quiet) MAC_ARG(priv->assoc_request.bssid), priv->assoc_request.channel); - priv->status &= ~(STATUS_ASSOCIATING | STATUS_ASSOCIATED); - priv->status |= STATUS_DISASSOCIATING; - if (quiet) priv->assoc_request.assoc_type = HC_DISASSOC_QUIET; else @@ -3695,6 +3710,9 @@ static void ipw_send_disassociate(struct ipw_priv *priv, int quiet) return; } + priv->status &= ~(STATUS_ASSOCIATING | STATUS_ASSOCIATED); + priv->status |= STATUS_DISASSOCIATING; + } static int ipw_disassociate(void *data) @@ -7625,8 +7643,6 @@ static int ipw_associate_network(struct ipw_priv *priv, */ priv->channel = network->channel; memcpy(priv->bssid, network->bssid, ETH_ALEN); - priv->status |= STATUS_ASSOCIATING; - priv->status &= ~STATUS_SECURITY_UPDATED; priv->assoc_network = network; @@ -7640,6 +7656,9 @@ static int ipw_associate_network(struct ipw_priv *priv, return err; } + priv->status |= STATUS_ASSOCIATING; + priv->status &= ~STATUS_SECURITY_UPDATED; + IPW_DEBUG(IPW_DL_STATE, "associating: '%s' " MAC_FMT " \n", escape_essid(priv->essid, priv->essid_len), MAC_ARG(priv->bssid)); -- cgit v1.2.2 From 55135791819270a412dfb99f66301f02c72edadf Mon Sep 17 00:00:00 2001 From: Zhu Yi Date: Thu, 25 Aug 2005 17:43:14 +0800 Subject: [Bug 760] Fix setting WEP key in monitor mode causes IV lost. Signed-off-by: Zhu Yi --- drivers/net/wireless/ipw2200.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 4cdb4748b761..bda292f7f82c 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -7907,7 +7907,7 @@ static void ipw_handle_data_packet(struct ipw_priv *priv, IPW_DEBUG_RX("Rx packet of %d bytes.\n", rxb->skb->len); /* HW decrypt will not clear the WEP bit, MIC, PN, etc. */ - if (!priv->ieee->host_decrypt) + if (!priv->ieee->host_decrypt && priv->ieee->iw_mode != IW_MODE_MONITOR) ipw_rebuild_decrypted_skb(priv, rxb->skb); if (!ieee80211_rx(priv->ieee, rxb->skb, stats)) -- cgit v1.2.2 From 054b08d48464bfa8e5be69829b59bd599c5dcd72 Mon Sep 17 00:00:00 2001 From: Hong Liu Date: Thu, 25 Aug 2005 17:45:49 +0800 Subject: Don't set hardware WEP if we are actually using TKIP/AES. Signed-off-by: Hong Liu --- drivers/net/wireless/ipw2100.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c index eaf47078ee56..83ba08c0c33c 100644 --- a/drivers/net/wireless/ipw2100.c +++ b/drivers/net/wireless/ipw2100.c @@ -5443,8 +5443,11 @@ static void shim__set_security(struct net_device *dev, else memcpy(priv->ieee->sec.keys[i], sec->keys[i], sec->key_sizes[i]); - priv->ieee->sec.flags |= (1 << i); - priv->status |= STATUS_SECURITY_UPDATED; + if (sec->level == SEC_LEVEL_1) { + priv->ieee->sec.flags |= (1 << i); + priv->status |= STATUS_SECURITY_UPDATED; + } else + priv->ieee->sec.flags &= ~(1 << i); } } -- cgit v1.2.2 From a4f6bbb305123c2c42322a10a770be64089a17ca Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Fri, 26 Aug 2005 00:33:34 -0500 Subject: Make all the places the firmware fails to load showerrors (in decimal, so you can cross-reference errno.h easily). Signed-off-by: Peter Jones Signed-off-by: James Ketrenos --- drivers/net/wireless/ipw2200.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index bda292f7f82c..79697e8e8d96 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -3304,7 +3304,7 @@ static int ipw_load(struct ipw_priv *priv) rc = ipw_load_firmware(priv, bootfw->data + sizeof(struct fw_header), bootfw->size - sizeof(struct fw_header)); if (rc < 0) { - IPW_ERROR("Unable to load boot firmware\n"); + IPW_ERROR("Unable to load boot firmware: %d\n", rc); goto error; } @@ -3327,7 +3327,7 @@ static int ipw_load(struct ipw_priv *priv) rc = ipw_load_ucode(priv, ucode->data + sizeof(struct fw_header), ucode->size - sizeof(struct fw_header)); if (rc < 0) { - IPW_ERROR("Unable to load ucode\n"); + IPW_ERROR("Unable to load ucode: %d\n", rc); goto error; } @@ -3339,7 +3339,7 @@ static int ipw_load(struct ipw_priv *priv) sizeof(struct fw_header), firmware->size - sizeof(struct fw_header)); if (rc < 0) { - IPW_ERROR("Unable to load firmware\n"); + IPW_ERROR("Unable to load firmware: %d\n", rc); goto error; } @@ -10958,7 +10958,7 @@ static int ipw_up(struct ipw_priv *priv) * Also start the clocks. */ rc = ipw_load(priv); if (rc) { - IPW_ERROR("Unable to load firmware: 0x%08X\n", rc); + IPW_ERROR("Unable to load firmware: %d\n", rc); return rc; } -- cgit v1.2.2 From 24a47dbd89a2738bc149de4685ae5a2a97193ae1 Mon Sep 17 00:00:00 2001 From: Mike Kershaw Date: Fri, 26 Aug 2005 00:41:54 -0500 Subject: Adds radiotap support to ipw2200 in monitor mode.. Signed-off-by: Mike Kershaw Signed-off-by: James Ketrenos --- drivers/net/wireless/ipw2200.c | 185 +++++++++++++++++++++++++++++++++++++++++ drivers/net/wireless/ipw2200.h | 1 + 2 files changed, 186 insertions(+) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 79697e8e8d96..86a4c2358f9d 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -7918,6 +7918,173 @@ static void ipw_handle_data_packet(struct ipw_priv *priv, } } +#ifdef CONFIG_IEEE80211_RADIOTAP +static void ipw_handle_data_packet_monitor(struct ipw_priv *priv, + struct ipw_rx_mem_buffer *rxb, + struct ieee80211_rx_stats *stats) +{ + struct ipw_rx_packet *pkt = (struct ipw_rx_packet *)rxb->skb->data; + struct ipw_rx_frame *frame = &pkt->u.frame; + + /* initial pull of some data */ + u16 received_channel = frame->received_channel; + u8 antennaAndPhy = frame->antennaAndPhy; + s8 antsignal = frame->rssi_dbm - IPW_RSSI_TO_DBM; /* call it signed anyhow */ + u16 pktrate = frame->rate; + + /* Magic struct that slots into the radiotap header -- no reason + * to build this manually element by element, we can write it much + * more efficiently than we can parse it. ORDER MATTERS HERE */ + struct ipw_rt_hdr { + struct ieee80211_radiotap_header rt_hdr; + u8 rt_flags; /* radiotap packet flags */ + u8 rt_rate; /* rate in 500kb/s */ + u16 rt_channel; /* channel in mhz */ + u16 rt_chbitmask; /* channel bitfield */ + s8 rt_dbmsignal; /* signal in dbM, kluged to signed */ + u8 rt_antenna; /* antenna number */ + } *ipw_rt; + + short len = le16_to_cpu(pkt->u.frame.length); + + /* We received data from the HW, so stop the watchdog */ + priv->net_dev->trans_start = jiffies; + + /* We only process data packets if the + * interface is open */ + if (unlikely((le16_to_cpu(pkt->u.frame.length) + IPW_RX_FRAME_SIZE) > + skb_tailroom(rxb->skb))) { + priv->ieee->stats.rx_errors++; + priv->wstats.discard.misc++; + IPW_DEBUG_DROP("Corruption detected! Oh no!\n"); + return; + } else if (unlikely(!netif_running(priv->net_dev))) { + priv->ieee->stats.rx_dropped++; + priv->wstats.discard.misc++; + IPW_DEBUG_DROP("Dropping packet while interface is not up.\n"); + return; + } + + /* Libpcap 0.9.3+ can handle variable length radiotap, so we'll use + * that now */ + if (len > IPW_RX_BUF_SIZE - sizeof(struct ipw_rt_hdr)) { + /* FIXME: Should alloc bigger skb instead */ + priv->ieee->stats.rx_dropped++; + priv->wstats.discard.misc++; + IPW_DEBUG_DROP("Dropping too large packet in monitor\n"); + return; + } + + /* copy the frame itself */ + memmove(rxb->skb->data + sizeof(struct ipw_rt_hdr), + rxb->skb->data + IPW_RX_FRAME_SIZE, len); + + /* Zero the radiotap static buffer ... We only need to zero the bytes NOT + * part of our real header, saves a little time. + * + * No longer necessary since we fill in all our data. Purge before merging + * patch officially. + * memset(rxb->skb->data + sizeof(struct ipw_rt_hdr), 0, + * IEEE80211_RADIOTAP_HDRLEN - sizeof(struct ipw_rt_hdr)); + */ + + ipw_rt = (struct ipw_rt_hdr *)rxb->skb->data; + + ipw_rt->rt_hdr.it_version = PKTHDR_RADIOTAP_VERSION; + ipw_rt->rt_hdr.it_pad = 0; /* always good to zero */ + ipw_rt->rt_hdr.it_len = sizeof(struct ipw_rt_hdr); /* total header+data */ + + /* Big bitfield of all the fields we provide in radiotap */ + ipw_rt->rt_hdr.it_present = + ((1 << IEEE80211_RADIOTAP_FLAGS) | + (1 << IEEE80211_RADIOTAP_RATE) | + (1 << IEEE80211_RADIOTAP_CHANNEL) | + (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) | + (1 << IEEE80211_RADIOTAP_ANTENNA)); + + /* Zero the flags, we'll add to them as we go */ + ipw_rt->rt_flags = 0; + + /* Convert signal to DBM */ + ipw_rt->rt_dbmsignal = antsignal; + + /* Convert the channel data and set the flags */ + ipw_rt->rt_channel = cpu_to_le16(ieee80211chan2mhz(received_channel)); + if (received_channel > 14) { /* 802.11a */ + ipw_rt->rt_chbitmask = + cpu_to_le16((IEEE80211_CHAN_OFDM | IEEE80211_CHAN_5GHZ)); + } else if (antennaAndPhy & 32) { /* 802.11b */ + ipw_rt->rt_chbitmask = + cpu_to_le16((IEEE80211_CHAN_CCK | IEEE80211_CHAN_2GHZ)); + } else { /* 802.11g */ + ipw_rt->rt_chbitmask = + (IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ); + } + + /* set the rate in multiples of 500k/s */ + switch (pktrate) { + case IPW_TX_RATE_1MB: + ipw_rt->rt_rate = 2; + break; + case IPW_TX_RATE_2MB: + ipw_rt->rt_rate = 4; + break; + case IPW_TX_RATE_5MB: + ipw_rt->rt_rate = 10; + break; + case IPW_TX_RATE_6MB: + ipw_rt->rt_rate = 12; + break; + case IPW_TX_RATE_9MB: + ipw_rt->rt_rate = 18; + break; + case IPW_TX_RATE_11MB: + ipw_rt->rt_rate = 22; + break; + case IPW_TX_RATE_12MB: + ipw_rt->rt_rate = 24; + break; + case IPW_TX_RATE_18MB: + ipw_rt->rt_rate = 36; + break; + case IPW_TX_RATE_24MB: + ipw_rt->rt_rate = 48; + break; + case IPW_TX_RATE_36MB: + ipw_rt->rt_rate = 72; + break; + case IPW_TX_RATE_48MB: + ipw_rt->rt_rate = 96; + break; + case IPW_TX_RATE_54MB: + ipw_rt->rt_rate = 108; + break; + default: + ipw_rt->rt_rate = 0; + break; + } + + /* antenna number */ + ipw_rt->rt_antenna = (antennaAndPhy & 3); /* Is this right? */ + + /* set the preamble flag if we have it */ + if ((antennaAndPhy & 64)) + ipw_rt->rt_flags |= IEEE80211_RADIOTAP_F_SHORTPRE; + + /* Set the size of the skb to the size of the frame */ + skb_put(rxb->skb, len + sizeof(struct ipw_rt_hdr)); + + IPW_DEBUG_RX("Rx packet of %d bytes.\n", rxb->skb->len); + + if (!ieee80211_rx(priv->ieee, rxb->skb, stats)) + priv->ieee->stats.rx_errors++; + else { /* ieee80211_rx succeeded, so it now owns the SKB */ + rxb->skb = NULL; + /* no LED during capture */ + } +} +#endif + static inline int is_network_packet(struct ipw_priv *priv, struct ieee80211_hdr_4addr *header) { @@ -8147,8 +8314,14 @@ static void ipw_rx(struct ipw_priv *priv) #ifdef CONFIG_IPW2200_MONITOR if (priv->ieee->iw_mode == IW_MODE_MONITOR) { +#ifdef CONFIG_IEEE80211_RADIOTAP + ipw_handle_data_packet_monitor(priv, + rxb, + &stats); +#else ipw_handle_data_packet(priv, rxb, &stats); +#endif break; } #endif @@ -8315,7 +8488,11 @@ static int ipw_sw_reset(struct ipw_priv *priv, int init) #ifdef CONFIG_IPW2200_MONITOR case 2: priv->ieee->iw_mode = IW_MODE_MONITOR; +#ifdef CONFIG_IEEE80211_RADIOTAP + priv->net_dev->type = ARPHRD_IEEE80211_RADIOTAP; +#else priv->net_dev->type = ARPHRD_IEEE80211; +#endif break; #endif default: @@ -8565,7 +8742,11 @@ static int ipw_wx_set_mode(struct net_device *dev, priv->net_dev->type = ARPHRD_ETHER; if (wrqu->mode == IW_MODE_MONITOR) +#ifdef CONFIG_IEEE80211_RADIOTAP + priv->net_dev->type = ARPHRD_IEEE80211_RADIOTAP; +#else priv->net_dev->type = ARPHRD_IEEE80211; +#endif #endif /* CONFIG_IPW2200_MONITOR */ /* Free the existing firmware and reset the fw_loaded @@ -9598,7 +9779,11 @@ static int ipw_wx_set_monitor(struct net_device *dev, IPW_DEBUG_WX("SET MONITOR: %d %d\n", enable, parms[1]); if (enable) { if (priv->ieee->iw_mode != IW_MODE_MONITOR) { +#ifdef CONFIG_IEEE80211_RADIOTAP + priv->net_dev->type = ARPHRD_IEEE80211_RADIOTAP; +#else priv->net_dev->type = ARPHRD_IEEE80211; +#endif queue_work(priv->workqueue, &priv->adapter_restart); } diff --git a/drivers/net/wireless/ipw2200.h b/drivers/net/wireless/ipw2200.h index f2056b62254e..28f1216f8ea4 100644 --- a/drivers/net/wireless/ipw2200.h +++ b/drivers/net/wireless/ipw2200.h @@ -50,6 +50,7 @@ #include #include +#include #define DRV_NAME "ipw2200" -- cgit v1.2.2 From 90700fd982022f0519e7bd7595adb8084f36d1c6 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Fri, 26 Aug 2005 16:51:06 -0500 Subject: Fixed is_network_packet() to include checking for broadcast packets. Signed-off-by: James Ketrenos --- drivers/net/wireless/ipw2200.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 86a4c2358f9d..d417ed7af7c1 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -8096,21 +8096,23 @@ static inline int is_network_packet(struct ipw_priv *priv, if (!memcmp(header->addr2, priv->net_dev->dev_addr, ETH_ALEN)) return 0; - /* multicast packets to our IBSS go through */ - if (is_multicast_ether_addr(header->addr1)) + /* {broad,multi}cast packets to our BSSID go through */ + if (is_multicast_ether_addr(header->addr1) || + is_broadcast_ether_addr(header->addr1)) return !memcmp(header->addr3, priv->bssid, ETH_ALEN); /* packets to our adapter go through */ return !memcmp(header->addr1, priv->net_dev->dev_addr, ETH_ALEN); - case IW_MODE_INFRA: /* Header: Dest. | AP{BSSID} | Source */ + case IW_MODE_INFRA: /* Header: Dest. | BSSID | Source */ /* packets from our adapter are dropped (echo) */ if (!memcmp(header->addr3, priv->net_dev->dev_addr, ETH_ALEN)) return 0; - /* {broad,multi}cast packets to our IBSS go through */ - if (is_multicast_ether_addr(header->addr1)) + /* {broad,multi}cast packets to our BSS go through */ + if (is_multicast_ether_addr(header->addr1) || + is_broadcast_ether_addr(header->addr1)) return !memcmp(header->addr2, priv->bssid, ETH_ALEN); /* packets to our adapter go through */ -- cgit v1.2.2 From 567deaf6d4a3372cd16b8719741ca3a6157c9615 Mon Sep 17 00:00:00 2001 From: Hong Liu Date: Wed, 31 Aug 2005 18:07:22 +0800 Subject: Mixed PTK/GTK CCMP/TKIP support. Signed-off-by: Hong Liu --- drivers/net/wireless/ipw2200.c | 50 +++++++++++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 13 deletions(-) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index d417ed7af7c1..c9b306a8116c 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -5771,7 +5771,8 @@ static void ipw_set_hwcrypto_keys(struct ipw_priv *priv) DCT_FLAG_EXT_SECURITY_CCM, priv->ieee->sec.active_key); - ipw_send_wep_keys(priv, DCW_WEP_KEY_SEC_TYPE_CCM); + if (!priv->ieee->host_mc_decrypt) + ipw_send_wep_keys(priv, DCW_WEP_KEY_SEC_TYPE_CCM); break; case SEC_LEVEL_2: if (priv->ieee->sec.flags & SEC_ACTIVE_KEY) @@ -5786,9 +5787,6 @@ static void ipw_set_hwcrypto_keys(struct ipw_priv *priv) default: break; } - - ipw_set_hw_decrypt_unicast(priv, priv->ieee->sec.level); - ipw_set_hw_decrypt_multicast(priv, priv->ieee->sec.level); } static void ipw_adhoc_check(void *data) @@ -6473,6 +6471,7 @@ static int ipw_wpa_set_encryption(struct net_device *dev, struct ipw_param *param, int param_len) { int ret = 0; + int group_key = 0; struct ipw_priv *priv = ieee80211_priv(dev); struct ieee80211_device *ieee = priv->ieee; struct ieee80211_crypto_ops *ops; @@ -6502,6 +6501,9 @@ static int ipw_wpa_set_encryption(struct net_device *dev, return -EINVAL; } + if (param->u.crypt.idx != 0) + group_key = 1; + sec.flags |= SEC_ENABLED | SEC_ENCRYPT; if (strcmp(param->u.crypt.alg, "none") == 0) { if (crypt) { @@ -6517,11 +6519,19 @@ static int ipw_wpa_set_encryption(struct net_device *dev, sec.encrypt = 1; /* IPW HW cannot build TKIP MIC, host decryption still needed. */ - if (strcmp(param->u.crypt.alg, "TKIP") == 0) - ieee->host_encrypt_msdu = 1; + if (strcmp(param->u.crypt.alg, "TKIP") == 0) { + if (group_key) + ieee->host_mc_decrypt = 1; + else + ieee->host_encrypt_msdu = 1; + } - if (!(ieee->host_encrypt || ieee->host_encrypt_msdu || - ieee->host_decrypt)) + /*if (!(ieee->host_encrypt || ieee->host_encrypt_msdu || + ieee->host_decrypt)) + goto skip_host_crypt; */ + if (group_key ? !ieee->host_mc_decrypt : + !(ieee->host_encrypt || ieee->host_decrypt || + ieee->host_encrypt_msdu)) goto skip_host_crypt; ops = ieee80211_get_crypto_ops(param->u.crypt.alg); @@ -6604,6 +6614,9 @@ static int ipw_wpa_set_encryption(struct net_device *dev, sec.flags |= SEC_LEVEL; sec.level = SEC_LEVEL_3; } + /* Don't set sec level for group keys. */ + if (group_key) + sec.flags &= ~SEC_LEVEL; } done: if (ieee->set_security) @@ -6953,15 +6966,21 @@ static int ipw_wx_set_encodeext(struct net_device *dev, struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; if (hwcrypto) { - /* IPW HW can't build TKIP MIC, host decryption still needed */ if (ext->alg == IW_ENCODE_ALG_TKIP) { - priv->ieee->host_encrypt = 0; - priv->ieee->host_encrypt_msdu = 1; - priv->ieee->host_decrypt = 1; + /* IPW HW can't build TKIP MIC, + host decryption still needed */ + if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) + priv->ieee->host_mc_decrypt = 1; + else { + priv->ieee->host_encrypt = 0; + priv->ieee->host_encrypt_msdu = 1; + priv->ieee->host_decrypt = 1; + } } else { priv->ieee->host_encrypt = 0; priv->ieee->host_encrypt_msdu = 0; priv->ieee->host_decrypt = 0; + priv->ieee->host_mc_decrypt = 0; } } @@ -7878,6 +7897,7 @@ static void ipw_handle_data_packet(struct ipw_priv *priv, struct ipw_rx_mem_buffer *rxb, struct ieee80211_rx_stats *stats) { + struct ieee80211_hdr_4addr *hdr; struct ipw_rx_packet *pkt = (struct ipw_rx_packet *)rxb->skb->data; /* We received data from the HW, so stop the watchdog */ @@ -7907,7 +7927,10 @@ static void ipw_handle_data_packet(struct ipw_priv *priv, IPW_DEBUG_RX("Rx packet of %d bytes.\n", rxb->skb->len); /* HW decrypt will not clear the WEP bit, MIC, PN, etc. */ - if (!priv->ieee->host_decrypt && priv->ieee->iw_mode != IW_MODE_MONITOR) + hdr = (struct ieee80211_hdr_4addr *)rxb->skb->data; + if (priv->ieee->iw_mode != IW_MODE_MONITOR && + (is_multicast_ether_addr(hdr->addr1) ? + !priv->ieee->host_mc_decrypt : !priv->ieee->host_decrypt)) ipw_rebuild_decrypted_skb(priv, rxb->skb); if (!ieee80211_rx(priv->ieee, rxb->skb, stats)) @@ -8508,6 +8531,7 @@ static int ipw_sw_reset(struct ipw_priv *priv, int init) priv->ieee->host_encrypt = 0; priv->ieee->host_encrypt_msdu = 0; priv->ieee->host_decrypt = 0; + priv->ieee->host_mc_decrypt = 0; } IPW_DEBUG_INFO("Hardware crypto [%s]\n", hwcrypto ? "on" : "off"); -- cgit v1.2.2 From cdd1fa1e10a2231b5e24bde82550ac499aa5dcc4 Mon Sep 17 00:00:00 2001 From: Hong Liu Date: Wed, 31 Aug 2005 18:14:27 +0800 Subject: Card with WEP enabled and using shared-key auth will have firmware error when it tries to auth to a WPA ap. The patch filters out WPA networks if the card is not wpa enabled when selecting network to associate to. Signed-off-by: Hong Liu --- drivers/net/wireless/ipw2200.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index c9b306a8116c..e36a1fd9eefd 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -5510,6 +5510,15 @@ static int ipw_best_network(struct ipw_priv *priv, return 0; } + if (!priv->ieee->wpa_enabled && (network->wpa_ie_len > 0 || + network->rsn_ie_len > 0)) { + IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " + "because of WPA capability mismatch.\n", + escape_essid(network->ssid, network->ssid_len), + MAC_ARG(network->bssid)); + return 0; + } + if ((priv->config & CFG_STATIC_BSSID) && memcmp(network->bssid, priv->bssid, ETH_ALEN)) { IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " @@ -6228,6 +6237,7 @@ static int ipw_wpa_enable(struct ipw_priv *priv, int value) { /* This is called when wpa_supplicant loads and closes the driver * interface. */ + priv->ieee->wpa_enabled = value; return 0; } -- cgit v1.2.2 From fb7ccc9e6d1a2872ea8a07154f1689d19a7576c5 Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Wed, 7 Sep 2005 18:19:08 -0500 Subject: Fixed problem with get_cmd_string not existing if CONFIG_IPW_DEBUG disabled. Signed-off-by: James Ketrenos --- drivers/net/wireless/ipw2200.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index e36a1fd9eefd..43dab7a5cc91 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -1809,7 +1809,6 @@ static void ipw_irq_tasklet(struct ipw_priv *priv) spin_unlock_irqrestore(&priv->lock, flags); } -#ifdef CONFIG_IPW_DEBUG #define IPW_CMD(x) case IPW_CMD_ ## x : return #x static char *get_cmd_string(u8 cmd) { @@ -1868,7 +1867,6 @@ static char *get_cmd_string(u8 cmd) return "UNKNOWN"; } } -#endif #define HOST_COMPLETE_TIMEOUT HZ static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) -- cgit v1.2.2 From 392d0f6d0752e6a3e25c3e3da95d78c53b0fd7a1 Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Wed, 7 Sep 2005 18:39:03 -0500 Subject: Removed PF_SYNCTHREAD legacy. The PF_SYNCTHREAD check was introduced to try and remain compatible with SWSUSP2. This check is no longer needed with newer versions. Signed-off-by: James Ketrenos --- drivers/net/wireless/ipw2100.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c index 83ba08c0c33c..23a74accd50a 100644 --- a/drivers/net/wireless/ipw2100.c +++ b/drivers/net/wireless/ipw2100.c @@ -6433,11 +6433,8 @@ static struct net_device *ipw2100_alloc_device(struct pci_dev *pci_dev, INIT_LIST_HEAD(&priv->fw_pend_list); INIT_STAT(&priv->fw_pend_stat); -#ifdef PF_SYNCTHREAD - priv->workqueue = create_workqueue(DRV_NAME, 0); -#else priv->workqueue = create_workqueue(DRV_NAME); -#endif + INIT_WORK(&priv->reset_work, (void (*)(void *))ipw2100_reset_adapter, priv); INIT_WORK(&priv->security_work, -- cgit v1.2.2 From 29cb843e6457c45c4a257a0d2080da3fd7fb9d1e Mon Sep 17 00:00:00 2001 From: Hong Liu Date: Mon, 12 Sep 2005 10:43:33 -0500 Subject: Fixes problem with WEP not working (association succeeds, but no Tx/Rx) Signed-off-by: James Ketrenos --- drivers/net/wireless/ipw2200.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 43dab7a5cc91..217b6579e901 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -5789,6 +5789,8 @@ static void ipw_set_hwcrypto_keys(struct ipw_priv *priv) break; case SEC_LEVEL_1: ipw_send_wep_keys(priv, DCW_WEP_KEY_SEC_TYPE_WEP); + ipw_set_hw_decrypt_unicast(priv, priv->ieee->sec.level); + ipw_set_hw_decrypt_multicast(priv, priv->ieee->sec.level); break; case SEC_LEVEL_0: default: -- cgit v1.2.2 From f4ff497d45c7071166277a39590cc59b50dc893c Mon Sep 17 00:00:00 2001 From: Zhu Yi Date: Mon, 12 Sep 2005 10:48:48 -0500 Subject: [Fix bug# 771] Too many (8) bytes recieved when using AES/hwcrypto Signed-off-by: James Ketrenos --- drivers/net/wireless/ipw2200.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 217b6579e901..549f582551e5 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -7877,10 +7877,7 @@ static void ipw_rebuild_decrypted_skb(struct ipw_priv *priv, memmove(skb->data + IEEE80211_3ADDR_LEN, skb->data + IEEE80211_3ADDR_LEN + 8, skb->len - IEEE80211_3ADDR_LEN - 8); - if (fc & IEEE80211_FCTL_MOREFRAGS) - skb_trim(skb, skb->len - 16); /* 2*MIC */ - else - skb_trim(skb, skb->len - 8); /* MIC */ + skb_trim(skb, skb->len - 16); /* CCMP_HDR_LEN + CCMP_MIC_LEN */ break; case SEC_LEVEL_2: break; @@ -7889,10 +7886,7 @@ static void ipw_rebuild_decrypted_skb(struct ipw_priv *priv, memmove(skb->data + IEEE80211_3ADDR_LEN, skb->data + IEEE80211_3ADDR_LEN + 4, skb->len - IEEE80211_3ADDR_LEN - 4); - if (fc & IEEE80211_FCTL_MOREFRAGS) - skb_trim(skb, skb->len - 8); /* 2*ICV */ - else - skb_trim(skb, skb->len - 4); /* ICV */ + skb_trim(skb, skb->len - 8); /* IV + ICV */ break; case SEC_LEVEL_0: break; -- cgit v1.2.2 From e63247269de722c3e753991025fb7f15c6aba9aa Mon Sep 17 00:00:00 2001 From: Hong Liu Date: Wed, 14 Sep 2005 21:04:15 -0500 Subject: Fixes WEP firmware error condition. The problem is caused by the patch in bug455 -- Channel change flood generates fatal error. The patch set the DISASSOCIATING status bit after sending the command. The process was scheduled out when waiting for the command to be sent to the card. The disassociated notification clears the DISASSOCIATING bit in the tasklet before the process set the bit. Move the bit setting code before sending the command now. Signed-off-by: Hong Liu Signed-off-by: James Ketrenos --- drivers/net/wireless/ipw2200.c | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 549f582551e5..a7630920ace8 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -1882,18 +1882,6 @@ static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) return -EAGAIN; } - if (priv->status & STATUS_ASSOCIATING) { - IPW_DEBUG_HC("abandon a command while associating\n"); - spin_unlock_irqrestore(&priv->lock, flags); - return -1; - } - - if (priv->status & STATUS_DISASSOCIATING) { - IPW_DEBUG_HC("abandon a command while disassociating\n"); - spin_unlock_irqrestore(&priv->lock, flags); - return -1; - } - priv->status |= STATUS_HCMD_ACTIVE; if (priv->cmdlog) { @@ -3697,10 +3685,14 @@ static void ipw_send_disassociate(struct ipw_priv *priv, int quiet) MAC_ARG(priv->assoc_request.bssid), priv->assoc_request.channel); + priv->status &= ~(STATUS_ASSOCIATING | STATUS_ASSOCIATED); + priv->status |= STATUS_DISASSOCIATING; + if (quiet) priv->assoc_request.assoc_type = HC_DISASSOC_QUIET; else priv->assoc_request.assoc_type = HC_DISASSOCIATE; + err = ipw_send_associate(priv, &priv->assoc_request); if (err) { IPW_DEBUG_HC("Attempt to send [dis]associate command " @@ -3708,9 +3700,6 @@ static void ipw_send_disassociate(struct ipw_priv *priv, int quiet) return; } - priv->status &= ~(STATUS_ASSOCIATING | STATUS_ASSOCIATED); - priv->status |= STATUS_DISASSOCIATING; - } static int ipw_disassociate(void *data) @@ -7672,6 +7661,8 @@ static int ipw_associate_network(struct ipw_priv *priv, */ priv->channel = network->channel; memcpy(priv->bssid, network->bssid, ETH_ALEN); + priv->status |= STATUS_ASSOCIATING; + priv->status &= ~STATUS_SECURITY_UPDATED; priv->assoc_network = network; @@ -7685,9 +7676,6 @@ static int ipw_associate_network(struct ipw_priv *priv, return err; } - priv->status |= STATUS_ASSOCIATING; - priv->status &= ~STATUS_SECURITY_UPDATED; - IPW_DEBUG(IPW_DL_STATE, "associating: '%s' " MAC_FMT " \n", escape_essid(priv->essid, priv->essid_len), MAC_ARG(priv->bssid)); @@ -7791,6 +7779,13 @@ static int ipw_associate(void *data) return 0; } + if (priv->status & STATUS_DISASSOCIATING) { + IPW_DEBUG_ASSOC("Not attempting association (in " + "disassociating)\n "); + queue_work(priv->workqueue, &priv->associate); + return 0; + } + if (!ipw_is_init(priv) || (priv->status & STATUS_SCANNING)) { IPW_DEBUG_ASSOC("Not attempting association (scanning or not " "initialized)\n"); -- cgit v1.2.2 From 9ef539d0d6fca1cd0b1f9b884be8b92cb80159c9 Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Thu, 15 Sep 2005 00:42:42 -0500 Subject: Updated driver version stamps for ipw2100 (1.1.3) and ipw2200 (1.0.7) Signed-off-by: James Ketrenos --- drivers/net/wireless/ipw2100.c | 2 +- drivers/net/wireless/ipw2200.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c index 23a74accd50a..dba1049bcf91 100644 --- a/drivers/net/wireless/ipw2100.c +++ b/drivers/net/wireless/ipw2100.c @@ -167,7 +167,7 @@ that only one external action is invoked at a time. #include "ipw2100.h" -#define IPW2100_VERSION "1.1.1" +#define IPW2100_VERSION "1.1.3" #define DRV_NAME "ipw2100" #define DRV_VERSION IPW2100_VERSION diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index a7630920ace8..0b1c6fe54262 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -32,7 +32,7 @@ #include "ipw2200.h" -#define IPW2200_VERSION "1.0.5" +#define IPW2200_VERSION "1.0.7" #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2200/2915 Network Driver" #define DRV_COPYRIGHT "Copyright(c) 2003-2005 Intel Corporation" #define DRV_VERSION IPW2200_VERSION -- cgit v1.2.2 From 87bb5e3814572b85cf5d4650fb1f88267411845f Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Thu, 15 Sep 2005 01:00:31 -0500 Subject: Pulled out a stray KERNEL_VERSION check around the suspend handler. Signed-off-by: James Ketrenos --- drivers/net/wireless/ipw2100.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c index dba1049bcf91..ed4f1a5e6b0a 100644 --- a/drivers/net/wireless/ipw2100.c +++ b/drivers/net/wireless/ipw2100.c @@ -6709,11 +6709,7 @@ static void __devexit ipw2100_pci_remove_one(struct pci_dev *pci_dev) } #ifdef CONFIG_PM -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11) -static int ipw2100_suspend(struct pci_dev *pci_dev, u32 state) -#else static int ipw2100_suspend(struct pci_dev *pci_dev, pm_message_t state) -#endif { struct ipw2100_priv *priv = pci_get_drvdata(pci_dev); struct net_device *dev = priv->net_dev; -- cgit v1.2.2 From 97a78ca968b84a5e9d8854622b4760cec5058f77 Mon Sep 17 00:00:00 2001 From: Benoit Boissinot Date: Thu, 15 Sep 2005 17:30:28 +0000 Subject: Fix 'Driver using old /proc/net/wireless support, please fix driver !' message. Wireless extensions moved the get_wireless_stats handler from being in net_device into wireless_handler. Signed-off-by: Benoit Boissinot Signed-off-by: James Ketrenos --- drivers/net/wireless/ipw2200.c | 19 ++++++++++++------- drivers/net/wireless/ipw2200.h | 2 ++ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 0b1c6fe54262..b89ede14419c 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -125,6 +125,7 @@ static int ipw_send_qos_info_command(struct ipw_priv *priv, struct ieee80211_qos *qos_param); #endif /* CONFIG_IPW_QOS */ +static struct iw_statistics *ipw_get_wireless_stats(struct net_device *dev); static void ipw_remove_current_network(struct ipw_priv *priv); static void ipw_rx(struct ipw_priv *priv); static int ipw_queue_tx_reclaim(struct ipw_priv *priv, @@ -8883,6 +8884,13 @@ static int ipw_wx_get_range(struct net_device *dev, range->num_frequency = i; up(&priv->sem); + + /* Event capability (kernel + driver) */ + range->event_capa[0] = (IW_EVENT_CAPA_K_0 | + IW_EVENT_CAPA_MASK(SIOCGIWTHRSPY) | + IW_EVENT_CAPA_MASK(SIOCGIWAP)); + range->event_capa[1] = IW_EVENT_CAPA_K_1; + IPW_DEBUG_WX("GET Range\n"); return 0; } @@ -9999,10 +10007,9 @@ static struct iw_handler_def ipw_wx_handler_def = { .num_private_args = ARRAY_SIZE(ipw_priv_args), .private = ipw_priv_handler, .private_args = ipw_priv_args, + .get_wireless_stats = ipw_get_wireless_stats, }; -static struct iw_public_data ipw_wx_data; - /* * Get wireless statistics. * Called by /proc/net/wireless @@ -11487,9 +11494,6 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) SET_MODULE_OWNER(net_dev); SET_NETDEV_DEV(net_dev, &pdev->dev); - ipw_wx_data.spy_data = &priv->ieee->spy_data; - ipw_wx_data.ieee80211 = priv->ieee; - down(&priv->sem); priv->ieee->hard_start_xmit = ipw_net_hard_start_xmit; @@ -11514,8 +11518,9 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) net_dev->get_stats = ipw_net_get_stats; net_dev->set_multicast_list = ipw_net_set_multicast_list; net_dev->set_mac_address = ipw_net_set_mac_address; - net_dev->get_wireless_stats = ipw_get_wireless_stats; - net_dev->wireless_data = &ipw_wx_data; + priv->wireless_data.spy_data = &priv->ieee->spy_data; + priv->wireless_data.ieee80211 = priv->ieee; + net_dev->wireless_data = &priv->wireless_data; net_dev->wireless_handlers = &ipw_wx_handler_def; net_dev->ethtool_ops = &ipw_ethtool_ops; net_dev->irq = pdev->irq; diff --git a/drivers/net/wireless/ipw2200.h b/drivers/net/wireless/ipw2200.h index 28f1216f8ea4..3e7699430c6c 100644 --- a/drivers/net/wireless/ipw2200.h +++ b/drivers/net/wireless/ipw2200.h @@ -1228,6 +1228,8 @@ struct ipw_priv { struct iw_statistics wstats; + struct iw_public_data wireless_data; + struct workqueue_struct *workqueue; struct work_struct adhoc_check; -- cgit v1.2.2 From 8935f39e86e3707770e091fb58d9060307edf959 Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Wed, 5 Oct 2005 15:59:08 -0500 Subject: Removed legacy WIRELESS_EXT checks from ipw2200.c Signed-off-by: James Ketrenos --- drivers/net/wireless/ipw2200.c | 508 +---------------------------------------- 1 file changed, 1 insertion(+), 507 deletions(-) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index b89ede14419c..8e17308b5539 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -6159,70 +6159,6 @@ static void ipw_bg_abort_scan(void *data) up(&priv->sem); } -#if WIRELESS_EXT < 18 -/* Support for wpa_supplicant before WE-18, deprecated. */ - -/* following definitions must match definitions in driver_ipw.c */ - -#define IPW_IOCTL_WPA_SUPPLICANT SIOCIWFIRSTPRIV+30 - -#define IPW_CMD_SET_WPA_PARAM 1 -#define IPW_CMD_SET_WPA_IE 2 -#define IPW_CMD_SET_ENCRYPTION 3 -#define IPW_CMD_MLME 4 - -#define IPW_PARAM_WPA_ENABLED 1 -#define IPW_PARAM_TKIP_COUNTERMEASURES 2 -#define IPW_PARAM_DROP_UNENCRYPTED 3 -#define IPW_PARAM_PRIVACY_INVOKED 4 -#define IPW_PARAM_AUTH_ALGS 5 -#define IPW_PARAM_IEEE_802_1X 6 - -#define IPW_MLME_STA_DEAUTH 1 -#define IPW_MLME_STA_DISASSOC 2 - -#define IPW_CRYPT_ERR_UNKNOWN_ALG 2 -#define IPW_CRYPT_ERR_UNKNOWN_ADDR 3 -#define IPW_CRYPT_ERR_CRYPT_INIT_FAILED 4 -#define IPW_CRYPT_ERR_KEY_SET_FAILED 5 -#define IPW_CRYPT_ERR_TX_KEY_SET_FAILED 6 -#define IPW_CRYPT_ERR_CARD_CONF_FAILED 7 - -#define IPW_CRYPT_ALG_NAME_LEN 16 - -struct ipw_param { - u32 cmd; - u8 sta_addr[ETH_ALEN]; - union { - struct { - u8 name; - u32 value; - } wpa_param; - struct { - u32 len; - u8 reserved[32]; - u8 data[0]; - } wpa_ie; - struct { - u32 command; - u32 reason_code; - } mlme; - struct { - u8 alg[IPW_CRYPT_ALG_NAME_LEN]; - u8 set_tx; - u32 err; - u8 idx; - u8 seq[8]; /* sequence counter (set: RX, get: TX) */ - u16 key_len; - u8 key[0]; - } crypt; - - } u; -}; - -/* end of driver_ipw.c code */ -#endif - static int ipw_wpa_enable(struct ipw_priv *priv, int value) { /* This is called when wpa_supplicant loads and closes the driver @@ -6231,11 +6167,6 @@ static int ipw_wpa_enable(struct ipw_priv *priv, int value) return 0; } -#if WIRELESS_EXT < 18 -#define IW_AUTH_ALG_OPEN_SYSTEM 0x1 -#define IW_AUTH_ALG_SHARED_KEY 0x2 -#endif - static int ipw_wpa_set_auth_algs(struct ipw_priv *priv, int value) { struct ieee80211_device *ieee = priv->ieee; @@ -6283,416 +6214,6 @@ static int ipw_set_rsn_capa(struct ipw_priv *priv, return ipw_send_cmd(priv, &cmd); } -#if WIRELESS_EXT < 18 -static int ipw_wpa_set_param(struct net_device *dev, u8 name, u32 value) -{ - struct ipw_priv *priv = ieee80211_priv(dev); - struct ieee80211_crypt_data *crypt; - unsigned long flags; - int ret = 0; - - switch (name) { - case IPW_PARAM_WPA_ENABLED: - ret = ipw_wpa_enable(priv, value); - break; - - case IPW_PARAM_TKIP_COUNTERMEASURES: - crypt = priv->ieee->crypt[priv->ieee->tx_keyidx]; - if (!crypt || !crypt->ops->set_flags || !crypt->ops->get_flags) { - IPW_WARNING("Can't set TKIP countermeasures: " - "crypt not set!\n"); - break; - } - - flags = crypt->ops->get_flags(crypt->priv); - - if (value) - flags |= IEEE80211_CRYPTO_TKIP_COUNTERMEASURES; - else - flags &= ~IEEE80211_CRYPTO_TKIP_COUNTERMEASURES; - - crypt->ops->set_flags(flags, crypt->priv); - - break; - - case IPW_PARAM_DROP_UNENCRYPTED:{ - /* HACK: - * - * wpa_supplicant calls set_wpa_enabled when the driver - * is loaded and unloaded, regardless of if WPA is being - * used. No other calls are made which can be used to - * determine if encryption will be used or not prior to - * association being expected. If encryption is not being - * used, drop_unencrypted is set to false, else true -- we - * can use this to determine if the CAP_PRIVACY_ON bit should - * be set. - */ - struct ieee80211_security sec = { - .flags = SEC_ENABLED, - .enabled = value, - }; - priv->ieee->drop_unencrypted = value; - /* We only change SEC_LEVEL for open mode. Others - * are set by ipw_wpa_set_encryption. - */ - if (!value) { - sec.flags |= SEC_LEVEL; - sec.level = SEC_LEVEL_0; - } else { - sec.flags |= SEC_LEVEL; - sec.level = SEC_LEVEL_1; - } - if (priv->ieee->set_security) - priv->ieee->set_security(priv->ieee->dev, &sec); - break; - } - - case IPW_PARAM_PRIVACY_INVOKED: - priv->ieee->privacy_invoked = value; - break; - - case IPW_PARAM_AUTH_ALGS: - ret = ipw_wpa_set_auth_algs(priv, value); - break; - - case IPW_PARAM_IEEE_802_1X: - priv->ieee->ieee802_1x = value; - break; - - default: - IPW_ERROR("%s: Unknown WPA param: %d\n", dev->name, name); - ret = -EOPNOTSUPP; - } - - return ret; -} - -static int ipw_wpa_mlme(struct net_device *dev, int command, int reason) -{ - struct ipw_priv *priv = ieee80211_priv(dev); - int ret = 0; - - switch (command) { - case IPW_MLME_STA_DEAUTH: - // silently ignore - break; - - case IPW_MLME_STA_DISASSOC: - ipw_disassociate(priv); - break; - - default: - IPW_ERROR("%s: Unknown MLME request: %d\n", dev->name, command); - ret = -EOPNOTSUPP; - } - - return ret; -} - -static int ipw_wpa_ie_cipher2level(u8 cipher) -{ - switch (cipher) { - case 4: /* CCMP */ - return SEC_LEVEL_3; - case 2: /* TKIP */ - return SEC_LEVEL_2; - case 5: /* WEP104 */ - case 1: /* WEP40 */ - return SEC_LEVEL_1; - case 0: /* NONE */ - return SEC_LEVEL_0; - default: - return -1; - } -} - -static int ipw_wpa_set_wpa_ie(struct net_device *dev, - struct ipw_param *param, int plen) -{ - struct ipw_priv *priv = ieee80211_priv(dev); - struct ieee80211_device *ieee = priv->ieee; - u8 *buf; - u8 *ptk, *gtk; - int level; - - if (param->u.wpa_ie.len > MAX_WPA_IE_LEN || - (param->u.wpa_ie.len && param->u.wpa_ie.data == NULL)) - return -EINVAL; - - if (param->u.wpa_ie.len) { - buf = kmalloc(param->u.wpa_ie.len, GFP_KERNEL); - if (buf == NULL) - return -ENOMEM; - - memcpy(buf, param->u.wpa_ie.data, param->u.wpa_ie.len); - kfree(ieee->wpa_ie); - ieee->wpa_ie = buf; - ieee->wpa_ie_len = param->u.wpa_ie.len; - } else { - kfree(ieee->wpa_ie); - ieee->wpa_ie = NULL; - ieee->wpa_ie_len = 0; - goto done; - } - - if (priv->ieee->host_encrypt) - goto done; - - /* HACK: Parse wpa_ie here to get pairwise suite, otherwise - * we need to change driver_ipw.c from wpa_supplicant. This - * is OK since -Dipw is deprecated. The -Dwext driver has a - * clean way to handle this. */ - gtk = ptk = (u8 *) ieee->wpa_ie; - if (ieee->wpa_ie[0] == 0x30) { /* RSN IE */ - gtk += 4 + 3; - ptk += 4 + 4 + 2 + 3; - } else { /* WPA IE */ - gtk += 8 + 3; - ptk += 8 + 4 + 2 + 3; - } - - if (ptk - (u8 *) ieee->wpa_ie > ieee->wpa_ie_len) - return -EINVAL; - - level = ipw_wpa_ie_cipher2level(*gtk); - ipw_set_hw_decrypt_multicast(priv, level); - - level = ipw_wpa_ie_cipher2level(*ptk); - ipw_set_hw_decrypt_unicast(priv, level); - - done: - ipw_wpa_assoc_frame(priv, ieee->wpa_ie, ieee->wpa_ie_len); - return 0; -} - -/* implementation borrowed from hostap driver */ - -static int ipw_wpa_set_encryption(struct net_device *dev, - struct ipw_param *param, int param_len) -{ - int ret = 0; - int group_key = 0; - struct ipw_priv *priv = ieee80211_priv(dev); - struct ieee80211_device *ieee = priv->ieee; - struct ieee80211_crypto_ops *ops; - struct ieee80211_crypt_data **crypt; - - struct ieee80211_security sec = { - .flags = 0, - }; - - param->u.crypt.err = 0; - param->u.crypt.alg[IPW_CRYPT_ALG_NAME_LEN - 1] = '\0'; - - if (param_len != - (int)((char *)param->u.crypt.key - (char *)param) + - param->u.crypt.key_len) { - IPW_DEBUG_INFO("Len mismatch %d, %d\n", param_len, - param->u.crypt.key_len); - return -EINVAL; - } - if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && - param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && - param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { - if (param->u.crypt.idx >= WEP_KEYS) - return -EINVAL; - crypt = &ieee->crypt[param->u.crypt.idx]; - } else { - return -EINVAL; - } - - if (param->u.crypt.idx != 0) - group_key = 1; - - sec.flags |= SEC_ENABLED | SEC_ENCRYPT; - if (strcmp(param->u.crypt.alg, "none") == 0) { - if (crypt) { - sec.enabled = 0; - sec.encrypt = 0; - sec.level = SEC_LEVEL_0; - sec.flags |= SEC_LEVEL; - ieee80211_crypt_delayed_deinit(ieee, crypt); - } - goto done; - } - sec.enabled = 1; - sec.encrypt = 1; - - /* IPW HW cannot build TKIP MIC, host decryption still needed. */ - if (strcmp(param->u.crypt.alg, "TKIP") == 0) { - if (group_key) - ieee->host_mc_decrypt = 1; - else - ieee->host_encrypt_msdu = 1; - } - - /*if (!(ieee->host_encrypt || ieee->host_encrypt_msdu || - ieee->host_decrypt)) - goto skip_host_crypt; */ - if (group_key ? !ieee->host_mc_decrypt : - !(ieee->host_encrypt || ieee->host_decrypt || - ieee->host_encrypt_msdu)) - goto skip_host_crypt; - - ops = ieee80211_get_crypto_ops(param->u.crypt.alg); - if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) { - request_module("ieee80211_crypt_wep"); - ops = ieee80211_get_crypto_ops(param->u.crypt.alg); - } else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0) { - request_module("ieee80211_crypt_tkip"); - ops = ieee80211_get_crypto_ops(param->u.crypt.alg); - } else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0) { - request_module("ieee80211_crypt_ccmp"); - ops = ieee80211_get_crypto_ops(param->u.crypt.alg); - } - if (ops == NULL) { - IPW_DEBUG_INFO("%s: unknown crypto alg '%s'\n", - dev->name, param->u.crypt.alg); - param->u.crypt.err = IPW_CRYPT_ERR_UNKNOWN_ALG; - ret = -EINVAL; - goto done; - } - - if (*crypt == NULL || (*crypt)->ops != ops) { - struct ieee80211_crypt_data *new_crypt; - - ieee80211_crypt_delayed_deinit(ieee, crypt); - - new_crypt = (struct ieee80211_crypt_data *) - kmalloc(sizeof(*new_crypt), GFP_KERNEL); - if (new_crypt == NULL) { - ret = -ENOMEM; - goto done; - } - memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data)); - new_crypt->ops = ops; - if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) - new_crypt->priv = - new_crypt->ops->init(param->u.crypt.idx); - - if (new_crypt->priv == NULL) { - kfree(new_crypt); - param->u.crypt.err = IPW_CRYPT_ERR_CRYPT_INIT_FAILED; - ret = -EINVAL; - goto done; - } - - *crypt = new_crypt; - } - - if (param->u.crypt.key_len > 0 && (*crypt)->ops->set_key && - (*crypt)->ops->set_key(param->u.crypt.key, - param->u.crypt.key_len, param->u.crypt.seq, - (*crypt)->priv) < 0) { - IPW_DEBUG_INFO("%s: key setting failed\n", dev->name); - param->u.crypt.err = IPW_CRYPT_ERR_KEY_SET_FAILED; - ret = -EINVAL; - goto done; - } - - skip_host_crypt: - if (param->u.crypt.set_tx) { - ieee->tx_keyidx = param->u.crypt.idx; - sec.active_key = param->u.crypt.idx; - sec.flags |= SEC_ACTIVE_KEY; - } else - sec.flags &= ~SEC_ACTIVE_KEY; - - if (param->u.crypt.alg != NULL) { - memcpy(sec.keys[param->u.crypt.idx], - param->u.crypt.key, param->u.crypt.key_len); - sec.key_sizes[param->u.crypt.idx] = param->u.crypt.key_len; - sec.flags |= (1 << param->u.crypt.idx); - - if (strcmp(param->u.crypt.alg, "WEP") == 0) { - sec.flags |= SEC_LEVEL; - sec.level = SEC_LEVEL_1; - } else if (strcmp(param->u.crypt.alg, "TKIP") == 0) { - sec.flags |= SEC_LEVEL; - sec.level = SEC_LEVEL_2; - } else if (strcmp(param->u.crypt.alg, "CCMP") == 0) { - sec.flags |= SEC_LEVEL; - sec.level = SEC_LEVEL_3; - } - /* Don't set sec level for group keys. */ - if (group_key) - sec.flags &= ~SEC_LEVEL; - } - done: - if (ieee->set_security) - ieee->set_security(ieee->dev, &sec); - - /* Do not reset port if card is in Managed mode since resetting will - * generate new IEEE 802.11 authentication which may end up in looping - * with IEEE 802.1X. If your hardware requires a reset after WEP - * configuration (for example... Prism2), implement the reset_port in - * the callbacks structures used to initialize the 802.11 stack. */ - if (ieee->reset_on_keychange && - ieee->iw_mode != IW_MODE_INFRA && - ieee->reset_port && ieee->reset_port(dev)) { - IPW_DEBUG_INFO("%s: reset_port failed\n", dev->name); - param->u.crypt.err = IPW_CRYPT_ERR_CARD_CONF_FAILED; - return -EINVAL; - } - - return ret; -} - -static int ipw_wpa_supplicant(struct net_device *dev, struct iw_point *p) -{ - struct ipw_param *param; - struct ipw_priv *priv = ieee80211_priv(dev); - int ret = 0; - - IPW_DEBUG_INFO("wpa_supplicant: len=%d\n", p->length); - - if (p->length < sizeof(struct ipw_param) || !p->pointer) - return -EINVAL; - - param = (struct ipw_param *)kmalloc(p->length, GFP_KERNEL); - if (param == NULL) - return -ENOMEM; - - if (copy_from_user(param, p->pointer, p->length)) { - kfree(param); - return -EFAULT; - } - - down(&priv->sem); - switch (param->cmd) { - - case IPW_CMD_SET_WPA_PARAM: - ret = ipw_wpa_set_param(dev, param->u.wpa_param.name, - param->u.wpa_param.value); - break; - - case IPW_CMD_SET_WPA_IE: - ret = ipw_wpa_set_wpa_ie(dev, param, p->length); - break; - - case IPW_CMD_SET_ENCRYPTION: - ret = ipw_wpa_set_encryption(dev, param, p->length); - break; - - case IPW_CMD_MLME: - ret = ipw_wpa_mlme(dev, param->u.mlme.command, - param->u.mlme.reason_code); - break; - - default: - IPW_ERROR("%s: Unknown WPA supplicant request: %d\n", - dev->name, param->cmd); - ret = -EOPNOTSUPP; - } - - up(&priv->sem); - if (ret == 0 && copy_to_user(p->pointer, param, p->length)) - ret = -EFAULT; - - kfree(param); - return ret; -} -#else /* * WE-18 support */ @@ -7021,7 +6542,6 @@ static int ipw_wx_set_mlme(struct net_device *dev, } return 0; } -#endif #ifdef CONFIG_IPW_QOS @@ -9391,7 +8911,6 @@ static int ipw_wx_get_retry(struct net_device *dev, return 0; } -#if WIRELESS_EXT > 17 static int ipw_request_direct_scan(struct ipw_priv *priv, char *essid, int essid_len) { @@ -9455,14 +8974,12 @@ static int ipw_request_direct_scan(struct ipw_priv *priv, char *essid, up(&priv->sem); return err; } -#endif /* WIRELESS_EXT > 17 */ static int ipw_wx_set_scan(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { struct ipw_priv *priv = ieee80211_priv(dev); -#if WIRELESS_EXT > 17 struct iw_scan_req *req = NULL; if (wrqu->data.length && wrqu->data.length == sizeof(struct iw_scan_req)) { @@ -9473,7 +8990,7 @@ static int ipw_wx_set_scan(struct net_device *dev, return 0; } } -#endif + IPW_DEBUG_WX("Start scan\n"); queue_work(priv->workqueue, &priv->request_scan); @@ -9923,7 +9440,6 @@ static iw_handler ipw_wx_handlers[] = { IW_IOCTL(SIOCGIWSPY) = iw_handler_get_spy, IW_IOCTL(SIOCSIWTHRSPY) = iw_handler_set_thrspy, IW_IOCTL(SIOCGIWTHRSPY) = iw_handler_get_thrspy, -#if WIRELESS_EXT > 17 IW_IOCTL(SIOCSIWGENIE) = ipw_wx_set_genie, IW_IOCTL(SIOCGIWGENIE) = ipw_wx_get_genie, IW_IOCTL(SIOCSIWMLME) = ipw_wx_set_mlme, @@ -9931,7 +9447,6 @@ static iw_handler ipw_wx_handlers[] = { IW_IOCTL(SIOCGIWAUTH) = ipw_wx_get_auth, IW_IOCTL(SIOCSIWENCODEEXT) = ipw_wx_set_encodeext, IW_IOCTL(SIOCGIWENCODEEXT) = ipw_wx_get_encodeext, -#endif }; enum { @@ -11317,24 +10832,6 @@ static void ipw_bg_down(void *data) up(&priv->sem); } -#if WIRELESS_EXT < 18 -static int ipw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) -{ - struct iwreq *wrq = (struct iwreq *)rq; - int ret = -1; - switch (cmd) { - case IPW_IOCTL_WPA_SUPPLICANT: - ret = ipw_wpa_supplicant(dev, &wrq->u.data); - return ret; - - default: - return -EOPNOTSUPP; - } - - return -EOPNOTSUPP; -} -#endif - /* Called by register_netdev() */ static int ipw_net_init(struct net_device *dev) { @@ -11512,9 +11009,6 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) net_dev->open = ipw_net_open; net_dev->stop = ipw_net_stop; net_dev->init = ipw_net_init; -#if WIRELESS_EXT < 18 - net_dev->do_ioctl = ipw_ioctl; -#endif net_dev->get_stats = ipw_net_get_stats; net_dev->set_multicast_list = ipw_net_set_multicast_list; net_dev->set_mac_address = ipw_net_set_mac_address; -- cgit v1.2.2 From e758256104c3c2475f7746bc1b348c99cdb207f2 Mon Sep 17 00:00:00 2001 From: Ben Cahill Date: Thu, 6 Oct 2005 15:34:41 -0500 Subject: Fixes missed beacon logic in relation to on-network AP roaming. Signed-off-by: James Ketrenos --- drivers/net/wireless/ipw2200.c | 27 ++++++++++++++++++++------- drivers/net/wireless/ipw2200.h | 3 +++ 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 8e17308b5539..894192964c0b 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -4082,6 +4082,11 @@ static void ipw_bg_gather_stats(void *data) up(&priv->sem); } +/* Missed beacon behavior: + * 1st missed -> roaming_threshold, just wait, don't do any scan/roam. + * roaming_threshold -> disassociate_threshold, scan and roam for better signal. + * Above disassociate threshold, give up and stop scanning. + * Roaming is disabled if disassociate_threshold <= roaming_threshold */ static inline void ipw_handle_missed_beacon(struct ipw_priv *priv, int missed_count) { @@ -4116,9 +4121,12 @@ static inline void ipw_handle_missed_beacon(struct ipw_priv *priv, return; } - if (missed_count > priv->roaming_threshold) { + if (missed_count > priv->roaming_threshold && + missed_count <= priv->disassociate_threshold) { /* If we are not already roaming, set the ROAM - * bit in the status and kick off a scan */ + * bit in the status and kick off a scan. + * This can happen several times before we reach + * disassociate_threshold. */ IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE, "Missed beacon: %d - initiate " "roaming\n", missed_count); @@ -4480,11 +4488,16 @@ static inline void ipw_rx_notification(struct ipw_priv *priv, STATUS_DISASSOCIATING))) queue_work(priv->workqueue, &priv->associate); else if (priv->status & STATUS_ROAMING) { - /* If a scan completed and we are in roam mode, then - * the scan that completed was the one requested as a - * result of entering roam... so, schedule the - * roam work */ - queue_work(priv->workqueue, &priv->roam); + if (x->status == SCAN_COMPLETED_STATUS_COMPLETE) + /* If a scan completed and we are in roam mode, then + * the scan that completed was the one requested as a + * result of entering roam... so, schedule the + * roam work */ + queue_work(priv->workqueue, + &priv->roam); + else + /* Don't schedule if we aborted the scan */ + priv->status &= ~STATUS_ROAMING; } else if (priv->status & STATUS_SCAN_PENDING) queue_work(priv->workqueue, &priv->request_scan); diff --git a/drivers/net/wireless/ipw2200.h b/drivers/net/wireless/ipw2200.h index 3e7699430c6c..617ec4dba17a 100644 --- a/drivers/net/wireless/ipw2200.h +++ b/drivers/net/wireless/ipw2200.h @@ -590,6 +590,9 @@ struct notif_channel_result { u8 uReserved; } __attribute__ ((packed)); +#define SCAN_COMPLETED_STATUS_COMPLETE 1 +#define SCAN_COMPLETED_STATUS_ABORTED 2 + struct notif_scan_complete { u8 scan_type; u8 num_channels; -- cgit v1.2.2 From 991d1cc5963f4926478f3139ec0b0dd26a2c888c Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Thu, 13 Oct 2005 09:26:48 +0000 Subject: Removed warning about TKIP not being configured if countermeasures are configured. Countermeasures default to being turned off when wpa_supplicant runs, regardless of if TKIP is being used. They are only turned on if a TKIP is running. The warning we were printing is therefore not needed. Signed-off-by: James Ketrenos --- drivers/net/wireless/ipw2100.c | 10 ++-------- drivers/net/wireless/ipw2200.c | 10 ++-------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c index ed4f1a5e6b0a..76841cb8301b 100644 --- a/drivers/net/wireless/ipw2100.c +++ b/drivers/net/wireless/ipw2100.c @@ -5866,11 +5866,8 @@ static int ipw2100_wpa_set_param(struct net_device *dev, u8 name, u32 value) case IPW2100_PARAM_TKIP_COUNTERMEASURES: crypt = priv->ieee->crypt[priv->ieee->tx_keyidx]; - if (!crypt || !crypt->ops->set_flags || !crypt->ops->get_flags) { - IPW_DEBUG_WARNING("Can't set TKIP countermeasures: " - "crypt not set!\n"); + if (!crypt || !crypt->ops->set_flags || !crypt->ops->get_flags) break; - } flags = crypt->ops->get_flags(crypt->priv); @@ -7935,11 +7932,8 @@ static int ipw2100_wx_set_auth(struct net_device *dev, case IW_AUTH_TKIP_COUNTERMEASURES: crypt = priv->ieee->crypt[priv->ieee->tx_keyidx]; - if (!crypt || !crypt->ops->set_flags || !crypt->ops->get_flags) { - IPW_DEBUG_WARNING("Can't set TKIP countermeasures: " - "crypt not set!\n"); + if (!crypt || !crypt->ops->set_flags || !crypt->ops->get_flags) break; - } flags = crypt->ops->get_flags(crypt->priv); diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 894192964c0b..750e43e9310a 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -6357,11 +6357,8 @@ static int ipw_wx_set_auth(struct net_device *dev, case IW_AUTH_TKIP_COUNTERMEASURES: crypt = priv->ieee->crypt[priv->ieee->tx_keyidx]; - if (!crypt || !crypt->ops->set_flags || !crypt->ops->get_flags) { - IPW_WARNING("Can't set TKIP countermeasures: " - "crypt not set!\n"); + if (!crypt || !crypt->ops->set_flags || !crypt->ops->get_flags) break; - } flags = crypt->ops->get_flags(crypt->priv); @@ -6453,11 +6450,8 @@ static int ipw_wx_get_auth(struct net_device *dev, case IW_AUTH_TKIP_COUNTERMEASURES: crypt = priv->ieee->crypt[priv->ieee->tx_keyidx]; - if (!crypt || !crypt->ops->get_flags) { - IPW_WARNING("Can't get TKIP countermeasures: " - "crypt not set!\n"); + if (!crypt || !crypt->ops->get_flags) break; - } param->value = (crypt->ops->get_flags(crypt->priv) & IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) ? 1 : 0; -- cgit v1.2.2 From 035205760e4f28082fedb258a20c804746c84ffe Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Wed, 19 Oct 2005 16:12:31 -0500 Subject: Added channel support for ipw2200 cards identified as 'ZZR' Signed-off-by: James Ketrenos --- drivers/net/wireless/ipw2200.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 750e43e9310a..081957ab1194 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -10495,6 +10495,17 @@ static const struct ieee80211_geo ipw_geos[] = { {5210, 42}, {5230, 46}}, }, + { /* Rest of World */ + "ZZR", + .bg_channels = 14, + .bg = {{2412, 1}, {2417, 2}, {2422, 3}, + {2427, 4}, {2432, 5}, {2437, 6}, + {2442, 7}, {2447, 8}, {2452, 9}, + {2457, 10}, {2462, 11}, {2467, 12}, + {2472, 13}, {2484, 14, IEEE80211_CH_B_ONLY | + IEEE80211_CH_PASSIVE_ONLY}}, + }, + { /* High Band */ "ZZH", .bg_channels = 13, @@ -10711,8 +10722,13 @@ static int ipw_up(struct ipw_priv *priv) ipw_geos[j].name, 3)) break; } - if (j == ARRAY_SIZE(ipw_geos)) + if (j == ARRAY_SIZE(ipw_geos)) { + IPW_WARNING("SKU [%c%c%c] not recognized.\n", + priv->eeprom[EEPROM_COUNTRY_CODE + 0], + priv->eeprom[EEPROM_COUNTRY_CODE + 1], + priv->eeprom[EEPROM_COUNTRY_CODE + 2]); j = 0; + } if (ipw_set_geo(priv->ieee, &ipw_geos[j])) { IPW_WARNING("Could not set geography."); return 0; -- cgit v1.2.2 From 9d5b880bb8e977426d64a4caebe3fd3ae73a2862 Mon Sep 17 00:00:00 2001 From: Hong Liu Date: Wed, 19 Oct 2005 16:25:33 -0500 Subject: Fixed problem with not being able to send broadcast packets. Signed-off-by: James Ketrenos --- drivers/net/wireless/ipw2200.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 081957ab1194..c1ae6d4065e0 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -7456,7 +7456,8 @@ static void ipw_handle_data_packet(struct ipw_priv *priv, /* HW decrypt will not clear the WEP bit, MIC, PN, etc. */ hdr = (struct ieee80211_hdr_4addr *)rxb->skb->data; if (priv->ieee->iw_mode != IW_MODE_MONITOR && - (is_multicast_ether_addr(hdr->addr1) ? + ((is_multicast_ether_addr(hdr->addr1) || + is_broadcast_ether_addr(hdr->addr1)) ? !priv->ieee->host_mc_decrypt : !priv->ieee->host_decrypt)) ipw_rebuild_decrypted_skb(priv, rxb->skb); @@ -9652,7 +9653,8 @@ static inline int ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb, switch (priv->ieee->iw_mode) { case IW_MODE_ADHOC: hdr_len = IEEE80211_3ADDR_LEN; - unicast = !is_multicast_ether_addr(hdr->addr1); + unicast = !(is_multicast_ether_addr(hdr->addr1) || + is_broadcast_ether_addr(hdr->addr1)); id = ipw_find_station(priv, hdr->addr1); if (id == IPW_INVALID_STATION) { id = ipw_add_station(priv, hdr->addr1); @@ -9667,7 +9669,8 @@ static inline int ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb, case IW_MODE_INFRA: default: - unicast = !is_multicast_ether_addr(hdr->addr3); + unicast = !(is_multicast_ether_addr(hdr->addr3) || + is_broadcast_ether_addr(hdr->addr3)); hdr_len = IEEE80211_3ADDR_LEN; id = 0; break; -- cgit v1.2.2 From 286568ab1e8f0e09a76cfa58e8ed48ddc44484b5 Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Tue, 30 Aug 2005 10:34:25 -0500 Subject: Fixed parameter reordering in firmware log routine. Signed-off-by: James Ketrenos --- drivers/net/wireless/ipw2200.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index c1ae6d4065e0..f49b0125375b 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -526,7 +526,7 @@ static void ipw_dump_error_log(struct ipw_priv *priv, for (i = 0; i < error->log_len; i++) IPW_ERROR("%i\t0x%08x\t%i\n", error->log[i].time, - error->log[i].event, error->log[i].data); + error->log[i].data, error->log[i].event); } #endif -- cgit v1.2.2 From 81715376de909637b957f856e30880871fbd78fc Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Thu, 25 Aug 2005 01:37:28 -0500 Subject: Updated firmware version stamp to 2.4 from 2.3 so it will use the latest firmware. You can obtain the firmware at http://ipw2200.sf.net/firmware.php Signed-off-by: James Ketrenos --- drivers/net/wireless/ipw2200.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index f49b0125375b..56709d2921a6 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -2834,7 +2834,7 @@ struct fw_chunk { }; #define IPW_FW_MAJOR_VERSION 2 -#define IPW_FW_MINOR_VERSION 3 +#define IPW_FW_MINOR_VERSION 4 #define IPW_FW_MINOR(x) ((x & 0xff) >> 8) #define IPW_FW_MAJOR(x) (x & 0xff) -- cgit v1.2.2 From cf1b479b6922c6736d9f00d90c2b78e977692c93 Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Thu, 20 Oct 2005 16:35:24 -0500 Subject: Update version ipw2200 stamp to 1.0.8 --- drivers/net/wireless/ipw2200.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 56709d2921a6..136884cef908 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -32,7 +32,7 @@ #include "ipw2200.h" -#define IPW2200_VERSION "1.0.7" +#define IPW2200_VERSION "git-1.0.8" #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2200/2915 Network Driver" #define DRV_COPYRIGHT "Copyright(c) 2003-2005 Intel Corporation" #define DRV_VERSION IPW2200_VERSION -- cgit v1.2.2 From 826d2abe9945372c8838398bfd88a1caa5844d41 Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Mon, 7 Nov 2005 18:56:59 -0600 Subject: Updated READMEs and MAINTAINERS for the ipw2100 and ipw2200 drivers. Signed-off-by: James Ketrenos --- Documentation/networking/README.ipw2100 | 132 ++++++++++++++------- Documentation/networking/README.ipw2200 | 196 ++++++++++++++++++++++++++------ MAINTAINERS | 18 +++ 3 files changed, 272 insertions(+), 74 deletions(-) diff --git a/Documentation/networking/README.ipw2100 b/Documentation/networking/README.ipw2100 index 2046948b020d..3ab40379d1cf 100644 --- a/Documentation/networking/README.ipw2100 +++ b/Documentation/networking/README.ipw2100 @@ -1,27 +1,82 @@ -=========================== -Intel(R) PRO/Wireless 2100 Network Connection Driver for Linux +Intel(R) PRO/Wireless 2100 Driver for Linux in support of: + +Intel(R) PRO/Wireless 2100 Network Connection + +Copyright (C) 2003-2005, Intel Corporation + README.ipw2100 -March 14, 2005 +Version: 1.1.3 +Date : October 17, 2005 -=========================== Index ---------------------------- -0. Introduction -1. Release 1.1.0 Current Features -2. Command Line Parameters -3. Sysfs Helper Files -4. Radio Kill Switch -5. Dynamic Firmware -6. Power Management -7. Support -8. License - - -=========================== -0. Introduction ------------- ----- ----- ---- --- -- - +----------------------------------------------- +0. IMPORTANT INFORMATION BEFORE USING THIS DRIVER +1. Introduction +2. Release 1.1.3 Current Features +3. Command Line Parameters +4. Sysfs Helper Files +5. Radio Kill Switch +6. Dynamic Firmware +7. Power Management +8. Support +9. License + + +0. IMPORTANT INFORMATION BEFORE USING THIS DRIVER +----------------------------------------------- + +Important Notice FOR ALL USERS OR DISTRIBUTORS!!!! + +Intel wireless LAN adapters are engineered, manufactured, tested, and +quality checked to ensure that they meet all necessary local and +governmental regulatory agency requirements for the regions that they +are designated and/or marked to ship into. Since wireless LANs are +generally unlicensed devices that share spectrum with radars, +satellites, and other licensed and unlicensed devices, it is sometimes +necessary to dynamically detect, avoid, and limit usage to avoid +interference with these devices. In many instances Intel is required to +provide test data to prove regional and local compliance to regional and +governmental regulations before certification or approval to use the +product is granted. Intel's wireless LAN's EEPROM, firmware, and +software driver are designed to carefully control parameters that affect +radio operation and to ensure electromagnetic compliance (EMC). These +parameters include, without limitation, RF power, spectrum usage, +channel scanning, and human exposure. + +For these reasons Intel cannot permit any manipulation by third parties +of the software provided in binary format with the wireless WLAN +adapters (e.g., the EEPROM and firmware). Furthermore, if you use any +patches, utilities, or code with the Intel wireless LAN adapters that +have been manipulated by an unauthorized party (i.e., patches, +utilities, or code (including open source code modifications) which have +not been validated by Intel), (i) you will be solely responsible for +ensuring the regulatory compliance of the products, (ii) Intel will bear +no liability, under any theory of liability for any issues associated +with the modified products, including without limitation, claims under +the warranty and/or issues arising from regulatory non-compliance, and +(iii) Intel will not provide or be required to assist in providing +support to any third parties for such modified products. + +Note: Many regulatory agencies consider Wireless LAN adapters to be +modules, and accordingly, condition system-level regulatory approval +upon receipt and review of test data documenting that the antennas and +system configuration do not cause the EMC and radio operation to be +non-compliant. + +The drivers available for download from SourceForge are provided as a +part of a development project. Conformance to local regulatory +requirements is the responsibility of the individual developer. As +such, if you are interested in deploying or shipping a driver as part of +solution intended to be used for purposes other than development, please +obtain a tested driver from Intel Customer Support at: + +http://support.intel.com/support/notebook/sb/CS-006408.htm + + +1. Introduction +----------------------------------------------- This document provides a brief overview of the features supported by the IPW2100 driver project. The main project website, where the latest @@ -34,9 +89,8 @@ potential fixes and patches, as well as links to the development mailing list for the driver project. -=========================== -1. Release 1.1.0 Current Supported Features ---------------------------- +2. Release 1.1.3 Current Supported Features +----------------------------------------------- - Managed (BSS) and Ad-Hoc (IBSS) - WEP (shared key and open) - Wireless Tools support @@ -51,9 +105,8 @@ on the amount of validation and interoperability testing that has been performed on a given feature. -=========================== -2. Command Line Parameters ---------------------------- +3. Command Line Parameters +----------------------------------------------- If the driver is built as a module, the following optional parameters are used by entering them on the command line with the modprobe command using this @@ -75,9 +128,9 @@ associate boolean associate=0 /* Do NOT auto associate */ disable boolean disable=1 /* Do not power the HW */ -=========================== -3. Sysfs Helper Files +4. Sysfs Helper Files --------------------------- +----------------------------------------------- There are several ways to control the behavior of the driver. Many of the general capabilities are exposed through the Wireless Tools (iwconfig). There @@ -120,9 +173,8 @@ For the device level files, see /sys/bus/pci/drivers/ipw2100: based RF kill from ON -> OFF -> ON, the radio will NOT come back on -=========================== -4. Radio Kill Switch ---------------------------- +5. Radio Kill Switch +----------------------------------------------- Most laptops provide the ability for the user to physically disable the radio. Some vendors have implemented this as a physical switch that requires no software to turn the radio off and on. On other laptops, however, the switch @@ -134,9 +186,8 @@ See the Sysfs helper file 'rf_kill' for determining the state of the RF switch on your system. -=========================== -5. Dynamic Firmware ---------------------------- +6. Dynamic Firmware +----------------------------------------------- As the firmware is licensed under a restricted use license, it can not be included within the kernel sources. To enable the IPW2100 you will need a firmware image to load into the wireless NIC's processors. @@ -146,9 +197,8 @@ You can obtain these images from . See INSTALL for instructions on installing the firmware. -=========================== -6. Power Management ---------------------------- +7. Power Management +----------------------------------------------- The IPW2100 supports the configuration of the Power Save Protocol through a private wireless extension interface. The IPW2100 supports the following different modes: @@ -200,9 +250,8 @@ xxxx/yyyy will be replaced with 'off' -- the level reported will be the active level if `iwconfig eth1 power on` is invoked. -=========================== -7. Support ---------------------------- +8. Support +----------------------------------------------- For general development information and support, go to: @@ -218,9 +267,8 @@ For installation support on the ipw2100 1.1.0 driver on Linux kernels http://supportmail.intel.com -=========================== -8. License ---------------------------- +9. License +----------------------------------------------- Copyright(c) 2003 - 2005 Intel Corporation. All rights reserved. diff --git a/Documentation/networking/README.ipw2200 b/Documentation/networking/README.ipw2200 index 6916080c5f03..c6492d3839fa 100644 --- a/Documentation/networking/README.ipw2200 +++ b/Documentation/networking/README.ipw2200 @@ -1,33 +1,89 @@ Intel(R) PRO/Wireless 2915ABG Driver for Linux in support of: -Intel(R) PRO/Wireless 2200BG Network Connection -Intel(R) PRO/Wireless 2915ABG Network Connection +Intel(R) PRO/Wireless 2200BG Network Connection +Intel(R) PRO/Wireless 2915ABG Network Connection -Note: The Intel(R) PRO/Wireless 2915ABG Driver for Linux and Intel(R) -PRO/Wireless 2200BG Driver for Linux is a unified driver that works on -both hardware adapters listed above. In this document the Intel(R) -PRO/Wireless 2915ABG Driver for Linux will be used to reference the +Note: The Intel(R) PRO/Wireless 2915ABG Driver for Linux and Intel(R) +PRO/Wireless 2200BG Driver for Linux is a unified driver that works on +both hardware adapters listed above. In this document the Intel(R) +PRO/Wireless 2915ABG Driver for Linux will be used to reference the unified driver. Copyright (C) 2004-2005, Intel Corporation README.ipw2200 -Version: 1.0.0 -Date : January 31, 2005 +Version: 1.0.8 +Date : October 20, 2005 Index ----------------------------------------------- +0. IMPORTANT INFORMATION BEFORE USING THIS DRIVER 1. Introduction 1.1. Overview of features 1.2. Module parameters 1.3. Wireless Extension Private Methods 1.4. Sysfs Helper Files -2. About the Version Numbers -3. Support -4. License +2. Ad-Hoc Networking +3. Interacting with Wireless Tools +3.1. iwconfig mode +4. About the Version Numbers +5. Firmware installation +6. Support +7. License + + +0. IMPORTANT INFORMATION BEFORE USING THIS DRIVER +----------------------------------------------- + +Important Notice FOR ALL USERS OR DISTRIBUTORS!!!! + +Intel wireless LAN adapters are engineered, manufactured, tested, and +quality checked to ensure that they meet all necessary local and +governmental regulatory agency requirements for the regions that they +are designated and/or marked to ship into. Since wireless LANs are +generally unlicensed devices that share spectrum with radars, +satellites, and other licensed and unlicensed devices, it is sometimes +necessary to dynamically detect, avoid, and limit usage to avoid +interference with these devices. In many instances Intel is required to +provide test data to prove regional and local compliance to regional and +governmental regulations before certification or approval to use the +product is granted. Intel's wireless LAN's EEPROM, firmware, and +software driver are designed to carefully control parameters that affect +radio operation and to ensure electromagnetic compliance (EMC). These +parameters include, without limitation, RF power, spectrum usage, +channel scanning, and human exposure. + +For these reasons Intel cannot permit any manipulation by third parties +of the software provided in binary format with the wireless WLAN +adapters (e.g., the EEPROM and firmware). Furthermore, if you use any +patches, utilities, or code with the Intel wireless LAN adapters that +have been manipulated by an unauthorized party (i.e., patches, +utilities, or code (including open source code modifications) which have +not been validated by Intel), (i) you will be solely responsible for +ensuring the regulatory compliance of the products, (ii) Intel will bear +no liability, under any theory of liability for any issues associated +with the modified products, including without limitation, claims under +the warranty and/or issues arising from regulatory non-compliance, and +(iii) Intel will not provide or be required to assist in providing +support to any third parties for such modified products. + +Note: Many regulatory agencies consider Wireless LAN adapters to be +modules, and accordingly, condition system-level regulatory approval +upon receipt and review of test data documenting that the antennas and +system configuration do not cause the EMC and radio operation to be +non-compliant. + +The drivers available for download from SourceForge are provided as a +part of a development project. Conformance to local regulatory +requirements is the responsibility of the individual developer. As +such, if you are interested in deploying or shipping a driver as part of +solution intended to be used for purposes other than development, please +obtain a tested driver from Intel Customer Support at: + +http://support.intel.com/support/notebook/sb/CS-006408.htm 1. Introduction @@ -45,7 +101,7 @@ file. 1.1. Overview of Features ----------------------------------------------- -The current release (1.0.0) supports the following features: +The current release (1.0.8) supports the following features: + BSS mode (Infrastructure, Managed) + IBSS mode (Ad-Hoc) @@ -56,17 +112,27 @@ The current release (1.0.0) supports the following features: + Full A rate support (2915 only) + Transmit power control + S state support (ACPI suspend/resume) + +The following features are currently enabled, but not officially +supported: + ++ WPA + long/short preamble support ++ Monitor mode (aka RFMon) + +The distinction between officially supported and enabled is a reflection +on the amount of validation and interoperability testing that has been +performed on a given feature. 1.2. Command Line Parameters ----------------------------------------------- -Like many modules used in the Linux kernel, the Intel(R) PRO/Wireless -2915ABG Driver for Linux allows certain configuration options to be -provided as module parameters. The most common way to specify a module -parameter is via the command line. +Like many modules used in the Linux kernel, the Intel(R) PRO/Wireless +2915ABG Driver for Linux allows configuration options to be provided +as module parameters. The most common way to specify a module parameter +is via the command line. The general form is: @@ -96,14 +162,18 @@ Where the supported parameter are: debug If using a debug build, this is used to control the amount of debug - info is logged. See the 'dval' and 'load' script for more info on - how to use this (the dval and load scripts are provided as part + info is logged. See the 'dvals' and 'load' script for more info on + how to use this (the dvals and load scripts are provided as part of the ipw2200 development snapshot releases available from the SourceForge project at http://ipw2200.sf.net) + + led + Can be used to turn on experimental LED code. + 0 = Off, 1 = On. Default is 0. mode Can be used to set the default mode of the adapter. - 0 = Managed, 1 = Ad-Hoc + 0 = Managed, 1 = Ad-Hoc, 2 = Monitor 1.3. Wireless Extension Private Methods @@ -164,8 +234,8 @@ The supported private methods are: ----------------------------------------------- The Linux kernel provides a pseudo file system that can be used to -access various components of the operating system. The Intel(R) -PRO/Wireless 2915ABG Driver for Linux exposes several configuration +access various components of the operating system. The Intel(R) +PRO/Wireless 2915ABG Driver for Linux exposes several configuration parameters through this mechanism. An entry in the sysfs can support reading and/or writing. You can @@ -184,13 +254,13 @@ You can set the debug level via: Where $VALUE would be a number in the case of this sysfs entry. The input to sysfs files does not have to be a number. For example, the -firmware loader used by hotplug utilizes sysfs entries for transferring +firmware loader used by hotplug utilizes sysfs entries for transfering the firmware image from user space into the driver. The Intel(R) PRO/Wireless 2915ABG Driver for Linux exposes sysfs entries -at two levels -- driver level, which apply to all instances of the -driver (in the event that there are more than one device installed) and -device level, which applies only to the single specific instance. +at two levels -- driver level, which apply to all instances of the driver +(in the event that there are more than one device installed) and device +level, which applies only to the single specific instance. 1.4.1 Driver Level Sysfs Helper Files @@ -203,6 +273,7 @@ For the driver level files, look in /sys/bus/pci/drivers/ipw2200/ This controls the same global as the 'debug' module parameter + 1.4.2 Device Level Sysfs Helper Files ----------------------------------------------- @@ -213,7 +284,7 @@ For the device level files, look in For example: /sys/bus/pci/drivers/ipw2200/0000:02:01.0 -For the device level files, see /sys/bus/pci/[drivers/ipw2200: +For the device level files, see /sys/bus/pci/drivers/ipw2200: rf_kill read - @@ -231,8 +302,59 @@ For the device level files, see /sys/bus/pci/[drivers/ipw2200: ucode read-only access to the ucode version number + led + read - + 0 = LED code disabled + 1 = LED code enabled + write - + 0 = Disable LED code + 1 = Enable LED code + + NOTE: The LED code has been reported to hang some systems when + running ifconfig and is therefore disabled by default. + + +2. Ad-Hoc Networking +----------------------------------------------- + +When using a device in an Ad-Hoc network, it is useful to understand the +sequence and requirements for the driver to be able to create, join, or +merge networks. + +The following attempts to provide enough information so that you can +have a consistent experience while using the driver as a member of an +Ad-Hoc network. + +2.1. Joining an Ad-Hoc Network +----------------------------------------------- + +The easiest way to get onto an Ad-Hoc network is to join one that +already exists. -2. About the Version Numbers +2.2. Creating an Ad-Hoc Network +----------------------------------------------- + +An Ad-Hoc networks is created using the syntax of the Wireless tool. + +For Example: +iwconfig eth1 mode ad-hoc essid testing channel 2 + +2.3. Merging Ad-Hoc Networks +----------------------------------------------- + + +3. Interaction with Wireless Tools +----------------------------------------------- + +3.1 iwconfig mode +----------------------------------------------- + +When configuring the mode of the adapter, all run-time configured parameters +are reset to the value used when the module was loaded. This includes +channels, rates, ESSID, etc. + + +4. About the Version Numbers ----------------------------------------------- Due to the nature of open source development projects, there are @@ -259,12 +381,23 @@ available as quickly as possible, unknown anomalies should be expected. The major version number will be incremented when significant changes are made to the driver. Currently, there are no major changes planned. +5. Firmware installation +---------------------------------------------- + +The driver requires a firmware image, download it and extract the +files under /lib/firmware (or wherever your hotplug's firmware.agent +will look for firmware files) + +The firmware can be downloaded from the following URL: -3. Support + http://ipw2200.sf.net/ + + +6. Support ----------------------------------------------- -For installation support of the 1.0.0 version, you can contact -http://supportmail.intel.com, or you can use the open source project +For direct support of the 1.0.0 version, you can contact +http://supportmail.intel.com, or you can use the open source project support. For general information and support, go to: @@ -272,7 +405,7 @@ For general information and support, go to: http://ipw2200.sf.net/ -4. License +7. License ----------------------------------------------- Copyright(c) 2003 - 2005 Intel Corporation. All rights reserved. @@ -297,4 +430,3 @@ For general information and support, go to: James P. Ketrenos Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - diff --git a/MAINTAINERS b/MAINTAINERS index d57c491212b1..c051f493d0dc 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1310,6 +1310,24 @@ M: john.ronciak@intel.com W: http://sourceforge.net/projects/e1000/ S: Supported +INTEL PRO/WIRELESS 2100 NETWORK CONNECTION SUPPORT +P: Yi Zhu +M: yi.zhu@intel.com +P: James Ketrenos +M: jketreno@linux.intel.com +L: http://lists.sourceforge.net/mailman/listinfo/ipw2100-devel +W: http://ipw2100.sourceforge.net +S: Supported + +INTEL PRO/WIRELESS 2915ABG NETWORK CONNECTION SUPPORT +P: Yi Zhu +M: yi.zhu@intel.com +P: James Ketrenos +M: jketreno@linux.intel.com +L: http://lists.sourceforge.net/mailman/listinfo/ipw2100-devel +W: http://ipw2200.sourceforge.net +S: Supported + IOC3 DRIVER P: Ralf Baechle M: ralf@linux-mips.org -- cgit v1.2.2 From fd7a516efbcdabf5d7b9307ca9fe48b511b7d123 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Wed, 2 Nov 2005 01:53:16 +0100 Subject: [PATCH] fix NET_RADIO=n, IEEE80211=y compile This patch fixes the following compile error with CONFIG_NET_RADIO=n and CONFIG_IEEE80211=y: LD .tmp_vmlinux1 net/built-in.o: In function `ieee80211_rx': : undefined reference to `wireless_spy_update' make: *** [.tmp_vmlinux1] Error 1 Signed-off-by: Adrian Bunk Signed-off-by: John W. Linville --- net/ieee80211/ieee80211_rx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/ieee80211/ieee80211_rx.c b/net/ieee80211/ieee80211_rx.c index ce694cf5c160..00eb780836d8 100644 --- a/net/ieee80211/ieee80211_rx.c +++ b/net/ieee80211/ieee80211_rx.c @@ -370,6 +370,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, /* Put this code here so that we avoid duplicating it in all * Rx paths. - Jean II */ #ifdef IW_WIRELESS_SPY /* defined in iw_handler.h */ +#ifdef CONFIG_NET_RADIO /* If spy monitoring on */ if (ieee->spy_data.spy_number > 0) { struct iw_quality wstats; @@ -396,6 +397,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, /* Update spy records */ wireless_spy_update(ieee->dev, hdr->addr2, &wstats); } +#endif /* CONFIG_NET_RADIO */ #endif /* IW_WIRELESS_SPY */ #ifdef NOT_YET -- cgit v1.2.2 From 8e3babcd69ec0fde874838e276eb0b211c6a5647 Mon Sep 17 00:00:00 2001 From: Jay Vosburgh Date: Fri, 4 Nov 2005 18:45:45 -0800 Subject: [PATCH] bonding: fix feature consolidation This should resolve http://bugzilla.kernel.org/show_bug.cgi?id=5519 The current feature computation loses bits that it doesn't know about, resulting in an inability to add VLANs and possibly other havoc. Rewrote function to preserve bits it doesn't know about, remove an unneeded state variable, and simplify the code. Signed-off-by: Jay Vosburgh Signed-off-by: John W. Linville --- drivers/net/bonding/bond_main.c | 32 +++++++++++--------------------- drivers/net/bonding/bonding.h | 7 ++----- 2 files changed, 13 insertions(+), 26 deletions(-) diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 8032126fd589..94cec3cf2a13 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -1604,35 +1604,27 @@ static int bond_sethwaddr(struct net_device *bond_dev, struct net_device *slave_ (NETIF_F_SG|NETIF_F_IP_CSUM|NETIF_F_NO_CSUM|NETIF_F_HW_CSUM) /* - * Compute the features available to the bonding device by - * intersection of all of the slave devices' BOND_INTERSECT_FEATURES. - * Call this after attaching or detaching a slave to update the - * bond's features. + * Compute the common dev->feature set available to all slaves. Some + * feature bits are managed elsewhere, so preserve feature bits set on + * master device that are not part of the examined set. */ static int bond_compute_features(struct bonding *bond) { - int i; + unsigned long features = BOND_INTERSECT_FEATURES; struct slave *slave; struct net_device *bond_dev = bond->dev; - int features = bond->bond_features; + int i; - bond_for_each_slave(bond, slave, i) { - struct net_device * slave_dev = slave->dev; - if (i == 0) { - features |= BOND_INTERSECT_FEATURES; - } - features &= - ~(~slave_dev->features & BOND_INTERSECT_FEATURES); - } + bond_for_each_slave(bond, slave, i) + features &= (slave->dev->features & BOND_INTERSECT_FEATURES); - /* turn off NETIF_F_SG if we need a csum and h/w can't do it */ if ((features & NETIF_F_SG) && - !(features & (NETIF_F_IP_CSUM | - NETIF_F_NO_CSUM | - NETIF_F_HW_CSUM))) { + !(features & (NETIF_F_IP_CSUM | + NETIF_F_NO_CSUM | + NETIF_F_HW_CSUM))) features &= ~NETIF_F_SG; - } + features |= (bond_dev->features & ~BOND_INTERSECT_FEATURES); bond_dev->features = features; return 0; @@ -4561,8 +4553,6 @@ static int __init bond_init(struct net_device *bond_dev, struct bond_params *par NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER); - bond->bond_features = bond_dev->features; - #ifdef CONFIG_PROC_FS bond_create_proc_entry(bond); #endif diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h index bbf9da8af624..1433e91db0f7 100644 --- a/drivers/net/bonding/bonding.h +++ b/drivers/net/bonding/bonding.h @@ -40,8 +40,8 @@ #include "bond_3ad.h" #include "bond_alb.h" -#define DRV_VERSION "2.6.4" -#define DRV_RELDATE "September 26, 2005" +#define DRV_VERSION "2.6.5" +#define DRV_RELDATE "November 4, 2005" #define DRV_NAME "bonding" #define DRV_DESCRIPTION "Ethernet Channel Bonding Driver" @@ -211,9 +211,6 @@ struct bonding { struct bond_params params; struct list_head vlan_list; struct vlan_group *vlgrp; - /* the features the bonding device supports, independently - * of any slaves */ - int bond_features; }; /** -- cgit v1.2.2 From 48888cc6120ff945675ef79a3ba2955afa0f5124 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Sat, 5 Nov 2005 20:01:47 +0100 Subject: [PATCH] kill include/linux/eeprom.h This patch kills include/linux/eeprom.h . Rationale: - it was only used by one single driver - even this driver didn't do anything useful with it - most of this file are non-inline and non-static functions (sic) This removes include/linux/eeprom.h and cleans drivers/net/ns83820.c up. If you think eeprom.h should be used more extensively, please consider: - the code has to be moved from the header file to a .c file - the currently empty write function has to be implemented - ns83820.c or any other driver should actually use it Noone did any of these during the more than 3 years eeprom.h already exists... Signed-off-by: Adrian Bunk Signed-off-by: John W. Linville --- drivers/net/ns83820.c | 13 +---- include/linux/eeprom.h | 136 ------------------------------------------------- 2 files changed, 2 insertions(+), 147 deletions(-) delete mode 100644 include/linux/eeprom.h diff --git a/drivers/net/ns83820.c b/drivers/net/ns83820.c index a3c3fc9c0d8a..f857ae94d261 100644 --- a/drivers/net/ns83820.c +++ b/drivers/net/ns83820.c @@ -110,7 +110,6 @@ #include #include /* for iph */ #include /* for IPPROTO_... */ -#include #include #include #include @@ -445,7 +444,6 @@ struct ns83820 { u32 MEAR_cache; u32 IMR_cache; - struct eeprom ee; unsigned linkstate; @@ -1558,15 +1556,13 @@ static void ns83820_getmac(struct ns83820 *dev, u8 *mac) unsigned i; for (i=0; i<3; i++) { u32 data; -#if 0 /* I've left this in as an example of how to use eeprom.h */ - data = eeprom_readw(&dev->ee, 0xa + 2 - i); -#else + /* Read from the perfect match memory: this is loaded by * the chip from the EEPROM via the EELOAD self test. */ writel(i*2, dev->base + RFCR); data = readl(dev->base + RFDR); -#endif + *mac++ = data; *mac++ = data >> 8; } @@ -1851,8 +1847,6 @@ static int __devinit ns83820_init_one(struct pci_dev *pci_dev, const struct pci_ spin_lock_init(&dev->misc_lock); dev->pci_dev = pci_dev; - dev->ee.cache = &dev->MEAR_cache; - dev->ee.lock = &dev->misc_lock; SET_MODULE_OWNER(ndev); SET_NETDEV_DEV(ndev, &pci_dev->dev); @@ -1887,9 +1881,6 @@ static int __devinit ns83820_init_one(struct pci_dev *pci_dev, const struct pci_ dev->IMR_cache = 0; - setup_ee_mem_bitbanger(&dev->ee, dev->base + MEAR, 3, 2, 1, 0, - 0); - err = request_irq(pci_dev->irq, ns83820_irq, SA_SHIRQ, DRV_NAME, ndev); if (err) { diff --git a/include/linux/eeprom.h b/include/linux/eeprom.h deleted file mode 100644 index 38afd9da1dfe..000000000000 --- a/include/linux/eeprom.h +++ /dev/null @@ -1,136 +0,0 @@ -/* credit winbond-840.c - */ -#include -struct eeprom_ops { - void (*set_cs)(void *ee); - void (*clear_cs)(void *ee); -}; - -#define EEPOL_EEDI 0x01 -#define EEPOL_EEDO 0x02 -#define EEPOL_EECLK 0x04 -#define EEPOL_EESEL 0x08 - -struct eeprom { - void *dev; - struct eeprom_ops *ops; - - void __iomem * addr; - - unsigned ee_addr_bits; - - unsigned eesel; - unsigned eeclk; - unsigned eedo; - unsigned eedi; - unsigned polarity; - unsigned ee_state; - - spinlock_t *lock; - u32 *cache; -}; - - -u8 eeprom_readb(struct eeprom *ee, unsigned address); -void eeprom_read(struct eeprom *ee, unsigned address, u8 *bytes, - unsigned count); -void eeprom_writeb(struct eeprom *ee, unsigned address, u8 data); -void eeprom_write(struct eeprom *ee, unsigned address, u8 *bytes, - unsigned count); - -/* The EEPROM commands include the alway-set leading bit. */ -enum EEPROM_Cmds { - EE_WriteCmd=(5 << 6), EE_ReadCmd=(6 << 6), EE_EraseCmd=(7 << 6), -}; - -void setup_ee_mem_bitbanger(struct eeprom *ee, void __iomem *memaddr, int eesel_bit, int eeclk_bit, int eedo_bit, int eedi_bit, unsigned polarity) -{ - ee->addr = memaddr; - ee->eesel = 1 << eesel_bit; - ee->eeclk = 1 << eeclk_bit; - ee->eedo = 1 << eedo_bit; - ee->eedi = 1 << eedi_bit; - - ee->polarity = polarity; - - *ee->cache = readl(ee->addr); -} - -/* foo. put this in a .c file */ -static inline void eeprom_update(struct eeprom *ee, u32 mask, int pol) -{ - unsigned long flags; - u32 data; - - spin_lock_irqsave(ee->lock, flags); - data = *ee->cache; - - data &= ~mask; - if (pol) - data |= mask; - - *ee->cache = data; -//printk("update: %08x\n", data); - writel(data, ee->addr); - spin_unlock_irqrestore(ee->lock, flags); -} - -void eeprom_clk_lo(struct eeprom *ee) -{ - int pol = !!(ee->polarity & EEPOL_EECLK); - - eeprom_update(ee, ee->eeclk, pol); - udelay(2); -} - -void eeprom_clk_hi(struct eeprom *ee) -{ - int pol = !!(ee->polarity & EEPOL_EECLK); - - eeprom_update(ee, ee->eeclk, !pol); - udelay(2); -} - -void eeprom_send_addr(struct eeprom *ee, unsigned address) -{ - int pol = !!(ee->polarity & EEPOL_EEDI); - unsigned i; - address |= 6 << 6; - - /* Shift the read command bits out. */ - for (i=0; i<11; i++) { - eeprom_update(ee, ee->eedi, ((address >> 10) & 1) ^ pol); - address <<= 1; - eeprom_clk_hi(ee); - eeprom_clk_lo(ee); - } - eeprom_update(ee, ee->eedi, pol); -} - -u16 eeprom_readw(struct eeprom *ee, unsigned address) -{ - unsigned i; - u16 res = 0; - - eeprom_clk_lo(ee); - eeprom_update(ee, ee->eesel, 1 ^ !!(ee->polarity & EEPOL_EESEL)); - eeprom_send_addr(ee, address); - - for (i=0; i<16; i++) { - u32 data; - eeprom_clk_hi(ee); - res <<= 1; - data = readl(ee->addr); -//printk("eeprom_readw: %08x\n", data); - res |= !!(data & ee->eedo) ^ !!(ee->polarity & EEPOL_EEDO); - eeprom_clk_lo(ee); - } - eeprom_update(ee, ee->eesel, 0 ^ !!(ee->polarity & EEPOL_EESEL)); - - return res; -} - - -void eeprom_writeb(struct eeprom *ee, unsigned address, u8 data) -{ -} -- cgit v1.2.2 From ac1f60db6a62c8605b551497c8002ba267ea1f4a Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Sun, 6 Nov 2005 01:46:47 +0100 Subject: [PATCH] drivers/net/s2io.c: make functions static This patch makes needlessly global functions static. Signed-off-by: Adrian Bunk Signed-off-by: John W. Linville --- drivers/net/s2io.c | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index 9c4935407f26..9848892643fc 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c @@ -1532,7 +1532,7 @@ static int init_nic(struct s2io_nic *nic) #define LINK_UP_DOWN_INTERRUPT 1 #define MAC_RMAC_ERR_TIMER 2 -int s2io_link_fault_indication(nic_t *nic) +static int s2io_link_fault_indication(nic_t *nic) { if (nic->intr_type != INTA) return MAC_RMAC_ERR_TIMER; @@ -1864,7 +1864,7 @@ static int verify_xena_quiescence(nic_t *sp, u64 val64, int flag) * */ -void fix_mac_address(nic_t * sp) +static void fix_mac_address(nic_t * sp) { XENA_dev_config_t __iomem *bar0 = sp->bar0; u64 val64; @@ -2162,7 +2162,7 @@ int fill_rxd_3buf(nic_t *nic, RxD_t *rxdp, struct sk_buff *skb) * SUCCESS on success or an appropriate -ve value on failure. */ -int fill_rx_buffers(struct s2io_nic *nic, int ring_no) +static int fill_rx_buffers(struct s2io_nic *nic, int ring_no) { struct net_device *dev = nic->dev; struct sk_buff *skb; @@ -2833,7 +2833,7 @@ static void alarm_intr_handler(struct s2io_nic *nic) * SUCCESS on success and FAILURE on failure. */ -int wait_for_cmd_complete(nic_t * sp) +static int wait_for_cmd_complete(nic_t * sp) { XENA_dev_config_t __iomem *bar0 = sp->bar0; int ret = FAILURE, cnt = 0; @@ -3079,7 +3079,7 @@ int s2io_set_swapper(nic_t * sp) return SUCCESS; } -int wait_for_msix_trans(nic_t *nic, int i) +static int wait_for_msix_trans(nic_t *nic, int i) { XENA_dev_config_t *bar0 = (XENA_dev_config_t *) nic->bar0; u64 val64; @@ -3118,7 +3118,7 @@ void restore_xmsi_data(nic_t *nic) } } -void store_xmsi_data(nic_t *nic) +static void store_xmsi_data(nic_t *nic) { XENA_dev_config_t *bar0 = (XENA_dev_config_t *) nic->bar0; u64 val64, addr, data; @@ -3290,7 +3290,7 @@ int s2io_enable_msi_x(nic_t *nic) * file on failure. */ -int s2io_open(struct net_device *dev) +static int s2io_open(struct net_device *dev) { nic_t *sp = dev->priv; int err = 0; @@ -3420,7 +3420,7 @@ hw_init_failed: * file on failure. */ -int s2io_close(struct net_device *dev) +static int s2io_close(struct net_device *dev) { nic_t *sp = dev->priv; int i; @@ -3469,7 +3469,7 @@ int s2io_close(struct net_device *dev) * 0 on success & 1 on failure. */ -int s2io_xmit(struct sk_buff *skb, struct net_device *dev) +static int s2io_xmit(struct sk_buff *skb, struct net_device *dev) { nic_t *sp = dev->priv; u16 frg_cnt, frg_len, i, queue, queue_len, put_off, get_off; @@ -3915,7 +3915,7 @@ static void s2io_updt_stats(nic_t *sp) * pointer to the updated net_device_stats structure. */ -struct net_device_stats *s2io_get_stats(struct net_device *dev) +static struct net_device_stats *s2io_get_stats(struct net_device *dev) { nic_t *sp = dev->priv; mac_info_t *mac_control; @@ -5108,19 +5108,20 @@ static void s2io_get_ethtool_stats(struct net_device *dev, tmp_stats[i++] = stat_info->sw_stat.double_ecc_errs; } -int s2io_ethtool_get_regs_len(struct net_device *dev) +static int s2io_ethtool_get_regs_len(struct net_device *dev) { return (XENA_REG_SPACE); } -u32 s2io_ethtool_get_rx_csum(struct net_device * dev) +static u32 s2io_ethtool_get_rx_csum(struct net_device * dev) { nic_t *sp = dev->priv; return (sp->rx_csum); } -int s2io_ethtool_set_rx_csum(struct net_device *dev, u32 data) + +static int s2io_ethtool_set_rx_csum(struct net_device *dev, u32 data) { nic_t *sp = dev->priv; @@ -5131,17 +5132,19 @@ int s2io_ethtool_set_rx_csum(struct net_device *dev, u32 data) return 0; } -int s2io_get_eeprom_len(struct net_device *dev) + +static int s2io_get_eeprom_len(struct net_device *dev) { return (XENA_EEPROM_SPACE); } -int s2io_ethtool_self_test_count(struct net_device *dev) +static int s2io_ethtool_self_test_count(struct net_device *dev) { return (S2IO_TEST_LEN); } -void s2io_ethtool_get_strings(struct net_device *dev, - u32 stringset, u8 * data) + +static void s2io_ethtool_get_strings(struct net_device *dev, + u32 stringset, u8 * data) { switch (stringset) { case ETH_SS_TEST: @@ -5157,7 +5160,7 @@ static int s2io_ethtool_get_stats_count(struct net_device *dev) return (S2IO_STAT_LEN); } -int s2io_ethtool_op_set_tx_csum(struct net_device *dev, u32 data) +static int s2io_ethtool_op_set_tx_csum(struct net_device *dev, u32 data) { if (data) dev->features |= NETIF_F_IP_CSUM; @@ -5210,7 +5213,7 @@ static struct ethtool_ops netdev_ethtool_ops = { * function always return EOPNOTSUPPORTED */ -int s2io_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) +static int s2io_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { return -EOPNOTSUPP; } @@ -5226,7 +5229,7 @@ int s2io_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) * file on failure. */ -int s2io_change_mtu(struct net_device *dev, int new_mtu) +static int s2io_change_mtu(struct net_device *dev, int new_mtu) { nic_t *sp = dev->priv; -- cgit v1.2.2 From de7fe963b123365a27f82330689806226a48d088 Mon Sep 17 00:00:00 2001 From: Roger While Date: Mon, 7 Nov 2005 20:57:58 +0100 Subject: [PATCH] prism54 : Unused variable / extraneous udelay In isl_38xx.c : The variable "counter" is defined and incremented but never used except if the driver is hand-compiled setting VERBOSE > SHOW_ERROR_MESSAGES. Move the definition and the increment to within the #if VERBOSE .. block. Remove extraneous udelay's. These are not required when triggering the device. Signed-off-by: Roger While Signed-off-by: John W. Linville --- drivers/net/wireless/prism54/isl_38xx.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/prism54/isl_38xx.c b/drivers/net/wireless/prism54/isl_38xx.c index adc7499136dc..866c476933c3 100644 --- a/drivers/net/wireless/prism54/isl_38xx.c +++ b/drivers/net/wireless/prism54/isl_38xx.c @@ -112,9 +112,10 @@ isl38xx_handle_wakeup(isl38xx_control_block *control_block, void isl38xx_trigger_device(int asleep, void __iomem *device_base) { - u32 reg, counter = 0; + u32 reg; #if VERBOSE > SHOW_ERROR_MESSAGES + u32 counter = 0; struct timeval current_time; DEBUG(SHOW_FUNCTION_CALLS, "isl38xx trigger device\n"); #endif @@ -131,7 +132,6 @@ isl38xx_trigger_device(int asleep, void __iomem *device_base) current_time.tv_sec, (long)current_time.tv_usec, readl(device_base + ISL38XX_CTRL_STAT_REG)); #endif - udelay(ISL38XX_WRITEIO_DELAY); reg = readl(device_base + ISL38XX_INT_IDENT_REG); if (reg == 0xabadface) { @@ -145,7 +145,9 @@ isl38xx_trigger_device(int asleep, void __iomem *device_base) while (reg = readl(device_base + ISL38XX_CTRL_STAT_REG), (reg & ISL38XX_CTRL_STAT_SLEEPMODE) == 0) { udelay(ISL38XX_WRITEIO_DELAY); +#if VERBOSE > SHOW_ERROR_MESSAGES counter++; +#endif } #if VERBOSE > SHOW_ERROR_MESSAGES @@ -153,10 +155,6 @@ isl38xx_trigger_device(int asleep, void __iomem *device_base) "%08li.%08li Device register read %08x\n", current_time.tv_sec, (long)current_time.tv_usec, readl(device_base + ISL38XX_CTRL_STAT_REG)); -#endif - udelay(ISL38XX_WRITEIO_DELAY); - -#if VERBOSE > SHOW_ERROR_MESSAGES do_gettimeofday(¤t_time); DEBUG(SHOW_TRACING, "%08li.%08li Device asleep counter %i\n", @@ -171,7 +169,6 @@ isl38xx_trigger_device(int asleep, void __iomem *device_base) /* perform another read on the Device Status Register */ reg = readl(device_base + ISL38XX_CTRL_STAT_REG); - udelay(ISL38XX_WRITEIO_DELAY); #if VERBOSE > SHOW_ERROR_MESSAGES do_gettimeofday(¤t_time); @@ -187,7 +184,6 @@ isl38xx_trigger_device(int asleep, void __iomem *device_base) isl38xx_w32_flush(device_base, ISL38XX_DEV_INT_UPDATE, ISL38XX_DEV_INT_REG); - udelay(ISL38XX_WRITEIO_DELAY); } } -- cgit v1.2.2 From 0b47939fe616a5e0dd279d98d1eb372e4acc1c09 Mon Sep 17 00:00:00 2001 From: Roger While Date: Mon, 7 Nov 2005 20:58:21 +0100 Subject: [PATCH] prism54 : Transmit stats updated in wrong place Move update of the transmit statistics to the correct place. This would be just before starting transmission rather than (potentially long) afterward. Signed-off-by: Roger While Signed-off-by: John W. Linville --- drivers/net/wireless/prism54/islpci_eth.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/prism54/islpci_eth.c b/drivers/net/wireless/prism54/islpci_eth.c index 3b49efa37ee5..56d97833edad 100644 --- a/drivers/net/wireless/prism54/islpci_eth.c +++ b/drivers/net/wireless/prism54/islpci_eth.c @@ -227,17 +227,17 @@ islpci_eth_transmit(struct sk_buff *skb, struct net_device *ndev) priv->data_low_tx_full = 1; } + /* set the transmission time */ + ndev->trans_start = jiffies; + priv->statistics.tx_packets++; + priv->statistics.tx_bytes += skb->len; + /* trigger the device */ islpci_trigger(priv); /* unlock the driver code */ spin_unlock_irqrestore(&priv->slock, flags); - /* set the transmission time */ - ndev->trans_start = jiffies; - priv->statistics.tx_packets++; - priv->statistics.tx_bytes += skb->len; - return 0; drop_free: -- cgit v1.2.2 From 097688ef4710648db335c3c4fa243751f60b330a Mon Sep 17 00:00:00 2001 From: Luiz Fernando Capitulino Date: Mon, 7 Nov 2005 18:14:12 -0200 Subject: [PATCH] Fix sparse warning in e100 driver. The patch below fixes the following sparse warnings: drivers/net/e100.c:1481:13: warning: Using plain integer as NULL pointer drivers/net/e100.c:1767:27: warning: Using plain integer as NULL pointer drivers/net/e100.c:1847:27: warning: Using plain integer as NULL pointer Signed-off-by: Luiz Capitulino Signed-off-by: John W. Linville --- drivers/net/e100.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/e100.c b/drivers/net/e100.c index eb169a8e8773..7a6aeae2c9fa 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c @@ -1478,7 +1478,7 @@ static inline int e100_rx_alloc_skb(struct nic *nic, struct rx *rx) if(pci_dma_mapping_error(rx->dma_addr)) { dev_kfree_skb_any(rx->skb); - rx->skb = 0; + rx->skb = NULL; rx->dma_addr = 0; return -ENOMEM; } @@ -1764,7 +1764,7 @@ static int e100_up(struct nic *nic) if((err = e100_hw_init(nic))) goto err_clean_cbs; e100_set_multicast_list(nic->netdev); - e100_start_receiver(nic, 0); + e100_start_receiver(nic, NULL); mod_timer(&nic->watchdog, jiffies); if((err = request_irq(nic->pdev->irq, e100_intr, SA_SHIRQ, nic->netdev->name, nic->netdev))) @@ -1844,7 +1844,7 @@ static int e100_loopback_test(struct nic *nic, enum loopback loopback_mode) mdio_write(nic->netdev, nic->mii.phy_id, MII_BMCR, BMCR_LOOPBACK); - e100_start_receiver(nic, 0); + e100_start_receiver(nic, NULL); if(!(skb = dev_alloc_skb(ETH_DATA_LEN))) { err = -ENOMEM; -- cgit v1.2.2 From f36be62115aabd50b4eda0f06f07ab5fae2e9cfd Mon Sep 17 00:00:00 2001 From: Alexey Dobriyan Date: Tue, 8 Nov 2005 00:41:48 +0300 Subject: [PATCH] atmel: memset correct range Specify the correct range when calling memset in atmel_get_range. Do this by specifying the size of the structure, rather than the size of the pointer. Signed-off-by: Alexey Dobriyan Signed-off-by: John W. Linville --- drivers/net/wireless/atmel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c index 1fbe027d26b6..a3e23527fe7f 100644 --- a/drivers/net/wireless/atmel.c +++ b/drivers/net/wireless/atmel.c @@ -2217,7 +2217,7 @@ static int atmel_get_range(struct net_device *dev, int k,i,j; dwrq->length = sizeof(struct iw_range); - memset(range, 0, sizeof(range)); + memset(range, 0, sizeof(struct iw_range)); range->min_nwid = 0x0000; range->max_nwid = 0x0000; range->num_channels = 0; -- cgit v1.2.2 From b69a3aa85cb7bda2eb6c5932a62c1337d0d6612c Mon Sep 17 00:00:00 2001 From: Panagiotis Issaris Date: Tue, 8 Nov 2005 00:03:15 +0100 Subject: [PATCH] wireless net: Conversions of kmalloc/memset to kzalloc More conversions of kmalloc/memset to kzalloc Signed-off-by: Panagiotis Issaris Signed-off-by: John W. Linville --- drivers/net/wireless/airo.c | 36 ++++++++++++------------------------ drivers/net/wireless/airo_cs.c | 6 ++---- drivers/net/wireless/atmel_cs.c | 6 ++---- drivers/net/wireless/ipw2100.c | 4 +--- drivers/net/wireless/wavelan_cs.c | 3 +-- drivers/net/wireless/wl3501_cs.c | 3 +-- 6 files changed, 19 insertions(+), 39 deletions(-) diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index 849ac88bcccc..58ca585caa59 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c @@ -4533,9 +4533,8 @@ static int proc_status_open( struct inode *inode, struct file *file ) { StatusRid status_rid; int i; - if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) + if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) return -ENOMEM; - memset(file->private_data, 0, sizeof(struct proc_data)); data = (struct proc_data *)file->private_data; if ((data->rbuffer = kmalloc( 2048, GFP_KERNEL )) == NULL) { kfree (file->private_data); @@ -4613,9 +4612,8 @@ static int proc_stats_rid_open( struct inode *inode, int i, j; u32 *vals = stats.vals; - if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) + if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) return -ENOMEM; - memset(file->private_data, 0, sizeof(struct proc_data)); data = (struct proc_data *)file->private_data; if ((data->rbuffer = kmalloc( 4096, GFP_KERNEL )) == NULL) { kfree (file->private_data); @@ -4879,20 +4877,18 @@ static int proc_config_open( struct inode *inode, struct file *file ) { struct airo_info *ai = dev->priv; int i; - if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) + if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) return -ENOMEM; - memset(file->private_data, 0, sizeof(struct proc_data)); data = (struct proc_data *)file->private_data; if ((data->rbuffer = kmalloc( 2048, GFP_KERNEL )) == NULL) { kfree (file->private_data); return -ENOMEM; } - if ((data->wbuffer = kmalloc( 2048, GFP_KERNEL )) == NULL) { + if ((data->wbuffer = kzalloc( 2048, GFP_KERNEL )) == NULL) { kfree (data->rbuffer); kfree (file->private_data); return -ENOMEM; } - memset( data->wbuffer, 0, 2048 ); data->maxwritelen = 2048; data->on_close = proc_config_on_close; @@ -5153,24 +5149,21 @@ static int proc_wepkey_open( struct inode *inode, struct file *file ) { int j=0; int rc; - if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) + if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) return -ENOMEM; - memset(file->private_data, 0, sizeof(struct proc_data)); memset(&wkr, 0, sizeof(wkr)); data = (struct proc_data *)file->private_data; - if ((data->rbuffer = kmalloc( 180, GFP_KERNEL )) == NULL) { + if ((data->rbuffer = kzalloc( 180, GFP_KERNEL )) == NULL) { kfree (file->private_data); return -ENOMEM; } - memset(data->rbuffer, 0, 180); data->writelen = 0; data->maxwritelen = 80; - if ((data->wbuffer = kmalloc( 80, GFP_KERNEL )) == NULL) { + if ((data->wbuffer = kzalloc( 80, GFP_KERNEL )) == NULL) { kfree (data->rbuffer); kfree (file->private_data); return -ENOMEM; } - memset( data->wbuffer, 0, 80 ); data->on_close = proc_wepkey_on_close; ptr = data->rbuffer; @@ -5201,9 +5194,8 @@ static int proc_SSID_open( struct inode *inode, struct file *file ) { char *ptr; SsidRid SSID_rid; - if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) + if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) return -ENOMEM; - memset(file->private_data, 0, sizeof(struct proc_data)); data = (struct proc_data *)file->private_data; if ((data->rbuffer = kmalloc( 104, GFP_KERNEL )) == NULL) { kfree (file->private_data); @@ -5211,12 +5203,11 @@ static int proc_SSID_open( struct inode *inode, struct file *file ) { } data->writelen = 0; data->maxwritelen = 33*3; - if ((data->wbuffer = kmalloc( 33*3, GFP_KERNEL )) == NULL) { + if ((data->wbuffer = kzalloc( 33*3, GFP_KERNEL )) == NULL) { kfree (data->rbuffer); kfree (file->private_data); return -ENOMEM; } - memset( data->wbuffer, 0, 33*3 ); data->on_close = proc_SSID_on_close; readSsidRid(ai, &SSID_rid); @@ -5245,9 +5236,8 @@ static int proc_APList_open( struct inode *inode, struct file *file ) { char *ptr; APListRid APList_rid; - if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) + if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) return -ENOMEM; - memset(file->private_data, 0, sizeof(struct proc_data)); data = (struct proc_data *)file->private_data; if ((data->rbuffer = kmalloc( 104, GFP_KERNEL )) == NULL) { kfree (file->private_data); @@ -5255,12 +5245,11 @@ static int proc_APList_open( struct inode *inode, struct file *file ) { } data->writelen = 0; data->maxwritelen = 4*6*3; - if ((data->wbuffer = kmalloc( data->maxwritelen, GFP_KERNEL )) == NULL) { + if ((data->wbuffer = kzalloc( data->maxwritelen, GFP_KERNEL )) == NULL) { kfree (data->rbuffer); kfree (file->private_data); return -ENOMEM; } - memset( data->wbuffer, 0, data->maxwritelen ); data->on_close = proc_APList_on_close; readAPListRid(ai, &APList_rid); @@ -5295,9 +5284,8 @@ static int proc_BSSList_open( struct inode *inode, struct file *file ) { /* If doLoseSync is not 1, we won't do a Lose Sync */ int doLoseSync = -1; - if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) + if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) return -ENOMEM; - memset(file->private_data, 0, sizeof(struct proc_data)); data = (struct proc_data *)file->private_data; if ((data->rbuffer = kmalloc( 1024, GFP_KERNEL )) == NULL) { kfree (file->private_data); diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c index 784de9109113..fee458fd7a4a 100644 --- a/drivers/net/wireless/airo_cs.c +++ b/drivers/net/wireless/airo_cs.c @@ -172,12 +172,11 @@ static dev_link_t *airo_attach(void) DEBUG(0, "airo_attach()\n"); /* Initialize the dev_link_t structure */ - link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); + link = kzalloc(sizeof(struct dev_link_t), GFP_KERNEL); if (!link) { printk(KERN_ERR "airo_cs: no memory for new device\n"); return NULL; } - memset(link, 0, sizeof(struct dev_link_t)); /* Interrupt setup */ link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; @@ -196,13 +195,12 @@ static dev_link_t *airo_attach(void) link->conf.IntType = INT_MEMORY_AND_IO; /* Allocate space for private device-specific data */ - local = kmalloc(sizeof(local_info_t), GFP_KERNEL); + local = kzalloc(sizeof(local_info_t), GFP_KERNEL); if (!local) { printk(KERN_ERR "airo_cs: no memory for new device\n"); kfree (link); return NULL; } - memset(local, 0, sizeof(local_info_t)); link->priv = local; /* Register with Card Services */ diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c index 195cb36619e8..1bd13146c644 100644 --- a/drivers/net/wireless/atmel_cs.c +++ b/drivers/net/wireless/atmel_cs.c @@ -180,12 +180,11 @@ static dev_link_t *atmel_attach(void) DEBUG(0, "atmel_attach()\n"); /* Initialize the dev_link_t structure */ - link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); + link = kzalloc(sizeof(struct dev_link_t), GFP_KERNEL); if (!link) { printk(KERN_ERR "atmel_cs: no memory for new device\n"); return NULL; } - memset(link, 0, sizeof(struct dev_link_t)); /* Interrupt setup */ link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; @@ -204,13 +203,12 @@ static dev_link_t *atmel_attach(void) link->conf.IntType = INT_MEMORY_AND_IO; /* Allocate space for private device-specific data */ - local = kmalloc(sizeof(local_info_t), GFP_KERNEL); + local = kzalloc(sizeof(local_info_t), GFP_KERNEL); if (!local) { printk(KERN_ERR "atmel_cs: no memory for new device\n"); kfree (link); return NULL; } - memset(local, 0, sizeof(local_info_t)); link->priv = local; /* Register with Card Services */ diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c index ad7f8cd76db9..4f19ac7d63a8 100644 --- a/drivers/net/wireless/ipw2100.c +++ b/drivers/net/wireless/ipw2100.c @@ -6065,13 +6065,11 @@ static int ipw2100_wpa_set_encryption(struct net_device *dev, ieee80211_crypt_delayed_deinit(ieee, crypt); - new_crypt = (struct ieee80211_crypt_data *) - kmalloc(sizeof(struct ieee80211_crypt_data), GFP_KERNEL); + new_crypt = kzalloc(sizeof(struct ieee80211_crypt_data), GFP_KERNEL); if (new_crypt == NULL) { ret = -ENOMEM; goto done; } - memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data)); new_crypt->ops = ops; if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) new_crypt->priv = new_crypt->ops->init(param->u.crypt.idx); diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c index 4b3c98f5c564..c822cad3333f 100644 --- a/drivers/net/wireless/wavelan_cs.c +++ b/drivers/net/wireless/wavelan_cs.c @@ -4608,9 +4608,8 @@ wavelan_attach(void) #endif /* Initialize the dev_link_t structure */ - link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); + link = kzalloc(sizeof(struct dev_link_t), GFP_KERNEL); if (!link) return NULL; - memset(link, 0, sizeof(struct dev_link_t)); /* The io structure describes IO port mapping */ link->io.NumPorts1 = 8; diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c index 3f8c27f0871b..978fdc606781 100644 --- a/drivers/net/wireless/wl3501_cs.c +++ b/drivers/net/wireless/wl3501_cs.c @@ -1965,10 +1965,9 @@ static dev_link_t *wl3501_attach(void) int ret; /* Initialize the dev_link_t structure */ - link = kmalloc(sizeof(*link), GFP_KERNEL); + link = kzalloc(sizeof(*link), GFP_KERNEL); if (!link) goto out; - memset(link, 0, sizeof(struct dev_link_t)); /* The io structure describes IO port mapping */ link->io.NumPorts1 = 16; -- cgit v1.2.2 From a852daa00ad91350fe603da47becaf3d5af4f2bd Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 2 Nov 2005 21:42:48 +0100 Subject: [PATCH] i2c: writing-client doc update complement My latest update to the writing-clients i2c documentation file was incomplete, here's the complement. Large parts of this file are still way out-of-date, but at least now the memory allocation and freeing instructions are consistent. Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- Documentation/i2c/writing-clients | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/i2c/writing-clients b/Documentation/i2c/writing-clients index cff7b652588a..d19993cc0604 100644 --- a/Documentation/i2c/writing-clients +++ b/Documentation/i2c/writing-clients @@ -412,7 +412,7 @@ For now, you can ignore the `flags' parameter. It is there for future use. release_region(address,FOO_EXTENT); /* SENSORS ONLY END */ ERROR1: - kfree(new_client); + kfree(data); ERROR0: return err; } @@ -443,7 +443,7 @@ much simpler than the attachment code, fortunately! release_region(client->addr,LM78_EXTENT); /* HYBRID SENSORS CHIP ONLY END */ - kfree(data); + kfree(i2c_get_clientdata(client)); return 0; } -- cgit v1.2.2 From ef9627464490fe67235bbd5724d55345b92c0315 Mon Sep 17 00:00:00 2001 From: James Chapman Date: Sun, 6 Nov 2005 23:07:38 +0100 Subject: [PATCH] i2c: ds1337 BCD conversion fix Fix BCD value errors when month=9, moving the increment inside the BIN2BCD macro. Fix similar code for the weekday value, just for consistency. This bug was reported by Michael Burian . Signed-off-by: James Chapman Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- drivers/i2c/chips/ds1337.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/chips/ds1337.c b/drivers/i2c/chips/ds1337.c index 01b037007410..02682fb794c8 100644 --- a/drivers/i2c/chips/ds1337.c +++ b/drivers/i2c/chips/ds1337.c @@ -164,9 +164,9 @@ static int ds1337_set_datetime(struct i2c_client *client, struct rtc_time *dt) buf[1] = BIN2BCD(dt->tm_sec); buf[2] = BIN2BCD(dt->tm_min); buf[3] = BIN2BCD(dt->tm_hour); - buf[4] = BIN2BCD(dt->tm_wday) + 1; + buf[4] = BIN2BCD(dt->tm_wday + 1); buf[5] = BIN2BCD(dt->tm_mday); - buf[6] = BIN2BCD(dt->tm_mon) + 1; + buf[6] = BIN2BCD(dt->tm_mon + 1); val = dt->tm_year; if (val >= 100) { val -= 100; -- cgit v1.2.2 From 4a1c4447e523003019a2bf9b972ed6fe411e84d2 Mon Sep 17 00:00:00 2001 From: Yuan Mu Date: Mon, 7 Nov 2005 22:19:04 +0100 Subject: [PATCH] hwmon: Fix two w83627hf bugs * Fix in4 reads for W83627THF and W83637HF chips. * Use the correct register for alarm flags. Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- drivers/hwmon/w83627hf.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/hwmon/w83627hf.c b/drivers/hwmon/w83627hf.c index 70ef926c3bd8..4e9a04e1f08e 100644 --- a/drivers/hwmon/w83627hf.c +++ b/drivers/hwmon/w83627hf.c @@ -180,11 +180,10 @@ superio_exit(void) #define W83781D_REG_BANK 0x4E #define W83781D_REG_CONFIG 0x40 -#define W83781D_REG_ALARM1 0x41 -#define W83781D_REG_ALARM2 0x42 -#define W83781D_REG_ALARM3 0x450 +#define W83781D_REG_ALARM1 0x459 +#define W83781D_REG_ALARM2 0x45A +#define W83781D_REG_ALARM3 0x45B -#define W83781D_REG_IRQ 0x4C #define W83781D_REG_BEEP_CONFIG 0x4D #define W83781D_REG_BEEP_INTS1 0x56 #define W83781D_REG_BEEP_INTS2 0x57 @@ -1370,13 +1369,6 @@ static void w83627hf_init_client(struct i2c_client *client) W83781D_REG_TEMP3_CONFIG, tmp & 0xfe); } } - - /* enable comparator mode for temp2 and temp3 so - alarm indication will work correctly */ - i = w83627hf_read_value(client, W83781D_REG_IRQ); - if (!(i & 0x40)) - w83627hf_write_value(client, W83781D_REG_IRQ, - i | 0x40); } /* Start monitoring */ @@ -1400,7 +1392,7 @@ static struct w83627hf_data *w83627hf_update_device(struct device *dev) /* skip missing sensors */ if (((data->type == w83697hf) && (i == 1)) || ((data->type == w83627thf || data->type == w83637hf) - && (i == 4 || i == 5))) + && (i == 5 || i == 6))) continue; data->in[i] = w83627hf_read_value(client, W83781D_REG_IN(i)); -- cgit v1.2.2 From 8750197f0e8f5467297d72e11444cf32f29d790f Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 31 Oct 2005 18:51:21 +0100 Subject: [PATCH] i2c-viapro: Some adjustments The big i2c-viapro SMBus driver update which went into 2.6.14-git1 introduced a few minor issues. Nothing critical, but I would like a few adjustments to be merged in to fix the following problems: * VIA should not be spelled Via. * Frodo Looijaard and Philip Edelbrock did not write the i2c-viapro driver. * When debugging is disabled, half of messages would be logged. * Drop an unneeded masking. * Some port reads can be avoided now that the transaction size is passed as a parameter to vt596_transaction(). * SMBus Receive Byte transactions are used for probing too (for EEPROMs), so hide errors on these too. Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- Documentation/i2c/busses/i2c-viapro | 6 ++---- drivers/i2c/busses/i2c-viapro.c | 27 ++++++++++++++------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/Documentation/i2c/busses/i2c-viapro b/Documentation/i2c/busses/i2c-viapro index 9363b8bd6109..16775663b9f5 100644 --- a/Documentation/i2c/busses/i2c-viapro +++ b/Documentation/i2c/busses/i2c-viapro @@ -7,12 +7,10 @@ Supported adapters: * VIA Technologies, Inc. VT82C686A/B Datasheet: Sometimes available at the VIA website - * VIA Technologies, Inc. VT8231, VT8233, VT8233A, VT8235, VT8237 - Datasheet: available on request from Via + * VIA Technologies, Inc. VT8231, VT8233, VT8233A, VT8235, VT8237R + Datasheet: available on request from VIA Authors: - Frodo Looijaard , - Philip Edelbrock , Kyösti Mälkki , Mark D. Studebaker , Jean Delvare diff --git a/drivers/i2c/busses/i2c-viapro.c b/drivers/i2c/busses/i2c-viapro.c index c9366b504833..a2237d4b2cf2 100644 --- a/drivers/i2c/busses/i2c-viapro.c +++ b/drivers/i2c/busses/i2c-viapro.c @@ -142,19 +142,18 @@ static int vt596_transaction(u8 size) /* Make sure the SMBus host is ready to start transmitting */ if ((temp = inb_p(SMBHSTSTS)) & 0x1F) { dev_dbg(&vt596_adapter.dev, "SMBus busy (0x%02x). " - "Resetting... ", temp); + "Resetting...\n", temp); outb_p(temp, SMBHSTSTS); if ((temp = inb_p(SMBHSTSTS)) & 0x1F) { - printk("Failed! (0x%02x)\n", temp); + dev_err(&vt596_adapter.dev, "SMBus reset failed! " + "(0x%02x)\n", temp); return -1; - } else { - printk("Successful!\n"); } } /* Start the transaction by setting bit 6 */ - outb_p(0x40 | (size & 0x3C), SMBHSTCNT); + outb_p(0x40 | size, SMBHSTCNT); /* We will always wait for a fraction of a second */ do { @@ -171,7 +170,7 @@ static int vt596_transaction(u8 size) if (temp & 0x10) { result = -1; dev_err(&vt596_adapter.dev, "Transaction failed (0x%02x)\n", - inb_p(SMBHSTCNT) & 0x3C); + size); } if (temp & 0x08) { @@ -180,11 +179,13 @@ static int vt596_transaction(u8 size) } if (temp & 0x04) { + int read = inb_p(SMBHSTADD) & 0x01; result = -1; - /* Quick commands are used to probe for chips, so - errors are expected, and we don't want to frighten the - user. */ - if ((inb_p(SMBHSTCNT) & 0x3C) != VT596_QUICK) + /* The quick and receive byte commands are used to probe + for chips, so errors are expected, and we don't want + to frighten the user. */ + if (!((size == VT596_QUICK && !read) || + (size == VT596_BYTE && read))) dev_err(&vt596_adapter.dev, "Transaction error!\n"); } @@ -462,9 +463,9 @@ static void __exit i2c_vt596_exit(void) } } -MODULE_AUTHOR( - "Frodo Looijaard and " - "Philip Edelbrock "); +MODULE_AUTHOR("Kyosti Malkki , " + "Mark D. Studebaker and " + "Jean Delvare "); MODULE_DESCRIPTION("vt82c596 SMBus driver"); MODULE_LICENSE("GPL"); -- cgit v1.2.2 From dbebb4cbe02dc811e21bd3bc40a252490e46b949 Mon Sep 17 00:00:00 2001 From: Russell King Date: Tue, 8 Nov 2005 10:40:10 +0000 Subject: [ARM SMP] Add missing SMP timer handling for realview Until we have local timer support, we need to broadcast the timer interrupt to the other CPUs. Also, add the missing smp_send_timer() prototype to asm/smp.h Signed-off-by: Russell King --- arch/arm/mach-realview/core.c | 5 +++++ include/asm-arm/smp.h | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c index 482eb512ebe8..4ea60d8b6e36 100644 --- a/arch/arm/mach-realview/core.c +++ b/arch/arm/mach-realview/core.c @@ -550,6 +550,11 @@ static irqreturn_t realview_timer_interrupt(int irq, void *dev_id, struct pt_reg timer_tick(regs); +#ifdef CONFIG_SMP + smp_send_timer(); + update_process_times(user_mode(regs)); +#endif + write_sequnlock(&xtime_lock); return IRQ_HANDLED; diff --git a/include/asm-arm/smp.h b/include/asm-arm/smp.h index 551cd3c3093c..21d1723c03e1 100644 --- a/include/asm-arm/smp.h +++ b/include/asm-arm/smp.h @@ -46,6 +46,11 @@ extern void smp_store_cpu_info(unsigned int cpuid); */ extern void smp_cross_call(cpumask_t callmap); +/* + * Broadcast a timer interrupt to the other CPUs. + */ +extern void smp_send_timer(void); + /* * Boot a secondary CPU, and assign it the specified idle task. * This also gives us the initial stack to use for this CPU. -- cgit v1.2.2 From 5d43045bcd296f9f269ab266bf26cd667d8d560c Mon Sep 17 00:00:00 2001 From: Russell King Date: Tue, 8 Nov 2005 10:44:46 +0000 Subject: [ARM SMP] Fix some sparse warnings in SMP code Signed-off-by: Russell King --- arch/arm/kernel/smp.c | 6 +++--- arch/arm/mach-realview/platsmp.c | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index edb5a406922f..f65750a3d28b 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c @@ -142,7 +142,7 @@ int __cpuinit __cpu_up(unsigned int cpu) ret = -EIO; } - secondary_data.stack = 0; + secondary_data.stack = NULL; secondary_data.pgdir = 0; *pmd_offset(pgd, PHYS_OFFSET) = __pmd(0); @@ -359,8 +359,8 @@ static void send_ipi_message(cpumask_t callmap, enum ipi_msg_type msg) * You must not call this function with disabled interrupts, from a * hardware interrupt handler, nor from a bottom half handler. */ -int smp_call_function_on_cpu(void (*func)(void *info), void *info, int retry, - int wait, cpumask_t callmap) +static int smp_call_function_on_cpu(void (*func)(void *info), void *info, + int retry, int wait, cpumask_t callmap) { struct smp_call_struct data; unsigned long timeout; diff --git a/arch/arm/mach-realview/platsmp.c b/arch/arm/mach-realview/platsmp.c index 9844644d0fb5..09b35f62247a 100644 --- a/arch/arm/mach-realview/platsmp.c +++ b/arch/arm/mach-realview/platsmp.c @@ -32,7 +32,7 @@ static unsigned int __init get_core_count(void) { unsigned int ncores; - ncores = __raw_readl(IO_ADDRESS(REALVIEW_MPCORE_SCU_BASE) + SCU_CONFIG); + ncores = __raw_readl(__io_address(REALVIEW_MPCORE_SCU_BASE) + SCU_CONFIG); return (ncores & 0x03) + 1; } @@ -133,12 +133,12 @@ static void __init poke_milo(void) #if 1 #define REALVIEW_SYS_FLAGSS_OFFSET 0x30 __raw_writel(virt_to_phys(realview_secondary_startup), - (IO_ADDRESS(REALVIEW_SYS_BASE) + - REALVIEW_SYS_FLAGSS_OFFSET)); + __io_address(REALVIEW_SYS_BASE) + + REALVIEW_SYS_FLAGSS_OFFSET); #define REALVIEW_SYS_FLAGSC_OFFSET 0x34 __raw_writel(3, - (IO_ADDRESS(REALVIEW_SYS_BASE) + - REALVIEW_SYS_FLAGSC_OFFSET)); + __io_address(REALVIEW_SYS_BASE) + + REALVIEW_SYS_FLAGSC_OFFSET); #endif mb(); -- cgit v1.2.2 From 2c250134952aac06edbdce5e61f0bd8737dcf3ad Mon Sep 17 00:00:00 2001 From: Russell King Date: Tue, 8 Nov 2005 14:44:15 +0000 Subject: [ARM] More sparse fixes arch/arm/kernel/irq.c:998:26: warning: Using plain integer as NULL pointer arch/arm/kernel/smp.c:145:25: warning: Using plain integer as NULL pointer arch/arm/kernel/smp.c:362:5: warning: symbol 'smp_call_function_on_cpu' was not declared. Should it be static? drivers/video/amba-clcd.c:521:12: warning: symbol 'amba_clcdfb_init' was not declared. Should it be static? Signed-off-by: Russell King --- arch/arm/kernel/irq.c | 2 +- arch/arm/kernel/smp.c | 2 +- drivers/video/amba-clcd.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c index 9def4404e1f2..6f86d0af7c56 100644 --- a/arch/arm/kernel/irq.c +++ b/arch/arm/kernel/irq.c @@ -995,7 +995,7 @@ void __init init_irq_proc(void) struct proc_dir_entry *dir; int irq; - dir = proc_mkdir("irq", 0); + dir = proc_mkdir("irq", NULL); if (!dir) return; diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index f65750a3d28b..f5fc57e0fe41 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c @@ -515,7 +515,7 @@ static void ipi_cpu_stop(unsigned int cpu) * * Bit 0 - Inter-processor function call */ -void do_IPI(struct pt_regs *regs) +asmlinkage void do_IPI(struct pt_regs *regs) { unsigned int cpu = smp_processor_id(); struct ipi_data *ipi = &per_cpu(ipi_data, cpu); diff --git a/drivers/video/amba-clcd.c b/drivers/video/amba-clcd.c index 467a1d7ebbde..a3c2c45e29e0 100644 --- a/drivers/video/amba-clcd.c +++ b/drivers/video/amba-clcd.c @@ -518,7 +518,7 @@ static struct amba_driver clcd_driver = { .id_table = clcdfb_id_table, }; -int __init amba_clcdfb_init(void) +static int __init amba_clcdfb_init(void) { if (fb_get_options("ambafb", NULL)) return -ENODEV; -- cgit v1.2.2 From 3b6353fae0d7ba772d7eb2651727332c9e9c74ac Mon Sep 17 00:00:00 2001 From: Russell King Date: Tue, 8 Nov 2005 15:35:23 +0000 Subject: [ARM] Declare asm entry points in asm/smp.h Signed-off-by: Russell King --- include/asm-arm/smp.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/asm-arm/smp.h b/include/asm-arm/smp.h index 21d1723c03e1..52e7c8d830b2 100644 --- a/include/asm-arm/smp.h +++ b/include/asm-arm/smp.h @@ -36,6 +36,11 @@ struct seq_file; */ extern void show_ipi_list(struct seq_file *p); +/* + * Called from assembly code, this handles an IPI. + */ +asmlinkage void do_IPI(struct pt_regs *regs); + /* * Move global data into per-processor storage. */ @@ -57,6 +62,12 @@ extern void smp_send_timer(void); */ extern int boot_secondary(unsigned int cpu, struct task_struct *); +/* + * Called from platform specific assembly code, this is the + * secondary CPU entry point. + */ +asmlinkage void secondary_start_kernel(void); + /* * Perform platform specific initialisation of the specified CPU. */ -- cgit v1.2.2 From 971f359ddcb2e7a0d577479c7561bda407febe1b Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Tue, 8 Nov 2005 09:37:56 -0800 Subject: [IPV6]: Put addr_diff() into common header for future use. Signed-off-by: YOSHIFUJI Hideaki Signed-off-by: David S. Miller --- include/net/ipv6.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ net/ipv6/ip6_fib.c | 54 ++---------------------------------------------------- 2 files changed, 50 insertions(+), 52 deletions(-) diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 65ec86678a08..98661fa4fc78 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h @@ -340,6 +340,54 @@ static inline int ipv6_addr_any(const struct in6_addr *a) a->s6_addr32[2] | a->s6_addr32[3] ) == 0); } +/* + * find the first different bit between two addresses + * length of address must be a multiple of 32bits + */ +static inline int __ipv6_addr_diff(const void *token1, const void *token2, int addrlen) +{ + const __u32 *a1 = token1, *a2 = token2; + int i; + + addrlen >>= 2; + + for (i = 0; i < addrlen; i++) { + __u32 xb = a1[i] ^ a2[i]; + if (xb) { + int j = 31; + + xb = ntohl(xb); + while ((xb & (1 << j)) == 0) + j--; + + return (i * 32 + 31 - j); + } + } + + /* + * we should *never* get to this point since that + * would mean the addrs are equal + * + * However, we do get to it 8) And exacly, when + * addresses are equal 8) + * + * ip route add 1111::/128 via ... + * ip route add 1111::/64 via ... + * and we are here. + * + * Ideally, this function should stop comparison + * at prefix length. It does not, but it is still OK, + * if returned value is greater than prefix length. + * --ANK (980803) + */ + return (addrlen << 5); +} + +static inline int ipv6_addr_diff(const struct in6_addr *a1, const struct in6_addr *a2) +{ + return __ipv6_addr_diff(a1, a2, sizeof(struct in6_addr)); +} + /* * Prototypes exported by ipv6 */ diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index 4fcc5a7acf6e..1bf6d9a769e6 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c @@ -127,56 +127,6 @@ static __inline__ int addr_bit_set(void *token, int fn_bit) return htonl(1 << ((~fn_bit)&0x1F)) & addr[fn_bit>>5]; } -/* - * find the first different bit between two addresses - * length of address must be a multiple of 32bits - */ - -static __inline__ int addr_diff(void *token1, void *token2, int addrlen) -{ - __u32 *a1 = token1; - __u32 *a2 = token2; - int i; - - addrlen >>= 2; - - for (i = 0; i < addrlen; i++) { - __u32 xb; - - xb = a1[i] ^ a2[i]; - - if (xb) { - int j = 31; - - xb = ntohl(xb); - - while ((xb & (1 << j)) == 0) - j--; - - return (i * 32 + 31 - j); - } - } - - /* - * we should *never* get to this point since that - * would mean the addrs are equal - * - * However, we do get to it 8) And exacly, when - * addresses are equal 8) - * - * ip route add 1111::/128 via ... - * ip route add 1111::/64 via ... - * and we are here. - * - * Ideally, this function should stop comparison - * at prefix length. It does not, but it is still OK, - * if returned value is greater than prefix length. - * --ANK (980803) - */ - - return addrlen<<5; -} - static __inline__ struct fib6_node * node_alloc(void) { struct fib6_node *fn; @@ -296,11 +246,11 @@ insert_above: /* find 1st bit in difference between the 2 addrs. - See comment in addr_diff: bit may be an invalid value, + See comment in __ipv6_addr_diff: bit may be an invalid value, but if it is >= plen, the value is ignored in any case. */ - bit = addr_diff(addr, &key->addr, addrlen); + bit = __ipv6_addr_diff(addr, &key->addr, addrlen); /* * (intermediate)[in] -- cgit v1.2.2 From b1cacb6820e0afc4aeeea67bcb5296a316862cad Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Tue, 8 Nov 2005 09:38:12 -0800 Subject: [IPV6]: Make ipv6_addr_type() more generic so that we can use it for source address selection. Signed-off-by: YOSHIFUJI Hideaki Signed-off-by: David S. Miller --- include/net/ipv6.h | 19 +++++++++-- net/ipv6/addrconf.c | 90 +++++++++++++++++++++++++++------------------------- net/ipv6/ipv6_syms.c | 2 +- 3 files changed, 64 insertions(+), 47 deletions(-) diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 98661fa4fc78..6addb4d464d6 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h @@ -252,12 +252,25 @@ typedef int (*inet_getfrag_t) (const void *data, char *, unsigned int, unsigned int); - -extern int ipv6_addr_type(const struct in6_addr *addr); +extern int __ipv6_addr_type(const struct in6_addr *addr); +static inline int ipv6_addr_type(const struct in6_addr *addr) +{ + return __ipv6_addr_type(addr) & 0xffff; +} static inline int ipv6_addr_scope(const struct in6_addr *addr) { - return ipv6_addr_type(addr) & IPV6_ADDR_SCOPE_MASK; + return __ipv6_addr_type(addr) & IPV6_ADDR_SCOPE_MASK; +} + +static inline int __ipv6_addr_src_scope(int type) +{ + return (type == IPV6_ADDR_ANY ? __IPV6_ADDR_SCOPE_INVALID : (type >> 16)); +} + +static inline int ipv6_addr_src_scope(const struct in6_addr *addr) +{ + return __ipv6_addr_src_scope(__ipv6_addr_type(addr)); } static inline int ipv6_addr_cmp(const struct in6_addr *a1, const struct in6_addr *a2) diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 2c5f57299d63..ff895da6395b 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -35,6 +35,9 @@ * YOSHIFUJI Hideaki @USAGI : ARCnet support * YOSHIFUJI Hideaki @USAGI : convert /proc/net/if_inet6 to * seq_file. + * YOSHIFUJI Hideaki @USAGI : improved source address + * selection; consider scope, + * status etc. */ #include @@ -193,46 +196,51 @@ const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT; #endif const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT; -int ipv6_addr_type(const struct in6_addr *addr) +#define IPV6_ADDR_SCOPE_TYPE(scope) ((scope) << 16) + +static inline unsigned ipv6_addr_scope2type(unsigned scope) +{ + switch(scope) { + case IPV6_ADDR_SCOPE_NODELOCAL: + return (IPV6_ADDR_SCOPE_TYPE(IPV6_ADDR_SCOPE_NODELOCAL) | + IPV6_ADDR_LOOPBACK); + case IPV6_ADDR_SCOPE_LINKLOCAL: + return (IPV6_ADDR_SCOPE_TYPE(IPV6_ADDR_SCOPE_LINKLOCAL) | + IPV6_ADDR_LINKLOCAL); + case IPV6_ADDR_SCOPE_SITELOCAL: + return (IPV6_ADDR_SCOPE_TYPE(IPV6_ADDR_SCOPE_SITELOCAL) | + IPV6_ADDR_SITELOCAL); + } + return IPV6_ADDR_SCOPE_TYPE(scope); +} + +int __ipv6_addr_type(const struct in6_addr *addr) { - int type; u32 st; st = addr->s6_addr32[0]; - if ((st & htonl(0xFF000000)) == htonl(0xFF000000)) { - type = IPV6_ADDR_MULTICAST; - - switch((st & htonl(0x00FF0000))) { - case __constant_htonl(0x00010000): - type |= IPV6_ADDR_LOOPBACK; - break; - - case __constant_htonl(0x00020000): - type |= IPV6_ADDR_LINKLOCAL; - break; - - case __constant_htonl(0x00050000): - type |= IPV6_ADDR_SITELOCAL; - break; - }; - return type; - } - - type = IPV6_ADDR_UNICAST; - /* Consider all addresses with the first three bits different of - 000 and 111 as finished. + 000 and 111 as unicasts. */ if ((st & htonl(0xE0000000)) != htonl(0x00000000) && (st & htonl(0xE0000000)) != htonl(0xE0000000)) - return type; - - if ((st & htonl(0xFFC00000)) == htonl(0xFE800000)) - return (IPV6_ADDR_LINKLOCAL | type); + return (IPV6_ADDR_UNICAST | + IPV6_ADDR_SCOPE_TYPE(IPV6_ADDR_SCOPE_GLOBAL)); + if ((st & htonl(0xFF000000)) == htonl(0xFF000000)) { + /* multicast */ + /* addr-select 3.1 */ + return (IPV6_ADDR_MULTICAST | + ipv6_addr_scope2type(IPV6_ADDR_MC_SCOPE(addr))); + } + + if ((st & htonl(0xFFC00000)) == htonl(0xFE800000)) + return (IPV6_ADDR_LINKLOCAL | IPV6_ADDR_UNICAST | + IPV6_ADDR_SCOPE_TYPE(IPV6_ADDR_SCOPE_LINKLOCAL)); /* addr-select 3.1 */ if ((st & htonl(0xFFC00000)) == htonl(0xFEC00000)) - return (IPV6_ADDR_SITELOCAL | type); + return (IPV6_ADDR_SITELOCAL | IPV6_ADDR_UNICAST | + IPV6_ADDR_SCOPE_TYPE(IPV6_ADDR_SCOPE_SITELOCAL)); /* addr-select 3.1 */ if ((addr->s6_addr32[0] | addr->s6_addr32[1]) == 0) { if (addr->s6_addr32[2] == 0) { @@ -240,24 +248,20 @@ int ipv6_addr_type(const struct in6_addr *addr) return IPV6_ADDR_ANY; if (addr->s6_addr32[3] == htonl(0x00000001)) - return (IPV6_ADDR_LOOPBACK | type); + return (IPV6_ADDR_LOOPBACK | IPV6_ADDR_UNICAST | + IPV6_ADDR_SCOPE_TYPE(IPV6_ADDR_SCOPE_LINKLOCAL)); /* addr-select 3.4 */ - return (IPV6_ADDR_COMPATv4 | type); + return (IPV6_ADDR_COMPATv4 | IPV6_ADDR_UNICAST | + IPV6_ADDR_SCOPE_TYPE(IPV6_ADDR_SCOPE_GLOBAL)); /* addr-select 3.3 */ } if (addr->s6_addr32[2] == htonl(0x0000ffff)) - return IPV6_ADDR_MAPPED; - } - - st &= htonl(0xFF000000); - if (st == 0) - return IPV6_ADDR_RESERVED; - st &= htonl(0xFE000000); - if (st == htonl(0x02000000)) - return IPV6_ADDR_RESERVED; /* for NSAP */ - if (st == htonl(0x04000000)) - return IPV6_ADDR_RESERVED; /* for IPX */ - return type; + return (IPV6_ADDR_MAPPED | + IPV6_ADDR_SCOPE_TYPE(IPV6_ADDR_SCOPE_GLOBAL)); /* addr-select 3.3 */ + } + + return (IPV6_ADDR_RESERVED | + IPV6_ADDR_SCOPE_TYPE(IPV6_ADDR_SCOPE_GLOBAL)); /* addr-select 3.4 */ } static void addrconf_del_timer(struct inet6_ifaddr *ifp) diff --git a/net/ipv6/ipv6_syms.c b/net/ipv6/ipv6_syms.c index 37a4a99c9fe9..16482785bdfd 100644 --- a/net/ipv6/ipv6_syms.c +++ b/net/ipv6/ipv6_syms.c @@ -7,7 +7,7 @@ #include #include -EXPORT_SYMBOL(ipv6_addr_type); +EXPORT_SYMBOL(__ipv6_addr_type); EXPORT_SYMBOL(icmpv6_send); EXPORT_SYMBOL(icmpv6_statistics); EXPORT_SYMBOL(icmpv6_err_convert); -- cgit v1.2.2 From 072047e4de3800905e09d0f8ef0e1cc4e91a601e Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Tue, 8 Nov 2005 09:38:30 -0800 Subject: [IPV6]: RFC3484 compliant source address selection Choose more appropriate source address; e.g. - outgoing interface - non-deprecated - scope - matching label Signed-off-by: YOSHIFUJI Hideaki Signed-off-by: David S. Miller --- net/ipv6/addrconf.c | 344 ++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 240 insertions(+), 104 deletions(-) diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index ff895da6395b..a34d1504deb9 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -809,138 +809,274 @@ out: #endif /* - * Choose an appropriate source address - * should do: - * i) get an address with an appropriate scope - * ii) see if there is a specific route for the destination and use - * an address of the attached interface - * iii) don't use deprecated addresses + * Choose an appropriate source address (RFC3484) */ -static int inline ipv6_saddr_pref(const struct inet6_ifaddr *ifp, u8 invpref) +struct ipv6_saddr_score { + int addr_type; + unsigned int attrs; + int matchlen; + unsigned int scope; + unsigned int rule; +}; + +#define IPV6_SADDR_SCORE_LOCAL 0x0001 +#define IPV6_SADDR_SCORE_PREFERRED 0x0004 +#define IPV6_SADDR_SCORE_HOA 0x0008 +#define IPV6_SADDR_SCORE_OIF 0x0010 +#define IPV6_SADDR_SCORE_LABEL 0x0020 +#define IPV6_SADDR_SCORE_PRIVACY 0x0040 + +static int inline ipv6_saddr_preferred(int type) { - int pref; - pref = ifp->flags&IFA_F_DEPRECATED ? 0 : 2; -#ifdef CONFIG_IPV6_PRIVACY - pref |= (ifp->flags^invpref)&IFA_F_TEMPORARY ? 0 : 1; -#endif - return pref; + if (type & (IPV6_ADDR_MAPPED|IPV6_ADDR_COMPATv4| + IPV6_ADDR_LOOPBACK|IPV6_ADDR_RESERVED)) + return 1; + return 0; } -#ifdef CONFIG_IPV6_PRIVACY -#define IPV6_GET_SADDR_MAXSCORE(score) ((score) == 3) -#else -#define IPV6_GET_SADDR_MAXSCORE(score) (score) -#endif +/* static matching label */ +static int inline ipv6_saddr_label(const struct in6_addr *addr, int type) +{ + /* + * prefix (longest match) label + * ----------------------------- + * ::1/128 0 + * ::/0 1 + * 2002::/16 2 + * ::/96 3 + * ::ffff:0:0/96 4 + */ + if (type & IPV6_ADDR_LOOPBACK) + return 0; + else if (type & IPV6_ADDR_COMPATv4) + return 3; + else if (type & IPV6_ADDR_MAPPED) + return 4; + else if (addr->s6_addr16[0] == htons(0x2002)) + return 2; + return 1; +} -int ipv6_dev_get_saddr(struct net_device *dev, +int ipv6_dev_get_saddr(struct net_device *daddr_dev, struct in6_addr *daddr, struct in6_addr *saddr) { - struct inet6_ifaddr *ifp = NULL; - struct inet6_ifaddr *match = NULL; - struct inet6_dev *idev; - int scope; - int err; - int hiscore = -1, score; + struct ipv6_saddr_score hiscore; + struct inet6_ifaddr *ifa_result = NULL; + int daddr_type = __ipv6_addr_type(daddr); + int daddr_scope = __ipv6_addr_src_scope(daddr_type); + u32 daddr_label = ipv6_saddr_label(daddr, daddr_type); + struct net_device *dev; - scope = ipv6_addr_scope(daddr); + memset(&hiscore, 0, sizeof(hiscore)); - /* - * known dev - * search dev and walk through dev addresses - */ + read_lock(&dev_base_lock); + read_lock(&addrconf_lock); - if (dev) { - if (dev->flags & IFF_LOOPBACK) - scope = IFA_HOST; + for (dev = dev_base; dev; dev=dev->next) { + struct inet6_dev *idev; + struct inet6_ifaddr *ifa; + + /* Rule 0: Candidate Source Address (section 4) + * - multicast and link-local destination address, + * the set of candidate source address MUST only + * include addresses assigned to interfaces + * belonging to the same link as the outgoing + * interface. + * (- For site-local destination addresses, the + * set of candidate source addresses MUST only + * include addresses assigned to interfaces + * belonging to the same site as the outgoing + * interface.) + */ + if ((daddr_type & IPV6_ADDR_MULTICAST || + daddr_scope <= IPV6_ADDR_SCOPE_LINKLOCAL) && + daddr_dev && dev != daddr_dev) + continue; - read_lock(&addrconf_lock); idev = __in6_dev_get(dev); - if (idev) { - read_lock_bh(&idev->lock); - for (ifp=idev->addr_list; ifp; ifp=ifp->if_next) { - if (ifp->scope == scope) { - if (ifp->flags&IFA_F_TENTATIVE) - continue; -#ifdef CONFIG_IPV6_PRIVACY - score = ipv6_saddr_pref(ifp, idev->cnf.use_tempaddr > 1 ? IFA_F_TEMPORARY : 0); -#else - score = ipv6_saddr_pref(ifp, 0); -#endif - if (score <= hiscore) - continue; + if (!idev) + continue; - if (match) - in6_ifa_put(match); - match = ifp; - hiscore = score; - in6_ifa_hold(ifp); + read_lock_bh(&idev->lock); + for (ifa = idev->addr_list; ifa; ifa = ifa->if_next) { + struct ipv6_saddr_score score; - if (IPV6_GET_SADDR_MAXSCORE(score)) { - read_unlock_bh(&idev->lock); - read_unlock(&addrconf_lock); - goto out; - } + score.addr_type = __ipv6_addr_type(&ifa->addr); + + /* Rule 0: Candidate Source Address (section 4) + * - In any case, anycast addresses, multicast + * addresses, and the unspecified address MUST + * NOT be included in a candidate set. + */ + if (unlikely(score.addr_type == IPV6_ADDR_ANY || + score.addr_type & IPV6_ADDR_MULTICAST)) { + LIMIT_NETDEBUG(KERN_DEBUG + "ADDRCONF: unspecified / multicast address" + "assigned as unicast address on %s", + dev->name); + continue; + } + + score.attrs = 0; + score.matchlen = 0; + score.scope = 0; + score.rule = 0; + + if (ifa_result == NULL) { + /* record it if the first available entry */ + goto record_it; + } + + /* Rule 1: Prefer same address */ + if (hiscore.rule < 1) { + if (ipv6_addr_equal(&ifa_result->addr, daddr)) + hiscore.attrs |= IPV6_SADDR_SCORE_LOCAL; + hiscore.rule++; + } + if (ipv6_addr_equal(&ifa->addr, daddr)) { + score.attrs |= IPV6_SADDR_SCORE_LOCAL; + if (!(hiscore.attrs & IPV6_SADDR_SCORE_LOCAL)) { + score.rule = 1; + goto record_it; } + } else { + if (hiscore.attrs & IPV6_SADDR_SCORE_LOCAL) + continue; } - read_unlock_bh(&idev->lock); - } - read_unlock(&addrconf_lock); - } - if (scope == IFA_LINK) - goto out; + /* Rule 2: Prefer appropriate scope */ + if (hiscore.rule < 2) { + hiscore.scope = __ipv6_addr_src_scope(hiscore.addr_type); + hiscore.rule++; + } + score.scope = __ipv6_addr_src_scope(score.addr_type); + if (hiscore.scope < score.scope) { + if (hiscore.scope < daddr_scope) { + score.rule = 2; + goto record_it; + } else + continue; + } else if (score.scope < hiscore.scope) { + if (score.scope < daddr_scope) + continue; + else { + score.rule = 2; + goto record_it; + } + } - /* - * dev == NULL or search failed for specified dev - */ + /* Rule 3: Avoid deprecated address */ + if (hiscore.rule < 3) { + if (ipv6_saddr_preferred(hiscore.addr_type) || + !(ifa_result->flags & IFA_F_DEPRECATED)) + hiscore.attrs |= IPV6_SADDR_SCORE_PREFERRED; + hiscore.rule++; + } + if (ipv6_saddr_preferred(score.addr_type) || + !(ifa->flags & IFA_F_DEPRECATED)) { + score.attrs |= IPV6_SADDR_SCORE_PREFERRED; + if (!(hiscore.attrs & IPV6_SADDR_SCORE_PREFERRED)) { + score.rule = 3; + goto record_it; + } + } else { + if (hiscore.attrs & IPV6_SADDR_SCORE_PREFERRED) + continue; + } - read_lock(&dev_base_lock); - read_lock(&addrconf_lock); - for (dev = dev_base; dev; dev=dev->next) { - idev = __in6_dev_get(dev); - if (idev) { - read_lock_bh(&idev->lock); - for (ifp=idev->addr_list; ifp; ifp=ifp->if_next) { - if (ifp->scope == scope) { - if (ifp->flags&IFA_F_TENTATIVE) - continue; -#ifdef CONFIG_IPV6_PRIVACY - score = ipv6_saddr_pref(ifp, idev->cnf.use_tempaddr > 1 ? IFA_F_TEMPORARY : 0); -#else - score = ipv6_saddr_pref(ifp, 0); -#endif - if (score <= hiscore) - continue; + /* Rule 4: Prefer home address -- not implemented yet */ - if (match) - in6_ifa_put(match); - match = ifp; - hiscore = score; - in6_ifa_hold(ifp); + /* Rule 5: Prefer outgoing interface */ + if (hiscore.rule < 5) { + if (daddr_dev == NULL || + daddr_dev == ifa_result->idev->dev) + hiscore.attrs |= IPV6_SADDR_SCORE_OIF; + hiscore.rule++; + } + if (daddr_dev == NULL || + daddr_dev == ifa->idev->dev) { + score.attrs |= IPV6_SADDR_SCORE_OIF; + if (!(hiscore.attrs & IPV6_SADDR_SCORE_OIF)) { + score.rule = 5; + goto record_it; + } + } else { + if (hiscore.attrs & IPV6_SADDR_SCORE_OIF) + continue; + } - if (IPV6_GET_SADDR_MAXSCORE(score)) { - read_unlock_bh(&idev->lock); - goto out_unlock_base; - } + /* Rule 6: Prefer matching label */ + if (hiscore.rule < 6) { + if (ipv6_saddr_label(&ifa_result->addr, hiscore.addr_type) == daddr_label) + hiscore.attrs |= IPV6_SADDR_SCORE_LABEL; + hiscore.rule++; + } + if (ipv6_saddr_label(&ifa->addr, score.addr_type) == daddr_label) { + score.attrs |= IPV6_SADDR_SCORE_LABEL; + if (!(hiscore.attrs & IPV6_SADDR_SCORE_LABEL)) { + score.rule = 6; + goto record_it; } + } else { + if (hiscore.attrs & IPV6_SADDR_SCORE_LABEL) + continue; } - read_unlock_bh(&idev->lock); + + /* Rule 7: Prefer public address + * Note: prefer temprary address if use_tempaddr >= 2 + */ + if (hiscore.rule < 7) { + if ((!(ifa_result->flags & IFA_F_TEMPORARY)) ^ + (ifa_result->idev->cnf.use_tempaddr >= 2)) + hiscore.attrs |= IPV6_SADDR_SCORE_PRIVACY; + hiscore.rule++; + } + if ((!(ifa->flags & IFA_F_TEMPORARY)) ^ + (ifa->idev->cnf.use_tempaddr >= 2)) { + score.attrs |= IPV6_SADDR_SCORE_PRIVACY; + if (!(hiscore.attrs & IPV6_SADDR_SCORE_PRIVACY)) { + score.rule = 7; + goto record_it; + } + } else { + if (hiscore.attrs & IPV6_SADDR_SCORE_PRIVACY) + continue; + } + + /* Rule 8: Use longest matching prefix */ + if (hiscore.rule < 8) + hiscore.matchlen = ipv6_addr_diff(&ifa_result->addr, daddr); + score.rule++; + score.matchlen = ipv6_addr_diff(&ifa->addr, daddr); + if (score.matchlen > hiscore.matchlen) { + score.rule = 8; + goto record_it; + } +#if 0 + else if (score.matchlen < hiscore.matchlen) + continue; +#endif + + /* Final Rule: choose first available one */ + continue; +record_it: + if (ifa_result) + in6_ifa_put(ifa_result); + in6_ifa_hold(ifa); + ifa_result = ifa; + hiscore = score; } + read_unlock_bh(&idev->lock); } - -out_unlock_base: read_unlock(&addrconf_lock); read_unlock(&dev_base_lock); -out: - err = -EADDRNOTAVAIL; - if (match) { - ipv6_addr_copy(saddr, &match->addr); - err = 0; - in6_ifa_put(match); - } - - return err; + if (!ifa_result) + return -EADDRNOTAVAIL; + + ipv6_addr_copy(saddr, &ifa_result->addr); + in6_ifa_put(ifa_result); + return 0; } -- cgit v1.2.2 From 18a0c23617a2cb1c2e55e650046c2084d823fde0 Mon Sep 17 00:00:00 2001 From: Carlo Comin Date: Tue, 8 Nov 2005 09:38:56 -0800 Subject: [CONNECTOR]: Fix documentation test module. Patch from Carlo Comin Signed-off-by: Evgeniy Polyakov Signed-off-by: David S. Miller --- Documentation/connector/cn_test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/connector/cn_test.c b/Documentation/connector/cn_test.c index b7de82e9c0e0..3e73231695b3 100644 --- a/Documentation/connector/cn_test.c +++ b/Documentation/connector/cn_test.c @@ -25,7 +25,7 @@ #include #include -#include "connector.h" +#include static struct cb_id cn_test_id = { 0x123, 0x456 }; static char cn_test_name[] = "cn_test"; @@ -104,7 +104,7 @@ static int cn_test_want_notify(void) req->first = cn_test_id.val + 20; req->range = 10; - NETLINK_CB(skb).dst_groups = ctl->group; + NETLINK_CB(skb).dst_group = ctl->group; //netlink_broadcast(nls, skb, 0, ctl->group, GFP_ATOMIC); netlink_unicast(nls, skb, 0, 0); -- cgit v1.2.2 From b541ca2c5a3f3f399d6f2ec9da33c1be5a8d8c19 Mon Sep 17 00:00:00 2001 From: Thomas Graf Date: Tue, 8 Nov 2005 09:39:17 -0800 Subject: [PKT_SCHED]: Correctly handle empty ematch trees Fixes an invalid memory reference when the basic classifier is used without any ematches but just actions. Signed-off-by: Thomas Graf Signed-off-by: David S. Miller --- net/sched/ematch.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/net/sched/ematch.c b/net/sched/ematch.c index ebfe2e7d21bd..64b047c65568 100644 --- a/net/sched/ematch.c +++ b/net/sched/ematch.c @@ -298,6 +298,11 @@ int tcf_em_tree_validate(struct tcf_proto *tp, struct rtattr *rta, struct tcf_ematch_tree_hdr *tree_hdr; struct tcf_ematch *em; + if (!rta) { + memset(tree, 0, sizeof(*tree)); + return 0; + } + if (rtattr_parse_nested(tb, TCA_EMATCH_TREE_MAX, rta) < 0) goto errout; -- cgit v1.2.2 From 9ee6b535af4c2c97b4e3b88f37f244bf1004ebd4 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 8 Nov 2005 09:39:42 -0800 Subject: [NET]: sk_add_backlog convert from macro to inline There is no reason for sk_add_backlog to be a macro. It can just be an inline function and get type checking. Signed-off-by: Stephen Hemminger Signed-off-by: David S. Miller --- include/net/sock.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/include/net/sock.h b/include/net/sock.h index e0498bd36004..ff13c4cc287a 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -461,16 +461,16 @@ static inline void sk_stream_free_skb(struct sock *sk, struct sk_buff *skb) } /* The per-socket spinlock must be held here. */ -#define sk_add_backlog(__sk, __skb) \ -do { if (!(__sk)->sk_backlog.tail) { \ - (__sk)->sk_backlog.head = \ - (__sk)->sk_backlog.tail = (__skb); \ - } else { \ - ((__sk)->sk_backlog.tail)->next = (__skb); \ - (__sk)->sk_backlog.tail = (__skb); \ - } \ - (__skb)->next = NULL; \ -} while(0) +static inline void sk_add_backlog(struct sock *sk, struct sk_buff *skb) +{ + if (!sk->sk_backlog.tail) { + sk->sk_backlog.head = sk->sk_backlog.tail = skb; + } else { + sk->sk_backlog.tail->next = skb; + sk->sk_backlog.tail = skb; + } + skb->next = NULL; +} #define sk_wait_event(__sk, __timeo, __condition) \ ({ int rc; \ -- cgit v1.2.2 From dc8103f25fd7cfac2c2b295f33edc10f255b4c80 Mon Sep 17 00:00:00 2001 From: Julian Anastasov Date: Tue, 8 Nov 2005 09:40:05 -0800 Subject: [IPVS]: fix connection leak if expire_nodest_conn=1 There was a fix in 2.6.13 that changed the behaviour of ip_vs_conn_expire_now function not to put reference to connection, its callers should hold write lock or connection refcnt. But we forgot to convert one caller, when the real server for connection is unavailable caller should put the connection reference. It happens only when sysctl var expire_nodest_conn is set to 1 and such connections never expire. Thanks to Roberto Nibali who found the problem and tested a 2.4.32-rc2 patch, which is equal to this 2.6 version. Patch for 2.4 is already sent to Marcelo. Signed-off-by: Julian Anastasov Signed-off-by: Roberto Nibali Signed-off-by: David S. Miller --- net/ipv4/ipvs/ip_vs_core.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/net/ipv4/ipvs/ip_vs_core.c b/net/ipv4/ipvs/ip_vs_core.c index 981cc3244ef2..1a0843cd58a9 100644 --- a/net/ipv4/ipvs/ip_vs_core.c +++ b/net/ipv4/ipvs/ip_vs_core.c @@ -1009,11 +1009,10 @@ ip_vs_in(unsigned int hooknum, struct sk_buff **pskb, if (sysctl_ip_vs_expire_nodest_conn) { /* try to expire the connection immediately */ ip_vs_conn_expire_now(cp); - } else { - /* don't restart its timer, and silently - drop the packet. */ - __ip_vs_conn_put(cp); } + /* don't restart its timer, and silently + drop the packet. */ + __ip_vs_conn_put(cp); return NF_DROP; } -- cgit v1.2.2 From 6722e78c90054101e6797d5944cdc81af9897a0a Mon Sep 17 00:00:00 2001 From: Philippe De Muyter Date: Tue, 8 Nov 2005 09:40:26 -0800 Subject: [PPP]: handle misaligned accesses From: "Philippe De Muyter" This patch avoids ppp-generated kernel crashes on machines where unaligned accesses are forbidden (ie: m68000), by fixing ppp alignment setting for reused skb's. Signed-off-by: Philippe De Muyter Cc: "David S. Miller" Cc: Paul Mackerras Signed-off-by: Andrew Morton Signed-off-by: David S. Miller --- drivers/net/ppp_async.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c index 59e8183c639e..400f652282d7 100644 --- a/drivers/net/ppp_async.c +++ b/drivers/net/ppp_async.c @@ -31,6 +31,7 @@ #include #include #include +#include #define PPP_VERSION "2.4.2" @@ -835,8 +836,11 @@ process_input_packet(struct asyncppp *ap) err: /* frame had an error, remember that, reset SC_TOSS & SC_ESCAPE */ ap->state = SC_PREV_ERROR; - if (skb) + if (skb) { + /* make skb appear as freshly allocated */ skb_trim(skb, 0); + skb_reserve(skb, - skb_headroom(skb)); + } } /* Called when the tty driver has data for us. Runs parallel with the @@ -889,10 +893,17 @@ ppp_async_input(struct asyncppp *ap, const unsigned char *buf, skb = dev_alloc_skb(ap->mru + PPP_HDRLEN + 2); if (skb == 0) goto nomem; - /* Try to get the payload 4-byte aligned */ + ap->rpkt = skb; + } + if (skb->len == 0) { + /* Try to get the payload 4-byte aligned. + * This should match the + * PPP_ALLSTATIONS/PPP_UI/compressed tests in + * process_input_packet, but we do not have + * enough chars here to test buf[1] and buf[2]. + */ if (buf[0] != PPP_ALLSTATIONS) skb_reserve(skb, 2 + (buf[0] & 1)); - ap->rpkt = skb; } if (n > skb_tailroom(skb)) { /* packet overflowed MRU */ -- cgit v1.2.2 From b3f9b92a6ec1a9a5e4b4b36e484f2f62cc73277c Mon Sep 17 00:00:00 2001 From: Matt Domsch Date: Tue, 8 Nov 2005 09:40:47 -0800 Subject: [PPP]: add PPP MPPE encryption module From: Matt Domsch The patch below implements the Microsoft Point-to-Point Encryption method as a PPP compressor/decompressor. This is necessary for Linux clients and servers to interoperate with Microsoft Point-to-Point Tunneling Protocol (PPTP) servers (either Microsoft PPTP servers or the poptop project) which use MPPE to encrypt data when creating a VPN. This patch differs from the kernel_ppp_mppe DKMS pacakge at pptpclient.sourceforge.net by utilizing the kernel crypto routines rather than providing its own SHA1 and arcfour implementations. Minor changes to ppp_generic.c try to prevent a link from disabling compression (in our case, the encryption) after it has started using compression (encryption). Feedback to please. Signed-off-by: Matt Domsch Cc: James Cameron Cc: "David S. Miller" Signed-off-by: Brice Goglin Acked-by: Paul Mackerras Signed-off-by: Andrew Morton Signed-off-by: David S. Miller --- drivers/net/Kconfig | 13 + drivers/net/Makefile | 1 + drivers/net/ppp_generic.c | 88 ++++-- drivers/net/ppp_mppe.c | 724 ++++++++++++++++++++++++++++++++++++++++++++++ drivers/net/ppp_mppe.h | 86 ++++++ include/linux/if_ppp.h | 7 +- include/linux/ppp-comp.h | 9 + 7 files changed, 902 insertions(+), 26 deletions(-) create mode 100644 drivers/net/ppp_mppe.c create mode 100644 drivers/net/ppp_mppe.h diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 1958d9e16a3a..24f1691b84f9 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -2523,6 +2523,19 @@ config PPP_BSDCOMP module; it is called bsd_comp and will show up in the directory modules once you have said "make modules". If unsure, say N. +config PPP_MPPE + tristate "PPP MPPE compression (encryption) (EXPERIMENTAL)" + depends on PPP && EXPERIMENTAL + select CRYPTO + select CRYPTO_SHA1 + select CRYPTO_ARC4 + ---help--- + Support for the MPPE Encryption protocol, as employed by the + Microsoft Point-to-Point Tunneling Protocol. + + See http://pptpclient.sourceforge.net/ for information on + configuring PPTP clients and servers to utilize this method. + config PPPOE tristate "PPP over Ethernet (EXPERIMENTAL)" depends on EXPERIMENTAL && PPP diff --git a/drivers/net/Makefile b/drivers/net/Makefile index 7c313cb341b8..4cffd34442aa 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile @@ -112,6 +112,7 @@ obj-$(CONFIG_PPP_ASYNC) += ppp_async.o obj-$(CONFIG_PPP_SYNC_TTY) += ppp_synctty.o obj-$(CONFIG_PPP_DEFLATE) += ppp_deflate.o obj-$(CONFIG_PPP_BSDCOMP) += bsd_comp.o +obj-$(CONFIG_PPP_MPPE) += ppp_mppe.o obj-$(CONFIG_PPPOE) += pppox.o pppoe.o obj-$(CONFIG_SLIP) += slip.o diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c index d3c9958b00d0..50430f79f8cf 100644 --- a/drivers/net/ppp_generic.c +++ b/drivers/net/ppp_generic.c @@ -137,13 +137,14 @@ struct ppp { /* * Bits in flags: SC_NO_TCP_CCID, SC_CCP_OPEN, SC_CCP_UP, SC_LOOP_TRAFFIC, - * SC_MULTILINK, SC_MP_SHORTSEQ, SC_MP_XSHORTSEQ, SC_COMP_TCP, SC_REJ_COMP_TCP. + * SC_MULTILINK, SC_MP_SHORTSEQ, SC_MP_XSHORTSEQ, SC_COMP_TCP, SC_REJ_COMP_TCP, + * SC_MUST_COMP * Bits in rstate: SC_DECOMP_RUN, SC_DC_ERROR, SC_DC_FERROR. * Bits in xstate: SC_COMP_RUN */ #define SC_FLAG_BITS (SC_NO_TCP_CCID|SC_CCP_OPEN|SC_CCP_UP|SC_LOOP_TRAFFIC \ |SC_MULTILINK|SC_MP_SHORTSEQ|SC_MP_XSHORTSEQ \ - |SC_COMP_TCP|SC_REJ_COMP_TCP) + |SC_COMP_TCP|SC_REJ_COMP_TCP|SC_MUST_COMP) /* * Private data structure for each channel. @@ -1027,6 +1028,56 @@ ppp_xmit_process(struct ppp *ppp) ppp_xmit_unlock(ppp); } +static inline struct sk_buff * +pad_compress_skb(struct ppp *ppp, struct sk_buff *skb) +{ + struct sk_buff *new_skb; + int len; + int new_skb_size = ppp->dev->mtu + + ppp->xcomp->comp_extra + ppp->dev->hard_header_len; + int compressor_skb_size = ppp->dev->mtu + + ppp->xcomp->comp_extra + PPP_HDRLEN; + new_skb = alloc_skb(new_skb_size, GFP_ATOMIC); + if (!new_skb) { + if (net_ratelimit()) + printk(KERN_ERR "PPP: no memory (comp pkt)\n"); + return NULL; + } + if (ppp->dev->hard_header_len > PPP_HDRLEN) + skb_reserve(new_skb, + ppp->dev->hard_header_len - PPP_HDRLEN); + + /* compressor still expects A/C bytes in hdr */ + len = ppp->xcomp->compress(ppp->xc_state, skb->data - 2, + new_skb->data, skb->len + 2, + compressor_skb_size); + if (len > 0 && (ppp->flags & SC_CCP_UP)) { + kfree_skb(skb); + skb = new_skb; + skb_put(skb, len); + skb_pull(skb, 2); /* pull off A/C bytes */ + } else if (len == 0) { + /* didn't compress, or CCP not up yet */ + kfree_skb(new_skb); + new_skb = skb; + } else { + /* + * (len < 0) + * MPPE requires that we do not send unencrypted + * frames. The compressor will return -1 if we + * should drop the frame. We cannot simply test + * the compress_proto because MPPE and MPPC share + * the same number. + */ + if (net_ratelimit()) + printk(KERN_ERR "ppp: compressor dropped pkt\n"); + kfree_skb(skb); + kfree_skb(new_skb); + new_skb = NULL; + } + return new_skb; +} + /* * Compress and send a frame. * The caller should have locked the xmit path, @@ -1113,29 +1164,14 @@ ppp_send_frame(struct ppp *ppp, struct sk_buff *skb) /* try to do packet compression */ if ((ppp->xstate & SC_COMP_RUN) && ppp->xc_state != 0 && proto != PPP_LCP && proto != PPP_CCP) { - new_skb = alloc_skb(ppp->dev->mtu + ppp->dev->hard_header_len, - GFP_ATOMIC); - if (new_skb == 0) { - printk(KERN_ERR "PPP: no memory (comp pkt)\n"); + if (!(ppp->flags & SC_CCP_UP) && (ppp->flags & SC_MUST_COMP)) { + if (net_ratelimit()) + printk(KERN_ERR "ppp: compression required but down - pkt dropped.\n"); goto drop; } - if (ppp->dev->hard_header_len > PPP_HDRLEN) - skb_reserve(new_skb, - ppp->dev->hard_header_len - PPP_HDRLEN); - - /* compressor still expects A/C bytes in hdr */ - len = ppp->xcomp->compress(ppp->xc_state, skb->data - 2, - new_skb->data, skb->len + 2, - ppp->dev->mtu + PPP_HDRLEN); - if (len > 0 && (ppp->flags & SC_CCP_UP)) { - kfree_skb(skb); - skb = new_skb; - skb_put(skb, len); - skb_pull(skb, 2); /* pull off A/C bytes */ - } else { - /* didn't compress, or CCP not up yet */ - kfree_skb(new_skb); - } + skb = pad_compress_skb(ppp, skb); + if (!skb) + goto drop; } /* @@ -1155,7 +1191,8 @@ ppp_send_frame(struct ppp *ppp, struct sk_buff *skb) return; drop: - kfree_skb(skb); + if (skb) + kfree_skb(skb); ++ppp->stats.tx_errors; } @@ -1552,6 +1589,9 @@ ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb) && (ppp->rstate & (SC_DC_FERROR | SC_DC_ERROR)) == 0) skb = ppp_decompress_frame(ppp, skb); + if (ppp->flags & SC_MUST_COMP && ppp->rstate & SC_DC_FERROR) + goto err; + proto = PPP_PROTO(skb); switch (proto) { case PPP_VJC_COMP: diff --git a/drivers/net/ppp_mppe.c b/drivers/net/ppp_mppe.c new file mode 100644 index 000000000000..1985d1b57c45 --- /dev/null +++ b/drivers/net/ppp_mppe.c @@ -0,0 +1,724 @@ +/* + * ppp_mppe.c - interface MPPE to the PPP code. + * This version is for use with Linux kernel 2.6.14+ + * + * By Frank Cusack . + * Copyright (c) 2002,2003,2004 Google, Inc. + * All rights reserved. + * + * License: + * Permission to use, copy, modify, and distribute this software and its + * documentation is hereby granted, provided that the above copyright + * notice appears in all copies. This software is provided without any + * warranty, express or implied. + * + * ALTERNATIVELY, provided that this notice is retained in full, this product + * may be distributed under the terms of the GNU General Public License (GPL), + * in which case the provisions of the GPL apply INSTEAD OF those given above. + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * + * Changelog: + * 08/12/05 - Matt Domsch + * Only need extra skb padding on transmit, not receive. + * 06/18/04 - Matt Domsch , Oleg Makarenko + * Use Linux kernel 2.6 arc4 and sha1 routines rather than + * providing our own. + * 2/15/04 - TS: added #include and testing for Kernel + * version before using + * MOD_DEC_USAGE_COUNT/MOD_INC_USAGE_COUNT which are + * deprecated in 2.6 + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ppp_mppe.h" + +MODULE_AUTHOR("Frank Cusack "); +MODULE_DESCRIPTION("Point-to-Point Protocol Microsoft Point-to-Point Encryption support"); +MODULE_LICENSE("Dual BSD/GPL"); +MODULE_ALIAS("ppp-compress-" __stringify(CI_MPPE)); +MODULE_VERSION("1.0.2"); + +static void +setup_sg(struct scatterlist *sg, const void *address, unsigned int length) +{ + sg[0].page = virt_to_page(address); + sg[0].offset = offset_in_page(address); + sg[0].length = length; +} + +#define SHA1_PAD_SIZE 40 + +/* + * kernel crypto API needs its arguments to be in kmalloc'd memory, not in the module + * static data area. That means sha_pad needs to be kmalloc'd. + */ + +struct sha_pad { + unsigned char sha_pad1[SHA1_PAD_SIZE]; + unsigned char sha_pad2[SHA1_PAD_SIZE]; +}; +static struct sha_pad *sha_pad; + +static inline void sha_pad_init(struct sha_pad *shapad) +{ + memset(shapad->sha_pad1, 0x00, sizeof(shapad->sha_pad1)); + memset(shapad->sha_pad2, 0xF2, sizeof(shapad->sha_pad2)); +} + +/* + * State for an MPPE (de)compressor. + */ +struct ppp_mppe_state { + struct crypto_tfm *arc4; + struct crypto_tfm *sha1; + unsigned char *sha1_digest; + unsigned char master_key[MPPE_MAX_KEY_LEN]; + unsigned char session_key[MPPE_MAX_KEY_LEN]; + unsigned keylen; /* key length in bytes */ + /* NB: 128-bit == 16, 40-bit == 8! */ + /* If we want to support 56-bit, */ + /* the unit has to change to bits */ + unsigned char bits; /* MPPE control bits */ + unsigned ccount; /* 12-bit coherency count (seqno) */ + unsigned stateful; /* stateful mode flag */ + int discard; /* stateful mode packet loss flag */ + int sanity_errors; /* take down LCP if too many */ + int unit; + int debug; + struct compstat stats; +}; + +/* struct ppp_mppe_state.bits definitions */ +#define MPPE_BIT_A 0x80 /* Encryption table were (re)inititalized */ +#define MPPE_BIT_B 0x40 /* MPPC only (not implemented) */ +#define MPPE_BIT_C 0x20 /* MPPC only (not implemented) */ +#define MPPE_BIT_D 0x10 /* This is an encrypted frame */ + +#define MPPE_BIT_FLUSHED MPPE_BIT_A +#define MPPE_BIT_ENCRYPTED MPPE_BIT_D + +#define MPPE_BITS(p) ((p)[4] & 0xf0) +#define MPPE_CCOUNT(p) ((((p)[4] & 0x0f) << 8) + (p)[5]) +#define MPPE_CCOUNT_SPACE 0x1000 /* The size of the ccount space */ + +#define MPPE_OVHD 2 /* MPPE overhead/packet */ +#define SANITY_MAX 1600 /* Max bogon factor we will tolerate */ + +/* + * Key Derivation, from RFC 3078, RFC 3079. + * Equivalent to Get_Key() for MS-CHAP as described in RFC 3079. + */ +static void get_new_key_from_sha(struct ppp_mppe_state * state, unsigned char *InterimKey) +{ + struct scatterlist sg[4]; + + setup_sg(&sg[0], state->master_key, state->keylen); + setup_sg(&sg[1], sha_pad->sha_pad1, sizeof(sha_pad->sha_pad1)); + setup_sg(&sg[2], state->session_key, state->keylen); + setup_sg(&sg[3], sha_pad->sha_pad2, sizeof(sha_pad->sha_pad2)); + + crypto_digest_digest (state->sha1, sg, 4, state->sha1_digest); + + memcpy(InterimKey, state->sha1_digest, state->keylen); +} + +/* + * Perform the MPPE rekey algorithm, from RFC 3078, sec. 7.3. + * Well, not what's written there, but rather what they meant. + */ +static void mppe_rekey(struct ppp_mppe_state * state, int initial_key) +{ + unsigned char InterimKey[MPPE_MAX_KEY_LEN]; + struct scatterlist sg_in[1], sg_out[1]; + + get_new_key_from_sha(state, InterimKey); + if (!initial_key) { + crypto_cipher_setkey(state->arc4, InterimKey, state->keylen); + setup_sg(sg_in, InterimKey, state->keylen); + setup_sg(sg_out, state->session_key, state->keylen); + if (crypto_cipher_encrypt(state->arc4, sg_out, sg_in, + state->keylen) != 0) { + printk(KERN_WARNING "mppe_rekey: cipher_encrypt failed\n"); + } + } else { + memcpy(state->session_key, InterimKey, state->keylen); + } + if (state->keylen == 8) { + /* See RFC 3078 */ + state->session_key[0] = 0xd1; + state->session_key[1] = 0x26; + state->session_key[2] = 0x9e; + } + crypto_cipher_setkey(state->arc4, state->session_key, state->keylen); +} + +/* + * Allocate space for a (de)compressor. + */ +static void *mppe_alloc(unsigned char *options, int optlen) +{ + struct ppp_mppe_state *state; + unsigned int digestsize; + + if (optlen != CILEN_MPPE + sizeof(state->master_key) + || options[0] != CI_MPPE || options[1] != CILEN_MPPE) + goto out; + + state = (struct ppp_mppe_state *) kmalloc(sizeof(*state), GFP_KERNEL); + if (state == NULL) + goto out; + + memset(state, 0, sizeof(*state)); + + state->arc4 = crypto_alloc_tfm("arc4", 0); + if (!state->arc4) + goto out_free; + + state->sha1 = crypto_alloc_tfm("sha1", 0); + if (!state->sha1) + goto out_free; + + digestsize = crypto_tfm_alg_digestsize(state->sha1); + if (digestsize < MPPE_MAX_KEY_LEN) + goto out_free; + + state->sha1_digest = kmalloc(digestsize, GFP_KERNEL); + if (!state->sha1_digest) + goto out_free; + + /* Save keys. */ + memcpy(state->master_key, &options[CILEN_MPPE], + sizeof(state->master_key)); + memcpy(state->session_key, state->master_key, + sizeof(state->master_key)); + + /* + * We defer initial key generation until mppe_init(), as mppe_alloc() + * is called frequently during negotiation. + */ + + return (void *)state; + + out_free: + if (state->sha1_digest) + kfree(state->sha1_digest); + if (state->sha1) + crypto_free_tfm(state->sha1); + if (state->arc4) + crypto_free_tfm(state->arc4); + kfree(state); + out: + return NULL; +} + +/* + * Deallocate space for a (de)compressor. + */ +static void mppe_free(void *arg) +{ + struct ppp_mppe_state *state = (struct ppp_mppe_state *) arg; + if (state) { + if (state->sha1_digest) + kfree(state->sha1_digest); + if (state->sha1) + crypto_free_tfm(state->sha1); + if (state->arc4) + crypto_free_tfm(state->arc4); + kfree(state); + } +} + +/* + * Initialize (de)compressor state. + */ +static int +mppe_init(void *arg, unsigned char *options, int optlen, int unit, int debug, + const char *debugstr) +{ + struct ppp_mppe_state *state = (struct ppp_mppe_state *) arg; + unsigned char mppe_opts; + + if (optlen != CILEN_MPPE + || options[0] != CI_MPPE || options[1] != CILEN_MPPE) + return 0; + + MPPE_CI_TO_OPTS(&options[2], mppe_opts); + if (mppe_opts & MPPE_OPT_128) + state->keylen = 16; + else if (mppe_opts & MPPE_OPT_40) + state->keylen = 8; + else { + printk(KERN_WARNING "%s[%d]: unknown key length\n", debugstr, + unit); + return 0; + } + if (mppe_opts & MPPE_OPT_STATEFUL) + state->stateful = 1; + + /* Generate the initial session key. */ + mppe_rekey(state, 1); + + if (debug) { + int i; + char mkey[sizeof(state->master_key) * 2 + 1]; + char skey[sizeof(state->session_key) * 2 + 1]; + + printk(KERN_DEBUG "%s[%d]: initialized with %d-bit %s mode\n", + debugstr, unit, (state->keylen == 16) ? 128 : 40, + (state->stateful) ? "stateful" : "stateless"); + + for (i = 0; i < sizeof(state->master_key); i++) + sprintf(mkey + i * 2, "%02x", state->master_key[i]); + for (i = 0; i < sizeof(state->session_key); i++) + sprintf(skey + i * 2, "%02x", state->session_key[i]); + printk(KERN_DEBUG + "%s[%d]: keys: master: %s initial session: %s\n", + debugstr, unit, mkey, skey); + } + + /* + * Initialize the coherency count. The initial value is not specified + * in RFC 3078, but we can make a reasonable assumption that it will + * start at 0. Setting it to the max here makes the comp/decomp code + * do the right thing (determined through experiment). + */ + state->ccount = MPPE_CCOUNT_SPACE - 1; + + /* + * Note that even though we have initialized the key table, we don't + * set the FLUSHED bit. This is contrary to RFC 3078, sec. 3.1. + */ + state->bits = MPPE_BIT_ENCRYPTED; + + state->unit = unit; + state->debug = debug; + + return 1; +} + +static int +mppe_comp_init(void *arg, unsigned char *options, int optlen, int unit, + int hdrlen, int debug) +{ + /* ARGSUSED */ + return mppe_init(arg, options, optlen, unit, debug, "mppe_comp_init"); +} + +/* + * We received a CCP Reset-Request (actually, we are sending a Reset-Ack), + * tell the compressor to rekey. Note that we MUST NOT rekey for + * every CCP Reset-Request; we only rekey on the next xmit packet. + * We might get multiple CCP Reset-Requests if our CCP Reset-Ack is lost. + * So, rekeying for every CCP Reset-Request is broken as the peer will not + * know how many times we've rekeyed. (If we rekey and THEN get another + * CCP Reset-Request, we must rekey again.) + */ +static void mppe_comp_reset(void *arg) +{ + struct ppp_mppe_state *state = (struct ppp_mppe_state *) arg; + + state->bits |= MPPE_BIT_FLUSHED; +} + +/* + * Compress (encrypt) a packet. + * It's strange to call this a compressor, since the output is always + * MPPE_OVHD + 2 bytes larger than the input. + */ +static int +mppe_compress(void *arg, unsigned char *ibuf, unsigned char *obuf, + int isize, int osize) +{ + struct ppp_mppe_state *state = (struct ppp_mppe_state *) arg; + int proto; + struct scatterlist sg_in[1], sg_out[1]; + + /* + * Check that the protocol is in the range we handle. + */ + proto = PPP_PROTOCOL(ibuf); + if (proto < 0x0021 || proto > 0x00fa) + return 0; + + /* Make sure we have enough room to generate an encrypted packet. */ + if (osize < isize + MPPE_OVHD + 2) { + /* Drop the packet if we should encrypt it, but can't. */ + printk(KERN_DEBUG "mppe_compress[%d]: osize too small! " + "(have: %d need: %d)\n", state->unit, + osize, osize + MPPE_OVHD + 2); + return -1; + } + + osize = isize + MPPE_OVHD + 2; + + /* + * Copy over the PPP header and set control bits. + */ + obuf[0] = PPP_ADDRESS(ibuf); + obuf[1] = PPP_CONTROL(ibuf); + obuf[2] = PPP_COMP >> 8; /* isize + MPPE_OVHD + 1 */ + obuf[3] = PPP_COMP; /* isize + MPPE_OVHD + 2 */ + obuf += PPP_HDRLEN; + + state->ccount = (state->ccount + 1) % MPPE_CCOUNT_SPACE; + if (state->debug >= 7) + printk(KERN_DEBUG "mppe_compress[%d]: ccount %d\n", state->unit, + state->ccount); + obuf[0] = state->ccount >> 8; + obuf[1] = state->ccount & 0xff; + + if (!state->stateful || /* stateless mode */ + ((state->ccount & 0xff) == 0xff) || /* "flag" packet */ + (state->bits & MPPE_BIT_FLUSHED)) { /* CCP Reset-Request */ + /* We must rekey */ + if (state->debug && state->stateful) + printk(KERN_DEBUG "mppe_compress[%d]: rekeying\n", + state->unit); + mppe_rekey(state, 0); + state->bits |= MPPE_BIT_FLUSHED; + } + obuf[0] |= state->bits; + state->bits &= ~MPPE_BIT_FLUSHED; /* reset for next xmit */ + + obuf += MPPE_OVHD; + ibuf += 2; /* skip to proto field */ + isize -= 2; + + /* Encrypt packet */ + setup_sg(sg_in, ibuf, isize); + setup_sg(sg_out, obuf, osize); + if (crypto_cipher_encrypt(state->arc4, sg_out, sg_in, isize) != 0) { + printk(KERN_DEBUG "crypto_cypher_encrypt failed\n"); + return -1; + } + + state->stats.unc_bytes += isize; + state->stats.unc_packets++; + state->stats.comp_bytes += osize; + state->stats.comp_packets++; + + return osize; +} + +/* + * Since every frame grows by MPPE_OVHD + 2 bytes, this is always going + * to look bad ... and the longer the link is up the worse it will get. + */ +static void mppe_comp_stats(void *arg, struct compstat *stats) +{ + struct ppp_mppe_state *state = (struct ppp_mppe_state *) arg; + + *stats = state->stats; +} + +static int +mppe_decomp_init(void *arg, unsigned char *options, int optlen, int unit, + int hdrlen, int mru, int debug) +{ + /* ARGSUSED */ + return mppe_init(arg, options, optlen, unit, debug, "mppe_decomp_init"); +} + +/* + * We received a CCP Reset-Ack. Just ignore it. + */ +static void mppe_decomp_reset(void *arg) +{ + /* ARGSUSED */ + return; +} + +/* + * Decompress (decrypt) an MPPE packet. + */ +static int +mppe_decompress(void *arg, unsigned char *ibuf, int isize, unsigned char *obuf, + int osize) +{ + struct ppp_mppe_state *state = (struct ppp_mppe_state *) arg; + unsigned ccount; + int flushed = MPPE_BITS(ibuf) & MPPE_BIT_FLUSHED; + int sanity = 0; + struct scatterlist sg_in[1], sg_out[1]; + + if (isize <= PPP_HDRLEN + MPPE_OVHD) { + if (state->debug) + printk(KERN_DEBUG + "mppe_decompress[%d]: short pkt (%d)\n", + state->unit, isize); + return DECOMP_ERROR; + } + + /* + * Make sure we have enough room to decrypt the packet. + * Note that for our test we only subtract 1 byte whereas in + * mppe_compress() we added 2 bytes (+MPPE_OVHD); + * this is to account for possible PFC. + */ + if (osize < isize - MPPE_OVHD - 1) { + printk(KERN_DEBUG "mppe_decompress[%d]: osize too small! " + "(have: %d need: %d)\n", state->unit, + osize, isize - MPPE_OVHD - 1); + return DECOMP_ERROR; + } + osize = isize - MPPE_OVHD - 2; /* assume no PFC */ + + ccount = MPPE_CCOUNT(ibuf); + if (state->debug >= 7) + printk(KERN_DEBUG "mppe_decompress[%d]: ccount %d\n", + state->unit, ccount); + + /* sanity checks -- terminate with extreme prejudice */ + if (!(MPPE_BITS(ibuf) & MPPE_BIT_ENCRYPTED)) { + printk(KERN_DEBUG + "mppe_decompress[%d]: ENCRYPTED bit not set!\n", + state->unit); + state->sanity_errors += 100; + sanity = 1; + } + if (!state->stateful && !flushed) { + printk(KERN_DEBUG "mppe_decompress[%d]: FLUSHED bit not set in " + "stateless mode!\n", state->unit); + state->sanity_errors += 100; + sanity = 1; + } + if (state->stateful && ((ccount & 0xff) == 0xff) && !flushed) { + printk(KERN_DEBUG "mppe_decompress[%d]: FLUSHED bit not set on " + "flag packet!\n", state->unit); + state->sanity_errors += 100; + sanity = 1; + } + + if (sanity) { + if (state->sanity_errors < SANITY_MAX) + return DECOMP_ERROR; + else + /* + * Take LCP down if the peer is sending too many bogons. + * We don't want to do this for a single or just a few + * instances since it could just be due to packet corruption. + */ + return DECOMP_FATALERROR; + } + + /* + * Check the coherency count. + */ + + if (!state->stateful) { + /* RFC 3078, sec 8.1. Rekey for every packet. */ + while (state->ccount != ccount) { + mppe_rekey(state, 0); + state->ccount = (state->ccount + 1) % MPPE_CCOUNT_SPACE; + } + } else { + /* RFC 3078, sec 8.2. */ + if (!state->discard) { + /* normal state */ + state->ccount = (state->ccount + 1) % MPPE_CCOUNT_SPACE; + if (ccount != state->ccount) { + /* + * (ccount > state->ccount) + * Packet loss detected, enter the discard state. + * Signal the peer to rekey (by sending a CCP Reset-Request). + */ + state->discard = 1; + return DECOMP_ERROR; + } + } else { + /* discard state */ + if (!flushed) { + /* ccp.c will be silent (no additional CCP Reset-Requests). */ + return DECOMP_ERROR; + } else { + /* Rekey for every missed "flag" packet. */ + while ((ccount & ~0xff) != + (state->ccount & ~0xff)) { + mppe_rekey(state, 0); + state->ccount = + (state->ccount + + 256) % MPPE_CCOUNT_SPACE; + } + + /* reset */ + state->discard = 0; + state->ccount = ccount; + /* + * Another problem with RFC 3078 here. It implies that the + * peer need not send a Reset-Ack packet. But RFC 1962 + * requires it. Hopefully, M$ does send a Reset-Ack; even + * though it isn't required for MPPE synchronization, it is + * required to reset CCP state. + */ + } + } + if (flushed) + mppe_rekey(state, 0); + } + + /* + * Fill in the first part of the PPP header. The protocol field + * comes from the decrypted data. + */ + obuf[0] = PPP_ADDRESS(ibuf); /* +1 */ + obuf[1] = PPP_CONTROL(ibuf); /* +1 */ + obuf += 2; + ibuf += PPP_HDRLEN + MPPE_OVHD; + isize -= PPP_HDRLEN + MPPE_OVHD; /* -6 */ + /* net osize: isize-4 */ + + /* + * Decrypt the first byte in order to check if it is + * a compressed or uncompressed protocol field. + */ + setup_sg(sg_in, ibuf, 1); + setup_sg(sg_out, obuf, 1); + if (crypto_cipher_decrypt(state->arc4, sg_out, sg_in, 1) != 0) { + printk(KERN_DEBUG "crypto_cypher_decrypt failed\n"); + return DECOMP_ERROR; + } + + /* + * Do PFC decompression. + * This would be nicer if we were given the actual sk_buff + * instead of a char *. + */ + if ((obuf[0] & 0x01) != 0) { + obuf[1] = obuf[0]; + obuf[0] = 0; + obuf++; + osize++; + } + + /* And finally, decrypt the rest of the packet. */ + setup_sg(sg_in, ibuf + 1, isize - 1); + setup_sg(sg_out, obuf + 1, osize - 1); + if (crypto_cipher_decrypt(state->arc4, sg_out, sg_in, isize - 1) != 0) { + printk(KERN_DEBUG "crypto_cypher_decrypt failed\n"); + return DECOMP_ERROR; + } + + state->stats.unc_bytes += osize; + state->stats.unc_packets++; + state->stats.comp_bytes += isize; + state->stats.comp_packets++; + + /* good packet credit */ + state->sanity_errors >>= 1; + + return osize; +} + +/* + * Incompressible data has arrived (this should never happen!). + * We should probably drop the link if the protocol is in the range + * of what should be encrypted. At the least, we should drop this + * packet. (How to do this?) + */ +static void mppe_incomp(void *arg, unsigned char *ibuf, int icnt) +{ + struct ppp_mppe_state *state = (struct ppp_mppe_state *) arg; + + if (state->debug && + (PPP_PROTOCOL(ibuf) >= 0x0021 && PPP_PROTOCOL(ibuf) <= 0x00fa)) + printk(KERN_DEBUG + "mppe_incomp[%d]: incompressible (unencrypted) data! " + "(proto %04x)\n", state->unit, PPP_PROTOCOL(ibuf)); + + state->stats.inc_bytes += icnt; + state->stats.inc_packets++; + state->stats.unc_bytes += icnt; + state->stats.unc_packets++; +} + +/************************************************************* + * Module interface table + *************************************************************/ + +/* + * Procedures exported to if_ppp.c. + */ +static struct compressor ppp_mppe = { + .compress_proto = CI_MPPE, + .comp_alloc = mppe_alloc, + .comp_free = mppe_free, + .comp_init = mppe_comp_init, + .comp_reset = mppe_comp_reset, + .compress = mppe_compress, + .comp_stat = mppe_comp_stats, + .decomp_alloc = mppe_alloc, + .decomp_free = mppe_free, + .decomp_init = mppe_decomp_init, + .decomp_reset = mppe_decomp_reset, + .decompress = mppe_decompress, + .incomp = mppe_incomp, + .decomp_stat = mppe_comp_stats, + .owner = THIS_MODULE, + .comp_extra = MPPE_PAD, +}; + +/* + * ppp_mppe_init() + * + * Prior to allowing load, try to load the arc4 and sha1 crypto + * libraries. The actual use will be allocated later, but + * this way the module will fail to insmod if they aren't available. + */ + +static int __init ppp_mppe_init(void) +{ + int answer; + if (!(crypto_alg_available("arc4", 0) && + crypto_alg_available("sha1", 0))) + return -ENODEV; + + sha_pad = kmalloc(sizeof(struct sha_pad), GFP_KERNEL); + if (!sha_pad) + return -ENOMEM; + sha_pad_init(sha_pad); + + answer = ppp_register_compressor(&ppp_mppe); + + if (answer == 0) + printk(KERN_INFO "PPP MPPE Compression module registered\n"); + else + kfree(sha_pad); + + return answer; +} + +static void __exit ppp_mppe_cleanup(void) +{ + ppp_unregister_compressor(&ppp_mppe); + kfree(sha_pad); +} + +module_init(ppp_mppe_init); +module_exit(ppp_mppe_cleanup); diff --git a/drivers/net/ppp_mppe.h b/drivers/net/ppp_mppe.h new file mode 100644 index 000000000000..7a14e058c668 --- /dev/null +++ b/drivers/net/ppp_mppe.h @@ -0,0 +1,86 @@ +#define MPPE_PAD 4 /* MPPE growth per frame */ +#define MPPE_MAX_KEY_LEN 16 /* largest key length (128-bit) */ + +/* option bits for ccp_options.mppe */ +#define MPPE_OPT_40 0x01 /* 40 bit */ +#define MPPE_OPT_128 0x02 /* 128 bit */ +#define MPPE_OPT_STATEFUL 0x04 /* stateful mode */ +/* unsupported opts */ +#define MPPE_OPT_56 0x08 /* 56 bit */ +#define MPPE_OPT_MPPC 0x10 /* MPPC compression */ +#define MPPE_OPT_D 0x20 /* Unknown */ +#define MPPE_OPT_UNSUPPORTED (MPPE_OPT_56|MPPE_OPT_MPPC|MPPE_OPT_D) +#define MPPE_OPT_UNKNOWN 0x40 /* Bits !defined in RFC 3078 were set */ + +/* + * This is not nice ... the alternative is a bitfield struct though. + * And unfortunately, we cannot share the same bits for the option + * names above since C and H are the same bit. We could do a u_int32 + * but then we have to do a htonl() all the time and/or we still need + * to know which octet is which. + */ +#define MPPE_C_BIT 0x01 /* MPPC */ +#define MPPE_D_BIT 0x10 /* Obsolete, usage unknown */ +#define MPPE_L_BIT 0x20 /* 40-bit */ +#define MPPE_S_BIT 0x40 /* 128-bit */ +#define MPPE_M_BIT 0x80 /* 56-bit, not supported */ +#define MPPE_H_BIT 0x01 /* Stateless (in a different byte) */ + +/* Does not include H bit; used for least significant octet only. */ +#define MPPE_ALL_BITS (MPPE_D_BIT|MPPE_L_BIT|MPPE_S_BIT|MPPE_M_BIT|MPPE_H_BIT) + +/* Build a CI from mppe opts (see RFC 3078) */ +#define MPPE_OPTS_TO_CI(opts, ci) \ + do { \ + u_char *ptr = ci; /* u_char[4] */ \ + \ + /* H bit */ \ + if (opts & MPPE_OPT_STATEFUL) \ + *ptr++ = 0x0; \ + else \ + *ptr++ = MPPE_H_BIT; \ + *ptr++ = 0; \ + *ptr++ = 0; \ + \ + /* S,L bits */ \ + *ptr = 0; \ + if (opts & MPPE_OPT_128) \ + *ptr |= MPPE_S_BIT; \ + if (opts & MPPE_OPT_40) \ + *ptr |= MPPE_L_BIT; \ + /* M,D,C bits not supported */ \ + } while (/* CONSTCOND */ 0) + +/* The reverse of the above */ +#define MPPE_CI_TO_OPTS(ci, opts) \ + do { \ + u_char *ptr = ci; /* u_char[4] */ \ + \ + opts = 0; \ + \ + /* H bit */ \ + if (!(ptr[0] & MPPE_H_BIT)) \ + opts |= MPPE_OPT_STATEFUL; \ + \ + /* S,L bits */ \ + if (ptr[3] & MPPE_S_BIT) \ + opts |= MPPE_OPT_128; \ + if (ptr[3] & MPPE_L_BIT) \ + opts |= MPPE_OPT_40; \ + \ + /* M,D,C bits */ \ + if (ptr[3] & MPPE_M_BIT) \ + opts |= MPPE_OPT_56; \ + if (ptr[3] & MPPE_D_BIT) \ + opts |= MPPE_OPT_D; \ + if (ptr[3] & MPPE_C_BIT) \ + opts |= MPPE_OPT_MPPC; \ + \ + /* Other bits */ \ + if (ptr[0] & ~MPPE_H_BIT) \ + opts |= MPPE_OPT_UNKNOWN; \ + if (ptr[1] || ptr[2]) \ + opts |= MPPE_OPT_UNKNOWN; \ + if (ptr[3] & ~MPPE_ALL_BITS) \ + opts |= MPPE_OPT_UNKNOWN; \ + } while (/* CONSTCOND */ 0) diff --git a/include/linux/if_ppp.h b/include/linux/if_ppp.h index 572aff7daa21..768372f07caa 100644 --- a/include/linux/if_ppp.h +++ b/include/linux/if_ppp.h @@ -21,7 +21,7 @@ */ /* - * ==FILEVERSION 20000724== + * ==FILEVERSION 20050812== * * NOTE TO MAINTAINERS: * If you modify this file at all, please set the above date. @@ -35,6 +35,8 @@ #ifndef _IF_PPP_H_ #define _IF_PPP_H_ +#include + /* * Packet sizes */ @@ -70,7 +72,8 @@ #define SC_LOG_RAWIN 0x00080000 /* log all chars received */ #define SC_LOG_FLUSH 0x00100000 /* log all chars flushed */ #define SC_SYNC 0x00200000 /* synchronous serial mode */ -#define SC_MASK 0x0f200fff /* bits that user can change */ +#define SC_MUST_COMP 0x00400000 /* no uncompressed packets may be sent or received */ +#define SC_MASK 0x0f600fff /* bits that user can change */ /* state bits */ #define SC_XMIT_BUSY 0x10000000 /* (used by isdn_ppp?) */ diff --git a/include/linux/ppp-comp.h b/include/linux/ppp-comp.h index 7227e653b3be..e86a7a5cf355 100644 --- a/include/linux/ppp-comp.h +++ b/include/linux/ppp-comp.h @@ -111,6 +111,8 @@ struct compressor { /* Used in locking compressor modules */ struct module *owner; + /* Extra skb space needed by the compressor algorithm */ + unsigned int comp_extra; }; /* @@ -190,6 +192,13 @@ struct compressor { #define DEFLATE_MAKE_OPT(w) ((((w) - 8) << 4) + DEFLATE_METHOD_VAL) #define DEFLATE_CHK_SEQUENCE 0 +/* + * Definitions for MPPE. + */ + +#define CI_MPPE 18 /* config option for MPPE */ +#define CILEN_MPPE 6 /* length of config option */ + /* * Definitions for other, as yet unsupported, compression methods. */ -- cgit v1.2.2 From ac7c98eca88a854755475fcfe1b2bf5f97f90d99 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Tue, 8 Nov 2005 09:41:13 -0800 Subject: [IRDA] donauboe: locking fix From: Andrew Morton Two missing unlocks, as noted by Ted Unangst Signed-off-by: Andrew Morton Signed-off-by: David S. Miller --- drivers/net/irda/donauboe.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/net/irda/donauboe.c b/drivers/net/irda/donauboe.c index 0282771b1cbb..3137592d60c0 100644 --- a/drivers/net/irda/donauboe.c +++ b/drivers/net/irda/donauboe.c @@ -1459,8 +1459,10 @@ toshoboe_net_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) */ IRDA_DEBUG (1, "%s(BANDWIDTH), %s, (%X/%ld\n", __FUNCTION__ ,dev->name, INB (OBOE_STATUS), irq->ifr_baudrate ); - if (!in_interrupt () && !capable (CAP_NET_ADMIN)) - return -EPERM; + if (!in_interrupt () && !capable (CAP_NET_ADMIN)) { + ret = -EPERM; + goto out; + } /* self->speed=irq->ifr_baudrate; */ /* toshoboe_setbaud(self); */ @@ -1470,8 +1472,10 @@ toshoboe_net_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) case SIOCSMEDIABUSY: /* Set media busy */ IRDA_DEBUG (1, "%s(MEDIABUSY), %s, (%X/%x)\n", __FUNCTION__ ,dev->name, INB (OBOE_STATUS), capable (CAP_NET_ADMIN) ); - if (!capable (CAP_NET_ADMIN)) - return -EPERM; + if (!capable (CAP_NET_ADMIN)) { + ret = -EPERM; + goto out; + } irda_device_set_media_busy (self->netdev, TRUE); break; case SIOCGRECEIVING: /* Check if we are receiving right now */ @@ -1483,7 +1487,7 @@ toshoboe_net_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) IRDA_DEBUG (1, "%s(?), %s, (cmd=0x%X)\n", __FUNCTION__, dev->name, cmd); ret = -EOPNOTSUPP; } - +out: spin_unlock_irqrestore(&self->spinlock, flags); return ret; -- cgit v1.2.2 From a51482bde22f99c63fbbb57d5d46cc666384e379 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Tue, 8 Nov 2005 09:41:34 -0800 Subject: [NET]: kfree cleanup From: Jesper Juhl This is the net/ part of the big kfree cleanup patch. Remove pointless checks for NULL prior to calling kfree() in net/. Signed-off-by: Jesper Juhl Cc: "David S. Miller" Cc: Arnaldo Carvalho de Melo Acked-by: Marcel Holtmann Acked-by: YOSHIFUJI Hideaki Signed-off-by: Andrew Morton --- net/802/p8023.c | 3 +-- net/ax25/af_ax25.c | 6 ++---- net/ax25/ax25_in.c | 6 ++---- net/ax25/ax25_route.c | 19 ++++++------------- net/bluetooth/hidp/core.c | 4 +--- net/core/dev_mcast.c | 3 +-- net/core/sock.c | 3 +-- net/dccp/ipv4.c | 6 ++---- net/dccp/proto.c | 3 +-- net/decnet/dn_table.c | 14 ++++++-------- net/ethernet/pe2.c | 3 +-- net/ipv4/af_inet.c | 3 +-- net/ipv4/fib_frontend.c | 3 +-- net/ipv4/ip_options.c | 3 +-- net/ipv4/ip_output.c | 12 ++++-------- net/ipv4/ip_sockglue.c | 12 ++++-------- net/ipv4/ipvs/ip_vs_app.c | 6 ++---- net/ipv4/multipath_wrandom.c | 10 +++------- net/ipv4/netfilter/ip_nat_snmp_basic.c | 3 +-- net/ipv4/tcp_ipv4.c | 3 +-- net/ipv6/addrconf.c | 3 +-- net/ipv6/ip6_output.c | 15 +++++---------- net/ipv6/ip6_tunnel.c | 6 ++---- net/ipv6/ipcomp6.c | 3 +-- net/ipv6/ipv6_sockglue.c | 3 +-- net/irda/discovery.c | 3 +-- net/irda/irias_object.c | 16 ++++++---------- net/rose/rose_route.c | 6 ++---- net/sched/cls_fw.c | 3 +-- net/sched/cls_route.c | 3 +-- net/sched/cls_rsvp.h | 3 +-- net/sched/cls_tcindex.c | 9 +++------ net/sched/cls_u32.c | 4 ++-- net/sched/em_meta.c | 3 +-- net/sctp/associola.c | 4 +--- net/sctp/sm_make_chunk.c | 6 ++---- net/sunrpc/auth_gss/gss_krb5_seal.c | 2 +- net/sunrpc/auth_gss/gss_krb5_unseal.c | 2 +- net/sunrpc/auth_gss/gss_mech_switch.c | 3 +-- net/sunrpc/auth_gss/gss_spkm3_seal.c | 3 +-- net/sunrpc/auth_gss/gss_spkm3_token.c | 3 +-- net/sunrpc/auth_gss/gss_spkm3_unseal.c | 6 ++---- net/sunrpc/svc.c | 9 +++------ net/sunrpc/xdr.c | 3 +-- net/wanrouter/af_wanpipe.c | 20 +++++++------------- net/wanrouter/wanmain.c | 12 ++++-------- net/xfrm/xfrm_state.c | 12 ++++-------- 47 files changed, 99 insertions(+), 191 deletions(-) diff --git a/net/802/p8023.c b/net/802/p8023.c index 6368d3dce444..d23e906456eb 100644 --- a/net/802/p8023.c +++ b/net/802/p8023.c @@ -54,8 +54,7 @@ struct datalink_proto *make_8023_client(void) */ void destroy_8023_client(struct datalink_proto *dl) { - if (dl) - kfree(dl); + kfree(dl); } EXPORT_SYMBOL(destroy_8023_client); diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index 8e37e71e34ff..1b683f302657 100644 --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c @@ -1138,10 +1138,8 @@ static int ax25_connect(struct socket *sock, struct sockaddr *uaddr, sk->sk_state = TCP_CLOSE; sock->state = SS_UNCONNECTED; - if (ax25->digipeat != NULL) { - kfree(ax25->digipeat); - ax25->digipeat = NULL; - } + kfree(ax25->digipeat); + ax25->digipeat = NULL; /* * Handle digi-peaters to be used. diff --git a/net/ax25/ax25_in.c b/net/ax25/ax25_in.c index 73cfc3411c46..4cf87540fb3a 100644 --- a/net/ax25/ax25_in.c +++ b/net/ax25/ax25_in.c @@ -401,10 +401,8 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev, } if (dp.ndigi == 0) { - if (ax25->digipeat != NULL) { - kfree(ax25->digipeat); - ax25->digipeat = NULL; - } + kfree(ax25->digipeat); + ax25->digipeat = NULL; } else { /* Reverse the source SABM's path */ memcpy(ax25->digipeat, &reverse_dp, sizeof(ax25_digi)); diff --git a/net/ax25/ax25_route.c b/net/ax25/ax25_route.c index 26b77d972220..b1e945bd6ed3 100644 --- a/net/ax25/ax25_route.c +++ b/net/ax25/ax25_route.c @@ -54,15 +54,13 @@ void ax25_rt_device_down(struct net_device *dev) if (s->dev == dev) { if (ax25_route_list == s) { ax25_route_list = s->next; - if (s->digipeat != NULL) - kfree(s->digipeat); + kfree(s->digipeat); kfree(s); } else { for (t = ax25_route_list; t != NULL; t = t->next) { if (t->next == s) { t->next = s->next; - if (s->digipeat != NULL) - kfree(s->digipeat); + kfree(s->digipeat); kfree(s); break; } @@ -90,10 +88,8 @@ static int ax25_rt_add(struct ax25_routes_struct *route) while (ax25_rt != NULL) { if (ax25cmp(&ax25_rt->callsign, &route->dest_addr) == 0 && ax25_rt->dev == ax25_dev->dev) { - if (ax25_rt->digipeat != NULL) { - kfree(ax25_rt->digipeat); - ax25_rt->digipeat = NULL; - } + kfree(ax25_rt->digipeat); + ax25_rt->digipeat = NULL; if (route->digi_count != 0) { if ((ax25_rt->digipeat = kmalloc(sizeof(ax25_digi), GFP_ATOMIC)) == NULL) { write_unlock(&ax25_route_lock); @@ -145,8 +141,7 @@ static int ax25_rt_add(struct ax25_routes_struct *route) static void ax25_rt_destroy(ax25_route *ax25_rt) { if (atomic_read(&ax25_rt->ref) == 0) { - if (ax25_rt->digipeat != NULL) - kfree(ax25_rt->digipeat); + kfree(ax25_rt->digipeat); kfree(ax25_rt); return; } @@ -530,9 +525,7 @@ void __exit ax25_rt_free(void) s = ax25_rt; ax25_rt = ax25_rt->next; - if (s->digipeat != NULL) - kfree(s->digipeat); - + kfree(s->digipeat); kfree(s); } write_unlock(&ax25_route_lock); diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c index 860444a7fc0f..cdb9cfafd960 100644 --- a/net/bluetooth/hidp/core.c +++ b/net/bluetooth/hidp/core.c @@ -660,9 +660,7 @@ unlink: failed: up_write(&hidp_session_sem); - if (session->input) - kfree(session->input); - + kfree(session->input); kfree(session); return err; } diff --git a/net/core/dev_mcast.c b/net/core/dev_mcast.c index db098ff3cd6a..cb530eef0e39 100644 --- a/net/core/dev_mcast.c +++ b/net/core/dev_mcast.c @@ -194,8 +194,7 @@ int dev_mc_add(struct net_device *dev, void *addr, int alen, int glbl) done: spin_unlock_bh(&dev->xmit_lock); - if (dmi1) - kfree(dmi1); + kfree(dmi1); return err; } diff --git a/net/core/sock.c b/net/core/sock.c index 9602ceb3bac9..13cc3be4f056 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -1242,8 +1242,7 @@ static void sock_def_write_space(struct sock *sk) static void sock_def_destruct(struct sock *sk) { - if (sk->sk_protinfo) - kfree(sk->sk_protinfo); + kfree(sk->sk_protinfo); } void sk_send_sigurg(struct sock *sk) diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index 4b9bc81ae1a3..ca03521112c5 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c @@ -1263,10 +1263,8 @@ static int dccp_v4_destroy_sock(struct sock *sk) if (inet_csk(sk)->icsk_bind_hash != NULL) inet_put_port(&dccp_hashinfo, sk); - if (dp->dccps_service_list != NULL) { - kfree(dp->dccps_service_list); - dp->dccps_service_list = NULL; - } + kfree(dp->dccps_service_list); + dp->dccps_service_list = NULL; ccid_hc_rx_exit(dp->dccps_hc_rx_ccid, sk); ccid_hc_tx_exit(dp->dccps_hc_tx_ccid, sk); diff --git a/net/dccp/proto.c b/net/dccp/proto.c index a021c3422f67..e0ace7cbb996 100644 --- a/net/dccp/proto.c +++ b/net/dccp/proto.c @@ -238,8 +238,7 @@ static int dccp_setsockopt_service(struct sock *sk, const u32 service, lock_sock(sk); dp->dccps_service = service; - if (dp->dccps_service_list != NULL) - kfree(dp->dccps_service_list); + kfree(dp->dccps_service_list); dp->dccps_service_list = sl; release_sock(sk); diff --git a/net/decnet/dn_table.c b/net/decnet/dn_table.c index eeba56f99323..6f8b5658cb4e 100644 --- a/net/decnet/dn_table.c +++ b/net/decnet/dn_table.c @@ -784,16 +784,14 @@ struct dn_fib_table *dn_fib_get_table(int n, int create) static void dn_fib_del_tree(int n) { - struct dn_fib_table *t; + struct dn_fib_table *t; - write_lock(&dn_fib_tables_lock); - t = dn_fib_tables[n]; - dn_fib_tables[n] = NULL; - write_unlock(&dn_fib_tables_lock); + write_lock(&dn_fib_tables_lock); + t = dn_fib_tables[n]; + dn_fib_tables[n] = NULL; + write_unlock(&dn_fib_tables_lock); - if (t) { - kfree(t); - } + kfree(t); } struct dn_fib_table *dn_fib_empty_table(void) diff --git a/net/ethernet/pe2.c b/net/ethernet/pe2.c index 98a494be6039..9d57b4fb6440 100644 --- a/net/ethernet/pe2.c +++ b/net/ethernet/pe2.c @@ -32,8 +32,7 @@ struct datalink_proto *make_EII_client(void) void destroy_EII_client(struct datalink_proto *dl) { - if (dl) - kfree(dl); + kfree(dl); } EXPORT_SYMBOL(destroy_EII_client); diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index a9d84f93442c..eaa150c33b04 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -147,8 +147,7 @@ void inet_sock_destruct(struct sock *sk) BUG_TRAP(!sk->sk_wmem_queued); BUG_TRAP(!sk->sk_forward_alloc); - if (inet->opt) - kfree(inet->opt); + kfree(inet->opt); dst_release(sk->sk_dst_cache); sk_refcnt_debug_dec(sk); } diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 990633c09dfe..2267c1fad879 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c @@ -266,8 +266,7 @@ int ip_rt_ioctl(unsigned int cmd, void __user *arg) if (tb) err = tb->tb_insert(tb, &req.rtm, &rta, &req.nlh, NULL); } - if (rta.rta_mx) - kfree(rta.rta_mx); + kfree(rta.rta_mx); } rtnl_unlock(); return err; diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c index bce4e875193b..dbe12da8d8b3 100644 --- a/net/ipv4/ip_options.c +++ b/net/ipv4/ip_options.c @@ -510,8 +510,7 @@ static int ip_options_get_finish(struct ip_options **optp, kfree(opt); return -EINVAL; } - if (*optp) - kfree(*optp); + kfree(*optp); *optp = opt; return 0; } diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 17758234a3e3..df7f20da422d 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c @@ -1262,10 +1262,8 @@ int ip_push_pending_frames(struct sock *sk) out: inet->cork.flags &= ~IPCORK_OPT; - if (inet->cork.opt) { - kfree(inet->cork.opt); - inet->cork.opt = NULL; - } + kfree(inet->cork.opt); + inet->cork.opt = NULL; if (inet->cork.rt) { ip_rt_put(inet->cork.rt); inet->cork.rt = NULL; @@ -1289,10 +1287,8 @@ void ip_flush_pending_frames(struct sock *sk) kfree_skb(skb); inet->cork.flags &= ~IPCORK_OPT; - if (inet->cork.opt) { - kfree(inet->cork.opt); - inet->cork.opt = NULL; - } + kfree(inet->cork.opt); + inet->cork.opt = NULL; if (inet->cork.rt) { ip_rt_put(inet->cork.rt); inet->cork.rt = NULL; diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index 2f0b47da5b37..4f2d87257309 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c @@ -202,8 +202,7 @@ int ip_ra_control(struct sock *sk, unsigned char on, void (*destructor)(struct s if (ra->sk == sk) { if (on) { write_unlock_bh(&ip_ra_lock); - if (new_ra) - kfree(new_ra); + kfree(new_ra); return -EADDRINUSE; } *rap = ra->next; @@ -446,8 +445,7 @@ int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval, #endif } opt = xchg(&inet->opt, opt); - if (opt) - kfree(opt); + kfree(opt); break; } case IP_PKTINFO: @@ -828,10 +826,8 @@ int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval, err = ip_mc_msfilter(sk, msf, ifindex); mc_msf_out: - if (msf) - kfree(msf); - if (gsf) - kfree(gsf); + kfree(msf); + kfree(gsf); break; } case IP_ROUTER_ALERT: diff --git a/net/ipv4/ipvs/ip_vs_app.c b/net/ipv4/ipvs/ip_vs_app.c index fc6f95aaa969..d7eb680101c2 100644 --- a/net/ipv4/ipvs/ip_vs_app.c +++ b/net/ipv4/ipvs/ip_vs_app.c @@ -110,8 +110,7 @@ ip_vs_app_inc_new(struct ip_vs_app *app, __u16 proto, __u16 port) return 0; out: - if (inc->timeout_table) - kfree(inc->timeout_table); + kfree(inc->timeout_table); kfree(inc); return ret; } @@ -136,8 +135,7 @@ ip_vs_app_inc_release(struct ip_vs_app *inc) list_del(&inc->a_list); - if (inc->timeout_table != NULL) - kfree(inc->timeout_table); + kfree(inc->timeout_table); kfree(inc); } diff --git a/net/ipv4/multipath_wrandom.c b/net/ipv4/multipath_wrandom.c index bd7d75b6abe0..d34a9fa608e0 100644 --- a/net/ipv4/multipath_wrandom.c +++ b/net/ipv4/multipath_wrandom.c @@ -207,16 +207,12 @@ static void wrandom_select_route(const struct flowi *flp, decision = mpc->rt; last_power = mpc->power; - if (last_mpc) - kfree(last_mpc); - + kfree(last_mpc); last_mpc = mpc; } - if (last_mpc) { - /* concurrent __multipath_flush may lead to !last_mpc */ - kfree(last_mpc); - } + /* concurrent __multipath_flush may lead to !last_mpc */ + kfree(last_mpc); decision->u.dst.__use++; *rp = decision; diff --git a/net/ipv4/netfilter/ip_nat_snmp_basic.c b/net/ipv4/netfilter/ip_nat_snmp_basic.c index 93b2c5111bb2..8acb7ed40b47 100644 --- a/net/ipv4/netfilter/ip_nat_snmp_basic.c +++ b/net/ipv4/netfilter/ip_nat_snmp_basic.c @@ -1161,8 +1161,7 @@ static int snmp_parse_mangle(unsigned char *msg, if (!snmp_object_decode(&ctx, obj)) { if (*obj) { - if ((*obj)->id) - kfree((*obj)->id); + kfree((*obj)->id); kfree(*obj); } kfree(obj); diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 49d67cd75edd..634dabb558fd 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -823,8 +823,7 @@ out: */ static void tcp_v4_reqsk_destructor(struct request_sock *req) { - if (inet_rsk(req)->opt) - kfree(inet_rsk(req)->opt); + kfree(inet_rsk(req)->opt); } static inline void syn_flood_warning(struct sk_buff *skb) diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index a34d1504deb9..b7a5f51238b3 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -3090,8 +3090,7 @@ static int inet6_fill_ifinfo(struct sk_buff *skb, struct inet6_dev *idev, nlmsg_failure: rtattr_failure: - if (array) - kfree(array); + kfree(array); skb_trim(skb, b - skb->data); return -1; } diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 614296a920c6..dbd9767b32e4 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c @@ -587,8 +587,7 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) skb->next = NULL; } - if (tmp_hdr) - kfree(tmp_hdr); + kfree(tmp_hdr); if (err == 0) { IP6_INC_STATS(IPSTATS_MIB_FRAGOKS); @@ -1186,10 +1185,8 @@ int ip6_push_pending_frames(struct sock *sk) out: inet->cork.flags &= ~IPCORK_OPT; - if (np->cork.opt) { - kfree(np->cork.opt); - np->cork.opt = NULL; - } + kfree(np->cork.opt); + np->cork.opt = NULL; if (np->cork.rt) { dst_release(&np->cork.rt->u.dst); np->cork.rt = NULL; @@ -1214,10 +1211,8 @@ void ip6_flush_pending_frames(struct sock *sk) inet->cork.flags &= ~IPCORK_OPT; - if (np->cork.opt) { - kfree(np->cork.opt); - np->cork.opt = NULL; - } + kfree(np->cork.opt); + np->cork.opt = NULL; if (np->cork.rt) { dst_release(&np->cork.rt->u.dst); np->cork.rt = NULL; diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index cf94372d1af3..e6b0e3954c02 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c @@ -756,8 +756,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) } ip6_tnl_dst_store(t, dst); - if (opt) - kfree(opt); + kfree(opt); t->recursion--; return 0; @@ -766,8 +765,7 @@ tx_err_link_failure: dst_link_failure(skb); tx_err_dst_release: dst_release(dst); - if (opt) - kfree(opt); + kfree(opt); tx_err: stats->tx_errors++; stats->tx_dropped++; diff --git a/net/ipv6/ipcomp6.c b/net/ipv6/ipcomp6.c index 85bfbc69b2c3..55917fb17094 100644 --- a/net/ipv6/ipcomp6.c +++ b/net/ipv6/ipcomp6.c @@ -130,8 +130,7 @@ static int ipcomp6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, s out_put_cpu: put_cpu(); out: - if (tmp_hdr) - kfree(tmp_hdr); + kfree(tmp_hdr); if (err) goto error_out; return nexthdr; diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c index 8567873d0dd8..003fd99ff597 100644 --- a/net/ipv6/ipv6_sockglue.c +++ b/net/ipv6/ipv6_sockglue.c @@ -80,8 +80,7 @@ int ip6_ra_control(struct sock *sk, int sel, void (*destructor)(struct sock *)) if (ra->sk == sk) { if (sel>=0) { write_unlock_bh(&ip6_ra_lock); - if (new_ra) - kfree(new_ra); + kfree(new_ra); return -EADDRINUSE; } diff --git a/net/irda/discovery.c b/net/irda/discovery.c index c4ba5fa1446a..3fefc822c1c0 100644 --- a/net/irda/discovery.c +++ b/net/irda/discovery.c @@ -194,8 +194,7 @@ void irlmp_expire_discoveries(hashbin_t *log, __u32 saddr, int force) /* Remove it from the log */ curr = hashbin_remove_this(log, (irda_queue_t *) curr); - if (curr) - kfree(curr); + kfree(curr); } } diff --git a/net/irda/irias_object.c b/net/irda/irias_object.c index 6fec428b4512..75f2666e8630 100644 --- a/net/irda/irias_object.c +++ b/net/irda/irias_object.c @@ -122,8 +122,7 @@ static void __irias_delete_attrib(struct ias_attrib *attrib) IRDA_ASSERT(attrib != NULL, return;); IRDA_ASSERT(attrib->magic == IAS_ATTRIB_MAGIC, return;); - if (attrib->name) - kfree(attrib->name); + kfree(attrib->name); irias_delete_value(attrib->value); attrib->magic = ~IAS_ATTRIB_MAGIC; @@ -136,8 +135,7 @@ void __irias_delete_object(struct ias_object *obj) IRDA_ASSERT(obj != NULL, return;); IRDA_ASSERT(obj->magic == IAS_OBJECT_MAGIC, return;); - if (obj->name) - kfree(obj->name); + kfree(obj->name); hashbin_delete(obj->attribs, (FREE_FUNC) __irias_delete_attrib); @@ -562,14 +560,12 @@ void irias_delete_value(struct ias_value *value) /* No need to deallocate */ break; case IAS_STRING: - /* If string, deallocate string */ - if (value->t.string != NULL) - kfree(value->t.string); + /* Deallocate string */ + kfree(value->t.string); break; case IAS_OCT_SEQ: - /* If byte stream, deallocate byte stream */ - if (value->t.oct_seq != NULL) - kfree(value->t.oct_seq); + /* Deallocate byte stream */ + kfree(value->t.oct_seq); break; default: IRDA_DEBUG(0, "%s(), Unknown value type!\n", __FUNCTION__); diff --git a/net/rose/rose_route.c b/net/rose/rose_route.c index b18fe5043019..8631b65a7312 100644 --- a/net/rose/rose_route.c +++ b/net/rose/rose_route.c @@ -240,8 +240,7 @@ static void rose_remove_neigh(struct rose_neigh *rose_neigh) if ((s = rose_neigh_list) == rose_neigh) { rose_neigh_list = rose_neigh->next; spin_unlock_bh(&rose_neigh_list_lock); - if (rose_neigh->digipeat != NULL) - kfree(rose_neigh->digipeat); + kfree(rose_neigh->digipeat); kfree(rose_neigh); return; } @@ -250,8 +249,7 @@ static void rose_remove_neigh(struct rose_neigh *rose_neigh) if (s->next == rose_neigh) { s->next = rose_neigh->next; spin_unlock_bh(&rose_neigh_list_lock); - if (rose_neigh->digipeat != NULL) - kfree(rose_neigh->digipeat); + kfree(rose_neigh->digipeat); kfree(rose_neigh); return; } diff --git a/net/sched/cls_fw.c b/net/sched/cls_fw.c index 29d8b9a4d162..75470486e405 100644 --- a/net/sched/cls_fw.c +++ b/net/sched/cls_fw.c @@ -298,8 +298,7 @@ static int fw_change(struct tcf_proto *tp, unsigned long base, return 0; errout: - if (f) - kfree(f); + kfree(f); return err; } diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c index 02996ac05c75..520ff716dab2 100644 --- a/net/sched/cls_route.c +++ b/net/sched/cls_route.c @@ -525,8 +525,7 @@ reinsert: return 0; errout: - if (f) - kfree(f); + kfree(f); return err; } diff --git a/net/sched/cls_rsvp.h b/net/sched/cls_rsvp.h index 006168d69376..572f06be3b02 100644 --- a/net/sched/cls_rsvp.h +++ b/net/sched/cls_rsvp.h @@ -555,8 +555,7 @@ insert: goto insert; errout: - if (f) - kfree(f); + kfree(f); errout2: tcf_exts_destroy(tp, &e); return err; diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c index 404d9d83a7fa..9f921174c8ab 100644 --- a/net/sched/cls_tcindex.c +++ b/net/sched/cls_tcindex.c @@ -194,8 +194,7 @@ found: } tcf_unbind_filter(tp, &r->res); tcf_exts_destroy(tp, &r->exts); - if (f) - kfree(f); + kfree(f); return 0; } @@ -442,10 +441,8 @@ static void tcindex_destroy(struct tcf_proto *tp) walker.skip = 0; walker.fn = &tcindex_destroy_element; tcindex_walk(tp,&walker); - if (p->perfect) - kfree(p->perfect); - if (p->h) - kfree(p->h); + kfree(p->perfect); + kfree(p->h); kfree(p); tp->root = NULL; } diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c index 364b87d86455..2b670479dde1 100644 --- a/net/sched/cls_u32.c +++ b/net/sched/cls_u32.c @@ -347,7 +347,7 @@ static int u32_destroy_key(struct tcf_proto *tp, struct tc_u_knode *n) if (n->ht_down) n->ht_down->refcnt--; #ifdef CONFIG_CLS_U32_PERF - if (n && (NULL != n->pf)) + if (n) kfree(n->pf); #endif kfree(n); @@ -680,7 +680,7 @@ static int u32_change(struct tcf_proto *tp, unsigned long base, u32 handle, return 0; } #ifdef CONFIG_CLS_U32_PERF - if (n && (NULL != n->pf)) + if (n) kfree(n->pf); #endif kfree(n); diff --git a/net/sched/em_meta.c b/net/sched/em_meta.c index cf68a59fdc5a..700844d49d79 100644 --- a/net/sched/em_meta.c +++ b/net/sched/em_meta.c @@ -561,8 +561,7 @@ static int meta_var_change(struct meta_value *dst, struct rtattr *rta) static void meta_var_destroy(struct meta_value *v) { - if (v->val) - kfree((void *) v->val); + kfree((void *) v->val); } static void meta_var_apply_extras(struct meta_value *v, diff --git a/net/sctp/associola.c b/net/sctp/associola.c index 12b0f582a66b..8c8ddf7f9b61 100644 --- a/net/sctp/associola.c +++ b/net/sctp/associola.c @@ -344,9 +344,7 @@ void sctp_association_free(struct sctp_association *asoc) } /* Free peer's cached cookie. */ - if (asoc->peer.cookie) { - kfree(asoc->peer.cookie); - } + kfree(asoc->peer.cookie); /* Release the transport structures. */ list_for_each_safe(pos, temp, &asoc->peer.transport_addr_list) { diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index 660c61bdf164..f9573eba5c7a 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c @@ -254,8 +254,7 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc, aiparam.adaption_ind = htonl(sp->adaption_ind); sctp_addto_chunk(retval, sizeof(aiparam), &aiparam); nodata: - if (addrs.v) - kfree(addrs.v); + kfree(addrs.v); return retval; } @@ -347,8 +346,7 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc, nomem_chunk: kfree(cookie); nomem_cookie: - if (addrs.v) - kfree(addrs.v); + kfree(addrs.v); return retval; } diff --git a/net/sunrpc/auth_gss/gss_krb5_seal.c b/net/sunrpc/auth_gss/gss_krb5_seal.c index 13f8ae979454..d0dfdfd5e79e 100644 --- a/net/sunrpc/auth_gss/gss_krb5_seal.c +++ b/net/sunrpc/auth_gss/gss_krb5_seal.c @@ -143,6 +143,6 @@ gss_get_mic_kerberos(struct gss_ctx *gss_ctx, struct xdr_buf *text, return ((ctx->endtime < now) ? GSS_S_CONTEXT_EXPIRED : GSS_S_COMPLETE); out_err: - if (md5cksum.data) kfree(md5cksum.data); + kfree(md5cksum.data); return GSS_S_FAILURE; } diff --git a/net/sunrpc/auth_gss/gss_krb5_unseal.c b/net/sunrpc/auth_gss/gss_krb5_unseal.c index 2030475d98ed..db055fd7d778 100644 --- a/net/sunrpc/auth_gss/gss_krb5_unseal.c +++ b/net/sunrpc/auth_gss/gss_krb5_unseal.c @@ -176,6 +176,6 @@ gss_verify_mic_kerberos(struct gss_ctx *gss_ctx, ret = GSS_S_COMPLETE; out: - if (md5cksum.data) kfree(md5cksum.data); + kfree(md5cksum.data); return ret; } diff --git a/net/sunrpc/auth_gss/gss_mech_switch.c b/net/sunrpc/auth_gss/gss_mech_switch.c index b048bf672da2..f8bac6ccd524 100644 --- a/net/sunrpc/auth_gss/gss_mech_switch.c +++ b/net/sunrpc/auth_gss/gss_mech_switch.c @@ -60,8 +60,7 @@ gss_mech_free(struct gss_api_mech *gm) for (i = 0; i < gm->gm_pf_num; i++) { pf = &gm->gm_pfs[i]; - if (pf->auth_domain_name) - kfree(pf->auth_domain_name); + kfree(pf->auth_domain_name); pf->auth_domain_name = NULL; } } diff --git a/net/sunrpc/auth_gss/gss_spkm3_seal.c b/net/sunrpc/auth_gss/gss_spkm3_seal.c index 148201e929d0..d1e12b25d6e2 100644 --- a/net/sunrpc/auth_gss/gss_spkm3_seal.c +++ b/net/sunrpc/auth_gss/gss_spkm3_seal.c @@ -122,8 +122,7 @@ spkm3_make_token(struct spkm3_ctx *ctx, return GSS_S_COMPLETE; out_err: - if (md5cksum.data) - kfree(md5cksum.data); + kfree(md5cksum.data); token->data = NULL; token->len = 0; return GSS_S_FAILURE; diff --git a/net/sunrpc/auth_gss/gss_spkm3_token.c b/net/sunrpc/auth_gss/gss_spkm3_token.c index 46c08a0710f6..1f824578d773 100644 --- a/net/sunrpc/auth_gss/gss_spkm3_token.c +++ b/net/sunrpc/auth_gss/gss_spkm3_token.c @@ -259,8 +259,7 @@ spkm3_verify_mic_token(unsigned char **tokp, int *mic_hdrlen, unsigned char **ck ret = GSS_S_COMPLETE; out: - if (spkm3_ctx_id.data) - kfree(spkm3_ctx_id.data); + kfree(spkm3_ctx_id.data); return ret; } diff --git a/net/sunrpc/auth_gss/gss_spkm3_unseal.c b/net/sunrpc/auth_gss/gss_spkm3_unseal.c index c3c0d9586103..241d5b30dfcb 100644 --- a/net/sunrpc/auth_gss/gss_spkm3_unseal.c +++ b/net/sunrpc/auth_gss/gss_spkm3_unseal.c @@ -120,9 +120,7 @@ spkm3_read_token(struct spkm3_ctx *ctx, /* XXX: need to add expiration and sequencing */ ret = GSS_S_COMPLETE; out: - if (md5cksum.data) - kfree(md5cksum.data); - if (wire_cksum.data) - kfree(wire_cksum.data); + kfree(md5cksum.data); + kfree(wire_cksum.data); return ret; } diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index 5a220b2bb376..e4296c8b861e 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c @@ -196,12 +196,9 @@ svc_exit_thread(struct svc_rqst *rqstp) struct svc_serv *serv = rqstp->rq_server; svc_release_buffer(rqstp); - if (rqstp->rq_resp) - kfree(rqstp->rq_resp); - if (rqstp->rq_argp) - kfree(rqstp->rq_argp); - if (rqstp->rq_auth_data) - kfree(rqstp->rq_auth_data); + kfree(rqstp->rq_resp); + kfree(rqstp->rq_argp); + kfree(rqstp->rq_auth_data); kfree(rqstp); /* Release the server */ diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c index 32df43372ee9..aaf08cdd19f0 100644 --- a/net/sunrpc/xdr.c +++ b/net/sunrpc/xdr.c @@ -992,8 +992,7 @@ xdr_xcode_array2(struct xdr_buf *buf, unsigned int base, err = 0; out: - if (elem) - kfree(elem); + kfree(elem); if (ppages) kunmap(*ppages); return err; diff --git a/net/wanrouter/af_wanpipe.c b/net/wanrouter/af_wanpipe.c index 596cb96e5f47..59fec59b2132 100644 --- a/net/wanrouter/af_wanpipe.c +++ b/net/wanrouter/af_wanpipe.c @@ -1099,7 +1099,7 @@ static void release_driver(struct sock *sk) sock_reset_flag(sk, SOCK_ZAPPED); wp = wp_sk(sk); - if (wp && wp->mbox) { + if (wp) { kfree(wp->mbox); wp->mbox = NULL; } @@ -1186,10 +1186,8 @@ static void wanpipe_kill_sock_timer (unsigned long data) return; } - if (wp_sk(sk)) { - kfree(wp_sk(sk)); - wp_sk(sk) = NULL; - } + kfree(wp_sk(sk)); + wp_sk(sk) = NULL; if (atomic_read(&sk->sk_refcnt) != 1) { atomic_set(&sk->sk_refcnt, 1); @@ -1219,10 +1217,8 @@ static void wanpipe_kill_sock_accept (struct sock *sk) sk->sk_socket = NULL; - if (wp_sk(sk)) { - kfree(wp_sk(sk)); - wp_sk(sk) = NULL; - } + kfree(wp_sk(sk)); + wp_sk(sk) = NULL; if (atomic_read(&sk->sk_refcnt) != 1) { atomic_set(&sk->sk_refcnt, 1); @@ -1243,10 +1239,8 @@ static void wanpipe_kill_sock_irq (struct sock *sk) sk->sk_socket = NULL; - if (wp_sk(sk)) { - kfree(wp_sk(sk)); - wp_sk(sk) = NULL; - } + kfree(wp_sk(sk)); + wp_sk(sk) = NULL; if (atomic_read(&sk->sk_refcnt) != 1) { atomic_set(&sk->sk_refcnt, 1); diff --git a/net/wanrouter/wanmain.c b/net/wanrouter/wanmain.c index 13b650ad22e2..bcf7b3faa76a 100644 --- a/net/wanrouter/wanmain.c +++ b/net/wanrouter/wanmain.c @@ -714,10 +714,8 @@ static int wanrouter_device_new_if(struct wan_device *wandev, } /* This code has moved from del_if() function */ - if (dev->priv) { - kfree(dev->priv); - dev->priv = NULL; - } + kfree(dev->priv); + dev->priv = NULL; #ifdef CONFIG_WANPIPE_MULTPPP if (cnf->config_id == WANCONFIG_MPPP) @@ -851,10 +849,8 @@ static int wanrouter_delete_interface(struct wan_device *wandev, char *name) /* Due to new interface linking method using dev->priv, * this code has moved from del_if() function.*/ - if (dev->priv){ - kfree(dev->priv); - dev->priv=NULL; - } + kfree(dev->priv); + dev->priv=NULL; unregister_netdev(dev); diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index 8b9a4747417d..7cf48aa6c95b 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c @@ -62,14 +62,10 @@ static void xfrm_state_gc_destroy(struct xfrm_state *x) { if (del_timer(&x->timer)) BUG(); - if (x->aalg) - kfree(x->aalg); - if (x->ealg) - kfree(x->ealg); - if (x->calg) - kfree(x->calg); - if (x->encap) - kfree(x->encap); + kfree(x->aalg); + kfree(x->ealg); + kfree(x->calg); + kfree(x->encap); if (x->type) { x->type->destructor(x); xfrm_put_type(x->type); -- cgit v1.2.2 From 89f5f0aeed14ac7245f760b0b96c9269c87bcbbe Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Tue, 8 Nov 2005 09:41:56 -0800 Subject: [IPV4]: Fix ip_queue_xmit identity increment for TSO packets When ip_queue_xmit calls ip_select_ident_more for IP identity selection it gives it the wrong packet count for TSO packets. The ip_select_* functions expect one less than the number of packets, so we need to subtract one for TSO packets. This bug was diagnosed and fixed by Tom Young. Signed-off-by: Herbert Xu Signed-off-by: David S. Miller --- net/ipv4/ip_output.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index df7f20da422d..11c2f68254f0 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c @@ -353,7 +353,8 @@ packet_routed: ip_options_build(skb, opt, inet->daddr, rt, 0); } - ip_select_ident_more(iph, &rt->u.dst, sk, skb_shinfo(skb)->tso_segs); + ip_select_ident_more(iph, &rt->u.dst, sk, + (skb_shinfo(skb)->tso_segs ?: 1) - 1); /* Add an IP checksum. */ ip_send_check(iph); -- cgit v1.2.2 From 7ef934b3b73f74aea23aa0e98affe86d7ea816a3 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Tue, 8 Nov 2005 09:57:05 -0800 Subject: [Bluetooth]: Add another ignore parameter to the HCI USB driver This patchs adds the module parameter ignore_dga to the HCI USB driver which makes it possible to prevent this driver from being loaded by some buggy Digianswer devices. Signed-off-by: Marcel Holtmann Signed-off-by: David S. Miller --- drivers/bluetooth/hci_usb.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/bluetooth/hci_usb.c b/drivers/bluetooth/hci_usb.c index f510b25b2c59..057cb2b6e6d1 100644 --- a/drivers/bluetooth/hci_usb.c +++ b/drivers/bluetooth/hci_usb.c @@ -65,6 +65,7 @@ #endif static int ignore = 0; +static int ignore_dga = 0; static int ignore_csr = 0; static int ignore_sniffer = 0; static int reset = 0; @@ -841,6 +842,9 @@ static int hci_usb_probe(struct usb_interface *intf, const struct usb_device_id if (ignore || id->driver_info & HCI_IGNORE) return -ENODEV; + if (ignore_dga && id->driver_info & HCI_DIGIANSWER) + return -ENODEV; + if (ignore_csr && id->driver_info & HCI_CSR) return -ENODEV; @@ -1070,6 +1074,9 @@ module_exit(hci_usb_exit); module_param(ignore, bool, 0644); MODULE_PARM_DESC(ignore, "Ignore devices from the matching table"); +module_param(ignore_dga, bool, 0644); +MODULE_PARM_DESC(ignore_dga, "Ignore devices with id 08fd:0001"); + module_param(ignore_csr, bool, 0644); MODULE_PARM_DESC(ignore_csr, "Ignore devices with id 0a12:0001"); -- cgit v1.2.2 From 1ebb92521d0bc2d4ef772730d29333c06b807191 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Tue, 8 Nov 2005 09:57:21 -0800 Subject: [Bluetooth]: Add endian annotations to the core This patch adds the endian annotations to the Bluetooth core. Signed-off-by: Marcel Holtmann Signed-off-by: David S. Miller --- drivers/bluetooth/bpa10x.c | 4 +- include/net/bluetooth/hci.h | 116 +++++++++++++++++++-------------------- include/net/bluetooth/hci_core.h | 2 +- net/bluetooth/hci_core.c | 2 +- net/bluetooth/hci_event.c | 6 +- net/bluetooth/hci_sock.c | 2 +- 6 files changed, 66 insertions(+), 66 deletions(-) diff --git a/drivers/bluetooth/bpa10x.c b/drivers/bluetooth/bpa10x.c index ecbeb7eaba8e..394796315adc 100644 --- a/drivers/bluetooth/bpa10x.c +++ b/drivers/bluetooth/bpa10x.c @@ -84,8 +84,8 @@ struct bpa10x_data { struct hci_vendor_hdr { __u8 type; - __u16 snum; - __u16 dlen; + __le16 snum; + __le16 dlen; } __attribute__ ((packed)); static void bpa10x_recv_bulk(struct bpa10x_data *data, unsigned char *buf, int count) diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index fa2d12b0579b..b06a2d2f63d2 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -184,10 +184,10 @@ enum { struct hci_rp_read_loc_version { __u8 status; __u8 hci_ver; - __u16 hci_rev; + __le16 hci_rev; __u8 lmp_ver; - __u16 manufacturer; - __u16 lmp_subver; + __le16 manufacturer; + __le16 lmp_subver; } __attribute__ ((packed)); #define OCF_READ_LOCAL_FEATURES 0x0003 @@ -199,10 +199,10 @@ struct hci_rp_read_loc_features { #define OCF_READ_BUFFER_SIZE 0x0005 struct hci_rp_read_buffer_size { __u8 status; - __u16 acl_mtu; + __le16 acl_mtu; __u8 sco_mtu; - __u16 acl_max_pkt; - __u16 sco_max_pkt; + __le16 acl_max_pkt; + __le16 sco_max_pkt; } __attribute__ ((packed)); #define OCF_READ_BD_ADDR 0x0009 @@ -267,21 +267,21 @@ struct hci_cp_write_dev_class { #define OCF_READ_VOICE_SETTING 0x0025 struct hci_rp_read_voice_setting { - __u8 status; - __u16 voice_setting; + __u8 status; + __le16 voice_setting; } __attribute__ ((packed)); #define OCF_WRITE_VOICE_SETTING 0x0026 struct hci_cp_write_voice_setting { - __u16 voice_setting; + __le16 voice_setting; } __attribute__ ((packed)); #define OCF_HOST_BUFFER_SIZE 0x0033 struct hci_cp_host_buffer_size { - __u16 acl_mtu; + __le16 acl_mtu; __u8 sco_mtu; - __u16 acl_max_pkt; - __u16 sco_max_pkt; + __le16 acl_max_pkt; + __le16 sco_max_pkt; } __attribute__ ((packed)); /* Link Control */ @@ -289,10 +289,10 @@ struct hci_cp_host_buffer_size { #define OCF_CREATE_CONN 0x0005 struct hci_cp_create_conn { bdaddr_t bdaddr; - __u16 pkt_type; + __le16 pkt_type; __u8 pscan_rep_mode; __u8 pscan_mode; - __u16 clock_offset; + __le16 clock_offset; __u8 role_switch; } __attribute__ ((packed)); @@ -310,14 +310,14 @@ struct hci_cp_reject_conn_req { #define OCF_DISCONNECT 0x0006 struct hci_cp_disconnect { - __u16 handle; + __le16 handle; __u8 reason; } __attribute__ ((packed)); #define OCF_ADD_SCO 0x0007 struct hci_cp_add_sco { - __u16 handle; - __u16 pkt_type; + __le16 handle; + __le16 pkt_type; } __attribute__ ((packed)); #define OCF_INQUIRY 0x0001 @@ -354,56 +354,56 @@ struct hci_cp_pin_code_neg_reply { #define OCF_CHANGE_CONN_PTYPE 0x000F struct hci_cp_change_conn_ptype { - __u16 handle; - __u16 pkt_type; + __le16 handle; + __le16 pkt_type; } __attribute__ ((packed)); #define OCF_AUTH_REQUESTED 0x0011 struct hci_cp_auth_requested { - __u16 handle; + __le16 handle; } __attribute__ ((packed)); #define OCF_SET_CONN_ENCRYPT 0x0013 struct hci_cp_set_conn_encrypt { - __u16 handle; + __le16 handle; __u8 encrypt; } __attribute__ ((packed)); #define OCF_CHANGE_CONN_LINK_KEY 0x0015 struct hci_cp_change_conn_link_key { - __u16 handle; + __le16 handle; } __attribute__ ((packed)); #define OCF_READ_REMOTE_FEATURES 0x001B struct hci_cp_read_rmt_features { - __u16 handle; + __le16 handle; } __attribute__ ((packed)); #define OCF_READ_REMOTE_VERSION 0x001D struct hci_cp_read_rmt_version { - __u16 handle; + __le16 handle; } __attribute__ ((packed)); /* Link Policy */ #define OGF_LINK_POLICY 0x02 #define OCF_ROLE_DISCOVERY 0x0009 struct hci_cp_role_discovery { - __u16 handle; + __le16 handle; } __attribute__ ((packed)); struct hci_rp_role_discovery { __u8 status; - __u16 handle; + __le16 handle; __u8 role; } __attribute__ ((packed)); #define OCF_READ_LINK_POLICY 0x000C struct hci_cp_read_link_policy { - __u16 handle; + __le16 handle; } __attribute__ ((packed)); struct hci_rp_read_link_policy { __u8 status; - __u16 handle; - __u16 policy; + __le16 handle; + __le16 policy; } __attribute__ ((packed)); #define OCF_SWITCH_ROLE 0x000B @@ -414,12 +414,12 @@ struct hci_cp_switch_role { #define OCF_WRITE_LINK_POLICY 0x000D struct hci_cp_write_link_policy { - __u16 handle; - __u16 policy; + __le16 handle; + __le16 policy; } __attribute__ ((packed)); struct hci_rp_write_link_policy { __u8 status; - __u16 handle; + __le16 handle; } __attribute__ ((packed)); /* Status params */ @@ -441,7 +441,7 @@ struct inquiry_info { __u8 pscan_period_mode; __u8 pscan_mode; __u8 dev_class[3]; - __u16 clock_offset; + __le16 clock_offset; } __attribute__ ((packed)); #define HCI_EV_INQUIRY_RESULT_WITH_RSSI 0x22 @@ -450,7 +450,7 @@ struct inquiry_info_with_rssi { __u8 pscan_rep_mode; __u8 pscan_period_mode; __u8 dev_class[3]; - __u16 clock_offset; + __le16 clock_offset; __s8 rssi; } __attribute__ ((packed)); struct inquiry_info_with_rssi_and_pscan_mode { @@ -459,7 +459,7 @@ struct inquiry_info_with_rssi_and_pscan_mode { __u8 pscan_period_mode; __u8 pscan_mode; __u8 dev_class[3]; - __u16 clock_offset; + __le16 clock_offset; __s8 rssi; } __attribute__ ((packed)); @@ -469,7 +469,7 @@ struct extended_inquiry_info { __u8 pscan_rep_mode; __u8 pscan_period_mode; __u8 dev_class[3]; - __u16 clock_offset; + __le16 clock_offset; __s8 rssi; __u8 data[240]; } __attribute__ ((packed)); @@ -477,7 +477,7 @@ struct extended_inquiry_info { #define HCI_EV_CONN_COMPLETE 0x03 struct hci_ev_conn_complete { __u8 status; - __u16 handle; + __le16 handle; bdaddr_t bdaddr; __u8 link_type; __u8 encr_mode; @@ -493,27 +493,27 @@ struct hci_ev_conn_request { #define HCI_EV_DISCONN_COMPLETE 0x05 struct hci_ev_disconn_complete { __u8 status; - __u16 handle; + __le16 handle; __u8 reason; } __attribute__ ((packed)); #define HCI_EV_AUTH_COMPLETE 0x06 struct hci_ev_auth_complete { __u8 status; - __u16 handle; + __le16 handle; } __attribute__ ((packed)); #define HCI_EV_ENCRYPT_CHANGE 0x08 struct hci_ev_encrypt_change { __u8 status; - __u16 handle; + __le16 handle; __u8 encrypt; } __attribute__ ((packed)); #define HCI_EV_CHANGE_CONN_LINK_KEY_COMPLETE 0x09 struct hci_ev_change_conn_link_key_complete { __u8 status; - __u16 handle; + __le16 handle; } __attribute__ ((packed)); #define HCI_EV_QOS_SETUP_COMPLETE 0x0D @@ -526,21 +526,21 @@ struct hci_qos { } __attribute__ ((packed)); struct hci_ev_qos_setup_complete { __u8 status; - __u16 handle; + __le16 handle; struct hci_qos qos; } __attribute__ ((packed)); #define HCI_EV_CMD_COMPLETE 0x0E struct hci_ev_cmd_complete { __u8 ncmd; - __u16 opcode; + __le16 opcode; } __attribute__ ((packed)); #define HCI_EV_CMD_STATUS 0x0F struct hci_ev_cmd_status { __u8 status; __u8 ncmd; - __u16 opcode; + __le16 opcode; } __attribute__ ((packed)); #define HCI_EV_NUM_COMP_PKTS 0x13 @@ -559,9 +559,9 @@ struct hci_ev_role_change { #define HCI_EV_MODE_CHANGE 0x14 struct hci_ev_mode_change { __u8 status; - __u16 handle; + __le16 handle; __u8 mode; - __u16 interval; + __le16 interval; } __attribute__ ((packed)); #define HCI_EV_PIN_CODE_REQ 0x16 @@ -584,24 +584,24 @@ struct hci_ev_link_key_notify { #define HCI_EV_RMT_FEATURES 0x0B struct hci_ev_rmt_features { __u8 status; - __u16 handle; + __le16 handle; __u8 features[8]; } __attribute__ ((packed)); #define HCI_EV_RMT_VERSION 0x0C struct hci_ev_rmt_version { __u8 status; - __u16 handle; + __le16 handle; __u8 lmp_ver; - __u16 manufacturer; - __u16 lmp_subver; + __le16 manufacturer; + __le16 lmp_subver; } __attribute__ ((packed)); #define HCI_EV_CLOCK_OFFSET 0x01C struct hci_ev_clock_offset { __u8 status; - __u16 handle; - __u16 clock_offset; + __le16 handle; + __le16 clock_offset; } __attribute__ ((packed)); #define HCI_EV_PSCAN_REP_MODE 0x20 @@ -638,7 +638,7 @@ struct hci_ev_si_security { #define HCI_SCO_HDR_SIZE 3 struct hci_command_hdr { - __u16 opcode; /* OCF & OGF */ + __le16 opcode; /* OCF & OGF */ __u8 plen; } __attribute__ ((packed)); @@ -648,22 +648,22 @@ struct hci_event_hdr { } __attribute__ ((packed)); struct hci_acl_hdr { - __u16 handle; /* Handle & Flags(PB, BC) */ - __u16 dlen; + __le16 handle; /* Handle & Flags(PB, BC) */ + __le16 dlen; } __attribute__ ((packed)); struct hci_sco_hdr { - __u16 handle; + __le16 handle; __u8 dlen; } __attribute__ ((packed)); /* Command opcode pack/unpack */ -#define hci_opcode_pack(ogf, ocf) (__u16)((ocf & 0x03ff)|(ogf << 10)) +#define hci_opcode_pack(ogf, ocf) (__u16) ((ocf & 0x03ff)|(ogf << 10)) #define hci_opcode_ogf(op) (op >> 10) #define hci_opcode_ocf(op) (op & 0x03ff) /* ACL handle and flags pack/unpack */ -#define hci_handle_pack(h, f) (__u16)((h & 0x0fff)|(f << 12)) +#define hci_handle_pack(h, f) (__u16) ((h & 0x0fff)|(f << 12)) #define hci_handle(h) (h & 0x0fff) #define hci_flags(h) (h >> 12) diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 7f933f302078..adb94508259b 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -44,7 +44,7 @@ struct inquiry_data { __u8 pscan_period_mode; __u8 pscan_mode; __u8 dev_class[3]; - __u16 clock_offset; + __le16 clock_offset; __s8 rssi; }; diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index cf0df1c8c933..9106354c781e 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -183,7 +183,7 @@ static void hci_reset_req(struct hci_dev *hdev, unsigned long opt) static void hci_init_req(struct hci_dev *hdev, unsigned long opt) { struct sk_buff *skb; - __u16 param; + __le16 param; BT_DBG("%s %ld", hdev->name, opt); diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index b61b4e8e36fd..eb64555d1fb3 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -242,7 +242,7 @@ static void hci_cc_host_ctl(struct hci_dev *hdev, __u16 ocf, struct sk_buff *skb break; status = *((__u8 *) skb->data); - setting = __le16_to_cpu(get_unaligned((__u16 *) sent)); + setting = __le16_to_cpu(get_unaligned((__le16 *) sent)); if (!status && hdev->voice_setting != setting) { hdev->voice_setting = setting; @@ -728,7 +728,7 @@ static inline void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff static inline void hci_num_comp_pkts_evt(struct hci_dev *hdev, struct sk_buff *skb) { struct hci_ev_num_comp_pkts *ev = (struct hci_ev_num_comp_pkts *) skb->data; - __u16 *ptr; + __le16 *ptr; int i; skb_pull(skb, sizeof(*ev)); @@ -742,7 +742,7 @@ static inline void hci_num_comp_pkts_evt(struct hci_dev *hdev, struct sk_buff *s tasklet_disable(&hdev->tx_task); - for (i = 0, ptr = (__u16 *) skb->data; i < ev->num_hndl; i++) { + for (i = 0, ptr = (__le16 *) skb->data; i < ev->num_hndl; i++) { struct hci_conn *conn; __u16 handle, count; diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index 799e448750ad..1d6d0a15c099 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c @@ -416,7 +416,7 @@ static int hci_sock_sendmsg(struct kiocb *iocb, struct socket *sock, skb->dev = (void *) hdev; if (bt_cb(skb)->pkt_type == HCI_COMMAND_PKT) { - u16 opcode = __le16_to_cpu(get_unaligned((u16 *)skb->data)); + u16 opcode = __le16_to_cpu(get_unaligned((__le16 *) skb->data)); u16 ogf = hci_opcode_ogf(opcode); u16 ocf = hci_opcode_ocf(opcode); -- cgit v1.2.2 From be9d122730c878baafe11e70d1436faac229f2fc Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Tue, 8 Nov 2005 09:57:38 -0800 Subject: [Bluetooth]: Remove the usage of /proc completely This patch removes all relics of the /proc usage from the Bluetooth subsystem core and its upper layers. All the previous information are now available via /sys/class/bluetooth through appropriate functions. Signed-off-by: Marcel Holtmann Signed-off-by: David S. Miller --- include/net/bluetooth/bluetooth.h | 4 +- include/net/bluetooth/hci_core.h | 7 --- include/net/bluetooth/rfcomm.h | 2 - net/bluetooth/af_bluetooth.c | 12 +--- net/bluetooth/hci_sysfs.c | 4 +- net/bluetooth/l2cap.c | 98 +++++------------------------- net/bluetooth/rfcomm/core.c | 124 ++++++-------------------------------- net/bluetooth/rfcomm/sock.c | 90 ++++----------------------- net/bluetooth/sco.c | 92 ++++------------------------ 9 files changed, 65 insertions(+), 368 deletions(-) diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index e42d728b1620..911ceb5cd263 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h @@ -57,8 +57,6 @@ #define BT_DBG(fmt, arg...) printk(KERN_INFO "%s: " fmt "\n" , __FUNCTION__ , ## arg) #define BT_ERR(fmt, arg...) printk(KERN_ERR "%s: " fmt "\n" , __FUNCTION__ , ## arg) -extern struct proc_dir_entry *proc_bt; - /* Connection and socket states */ enum { BT_CONNECTED = 1, /* Equal to TCP_ESTABLISHED to make net code happy */ @@ -177,4 +175,6 @@ extern int hci_sock_cleanup(void); extern int bt_sysfs_init(void); extern void bt_sysfs_cleanup(void); +extern struct class bt_class; + #endif /* __BLUETOOTH_H */ diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index adb94508259b..bb9f81dc8723 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -25,7 +25,6 @@ #ifndef __HCI_CORE_H #define __HCI_CORE_H -#include #include /* HCI upper protocols */ @@ -34,8 +33,6 @@ #define HCI_INIT_TIMEOUT (HZ * 10) -extern struct proc_dir_entry *proc_bt_hci; - /* HCI Core structures */ struct inquiry_data { @@ -126,10 +123,6 @@ struct hci_dev { atomic_t promisc; -#ifdef CONFIG_PROC_FS - struct proc_dir_entry *proc; -#endif - struct class_device class_dev; struct module *owner; diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h index e656be7c001a..bbfac86734ec 100644 --- a/include/net/bluetooth/rfcomm.h +++ b/include/net/bluetooth/rfcomm.h @@ -351,6 +351,4 @@ int rfcomm_dev_ioctl(struct sock *sk, unsigned int cmd, void __user *arg); int rfcomm_init_ttys(void); void rfcomm_cleanup_ttys(void); -extern struct proc_dir_entry *proc_bt_rfcomm; - #endif /* __RFCOMM_H */ diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c index 03532062a46a..ea616e3fc98e 100644 --- a/net/bluetooth/af_bluetooth.c +++ b/net/bluetooth/af_bluetooth.c @@ -36,7 +36,6 @@ #include #include #include -#include #include #if defined(CONFIG_KMOD) @@ -50,10 +49,7 @@ #define BT_DBG(D...) #endif -#define VERSION "2.7" - -struct proc_dir_entry *proc_bt; -EXPORT_SYMBOL(proc_bt); +#define VERSION "2.8" /* Bluetooth sockets */ #define BT_MAX_PROTO 8 @@ -312,10 +308,6 @@ static int __init bt_init(void) { BT_INFO("Core ver %s", VERSION); - proc_bt = proc_mkdir("bluetooth", NULL); - if (proc_bt) - proc_bt->owner = THIS_MODULE; - sock_register(&bt_sock_family_ops); BT_INFO("HCI device and connection manager initialized"); @@ -334,8 +326,6 @@ static void __exit bt_exit(void) bt_sysfs_cleanup(); sock_unregister(PF_BLUETOOTH); - - remove_proc_entry("bluetooth", NULL); } subsys_initcall(bt_init); diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c index 7856bc26accb..bd7568ac87fc 100644 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c @@ -103,7 +103,7 @@ static void bt_release(struct class_device *cdev) kfree(hdev); } -static struct class bt_class = { +struct class bt_class = { .name = "bluetooth", .release = bt_release, #ifdef CONFIG_HOTPLUG @@ -111,6 +111,8 @@ static struct class bt_class = { #endif }; +EXPORT_SYMBOL_GPL(bt_class); + int hci_register_sysfs(struct hci_dev *hdev) { struct class_device *cdev = &hdev->class_dev; diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index 59b2dd36baa7..e3bb11ca4235 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c @@ -38,9 +38,8 @@ #include #include #include -#include -#include #include +#include #include #include @@ -56,7 +55,7 @@ #define BT_DBG(D...) #endif -#define VERSION "2.7" +#define VERSION "2.8" static struct proto_ops l2cap_sock_ops; @@ -2137,94 +2136,29 @@ drop: return 0; } -/* ---- Proc fs support ---- */ -#ifdef CONFIG_PROC_FS -static void *l2cap_seq_start(struct seq_file *seq, loff_t *pos) +static ssize_t l2cap_sysfs_show(struct class *dev, char *buf) { struct sock *sk; struct hlist_node *node; - loff_t l = *pos; + char *str = buf; read_lock_bh(&l2cap_sk_list.lock); - sk_for_each(sk, node, &l2cap_sk_list.head) - if (!l--) - goto found; - sk = NULL; -found: - return sk; -} + sk_for_each(sk, node, &l2cap_sk_list.head) { + struct l2cap_pinfo *pi = l2cap_pi(sk); -static void *l2cap_seq_next(struct seq_file *seq, void *e, loff_t *pos) -{ - (*pos)++; - return sk_next(e); -} + str += sprintf(str, "%s %s %d %d 0x%4.4x 0x%4.4x %d %d 0x%x\n", + batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), + sk->sk_state, pi->psm, pi->scid, pi->dcid, pi->imtu, + pi->omtu, pi->link_mode); + } -static void l2cap_seq_stop(struct seq_file *seq, void *e) -{ read_unlock_bh(&l2cap_sk_list.lock); -} -static int l2cap_seq_show(struct seq_file *seq, void *e) -{ - struct sock *sk = e; - struct l2cap_pinfo *pi = l2cap_pi(sk); - - seq_printf(seq, "%s %s %d %d 0x%4.4x 0x%4.4x %d %d 0x%x\n", - batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), - sk->sk_state, pi->psm, pi->scid, pi->dcid, pi->imtu, - pi->omtu, pi->link_mode); - return 0; + return (str - buf); } -static struct seq_operations l2cap_seq_ops = { - .start = l2cap_seq_start, - .next = l2cap_seq_next, - .stop = l2cap_seq_stop, - .show = l2cap_seq_show -}; - -static int l2cap_seq_open(struct inode *inode, struct file *file) -{ - return seq_open(file, &l2cap_seq_ops); -} - -static struct file_operations l2cap_seq_fops = { - .owner = THIS_MODULE, - .open = l2cap_seq_open, - .read = seq_read, - .llseek = seq_lseek, - .release = seq_release, -}; - -static int __init l2cap_proc_init(void) -{ - struct proc_dir_entry *p = create_proc_entry("l2cap", S_IRUGO, proc_bt); - if (!p) - return -ENOMEM; - p->owner = THIS_MODULE; - p->proc_fops = &l2cap_seq_fops; - return 0; -} - -static void __exit l2cap_proc_cleanup(void) -{ - remove_proc_entry("l2cap", proc_bt); -} - -#else /* CONFIG_PROC_FS */ - -static int __init l2cap_proc_init(void) -{ - return 0; -} - -static void __exit l2cap_proc_cleanup(void) -{ - return; -} -#endif /* CONFIG_PROC_FS */ +static CLASS_ATTR(l2cap, S_IRUGO, l2cap_sysfs_show, NULL); static struct proto_ops l2cap_sock_ops = { .family = PF_BLUETOOTH, @@ -2266,7 +2200,7 @@ static struct hci_proto l2cap_hci_proto = { static int __init l2cap_init(void) { int err; - + err = proto_register(&l2cap_proto, 0); if (err < 0) return err; @@ -2284,7 +2218,7 @@ static int __init l2cap_init(void) goto error; } - l2cap_proc_init(); + class_create_file(&bt_class, &class_attr_l2cap); BT_INFO("L2CAP ver %s", VERSION); BT_INFO("L2CAP socket layer initialized"); @@ -2298,7 +2232,7 @@ error: static void __exit l2cap_exit(void) { - l2cap_proc_cleanup(); + class_remove_file(&bt_class, &class_attr_l2cap); if (bt_sock_unregister(BTPROTO_L2CAP) < 0) BT_ERR("L2CAP socket unregistration failed"); diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c index c3d56ead840c..0d89d6434136 100644 --- a/net/bluetooth/rfcomm/core.c +++ b/net/bluetooth/rfcomm/core.c @@ -35,9 +35,8 @@ #include #include #include +#include #include -#include -#include #include #include #include @@ -47,17 +46,13 @@ #include #include -#define VERSION "1.5" +#define VERSION "1.6" #ifndef CONFIG_BT_RFCOMM_DEBUG #undef BT_DBG #define BT_DBG(D...) #endif -#ifdef CONFIG_PROC_FS -struct proc_dir_entry *proc_bt_rfcomm; -#endif - static struct task_struct *rfcomm_thread; static DECLARE_MUTEX(rfcomm_sem); @@ -2001,117 +1996,32 @@ static struct hci_cb rfcomm_cb = { .encrypt_cfm = rfcomm_encrypt_cfm }; -/* ---- Proc fs support ---- */ -#ifdef CONFIG_PROC_FS -static void *rfcomm_seq_start(struct seq_file *seq, loff_t *pos) +static ssize_t rfcomm_dlc_sysfs_show(struct class *dev, char *buf) { struct rfcomm_session *s; struct list_head *pp, *p; - loff_t l = *pos; + char *str = buf; rfcomm_lock(); list_for_each(p, &session_list) { s = list_entry(p, struct rfcomm_session, list); - list_for_each(pp, &s->dlcs) - if (!l--) { - seq->private = s; - return pp; - } - } - return NULL; -} + list_for_each(pp, &s->dlcs) { + struct sock *sk = s->sock->sk; + struct rfcomm_dlc *d = list_entry(pp, struct rfcomm_dlc, list); -static void *rfcomm_seq_next(struct seq_file *seq, void *e, loff_t *pos) -{ - struct rfcomm_session *s = seq->private; - struct list_head *pp, *p = e; - (*pos)++; - - if (p->next != &s->dlcs) - return p->next; - - list_for_each(p, &session_list) { - s = list_entry(p, struct rfcomm_session, list); - __list_for_each(pp, &s->dlcs) { - seq->private = s; - return pp; + str += sprintf(str, "%s %s %ld %d %d %d %d\n", + batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), + d->state, d->dlci, d->mtu, d->rx_credits, d->tx_credits); } } - return NULL; -} -static void rfcomm_seq_stop(struct seq_file *seq, void *e) -{ rfcomm_unlock(); -} - -static int rfcomm_seq_show(struct seq_file *seq, void *e) -{ - struct rfcomm_session *s = seq->private; - struct sock *sk = s->sock->sk; - struct rfcomm_dlc *d = list_entry(e, struct rfcomm_dlc, list); - - seq_printf(seq, "%s %s %ld %d %d %d %d\n", - batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), - d->state, d->dlci, d->mtu, d->rx_credits, d->tx_credits); - return 0; -} - -static struct seq_operations rfcomm_seq_ops = { - .start = rfcomm_seq_start, - .next = rfcomm_seq_next, - .stop = rfcomm_seq_stop, - .show = rfcomm_seq_show -}; - -static int rfcomm_seq_open(struct inode *inode, struct file *file) -{ - return seq_open(file, &rfcomm_seq_ops); -} - -static struct file_operations rfcomm_seq_fops = { - .owner = THIS_MODULE, - .open = rfcomm_seq_open, - .read = seq_read, - .llseek = seq_lseek, - .release = seq_release, -}; - -static int __init rfcomm_proc_init(void) -{ - struct proc_dir_entry *p; - - proc_bt_rfcomm = proc_mkdir("rfcomm", proc_bt); - if (proc_bt_rfcomm) { - proc_bt_rfcomm->owner = THIS_MODULE; - - p = create_proc_entry("dlc", S_IRUGO, proc_bt_rfcomm); - if (p) - p->proc_fops = &rfcomm_seq_fops; - } - return 0; -} - -static void __exit rfcomm_proc_cleanup(void) -{ - remove_proc_entry("dlc", proc_bt_rfcomm); - remove_proc_entry("rfcomm", proc_bt); + return (str - buf); } -#else /* CONFIG_PROC_FS */ - -static int __init rfcomm_proc_init(void) -{ - return 0; -} - -static void __exit rfcomm_proc_cleanup(void) -{ - return; -} -#endif /* CONFIG_PROC_FS */ +static CLASS_ATTR(rfcomm_dlc, S_IRUGO, rfcomm_dlc_sysfs_show, NULL); /* ---- Initialization ---- */ static int __init rfcomm_init(void) @@ -2122,9 +2032,7 @@ static int __init rfcomm_init(void) kernel_thread(rfcomm_run, NULL, CLONE_KERNEL); - BT_INFO("RFCOMM ver %s", VERSION); - - rfcomm_proc_init(); + class_create_file(&bt_class, &class_attr_rfcomm_dlc); rfcomm_init_sockets(); @@ -2132,11 +2040,15 @@ static int __init rfcomm_init(void) rfcomm_init_ttys(); #endif + BT_INFO("RFCOMM ver %s", VERSION); + return 0; } static void __exit rfcomm_exit(void) { + class_remove_file(&bt_class, &class_attr_rfcomm_dlc); + hci_unregister_cb(&rfcomm_cb); /* Terminate working thread. @@ -2153,8 +2065,6 @@ static void __exit rfcomm_exit(void) #endif rfcomm_cleanup_sockets(); - - rfcomm_proc_cleanup(); } module_init(rfcomm_init); diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c index a2b30f0aedb7..6c34261b232e 100644 --- a/net/bluetooth/rfcomm/sock.c +++ b/net/bluetooth/rfcomm/sock.c @@ -42,8 +42,7 @@ #include #include #include -#include -#include +#include #include #include @@ -887,89 +886,26 @@ done: return result; } -/* ---- Proc fs support ---- */ -#ifdef CONFIG_PROC_FS -static void *rfcomm_seq_start(struct seq_file *seq, loff_t *pos) +static ssize_t rfcomm_sock_sysfs_show(struct class *dev, char *buf) { struct sock *sk; struct hlist_node *node; - loff_t l = *pos; + char *str = buf; read_lock_bh(&rfcomm_sk_list.lock); - sk_for_each(sk, node, &rfcomm_sk_list.head) - if (!l--) - return sk; - return NULL; -} - -static void *rfcomm_seq_next(struct seq_file *seq, void *e, loff_t *pos) -{ - struct sock *sk = e; - (*pos)++; - return sk_next(sk); -} + sk_for_each(sk, node, &rfcomm_sk_list.head) { + str += sprintf(str, "%s %s %d %d\n", + batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), + sk->sk_state, rfcomm_pi(sk)->channel); + } -static void rfcomm_seq_stop(struct seq_file *seq, void *e) -{ read_unlock_bh(&rfcomm_sk_list.lock); -} -static int rfcomm_seq_show(struct seq_file *seq, void *e) -{ - struct sock *sk = e; - seq_printf(seq, "%s %s %d %d\n", - batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), - sk->sk_state, rfcomm_pi(sk)->channel); - return 0; -} - -static struct seq_operations rfcomm_seq_ops = { - .start = rfcomm_seq_start, - .next = rfcomm_seq_next, - .stop = rfcomm_seq_stop, - .show = rfcomm_seq_show -}; - -static int rfcomm_seq_open(struct inode *inode, struct file *file) -{ - return seq_open(file, &rfcomm_seq_ops); + return (str - buf); } -static struct file_operations rfcomm_seq_fops = { - .owner = THIS_MODULE, - .open = rfcomm_seq_open, - .read = seq_read, - .llseek = seq_lseek, - .release = seq_release, -}; - -static int __init rfcomm_sock_proc_init(void) -{ - struct proc_dir_entry *p = create_proc_entry("sock", S_IRUGO, proc_bt_rfcomm); - if (!p) - return -ENOMEM; - p->proc_fops = &rfcomm_seq_fops; - return 0; -} - -static void __exit rfcomm_sock_proc_cleanup(void) -{ - remove_proc_entry("sock", proc_bt_rfcomm); -} - -#else /* CONFIG_PROC_FS */ - -static int __init rfcomm_sock_proc_init(void) -{ - return 0; -} - -static void __exit rfcomm_sock_proc_cleanup(void) -{ - return; -} -#endif /* CONFIG_PROC_FS */ +static CLASS_ATTR(rfcomm, S_IRUGO, rfcomm_sock_sysfs_show, NULL); static struct proto_ops rfcomm_sock_ops = { .family = PF_BLUETOOTH, @@ -997,7 +933,7 @@ static struct net_proto_family rfcomm_sock_family_ops = { .create = rfcomm_sock_create }; -int __init rfcomm_init_sockets(void) +int __init rfcomm_init_sockets(void) { int err; @@ -1009,7 +945,7 @@ int __init rfcomm_init_sockets(void) if (err < 0) goto error; - rfcomm_sock_proc_init(); + class_create_file(&bt_class, &class_attr_rfcomm); BT_INFO("RFCOMM socket layer initialized"); @@ -1023,7 +959,7 @@ error: void __exit rfcomm_cleanup_sockets(void) { - rfcomm_sock_proc_cleanup(); + class_remove_file(&bt_class, &class_attr_rfcomm); if (bt_sock_unregister(BTPROTO_RFCOMM) < 0) BT_ERR("RFCOMM socket layer unregistration failed"); diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c index 997e42df115c..9cb00dc6c08c 100644 --- a/net/bluetooth/sco.c +++ b/net/bluetooth/sco.c @@ -38,8 +38,7 @@ #include #include #include -#include -#include +#include #include #include @@ -55,7 +54,7 @@ #define BT_DBG(D...) #endif -#define VERSION "0.4" +#define VERSION "0.5" static struct proto_ops sco_sock_ops; @@ -893,91 +892,26 @@ drop: return 0; } -/* ---- Proc fs support ---- */ -#ifdef CONFIG_PROC_FS -static void *sco_seq_start(struct seq_file *seq, loff_t *pos) +static ssize_t sco_sysfs_show(struct class *dev, char *buf) { struct sock *sk; struct hlist_node *node; - loff_t l = *pos; + char *str = buf; read_lock_bh(&sco_sk_list.lock); - sk_for_each(sk, node, &sco_sk_list.head) - if (!l--) - goto found; - sk = NULL; -found: - return sk; -} - -static void *sco_seq_next(struct seq_file *seq, void *e, loff_t *pos) -{ - struct sock *sk = e; - (*pos)++; - return sk_next(sk); -} + sk_for_each(sk, node, &sco_sk_list.head) { + str += sprintf(str, "%s %s %d\n", + batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), + sk->sk_state); + } -static void sco_seq_stop(struct seq_file *seq, void *e) -{ read_unlock_bh(&sco_sk_list.lock); -} - -static int sco_seq_show(struct seq_file *seq, void *e) -{ - struct sock *sk = e; - seq_printf(seq, "%s %s %d\n", - batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), sk->sk_state); - return 0; -} -static struct seq_operations sco_seq_ops = { - .start = sco_seq_start, - .next = sco_seq_next, - .stop = sco_seq_stop, - .show = sco_seq_show -}; - -static int sco_seq_open(struct inode *inode, struct file *file) -{ - return seq_open(file, &sco_seq_ops); + return (str - buf); } -static struct file_operations sco_seq_fops = { - .owner = THIS_MODULE, - .open = sco_seq_open, - .read = seq_read, - .llseek = seq_lseek, - .release = seq_release, -}; - -static int __init sco_proc_init(void) -{ - struct proc_dir_entry *p = create_proc_entry("sco", S_IRUGO, proc_bt); - if (!p) - return -ENOMEM; - p->owner = THIS_MODULE; - p->proc_fops = &sco_seq_fops; - return 0; -} - -static void __exit sco_proc_cleanup(void) -{ - remove_proc_entry("sco", proc_bt); -} - -#else /* CONFIG_PROC_FS */ - -static int __init sco_proc_init(void) -{ - return 0; -} - -static void __exit sco_proc_cleanup(void) -{ - return; -} -#endif /* CONFIG_PROC_FS */ +static CLASS_ATTR(sco, S_IRUGO, sco_sysfs_show, NULL); static struct proto_ops sco_sock_ops = { .family = PF_BLUETOOTH, @@ -1035,7 +969,7 @@ static int __init sco_init(void) goto error; } - sco_proc_init(); + class_create_file(&bt_class, &class_attr_sco); BT_INFO("SCO (Voice Link) ver %s", VERSION); BT_INFO("SCO socket layer initialized"); @@ -1049,7 +983,7 @@ error: static void __exit sco_exit(void) { - sco_proc_cleanup(); + class_remove_file(&bt_class, &class_attr_sco); if (bt_sock_unregister(BTPROTO_SCO) < 0) BT_ERR("SCO socket unregistration failed"); -- cgit v1.2.2 From d5a858bc148fe97996af9cf685cc124b70519adf Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Tue, 8 Nov 2005 10:00:13 -0800 Subject: [SPARC]: Missing compat_ioctl hookup in openprom driver. Signed-off-by: David S. Miller --- drivers/sbus/char/openprom.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/sbus/char/openprom.c b/drivers/sbus/char/openprom.c index 5028ac214326..383a95f34a0d 100644 --- a/drivers/sbus/char/openprom.c +++ b/drivers/sbus/char/openprom.c @@ -596,6 +596,8 @@ static long openprom_compat_ioctl(struct file *file, unsigned int cmd, lock_kernel(); break; } + + return rval; } static int openprom_open(struct inode * inode, struct file * file) @@ -623,6 +625,7 @@ static struct file_operations openprom_fops = { .owner = THIS_MODULE, .llseek = no_llseek, .ioctl = openprom_ioctl, + .compat_ioctl = openprom_compat_ioctl, .open = openprom_open, .release = openprom_release, }; -- cgit v1.2.2 From da1605465ebdb9dc25296a354394086cd559c243 Mon Sep 17 00:00:00 2001 From: Hugh Dickins Date: Tue, 8 Nov 2005 10:00:55 -0800 Subject: [SPARC64] mm: update get_user_insn comment Update comment on get_user_insn to the more general "pte lock", which may or may not be the page_table_lock. Note vmtruncate handled like kswapd. Signed-off-by: Hugh Dickins Signed-off-by: David S. Miller --- arch/sparc64/mm/fault.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/sparc64/mm/fault.c b/arch/sparc64/mm/fault.c index 31fbc67719a1..3be278d916db 100644 --- a/arch/sparc64/mm/fault.c +++ b/arch/sparc64/mm/fault.c @@ -109,7 +109,7 @@ static void bad_kernel_pc(struct pt_regs *regs) * this. Additionally, to prevent kswapd from ripping ptes from * under us, raise interrupts around the time that we look at the * pte, kswapd will have to wait to get his smp ipi response from - * us. This saves us having to get page_table_lock. + * us. vmtruncate likewise. This saves us having to get pte lock. */ static unsigned int get_user_insn(unsigned long tpc) { -- cgit v1.2.2 From 56f87b82171245a81a5dbac5e703d3941d80da49 Mon Sep 17 00:00:00 2001 From: Russ Anderson Date: Fri, 4 Nov 2005 13:57:00 -0600 Subject: [IA64] MCA recovery: pfn_valid() needs a pfn paddr needs to be shifted by PAGE_SHIFT to be valid input for pfn_valid(). Signed-off-by: Russ Anderson Signed-off-by: Tony Luck --- arch/ia64/kernel/mca_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/ia64/kernel/mca_drv.c b/arch/ia64/kernel/mca_drv.c index f081c60ab206..6ff32d4faf81 100644 --- a/arch/ia64/kernel/mca_drv.c +++ b/arch/ia64/kernel/mca_drv.c @@ -88,7 +88,7 @@ mca_page_isolate(unsigned long paddr) if (!ia64_phys_addr_valid(paddr)) return ISOLATE_NONE; - if (!pfn_valid(paddr)) + if (!pfn_valid(paddr >> PAGE_SHIFT)) return ISOLATE_NONE; /* convert physical address to physical page number */ -- cgit v1.2.2 From cbb921443424fb8019e52bae83e442d01f7715ef Mon Sep 17 00:00:00 2001 From: Russ Anderson Date: Fri, 4 Nov 2005 16:58:28 -0600 Subject: [IA64] MCA recovery: Bump reference count on bad pages When a page has a memory uncorrectable ECC error, the recovery code wants to prevent the page from being reused. This change bumps the reference count to prevent the page from getting back on the free list. Signed-off-by: Russ Anderson (rja@sgi.com) Signed-off-by: Tony Luck --- arch/ia64/kernel/mca_drv.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/ia64/kernel/mca_drv.c b/arch/ia64/kernel/mca_drv.c index 6ff32d4faf81..eb39bc9c133b 100644 --- a/arch/ia64/kernel/mca_drv.c +++ b/arch/ia64/kernel/mca_drv.c @@ -108,6 +108,7 @@ mca_page_isolate(unsigned long paddr) return ISOLATE_NG; /* add attribute 'Reserved' and register the page */ + get_page(p); SetPageReserved(p); page_isolate[num_page_isolate++] = p; -- cgit v1.2.2 From 6fb93a92ec2a012fa525499c330522bbb8c18d80 Mon Sep 17 00:00:00 2001 From: Mark Maule Date: Mon, 7 Nov 2005 15:48:50 -0600 Subject: [IA64] altix: misc pci interrupt related fixes Fix a couple of altix interrupt related bugs. Signed-off-by: Mark Maule Signed-off-by: Tony Luck --- arch/ia64/sn/pci/pcibr/pcibr_provider.c | 4 ++-- arch/ia64/sn/pci/pcibr/pcibr_reg.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/ia64/sn/pci/pcibr/pcibr_provider.c b/arch/ia64/sn/pci/pcibr/pcibr_provider.c index 7b03b8084ffc..1f500c81002c 100644 --- a/arch/ia64/sn/pci/pcibr/pcibr_provider.c +++ b/arch/ia64/sn/pci/pcibr/pcibr_provider.c @@ -212,13 +212,13 @@ void pcibr_target_interrupt(struct sn_irq_info *sn_irq_info) pdi_pcibus_info; /* Disable the device's IRQ */ - pcireg_intr_enable_bit_clr(pcibus_info, bit); + pcireg_intr_enable_bit_clr(pcibus_info, (1 << bit)); /* Change the device's IRQ */ pcireg_intr_addr_addr_set(pcibus_info, bit, xtalk_addr); /* Re-enable the device's IRQ */ - pcireg_intr_enable_bit_set(pcibus_info, bit); + pcireg_intr_enable_bit_set(pcibus_info, (1 << bit)); pcibr_force_interrupt(sn_irq_info); } diff --git a/arch/ia64/sn/pci/pcibr/pcibr_reg.c b/arch/ia64/sn/pci/pcibr/pcibr_reg.c index 4f718c3e93d3..5d534091262c 100644 --- a/arch/ia64/sn/pci/pcibr/pcibr_reg.c +++ b/arch/ia64/sn/pci/pcibr/pcibr_reg.c @@ -131,7 +131,7 @@ void pcireg_intr_enable_bit_clr(struct pcibus_info *pcibus_info, uint64_t bits) __sn_clrq_relaxed(&ptr->tio.cp_int_enable, bits); break; case PCIBR_BRIDGETYPE_PIC: - __sn_clrq_relaxed(&ptr->pic.p_int_enable, ~bits); + __sn_clrq_relaxed(&ptr->pic.p_int_enable, bits); break; default: panic -- cgit v1.2.2 From 37ee16ae93a3e4ae7dd51beb81d249f5f12a55c2 Mon Sep 17 00:00:00 2001 From: Russell King Date: Tue, 8 Nov 2005 19:08:05 +0000 Subject: [ARM SMP] Add core ARM support for local timers Add infrastructure for supporting per-cpu local timers to update the profiling information and update system time accounting. Signed-off-by: Russell King --- arch/arm/Kconfig | 10 ++++++++++ arch/arm/kernel/entry-armv.S | 7 +++++++ arch/arm/kernel/irq.c | 1 + arch/arm/kernel/smp.c | 34 ++++++++++++++++++++++++++++++++++ include/asm-arm/hardirq.h | 1 + include/asm-arm/smp.h | 38 ++++++++++++++++++++++++++++++++++++++ 6 files changed, 91 insertions(+) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 91d5ef3397be..3bfef0934c9d 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -356,6 +356,16 @@ config HOTPLUG_CPU Say Y here to experiment with turning CPUs off and on. CPUs can be controlled through /sys/devices/system/cpu. +config LOCAL_TIMERS + bool "Use local timer interrupts" + depends on SMP && n + default y + help + Enable support for local timers on SMP platforms, rather then the + legacy IPI broadcast method. Local timers allows the system + accounting to be spread across the timer interval, preventing a + "thundering herd" at every timer tick. + config PREEMPT bool "Preemptible Kernel (EXPERIMENTAL)" depends on EXPERIMENTAL diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S index a511ec5b11a3..d9fb819bf7cc 100644 --- a/arch/arm/kernel/entry-armv.S +++ b/arch/arm/kernel/entry-armv.S @@ -47,6 +47,13 @@ movne r0, sp adrne lr, 1b bne do_IPI + +#ifdef CONFIG_LOCAL_TIMERS + test_for_ltirq r0, r6, r5, lr + movne r0, sp + adrne lr, 1b + bne do_local_timer +#endif #endif .endm diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c index 6f86d0af7c56..d7099dbbb879 100644 --- a/arch/arm/kernel/irq.c +++ b/arch/arm/kernel/irq.c @@ -264,6 +264,7 @@ unlock: #endif #ifdef CONFIG_SMP show_ipi_list(p); + show_local_irqs(p); #endif seq_printf(p, "Err: %10lu\n", irq_err_count); } diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index f5fc57e0fe41..77e2e9ca89fa 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c @@ -184,6 +184,11 @@ int __cpuexit __cpu_disable(void) */ migrate_irqs(); + /* + * Stop the local timer for this CPU. + */ + local_timer_stop(cpu); + /* * Flush user cache and TLB mappings, and then remove this CPU * from the vm mask set of all processes. @@ -289,6 +294,11 @@ asmlinkage void __cpuinit secondary_start_kernel(void) */ cpu_set(cpu, cpu_online_map); + /* + * Setup local timer for this CPU. + */ + local_timer_setup(cpu); + /* * OK, it's off to the idle thread for us */ @@ -454,6 +464,18 @@ void show_ipi_list(struct seq_file *p) seq_putc(p, '\n'); } +void show_local_irqs(struct seq_file *p) +{ + unsigned int cpu; + + seq_printf(p, "LOC: "); + + for_each_present_cpu(cpu) + seq_printf(p, "%10u ", irq_stat[cpu].local_timer_irqs); + + seq_putc(p, '\n'); +} + static void ipi_timer(struct pt_regs *regs) { int user = user_mode(regs); @@ -464,6 +486,18 @@ static void ipi_timer(struct pt_regs *regs) irq_exit(); } +#ifdef CONFIG_LOCAL_TIMERS +asmlinkage void do_local_timer(struct pt_regs *regs) +{ + int cpu = smp_processor_id(); + + if (local_timer_ack()) { + irq_stat[cpu].local_timer_irqs++; + ipi_timer(regs); + } +} +#endif + /* * ipi_call_function - handle IPI from smp_call_function() * diff --git a/include/asm-arm/hardirq.h b/include/asm-arm/hardirq.h index e5ccb6b8ff83..1cbb173bf5b1 100644 --- a/include/asm-arm/hardirq.h +++ b/include/asm-arm/hardirq.h @@ -8,6 +8,7 @@ typedef struct { unsigned int __softirq_pending; + unsigned int local_timer_irqs; } ____cacheline_aligned irq_cpustat_t; #include /* Standard mappings for irq_cpustat_t above */ diff --git a/include/asm-arm/smp.h b/include/asm-arm/smp.h index 52e7c8d830b2..5a72e50ca9fc 100644 --- a/include/asm-arm/smp.h +++ b/include/asm-arm/smp.h @@ -92,4 +92,42 @@ extern void platform_cpu_die(unsigned int cpu); extern int platform_cpu_kill(unsigned int cpu); extern void platform_cpu_enable(unsigned int cpu); +#ifdef CONFIG_LOCAL_TIMERS +/* + * Setup a local timer interrupt for a CPU. + */ +extern void local_timer_setup(unsigned int cpu); + +/* + * Stop a local timer interrupt. + */ +extern void local_timer_stop(unsigned int cpu); + +/* + * Platform provides this to acknowledge a local timer IRQ + */ +extern int local_timer_ack(void); + +#else + +static inline void local_timer_setup(unsigned int cpu) +{ +} + +static inline void local_timer_stop(unsigned int cpu) +{ +} + +#endif + +/* + * show local interrupt info + */ +extern void show_local_irqs(struct seq_file *); + +/* + * Called from assembly, this is the local timer IRQ handler + */ +asmlinkage void do_local_timer(struct pt_regs *); + #endif /* ifndef __ASM_ARM_SMP_H */ -- cgit v1.2.2 From a93876c16275376c4f9f1630ce24036d329fa7a0 Mon Sep 17 00:00:00 2001 From: Dirk Opfer Date: Tue, 8 Nov 2005 19:15:30 +0000 Subject: [ARM] 3123/1: Sharp SL-6000x: Add IRDA, MMC, UDC and keyboard device Patch from Dirk Opfer This patch adds MMC, IRDA and UDC support to the Sharp SL-6000x device. Also it adds a platform device for the keyboard driver. Signed-off-by: Dirk Opfer Signed-off-by: Richard Purdie Signed-off-by: Russell King --- arch/arm/mach-pxa/tosa.c | 117 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 116 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c index 400609f8b6a8..f3e01891e851 100644 --- a/arch/arm/mach-pxa/tosa.c +++ b/arch/arm/mach-pxa/tosa.c @@ -111,16 +111,128 @@ static struct scoop_pcmcia_dev tosa_pcmcia_scoop[] = { }, }; +/* + * USB Device Controller + */ +static void tosa_udc_command(int cmd) +{ + switch(cmd) { + case PXA2XX_UDC_CMD_CONNECT: + set_scoop_gpio(&tosascoop_jc_device.dev,TOSA_SCOOP_JC_USB_PULLUP); + break; + case PXA2XX_UDC_CMD_DISCONNECT: + reset_scoop_gpio(&tosascoop_jc_device.dev,TOSA_SCOOP_JC_USB_PULLUP); + break; + } +} + +static int tosa_udc_is_connected(void) +{ + return ((GPLR(TOSA_GPIO_USB_IN) & GPIO_bit(TOSA_GPIO_USB_IN)) == 0); +} + + +static struct pxa2xx_udc_mach_info udc_info __initdata = { + .udc_command = tosa_udc_command, + .udc_is_connected = tosa_udc_is_connected, +}; + +/* + * MMC/SD Device + */ +static struct pxamci_platform_data tosa_mci_platform_data; + +static int tosa_mci_init(struct device *dev, irqreturn_t (*tosa_detect_int)(int, void *, struct pt_regs *), void *data) +{ + int err; + + /* setup GPIO for PXA25x MMC controller */ + pxa_gpio_mode(GPIO6_MMCCLK_MD); + pxa_gpio_mode(GPIO8_MMCCS0_MD); + pxa_gpio_mode(TOSA_GPIO_nSD_DETECT | GPIO_IN); + + tosa_mci_platform_data.detect_delay = msecs_to_jiffies(250); + + err = request_irq(TOSA_IRQ_GPIO_nSD_DETECT, tosa_detect_int, SA_INTERRUPT, + "MMC/SD card detect", data); + if (err) { + printk(KERN_ERR "tosa_mci_init: MMC/SD: can't request MMC card detect IRQ\n"); + return -1; + } + + set_irq_type(TOSA_IRQ_GPIO_nSD_DETECT, IRQT_BOTHEDGE); + + return 0; +} + +static void tosa_mci_setpower(struct device *dev, unsigned int vdd) +{ + struct pxamci_platform_data* p_d = dev->platform_data; + + if (( 1 << vdd) & p_d->ocr_mask) { + set_scoop_gpio(&tosascoop_device.dev,TOSA_SCOOP_PWR_ON); + } else { + reset_scoop_gpio(&tosascoop_device.dev,TOSA_SCOOP_PWR_ON); + } +} + +static int tosa_mci_get_ro(struct device *dev) +{ + return (read_scoop_reg(&tosascoop_device.dev, SCOOP_GPWR)&TOSA_SCOOP_SD_WP); +} + +static void tosa_mci_exit(struct device *dev, void *data) +{ + free_irq(TOSA_IRQ_GPIO_nSD_DETECT, data); +} + +static struct pxamci_platform_data tosa_mci_platform_data = { + .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, + .init = tosa_mci_init, + .get_ro = tosa_mci_get_ro, + .setpower = tosa_mci_setpower, + .exit = tosa_mci_exit, +}; + +/* + * Irda + */ +static void tosa_irda_transceiver_mode(struct device *dev, int mode) +{ + if (mode & IR_OFF) { + reset_scoop_gpio(&tosascoop_device.dev,TOSA_SCOOP_IR_POWERDWN); + pxa_gpio_mode(GPIO47_STTXD|GPIO_DFLT_LOW); + pxa_gpio_mode(GPIO47_STTXD|GPIO_OUT); + } else { + pxa_gpio_mode(GPIO47_STTXD_MD); + set_scoop_gpio(&tosascoop_device.dev,TOSA_SCOOP_IR_POWERDWN); + } +} + +static struct pxaficp_platform_data tosa_ficp_platform_data = { + .transceiver_cap = IR_SIRMODE | IR_OFF, + .transceiver_mode = tosa_irda_transceiver_mode, +}; + +/* + * Tosa Keyboard + */ +static struct platform_device tosakbd_device = { + .name = "tosa-keyboard", + .id = -1, +}; static struct platform_device *devices[] __initdata = { &tosascoop_device, &tosascoop_jc_device, + &tosakbd_device, }; static void __init tosa_init(void) { pxa_gpio_mode(TOSA_GPIO_ON_RESET | GPIO_IN); pxa_gpio_mode(TOSA_GPIO_TC6393_INT | GPIO_IN); + pxa_gpio_mode(TOSA_GPIO_USB_IN | GPIO_IN); /* setup sleep mode values */ PWER = 0x00000002; @@ -131,9 +243,12 @@ static void __init tosa_init(void) PGSR2 = 0x00014000; PCFR |= PCFR_OPDE; - // enable batt_fault + /* enable batt_fault */ PMCR = 0x01; + pxa_set_mci_info(&tosa_mci_platform_data); + pxa_set_udc_info(&udc_info); + pxa_set_ficp_info(&tosa_ficp_platform_data); platform_add_devices(devices, ARRAY_SIZE(devices)); scoop_num = 2; -- cgit v1.2.2 From df1ec6deeb18097ae670bf6d001b6e95c8332640 Mon Sep 17 00:00:00 2001 From: Ben Dooks Date: Tue, 8 Nov 2005 19:15:30 +0000 Subject: [ARM] 3125/2: VR1000: Fix map_decs initialiser Patch from Ben Dooks Fix the initialisation of the map_desc fields in the Thorcom VR1000 machine support to use the new .pfn initialiser. Signed-off-by: Ben Dooks Signed-off-by: Russell King --- arch/arm/mach-s3c2410/mach-vr1000.c | 56 +++++++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 18 deletions(-) diff --git a/arch/arm/mach-s3c2410/mach-vr1000.c b/arch/arm/mach-s3c2410/mach-vr1000.c index 46b259673c18..ae7e099bf6c8 100644 --- a/arch/arm/mach-s3c2410/mach-vr1000.c +++ b/arch/arm/mach-s3c2410/mach-vr1000.c @@ -74,27 +74,47 @@ /* macros to modify the physical addresses for io space */ -#define PA_CS2(item) ((item) + S3C2410_CS2) -#define PA_CS3(item) ((item) + S3C2410_CS3) -#define PA_CS4(item) ((item) + S3C2410_CS4) -#define PA_CS5(item) ((item) + S3C2410_CS5) +#define PA_CS2(item) (__phys_to_pfn((item) + S3C2410_CS2)) +#define PA_CS3(item) (__phys_to_pfn((item) + S3C2410_CS3)) +#define PA_CS4(item) (__phys_to_pfn((item) + S3C2410_CS4)) +#define PA_CS5(item) (__phys_to_pfn((item) + S3C2410_CS5)) static struct map_desc vr1000_iodesc[] __initdata = { /* ISA IO areas */ - - { (u32)S3C24XX_VA_ISA_BYTE, PA_CS2(BAST_PA_ISAIO), SZ_16M, MT_DEVICE }, - { (u32)S3C24XX_VA_ISA_WORD, PA_CS3(BAST_PA_ISAIO), SZ_16M, MT_DEVICE }, - - /* we could possibly compress the next set down into a set of smaller tables - * pagetables, but that would mean using an L2 section, and it still means - * we cannot actually feed the same register to an LDR due to 16K spacing - */ - - /* bast CPLD control registers, and external interrupt controls */ - { (u32)VR1000_VA_CTRL1, VR1000_PA_CTRL1, SZ_1M, MT_DEVICE }, - { (u32)VR1000_VA_CTRL2, VR1000_PA_CTRL2, SZ_1M, MT_DEVICE }, - { (u32)VR1000_VA_CTRL3, VR1000_PA_CTRL3, SZ_1M, MT_DEVICE }, - { (u32)VR1000_VA_CTRL4, VR1000_PA_CTRL4, SZ_1M, MT_DEVICE }, + { + .virtual = (u32)S3C24XX_VA_ISA_BYTE, + .pfn = PA_CS2(BAST_PA_ISAIO), + .length = SZ_16M, + .type = MT_DEVICE, + }, { + .virtual = (u32)S3C24XX_VA_ISA_WORD, + .pfn = PA_CS3(BAST_PA_ISAIO), + .length = SZ_16M, + .type = MT_DEVICE, + }, + + /* CPLD control registers, and external interrupt controls */ + { + .virtual = (u32)VR1000_VA_CTRL1, + .pfn = __phys_to_pfn(VR1000_PA_CTRL1), + .length = SZ_1M, + .type = MT_DEVICE, + }, { + .virtual = (u32)VR1000_VA_CTRL2, + .pfn = __phys_to_pfn(VR1000_PA_CTRL2), + .length = SZ_1M, + .type = MT_DEVICE, + }, { + .virtual = (u32)VR1000_VA_CTRL3, + .pfn = __phys_to_pfn(VR1000_PA_CTRL3), + .length = SZ_1M, + .type = MT_DEVICE, + }, { + .virtual = (u32)VR1000_VA_CTRL4, + .pfn = __phys_to_pfn(VR1000_PA_CTRL4), + .length = SZ_1M, + .type = MT_DEVICE, + }, /* peripheral space... one for each of fast/slow/byte/16bit */ /* note, ide is only decoded in word space, even though some registers -- cgit v1.2.2 From 1d23b65de54c35844e82bdb08bc85d8142e310ea Mon Sep 17 00:00:00 2001 From: Ben Dooks Date: Tue, 8 Nov 2005 19:15:31 +0000 Subject: [ARM] 3126/1: BAST: fix map_desc initialisation Patch from Ben Dooks Fix the map_desc entries to use the new .pfn initialiser for the Simtec BAST machine support. Signed-off-by: Ben Dooks Signed-off-by: Russell King --- arch/arm/mach-s3c2410/mach-bast.c | 73 ++++++++++++++++++++++++++++----------- 1 file changed, 52 insertions(+), 21 deletions(-) diff --git a/arch/arm/mach-s3c2410/mach-bast.c b/arch/arm/mach-s3c2410/mach-bast.c index 0b71c896bbd1..1be2567a7486 100644 --- a/arch/arm/mach-s3c2410/mach-bast.c +++ b/arch/arm/mach-s3c2410/mach-bast.c @@ -89,32 +89,63 @@ /* macros to modify the physical addresses for io space */ -#define PA_CS2(item) ((item) + S3C2410_CS2) -#define PA_CS3(item) ((item) + S3C2410_CS3) -#define PA_CS4(item) ((item) + S3C2410_CS4) -#define PA_CS5(item) ((item) + S3C2410_CS5) +#define PA_CS2(item) (__phys_to_pfn((item) + S3C2410_CS2)) +#define PA_CS3(item) (__phys_to_pfn((item) + S3C2410_CS3)) +#define PA_CS4(item) (__phys_to_pfn((item) + S3C2410_CS4)) +#define PA_CS5(item) (__phys_to_pfn((item) + S3C2410_CS5)) static struct map_desc bast_iodesc[] __initdata = { /* ISA IO areas */ - - { (u32)S3C24XX_VA_ISA_BYTE, PA_CS2(BAST_PA_ISAIO), SZ_16M, MT_DEVICE }, - { (u32)S3C24XX_VA_ISA_WORD, PA_CS3(BAST_PA_ISAIO), SZ_16M, MT_DEVICE }, - - /* we could possibly compress the next set down into a set of smaller tables - * pagetables, but that would mean using an L2 section, and it still means - * we cannot actually feed the same register to an LDR due to 16K spacing - */ - + { + .virtual = (u32)S3C24XX_VA_ISA_BYTE, + .pfn = PA_CS2(BAST_PA_ISAIO), + .length = SZ_16M, + .type = MT_DEVICE, + }, { + .virtual = (u32)S3C24XX_VA_ISA_WORD, + .pfn = PA_CS3(BAST_PA_ISAIO), + .length = SZ_16M, + .type = MT_DEVICE, + }, /* bast CPLD control registers, and external interrupt controls */ - { (u32)BAST_VA_CTRL1, BAST_PA_CTRL1, SZ_1M, MT_DEVICE }, - { (u32)BAST_VA_CTRL2, BAST_PA_CTRL2, SZ_1M, MT_DEVICE }, - { (u32)BAST_VA_CTRL3, BAST_PA_CTRL3, SZ_1M, MT_DEVICE }, - { (u32)BAST_VA_CTRL4, BAST_PA_CTRL4, SZ_1M, MT_DEVICE }, - + { + .virtual = (u32)BAST_VA_CTRL1, + .pfn = __phys_to_pfn(BAST_PA_CTRL1), + .length = SZ_1M, + .type = MT_DEVICE, + }, { + .virtual = (u32)BAST_VA_CTRL2, + .pfn = __phys_to_pfn(BAST_PA_CTRL2), + .length = SZ_1M, + .type = MT_DEVICE, + }, { + .virtual = (u32)BAST_VA_CTRL3, + .pfn = __phys_to_pfn(BAST_PA_CTRL3), + .length = SZ_1M, + .type = MT_DEVICE, + }, { + .virtual = (u32)BAST_VA_CTRL4, + .pfn = __phys_to_pfn(BAST_PA_CTRL4), + .length = SZ_1M, + .type = MT_DEVICE, + }, /* PC104 IRQ mux */ - { (u32)BAST_VA_PC104_IRQREQ, BAST_PA_PC104_IRQREQ, SZ_1M, MT_DEVICE }, - { (u32)BAST_VA_PC104_IRQRAW, BAST_PA_PC104_IRQRAW, SZ_1M, MT_DEVICE }, - { (u32)BAST_VA_PC104_IRQMASK, BAST_PA_PC104_IRQMASK, SZ_1M, MT_DEVICE }, + { + .virtual = (u32)BAST_VA_PC104_IRQREQ, + .pfn = __phys_to_pfn(BAST_PA_PC104_IRQREQ), + .length = SZ_1M, + .type = MT_DEVICE, + }, { + .virtual = (u32)BAST_VA_PC104_IRQRAW, + .pfn = __phys_to_pfn(BAST_PA_PC104_IRQRAW), + .length = SZ_1M, + .type = MT_DEVICE, + }, { + .virtual = (u32)BAST_VA_PC104_IRQMASK, + .pfn = __phys_to_pfn(BAST_PA_PC104_IRQMASK), + .length = SZ_1M, + .type = MT_DEVICE, + }, /* peripheral space... one for each of fast/slow/byte/16bit */ /* note, ide is only decoded in word space, even though some registers -- cgit v1.2.2 From a63ae4427c6af66d6eda26e5da8fed53f8fbede3 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Tue, 8 Nov 2005 19:15:43 +0000 Subject: [ARM] 3093/1: SharpSL PCMCIA Updates for Cxx00 models Patch from Richard Purdie The Sharp SL-Cxx00 models have a combined power control for the SD and CF slot 0. This patch adds hooks to the scoop driver to allow machines to provide a custom control function for this and such a function is added for spitz/akita/borzoi. It also moves the gpio init code into the machine files as this is machine dependent and differs between some models. A couple of warnings when compiling for collie are also fixed. Signed-off-by: Richard Purdie Signed-off-by: Russell King --- arch/arm/common/scoop.c | 6 -- arch/arm/mach-pxa/corgi.c | 48 +++++++++++--- arch/arm/mach-pxa/poodle.c | 32 ++++++++- arch/arm/mach-pxa/spitz.c | 95 ++++++++++++++++++++------ drivers/pcmcia/pxa2xx_sharpsl.c | 140 +++++++++++++++++++-------------------- include/asm-arm/hardware/scoop.h | 10 ++- 6 files changed, 220 insertions(+), 111 deletions(-) diff --git a/arch/arm/common/scoop.c b/arch/arm/common/scoop.c index bb4eff614413..c7fdf390cef9 100644 --- a/arch/arm/common/scoop.c +++ b/arch/arm/common/scoop.c @@ -19,12 +19,6 @@ #define SCOOP_REG(d,adr) (*(volatile unsigned short*)(d +(adr))) -/* PCMCIA to Scoop linkage structures for pxa2xx_sharpsl.c - There is no easy way to link multiple scoop devices into one - single entity for the pxa2xx_pcmcia device */ -int scoop_num; -struct scoop_pcmcia_dev *scoop_devs; - struct scoop_dev { void *base; spinlock_t scoop_lock; diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c index eb5f6d744a4a..100fb31b5156 100644 --- a/arch/arm/mach-pxa/corgi.c +++ b/arch/arm/mach-pxa/corgi.c @@ -62,6 +62,37 @@ static struct scoop_config corgi_scoop_setup = { .io_out = CORGI_SCOOP_IO_OUT, }; +struct platform_device corgiscoop_device = { + .name = "sharp-scoop", + .id = -1, + .dev = { + .platform_data = &corgi_scoop_setup, + }, + .num_resources = ARRAY_SIZE(corgi_scoop_resources), + .resource = corgi_scoop_resources, +}; + +static void corgi_pcmcia_init(void) +{ + /* Setup default state of GPIO outputs + before we enable them as outputs. */ + GPSR(GPIO48_nPOE) = GPIO_bit(GPIO48_nPOE) | + GPIO_bit(GPIO49_nPWE) | GPIO_bit(GPIO50_nPIOR) | + GPIO_bit(GPIO51_nPIOW) | GPIO_bit(GPIO52_nPCE_1) | + GPIO_bit(GPIO53_nPCE_2); + + pxa_gpio_mode(GPIO48_nPOE_MD); + pxa_gpio_mode(GPIO49_nPWE_MD); + pxa_gpio_mode(GPIO50_nPIOR_MD); + pxa_gpio_mode(GPIO51_nPIOW_MD); + pxa_gpio_mode(GPIO55_nPREG_MD); + pxa_gpio_mode(GPIO56_nPWAIT_MD); + pxa_gpio_mode(GPIO57_nIOIS16_MD); + pxa_gpio_mode(GPIO52_nPCE_1_MD); + pxa_gpio_mode(GPIO53_nPCE_2_MD); + pxa_gpio_mode(GPIO54_pSKTSEL_MD); +} + static struct scoop_pcmcia_dev corgi_pcmcia_scoop[] = { { .dev = &corgiscoop_device.dev, @@ -71,16 +102,14 @@ static struct scoop_pcmcia_dev corgi_pcmcia_scoop[] = { }, }; -struct platform_device corgiscoop_device = { - .name = "sharp-scoop", - .id = -1, - .dev = { - .platform_data = &corgi_scoop_setup, - }, - .num_resources = ARRAY_SIZE(corgi_scoop_resources), - .resource = corgi_scoop_resources, +static struct scoop_pcmcia_config corgi_pcmcia_config = { + .devs = &corgi_pcmcia_scoop[0], + .num_devs = 1, + .pcmcia_init = corgi_pcmcia_init, }; +EXPORT_SYMBOL(corgiscoop_device); + /* * Corgi SSP Device @@ -294,8 +323,7 @@ static void __init corgi_init(void) pxa_set_mci_info(&corgi_mci_platform_data); pxa_set_ficp_info(&corgi_ficp_platform_data); - scoop_num = 1; - scoop_devs = &corgi_pcmcia_scoop[0]; + platform_scoop_config = &corgi_pcmcia_config; platform_add_devices(devices, ARRAY_SIZE(devices)); } diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c index ad6a13f95a62..eef3de26ad37 100644 --- a/arch/arm/mach-pxa/poodle.c +++ b/arch/arm/mach-pxa/poodle.c @@ -65,6 +65,27 @@ struct platform_device poodle_scoop_device = { .resource = poodle_scoop_resources, }; +static void poodle_pcmcia_init(void) +{ + /* Setup default state of GPIO outputs + before we enable them as outputs. */ + GPSR(GPIO48_nPOE) = GPIO_bit(GPIO48_nPOE) | + GPIO_bit(GPIO49_nPWE) | GPIO_bit(GPIO50_nPIOR) | + GPIO_bit(GPIO51_nPIOW) | GPIO_bit(GPIO52_nPCE_1) | + GPIO_bit(GPIO53_nPCE_2); + + pxa_gpio_mode(GPIO48_nPOE_MD); + pxa_gpio_mode(GPIO49_nPWE_MD); + pxa_gpio_mode(GPIO50_nPIOR_MD); + pxa_gpio_mode(GPIO51_nPIOW_MD); + pxa_gpio_mode(GPIO55_nPREG_MD); + pxa_gpio_mode(GPIO56_nPWAIT_MD); + pxa_gpio_mode(GPIO57_nIOIS16_MD); + pxa_gpio_mode(GPIO52_nPCE_1_MD); + pxa_gpio_mode(GPIO53_nPCE_2_MD); + pxa_gpio_mode(GPIO54_pSKTSEL_MD); +} + static struct scoop_pcmcia_dev poodle_pcmcia_scoop[] = { { .dev = &poodle_scoop_device.dev, @@ -74,6 +95,14 @@ static struct scoop_pcmcia_dev poodle_pcmcia_scoop[] = { }, }; +static struct scoop_pcmcia_config poodle_pcmcia_config = { + .devs = &poodle_pcmcia_scoop[0], + .num_devs = 1, + .pcmcia_init = poodle_pcmcia_init, +}; + +EXPORT_SYMBOL(poodle_scoop_device); + /* LoCoMo device */ static struct resource locomo_resources[] = { @@ -268,8 +297,7 @@ static void __init poodle_init(void) pxa_set_mci_info(&poodle_mci_platform_data); pxa_set_ficp_info(&poodle_ficp_platform_data); - scoop_num = 1; - scoop_devs = &poodle_pcmcia_scoop[0]; + platform_scoop_config = &poodle_pcmcia_config; ret = platform_add_devices(devices, ARRAY_SIZE(devices)); if (ret) { diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index 6c6878cd2207..4e9a699ee428 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c @@ -104,6 +104,66 @@ struct platform_device spitzscoop2_device = { .resource = spitz_scoop2_resources, }; +#define SPITZ_PWR_SD 0x01 +#define SPITZ_PWR_CF 0x02 + +/* Power control is shared with between one of the CF slots and SD */ +static void spitz_card_pwr_ctrl(int device, unsigned short new_cpr) +{ + unsigned short cpr = read_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR); + + if (new_cpr & 0x0007) { + set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_CF_POWER); + if (!(cpr & 0x0002) && !(cpr & 0x0004)) + mdelay(5); + if (device == SPITZ_PWR_CF) + cpr |= 0x0002; + if (device == SPITZ_PWR_SD) + cpr |= 0x0004; + write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr | new_cpr); + } else { + if (device == SPITZ_PWR_CF) + cpr &= ~0x0002; + if (device == SPITZ_PWR_SD) + cpr &= ~0x0004; + write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr | new_cpr); + if (!(cpr & 0x0002) && !(cpr & 0x0004)) { + mdelay(1); + reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_CF_POWER); + } + } +} + +static void spitz_pcmcia_init(void) +{ + /* Setup default state of GPIO outputs + before we enable them as outputs. */ + GPSR(GPIO48_nPOE) = GPIO_bit(GPIO48_nPOE) | + GPIO_bit(GPIO49_nPWE) | GPIO_bit(GPIO50_nPIOR) | + GPIO_bit(GPIO51_nPIOW) | GPIO_bit(GPIO54_nPCE_2); + GPSR(GPIO85_nPCE_1) = GPIO_bit(GPIO85_nPCE_1); + + pxa_gpio_mode(GPIO48_nPOE_MD); + pxa_gpio_mode(GPIO49_nPWE_MD); + pxa_gpio_mode(GPIO50_nPIOR_MD); + pxa_gpio_mode(GPIO51_nPIOW_MD); + pxa_gpio_mode(GPIO55_nPREG_MD); + pxa_gpio_mode(GPIO56_nPWAIT_MD); + pxa_gpio_mode(GPIO57_nIOIS16_MD); + pxa_gpio_mode(GPIO85_nPCE_1_MD); + pxa_gpio_mode(GPIO54_nPCE_2_MD); + pxa_gpio_mode(GPIO104_pSKTSEL_MD); +} + +static void spitz_pcmcia_pwr(struct device *scoop, unsigned short cpr, int nr) +{ + /* Only need to override behaviour for slot 0 */ + if (nr == 0) + spitz_card_pwr_ctrl(SPITZ_PWR_CF, cpr); + else + write_scoop_reg(scoop, SCOOP_CPR, cpr); +} + static struct scoop_pcmcia_dev spitz_pcmcia_scoop[] = { { .dev = &spitzscoop_device.dev, @@ -117,6 +177,16 @@ static struct scoop_pcmcia_dev spitz_pcmcia_scoop[] = { }, }; +static struct scoop_pcmcia_config spitz_pcmcia_config = { + .devs = &spitz_pcmcia_scoop[0], + .num_devs = 2, + .pcmcia_init = spitz_pcmcia_init, + .power_ctrl = spitz_pcmcia_pwr, +}; + +EXPORT_SYMBOL(spitzscoop_device); +EXPORT_SYMBOL(spitzscoop2_device); + /* * Spitz SSP Device @@ -235,27 +305,14 @@ static int spitz_mci_init(struct device *dev, irqreturn_t (*spitz_detect_int)(in return 0; } -/* Power control is shared with one of the CF slots so we have a mess */ static void spitz_mci_setpower(struct device *dev, unsigned int vdd) { struct pxamci_platform_data* p_d = dev->platform_data; - unsigned short cpr = read_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR); - - if (( 1 << vdd) & p_d->ocr_mask) { - /* printk(KERN_DEBUG "%s: on\n", __FUNCTION__); */ - set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_CF_POWER); - mdelay(2); - write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr | 0x04); - } else { - /* printk(KERN_DEBUG "%s: off\n", __FUNCTION__); */ - write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr & ~0x04); - - if (!(cpr | 0x02)) { - mdelay(1); - reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_CF_POWER); - } - } + if (( 1 << vdd) & p_d->ocr_mask) + spitz_card_pwr_ctrl(SPITZ_PWR_SD, 0x0004); + else + spitz_card_pwr_ctrl(SPITZ_PWR_SD, 0x0000); } static int spitz_mci_get_ro(struct device *dev) @@ -351,8 +408,8 @@ static void __init common_init(void) static void __init spitz_init(void) { - scoop_num = 2; - scoop_devs = &spitz_pcmcia_scoop[0]; + platform_scoop_config = &spitz_pcmcia_config; + spitz_bl_machinfo.set_bl_intensity = spitz_bl_set_intensity; common_init(); diff --git a/drivers/pcmcia/pxa2xx_sharpsl.c b/drivers/pcmcia/pxa2xx_sharpsl.c index fe5ea36e7de3..56c58831e80e 100644 --- a/drivers/pcmcia/pxa2xx_sharpsl.c +++ b/drivers/pcmcia/pxa2xx_sharpsl.c @@ -22,16 +22,20 @@ #include #include #include -#ifdef CONFIG_SA1100_COLLIE -#include -#else -#include -#endif #include "soc_common.h" #define NO_KEEP_VS 0x0001 +/* PCMCIA to Scoop linkage + + There is no easy way to link multiple scoop devices into one + single entity for the pxa2xx_pcmcia device so this structure + is used which is setup by the platform code +*/ +struct scoop_pcmcia_config *platform_scoop_config; +#define SCOOP_DEV platform_scoop_config->devs + static void sharpsl_pcmcia_init_reset(struct scoop_pcmcia_dev *scoopdev) { reset_scoop(scoopdev->dev); @@ -43,38 +47,16 @@ static int sharpsl_pcmcia_hw_init(struct soc_pcmcia_socket *skt) { int ret; -#ifndef CONFIG_SA1100_COLLIE - /* - * Setup default state of GPIO outputs - * before we enable them as outputs. - */ - GPSR(GPIO48_nPOE) = - GPIO_bit(GPIO48_nPOE) | - GPIO_bit(GPIO49_nPWE) | - GPIO_bit(GPIO50_nPIOR) | - GPIO_bit(GPIO51_nPIOW) | - GPIO_bit(GPIO52_nPCE_1) | - GPIO_bit(GPIO53_nPCE_2); - - pxa_gpio_mode(GPIO48_nPOE_MD); - pxa_gpio_mode(GPIO49_nPWE_MD); - pxa_gpio_mode(GPIO50_nPIOR_MD); - pxa_gpio_mode(GPIO51_nPIOW_MD); - pxa_gpio_mode(GPIO52_nPCE_1_MD); - pxa_gpio_mode(GPIO53_nPCE_2_MD); - pxa_gpio_mode(GPIO54_pSKTSEL_MD); - pxa_gpio_mode(GPIO55_nPREG_MD); - pxa_gpio_mode(GPIO56_nPWAIT_MD); - pxa_gpio_mode(GPIO57_nIOIS16_MD); -#endif + if (platform_scoop_config->pcmcia_init) + platform_scoop_config->pcmcia_init(); /* Register interrupts */ - if (scoop_devs[skt->nr].cd_irq >= 0) { + if (SCOOP_DEV[skt->nr].cd_irq >= 0) { struct pcmcia_irqs cd_irq; cd_irq.sock = skt->nr; - cd_irq.irq = scoop_devs[skt->nr].cd_irq; - cd_irq.str = scoop_devs[skt->nr].cd_irq_str; + cd_irq.irq = SCOOP_DEV[skt->nr].cd_irq; + cd_irq.str = SCOOP_DEV[skt->nr].cd_irq_str; ret = soc_pcmcia_request_irqs(skt, &cd_irq, 1); if (ret) { @@ -83,19 +65,19 @@ static int sharpsl_pcmcia_hw_init(struct soc_pcmcia_socket *skt) } } - skt->irq = scoop_devs[skt->nr].irq; + skt->irq = SCOOP_DEV[skt->nr].irq; return 0; } static void sharpsl_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) { - if (scoop_devs[skt->nr].cd_irq >= 0) { + if (SCOOP_DEV[skt->nr].cd_irq >= 0) { struct pcmcia_irqs cd_irq; cd_irq.sock = skt->nr; - cd_irq.irq = scoop_devs[skt->nr].cd_irq; - cd_irq.str = scoop_devs[skt->nr].cd_irq_str; + cd_irq.irq = SCOOP_DEV[skt->nr].cd_irq; + cd_irq.str = SCOOP_DEV[skt->nr].cd_irq_str; soc_pcmcia_free_irqs(skt, &cd_irq, 1); } } @@ -105,9 +87,9 @@ static void sharpsl_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_state *state) { unsigned short cpr, csr; - struct device *scoop = scoop_devs[skt->nr].dev; + struct device *scoop = SCOOP_DEV[skt->nr].dev; - cpr = read_scoop_reg(scoop_devs[skt->nr].dev, SCOOP_CPR); + cpr = read_scoop_reg(SCOOP_DEV[skt->nr].dev, SCOOP_CPR); write_scoop_reg(scoop, SCOOP_IRM, 0x00FF); write_scoop_reg(scoop, SCOOP_ISR, 0x0000); @@ -116,21 +98,25 @@ static void sharpsl_pcmcia_socket_state(struct soc_pcmcia_socket *skt, if (csr & 0x0004) { /* card eject */ write_scoop_reg(scoop, SCOOP_CDR, 0x0000); - scoop_devs[skt->nr].keep_vs = NO_KEEP_VS; + SCOOP_DEV[skt->nr].keep_vs = NO_KEEP_VS; } - else if (!(scoop_devs[skt->nr].keep_vs & NO_KEEP_VS)) { + else if (!(SCOOP_DEV[skt->nr].keep_vs & NO_KEEP_VS)) { /* keep vs1,vs2 */ write_scoop_reg(scoop, SCOOP_CDR, 0x0000); - csr |= scoop_devs[skt->nr].keep_vs; + csr |= SCOOP_DEV[skt->nr].keep_vs; } else if (cpr & 0x0003) { /* power on */ write_scoop_reg(scoop, SCOOP_CDR, 0x0000); - scoop_devs[skt->nr].keep_vs = (csr & 0x00C0); + SCOOP_DEV[skt->nr].keep_vs = (csr & 0x00C0); } else { /* card detect */ - write_scoop_reg(scoop, SCOOP_CDR, 0x0002); + if ((machine_is_spitz() || machine_is_borzoi()) && skt->nr == 1) { + write_scoop_reg(scoop, SCOOP_CDR, 0x0000); + } else { + write_scoop_reg(scoop, SCOOP_CDR, 0x0002); + } } state->detect = (csr & 0x0004) ? 0 : 1; @@ -144,7 +130,6 @@ static void sharpsl_pcmcia_socket_state(struct soc_pcmcia_socket *skt, if ((cpr & 0x0080) && ((cpr & 0x8040) != 0x8040)) { printk(KERN_ERR "sharpsl_pcmcia_socket_state(): CPR=%04X, Low voltage!\n", cpr); } - } @@ -152,7 +137,7 @@ static int sharpsl_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state) { unsigned long flags; - struct device *scoop = scoop_devs[skt->nr].dev; + struct device *scoop = SCOOP_DEV[skt->nr].dev; unsigned short cpr, ncpr, ccr, nccr, mcr, nmcr, imr, nimr; @@ -177,8 +162,13 @@ static int sharpsl_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, nccr = (ccr = read_scoop_reg(scoop, SCOOP_CCR)) & ~0x0080; nimr = (imr = read_scoop_reg(scoop, SCOOP_IMR)) & ~0x003E; - ncpr |= (state->Vcc == 33) ? 0x0001 : - (state->Vcc == 50) ? 0x0002 : 0; + if ((machine_is_spitz() || machine_is_borzoi() || machine_is_akita()) && skt->nr == 0) { + ncpr |= (state->Vcc == 33) ? 0x0002 : + (state->Vcc == 50) ? 0x0002 : 0; + } else { + ncpr |= (state->Vcc == 33) ? 0x0001 : + (state->Vcc == 50) ? 0x0002 : 0; + } nmcr |= (state->flags&SS_IOCARD) ? 0x0010 : 0; ncpr |= (state->flags&SS_OUTPUT_ENA) ? 0x0080 : 0; nccr |= (state->flags&SS_RESET)? 0x0080: 0; @@ -190,18 +180,22 @@ static int sharpsl_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, ((skt->status&SS_WRPROT) ? 0x0008 : 0); if (!(ncpr & 0x0003)) { - scoop_devs[skt->nr].keep_rd = 0; - } else if (!scoop_devs[skt->nr].keep_rd) { + SCOOP_DEV[skt->nr].keep_rd = 0; + } else if (!SCOOP_DEV[skt->nr].keep_rd) { if (nccr & 0x0080) - scoop_devs[skt->nr].keep_rd = 1; + SCOOP_DEV[skt->nr].keep_rd = 1; else nccr |= 0x0080; } if (mcr != nmcr) write_scoop_reg(scoop, SCOOP_MCR, nmcr); - if (cpr != ncpr) - write_scoop_reg(scoop, SCOOP_CPR, ncpr); + if (cpr != ncpr) { + if (platform_scoop_config->power_ctrl) + platform_scoop_config->power_ctrl(scoop, ncpr , skt->nr); + else + write_scoop_reg(scoop, SCOOP_CPR, ncpr); + } if (ccr != nccr) write_scoop_reg(scoop, SCOOP_CCR, nccr); if (imr != nimr) @@ -214,43 +208,43 @@ static int sharpsl_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, static void sharpsl_pcmcia_socket_init(struct soc_pcmcia_socket *skt) { - sharpsl_pcmcia_init_reset(&scoop_devs[skt->nr]); + sharpsl_pcmcia_init_reset(&SCOOP_DEV[skt->nr]); /* Enable interrupt */ - write_scoop_reg(scoop_devs[skt->nr].dev, SCOOP_IMR, 0x00C0); - write_scoop_reg(scoop_devs[skt->nr].dev, SCOOP_MCR, 0x0101); - scoop_devs[skt->nr].keep_vs = NO_KEEP_VS; + write_scoop_reg(SCOOP_DEV[skt->nr].dev, SCOOP_IMR, 0x00C0); + write_scoop_reg(SCOOP_DEV[skt->nr].dev, SCOOP_MCR, 0x0101); + SCOOP_DEV[skt->nr].keep_vs = NO_KEEP_VS; if (machine_is_collie()) /* We need to disable SS_OUTPUT_ENA here. */ - write_scoop_reg(scoop_devs[skt->nr].dev, SCOOP_CPR, read_scoop_reg(scoop_devs[skt->nr].dev, SCOOP_CPR) & ~0x0080); + write_scoop_reg(SCOOP_DEV[skt->nr].dev, SCOOP_CPR, read_scoop_reg(SCOOP_DEV[skt->nr].dev, SCOOP_CPR) & ~0x0080); } static void sharpsl_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt) { /* CF_BUS_OFF */ - sharpsl_pcmcia_init_reset(&scoop_devs[skt->nr]); + sharpsl_pcmcia_init_reset(&SCOOP_DEV[skt->nr]); if (machine_is_collie()) /* We need to disable SS_OUTPUT_ENA here. */ - write_scoop_reg(scoop_devs[skt->nr].dev, SCOOP_CPR, read_scoop_reg(scoop_devs[skt->nr].dev, SCOOP_CPR) & ~0x0080); + write_scoop_reg(SCOOP_DEV[skt->nr].dev, SCOOP_CPR, read_scoop_reg(SCOOP_DEV[skt->nr].dev, SCOOP_CPR) & ~0x0080); } static struct pcmcia_low_level sharpsl_pcmcia_ops = { - .owner = THIS_MODULE, - .hw_init = sharpsl_pcmcia_hw_init, - .hw_shutdown = sharpsl_pcmcia_hw_shutdown, - .socket_state = sharpsl_pcmcia_socket_state, - .configure_socket = sharpsl_pcmcia_configure_socket, - .socket_init = sharpsl_pcmcia_socket_init, - .socket_suspend = sharpsl_pcmcia_socket_suspend, - .first = 0, - .nr = 0, + .owner = THIS_MODULE, + .hw_init = sharpsl_pcmcia_hw_init, + .hw_shutdown = sharpsl_pcmcia_hw_shutdown, + .socket_state = sharpsl_pcmcia_socket_state, + .configure_socket = sharpsl_pcmcia_configure_socket, + .socket_init = sharpsl_pcmcia_socket_init, + .socket_suspend = sharpsl_pcmcia_socket_suspend, + .first = 0, + .nr = 0, }; -static struct platform_device *sharpsl_pcmcia_device; - #ifdef CONFIG_SA1100_COLLIE +#include "sa11xx_base.h" + int __init pcmcia_collie_init(struct device *dev) { int ret = -ENODEV; @@ -263,11 +257,13 @@ int __init pcmcia_collie_init(struct device *dev) #else +static struct platform_device *sharpsl_pcmcia_device; + static int __init sharpsl_pcmcia_init(void) { int ret; - sharpsl_pcmcia_ops.nr=scoop_num; + sharpsl_pcmcia_ops.nr=platform_scoop_config->num_devs; sharpsl_pcmcia_device = kmalloc(sizeof(*sharpsl_pcmcia_device), GFP_KERNEL); if (!sharpsl_pcmcia_device) return -ENOMEM; @@ -275,7 +271,7 @@ static int __init sharpsl_pcmcia_init(void) memset(sharpsl_pcmcia_device, 0, sizeof(*sharpsl_pcmcia_device)); sharpsl_pcmcia_device->name = "pxa2xx-pcmcia"; sharpsl_pcmcia_device->dev.platform_data = &sharpsl_pcmcia_ops; - sharpsl_pcmcia_device->dev.parent=scoop_devs[0].dev; + sharpsl_pcmcia_device->dev.parent=platform_scoop_config->devs[0].dev; ret = platform_device_register(sharpsl_pcmcia_device); if (ret) diff --git a/include/asm-arm/hardware/scoop.h b/include/asm-arm/hardware/scoop.h index a8f1013930e3..d37bf7443264 100644 --- a/include/asm-arm/hardware/scoop.h +++ b/include/asm-arm/hardware/scoop.h @@ -52,8 +52,14 @@ struct scoop_pcmcia_dev { unsigned char keep_rd; }; -extern int scoop_num; -extern struct scoop_pcmcia_dev *scoop_devs; +struct scoop_pcmcia_config { + struct scoop_pcmcia_dev *devs; + int num_devs; + void (*pcmcia_init)(void); + void (*power_ctrl)(struct device *scoop, unsigned short cpr, int nr); +}; + +extern struct scoop_pcmcia_config *platform_scoop_config; void reset_scoop(struct device *dev); unsigned short set_scoop_gpio(struct device *dev, unsigned short bit); -- cgit v1.2.2 From 4c18ad20493c9eac6e7d0c2a05156acfc02d9b6b Mon Sep 17 00:00:00 2001 From: Dirk Opfer Date: Tue, 8 Nov 2005 19:15:50 +0000 Subject: [ARM] 3124/1: Sharp SL-6000x: SharpSL PCMCIA Updates Patch from Dirk Opfer This patch updates the tosa machine to use the new SharpSL PCMCIA layer introduced with Patch #3093/1 Depends on #3093/1 Signed-off-by: Dirk Opfer Signed-off-by: Richard Purdie Signed-off-by: Russell King --- arch/arm/mach-pxa/tosa.c | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c index f3e01891e851..c312054dfb88 100644 --- a/arch/arm/mach-pxa/tosa.c +++ b/arch/arm/mach-pxa/tosa.c @@ -98,6 +98,9 @@ struct platform_device tosascoop_jc_device = { .resource = tosa_scoop_jc_resources, }; +/* + * PCMCIA + */ static struct scoop_pcmcia_dev tosa_pcmcia_scoop[] = { { .dev = &tosascoop_device.dev, @@ -111,6 +114,33 @@ static struct scoop_pcmcia_dev tosa_pcmcia_scoop[] = { }, }; +static void tosa_pcmcia_init(void) +{ + /* Setup default state of GPIO outputs + before we enable them as outputs. */ + GPSR(GPIO48_nPOE) = GPIO_bit(GPIO48_nPOE) | + GPIO_bit(GPIO49_nPWE) | GPIO_bit(GPIO50_nPIOR) | + GPIO_bit(GPIO51_nPIOW) | GPIO_bit(GPIO52_nPCE_1) | + GPIO_bit(GPIO53_nPCE_2); + + pxa_gpio_mode(GPIO48_nPOE_MD); + pxa_gpio_mode(GPIO49_nPWE_MD); + pxa_gpio_mode(GPIO50_nPIOR_MD); + pxa_gpio_mode(GPIO51_nPIOW_MD); + pxa_gpio_mode(GPIO55_nPREG_MD); + pxa_gpio_mode(GPIO56_nPWAIT_MD); + pxa_gpio_mode(GPIO57_nIOIS16_MD); + pxa_gpio_mode(GPIO52_nPCE_1_MD); + pxa_gpio_mode(GPIO53_nPCE_2_MD); + pxa_gpio_mode(GPIO54_pSKTSEL_MD); +} + +static struct scoop_pcmcia_config tosa_pcmcia_config = { + .devs = &tosa_pcmcia_scoop[0], + .num_devs = 2, + .pcmcia_init = tosa_pcmcia_init, +}; + /* * USB Device Controller */ @@ -249,10 +279,9 @@ static void __init tosa_init(void) pxa_set_mci_info(&tosa_mci_platform_data); pxa_set_udc_info(&udc_info); pxa_set_ficp_info(&tosa_ficp_platform_data); - platform_add_devices(devices, ARRAY_SIZE(devices)); + platform_scoop_config = &tosa_pcmcia_config; - scoop_num = 2; - scoop_devs = &tosa_pcmcia_scoop[0]; + platform_add_devices(devices, ARRAY_SIZE(devices)); } static void __init fixup_tosa(struct machine_desc *desc, -- cgit v1.2.2 From 329f7dba5f7dc3bc9a30ad00cf373d2e83115aa1 Mon Sep 17 00:00:00 2001 From: Oleg Nesterov Date: Mon, 7 Nov 2005 21:12:43 +0300 Subject: [PATCH] fix de_thread() vs send_group_sigqueue() race When non-leader thread does exec, de_thread calls release_task(leader) before calling exit_itimers(). If local timer interrupt happens in between, it can oops in send_group_sigqueue() while taking ->sighand->siglock == NULL. However, we can't change send_group_sigqueue() to check p->signal != NULL, because sys_timer_create() does get_task_struct() only in SIGEV_THREAD_ID case. So it is possible that this task_struct was already freed and we can't trust p->signal. This patch changes de_thread() so that leader released after exit_itimers() call. Signed-off-by: Oleg Nesterov Acked-by: Chris Wright Signed-off-by: Linus Torvalds --- fs/exec.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/fs/exec.c b/fs/exec.c index cd6c574557dc..5a4e3acc2e9f 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -590,6 +590,7 @@ static inline int de_thread(struct task_struct *tsk) struct signal_struct *sig = tsk->signal; struct sighand_struct *newsighand, *oldsighand = tsk->sighand; spinlock_t *lock = &oldsighand->siglock; + struct task_struct *leader = NULL; int count; /* @@ -665,7 +666,7 @@ static inline int de_thread(struct task_struct *tsk) * and to assume its PID: */ if (!thread_group_leader(current)) { - struct task_struct *leader = current->group_leader, *parent; + struct task_struct *parent; struct dentry *proc_dentry1, *proc_dentry2; unsigned long exit_state, ptrace; @@ -674,6 +675,7 @@ static inline int de_thread(struct task_struct *tsk) * It should already be zombie at this point, most * of the time. */ + leader = current->group_leader; while (leader->exit_state != EXIT_ZOMBIE) yield(); @@ -733,7 +735,6 @@ static inline int de_thread(struct task_struct *tsk) proc_pid_flush(proc_dentry2); BUG_ON(exit_state != EXIT_ZOMBIE); - release_task(leader); } /* @@ -743,8 +744,11 @@ static inline int de_thread(struct task_struct *tsk) sig->flags = 0; no_thread_group: - BUG_ON(atomic_read(&sig->count) != 1); exit_itimers(sig); + if (leader) + release_task(leader); + + BUG_ON(atomic_read(&sig->count) != 1); if (atomic_read(&oldsighand->count) == 1) { /* -- cgit v1.2.2 From 88d51967f56f55a45849efe50858ea7dfa0d38dc Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Sun, 6 Nov 2005 23:35:34 -0800 Subject: [PATCH] AGP performance fixes AGP allocation/deallocation is suffering major performance issues due to the nature of global_flush_tlb() being called on every change_page_attr() call. For small allocations this isn't really seen, but when you start allocating 50000 pages of AGP space, for say, texture memory, then things can take seconds to complete. In some cases the situation is doubled or even quadrupled in the time due to SMP, or a deallocation, then a new reallocation. I've had a case of upto 20 seconds wait time to deallocate and reallocate AGP space. This patch fixes the problem by making it the caller's responsibility to call global_flush_tlb(), and so removes it from every instance of mapping a page into AGP space until the time that all change_page_attr() changes are done. Signed-off-by: Dave Jones Signed-off-by: Andrew Morton --- drivers/char/agp/backend.c | 9 +++++++-- drivers/char/agp/generic.c | 11 ++++++++--- drivers/char/agp/i460-agp.c | 9 ++++++--- drivers/char/agp/intel-agp.c | 5 ++++- 4 files changed, 25 insertions(+), 9 deletions(-) diff --git a/drivers/char/agp/backend.c b/drivers/char/agp/backend.c index 73f333f491bd..4d5ed18dad00 100644 --- a/drivers/char/agp/backend.c +++ b/drivers/char/agp/backend.c @@ -147,6 +147,7 @@ static int agp_backend_initialize(struct agp_bridge_data *bridge) printk(KERN_ERR PFX "unable to get memory for scratch page.\n"); return -ENOMEM; } + global_flush_tlb(); bridge->scratch_page_real = virt_to_gart(addr); bridge->scratch_page = @@ -187,9 +188,11 @@ static int agp_backend_initialize(struct agp_bridge_data *bridge) return 0; err_out: - if (bridge->driver->needs_scratch_page) + if (bridge->driver->needs_scratch_page) { bridge->driver->agp_destroy_page( gart_to_virt(bridge->scratch_page_real)); + global_flush_tlb(); + } if (got_gatt) bridge->driver->free_gatt_table(bridge); if (got_keylist) { @@ -211,9 +214,11 @@ static void agp_backend_cleanup(struct agp_bridge_data *bridge) bridge->key_list = NULL; if (bridge->driver->agp_destroy_page && - bridge->driver->needs_scratch_page) + bridge->driver->needs_scratch_page) { bridge->driver->agp_destroy_page( gart_to_virt(bridge->scratch_page_real)); + global_flush_tlb(); + } } /* When we remove the global variable agp_bridge from all drivers diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c index c4a38715c6f9..19f242b50781 100644 --- a/drivers/char/agp/generic.c +++ b/drivers/char/agp/generic.c @@ -57,7 +57,8 @@ int map_page_into_agp(struct page *page) { int i; i = change_page_attr(page, 1, PAGE_KERNEL_NOCACHE); - global_flush_tlb(); + /* Caller's responsibility to call global_flush_tlb() for + * performance reasons */ return i; } EXPORT_SYMBOL_GPL(map_page_into_agp); @@ -66,7 +67,8 @@ int unmap_page_from_agp(struct page *page) { int i; i = change_page_attr(page, 1, PAGE_KERNEL); - global_flush_tlb(); + /* Caller's responsibility to call global_flush_tlb() for + * performance reasons */ return i; } EXPORT_SYMBOL_GPL(unmap_page_from_agp); @@ -153,6 +155,7 @@ void agp_free_memory(struct agp_memory *curr) for (i = 0; i < curr->page_count; i++) { curr->bridge->driver->agp_destroy_page(gart_to_virt(curr->memory[i])); } + global_flush_tlb(); } agp_free_key(curr->key); vfree(curr->memory); @@ -210,7 +213,9 @@ struct agp_memory *agp_allocate_memory(struct agp_bridge_data *bridge, new->memory[i] = virt_to_gart(addr); new->page_count++; } - new->bridge = bridge; + global_flush_tlb(); + + new->bridge = bridge; flush_agp_mappings(); diff --git a/drivers/char/agp/i460-agp.c b/drivers/char/agp/i460-agp.c index 58944cd271ea..be2e569ae910 100644 --- a/drivers/char/agp/i460-agp.c +++ b/drivers/char/agp/i460-agp.c @@ -514,9 +514,10 @@ static void *i460_alloc_page (struct agp_bridge_data *bridge) { void *page; - if (I460_IO_PAGE_SHIFT <= PAGE_SHIFT) + if (I460_IO_PAGE_SHIFT <= PAGE_SHIFT) { page = agp_generic_alloc_page(agp_bridge); - else + global_flush_tlb(); + } else /* Returning NULL would cause problems */ /* AK: really dubious code. */ page = (void *)~0UL; @@ -525,8 +526,10 @@ static void *i460_alloc_page (struct agp_bridge_data *bridge) static void i460_destroy_page (void *page) { - if (I460_IO_PAGE_SHIFT <= PAGE_SHIFT) + if (I460_IO_PAGE_SHIFT <= PAGE_SHIFT) { agp_generic_destroy_page(page); + global_flush_tlb(); + } } #endif /* I460_LARGE_IO_PAGES */ diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c index bf4cc9ffd5b1..027161ab88e9 100644 --- a/drivers/char/agp/intel-agp.c +++ b/drivers/char/agp/intel-agp.c @@ -270,6 +270,7 @@ static struct agp_memory *alloc_agpphysmem_i8xx(size_t pg_count, int type) switch (pg_count) { case 1: addr = agp_bridge->driver->agp_alloc_page(agp_bridge); + global_flush_tlb(); break; case 4: /* kludge to get 4 physical pages for ARGB cursor */ @@ -330,9 +331,11 @@ static void intel_i810_free_by_type(struct agp_memory *curr) if(curr->type == AGP_PHYS_MEMORY) { if (curr->page_count == 4) i8xx_destroy_pages(gart_to_virt(curr->memory[0])); - else + else { agp_bridge->driver->agp_destroy_page( gart_to_virt(curr->memory[0])); + global_flush_tlb(); + } vfree(curr->memory); } kfree(curr); -- cgit v1.2.2 From 49ebd7c6bb1f70a6c5465925e6ca2f4a32d6a6cd Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Sun, 6 Nov 2005 23:35:35 -0800 Subject: [PATCH] i460-agp warning fixes drivers/char/agp/i460-agp.c: In function `i460_fetch_size': drivers/char/agp/i460-agp.c:115: warning: size_t format, long unsigned int arg (arg 2) drivers/char/agp/i460-agp.c:115: warning: size_t format, long unsigned int arg (arg 3) drivers/char/agp/i460-agp.c: In function `i460_mask_memory': drivers/char/agp/i460-agp.c:542: warning: integer constant is too large for "long" type Note that the i460_mask_memory() change is a guess. But a good one, I suspect. Signed-off-by: Dave Jones Signed-off-by: Andrew Morton --- drivers/char/agp/i460-agp.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/char/agp/i460-agp.c b/drivers/char/agp/i460-agp.c index be2e569ae910..34a444658ffe 100644 --- a/drivers/char/agp/i460-agp.c +++ b/drivers/char/agp/i460-agp.c @@ -111,8 +111,10 @@ static int i460_fetch_size (void) if (i460.io_page_shift != I460_IO_PAGE_SHIFT) { printk(KERN_ERR PFX - "I/O (GART) page-size %ZuKB doesn't match expected size %ZuKB\n", - 1UL << (i460.io_page_shift - 10), 1UL << (I460_IO_PAGE_SHIFT)); + "I/O (GART) page-size %luKB doesn't match expected " + "size %luKB\n", + 1UL << (i460.io_page_shift - 10), + 1UL << (I460_IO_PAGE_SHIFT)); return 0; } @@ -539,7 +541,7 @@ static unsigned long i460_mask_memory (struct agp_bridge_data *bridge, { /* Make sure the returned address is a valid GATT entry */ return bridge->driver->masks[0].mask - | (((addr & ~((1 << I460_IO_PAGE_SHIFT) - 1)) & 0xffffff000) >> 12); + | (((addr & ~((1 << I460_IO_PAGE_SHIFT) - 1)) & 0xfffff000) >> 12); } struct agp_bridge_driver intel_i460_driver = { -- cgit v1.2.2 From f8c905d368c757e2c96db293a472a31abcf4b147 Mon Sep 17 00:00:00 2001 From: Ben Dooks Date: Tue, 8 Nov 2005 22:43:05 +0000 Subject: [ARM] 3132/1: S3C2410 - reset on decompression error Patch from Ben Dooks Force a watchdog reset if the system fails to decompress properly. Signed-off-by: Ben Dooks Signed-off-by: Russell King --- arch/arm/boot/compressed/misc.c | 6 ++++++ arch/arm/mach-s3c2410/Kconfig | 8 ++++++++ include/asm-arm/arch-s3c2410/uncompress.h | 22 ++++++++++++++++++++-- 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c index 50f13eec6cd7..5ab94584baee 100644 --- a/arch/arm/boot/compressed/misc.c +++ b/arch/arm/boot/compressed/misc.c @@ -283,8 +283,14 @@ void flush_window(void) putstr("."); } +#ifndef arch_error +#define arch_error(x) +#endif + static void error(char *x) { + arch_error(x); + putstr("\n\n"); putstr(x); putstr("\n\n -- System halted"); diff --git a/arch/arm/mach-s3c2410/Kconfig b/arch/arm/mach-s3c2410/Kconfig index c796bcdd6158..0b9d7ca49ec1 100644 --- a/arch/arm/mach-s3c2410/Kconfig +++ b/arch/arm/mach-s3c2410/Kconfig @@ -121,6 +121,14 @@ config S3C2410_BOOT_WATCHDOG system resets depends on the value of PCLK. The timeout on an 200MHz s3c2410 should be about 30 seconds. +config S3C2410_BOOT_ERROR_RESET + bool "S3C2410 Reboot on decompression error" + depends on ARCH_S3C2410 + help + Say y here to use the watchdog to reset the system if the + kernel decompressor detects an error during decompression. + + comment "S3C2410 Setup" config S3C2410_DMA diff --git a/include/asm-arm/arch-s3c2410/uncompress.h b/include/asm-arm/arch-s3c2410/uncompress.h index d7a4a8354fa9..ddd1578a7ee0 100644 --- a/include/asm-arm/arch-s3c2410/uncompress.h +++ b/include/asm-arm/arch-s3c2410/uncompress.h @@ -116,6 +116,8 @@ putstr(const char *ptr) } } +#define __raw_writel(d,ad) do { *((volatile unsigned int *)(ad)) = (d); } while(0) + /* CONFIG_S3C2410_BOOT_WATCHDOG * * Simple boot-time watchdog setup, to reboot the system if there is @@ -126,8 +128,6 @@ putstr(const char *ptr) #define WDOG_COUNT (0xff00) -#define __raw_writel(d,ad) do { *((volatile unsigned int *)(ad)) = (d); } while(0) - static inline void arch_decomp_wdog(void) { __raw_writel(WDOG_COUNT, S3C2410_WTCNT); @@ -145,6 +145,24 @@ static void arch_decomp_wdog_start(void) #define arch_decomp_wdog() #endif +#ifdef CONFIG_S3C2410_BOOT_ERROR_RESET + +static void arch_decomp_error(const char *x) +{ + putstr("\n\n"); + putstr(x); + putstr("\n\n -- System resetting\n"); + + __raw_writel(0x4000, S3C2410_WTDAT); + __raw_writel(0x4000, S3C2410_WTCNT); + __raw_writel(S3C2410_WTCON_ENABLE | S3C2410_WTCON_DIV128 | S3C2410_WTCON_RSTEN | S3C2410_WTCON_PRESCALE(0x40), S3C2410_WTCON); + + while(1); +} + +#define arch_error arch_decomp_error +#endif + static void error(char *err); static void -- cgit v1.2.2 From d07ad967e3c1cb955c4f9ee6a4eba4e6e1edb1e8 Mon Sep 17 00:00:00 2001 From: Nicolas Pitre Date: Tue, 8 Nov 2005 22:43:05 +0000 Subject: [ARM] 3134/1: add missing EXPORT_SYMBOL for the ARM version of sha_transform Patch from Nicolas Pitre Noticed by Woody Suwalski . Signed-off-by: Nicolas Pitre Signed-off-by: Russell King --- arch/arm/kernel/armksyms.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/kernel/armksyms.c b/arch/arm/kernel/armksyms.c index 7b17a87a3311..7a3261f0bf79 100644 --- a/arch/arm/kernel/armksyms.c +++ b/arch/arm/kernel/armksyms.c @@ -9,6 +9,7 @@ */ #include #include +#include #include #include #include @@ -126,6 +127,9 @@ EXPORT_SYMBOL(__put_user_2); EXPORT_SYMBOL(__put_user_4); EXPORT_SYMBOL(__put_user_8); + /* crypto hash */ +EXPORT_SYMBOL(sha_transform); + /* gcc lib functions */ EXPORT_SYMBOL(__ashldi3); EXPORT_SYMBOL(__ashrdi3); -- cgit v1.2.2 From 5285eb57c9a20d8df2569c770ff6048c3202cc91 Mon Sep 17 00:00:00 2001 From: Nicolas Pitre Date: Tue, 8 Nov 2005 22:43:06 +0000 Subject: [ARM] 3135/1: harden SA11x0 and PXA2xx timer init code Patch from Nicolas Pitre Make it completely deterministic and leave nothing to chance (even if it had at worst 0.001% probability of failing). Signed-off-by: Nicolas Pitre Signed-off-by: Russell King --- arch/arm/mach-pxa/time.c | 8 +++++--- arch/arm/mach-sa1100/time.c | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-pxa/time.c b/arch/arm/mach-pxa/time.c index 7dad3f1465e0..b9b2057349eb 100644 --- a/arch/arm/mach-pxa/time.c +++ b/arch/arm/mach-pxa/time.c @@ -132,11 +132,13 @@ static void __init pxa_timer_init(void) tv.tv_sec = pxa_get_rtc_time(); do_settimeofday(&tv); - OSMR0 = 0; /* set initial match at 0 */ + OIER = 0; /* disable any timer interrupts */ + OSCR = LATCH*2; /* push OSCR out of the way */ + OSMR0 = LATCH; /* set initial match */ OSSR = 0xf; /* clear status on all timers */ setup_irq(IRQ_OST0, &pxa_timer_irq); - OIER |= OIER_E0; /* enable match on timer 0 to cause interrupts */ - OSCR = 0; /* initialize free-running timer, force first match */ + OIER = OIER_E0; /* enable match on timer 0 to cause interrupts */ + OSCR = 0; /* initialize free-running timer */ } #ifdef CONFIG_NO_IDLE_HZ diff --git a/arch/arm/mach-sa1100/time.c b/arch/arm/mach-sa1100/time.c index 47e0420623fc..e4b435e634e4 100644 --- a/arch/arm/mach-sa1100/time.c +++ b/arch/arm/mach-sa1100/time.c @@ -124,11 +124,13 @@ static void __init sa1100_timer_init(void) tv.tv_sec = sa1100_get_rtc_time(); do_settimeofday(&tv); - OSMR0 = 0; /* set initial match at 0 */ + OIER = 0; /* disable any timer interrupts */ + OSCR = LATCH*2; /* push OSCR out of the way */ + OSMR0 = LATCH; /* set initial match */ OSSR = 0xf; /* clear status on all timers */ setup_irq(IRQ_OST0, &sa1100_timer_irq); - OIER |= OIER_E0; /* enable match on timer 0 to cause interrupts */ - OSCR = 0; /* initialize free-running timer, force first match */ + OIER = OIER_E0; /* enable match on timer 0 to cause interrupts */ + OSCR = 0; /* initialize free-running timer */ } #ifdef CONFIG_NO_IDLE_HZ -- cgit v1.2.2 From 15a93807826a5cbffb47d6bfbeeee108d6da1dbc Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Tue, 8 Nov 2005 23:10:51 +0000 Subject: [SERIAL] IOC3: Update 8250 driver bits Update the support for the 16550 present on most IOC3 configurations to use the current API. Signed-off-by: Ralf Baechle Signed-off-by: Russell King --- drivers/net/ioc3-eth.c | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/drivers/net/ioc3-eth.c b/drivers/net/ioc3-eth.c index 49e5467bdd73..6a3129bc15a6 100644 --- a/drivers/net/ioc3-eth.c +++ b/drivers/net/ioc3-eth.c @@ -46,10 +46,8 @@ #include #ifdef CONFIG_SERIAL_8250 -#include -#include -#define IOC3_BAUD (22000000 / (3*16)) -#define IOC3_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) +#include +#include #endif #include @@ -1146,12 +1144,11 @@ static inline int ioc3_is_menet(struct pci_dev *pdev) * around ioc3 oddities in this respect. * * The IOC3 serials use a 22MHz clock rate with an additional divider by 3. - * (IOC3_BAUD = (22000000 / (3*16))) */ static void __devinit ioc3_serial_probe(struct pci_dev *pdev, struct ioc3 *ioc3) { - struct serial_struct req; + struct uart_port port; /* * We need to recognice and treat the fourth MENET serial as it @@ -1165,20 +1162,25 @@ static void __devinit ioc3_serial_probe(struct pci_dev *pdev, struct ioc3 *ioc3) if (ioc3_is_menet(pdev) && PCI_SLOT(pdev->devfn) == 3) return; - /* Register to interrupt zero because we share the interrupt with - the serial driver which we don't properly support yet. */ - memset(&req, 0, sizeof(req)); - req.irq = 0; - req.flags = IOC3_COM_FLAGS; - req.io_type = SERIAL_IO_MEM; - req.iomem_reg_shift = 0; - req.baud_base = IOC3_BAUD; - - req.iomem_base = (unsigned char *) &ioc3->sregs.uarta; - register_serial(&req); - - req.iomem_base = (unsigned char *) &ioc3->sregs.uartb; - register_serial(&req); + /* + * Register to interrupt zero because we share the interrupt with + * the serial driver which we don't properly support yet. + * + * Can't use UPF_IOREMAP as the whole of IOC3 resources have already + * been registered. + */ + memset(&port, 0, sizeof(port)); + port.irq = 0; + port.flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF; + port.iotype = UPIO_MEM; + port.regshift = 0; + port.uartclk = 22000000 / 3; + + port.membase = (unsigned char *) &ioc3->sregs.uarta; + serial8250_register_port(&port); + + port.membase = (unsigned char *) &ioc3->sregs.uartb; + serial8250_register_port(&port); } #endif -- cgit v1.2.2 From 330d57fb98a916fa8e1363846540dd420e99499a Mon Sep 17 00:00:00 2001 From: Al Viro Date: Fri, 4 Nov 2005 10:18:40 +0000 Subject: [PATCH] Fix sysctl unregistration oops (CVE-2005-2709) You could open the /proc/sys/net/ipv4/conf// file, then wait for interface to go away, try to grab as much memory as possible in hope to hit the (kfreed) ctl_table. Then fill it with pointers to your function. Then do read from file you've opened and if you are lucky, you'll get it called as ->proc_handler() in kernel mode. So this is at least an Oops and possibly more. It does depend on an interface going away though, so less of a security risk than it would otherwise be. Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- arch/s390/appldata/appldata_base.c | 7 +- include/linux/proc_fs.h | 1 + include/linux/sysctl.h | 3 + kernel/sysctl.c | 136 +++++++++++++++++++++++++++++-------- 4 files changed, 116 insertions(+), 31 deletions(-) diff --git a/arch/s390/appldata/appldata_base.c b/arch/s390/appldata/appldata_base.c index c9f2f60cfa58..dee6ab54984d 100644 --- a/arch/s390/appldata/appldata_base.c +++ b/arch/s390/appldata/appldata_base.c @@ -592,12 +592,15 @@ int appldata_register_ops(struct appldata_ops *ops) */ void appldata_unregister_ops(struct appldata_ops *ops) { + void *table; spin_lock(&appldata_ops_lock); - unregister_sysctl_table(ops->sysctl_header); list_del(&ops->list); - kfree(ops->ctl_table); + /* at that point any incoming access will fail */ + table = ops->ctl_table; ops->ctl_table = NULL; spin_unlock(&appldata_ops_lock); + unregister_sysctl_table(ops->sysctl_header); + kfree(table); P_INFO("%s-ops unregistered!\n", ops->name); } /********************** module-ops management **************************/ diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index 65ceeaa30652..74488e49166d 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h @@ -66,6 +66,7 @@ struct proc_dir_entry { write_proc_t *write_proc; atomic_t count; /* use count */ int deleted; /* delete flag */ + void *set; }; struct kcore_list { diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index fc8e367f671e..fc131d6602b9 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -24,6 +24,7 @@ #include struct file; +struct completion; #define CTL_MAXNAME 10 /* how many path components do we allow in a call to sysctl? In other words, what is @@ -925,6 +926,8 @@ struct ctl_table_header { ctl_table *ctl_table; struct list_head ctl_entry; + int used; + struct completion *unregistering; }; struct ctl_table_header * register_sysctl_table(ctl_table * table, diff --git a/kernel/sysctl.c b/kernel/sysctl.c index c4f35f96884d..9990e10192e8 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -169,7 +169,7 @@ struct file_operations proc_sys_file_operations = { extern struct proc_dir_entry *proc_sys_root; -static void register_proc_table(ctl_table *, struct proc_dir_entry *); +static void register_proc_table(ctl_table *, struct proc_dir_entry *, void *); static void unregister_proc_table(ctl_table *, struct proc_dir_entry *); #endif @@ -992,10 +992,51 @@ static ctl_table dev_table[] = { extern void init_irq_proc (void); +static DEFINE_SPINLOCK(sysctl_lock); + +/* called under sysctl_lock */ +static int use_table(struct ctl_table_header *p) +{ + if (unlikely(p->unregistering)) + return 0; + p->used++; + return 1; +} + +/* called under sysctl_lock */ +static void unuse_table(struct ctl_table_header *p) +{ + if (!--p->used) + if (unlikely(p->unregistering)) + complete(p->unregistering); +} + +/* called under sysctl_lock, will reacquire if has to wait */ +static void start_unregistering(struct ctl_table_header *p) +{ + /* + * if p->used is 0, nobody will ever touch that entry again; + * we'll eliminate all paths to it before dropping sysctl_lock + */ + if (unlikely(p->used)) { + struct completion wait; + init_completion(&wait); + p->unregistering = &wait; + spin_unlock(&sysctl_lock); + wait_for_completion(&wait); + spin_lock(&sysctl_lock); + } + /* + * do not remove from the list until nobody holds it; walking the + * list in do_sysctl() relies on that. + */ + list_del_init(&p->ctl_entry); +} + void __init sysctl_init(void) { #ifdef CONFIG_PROC_FS - register_proc_table(root_table, proc_sys_root); + register_proc_table(root_table, proc_sys_root, &root_table_header); init_irq_proc(); #endif } @@ -1004,6 +1045,7 @@ int do_sysctl(int __user *name, int nlen, void __user *oldval, size_t __user *ol void __user *newval, size_t newlen) { struct list_head *tmp; + int error = -ENOTDIR; if (nlen <= 0 || nlen >= CTL_MAXNAME) return -ENOTDIR; @@ -1012,20 +1054,30 @@ int do_sysctl(int __user *name, int nlen, void __user *oldval, size_t __user *ol if (!oldlenp || get_user(old_len, oldlenp)) return -EFAULT; } + spin_lock(&sysctl_lock); tmp = &root_table_header.ctl_entry; do { struct ctl_table_header *head = list_entry(tmp, struct ctl_table_header, ctl_entry); void *context = NULL; - int error = parse_table(name, nlen, oldval, oldlenp, + + if (!use_table(head)) + continue; + + spin_unlock(&sysctl_lock); + + error = parse_table(name, nlen, oldval, oldlenp, newval, newlen, head->ctl_table, &context); kfree(context); + + spin_lock(&sysctl_lock); + unuse_table(head); if (error != -ENOTDIR) - return error; - tmp = tmp->next; - } while (tmp != &root_table_header.ctl_entry); - return -ENOTDIR; + break; + } while ((tmp = tmp->next) != &root_table_header.ctl_entry); + spin_unlock(&sysctl_lock); + return error; } asmlinkage long sys_sysctl(struct __sysctl_args __user *args) @@ -1236,12 +1288,16 @@ struct ctl_table_header *register_sysctl_table(ctl_table * table, return NULL; tmp->ctl_table = table; INIT_LIST_HEAD(&tmp->ctl_entry); + tmp->used = 0; + tmp->unregistering = NULL; + spin_lock(&sysctl_lock); if (insert_at_head) list_add(&tmp->ctl_entry, &root_table_header.ctl_entry); else list_add_tail(&tmp->ctl_entry, &root_table_header.ctl_entry); + spin_unlock(&sysctl_lock); #ifdef CONFIG_PROC_FS - register_proc_table(table, proc_sys_root); + register_proc_table(table, proc_sys_root, tmp); #endif return tmp; } @@ -1255,10 +1311,13 @@ struct ctl_table_header *register_sysctl_table(ctl_table * table, */ void unregister_sysctl_table(struct ctl_table_header * header) { - list_del(&header->ctl_entry); + might_sleep(); + spin_lock(&sysctl_lock); + start_unregistering(header); #ifdef CONFIG_PROC_FS unregister_proc_table(header->ctl_table, proc_sys_root); #endif + spin_unlock(&sysctl_lock); kfree(header); } @@ -1269,7 +1328,7 @@ void unregister_sysctl_table(struct ctl_table_header * header) #ifdef CONFIG_PROC_FS /* Scan the sysctl entries in table and add them all into /proc */ -static void register_proc_table(ctl_table * table, struct proc_dir_entry *root) +static void register_proc_table(ctl_table * table, struct proc_dir_entry *root, void *set) { struct proc_dir_entry *de; int len; @@ -1305,13 +1364,14 @@ static void register_proc_table(ctl_table * table, struct proc_dir_entry *root) de = create_proc_entry(table->procname, mode, root); if (!de) continue; + de->set = set; de->data = (void *) table; if (table->proc_handler) de->proc_fops = &proc_sys_file_operations; } table->de = de; if (de->mode & S_IFDIR) - register_proc_table(table->child, de); + register_proc_table(table->child, de, set); } } @@ -1336,6 +1396,13 @@ static void unregister_proc_table(ctl_table * table, struct proc_dir_entry *root continue; } + /* + * In any case, mark the entry as goner; we'll keep it + * around if it's busy, but we'll know to do nothing with + * its fields. We are under sysctl_lock here. + */ + de->data = NULL; + /* Don't unregister proc entries that are still being used.. */ if (atomic_read(&de->count)) continue; @@ -1349,27 +1416,38 @@ static ssize_t do_rw_proc(int write, struct file * file, char __user * buf, size_t count, loff_t *ppos) { int op; - struct proc_dir_entry *de; + struct proc_dir_entry *de = PDE(file->f_dentry->d_inode); struct ctl_table *table; size_t res; - ssize_t error; - - de = PDE(file->f_dentry->d_inode); - if (!de || !de->data) - return -ENOTDIR; - table = (struct ctl_table *) de->data; - if (!table || !table->proc_handler) - return -ENOTDIR; - op = (write ? 002 : 004); - if (ctl_perm(table, op)) - return -EPERM; + ssize_t error = -ENOTDIR; - res = count; - - error = (*table->proc_handler) (table, write, file, buf, &res, ppos); - if (error) - return error; - return res; + spin_lock(&sysctl_lock); + if (de && de->data && use_table(de->set)) { + /* + * at that point we know that sysctl was not unregistered + * and won't be until we finish + */ + spin_unlock(&sysctl_lock); + table = (struct ctl_table *) de->data; + if (!table || !table->proc_handler) + goto out; + error = -EPERM; + op = (write ? 002 : 004); + if (ctl_perm(table, op)) + goto out; + + /* careful: calling conventions are nasty here */ + res = count; + error = (*table->proc_handler)(table, write, file, + buf, &res, ppos); + if (!error) + error = res; + out: + spin_lock(&sysctl_lock); + unuse_table(de->set); + } + spin_unlock(&sysctl_lock); + return error; } static int proc_opensys(struct inode *inode, struct file *file) -- cgit v1.2.2 From adba9e23b4066f1d741a2076fc6ad18b6c0cea44 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 8 Nov 2005 10:33:40 -0800 Subject: [PATCH] skge: clear PCI PHY COMA mode on boot When skge is booted up, the PHY may be stuck in power down state by the previous OS. So we may need to turn it on. Signed-off-by: Stephen Hemminger Signed-off-by: Jeff Garzik --- drivers/net/skge.c | 10 ++++++++++ drivers/net/skge.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/drivers/net/skge.c b/drivers/net/skge.c index 572f121b1f4e..fe806dbc1914 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c @@ -2893,6 +2893,7 @@ static const char *skge_board_name(const struct skge_hw *hw) */ static int skge_reset(struct skge_hw *hw) { + u32 reg; u16 ctst; u8 t8, mac_cfg, pmd_type, phy_type; int i; @@ -2971,6 +2972,7 @@ static int skge_reset(struct skge_hw *hw) /* switch power to VCC (WA for VAUX problem) */ skge_write8(hw, B0_POWER_CTRL, PC_VAUX_ENA | PC_VCC_ENA | PC_VAUX_OFF | PC_VCC_ON); + /* avoid boards with stuck Hardware error bits */ if ((skge_read32(hw, B0_ISRC) & IS_HW_ERR) && (skge_read32(hw, B0_HWE_ISRC) & IS_IRQ_SENSOR)) { @@ -2978,6 +2980,14 @@ static int skge_reset(struct skge_hw *hw) hw->intr_mask &= ~IS_HW_ERR; } + /* Clear PHY COMA */ + skge_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); + pci_read_config_dword(hw->pdev, PCI_DEV_REG1, ®); + reg &= ~PCI_PHY_COMA; + pci_write_config_dword(hw->pdev, PCI_DEV_REG1, reg); + skge_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); + + for (i = 0; i < hw->ports; i++) { skge_write16(hw, SK_REG(i, GMAC_LINK_CTRL), GMLC_RST_SET); skge_write16(hw, SK_REG(i, GMAC_LINK_CTRL), GMLC_RST_CLR); diff --git a/drivers/net/skge.h b/drivers/net/skge.h index 72c175b87a5a..ee123c15f545 100644 --- a/drivers/net/skge.h +++ b/drivers/net/skge.h @@ -6,6 +6,8 @@ /* PCI config registers */ #define PCI_DEV_REG1 0x40 +#define PCI_PHY_COMA 0x8000000 +#define PCI_VIO 0x2000000 #define PCI_DEV_REG2 0x44 #define PCI_REV_DESC 0x4 -- cgit v1.2.2 From 7e86306113ca9e418e49ff1c7c0984f8ffe8cf61 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 8 Nov 2005 10:33:41 -0800 Subject: [PATCH] skge: use kzalloc Can use kzalloc in skge driver. Signed-off-by: Stephen Hemminger Signed-off-by: Jeff Garzik --- drivers/net/skge.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/skge.c b/drivers/net/skge.c index fe806dbc1914..f411c5c80410 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c @@ -3168,14 +3168,13 @@ static int __devinit skge_probe(struct pci_dev *pdev, #endif err = -ENOMEM; - hw = kmalloc(sizeof(*hw), GFP_KERNEL); + hw = kzalloc(sizeof(*hw), GFP_KERNEL); if (!hw) { printk(KERN_ERR PFX "%s: cannot allocate hardware struct\n", pci_name(pdev)); goto err_out_free_regions; } - memset(hw, 0, sizeof(*hw)); hw->pdev = pdev; spin_lock_init(&hw->phy_lock); tasklet_init(&hw->ext_tasklet, skge_extirq, (unsigned long) hw); -- cgit v1.2.2 From 2cd8e5d36584653c62a6fdf0e7d9fbde5022b5d6 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 8 Nov 2005 10:33:42 -0800 Subject: [PATCH] skge: add mii ioctl support Basic MII ioctl support for skge driver. Signed-off-by: Stephen Hemminger Signed-off-by: Jeff Garzik --- drivers/net/skge.c | 172 +++++++++++++++++++++++++++++++++++------------------ 1 file changed, 114 insertions(+), 58 deletions(-) diff --git a/drivers/net/skge.c b/drivers/net/skge.c index f411c5c80410..a1cfead5827b 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include "skge.h" @@ -88,8 +89,8 @@ MODULE_DEVICE_TABLE(pci, skge_id_table); static int skge_up(struct net_device *dev); static int skge_down(struct net_device *dev); static void skge_tx_clean(struct skge_port *skge); -static void xm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val); -static void gm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val); +static int xm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val); +static int gm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val); static void genesis_get_stats(struct skge_port *skge, u64 *data); static void yukon_get_stats(struct skge_port *skge, u64 *data); static void yukon_init(struct skge_hw *hw, int port); @@ -883,32 +884,37 @@ static void skge_link_down(struct skge_port *skge) printk(KERN_INFO PFX "%s: Link is down.\n", skge->netdev->name); } -static u16 xm_phy_read(struct skge_hw *hw, int port, u16 reg) +static int __xm_phy_read(struct skge_hw *hw, int port, u16 reg, u16 *val) { int i; - u16 v; xm_write16(hw, port, XM_PHY_ADDR, reg | hw->phy_addr); - v = xm_read16(hw, port, XM_PHY_DATA); + xm_read16(hw, port, XM_PHY_DATA); /* Need to wait for external PHY */ for (i = 0; i < PHY_RETRIES; i++) { udelay(1); - if (xm_read16(hw, port, XM_MMU_CMD) - & XM_MMU_PHY_RDY) + if (xm_read16(hw, port, XM_MMU_CMD) & XM_MMU_PHY_RDY) goto ready; } - printk(KERN_WARNING PFX "%s: phy read timed out\n", - hw->dev[port]->name); - return 0; + return -ETIMEDOUT; ready: - v = xm_read16(hw, port, XM_PHY_DATA); + *val = xm_read16(hw, port, XM_PHY_DATA); + return 0; +} + +static u16 xm_phy_read(struct skge_hw *hw, int port, u16 reg) +{ + u16 v = 0; + if (__xm_phy_read(hw, port, reg, &v)) + printk(KERN_WARNING PFX "%s: phy read timed out\n", + hw->dev[port]->name); return v; } -static void xm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val) +static int xm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val) { int i; @@ -918,19 +924,11 @@ static void xm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val) goto ready; udelay(1); } - printk(KERN_WARNING PFX "%s: phy write failed to come ready\n", - hw->dev[port]->name); - + return -EIO; ready: xm_write16(hw, port, XM_PHY_DATA, val); - for (i = 0; i < PHY_RETRIES; i++) { - udelay(1); - if (!(xm_read16(hw, port, XM_MMU_CMD) & XM_MMU_PHY_BUSY)) - return; - } - printk(KERN_WARNING PFX "%s: phy write timed out\n", - hw->dev[port]->name); + return 0; } static void genesis_init(struct skge_hw *hw) @@ -1400,42 +1398,6 @@ static void genesis_mac_intr(struct skge_hw *hw, int port) } } -static void gm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val) -{ - int i; - - gma_write16(hw, port, GM_SMI_DATA, val); - gma_write16(hw, port, GM_SMI_CTRL, - GM_SMI_CT_PHY_AD(hw->phy_addr) | GM_SMI_CT_REG_AD(reg)); - for (i = 0; i < PHY_RETRIES; i++) { - udelay(1); - - if (!(gma_read16(hw, port, GM_SMI_CTRL) & GM_SMI_CT_BUSY)) - break; - } -} - -static u16 gm_phy_read(struct skge_hw *hw, int port, u16 reg) -{ - int i; - - gma_write16(hw, port, GM_SMI_CTRL, - GM_SMI_CT_PHY_AD(hw->phy_addr) - | GM_SMI_CT_REG_AD(reg) | GM_SMI_CT_OP_RD); - - for (i = 0; i < PHY_RETRIES; i++) { - udelay(1); - if (gma_read16(hw, port, GM_SMI_CTRL) & GM_SMI_CT_RD_VAL) - goto ready; - } - - printk(KERN_WARNING PFX "%s: phy read timeout\n", - hw->dev[port]->name); - return 0; - ready: - return gma_read16(hw, port, GM_SMI_DATA); -} - static void genesis_link_up(struct skge_port *skge) { struct skge_hw *hw = skge->hw; @@ -1549,6 +1511,54 @@ static inline void bcom_phy_intr(struct skge_port *skge) } +static int gm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val) +{ + int i; + + gma_write16(hw, port, GM_SMI_DATA, val); + gma_write16(hw, port, GM_SMI_CTRL, + GM_SMI_CT_PHY_AD(hw->phy_addr) | GM_SMI_CT_REG_AD(reg)); + for (i = 0; i < PHY_RETRIES; i++) { + udelay(1); + + if (!(gma_read16(hw, port, GM_SMI_CTRL) & GM_SMI_CT_BUSY)) + return 0; + } + + printk(KERN_WARNING PFX "%s: phy write timeout\n", + hw->dev[port]->name); + return -EIO; +} + +static int __gm_phy_read(struct skge_hw *hw, int port, u16 reg, u16 *val) +{ + int i; + + gma_write16(hw, port, GM_SMI_CTRL, + GM_SMI_CT_PHY_AD(hw->phy_addr) + | GM_SMI_CT_REG_AD(reg) | GM_SMI_CT_OP_RD); + + for (i = 0; i < PHY_RETRIES; i++) { + udelay(1); + if (gma_read16(hw, port, GM_SMI_CTRL) & GM_SMI_CT_RD_VAL) + goto ready; + } + + return -ETIMEDOUT; + ready: + *val = gma_read16(hw, port, GM_SMI_DATA); + return 0; +} + +static u16 gm_phy_read(struct skge_hw *hw, int port, u16 reg) +{ + u16 v = 0; + if (__gm_phy_read(hw, port, reg, &v)) + printk(KERN_WARNING PFX "%s: phy read timeout\n", + hw->dev[port]->name); + return v; +} + /* Marvell Phy Initailization */ static void yukon_init(struct skge_hw *hw, int port) { @@ -1997,6 +2007,51 @@ static void yukon_phy_intr(struct skge_port *skge) /* XXX restart autonegotiation? */ } +/* Basic MII support */ +static int skge_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) +{ + struct mii_ioctl_data *data = if_mii(ifr); + struct skge_port *skge = netdev_priv(dev); + struct skge_hw *hw = skge->hw; + int err = -EOPNOTSUPP; + + if (!netif_running(dev)) + return -ENODEV; /* Phy still in reset */ + + switch(cmd) { + case SIOCGMIIPHY: + data->phy_id = hw->phy_addr; + + /* fallthru */ + case SIOCGMIIREG: { + u16 val = 0; + spin_lock_bh(&hw->phy_lock); + if (hw->chip_id == CHIP_ID_GENESIS) + err = __xm_phy_read(hw, skge->port, data->reg_num & 0x1f, &val); + else + err = __gm_phy_read(hw, skge->port, data->reg_num & 0x1f, &val); + spin_unlock_bh(&hw->phy_lock); + data->val_out = val; + break; + } + + case SIOCSMIIREG: + if (!capable(CAP_NET_ADMIN)) + return -EPERM; + + spin_lock_bh(&hw->phy_lock); + if (hw->chip_id == CHIP_ID_GENESIS) + err = xm_phy_write(hw, skge->port, data->reg_num & 0x1f, + data->val_in); + else + err = gm_phy_write(hw, skge->port, data->reg_num & 0x1f, + data->val_in); + spin_unlock_bh(&hw->phy_lock); + break; + } + return err; +} + static void skge_ramset(struct skge_hw *hw, u16 q, u32 start, size_t len) { u32 end; @@ -3058,6 +3113,7 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port, SET_NETDEV_DEV(dev, &hw->pdev->dev); dev->open = skge_up; dev->stop = skge_down; + dev->do_ioctl = skge_ioctl; dev->hard_start_xmit = skge_xmit_frame; dev->get_stats = skge_get_stats; if (hw->chip_id == CHIP_ID_GENESIS) -- cgit v1.2.2 From 355ec57243574c439a4b731fc83af6165ec2f1ec Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 8 Nov 2005 10:33:43 -0800 Subject: [PATCH] skge: goto low power mode on shutdown Go into power down mode on shutdown. Signed-off-by: Stephen Hemminger Signed-off-by: Jeff Garzik --- drivers/net/skge.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/drivers/net/skge.c b/drivers/net/skge.c index a1cfead5827b..ea68d4d3d57c 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c @@ -1804,6 +1804,25 @@ static void yukon_mac_init(struct skge_hw *hw, int port) skge_write16(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_OPER_ON); } +/* Go into power down mode */ +static void yukon_suspend(struct skge_hw *hw, int port) +{ + u16 ctrl; + + ctrl = gm_phy_read(hw, port, PHY_MARV_PHY_CTRL); + ctrl |= PHY_M_PC_POL_R_DIS; + gm_phy_write(hw, port, PHY_MARV_PHY_CTRL, ctrl); + + ctrl = gm_phy_read(hw, port, PHY_MARV_CTRL); + ctrl |= PHY_CT_RESET; + gm_phy_write(hw, port, PHY_MARV_CTRL, ctrl); + + /* switch IEEE compatible power down mode on */ + ctrl = gm_phy_read(hw, port, PHY_MARV_CTRL); + ctrl |= PHY_CT_PDOWN; + gm_phy_write(hw, port, PHY_MARV_CTRL, ctrl); +} + static void yukon_stop(struct skge_port *skge) { struct skge_hw *hw = skge->hw; @@ -1817,14 +1836,7 @@ static void yukon_stop(struct skge_port *skge) & ~(GM_GPCR_TX_ENA|GM_GPCR_RX_ENA)); gma_read16(hw, port, GM_GP_CTRL); - if (hw->chip_id == CHIP_ID_YUKON_LITE && - hw->chip_rev >= CHIP_REV_YU_LITE_A3) { - u32 io = skge_read32(hw, B2_GP_IO); - - io |= GP_DIR_9 | GP_IO_9; - skge_write32(hw, B2_GP_IO, io); - skge_read32(hw, B2_GP_IO); - } + yukon_suspend(hw, port); /* set GPHY Control reset */ skge_write8(hw, SK_REG(port, GPHY_CTRL), GPC_RST_SET); -- cgit v1.2.2 From 1631aef15193ef8a199982fa3d45db4d07786d7f Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 8 Nov 2005 10:33:44 -0800 Subject: [PATCH] skge: use prefetch on receive Use prefetch() in the interrupt path to try and look ahead at the next place will be looking at in the ring. Signed-off-by: Stephen Hemminger Signed-off-by: Jeff Garzik --- drivers/net/skge.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/net/skge.c b/drivers/net/skge.c index ea68d4d3d57c..389d0be35865 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c @@ -2627,7 +2627,7 @@ static int skge_poll(struct net_device *dev, int *budget) unsigned int to_do = min(dev->quota, *budget); unsigned int work_done = 0; - for (e = ring->to_clean; work_done < to_do; e = e->next) { + for (e = ring->to_clean; prefetch(e->next), work_done < to_do; e = e->next) { struct skge_rx_desc *rd = e->desc; struct sk_buff *skb; u32 control; @@ -2660,11 +2660,11 @@ static int skge_poll(struct net_device *dev, int *budget) if (work_done >= to_do) return 1; /* not done */ - local_irq_disable(); - __netif_rx_complete(dev); + netif_rx_complete(dev); hw->intr_mask |= portirqmask[skge->port]; skge_write32(hw, B0_IMSK, hw->intr_mask); - local_irq_enable(); + skge_read32(hw, B0_IMSK); + return 0; } @@ -2676,7 +2676,7 @@ static inline void skge_tx_intr(struct net_device *dev) struct skge_element *e; spin_lock(&skge->tx_lock); - for (e = ring->to_clean; e != ring->to_use; e = e->next) { + for (e = ring->to_clean; prefetch(e->next), e != ring->to_use; e = e->next) { struct skge_tx_desc *td = e->desc; u32 control; @@ -2829,6 +2829,14 @@ static void skge_extirq(unsigned long data) local_irq_enable(); } +static inline void skge_wakeup(struct net_device *dev) +{ + struct skge_port *skge = netdev_priv(dev); + + prefetch(skge->rx_ring.to_clean); + netif_rx_schedule(dev); +} + static irqreturn_t skge_intr(int irq, void *dev_id, struct pt_regs *regs) { struct skge_hw *hw = dev_id; @@ -2840,12 +2848,12 @@ static irqreturn_t skge_intr(int irq, void *dev_id, struct pt_regs *regs) status &= hw->intr_mask; if (status & IS_R1_F) { hw->intr_mask &= ~IS_R1_F; - netif_rx_schedule(hw->dev[0]); + skge_wakeup(hw->dev[0]); } if (status & IS_R2_F) { hw->intr_mask &= ~IS_R2_F; - netif_rx_schedule(hw->dev[1]); + skge_wakeup(hw->dev[1]); } if (status & IS_XA1_F) -- cgit v1.2.2 From 8f3f8193a49e1eb0d2e01309fdef2ad4fb33293c Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 8 Nov 2005 10:33:45 -0800 Subject: [PATCH] skge: spelling fixes Fix some of my bad spelling. Signed-off-by: Stephen Hemminger Signed-off-by: Jeff Garzik --- drivers/net/skge.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/net/skge.c b/drivers/net/skge.c index 389d0be35865..df30274aad11 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c @@ -130,7 +130,7 @@ static void skge_get_regs(struct net_device *dev, struct ethtool_regs *regs, regs->len - B3_RI_WTO_R1); } -/* Wake on Lan only supported on Yukon chps with rev 1 or above */ +/* Wake on Lan only supported on Yukon chips with rev 1 or above */ static int wol_supported(const struct skge_hw *hw) { return !((hw->chip_id == CHIP_ID_GENESIS || @@ -170,8 +170,8 @@ static int skge_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) return 0; } -/* Determine supported/adverised modes based on hardware. - * Note: ethtoool ADVERTISED_xxx == SUPPORTED_xxx +/* Determine supported/advertised modes based on hardware. + * Note: ethtool ADVERTISED_xxx == SUPPORTED_xxx */ static u32 skge_supported_modes(const struct skge_hw *hw) { @@ -532,13 +532,13 @@ static inline u32 hwkhz(const struct skge_hw *hw) return 78215; /* or: 78.125 MHz */ } -/* Chip hz to microseconds */ +/* Chip HZ to microseconds */ static inline u32 skge_clk2usec(const struct skge_hw *hw, u32 ticks) { return (ticks * 1000) / hwkhz(hw); } -/* Microseconds to chip hz */ +/* Microseconds to chip HZ */ static inline u32 skge_usecs2clk(const struct skge_hw *hw, u32 usec) { return hwkhz(hw) * usec / 1000; @@ -1163,7 +1163,7 @@ static void bcom_phy_init(struct skge_port *skge, int jumbo) xm_phy_write(hw, port, PHY_BCOM_P_EXT_CTRL, ext); xm_phy_write(hw, port, PHY_BCOM_CTRL, ctl); - /* Use link status change interrrupt */ + /* Use link status change interrupt */ xm_phy_write(hw, port, PHY_BCOM_INT_MASK, PHY_B_DEF_MSK); bcom_check_link(hw, port); @@ -1203,7 +1203,7 @@ static void genesis_mac_init(struct skge_hw *hw, int port) skge_write32(hw, B2_GP_IO, r); skge_read32(hw, B2_GP_IO); - /* Enable GMII interfac */ + /* Enable GMII interface */ xm_write16(hw, port, XM_HW_CFG, XM_HW_GMII_MD); bcom_phy_init(skge, jumbo); @@ -1254,7 +1254,7 @@ static void genesis_mac_init(struct skge_hw *hw, int port) * that jumbo frames larger than 8192 bytes will be * truncated. Disabling all bad frame filtering causes * the RX FIFO to operate in streaming mode, in which - * case the XMAC will start transfering frames out of the + * case the XMAC will start transferring frames out of the * RX FIFO as soon as the FIFO threshold is reached. */ xm_write32(hw, port, XM_MODE, XM_DEF_MODE); @@ -1321,7 +1321,7 @@ static void genesis_stop(struct skge_port *skge) port == 0 ? PA_CLR_TO_TX1 : PA_CLR_TO_TX2); /* - * If the transfer stucks at the MAC the STOP command will not + * If the transfer sticks at the MAC the STOP command will not * terminate if we don't flush the XMAC's transmit FIFO ! */ xm_write32(hw, port, XM_MODE, @@ -1559,7 +1559,7 @@ static u16 gm_phy_read(struct skge_hw *hw, int port, u16 reg) return v; } -/* Marvell Phy Initailization */ +/* Marvell Phy Initialization */ static void yukon_init(struct skge_hw *hw, int port) { struct skge_port *skge = netdev_priv(hw->dev[port]); @@ -2156,7 +2156,7 @@ static int skge_up(struct net_device *dev) hw->intr_mask |= portirqmask[port]; skge_write32(hw, B0_IMSK, hw->intr_mask); - /* Initialze MAC */ + /* Initialize MAC */ spin_lock_bh(&hw->phy_lock); if (hw->chip_id == CHIP_ID_GENESIS) genesis_mac_init(hw, port); @@ -2476,7 +2476,7 @@ static void yukon_set_multicast(struct net_device *dev) reg = gma_read16(hw, port, GM_RX_CTRL); reg |= GM_RXCR_UCF_ENA; - if (dev->flags & IFF_PROMISC) /* promiscious */ + if (dev->flags & IFF_PROMISC) /* promiscuous */ reg &= ~(GM_RXCR_UCF_ENA | GM_RXCR_MCF_ENA); else if (dev->flags & IFF_ALLMULTI) /* all multicast */ memset(filter, 0xff, sizeof(filter)); @@ -2799,7 +2799,7 @@ static void skge_error_irq(struct skge_hw *hw) } /* - * Interrrupt from PHY are handled in tasklet (soft irq) + * Interrupt from PHY are handled in tasklet (soft irq) * because accessing phy registers requires spin wait which might * cause excess interrupt latency. */ @@ -3233,7 +3233,7 @@ static int __devinit skge_probe(struct pci_dev *pdev, } #ifdef __BIG_ENDIAN - /* byte swap decriptors in hardware */ + /* byte swap descriptors in hardware */ { u32 reg; -- cgit v1.2.2 From d7eaee087a8cb850ed33ee39a3e2a0f02ecff44c Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 8 Nov 2005 10:33:46 -0800 Subject: [PATCH] skge: increase version number Increase the driver version number and print version when probing. Signed-off-by: Stephen Hemminger Signed-off-by: Jeff Garzik --- drivers/net/skge.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/skge.c b/drivers/net/skge.c index df30274aad11..596c93b12daa 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c @@ -43,7 +43,7 @@ #include "skge.h" #define DRV_NAME "skge" -#define DRV_VERSION "1.1" +#define DRV_VERSION "1.2" #define PFX DRV_NAME " " #define DEFAULT_TX_RING_SIZE 128 @@ -3273,7 +3273,7 @@ static int __devinit skge_probe(struct pci_dev *pdev, if (err) goto err_out_free_irq; - printk(KERN_INFO PFX "addr 0x%lx irq %d chip %s rev %d\n", + printk(KERN_INFO PFX DRV_VERSION " addr 0x%lx irq %d chip %s rev %d\n", pci_resource_start(pdev, 0), pdev->irq, skge_board_name(hw), hw->chip_rev); -- cgit v1.2.2 From c2a8fad43376b2567087358a9cc46844f742342e Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Wed, 9 Nov 2005 00:49:38 -0500 Subject: [wireless ipw2100] kill unused-var warnings for debug-disabled code --- drivers/net/wireless/ipw2100.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c index 877ac514aa07..a2e6214169e9 100644 --- a/drivers/net/wireless/ipw2100.c +++ b/drivers/net/wireless/ipw2100.c @@ -3748,6 +3748,8 @@ static ssize_t store_memory(struct device *d, struct device_attribute *attr, struct net_device *dev = priv->net_dev; const char *p = buf; + (void) dev; /* kill unused-var warning for debug-only code */ + if (count < 1) return count; @@ -4066,6 +4068,8 @@ static ssize_t store_scan_age(struct device *d, struct device_attribute *attr, unsigned long val; char *p = buffer; + (void) dev; /* kill unused-var warning for debug-only code */ + IPW_DEBUG_INFO("enter\n"); strncpy(buffer, buf, len); -- cgit v1.2.2 From e3305626e0985faa8796f1f4e5a99c1f40bfa70e Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Wed, 9 Nov 2005 01:01:04 -0500 Subject: ieee80211: cleanup crypto list handling, other minor cleanups. --- include/net/ieee80211_crypt.h | 1 + net/ieee80211/ieee80211_crypt.c | 152 +++++++++++----------------------------- 2 files changed, 42 insertions(+), 111 deletions(-) diff --git a/include/net/ieee80211_crypt.h b/include/net/ieee80211_crypt.h index 0a1c2d82ca4b..225fc751d464 100644 --- a/include/net/ieee80211_crypt.h +++ b/include/net/ieee80211_crypt.h @@ -31,6 +31,7 @@ enum { struct ieee80211_crypto_ops { const char *name; + struct list_head list; /* init new crypto context (e.g., allocate private data space, * select IV, etc.); returns NULL on failure or pointer to allocated diff --git a/net/ieee80211/ieee80211_crypt.c b/net/ieee80211/ieee80211_crypt.c index 20cc580a07e0..ecc9bb196abc 100644 --- a/net/ieee80211/ieee80211_crypt.c +++ b/net/ieee80211/ieee80211_crypt.c @@ -11,15 +11,14 @@ * */ -#include +#include #include #include #include -#include -#include - +#include #include + MODULE_AUTHOR("Jouni Malinen"); MODULE_DESCRIPTION("HostAP crypto"); MODULE_LICENSE("GPL"); @@ -29,32 +28,20 @@ struct ieee80211_crypto_alg { struct ieee80211_crypto_ops *ops; }; -struct ieee80211_crypto { - struct list_head algs; - spinlock_t lock; -}; - -static struct ieee80211_crypto *hcrypt; +static LIST_HEAD(ieee80211_crypto_algs); +static DEFINE_SPINLOCK(ieee80211_crypto_lock); void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee, int force) { - struct list_head *ptr, *n; - struct ieee80211_crypt_data *entry; + struct ieee80211_crypt_data *entry, *next; unsigned long flags; spin_lock_irqsave(&ieee->lock, flags); - - if (list_empty(&ieee->crypt_deinit_list)) - goto unlock; - - for (ptr = ieee->crypt_deinit_list.next, n = ptr->next; - ptr != &ieee->crypt_deinit_list; ptr = n, n = ptr->next) { - entry = list_entry(ptr, struct ieee80211_crypt_data, list); - + list_for_each_entry_safe(entry, next, &ieee->crypt_deinit_list, list) { if (atomic_read(&entry->refcnt) != 0 && !force) continue; - list_del(ptr); + list_del(&entry->list); if (entry->ops) { entry->ops->deinit(entry->priv); @@ -62,7 +49,6 @@ void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee, int force) } kfree(entry); } - unlock: spin_unlock_irqrestore(&ieee->lock, flags); } @@ -125,9 +111,6 @@ int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops) unsigned long flags; struct ieee80211_crypto_alg *alg; - if (hcrypt == NULL) - return -1; - alg = kmalloc(sizeof(*alg), GFP_KERNEL); if (alg == NULL) return -ENOMEM; @@ -135,9 +118,9 @@ int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops) memset(alg, 0, sizeof(*alg)); alg->ops = ops; - spin_lock_irqsave(&hcrypt->lock, flags); - list_add(&alg->list, &hcrypt->algs); - spin_unlock_irqrestore(&hcrypt->lock, flags); + spin_lock_irqsave(&ieee80211_crypto_lock, flags); + list_add(&alg->list, &ieee80211_crypto_algs); + spin_unlock_irqrestore(&ieee80211_crypto_lock, flags); printk(KERN_DEBUG "ieee80211_crypt: registered algorithm '%s'\n", ops->name); @@ -147,64 +130,49 @@ int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops) int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops) { + struct ieee80211_crypto_alg *alg; unsigned long flags; - struct list_head *ptr; - struct ieee80211_crypto_alg *del_alg = NULL; - - if (hcrypt == NULL) - return -1; - - spin_lock_irqsave(&hcrypt->lock, flags); - for (ptr = hcrypt->algs.next; ptr != &hcrypt->algs; ptr = ptr->next) { - struct ieee80211_crypto_alg *alg = - (struct ieee80211_crypto_alg *)ptr; - if (alg->ops == ops) { - list_del(&alg->list); - del_alg = alg; - break; - } - } - spin_unlock_irqrestore(&hcrypt->lock, flags); - if (del_alg) { - printk(KERN_DEBUG "ieee80211_crypt: unregistered algorithm " - "'%s'\n", ops->name); - kfree(del_alg); + spin_lock_irqsave(&ieee80211_crypto_lock, flags); + list_for_each_entry(alg, &ieee80211_crypto_algs, list) { + if (alg->ops == ops) + goto found; } - - return del_alg ? 0 : -1; + spin_unlock_irqrestore(&ieee80211_crypto_lock, flags); + return -EINVAL; + + found: + printk(KERN_DEBUG "ieee80211_crypt: unregistered algorithm " + "'%s'\n", ops->name); + list_del(&alg->list); + spin_unlock_irqrestore(&ieee80211_crypto_lock, flags); + kfree(alg); + return 0; } struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name) { + struct ieee80211_crypto_alg *alg; unsigned long flags; - struct list_head *ptr; - struct ieee80211_crypto_alg *found_alg = NULL; - - if (hcrypt == NULL) - return NULL; - - spin_lock_irqsave(&hcrypt->lock, flags); - for (ptr = hcrypt->algs.next; ptr != &hcrypt->algs; ptr = ptr->next) { - struct ieee80211_crypto_alg *alg = - (struct ieee80211_crypto_alg *)ptr; - if (strcmp(alg->ops->name, name) == 0) { - found_alg = alg; - break; - } + + spin_lock_irqsave(&ieee80211_crypto_lock, flags); + list_for_each_entry(alg, &ieee80211_crypto_algs, list) { + if (strcmp(alg->ops->name, name) == 0) + goto found; } - spin_unlock_irqrestore(&hcrypt->lock, flags); + spin_unlock_irqrestore(&ieee80211_crypto_lock, flags); + return NULL; - if (found_alg) - return found_alg->ops; - else - return NULL; + found: + spin_unlock_irqrestore(&ieee80211_crypto_lock, flags); + return alg->ops; } static void *ieee80211_crypt_null_init(int keyidx) { return (void *)1; } + static void ieee80211_crypt_null_deinit(void *priv) { } @@ -213,56 +181,18 @@ static struct ieee80211_crypto_ops ieee80211_crypt_null = { .name = "NULL", .init = ieee80211_crypt_null_init, .deinit = ieee80211_crypt_null_deinit, - .encrypt_mpdu = NULL, - .decrypt_mpdu = NULL, - .encrypt_msdu = NULL, - .decrypt_msdu = NULL, - .set_key = NULL, - .get_key = NULL, - .extra_mpdu_prefix_len = 0, - .extra_mpdu_postfix_len = 0, .owner = THIS_MODULE, }; static int __init ieee80211_crypto_init(void) { - int ret = -ENOMEM; - - hcrypt = kmalloc(sizeof(*hcrypt), GFP_KERNEL); - if (!hcrypt) - goto out; - - memset(hcrypt, 0, sizeof(*hcrypt)); - INIT_LIST_HEAD(&hcrypt->algs); - spin_lock_init(&hcrypt->lock); - - ret = ieee80211_register_crypto_ops(&ieee80211_crypt_null); - if (ret < 0) { - kfree(hcrypt); - hcrypt = NULL; - } - out: - return ret; + return ieee80211_register_crypto_ops(&ieee80211_crypt_null); } static void __exit ieee80211_crypto_deinit(void) { - struct list_head *ptr, *n; - - if (hcrypt == NULL) - return; - - for (ptr = hcrypt->algs.next, n = ptr->next; ptr != &hcrypt->algs; - ptr = n, n = ptr->next) { - struct ieee80211_crypto_alg *alg = - (struct ieee80211_crypto_alg *)ptr; - list_del(ptr); - printk(KERN_DEBUG "ieee80211_crypt: unregistered algorithm " - "'%s' (deinit)\n", alg->ops->name); - kfree(alg); - } - - kfree(hcrypt); + ieee80211_unregister_crypto_ops(&ieee80211_crypt_null); + BUG_ON(!list_empty(&ieee80211_crypto_algs)); } EXPORT_SYMBOL(ieee80211_crypt_deinit_entries); -- cgit v1.2.2 From b9dcbb40f40d60c7e33a2b7ea858fcd27c35cc00 Mon Sep 17 00:00:00 2001 From: Francois Romieu Date: Tue, 8 Nov 2005 23:36:20 +0100 Subject: [PATCH] b44: replace B44_FLAG_INIT_COMPLETE with netif_running() Signed-off-by: Francois Romieu Signed-off-by: Jeff Garzik --- drivers/net/b44.c | 6 ++---- drivers/net/b44.h | 1 - 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/net/b44.c b/drivers/net/b44.c index ecc2e32c38c1..f1675dcf4d5c 100644 --- a/drivers/net/b44.c +++ b/drivers/net/b44.c @@ -1392,7 +1392,6 @@ static int b44_open(struct net_device *dev) b44_init_rings(bp); b44_init_hw(bp); - bp->flags |= B44_FLAG_INIT_COMPLETE; netif_carrier_off(dev); b44_check_phy(bp); @@ -1456,7 +1455,6 @@ static int b44_close(struct net_device *dev) #endif b44_halt(bp); b44_free_rings(bp); - bp->flags &= ~B44_FLAG_INIT_COMPLETE; netif_carrier_off(bp->dev); spin_unlock_irq(&bp->lock); @@ -1608,7 +1606,7 @@ static int b44_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) { struct b44 *bp = netdev_priv(dev); - if (!(bp->flags & B44_FLAG_INIT_COMPLETE)) + if (!netif_running(dev)) return -EAGAIN; cmd->supported = (SUPPORTED_Autoneg); cmd->supported |= (SUPPORTED_100baseT_Half | @@ -1646,7 +1644,7 @@ static int b44_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) { struct b44 *bp = netdev_priv(dev); - if (!(bp->flags & B44_FLAG_INIT_COMPLETE)) + if (!netif_running(dev)) return -EAGAIN; /* We do not support gigabit. */ diff --git a/drivers/net/b44.h b/drivers/net/b44.h index 7afeaf608232..b178662978f3 100644 --- a/drivers/net/b44.h +++ b/drivers/net/b44.h @@ -420,7 +420,6 @@ struct b44 { u32 dma_offset; u32 flags; -#define B44_FLAG_INIT_COMPLETE 0x00000001 #define B44_FLAG_BUGGY_TXPTR 0x00000002 #define B44_FLAG_REORDER_BUG 0x00000004 #define B44_FLAG_PAUSE_AUTO 0x00008000 -- cgit v1.2.2 From ba5eec9c55ec4be99d21a6ea614003b65d7f37d7 Mon Sep 17 00:00:00 2001 From: Francois Romieu Date: Tue, 8 Nov 2005 23:37:12 +0100 Subject: [PATCH] b44: race on device closing Usual fix: - b44_interrupt() does not schedule NAPI polling when the device is going down; - b44_close() waits for any scheduled NAPI polling before it starts to release the private structures of the device. Signed-off-by: Francois Romieu Signed-off-by: Jeff Garzik --- drivers/net/b44.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/net/b44.c b/drivers/net/b44.c index f1675dcf4d5c..e829beea668c 100644 --- a/drivers/net/b44.c +++ b/drivers/net/b44.c @@ -909,6 +909,12 @@ static irqreturn_t b44_interrupt(int irq, void *dev_id, struct pt_regs *regs) istat &= imask; if (istat) { handled = 1; + + if (unlikely(!netif_running(dev))) { + printk(KERN_INFO "%s: late interrupt.\n", dev->name); + goto irq_ack; + } + if (netif_rx_schedule_prep(dev)) { /* NOTE: These writes are posted by the readback of * the ISTAT register below. @@ -921,6 +927,7 @@ static irqreturn_t b44_interrupt(int irq, void *dev_id, struct pt_regs *regs) dev->name); } +irq_ack: bw32(bp, B44_ISTAT, istat); br32(bp, B44_ISTAT); } @@ -1446,6 +1453,8 @@ static int b44_close(struct net_device *dev) netif_stop_queue(dev); + netif_poll_disable(dev); + del_timer_sync(&bp->timer); spin_lock_irq(&bp->lock); @@ -1461,6 +1470,8 @@ static int b44_close(struct net_device *dev) free_irq(dev->irq, dev); + netif_poll_enable(dev); + b44_free_consistent(bp); return 0; -- cgit v1.2.2 From eac1dfcb32fbe8b0d9135caea90b0bba9945360f Mon Sep 17 00:00:00 2001 From: Francois Romieu Date: Tue, 8 Nov 2005 23:38:01 +0100 Subject: [PATCH] b44: increase version number Signed-off-by: Francois Romieu Signed-off-by: Jeff Garzik --- drivers/net/b44.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/b44.c b/drivers/net/b44.c index e829beea668c..b38fa245a607 100644 --- a/drivers/net/b44.c +++ b/drivers/net/b44.c @@ -29,8 +29,8 @@ #define DRV_MODULE_NAME "b44" #define PFX DRV_MODULE_NAME ": " -#define DRV_MODULE_VERSION "0.95" -#define DRV_MODULE_RELDATE "Aug 3, 2004" +#define DRV_MODULE_VERSION "0.96" +#define DRV_MODULE_RELDATE "Nov 8, 2005" #define B44_DEF_MSG_ENABLE \ (NETIF_MSG_DRV | \ -- cgit v1.2.2 From 76f2b4d98c3d6a88a260275acbede99c23a24d60 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Mon, 7 Nov 2005 06:18:57 +0100 Subject: [PATCH] cris v10 eth: use ethtool_ops Signed-off-by: Christoph Hellwig Signed-off-by: Jeff Garzik --- drivers/net/cris/eth_v10.c | 149 +++++++++++++++++++++------------------------ 1 file changed, 71 insertions(+), 78 deletions(-) diff --git a/drivers/net/cris/eth_v10.c b/drivers/net/cris/eth_v10.c index b68b9cad76e9..64105e4eaf31 100644 --- a/drivers/net/cris/eth_v10.c +++ b/drivers/net/cris/eth_v10.c @@ -409,7 +409,6 @@ static irqreturn_t e100nw_interrupt(int irq, void *dev_id, struct pt_regs *regs) static void e100_rx(struct net_device *dev); static int e100_close(struct net_device *dev); static int e100_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); -static int e100_ethtool_ioctl(struct net_device* dev, struct ifreq *ifr); static int e100_set_config(struct net_device* dev, struct ifmap* map); static void e100_tx_timeout(struct net_device *dev); static struct net_device_stats *e100_get_stats(struct net_device *dev); @@ -436,6 +435,8 @@ static void e100_reset_transceiver(struct net_device* net); static void e100_clear_network_leds(unsigned long dummy); static void e100_set_network_leds(int active); +static struct ethtool_ops e100_ethtool_ops; + static void broadcom_check_speed(struct net_device* dev); static void broadcom_check_duplex(struct net_device* dev); static void tdk_check_speed(struct net_device* dev); @@ -495,6 +496,7 @@ etrax_ethernet_init(void) dev->get_stats = e100_get_stats; dev->set_multicast_list = set_multicast_list; dev->set_mac_address = e100_set_mac_address; + dev->ethtool_ops = &e100_ethtool_ops; dev->do_ioctl = e100_ioctl; dev->set_config = e100_set_config; dev->tx_timeout = e100_tx_timeout; @@ -1448,8 +1450,6 @@ e100_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) spin_lock(&np->lock); /* Preempt protection */ switch (cmd) { - case SIOCETHTOOL: - return e100_ethtool_ioctl(dev,ifr); case SIOCGMIIPHY: /* Get PHY address */ data->phy_id = mdio_phy_addr; break; @@ -1486,88 +1486,81 @@ e100_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) return 0; } -static int -e100_ethtool_ioctl(struct net_device *dev, struct ifreq *ifr) +static int e100_set_settings(struct net_device *dev, + struct ethtool_cmd *ecmd) { - struct ethtool_cmd ecmd; - - if (copy_from_user(&ecmd, ifr->ifr_data, sizeof (ecmd))) - return -EFAULT; - - switch (ecmd.cmd) { - case ETHTOOL_GSET: - { - memset((void *) &ecmd, 0, sizeof (ecmd)); - ecmd.supported = - SUPPORTED_Autoneg | SUPPORTED_TP | SUPPORTED_MII | + ecmd->supported = SUPPORTED_Autoneg | SUPPORTED_TP | SUPPORTED_MII | SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full | SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full; - ecmd.port = PORT_TP; - ecmd.transceiver = XCVR_EXTERNAL; - ecmd.phy_address = mdio_phy_addr; - ecmd.speed = current_speed; - ecmd.duplex = full_duplex ? DUPLEX_FULL : DUPLEX_HALF; - ecmd.advertising = ADVERTISED_TP; - if (current_duplex == autoneg && current_speed_selection == 0) - ecmd.advertising |= ADVERTISED_Autoneg; - else { - ecmd.advertising |= - ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full | - ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full; - if (current_speed_selection == 10) - ecmd.advertising &= ~(ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full); - else if (current_speed_selection == 100) - ecmd.advertising &= ~(ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full); - if (current_duplex == half) - ecmd.advertising &= ~(ADVERTISED_10baseT_Full | ADVERTISED_100baseT_Full); - else if (current_duplex == full) - ecmd.advertising &= ~(ADVERTISED_10baseT_Half | ADVERTISED_100baseT_Half); - } - ecmd.autoneg = AUTONEG_ENABLE; - if (copy_to_user(ifr->ifr_data, &ecmd, sizeof (ecmd))) - return -EFAULT; - } - break; - case ETHTOOL_SSET: - { - if (!capable(CAP_NET_ADMIN)) { - return -EPERM; - } - if (ecmd.autoneg == AUTONEG_ENABLE) { - e100_set_duplex(dev, autoneg); - e100_set_speed(dev, 0); - } else { - e100_set_duplex(dev, ecmd.duplex == DUPLEX_HALF ? half : full); - e100_set_speed(dev, ecmd.speed == SPEED_10 ? 10: 100); - } - } - break; - case ETHTOOL_GDRVINFO: - { - struct ethtool_drvinfo info; - memset((void *) &info, 0, sizeof (info)); - strncpy(info.driver, "ETRAX 100LX", sizeof(info.driver) - 1); - strncpy(info.version, "$Revision: 1.31 $", sizeof(info.version) - 1); - strncpy(info.fw_version, "N/A", sizeof(info.fw_version) - 1); - strncpy(info.bus_info, "N/A", sizeof(info.bus_info) - 1); - info.regdump_len = 0; - info.eedump_len = 0; - info.testinfo_len = 0; - if (copy_to_user(ifr->ifr_data, &info, sizeof (info))) - return -EFAULT; - } - break; - case ETHTOOL_NWAY_RST: - if (current_duplex == autoneg && current_speed_selection == 0) - e100_negotiate(dev); - break; - default: - return -EOPNOTSUPP; - break; + ecmd->port = PORT_TP; + ecmd->transceiver = XCVR_EXTERNAL; + ecmd->phy_address = mdio_phy_addr; + ecmd->speed = current_speed; + ecmd->duplex = full_duplex ? DUPLEX_FULL : DUPLEX_HALF; + ecmd->advertising = ADVERTISED_TP; + + if (current_duplex == autoneg && current_speed_selection == 0) + ecmd->advertising |= ADVERTISED_Autoneg; + else { + ecmd->advertising |= + ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full | + ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full; + if (current_speed_selection == 10) + ecmd->advertising &= ~(ADVERTISED_100baseT_Half | + ADVERTISED_100baseT_Full); + else if (current_speed_selection == 100) + ecmd->advertising &= ~(ADVERTISED_10baseT_Half | + ADVERTISED_10baseT_Full); + if (current_duplex == half) + ecmd->advertising &= ~(ADVERTISED_10baseT_Full | + ADVERTISED_100baseT_Full); + else if (current_duplex == full) + ecmd->advertising &= ~(ADVERTISED_10baseT_Half | + ADVERTISED_100baseT_Half); + } + + ecmd->autoneg = AUTONEG_ENABLE; + return 0; +} + +static int e100_set_settings(struct net_device *dev, + struct ethtool_cmd *ecmd) +{ + if (ecmd->autoneg == AUTONEG_ENABLE) { + e100_set_duplex(dev, autoneg); + e100_set_speed(dev, 0); + } else { + e100_set_duplex(dev, ecmd->duplex == DUPLEX_HALF ? half : full); + e100_set_speed(dev, ecmd->speed == SPEED_10 ? 10: 100); } + + return 0; +} + +static void e100_get_drvinfo(struct net_device *dev, + struct ethtool_drvinfo *info) +{ + strncpy(info->driver, "ETRAX 100LX", sizeof(info->driver) - 1); + strncpy(info->version, "$Revision: 1.31 $", sizeof(info->version) - 1); + strncpy(info->fw_version, "N/A", sizeof(info->fw_version) - 1); + strncpy(info->bus_info, "N/A", sizeof(info->bus_info) - 1); +} + +static int e100_nway_reset(struct net_device *dev) +{ + if (current_duplex == autoneg && current_speed_selection == 0) + e100_negotiate(dev); return 0; } +static struct ethtool_ops e100_ethtool_ops = { + .get_settings = e100_get_settings, + .set_settings = e100_set_settings, + .get_drvinfo = e100_get_drvinfo, + .nway_reset = e100_nway_reset, + .get_link = ethtool_op_get_link, +}; + static int e100_set_config(struct net_device *dev, struct ifmap *map) { -- cgit v1.2.2 From d3757472841cddfa2f905d1de76fabf1b98cfc1a Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Mon, 7 Nov 2005 06:20:36 +0100 Subject: [PATCH] xtensa platform-iss network: remove no-op ioctl handler If the driver ever wants to add ethtool support it should use ethtool_ops. Signed-off-by: Christoph Hellwig Signed-off-by: Jeff Garzik --- arch/xtensa/platform-iss/network.c | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/arch/xtensa/platform-iss/network.c b/arch/xtensa/platform-iss/network.c index 0682ffd38175..96b9bb4a478d 100644 --- a/arch/xtensa/platform-iss/network.c +++ b/arch/xtensa/platform-iss/network.c @@ -611,38 +611,6 @@ static int iss_net_change_mtu(struct net_device *dev, int new_mtu) return -EINVAL; } -static int iss_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) -{ -#if 0 - static const struct ethtool_drvinfo info = { - .cmd = ETHTOOL_GDRVINFO, - .driver = DRIVER_NAME, - .version = "42", - }; - void *useraddr; - u32 ethcmd; - - switch (cmd) { - case SIOCETHTOOL: - useraddr = ifr->ifr_data; - if (copy_from_user(ðcmd, useraddr, sizeof(ethcmd))) - return -EFAULT; - - switch (ethcmd) { - case ETHTOOL_GDRVINFO: - if (copy_to_user(useraddr, &info, sizeof(info))) - return -EFAULT; - return 0; - default: - return -EOPNOTSUPP; - } - default: - return -EINVAL; - } -#endif - return -EINVAL; -} - void iss_net_user_timer_expire(unsigned long _conn) { } @@ -730,7 +698,6 @@ static int iss_net_configure(int index, char *init) dev->tx_timeout = iss_net_tx_timeout; dev->set_mac_address = iss_net_set_mac; dev->change_mtu = iss_net_change_mtu; - dev->do_ioctl = iss_net_ioctl; dev->watchdog_timeo = (HZ >> 1); dev->irq = -1; -- cgit v1.2.2 From 6d3874844f3279f170dca5339b8a94d6f1868425 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Mon, 7 Nov 2005 06:21:21 +0100 Subject: [PATCH] uml_net: use ethtool_ops Signed-off-by: Christoph Hellwig Signed-off-by: Jeff Garzik --- arch/um/drivers/net_kern.c | 38 +++++++++++--------------------------- 1 file changed, 11 insertions(+), 27 deletions(-) diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c index fe865d9a3721..4cf31a2ae19c 100644 --- a/arch/um/drivers/net_kern.c +++ b/arch/um/drivers/net_kern.c @@ -243,34 +243,18 @@ static int uml_net_change_mtu(struct net_device *dev, int new_mtu) return err; } -static int uml_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) -{ - static const struct ethtool_drvinfo info = { - .cmd = ETHTOOL_GDRVINFO, - .driver = DRIVER_NAME, - .version = "42", - }; - void *useraddr; - u32 ethcmd; - - switch (cmd) { - case SIOCETHTOOL: - useraddr = ifr->ifr_data; - if (copy_from_user(ðcmd, useraddr, sizeof(ethcmd))) - return -EFAULT; - switch (ethcmd) { - case ETHTOOL_GDRVINFO: - if (copy_to_user(useraddr, &info, sizeof(info))) - return -EFAULT; - return 0; - default: - return -EOPNOTSUPP; - } - default: - return -EINVAL; - } +static void uml_net_get_drvinfo(struct net_device *dev, + struct ethtool_drvinfo *info) +{ + strcpy(info->driver, DRIVER_NAME); + strcpy(info->version, "42"); } +static struct ethtool_ops uml_net_ethtool_ops = { + .get_drvinfo = uml_net_get_drvinfo, + .get_link = ethtool_op_get_link, +}; + void uml_net_user_timer_expire(unsigned long _conn) { #ifdef undef @@ -359,7 +343,7 @@ static int eth_configure(int n, void *init, char *mac, dev->tx_timeout = uml_net_tx_timeout; dev->set_mac_address = uml_net_set_mac; dev->change_mtu = uml_net_change_mtu; - dev->do_ioctl = uml_net_ioctl; + dev->ethtool_ops = ¨_net_ethtool_ops; dev->watchdog_timeo = (HZ >> 1); dev->irq = UM_ETH_IRQ; -- cgit v1.2.2 From 8e8b77dd4846b73f2e0756cf59123ee709246d11 Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Tue, 1 Nov 2005 21:29:27 -0800 Subject: [PATCH] libata kernel-doc fixes Fix all reported kernel-doc errors in libata. Signed-off-by: Randy Dunlap Signed-off-by: Jeff Garzik --- drivers/scsi/libata-core.c | 4 ++-- drivers/scsi/libata-scsi.c | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 98769a3d31ae..f1942545a20d 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c @@ -2713,7 +2713,7 @@ static int ata_sg_setup(struct ata_queued_cmd *qc) /** * ata_poll_qc_complete - turn irq back on and finish qc * @qc: Command to complete - * @drv_stat: ATA status register content + * @err_mask: ATA status register content * * LOCKING: * None. (grabs host lock) @@ -3478,7 +3478,7 @@ void ata_qc_free(struct ata_queued_cmd *qc) /** * ata_qc_complete - Complete an active ATA command * @qc: Command to complete - * @drv_stat: ATA Status register contents + * @err_mask: ATA Status register contents * * Indicate to the mid and upper layers that an ATA * command has completed, with either an ok or not-ok status. diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c index 38a895ebe826..bb30fcdc9297 100644 --- a/drivers/scsi/libata-scsi.c +++ b/drivers/scsi/libata-scsi.c @@ -131,7 +131,7 @@ int ata_std_bios_param(struct scsi_device *sdev, struct block_device *bdev, /** * ata_cmd_ioctl - Handler for HDIO_DRIVE_CMD ioctl - * @dev: Device to whom we are issuing command + * @scsidev: Device to which we are issuing command * @arg: User provided data for issuing command * * LOCKING: @@ -217,7 +217,7 @@ error: /** * ata_task_ioctl - Handler for HDIO_DRIVE_TASK ioctl - * @dev: Device to whom we are issuing command + * @scsidev: Device to which we are issuing command * @arg: User provided data for issuing command * * LOCKING: @@ -416,6 +416,7 @@ void ata_dump_status(unsigned id, struct ata_taskfile *tf) /** * ata_to_sense_error - convert ATA error to SCSI error + * @id: ATA device number * @drv_stat: value contained in ATA status register * @drv_err: value contained in ATA error register * @sk: the sense key we'll fill out @@ -2231,7 +2232,7 @@ ata_scsi_map_proto(u8 byte1) /** * ata_scsi_pass_thru - convert ATA pass-thru CDB to taskfile * @qc: command structure to be initialized - * @cmd: SCSI command to convert + * @scsicmd: SCSI command to convert * * Handles either 12 or 16-byte versions of the CDB. * -- cgit v1.2.2 From 7c3983357fdaef3ae71a0d7081a4b6dcfd869d39 Mon Sep 17 00:00:00 2001 From: Albert Lee Date: Wed, 9 Nov 2005 13:03:30 +0800 Subject: [PATCH] libata: if condition fix for ata_dev_identify() - if condition fix for ata_dev_identify() - ata_pio_poll() minor cleanup. Changes: - Use (dev->class == ATA_DEV_ATA) for ata_dev_identify() since "qc->tf.command" has been overwritten by the device status - Use HSM_ST_TMOUT directly in ata_pio_poll() Signed-off-by: Albert Lee ============ Signed-off-by: Jeff Garzik --- drivers/scsi/libata-core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index f1942545a20d..a74b4071a662 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c @@ -1144,7 +1144,7 @@ retry: * ATA software reset (SRST, the default) does not appear * to have this problem. */ - if ((using_edd) && (qc->tf.command == ATA_CMD_ID_ATA)) { + if ((using_edd) && (dev->class == ATA_DEV_ATA)) { u8 err = qc->tf.feature; if (err & ATA_ABORTED) { dev->class = ATA_DEV_ATAPI; @@ -2747,7 +2747,6 @@ static unsigned long ata_pio_poll(struct ata_port *ap) u8 status; unsigned int poll_state = HSM_ST_UNKNOWN; unsigned int reg_state = HSM_ST_UNKNOWN; - const unsigned int tmout_state = HSM_ST_TMOUT; switch (ap->hsm_task_state) { case HSM_ST: @@ -2768,7 +2767,7 @@ static unsigned long ata_pio_poll(struct ata_port *ap) status = ata_chk_status(ap); if (status & ATA_BUSY) { if (time_after(jiffies, ap->pio_task_timeout)) { - ap->hsm_task_state = tmout_state; + ap->hsm_task_state = HSM_ST_TMOUT; return 0; } ap->hsm_task_state = poll_state; -- cgit v1.2.2 From 385023cb8972971540d17c92baf0132693955f5f Mon Sep 17 00:00:00 2001 From: Ashutosh Naik Date: Sun, 6 Nov 2005 23:43:22 -0800 Subject: [PATCH] dgrs: fix warnings when CONFIG_ISA and CONFIG_PCI are not enabled This patch fixes compiler warnings when CONFIG_ISA and CONFIG_PCI are not enabled in the dgrc network driver. Signed-off-by: Ashutosh Naik Cc: Jeff Garzik Signed-off-by: Andrew Morton Signed-off-by: Jeff Garzik --- drivers/net/dgrs.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/net/dgrs.c b/drivers/net/dgrs.c index 7809838e6c4c..2a290cc397ad 100644 --- a/drivers/net/dgrs.c +++ b/drivers/net/dgrs.c @@ -1549,7 +1549,7 @@ MODULE_PARM_DESC(nicmode, "Digi RightSwitch operating mode (1: switch, 2: multi- static int __init dgrs_init_module (void) { int i; - int eisacount = 0, pcicount = 0; + int cardcount = 0; /* * Command line variable overrides @@ -1591,15 +1591,13 @@ static int __init dgrs_init_module (void) * Find and configure all the cards */ #ifdef CONFIG_EISA - eisacount = eisa_driver_register(&dgrs_eisa_driver); - if (eisacount < 0) - return eisacount; -#endif -#ifdef CONFIG_PCI - pcicount = pci_register_driver(&dgrs_pci_driver); - if (pcicount) - return pcicount; + cardcount = eisa_driver_register(&dgrs_eisa_driver); + if (cardcount < 0) + return cardcount; #endif + cardcount = pci_register_driver(&dgrs_pci_driver); + if (cardcount) + return cardcount; return 0; } -- cgit v1.2.2 From f406db8cba6bbce42b96490e6d31bdec229ad994 Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Tue, 8 Nov 2005 19:10:24 +0000 Subject: [PATCH] IOC: And don't mark the things as broken Cowboy. And don't mark the things as broken Cowboy. Signed-off-by: Ralf Baechle Signed-off-by: Jeff Garzik --- drivers/net/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 1958d9e16a3a..e70315a85447 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -447,7 +447,7 @@ config NET_SB1250_MAC config SGI_IOC3_ETH bool "SGI IOC3 Ethernet" - depends on NET_ETHERNET && PCI && SGI_IP27 && BROKEN + depends on NET_ETHERNET && PCI && SGI_IP27 select CRC32 select MII help -- cgit v1.2.2 From 2a98beb6390aef8fad85103ea25b3b1ace8015b5 Mon Sep 17 00:00:00 2001 From: Russell King Date: Wed, 9 Nov 2005 10:50:29 +0000 Subject: [ARM SMP] Add local timer support for Realview MPcore Add platform specific parts for local timer support for the Realview board. Signed-off-by: Russell King --- arch/arm/Kconfig | 2 +- arch/arm/mach-realview/Makefile | 1 + arch/arm/mach-realview/core.c | 2 +- arch/arm/mach-realview/localtimer.c | 130 ++++++++++++++++++++++++++++ arch/arm/mach-realview/platsmp.c | 5 ++ include/asm-arm/arch-realview/entry-macro.S | 11 +++ include/asm-arm/arch-realview/irqs.h | 3 + include/asm-arm/arch-realview/platform.h | 5 +- 8 files changed, 154 insertions(+), 5 deletions(-) create mode 100644 arch/arm/mach-realview/localtimer.c diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 3bfef0934c9d..ec77721507cb 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -358,7 +358,7 @@ config HOTPLUG_CPU config LOCAL_TIMERS bool "Use local timer interrupts" - depends on SMP && n + depends on SMP && REALVIEW_MPCORE default y help Enable support for local timers on SMP platforms, rather then the diff --git a/arch/arm/mach-realview/Makefile b/arch/arm/mach-realview/Makefile index 011a85c10627..a6a40dac26a9 100644 --- a/arch/arm/mach-realview/Makefile +++ b/arch/arm/mach-realview/Makefile @@ -5,3 +5,4 @@ obj-y := core.o clock.o obj-$(CONFIG_MACH_REALVIEW_EB) += realview_eb.o obj-$(CONFIG_SMP) += platsmp.o headsmp.o +obj-$(CONFIG_LOCAL_TIMERS) += localtimer.o diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c index 4ea60d8b6e36..e2c6fa23d3cd 100644 --- a/arch/arm/mach-realview/core.c +++ b/arch/arm/mach-realview/core.c @@ -550,7 +550,7 @@ static irqreturn_t realview_timer_interrupt(int irq, void *dev_id, struct pt_reg timer_tick(regs); -#ifdef CONFIG_SMP +#if defined(CONFIG_SMP) && !defined(CONFIG_LOCAL_TIMERS) smp_send_timer(); update_process_times(user_mode(regs)); #endif diff --git a/arch/arm/mach-realview/localtimer.c b/arch/arm/mach-realview/localtimer.c new file mode 100644 index 000000000000..5e917e37d095 --- /dev/null +++ b/arch/arm/mach-realview/localtimer.c @@ -0,0 +1,130 @@ +/* + * linux/arch/arm/mach-realview/localtimer.c + * + * Copyright (C) 2002 ARM Ltd. + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "core.h" + +#define TWD_BASE(cpu) (__io_address(REALVIEW_TWD_BASE) + \ + ((cpu) * REALVIEW_TWD_SIZE)) + +static unsigned long mpcore_timer_rate; + +/* + * local_timer_ack: checks for a local timer interrupt. + * + * If a local timer interrupt has occured, acknowledge and return 1. + * Otherwise, return 0. + */ +int local_timer_ack(void) +{ + void __iomem *base = TWD_BASE(smp_processor_id()); + + if (__raw_readl(base + TWD_TIMER_INTSTAT)) { + __raw_writel(1, base + TWD_TIMER_INTSTAT); + return 1; + } + + return 0; +} + +void __cpuinit local_timer_setup(unsigned int cpu) +{ + void __iomem *base = TWD_BASE(cpu); + unsigned int load, offset; + u64 waitjiffies; + unsigned int count; + + /* + * If this is the first time round, we need to work out how fast + * the timer ticks + */ + if (mpcore_timer_rate == 0) { + printk("Calibrating local timer... "); + + /* Wait for a tick to start */ + waitjiffies = get_jiffies_64() + 1; + + while (get_jiffies_64() < waitjiffies) + udelay(10); + + /* OK, now the tick has started, let's get the timer going */ + waitjiffies += 5; + + /* enable, no interrupt or reload */ + __raw_writel(0x1, base + TWD_TIMER_CONTROL); + + /* maximum value */ + __raw_writel(0xFFFFFFFFU, base + TWD_TIMER_COUNTER); + + while (get_jiffies_64() < waitjiffies) + udelay(10); + + count = __raw_readl(base + TWD_TIMER_COUNTER); + + mpcore_timer_rate = (0xFFFFFFFFU - count) * (HZ / 5); + + printk("%lu.%02luMHz.\n", mpcore_timer_rate / 1000000, + (mpcore_timer_rate / 100000) % 100); + } + + load = mpcore_timer_rate / HZ; + + __raw_writel(load, base + TWD_TIMER_LOAD); + __raw_writel(0x7, base + TWD_TIMER_CONTROL); + + /* + * Now maneuver our local tick into the right part of the jiffy. + * Start by working out where within the tick our local timer + * interrupt should go. + */ + offset = ((mpcore_timer_rate / HZ) / (NR_CPUS + 1)) * (cpu + 1); + + /* + * gettimeoffset() will return a number of us since the last tick. + * Convert this number of us to a local timer tick count. + * Be careful of integer overflow whilst keeping maximum precision. + * + * with HZ=100 and 1MHz (fpga) ~ 1GHz processor: + * load = 1 ~ 10,000 + * mpcore_timer_rate/10000 = 100 ~ 100,000 + * + * so the multiply value will be less than 10^9 always. + */ + load = (system_timer->offset() * (mpcore_timer_rate / 10000)) / 100; + + /* Add on our offset to get the load value */ + load = (load + offset) % (mpcore_timer_rate / HZ); + + __raw_writel(load, base + TWD_TIMER_COUNTER); + + /* Make sure our local interrupt controller has this enabled */ + __raw_writel(1 << IRQ_LOCALTIMER, + __io_address(REALVIEW_GIC_DIST_BASE) + GIC_DIST_ENABLE_SET); +} + +/* + * take a local timer down + */ +void __cpuexit local_timer_stop(unsigned int cpu) +{ + __raw_writel(0, TWD_BASE(cpu) + TWD_TIMER_CONTROL); +} diff --git a/arch/arm/mach-realview/platsmp.c b/arch/arm/mach-realview/platsmp.c index 09b35f62247a..0c7d4ac9a7b3 100644 --- a/arch/arm/mach-realview/platsmp.c +++ b/arch/arm/mach-realview/platsmp.c @@ -174,6 +174,11 @@ void __init smp_prepare_cpus(unsigned int max_cpus) if (max_cpus > ncores) max_cpus = ncores; + /* + * Enable the local timer for primary CPU + */ + local_timer_setup(cpu); + /* * Initialise the possible/present maps. * cpu_possible_map describes the set of CPUs which may be present diff --git a/include/asm-arm/arch-realview/entry-macro.S b/include/asm-arm/arch-realview/entry-macro.S index 4df469bf42e2..6288fad0dc41 100644 --- a/include/asm-arm/arch-realview/entry-macro.S +++ b/include/asm-arm/arch-realview/entry-macro.S @@ -61,3 +61,14 @@ strcc \irqstat, [\base, #GIC_CPU_EOI] cmpcs \irqnr, \irqnr .endm + + /* As above, this assumes that irqstat and base are preserved.. */ + + .macro test_for_ltirq, irqnr, irqstat, base, tmp + bic \irqnr, \irqstat, #0x1c00 + mov \tmp, #0 + cmp \irqnr, #29 + moveq \tmp, #1 + streq \irqstat, [\base, #GIC_CPU_EOI] + cmp \tmp, #0 + .endm diff --git a/include/asm-arm/arch-realview/irqs.h b/include/asm-arm/arch-realview/irqs.h index ff376494e5b1..c16223c9588d 100644 --- a/include/asm-arm/arch-realview/irqs.h +++ b/include/asm-arm/arch-realview/irqs.h @@ -21,6 +21,9 @@ #include +#define IRQ_LOCALTIMER 29 +#define IRQ_LOCALWDOG 30 + /* * IRQ interrupts definitions are the same the INT definitions * held within platform.h diff --git a/include/asm-arm/arch-realview/platform.h b/include/asm-arm/arch-realview/platform.h index aef9b36b3c37..18d7c18b738c 100644 --- a/include/asm-arm/arch-realview/platform.h +++ b/include/asm-arm/arch-realview/platform.h @@ -209,6 +209,8 @@ #else #define REALVIEW_MPCORE_SCU_BASE 0x10100000 /* SCU registers */ #define REALVIEW_GIC_CPU_BASE 0x10100100 /* Generic interrupt controller CPU interface */ +#define REALVIEW_TWD_BASE 0x10100700 +#define REALVIEW_TWD_SIZE 0x00000100 #define REALVIEW_GIC_DIST_BASE 0x10101000 /* Generic interrupt controller distributor */ #endif #define REALVIEW_SMC_BASE 0x10080000 /* SMC */ @@ -305,9 +307,6 @@ #define INT_TSPENINT 30 /* Touchscreen pen */ #define INT_TSKPADINT 31 /* Touchscreen keypad */ #else -#define INT_LOCALTIMER 29 -#define INT_LOCALWDOG 30 - #define INT_AACI 0 #define INT_TIMERINT0_1 1 #define INT_TIMERINT2_3 2 -- cgit v1.2.2 From 97a63ecff4bd06da5d8feb8c0394a4d020f2d34d Mon Sep 17 00:00:00 2001 From: Russell King Date: Wed, 9 Nov 2005 13:50:57 +0000 Subject: [ARM SMP] Add CPU hotplug support for Realview MPcore Add platform specific parts for hotplug CPU support for the Realview board. Signed-off-by: Russell King --- arch/arm/mach-realview/Makefile | 1 + arch/arm/mach-realview/hotplug.c | 138 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 139 insertions(+) create mode 100644 arch/arm/mach-realview/hotplug.c diff --git a/arch/arm/mach-realview/Makefile b/arch/arm/mach-realview/Makefile index a6a40dac26a9..36e76ba937fc 100644 --- a/arch/arm/mach-realview/Makefile +++ b/arch/arm/mach-realview/Makefile @@ -5,4 +5,5 @@ obj-y := core.o clock.o obj-$(CONFIG_MACH_REALVIEW_EB) += realview_eb.o obj-$(CONFIG_SMP) += platsmp.o headsmp.o +obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o obj-$(CONFIG_LOCAL_TIMERS) += localtimer.o diff --git a/arch/arm/mach-realview/hotplug.c b/arch/arm/mach-realview/hotplug.c new file mode 100644 index 000000000000..09748cbcd10e --- /dev/null +++ b/arch/arm/mach-realview/hotplug.c @@ -0,0 +1,138 @@ +/* + * linux/arch/arm/mach-realview/hotplug.c + * + * Copyright (C) 2002 ARM Ltd. + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#include +#include +#include +#include + +extern volatile int pen_release; + +static DECLARE_COMPLETION(cpu_killed); + +static inline void cpu_enter_lowpower(void) +{ + unsigned int v; + + asm volatile( "mcr p15, 0, %1, c7, c14, 0\n" + " mcr p15, 0, %1, c7, c5, 0\n" + " mcr p15, 0, %1, c7, c10, 4\n" + /* + * Turn off coherency + */ + " mrc p15, 0, %0, c1, c0, 1\n" + " bic %0, %0, #0x20\n" + " mcr p15, 0, %0, c1, c0, 1\n" + " mrc p15, 0, %0, c1, c0, 0\n" + " bic %0, %0, #0x04\n" + " mcr p15, 0, %0, c1, c0, 0\n" + : "=&r" (v) + : "r" (0) + : "cc"); +} + +static inline void cpu_leave_lowpower(void) +{ + unsigned int v; + + asm volatile( "mrc p15, 0, %0, c1, c0, 0\n" + " orr %0, %0, #0x04\n" + " mcr p15, 0, %0, c1, c0, 0\n" + " mrc p15, 0, %0, c1, c0, 1\n" + " orr %0, %0, #0x20\n" + " mcr p15, 0, %0, c1, c0, 1\n" + : "=&r" (v) + : + : "cc"); +} + +static inline void platform_do_lowpower(unsigned int cpu) +{ + /* + * there is no power-control hardware on this platform, so all + * we can do is put the core into WFI; this is safe as the calling + * code will have already disabled interrupts + */ + for (;;) { + /* + * here's the WFI + */ + asm(".word 0xe320f003\n" + : + : + : "memory", "cc"); + + if (pen_release == cpu) { + /* + * OK, proper wakeup, we're done + */ + break; + } + + /* + * getting here, means that we have come out of WFI without + * having been woken up - this shouldn't happen + * + * The trouble is, letting people know about this is not really + * possible, since we are currently running incoherently, and + * therefore cannot safely call printk() or anything else + */ +#ifdef DEBUG + printk("CPU%u: spurious wakeup call\n", cpu); +#endif + } +} + +int platform_cpu_kill(unsigned int cpu) +{ + return wait_for_completion_timeout(&cpu_killed, 5000); +} + +/* + * platform-specific code to shutdown a CPU + * + * Called with IRQs disabled + */ +void platform_cpu_die(unsigned int cpu) +{ +#ifdef DEBUG + unsigned int this_cpu = hard_smp_processor_id(); + + if (cpu != this_cpu) { + printk(KERN_CRIT "Eek! platform_cpu_die running on %u, should be %u\n", + this_cpu, cpu); + BUG(); + } +#endif + + printk(KERN_NOTICE "CPU%u: shutdown\n", cpu); + complete(&cpu_killed); + + /* + * we're ready for shutdown now, so do it + */ + cpu_enter_lowpower(); + platform_do_lowpower(cpu); + + /* + * bring this CPU back into the world of cache + * coherency, and then restore interrupts + */ + cpu_leave_lowpower(); +} + +int mach_cpu_disable(unsigned int cpu) +{ + /* + * we don't allow CPU 0 to be shutdown (it is still too special + * e.g. clock tick interrupts) + */ + return cpu == 0 ? -EPERM : 0; +} -- cgit v1.2.2 From 8dd523118bfbcaca5b67923ff6ee546e04a4db64 Mon Sep 17 00:00:00 2001 From: Ben Dooks Date: Wed, 9 Nov 2005 14:05:30 +0000 Subject: [ARM] 3136/1: Anubis - fix map_desc initialisers Patch from Ben Dooks Fix the map_desc initialisers for the Simtec Anubis board to match the new initialiser scheme. Signed-off-by: Ben Dooks Signed-off-by: Russell King --- arch/arm/mach-s3c2410/mach-anubis.c | 51 ++++++++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 9 deletions(-) diff --git a/arch/arm/mach-s3c2410/mach-anubis.c b/arch/arm/mach-s3c2410/mach-anubis.c index 8390b685c2b6..0f81fc0c2f7f 100644 --- a/arch/arm/mach-s3c2410/mach-anubis.c +++ b/arch/arm/mach-s3c2410/mach-anubis.c @@ -56,8 +56,16 @@ static struct map_desc anubis_iodesc[] __initdata = { /* ISA IO areas */ - { (u32)S3C24XX_VA_ISA_BYTE, 0x0, SZ_16M, MT_DEVICE }, - { (u32)S3C24XX_VA_ISA_WORD, 0x0, SZ_16M, MT_DEVICE }, + { + .virtual = (u32)S3C24XX_VA_ISA_BYTE, + .pfn = __phys_to_pfn(0x0), + .length = SZ_4M, + .type = MT_DEVICE + }, { + .virtual = (u32)S3C24XX_VA_ISA_WORD, + .pfn = __phys_to_pfn(0x0), + .length = SZ_4M, MT_DEVICE + }, /* we could possibly compress the next set down into a set of smaller tables * pagetables, but that would mean using an L2 section, and it still means @@ -66,16 +74,41 @@ static struct map_desc anubis_iodesc[] __initdata = { /* CPLD control registers */ - { (u32)ANUBIS_VA_CTRL1, ANUBIS_PA_CTRL1, SZ_4K, MT_DEVICE }, - { (u32)ANUBIS_VA_CTRL2, ANUBIS_PA_CTRL2, SZ_4K, MT_DEVICE }, + { + .virtual = (u32)ANUBIS_VA_CTRL1, + .pfn = __phys_to_pfn(ANUBIS_PA_CTRL1), + .length = SZ_4K, + .type = MT_DEVICE + }, { + .virtual = (u32)ANUBIS_VA_CTRL2, + .pfn = __phys_to_pfn(ANUBIS_PA_CTRL2), + .length = SZ_4K, + .type =MT_DEVICE + }, /* IDE drives */ - { (u32)ANUBIS_IDEPRI, S3C2410_CS3, SZ_1M, MT_DEVICE }, - { (u32)ANUBIS_IDEPRIAUX, S3C2410_CS3+(1<<26), SZ_1M, MT_DEVICE }, - - { (u32)ANUBIS_IDESEC, S3C2410_CS4, SZ_1M, MT_DEVICE }, - { (u32)ANUBIS_IDESECAUX, S3C2410_CS4+(1<<26), SZ_1M, MT_DEVICE }, + { + .virtual = (u32)ANUBIS_IDEPRI, + .pfn = __phys_to_pfn(S3C2410_CS3), + .length = SZ_1M, + .type = MT_DEVICE + }, { + .virtual = (u32)ANUBIS_IDEPRIAUX, + .pfn = __phys_to_pfn(S3C2410_CS3+(1<<26)), + .length = SZ_1M, + .type = MT_DEVICE + }, { + .virtual = (u32)ANUBIS_IDESEC, + .pfn = __phys_to_pfn(S3C2410_CS4), + .length = SZ_1M, + .type = MT_DEVICE + }, { + .virtual = (u32)ANUBIS_IDESECAUX, + .pfn = __phys_to_pfn(S3C2410_CS4+(1<<26)), + .length = SZ_1M, + .type = MT_DEVICE + }, }; #define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK -- cgit v1.2.2 From ff6ffa82fe122ecda457bb10dbab7b0c08ee3803 Mon Sep 17 00:00:00 2001 From: Ben Dooks Date: Wed, 9 Nov 2005 14:05:31 +0000 Subject: [ARM] 3137/1: RX3715 - fix map_desc initialiser Patch from Ben Dooks Change the initialiser for the map_desc for the iPAQ RX3715 to use the new pfn initialiser, and also reduce the amount of ISA space mapped (we only need to stop any ISA IO writes OOPsing the system, so do not need >1Mbyte of space) Signed-off-by: Ben Dooks Signed-off-by: Russell King --- arch/arm/mach-s3c2410/mach-rx3715.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-s3c2410/mach-rx3715.c b/arch/arm/mach-s3c2410/mach-rx3715.c index 24d69019a843..f8d86d1e16b6 100644 --- a/arch/arm/mach-s3c2410/mach-rx3715.c +++ b/arch/arm/mach-s3c2410/mach-rx3715.c @@ -56,8 +56,17 @@ static struct map_desc rx3715_iodesc[] __initdata = { /* dump ISA space somewhere unused */ - { (u32)S3C24XX_VA_ISA_WORD, S3C2410_CS3, SZ_16M, MT_DEVICE }, - { (u32)S3C24XX_VA_ISA_BYTE, S3C2410_CS3, SZ_16M, MT_DEVICE }, + { + .virtual = (u32)S3C24XX_VA_ISA_WORD, + .pfn = __phys_to_pfn(S3C2410_CS3), + .length = SZ_1M, + .type = MT_DEVICE, + }, { + .virtual = (u32)S3C24XX_VA_ISA_BYTE, + .pfn = __phys_to_pfn(S3C2410_CS3), + .length = SZ_1M, + .type = MT_DEVICE, + }, }; -- cgit v1.2.2 From cbe69f95fa7ffc4604622cd4f7efd56ed10999fe Mon Sep 17 00:00:00 2001 From: Ben Dooks Date: Wed, 9 Nov 2005 14:05:31 +0000 Subject: [ARM] 3138/1: SMDK2440 - fix map_desc initialisation (and ISA memory space) Patch from Ben Dooks Fix the map_desc initialisers for the SMDK2440 machine to use the new .pfn method, and at the same time making the differntiation between ISA IO and Memory space accesses Signed-off-by: Ben Dooks Signed-off-by: Russell King --- arch/arm/mach-s3c2410/mach-smdk2440.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-s3c2410/mach-smdk2440.c b/arch/arm/mach-s3c2410/mach-smdk2440.c index d666c621ad06..4e31118533e6 100644 --- a/arch/arm/mach-s3c2410/mach-smdk2440.c +++ b/arch/arm/mach-s3c2410/mach-smdk2440.c @@ -58,8 +58,27 @@ static struct map_desc smdk2440_iodesc[] __initdata = { /* ISA IO Space map (memory space selected by A24) */ - { (u32)S3C24XX_VA_ISA_WORD, S3C2410_CS2, SZ_16M, MT_DEVICE }, - { (u32)S3C24XX_VA_ISA_BYTE, S3C2410_CS2, SZ_16M, MT_DEVICE }, + { + .virtual = (u32)S3C24XX_VA_ISA_WORD, + .pfn = __phys_to_pfn(S3C2410_CS2), + .length = 0x10000, + .type = MT_DEVICE, + }, { + .virtual = (u32)S3C24XX_VA_ISA_WORD + 0x10000, + .pfn = __phys_to_pfn(S3C2410_CS2 + (1<<24)), + .length = SZ_4M, + .type = MT_DEVICE, + }, { + .virtual = (u32)S3C24XX_VA_ISA_BYTE, + .pfn = __phys_to_pfn(S3C2410_CS2), + .length = 0x10000, + .type = MT_DEVICE, + }, { + .virtual = (u32)S3C24XX_VA_ISA_BYTE + 0x10000, + .pfn = __phys_to_pfn(S3C2410_CS2 + (1<<24)), + .length = SZ_4M, + .type = MT_DEVICE, + } }; #define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK -- cgit v1.2.2 From c906107bb72b7bd5ecfc98cc807bdb8f34d17501 Mon Sep 17 00:00:00 2001 From: Nicolas Pitre Date: Wed, 9 Nov 2005 14:09:31 +0000 Subject: [ARM] 3100/1: simplify a pointer computation Patch from Nicolas Pitre Looks clearer this way. Signed-off-by: Nicolas Pitre Signed-off-by: Russell King --- arch/arm/kernel/process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index ba298277becd..07fb744f8a68 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c @@ -355,7 +355,7 @@ copy_thread(int nr, unsigned long clone_flags, unsigned long stack_start, struct thread_info *thread = p->thread_info; struct pt_regs *childregs; - childregs = ((struct pt_regs *)((unsigned long)thread + THREAD_START_SP)) - 1; + childregs = (void *)thread + THREAD_START_SP - sizeof(*regs); *childregs = *regs; childregs->ARM_r0 = 0; childregs->ARM_sp = stack_start; -- cgit v1.2.2 From 59d1ff3bfb56d9b8cf3ec864857e6a4dfd9d2dba Mon Sep 17 00:00:00 2001 From: Russell King Date: Wed, 9 Nov 2005 15:04:22 +0000 Subject: [ARM] Clean up save_and_disable_irqs macro and allow use of ARMv6 CPSID save_and_disable_irqs does not need to use mov + msr (which was introduced to work around a documentation bug which was propagated into binutils.) Use msr with an immediate constant, and if we're building for ARMv6 or later, use the new CPSID instruction. Signed-off-by: Russell King --- arch/arm/lib/bitops.h | 4 ++-- include/asm-arm/assembler.h | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/arch/arm/lib/bitops.h b/arch/arm/lib/bitops.h index f35d91fbe117..b8c14e936697 100644 --- a/arch/arm/lib/bitops.h +++ b/arch/arm/lib/bitops.h @@ -34,7 +34,7 @@ and r2, r0, #7 mov r3, #1 mov r3, r3, lsl r2 - save_and_disable_irqs ip, r2 + save_and_disable_irqs ip ldrb r2, [r1, r0, lsr #3] \instr r2, r2, r3 strb r2, [r1, r0, lsr #3] @@ -54,7 +54,7 @@ add r1, r1, r0, lsr #3 and r3, r0, #7 mov r0, #1 - save_and_disable_irqs ip, r2 + save_and_disable_irqs ip ldrb r2, [r1] tst r2, r0, lsl r3 \instr r2, r2, r0, lsl r3 diff --git a/include/asm-arm/assembler.h b/include/asm-arm/assembler.h index 69a28f96bee2..f31ac92b6c7f 100644 --- a/include/asm-arm/assembler.h +++ b/include/asm-arm/assembler.h @@ -83,10 +83,13 @@ * Save the current IRQ state and disable IRQs. Note that this macro * assumes FIQs are enabled, and that the processor is in SVC mode. */ - .macro save_and_disable_irqs, oldcpsr, temp + .macro save_and_disable_irqs, oldcpsr mrs \oldcpsr, cpsr - mov \temp, #PSR_I_BIT | MODE_SVC - msr cpsr_c, \temp +#if __LINUX_ARM_ARCH__ >= 6 + cpsid i +#else + msr cpsr_c, #PSR_I_BIT | MODE_SVC +#endif .endm /* -- cgit v1.2.2 From 861e37ad5969f764574722f4cfc0734511cbac7f Mon Sep 17 00:00:00 2001 From: Kyungmin Park Date: Wed, 9 Nov 2005 15:15:10 +0000 Subject: [ARM] 3057/1: Add memory control method to support OneNAND sync burst read Patch from Kyungmin Park This patch is required for OneNAND MTD to passing the OneNAND sync. burst read Signed-off-by: Kyungmin Park Signed-off-by: Russell King --- include/asm-arm/mach/flash.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/asm-arm/mach/flash.h b/include/asm-arm/mach/flash.h index cd57436d9874..05b029ef6371 100644 --- a/include/asm-arm/mach/flash.h +++ b/include/asm-arm/mach/flash.h @@ -11,6 +11,7 @@ #define ASMARM_MACH_FLASH_H struct mtd_partition; +struct mtd_info; /* * map_name: the map probe function name @@ -19,6 +20,7 @@ struct mtd_partition; * init: method called at driver/device initialisation * exit: method called at driver/device removal * set_vpp: method called to enable or disable VPP + * mmcontrol: method called to enable or disable Sync. Burst Read in OneNAND * parts: optional array of mtd_partitions for static partitioning * nr_parts: number of mtd_partitions for static partitoning */ @@ -29,6 +31,7 @@ struct flash_platform_data { int (*init)(void); void (*exit)(void); void (*set_vpp)(int on); + void (*mmcontrol)(struct mtd_info *mtd, int sync_read); struct mtd_partition *parts; unsigned int nr_parts; }; -- cgit v1.2.2 From 90d45d17f3e68608ac7ba8fc3d7acce022a19c8e Mon Sep 17 00:00:00 2001 From: Ashok Raj Date: Tue, 8 Nov 2005 21:34:24 -0800 Subject: [PATCH] cpu hotplug: fix locking in cpufreq drivers When calling target drivers to set frequency, we take cpucontrol lock. When we modified the code to accomodate CPU hotplug, there was an attempt to take a double lock of cpucontrol leading to a deadlock. Since the current thread context is already holding the cpucontrol lock, we dont need to make another attempt to acquire it. Now we leave a trace in current->flags indicating current thread already is under cpucontrol lock held, so we dont attempt to do this another time. Thanks to Andrew Morton for the beating:-) From: Brice Goglin Build fix (akpm: this patch is still unpleasant. Ashok continues to look for a cleaner solution, doesn't he? ;)) Signed-off-by: Ashok Raj Signed-off-by: Brice Goglin Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/cpufreq/cpufreq.c | 24 ++++++++++-------------- include/linux/cpu.h | 5 +++++ include/linux/sched.h | 1 + kernel/cpu.c | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 49 insertions(+), 14 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 25acf478c9e8..23a63207d747 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -38,7 +38,6 @@ static struct cpufreq_driver *cpufreq_driver; static struct cpufreq_policy *cpufreq_cpu_data[NR_CPUS]; static DEFINE_SPINLOCK(cpufreq_driver_lock); - /* internal prototypes */ static int __cpufreq_governor(struct cpufreq_policy *policy, unsigned int event); static void handle_update(void *data); @@ -1115,24 +1114,21 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy, int retval = -EINVAL; /* - * Converted the lock_cpu_hotplug to preempt_disable() - * and preempt_enable(). This is a bit kludgy and relies on how cpu - * hotplug works. All we need is a guarantee that cpu hotplug won't make - * progress on any cpu. Once we do preempt_disable(), this would ensure - * that hotplug threads don't get onto this cpu, thereby delaying - * the cpu remove process. - * - * We removed the lock_cpu_hotplug since we need to call this function - * via cpu hotplug callbacks, which result in locking the cpu hotplug - * thread itself. Agree this is not very clean, cpufreq community - * could improve this if required. - Ashok Raj + * If we are already in context of hotplug thread, we dont need to + * acquire the hotplug lock. Otherwise acquire cpucontrol to prevent + * hotplug from removing this cpu that we are working on. */ - preempt_disable(); + if (!current_in_cpu_hotplug()) + lock_cpu_hotplug(); + dprintk("target for CPU %u: %u kHz, relation %u\n", policy->cpu, target_freq, relation); if (cpu_online(policy->cpu) && cpufreq_driver->target) retval = cpufreq_driver->target(policy, target_freq, relation); - preempt_enable(); + + if (!current_in_cpu_hotplug()) + unlock_cpu_hotplug(); + return retval; } EXPORT_SYMBOL_GPL(__cpufreq_driver_target); diff --git a/include/linux/cpu.h b/include/linux/cpu.h index 1f7b2c097503..43c44530ef9d 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h @@ -42,6 +42,7 @@ struct notifier_block; /* Need to know about CPUs going up/down? */ extern int register_cpu_notifier(struct notifier_block *nb); extern void unregister_cpu_notifier(struct notifier_block *nb); +extern int current_in_cpu_hotplug(void); int cpu_up(unsigned int cpu); @@ -54,6 +55,10 @@ static inline int register_cpu_notifier(struct notifier_block *nb) static inline void unregister_cpu_notifier(struct notifier_block *nb) { } +static inline int current_in_cpu_hotplug(void) +{ + return 0; +} #endif /* CONFIG_SMP */ extern struct sysdev_class cpu_sysdev_class; diff --git a/include/linux/sched.h b/include/linux/sched.h index 03b68a7b4b82..2bbf968b23d9 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -909,6 +909,7 @@ do { if (atomic_dec_and_test(&(tsk)->usage)) __put_task_struct(tsk); } while(0) #define PF_SYNCWRITE 0x00200000 /* I am doing a sync write */ #define PF_BORROWED_MM 0x00400000 /* I am a kthread doing use_mm */ #define PF_RANDOMIZE 0x00800000 /* randomize virtual address space */ +#define PF_HOTPLUG_CPU 0x01000000 /* Currently performing CPU hotplug */ /* * Only the _current_ task can read/write to tsk->flags, but other diff --git a/kernel/cpu.c b/kernel/cpu.c index 3619e939182e..d61ba88f34e5 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -21,6 +21,24 @@ EXPORT_SYMBOL_GPL(cpucontrol); static struct notifier_block *cpu_chain; +/* + * Used to check by callers if they need to acquire the cpucontrol + * or not to protect a cpu from being removed. Its sometimes required to + * call these functions both for normal operations, and in response to + * a cpu being added/removed. If the context of the call is in the same + * thread context as a CPU hotplug thread, we dont need to take the lock + * since its already protected + * check drivers/cpufreq/cpufreq.c for its usage - Ashok Raj + */ + +int current_in_cpu_hotplug(void) +{ + return (current->flags & PF_HOTPLUG_CPU); +} + +EXPORT_SYMBOL_GPL(current_in_cpu_hotplug); + + /* Need to know about CPUs going up/down? */ int register_cpu_notifier(struct notifier_block *nb) { @@ -94,6 +112,13 @@ int cpu_down(unsigned int cpu) goto out; } + /* + * Leave a trace in current->flags indicating we are already in + * process of performing CPU hotplug. Callers can check if cpucontrol + * is already acquired by current thread, and if so not cause + * a dead lock by not acquiring the lock + */ + current->flags |= PF_HOTPLUG_CPU; err = notifier_call_chain(&cpu_chain, CPU_DOWN_PREPARE, (void *)(long)cpu); if (err == NOTIFY_BAD) { @@ -146,6 +171,7 @@ out_thread: out_allowed: set_cpus_allowed(current, old_allowed); out: + current->flags &= ~PF_HOTPLUG_CPU; unlock_cpu_hotplug(); return err; } @@ -163,6 +189,12 @@ int __devinit cpu_up(unsigned int cpu) ret = -EINVAL; goto out; } + + /* + * Leave a trace in current->flags indicating we are already in + * process of performing CPU hotplug. + */ + current->flags |= PF_HOTPLUG_CPU; ret = notifier_call_chain(&cpu_chain, CPU_UP_PREPARE, hcpu); if (ret == NOTIFY_BAD) { printk("%s: attempt to bring up CPU %u failed\n", @@ -185,6 +217,7 @@ out_notify: if (ret != 0) notifier_call_chain(&cpu_chain, CPU_UP_CANCELED, hcpu); out: + current->flags &= ~PF_HOTPLUG_CPU; up(&cpucontrol); return ret; } -- cgit v1.2.2 From 3aef1bde147a503aacb59b767826720a996aea6d Mon Sep 17 00:00:00 2001 From: Anton Blanchard Date: Tue, 8 Nov 2005 21:34:25 -0800 Subject: [PATCH] quieten softlockup at boot On a large SMP box we get a lot of softlockup thread XX started lines. Signed-off-by: Anton Blanchard Acked-by: Ingo Molnar Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- kernel/softlockup.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/kernel/softlockup.c b/kernel/softlockup.c index a2dcceb9437d..c67189a25d52 100644 --- a/kernel/softlockup.c +++ b/kernel/softlockup.c @@ -73,9 +73,6 @@ void softlockup_tick(struct pt_regs *regs) static int watchdog(void * __bind_cpu) { struct sched_param param = { .sched_priority = 99 }; - int this_cpu = (long) __bind_cpu; - - printk("softlockup thread %d started up.\n", this_cpu); sched_setscheduler(current, SCHED_FIFO, ¶m); current->flags |= PF_NOFREEZE; -- cgit v1.2.2 From 409ef74a1558f4550de677957d1d136f1e5b03b3 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Tue, 8 Nov 2005 21:34:26 -0800 Subject: [PATCH] vx_hwdep.c needs vmalloc.h sound/drivers/vx/vx_hwdep.c: In function `free_fw': sound/drivers/vx/vx_hwdep.c:144: error: implicit declaration of function `vfree' sound/drivers/vx/vx_hwdep.c: In function `vx_hwdep_dsp_load': sound/drivers/vx/vx_hwdep.c:163: error: implicit declaration of function `vmalloc' Cc: Jaroslav Kysela Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- sound/drivers/vx/vx_hwdep.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/drivers/vx/vx_hwdep.c b/sound/drivers/vx/vx_hwdep.c index 9a3dc3c3b3de..c4993b004c42 100644 --- a/sound/drivers/vx/vx_hwdep.c +++ b/sound/drivers/vx/vx_hwdep.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include -- cgit v1.2.2 From b80b5832ffc03cb5e2af9bb12c04836190a74481 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Tue, 8 Nov 2005 21:34:27 -0800 Subject: [PATCH] mtd: rfd_ftl build fix drivers/mtd/rfd_ftl.c: In function `find_free_block': drivers/mtd/rfd_ftl.c:528: error: `jiffies' undeclared (first use in this function) drivers/mtd/rfd_ftl.c:528: error: (Each undeclared identifier is reported only once drivers/mtd/rfd_ftl.c:528: error: for each function it appears in.) Cc: Thomas Gleixner Cc: David Woodhouse Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/mtd/rfd_ftl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mtd/rfd_ftl.c b/drivers/mtd/rfd_ftl.c index 041ee59ea77d..0ab8d29caeea 100644 --- a/drivers/mtd/rfd_ftl.c +++ b/drivers/mtd/rfd_ftl.c @@ -18,6 +18,7 @@ #include #include #include +#include #include -- cgit v1.2.2 From 015953d706b1b7ad61c37fe329042828a0f3b0f6 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Tue, 8 Nov 2005 21:34:28 -0800 Subject: [PATCH] mtd: onenand_base needs sched.h drivers/mtd/onenand/onenand_base.c: In function `onenand_wait': drivers/mtd/onenand/onenand_base.c:293: error: `jiffies' undeclared (first use in this function) drivers/mtd/onenand/onenand_base.c:293: error: (Each undeclared identifier is reported only once drivers/mtd/onenand/onenand_base.c:293: error: for each function it appears in.) drivers/mtd/onenand/onenand_base.c:293: error: implicit declaration of function `msecs_to_jiffies' drivers/mtd/onenand/onenand_base.c:294: error: implicit declaration of function `time_before' drivers/mtd/onenand/onenand_base.c:301: error: implicit declaration of function `cond_resched' drivers/mtd/onenand/onenand_base.c: In function `onenand_get_device': drivers/mtd/onenand/onenand_base.c:522: error: implicit declaration of function `set_current_state' drivers/mtd/onenand/onenand_base.c:522: error: `TASK_UNINTERRUPTIBLE' undeclared (first use in this function) drivers/mtd/onenand/onenand_base.c:525: error: implicit declaration of function `schedule' drivers/mtd/onenand/onenand_base.c: In function `onenand_release_device': drivers/mtd/onenand/onenand_base.c:545: error: `TASK_UNINTERRUPTIBLE' undeclared (first use in this function) drivers/mtd/onenand/onenand_base.c:545: error: `TASK_INTERRUPTIBLE' undeclared (first use in this function) Cc: Thomas Gleixner Cc: David Woodhouse Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/mtd/onenand/onenand_base.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c index cc38fa0d45c6..f67d5d6eb9a6 100644 --- a/drivers/mtd/onenand/onenand_base.c +++ b/drivers/mtd/onenand/onenand_base.c @@ -12,6 +12,8 @@ #include #include #include +#include +#include #include #include #include -- cgit v1.2.2 From 08de1f0461ad40136e7373cf85e2f3c221a9ad9a Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Tue, 8 Nov 2005 21:34:29 -0800 Subject: [PATCH] Input: fix 'uniq' reporting in hotplug handler Input: fix 'uniq' reporting in hotplug handler Signed-off-by: Dmitry Torokhov Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/input/input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/input/input.c b/drivers/input/input.c index 0879915b14d5..c8ae2bb054e0 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -669,7 +669,7 @@ static int input_dev_hotplug(struct class_device *cdev, char **envp, INPUT_ADD_HOTPLUG_VAR("NAME=\"%s\"", dev->name); if (dev->phys) INPUT_ADD_HOTPLUG_VAR("PHYS=\"%s\"", dev->phys); - if (dev->phys) + if (dev->uniq) INPUT_ADD_HOTPLUG_VAR("UNIQ=\"%s\"", dev->uniq); INPUT_ADD_HOTPLUG_BM_VAR("EV=", dev->evbit, EV_MAX); -- cgit v1.2.2 From 969e9afd489514252a680914c6d8b9322c713eb4 Mon Sep 17 00:00:00 2001 From: Pavel Machek Date: Tue, 8 Nov 2005 21:34:30 -0800 Subject: [PATCH] sleep: Fix oops in enter_state If ACPI sleep is not configured, but someone still wants to run swsusp, he'd get oops in enter_state. This is regression since 2.6.14 and this fixes it. Signed-off-by: Pavel Machek Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- kernel/power/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/power/main.c b/kernel/power/main.c index 18d7d693fbba..6ee2cad530e8 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c @@ -167,7 +167,7 @@ static int enter_state(suspend_state_t state) { int error; - if (pm_ops->valid && !pm_ops->valid(state)) + if (pm_ops && pm_ops->valid && !pm_ops->valid(state)) return -ENODEV; if (down_trylock(&pm_sem)) return -EBUSY; -- cgit v1.2.2 From d34d7ae266b23932809c43f115fda71fc5e5fcb1 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 8 Nov 2005 21:34:31 -0800 Subject: [PATCH] drm fixup pci gart settings Fix the PCIGART increment and add a cpu_to_le32 for ppc (untested) Paulus was unsure if we need to cpu_to_le32 but the old code was definitely wrong, so make it consistent and let the PPC guys figure it out later. Signed-off-by: Dave Airlie Cc: Paul Mackerras Cc: Dave Jones Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/char/drm/ati_pcigart.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/char/drm/ati_pcigart.c b/drivers/char/drm/ati_pcigart.c index 6d3fec160bff..efff0eec618c 100644 --- a/drivers/char/drm/ati_pcigart.c +++ b/drivers/char/drm/ati_pcigart.c @@ -203,10 +203,10 @@ int drm_ati_pcigart_init(drm_device_t * dev, drm_ati_pcigart_info * gart_info) for (j = 0; j < (PAGE_SIZE / ATI_PCIGART_PAGE_SIZE); j++) { if (gart_info->is_pcie) - *pci_gart = (cpu_to_le32(page_base) >> 8) | 0xc; + *pci_gart = cpu_to_le32((page_base >> 8) | 0xc); else *pci_gart = cpu_to_le32(page_base); - *pci_gart++; + pci_gart++; page_base += ATI_PCIGART_PAGE_SIZE; } } -- cgit v1.2.2 From e517a0cd859ae0c4d9451107113fc2b076456f8f Mon Sep 17 00:00:00 2001 From: Stephen Smalley Date: Tue, 8 Nov 2005 21:34:32 -0800 Subject: [PATCH] selinux: MLS compatibility This patch enables files created on a MLS-enabled SELinux system to be accessible on a non-MLS SELinux system, by skipping the MLS component of the security context in the non-MLS case. Signed-off-by: Stephen Smalley Signed-off-by: James Morris Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- security/selinux/ss/mls.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/security/selinux/ss/mls.c b/security/selinux/ss/mls.c index aaefac2921f1..640d0bfdbc68 100644 --- a/security/selinux/ss/mls.c +++ b/security/selinux/ss/mls.c @@ -262,8 +262,11 @@ int mls_context_to_sid(char oldc, struct cat_datum *catdatum, *rngdatum; int l, rc = -EINVAL; - if (!selinux_mls_enabled) + if (!selinux_mls_enabled) { + if (def_sid != SECSID_NULL && oldc) + *scontext += strlen(*scontext); return 0; + } /* * No MLS component to the security context, try and map to -- cgit v1.2.2 From 25a74f3ba8efb394e9a30d6de37566bf03fd3de8 Mon Sep 17 00:00:00 2001 From: Stephen Smalley Date: Tue, 8 Nov 2005 21:34:33 -0800 Subject: [PATCH] selinux: disable setxattr on mountpoint labeled filesystems This patch disables the setting of SELinux xattrs on files created in filesystems labeled via mountpoint labeling (mounted with the context= option). selinux_inode_setxattr already prevents explicit setxattr from userspace on such filesystems, so this provides consistent behavior for file creation. Signed-off-by: Stephen Smalley Signed-off-by: James Morris Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- security/selinux/hooks.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 45c41490d521..fc774436a264 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -1986,6 +1986,9 @@ static int selinux_inode_init_security(struct inode *inode, struct inode *dir, inode_security_set_sid(inode, newsid); + if (sbsec->behavior == SECURITY_FS_USE_MNTPOINT) + return -EOPNOTSUPP; + if (name) { namep = kstrdup(XATTR_SELINUX_SUFFIX, GFP_KERNEL); if (!namep) -- cgit v1.2.2 From ce9982d048bb498c38ec1fe2ae59a44350882f3f Mon Sep 17 00:00:00 2001 From: Stephen Smalley Date: Tue, 8 Nov 2005 21:34:33 -0800 Subject: [PATCH] selinux: extend selinuxfs context interface This patch extends the selinuxfs context interface to allow return the canonical form of the context to userspace. Signed-off-by: Stephen Smalley Signed-off-by: James Morris Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- security/selinux/selinuxfs.c | 45 +++++++++++++++++++------------------------- 1 file changed, 19 insertions(+), 26 deletions(-) diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c index fdc382389720..0e1352a555c8 100644 --- a/security/selinux/selinuxfs.c +++ b/security/selinux/selinuxfs.c @@ -271,46 +271,38 @@ static struct file_operations sel_load_ops = { .write = sel_write_load, }; - -static ssize_t sel_write_context(struct file * file, const char __user * buf, - size_t count, loff_t *ppos) - +static ssize_t sel_write_context(struct file * file, char *buf, size_t size) { - char *page; - u32 sid; + char *canon; + u32 sid, len; ssize_t length; length = task_has_security(current, SECURITY__CHECK_CONTEXT); if (length) return length; - if (count >= PAGE_SIZE) - return -ENOMEM; - if (*ppos != 0) { - /* No partial writes. */ - return -EINVAL; - } - page = (char*)get_zeroed_page(GFP_KERNEL); - if (!page) - return -ENOMEM; - length = -EFAULT; - if (copy_from_user(page, buf, count)) - goto out; + length = security_context_to_sid(buf, size, &sid); + if (length < 0) + return length; - length = security_context_to_sid(page, count, &sid); + length = security_sid_to_context(sid, &canon, &len); if (length < 0) + return length; + + if (len > SIMPLE_TRANSACTION_LIMIT) { + printk(KERN_ERR "%s: context size (%u) exceeds payload " + "max\n", __FUNCTION__, len); + length = -ERANGE; goto out; + } - length = count; + memcpy(buf, canon, len); + length = len; out: - free_page((unsigned long) page); + kfree(canon); return length; } -static struct file_operations sel_context_ops = { - .write = sel_write_context, -}; - static ssize_t sel_read_checkreqprot(struct file *filp, char __user *buf, size_t count, loff_t *ppos) { @@ -375,6 +367,7 @@ static ssize_t (*write_op[])(struct file *, char *, size_t) = { [SEL_RELABEL] = sel_write_relabel, [SEL_USER] = sel_write_user, [SEL_MEMBER] = sel_write_member, + [SEL_CONTEXT] = sel_write_context, }; static ssize_t selinux_transaction_write(struct file *file, const char __user *buf, size_t size, loff_t *pos) @@ -1220,7 +1213,7 @@ static int sel_fill_super(struct super_block * sb, void * data, int silent) static struct tree_descr selinux_files[] = { [SEL_LOAD] = {"load", &sel_load_ops, S_IRUSR|S_IWUSR}, [SEL_ENFORCE] = {"enforce", &sel_enforce_ops, S_IRUGO|S_IWUSR}, - [SEL_CONTEXT] = {"context", &sel_context_ops, S_IRUGO|S_IWUGO}, + [SEL_CONTEXT] = {"context", &transaction_ops, S_IRUGO|S_IWUGO}, [SEL_ACCESS] = {"access", &transaction_ops, S_IRUGO|S_IWUGO}, [SEL_CREATE] = {"create", &transaction_ops, S_IRUGO|S_IWUGO}, [SEL_RELABEL] = {"relabel", &transaction_ops, S_IRUGO|S_IWUGO}, -- cgit v1.2.2 From c099af7622c8e032edcfdc057cde1015761adeac Mon Sep 17 00:00:00 2001 From: Matt Porter Date: Tue, 8 Nov 2005 21:34:34 -0800 Subject: [PATCH] ppc32: Fix RapidIO build on 85xx Fixes mismerged Makefile that prevented the ppc85xx rapidio support from being built. Signed-off-by: Matt Porter Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/ppc/syslib/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/ppc/syslib/Makefile b/arch/ppc/syslib/Makefile index 5bd33baac243..5b7f2b80e56e 100644 --- a/arch/ppc/syslib/Makefile +++ b/arch/ppc/syslib/Makefile @@ -33,7 +33,6 @@ obj-$(CONFIG_PPC4xx_DMA) += ppc4xx_dma.o obj-$(CONFIG_PPC4xx_EDMA) += ppc4xx_sgdma.o ifeq ($(CONFIG_40x),y) obj-$(CONFIG_PCI) += pci_auto.o ppc405_pci.o -obj-$(CONFIG_RAPIDIO) += ppc85xx_rio.o endif endif obj-$(CONFIG_8xx) += m8xx_setup.o ppc8xx_pic.o $(wdt-mpc8xx-y) \ @@ -96,6 +95,7 @@ obj-$(CONFIG_85xx) += open_pic.o ppc85xx_common.o ppc85xx_setup.o \ ifeq ($(CONFIG_85xx),y) obj-$(CONFIG_PCI) += pci_auto.o endif +obj-$(CONFIG_RAPIDIO) += ppc85xx_rio.o obj-$(CONFIG_83xx) += ipic.o ppc83xx_setup.o ppc_sys.o \ mpc83xx_sys.o mpc83xx_devices.o ifeq ($(CONFIG_83xx),y) -- cgit v1.2.2 From 8827cc706861070f8a3a9e839b96e40231b16ce0 Mon Sep 17 00:00:00 2001 From: Matt Porter Date: Tue, 8 Nov 2005 21:34:35 -0800 Subject: [PATCH] ppc32: Fix STx GP3 build Add missing include file to fix STx GP3 build. Signed-off-by: Matt Porter Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/ppc/platforms/85xx/stx_gp3.h | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/ppc/platforms/85xx/stx_gp3.h b/arch/ppc/platforms/85xx/stx_gp3.h index 95fdf4b0680b..7bcc6c35a417 100644 --- a/arch/ppc/platforms/85xx/stx_gp3.h +++ b/arch/ppc/platforms/85xx/stx_gp3.h @@ -21,6 +21,7 @@ #include #include +#include #include #define BOARD_CCSRBAR ((uint)0xe0000000) -- cgit v1.2.2 From 143dcec2f7123b630b9e2c01c31b01a383dc15ff Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Tue, 8 Nov 2005 21:34:36 -0800 Subject: [PATCH] ppc64: add MODALIAS= for vio bus A non-broken udev would autoload also the drivers for devices on the pseries vio bus, like ibmveth, ibmvscsic and hvsc. This is similar to pci, usb and ieee1394: /lib/modules/`uname -r`/modules.alias alias vio:TvscsiSIBM,v-scsi* ibmvscsic alias vio:TnetworkSIBM,l-lan* ibmveth alias vio:Tserial-serverShvterm2* hvcs /events/debug.00004.pci.add.1394:MODALIAS='pci:v00001014d00000188sv00000000sd00000000bc06sc04i0f' /events/debug.00005.pci.add.1509:MODALIAS='pci:v00008086d00001229sv00001014sd000001FFbc02sc00i00' /events/debug.00026.vio.add.1519:MODALIAS='vio:TserialShvterm1' /events/debug.00027.vio.add.1446:MODALIAS='vio:TvscsiSIBM,v-scsi' /events/debug.00028.vio.add.1451:MODALIAS='vio:TnetworkSIBM,l-lan' modprobe -v vio:TnetworkSIBM,l-lan insmod /lib/modules/2.6.14-20051030_vio-ppc64/kernel/drivers/net/ibmveth.ko Signed-off-by: Olaf Hering Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/powerpc/kernel/vio.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c index 97082a4203ad..71a6addf9f7f 100644 --- a/arch/powerpc/kernel/vio.c +++ b/arch/powerpc/kernel/vio.c @@ -21,6 +21,7 @@ #include #include #include +#include static const struct vio_device_id *vio_match_device( const struct vio_device_id *, const struct vio_dev *); @@ -265,7 +266,33 @@ static int vio_bus_match(struct device *dev, struct device_driver *drv) return (ids != NULL) && (vio_match_device(ids, vio_dev) != NULL); } +static int vio_hotplug(struct device *dev, char **envp, int num_envp, + char *buffer, int buffer_size) +{ + const struct vio_dev *vio_dev = to_vio_dev(dev); + char *cp; + int length; + + if (!num_envp) + return -ENOMEM; + + if (!vio_dev->dev.platform_data) + return -ENODEV; + cp = (char *)get_property(vio_dev->dev.platform_data, "compatible", &length); + if (!cp) + return -ENODEV; + + envp[0] = buffer; + length = scnprintf(buffer, buffer_size, "MODALIAS=vio:T%sS%s", + vio_dev->type, cp); + if (buffer_size - length <= 0) + return -ENOMEM; + envp[1] = NULL; + return 0; +} + struct bus_type vio_bus_type = { .name = "vio", + .hotplug = vio_hotplug, .match = vio_bus_match, }; -- cgit v1.2.2 From 78b331213ec738ee4c1218034d6eec17293b3aed Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Tue, 8 Nov 2005 21:34:37 -0800 Subject: [PATCH] ppc32: Update MPC834x platform to work with new phylib MPC834x uses the gianfar network driver which now uses the new phylib. We need to update the platform code to create a gianfar platform MDIO bus and pass the right intializations to the gianfar driver to make things work again. Signed-off-by: Kumar Gala Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/ppc/configs/mpc834x_sys_defconfig | 431 ++++++++++++++++++++++++--------- arch/ppc/platforms/83xx/mpc834x_sys.c | 23 +- arch/ppc/syslib/mpc83xx_devices.c | 12 +- arch/ppc/syslib/mpc83xx_sys.c | 24 +- include/asm-ppc/mpc83xx.h | 1 + 5 files changed, 353 insertions(+), 138 deletions(-) diff --git a/arch/ppc/configs/mpc834x_sys_defconfig b/arch/ppc/configs/mpc834x_sys_defconfig index 4a5522ca8207..673dc64ebcb1 100644 --- a/arch/ppc/configs/mpc834x_sys_defconfig +++ b/arch/ppc/configs/mpc834x_sys_defconfig @@ -1,16 +1,17 @@ # # Automatically generated make config: don't edit -# Linux kernel version: 2.6.11-rc4 -# Thu Feb 17 16:12:23 2005 +# Linux kernel version: 2.6.14 +# Mon Nov 7 15:38:29 2005 # CONFIG_MMU=y CONFIG_GENERIC_HARDIRQS=y CONFIG_RWSEM_XCHGADD_ALGORITHM=y CONFIG_GENERIC_CALIBRATE_DELAY=y -CONFIG_HAVE_DEC_LOCK=y CONFIG_PPC=y CONFIG_PPC32=y CONFIG_GENERIC_NVRAM=y +CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y +CONFIG_ARCH_MAY_HAVE_PC_FDC=y # # Code maturity level options @@ -18,23 +19,28 @@ CONFIG_GENERIC_NVRAM=y CONFIG_EXPERIMENTAL=y CONFIG_CLEAN_COMPILE=y CONFIG_BROKEN_ON_SMP=y +CONFIG_INIT_ENV_ARG_LIMIT=32 # # General setup # CONFIG_LOCALVERSION="" +CONFIG_LOCALVERSION_AUTO=y CONFIG_SWAP=y CONFIG_SYSVIPC=y # CONFIG_POSIX_MQUEUE is not set # CONFIG_BSD_PROCESS_ACCT is not set CONFIG_SYSCTL=y # CONFIG_AUDIT is not set -CONFIG_LOG_BUF_SHIFT=14 # CONFIG_HOTPLUG is not set CONFIG_KOBJECT_UEVENT=y # CONFIG_IKCONFIG is not set +CONFIG_INITRAMFS_SOURCE="" CONFIG_EMBEDDED=y # CONFIG_KALLSYMS is not set +CONFIG_PRINTK=y +CONFIG_BUG=y +CONFIG_BASE_FULL=y CONFIG_FUTEX=y # CONFIG_EPOLL is not set # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set @@ -44,6 +50,7 @@ CONFIG_CC_ALIGN_LABELS=0 CONFIG_CC_ALIGN_LOOPS=0 CONFIG_CC_ALIGN_JUMPS=0 # CONFIG_TINY_SHMEM is not set +CONFIG_BASE_SMALL=0 # # Loadable module support @@ -59,44 +66,90 @@ CONFIG_6xx=y # CONFIG_POWER3 is not set # CONFIG_POWER4 is not set # CONFIG_8xx is not set +# CONFIG_E200 is not set # CONFIG_E500 is not set +CONFIG_PPC_FPU=y +# CONFIG_KEXEC is not set # CONFIG_CPU_FREQ is not set +# CONFIG_WANT_EARLY_SERIAL is not set CONFIG_PPC_GEN550=y -CONFIG_83xx=y - -# -# Freescale 83xx options -# -CONFIG_MPC834x_SYS=y -CONFIG_MPC834x=y CONFIG_PPC_STD_MMU=y # # Platform options # +# CONFIG_PPC_MULTIPLATFORM is not set +# CONFIG_APUS is not set +# CONFIG_KATANA is not set +# CONFIG_WILLOW is not set +# CONFIG_CPCI690 is not set +# CONFIG_POWERPMC250 is not set +# CONFIG_CHESTNUT is not set +# CONFIG_SPRUCE is not set +# CONFIG_HDPU is not set +# CONFIG_EV64260 is not set +# CONFIG_LOPEC is not set +# CONFIG_MVME5100 is not set +# CONFIG_PPLUS is not set +# CONFIG_PRPMC750 is not set +# CONFIG_PRPMC800 is not set +# CONFIG_SANDPOINT is not set +# CONFIG_RADSTONE_PPC7D is not set +# CONFIG_PAL4 is not set +# CONFIG_GEMINI is not set +# CONFIG_EST8260 is not set +# CONFIG_SBC82xx is not set +# CONFIG_SBS8260 is not set +# CONFIG_RPX8260 is not set +# CONFIG_TQM8260 is not set +# CONFIG_ADS8272 is not set +# CONFIG_PQ2FADS is not set +# CONFIG_LITE5200 is not set +CONFIG_MPC834x_SYS=y +# CONFIG_EV64360 is not set +CONFIG_83xx=y +CONFIG_MPC834x=y # CONFIG_SMP is not set -# CONFIG_PREEMPT is not set # CONFIG_HIGHMEM is not set +# CONFIG_HZ_100 is not set +CONFIG_HZ_250=y +# CONFIG_HZ_1000 is not set +CONFIG_HZ=250 +CONFIG_PREEMPT_NONE=y +# CONFIG_PREEMPT_VOLUNTARY is not set +# CONFIG_PREEMPT is not set +CONFIG_SELECT_MEMORY_MODEL=y +CONFIG_FLATMEM_MANUAL=y +# CONFIG_DISCONTIGMEM_MANUAL is not set +# CONFIG_SPARSEMEM_MANUAL is not set +CONFIG_FLATMEM=y +CONFIG_FLAT_NODE_MEM_MAP=y +# CONFIG_SPARSEMEM_STATIC is not set +CONFIG_SPLIT_PTLOCK_CPUS=4 CONFIG_BINFMT_ELF=y # CONFIG_BINFMT_MISC is not set # CONFIG_CMDLINE_BOOL is not set +# CONFIG_PM is not set +# CONFIG_SOFTWARE_SUSPEND is not set +CONFIG_SECCOMP=y +CONFIG_ISA_DMA_API=y # # Bus options # CONFIG_GENERIC_ISA_DMA=y -# CONFIG_PCI is not set -# CONFIG_PCI_DOMAINS is not set +# CONFIG_PPC_I8259 is not set +CONFIG_PPC_INDIRECT_PCI=y +CONFIG_PCI=y +CONFIG_PCI_DOMAINS=y +# CONFIG_MPC83xx_PCI2 is not set +CONFIG_PCI_LEGACY_PROC=y # # PCCARD (PCMCIA/CardBus) support # # CONFIG_PCCARD is not set -# -# PC-card bridges -# - # # Advanced setup # @@ -111,6 +164,75 @@ CONFIG_KERNEL_START=0xc0000000 CONFIG_TASK_SIZE=0x80000000 CONFIG_BOOT_LOAD=0x00800000 +# +# Networking +# +CONFIG_NET=y + +# +# Networking options +# +CONFIG_PACKET=y +# CONFIG_PACKET_MMAP is not set +CONFIG_UNIX=y +# CONFIG_NET_KEY is not set +CONFIG_INET=y +CONFIG_IP_MULTICAST=y +# CONFIG_IP_ADVANCED_ROUTER is not set +CONFIG_IP_FIB_HASH=y +CONFIG_IP_PNP=y +CONFIG_IP_PNP_DHCP=y +CONFIG_IP_PNP_BOOTP=y +# CONFIG_IP_PNP_RARP is not set +# CONFIG_NET_IPIP is not set +# CONFIG_NET_IPGRE is not set +# CONFIG_IP_MROUTE is not set +# CONFIG_ARPD is not set +CONFIG_SYN_COOKIES=y +# CONFIG_INET_AH is not set +# CONFIG_INET_ESP is not set +# CONFIG_INET_IPCOMP is not set +# CONFIG_INET_TUNNEL is not set +CONFIG_INET_DIAG=y +CONFIG_INET_TCP_DIAG=y +# CONFIG_TCP_CONG_ADVANCED is not set +CONFIG_TCP_CONG_BIC=y +# CONFIG_IPV6 is not set +# CONFIG_NETFILTER is not set + +# +# DCCP Configuration (EXPERIMENTAL) +# +# CONFIG_IP_DCCP is not set + +# +# SCTP Configuration (EXPERIMENTAL) +# +# CONFIG_IP_SCTP is not set +# CONFIG_ATM is not set +# CONFIG_BRIDGE is not set +# CONFIG_VLAN_8021Q is not set +# CONFIG_DECNET is not set +# CONFIG_LLC2 is not set +# CONFIG_IPX is not set +# CONFIG_ATALK is not set +# CONFIG_X25 is not set +# CONFIG_LAPB is not set +# CONFIG_NET_DIVERT is not set +# CONFIG_ECONET is not set +# CONFIG_WAN_ROUTER is not set +# CONFIG_NET_SCHED is not set +# CONFIG_NET_CLS_ROUTE is not set + +# +# Network testing +# +# CONFIG_NET_PKTGEN is not set +# CONFIG_HAMRADIO is not set +# CONFIG_IRDA is not set +# CONFIG_BT is not set +# CONFIG_IEEE80211 is not set + # # Device Drivers # @@ -122,6 +244,11 @@ CONFIG_STANDALONE=y CONFIG_PREVENT_FIRMWARE_BUILD=y # CONFIG_FW_LOADER is not set +# +# Connector - unified userspace <-> kernelspace linker +# +# CONFIG_CONNECTOR is not set + # # Memory Technology Devices (MTD) # @@ -140,15 +267,19 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y # Block devices # # CONFIG_BLK_DEV_FD is not set +# CONFIG_BLK_CPQ_DA is not set +# CONFIG_BLK_CPQ_CISS_DA is not set +# CONFIG_BLK_DEV_DAC960 is not set +# CONFIG_BLK_DEV_UMEM is not set # CONFIG_BLK_DEV_COW_COMMON is not set CONFIG_BLK_DEV_LOOP=y # CONFIG_BLK_DEV_CRYPTOLOOP is not set # CONFIG_BLK_DEV_NBD is not set +# CONFIG_BLK_DEV_SX8 is not set CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM_COUNT=16 CONFIG_BLK_DEV_RAM_SIZE=32768 CONFIG_BLK_DEV_INITRD=y -CONFIG_INITRAMFS_SOURCE="" # CONFIG_LBD is not set # CONFIG_CDROM_PKTCDVD is not set @@ -159,6 +290,11 @@ CONFIG_IOSCHED_NOOP=y CONFIG_IOSCHED_AS=y CONFIG_IOSCHED_DEADLINE=y CONFIG_IOSCHED_CFQ=y +CONFIG_DEFAULT_AS=y +# CONFIG_DEFAULT_DEADLINE is not set +# CONFIG_DEFAULT_CFQ is not set +# CONFIG_DEFAULT_NOOP is not set +CONFIG_DEFAULT_IOSCHED="anticipatory" # CONFIG_ATA_OVER_ETH is not set # @@ -169,6 +305,7 @@ CONFIG_IOSCHED_CFQ=y # # SCSI device support # +# CONFIG_RAID_ATTRS is not set # CONFIG_SCSI is not set # @@ -179,110 +316,116 @@ CONFIG_IOSCHED_CFQ=y # # Fusion MPT device support # +# CONFIG_FUSION is not set # # IEEE 1394 (FireWire) support # +# CONFIG_IEEE1394 is not set # # I2O device support # +# CONFIG_I2O is not set # # Macintosh device drivers # # -# Networking support +# Network device support # -CONFIG_NET=y - -# -# Networking options -# -CONFIG_PACKET=y -# CONFIG_PACKET_MMAP is not set -# CONFIG_NETLINK_DEV is not set -CONFIG_UNIX=y -# CONFIG_NET_KEY is not set -CONFIG_INET=y -CONFIG_IP_MULTICAST=y -# CONFIG_IP_ADVANCED_ROUTER is not set -CONFIG_IP_PNP=y -CONFIG_IP_PNP_DHCP=y -CONFIG_IP_PNP_BOOTP=y -# CONFIG_IP_PNP_RARP is not set -# CONFIG_NET_IPIP is not set -# CONFIG_NET_IPGRE is not set -# CONFIG_IP_MROUTE is not set -# CONFIG_ARPD is not set -CONFIG_SYN_COOKIES=y -# CONFIG_INET_AH is not set -# CONFIG_INET_ESP is not set -# CONFIG_INET_IPCOMP is not set -# CONFIG_INET_TUNNEL is not set -CONFIG_IP_TCPDIAG=y -# CONFIG_IP_TCPDIAG_IPV6 is not set -# CONFIG_IPV6 is not set -# CONFIG_NETFILTER is not set +CONFIG_NETDEVICES=y +# CONFIG_DUMMY is not set +# CONFIG_BONDING is not set +# CONFIG_EQUALIZER is not set +# CONFIG_TUN is not set # -# SCTP Configuration (EXPERIMENTAL) +# ARCnet devices # -# CONFIG_IP_SCTP is not set -# CONFIG_ATM is not set -# CONFIG_BRIDGE is not set -# CONFIG_VLAN_8021Q is not set -# CONFIG_DECNET is not set -# CONFIG_LLC2 is not set -# CONFIG_IPX is not set -# CONFIG_ATALK is not set -# CONFIG_X25 is not set -# CONFIG_LAPB is not set -# CONFIG_NET_DIVERT is not set -# CONFIG_ECONET is not set -# CONFIG_WAN_ROUTER is not set +# CONFIG_ARCNET is not set # -# QoS and/or fair queueing +# PHY device support # -# CONFIG_NET_SCHED is not set -# CONFIG_NET_CLS_ROUTE is not set +CONFIG_PHYLIB=y # -# Network testing +# MII PHY device drivers # -# CONFIG_NET_PKTGEN is not set -# CONFIG_NETPOLL is not set -# CONFIG_NET_POLL_CONTROLLER is not set -# CONFIG_HAMRADIO is not set -# CONFIG_IRDA is not set -# CONFIG_BT is not set -CONFIG_NETDEVICES=y -# CONFIG_DUMMY is not set -# CONFIG_BONDING is not set -# CONFIG_EQUALIZER is not set -# CONFIG_TUN is not set +CONFIG_MARVELL_PHY=y +# CONFIG_DAVICOM_PHY is not set +# CONFIG_QSEMI_PHY is not set +# CONFIG_LXT_PHY is not set +# CONFIG_CICADA_PHY is not set # # Ethernet (10 or 100Mbit) # CONFIG_NET_ETHERNET=y CONFIG_MII=y +# CONFIG_HAPPYMEAL is not set +# CONFIG_SUNGEM is not set +# CONFIG_CASSINI is not set +# CONFIG_NET_VENDOR_3COM is not set + +# +# Tulip family network device support +# +# CONFIG_NET_TULIP is not set +# CONFIG_HP100 is not set +CONFIG_NET_PCI=y +# CONFIG_PCNET32 is not set +# CONFIG_AMD8111_ETH is not set +# CONFIG_ADAPTEC_STARFIRE is not set +# CONFIG_B44 is not set +# CONFIG_FORCEDETH is not set +# CONFIG_DGRS is not set +# CONFIG_EEPRO100 is not set +CONFIG_E100=y +# CONFIG_FEALNX is not set +# CONFIG_NATSEMI is not set +# CONFIG_NE2K_PCI is not set +# CONFIG_8139CP is not set +# CONFIG_8139TOO is not set +# CONFIG_SIS900 is not set +# CONFIG_EPIC100 is not set +# CONFIG_SUNDANCE is not set +# CONFIG_TLAN is not set +# CONFIG_VIA_RHINE is not set # # Ethernet (1000 Mbit) # +# CONFIG_ACENIC is not set +# CONFIG_DL2K is not set +CONFIG_E1000=y +# CONFIG_E1000_NAPI is not set +# CONFIG_NS83820 is not set +# CONFIG_HAMACHI is not set +# CONFIG_YELLOWFIN is not set +# CONFIG_R8169 is not set +# CONFIG_SIS190 is not set +# CONFIG_SKGE is not set +# CONFIG_SK98LIN is not set +# CONFIG_VIA_VELOCITY is not set +# CONFIG_TIGON3 is not set +# CONFIG_BNX2 is not set CONFIG_GIANFAR=y # CONFIG_GFAR_NAPI is not set # # Ethernet (10000 Mbit) # +# CONFIG_CHELSIO_T1 is not set +# CONFIG_IXGB is not set +# CONFIG_S2IO is not set # # Token Ring devices # +# CONFIG_TR is not set # # Wireless LAN (non-hamradio) @@ -293,10 +436,14 @@ CONFIG_GIANFAR=y # Wan interfaces # # CONFIG_WAN is not set +# CONFIG_FDDI is not set +# CONFIG_HIPPI is not set # CONFIG_PPP is not set # CONFIG_SLIP is not set # CONFIG_SHAPER is not set # CONFIG_NETCONSOLE is not set +# CONFIG_NETPOLL is not set +# CONFIG_NET_POLL_CONTROLLER is not set # # ISDN subsystem @@ -322,14 +469,6 @@ CONFIG_INPUT=y # CONFIG_INPUT_EVDEV is not set # CONFIG_INPUT_EVBUG is not set -# -# Input I/O drivers -# -# CONFIG_GAMEPORT is not set -CONFIG_SOUND_GAMEPORT=y -# CONFIG_SERIO is not set -# CONFIG_SERIO_I8042 is not set - # # Input Device Drivers # @@ -339,6 +478,12 @@ CONFIG_SOUND_GAMEPORT=y # CONFIG_INPUT_TOUCHSCREEN is not set # CONFIG_INPUT_MISC is not set +# +# Hardware I/O ports +# +# CONFIG_SERIO is not set +# CONFIG_GAMEPORT is not set + # # Character devices # @@ -358,6 +503,7 @@ CONFIG_SERIAL_8250_NR_UARTS=4 # CONFIG_SERIAL_CORE=y CONFIG_SERIAL_CORE_CONSOLE=y +# CONFIG_SERIAL_JSM is not set CONFIG_UNIX98_PTYS=y CONFIG_LEGACY_PTYS=y CONFIG_LEGACY_PTY_COUNT=256 @@ -376,6 +522,7 @@ CONFIG_GEN_RTC=y # CONFIG_GEN_RTC_X is not set # CONFIG_DTLK is not set # CONFIG_R3964 is not set +# CONFIG_APPLICOM is not set # # Ftape, the floppy tape device driver @@ -384,6 +531,12 @@ CONFIG_GEN_RTC=y # CONFIG_DRM is not set # CONFIG_RAW_DRIVER is not set +# +# TPM devices +# +# CONFIG_TCG_TPM is not set +# CONFIG_TELCLOCK is not set + # # I2C support # @@ -400,23 +553,68 @@ CONFIG_I2C_CHARDEV=y # # I2C Hardware Bus support # -# CONFIG_I2C_ISA is not set +# CONFIG_I2C_ALI1535 is not set +# CONFIG_I2C_ALI1563 is not set +# CONFIG_I2C_ALI15X3 is not set +# CONFIG_I2C_AMD756 is not set +# CONFIG_I2C_AMD8111 is not set +# CONFIG_I2C_I801 is not set +# CONFIG_I2C_I810 is not set +# CONFIG_I2C_PIIX4 is not set CONFIG_I2C_MPC=y +# CONFIG_I2C_NFORCE2 is not set # CONFIG_I2C_PARPORT_LIGHT is not set +# CONFIG_I2C_PROSAVAGE is not set +# CONFIG_I2C_SAVAGE4 is not set +# CONFIG_SCx200_ACB is not set +# CONFIG_I2C_SIS5595 is not set +# CONFIG_I2C_SIS630 is not set +# CONFIG_I2C_SIS96X is not set +# CONFIG_I2C_VIA is not set +# CONFIG_I2C_VIAPRO is not set +# CONFIG_I2C_VOODOO3 is not set # CONFIG_I2C_PCA_ISA is not set # -# Hardware Sensors Chip support +# Miscellaneous I2C Chip support +# +# CONFIG_SENSORS_DS1337 is not set +# CONFIG_SENSORS_DS1374 is not set +# CONFIG_SENSORS_EEPROM is not set +# CONFIG_SENSORS_PCF8574 is not set +# CONFIG_SENSORS_PCA9539 is not set +# CONFIG_SENSORS_PCF8591 is not set +# CONFIG_SENSORS_RTC8564 is not set +# CONFIG_SENSORS_M41T00 is not set +# CONFIG_SENSORS_MAX6875 is not set +# CONFIG_RTC_X1205_I2C is not set +# CONFIG_I2C_DEBUG_CORE is not set +# CONFIG_I2C_DEBUG_ALGO is not set +# CONFIG_I2C_DEBUG_BUS is not set +# CONFIG_I2C_DEBUG_CHIP is not set + +# +# Dallas's 1-wire bus +# +# CONFIG_W1 is not set + +# +# Hardware Monitoring support # -# CONFIG_I2C_SENSOR is not set +CONFIG_HWMON=y +# CONFIG_HWMON_VID is not set # CONFIG_SENSORS_ADM1021 is not set # CONFIG_SENSORS_ADM1025 is not set # CONFIG_SENSORS_ADM1026 is not set # CONFIG_SENSORS_ADM1031 is not set +# CONFIG_SENSORS_ADM9240 is not set # CONFIG_SENSORS_ASB100 is not set +# CONFIG_SENSORS_ATXP1 is not set # CONFIG_SENSORS_DS1621 is not set # CONFIG_SENSORS_FSCHER is not set +# CONFIG_SENSORS_FSCPOS is not set # CONFIG_SENSORS_GL518SM is not set +# CONFIG_SENSORS_GL520SM is not set # CONFIG_SENSORS_IT87 is not set # CONFIG_SENSORS_LM63 is not set # CONFIG_SENSORS_LM75 is not set @@ -427,33 +625,26 @@ CONFIG_I2C_MPC=y # CONFIG_SENSORS_LM85 is not set # CONFIG_SENSORS_LM87 is not set # CONFIG_SENSORS_LM90 is not set +# CONFIG_SENSORS_LM92 is not set # CONFIG_SENSORS_MAX1619 is not set # CONFIG_SENSORS_PC87360 is not set -# CONFIG_SENSORS_SMSC47B397 is not set +# CONFIG_SENSORS_SIS5595 is not set # CONFIG_SENSORS_SMSC47M1 is not set +# CONFIG_SENSORS_SMSC47B397 is not set +# CONFIG_SENSORS_VIA686A is not set # CONFIG_SENSORS_W83781D is not set +# CONFIG_SENSORS_W83792D is not set # CONFIG_SENSORS_W83L785TS is not set # CONFIG_SENSORS_W83627HF is not set +# CONFIG_SENSORS_W83627EHF is not set +# CONFIG_HWMON_DEBUG_CHIP is not set # -# Other I2C Chip support -# -# CONFIG_SENSORS_EEPROM is not set -# CONFIG_SENSORS_PCF8574 is not set -# CONFIG_SENSORS_PCF8591 is not set -# CONFIG_SENSORS_RTC8564 is not set -# CONFIG_I2C_DEBUG_CORE is not set -# CONFIG_I2C_DEBUG_ALGO is not set -# CONFIG_I2C_DEBUG_BUS is not set -# CONFIG_I2C_DEBUG_CHIP is not set - -# -# Dallas's 1-wire bus +# Misc devices # -# CONFIG_W1 is not set # -# Misc devices +# Multimedia Capabilities Port drivers # # @@ -479,11 +670,12 @@ CONFIG_I2C_MPC=y # # USB support # -# CONFIG_USB_ARCH_HAS_HCD is not set -# CONFIG_USB_ARCH_HAS_OHCI is not set +CONFIG_USB_ARCH_HAS_HCD=y +CONFIG_USB_ARCH_HAS_OHCI=y +# CONFIG_USB is not set # -# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information +# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' # # @@ -501,11 +693,16 @@ CONFIG_I2C_MPC=y # # CONFIG_INFINIBAND is not set +# +# SN Devices +# + # # File systems # CONFIG_EXT2_FS=y # CONFIG_EXT2_FS_XATTR is not set +# CONFIG_EXT2_FS_XIP is not set CONFIG_EXT3_FS=y CONFIG_EXT3_FS_XATTR=y # CONFIG_EXT3_FS_POSIX_ACL is not set @@ -515,17 +712,16 @@ CONFIG_JBD=y CONFIG_FS_MBCACHE=y # CONFIG_REISERFS_FS is not set # CONFIG_JFS_FS is not set - -# -# XFS support -# +# CONFIG_FS_POSIX_ACL is not set # CONFIG_XFS_FS is not set # CONFIG_MINIX_FS is not set # CONFIG_ROMFS_FS is not set +CONFIG_INOTIFY=y # CONFIG_QUOTA is not set CONFIG_DNOTIFY=y # CONFIG_AUTOFS_FS is not set # CONFIG_AUTOFS4_FS is not set +# CONFIG_FUSE_FS is not set # # CD-ROM/DVD Filesystems @@ -546,12 +742,10 @@ CONFIG_DNOTIFY=y CONFIG_PROC_FS=y CONFIG_PROC_KCORE=y CONFIG_SYSFS=y -# CONFIG_DEVFS_FS is not set -# CONFIG_DEVPTS_FS_XATTR is not set CONFIG_TMPFS=y -# CONFIG_TMPFS_XATTR is not set # CONFIG_HUGETLB_PAGE is not set CONFIG_RAMFS=y +# CONFIG_RELAYFS_FS is not set # # Miscellaneous filesystems @@ -580,6 +774,7 @@ CONFIG_NFS_FS=y # CONFIG_NFSD is not set CONFIG_ROOT_NFS=y CONFIG_LOCKD=y +CONFIG_NFS_COMMON=y CONFIG_SUNRPC=y # CONFIG_RPCSEC_GSS_KRB5 is not set # CONFIG_RPCSEC_GSS_SPKM3 is not set @@ -588,6 +783,7 @@ CONFIG_SUNRPC=y # CONFIG_NCP_FS is not set # CONFIG_CODA_FS is not set # CONFIG_AFS_FS is not set +# CONFIG_9P_FS is not set # # Partition Types @@ -614,6 +810,7 @@ CONFIG_PARTITION_ADVANCED=y # Library routines # # CONFIG_CRC_CCITT is not set +# CONFIG_CRC16 is not set CONFIG_CRC32=y # CONFIG_LIBCRC32C is not set @@ -625,7 +822,9 @@ CONFIG_CRC32=y # # Kernel hacking # +# CONFIG_PRINTK_TIME is not set # CONFIG_DEBUG_KERNEL is not set +CONFIG_LOG_BUF_SHIFT=14 # CONFIG_SERIAL_TEXT_DEBUG is not set # diff --git a/arch/ppc/platforms/83xx/mpc834x_sys.c b/arch/ppc/platforms/83xx/mpc834x_sys.c index 79b3f533d0a3..98edc75f4105 100644 --- a/arch/ppc/platforms/83xx/mpc834x_sys.c +++ b/arch/ppc/platforms/83xx/mpc834x_sys.c @@ -51,6 +51,9 @@ #include +static const char *GFAR_PHY_0 = "phy0:0"; +static const char *GFAR_PHY_1 = "phy0:1"; + #ifndef CONFIG_PCI unsigned long isa_io_base = 0; unsigned long isa_mem_base = 0; @@ -97,6 +100,7 @@ mpc834x_sys_setup_arch(void) bd_t *binfo = (bd_t *) __res; unsigned int freq; struct gianfar_platform_data *pdata; + struct gianfar_mdio_data *mdata; /* get the core frequency */ freq = binfo->bi_intfreq; @@ -111,24 +115,27 @@ mpc834x_sys_setup_arch(void) #endif mpc83xx_early_serial_map(); + /* setup the board related info for the MDIO bus */ + mdata = (struct gianfar_mdio_data *) ppc_sys_get_pdata(MPC83xx_MDIO); + + mdata->irq[0] = MPC83xx_IRQ_EXT1; + mdata->irq[1] = MPC83xx_IRQ_EXT2; + mdata->irq[2] = -1; + mdata->irq[31] = -1; + mdata->paddr += binfo->bi_immr_base; + /* setup the board related information for the enet controllers */ pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC83xx_TSEC1); if (pdata) { pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; - pdata->interruptPHY = MPC83xx_IRQ_EXT1; - pdata->phyid = 0; - /* fixup phy address */ - pdata->phy_reg_addr += binfo->bi_immr_base; + pdata->bus_id = GFAR_PHY_0; memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6); } pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC83xx_TSEC2); if (pdata) { pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; - pdata->interruptPHY = MPC83xx_IRQ_EXT2; - pdata->phyid = 1; - /* fixup phy address */ - pdata->phy_reg_addr += binfo->bi_immr_base; + pdata->bus_id = GFAR_PHY_1; memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6); } diff --git a/arch/ppc/syslib/mpc83xx_devices.c b/arch/ppc/syslib/mpc83xx_devices.c index dbf8acac507f..f43fbf9a9389 100644 --- a/arch/ppc/syslib/mpc83xx_devices.c +++ b/arch/ppc/syslib/mpc83xx_devices.c @@ -27,18 +27,20 @@ * what IMMRBAR is, will get fixed up by mach_mpc83xx_fixup */ +struct gianfar_mdio_data mpc83xx_mdio_pdata = { + .paddr = 0x24520, +}; + static struct gianfar_platform_data mpc83xx_tsec1_pdata = { .device_flags = FSL_GIANFAR_DEV_HAS_GIGABIT | FSL_GIANFAR_DEV_HAS_COALESCE | FSL_GIANFAR_DEV_HAS_RMON | FSL_GIANFAR_DEV_HAS_MULTI_INTR, - .phy_reg_addr = 0x24000, }; static struct gianfar_platform_data mpc83xx_tsec2_pdata = { .device_flags = FSL_GIANFAR_DEV_HAS_GIGABIT | FSL_GIANFAR_DEV_HAS_COALESCE | FSL_GIANFAR_DEV_HAS_RMON | FSL_GIANFAR_DEV_HAS_MULTI_INTR, - .phy_reg_addr = 0x24000, }; static struct fsl_i2c_platform_data mpc83xx_fsl_i2c1_pdata = { @@ -220,6 +222,12 @@ struct platform_device ppc_sys_platform_devices[] = { }, }, }, + [MPC83xx_MDIO] = { + .name = "fsl-gianfar_mdio", + .id = 0, + .dev.platform_data = &mpc83xx_mdio_pdata, + .num_resources = 0, + }, }; static int __init mach_mpc83xx_fixup(struct platform_device *pdev) diff --git a/arch/ppc/syslib/mpc83xx_sys.c b/arch/ppc/syslib/mpc83xx_sys.c index 29aa63350025..da743446789b 100644 --- a/arch/ppc/syslib/mpc83xx_sys.c +++ b/arch/ppc/syslib/mpc83xx_sys.c @@ -24,72 +24,72 @@ struct ppc_sys_spec ppc_sys_specs[] = { .ppc_sys_name = "8349E", .mask = 0xFFFF0000, .value = 0x80500000, - .num_devices = 8, + .num_devices = 9, .device_list = (enum ppc_sys_devices[]) { MPC83xx_TSEC1, MPC83xx_TSEC2, MPC83xx_IIC1, MPC83xx_IIC2, MPC83xx_DUART, MPC83xx_SEC2, - MPC83xx_USB2_DR, MPC83xx_USB2_MPH + MPC83xx_USB2_DR, MPC83xx_USB2_MPH, MPC83xx_MDIO }, }, { .ppc_sys_name = "8349", .mask = 0xFFFF0000, .value = 0x80510000, - .num_devices = 7, + .num_devices = 8, .device_list = (enum ppc_sys_devices[]) { MPC83xx_TSEC1, MPC83xx_TSEC2, MPC83xx_IIC1, MPC83xx_IIC2, MPC83xx_DUART, - MPC83xx_USB2_DR, MPC83xx_USB2_MPH + MPC83xx_USB2_DR, MPC83xx_USB2_MPH, MPC83xx_MDIO }, }, { .ppc_sys_name = "8347E", .mask = 0xFFFF0000, .value = 0x80520000, - .num_devices = 8, + .num_devices = 9, .device_list = (enum ppc_sys_devices[]) { MPC83xx_TSEC1, MPC83xx_TSEC2, MPC83xx_IIC1, MPC83xx_IIC2, MPC83xx_DUART, MPC83xx_SEC2, - MPC83xx_USB2_DR, MPC83xx_USB2_MPH + MPC83xx_USB2_DR, MPC83xx_USB2_MPH, MPC83xx_MDIO }, }, { .ppc_sys_name = "8347", .mask = 0xFFFF0000, .value = 0x80530000, - .num_devices = 7, + .num_devices = 8, .device_list = (enum ppc_sys_devices[]) { MPC83xx_TSEC1, MPC83xx_TSEC2, MPC83xx_IIC1, MPC83xx_IIC2, MPC83xx_DUART, - MPC83xx_USB2_DR, MPC83xx_USB2_MPH + MPC83xx_USB2_DR, MPC83xx_USB2_MPH, MPC83xx_MDIO }, }, { .ppc_sys_name = "8343E", .mask = 0xFFFF0000, .value = 0x80540000, - .num_devices = 7, + .num_devices = 8, .device_list = (enum ppc_sys_devices[]) { MPC83xx_TSEC1, MPC83xx_TSEC2, MPC83xx_IIC1, MPC83xx_IIC2, MPC83xx_DUART, MPC83xx_SEC2, - MPC83xx_USB2_DR, + MPC83xx_USB2_DR, MPC83xx_MDIO }, }, { .ppc_sys_name = "8343", .mask = 0xFFFF0000, .value = 0x80550000, - .num_devices = 6, + .num_devices = 7, .device_list = (enum ppc_sys_devices[]) { MPC83xx_TSEC1, MPC83xx_TSEC2, MPC83xx_IIC1, MPC83xx_IIC2, MPC83xx_DUART, - MPC83xx_USB2_DR, + MPC83xx_USB2_DR, MPC83xx_MDIO }, }, { /* default match */ diff --git a/include/asm-ppc/mpc83xx.h b/include/asm-ppc/mpc83xx.h index bb1b0576c947..ce212201db2a 100644 --- a/include/asm-ppc/mpc83xx.h +++ b/include/asm-ppc/mpc83xx.h @@ -107,6 +107,7 @@ enum ppc_sys_devices { MPC83xx_SEC2, MPC83xx_USB2_DR, MPC83xx_USB2_MPH, + MPC83xx_MDIO, }; #endif /* CONFIG_83xx */ -- cgit v1.2.2 From a31751e04ea738acc8042e5aa1a825901aa7b97f Mon Sep 17 00:00:00 2001 From: Matt Porter Date: Tue, 8 Nov 2005 21:34:38 -0800 Subject: [PATCH] ppc32: fix perf_irq extern on e500 Fixes e500 build and cleans up traps.c by moving perf_irq extern to pmc.h. Signed-off-by: Matt Porter Cc: Paul Mackerras Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/powerpc/kernel/traps.c | 4 ---- include/asm-powerpc/pmc.h | 1 + 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c index 32f215825e8d..0578f8387603 100644 --- a/arch/powerpc/kernel/traps.c +++ b/arch/powerpc/kernel/traps.c @@ -887,10 +887,6 @@ void altivec_unavailable_exception(struct pt_regs *regs) die("Unrecoverable VMX/Altivec Unavailable Exception", regs, SIGABRT); } -#ifdef CONFIG_PPC64 -extern perf_irq_t perf_irq; -#endif - #if defined(CONFIG_PPC64) || defined(CONFIG_E500) void performance_monitor_exception(struct pt_regs *regs) { diff --git a/include/asm-powerpc/pmc.h b/include/asm-powerpc/pmc.h index 2f3c3fc2b796..5f41f3a2b293 100644 --- a/include/asm-powerpc/pmc.h +++ b/include/asm-powerpc/pmc.h @@ -22,6 +22,7 @@ #include typedef void (*perf_irq_t)(struct pt_regs *); +extern perf_irq_t perf_irq; int reserve_pmc_hardware(perf_irq_t new_perf_irq); void release_pmc_hardware(void); -- cgit v1.2.2 From 054bd4c18853f3a3851bd97aa90e11022a69dc42 Mon Sep 17 00:00:00 2001 From: "Rafael J. Wysocki" Date: Tue, 8 Nov 2005 21:34:39 -0800 Subject: [PATCH] swsusp: reduce code duplication MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The changes made by this patch are necessary for the pagedir relocation simplification in the next patch.  Additionally, these changes allow us to drop check_pagedir() and make get_safe_page() be a one-line wrapper around alloc_image_page() (get_safe_page() goes to snapshot.c, because alloc_image_page() is static and it does not make sense to export it). Signed-off-by: Rafael J. Wysocki Cc: Pavel Machek Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- kernel/power/power.h | 3 ++- kernel/power/snapshot.c | 62 ++++++++++++++++++++++++++++++++++++++----------- kernel/power/swsusp.c | 57 ++------------------------------------------- 3 files changed, 52 insertions(+), 70 deletions(-) diff --git a/kernel/power/power.h b/kernel/power/power.h index d4fd96a135ab..c98923e13e75 100644 --- a/kernel/power/power.h +++ b/kernel/power/power.h @@ -66,7 +66,8 @@ extern asmlinkage int swsusp_arch_suspend(void); extern asmlinkage int swsusp_arch_resume(void); extern int restore_highmem(void); -extern struct pbe * alloc_pagedir(unsigned nr_pages); +extern struct pbe *alloc_pagedir(unsigned nr_pages, gfp_t gfp_mask, int safe_needed); extern void create_pbe_list(struct pbe *pblist, unsigned nr_pages); extern void swsusp_free(void); +extern int alloc_data_pages(struct pbe *pblist, gfp_t gfp_mask, int safe_needed); extern int enough_swap(unsigned nr_pages); diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c index 723f5179883e..96cc3e21e97d 100644 --- a/kernel/power/snapshot.c +++ b/kernel/power/snapshot.c @@ -269,9 +269,30 @@ void create_pbe_list(struct pbe *pblist, unsigned int nr_pages) pr_debug("create_pbe_list(): initialized %d PBEs\n", num); } -static void *alloc_image_page(void) +/** + * @safe_needed - on resume, for storing the PBE list and the image, + * we can only use memory pages that do not conflict with the pages + * which had been used before suspend. + * + * The unsafe pages are marked with the PG_nosave_free flag + * + * Allocated but unusable (ie eaten) memory pages should be marked + * so that swsusp_free() can release them + */ + +static inline void *alloc_image_page(gfp_t gfp_mask, int safe_needed) { - void *res = (void *)get_zeroed_page(GFP_ATOMIC | __GFP_COLD); + void *res; + + if (safe_needed) + do { + res = (void *)get_zeroed_page(gfp_mask); + if (res && PageNosaveFree(virt_to_page(res))) + /* This is for swsusp_free() */ + SetPageNosave(virt_to_page(res)); + } while (res && PageNosaveFree(virt_to_page(res))); + else + res = (void *)get_zeroed_page(gfp_mask); if (res) { SetPageNosave(virt_to_page(res)); SetPageNosaveFree(virt_to_page(res)); @@ -279,6 +300,11 @@ static void *alloc_image_page(void) return res; } +unsigned long get_safe_page(gfp_t gfp_mask) +{ + return (unsigned long)alloc_image_page(gfp_mask, 1); +} + /** * alloc_pagedir - Allocate the page directory. * @@ -292,7 +318,7 @@ static void *alloc_image_page(void) * On each page we set up a list of struct_pbe elements. */ -struct pbe *alloc_pagedir(unsigned int nr_pages) +struct pbe *alloc_pagedir(unsigned int nr_pages, gfp_t gfp_mask, int safe_needed) { unsigned int num; struct pbe *pblist, *pbe; @@ -301,12 +327,12 @@ struct pbe *alloc_pagedir(unsigned int nr_pages) return NULL; pr_debug("alloc_pagedir(): nr_pages = %d\n", nr_pages); - pblist = alloc_image_page(); + pblist = alloc_image_page(gfp_mask, safe_needed); /* FIXME: rewrite this ugly loop */ for (pbe = pblist, num = PBES_PER_PAGE; pbe && num < nr_pages; pbe = pbe->next, num += PBES_PER_PAGE) { pbe += PB_PAGE_SKIP; - pbe->next = alloc_image_page(); + pbe->next = alloc_image_page(gfp_mask, safe_needed); } if (!pbe) { /* get_zeroed_page() failed */ free_pagedir(pblist); @@ -354,24 +380,32 @@ static int enough_free_mem(unsigned int nr_pages) (nr_pages + PBES_PER_PAGE - 1) / PBES_PER_PAGE); } +int alloc_data_pages(struct pbe *pblist, gfp_t gfp_mask, int safe_needed) +{ + struct pbe *p; + + for_each_pbe (p, pblist) { + p->address = (unsigned long)alloc_image_page(gfp_mask, safe_needed); + if (!p->address) + return -ENOMEM; + } + return 0; +} static struct pbe *swsusp_alloc(unsigned int nr_pages) { - struct pbe *pblist, *p; + struct pbe *pblist; - if (!(pblist = alloc_pagedir(nr_pages))) { + if (!(pblist = alloc_pagedir(nr_pages, GFP_ATOMIC | __GFP_COLD, 0))) { printk(KERN_ERR "suspend: Allocating pagedir failed.\n"); return NULL; } create_pbe_list(pblist, nr_pages); - for_each_pbe (p, pblist) { - p->address = (unsigned long)alloc_image_page(); - if (!p->address) { - printk(KERN_ERR "suspend: Allocating image pages failed.\n"); - swsusp_free(); - return NULL; - } + if (alloc_data_pages(pblist, GFP_ATOMIC | __GFP_COLD, 0)) { + printk(KERN_ERR "suspend: Allocating image pages failed.\n"); + swsusp_free(); + return NULL; } return pblist; diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c index e1ab28b9b217..a456ffe7a3c8 100644 --- a/kernel/power/swsusp.c +++ b/kernel/power/swsusp.c @@ -628,59 +628,6 @@ int swsusp_resume(void) return error; } -/** - * On resume, for storing the PBE list and the image, - * we can only use memory pages that do not conflict with the pages - * which had been used before suspend. - * - * We don't know which pages are usable until we allocate them. - * - * Allocated but unusable (ie eaten) memory pages are marked so that - * swsusp_free() can release them - */ - -unsigned long get_safe_page(gfp_t gfp_mask) -{ - unsigned long m; - - do { - m = get_zeroed_page(gfp_mask); - if (m && PageNosaveFree(virt_to_page(m))) - /* This is for swsusp_free() */ - SetPageNosave(virt_to_page(m)); - } while (m && PageNosaveFree(virt_to_page(m))); - if (m) { - /* This is for swsusp_free() */ - SetPageNosave(virt_to_page(m)); - SetPageNosaveFree(virt_to_page(m)); - } - return m; -} - -/** - * check_pagedir - We ensure here that pages that the PBEs point to - * won't collide with pages where we're going to restore from the loaded - * pages later - */ - -static int check_pagedir(struct pbe *pblist) -{ - struct pbe *p; - - /* This is necessary, so that we can free allocated pages - * in case of failure - */ - for_each_pbe (p, pblist) - p->address = 0UL; - - for_each_pbe (p, pblist) { - p->address = get_safe_page(GFP_ATOMIC); - if (!p->address) - return -ENOMEM; - } - return 0; -} - /** * swsusp_pagedir_relocate - It is possible, that some memory pages * occupied by the list of PBEs collide with pages where we're going to @@ -990,7 +937,7 @@ static int read_suspend_image(void) int error = 0; struct pbe *p; - if (!(p = alloc_pagedir(nr_copy_pages))) + if (!(p = alloc_pagedir(nr_copy_pages, GFP_ATOMIC, 0))) return -ENOMEM; if ((error = read_pagedir(p))) @@ -1003,7 +950,7 @@ static int read_suspend_image(void) /* Allocate memory for the image and read the data from swap */ - error = check_pagedir(pagedir_nosave); + error = alloc_data_pages(pagedir_nosave, GFP_ATOMIC, 1); if (!error) error = data_read(pagedir_nosave); -- cgit v1.2.2 From ed14b52701e6ef5a5aaf7bdb75932d5ea5dd7387 Mon Sep 17 00:00:00 2001 From: "Rafael J. Wysocki" Date: Tue, 8 Nov 2005 21:34:40 -0800 Subject: [PATCH] swsusp: simplify pagedir relocation This patch simplifies the relocation of the page backup list (aka pagedir) during resume. Signed-off-by: Rafael J. Wysocki Cc: Pavel Machek Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- kernel/power/power.h | 1 + kernel/power/snapshot.c | 2 +- kernel/power/swsusp.c | 78 +++++++++++++++++-------------------------------- 3 files changed, 28 insertions(+), 53 deletions(-) diff --git a/kernel/power/power.h b/kernel/power/power.h index c98923e13e75..893ee655085c 100644 --- a/kernel/power/power.h +++ b/kernel/power/power.h @@ -66,6 +66,7 @@ extern asmlinkage int swsusp_arch_suspend(void); extern asmlinkage int swsusp_arch_resume(void); extern int restore_highmem(void); +extern void free_pagedir(struct pbe *pblist); extern struct pbe *alloc_pagedir(unsigned nr_pages, gfp_t gfp_mask, int safe_needed); extern void create_pbe_list(struct pbe *pblist, unsigned nr_pages); extern void swsusp_free(void); diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c index 96cc3e21e97d..b8a2e9a63206 100644 --- a/kernel/power/snapshot.c +++ b/kernel/power/snapshot.c @@ -216,7 +216,7 @@ static void copy_data_pages(struct pbe *pblist) * free_pagedir - free pages allocated with alloc_pagedir() */ -static void free_pagedir(struct pbe *pblist) +void free_pagedir(struct pbe *pblist) { struct pbe *pbe; diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c index a456ffe7a3c8..8511c7f3386a 100644 --- a/kernel/power/swsusp.c +++ b/kernel/power/swsusp.c @@ -629,74 +629,43 @@ int swsusp_resume(void) } /** - * swsusp_pagedir_relocate - It is possible, that some memory pages - * occupied by the list of PBEs collide with pages where we're going to - * restore from the loaded pages later. We relocate them here. + * mark_unsafe_pages - mark the pages that cannot be used for storing + * the image during resume, because they conflict with the pages that + * had been used before suspend */ -static struct pbe *swsusp_pagedir_relocate(struct pbe *pblist) +static void mark_unsafe_pages(struct pbe *pblist) { struct zone *zone; unsigned long zone_pfn; - struct pbe *pbpage, *tail, *p; - void *m; - int rel = 0; + struct pbe *p; if (!pblist) /* a sanity check */ - return NULL; - - pr_debug("swsusp: Relocating pagedir (%lu pages to check)\n", - swsusp_info.pagedir_pages); + return; /* Clear page flags */ - for_each_zone (zone) { - for (zone_pfn = 0; zone_pfn < zone->spanned_pages; ++zone_pfn) - if (pfn_valid(zone_pfn + zone->zone_start_pfn)) - ClearPageNosaveFree(pfn_to_page(zone_pfn + + for (zone_pfn = 0; zone_pfn < zone->spanned_pages; ++zone_pfn) + if (pfn_valid(zone_pfn + zone->zone_start_pfn)) + ClearPageNosaveFree(pfn_to_page(zone_pfn + zone->zone_start_pfn)); } /* Mark orig addresses */ - for_each_pbe (p, pblist) SetPageNosaveFree(virt_to_page(p->orig_address)); - tail = pblist + PB_PAGE_SKIP; - - /* Relocate colliding pages */ - - for_each_pb_page (pbpage, pblist) { - if (PageNosaveFree(virt_to_page((unsigned long)pbpage))) { - m = (void *)get_safe_page(GFP_ATOMIC | __GFP_COLD); - if (!m) - return NULL; - memcpy(m, (void *)pbpage, PAGE_SIZE); - if (pbpage == pblist) - pblist = (struct pbe *)m; - else - tail->next = (struct pbe *)m; - pbpage = (struct pbe *)m; - - /* We have to link the PBEs again */ - for (p = pbpage; p < pbpage + PB_PAGE_SKIP; p++) - if (p->next) /* needed to save the end */ - p->next = p + 1; - - rel++; - } - tail = pbpage + PB_PAGE_SKIP; - } +} - /* This is for swsusp_free() */ - for_each_pb_page (pbpage, pblist) { - SetPageNosave(virt_to_page(pbpage)); - SetPageNosaveFree(virt_to_page(pbpage)); +static void copy_page_backup_list(struct pbe *dst, struct pbe *src) +{ + /* We assume both lists contain the same number of elements */ + while (src) { + dst->orig_address = src->orig_address; + dst->swap_address = src->swap_address; + dst = dst->next; + src = src->next; } - - printk("swsusp: Relocated %d pages\n", rel); - - return pblist; } /* @@ -942,10 +911,15 @@ static int read_suspend_image(void) if ((error = read_pagedir(p))) return error; - create_pbe_list(p, nr_copy_pages); - - if (!(pagedir_nosave = swsusp_pagedir_relocate(p))) + mark_unsafe_pages(p); + pagedir_nosave = alloc_pagedir(nr_copy_pages, GFP_ATOMIC, 1); + if (pagedir_nosave) { + create_pbe_list(pagedir_nosave, nr_copy_pages); + copy_page_backup_list(pagedir_nosave, p); + } + free_pagedir(p); + if (!pagedir_nosave) return -ENOMEM; /* Allocate memory for the image and read the data from swap */ -- cgit v1.2.2 From 0fbeb5a45dccd493c35a68a5548e6a9d9882a791 Mon Sep 17 00:00:00 2001 From: "Rafael J. Wysocki" Date: Tue, 8 Nov 2005 21:34:41 -0800 Subject: [PATCH] swsusp: rework swsusp_suspend MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch makes only the functions in swsusp.c call functions in snapshot.c and not both ways.  It also moves the check for available swap out of swsusp_suspend() which is necessary for separating the swap-handling functions in swsusp from the core code. Signed-off-by: Rafael J. Wysocki Cc: Pavel Machek Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- kernel/power/power.h | 2 -- kernel/power/snapshot.c | 19 ++----------- kernel/power/swsusp.c | 75 +++++++++++++++++++++++++++++-------------------- 3 files changed, 47 insertions(+), 49 deletions(-) diff --git a/kernel/power/power.h b/kernel/power/power.h index 893ee655085c..6c042b5ee14b 100644 --- a/kernel/power/power.h +++ b/kernel/power/power.h @@ -65,10 +65,8 @@ extern suspend_pagedir_t *pagedir_save; extern asmlinkage int swsusp_arch_suspend(void); extern asmlinkage int swsusp_arch_resume(void); -extern int restore_highmem(void); extern void free_pagedir(struct pbe *pblist); extern struct pbe *alloc_pagedir(unsigned nr_pages, gfp_t gfp_mask, int safe_needed); extern void create_pbe_list(struct pbe *pblist, unsigned nr_pages); extern void swsusp_free(void); extern int alloc_data_pages(struct pbe *pblist, gfp_t gfp_mask, int safe_needed); -extern int enough_swap(unsigned nr_pages); diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c index b8a2e9a63206..4a6dbcefd378 100644 --- a/kernel/power/snapshot.c +++ b/kernel/power/snapshot.c @@ -88,8 +88,7 @@ static int save_highmem_zone(struct zone *zone) return 0; } - -static int save_highmem(void) +int save_highmem(void) { struct zone *zone; int res = 0; @@ -120,11 +119,7 @@ int restore_highmem(void) } return 0; } -#else -static int save_highmem(void) { return 0; } -int restore_highmem(void) { return 0; } -#endif /* CONFIG_HIGHMEM */ - +#endif static int pfn_is_nosave(unsigned long pfn) { @@ -416,11 +411,6 @@ asmlinkage int swsusp_save(void) unsigned int nr_pages; pr_debug("swsusp: critical section: \n"); - if (save_highmem()) { - printk(KERN_CRIT "swsusp: Not enough free pages for highmem\n"); - restore_highmem(); - return -ENOMEM; - } drain_local_pages(); nr_pages = count_data_pages(); @@ -440,11 +430,6 @@ asmlinkage int swsusp_save(void) return -ENOMEM; } - if (!enough_swap(nr_pages)) { - printk(KERN_ERR "swsusp: Not enough free swap\n"); - return -ENOSPC; - } - pagedir_nosave = swsusp_alloc(nr_pages); if (!pagedir_nosave) return -ENOMEM; diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c index 8511c7f3386a..c05f46e7348f 100644 --- a/kernel/power/swsusp.c +++ b/kernel/power/swsusp.c @@ -73,6 +73,14 @@ #include "power.h" +#ifdef CONFIG_HIGHMEM +int save_highmem(void); +int restore_highmem(void); +#else +static int save_highmem(void) { return 0; } +static int restore_highmem(void) { return 0; } +#endif + #define CIPHER "aes" #define MAXKEY 32 #define MAXIV 32 @@ -499,6 +507,26 @@ static int write_pagedir(void) return error; } +/** + * enough_swap - Make sure we have enough swap to save the image. + * + * Returns TRUE or FALSE after checking the total amount of swap + * space avaiable. + * + * FIXME: si_swapinfo(&i) returns all swap devices information. + * We should only consider resume_device. + */ + +static int enough_swap(unsigned int nr_pages) +{ + struct sysinfo i; + + si_swapinfo(&i); + pr_debug("swsusp: available swap: %lu pages\n", i.freeswap); + return i.freeswap > (nr_pages + PAGES_FOR_IO + + (nr_pages + PBES_PER_PAGE - 1) / PBES_PER_PAGE); +} + /** * write_suspend_image - Write entire image and metadata. * @@ -507,6 +535,11 @@ static int write_suspend_image(void) { int error; + if (!enough_swap(nr_copy_pages)) { + printk(KERN_ERR "swsusp: Not enough free swap\n"); + return -ENOSPC; + } + init_header(); if ((error = data_write())) goto FreeData; @@ -526,27 +559,6 @@ static int write_suspend_image(void) goto Done; } -/** - * enough_swap - Make sure we have enough swap to save the image. - * - * Returns TRUE or FALSE after checking the total amount of swap - * space avaiable. - * - * FIXME: si_swapinfo(&i) returns all swap devices information. - * We should only consider resume_device. - */ - -int enough_swap(unsigned int nr_pages) -{ - struct sysinfo i; - - si_swapinfo(&i); - pr_debug("swsusp: available swap: %lu pages\n", i.freeswap); - return i.freeswap > (nr_pages + PAGES_FOR_IO + - (nr_pages + PBES_PER_PAGE - 1) / PBES_PER_PAGE); -} - - /* It is important _NOT_ to umount filesystems at this point. We want * them synced (in case something goes wrong) but we DO not want to mark * filesystem clean: it is not. (And it does not matter, if we resume @@ -556,12 +568,15 @@ int swsusp_write(void) { int error; + if ((error = swsusp_swap_check())) { + printk(KERN_ERR "swsusp: cannot find swap device, try swapon -a.\n"); + return error; + } lock_swapdevices(); error = write_suspend_image(); /* This will unlock ignored swap devices since writing is finished */ lock_swapdevices(); return error; - } @@ -569,6 +584,7 @@ int swsusp_write(void) int swsusp_suspend(void) { int error; + if ((error = arch_prepare_suspend())) return error; local_irq_disable(); @@ -580,15 +596,12 @@ int swsusp_suspend(void) */ if ((error = device_power_down(PMSG_FREEZE))) { printk(KERN_ERR "Some devices failed to power down, aborting suspend\n"); - local_irq_enable(); - return error; + goto Enable_irqs; } - if ((error = swsusp_swap_check())) { - printk(KERN_ERR "swsusp: cannot find swap device, try swapon -a.\n"); - device_power_up(); - local_irq_enable(); - return error; + if ((error = save_highmem())) { + printk(KERN_ERR "swsusp: Not enough free pages for highmem\n"); + goto Restore_highmem; } save_processor_state(); @@ -596,8 +609,10 @@ int swsusp_suspend(void) printk(KERN_ERR "Error %d suspending\n", error); /* Restore control flow magically appears here */ restore_processor_state(); +Restore_highmem: restore_highmem(); device_power_up(); +Enable_irqs: local_irq_enable(); return error; } @@ -804,7 +819,7 @@ static int check_sig(void) * Reset swap signature now. */ error = bio_write_page(0, &swsusp_header); - } else { + } else { return -EINVAL; } if (!error) -- cgit v1.2.2 From 4448aaf0faafff3f275d15937c28b6346760e028 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Tue, 8 Nov 2005 21:34:42 -0800 Subject: [PATCH] s390: "extern inline" -> "static inline" "extern inline" -> "static inline" Signed-off-by: Adrian Bunk Cc: Martin Schwidefsky Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/s390/Debugging390.txt | 2 +- arch/s390/kernel/debug.c | 12 +++---- arch/s390/mm/fault.c | 2 +- drivers/s390/char/keyboard.h | 4 +-- drivers/s390/cio/qdio.h | 8 ++--- drivers/s390/net/fsm.h | 6 ++-- drivers/s390/s390mach.h | 2 +- include/asm-s390/debug.h | 16 ++++----- include/asm-s390/ebcdic.h | 2 +- include/asm-s390/io.h | 8 ++--- include/asm-s390/lowcore.h | 2 +- include/asm-s390/mmu_context.h | 2 +- include/asm-s390/pgtable.h | 68 ++++++++++++++++++------------------- include/asm-s390/sigp.h | 6 ++-- include/asm-s390/smp.h | 2 +- 15 files changed, 71 insertions(+), 71 deletions(-) diff --git a/Documentation/s390/Debugging390.txt b/Documentation/s390/Debugging390.txt index adbfe620c061..844c03fe7921 100644 --- a/Documentation/s390/Debugging390.txt +++ b/Documentation/s390/Debugging390.txt @@ -871,7 +871,7 @@ by playing with the --adjust-vma parameter to objdump. -extern inline void spin_lock(spinlock_t *lp) +static inline void spin_lock(spinlock_t *lp) { a0: 18 34 lr %r3,%r4 a2: a7 3a 03 bc ahi %r3,956 diff --git a/arch/s390/kernel/debug.c b/arch/s390/kernel/debug.c index bc59282da762..896d39d0e4ce 100644 --- a/arch/s390/kernel/debug.c +++ b/arch/s390/kernel/debug.c @@ -486,7 +486,7 @@ out: * - goto next entry in p_info */ -extern inline int +static inline int debug_next_entry(file_private_info_t *p_info) { debug_info_t *id; @@ -800,7 +800,7 @@ debug_set_level(debug_info_t* id, int new_level) * - set active entry to next in the ring buffer */ -extern inline void +static inline void proceed_active_entry(debug_info_t * id) { if ((id->active_entries[id->active_area] += id->entry_size) @@ -817,7 +817,7 @@ proceed_active_entry(debug_info_t * id) * - set active area to next in the ring buffer */ -extern inline void +static inline void proceed_active_area(debug_info_t * id) { id->active_area++; @@ -828,7 +828,7 @@ proceed_active_area(debug_info_t * id) * get_active_entry: */ -extern inline debug_entry_t* +static inline debug_entry_t* get_active_entry(debug_info_t * id) { return (debug_entry_t *) (((char *) id->areas[id->active_area] @@ -841,7 +841,7 @@ get_active_entry(debug_info_t * id) * - set timestamp, caller address, cpu number etc. */ -extern inline void +static inline void debug_finish_entry(debug_info_t * id, debug_entry_t* active, int level, int exception) { @@ -971,7 +971,7 @@ debug_entry_t * counts arguments in format string for sprintf view */ -extern inline int +static inline int debug_count_numargs(char *string) { int numargs=0; diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c index 64e32da77754..fb2607c369ed 100644 --- a/arch/s390/mm/fault.c +++ b/arch/s390/mm/fault.c @@ -160,7 +160,7 @@ static void do_sigsegv(struct pt_regs *regs, unsigned long error_code, * 11 Page translation -> Not present (nullification) * 3b Region third trans. -> Not present (nullification) */ -extern inline void +static inline void do_exception(struct pt_regs *regs, unsigned long error_code, int is_protection) { struct task_struct *tsk; diff --git a/drivers/s390/char/keyboard.h b/drivers/s390/char/keyboard.h index 3b4da5a9cf79..f7bf45c6bf0d 100644 --- a/drivers/s390/char/keyboard.h +++ b/drivers/s390/char/keyboard.h @@ -41,14 +41,14 @@ int kbd_ioctl(struct kbd_data *, struct file *, unsigned int, unsigned long); /* * Helper Functions. */ -extern inline void +static inline void kbd_put_queue(struct tty_struct *tty, int ch) { tty_insert_flip_char(tty, ch, 0); tty_schedule_flip(tty); } -extern inline void +static inline void kbd_puts_queue(struct tty_struct *tty, char *cp) { while (*cp) diff --git a/drivers/s390/cio/qdio.h b/drivers/s390/cio/qdio.h index 6b8aa6a852be..328e31cc6854 100644 --- a/drivers/s390/cio/qdio.h +++ b/drivers/s390/cio/qdio.h @@ -265,7 +265,7 @@ QDIO_PRINT_##importance(header "%02x %02x %02x %02x %02x %02x %02x %02x " \ /* * Some instructions as assembly */ -extern __inline__ int +static inline int do_siga_sync(unsigned int irq, unsigned int mask1, unsigned int mask2) { int cc; @@ -300,7 +300,7 @@ do_siga_sync(unsigned int irq, unsigned int mask1, unsigned int mask2) return cc; } -extern __inline__ int +static inline int do_siga_input(unsigned int irq, unsigned int mask) { int cc; @@ -334,7 +334,7 @@ do_siga_input(unsigned int irq, unsigned int mask) return cc; } -extern __inline__ int +static inline int do_siga_output(unsigned long irq, unsigned long mask, __u32 *bb) { int cc; @@ -401,7 +401,7 @@ do_siga_output(unsigned long irq, unsigned long mask, __u32 *bb) return cc; } -extern __inline__ unsigned long +static inline unsigned long do_clear_global_summary(void) { diff --git a/drivers/s390/net/fsm.h b/drivers/s390/net/fsm.h index 1b8a7e7c34f3..5b98253be7aa 100644 --- a/drivers/s390/net/fsm.h +++ b/drivers/s390/net/fsm.h @@ -140,7 +140,7 @@ fsm_record_history(fsm_instance *fi, int state, int event); * 1 if current state or event is out of range * !0 if state and event in range, but no action defined. */ -extern __inline__ int +static inline int fsm_event(fsm_instance *fi, int event, void *arg) { fsm_function_t r; @@ -188,7 +188,7 @@ fsm_event(fsm_instance *fi, int event, void *arg) * @param fi Pointer to FSM * @param state The new state for this FSM. */ -extern __inline__ void +static inline void fsm_newstate(fsm_instance *fi, int newstate) { atomic_set(&fi->state,newstate); @@ -208,7 +208,7 @@ fsm_newstate(fsm_instance *fi, int newstate) * * @return The current state of the FSM. */ -extern __inline__ int +static inline int fsm_getstate(fsm_instance *fi) { return atomic_read(&fi->state); diff --git a/drivers/s390/s390mach.h b/drivers/s390/s390mach.h index 4eaa70179182..d9ea7ed2e46e 100644 --- a/drivers/s390/s390mach.h +++ b/drivers/s390/s390mach.h @@ -88,7 +88,7 @@ struct crw { #define CRW_ERC_PERRI 0x07 /* perm. error, facility init */ #define CRW_ERC_PMOD 0x08 /* installed parameters modified */ -extern __inline__ int stcrw(struct crw *pcrw ) +static inline int stcrw(struct crw *pcrw ) { int ccode; diff --git a/include/asm-s390/debug.h b/include/asm-s390/debug.h index 7127030ae162..23450ed4b571 100644 --- a/include/asm-s390/debug.h +++ b/include/asm-s390/debug.h @@ -129,7 +129,7 @@ void debug_set_level(debug_info_t* id, int new_level); void debug_stop_all(void); -extern inline debug_entry_t* +static inline debug_entry_t* debug_event(debug_info_t* id, int level, void* data, int length) { if ((!id) || (level > id->level) || (id->pages_per_area == 0)) @@ -137,7 +137,7 @@ debug_event(debug_info_t* id, int level, void* data, int length) return debug_event_common(id,level,data,length); } -extern inline debug_entry_t* +static inline debug_entry_t* debug_int_event(debug_info_t* id, int level, unsigned int tag) { unsigned int t=tag; @@ -146,7 +146,7 @@ debug_int_event(debug_info_t* id, int level, unsigned int tag) return debug_event_common(id,level,&t,sizeof(unsigned int)); } -extern inline debug_entry_t * +static inline debug_entry_t * debug_long_event (debug_info_t* id, int level, unsigned long tag) { unsigned long t=tag; @@ -155,7 +155,7 @@ debug_long_event (debug_info_t* id, int level, unsigned long tag) return debug_event_common(id,level,&t,sizeof(unsigned long)); } -extern inline debug_entry_t* +static inline debug_entry_t* debug_text_event(debug_info_t* id, int level, const char* txt) { if ((!id) || (level > id->level) || (id->pages_per_area == 0)) @@ -168,7 +168,7 @@ debug_sprintf_event(debug_info_t* id,int level,char *string,...) __attribute__ ((format(printf, 3, 4))); -extern inline debug_entry_t* +static inline debug_entry_t* debug_exception(debug_info_t* id, int level, void* data, int length) { if ((!id) || (level > id->level) || (id->pages_per_area == 0)) @@ -176,7 +176,7 @@ debug_exception(debug_info_t* id, int level, void* data, int length) return debug_exception_common(id,level,data,length); } -extern inline debug_entry_t* +static inline debug_entry_t* debug_int_exception(debug_info_t* id, int level, unsigned int tag) { unsigned int t=tag; @@ -185,7 +185,7 @@ debug_int_exception(debug_info_t* id, int level, unsigned int tag) return debug_exception_common(id,level,&t,sizeof(unsigned int)); } -extern inline debug_entry_t * +static inline debug_entry_t * debug_long_exception (debug_info_t* id, int level, unsigned long tag) { unsigned long t=tag; @@ -194,7 +194,7 @@ debug_long_exception (debug_info_t* id, int level, unsigned long tag) return debug_exception_common(id,level,&t,sizeof(unsigned long)); } -extern inline debug_entry_t* +static inline debug_entry_t* debug_text_exception(debug_info_t* id, int level, const char* txt) { if ((!id) || (level > id->level) || (id->pages_per_area == 0)) diff --git a/include/asm-s390/ebcdic.h b/include/asm-s390/ebcdic.h index 20e81e885821..4cbc336e4d60 100644 --- a/include/asm-s390/ebcdic.h +++ b/include/asm-s390/ebcdic.h @@ -21,7 +21,7 @@ extern __u8 _ebcasc[]; /* EBCDIC -> ASCII conversion table */ extern __u8 _ebc_tolower[]; /* EBCDIC -> lowercase */ extern __u8 _ebc_toupper[]; /* EBCDIC -> uppercase */ -extern __inline__ void +static inline void codepage_convert(const __u8 *codepage, volatile __u8 * addr, unsigned long nr) { if (nr-- <= 0) diff --git a/include/asm-s390/io.h b/include/asm-s390/io.h index 8188fdc9884f..71f55eb2350a 100644 --- a/include/asm-s390/io.h +++ b/include/asm-s390/io.h @@ -24,7 +24,7 @@ * Change virtual addresses to physical addresses and vv. * These are pretty trivial */ -extern inline unsigned long virt_to_phys(volatile void * address) +static inline unsigned long virt_to_phys(volatile void * address) { unsigned long real_address; __asm__ ( @@ -42,7 +42,7 @@ extern inline unsigned long virt_to_phys(volatile void * address) return real_address; } -extern inline void * phys_to_virt(unsigned long address) +static inline void * phys_to_virt(unsigned long address) { return __io_virt(address); } @@ -54,7 +54,7 @@ extern inline void * phys_to_virt(unsigned long address) extern void * __ioremap(unsigned long offset, unsigned long size, unsigned long flags); -extern inline void * ioremap (unsigned long offset, unsigned long size) +static inline void * ioremap (unsigned long offset, unsigned long size) { return __ioremap(offset, size, 0); } @@ -64,7 +64,7 @@ extern inline void * ioremap (unsigned long offset, unsigned long size) * it's useful if some control registers are in such an area and write combining * or read caching is not desirable: */ -extern inline void * ioremap_nocache (unsigned long offset, unsigned long size) +static inline void * ioremap_nocache (unsigned long offset, unsigned long size) { return __ioremap(offset, size, 0); } diff --git a/include/asm-s390/lowcore.h b/include/asm-s390/lowcore.h index c6f51c9ce3ff..db0606c1abd4 100644 --- a/include/asm-s390/lowcore.h +++ b/include/asm-s390/lowcore.h @@ -346,7 +346,7 @@ struct _lowcore #define S390_lowcore (*((struct _lowcore *) 0)) extern struct _lowcore *lowcore_ptr[]; -extern __inline__ void set_prefix(__u32 address) +static inline void set_prefix(__u32 address) { __asm__ __volatile__ ("spx %0" : : "m" (address) : "memory" ); } diff --git a/include/asm-s390/mmu_context.h b/include/asm-s390/mmu_context.h index 3a3bb3f2dad5..bcf24a873874 100644 --- a/include/asm-s390/mmu_context.h +++ b/include/asm-s390/mmu_context.h @@ -44,7 +44,7 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, #define deactivate_mm(tsk,mm) do { } while (0) -extern inline void activate_mm(struct mm_struct *prev, +static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next) { switch_mm(prev, next, current); diff --git a/include/asm-s390/pgtable.h b/include/asm-s390/pgtable.h index 9be741bb1496..859b5e969826 100644 --- a/include/asm-s390/pgtable.h +++ b/include/asm-s390/pgtable.h @@ -319,7 +319,7 @@ extern char empty_zero_page[PAGE_SIZE]; * within a page table are directly modified. Thus, the following * hook is made available. */ -extern inline void set_pte(pte_t *pteptr, pte_t pteval) +static inline void set_pte(pte_t *pteptr, pte_t pteval) { *pteptr = pteval; } @@ -330,63 +330,63 @@ extern inline void set_pte(pte_t *pteptr, pte_t pteval) */ #ifndef __s390x__ -extern inline int pgd_present(pgd_t pgd) { return 1; } -extern inline int pgd_none(pgd_t pgd) { return 0; } -extern inline int pgd_bad(pgd_t pgd) { return 0; } +static inline int pgd_present(pgd_t pgd) { return 1; } +static inline int pgd_none(pgd_t pgd) { return 0; } +static inline int pgd_bad(pgd_t pgd) { return 0; } -extern inline int pmd_present(pmd_t pmd) { return pmd_val(pmd) & _SEG_PRESENT; } -extern inline int pmd_none(pmd_t pmd) { return pmd_val(pmd) & _PAGE_TABLE_INV; } -extern inline int pmd_bad(pmd_t pmd) +static inline int pmd_present(pmd_t pmd) { return pmd_val(pmd) & _SEG_PRESENT; } +static inline int pmd_none(pmd_t pmd) { return pmd_val(pmd) & _PAGE_TABLE_INV; } +static inline int pmd_bad(pmd_t pmd) { return (pmd_val(pmd) & (~PAGE_MASK & ~_PAGE_TABLE_INV)) != _PAGE_TABLE; } #else /* __s390x__ */ -extern inline int pgd_present(pgd_t pgd) +static inline int pgd_present(pgd_t pgd) { return (pgd_val(pgd) & ~PAGE_MASK) == _PGD_ENTRY; } -extern inline int pgd_none(pgd_t pgd) +static inline int pgd_none(pgd_t pgd) { return pgd_val(pgd) & _PGD_ENTRY_INV; } -extern inline int pgd_bad(pgd_t pgd) +static inline int pgd_bad(pgd_t pgd) { return (pgd_val(pgd) & (~PAGE_MASK & ~_PGD_ENTRY_INV)) != _PGD_ENTRY; } -extern inline int pmd_present(pmd_t pmd) +static inline int pmd_present(pmd_t pmd) { return (pmd_val(pmd) & ~PAGE_MASK) == _PMD_ENTRY; } -extern inline int pmd_none(pmd_t pmd) +static inline int pmd_none(pmd_t pmd) { return pmd_val(pmd) & _PMD_ENTRY_INV; } -extern inline int pmd_bad(pmd_t pmd) +static inline int pmd_bad(pmd_t pmd) { return (pmd_val(pmd) & (~PAGE_MASK & ~_PMD_ENTRY_INV)) != _PMD_ENTRY; } #endif /* __s390x__ */ -extern inline int pte_none(pte_t pte) +static inline int pte_none(pte_t pte) { return (pte_val(pte) & _PAGE_INVALID_MASK) == _PAGE_INVALID_EMPTY; } -extern inline int pte_present(pte_t pte) +static inline int pte_present(pte_t pte) { return !(pte_val(pte) & _PAGE_INVALID) || (pte_val(pte) & _PAGE_INVALID_MASK) == _PAGE_INVALID_NONE; } -extern inline int pte_file(pte_t pte) +static inline int pte_file(pte_t pte) { return (pte_val(pte) & _PAGE_INVALID_MASK) == _PAGE_INVALID_FILE; } @@ -397,12 +397,12 @@ extern inline int pte_file(pte_t pte) * query functions pte_write/pte_dirty/pte_young only work if * pte_present() is true. Undefined behaviour if not.. */ -extern inline int pte_write(pte_t pte) +static inline int pte_write(pte_t pte) { return (pte_val(pte) & _PAGE_RO) == 0; } -extern inline int pte_dirty(pte_t pte) +static inline int pte_dirty(pte_t pte) { /* A pte is neither clean nor dirty on s/390. The dirty bit * is in the storage key. See page_test_and_clear_dirty for @@ -411,7 +411,7 @@ extern inline int pte_dirty(pte_t pte) return 0; } -extern inline int pte_young(pte_t pte) +static inline int pte_young(pte_t pte) { /* A pte is neither young nor old on s/390. The young bit * is in the storage key. See page_test_and_clear_young for @@ -420,7 +420,7 @@ extern inline int pte_young(pte_t pte) return 0; } -extern inline int pte_read(pte_t pte) +static inline int pte_read(pte_t pte) { /* All pages are readable since we don't use the fetch * protection bit in the storage key. @@ -434,9 +434,9 @@ extern inline int pte_read(pte_t pte) #ifndef __s390x__ -extern inline void pgd_clear(pgd_t * pgdp) { } +static inline void pgd_clear(pgd_t * pgdp) { } -extern inline void pmd_clear(pmd_t * pmdp) +static inline void pmd_clear(pmd_t * pmdp) { pmd_val(pmdp[0]) = _PAGE_TABLE_INV; pmd_val(pmdp[1]) = _PAGE_TABLE_INV; @@ -446,12 +446,12 @@ extern inline void pmd_clear(pmd_t * pmdp) #else /* __s390x__ */ -extern inline void pgd_clear(pgd_t * pgdp) +static inline void pgd_clear(pgd_t * pgdp) { pgd_val(*pgdp) = _PGD_ENTRY_INV | _PGD_ENTRY; } -extern inline void pmd_clear(pmd_t * pmdp) +static inline void pmd_clear(pmd_t * pmdp) { pmd_val(*pmdp) = _PMD_ENTRY_INV | _PMD_ENTRY; pmd_val1(*pmdp) = _PMD_ENTRY_INV | _PMD_ENTRY; @@ -459,7 +459,7 @@ extern inline void pmd_clear(pmd_t * pmdp) #endif /* __s390x__ */ -extern inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) +static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { pte_val(*ptep) = _PAGE_INVALID_EMPTY; } @@ -468,14 +468,14 @@ extern inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *pt * The following pte modification functions only work if * pte_present() is true. Undefined behaviour if not.. */ -extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot) +static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) { pte_val(pte) &= PAGE_MASK; pte_val(pte) |= pgprot_val(newprot); return pte; } -extern inline pte_t pte_wrprotect(pte_t pte) +static inline pte_t pte_wrprotect(pte_t pte) { /* Do not clobber _PAGE_INVALID_NONE pages! */ if (!(pte_val(pte) & _PAGE_INVALID)) @@ -483,13 +483,13 @@ extern inline pte_t pte_wrprotect(pte_t pte) return pte; } -extern inline pte_t pte_mkwrite(pte_t pte) +static inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) &= ~_PAGE_RO; return pte; } -extern inline pte_t pte_mkclean(pte_t pte) +static inline pte_t pte_mkclean(pte_t pte) { /* The only user of pte_mkclean is the fork() code. We must *not* clear the *physical* page dirty bit @@ -498,7 +498,7 @@ extern inline pte_t pte_mkclean(pte_t pte) return pte; } -extern inline pte_t pte_mkdirty(pte_t pte) +static inline pte_t pte_mkdirty(pte_t pte) { /* We do not explicitly set the dirty bit because the * sske instruction is slow. It is faster to let the @@ -507,7 +507,7 @@ extern inline pte_t pte_mkdirty(pte_t pte) return pte; } -extern inline pte_t pte_mkold(pte_t pte) +static inline pte_t pte_mkold(pte_t pte) { /* S/390 doesn't keep its dirty/referenced bit in the pte. * There is no point in clearing the real referenced bit. @@ -515,7 +515,7 @@ extern inline pte_t pte_mkold(pte_t pte) return pte; } -extern inline pte_t pte_mkyoung(pte_t pte) +static inline pte_t pte_mkyoung(pte_t pte) { /* S/390 doesn't keep its dirty/referenced bit in the pte. * There is no point in setting the real referenced bit. @@ -695,7 +695,7 @@ static inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot) #ifndef __s390x__ /* Find an entry in the second-level page table.. */ -extern inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address) +static inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address) { return (pmd_t *) dir; } @@ -758,7 +758,7 @@ extern inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address) #else #define __SWP_OFFSET_MASK (~0UL >> 11) #endif -extern inline pte_t mk_swap_pte(unsigned long type, unsigned long offset) +static inline pte_t mk_swap_pte(unsigned long type, unsigned long offset) { pte_t pte; offset &= __SWP_OFFSET_MASK; diff --git a/include/asm-s390/sigp.h b/include/asm-s390/sigp.h index 3979bc3858e2..fc56458aff66 100644 --- a/include/asm-s390/sigp.h +++ b/include/asm-s390/sigp.h @@ -67,7 +67,7 @@ typedef enum /* * Signal processor */ -extern __inline__ sigp_ccode +static inline sigp_ccode signal_processor(__u16 cpu_addr, sigp_order_code order_code) { sigp_ccode ccode; @@ -86,7 +86,7 @@ signal_processor(__u16 cpu_addr, sigp_order_code order_code) /* * Signal processor with parameter */ -extern __inline__ sigp_ccode +static inline sigp_ccode signal_processor_p(__u32 parameter, __u16 cpu_addr, sigp_order_code order_code) { @@ -107,7 +107,7 @@ signal_processor_p(__u32 parameter, __u16 cpu_addr, /* * Signal processor with parameter and return status */ -extern __inline__ sigp_ccode +static inline sigp_ccode signal_processor_ps(__u32 *statusptr, __u32 parameter, __u16 cpu_addr, sigp_order_code order_code) { diff --git a/include/asm-s390/smp.h b/include/asm-s390/smp.h index dd50e57a928f..a2ae7628bbaa 100644 --- a/include/asm-s390/smp.h +++ b/include/asm-s390/smp.h @@ -52,7 +52,7 @@ extern int smp_call_function_on(void (*func) (void *info), void *info, extern int smp_get_cpu(cpumask_t cpu_map); extern void smp_put_cpu(int cpu); -extern __inline__ __u16 hard_smp_processor_id(void) +static inline __u16 hard_smp_processor_id(void) { __u16 cpu_address; -- cgit v1.2.2 From 88baf3e85af72f606363a85e9a60e9e61cc64a6c Mon Sep 17 00:00:00 2001 From: Jon Masters Date: Tue, 8 Nov 2005 21:34:43 -0800 Subject: [PATCH] fix floppy.c to store correct ro/rw status in underlying gendisk Evgeny Stambulchik found that doing the following always worked: # mount /dev/fd0 /mnt/floppy/ mount: block device /dev/fd0 is write-protected, mounting read-only # mount -o remount,rw /mnt/floppy # echo $? 0 This is the case because the block device /dev/fd0 is writeable but the floppy disk is marked protected. A fix is to simply have floppy_open mark the underlying gendisk policy according to reality (since the VFS doesn't provide a way for do_remount_sb to inquire as to the current device status). Signed-off-by: Jon Masters Cc: Al Viro Cc: Christoph Hellwig Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/block/floppy.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 5eadbb9d4d71..dd1935d55424 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -3714,6 +3714,12 @@ static int floppy_open(struct inode *inode, struct file *filp) USETF(FD_VERIFY); } + /* set underlying gendisk policy to reflect real ro/rw status */ + if (UTESTF(FD_DISK_WRITABLE)) + inode->i_bdev->bd_disk->policy = 0; + else + inode->i_bdev->bd_disk->policy = 1; + if (UDRS->fd_ref == -1 || (UDRS->fd_ref && (filp->f_flags & O_EXCL))) goto out2; -- cgit v1.2.2 From cecd1ca0cbd6fc5873e9bb110dacb8411be72928 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Tue, 8 Nov 2005 21:34:45 -0800 Subject: [PATCH] schedule obsolete OSS drivers for removal This patch schedules obsolete OSS drivers (with ALSA drivers that support the same hardware) for removal. Scheduling the via82cxxx driver for removal was ACK'ed by Jeff Garzik. Signed-off-by: Adrian Bunk Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/feature-removal-schedule.txt | 7 +++ sound/oss/Kconfig | 73 ++++++++++++++++++------------ 2 files changed, 51 insertions(+), 29 deletions(-) diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index decdf9917e0d..910cc9998731 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt @@ -25,6 +25,13 @@ Who: Adrian Bunk --------------------------- +What: drivers depending on OBSOLETE_OSS_DRIVER +When: January 2006 +Why: OSS drivers with ALSA replacements +Who: Adrian Bunk + +--------------------------- + What: RCU API moves to EXPORT_SYMBOL_GPL When: April 2006 Files: include/linux/rcupdate.h, kernel/rcupdate.c diff --git a/sound/oss/Kconfig b/sound/oss/Kconfig index 953e5f3ea03d..88e52dc84c09 100644 --- a/sound/oss/Kconfig +++ b/sound/oss/Kconfig @@ -4,9 +4,24 @@ # More hacking for modularisation. # # Prompt user for primary drivers. + +config OBSOLETE_OSS_DRIVER + bool "Obsolete OSS drivers" + depends on SOUND_PRIME + help + This option enables support for obsolete OSS drivers that + are scheduled for removal in the near future since there + are ALSA drivers for the same hardware. + + Please contact Adrian Bunk if you had to + say Y here because your soundcard is not properly supported + by ALSA. + + If unsure, say N. + config SOUND_BT878 tristate "BT878 audio dma" - depends on SOUND_PRIME && PCI + depends on SOUND_PRIME && PCI && OBSOLETE_OSS_DRIVER ---help--- Audio DMA support for bt878 based grabber boards. As you might have already noticed, bt878 is listed with two functions in /proc/pci. @@ -22,7 +37,7 @@ config SOUND_BT878 config SOUND_CMPCI tristate "C-Media PCI (CMI8338/8738)" - depends on SOUND_PRIME && PCI + depends on SOUND_PRIME && PCI && OBSOLETE_OSS_DRIVER help Say Y or M if you have a PCI sound card using the CMI8338 or the CMI8738 chipset. Data on these chips are available at @@ -61,7 +76,7 @@ config SOUND_CMPCI_JOYSTICK config SOUND_EMU10K1 tristate "Creative SBLive! (EMU10K1)" - depends on SOUND_PRIME && PCI + depends on SOUND_PRIME && PCI && OBSOLETE_OSS_DRIVER ---help--- Say Y or M if you have a PCI sound card using the EMU10K1 chipset, such as the Creative SBLive!, SB PCI512 or Emu-APS. @@ -95,7 +110,7 @@ config SOUND_FUSION config SOUND_CS4281 tristate "Crystal Sound CS4281" - depends on SOUND_PRIME && PCI + depends on SOUND_PRIME && PCI && OBSOLETE_OSS_DRIVER help Picture and feature list at . @@ -112,7 +127,7 @@ config SOUND_BCM_CS4297A config SOUND_ES1370 tristate "Ensoniq AudioPCI (ES1370)" - depends on SOUND_PRIME && PCI + depends on SOUND_PRIME && PCI && OBSOLETE_OSS_DRIVER help Say Y or M if you have a PCI sound card utilizing the Ensoniq ES1370 chipset, such as Ensoniq's AudioPCI (non-97). To find @@ -125,7 +140,7 @@ config SOUND_ES1370 config SOUND_ES1371 tristate "Creative Ensoniq AudioPCI 97 (ES1371)" - depends on SOUND_PRIME && PCI + depends on SOUND_PRIME && PCI && OBSOLETE_OSS_DRIVER help Say Y or M if you have a PCI sound card utilizing the Ensoniq ES1371 chipset, such as Ensoniq's AudioPCI97. To find out if @@ -138,7 +153,7 @@ config SOUND_ES1371 config SOUND_ESSSOLO1 tristate "ESS Technology Solo1" - depends on SOUND_PRIME && PCI + depends on SOUND_PRIME && PCI && OBSOLETE_OSS_DRIVER help Say Y or M if you have a PCI sound card utilizing the ESS Technology Solo1 chip. To find out if your sound card uses a @@ -149,7 +164,7 @@ config SOUND_ESSSOLO1 config SOUND_MAESTRO tristate "ESS Maestro, Maestro2, Maestro2E driver" - depends on SOUND_PRIME && PCI + depends on SOUND_PRIME && PCI && OBSOLETE_OSS_DRIVER help Say Y or M if you have a sound system driven by ESS's Maestro line of PCI sound chips. These include the Maestro 1, Maestro 2, and @@ -158,7 +173,7 @@ config SOUND_MAESTRO config SOUND_MAESTRO3 tristate "ESS Maestro3/Allegro driver (EXPERIMENTAL)" - depends on SOUND_PRIME && PCI && EXPERIMENTAL + depends on SOUND_PRIME && PCI && EXPERIMENTAL && OBSOLETE_OSS_DRIVER help Say Y or M if you have a sound system driven by ESS's Maestro 3 PCI sound chip. @@ -172,14 +187,14 @@ config SOUND_ICH config SOUND_HARMONY tristate "PA Harmony audio driver" - depends on GSC_LASI && SOUND_PRIME + depends on GSC_LASI && SOUND_PRIME && OBSOLETE_OSS_DRIVER help Say 'Y' or 'M' to include support for Harmony soundchip on HP 712, 715/new and many other GSC based machines. config SOUND_SONICVIBES tristate "S3 SonicVibes" - depends on SOUND_PRIME && PCI + depends on SOUND_PRIME && PCI && OBSOLETE_OSS_DRIVER help Say Y or M if you have a PCI sound card utilizing the S3 SonicVibes chipset. To find out if your sound card uses a @@ -218,7 +233,7 @@ config SOUND_VRC5477 config SOUND_AU1000 tristate "Au1000 Sound" - depends on SOUND_PRIME && (SOC_AU1000 || SOC_AU1100 || SOC_AU1500) + depends on SOUND_PRIME && (SOC_AU1000 || SOC_AU1100 || SOC_AU1500) && OBSOLETE_OSS_DRIVER config SOUND_AU1550_AC97 tristate "Au1550 AC97 Sound" @@ -492,7 +507,7 @@ config MSND_FIFOSIZE config SOUND_VIA82CXXX tristate "VIA 82C686 Audio Codec" - depends on SOUND_PRIME && PCI + depends on SOUND_PRIME && PCI && OBSOLETE_OSS_DRIVER help Say Y here to include support for the audio codec found on VIA 82Cxxx-based chips. Typically these are built into a motherboard. @@ -563,7 +578,7 @@ config SOUND_AD1889 config SOUND_SGALAXY tristate "Aztech Sound Galaxy (non-PnP) cards" - depends on SOUND_OSS + depends on SOUND_OSS && OBSOLETE_OSS_DRIVER help This module initializes the older non Plug and Play sound galaxy cards from Aztech. It supports the Waverider Pro 32 - 3D and the @@ -599,7 +614,7 @@ config SOUND_ACI_MIXER config SOUND_CS4232 tristate "Crystal CS4232 based (PnP) cards" - depends on SOUND_OSS + depends on SOUND_OSS && OBSOLETE_OSS_DRIVER help Say Y here if you have a card based on the Crystal CS4232 chip set, which uses its own Plug and Play protocol. @@ -613,7 +628,7 @@ config SOUND_CS4232 config SOUND_SSCAPE tristate "Ensoniq SoundScape support" - depends on SOUND_OSS + depends on SOUND_OSS && OBSOLETE_OSS_DRIVER help Answer Y if you have a sound card based on the Ensoniq SoundScape chipset. Such cards are being manufactured at least by Ensoniq, Spea @@ -625,7 +640,7 @@ config SOUND_SSCAPE config SOUND_GUS tristate "Gravis Ultrasound support" - depends on SOUND_OSS + depends on SOUND_OSS && OBSOLETE_OSS_DRIVER help Say Y here for any type of Gravis Ultrasound card, including the GUS or GUS MAX. See also for more @@ -727,7 +742,7 @@ config SOUND_MPU401 config SOUND_NM256 tristate "NM256AV/NM256ZX audio support" - depends on SOUND_OSS + depends on SOUND_OSS && OBSOLETE_OSS_DRIVER help Say M here to include audio support for the NeoMagic 256AV/256ZX chipsets. These are the audio chipsets found in the Sony @@ -739,7 +754,7 @@ config SOUND_NM256 config SOUND_MAD16 tristate "OPTi MAD16 and/or Mozart based cards" - depends on SOUND_OSS + depends on SOUND_OSS && OBSOLETE_OSS_DRIVER ---help--- Answer Y if your card has a Mozart (OAK OTI-601) or MAD16 (OPTi 82C928 or 82C929 or 82C931) audio interface chip. These chips are @@ -860,7 +875,7 @@ config SOUND_SB config SOUND_AWE32_SYNTH tristate "AWE32 synth" - depends on SOUND_OSS + depends on SOUND_OSS && OBSOLETE_OSS_DRIVER help Say Y here if you have a Sound Blaster SB32, AWE32-PnP, SB AWE64 or similar sound card. See , @@ -870,7 +885,7 @@ config SOUND_AWE32_SYNTH config SOUND_WAVEFRONT tristate "Full support for Turtle Beach WaveFront (Tropez Plus, Tropez, Maui) synth/soundcards" - depends on SOUND_OSS && m + depends on SOUND_OSS && m && OBSOLETE_OSS_DRIVER help Answer Y or M if you have a Tropez Plus, Tropez or Maui sound card and read the files and @@ -878,7 +893,7 @@ config SOUND_WAVEFRONT config SOUND_MAUI tristate "Limited support for Turtle Beach Wave Front (Maui, Tropez) synthesizers" - depends on SOUND_OSS + depends on SOUND_OSS && OBSOLETE_OSS_DRIVER help Say Y here if you have a Turtle Beach Wave Front, Maui, or Tropez sound card. @@ -904,7 +919,7 @@ config MAUI_BOOT_FILE config SOUND_YM3812 tristate "Yamaha FM synthesizer (YM3812/OPL-3) support" - depends on SOUND_OSS + depends on SOUND_OSS && OBSOLETE_OSS_DRIVER ---help--- Answer Y if your card has a FM chip made by Yamaha (OPL2/OPL3/OPL4). Answering Y is usually a safe and recommended choice, however some @@ -920,7 +935,7 @@ config SOUND_YM3812 config SOUND_OPL3SA1 tristate "Yamaha OPL3-SA1 audio controller" - depends on SOUND_OSS + depends on SOUND_OSS && OBSOLETE_OSS_DRIVER help Say Y or M if you have a Yamaha OPL3-SA1 sound chip, which is usually built into motherboards. Read @@ -946,7 +961,7 @@ config SOUND_OPL3SA2 config SOUND_YMFPCI tristate "Yamaha YMF7xx PCI audio (native mode)" - depends on SOUND_OSS && PCI + depends on SOUND_OSS && PCI && OBSOLETE_OSS_DRIVER help Support for Yamaha cards including the YMF711, YMF715, YMF718, YMF719, YMF724, Waveforce 192XG, and Waveforce 192 Digital. @@ -1088,11 +1103,11 @@ config SOUND_KAHLUA config SOUND_ALI5455 tristate "ALi5455 audio support" - depends on SOUND_PRIME && PCI + depends on SOUND_PRIME && PCI && OBSOLETE_OSS_DRIVER config SOUND_FORTE tristate "ForteMedia FM801 driver" - depends on SOUND_PRIME && PCI + depends on SOUND_PRIME && PCI && OBSOLETE_OSS_DRIVER help Say Y or M if you want driver support for the ForteMedia FM801 PCI audio controller (Abit AU10, Genius Sound Maker, HP Workstation @@ -1100,7 +1115,7 @@ config SOUND_FORTE config SOUND_RME96XX tristate "RME Hammerfall (RME96XX) support" - depends on SOUND_PRIME && PCI + depends on SOUND_PRIME && PCI && OBSOLETE_OSS_DRIVER help Say Y or M if you have a Hammerfall or Hammerfall light multichannel card from RME. If you want to access advanced @@ -1108,7 +1123,7 @@ config SOUND_RME96XX config SOUND_AD1980 tristate "AD1980 front/back switch plugin" - depends on SOUND_PRIME + depends on SOUND_PRIME && OBSOLETE_OSS_DRIVER config SOUND_SH_DAC_AUDIO tristate "SuperH DAC audio support" -- cgit v1.2.2 From 3f04e7ddf47a1c821dfaa886161d94774af583fa Mon Sep 17 00:00:00 2001 From: David Gibson Date: Tue, 8 Nov 2005 21:34:46 -0800 Subject: [PATCH] kconfig: Fix Kconfig performance bug When doing its recursive dependency check, scripts/kconfig/conf uses the flag SYMBOL_CHECK_DONE to avoid rechecking a symbol it has already checked. However, that flag is only set at the top level, so if a symbol is first encountered as a dependency of another symbol it will be rechecked every time it is encountered until it's encountered at the top level. This patch adjusts the flag setting so that each symbol will only be checked once, regardless of whether it is first encountered at the top level, or while recursing down from another symbol. On complex configurations, this vastly speeds up scripts/kconfig/conf. The config in the powerpc merge tree is particularly bad: this patch reduces the time for 'scripts/kconfig/conf -o arch/powerpc/Kconfig' by a factor of 40 on a G5. That's even including the time to print the config, so the speedup in the actual checking is more likely 2 or 3 orders of magnitude. Signed-off-by: David Gibson Signed-off-by: Roman Zippel Cc: Sam Ravnborg Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- scripts/kconfig/expr.h | 1 - scripts/kconfig/symbol.c | 11 ++++++++--- scripts/kconfig/zconf.tab.c_shipped | 5 +---- scripts/kconfig/zconf.y | 5 +---- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h index 7d39ff43e6e1..1b36ef18c48d 100644 --- a/scripts/kconfig/expr.h +++ b/scripts/kconfig/expr.h @@ -93,7 +93,6 @@ struct symbol { #define SYMBOL_NEW 0x0800 #define SYMBOL_AUTO 0x1000 #define SYMBOL_CHECKED 0x2000 -#define SYMBOL_CHECK_DONE 0x4000 #define SYMBOL_WARNED 0x8000 #define SYMBOL_MAXLENGTH 256 diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index affa52f5c651..10d96c4188dd 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c @@ -731,12 +731,12 @@ struct symbol *sym_check_deps(struct symbol *sym) struct symbol *sym2; struct property *prop; - if (sym->flags & SYMBOL_CHECK_DONE) - return NULL; if (sym->flags & SYMBOL_CHECK) { printf("Warning! Found recursive dependency: %s", sym->name); return sym; } + if (sym->flags & SYMBOL_CHECKED) + return NULL; sym->flags |= (SYMBOL_CHECK | SYMBOL_CHECKED); sym2 = sym_check_expr_deps(sym->rev_dep.expr); @@ -756,8 +756,13 @@ struct symbol *sym_check_deps(struct symbol *sym) goto out; } out: - if (sym2) + if (sym2) { printf(" %s", sym->name); + if (sym2 == sym) { + printf("\n"); + sym2 = NULL; + } + } sym->flags &= ~SYMBOL_CHECK; return sym2; } diff --git a/scripts/kconfig/zconf.tab.c_shipped b/scripts/kconfig/zconf.tab.c_shipped index ff4fcc09720e..da12f7b33be3 100644 --- a/scripts/kconfig/zconf.tab.c_shipped +++ b/scripts/kconfig/zconf.tab.c_shipped @@ -1933,10 +1933,7 @@ void conf_parse(const char *name) exit(1); menu_finalize(&rootmenu); for_all_symbols(i, sym) { - if (!(sym->flags & SYMBOL_CHECKED) && sym_check_deps(sym)) - printf("\n"); - else - sym->flags |= SYMBOL_CHECK_DONE; + sym_check_deps(sym); } sym_change_count = 1; diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y index e1a0f455d4a8..1e214e9c1d31 100644 --- a/scripts/kconfig/zconf.y +++ b/scripts/kconfig/zconf.y @@ -495,10 +495,7 @@ void conf_parse(const char *name) exit(1); menu_finalize(&rootmenu); for_all_symbols(i, sym) { - if (!(sym->flags & SYMBOL_CHECKED) && sym_check_deps(sym)) - printf("\n"); - else - sym->flags |= SYMBOL_CHECK_DONE; + sym_check_deps(sym); } sym_change_count = 1; -- cgit v1.2.2 From 3f23ca2b37d13a89bb6cd0421821fc9c3b8ccd47 Mon Sep 17 00:00:00 2001 From: Roman Zippel Date: Tue, 8 Nov 2005 21:34:48 -0800 Subject: [PATCH] kconfig: fix restart for choice symbols The restart check whether new symbols became visible, didn't always work for choice symbols. Even if a choice symbol itself isn't changable, the childs are. This also requires to update the new status of all choice values, once one of them is set. Signed-off-by: Roman Zippel Cc: Sam Ravnborg Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- scripts/kconfig/conf.c | 7 +++---- scripts/kconfig/symbol.c | 11 +++++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index bc20cab9d0d6..dffbf2ea1f9d 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c @@ -467,15 +467,14 @@ static void check_conf(struct menu *menu) return; sym = menu->sym; - if (sym) { - if (sym_is_changable(sym) && !sym_has_value(sym)) { + if (sym && !sym_has_value(sym)) { + if (sym_is_changable(sym) || + (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) { if (!conf_cnt++) printf(_("*\n* Restart config...\n*\n")); rootEntry = menu_get_parent_menu(menu); conf(rootEntry); } - if (sym_is_choice(sym) && sym_get_tristate_value(sym) != mod) - return; } for (child = menu->list; child; child = child->next) diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index 10d96c4188dd..29bff43adc5e 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c @@ -380,11 +380,22 @@ bool sym_set_tristate_value(struct symbol *sym, tristate val) sym->flags &= ~SYMBOL_NEW; sym_set_changed(sym); } + /* + * setting a choice value also resets the new flag of the choice + * symbol and all other choice values. + */ if (sym_is_choice_value(sym) && val == yes) { struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym)); + struct property *prop; + struct expr *e; cs->user.val = sym; cs->flags &= ~SYMBOL_NEW; + prop = sym_get_choice_prop(cs); + for (e = prop->expr; e; e = e->left.expr) { + if (e->right.sym->visible != no) + e->right.sym->flags &= ~SYMBOL_NEW; + } } sym->user.tri = val; -- cgit v1.2.2 From 90389160efc2864501ced6e662f9419eb7a3e6c8 Mon Sep 17 00:00:00 2001 From: Roman Zippel Date: Tue, 8 Nov 2005 21:34:49 -0800 Subject: [PATCH] kconfig: preset config during all*config Allow to force setting of config variables during all{no,mod,yes,random}config to a specific value. For that conf first checks the KCONFIG_ALLCONFIG environment variable for a file name, otherwise it checks for all{no,mod,yes,random}.config and all.config. The file is a normal config file, which presets the config variables, but they are still subject to normal dependency checks. Signed-off-by: Roman Zippel Cc: Sam Ravnborg Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- scripts/kconfig/conf.c | 30 ++++++++++++++++++++++++++++++ scripts/kconfig/confdata.c | 17 ++++++++++++++--- scripts/kconfig/lkc_proto.h | 1 + 3 files changed, 45 insertions(+), 3 deletions(-) diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index dffbf2ea1f9d..8ba5d29d3d42 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c @@ -82,6 +82,15 @@ static void conf_askvalue(struct symbol *sym, const char *def) } switch (input_mode) { + case set_no: + case set_mod: + case set_yes: + case set_random: + if (sym_has_value(sym)) { + printf("%s\n", def); + return; + } + break; case ask_new: case ask_silent: if (sym_has_value(sym)) { @@ -558,6 +567,27 @@ int main(int ac, char **av) case ask_new: conf_read(NULL); break; + case set_no: + case set_mod: + case set_yes: + case set_random: + name = getenv("KCONFIG_ALLCONFIG"); + if (name && !stat(name, &tmpstat)) { + conf_read_simple(name); + break; + } + switch (input_mode) { + case set_no: name = "allno.config"; break; + case set_mod: name = "allmod.config"; break; + case set_yes: name = "allyes.config"; break; + case set_random: name = "allrandom.config"; break; + default: break; + } + if (!stat(name, &tmpstat)) + conf_read_simple(name); + else if (!stat("all.config", &tmpstat)) + conf_read_simple("all.config"); + break; default: break; } diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 02f670cc6bb9..4bba6202b79e 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -69,15 +69,13 @@ char *conf_get_default_confname(void) return name; } -int conf_read(const char *name) +int conf_read_simple(const char *name) { FILE *in = NULL; char line[1024]; char *p, *p2; int lineno = 0; struct symbol *sym; - struct property *prop; - struct expr *e; int i; if (name) { @@ -232,6 +230,19 @@ int conf_read(const char *name) if (modules_sym) sym_calc_value(modules_sym); + return 0; +} + +int conf_read(const char *name) +{ + struct symbol *sym; + struct property *prop; + struct expr *e; + int i; + + if (conf_read_simple(name)) + return 1; + for_all_symbols(i, sym) { sym_calc_value(sym); if (sym_has_value(sym) && !sym_is_choice_value(sym)) { diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h index 6dc6d0c48e7a..b6a389c5fcbd 100644 --- a/scripts/kconfig/lkc_proto.h +++ b/scripts/kconfig/lkc_proto.h @@ -2,6 +2,7 @@ /* confdata.c */ P(conf_parse,void,(const char *name)); P(conf_read,int,(const char *name)); +P(conf_read_simple,int,(const char *name)); P(conf_write,int,(const char *name)); /* menu.c */ -- cgit v1.2.2 From 4cf3cbe2a9682242cd38897914b1f2a95f1db7e4 Mon Sep 17 00:00:00 2001 From: Roman Zippel Date: Tue, 8 Nov 2005 21:34:49 -0800 Subject: [PATCH] kconfig: allow variable argumnts for range This allows variable arguments in the range option for int and hex config symbols. Signed-off-by: Roman Zippel Cc: Sam Ravnborg Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- scripts/kconfig/menu.c | 10 +++++++-- scripts/kconfig/symbol.c | 58 ++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 62 insertions(+), 6 deletions(-) diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index 5cfa6c405cf0..c2a423a1c341 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c @@ -151,6 +151,12 @@ void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep) menu_add_prop(type, NULL, expr_alloc_symbol(sym), dep); } +static int menu_range_valid_sym(struct symbol *sym, struct symbol *sym2) +{ + return sym2->type == S_INT || sym2->type == S_HEX || + (sym2->type == S_UNKNOWN && sym_string_valid(sym, sym2->name)); +} + void sym_check_prop(struct symbol *sym) { struct property *prop; @@ -185,8 +191,8 @@ void sym_check_prop(struct symbol *sym) if (sym->type != S_INT && sym->type != S_HEX) prop_warn(prop, "range is only allowed " "for int or hex symbols"); - if (!sym_string_valid(sym, prop->expr->left.sym->name) || - !sym_string_valid(sym, prop->expr->right.sym->name)) + if (!menu_range_valid_sym(sym, prop->expr->left.sym) || + !menu_range_valid_sym(sym, prop->expr->right.sym)) prop_warn(prop, "range is invalid"); break; default: diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index 29bff43adc5e..69c2549c0baa 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c @@ -141,6 +141,55 @@ struct property *sym_get_range_prop(struct symbol *sym) return NULL; } +static int sym_get_range_val(struct symbol *sym, int base) +{ + sym_calc_value(sym); + switch (sym->type) { + case S_INT: + base = 10; + break; + case S_HEX: + base = 16; + break; + default: + break; + } + return strtol(sym->curr.val, NULL, base); +} + +static void sym_validate_range(struct symbol *sym) +{ + struct property *prop; + int base, val, val2; + char str[64]; + + switch (sym->type) { + case S_INT: + base = 10; + break; + case S_HEX: + base = 16; + break; + default: + return; + } + prop = sym_get_range_prop(sym); + if (!prop) + return; + val = strtol(sym->curr.val, NULL, base); + val2 = sym_get_range_val(prop->expr->left.sym, base); + if (val >= val2) { + val2 = sym_get_range_val(prop->expr->right.sym, base); + if (val <= val2) + return; + } + if (sym->type == S_INT) + sprintf(str, "%d", val2); + else + sprintf(str, "0x%x", val2); + sym->curr.val = strdup(str); +} + static void sym_calc_visibility(struct symbol *sym) { struct property *prop; @@ -301,6 +350,7 @@ void sym_calc_value(struct symbol *sym) sym->curr = newval; if (sym_is_choice(sym) && newval.tri == yes) sym->curr.val = sym_calc_choice(sym); + sym_validate_range(sym); if (memcmp(&oldval, &sym->curr, sizeof(oldval))) sym_set_changed(sym); @@ -489,8 +539,8 @@ bool sym_string_within_range(struct symbol *sym, const char *str) if (!prop) return true; val = strtol(str, NULL, 10); - return val >= strtol(prop->expr->left.sym->name, NULL, 10) && - val <= strtol(prop->expr->right.sym->name, NULL, 10); + return val >= sym_get_range_val(prop->expr->left.sym, 10) && + val <= sym_get_range_val(prop->expr->right.sym, 10); case S_HEX: if (!sym_string_valid(sym, str)) return false; @@ -498,8 +548,8 @@ bool sym_string_within_range(struct symbol *sym, const char *str) if (!prop) return true; val = strtol(str, NULL, 16); - return val >= strtol(prop->expr->left.sym->name, NULL, 16) && - val <= strtol(prop->expr->right.sym->name, NULL, 16); + return val >= sym_get_range_val(prop->expr->left.sym, 16) && + val <= sym_get_range_val(prop->expr->right.sym, 16); case S_BOOLEAN: case S_TRISTATE: switch (str[0]) { -- cgit v1.2.2 From 491d711035dc08071ed58cf470f15efadb67cb1c Mon Sep 17 00:00:00 2001 From: Roman Zippel Date: Tue, 8 Nov 2005 21:34:50 -0800 Subject: [PATCH] kconfig: update kconfig Makefile Remove the long obsolete zconf.tab.h and fix kconfig make rules to generate the correct output files. Setting LKC_GENPARSER will now also update the shipped files. Signed-off-by: Roman Zippel Cc: Sam Ravnborg Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- scripts/kconfig/Makefile | 18 ++---- scripts/kconfig/zconf.tab.h_shipped | 125 ------------------------------------ 2 files changed, 7 insertions(+), 136 deletions(-) delete mode 100644 scripts/kconfig/zconf.tab.h_shipped diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index c65c435c4923..65e3e7371251 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -114,7 +114,7 @@ gconf-objs := gconf.o kconfig_load.o zconf.tab.o endif clean-files := lkc_defs.h qconf.moc .tmp_qtcheck \ - .tmp_gtkcheck zconf.tab.c zconf.tab.h lex.zconf.c + .tmp_gtkcheck zconf.tab.c lex.zconf.c # Needed for systems without gettext KBUILD_HAVE_NLS := $(shell \ @@ -136,12 +136,6 @@ HOSTLOADLIBES_gconf = `pkg-config gtk+-2.0 gmodule-2.0 libglade-2.0 --libs` HOSTCFLAGS_gconf.o = `pkg-config gtk+-2.0 gmodule-2.0 libglade-2.0 --cflags` \ -D LKC_DIRECT_LINK -$(obj)/conf.o $(obj)/mconf.o $(obj)/qconf.o $(obj)/gconf.o $(obj)/kxgettext: $(obj)/zconf.tab.h - -$(obj)/zconf.tab.h: $(src)/zconf.tab.h_shipped -$(obj)/zconf.tab.c: $(src)/zconf.tab.c_shipped -$(obj)/lex.zconf.c: $(src)/lex.zconf.c_shipped - $(obj)/qconf.o: $(obj)/.tmp_qtcheck ifeq ($(qconf-target),1) @@ -230,13 +224,15 @@ $(obj)/lkc_defs.h: $(src)/lkc_proto.h ifdef LKC_GENPARSER -$(obj)/zconf.tab.c: $(obj)/zconf.y -$(obj)/zconf.tab.h: $(obj)/zconf.tab.c +$(obj)/zconf.tab.c: $(src)/zconf.y +$(obj)/lex.zconf.c: $(src)/zconf.l %.tab.c: %.y - bison -t -d -v -b $* -p $(notdir $*) $< + bison -l -b $* -p $(notdir $*) $< + cp $@ $@_shipped lex.%.c: %.l - flex -P$(notdir $*) -o$@ $< + flex -L -P$(notdir $*) -o$@ $< + cp $@ $@_shipped endif diff --git a/scripts/kconfig/zconf.tab.h_shipped b/scripts/kconfig/zconf.tab.h_shipped deleted file mode 100644 index 3b191ef59985..000000000000 --- a/scripts/kconfig/zconf.tab.h_shipped +++ /dev/null @@ -1,125 +0,0 @@ -/* A Bison parser, made from zconf.y, by GNU bison 1.75. */ - -/* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc. - - 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, 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., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ - -#ifndef BISON_ZCONF_TAB_H -# define BISON_ZCONF_TAB_H - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - T_MAINMENU = 258, - T_MENU = 259, - T_ENDMENU = 260, - T_SOURCE = 261, - T_CHOICE = 262, - T_ENDCHOICE = 263, - T_COMMENT = 264, - T_CONFIG = 265, - T_HELP = 266, - T_HELPTEXT = 267, - T_IF = 268, - T_ENDIF = 269, - T_DEPENDS = 270, - T_REQUIRES = 271, - T_OPTIONAL = 272, - T_PROMPT = 273, - T_DEFAULT = 274, - T_TRISTATE = 275, - T_BOOLEAN = 276, - T_INT = 277, - T_HEX = 278, - T_WORD = 279, - T_STRING = 280, - T_UNEQUAL = 281, - T_EOF = 282, - T_EOL = 283, - T_CLOSE_PAREN = 284, - T_OPEN_PAREN = 285, - T_ON = 286, - T_OR = 287, - T_AND = 288, - T_EQUAL = 289, - T_NOT = 290 - }; -#endif -#define T_MAINMENU 258 -#define T_MENU 259 -#define T_ENDMENU 260 -#define T_SOURCE 261 -#define T_CHOICE 262 -#define T_ENDCHOICE 263 -#define T_COMMENT 264 -#define T_CONFIG 265 -#define T_HELP 266 -#define T_HELPTEXT 267 -#define T_IF 268 -#define T_ENDIF 269 -#define T_DEPENDS 270 -#define T_REQUIRES 271 -#define T_OPTIONAL 272 -#define T_PROMPT 273 -#define T_DEFAULT 274 -#define T_TRISTATE 275 -#define T_BOOLEAN 276 -#define T_INT 277 -#define T_HEX 278 -#define T_WORD 279 -#define T_STRING 280 -#define T_UNEQUAL 281 -#define T_EOF 282 -#define T_EOL 283 -#define T_CLOSE_PAREN 284 -#define T_OPEN_PAREN 285 -#define T_ON 286 -#define T_OR 287 -#define T_AND 288 -#define T_EQUAL 289 -#define T_NOT 290 - - - - -#ifndef YYSTYPE -#line 33 "zconf.y" -typedef union { - int token; - char *string; - struct symbol *symbol; - struct expr *expr; - struct menu *menu; -} yystype; -/* Line 1281 of /usr/share/bison/yacc.c. */ -#line 118 "zconf.tab.h" -# define YYSTYPE yystype -#endif - -extern YYSTYPE zconflval; - - -#endif /* not BISON_ZCONF_TAB_H */ - -- cgit v1.2.2 From 7a88488bbc231e48a4a88ee2569bc0cc5d706f0a Mon Sep 17 00:00:00 2001 From: Roman Zippel Date: Tue, 8 Nov 2005 21:34:51 -0800 Subject: [PATCH] kconfig: use gperf for kconfig keywords Use gperf to generate a hash for the kconfig keywords. This greatly reduces the size of the generated scanner and makes it easier to extend kconfig. Signed-off-by: Roman Zippel Cc: Sam Ravnborg Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- scripts/kconfig/Makefile | 11 +- scripts/kconfig/lex.zconf.c_shipped | 1753 ++++------------------------------ scripts/kconfig/lkc.h | 10 + scripts/kconfig/zconf.gperf | 43 + scripts/kconfig/zconf.hash.c_shipped | 231 +++++ scripts/kconfig/zconf.l | 53 +- scripts/kconfig/zconf.tab.c_shipped | 455 +++++---- scripts/kconfig/zconf.y | 9 +- 8 files changed, 760 insertions(+), 1805 deletions(-) create mode 100644 scripts/kconfig/zconf.gperf create mode 100644 scripts/kconfig/zconf.hash.c_shipped diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 65e3e7371251..9d67782b812f 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -114,7 +114,7 @@ gconf-objs := gconf.o kconfig_load.o zconf.tab.o endif clean-files := lkc_defs.h qconf.moc .tmp_qtcheck \ - .tmp_gtkcheck zconf.tab.c lex.zconf.c + .tmp_gtkcheck zconf.tab.c lex.zconf.c zconf.hash.c # Needed for systems without gettext KBUILD_HAVE_NLS := $(shell \ @@ -201,7 +201,7 @@ $(obj)/.tmp_gtkcheck: fi endif -$(obj)/zconf.tab.o: $(obj)/lex.zconf.c +$(obj)/zconf.tab.o: $(obj)/lex.zconf.c $(obj)/zconf.hash.c $(obj)/kconfig_load.o: $(obj)/lkc_defs.h @@ -217,7 +217,7 @@ $(obj)/lkc_defs.h: $(src)/lkc_proto.h ### -# The following requires flex/bison +# The following requires flex/bison/gperf # By default we use the _shipped versions, uncomment the following line if # you are modifying the flex/bison src. # LKC_GENPARSER := 1 @@ -226,6 +226,7 @@ ifdef LKC_GENPARSER $(obj)/zconf.tab.c: $(src)/zconf.y $(obj)/lex.zconf.c: $(src)/zconf.l +$(obj)/zconf.hash.c: $(src)/zconf.gperf %.tab.c: %.y bison -l -b $* -p $(notdir $*) $< @@ -235,4 +236,8 @@ lex.%.c: %.l flex -L -P$(notdir $*) -o$@ $< cp $@ $@_shipped +%.hash.c: %.gperf + gperf < $< > $@ + cp $@ $@_shipped + endif diff --git a/scripts/kconfig/lex.zconf.c_shipped b/scripts/kconfig/lex.zconf.c_shipped index 22dda11f758b..0168141417f6 100644 --- a/scripts/kconfig/lex.zconf.c_shipped +++ b/scripts/kconfig/lex.zconf.c_shipped @@ -1,5 +1,5 @@ -#line 3 "lex.zconf.c" +#line 3 "scripts/kconfig/lex.zconf.c" #define YY_INT_ALIGNED short int @@ -338,1567 +338,323 @@ int zconflineno = 1; extern char *zconftext; #define yytext_ptr zconftext -static yyconst flex_int16_t yy_nxt[][38] = +static yyconst flex_int16_t yy_nxt[][17] = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 - }, - - { - 11, 12, 13, 14, 12, 12, 15, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 12, 12 - }, - - { - 11, 12, 13, 14, 12, 12, 15, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, - - 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 12, 12 - }, - - { - 11, 16, 16, 17, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 18, 16, 16, 18, 18, 19, 20, - 21, 22, 18, 18, 23, 24, 18, 25, 18, 26, - 27, 18, 28, 29, 30, 18, 18, 16 - }, - - { - 11, 16, 16, 17, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 18, 16, 16, 18, 18, 19, 20, - 21, 22, 18, 18, 23, 24, 18, 25, 18, 26, - 27, 18, 28, 29, 30, 18, 18, 16 - - }, - - { - 11, 31, 32, 33, 31, 31, 31, 31, 31, 31, - 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, - 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, - 31, 31, 31, 31, 31, 31, 31, 31 - }, - - { - 11, 31, 32, 33, 31, 31, 31, 31, 31, 31, - 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, - 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, - 31, 31, 31, 31, 31, 31, 31, 31 - }, - - { - 11, 34, 34, 35, 34, 36, 34, 34, 36, 34, - 34, 34, 34, 34, 34, 37, 34, 34, 34, 34, - - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34 - }, - - { - 11, 34, 34, 35, 34, 36, 34, 34, 36, 34, - 34, 34, 34, 34, 34, 37, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34 - }, - - { - 11, 38, 38, 39, 40, 41, 42, 43, 41, 44, - 45, 46, 47, 47, 48, 49, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 50, 47, 47, 47, 51, - 47, 47, 47, 47, 47, 47, 47, 52 - - }, - - { - 11, 38, 38, 39, 40, 41, 42, 43, 41, 44, - 45, 46, 47, 47, 48, 49, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 50, 47, 47, 47, 51, - 47, 47, 47, 47, 47, 47, 47, 52 - }, - - { - -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, - -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, - -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, - -11, -11, -11, -11, -11, -11, -11, -11 - }, - - { - 11, -12, -12, -12, -12, -12, -12, -12, -12, -12, - -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, - - -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, - -12, -12, -12, -12, -12, -12, -12, -12 - }, - - { - 11, -13, 53, 54, -13, -13, 55, -13, -13, -13, - -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, - -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, - -13, -13, -13, -13, -13, -13, -13, -13 - }, - - { - 11, -14, -14, -14, -14, -14, -14, -14, -14, -14, - -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, - -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, - -14, -14, -14, -14, -14, -14, -14, -14 - - }, - - { - 11, 56, 56, 57, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 56 - }, - - { - 11, -16, -16, -16, -16, -16, -16, -16, -16, -16, - -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, - -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, - -16, -16, -16, -16, -16, -16, -16, -16 - }, - - { - 11, -17, -17, -17, -17, -17, -17, -17, -17, -17, - -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, - - -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, - -17, -17, -17, -17, -17, -17, -17, -17 - }, - - { - 11, -18, -18, -18, -18, -18, -18, -18, -18, -18, - -18, -18, -18, 58, -18, -18, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -18 - }, - - { - 11, -19, -19, -19, -19, -19, -19, -19, -19, -19, - -19, -19, -19, 58, -19, -19, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 59, - 58, 58, 58, 58, 58, 58, 58, -19 - - }, - - { - 11, -20, -20, -20, -20, -20, -20, -20, -20, -20, - -20, -20, -20, 58, -20, -20, 58, 58, 58, 58, - 58, 58, 58, 58, 60, 58, 58, 58, 58, 61, - 58, 58, 58, 58, 58, 58, 58, -20 - }, - - { - 11, -21, -21, -21, -21, -21, -21, -21, -21, -21, - -21, -21, -21, 58, -21, -21, 58, 58, 58, 58, - 58, 62, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -21 - }, - - { - 11, -22, -22, -22, -22, -22, -22, -22, -22, -22, - -22, -22, -22, 58, -22, -22, 58, 58, 58, 58, - - 58, 58, 58, 58, 58, 58, 58, 58, 63, 58, - 58, 58, 58, 58, 58, 58, 58, -22 - }, - - { - 11, -23, -23, -23, -23, -23, -23, -23, -23, -23, - -23, -23, -23, 58, -23, -23, 58, 58, 58, 58, - 58, 64, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -23 - }, - - { - 11, -24, -24, -24, -24, -24, -24, -24, -24, -24, - -24, -24, -24, 58, -24, -24, 58, 58, 58, 58, - 58, 58, 65, 58, 58, 58, 58, 58, 66, 58, - 58, 58, 58, 58, 58, 58, 58, -24 - - }, - - { - 11, -25, -25, -25, -25, -25, -25, -25, -25, -25, - -25, -25, -25, 58, -25, -25, 58, 67, 58, 58, - 58, 68, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -25 - }, - - { - 11, -26, -26, -26, -26, -26, -26, -26, -26, -26, - -26, -26, -26, 58, -26, -26, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 69, 58, 58, 58, 58, 58, 58, -26 - }, - - { - 11, -27, -27, -27, -27, -27, -27, -27, -27, -27, - -27, -27, -27, 58, -27, -27, 58, 58, 58, 58, - - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 70, 58, 58, 58, 58, -27 - }, - - { - 11, -28, -28, -28, -28, -28, -28, -28, -28, -28, - -28, -28, -28, 58, -28, -28, 58, 71, 58, 58, - 58, 72, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -28 - }, - - { - 11, -29, -29, -29, -29, -29, -29, -29, -29, -29, - -29, -29, -29, 58, -29, -29, 58, 58, 58, 58, - 58, 73, 58, 58, 58, 58, 58, 58, 58, 74, - 58, 58, 58, 58, 75, 58, 58, -29 - - }, - - { - 11, -30, -30, -30, -30, -30, -30, -30, -30, -30, - -30, -30, -30, 58, -30, -30, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 76, 58, 58, 58, 58, -30 - }, - - { - 11, 77, 77, -31, 77, 77, 77, 77, 77, 77, - 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, - 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, - 77, 77, 77, 77, 77, 77, 77, 77 - }, - - { - 11, -32, 78, 79, -32, -32, -32, -32, -32, -32, - -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, - - -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, - -32, -32, -32, -32, -32, -32, -32, -32 - }, - - { - 11, 80, -33, -33, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80 - }, - - { - 11, 81, 81, 82, 81, -34, 81, 81, -34, 81, - 81, 81, 81, 81, 81, -34, 81, 81, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 81 - - }, - - { - 11, -35, -35, -35, -35, -35, -35, -35, -35, -35, - -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, - -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, - -35, -35, -35, -35, -35, -35, -35, -35 - }, - - { - 11, -36, -36, -36, -36, -36, -36, -36, -36, -36, - -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, - -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, - -36, -36, -36, -36, -36, -36, -36, -36 - }, - - { - 11, 83, 83, 84, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83 - }, - - { - 11, -38, -38, -38, -38, -38, -38, -38, -38, -38, - -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, - -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, - -38, -38, -38, -38, -38, -38, -38, -38 - }, - - { - 11, -39, -39, -39, -39, -39, -39, -39, -39, -39, - -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, - -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, - -39, -39, -39, -39, -39, -39, -39, -39 - - }, - - { - 11, -40, -40, -40, -40, -40, -40, -40, -40, -40, - -40, -40, -40, -40, 85, -40, -40, -40, -40, -40, - -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, - -40, -40, -40, -40, -40, -40, -40, -40 - }, - - { - 11, -41, -41, -41, -41, -41, -41, -41, -41, -41, - -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, - -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, - -41, -41, -41, -41, -41, -41, -41, -41 - }, - - { - 11, 86, 86, -42, 86, 86, 86, 86, 86, 86, - 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, - - 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, - 86, 86, 86, 86, 86, 86, 86, 86 - }, - - { - 11, -43, -43, -43, -43, -43, -43, 87, -43, -43, - -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, - -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, - -43, -43, -43, -43, -43, -43, -43, -43 - }, - - { - 11, -44, -44, -44, -44, -44, -44, -44, -44, -44, - -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, - -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, - -44, -44, -44, -44, -44, -44, -44, -44 - - }, - - { - 11, -45, -45, -45, -45, -45, -45, -45, -45, -45, - -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, - -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, - -45, -45, -45, -45, -45, -45, -45, -45 - }, - - { - 11, -46, -46, -46, -46, -46, -46, -46, -46, -46, - -46, 88, 89, 89, -46, -46, 89, 89, 89, 89, - 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, - 89, 89, 89, 89, 89, 89, 89, -46 - }, - - { - 11, -47, -47, -47, -47, -47, -47, -47, -47, -47, - -47, 89, 89, 89, -47, -47, 89, 89, 89, 89, - - 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, - 89, 89, 89, 89, 89, 89, 89, -47 - }, - - { - 11, -48, -48, -48, -48, -48, -48, -48, -48, -48, - -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, - -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, - -48, -48, -48, -48, -48, -48, -48, -48 - }, - - { - 11, -49, -49, 90, -49, -49, -49, -49, -49, -49, - -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, - -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, - -49, -49, -49, -49, -49, -49, -49, -49 - - }, - - { - 11, -50, -50, -50, -50, -50, -50, -50, -50, -50, - -50, 89, 89, 89, -50, -50, 89, 89, 89, 89, - 89, 89, 91, 89, 89, 89, 89, 89, 89, 89, - 89, 89, 89, 89, 89, 89, 89, -50 - }, - - { - 11, -51, -51, -51, -51, -51, -51, -51, -51, -51, - -51, 89, 89, 89, -51, -51, 89, 89, 89, 89, - 89, 89, 89, 89, 89, 89, 89, 89, 92, 89, - 89, 89, 89, 89, 89, 89, 89, -51 - }, - - { - 11, -52, -52, -52, -52, -52, -52, -52, -52, -52, - -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, - - -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, - -52, -52, -52, -52, -52, -52, -52, 93 - }, - - { - 11, -53, 53, 54, -53, -53, 55, -53, -53, -53, - -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, - -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, - -53, -53, -53, -53, -53, -53, -53, -53 - }, - - { - 11, -54, -54, -54, -54, -54, -54, -54, -54, -54, - -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, - -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, - -54, -54, -54, -54, -54, -54, -54, -54 - - }, - - { - 11, 56, 56, 57, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 56 - }, - - { - 11, 56, 56, 57, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 56 - }, - - { - 11, -57, -57, -57, -57, -57, -57, -57, -57, -57, - -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, - - -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, - -57, -57, -57, -57, -57, -57, -57, -57 - }, - - { - 11, -58, -58, -58, -58, -58, -58, -58, -58, -58, - -58, -58, -58, 58, -58, -58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -58 - }, - - { - 11, -59, -59, -59, -59, -59, -59, -59, -59, -59, - -59, -59, -59, 58, -59, -59, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 94, - 58, 58, 58, 58, 58, 58, 58, -59 - - }, - - { - 11, -60, -60, -60, -60, -60, -60, -60, -60, -60, - -60, -60, -60, 58, -60, -60, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 95, - 58, 58, 58, 58, 58, 58, 58, -60 - }, - - { - 11, -61, -61, -61, -61, -61, -61, -61, -61, -61, - -61, -61, -61, 58, -61, -61, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 96, 97, 58, - 58, 58, 58, 58, 58, 58, 58, -61 - }, - - { - 11, -62, -62, -62, -62, -62, -62, -62, -62, -62, - -62, -62, -62, 58, -62, -62, 58, 58, 58, 58, - - 58, 58, 98, 58, 58, 58, 58, 58, 58, 58, - 99, 58, 58, 58, 58, 58, 58, -62 - }, - - { - 11, -63, -63, -63, -63, -63, -63, -63, -63, -63, - -63, -63, -63, 58, -63, -63, 58, 100, 58, 58, - 101, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -63 - }, - - { - 11, -64, -64, -64, -64, -64, -64, -64, -64, -64, - -64, -64, -64, 58, -64, -64, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 102, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 103, -64 - - }, - - { - 11, -65, -65, -65, -65, -65, -65, -65, -65, -65, - -65, -65, -65, 58, -65, -65, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -65 - }, - - { - 11, -66, -66, -66, -66, -66, -66, -66, -66, -66, - -66, -66, -66, 58, -66, -66, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 104, 58, 58, -66 - }, - - { - 11, -67, -67, -67, -67, -67, -67, -67, -67, -67, - -67, -67, -67, 58, -67, -67, 58, 58, 58, 58, - - 58, 58, 58, 58, 58, 105, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -67 - }, - - { - 11, -68, -68, -68, -68, -68, -68, -68, -68, -68, - -68, -68, -68, 58, -68, -68, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 106, 58, - 58, 58, 58, 58, 58, 58, 58, -68 - }, - - { - 11, -69, -69, -69, -69, -69, -69, -69, -69, -69, - -69, -69, -69, 58, -69, -69, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 107, 58, 58, -69 - - }, - - { - 11, -70, -70, -70, -70, -70, -70, -70, -70, -70, - -70, -70, -70, 58, -70, -70, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 108, - 58, 58, 58, 58, 58, 58, 58, -70 - }, - - { - 11, -71, -71, -71, -71, -71, -71, -71, -71, -71, - -71, -71, -71, 58, -71, -71, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 109, 58, - 58, 58, 58, 58, 58, 58, 58, -71 - }, - - { - 11, -72, -72, -72, -72, -72, -72, -72, -72, -72, - -72, -72, -72, 58, -72, -72, 58, 58, 58, 58, - - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 110, 58, 58, 58, 58, 58, -72 - }, - - { - 11, -73, -73, -73, -73, -73, -73, -73, -73, -73, - -73, -73, -73, 58, -73, -73, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 111, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -73 - }, - - { - 11, -74, -74, -74, -74, -74, -74, -74, -74, -74, - -74, -74, -74, 58, -74, -74, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 112, 58, -74 - - }, - - { - 11, -75, -75, -75, -75, -75, -75, -75, -75, -75, - -75, -75, -75, 58, -75, -75, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 113, 58, 58, 58, 58, -75 - }, - - { - 11, -76, -76, -76, -76, -76, -76, -76, -76, -76, - -76, -76, -76, 58, -76, -76, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 114, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -76 - }, - - { - 11, 77, 77, -77, 77, 77, 77, 77, 77, 77, - 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, - - 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, - 77, 77, 77, 77, 77, 77, 77, 77 - }, - - { - 11, -78, 78, 79, -78, -78, -78, -78, -78, -78, - -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, - -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, - -78, -78, -78, -78, -78, -78, -78, -78 - }, - - { - 11, 80, -79, -79, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80 - - }, - - { - 11, -80, -80, -80, -80, -80, -80, -80, -80, -80, - -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, - -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, - -80, -80, -80, -80, -80, -80, -80, -80 - }, - - { - 11, 81, 81, 82, 81, -81, 81, 81, -81, 81, - 81, 81, 81, 81, 81, -81, 81, 81, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 81 - }, - - { - 11, -82, -82, -82, -82, -82, -82, -82, -82, -82, - -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, - - -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, - -82, -82, -82, -82, -82, -82, -82, -82 - }, - - { - 11, -83, -83, 84, -83, -83, -83, -83, -83, -83, - -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, - -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, - -83, -83, -83, -83, -83, -83, -83, -83 - }, - - { - 11, -84, -84, -84, -84, -84, -84, -84, -84, -84, - -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, - -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, - -84, -84, -84, -84, -84, -84, -84, -84 - - }, - - { - 11, -85, -85, -85, -85, -85, -85, -85, -85, -85, - -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, - -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, - -85, -85, -85, -85, -85, -85, -85, -85 - }, - - { - 11, 86, 86, -86, 86, 86, 86, 86, 86, 86, - 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, - 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, - 86, 86, 86, 86, 86, 86, 86, 86 - }, - - { - 11, -87, -87, -87, -87, -87, -87, -87, -87, -87, - -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, - - -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, - -87, -87, -87, -87, -87, -87, -87, -87 - }, - - { - 11, -88, -88, -88, -88, -88, -88, -88, -88, -88, - -88, 115, 89, 89, -88, -88, 89, 89, 89, 89, - 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, - 89, 89, 89, 89, 89, 89, 89, -88 - }, - - { - 11, -89, -89, -89, -89, -89, -89, -89, -89, -89, - -89, 89, 89, 89, -89, -89, 89, 89, 89, 89, - 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, - 89, 89, 89, 89, 89, 89, 89, -89 - - }, - - { - 11, -90, -90, -90, -90, -90, -90, -90, -90, -90, - -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, - -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, - -90, -90, -90, -90, -90, -90, -90, -90 - }, - - { - 11, -91, -91, -91, -91, -91, -91, -91, -91, -91, - -91, 89, 89, 89, -91, -91, 89, 89, 89, 89, - 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, - 89, 89, 89, 89, 89, 89, 89, -91 - }, - - { - 11, -92, -92, -92, -92, -92, -92, -92, -92, -92, - -92, 89, 89, 89, -92, -92, 89, 89, 89, 89, - - 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, - 89, 89, 89, 89, 89, 89, 89, -92 - }, - - { - 11, -93, -93, -93, -93, -93, -93, -93, -93, -93, - -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, - -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, - -93, -93, -93, -93, -93, -93, -93, -93 - }, - - { - 11, -94, -94, -94, -94, -94, -94, -94, -94, -94, - -94, -94, -94, 58, -94, -94, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 116, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -94 - - }, - - { - 11, -95, -95, -95, -95, -95, -95, -95, -95, -95, - -95, -95, -95, 58, -95, -95, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 117, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -95 - }, - - { - 11, -96, -96, -96, -96, -96, -96, -96, -96, -96, - -96, -96, -96, 58, -96, -96, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 118, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -96 - }, - - { - 11, -97, -97, -97, -97, -97, -97, -97, -97, -97, - -97, -97, -97, 58, -97, -97, 58, 58, 58, 58, - - 58, 58, 119, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -97 - }, - - { - 11, -98, -98, -98, -98, -98, -98, -98, -98, -98, - -98, -98, -98, 58, -98, -98, 120, 121, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -98 - }, - - { - 11, -99, -99, -99, -99, -99, -99, -99, -99, -99, - -99, -99, -99, 58, -99, -99, 58, 58, 58, 58, - 58, 122, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -99 - - }, - - { - 11, -100, -100, -100, -100, -100, -100, -100, -100, -100, - -100, -100, -100, 58, -100, -100, 58, 58, 123, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -100 - }, - - { - 11, -101, -101, -101, -101, -101, -101, -101, -101, -101, - -101, -101, -101, 58, -101, -101, 58, 58, 58, 124, - 58, 58, 58, 58, 58, 125, 58, 126, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -101 - }, - - { - 11, -102, -102, -102, -102, -102, -102, -102, -102, -102, - -102, -102, -102, 58, -102, -102, 58, 58, 58, 58, - - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 127, 58, 58, 58, 58, 58, 58, -102 - }, - - { - 11, -103, -103, -103, -103, -103, -103, -103, -103, -103, - -103, -103, -103, 58, -103, -103, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -103 - }, - - { - 11, -104, -104, -104, -104, -104, -104, -104, -104, -104, - -104, -104, -104, 58, -104, -104, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -104 - - }, - - { - 11, -105, -105, -105, -105, -105, -105, -105, -105, -105, - -105, -105, -105, 58, -105, -105, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 128, 58, - 58, 58, 58, 58, 58, 58, 58, -105 - }, - - { - 11, -106, -106, -106, -106, -106, -106, -106, -106, -106, - -106, -106, -106, 58, -106, -106, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 129, 58, -106 - }, - - { - 11, -107, -107, -107, -107, -107, -107, -107, -107, -107, - -107, -107, -107, 58, -107, -107, 58, 58, 58, 58, - - 58, 58, 58, 58, 58, 130, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -107 - }, - - { - 11, -108, -108, -108, -108, -108, -108, -108, -108, -108, - -108, -108, -108, 58, -108, -108, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 131, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -108 - }, - - { - 11, -109, -109, -109, -109, -109, -109, -109, -109, -109, - -109, -109, -109, 58, -109, -109, 58, 58, 58, 58, - 58, 58, 58, 132, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -109 - - }, - - { - 11, -110, -110, -110, -110, -110, -110, -110, -110, -110, - -110, -110, -110, 58, -110, -110, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 133, 58, -110 - }, - - { - 11, -111, -111, -111, -111, -111, -111, -111, -111, -111, - -111, -111, -111, 58, -111, -111, 58, 58, 58, 58, - 58, 134, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -111 - }, - - { - 11, -112, -112, -112, -112, -112, -112, -112, -112, -112, - -112, -112, -112, 58, -112, -112, 58, 58, 58, 58, - - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 135, 58, 58, 58, 58, -112 - }, - - { - 11, -113, -113, -113, -113, -113, -113, -113, -113, -113, - -113, -113, -113, 58, -113, -113, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 136, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -113 - }, - - { - 11, -114, -114, -114, -114, -114, -114, -114, -114, -114, - -114, -114, -114, 58, -114, -114, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 137, 58, 58, 58, -114 - - }, - - { - 11, -115, -115, -115, -115, -115, -115, -115, -115, -115, - -115, 89, 89, 89, -115, -115, 89, 89, 89, 89, - 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, - 89, 89, 89, 89, 89, 89, 89, -115 - }, - - { - 11, -116, -116, -116, -116, -116, -116, -116, -116, -116, - -116, -116, -116, 58, -116, -116, 58, 58, 58, 58, - 58, 138, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -116 - }, - - { - 11, -117, -117, -117, -117, -117, -117, -117, -117, -117, - -117, -117, -117, 58, -117, -117, 58, 58, 58, 139, - - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -117 - }, - - { - 11, -118, -118, -118, -118, -118, -118, -118, -118, -118, - -118, -118, -118, 58, -118, -118, 58, 58, 58, 58, - 58, 140, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -118 - }, - - { - 11, -119, -119, -119, -119, -119, -119, -119, -119, -119, - -119, -119, -119, 58, -119, -119, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 141, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -119 - - }, - - { - 11, -120, -120, -120, -120, -120, -120, -120, -120, -120, - -120, -120, -120, 58, -120, -120, 58, 58, 142, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 143, 58, 58, -120 - }, - - { - 11, -121, -121, -121, -121, -121, -121, -121, -121, -121, - -121, -121, -121, 58, -121, -121, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 144, 58, -121 - }, - - { - 11, -122, -122, -122, -122, -122, -122, -122, -122, -122, - -122, -122, -122, 58, -122, -122, 58, 58, 58, 58, - - 58, 58, 58, 58, 58, 58, 58, 58, 145, 58, - 58, 58, 58, 58, 58, 58, 58, -122 + 0, 0, 0, 0, 0, 0, 0 }, { - 11, -123, -123, -123, -123, -123, -123, -123, -123, -123, - -123, -123, -123, 58, -123, -123, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 146, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -123 - }, - - { - 11, -124, -124, -124, -124, -124, -124, -124, -124, -124, - -124, -124, -124, 58, -124, -124, 58, 58, 58, 58, - 58, 58, 58, 58, 147, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -124 - - }, - - { - 11, -125, -125, -125, -125, -125, -125, -125, -125, -125, - -125, -125, -125, 58, -125, -125, 58, 58, 58, 58, - 58, 58, 148, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -125 - }, - - { - 11, -126, -126, -126, -126, -126, -126, -126, -126, -126, - -126, -126, -126, 58, -126, -126, 58, 58, 58, 58, - 58, 149, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -126 - }, - - { - 11, -127, -127, -127, -127, -127, -127, -127, -127, -127, - -127, -127, -127, 58, -127, -127, 58, 58, 58, 58, - - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -127 - }, - - { - 11, -128, -128, -128, -128, -128, -128, -128, -128, -128, - -128, -128, -128, 58, -128, -128, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 150, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -128 - }, - - { - 11, -129, -129, -129, -129, -129, -129, -129, -129, -129, - -129, -129, -129, 58, -129, -129, 58, 58, 58, 151, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -129 - - }, - - { - 11, -130, -130, -130, -130, -130, -130, -130, -130, -130, - -130, -130, -130, 58, -130, -130, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 152, - 58, 58, 58, 58, 58, 58, 58, -130 - }, - - { - 11, -131, -131, -131, -131, -131, -131, -131, -131, -131, - -131, -131, -131, 58, -131, -131, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 153, 58, 58, 58, 58, 58, 58, -131 - }, - - { - 11, -132, -132, -132, -132, -132, -132, -132, -132, -132, - -132, -132, -132, 58, -132, -132, 58, 58, 58, 58, - - 58, 154, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -132 - }, - - { - 11, -133, -133, -133, -133, -133, -133, -133, -133, -133, - -133, -133, -133, 58, -133, -133, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 155, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -133 - }, - - { - 11, -134, -134, -134, -134, -134, -134, -134, -134, -134, - -134, -134, -134, 58, -134, -134, 58, 58, 58, 156, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -134 - - }, - - { - 11, -135, -135, -135, -135, -135, -135, -135, -135, -135, - -135, -135, -135, 58, -135, -135, 58, 58, 58, 157, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -135 - }, - - { - 11, -136, -136, -136, -136, -136, -136, -136, -136, -136, - -136, -136, -136, 58, -136, -136, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 158, 58, - 58, 58, 58, 58, 58, 58, 58, -136 - }, - - { - 11, -137, -137, -137, -137, -137, -137, -137, -137, -137, - -137, -137, -137, 58, -137, -137, 58, 58, 58, 58, - - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 159, 58, 58, -137 - }, - - { - 11, -138, -138, -138, -138, -138, -138, -138, -138, -138, - -138, -138, -138, 58, -138, -138, 58, 160, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -138 - }, - - { - 11, -139, -139, -139, -139, -139, -139, -139, -139, -139, - -139, -139, -139, 58, -139, -139, 58, 58, 58, 58, - 58, 161, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -139 - - }, - - { - 11, -140, -140, -140, -140, -140, -140, -140, -140, -140, - -140, -140, -140, 58, -140, -140, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 162, 58, - 58, 58, 58, 58, 58, 58, 58, -140 - }, - - { - 11, -141, -141, -141, -141, -141, -141, -141, -141, -141, - -141, -141, -141, 58, -141, -141, 58, 58, 58, 58, - 58, 58, 58, 163, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -141 - }, - - { - 11, -142, -142, -142, -142, -142, -142, -142, -142, -142, - -142, -142, -142, 58, -142, -142, 58, 58, 58, 58, - - 58, 58, 58, 58, 58, 58, 58, 58, 58, 164, - 58, 58, 58, 58, 58, 58, 58, -142 - }, - - { - 11, -143, -143, -143, -143, -143, -143, -143, -143, -143, - -143, -143, -143, 58, -143, -143, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 165, 58, 58, 58, 58, -143 - }, - - { - 11, -144, -144, -144, -144, -144, -144, -144, -144, -144, - -144, -144, -144, 58, -144, -144, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 166, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -144 - - }, - - { - 11, -145, -145, -145, -145, -145, -145, -145, -145, -145, - -145, -145, -145, 58, -145, -145, 58, 58, 58, 58, - 167, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -145 - }, - - { - 11, -146, -146, -146, -146, -146, -146, -146, -146, -146, - -146, -146, -146, 58, -146, -146, 58, 58, 58, 58, - 58, 168, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -146 - }, - - { - 11, -147, -147, -147, -147, -147, -147, -147, -147, -147, - -147, -147, -147, 58, -147, -147, 58, 58, 58, 58, - - 58, 58, 58, 58, 58, 58, 58, 58, 58, 169, - 58, 58, 58, 58, 58, 58, 58, -147 - }, - - { - 11, -148, -148, -148, -148, -148, -148, -148, -148, -148, - -148, -148, -148, 58, -148, -148, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -148 - }, - - { - 11, -149, -149, -149, -149, -149, -149, -149, -149, -149, - -149, -149, -149, 58, -149, -149, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 170, 58, - 58, 58, 58, 58, 58, 58, 58, -149 - - }, - - { - 11, -150, -150, -150, -150, -150, -150, -150, -150, -150, - -150, -150, -150, 58, -150, -150, 58, 58, 58, 58, - 58, 171, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -150 - }, - - { - 11, -151, -151, -151, -151, -151, -151, -151, -151, -151, - -151, -151, -151, 58, -151, -151, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 172, - 58, 58, 58, 58, 58, 58, 58, -151 + 11, 12, 13, 14, 12, 12, 15, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12 }, { - 11, -152, -152, -152, -152, -152, -152, -152, -152, -152, - -152, -152, -152, 58, -152, -152, 58, 58, 58, 58, - - 58, 58, 58, 58, 58, 58, 58, 58, 173, 58, - 58, 58, 58, 58, 58, 58, 58, -152 + 11, 12, 13, 14, 12, 12, 15, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12 }, { - 11, -153, -153, -153, -153, -153, -153, -153, -153, -153, - -153, -153, -153, 58, -153, -153, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 174, 58, 58, -153 + 11, 16, 16, 17, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 18, 16, 16, 16 }, { - 11, -154, -154, -154, -154, -154, -154, -154, -154, -154, - -154, -154, -154, 58, -154, -154, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -154 + 11, 16, 16, 17, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 18, 16, 16, 16 }, { - 11, -155, -155, -155, -155, -155, -155, -155, -155, -155, - -155, -155, -155, 58, -155, -155, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 175, 58, 58, 58, 58, -155 + 11, 19, 20, 21, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19 }, { - 11, -156, -156, -156, -156, -156, -156, -156, -156, -156, - -156, -156, -156, 58, -156, -156, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 176, 58, 58, -156 + 11, 19, 20, 21, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19 }, { - 11, -157, -157, -157, -157, -157, -157, -157, -157, -157, - -157, -157, -157, 58, -157, -157, 58, 58, 58, 58, - - 58, 177, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -157 + 11, 22, 22, 23, 22, 24, 22, 22, 24, 22, + 22, 22, 22, 22, 22, 25, 22 }, { - 11, -158, -158, -158, -158, -158, -158, -158, -158, -158, - -158, -158, -158, 58, -158, -158, 58, 58, 58, 58, - 58, 58, 58, 178, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -158 + 11, 22, 22, 23, 22, 24, 22, 22, 24, 22, + 22, 22, 22, 22, 22, 25, 22 }, { - 11, -159, -159, -159, -159, -159, -159, -159, -159, -159, - -159, -159, -159, 58, -159, -159, 58, 179, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -159 + 11, 26, 26, 27, 28, 29, 30, 31, 29, 32, + 33, 34, 35, 35, 36, 37, 38 }, { - 11, -160, -160, -160, -160, -160, -160, -160, -160, -160, - -160, -160, -160, 58, -160, -160, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 180, 58, - 58, 58, 58, 58, 58, 58, 58, -160 + 11, 26, 26, 27, 28, 29, 30, 31, 29, 32, + 33, 34, 35, 35, 36, 37, 38 }, { - 11, -161, -161, -161, -161, -161, -161, -161, -161, -161, - -161, -161, -161, 58, -161, -161, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -161 + -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, + -11, -11, -11, -11, -11, -11, -11 }, { - 11, -162, -162, -162, -162, -162, -162, -162, -162, -162, - -162, -162, -162, 58, -162, -162, 58, 58, 58, 58, - - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 181, 58, 58, -162 + 11, -12, -12, -12, -12, -12, -12, -12, -12, -12, + -12, -12, -12, -12, -12, -12, -12 }, { - 11, -163, -163, -163, -163, -163, -163, -163, -163, -163, - -163, -163, -163, 58, -163, -163, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -163 + 11, -13, 39, 40, -13, -13, 41, -13, -13, -13, + -13, -13, -13, -13, -13, -13, -13 }, { - 11, -164, -164, -164, -164, -164, -164, -164, -164, -164, - -164, -164, -164, 58, -164, -164, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 182, - 58, 58, 58, 58, 58, 58, 58, -164 + 11, -14, -14, -14, -14, -14, -14, -14, -14, -14, + -14, -14, -14, -14, -14, -14, -14 }, { - 11, -165, -165, -165, -165, -165, -165, -165, -165, -165, - -165, -165, -165, 58, -165, -165, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 183, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -165 + 11, 42, 42, 43, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42 }, { - 11, -166, -166, -166, -166, -166, -166, -166, -166, -166, - -166, -166, -166, 58, -166, -166, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 184, 58, 58, -166 + 11, -16, -16, -16, -16, -16, -16, -16, -16, -16, + -16, -16, -16, -16, -16, -16, -16 }, { - 11, -167, -167, -167, -167, -167, -167, -167, -167, -167, - -167, -167, -167, 58, -167, -167, 58, 58, 58, 58, - - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 185, 58, 58, 58, -167 + 11, -17, -17, -17, -17, -17, -17, -17, -17, -17, + -17, -17, -17, -17, -17, -17, -17 }, { - 11, -168, -168, -168, -168, -168, -168, -168, -168, -168, - -168, -168, -168, 58, -168, -168, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -168 + 11, -18, -18, -18, -18, -18, -18, -18, -18, -18, + -18, -18, -18, 44, -18, -18, -18 }, { - 11, -169, -169, -169, -169, -169, -169, -169, -169, -169, - -169, -169, -169, 58, -169, -169, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 186, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -169 + 11, 45, 45, -19, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45 }, { - 11, -170, -170, -170, -170, -170, -170, -170, -170, -170, - -170, -170, -170, 58, -170, -170, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 187, 58, -170 + 11, -20, 46, 47, -20, -20, -20, -20, -20, -20, + -20, -20, -20, -20, -20, -20, -20 }, { - 11, -171, -171, -171, -171, -171, -171, -171, -171, -171, - -171, -171, -171, 58, -171, -171, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 188, 58, - 58, 58, 58, 58, 58, 58, 58, -171 + 11, 48, -21, -21, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48 }, { - 11, -172, -172, -172, -172, -172, -172, -172, -172, -172, - -172, -172, -172, 58, -172, -172, 58, 58, 58, 58, - - 58, 58, 58, 58, 58, 58, 58, 58, 189, 58, - 58, 58, 58, 58, 58, 58, 58, -172 + 11, 49, 49, 50, 49, -22, 49, 49, -22, 49, + 49, 49, 49, 49, 49, -22, 49 }, { - 11, -173, -173, -173, -173, -173, -173, -173, -173, -173, - -173, -173, -173, 58, -173, -173, 58, 190, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -173 + 11, -23, -23, -23, -23, -23, -23, -23, -23, -23, + -23, -23, -23, -23, -23, -23, -23 }, { - 11, -174, -174, -174, -174, -174, -174, -174, -174, -174, - -174, -174, -174, 58, -174, -174, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -174 + 11, -24, -24, -24, -24, -24, -24, -24, -24, -24, + -24, -24, -24, -24, -24, -24, -24 }, { - 11, -175, -175, -175, -175, -175, -175, -175, -175, -175, - -175, -175, -175, 58, -175, -175, 58, 58, 58, 58, - 58, 191, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -175 + 11, 51, 51, 52, 51, 51, 51, 51, 51, 51, + 51, 51, 51, 51, 51, 51, 51 }, { - 11, -176, -176, -176, -176, -176, -176, -176, -176, -176, - -176, -176, -176, 58, -176, -176, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -176 + 11, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26 }, { - 11, -177, -177, -177, -177, -177, -177, -177, -177, -177, - -177, -177, -177, 58, -177, -177, 58, 58, 58, 58, - - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -177 + 11, -27, -27, -27, -27, -27, -27, -27, -27, -27, + -27, -27, -27, -27, -27, -27, -27 }, { - 11, -178, -178, -178, -178, -178, -178, -178, -178, -178, - -178, -178, -178, 58, -178, -178, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -178 + 11, -28, -28, -28, -28, -28, -28, -28, -28, -28, + -28, -28, -28, -28, 53, -28, -28 }, { - 11, -179, -179, -179, -179, -179, -179, -179, -179, -179, - -179, -179, -179, 58, -179, -179, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 192, 58, 58, -179 + 11, -29, -29, -29, -29, -29, -29, -29, -29, -29, + -29, -29, -29, -29, -29, -29, -29 }, { - 11, -180, -180, -180, -180, -180, -180, -180, -180, -180, - -180, -180, -180, 58, -180, -180, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -180 + 11, 54, 54, -30, 54, 54, 54, 54, 54, 54, + 54, 54, 54, 54, 54, 54, 54 }, { - 11, -181, -181, -181, -181, -181, -181, -181, -181, -181, - -181, -181, -181, 58, -181, -181, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -181 + 11, -31, -31, -31, -31, -31, -31, 55, -31, -31, + -31, -31, -31, -31, -31, -31, -31 }, { - 11, -182, -182, -182, -182, -182, -182, -182, -182, -182, - -182, -182, -182, 58, -182, -182, 58, 58, 58, 58, - - 58, 58, 58, 58, 58, 58, 193, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -182 + 11, -32, -32, -32, -32, -32, -32, -32, -32, -32, + -32, -32, -32, -32, -32, -32, -32 }, { - 11, -183, -183, -183, -183, -183, -183, -183, -183, -183, - -183, -183, -183, 58, -183, -183, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 194, 58, 58, 58, -183 + 11, -33, -33, -33, -33, -33, -33, -33, -33, -33, + -33, -33, -33, -33, -33, -33, -33 }, { - 11, -184, -184, -184, -184, -184, -184, -184, -184, -184, - -184, -184, -184, 58, -184, -184, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -184 + 11, -34, -34, -34, -34, -34, -34, -34, -34, -34, + -34, 56, 57, 57, -34, -34, -34 }, { - 11, -185, -185, -185, -185, -185, -185, -185, -185, -185, - -185, -185, -185, 58, -185, -185, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -185 + 11, -35, -35, -35, -35, -35, -35, -35, -35, -35, + -35, 57, 57, 57, -35, -35, -35 }, { - 11, -186, -186, -186, -186, -186, -186, -186, -186, -186, - -186, -186, -186, 58, -186, -186, 58, 58, 58, 195, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -186 + 11, -36, -36, -36, -36, -36, -36, -36, -36, -36, + -36, -36, -36, -36, -36, -36, -36 }, { - 11, -187, -187, -187, -187, -187, -187, -187, -187, -187, - -187, -187, -187, 58, -187, -187, 58, 58, 58, 58, - - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -187 + 11, -37, -37, 58, -37, -37, -37, -37, -37, -37, + -37, -37, -37, -37, -37, -37, -37 }, { - 11, -188, -188, -188, -188, -188, -188, -188, -188, -188, - -188, -188, -188, 58, -188, -188, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 196, 58, -188 + 11, -38, -38, -38, -38, -38, -38, -38, -38, -38, + -38, -38, -38, -38, -38, -38, 59 }, { - 11, -189, -189, -189, -189, -189, -189, -189, -189, -189, - -189, -189, -189, 58, -189, -189, 58, 58, 58, 58, - 58, 58, 197, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -189 + 11, -39, 39, 40, -39, -39, 41, -39, -39, -39, + -39, -39, -39, -39, -39, -39, -39 }, { - 11, -190, -190, -190, -190, -190, -190, -190, -190, -190, - -190, -190, -190, 58, -190, -190, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 198, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -190 + 11, -40, -40, -40, -40, -40, -40, -40, -40, -40, + -40, -40, -40, -40, -40, -40, -40 }, { - 11, -191, -191, -191, -191, -191, -191, -191, -191, -191, - -191, -191, -191, 58, -191, -191, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 199, 58, 58, 58, -191 + 11, 42, 42, 43, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42 }, { - 11, -192, -192, -192, -192, -192, -192, -192, -192, -192, - -192, -192, -192, 58, -192, -192, 58, 58, 58, 58, - - 58, 200, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -192 + 11, 42, 42, 43, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42 }, { - 11, -193, -193, -193, -193, -193, -193, -193, -193, -193, - -193, -193, -193, 58, -193, -193, 58, 58, 58, 58, - 58, 201, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -193 + 11, -43, -43, -43, -43, -43, -43, -43, -43, -43, + -43, -43, -43, -43, -43, -43, -43 }, { - 11, -194, -194, -194, -194, -194, -194, -194, -194, -194, - -194, -194, -194, 58, -194, -194, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 202, 58, 58, -194 + 11, -44, -44, -44, -44, -44, -44, -44, -44, -44, + -44, -44, -44, 44, -44, -44, -44 }, { - 11, -195, -195, -195, -195, -195, -195, -195, -195, -195, - -195, -195, -195, 58, -195, -195, 58, 58, 58, 58, - 58, 203, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -195 + 11, 45, 45, -45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45 }, { - 11, -196, -196, -196, -196, -196, -196, -196, -196, -196, - -196, -196, -196, 58, -196, -196, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -196 + 11, -46, 46, 47, -46, -46, -46, -46, -46, -46, + -46, -46, -46, -46, -46, -46, -46 }, { - 11, -197, -197, -197, -197, -197, -197, -197, -197, -197, - -197, -197, -197, 58, -197, -197, 58, 58, 58, 58, - - 58, 58, 58, 58, 58, 204, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -197 + 11, 48, -47, -47, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48 }, { - 11, -198, -198, -198, -198, -198, -198, -198, -198, -198, - -198, -198, -198, 58, -198, -198, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -198 + 11, -48, -48, -48, -48, -48, -48, -48, -48, -48, + -48, -48, -48, -48, -48, -48, -48 }, { - 11, -199, -199, -199, -199, -199, -199, -199, -199, -199, - -199, -199, -199, 58, -199, -199, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -199 + 11, 49, 49, 50, 49, -49, 49, 49, -49, 49, + 49, 49, 49, 49, 49, -49, 49 }, { - 11, -200, -200, -200, -200, -200, -200, -200, -200, -200, - -200, -200, -200, 58, -200, -200, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -200 + 11, -50, -50, -50, -50, -50, -50, -50, -50, -50, + -50, -50, -50, -50, -50, -50, -50 }, { - 11, -201, -201, -201, -201, -201, -201, -201, -201, -201, - -201, -201, -201, 58, -201, -201, 58, 205, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -201 + 11, -51, -51, 52, -51, -51, -51, -51, -51, -51, + -51, -51, -51, -51, -51, -51, -51 }, { - 11, -202, -202, -202, -202, -202, -202, -202, -202, -202, - -202, -202, -202, 58, -202, -202, 58, 206, 58, 58, - - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -202 + 11, -52, -52, -52, -52, -52, -52, -52, -52, -52, + -52, -52, -52, -52, -52, -52, -52 }, { - 11, -203, -203, -203, -203, -203, -203, -203, -203, -203, - -203, -203, -203, 58, -203, -203, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -203 + 11, -53, -53, -53, -53, -53, -53, -53, -53, -53, + -53, -53, -53, -53, -53, -53, -53 }, { - 11, -204, -204, -204, -204, -204, -204, -204, -204, -204, - -204, -204, -204, 58, -204, -204, 58, 58, 58, 58, - 58, 58, 58, 207, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -204 + 11, 54, 54, -54, 54, 54, 54, 54, 54, 54, + 54, 54, 54, 54, 54, 54, 54 }, { - 11, -205, -205, -205, -205, -205, -205, -205, -205, -205, - -205, -205, -205, 58, -205, -205, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 208, 58, - 58, 58, 58, 58, 58, 58, 58, -205 + 11, -55, -55, -55, -55, -55, -55, -55, -55, -55, + -55, -55, -55, -55, -55, -55, -55 }, { - 11, -206, -206, -206, -206, -206, -206, -206, -206, -206, - -206, -206, -206, 58, -206, -206, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 209, 58, 58, -206 + 11, -56, -56, -56, -56, -56, -56, -56, -56, -56, + -56, 60, 57, 57, -56, -56, -56 }, { - 11, -207, -207, -207, -207, -207, -207, -207, -207, -207, - -207, -207, -207, 58, -207, -207, 58, 58, 58, 58, - - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -207 + 11, -57, -57, -57, -57, -57, -57, -57, -57, -57, + -57, 57, 57, 57, -57, -57, -57 }, { - 11, -208, -208, -208, -208, -208, -208, -208, -208, -208, - -208, -208, -208, 58, -208, -208, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -208 + 11, -58, -58, -58, -58, -58, -58, -58, -58, -58, + -58, -58, -58, -58, -58, -58, -58 }, { - 11, -209, -209, -209, -209, -209, -209, -209, -209, -209, - -209, -209, -209, 58, -209, -209, 58, 58, 58, 58, - 58, 210, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -209 + 11, -59, -59, -59, -59, -59, -59, -59, -59, -59, + -59, -59, -59, -59, -59, -59, -59 }, { - 11, -210, -210, -210, -210, -210, -210, -210, -210, -210, - -210, -210, -210, 58, -210, -210, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, -210 + 11, -60, -60, -60, -60, -60, -60, -60, -60, -60, + -60, 57, 57, 57, -60, -60, -60 }, } ; @@ -1918,8 +674,8 @@ static void yy_fatal_error (yyconst char msg[] ); *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; -#define YY_NUM_RULES 64 -#define YY_END_OF_BUFFER 65 +#define YY_NUM_RULES 33 +#define YY_END_OF_BUFFER 34 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -1927,31 +683,14 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[211] = +static yyconst flex_int16_t yy_accept[61] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 65, 5, 4, 3, 2, 36, 37, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 63, 60, 62, 55, 59, 58, 57, 53, 48, 42, - 47, 51, 53, 40, 41, 50, 50, 43, 53, 50, - 50, 53, 4, 3, 2, 2, 1, 35, 35, 35, - 35, 35, 35, 35, 16, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 63, 60, 62, 61, - 55, 54, 57, 56, 44, 51, 38, 50, 50, 52, - 45, 46, 39, 35, 35, 35, 35, 35, 35, 35, - - 35, 35, 30, 29, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 49, 25, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 15, 35, 7, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 17, 35, 35, - 35, 35, 35, 34, 35, 35, 35, 35, 35, 35, - 10, 35, 13, 35, 35, 35, 35, 33, 35, 35, - 35, 35, 35, 22, 35, 32, 9, 31, 35, 26, - 12, 35, 35, 21, 18, 35, 8, 35, 35, 35, - 35, 35, 27, 35, 35, 6, 35, 20, 19, 23, - - 35, 35, 11, 35, 35, 35, 14, 28, 35, 24 + 34, 5, 4, 3, 2, 7, 8, 6, 32, 29, + 31, 24, 28, 27, 26, 22, 17, 13, 16, 20, + 22, 11, 12, 19, 19, 14, 22, 22, 4, 3, + 2, 2, 1, 6, 32, 29, 31, 30, 24, 23, + 26, 25, 15, 20, 9, 19, 19, 21, 10, 18 } ; static yyconst flex_int32_t yy_ec[256] = @@ -1965,11 +704,11 @@ static yyconst flex_int32_t yy_ec[256] = 14, 1, 1, 1, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 1, 15, 1, 1, 16, 1, 17, 18, 19, 20, + 1, 15, 1, 1, 13, 1, 13, 13, 13, 13, - 21, 22, 23, 24, 25, 13, 13, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 35, 13, 13, 36, - 13, 13, 1, 37, 1, 1, 1, 1, 1, 1, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 1, 16, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -2014,8 +753,7 @@ char *zconftext; #define START_STRSIZE 16 -char *text; -static char *text_ptr; +static char *text; static int text_size, text_asize; struct buffer { @@ -2034,23 +772,22 @@ void new_string(void) { text = malloc(START_STRSIZE); text_asize = START_STRSIZE; - text_ptr = text; text_size = 0; - *text_ptr = 0; + *text = 0; } void append_string(const char *str, int size) { int new_size = text_size + size + 1; if (new_size > text_asize) { + new_size += START_STRSIZE - 1; + new_size &= -START_STRSIZE; text = realloc(text, new_size); text_asize = new_size; - text_ptr = text + text_size; } - memcpy(text_ptr, str, size); - text_ptr += size; + memcpy(text + text_size, str, size); text_size += size; - *text_ptr = 0; + text[text_size] = 0; } void alloc_string(const char *str, int size) @@ -2066,11 +803,13 @@ void alloc_string(const char *str, int size) #define STRING 3 #define PARAM 4 +#ifndef YY_NO_UNISTD_H /* Special case for "unistd.h", since it is non-ANSI. We include it way * down here because we want the user's section 1 to have been scanned first. * The user has a chance to override it with an option. */ #include +#endif #ifndef YY_EXTRA_TYPE #define YY_EXTRA_TYPE void * @@ -2282,175 +1021,56 @@ YY_RULE_SETUP case 6: YY_RULE_SETUP -BEGIN(PARAM); return T_MAINMENU; - YY_BREAK -case 7: -YY_RULE_SETUP -BEGIN(PARAM); return T_MENU; - YY_BREAK -case 8: -YY_RULE_SETUP -BEGIN(PARAM); return T_ENDMENU; - YY_BREAK -case 9: -YY_RULE_SETUP -BEGIN(PARAM); return T_SOURCE; - YY_BREAK -case 10: -YY_RULE_SETUP -BEGIN(PARAM); return T_CHOICE; - YY_BREAK -case 11: -YY_RULE_SETUP -BEGIN(PARAM); return T_ENDCHOICE; - YY_BREAK -case 12: -YY_RULE_SETUP -BEGIN(PARAM); return T_COMMENT; - YY_BREAK -case 13: -YY_RULE_SETUP -BEGIN(PARAM); return T_CONFIG; - YY_BREAK -case 14: -YY_RULE_SETUP -BEGIN(PARAM); return T_MENUCONFIG; - YY_BREAK -case 15: -YY_RULE_SETUP -BEGIN(PARAM); return T_HELP; - YY_BREAK -case 16: -YY_RULE_SETUP -BEGIN(PARAM); return T_IF; - YY_BREAK -case 17: -YY_RULE_SETUP -BEGIN(PARAM); return T_ENDIF; - YY_BREAK -case 18: -YY_RULE_SETUP -BEGIN(PARAM); return T_DEPENDS; - YY_BREAK -case 19: -YY_RULE_SETUP -BEGIN(PARAM); return T_REQUIRES; - YY_BREAK -case 20: -YY_RULE_SETUP -BEGIN(PARAM); return T_OPTIONAL; - YY_BREAK -case 21: -YY_RULE_SETUP -BEGIN(PARAM); return T_DEFAULT; - YY_BREAK -case 22: -YY_RULE_SETUP -BEGIN(PARAM); return T_PROMPT; - YY_BREAK -case 23: -YY_RULE_SETUP -BEGIN(PARAM); return T_TRISTATE; - YY_BREAK -case 24: -YY_RULE_SETUP -BEGIN(PARAM); return T_DEF_TRISTATE; - YY_BREAK -case 25: -YY_RULE_SETUP -BEGIN(PARAM); return T_BOOLEAN; - YY_BREAK -case 26: -YY_RULE_SETUP -BEGIN(PARAM); return T_BOOLEAN; - YY_BREAK -case 27: -YY_RULE_SETUP -BEGIN(PARAM); return T_DEF_BOOLEAN; - YY_BREAK -case 28: -YY_RULE_SETUP -BEGIN(PARAM); return T_DEF_BOOLEAN; - YY_BREAK -case 29: -YY_RULE_SETUP -BEGIN(PARAM); return T_INT; - YY_BREAK -case 30: -YY_RULE_SETUP -BEGIN(PARAM); return T_HEX; - YY_BREAK -case 31: -YY_RULE_SETUP -BEGIN(PARAM); return T_STRING; - YY_BREAK -case 32: -YY_RULE_SETUP -BEGIN(PARAM); return T_SELECT; - YY_BREAK -case 33: -YY_RULE_SETUP -BEGIN(PARAM); return T_SELECT; - YY_BREAK -case 34: -YY_RULE_SETUP -BEGIN(PARAM); return T_RANGE; - YY_BREAK -case 35: -YY_RULE_SETUP { + struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng); + if (id && id->flags & TF_COMMAND) { + BEGIN(PARAM); + return id->token; + } alloc_string(zconftext, zconfleng); zconflval.string = text; return T_WORD; } YY_BREAK -case 36: +case 7: YY_RULE_SETUP YY_BREAK -case 37: -/* rule 37 can match eol */ +case 8: +/* rule 8 can match eol */ YY_RULE_SETUP current_file->lineno++; BEGIN(INITIAL); YY_BREAK -case 38: +case 9: YY_RULE_SETUP return T_AND; YY_BREAK -case 39: +case 10: YY_RULE_SETUP return T_OR; YY_BREAK -case 40: +case 11: YY_RULE_SETUP return T_OPEN_PAREN; YY_BREAK -case 41: +case 12: YY_RULE_SETUP return T_CLOSE_PAREN; YY_BREAK -case 42: +case 13: YY_RULE_SETUP return T_NOT; YY_BREAK -case 43: +case 14: YY_RULE_SETUP return T_EQUAL; YY_BREAK -case 44: +case 15: YY_RULE_SETUP return T_UNEQUAL; YY_BREAK -case 45: -YY_RULE_SETUP -return T_IF; - YY_BREAK -case 46: -YY_RULE_SETUP -return T_ON; - YY_BREAK -case 47: +case 16: YY_RULE_SETUP { str = zconftext[0]; @@ -2458,33 +1078,36 @@ YY_RULE_SETUP BEGIN(STRING); } YY_BREAK -case 48: -/* rule 48 can match eol */ +case 17: +/* rule 17 can match eol */ YY_RULE_SETUP BEGIN(INITIAL); current_file->lineno++; return T_EOL; YY_BREAK -case 49: +case 18: YY_RULE_SETUP /* ignore */ YY_BREAK -case 50: +case 19: YY_RULE_SETUP { + struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng); + if (id && id->flags & TF_PARAM) + return id->token; alloc_string(zconftext, zconfleng); zconflval.string = text; return T_WORD; } YY_BREAK -case 51: +case 20: YY_RULE_SETUP /* comment */ YY_BREAK -case 52: -/* rule 52 can match eol */ +case 21: +/* rule 21 can match eol */ YY_RULE_SETUP current_file->lineno++; YY_BREAK -case 53: +case 22: YY_RULE_SETUP YY_BREAK @@ -2494,8 +1117,8 @@ case YY_STATE_EOF(PARAM): } YY_BREAK -case 54: -/* rule 54 can match eol */ +case 23: +/* rule 23 can match eol */ *yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */ (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up zconftext again */ @@ -2506,14 +1129,14 @@ YY_RULE_SETUP return T_WORD_QUOTE; } YY_BREAK -case 55: +case 24: YY_RULE_SETUP { append_string(zconftext, zconfleng); } YY_BREAK -case 56: -/* rule 56 can match eol */ +case 25: +/* rule 25 can match eol */ *yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */ (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up zconftext again */ @@ -2524,13 +1147,13 @@ YY_RULE_SETUP return T_WORD_QUOTE; } YY_BREAK -case 57: +case 26: YY_RULE_SETUP { append_string(zconftext + 1, zconfleng - 1); } YY_BREAK -case 58: +case 27: YY_RULE_SETUP { if (str == zconftext[0]) { @@ -2541,8 +1164,8 @@ YY_RULE_SETUP append_string(zconftext, 1); } YY_BREAK -case 59: -/* rule 59 can match eol */ +case 28: +/* rule 28 can match eol */ YY_RULE_SETUP { printf("%s:%d:warning: multi-line strings not supported\n", zconf_curname(), zconf_lineno()); @@ -2557,7 +1180,7 @@ case YY_STATE_EOF(STRING): } YY_BREAK -case 60: +case 29: YY_RULE_SETUP { ts = 0; @@ -2582,8 +1205,8 @@ YY_RULE_SETUP } } YY_BREAK -case 61: -/* rule 61 can match eol */ +case 30: +/* rule 30 can match eol */ *yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */ (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up zconftext again */ @@ -2594,15 +1217,15 @@ YY_RULE_SETUP return T_HELPTEXT; } YY_BREAK -case 62: -/* rule 62 can match eol */ +case 31: +/* rule 31 can match eol */ YY_RULE_SETUP { current_file->lineno++; append_string("\n", 1); } YY_BREAK -case 63: +case 32: YY_RULE_SETUP { append_string(zconftext, zconfleng); @@ -2628,7 +1251,7 @@ case YY_STATE_EOF(COMMAND): yyterminate(); } YY_BREAK -case 64: +case 33: YY_RULE_SETUP YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK @@ -3338,10 +1961,10 @@ YY_BUFFER_STATE zconf_scan_buffer (char * base, yy_size_t size ) * @note If you want to scan bytes that may contain NUL values, then use * zconf_scan_bytes() instead. */ -YY_BUFFER_STATE zconf_scan_string (yyconst char * str ) +YY_BUFFER_STATE zconf_scan_string (yyconst char * yy_str ) { - return zconf_scan_bytes(str,strlen(str) ); + return zconf_scan_bytes(yy_str,strlen(yy_str) ); } /** Setup the input buffer state to scan the given bytes. The next call to zconflex() will diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h index 5fba1feff2a8..6881fb084324 100644 --- a/scripts/kconfig/lkc.h +++ b/scripts/kconfig/lkc.h @@ -37,6 +37,16 @@ extern "C" { #define _(text) gettext(text) #define N_(text) (text) + +#define TF_COMMAND 0x0001 +#define TF_PARAM 0x0002 + +struct kconf_id { + int name; + int token; + unsigned int flags; +}; + int zconfparse(void); void zconfdump(FILE *out); diff --git a/scripts/kconfig/zconf.gperf b/scripts/kconfig/zconf.gperf new file mode 100644 index 000000000000..c9d81cf5d7fb --- /dev/null +++ b/scripts/kconfig/zconf.gperf @@ -0,0 +1,43 @@ +%language=ANSI-C +%define hash-function-name kconf_id_hash +%define lookup-function-name kconf_id_lookup +%define string-pool-name kconf_id_strings +%compare-strncmp +%enum +%pic +%struct-type + +struct kconf_id; + +%% +mainmenu, T_MAINMENU, TF_COMMAND +menu, T_MENU, TF_COMMAND +endmenu, T_ENDMENU, TF_COMMAND +source, T_SOURCE, TF_COMMAND +choice, T_CHOICE, TF_COMMAND +endchoice, T_ENDCHOICE, TF_COMMAND +comment, T_COMMENT, TF_COMMAND +config, T_CONFIG, TF_COMMAND +menuconfig, T_MENUCONFIG, TF_COMMAND +help, T_HELP, TF_COMMAND +if, T_IF, TF_COMMAND|TF_PARAM +endif, T_ENDIF, TF_COMMAND +depends, T_DEPENDS, TF_COMMAND +requires, T_REQUIRES, TF_COMMAND +optional, T_OPTIONAL, TF_COMMAND +default, T_DEFAULT, TF_COMMAND +prompt, T_PROMPT, TF_COMMAND +tristate, T_TRISTATE, TF_COMMAND +def_tristate, T_DEF_TRISTATE, TF_COMMAND +bool, T_BOOLEAN, TF_COMMAND +boolean, T_BOOLEAN, TF_COMMAND +def_bool, T_DEF_BOOLEAN, TF_COMMAND +def_boolean, T_DEF_BOOLEAN, TF_COMMAND +int, T_INT, TF_COMMAND +hex, T_HEX, TF_COMMAND +string, T_STRING, TF_COMMAND +select, T_SELECT, TF_COMMAND +enable, T_SELECT, TF_COMMAND +range, T_RANGE, TF_COMMAND +on, T_ON, TF_PARAM +%% diff --git a/scripts/kconfig/zconf.hash.c_shipped b/scripts/kconfig/zconf.hash.c_shipped new file mode 100644 index 000000000000..6741cb159801 --- /dev/null +++ b/scripts/kconfig/zconf.hash.c_shipped @@ -0,0 +1,231 @@ +/* ANSI-C code produced by gperf version 3.0.1 */ +/* Command-line: gperf */ +/* Computed positions: -k'1,3' */ + +#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ + && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ + && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ + && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ + && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ + && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ + && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ + && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ + && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ + && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ + && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ + && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ + && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ + && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ + && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ + && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ + && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ + && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ + && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ + && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ + && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ + && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ + && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) +/* The character set is not based on ISO-646. */ +#error "gperf generated tables don't work with this execution character set. Please report a bug to ." +#endif + +struct kconf_id; +/* maximum key range = 45, duplicates = 0 */ + +#ifdef __GNUC__ +__inline +#else +#ifdef __cplusplus +inline +#endif +#endif +static unsigned int +kconf_id_hash (register const char *str, register unsigned int len) +{ + static unsigned char asso_values[] = + { + 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, + 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, + 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, + 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, + 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, + 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, + 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, + 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, + 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, + 47, 47, 47, 47, 47, 47, 47, 25, 10, 15, + 0, 0, 5, 47, 0, 0, 47, 47, 0, 10, + 0, 20, 20, 20, 5, 0, 0, 20, 47, 47, + 20, 47, 47, 47, 47, 47, 47, 47, 47, 47, + 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, + 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, + 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, + 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, + 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, + 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, + 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, + 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, + 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, + 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, + 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, + 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, + 47, 47, 47, 47, 47, 47 + }; + register int hval = len; + + switch (hval) + { + default: + hval += asso_values[(unsigned char)str[2]]; + /*FALLTHROUGH*/ + case 2: + case 1: + hval += asso_values[(unsigned char)str[0]]; + break; + } + return hval; +} + +struct kconf_id_strings_t + { + char kconf_id_strings_str2[sizeof("if")]; + char kconf_id_strings_str3[sizeof("int")]; + char kconf_id_strings_str4[sizeof("help")]; + char kconf_id_strings_str5[sizeof("endif")]; + char kconf_id_strings_str6[sizeof("select")]; + char kconf_id_strings_str7[sizeof("endmenu")]; + char kconf_id_strings_str8[sizeof("tristate")]; + char kconf_id_strings_str9[sizeof("endchoice")]; + char kconf_id_strings_str10[sizeof("range")]; + char kconf_id_strings_str11[sizeof("string")]; + char kconf_id_strings_str12[sizeof("default")]; + char kconf_id_strings_str13[sizeof("def_bool")]; + char kconf_id_strings_str14[sizeof("menu")]; + char kconf_id_strings_str16[sizeof("def_boolean")]; + char kconf_id_strings_str17[sizeof("def_tristate")]; + char kconf_id_strings_str18[sizeof("mainmenu")]; + char kconf_id_strings_str20[sizeof("menuconfig")]; + char kconf_id_strings_str21[sizeof("config")]; + char kconf_id_strings_str22[sizeof("on")]; + char kconf_id_strings_str23[sizeof("hex")]; + char kconf_id_strings_str26[sizeof("source")]; + char kconf_id_strings_str27[sizeof("depends")]; + char kconf_id_strings_str28[sizeof("optional")]; + char kconf_id_strings_str31[sizeof("enable")]; + char kconf_id_strings_str32[sizeof("comment")]; + char kconf_id_strings_str33[sizeof("requires")]; + char kconf_id_strings_str34[sizeof("bool")]; + char kconf_id_strings_str37[sizeof("boolean")]; + char kconf_id_strings_str41[sizeof("choice")]; + char kconf_id_strings_str46[sizeof("prompt")]; + }; +static struct kconf_id_strings_t kconf_id_strings_contents = + { + "if", + "int", + "help", + "endif", + "select", + "endmenu", + "tristate", + "endchoice", + "range", + "string", + "default", + "def_bool", + "menu", + "def_boolean", + "def_tristate", + "mainmenu", + "menuconfig", + "config", + "on", + "hex", + "source", + "depends", + "optional", + "enable", + "comment", + "requires", + "bool", + "boolean", + "choice", + "prompt" + }; +#define kconf_id_strings ((const char *) &kconf_id_strings_contents) +#ifdef __GNUC__ +__inline +#endif +struct kconf_id * +kconf_id_lookup (register const char *str, register unsigned int len) +{ + enum + { + TOTAL_KEYWORDS = 30, + MIN_WORD_LENGTH = 2, + MAX_WORD_LENGTH = 12, + MIN_HASH_VALUE = 2, + MAX_HASH_VALUE = 46 + }; + + static struct kconf_id wordlist[] = + { + {-1}, {-1}, + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str2, T_IF, TF_COMMAND|TF_PARAM}, + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str3, T_INT, TF_COMMAND}, + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str4, T_HELP, TF_COMMAND}, + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str5, T_ENDIF, TF_COMMAND}, + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str6, T_SELECT, TF_COMMAND}, + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str7, T_ENDMENU, TF_COMMAND}, + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str8, T_TRISTATE, TF_COMMAND}, + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str9, T_ENDCHOICE, TF_COMMAND}, + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str10, T_RANGE, TF_COMMAND}, + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str11, T_STRING, TF_COMMAND}, + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str12, T_DEFAULT, TF_COMMAND}, + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str13, T_DEF_BOOLEAN, TF_COMMAND}, + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str14, T_MENU, TF_COMMAND}, + {-1}, + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str16, T_DEF_BOOLEAN, TF_COMMAND}, + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str17, T_DEF_TRISTATE, TF_COMMAND}, + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str18, T_MAINMENU, TF_COMMAND}, + {-1}, + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str20, T_MENUCONFIG, TF_COMMAND}, + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str21, T_CONFIG, TF_COMMAND}, + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str22, T_ON, TF_PARAM}, + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str23, T_HEX, TF_COMMAND}, + {-1}, {-1}, + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str26, T_SOURCE, TF_COMMAND}, + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str27, T_DEPENDS, TF_COMMAND}, + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str28, T_OPTIONAL, TF_COMMAND}, + {-1}, {-1}, + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str31, T_SELECT, TF_COMMAND}, + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str32, T_COMMENT, TF_COMMAND}, + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str33, T_REQUIRES, TF_COMMAND}, + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str34, T_BOOLEAN, TF_COMMAND}, + {-1}, {-1}, + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str37, T_BOOLEAN, TF_COMMAND}, + {-1}, {-1}, {-1}, + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str41, T_CHOICE, TF_COMMAND}, + {-1}, {-1}, {-1}, {-1}, + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str46, T_PROMPT, TF_COMMAND} + }; + + if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) + { + register int key = kconf_id_hash (str, len); + + if (key <= MAX_HASH_VALUE && key >= 0) + { + register int o = wordlist[key].name; + if (o >= 0) + { + register const char *s = o + kconf_id_strings; + + if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0') + return &wordlist[key]; + } + } + } + return 0; +} + diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l index 55517b2877cd..ec902091be97 100644 --- a/scripts/kconfig/zconf.l +++ b/scripts/kconfig/zconf.l @@ -18,8 +18,7 @@ #define START_STRSIZE 16 -char *text; -static char *text_ptr; +static char *text; static int text_size, text_asize; struct buffer { @@ -38,23 +37,22 @@ void new_string(void) { text = malloc(START_STRSIZE); text_asize = START_STRSIZE; - text_ptr = text; text_size = 0; - *text_ptr = 0; + *text = 0; } void append_string(const char *str, int size) { int new_size = text_size + size + 1; if (new_size > text_asize) { + new_size += START_STRSIZE - 1; + new_size &= -START_STRSIZE; text = realloc(text, new_size); text_asize = new_size; - text_ptr = text + text_size; } - memcpy(text_ptr, str, size); - text_ptr += size; + memcpy(text + text_size, str, size); text_size += size; - *text_ptr = 0; + text[text_size] = 0; } void alloc_string(const char *str, int size) @@ -88,36 +86,12 @@ n [A-Za-z0-9_] { - "mainmenu" BEGIN(PARAM); return T_MAINMENU; - "menu" BEGIN(PARAM); return T_MENU; - "endmenu" BEGIN(PARAM); return T_ENDMENU; - "source" BEGIN(PARAM); return T_SOURCE; - "choice" BEGIN(PARAM); return T_CHOICE; - "endchoice" BEGIN(PARAM); return T_ENDCHOICE; - "comment" BEGIN(PARAM); return T_COMMENT; - "config" BEGIN(PARAM); return T_CONFIG; - "menuconfig" BEGIN(PARAM); return T_MENUCONFIG; - "help" BEGIN(PARAM); return T_HELP; - "if" BEGIN(PARAM); return T_IF; - "endif" BEGIN(PARAM); return T_ENDIF; - "depends" BEGIN(PARAM); return T_DEPENDS; - "requires" BEGIN(PARAM); return T_REQUIRES; - "optional" BEGIN(PARAM); return T_OPTIONAL; - "default" BEGIN(PARAM); return T_DEFAULT; - "prompt" BEGIN(PARAM); return T_PROMPT; - "tristate" BEGIN(PARAM); return T_TRISTATE; - "def_tristate" BEGIN(PARAM); return T_DEF_TRISTATE; - "bool" BEGIN(PARAM); return T_BOOLEAN; - "boolean" BEGIN(PARAM); return T_BOOLEAN; - "def_bool" BEGIN(PARAM); return T_DEF_BOOLEAN; - "def_boolean" BEGIN(PARAM); return T_DEF_BOOLEAN; - "int" BEGIN(PARAM); return T_INT; - "hex" BEGIN(PARAM); return T_HEX; - "string" BEGIN(PARAM); return T_STRING; - "select" BEGIN(PARAM); return T_SELECT; - "enable" BEGIN(PARAM); return T_SELECT; - "range" BEGIN(PARAM); return T_RANGE; {n}+ { + struct kconf_id *id = kconf_id_lookup(yytext, yyleng); + if (id && id->flags & TF_COMMAND) { + BEGIN(PARAM); + return id->token; + } alloc_string(yytext, yyleng); zconflval.string = text; return T_WORD; @@ -134,8 +108,6 @@ n [A-Za-z0-9_] "!" return T_NOT; "=" return T_EQUAL; "!=" return T_UNEQUAL; - "if" return T_IF; - "on" return T_ON; \"|\' { str = yytext[0]; new_string(); @@ -144,6 +116,9 @@ n [A-Za-z0-9_] \n BEGIN(INITIAL); current_file->lineno++; return T_EOL; --- /* ignore */ ({n}|[-/.])+ { + struct kconf_id *id = kconf_id_lookup(yytext, yyleng); + if (id && id->flags & TF_PARAM) + return id->token; alloc_string(yytext, yyleng); zconflval.string = text; return T_WORD; diff --git a/scripts/kconfig/zconf.tab.c_shipped b/scripts/kconfig/zconf.tab.c_shipped index da12f7b33be3..07fa508d4659 100644 --- a/scripts/kconfig/zconf.tab.c_shipped +++ b/scripts/kconfig/zconf.tab.c_shipped @@ -1,7 +1,7 @@ -/* A Bison parser, made by GNU Bison 1.875a. */ +/* A Bison parser, made by GNU Bison 2.0. */ /* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. 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 @@ -45,8 +45,7 @@ /* Using locations. */ #define YYLSP_NEEDED 0 -/* If NAME_PREFIX is specified substitute the variables and functions - names. */ +/* Substitute the variable and function names. */ #define yyparse zconfparse #define yylex zconflex #define yyerror zconferror @@ -161,6 +160,11 @@ #include #include +#define LKC_DIRECT_LINK +#include "lkc.h" + +#include "zconf.hash.c" + #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt) #define PRINTD 0x0001 @@ -202,7 +206,7 @@ typedef union YYSTYPE { struct expr *expr; struct menu *menu; } YYSTYPE; -/* Line 191 of yacc.c. */ +/* Line 190 of yacc.c. */ # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 @@ -214,27 +218,26 @@ typedef union YYSTYPE { /* Copy the second part of user declarations. */ -#define LKC_DIRECT_LINK -#include "lkc.h" - - -/* Line 214 of yacc.c. */ +/* Line 213 of yacc.c. */ #if ! defined (yyoverflow) || YYERROR_VERBOSE +# ifndef YYFREE +# define YYFREE free +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# endif + /* The parser invokes alloca or malloc; define the necessary symbols. */ -# if YYSTACK_USE_ALLOCA -# define YYSTACK_ALLOC alloca -# else -# ifndef YYSTACK_USE_ALLOCA -# if defined (alloca) || defined (_ALLOCA_H) -# define YYSTACK_ALLOC alloca +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca # else -# ifdef __GNUC__ -# define YYSTACK_ALLOC __builtin_alloca -# endif +# define YYSTACK_ALLOC alloca # endif # endif # endif @@ -247,20 +250,20 @@ typedef union YYSTYPE { # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # endif -# define YYSTACK_ALLOC malloc -# define YYSTACK_FREE free +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE # endif #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ #if (! defined (yyoverflow) \ && (! defined (__cplusplus) \ - || (YYSTYPE_IS_TRIVIAL))) + || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { - short yyss; + short int yyss; YYSTYPE yyvs; }; @@ -270,13 +273,13 @@ union yyalloc /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ - ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ + ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY -# if 1 < __GNUC__ +# if defined (__GNUC__) && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else @@ -312,7 +315,7 @@ union yyalloc #if defined (__STDC__) || defined (__cplusplus) typedef signed char yysigned_char; #else - typedef short yysigned_char; + typedef short int yysigned_char; #endif /* YYFINAL -- State number of the termination state. */ @@ -374,7 +377,7 @@ static const unsigned char yytranslate[] = #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ -static const unsigned short yyprhs[] = +static const unsigned short int yyprhs[] = { 0, 0, 3, 4, 7, 9, 11, 13, 17, 19, 21, 23, 26, 28, 30, 32, 34, 36, 38, 42, @@ -427,19 +430,19 @@ static const yysigned_char yyrhs[] = }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const unsigned short yyrline[] = +static const unsigned short int yyrline[] = { - 0, 94, 94, 95, 98, 99, 100, 101, 102, 103, - 104, 105, 109, 110, 111, 112, 113, 114, 120, 128, - 134, 142, 152, 154, 155, 156, 157, 160, 166, 173, - 179, 186, 192, 198, 204, 210, 216, 222, 230, 239, - 245, 254, 255, 261, 263, 264, 265, 266, 269, 275, - 281, 287, 293, 299, 301, 306, 315, 324, 325, 331, - 333, 334, 335, 340, 347, 353, 362, 363, 369, 371, - 372, 373, 374, 377, 383, 390, 397, 404, 410, 417, - 418, 419, 422, 427, 432, 440, 442, 447, 448, 451, - 452, 453, 457, 457, 459, 460, 463, 464, 465, 466, - 467, 468, 469, 472, 473 + 0, 97, 97, 98, 101, 102, 103, 104, 105, 106, + 107, 108, 112, 113, 114, 115, 116, 117, 123, 131, + 137, 145, 155, 157, 158, 159, 160, 163, 169, 176, + 182, 189, 195, 201, 207, 213, 219, 225, 233, 242, + 248, 257, 258, 264, 266, 267, 268, 269, 272, 278, + 284, 290, 296, 302, 304, 309, 318, 327, 328, 334, + 336, 337, 338, 343, 350, 356, 365, 366, 372, 374, + 375, 376, 377, 380, 386, 393, 400, 407, 413, 420, + 421, 422, 425, 430, 435, 443, 445, 450, 451, 454, + 455, 456, 460, 460, 462, 463, 466, 467, 468, 469, + 470, 471, 472, 475, 476 }; #endif @@ -448,29 +451,29 @@ static const unsigned short yyrline[] = First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { - "$end", "error", "$undefined", "T_MAINMENU", "T_MENU", "T_ENDMENU", - "T_SOURCE", "T_CHOICE", "T_ENDCHOICE", "T_COMMENT", "T_CONFIG", - "T_MENUCONFIG", "T_HELP", "T_HELPTEXT", "T_IF", "T_ENDIF", "T_DEPENDS", - "T_REQUIRES", "T_OPTIONAL", "T_PROMPT", "T_DEFAULT", "T_TRISTATE", - "T_DEF_TRISTATE", "T_BOOLEAN", "T_DEF_BOOLEAN", "T_STRING", "T_INT", - "T_HEX", "T_WORD", "T_WORD_QUOTE", "T_UNEQUAL", "T_EOF", "T_EOL", - "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_ON", "T_SELECT", "T_RANGE", "T_OR", - "T_AND", "T_EQUAL", "T_NOT", "$accept", "input", "block", - "common_block", "config_entry_start", "config_stmt", - "menuconfig_entry_start", "menuconfig_stmt", "config_option_list", - "config_option", "choice", "choice_entry", "choice_end", "choice_stmt", - "choice_option_list", "choice_option", "choice_block", "if", "if_end", - "if_stmt", "if_block", "menu", "menu_entry", "menu_end", "menu_stmt", - "menu_block", "source", "source_stmt", "comment", "comment_stmt", - "help_start", "help", "depends_list", "depends", "prompt_stmt_opt", - "prompt", "end", "nl_or_eof", "if_expr", "expr", "symbol", 0 + "$end", "error", "$undefined", "T_MAINMENU", "T_MENU", "T_ENDMENU", + "T_SOURCE", "T_CHOICE", "T_ENDCHOICE", "T_COMMENT", "T_CONFIG", + "T_MENUCONFIG", "T_HELP", "T_HELPTEXT", "T_IF", "T_ENDIF", "T_DEPENDS", + "T_REQUIRES", "T_OPTIONAL", "T_PROMPT", "T_DEFAULT", "T_TRISTATE", + "T_DEF_TRISTATE", "T_BOOLEAN", "T_DEF_BOOLEAN", "T_STRING", "T_INT", + "T_HEX", "T_WORD", "T_WORD_QUOTE", "T_UNEQUAL", "T_EOF", "T_EOL", + "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_ON", "T_SELECT", "T_RANGE", "T_OR", + "T_AND", "T_EQUAL", "T_NOT", "$accept", "input", "block", "common_block", + "config_entry_start", "config_stmt", "menuconfig_entry_start", + "menuconfig_stmt", "config_option_list", "config_option", "choice", + "choice_entry", "choice_end", "choice_stmt", "choice_option_list", + "choice_option", "choice_block", "if", "if_end", "if_stmt", "if_block", + "menu", "menu_entry", "menu_end", "menu_stmt", "menu_block", "source", + "source_stmt", "comment", "comment_stmt", "help_start", "help", + "depends_list", "depends", "prompt_stmt_opt", "prompt", "end", + "nl_or_eof", "if_expr", "expr", "symbol", 0 }; #endif # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ -static const unsigned short yytoknum[] = +static const unsigned short int yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, @@ -539,7 +542,7 @@ static const unsigned char yydefact[] = }; /* YYDEFGOTO[NTERM-NUM]. */ -static const short yydefgoto[] = +static const short int yydefgoto[] = { -1, 1, 17, 18, 19, 20, 21, 22, 52, 88, 23, 24, 105, 25, 54, 98, 55, 26, 109, 27, @@ -551,7 +554,7 @@ static const short yydefgoto[] = /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -99 -static const short yypact[] = +static const short int yypact[] = { -99, 48, -99, 38, 46, 46, -99, 46, -29, -99, 46, -17, -3, -11, -99, -99, -99, -99, -99, -99, @@ -575,7 +578,7 @@ static const short yypact[] = }; /* YYPGOTO[NTERM-NUM]. */ -static const short yypgoto[] = +static const short int yypgoto[] = { -99, -99, -99, 111, -99, -99, -99, -99, 178, -99, -99, -99, -99, 91, -99, -99, -99, -99, -99, -99, @@ -589,7 +592,7 @@ static const short yypgoto[] = number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -68 -static const short yytable[] = +static const short int yytable[] = { 66, 67, 36, 42, 39, 40, 71, 41, 123, 124, 43, 44, 74, 75, 120, 154, 72, 46, 47, 69, @@ -687,7 +690,7 @@ static const unsigned char yystos[] = #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab -#define YYERROR goto yyerrlab1 +#define YYERROR goto yyerrorlab /* Like YYERROR except do call yyerror. This remains here temporarily @@ -715,20 +718,53 @@ do \ } \ while (0) + #define YYTERROR 1 #define YYERRCODE 256 -/* YYLLOC_DEFAULT -- Compute the default location (before the actions - are run). */ +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - Current.first_line = Rhs[1].first_line; \ - Current.first_column = Rhs[1].first_column; \ - Current.last_line = Rhs[N].last_line; \ - Current.last_column = Rhs[N].last_column; +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (N) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (0) #endif + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if YYLTYPE_IS_TRIVIAL +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif +#endif + + /* YYLEX -- calling `yylex' with the right arguments. */ #ifdef YYLEX_PARAM @@ -751,36 +787,30 @@ do { \ YYFPRINTF Args; \ } while (0) -# define YYDSYMPRINT(Args) \ -do { \ - if (yydebug) \ - yysymprint Args; \ -} while (0) - -# define YYDSYMPRINTF(Title, Token, Value, Location) \ +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yysymprint (stderr, \ - Token, Value); \ + Type, Value); \ YYFPRINTF (stderr, "\n"); \ } \ } while (0) /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | -| TOP (cinluded). | +| TOP (included). | `------------------------------------------------------------------*/ #if defined (__STDC__) || defined (__cplusplus) static void -yy_stack_print (short *bottom, short *top) +yy_stack_print (short int *bottom, short int *top) #else static void yy_stack_print (bottom, top) - short *bottom; - short *top; + short int *bottom; + short int *top; #endif { YYFPRINTF (stderr, "Stack now"); @@ -810,9 +840,9 @@ yy_reduce_print (yyrule) #endif { int yyi; - unsigned int yylineno = yyrline[yyrule]; + unsigned int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", - yyrule - 1, yylineno); + yyrule - 1, yylno); /* Print the symbols being reduced, and their result. */ for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]); @@ -830,8 +860,7 @@ do { \ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) -# define YYDSYMPRINT(Args) -# define YYDSYMPRINTF(Title, Token, Value, Location) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ @@ -849,10 +878,6 @@ int yydebug; SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ -#if YYMAXDEPTH == 0 -# undef YYMAXDEPTH -#endif - #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif @@ -934,15 +959,15 @@ yysymprint (yyoutput, yytype, yyvaluep) (void) yyvaluep; if (yytype < YYNTOKENS) - { - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); -# ifdef YYPRINT - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# endif - } + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); else YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# endif switch (yytype) { default: @@ -958,10 +983,11 @@ yysymprint (yyoutput, yytype, yyvaluep) #if defined (__STDC__) || defined (__cplusplus) static void -yydestruct (int yytype, YYSTYPE *yyvaluep) +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) #else static void -yydestruct (yytype, yyvaluep) +yydestruct (yymsg, yytype, yyvaluep) + const char *yymsg; int yytype; YYSTYPE *yyvaluep; #endif @@ -969,6 +995,10 @@ yydestruct (yytype, yyvaluep) /* Pacify ``unused variable'' warnings. */ (void) yyvaluep; + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + switch (yytype) { @@ -996,10 +1026,10 @@ int yyparse (); -/* The lookahead symbol. */ +/* The look-ahead symbol. */ int yychar; -/* The semantic value of the lookahead symbol. */ +/* The semantic value of the look-ahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ @@ -1035,7 +1065,7 @@ yyparse () int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; - /* Lookahead token as an internal (translated) token number. */ + /* Look-ahead token as an internal (translated) token number. */ int yytoken = 0; /* Three stacks and their tools: @@ -1047,9 +1077,9 @@ yyparse () to reallocate them elsewhere. */ /* The state stack. */ - short yyssa[YYINITDEPTH]; - short *yyss = yyssa; - register short *yyssp; + short int yyssa[YYINITDEPTH]; + short int *yyss = yyssa; + register short int *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; @@ -1086,6 +1116,9 @@ yyparse () yyssp = yyss; yyvsp = yyvs; + + yyvsp[0] = yylval; + goto yysetstate; /*------------------------------------------------------------. @@ -1111,7 +1144,7 @@ yyparse () these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; - short *yyss1 = yyss; + short int *yyss1 = yyss; /* Each stack pointer address is followed by the size of the @@ -1139,7 +1172,7 @@ yyparse () yystacksize = YYMAXDEPTH; { - short *yyss1 = yyss; + short int *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) @@ -1175,18 +1208,18 @@ yyparse () yybackup: /* Do appropriate processing given the current state. */ -/* Read a lookahead token if we need one and don't already have one. */ +/* Read a look-ahead token if we need one and don't already have one. */ /* yyresume: */ - /* First try to decide what to do without reference to lookahead token. */ + /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a lookahead token if don't already have one. */ + /* Not known => get a look-ahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -1201,7 +1234,7 @@ yybackup: else { yytoken = YYTRANSLATE (yychar); - YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to @@ -1221,8 +1254,8 @@ yybackup: if (yyn == YYFINAL) YYACCEPT; - /* Shift the lookahead token. */ - YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken])); + /* Shift the look-ahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); /* Discard the token being shifted unless it is eof. */ if (yychar != YYEOF) @@ -1294,10 +1327,10 @@ yyreduce: case 18: { - struct symbol *sym = sym_lookup(yyvsp[-1].string, 0); + struct symbol *sym = sym_lookup((yyvsp[-1].string), 0); sym->flags |= SYMBOL_OPTIONAL; menu_add_entry(sym); - printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), yyvsp[-1].string); + printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string)); ;} break; @@ -1312,10 +1345,10 @@ yyreduce: case 20: { - struct symbol *sym = sym_lookup(yyvsp[-1].string, 0); + struct symbol *sym = sym_lookup((yyvsp[-1].string), 0); sym->flags |= SYMBOL_OPTIONAL; menu_add_entry(sym); - printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), yyvsp[-1].string); + printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string)); ;} break; @@ -1342,7 +1375,7 @@ yyreduce: case 28: { - menu_add_expr(P_DEFAULT, yyvsp[-2].expr, yyvsp[-1].expr); + menu_add_expr(P_DEFAULT, (yyvsp[-2].expr), (yyvsp[-1].expr)); menu_set_type(S_TRISTATE); printd(DEBUG_PARSE, "%s:%d:def_boolean\n", zconf_curname(), zconf_lineno()); ;} @@ -1359,7 +1392,7 @@ yyreduce: case 30: { - menu_add_expr(P_DEFAULT, yyvsp[-2].expr, yyvsp[-1].expr); + menu_add_expr(P_DEFAULT, (yyvsp[-2].expr), (yyvsp[-1].expr)); menu_set_type(S_BOOLEAN); printd(DEBUG_PARSE, "%s:%d:def_boolean\n", zconf_curname(), zconf_lineno()); ;} @@ -1392,7 +1425,7 @@ yyreduce: case 34: { - menu_add_prompt(P_PROMPT, yyvsp[-2].string, yyvsp[-1].expr); + menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr)); printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno()); ;} break; @@ -1400,7 +1433,7 @@ yyreduce: case 35: { - menu_add_expr(P_DEFAULT, yyvsp[-2].expr, yyvsp[-1].expr); + menu_add_expr(P_DEFAULT, (yyvsp[-2].expr), (yyvsp[-1].expr)); printd(DEBUG_PARSE, "%s:%d:default\n", zconf_curname(), zconf_lineno()); ;} break; @@ -1408,7 +1441,7 @@ yyreduce: case 36: { - menu_add_symbol(P_SELECT, sym_lookup(yyvsp[-2].string, 0), yyvsp[-1].expr); + menu_add_symbol(P_SELECT, sym_lookup((yyvsp[-2].string), 0), (yyvsp[-1].expr)); printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno()); ;} break; @@ -1416,7 +1449,7 @@ yyreduce: case 37: { - menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,yyvsp[-3].symbol, yyvsp[-2].symbol), yyvsp[-1].expr); + menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,(yyvsp[-3].symbol), (yyvsp[-2].symbol)), (yyvsp[-1].expr)); printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno()); ;} break; @@ -1443,7 +1476,7 @@ yyreduce: case 40: { - if (zconf_endtoken(yyvsp[0].token, T_CHOICE, T_ENDCHOICE)) { + if (zconf_endtoken((yyvsp[0].token), T_CHOICE, T_ENDCHOICE)) { menu_end_menu(); printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno()); } @@ -1461,7 +1494,7 @@ yyreduce: case 48: { - menu_add_prompt(P_PROMPT, yyvsp[-2].string, yyvsp[-1].expr); + menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr)); printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno()); ;} break; @@ -1493,7 +1526,7 @@ yyreduce: case 52: { - menu_add_symbol(P_DEFAULT, sym_lookup(yyvsp[-2].string, 0), yyvsp[-1].expr); + menu_add_symbol(P_DEFAULT, sym_lookup((yyvsp[-2].string), 0), (yyvsp[-1].expr)); printd(DEBUG_PARSE, "%s:%d:default\n", zconf_curname(), zconf_lineno()); ;} break; @@ -1503,7 +1536,7 @@ yyreduce: { printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno()); menu_add_entry(NULL); - menu_add_dep(yyvsp[-1].expr); + menu_add_dep((yyvsp[-1].expr)); menu_end_entry(); menu_add_menu(); ;} @@ -1512,7 +1545,7 @@ yyreduce: case 56: { - if (zconf_endtoken(yyvsp[0].token, T_IF, T_ENDIF)) { + if (zconf_endtoken((yyvsp[0].token), T_IF, T_ENDIF)) { menu_end_menu(); printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno()); } @@ -1531,7 +1564,7 @@ yyreduce: { menu_add_entry(NULL); - menu_add_prompt(P_MENU, yyvsp[-1].string, NULL); + menu_add_prompt(P_MENU, (yyvsp[-1].string), NULL); printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno()); ;} break; @@ -1547,7 +1580,7 @@ yyreduce: case 65: { - if (zconf_endtoken(yyvsp[0].token, T_MENU, T_ENDMENU)) { + if (zconf_endtoken((yyvsp[0].token), T_MENU, T_ENDMENU)) { menu_end_menu(); printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno()); } @@ -1570,15 +1603,15 @@ yyreduce: case 73: { - yyval.string = yyvsp[-1].string; - printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), yyvsp[-1].string); + (yyval.string) = (yyvsp[-1].string); + printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string)); ;} break; case 74: { - zconf_nextfile(yyvsp[0].string); + zconf_nextfile((yyvsp[0].string)); ;} break; @@ -1586,7 +1619,7 @@ yyreduce: { menu_add_entry(NULL); - menu_add_prompt(P_COMMENT, yyvsp[-1].string, NULL); + menu_add_prompt(P_COMMENT, (yyvsp[-1].string), NULL); printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno()); ;} break; @@ -1609,14 +1642,14 @@ yyreduce: case 78: { - current_entry->sym->help = yyvsp[0].string; + current_entry->sym->help = (yyvsp[0].string); ;} break; case 82: { - menu_add_dep(yyvsp[-1].expr); + menu_add_dep((yyvsp[-1].expr)); printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno()); ;} break; @@ -1624,7 +1657,7 @@ yyreduce: case 83: { - menu_add_dep(yyvsp[-1].expr); + menu_add_dep((yyvsp[-1].expr)); printd(DEBUG_PARSE, "%s:%d:depends\n", zconf_curname(), zconf_lineno()); ;} break; @@ -1632,7 +1665,7 @@ yyreduce: case 84: { - menu_add_dep(yyvsp[-1].expr); + menu_add_dep((yyvsp[-1].expr)); printd(DEBUG_PARSE, "%s:%d:requires\n", zconf_curname(), zconf_lineno()); ;} break; @@ -1640,84 +1673,84 @@ yyreduce: case 86: { - menu_add_prompt(P_PROMPT, yyvsp[-1].string, yyvsp[0].expr); + menu_add_prompt(P_PROMPT, (yyvsp[-1].string), (yyvsp[0].expr)); ;} break; case 89: - { yyval.token = T_ENDMENU; ;} + { (yyval.token) = T_ENDMENU; ;} break; case 90: - { yyval.token = T_ENDCHOICE; ;} + { (yyval.token) = T_ENDCHOICE; ;} break; case 91: - { yyval.token = T_ENDIF; ;} + { (yyval.token) = T_ENDIF; ;} break; case 94: - { yyval.expr = NULL; ;} + { (yyval.expr) = NULL; ;} break; case 95: - { yyval.expr = yyvsp[0].expr; ;} + { (yyval.expr) = (yyvsp[0].expr); ;} break; case 96: - { yyval.expr = expr_alloc_symbol(yyvsp[0].symbol); ;} + { (yyval.expr) = expr_alloc_symbol((yyvsp[0].symbol)); ;} break; case 97: - { yyval.expr = expr_alloc_comp(E_EQUAL, yyvsp[-2].symbol, yyvsp[0].symbol); ;} + { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); ;} break; case 98: - { yyval.expr = expr_alloc_comp(E_UNEQUAL, yyvsp[-2].symbol, yyvsp[0].symbol); ;} + { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); ;} break; case 99: - { yyval.expr = yyvsp[-1].expr; ;} + { (yyval.expr) = (yyvsp[-1].expr); ;} break; case 100: - { yyval.expr = expr_alloc_one(E_NOT, yyvsp[0].expr); ;} + { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[0].expr)); ;} break; case 101: - { yyval.expr = expr_alloc_two(E_OR, yyvsp[-2].expr, yyvsp[0].expr); ;} + { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[-2].expr), (yyvsp[0].expr)); ;} break; case 102: - { yyval.expr = expr_alloc_two(E_AND, yyvsp[-2].expr, yyvsp[0].expr); ;} + { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[-2].expr), (yyvsp[0].expr)); ;} break; case 103: - { yyval.symbol = sym_lookup(yyvsp[0].string, 0); free(yyvsp[0].string); ;} + { (yyval.symbol) = sym_lookup((yyvsp[0].string), 0); free((yyvsp[0].string)); ;} break; case 104: - { yyval.symbol = sym_lookup(yyvsp[0].string, 1); free(yyvsp[0].string); ;} + { (yyval.symbol) = sym_lookup((yyvsp[0].string), 1); free((yyvsp[0].string)); ;} break; } -/* Line 999 of yacc.c. */ +/* Line 1037 of yacc.c. */ yyvsp -= yylen; @@ -1759,18 +1792,33 @@ yyerrlab: { YYSIZE_T yysize = 0; int yytype = YYTRANSLATE (yychar); + const char* yyprefix; char *yymsg; - int yyx, yycount; + int yyx; - yycount = 0; /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ - for (yyx = yyn < 0 ? -yyn : 0; - yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) + int yyxbegin = yyn < 0 ? -yyn : 0; + + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 0; + + yyprefix = ", expecting "; + for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - yysize += yystrlen (yytname[yyx]) + 15, yycount++; - yysize += yystrlen ("syntax error, unexpected ") + 1; - yysize += yystrlen (yytname[yytype]); + { + yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]); + yycount += 1; + if (yycount == 5) + { + yysize = 0; + break; + } + } + yysize += (sizeof ("syntax error, unexpected ") + + yystrlen (yytname[yytype])); yymsg = (char *) YYSTACK_ALLOC (yysize); if (yymsg != 0) { @@ -1779,16 +1827,13 @@ yyerrlab: if (yycount < 5) { - yycount = 0; - for (yyx = yyn < 0 ? -yyn : 0; - yyx < (int) (sizeof (yytname) / sizeof (char *)); - yyx++) + yyprefix = ", expecting "; + for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { - const char *yyq = ! yycount ? ", expecting " : " or "; - yyp = yystpcpy (yyp, yyq); + yyp = yystpcpy (yyp, yyprefix); yyp = yystpcpy (yyp, yytname[yyx]); - yycount++; + yyprefix = " or "; } } yyerror (yymsg); @@ -1806,38 +1851,57 @@ yyerrlab: if (yyerrstatus == 3) { - /* If just tried and failed to reuse lookahead token after an + /* If just tried and failed to reuse look-ahead token after an error, discard it. */ - /* Return failure if at end of input. */ - if (yychar == YYEOF) + if (yychar <= YYEOF) { - /* Pop the error token. */ - YYPOPSTACK; - /* Pop the rest of the stack. */ - while (yyss < yyssp) - { - YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); - yydestruct (yystos[*yyssp], yyvsp); - YYPOPSTACK; - } - YYABORT; + /* If at end of input, pop the error token, + then the rest of the stack, then return failure. */ + if (yychar == YYEOF) + for (;;) + { + + YYPOPSTACK; + if (yyssp == yyss) + YYABORT; + yydestruct ("Error: popping", + yystos[*yyssp], yyvsp); + } } - - YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc); - yydestruct (yytoken, &yylval); - yychar = YYEMPTY; - + else + { + yydestruct ("Error: discarding", yytoken, &yylval); + yychar = YYEMPTY; + } } - /* Else will try to reuse lookahead token after shifting the error + /* Else will try to reuse look-ahead token after shifting the error token. */ goto yyerrlab1; -/*----------------------------------------------------. -| yyerrlab1 -- error raised explicitly by an action. | -`----------------------------------------------------*/ +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + +#ifdef __GNUC__ + /* Pacify GCC when the user code never invokes YYERROR and the label + yyerrorlab therefore never appears in user code. */ + if (0) + goto yyerrorlab; +#endif + +yyvsp -= yylen; + yyssp -= yylen; + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ @@ -1859,22 +1923,22 @@ yyerrlab1: if (yyssp == yyss) YYABORT; - YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); - yydestruct (yystos[yystate], yyvsp); - yyvsp--; - yystate = *--yyssp; + yydestruct ("Error: popping", yystos[yystate], yyvsp); + YYPOPSTACK; + yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } if (yyn == YYFINAL) YYACCEPT; - YYDPRINTF ((stderr, "Shifting error token, ")); - *++yyvsp = yylval; + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + yystate = yyn; goto yynewstate; @@ -1890,6 +1954,9 @@ yyacceptlab: | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: + yydestruct ("Error: discarding lookahead", + yytoken, &yylval); + yychar = YYEMPTY; yyresult = 1; goto yyreturn; diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y index 1e214e9c1d31..43021d436baf 100644 --- a/scripts/kconfig/zconf.y +++ b/scripts/kconfig/zconf.y @@ -11,6 +11,11 @@ #include #include +#define LKC_DIRECT_LINK +#include "lkc.h" + +#include "zconf.hash.c" + #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt) #define PRINTD 0x0001 @@ -88,10 +93,6 @@ static struct menu *current_menu, *current_entry; %type if_expr %type end -%{ -#define LKC_DIRECT_LINK -#include "lkc.h" -%} %% input: /* empty */ | input block -- cgit v1.2.2 From 3370f9f0d9c7d14bf71aab27fa45c0537f130614 Mon Sep 17 00:00:00 2001 From: Roman Zippel Date: Tue, 8 Nov 2005 21:34:52 -0800 Subject: [PATCH] kconfig: simplify symbol type parsing This simplifies the parser a bit by merging the various symbol types into a single token and adds the type to the keyword hash. Signed-off-by: Roman Zippel Cc: Sam Ravnborg Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- scripts/kconfig/lex.zconf.c_shipped | 5 +- scripts/kconfig/lkc.h | 1 + scripts/kconfig/zconf.gperf | 20 +- scripts/kconfig/zconf.hash.c_shipped | 20 +- scripts/kconfig/zconf.l | 5 +- scripts/kconfig/zconf.tab.c_shipped | 608 +++++++++++++++-------------------- scripts/kconfig/zconf.y | 130 +++----- 7 files changed, 342 insertions(+), 447 deletions(-) diff --git a/scripts/kconfig/lex.zconf.c_shipped b/scripts/kconfig/lex.zconf.c_shipped index 0168141417f6..bedba89a87c6 100644 --- a/scripts/kconfig/lex.zconf.c_shipped +++ b/scripts/kconfig/lex.zconf.c_shipped @@ -1025,6 +1025,7 @@ YY_RULE_SETUP struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng); if (id && id->flags & TF_COMMAND) { BEGIN(PARAM); + zconflval.id = id; return id->token; } alloc_string(zconftext, zconfleng); @@ -1091,8 +1092,10 @@ case 19: YY_RULE_SETUP { struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng); - if (id && id->flags & TF_PARAM) + if (id && id->flags & TF_PARAM) { + zconflval.id = id; return id->token; + } alloc_string(zconftext, zconfleng); zconflval.string = text; return T_WORD; diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h index 6881fb084324..91491d0a3029 100644 --- a/scripts/kconfig/lkc.h +++ b/scripts/kconfig/lkc.h @@ -45,6 +45,7 @@ struct kconf_id { int name; int token; unsigned int flags; + enum symbol_type stype; }; int zconfparse(void); diff --git a/scripts/kconfig/zconf.gperf b/scripts/kconfig/zconf.gperf index c9d81cf5d7fb..b03220600b3a 100644 --- a/scripts/kconfig/zconf.gperf +++ b/scripts/kconfig/zconf.gperf @@ -25,17 +25,17 @@ endif, T_ENDIF, TF_COMMAND depends, T_DEPENDS, TF_COMMAND requires, T_REQUIRES, TF_COMMAND optional, T_OPTIONAL, TF_COMMAND -default, T_DEFAULT, TF_COMMAND +default, T_DEFAULT, TF_COMMAND, S_UNKNOWN prompt, T_PROMPT, TF_COMMAND -tristate, T_TRISTATE, TF_COMMAND -def_tristate, T_DEF_TRISTATE, TF_COMMAND -bool, T_BOOLEAN, TF_COMMAND -boolean, T_BOOLEAN, TF_COMMAND -def_bool, T_DEF_BOOLEAN, TF_COMMAND -def_boolean, T_DEF_BOOLEAN, TF_COMMAND -int, T_INT, TF_COMMAND -hex, T_HEX, TF_COMMAND -string, T_STRING, TF_COMMAND +tristate, T_TYPE, TF_COMMAND, S_TRISTATE +def_tristate, T_DEFAULT, TF_COMMAND, S_TRISTATE +bool, T_TYPE, TF_COMMAND, S_BOOLEAN +boolean, T_TYPE, TF_COMMAND, S_BOOLEAN +def_bool, T_DEFAULT, TF_COMMAND, S_BOOLEAN +def_boolean, T_DEFAULT, TF_COMMAND, S_BOOLEAN +int, T_TYPE, TF_COMMAND, S_INT +hex, T_TYPE, TF_COMMAND, S_HEX +string, T_TYPE, TF_COMMAND, S_STRING select, T_SELECT, TF_COMMAND enable, T_SELECT, TF_COMMAND range, T_RANGE, TF_COMMAND diff --git a/scripts/kconfig/zconf.hash.c_shipped b/scripts/kconfig/zconf.hash.c_shipped index 6741cb159801..345f0fc07ca3 100644 --- a/scripts/kconfig/zconf.hash.c_shipped +++ b/scripts/kconfig/zconf.hash.c_shipped @@ -172,27 +172,27 @@ kconf_id_lookup (register const char *str, register unsigned int len) { {-1}, {-1}, {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str2, T_IF, TF_COMMAND|TF_PARAM}, - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str3, T_INT, TF_COMMAND}, + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str3, T_TYPE, TF_COMMAND, S_INT}, {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str4, T_HELP, TF_COMMAND}, {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str5, T_ENDIF, TF_COMMAND}, {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str6, T_SELECT, TF_COMMAND}, {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str7, T_ENDMENU, TF_COMMAND}, - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str8, T_TRISTATE, TF_COMMAND}, + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str8, T_TYPE, TF_COMMAND, S_TRISTATE}, {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str9, T_ENDCHOICE, TF_COMMAND}, {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str10, T_RANGE, TF_COMMAND}, - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str11, T_STRING, TF_COMMAND}, - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str12, T_DEFAULT, TF_COMMAND}, - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str13, T_DEF_BOOLEAN, TF_COMMAND}, + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str11, T_TYPE, TF_COMMAND, S_STRING}, + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str12, T_DEFAULT, TF_COMMAND, S_UNKNOWN}, + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str13, T_DEFAULT, TF_COMMAND, S_BOOLEAN}, {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str14, T_MENU, TF_COMMAND}, {-1}, - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str16, T_DEF_BOOLEAN, TF_COMMAND}, - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str17, T_DEF_TRISTATE, TF_COMMAND}, + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str16, T_DEFAULT, TF_COMMAND, S_BOOLEAN}, + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str17, T_DEFAULT, TF_COMMAND, S_TRISTATE}, {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str18, T_MAINMENU, TF_COMMAND}, {-1}, {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str20, T_MENUCONFIG, TF_COMMAND}, {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str21, T_CONFIG, TF_COMMAND}, {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str22, T_ON, TF_PARAM}, - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str23, T_HEX, TF_COMMAND}, + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str23, T_TYPE, TF_COMMAND, S_HEX}, {-1}, {-1}, {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str26, T_SOURCE, TF_COMMAND}, {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str27, T_DEPENDS, TF_COMMAND}, @@ -201,9 +201,9 @@ kconf_id_lookup (register const char *str, register unsigned int len) {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str31, T_SELECT, TF_COMMAND}, {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str32, T_COMMENT, TF_COMMAND}, {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str33, T_REQUIRES, TF_COMMAND}, - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str34, T_BOOLEAN, TF_COMMAND}, + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str34, T_TYPE, TF_COMMAND, S_BOOLEAN}, {-1}, {-1}, - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str37, T_BOOLEAN, TF_COMMAND}, + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str37, T_TYPE, TF_COMMAND, S_BOOLEAN}, {-1}, {-1}, {-1}, {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str41, T_CHOICE, TF_COMMAND}, {-1}, {-1}, {-1}, {-1}, diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l index ec902091be97..cfcfabd7a069 100644 --- a/scripts/kconfig/zconf.l +++ b/scripts/kconfig/zconf.l @@ -90,6 +90,7 @@ n [A-Za-z0-9_] struct kconf_id *id = kconf_id_lookup(yytext, yyleng); if (id && id->flags & TF_COMMAND) { BEGIN(PARAM); + zconflval.id = id; return id->token; } alloc_string(yytext, yyleng); @@ -117,8 +118,10 @@ n [A-Za-z0-9_] --- /* ignore */ ({n}|[-/.])+ { struct kconf_id *id = kconf_id_lookup(yytext, yyleng); - if (id && id->flags & TF_PARAM) + if (id && id->flags & TF_PARAM) { + zconflval.id = id; return id->token; + } alloc_string(yytext, yyleng); zconflval.string = text; return T_WORD; diff --git a/scripts/kconfig/zconf.tab.c_shipped b/scripts/kconfig/zconf.tab.c_shipped index 07fa508d4659..3fc296274c98 100644 --- a/scripts/kconfig/zconf.tab.c_shipped +++ b/scripts/kconfig/zconf.tab.c_shipped @@ -78,28 +78,22 @@ T_REQUIRES = 272, T_OPTIONAL = 273, T_PROMPT = 274, - T_DEFAULT = 275, - T_TRISTATE = 276, - T_DEF_TRISTATE = 277, - T_BOOLEAN = 278, - T_DEF_BOOLEAN = 279, - T_STRING = 280, - T_INT = 281, - T_HEX = 282, - T_WORD = 283, - T_WORD_QUOTE = 284, - T_UNEQUAL = 285, + T_TYPE = 275, + T_DEFAULT = 276, + T_SELECT = 277, + T_RANGE = 278, + T_ON = 279, + T_WORD = 280, + T_WORD_QUOTE = 281, + T_UNEQUAL = 282, + T_CLOSE_PAREN = 283, + T_OPEN_PAREN = 284, + T_EOL = 285, T_EOF = 286, - T_EOL = 287, - T_CLOSE_PAREN = 288, - T_OPEN_PAREN = 289, - T_ON = 290, - T_SELECT = 291, - T_RANGE = 292, - T_OR = 293, - T_AND = 294, - T_EQUAL = 295, - T_NOT = 296 + T_OR = 287, + T_AND = 288, + T_EQUAL = 289, + T_NOT = 290 }; #endif #define T_MAINMENU 258 @@ -119,28 +113,22 @@ #define T_REQUIRES 272 #define T_OPTIONAL 273 #define T_PROMPT 274 -#define T_DEFAULT 275 -#define T_TRISTATE 276 -#define T_DEF_TRISTATE 277 -#define T_BOOLEAN 278 -#define T_DEF_BOOLEAN 279 -#define T_STRING 280 -#define T_INT 281 -#define T_HEX 282 -#define T_WORD 283 -#define T_WORD_QUOTE 284 -#define T_UNEQUAL 285 +#define T_TYPE 275 +#define T_DEFAULT 276 +#define T_SELECT 277 +#define T_RANGE 278 +#define T_ON 279 +#define T_WORD 280 +#define T_WORD_QUOTE 281 +#define T_UNEQUAL 282 +#define T_CLOSE_PAREN 283 +#define T_OPEN_PAREN 284 +#define T_EOL 285 #define T_EOF 286 -#define T_EOL 287 -#define T_CLOSE_PAREN 288 -#define T_OPEN_PAREN 289 -#define T_ON 290 -#define T_SELECT 291 -#define T_RANGE 292 -#define T_OR 293 -#define T_AND 294 -#define T_EQUAL 295 -#define T_NOT 296 +#define T_OR 287 +#define T_AND 288 +#define T_EQUAL 289 +#define T_NOT 290 @@ -205,6 +193,7 @@ typedef union YYSTYPE { struct symbol *symbol; struct expr *expr; struct menu *menu; + struct kconf_id *id; } YYSTYPE; /* Line 190 of yacc.c. */ @@ -321,20 +310,20 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 2 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 201 +#define YYLAST 179 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 42 +#define YYNTOKENS 36 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 41 /* YYNRULES -- Number of rules. */ -#define YYNRULES 104 +#define YYNRULES 97 /* YYNRULES -- Number of states. */ -#define YYNSTATES 182 +#define YYNSTATES 159 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 296 +#define YYMAXUTOK 290 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -371,7 +360,7 @@ static const unsigned char yytranslate[] = 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41 + 35 }; #if YYDEBUG @@ -382,67 +371,62 @@ static const unsigned short int yyprhs[] = 0, 0, 3, 4, 7, 9, 11, 13, 17, 19, 21, 23, 26, 28, 30, 32, 34, 36, 38, 42, 45, 49, 52, 53, 56, 59, 62, 65, 69, 74, - 78, 83, 87, 91, 95, 100, 105, 110, 116, 119, - 122, 124, 128, 131, 132, 135, 138, 141, 144, 149, - 153, 157, 160, 165, 166, 169, 173, 175, 179, 182, - 183, 186, 189, 192, 196, 199, 201, 205, 208, 209, - 212, 215, 218, 222, 226, 228, 232, 235, 238, 241, - 242, 245, 248, 253, 257, 261, 262, 265, 267, 269, - 272, 275, 278, 280, 282, 283, 286, 288, 292, 296, - 300, 303, 307, 311, 313 + 79, 84, 90, 93, 96, 98, 102, 105, 106, 109, + 112, 115, 118, 123, 127, 130, 135, 136, 139, 143, + 145, 149, 152, 153, 156, 159, 162, 166, 169, 171, + 175, 178, 179, 182, 185, 188, 192, 196, 198, 202, + 205, 208, 211, 212, 215, 218, 223, 227, 231, 232, + 235, 237, 239, 242, 245, 248, 250, 252, 253, 256, + 258, 262, 266, 270, 273, 277, 281, 283 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yysigned_char yyrhs[] = { - 43, 0, -1, -1, 43, 44, -1, 45, -1, 55, - -1, 66, -1, 3, 77, 79, -1, 5, -1, 15, - -1, 8, -1, 1, 79, -1, 61, -1, 71, -1, - 47, -1, 49, -1, 69, -1, 79, -1, 10, 28, - 32, -1, 46, 50, -1, 11, 28, 32, -1, 48, - 50, -1, -1, 50, 51, -1, 50, 75, -1, 50, - 73, -1, 50, 32, -1, 21, 76, 32, -1, 22, - 81, 80, 32, -1, 23, 76, 32, -1, 24, 81, - 80, 32, -1, 26, 76, 32, -1, 27, 76, 32, - -1, 25, 76, 32, -1, 19, 77, 80, 32, -1, - 20, 81, 80, 32, -1, 36, 28, 80, 32, -1, - 37, 82, 82, 80, 32, -1, 7, 32, -1, 52, - 56, -1, 78, -1, 53, 58, 54, -1, 53, 58, - -1, -1, 56, 57, -1, 56, 75, -1, 56, 73, - -1, 56, 32, -1, 19, 77, 80, 32, -1, 21, - 76, 32, -1, 23, 76, 32, -1, 18, 32, -1, - 20, 28, 80, 32, -1, -1, 58, 45, -1, 14, - 81, 32, -1, 78, -1, 59, 62, 60, -1, 59, - 62, -1, -1, 62, 45, -1, 62, 66, -1, 62, - 55, -1, 4, 77, 32, -1, 63, 74, -1, 78, - -1, 64, 67, 65, -1, 64, 67, -1, -1, 67, - 45, -1, 67, 66, -1, 67, 55, -1, 67, 1, - 32, -1, 6, 77, 32, -1, 68, -1, 9, 77, - 32, -1, 70, 74, -1, 12, 32, -1, 72, 13, - -1, -1, 74, 75, -1, 74, 32, -1, 16, 35, - 81, 32, -1, 16, 81, 32, -1, 17, 81, 32, - -1, -1, 77, 80, -1, 28, -1, 29, -1, 5, - 79, -1, 8, 79, -1, 15, 79, -1, 32, -1, - 31, -1, -1, 14, 81, -1, 82, -1, 82, 40, - 82, -1, 82, 30, 82, -1, 34, 81, 33, -1, - 41, 81, -1, 81, 38, 81, -1, 81, 39, 81, - -1, 28, -1, 29, -1 + 37, 0, -1, -1, 37, 38, -1, 39, -1, 49, + -1, 60, -1, 3, 71, 73, -1, 5, -1, 15, + -1, 8, -1, 1, 73, -1, 55, -1, 65, -1, + 41, -1, 43, -1, 63, -1, 73, -1, 10, 25, + 30, -1, 40, 44, -1, 11, 25, 30, -1, 42, + 44, -1, -1, 44, 45, -1, 44, 69, -1, 44, + 67, -1, 44, 30, -1, 20, 70, 30, -1, 19, + 71, 74, 30, -1, 21, 75, 74, 30, -1, 22, + 25, 74, 30, -1, 23, 76, 76, 74, 30, -1, + 7, 30, -1, 46, 50, -1, 72, -1, 47, 52, + 48, -1, 47, 52, -1, -1, 50, 51, -1, 50, + 69, -1, 50, 67, -1, 50, 30, -1, 19, 71, + 74, 30, -1, 20, 70, 30, -1, 18, 30, -1, + 21, 25, 74, 30, -1, -1, 52, 39, -1, 14, + 75, 30, -1, 72, -1, 53, 56, 54, -1, 53, + 56, -1, -1, 56, 39, -1, 56, 60, -1, 56, + 49, -1, 4, 71, 30, -1, 57, 68, -1, 72, + -1, 58, 61, 59, -1, 58, 61, -1, -1, 61, + 39, -1, 61, 60, -1, 61, 49, -1, 61, 1, + 30, -1, 6, 71, 30, -1, 62, -1, 9, 71, + 30, -1, 64, 68, -1, 12, 30, -1, 66, 13, + -1, -1, 68, 69, -1, 68, 30, -1, 16, 24, + 75, 30, -1, 16, 75, 30, -1, 17, 75, 30, + -1, -1, 71, 74, -1, 25, -1, 26, -1, 5, + 73, -1, 8, 73, -1, 15, 73, -1, 30, -1, + 31, -1, -1, 14, 75, -1, 76, -1, 76, 34, + 76, -1, 76, 27, 76, -1, 29, 75, 28, -1, + 35, 75, -1, 75, 32, 75, -1, 75, 33, 75, + -1, 25, -1, 26, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const unsigned short int yyrline[] = { - 0, 97, 97, 98, 101, 102, 103, 104, 105, 106, - 107, 108, 112, 113, 114, 115, 116, 117, 123, 131, - 137, 145, 155, 157, 158, 159, 160, 163, 169, 176, - 182, 189, 195, 201, 207, 213, 219, 225, 233, 242, - 248, 257, 258, 264, 266, 267, 268, 269, 272, 278, - 284, 290, 296, 302, 304, 309, 318, 327, 328, 334, - 336, 337, 338, 343, 350, 356, 365, 366, 372, 374, - 375, 376, 377, 380, 386, 393, 400, 407, 413, 420, - 421, 422, 425, 430, 435, 443, 445, 450, 451, 454, - 455, 456, 460, 460, 462, 463, 466, 467, 468, 469, - 470, 471, 472, 475, 476 + 0, 92, 92, 93, 96, 97, 98, 99, 100, 101, + 102, 103, 107, 108, 109, 110, 111, 112, 118, 126, + 132, 140, 150, 152, 153, 154, 155, 158, 166, 172, + 182, 188, 196, 205, 211, 220, 221, 227, 229, 230, + 231, 232, 235, 241, 252, 258, 268, 270, 275, 284, + 293, 294, 300, 302, 303, 304, 309, 316, 322, 331, + 332, 338, 340, 341, 342, 343, 346, 352, 359, 366, + 373, 379, 386, 387, 388, 391, 396, 401, 409, 411, + 416, 417, 420, 421, 422, 426, 426, 428, 429, 432, + 433, 434, 435, 436, 437, 438, 441, 442 }; #endif @@ -454,11 +438,10 @@ static const char *const yytname[] = "$end", "error", "$undefined", "T_MAINMENU", "T_MENU", "T_ENDMENU", "T_SOURCE", "T_CHOICE", "T_ENDCHOICE", "T_COMMENT", "T_CONFIG", "T_MENUCONFIG", "T_HELP", "T_HELPTEXT", "T_IF", "T_ENDIF", "T_DEPENDS", - "T_REQUIRES", "T_OPTIONAL", "T_PROMPT", "T_DEFAULT", "T_TRISTATE", - "T_DEF_TRISTATE", "T_BOOLEAN", "T_DEF_BOOLEAN", "T_STRING", "T_INT", - "T_HEX", "T_WORD", "T_WORD_QUOTE", "T_UNEQUAL", "T_EOF", "T_EOL", - "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_ON", "T_SELECT", "T_RANGE", "T_OR", - "T_AND", "T_EQUAL", "T_NOT", "$accept", "input", "block", "common_block", + "T_REQUIRES", "T_OPTIONAL", "T_PROMPT", "T_TYPE", "T_DEFAULT", + "T_SELECT", "T_RANGE", "T_ON", "T_WORD", "T_WORD_QUOTE", "T_UNEQUAL", + "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_EOL", "T_EOF", "T_OR", "T_AND", + "T_EQUAL", "T_NOT", "$accept", "input", "block", "common_block", "config_entry_start", "config_stmt", "menuconfig_entry_start", "menuconfig_stmt", "config_option_list", "config_option", "choice", "choice_entry", "choice_end", "choice_stmt", "choice_option_list", @@ -478,25 +461,23 @@ static const unsigned short int yytoknum[] = 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296 + 285, 286, 287, 288, 289, 290 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const unsigned char yyr1[] = { - 0, 42, 43, 43, 44, 44, 44, 44, 44, 44, - 44, 44, 45, 45, 45, 45, 45, 45, 46, 47, - 48, 49, 50, 50, 50, 50, 50, 51, 51, 51, - 51, 51, 51, 51, 51, 51, 51, 51, 52, 53, - 54, 55, 55, 56, 56, 56, 56, 56, 57, 57, - 57, 57, 57, 58, 58, 59, 60, 61, 61, 62, - 62, 62, 62, 63, 64, 65, 66, 66, 67, 67, - 67, 67, 67, 68, 69, 70, 71, 72, 73, 74, - 74, 74, 75, 75, 75, 76, 76, 77, 77, 78, - 78, 78, 79, 79, 80, 80, 81, 81, 81, 81, - 81, 81, 81, 82, 82 + 0, 36, 37, 37, 38, 38, 38, 38, 38, 38, + 38, 38, 39, 39, 39, 39, 39, 39, 40, 41, + 42, 43, 44, 44, 44, 44, 44, 45, 45, 45, + 45, 45, 46, 47, 48, 49, 49, 50, 50, 50, + 50, 50, 51, 51, 51, 51, 52, 52, 53, 54, + 55, 55, 56, 56, 56, 56, 57, 58, 59, 60, + 60, 61, 61, 61, 61, 61, 62, 63, 64, 65, + 66, 67, 68, 68, 68, 69, 69, 69, 70, 70, + 71, 71, 72, 72, 72, 73, 73, 74, 74, 75, + 75, 75, 75, 75, 75, 75, 76, 76 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -504,15 +485,14 @@ static const unsigned char yyr2[] = { 0, 2, 0, 2, 1, 1, 1, 3, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 3, 2, - 3, 2, 0, 2, 2, 2, 2, 3, 4, 3, - 4, 3, 3, 3, 4, 4, 4, 5, 2, 2, - 1, 3, 2, 0, 2, 2, 2, 2, 4, 3, - 3, 2, 4, 0, 2, 3, 1, 3, 2, 0, - 2, 2, 2, 3, 2, 1, 3, 2, 0, 2, - 2, 2, 3, 3, 1, 3, 2, 2, 2, 0, - 2, 2, 4, 3, 3, 0, 2, 1, 1, 2, - 2, 2, 1, 1, 0, 2, 1, 3, 3, 3, - 2, 3, 3, 1, 1 + 3, 2, 0, 2, 2, 2, 2, 3, 4, 4, + 4, 5, 2, 2, 1, 3, 2, 0, 2, 2, + 2, 2, 4, 3, 2, 4, 0, 2, 3, 1, + 3, 2, 0, 2, 2, 2, 3, 2, 1, 3, + 2, 0, 2, 2, 2, 3, 3, 1, 3, 2, + 2, 2, 0, 2, 2, 4, 3, 3, 0, 2, + 1, 1, 2, 2, 2, 1, 1, 0, 2, 1, + 3, 3, 3, 2, 3, 3, 1, 1 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -521,69 +501,63 @@ static const unsigned char yyr2[] = static const unsigned char yydefact[] = { 2, 0, 1, 0, 0, 0, 8, 0, 0, 10, - 0, 0, 0, 0, 9, 93, 92, 3, 4, 22, - 14, 22, 15, 43, 53, 5, 59, 12, 79, 68, - 6, 74, 16, 79, 13, 17, 11, 87, 88, 0, - 0, 0, 38, 0, 0, 0, 103, 104, 0, 0, - 0, 96, 19, 21, 39, 42, 58, 64, 0, 76, - 7, 63, 73, 75, 18, 20, 0, 100, 55, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 85, 0, - 85, 0, 85, 85, 85, 26, 0, 0, 23, 0, - 25, 24, 0, 0, 0, 85, 85, 47, 44, 46, - 45, 0, 0, 0, 54, 41, 40, 60, 62, 57, - 61, 56, 81, 80, 0, 69, 71, 66, 70, 65, - 99, 101, 102, 98, 97, 77, 0, 0, 0, 94, - 94, 0, 94, 94, 0, 94, 0, 0, 0, 94, - 0, 78, 51, 94, 94, 0, 0, 89, 90, 91, - 72, 0, 83, 84, 0, 0, 0, 27, 86, 0, - 29, 0, 33, 31, 32, 0, 94, 0, 0, 49, - 50, 82, 95, 34, 35, 28, 30, 36, 0, 48, - 52, 37 + 0, 0, 0, 0, 9, 85, 86, 3, 4, 22, + 14, 22, 15, 37, 46, 5, 52, 12, 72, 61, + 6, 67, 16, 72, 13, 17, 11, 80, 81, 0, + 0, 0, 32, 0, 0, 0, 96, 97, 0, 0, + 0, 89, 19, 21, 33, 36, 51, 57, 0, 69, + 7, 56, 66, 68, 18, 20, 0, 93, 48, 0, + 0, 0, 0, 0, 0, 0, 0, 78, 0, 0, + 0, 26, 23, 0, 25, 24, 0, 0, 78, 0, + 41, 38, 40, 39, 0, 0, 0, 47, 35, 34, + 53, 55, 50, 54, 49, 74, 73, 0, 62, 64, + 59, 63, 58, 92, 94, 95, 91, 90, 70, 0, + 0, 0, 87, 0, 87, 87, 87, 0, 71, 44, + 87, 0, 87, 82, 83, 84, 65, 0, 76, 77, + 0, 0, 27, 79, 0, 0, 87, 0, 43, 0, + 75, 88, 28, 29, 30, 0, 42, 45, 31 }; /* YYDEFGOTO[NTERM-NUM]. */ static const short int yydefgoto[] = { - -1, 1, 17, 18, 19, 20, 21, 22, 52, 88, - 23, 24, 105, 25, 54, 98, 55, 26, 109, 27, - 56, 28, 29, 117, 30, 58, 31, 32, 33, 34, - 89, 90, 57, 91, 131, 132, 106, 35, 155, 50, + -1, 1, 17, 18, 19, 20, 21, 22, 52, 82, + 23, 24, 98, 25, 54, 91, 55, 26, 102, 27, + 56, 28, 29, 110, 30, 58, 31, 32, 33, 34, + 83, 84, 57, 85, 123, 124, 99, 35, 141, 50, 51 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -99 +#define YYPACT_NINF -113 static const short int yypact[] = { - -99, 48, -99, 38, 46, 46, -99, 46, -29, -99, - 46, -17, -3, -11, -99, -99, -99, -99, -99, -99, - -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, - -99, -99, -99, -99, -99, -99, -99, -99, -99, 38, - 12, 15, -99, 18, 51, 62, -99, -99, -11, -11, - 4, -24, 138, 138, 160, 121, 110, -4, 81, -4, - -99, -99, -99, -99, -99, -99, -19, -99, -99, -11, - -11, 70, 70, 73, 32, -11, 46, -11, 46, -11, - 46, -11, 46, 46, 46, -99, 36, 70, -99, 95, - -99, -99, 96, 46, 106, 46, 46, -99, -99, -99, - -99, 38, 38, 38, -99, -99, -99, -99, -99, -99, - -99, -99, -99, -99, 112, -99, -99, -99, -99, -99, - -99, 117, -99, -99, -99, -99, -11, 33, 65, 131, - 1, 119, 131, 1, 136, 1, 153, 154, 155, 131, - 70, -99, -99, 131, 131, 156, 157, -99, -99, -99, - -99, 101, -99, -99, -11, 158, 159, -99, -99, 161, - -99, 162, -99, -99, -99, 163, 131, 164, 165, -99, - -99, -99, 99, -99, -99, -99, -99, -99, 166, -99, - -99, -99 + -113, 37, -113, 114, 136, 136, -113, 136, -29, -113, + 136, -19, -14, -10, -113, -113, -113, -113, -113, -113, + -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, + -113, -113, -113, -113, -113, -113, -113, -113, -113, 114, + 9, 25, -113, 56, 60, 65, -113, -113, -10, -10, + 33, -1, 108, 108, 41, 103, 92, 5, 74, 5, + -113, -113, -113, -113, -113, -113, 115, -113, -113, -10, + -10, 138, 138, 80, 111, -10, 136, 136, -10, 2, + 138, -113, -113, 113, -113, -113, 85, 136, 136, 107, + -113, -113, -113, -113, 114, 114, 114, -113, -113, -113, + -113, -113, -113, -113, -113, -113, -113, 120, -113, -113, + -113, -113, -113, -113, 121, -113, -113, -113, -113, -10, + 109, 119, 16, 137, 16, 17, 16, 138, -113, -113, + 16, 139, 16, -113, -113, -113, -113, 123, -113, -113, + -10, 140, -113, -113, 141, 142, 16, 143, -113, 144, + -113, 133, -113, -113, -113, 145, -113, -113, -113 }; /* YYPGOTO[NTERM-NUM]. */ static const short int yypgoto[] = { - -99, -99, -99, 111, -99, -99, -99, -99, 178, -99, - -99, -99, -99, 91, -99, -99, -99, -99, -99, -99, - -99, -99, -99, -99, 115, -99, -99, -99, -99, -99, - -99, 146, 168, 89, 27, 0, 126, -1, -98, -48, + -113, -113, -113, 14, -113, -113, -113, -113, 147, -113, + -113, -113, -113, -2, -113, -113, -113, -113, -113, -113, + -113, -113, -113, -113, 101, -113, -113, -113, -113, -113, + -113, 122, 146, 62, 89, 0, 102, -3, -112, -46, -63 }; @@ -591,80 +565,71 @@ static const short int yypgoto[] = positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -68 +#define YYTABLE_NINF -61 static const short int yytable[] = { - 66, 67, 36, 42, 39, 40, 71, 41, 123, 124, - 43, 44, 74, 75, 120, 154, 72, 46, 47, 69, - 70, 121, 122, 48, 140, 45, 127, 128, 112, 130, - 49, 133, 156, 135, 158, 159, 68, 161, 60, 69, - 70, 165, 69, 70, 61, 167, 168, 62, 2, 3, - 63, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 46, 47, 13, 14, 139, 152, 48, 126, 178, 15, - 16, 69, 70, 49, 37, 38, 129, 166, 151, 15, - 16, -67, 114, 64, -67, 5, 101, 7, 8, 102, - 10, 11, 12, 143, 65, 13, 103, 153, 46, 47, - 147, 148, 149, 69, 70, 125, 172, 134, 141, 136, - 137, 138, 15, 16, 5, 101, 7, 8, 102, 10, - 11, 12, 145, 146, 13, 103, 101, 7, 142, 102, - 10, 11, 12, 171, 144, 13, 103, 69, 70, 69, - 70, 15, 16, 100, 150, 154, 113, 108, 113, 116, - 73, 157, 15, 16, 74, 75, 70, 76, 77, 78, - 79, 80, 81, 82, 83, 84, 104, 107, 160, 115, - 85, 110, 73, 118, 86, 87, 74, 75, 92, 93, - 94, 95, 111, 96, 119, 162, 163, 164, 169, 170, - 173, 174, 97, 175, 176, 177, 179, 180, 181, 53, - 99, 59 + 36, 42, 66, 67, 39, 40, 44, 41, 116, 117, + 43, 45, 143, 144, 145, 46, 47, 127, 147, 48, + 149, 74, 75, 114, 115, 49, 71, 126, 120, 121, + 140, 140, 125, 72, 155, 105, 60, 2, 3, 61, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 69, + 70, 13, 14, 73, 101, 62, 109, 74, 75, 86, + 87, 88, 89, 68, 146, 69, 70, 15, 16, 97, + 100, 90, 108, 137, -60, 107, 122, -60, 5, 94, + 7, 8, 95, 10, 11, 12, 63, 130, 13, 96, + 64, 133, 134, 135, 151, 65, 5, 94, 7, 8, + 95, 10, 11, 12, 15, 16, 13, 96, 94, 7, + 118, 95, 10, 11, 12, 129, 93, 13, 96, 106, + 73, 106, 15, 16, 74, 75, 128, 76, 77, 78, + 79, 80, 132, 15, 16, 119, 46, 47, 81, 138, + 48, 69, 70, 113, 15, 16, 49, 69, 70, 139, + 136, 69, 70, 150, 70, 69, 70, 103, 104, 111, + 112, 37, 38, 46, 47, 69, 70, 142, 53, 148, + 152, 153, 154, 156, 157, 158, 92, 131, 0, 59 }; -static const unsigned char yycheck[] = +static const short int yycheck[] = { - 48, 49, 3, 32, 4, 5, 30, 7, 71, 72, - 10, 28, 16, 17, 33, 14, 40, 28, 29, 38, - 39, 69, 70, 34, 87, 28, 74, 75, 32, 77, - 41, 79, 130, 81, 132, 133, 32, 135, 39, 38, - 39, 139, 38, 39, 32, 143, 144, 32, 0, 1, - 32, 3, 4, 5, 6, 7, 8, 9, 10, 11, - 28, 29, 14, 15, 28, 32, 34, 35, 166, 31, - 32, 38, 39, 41, 28, 29, 76, 140, 126, 31, - 32, 0, 1, 32, 3, 4, 5, 6, 7, 8, - 9, 10, 11, 93, 32, 14, 15, 32, 28, 29, - 101, 102, 103, 38, 39, 32, 154, 80, 13, 82, - 83, 84, 31, 32, 4, 5, 6, 7, 8, 9, - 10, 11, 95, 96, 14, 15, 5, 6, 32, 8, - 9, 10, 11, 32, 28, 14, 15, 38, 39, 38, - 39, 31, 32, 54, 32, 14, 57, 56, 59, 58, - 12, 32, 31, 32, 16, 17, 39, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 55, 56, 32, 58, - 32, 56, 12, 58, 36, 37, 16, 17, 18, 19, - 20, 21, 56, 23, 58, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 21, - 54, 33 + 3, 30, 48, 49, 4, 5, 25, 7, 71, 72, + 10, 25, 124, 125, 126, 25, 26, 80, 130, 29, + 132, 16, 17, 69, 70, 35, 27, 25, 74, 75, + 14, 14, 78, 34, 146, 30, 39, 0, 1, 30, + 3, 4, 5, 6, 7, 8, 9, 10, 11, 32, + 33, 14, 15, 12, 56, 30, 58, 16, 17, 18, + 19, 20, 21, 30, 127, 32, 33, 30, 31, 55, + 56, 30, 58, 119, 0, 1, 76, 3, 4, 5, + 6, 7, 8, 9, 10, 11, 30, 87, 14, 15, + 30, 94, 95, 96, 140, 30, 4, 5, 6, 7, + 8, 9, 10, 11, 30, 31, 14, 15, 5, 6, + 30, 8, 9, 10, 11, 30, 54, 14, 15, 57, + 12, 59, 30, 31, 16, 17, 13, 19, 20, 21, + 22, 23, 25, 30, 31, 24, 25, 26, 30, 30, + 29, 32, 33, 28, 30, 31, 35, 32, 33, 30, + 30, 32, 33, 30, 33, 32, 33, 56, 56, 58, + 58, 25, 26, 25, 26, 32, 33, 30, 21, 30, + 30, 30, 30, 30, 30, 30, 54, 88, -1, 33 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const unsigned char yystos[] = { - 0, 43, 0, 1, 3, 4, 5, 6, 7, 8, - 9, 10, 11, 14, 15, 31, 32, 44, 45, 46, - 47, 48, 49, 52, 53, 55, 59, 61, 63, 64, - 66, 68, 69, 70, 71, 79, 79, 28, 29, 77, - 77, 77, 32, 77, 28, 28, 28, 29, 34, 41, - 81, 82, 50, 50, 56, 58, 62, 74, 67, 74, - 79, 32, 32, 32, 32, 32, 81, 81, 32, 38, - 39, 30, 40, 12, 16, 17, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 32, 36, 37, 51, 72, - 73, 75, 18, 19, 20, 21, 23, 32, 57, 73, - 75, 5, 8, 15, 45, 54, 78, 45, 55, 60, - 66, 78, 32, 75, 1, 45, 55, 65, 66, 78, - 33, 81, 81, 82, 82, 32, 35, 81, 81, 77, - 81, 76, 77, 81, 76, 81, 76, 76, 76, 28, - 82, 13, 32, 77, 28, 76, 76, 79, 79, 79, - 32, 81, 32, 32, 14, 80, 80, 32, 80, 80, - 32, 80, 32, 32, 32, 80, 82, 80, 80, 32, - 32, 32, 81, 32, 32, 32, 32, 32, 80, 32, - 32, 32 + 0, 37, 0, 1, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 14, 15, 30, 31, 38, 39, 40, + 41, 42, 43, 46, 47, 49, 53, 55, 57, 58, + 60, 62, 63, 64, 65, 73, 73, 25, 26, 71, + 71, 71, 30, 71, 25, 25, 25, 26, 29, 35, + 75, 76, 44, 44, 50, 52, 56, 68, 61, 68, + 73, 30, 30, 30, 30, 30, 75, 75, 30, 32, + 33, 27, 34, 12, 16, 17, 19, 20, 21, 22, + 23, 30, 45, 66, 67, 69, 18, 19, 20, 21, + 30, 51, 67, 69, 5, 8, 15, 39, 48, 72, + 39, 49, 54, 60, 72, 30, 69, 1, 39, 49, + 59, 60, 72, 28, 75, 75, 76, 76, 30, 24, + 75, 75, 71, 70, 71, 75, 25, 76, 13, 30, + 71, 70, 25, 73, 73, 73, 30, 75, 30, 30, + 14, 74, 30, 74, 74, 74, 76, 74, 30, 74, + 30, 75, 30, 30, 30, 74, 30, 30, 30 }; #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) @@ -1367,78 +1332,34 @@ yyreduce: case 27: { - menu_set_type(S_TRISTATE); - printd(DEBUG_PARSE, "%s:%d:tristate\n", zconf_curname(), zconf_lineno()); + menu_set_type((yyvsp[-2].id)->stype); + printd(DEBUG_PARSE, "%s:%d:type(%u)\n", + zconf_curname(), zconf_lineno(), + (yyvsp[-2].id)->stype); ;} break; case 28: - { - menu_add_expr(P_DEFAULT, (yyvsp[-2].expr), (yyvsp[-1].expr)); - menu_set_type(S_TRISTATE); - printd(DEBUG_PARSE, "%s:%d:def_boolean\n", zconf_curname(), zconf_lineno()); -;} - break; - - case 29: - - { - menu_set_type(S_BOOLEAN); - printd(DEBUG_PARSE, "%s:%d:boolean\n", zconf_curname(), zconf_lineno()); -;} - break; - - case 30: - - { - menu_add_expr(P_DEFAULT, (yyvsp[-2].expr), (yyvsp[-1].expr)); - menu_set_type(S_BOOLEAN); - printd(DEBUG_PARSE, "%s:%d:def_boolean\n", zconf_curname(), zconf_lineno()); -;} - break; - - case 31: - - { - menu_set_type(S_INT); - printd(DEBUG_PARSE, "%s:%d:int\n", zconf_curname(), zconf_lineno()); -;} - break; - - case 32: - - { - menu_set_type(S_HEX); - printd(DEBUG_PARSE, "%s:%d:hex\n", zconf_curname(), zconf_lineno()); -;} - break; - - case 33: - - { - menu_set_type(S_STRING); - printd(DEBUG_PARSE, "%s:%d:string\n", zconf_curname(), zconf_lineno()); -;} - break; - - case 34: - { menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr)); printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno()); ;} break; - case 35: + case 29: { menu_add_expr(P_DEFAULT, (yyvsp[-2].expr), (yyvsp[-1].expr)); - printd(DEBUG_PARSE, "%s:%d:default\n", zconf_curname(), zconf_lineno()); + if ((yyvsp[-3].id)->stype != S_UNKNOWN) + menu_set_type((yyvsp[-3].id)->stype); + printd(DEBUG_PARSE, "%s:%d:default(%u)\n", + zconf_curname(), zconf_lineno(), + (yyvsp[-3].id)->stype); ;} break; - case 36: + case 30: { menu_add_symbol(P_SELECT, sym_lookup((yyvsp[-2].string), 0), (yyvsp[-1].expr)); @@ -1446,7 +1367,7 @@ yyreduce: ;} break; - case 37: + case 31: { menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,(yyvsp[-3].symbol), (yyvsp[-2].symbol)), (yyvsp[-1].expr)); @@ -1454,7 +1375,7 @@ yyreduce: ;} break; - case 38: + case 32: { struct symbol *sym = sym_lookup(NULL, 0); @@ -1465,7 +1386,7 @@ yyreduce: ;} break; - case 39: + case 33: { menu_end_entry(); @@ -1473,7 +1394,7 @@ yyreduce: ;} break; - case 40: + case 34: { if (zconf_endtoken((yyvsp[0].token), T_CHOICE, T_ENDCHOICE)) { @@ -1483,7 +1404,7 @@ yyreduce: ;} break; - case 42: + case 36: { printf("%s:%d: missing 'endchoice' for this 'choice' statement\n", current_menu->file->name, current_menu->lineno); @@ -1491,7 +1412,7 @@ yyreduce: ;} break; - case 48: + case 42: { menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr)); @@ -1499,23 +1420,20 @@ yyreduce: ;} break; - case 49: - - { - menu_set_type(S_TRISTATE); - printd(DEBUG_PARSE, "%s:%d:tristate\n", zconf_curname(), zconf_lineno()); -;} - break; - - case 50: + case 43: { - menu_set_type(S_BOOLEAN); - printd(DEBUG_PARSE, "%s:%d:boolean\n", zconf_curname(), zconf_lineno()); + if ((yyvsp[-2].id)->stype == S_BOOLEAN || (yyvsp[-2].id)->stype == S_TRISTATE) { + menu_set_type((yyvsp[-2].id)->stype); + printd(DEBUG_PARSE, "%s:%d:type(%u)\n", + zconf_curname(), zconf_lineno(), + (yyvsp[-2].id)->stype); + } else + YYERROR; ;} break; - case 51: + case 44: { current_entry->sym->flags |= SYMBOL_OPTIONAL; @@ -1523,15 +1441,19 @@ yyreduce: ;} break; - case 52: + case 45: { - menu_add_symbol(P_DEFAULT, sym_lookup((yyvsp[-2].string), 0), (yyvsp[-1].expr)); - printd(DEBUG_PARSE, "%s:%d:default\n", zconf_curname(), zconf_lineno()); + if ((yyvsp[-3].id)->stype == S_UNKNOWN) { + menu_add_symbol(P_DEFAULT, sym_lookup((yyvsp[-2].string), 0), (yyvsp[-1].expr)); + printd(DEBUG_PARSE, "%s:%d:default\n", + zconf_curname(), zconf_lineno()); + } else + YYERROR; ;} break; - case 55: + case 48: { printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno()); @@ -1542,7 +1464,7 @@ yyreduce: ;} break; - case 56: + case 49: { if (zconf_endtoken((yyvsp[0].token), T_IF, T_ENDIF)) { @@ -1552,7 +1474,7 @@ yyreduce: ;} break; - case 58: + case 51: { printf("%s:%d: missing 'endif' for this 'if' statement\n", current_menu->file->name, current_menu->lineno); @@ -1560,7 +1482,7 @@ yyreduce: ;} break; - case 63: + case 56: { menu_add_entry(NULL); @@ -1569,7 +1491,7 @@ yyreduce: ;} break; - case 64: + case 57: { menu_end_entry(); @@ -1577,7 +1499,7 @@ yyreduce: ;} break; - case 65: + case 58: { if (zconf_endtoken((yyvsp[0].token), T_MENU, T_ENDMENU)) { @@ -1587,7 +1509,7 @@ yyreduce: ;} break; - case 67: + case 60: { printf("%s:%d: missing 'endmenu' for this 'menu' statement\n", current_menu->file->name, current_menu->lineno); @@ -1595,12 +1517,12 @@ yyreduce: ;} break; - case 72: + case 65: { zconfprint("invalid menu option"); yyerrok; ;} break; - case 73: + case 66: { (yyval.string) = (yyvsp[-1].string); @@ -1608,14 +1530,14 @@ yyreduce: ;} break; - case 74: + case 67: { zconf_nextfile((yyvsp[0].string)); ;} break; - case 75: + case 68: { menu_add_entry(NULL); @@ -1624,14 +1546,14 @@ yyreduce: ;} break; - case 76: + case 69: { menu_end_entry(); ;} break; - case 77: + case 70: { printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno()); @@ -1639,14 +1561,14 @@ yyreduce: ;} break; - case 78: + case 71: { current_entry->sym->help = (yyvsp[0].string); ;} break; - case 82: + case 75: { menu_add_dep((yyvsp[-1].expr)); @@ -1654,7 +1576,7 @@ yyreduce: ;} break; - case 83: + case 76: { menu_add_dep((yyvsp[-1].expr)); @@ -1662,7 +1584,7 @@ yyreduce: ;} break; - case 84: + case 77: { menu_add_dep((yyvsp[-1].expr)); @@ -1670,79 +1592,79 @@ yyreduce: ;} break; - case 86: + case 79: { menu_add_prompt(P_PROMPT, (yyvsp[-1].string), (yyvsp[0].expr)); ;} break; - case 89: + case 82: { (yyval.token) = T_ENDMENU; ;} break; - case 90: + case 83: { (yyval.token) = T_ENDCHOICE; ;} break; - case 91: + case 84: { (yyval.token) = T_ENDIF; ;} break; - case 94: + case 87: { (yyval.expr) = NULL; ;} break; - case 95: + case 88: { (yyval.expr) = (yyvsp[0].expr); ;} break; - case 96: + case 89: { (yyval.expr) = expr_alloc_symbol((yyvsp[0].symbol)); ;} break; - case 97: + case 90: { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); ;} break; - case 98: + case 91: { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); ;} break; - case 99: + case 92: { (yyval.expr) = (yyvsp[-1].expr); ;} break; - case 100: + case 93: { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[0].expr)); ;} break; - case 101: + case 94: { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[-2].expr), (yyvsp[0].expr)); ;} break; - case 102: + case 95: { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[-2].expr), (yyvsp[0].expr)); ;} break; - case 103: + case 96: { (yyval.symbol) = sym_lookup((yyvsp[0].string), 0); free((yyvsp[0].string)); ;} break; - case 104: + case 97: { (yyval.symbol) = sym_lookup((yyvsp[0].string), 1); free((yyvsp[0].string)); ;} break; diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y index 43021d436baf..1211781675b8 100644 --- a/scripts/kconfig/zconf.y +++ b/scripts/kconfig/zconf.y @@ -43,43 +43,38 @@ static struct menu *current_menu, *current_entry; struct symbol *symbol; struct expr *expr; struct menu *menu; + struct kconf_id *id; } -%token T_MAINMENU -%token T_MENU -%token T_ENDMENU -%token T_SOURCE -%token T_CHOICE -%token T_ENDCHOICE -%token T_COMMENT -%token T_CONFIG -%token T_MENUCONFIG -%token T_HELP +%token T_MAINMENU +%token T_MENU +%token T_ENDMENU +%token T_SOURCE +%token T_CHOICE +%token T_ENDCHOICE +%token T_COMMENT +%token T_CONFIG +%token T_MENUCONFIG +%token T_HELP %token T_HELPTEXT -%token T_IF -%token T_ENDIF -%token T_DEPENDS -%token T_REQUIRES -%token T_OPTIONAL -%token T_PROMPT -%token T_DEFAULT -%token T_TRISTATE -%token T_DEF_TRISTATE -%token T_BOOLEAN -%token T_DEF_BOOLEAN -%token T_STRING -%token T_INT -%token T_HEX +%token T_IF +%token T_ENDIF +%token T_DEPENDS +%token T_REQUIRES +%token T_OPTIONAL +%token T_PROMPT +%token T_TYPE +%token T_DEFAULT +%token T_SELECT +%token T_RANGE +%token T_ON %token T_WORD %token T_WORD_QUOTE %token T_UNEQUAL -%token T_EOF -%token T_EOL %token T_CLOSE_PAREN %token T_OPEN_PAREN -%token T_ON -%token T_SELECT -%token T_RANGE +%token T_EOL +%token T_EOF %left T_OR %left T_AND @@ -160,48 +155,12 @@ config_option_list: | config_option_list T_EOL ; -config_option: T_TRISTATE prompt_stmt_opt T_EOL -{ - menu_set_type(S_TRISTATE); - printd(DEBUG_PARSE, "%s:%d:tristate\n", zconf_curname(), zconf_lineno()); -}; - -config_option: T_DEF_TRISTATE expr if_expr T_EOL +config_option: T_TYPE prompt_stmt_opt T_EOL { - menu_add_expr(P_DEFAULT, $2, $3); - menu_set_type(S_TRISTATE); - printd(DEBUG_PARSE, "%s:%d:def_boolean\n", zconf_curname(), zconf_lineno()); -}; - -config_option: T_BOOLEAN prompt_stmt_opt T_EOL -{ - menu_set_type(S_BOOLEAN); - printd(DEBUG_PARSE, "%s:%d:boolean\n", zconf_curname(), zconf_lineno()); -}; - -config_option: T_DEF_BOOLEAN expr if_expr T_EOL -{ - menu_add_expr(P_DEFAULT, $2, $3); - menu_set_type(S_BOOLEAN); - printd(DEBUG_PARSE, "%s:%d:def_boolean\n", zconf_curname(), zconf_lineno()); -}; - -config_option: T_INT prompt_stmt_opt T_EOL -{ - menu_set_type(S_INT); - printd(DEBUG_PARSE, "%s:%d:int\n", zconf_curname(), zconf_lineno()); -}; - -config_option: T_HEX prompt_stmt_opt T_EOL -{ - menu_set_type(S_HEX); - printd(DEBUG_PARSE, "%s:%d:hex\n", zconf_curname(), zconf_lineno()); -}; - -config_option: T_STRING prompt_stmt_opt T_EOL -{ - menu_set_type(S_STRING); - printd(DEBUG_PARSE, "%s:%d:string\n", zconf_curname(), zconf_lineno()); + menu_set_type($1->stype); + printd(DEBUG_PARSE, "%s:%d:type(%u)\n", + zconf_curname(), zconf_lineno(), + $1->stype); }; config_option: T_PROMPT prompt if_expr T_EOL @@ -213,7 +172,11 @@ config_option: T_PROMPT prompt if_expr T_EOL config_option: T_DEFAULT expr if_expr T_EOL { menu_add_expr(P_DEFAULT, $2, $3); - printd(DEBUG_PARSE, "%s:%d:default\n", zconf_curname(), zconf_lineno()); + if ($1->stype != S_UNKNOWN) + menu_set_type($1->stype); + printd(DEBUG_PARSE, "%s:%d:default(%u)\n", + zconf_curname(), zconf_lineno(), + $1->stype); }; config_option: T_SELECT T_WORD if_expr T_EOL @@ -275,16 +238,15 @@ choice_option: T_PROMPT prompt if_expr T_EOL printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno()); }; -choice_option: T_TRISTATE prompt_stmt_opt T_EOL -{ - menu_set_type(S_TRISTATE); - printd(DEBUG_PARSE, "%s:%d:tristate\n", zconf_curname(), zconf_lineno()); -}; - -choice_option: T_BOOLEAN prompt_stmt_opt T_EOL +choice_option: T_TYPE prompt_stmt_opt T_EOL { - menu_set_type(S_BOOLEAN); - printd(DEBUG_PARSE, "%s:%d:boolean\n", zconf_curname(), zconf_lineno()); + if ($1->stype == S_BOOLEAN || $1->stype == S_TRISTATE) { + menu_set_type($1->stype); + printd(DEBUG_PARSE, "%s:%d:type(%u)\n", + zconf_curname(), zconf_lineno(), + $1->stype); + } else + YYERROR; }; choice_option: T_OPTIONAL T_EOL @@ -295,8 +257,12 @@ choice_option: T_OPTIONAL T_EOL choice_option: T_DEFAULT T_WORD if_expr T_EOL { - menu_add_symbol(P_DEFAULT, sym_lookup($2, 0), $3); - printd(DEBUG_PARSE, "%s:%d:default\n", zconf_curname(), zconf_lineno()); + if ($1->stype == S_UNKNOWN) { + menu_add_symbol(P_DEFAULT, sym_lookup($2, 0), $3); + printd(DEBUG_PARSE, "%s:%d:default\n", + zconf_curname(), zconf_lineno()); + } else + YYERROR; }; choice_block: -- cgit v1.2.2 From a02f0570ae201c495ee991b959bb974af18f35cc Mon Sep 17 00:00:00 2001 From: Roman Zippel Date: Tue, 8 Nov 2005 21:34:53 -0800 Subject: [PATCH] kconfig: improve error handling in the parser Add a few error tokens to the parser to catch common errors and print more descriptive error messages. Signed-off-by: Roman Zippel Cc: Sam Ravnborg Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- scripts/kconfig/lex.zconf.c_shipped | 57 ++-- scripts/kconfig/lkc.h | 2 +- scripts/kconfig/menu.c | 5 +- scripts/kconfig/zconf.l | 42 ++- scripts/kconfig/zconf.tab.c_shipped | 657 ++++++++++++++++++++---------------- scripts/kconfig/zconf.y | 173 ++++++---- 6 files changed, 515 insertions(+), 421 deletions(-) diff --git a/scripts/kconfig/lex.zconf.c_shipped b/scripts/kconfig/lex.zconf.c_shipped index bedba89a87c6..24e3c8cbb7ac 100644 --- a/scripts/kconfig/lex.zconf.c_shipped +++ b/scripts/kconfig/lex.zconf.c_shipped @@ -323,7 +323,7 @@ void zconffree (void * ); /* Begin user sect3 */ -#define zconfwrap(n) 1 +#define zconfwrap() 1 #define YY_SKIP_YYWRAP typedef unsigned char YY_CHAR; @@ -686,10 +686,10 @@ struct yy_trans_info static yyconst flex_int16_t yy_accept[61] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 34, 5, 4, 3, 2, 7, 8, 6, 32, 29, + 34, 5, 4, 2, 3, 7, 8, 6, 32, 29, 31, 24, 28, 27, 26, 22, 17, 13, 16, 20, - 22, 11, 12, 19, 19, 14, 22, 22, 4, 3, - 2, 2, 1, 6, 32, 29, 31, 30, 24, 23, + 22, 11, 12, 19, 19, 14, 22, 22, 4, 2, + 3, 3, 1, 6, 32, 29, 31, 30, 24, 23, 26, 25, 15, 20, 9, 19, 19, 21, 10, 18 } ; @@ -753,6 +753,11 @@ char *zconftext; #define START_STRSIZE 16 +static struct { + struct file *file; + int lineno; +} current_pos; + static char *text; static int text_size, text_asize; @@ -766,7 +771,7 @@ struct buffer *current_buf; static int last_ts, first_ts; static void zconf_endhelp(void); -static struct buffer *zconf_endfile(void); +static void zconf_endfile(void); void new_string(void) { @@ -993,17 +998,17 @@ do_action: /* This label is used only to access EOF actions. */ { /* beginning of action switch */ case 1: /* rule 1 can match eol */ -YY_RULE_SETUP -current_file->lineno++; - YY_BREAK case 2: +/* rule 2 can match eol */ YY_RULE_SETUP - +{ + current_file->lineno++; + return T_EOL; +} YY_BREAK case 3: -/* rule 3 can match eol */ YY_RULE_SETUP -current_file->lineno++; return T_EOL; + YY_BREAK case 4: YY_RULE_SETUP @@ -1023,8 +1028,10 @@ case 6: YY_RULE_SETUP { struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng); + BEGIN(PARAM); + current_pos.file = current_file; + current_pos.lineno = current_file->lineno; if (id && id->flags & TF_COMMAND) { - BEGIN(PARAM); zconflval.id = id; return id->token; } @@ -1040,7 +1047,11 @@ YY_RULE_SETUP case 8: /* rule 8 can match eol */ YY_RULE_SETUP -current_file->lineno++; BEGIN(INITIAL); +{ + BEGIN(INITIAL); + current_file->lineno++; + return T_EOL; + } YY_BREAK case 9: @@ -1246,9 +1257,9 @@ case YY_STATE_EOF(HELP): case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(COMMAND): { - if (current_buf) { + if (current_file) { zconf_endfile(); - return T_EOF; + return T_EOL; } fclose(zconfin); yyterminate(); @@ -1958,7 +1969,7 @@ YY_BUFFER_STATE zconf_scan_buffer (char * base, yy_size_t size ) /** Setup the input buffer state to scan a string. The next call to zconflex() will * scan from a @e copy of @a str. - * @param str a NUL-terminated string to scan + * @param yy_str a NUL-terminated string to scan * * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use @@ -2276,7 +2287,7 @@ void zconf_nextfile(const char *name) current_file = file; } -static struct buffer *zconf_endfile(void) +static void zconf_endfile(void) { struct buffer *parent; @@ -2292,23 +2303,15 @@ static struct buffer *zconf_endfile(void) } free(current_buf); current_buf = parent; - - return parent; } int zconf_lineno(void) { - if (current_buf) - return current_file->lineno - 1; - else - return 0; + return current_pos.lineno; } char *zconf_curname(void) { - if (current_buf) - return current_file->name; - else - return ""; + return current_pos.file ? current_pos.file->name : ""; } diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h index 91491d0a3029..ca02eb42eeb3 100644 --- a/scripts/kconfig/lkc.h +++ b/scripts/kconfig/lkc.h @@ -70,7 +70,7 @@ void kconfig_load(void); /* menu.c */ void menu_init(void); -void menu_add_menu(void); +struct menu *menu_add_menu(void); void menu_end_menu(void); void menu_add_entry(struct symbol *sym); void menu_end_entry(void); diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index c2a423a1c341..0fce20cb7f3c 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c @@ -61,10 +61,11 @@ void menu_end_entry(void) { } -void menu_add_menu(void) +struct menu *menu_add_menu(void) { - current_menu = current_entry; + menu_end_entry(); last_entry_ptr = ¤t_entry->list; + return current_menu = current_entry; } void menu_end_menu(void) diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l index cfcfabd7a069..cfa46077c6b4 100644 --- a/scripts/kconfig/zconf.l +++ b/scripts/kconfig/zconf.l @@ -18,6 +18,11 @@ #define START_STRSIZE 16 +static struct { + struct file *file; + int lineno; +} current_pos; + static char *text; static int text_size, text_asize; @@ -31,7 +36,7 @@ struct buffer *current_buf; static int last_ts, first_ts; static void zconf_endhelp(void); -static struct buffer *zconf_endfile(void); +static void zconf_endfile(void); void new_string(void) { @@ -70,10 +75,13 @@ n [A-Za-z0-9_] int str = 0; int ts, i; -[ \t]*#.*\n current_file->lineno++; +[ \t]*#.*\n | +[ \t]*\n { + current_file->lineno++; + return T_EOL; +} [ \t]*#.* -[ \t]*\n current_file->lineno++; return T_EOL; [ \t]+ { BEGIN(COMMAND); @@ -88,8 +96,10 @@ n [A-Za-z0-9_] { {n}+ { struct kconf_id *id = kconf_id_lookup(yytext, yyleng); + BEGIN(PARAM); + current_pos.file = current_file; + current_pos.lineno = current_file->lineno; if (id && id->flags & TF_COMMAND) { - BEGIN(PARAM); zconflval.id = id; return id->token; } @@ -98,7 +108,11 @@ n [A-Za-z0-9_] return T_WORD; } . - \n current_file->lineno++; BEGIN(INITIAL); + \n { + BEGIN(INITIAL); + current_file->lineno++; + return T_EOL; + } } { @@ -214,9 +228,9 @@ n [A-Za-z0-9_] } <> { - if (current_buf) { + if (current_file) { zconf_endfile(); - return T_EOF; + return T_EOL; } fclose(yyin); yyterminate(); @@ -307,7 +321,7 @@ void zconf_nextfile(const char *name) current_file = file; } -static struct buffer *zconf_endfile(void) +static void zconf_endfile(void) { struct buffer *parent; @@ -323,22 +337,14 @@ static struct buffer *zconf_endfile(void) } free(current_buf); current_buf = parent; - - return parent; } int zconf_lineno(void) { - if (current_buf) - return current_file->lineno - 1; - else - return 0; + return current_pos.lineno; } char *zconf_curname(void) { - if (current_buf) - return current_file->name; - else - return ""; + return current_pos.file ? current_pos.file->name : ""; } diff --git a/scripts/kconfig/zconf.tab.c_shipped b/scripts/kconfig/zconf.tab.c_shipped index 3fc296274c98..ea7755da82f5 100644 --- a/scripts/kconfig/zconf.tab.c_shipped +++ b/scripts/kconfig/zconf.tab.c_shipped @@ -89,11 +89,10 @@ T_CLOSE_PAREN = 283, T_OPEN_PAREN = 284, T_EOL = 285, - T_EOF = 286, - T_OR = 287, - T_AND = 288, - T_EQUAL = 289, - T_NOT = 290 + T_OR = 286, + T_AND = 287, + T_EQUAL = 288, + T_NOT = 289 }; #endif #define T_MAINMENU 258 @@ -124,11 +123,10 @@ #define T_CLOSE_PAREN 283 #define T_OPEN_PAREN 284 #define T_EOL 285 -#define T_EOF 286 -#define T_OR 287 -#define T_AND 288 -#define T_EQUAL 289 -#define T_NOT 290 +#define T_OR 286 +#define T_AND 287 +#define T_EQUAL 288 +#define T_NOT 289 @@ -162,14 +160,18 @@ int cdebug = PRINTD; extern int zconflex(void); static void zconfprint(const char *err, ...); +static void zconf_error(const char *err, ...); static void zconferror(const char *err); -static bool zconf_endtoken(int token, int starttoken, int endtoken); +static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken); struct symbol *symbol_hash[257]; static struct menu *current_menu, *current_entry; +#define YYDEBUG 0 +#if YYDEBUG #define YYERROR_VERBOSE +#endif /* Enabling traces. */ @@ -188,8 +190,8 @@ static struct menu *current_menu, *current_entry; #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) typedef union YYSTYPE { - int token; char *string; + struct file *file; struct symbol *symbol; struct expr *expr; struct menu *menu; @@ -308,22 +310,22 @@ union yyalloc #endif /* YYFINAL -- State number of the termination state. */ -#define YYFINAL 2 +#define YYFINAL 3 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 179 +#define YYLAST 264 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 36 +#define YYNTOKENS 35 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 41 +#define YYNNTS 42 /* YYNRULES -- Number of rules. */ -#define YYNRULES 97 +#define YYNRULES 104 /* YYNRULES -- Number of states. */ -#define YYNSTATES 159 +#define YYNSTATES 175 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 290 +#define YYMAXUTOK 289 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -359,8 +361,7 @@ static const unsigned char yytranslate[] = 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35 + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34 }; #if YYDEBUG @@ -368,65 +369,70 @@ static const unsigned char yytranslate[] = YYRHS. */ static const unsigned short int yyprhs[] = { - 0, 0, 3, 4, 7, 9, 11, 13, 17, 19, - 21, 23, 26, 28, 30, 32, 34, 36, 38, 42, - 45, 49, 52, 53, 56, 59, 62, 65, 69, 74, - 79, 84, 90, 93, 96, 98, 102, 105, 106, 109, - 112, 115, 118, 123, 127, 130, 135, 136, 139, 143, - 145, 149, 152, 153, 156, 159, 162, 166, 169, 171, - 175, 178, 179, 182, 185, 188, 192, 196, 198, 202, - 205, 208, 211, 212, 215, 218, 223, 227, 231, 232, - 235, 237, 239, 242, 245, 248, 250, 252, 253, 256, - 258, 262, 266, 270, 273, 277, 281, 283 + 0, 0, 3, 5, 6, 9, 12, 15, 20, 23, + 28, 33, 37, 39, 41, 43, 45, 47, 49, 51, + 53, 55, 57, 59, 61, 63, 67, 70, 74, 77, + 81, 84, 85, 88, 91, 94, 97, 100, 104, 109, + 114, 119, 125, 128, 131, 133, 137, 138, 141, 144, + 147, 150, 153, 158, 162, 165, 170, 171, 174, 178, + 180, 184, 185, 188, 191, 194, 198, 201, 203, 207, + 208, 211, 214, 217, 221, 225, 228, 231, 234, 235, + 238, 241, 244, 249, 253, 257, 258, 261, 263, 265, + 268, 271, 274, 276, 279, 280, 283, 285, 289, 293, + 297, 300, 304, 308, 310 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yysigned_char yyrhs[] = { - 37, 0, -1, -1, 37, 38, -1, 39, -1, 49, - -1, 60, -1, 3, 71, 73, -1, 5, -1, 15, - -1, 8, -1, 1, 73, -1, 55, -1, 65, -1, - 41, -1, 43, -1, 63, -1, 73, -1, 10, 25, - 30, -1, 40, 44, -1, 11, 25, 30, -1, 42, - 44, -1, -1, 44, 45, -1, 44, 69, -1, 44, - 67, -1, 44, 30, -1, 20, 70, 30, -1, 19, - 71, 74, 30, -1, 21, 75, 74, 30, -1, 22, - 25, 74, 30, -1, 23, 76, 76, 74, 30, -1, - 7, 30, -1, 46, 50, -1, 72, -1, 47, 52, - 48, -1, 47, 52, -1, -1, 50, 51, -1, 50, - 69, -1, 50, 67, -1, 50, 30, -1, 19, 71, - 74, 30, -1, 20, 70, 30, -1, 18, 30, -1, - 21, 25, 74, 30, -1, -1, 52, 39, -1, 14, - 75, 30, -1, 72, -1, 53, 56, 54, -1, 53, - 56, -1, -1, 56, 39, -1, 56, 60, -1, 56, - 49, -1, 4, 71, 30, -1, 57, 68, -1, 72, - -1, 58, 61, 59, -1, 58, 61, -1, -1, 61, - 39, -1, 61, 60, -1, 61, 49, -1, 61, 1, - 30, -1, 6, 71, 30, -1, 62, -1, 9, 71, - 30, -1, 64, 68, -1, 12, 30, -1, 66, 13, - -1, -1, 68, 69, -1, 68, 30, -1, 16, 24, - 75, 30, -1, 16, 75, 30, -1, 17, 75, 30, - -1, -1, 71, 74, -1, 25, -1, 26, -1, 5, - 73, -1, 8, 73, -1, 15, 73, -1, 30, -1, - 31, -1, -1, 14, 75, -1, 76, -1, 76, 34, - 76, -1, 76, 27, 76, -1, 29, 75, 28, -1, - 35, 75, -1, 75, 32, 75, -1, 75, 33, 75, - -1, 25, -1, 26, -1 + 36, 0, -1, 37, -1, -1, 37, 39, -1, 37, + 50, -1, 37, 61, -1, 37, 3, 71, 73, -1, + 37, 72, -1, 37, 25, 1, 30, -1, 37, 38, + 1, 30, -1, 37, 1, 30, -1, 16, -1, 19, + -1, 20, -1, 22, -1, 18, -1, 23, -1, 21, + -1, 30, -1, 56, -1, 65, -1, 42, -1, 44, + -1, 63, -1, 25, 1, 30, -1, 1, 30, -1, + 10, 25, 30, -1, 41, 45, -1, 11, 25, 30, + -1, 43, 45, -1, -1, 45, 46, -1, 45, 69, + -1, 45, 67, -1, 45, 40, -1, 45, 30, -1, + 20, 70, 30, -1, 19, 71, 74, 30, -1, 21, + 75, 74, 30, -1, 22, 25, 74, 30, -1, 23, + 76, 76, 74, 30, -1, 7, 30, -1, 47, 51, + -1, 72, -1, 48, 53, 49, -1, -1, 51, 52, + -1, 51, 69, -1, 51, 67, -1, 51, 30, -1, + 51, 40, -1, 19, 71, 74, 30, -1, 20, 70, + 30, -1, 18, 30, -1, 21, 25, 74, 30, -1, + -1, 53, 39, -1, 14, 75, 73, -1, 72, -1, + 54, 57, 55, -1, -1, 57, 39, -1, 57, 61, + -1, 57, 50, -1, 4, 71, 30, -1, 58, 68, + -1, 72, -1, 59, 62, 60, -1, -1, 62, 39, + -1, 62, 61, -1, 62, 50, -1, 6, 71, 30, + -1, 9, 71, 30, -1, 64, 68, -1, 12, 30, + -1, 66, 13, -1, -1, 68, 69, -1, 68, 30, + -1, 68, 40, -1, 16, 24, 75, 30, -1, 16, + 75, 30, -1, 17, 75, 30, -1, -1, 71, 74, + -1, 25, -1, 26, -1, 5, 30, -1, 8, 30, + -1, 15, 30, -1, 30, -1, 73, 30, -1, -1, + 14, 75, -1, 76, -1, 76, 33, 76, -1, 76, + 27, 76, -1, 29, 75, 28, -1, 34, 75, -1, + 75, 31, 75, -1, 75, 32, 75, -1, 25, -1, + 26, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const unsigned short int yyrline[] = { - 0, 92, 92, 93, 96, 97, 98, 99, 100, 101, - 102, 103, 107, 108, 109, 110, 111, 112, 118, 126, - 132, 140, 150, 152, 153, 154, 155, 158, 166, 172, - 182, 188, 196, 205, 211, 220, 221, 227, 229, 230, - 231, 232, 235, 241, 252, 258, 268, 270, 275, 284, - 293, 294, 300, 302, 303, 304, 309, 316, 322, 331, - 332, 338, 340, 341, 342, 343, 346, 352, 359, 366, - 373, 379, 386, 387, 388, 391, 396, 401, 409, 411, - 416, 417, 420, 421, 422, 426, 426, 428, 429, 432, - 433, 434, 435, 436, 437, 438, 441, 442 + 0, 103, 103, 105, 107, 108, 109, 110, 111, 112, + 113, 117, 121, 121, 121, 121, 121, 121, 121, 125, + 126, 127, 128, 129, 130, 134, 135, 141, 149, 155, + 163, 173, 175, 176, 177, 178, 179, 182, 190, 196, + 206, 212, 220, 229, 234, 242, 245, 247, 248, 249, + 250, 251, 254, 260, 271, 277, 287, 289, 294, 302, + 310, 313, 315, 316, 317, 322, 329, 334, 342, 345, + 347, 348, 349, 352, 360, 367, 374, 380, 387, 389, + 390, 391, 394, 399, 404, 412, 414, 419, 420, 423, + 424, 425, 429, 430, 433, 434, 437, 438, 439, 440, + 441, 442, 443, 446, 447 }; #endif @@ -440,16 +446,16 @@ static const char *const yytname[] = "T_MENUCONFIG", "T_HELP", "T_HELPTEXT", "T_IF", "T_ENDIF", "T_DEPENDS", "T_REQUIRES", "T_OPTIONAL", "T_PROMPT", "T_TYPE", "T_DEFAULT", "T_SELECT", "T_RANGE", "T_ON", "T_WORD", "T_WORD_QUOTE", "T_UNEQUAL", - "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_EOL", "T_EOF", "T_OR", "T_AND", - "T_EQUAL", "T_NOT", "$accept", "input", "block", "common_block", - "config_entry_start", "config_stmt", "menuconfig_entry_start", - "menuconfig_stmt", "config_option_list", "config_option", "choice", - "choice_entry", "choice_end", "choice_stmt", "choice_option_list", - "choice_option", "choice_block", "if", "if_end", "if_stmt", "if_block", - "menu", "menu_entry", "menu_end", "menu_stmt", "menu_block", "source", - "source_stmt", "comment", "comment_stmt", "help_start", "help", - "depends_list", "depends", "prompt_stmt_opt", "prompt", "end", - "nl_or_eof", "if_expr", "expr", "symbol", 0 + "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_EOL", "T_OR", "T_AND", "T_EQUAL", + "T_NOT", "$accept", "input", "stmt_list", "option_name", "common_stmt", + "option_error", "config_entry_start", "config_stmt", + "menuconfig_entry_start", "menuconfig_stmt", "config_option_list", + "config_option", "choice", "choice_entry", "choice_end", "choice_stmt", + "choice_option_list", "choice_option", "choice_block", "if_entry", + "if_end", "if_stmt", "if_block", "menu", "menu_entry", "menu_end", + "menu_stmt", "menu_block", "source_stmt", "comment", "comment_stmt", + "help_start", "help", "depends_list", "depends", "prompt_stmt_opt", + "prompt", "end", "nl", "if_expr", "expr", "symbol", 0 }; #endif @@ -461,38 +467,40 @@ static const unsigned short int yytoknum[] = 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290 + 285, 286, 287, 288, 289 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const unsigned char yyr1[] = { - 0, 36, 37, 37, 38, 38, 38, 38, 38, 38, - 38, 38, 39, 39, 39, 39, 39, 39, 40, 41, - 42, 43, 44, 44, 44, 44, 44, 45, 45, 45, - 45, 45, 46, 47, 48, 49, 49, 50, 50, 50, - 50, 50, 51, 51, 51, 51, 52, 52, 53, 54, - 55, 55, 56, 56, 56, 56, 57, 58, 59, 60, - 60, 61, 61, 61, 61, 61, 62, 63, 64, 65, - 66, 67, 68, 68, 68, 69, 69, 69, 70, 70, - 71, 71, 72, 72, 72, 73, 73, 74, 74, 75, - 75, 75, 75, 75, 75, 75, 76, 76 + 0, 35, 36, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 38, 38, 38, 38, 38, 38, 38, 39, + 39, 39, 39, 39, 39, 40, 40, 41, 42, 43, + 44, 45, 45, 45, 45, 45, 45, 46, 46, 46, + 46, 46, 47, 48, 49, 50, 51, 51, 51, 51, + 51, 51, 52, 52, 52, 52, 53, 53, 54, 55, + 56, 57, 57, 57, 57, 58, 59, 60, 61, 62, + 62, 62, 62, 63, 64, 65, 66, 67, 68, 68, + 68, 68, 69, 69, 69, 70, 70, 71, 71, 72, + 72, 72, 73, 73, 74, 74, 75, 75, 75, 75, + 75, 75, 75, 76, 76 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const unsigned char yyr2[] = { - 0, 2, 0, 2, 1, 1, 1, 3, 1, 1, - 1, 2, 1, 1, 1, 1, 1, 1, 3, 2, - 3, 2, 0, 2, 2, 2, 2, 3, 4, 4, - 4, 5, 2, 2, 1, 3, 2, 0, 2, 2, + 0, 2, 1, 0, 2, 2, 2, 4, 2, 4, + 4, 3, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 3, 2, 3, 2, 3, + 2, 0, 2, 2, 2, 2, 2, 3, 4, 4, + 4, 5, 2, 2, 1, 3, 0, 2, 2, 2, 2, 2, 4, 3, 2, 4, 0, 2, 3, 1, - 3, 2, 0, 2, 2, 2, 3, 2, 1, 3, - 2, 0, 2, 2, 2, 3, 3, 1, 3, 2, - 2, 2, 0, 2, 2, 4, 3, 3, 0, 2, - 1, 1, 2, 2, 2, 1, 1, 0, 2, 1, - 3, 3, 3, 2, 3, 3, 1, 1 + 3, 0, 2, 2, 2, 3, 2, 1, 3, 0, + 2, 2, 2, 3, 3, 2, 2, 2, 0, 2, + 2, 2, 4, 3, 3, 0, 2, 1, 1, 2, + 2, 2, 1, 2, 0, 2, 1, 3, 3, 3, + 2, 3, 3, 1, 1 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -500,136 +508,160 @@ static const unsigned char yyr2[] = means the default is an error. */ static const unsigned char yydefact[] = { - 2, 0, 1, 0, 0, 0, 8, 0, 0, 10, - 0, 0, 0, 0, 9, 85, 86, 3, 4, 22, - 14, 22, 15, 37, 46, 5, 52, 12, 72, 61, - 6, 67, 16, 72, 13, 17, 11, 80, 81, 0, - 0, 0, 32, 0, 0, 0, 96, 97, 0, 0, - 0, 89, 19, 21, 33, 36, 51, 57, 0, 69, - 7, 56, 66, 68, 18, 20, 0, 93, 48, 0, - 0, 0, 0, 0, 0, 0, 0, 78, 0, 0, - 0, 26, 23, 0, 25, 24, 0, 0, 78, 0, - 41, 38, 40, 39, 0, 0, 0, 47, 35, 34, - 53, 55, 50, 54, 49, 74, 73, 0, 62, 64, - 59, 63, 58, 92, 94, 95, 91, 90, 70, 0, - 0, 0, 87, 0, 87, 87, 87, 0, 71, 44, - 87, 0, 87, 82, 83, 84, 65, 0, 76, 77, - 0, 0, 27, 79, 0, 0, 87, 0, 43, 0, - 75, 88, 28, 29, 30, 0, 42, 45, 31 + 3, 0, 0, 1, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 12, 16, 13, 14, + 18, 15, 17, 0, 19, 0, 4, 31, 22, 31, + 23, 46, 56, 5, 61, 20, 78, 69, 6, 24, + 78, 21, 8, 11, 87, 88, 0, 0, 89, 0, + 42, 90, 0, 0, 0, 103, 104, 0, 0, 0, + 96, 91, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 92, 7, 65, 73, 74, 27, 29, 0, + 100, 0, 0, 58, 0, 0, 9, 10, 0, 0, + 0, 0, 0, 85, 0, 0, 0, 0, 36, 35, + 32, 0, 34, 33, 0, 0, 85, 0, 50, 51, + 47, 49, 48, 57, 45, 44, 62, 64, 60, 63, + 59, 80, 81, 79, 70, 72, 68, 71, 67, 93, + 99, 101, 102, 98, 97, 26, 76, 0, 0, 0, + 94, 0, 94, 94, 94, 0, 0, 77, 54, 94, + 0, 94, 0, 83, 84, 0, 0, 37, 86, 0, + 0, 94, 25, 0, 53, 0, 82, 95, 38, 39, + 40, 0, 52, 55, 41 }; /* YYDEFGOTO[NTERM-NUM]. */ static const short int yydefgoto[] = { - -1, 1, 17, 18, 19, 20, 21, 22, 52, 82, - 23, 24, 98, 25, 54, 91, 55, 26, 102, 27, - 56, 28, 29, 110, 30, 58, 31, 32, 33, 34, - 83, 84, 57, 85, 123, 124, 99, 35, 141, 50, - 51 + -1, 1, 2, 25, 26, 99, 27, 28, 29, 30, + 64, 100, 31, 32, 114, 33, 66, 110, 67, 34, + 118, 35, 68, 36, 37, 126, 38, 70, 39, 40, + 41, 101, 102, 69, 103, 141, 142, 42, 73, 156, + 59, 60 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -113 +#define YYPACT_NINF -78 static const short int yypact[] = { - -113, 37, -113, 114, 136, 136, -113, 136, -29, -113, - 136, -19, -14, -10, -113, -113, -113, -113, -113, -113, - -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, - -113, -113, -113, -113, -113, -113, -113, -113, -113, 114, - 9, 25, -113, 56, 60, 65, -113, -113, -10, -10, - 33, -1, 108, 108, 41, 103, 92, 5, 74, 5, - -113, -113, -113, -113, -113, -113, 115, -113, -113, -10, - -10, 138, 138, 80, 111, -10, 136, 136, -10, 2, - 138, -113, -113, 113, -113, -113, 85, 136, 136, 107, - -113, -113, -113, -113, 114, 114, 114, -113, -113, -113, - -113, -113, -113, -113, -113, -113, -113, 120, -113, -113, - -113, -113, -113, -113, 121, -113, -113, -113, -113, -10, - 109, 119, 16, 137, 16, 17, 16, 138, -113, -113, - 16, 139, 16, -113, -113, -113, -113, 123, -113, -113, - -10, 140, -113, -113, 141, 142, 16, 143, -113, 144, - -113, 133, -113, -113, -113, 145, -113, -113, -113 + -78, 2, 159, -78, -21, 0, 0, -12, 0, 1, + 4, 0, 27, 38, 60, 58, -78, -78, -78, -78, + -78, -78, -78, 100, -78, 104, -78, -78, -78, -78, + -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, + -78, -78, -78, -78, -78, -78, 86, 113, -78, 114, + -78, -78, 125, 127, 128, -78, -78, 60, 60, 210, + 65, -78, 141, 142, 39, 103, 182, 200, 6, 66, + 6, 131, -78, 146, -78, -78, -78, -78, -78, 196, + -78, 60, 60, 146, 40, 40, -78, -78, 155, 156, + -2, 60, 0, 0, 60, 105, 40, 194, -78, -78, + -78, 206, -78, -78, 183, 0, 0, 195, -78, -78, + -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, + -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, + -78, 197, -78, -78, -78, -78, -78, 60, 213, 216, + 212, 203, 212, 190, 212, 40, 208, -78, -78, 212, + 222, 212, 219, -78, -78, 60, 223, -78, -78, 224, + 225, 212, -78, 226, -78, 227, -78, 47, -78, -78, + -78, 228, -78, -78, -78 }; /* YYPGOTO[NTERM-NUM]. */ static const short int yypgoto[] = { - -113, -113, -113, 14, -113, -113, -113, -113, 147, -113, - -113, -113, -113, -2, -113, -113, -113, -113, -113, -113, - -113, -113, -113, -113, 101, -113, -113, -113, -113, -113, - -113, 122, 146, 62, 89, 0, 102, -3, -112, -46, - -63 + -78, -78, -78, -78, 164, -36, -78, -78, -78, -78, + 230, -78, -78, -78, -78, 29, -78, -78, -78, -78, + -78, -78, -78, -78, -78, -78, 59, -78, -78, -78, + -78, -78, 198, 220, 24, 157, -5, 169, 202, 74, + -53, -77 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -61 +#define YYTABLE_NINF -76 static const short int yytable[] = { - 36, 42, 66, 67, 39, 40, 44, 41, 116, 117, - 43, 45, 143, 144, 145, 46, 47, 127, 147, 48, - 149, 74, 75, 114, 115, 49, 71, 126, 120, 121, - 140, 140, 125, 72, 155, 105, 60, 2, 3, 61, - 4, 5, 6, 7, 8, 9, 10, 11, 12, 69, - 70, 13, 14, 73, 101, 62, 109, 74, 75, 86, - 87, 88, 89, 68, 146, 69, 70, 15, 16, 97, - 100, 90, 108, 137, -60, 107, 122, -60, 5, 94, - 7, 8, 95, 10, 11, 12, 63, 130, 13, 96, - 64, 133, 134, 135, 151, 65, 5, 94, 7, 8, - 95, 10, 11, 12, 15, 16, 13, 96, 94, 7, - 118, 95, 10, 11, 12, 129, 93, 13, 96, 106, - 73, 106, 15, 16, 74, 75, 128, 76, 77, 78, - 79, 80, 132, 15, 16, 119, 46, 47, 81, 138, - 48, 69, 70, 113, 15, 16, 49, 69, 70, 139, - 136, 69, 70, 150, 70, 69, 70, 103, 104, 111, - 112, 37, 38, 46, 47, 69, 70, 142, 53, 148, - 152, 153, 154, 156, 157, 158, 92, 131, 0, 59 + 46, 47, 3, 49, 79, 80, 52, 133, 134, 43, + 6, 7, 8, 9, 10, 11, 12, 13, 48, 145, + 14, 15, 137, 55, 56, 44, 45, 57, 131, 132, + 109, 50, 58, 122, 51, 122, 24, 138, 139, -28, + 88, 143, -28, -28, -28, -28, -28, -28, -28, -28, + -28, 89, 53, -28, -28, 90, 91, -28, 92, 93, + 94, 95, 96, 54, 97, 55, 56, 88, 161, 98, + -66, -66, -66, -66, -66, -66, -66, -66, 81, 82, + -66, -66, 90, 91, 152, 55, 56, 140, 61, 57, + 112, 97, 84, 123, 58, 123, 121, 117, 85, 125, + 149, 62, 167, -30, 88, 63, -30, -30, -30, -30, + -30, -30, -30, -30, -30, 89, 72, -30, -30, 90, + 91, -30, 92, 93, 94, 95, 96, 119, 97, 127, + 144, -75, 88, 98, -75, -75, -75, -75, -75, -75, + -75, -75, -75, 74, 75, -75, -75, 90, 91, -75, + -75, -75, -75, -75, -75, 76, 97, 77, 78, -2, + 4, 121, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 86, 87, 14, 15, 16, 129, 17, 18, 19, + 20, 21, 22, 88, 23, 135, 136, -43, -43, 24, + -43, -43, -43, -43, 89, 146, -43, -43, 90, 91, + 104, 105, 106, 107, 155, 7, 8, 97, 10, 11, + 12, 13, 108, 148, 14, 15, 158, 159, 160, 147, + 151, 81, 82, 163, 130, 165, 155, 81, 82, 82, + 24, 113, 116, 157, 124, 171, 115, 120, 162, 128, + 72, 81, 82, 153, 81, 82, 154, 81, 82, 166, + 81, 82, 164, 168, 169, 170, 172, 173, 174, 65, + 71, 83, 0, 150, 111 }; static const short int yycheck[] = { - 3, 30, 48, 49, 4, 5, 25, 7, 71, 72, - 10, 25, 124, 125, 126, 25, 26, 80, 130, 29, - 132, 16, 17, 69, 70, 35, 27, 25, 74, 75, - 14, 14, 78, 34, 146, 30, 39, 0, 1, 30, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 32, - 33, 14, 15, 12, 56, 30, 58, 16, 17, 18, - 19, 20, 21, 30, 127, 32, 33, 30, 31, 55, - 56, 30, 58, 119, 0, 1, 76, 3, 4, 5, - 6, 7, 8, 9, 10, 11, 30, 87, 14, 15, - 30, 94, 95, 96, 140, 30, 4, 5, 6, 7, - 8, 9, 10, 11, 30, 31, 14, 15, 5, 6, - 30, 8, 9, 10, 11, 30, 54, 14, 15, 57, - 12, 59, 30, 31, 16, 17, 13, 19, 20, 21, - 22, 23, 25, 30, 31, 24, 25, 26, 30, 30, - 29, 32, 33, 28, 30, 31, 35, 32, 33, 30, - 30, 32, 33, 30, 33, 32, 33, 56, 56, 58, - 58, 25, 26, 25, 26, 32, 33, 30, 21, 30, - 30, 30, 30, 30, 30, 30, 54, 88, -1, 33 + 5, 6, 0, 8, 57, 58, 11, 84, 85, 30, + 4, 5, 6, 7, 8, 9, 10, 11, 30, 96, + 14, 15, 24, 25, 26, 25, 26, 29, 81, 82, + 66, 30, 34, 69, 30, 71, 30, 90, 91, 0, + 1, 94, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 25, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 25, 25, 25, 26, 1, 145, 30, + 4, 5, 6, 7, 8, 9, 10, 11, 31, 32, + 14, 15, 16, 17, 137, 25, 26, 92, 30, 29, + 66, 25, 27, 69, 34, 71, 30, 68, 33, 70, + 105, 1, 155, 0, 1, 1, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 30, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 68, 25, 70, + 25, 0, 1, 30, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 30, 30, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 30, 25, 30, 30, 0, + 1, 30, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 30, 30, 14, 15, 16, 30, 18, 19, 20, + 21, 22, 23, 1, 25, 30, 30, 5, 6, 30, + 8, 9, 10, 11, 12, 1, 14, 15, 16, 17, + 18, 19, 20, 21, 14, 5, 6, 25, 8, 9, + 10, 11, 30, 30, 14, 15, 142, 143, 144, 13, + 25, 31, 32, 149, 28, 151, 14, 31, 32, 32, + 30, 67, 68, 30, 70, 161, 67, 68, 30, 70, + 30, 31, 32, 30, 31, 32, 30, 31, 32, 30, + 31, 32, 30, 30, 30, 30, 30, 30, 30, 29, + 40, 59, -1, 106, 66 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const unsigned char yystos[] = { - 0, 37, 0, 1, 3, 4, 5, 6, 7, 8, - 9, 10, 11, 14, 15, 30, 31, 38, 39, 40, - 41, 42, 43, 46, 47, 49, 53, 55, 57, 58, - 60, 62, 63, 64, 65, 73, 73, 25, 26, 71, - 71, 71, 30, 71, 25, 25, 25, 26, 29, 35, - 75, 76, 44, 44, 50, 52, 56, 68, 61, 68, - 73, 30, 30, 30, 30, 30, 75, 75, 30, 32, - 33, 27, 34, 12, 16, 17, 19, 20, 21, 22, - 23, 30, 45, 66, 67, 69, 18, 19, 20, 21, - 30, 51, 67, 69, 5, 8, 15, 39, 48, 72, - 39, 49, 54, 60, 72, 30, 69, 1, 39, 49, - 59, 60, 72, 28, 75, 75, 76, 76, 30, 24, - 75, 75, 71, 70, 71, 75, 25, 76, 13, 30, - 71, 70, 25, 73, 73, 73, 30, 75, 30, 30, - 14, 74, 30, 74, 74, 74, 76, 74, 30, 74, - 30, 75, 30, 30, 30, 74, 30, 30, 30 + 0, 36, 37, 0, 1, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 14, 15, 16, 18, 19, 20, + 21, 22, 23, 25, 30, 38, 39, 41, 42, 43, + 44, 47, 48, 50, 54, 56, 58, 59, 61, 63, + 64, 65, 72, 30, 25, 26, 71, 71, 30, 71, + 30, 30, 71, 25, 25, 25, 26, 29, 34, 75, + 76, 30, 1, 1, 45, 45, 51, 53, 57, 68, + 62, 68, 30, 73, 30, 30, 30, 30, 30, 75, + 75, 31, 32, 73, 27, 33, 30, 30, 1, 12, + 16, 17, 19, 20, 21, 22, 23, 25, 30, 40, + 46, 66, 67, 69, 18, 19, 20, 21, 30, 40, + 52, 67, 69, 39, 49, 72, 39, 50, 55, 61, + 72, 30, 40, 69, 39, 50, 60, 61, 72, 30, + 28, 75, 75, 76, 76, 30, 30, 24, 75, 75, + 71, 70, 71, 75, 25, 76, 1, 13, 30, 71, + 70, 25, 75, 30, 30, 14, 74, 30, 74, 74, + 74, 76, 30, 74, 30, 74, 30, 75, 30, 30, + 30, 74, 30, 30, 30 }; #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) @@ -966,6 +998,36 @@ yydestruct (yymsg, yytype, yyvaluep) switch (yytype) { + case 48: /* choice_entry */ + + { + fprintf(stderr, "%s:%d: missing end statement for this entry\n", + (yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno); + if (current_menu == (yyvaluep->menu)) + menu_end_menu(); +}; + + break; + case 54: /* if_entry */ + + { + fprintf(stderr, "%s:%d: missing end statement for this entry\n", + (yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno); + if (current_menu == (yyvaluep->menu)) + menu_end_menu(); +}; + + break; + case 59: /* menu_entry */ + + { + fprintf(stderr, "%s:%d: missing end statement for this entry\n", + (yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno); + if (current_menu == (yyvaluep->menu)) + menu_end_menu(); +}; + + break; default: break; @@ -1271,25 +1333,37 @@ yyreduce: { case 8: - { zconfprint("unexpected 'endmenu' statement"); ;} + { zconf_error("unexpected end statement"); ;} break; case 9: - { zconfprint("unexpected 'endif' statement"); ;} + { zconf_error("unknown statement \"%s\"", (yyvsp[-2].string)); ;} break; case 10: - { zconfprint("unexpected 'endchoice' statement"); ;} + { + zconf_error("unexpected option \"%s\"", kconf_id_strings + (yyvsp[-2].id)->name); +;} break; case 11: - { zconfprint("syntax error"); yyerrok; ;} + { zconf_error("invalid statement"); ;} break; - case 18: + case 25: + + { zconf_error("unknown option \"%s\"", (yyvsp[-2].string)); ;} + break; + + case 26: + + { zconf_error("invalid option"); ;} + break; + + case 27: { struct symbol *sym = sym_lookup((yyvsp[-1].string), 0); @@ -1299,7 +1373,7 @@ yyreduce: ;} break; - case 19: + case 28: { menu_end_entry(); @@ -1307,7 +1381,7 @@ yyreduce: ;} break; - case 20: + case 29: { struct symbol *sym = sym_lookup((yyvsp[-1].string), 0); @@ -1317,7 +1391,7 @@ yyreduce: ;} break; - case 21: + case 30: { if (current_entry->prompt) @@ -1329,7 +1403,7 @@ yyreduce: ;} break; - case 27: + case 37: { menu_set_type((yyvsp[-2].id)->stype); @@ -1339,7 +1413,7 @@ yyreduce: ;} break; - case 28: + case 38: { menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr)); @@ -1347,7 +1421,7 @@ yyreduce: ;} break; - case 29: + case 39: { menu_add_expr(P_DEFAULT, (yyvsp[-2].expr), (yyvsp[-1].expr)); @@ -1359,7 +1433,7 @@ yyreduce: ;} break; - case 30: + case 40: { menu_add_symbol(P_SELECT, sym_lookup((yyvsp[-2].string), 0), (yyvsp[-1].expr)); @@ -1367,7 +1441,7 @@ yyreduce: ;} break; - case 31: + case 41: { menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,(yyvsp[-3].symbol), (yyvsp[-2].symbol)), (yyvsp[-1].expr)); @@ -1375,7 +1449,7 @@ yyreduce: ;} break; - case 32: + case 42: { struct symbol *sym = sym_lookup(NULL, 0); @@ -1386,33 +1460,24 @@ yyreduce: ;} break; - case 33: + case 43: { - menu_end_entry(); - menu_add_menu(); + (yyval.menu) = menu_add_menu(); ;} break; - case 34: + case 44: { - if (zconf_endtoken((yyvsp[0].token), T_CHOICE, T_ENDCHOICE)) { + if (zconf_endtoken((yyvsp[0].id), T_CHOICE, T_ENDCHOICE)) { menu_end_menu(); printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno()); } ;} break; - case 36: - - { - printf("%s:%d: missing 'endchoice' for this 'choice' statement\n", current_menu->file->name, current_menu->lineno); - zconfnerrs++; -;} - break; - - case 42: + case 52: { menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr)); @@ -1420,7 +1485,7 @@ yyreduce: ;} break; - case 43: + case 53: { if ((yyvsp[-2].id)->stype == S_BOOLEAN || (yyvsp[-2].id)->stype == S_TRISTATE) { @@ -1433,7 +1498,7 @@ yyreduce: ;} break; - case 44: + case 54: { current_entry->sym->flags |= SYMBOL_OPTIONAL; @@ -1441,7 +1506,7 @@ yyreduce: ;} break; - case 45: + case 55: { if ((yyvsp[-3].id)->stype == S_UNKNOWN) { @@ -1453,36 +1518,27 @@ yyreduce: ;} break; - case 48: + case 58: { printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno()); menu_add_entry(NULL); menu_add_dep((yyvsp[-1].expr)); - menu_end_entry(); - menu_add_menu(); + (yyval.menu) = menu_add_menu(); ;} break; - case 49: + case 59: { - if (zconf_endtoken((yyvsp[0].token), T_IF, T_ENDIF)) { + if (zconf_endtoken((yyvsp[0].id), T_IF, T_ENDIF)) { menu_end_menu(); printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno()); } ;} break; - case 51: - - { - printf("%s:%d: missing 'endif' for this 'if' statement\n", current_menu->file->name, current_menu->lineno); - zconfnerrs++; -;} - break; - - case 56: + case 65: { menu_add_entry(NULL); @@ -1491,53 +1547,32 @@ yyreduce: ;} break; - case 57: + case 66: { - menu_end_entry(); - menu_add_menu(); + (yyval.menu) = menu_add_menu(); ;} break; - case 58: + case 67: { - if (zconf_endtoken((yyvsp[0].token), T_MENU, T_ENDMENU)) { + if (zconf_endtoken((yyvsp[0].id), T_MENU, T_ENDMENU)) { menu_end_menu(); printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno()); } ;} break; - case 60: + case 73: { - printf("%s:%d: missing 'endmenu' for this 'menu' statement\n", current_menu->file->name, current_menu->lineno); - zconfnerrs++; -;} - break; - - case 65: - - { zconfprint("invalid menu option"); yyerrok; ;} - break; - - case 66: - - { - (yyval.string) = (yyvsp[-1].string); printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string)); + zconf_nextfile((yyvsp[-1].string)); ;} break; - case 67: - - { - zconf_nextfile((yyvsp[0].string)); -;} - break; - - case 68: + case 74: { menu_add_entry(NULL); @@ -1546,14 +1581,14 @@ yyreduce: ;} break; - case 69: + case 75: { menu_end_entry(); ;} break; - case 70: + case 76: { printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno()); @@ -1561,14 +1596,14 @@ yyreduce: ;} break; - case 71: + case 77: { current_entry->sym->help = (yyvsp[0].string); ;} break; - case 75: + case 82: { menu_add_dep((yyvsp[-1].expr)); @@ -1576,7 +1611,7 @@ yyreduce: ;} break; - case 76: + case 83: { menu_add_dep((yyvsp[-1].expr)); @@ -1584,7 +1619,7 @@ yyreduce: ;} break; - case 77: + case 84: { menu_add_dep((yyvsp[-1].expr)); @@ -1592,79 +1627,79 @@ yyreduce: ;} break; - case 79: + case 86: { menu_add_prompt(P_PROMPT, (yyvsp[-1].string), (yyvsp[0].expr)); ;} break; - case 82: + case 89: - { (yyval.token) = T_ENDMENU; ;} + { (yyval.id) = (yyvsp[-1].id); ;} break; - case 83: + case 90: - { (yyval.token) = T_ENDCHOICE; ;} + { (yyval.id) = (yyvsp[-1].id); ;} break; - case 84: + case 91: - { (yyval.token) = T_ENDIF; ;} + { (yyval.id) = (yyvsp[-1].id); ;} break; - case 87: + case 94: { (yyval.expr) = NULL; ;} break; - case 88: + case 95: { (yyval.expr) = (yyvsp[0].expr); ;} break; - case 89: + case 96: { (yyval.expr) = expr_alloc_symbol((yyvsp[0].symbol)); ;} break; - case 90: + case 97: { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); ;} break; - case 91: + case 98: { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); ;} break; - case 92: + case 99: { (yyval.expr) = (yyvsp[-1].expr); ;} break; - case 93: + case 100: { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[0].expr)); ;} break; - case 94: + case 101: { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[-2].expr), (yyvsp[0].expr)); ;} break; - case 95: + case 102: { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[-2].expr), (yyvsp[0].expr)); ;} break; - case 96: + case 103: { (yyval.symbol) = sym_lookup((yyvsp[0].string), 0); free((yyvsp[0].string)); ;} break; - case 97: + case 104: { (yyval.symbol) = sym_lookup((yyvsp[0].string), 1); free((yyvsp[0].string)); ;} break; @@ -1916,7 +1951,10 @@ void conf_parse(const char *name) modules_sym = sym_lookup("MODULES", 0); rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL); - //zconfdebug = 1; +#if YYDEBUG + if (getenv("ZCONF_DEBUG")) + zconfdebug = 1; +#endif zconfparse(); if (zconfnerrs) exit(1); @@ -1937,20 +1975,25 @@ const char *zconf_tokenname(int token) case T_ENDCHOICE: return "endchoice"; case T_IF: return "if"; case T_ENDIF: return "endif"; + case T_DEPENDS: return "depends"; } return ""; } -static bool zconf_endtoken(int token, int starttoken, int endtoken) +static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken) { - if (token != endtoken) { - zconfprint("unexpected '%s' within %s block", zconf_tokenname(token), zconf_tokenname(starttoken)); + if (id->token != endtoken) { + zconf_error("unexpected '%s' within %s block", + kconf_id_strings + id->name, zconf_tokenname(starttoken)); zconfnerrs++; return false; } if (current_menu->file != current_file) { - zconfprint("'%s' in different file than '%s'", zconf_tokenname(token), zconf_tokenname(starttoken)); - zconfprint("location of the '%s'", zconf_tokenname(starttoken)); + zconf_error("'%s' in different file than '%s'", + kconf_id_strings + id->name, zconf_tokenname(starttoken)); + fprintf(stderr, "%s:%d: location of the '%s'\n", + current_menu->file->name, current_menu->lineno, + zconf_tokenname(starttoken)); zconfnerrs++; return false; } @@ -1961,7 +2004,19 @@ static void zconfprint(const char *err, ...) { va_list ap; - fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno() + 1); + fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno()); + va_start(ap, err); + vfprintf(stderr, err, ap); + va_end(ap); + fprintf(stderr, "\n"); +} + +static void zconf_error(const char *err, ...) +{ + va_list ap; + + zconfnerrs++; + fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno()); va_start(ap, err); vfprintf(stderr, err, ap); va_end(ap); @@ -1970,7 +2025,9 @@ static void zconfprint(const char *err, ...) static void zconferror(const char *err) { +#if YYDEBUG fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err); +#endif } void print_quoted_string(FILE *out, const char *str) diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y index 1211781675b8..1f61fba6aa28 100644 --- a/scripts/kconfig/zconf.y +++ b/scripts/kconfig/zconf.y @@ -25,21 +25,25 @@ int cdebug = PRINTD; extern int zconflex(void); static void zconfprint(const char *err, ...); +static void zconf_error(const char *err, ...); static void zconferror(const char *err); -static bool zconf_endtoken(int token, int starttoken, int endtoken); +static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken); struct symbol *symbol_hash[257]; static struct menu *current_menu, *current_entry; +#define YYDEBUG 0 +#if YYDEBUG #define YYERROR_VERBOSE +#endif %} -%expect 40 +%expect 26 %union { - int token; char *string; + struct file *file; struct symbol *symbol; struct expr *expr; struct menu *menu; @@ -74,7 +78,6 @@ static struct menu *current_menu, *current_entry; %token T_CLOSE_PAREN %token T_OPEN_PAREN %token T_EOL -%token T_EOF %left T_OR %left T_AND @@ -82,34 +85,54 @@ static struct menu *current_menu, *current_entry; %nonassoc T_NOT %type prompt -%type source %type symbol %type expr %type if_expr -%type end +%type end +%type option_name +%type if_entry menu_entry choice_entry + +%destructor { + fprintf(stderr, "%s:%d: missing end statement for this entry\n", + $$->file->name, $$->lineno); + if (current_menu == $$) + menu_end_menu(); +} if_entry menu_entry choice_entry %% -input: /* empty */ - | input block +input: stmt_list; + +stmt_list: + /* empty */ + | stmt_list common_stmt + | stmt_list choice_stmt + | stmt_list menu_stmt + | stmt_list T_MAINMENU prompt nl + | stmt_list end { zconf_error("unexpected end statement"); } + | stmt_list T_WORD error T_EOL { zconf_error("unknown statement \"%s\"", $2); } + | stmt_list option_name error T_EOL +{ + zconf_error("unexpected option \"%s\"", kconf_id_strings + $2->name); +} + | stmt_list error T_EOL { zconf_error("invalid statement"); } ; -block: common_block - | choice_stmt - | menu_stmt - | T_MAINMENU prompt nl_or_eof - | T_ENDMENU { zconfprint("unexpected 'endmenu' statement"); } - | T_ENDIF { zconfprint("unexpected 'endif' statement"); } - | T_ENDCHOICE { zconfprint("unexpected 'endchoice' statement"); } - | error nl_or_eof { zconfprint("syntax error"); yyerrok; } +option_name: + T_DEPENDS | T_PROMPT | T_TYPE | T_SELECT | T_OPTIONAL | T_RANGE | T_DEFAULT ; -common_block: - if_stmt +common_stmt: + T_EOL + | if_stmt | comment_stmt | config_stmt | menuconfig_stmt | source_stmt - | nl_or_eof +; + +option_error: + T_WORD error T_EOL { zconf_error("unknown option \"%s\"", $1); } + | error T_EOL { zconf_error("invalid option"); } ; @@ -152,6 +175,7 @@ config_option_list: | config_option_list config_option | config_option_list depends | config_option_list help + | config_option_list option_error | config_option_list T_EOL ; @@ -204,8 +228,7 @@ choice: T_CHOICE T_EOL choice_entry: choice choice_option_list { - menu_end_entry(); - menu_add_menu(); + $$ = menu_add_menu(); }; choice_end: end @@ -216,13 +239,8 @@ choice_end: end } }; -choice_stmt: - choice_entry choice_block choice_end - | choice_entry choice_block -{ - printf("%s:%d: missing 'endchoice' for this 'choice' statement\n", current_menu->file->name, current_menu->lineno); - zconfnerrs++; -}; +choice_stmt: choice_entry choice_block choice_end +; choice_option_list: /* empty */ @@ -230,6 +248,7 @@ choice_option_list: | choice_option_list depends | choice_option_list help | choice_option_list T_EOL + | choice_option_list option_error ; choice_option: T_PROMPT prompt if_expr T_EOL @@ -267,18 +286,17 @@ choice_option: T_DEFAULT T_WORD if_expr T_EOL choice_block: /* empty */ - | choice_block common_block + | choice_block common_stmt ; /* if entry */ -if: T_IF expr T_EOL +if_entry: T_IF expr nl { printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno()); menu_add_entry(NULL); menu_add_dep($2); - menu_end_entry(); - menu_add_menu(); + $$ = menu_add_menu(); }; if_end: end @@ -289,17 +307,12 @@ if_end: end } }; -if_stmt: - if if_block if_end - | if if_block -{ - printf("%s:%d: missing 'endif' for this 'if' statement\n", current_menu->file->name, current_menu->lineno); - zconfnerrs++; -}; +if_stmt: if_entry if_block if_end +; if_block: /* empty */ - | if_block common_block + | if_block common_stmt | if_block menu_stmt | if_block choice_stmt ; @@ -315,8 +328,7 @@ menu: T_MENU prompt T_EOL menu_entry: menu depends_list { - menu_end_entry(); - menu_add_menu(); + $$ = menu_add_menu(); }; menu_end: end @@ -327,31 +339,20 @@ menu_end: end } }; -menu_stmt: - menu_entry menu_block menu_end - | menu_entry menu_block -{ - printf("%s:%d: missing 'endmenu' for this 'menu' statement\n", current_menu->file->name, current_menu->lineno); - zconfnerrs++; -}; +menu_stmt: menu_entry menu_block menu_end +; menu_block: /* empty */ - | menu_block common_block + | menu_block common_stmt | menu_block menu_stmt | menu_block choice_stmt - | menu_block error T_EOL { zconfprint("invalid menu option"); yyerrok; } ; -source: T_SOURCE prompt T_EOL +source_stmt: T_SOURCE prompt T_EOL { - $$ = $2; printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), $2); -}; - -source_stmt: source -{ - zconf_nextfile($1); + zconf_nextfile($2); }; /* comment entry */ @@ -383,9 +384,11 @@ help: help_start T_HELPTEXT /* depends option */ -depends_list: /* empty */ - | depends_list depends - | depends_list T_EOL +depends_list: + /* empty */ + | depends_list depends + | depends_list T_EOL + | depends_list option_error ; depends: T_DEPENDS T_ON expr T_EOL @@ -417,13 +420,15 @@ prompt: T_WORD | T_WORD_QUOTE ; -end: T_ENDMENU nl_or_eof { $$ = T_ENDMENU; } - | T_ENDCHOICE nl_or_eof { $$ = T_ENDCHOICE; } - | T_ENDIF nl_or_eof { $$ = T_ENDIF; } +end: T_ENDMENU T_EOL { $$ = $1; } + | T_ENDCHOICE T_EOL { $$ = $1; } + | T_ENDIF T_EOL { $$ = $1; } ; -nl_or_eof: - T_EOL | T_EOF; +nl: + T_EOL + | nl T_EOL +; if_expr: /* empty */ { $$ = NULL; } | T_IF expr { $$ = $2; } @@ -456,7 +461,10 @@ void conf_parse(const char *name) modules_sym = sym_lookup("MODULES", 0); rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL); - //zconfdebug = 1; +#if YYDEBUG + if (getenv("ZCONF_DEBUG")) + zconfdebug = 1; +#endif zconfparse(); if (zconfnerrs) exit(1); @@ -477,20 +485,25 @@ const char *zconf_tokenname(int token) case T_ENDCHOICE: return "endchoice"; case T_IF: return "if"; case T_ENDIF: return "endif"; + case T_DEPENDS: return "depends"; } return ""; } -static bool zconf_endtoken(int token, int starttoken, int endtoken) +static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken) { - if (token != endtoken) { - zconfprint("unexpected '%s' within %s block", zconf_tokenname(token), zconf_tokenname(starttoken)); + if (id->token != endtoken) { + zconf_error("unexpected '%s' within %s block", + kconf_id_strings + id->name, zconf_tokenname(starttoken)); zconfnerrs++; return false; } if (current_menu->file != current_file) { - zconfprint("'%s' in different file than '%s'", zconf_tokenname(token), zconf_tokenname(starttoken)); - zconfprint("location of the '%s'", zconf_tokenname(starttoken)); + zconf_error("'%s' in different file than '%s'", + kconf_id_strings + id->name, zconf_tokenname(starttoken)); + fprintf(stderr, "%s:%d: location of the '%s'\n", + current_menu->file->name, current_menu->lineno, + zconf_tokenname(starttoken)); zconfnerrs++; return false; } @@ -501,7 +514,19 @@ static void zconfprint(const char *err, ...) { va_list ap; - fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno() + 1); + fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno()); + va_start(ap, err); + vfprintf(stderr, err, ap); + va_end(ap); + fprintf(stderr, "\n"); +} + +static void zconf_error(const char *err, ...) +{ + va_list ap; + + zconfnerrs++; + fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno()); va_start(ap, err); vfprintf(stderr, err, ap); va_end(ap); @@ -510,7 +535,9 @@ static void zconfprint(const char *err, ...) static void zconferror(const char *err) { +#if YYDEBUG fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err); +#endif } void print_quoted_string(FILE *out, const char *str) -- cgit v1.2.2 From c1a0f5e3c01d28b6782457bee5ae5ace3a9958ec Mon Sep 17 00:00:00 2001 From: Roman Zippel Date: Tue, 8 Nov 2005 21:34:54 -0800 Subject: [PATCH] kconfig: stricter error checking for .config Add some more checks during the parsing of .config, so that after parsing sym_change_count reflects the correct state whether the .config is correct and in sync with the Kconfig or if it needs saving. Signed-off-by: Roman Zippel Cc: Sam Ravnborg Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- scripts/kconfig/confdata.c | 95 +++++++++++++++++++++++++++++++++++++--------- scripts/kconfig/lkc.h | 1 - 2 files changed, 77 insertions(+), 19 deletions(-) diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 4bba6202b79e..ccd45130c482 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -14,6 +14,12 @@ #define LKC_DIRECT_LINK #include "lkc.h" +static void conf_warning(const char *fmt, ...) + __attribute__ ((format (printf, 1, 2))); + +static const char *conf_filename; +static int conf_lineno, conf_warnings, conf_unsaved; + const char conf_def_filename[] = ".config"; const char conf_defname[] = "arch/$ARCH/defconfig"; @@ -27,6 +33,17 @@ const char *conf_confnames[] = { NULL, }; +static void conf_warning(const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + fprintf(stderr, "%s:%d:warning: ", conf_filename, conf_lineno); + vfprintf(stderr, fmt, ap); + fprintf(stderr, "\n"); + va_end(ap); + conf_warnings++; +} + static char *conf_expand_value(const char *in) { struct symbol *sym; @@ -74,7 +91,6 @@ int conf_read_simple(const char *name) FILE *in = NULL; char line[1024]; char *p, *p2; - int lineno = 0; struct symbol *sym; int i; @@ -93,12 +109,18 @@ int conf_read_simple(const char *name) } } } - if (!in) return 1; + conf_filename = name; + conf_lineno = 0; + conf_warnings = 0; + conf_unsaved = 0; + for_all_symbols(i, sym) { sym->flags |= SYMBOL_NEW | SYMBOL_CHANGED; + if (sym_is_choice(sym)) + sym->flags &= ~SYMBOL_NEW; sym->flags &= ~SYMBOL_VALID; switch (sym->type) { case S_INT: @@ -113,7 +135,7 @@ int conf_read_simple(const char *name) } while (fgets(line, sizeof(line), in)) { - lineno++; + conf_lineno++; sym = NULL; switch (line[0]) { case '#': @@ -127,7 +149,10 @@ int conf_read_simple(const char *name) continue; sym = sym_find(line + 9); if (!sym) { - fprintf(stderr, "%s:%d: trying to assign nonexistent symbol %s\n", name, lineno, line + 9); + conf_warning("trying to assign nonexistent symbol %s", line + 9); + break; + } else if (!(sym->flags & SYMBOL_NEW)) { + conf_warning("trying to reassign symbol %s", sym->name); break; } switch (sym->type) { @@ -141,8 +166,10 @@ int conf_read_simple(const char *name) } break; case 'C': - if (memcmp(line, "CONFIG_", 7)) + if (memcmp(line, "CONFIG_", 7)) { + conf_warning("unexpected data"); continue; + } p = strchr(line + 7, '='); if (!p) continue; @@ -152,7 +179,10 @@ int conf_read_simple(const char *name) *p2 = 0; sym = sym_find(line + 7); if (!sym) { - fprintf(stderr, "%s:%d: trying to assign nonexistent symbol %s\n", name, lineno, line + 7); + conf_warning("trying to assign nonexistent symbol %s", line + 7); + break; + } else if (!(sym->flags & SYMBOL_NEW)) { + conf_warning("trying to reassign symbol %s", sym->name); break; } switch (sym->type) { @@ -173,6 +203,7 @@ int conf_read_simple(const char *name) sym->flags &= ~SYMBOL_NEW; break; } + conf_warning("symbol value '%s' invalid for %s", p, sym->name); break; case S_STRING: if (*p++ != '"') @@ -185,8 +216,8 @@ int conf_read_simple(const char *name) memmove(p2, p2 + 1, strlen(p2)); } if (!p2) { - fprintf(stderr, "%s:%d: invalid string found\n", name, lineno); - exit(1); + conf_warning("invalid string found"); + continue; } case S_INT: case S_HEX: @@ -194,8 +225,8 @@ int conf_read_simple(const char *name) sym->user.val = strdup(p); sym->flags &= ~SYMBOL_NEW; } else { - fprintf(stderr, "%s:%d: symbol value '%s' invalid for %s\n", name, lineno, p, sym->name); - exit(1); + conf_warning("symbol value '%s' invalid for %s", p, sym->name); + continue; } break; default: @@ -205,6 +236,7 @@ int conf_read_simple(const char *name) case '\n': break; default: + conf_warning("unexpected data"); continue; } if (sym && sym_is_choice_value(sym)) { @@ -213,17 +245,20 @@ int conf_read_simple(const char *name) case no: break; case mod: - if (cs->user.tri == yes) - /* warn? */; + if (cs->user.tri == yes) { + conf_warning("%s creates inconsistent choice state", sym->name); + cs->flags |= SYMBOL_NEW; + } break; case yes: - if (cs->user.tri != no) - /* warn? */; - cs->user.val = sym; + if (cs->user.tri != no) { + conf_warning("%s creates inconsistent choice state", sym->name); + cs->flags |= SYMBOL_NEW; + } else + cs->user.val = sym; break; } cs->user.tri = E_OR(cs->user.tri, sym->user.tri); - cs->flags &= ~SYMBOL_NEW; } } fclose(in); @@ -245,6 +280,28 @@ int conf_read(const char *name) for_all_symbols(i, sym) { sym_calc_value(sym); + if (sym_is_choice(sym) || (sym->flags & SYMBOL_AUTO)) + goto sym_ok; + if (sym_has_value(sym) && (sym->flags & SYMBOL_WRITE)) { + /* check that calculated value agrees with saved value */ + switch (sym->type) { + case S_BOOLEAN: + case S_TRISTATE: + if (sym->user.tri != sym_get_tristate_value(sym)) + break; + if (!sym_is_choice(sym)) + goto sym_ok; + default: + if (!strcmp(sym->curr.val, sym->user.val)) + goto sym_ok; + break; + } + } else if (!sym_has_value(sym) && !(sym->flags & SYMBOL_WRITE)) + /* no previous value and not saved */ + goto sym_ok; + conf_unsaved++; + /* maybe print value in verbose mode... */ + sym_ok: if (sym_has_value(sym) && !sym_is_choice_value(sym)) { if (sym->visible == no) sym->flags |= SYMBOL_NEW; @@ -252,8 +309,10 @@ int conf_read(const char *name) case S_STRING: case S_INT: case S_HEX: - if (!sym_string_within_range(sym, sym->user.val)) + if (!sym_string_within_range(sym, sym->user.val)) { sym->flags |= SYMBOL_NEW; + sym->flags &= ~SYMBOL_VALID; + } default: break; } @@ -266,7 +325,7 @@ int conf_read(const char *name) sym->flags |= e->right.sym->flags & SYMBOL_NEW; } - sym_change_count = 1; + sym_change_count = conf_warnings && conf_unsaved; return 0; } diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h index ca02eb42eeb3..527f60c99c50 100644 --- a/scripts/kconfig/lkc.h +++ b/scripts/kconfig/lkc.h @@ -61,7 +61,6 @@ char *zconf_curname(void); /* confdata.c */ extern const char conf_def_filename[]; -extern char conf_filename[]; char *conf_get_default_confname(void); -- cgit v1.2.2 From 733482e445ca4450cf41381b1c95e2b8c7145114 Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Tue, 8 Nov 2005 21:34:55 -0800 Subject: [PATCH] changing CONFIG_LOCALVERSION rebuilds too much, for no good reason This patch removes almost all inclusions of linux/version.h. The 3 #defines are unused in most of the touched files. A few drivers use the simple KERNEL_VERSION(a,b,c) macro, which is unfortunatly in linux/version.h. There are also lots of #ifdef for long obsolete kernels, this was not touched. In a few places, the linux/version.h include was move to where the LINUX_VERSION_CODE was used. quilt vi `find * -type f -name "*.[ch]"|xargs grep -El '(UTS_RELEASE|LINUX_VERSION_CODE|KERNEL_VERSION|linux/version.h)'|grep -Ev '(/(boot|coda|drm)/|~$)'` search pattern: /UTS_RELEASE\|LINUX_VERSION_CODE\|KERNEL_VERSION\|linux\/\(utsname\|version\).h Signed-off-by: Olaf Hering Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/arm/mach-omap1/leds-h2p2-debug.c | 1 - arch/arm/plat-omap/ocpi.c | 1 - arch/cris/arch-v10/drivers/pcf8563.c | 1 - arch/cris/arch-v10/kernel/fasttimer.c | 1 - arch/cris/arch-v32/drivers/nandflash.c | 1 - arch/cris/arch-v32/drivers/pcf8563.c | 1 - arch/mips/tx4938/toshiba_rbtx4938/irq.c | 1 - arch/parisc/kernel/asm-offsets.c | 1 - arch/ppc/syslib/prom.c | 1 - arch/ppc/syslib/prom_init.c | 1 - drivers/block/amiflop.c | 1 - drivers/char/ip2.c | 1 - drivers/char/mwave/tp3780i.c | 1 - drivers/char/mxser.c | 1 - drivers/char/specialix.c | 1 - drivers/char/tpm/tpm.h | 1 - drivers/char/viocons.c | 1 - drivers/char/viotape.c | 1 - drivers/firmware/dell_rbu.c | 1 - drivers/infiniband/ulp/srp/ib_srp.c | 1 - drivers/isdn/divert/divert_init.c | 1 - drivers/isdn/divert/divert_procfs.c | 1 - drivers/isdn/divert/isdn_divert.c | 1 - drivers/isdn/hisax/hisax_fcpcipnp.c | 1 - drivers/isdn/hisax/st5481_init.c | 1 - drivers/isdn/hysdn/hycapi.c | 1 - drivers/isdn/hysdn/hysdn_init.c | 1 - drivers/isdn/hysdn/hysdn_net.c | 1 - drivers/isdn/hysdn/hysdn_procconf.c | 1 - drivers/isdn/hysdn/hysdn_proclog.c | 1 - drivers/isdn/i4l/isdn_common.c | 1 - drivers/isdn/icn/icn.h | 1 - drivers/isdn/isdnloop/isdnloop.h | 1 - drivers/isdn/sc/includes.h | 1 - drivers/md/bitmap.c | 1 - drivers/media/video/arv.c | 1 - drivers/media/video/zr36016.c | 1 - drivers/media/video/zr36050.c | 1 - drivers/media/video/zr36060.c | 1 - drivers/message/fusion/mptbase.c | 1 - drivers/message/fusion/mptbase.h | 1 - drivers/message/fusion/mptctl.c | 1 - drivers/message/fusion/mptctl.h | 1 - drivers/message/fusion/mptlan.h | 1 - drivers/misc/hdpuftrs/hdpu_cpustate.c | 1 - drivers/misc/hdpuftrs/hdpu_nexus.c | 1 - drivers/misc/ibmasm/ibmasm.h | 1 - drivers/mtd/chips/cfi_cmdset_0020.c | 1 - drivers/mtd/devices/pmc551.c | 1 - drivers/mtd/maps/ebony.c | 1 - drivers/mtd/maps/ocotea.c | 1 - drivers/mtd/maps/walnut.c | 1 - drivers/mtd/nand/au1550nd.c | 1 + drivers/mtd/nand/autcpu12.c | 1 - drivers/net/b44.c | 1 - drivers/net/cassini.c | 1 - drivers/net/dm9000.c | 1 - drivers/net/fs_enet/fs_enet.h | 1 - drivers/net/gianfar.c | 1 - drivers/net/gianfar.h | 1 - drivers/net/gianfar_ethtool.c | 1 - drivers/net/gianfar_mii.c | 1 - drivers/net/hp100.c | 1 - drivers/net/ibmveth.c | 1 - drivers/net/iseries_veth.c | 1 - drivers/net/mac8390.c | 1 - drivers/net/mv643xx_eth.h | 1 - drivers/net/s2io.c | 1 - drivers/net/sk98lin/h/skdrv1st.h | 3 --- drivers/net/sk_mca.c | 1 - drivers/net/sk_mca.h | 2 -- drivers/net/starfire.c | 1 - drivers/net/via-velocity.c | 1 - drivers/net/wireless/hostap/hostap.c | 1 - drivers/net/wireless/hostap/hostap_hw.c | 1 - drivers/net/wireless/hostap/hostap_pci.c | 1 - drivers/net/wireless/hostap/hostap_plx.c | 1 - drivers/net/wireless/ipw2100.h | 1 - drivers/net/wireless/ipw2200.c | 1 + drivers/net/wireless/ipw2200.h | 1 - drivers/net/wireless/orinoco.h | 1 - drivers/net/wireless/prism54/isl_38xx.c | 1 - drivers/net/wireless/prism54/isl_38xx.h | 1 - drivers/net/wireless/prism54/isl_ioctl.c | 1 - drivers/net/wireless/prism54/islpci_dev.c | 1 - drivers/net/wireless/prism54/islpci_dev.h | 1 - drivers/net/wireless/prism54/islpci_eth.c | 1 - drivers/net/wireless/prism54/islpci_hotplug.c | 1 - drivers/pcmcia/au1000_pb1x00.c | 1 - drivers/pcmcia/au1000_xxs1500.c | 1 - drivers/s390/crypto/z90main.c | 1 - drivers/s390/net/claw.c | 1 - drivers/scsi/3w-xxxx.h | 1 - drivers/scsi/a2091.c | 1 - drivers/scsi/aic7xxx/aic79xx_osm.h | 1 - drivers/scsi/aic7xxx/aic7xxx_osm.h | 1 - drivers/scsi/amiga7xx.c | 1 - drivers/scsi/bvme6000.c | 1 - drivers/scsi/gvp11.c | 1 - drivers/scsi/ibmmca.c | 6 ------ drivers/scsi/ips.h | 1 + drivers/scsi/megaraid/mega_common.h | 1 - drivers/scsi/megaraid/megaraid_mm.h | 1 - drivers/scsi/megaraid/megaraid_sas.c | 1 - drivers/scsi/mvme147.c | 1 - drivers/scsi/mvme16x.c | 1 - drivers/scsi/nsp32.h | 1 + drivers/scsi/pci2000.h | 3 --- drivers/scsi/scsi_debug.c | 4 ---- drivers/scsi/sg.c | 4 ---- drivers/scsi/sgiwd93.c | 1 - drivers/scsi/wd33c93.c | 1 - drivers/telephony/ixj.h | 1 - drivers/usb/gadget/dummy_hcd.c | 1 - drivers/usb/gadget/lh7a40x_udc.h | 1 - drivers/usb/gadget/pxa2xx_udc.c | 1 - drivers/usb/gadget/rndis.c | 1 - drivers/usb/host/hc_crisv10.c | 1 - drivers/usb/media/pwc/pwc-if.c | 1 + drivers/usb/media/pwc/pwc.h | 2 -- drivers/usb/media/w9968cf.c | 1 - drivers/usb/misc/sisusbvga/sisusb.c | 1 - drivers/usb/misc/sisusbvga/sisusb.h | 1 + drivers/usb/misc/sisusbvga/sisusb_con.c | 1 - drivers/usb/misc/sisusbvga/sisusb_init.c | 1 - drivers/video/backlight/backlight.c | 1 - drivers/video/backlight/lcd.c | 1 - drivers/video/intelfb/intelfbdrv.c | 1 - drivers/video/intelfb/intelfbhw.c | 1 - fs/9p/vfs_file.c | 1 - fs/adfs/adfs.h | 1 - fs/hfs/hfs_fs.h | 1 - fs/hfs/inode.c | 1 - fs/hfsplus/bnode.c | 1 - fs/hfsplus/dir.c | 1 - fs/hfsplus/extents.c | 1 - fs/hfsplus/hfsplus_fs.h | 1 - fs/hfsplus/inode.c | 1 - fs/hfsplus/super.c | 1 - fs/hfsplus/wrapper.c | 1 - fs/hostfs/hostfs_kern.c | 1 - fs/xfs/linux-2.6/xfs_linux.h | 1 - fs/xfs/xfs.h | 7 ------- fs/xfs/xfs_dmapi.h | 1 + include/linux/fs_enet_pd.h | 1 - include/linux/if_wanpipe_common.h | 2 -- include/linux/istallion.h | 2 -- include/linux/mtd/cfi.h | 1 - include/linux/mtd/mtd.h | 1 - include/linux/phonedev.h | 1 - include/linux/stallion.h | 2 -- sound/oss/msnd.c | 1 - sound/oss/os.h | 2 -- sound/oss/rme96xx.c | 1 - sound/oss/sh_dac_audio.c | 1 - sound/ppc/pmac.h | 1 - 156 files changed, 7 insertions(+), 176 deletions(-) diff --git a/arch/arm/mach-omap1/leds-h2p2-debug.c b/arch/arm/mach-omap1/leds-h2p2-debug.c index be283cda63dd..399010c14036 100644 --- a/arch/arm/mach-omap1/leds-h2p2-debug.c +++ b/arch/arm/mach-omap1/leds-h2p2-debug.c @@ -13,7 +13,6 @@ #include #include #include -#include #include #include diff --git a/arch/arm/plat-omap/ocpi.c b/arch/arm/plat-omap/ocpi.c index 1fb16f9edfd5..2ede2ee8cae4 100644 --- a/arch/arm/plat-omap/ocpi.c +++ b/arch/arm/plat-omap/ocpi.c @@ -25,7 +25,6 @@ #include #include -#include #include #include #include diff --git a/arch/cris/arch-v10/drivers/pcf8563.c b/arch/cris/arch-v10/drivers/pcf8563.c index 201f4c90d961..f2c55742e90c 100644 --- a/arch/cris/arch-v10/drivers/pcf8563.c +++ b/arch/cris/arch-v10/drivers/pcf8563.c @@ -19,7 +19,6 @@ */ #include -#include #include #include #include diff --git a/arch/cris/arch-v10/kernel/fasttimer.c b/arch/cris/arch-v10/kernel/fasttimer.c index 094ff45ae85b..cac05a5e514c 100644 --- a/arch/cris/arch-v10/kernel/fasttimer.c +++ b/arch/cris/arch-v10/kernel/fasttimer.c @@ -112,7 +112,6 @@ #include #include -#include #include #include diff --git a/arch/cris/arch-v32/drivers/nandflash.c b/arch/cris/arch-v32/drivers/nandflash.c index fc2a619b035d..93ddea4d9564 100644 --- a/arch/cris/arch-v32/drivers/nandflash.c +++ b/arch/cris/arch-v32/drivers/nandflash.c @@ -14,7 +14,6 @@ * */ -#include #include #include #include diff --git a/arch/cris/arch-v32/drivers/pcf8563.c b/arch/cris/arch-v32/drivers/pcf8563.c index f894580b648b..d788bda3578c 100644 --- a/arch/cris/arch-v32/drivers/pcf8563.c +++ b/arch/cris/arch-v32/drivers/pcf8563.c @@ -18,7 +18,6 @@ */ #include -#include #include #include #include diff --git a/arch/mips/tx4938/toshiba_rbtx4938/irq.c b/arch/mips/tx4938/toshiba_rbtx4938/irq.c index 230f5a93c2e6..9cd9c0fe2265 100644 --- a/arch/mips/tx4938/toshiba_rbtx4938/irq.c +++ b/arch/mips/tx4938/toshiba_rbtx4938/irq.c @@ -84,7 +84,6 @@ IRQ Device #include #include #include -#include #include #include diff --git a/arch/parisc/kernel/asm-offsets.c b/arch/parisc/kernel/asm-offsets.c index 1ad44f92d6e4..e23c4e1e3a25 100644 --- a/arch/parisc/kernel/asm-offsets.c +++ b/arch/parisc/kernel/asm-offsets.c @@ -30,7 +30,6 @@ #include #include #include -#include #include #include diff --git a/arch/ppc/syslib/prom.c b/arch/ppc/syslib/prom.c index 03b1fc9b9501..af4deace49e0 100644 --- a/arch/ppc/syslib/prom.c +++ b/arch/ppc/syslib/prom.c @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include diff --git a/arch/ppc/syslib/prom_init.c b/arch/ppc/syslib/prom_init.c index 7f15136830f4..df14422ae1c6 100644 --- a/arch/ppc/syslib/prom_init.c +++ b/arch/ppc/syslib/prom_init.c @@ -9,7 +9,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/block/amiflop.c b/drivers/block/amiflop.c index 1468e8cf712d..0acbfff8ad28 100644 --- a/drivers/block/amiflop.c +++ b/drivers/block/amiflop.c @@ -1816,7 +1816,6 @@ out_blkdev: } #ifdef MODULE -#include int init_module(void) { diff --git a/drivers/char/ip2.c b/drivers/char/ip2.c index 6cd12f23aa58..7cadfc6ef352 100644 --- a/drivers/char/ip2.c +++ b/drivers/char/ip2.c @@ -7,7 +7,6 @@ // #include -#include #include #include diff --git a/drivers/char/mwave/tp3780i.c b/drivers/char/mwave/tp3780i.c index d6c72e0934e2..cc3e54dd7234 100644 --- a/drivers/char/mwave/tp3780i.c +++ b/drivers/char/mwave/tp3780i.c @@ -46,7 +46,6 @@ * First release to the public */ -#include #include #include #include diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c index 3b965a651da4..26448f176803 100644 --- a/drivers/char/mxser.c +++ b/drivers/char/mxser.c @@ -38,7 +38,6 @@ #include #include -#include #include #include #include diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c index 352547eabf7b..0bbfce43031c 100644 --- a/drivers/char/specialix.c +++ b/drivers/char/specialix.c @@ -90,7 +90,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h index 99a60496ecc6..9293bcc4dc62 100644 --- a/drivers/char/tpm/tpm.h +++ b/drivers/char/tpm/tpm.h @@ -19,7 +19,6 @@ * */ #include -#include #include #include #include diff --git a/drivers/char/viocons.c b/drivers/char/viocons.c index 98601c7d04a9..4d75c261f98a 100644 --- a/drivers/char/viocons.c +++ b/drivers/char/viocons.c @@ -26,7 +26,6 @@ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include -#include #include #include #include diff --git a/drivers/char/viotape.c b/drivers/char/viotape.c index 867cc4e418c7..60aabdb4a046 100644 --- a/drivers/char/viotape.c +++ b/drivers/char/viotape.c @@ -32,7 +32,6 @@ * iseries/vio.h */ #include -#include #include #include #include diff --git a/drivers/firmware/dell_rbu.c b/drivers/firmware/dell_rbu.c index ba17292eb290..6d83299e7c9b 100644 --- a/drivers/firmware/dell_rbu.c +++ b/drivers/firmware/dell_rbu.c @@ -34,7 +34,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ -#include #include #include #include diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 2687e34aa5bc..321a3a10e69b 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -32,7 +32,6 @@ * $Id: ib_srp.c 3932 2005-11-01 17:19:29Z roland $ */ -#include #include #include #include diff --git a/drivers/isdn/divert/divert_init.c b/drivers/isdn/divert/divert_init.c index 434e684f5dbb..2f7c9fc2e898 100644 --- a/drivers/isdn/divert/divert_init.c +++ b/drivers/isdn/divert/divert_init.c @@ -10,7 +10,6 @@ */ #include -#include #include #include diff --git a/drivers/isdn/divert/divert_procfs.c b/drivers/isdn/divert/divert_procfs.c index 0b0ea26023e5..1b37d86d5ee1 100644 --- a/drivers/isdn/divert/divert_procfs.c +++ b/drivers/isdn/divert/divert_procfs.c @@ -11,7 +11,6 @@ #include #include -#include #include #include #ifdef CONFIG_PROC_FS diff --git a/drivers/isdn/divert/isdn_divert.c b/drivers/isdn/divert/isdn_divert.c index 0bfd698726a6..f1a1f9a9b88e 100644 --- a/drivers/isdn/divert/isdn_divert.c +++ b/drivers/isdn/divert/isdn_divert.c @@ -9,7 +9,6 @@ * */ -#include #include #include "isdn_divert.h" diff --git a/drivers/isdn/hisax/hisax_fcpcipnp.c b/drivers/isdn/hisax/hisax_fcpcipnp.c index b4d795d40154..dc7ef957e897 100644 --- a/drivers/isdn/hisax/hisax_fcpcipnp.c +++ b/drivers/isdn/hisax/hisax_fcpcipnp.c @@ -23,7 +23,6 @@ * o tx_skb at PH_DEACTIVATE time */ -#include #include #include #include diff --git a/drivers/isdn/hisax/st5481_init.c b/drivers/isdn/hisax/st5481_init.c index 2cf5d1a6df6c..8e192a3a3490 100644 --- a/drivers/isdn/hisax/st5481_init.c +++ b/drivers/isdn/hisax/st5481_init.c @@ -25,7 +25,6 @@ */ #include -#include #include #include #include diff --git a/drivers/isdn/hysdn/hycapi.c b/drivers/isdn/hysdn/hycapi.c index 1fd3d4e5f284..acc1d3cceebb 100644 --- a/drivers/isdn/hysdn/hycapi.c +++ b/drivers/isdn/hysdn/hycapi.c @@ -11,7 +11,6 @@ */ #include -#include #include #include #include diff --git a/drivers/isdn/hysdn/hysdn_init.c b/drivers/isdn/hysdn/hysdn_init.c index 12c8137b5161..cb791f8e793a 100644 --- a/drivers/isdn/hysdn/hysdn_init.c +++ b/drivers/isdn/hysdn/hysdn_init.c @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/isdn/hysdn/hysdn_net.c b/drivers/isdn/hysdn/hysdn_net.c index babec8157ae6..aa01628d74c6 100644 --- a/drivers/isdn/hysdn/hysdn_net.c +++ b/drivers/isdn/hysdn/hysdn_net.c @@ -14,7 +14,6 @@ */ #include -#include #include #include #include diff --git a/drivers/isdn/hysdn/hysdn_procconf.c b/drivers/isdn/hysdn/hysdn_procconf.c index 87f59a0e2a95..40e56143c768 100644 --- a/drivers/isdn/hysdn/hysdn_procconf.c +++ b/drivers/isdn/hysdn/hysdn_procconf.c @@ -12,7 +12,6 @@ */ #include -#include #include #include #include diff --git a/drivers/isdn/hysdn/hysdn_proclog.c b/drivers/isdn/hysdn/hysdn_proclog.c index 4d57011c5737..6c26f1efabd5 100644 --- a/drivers/isdn/hysdn/hysdn_proclog.c +++ b/drivers/isdn/hysdn/hysdn_proclog.c @@ -11,7 +11,6 @@ */ #include -#include #include #include #include diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c index 8a7d54a5c97d..4643df097bfe 100644 --- a/drivers/isdn/i4l/isdn_common.c +++ b/drivers/isdn/i4l/isdn_common.c @@ -14,7 +14,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/isdn/icn/icn.h b/drivers/isdn/icn/icn.h index 9028cc3b5071..7d7245fb0b32 100644 --- a/drivers/isdn/icn/icn.h +++ b/drivers/isdn/icn/icn.h @@ -35,7 +35,6 @@ typedef struct icn_cdef { #ifdef __KERNEL__ /* Kernel includes */ -#include #include #include #include diff --git a/drivers/isdn/isdnloop/isdnloop.h b/drivers/isdn/isdnloop/isdnloop.h index 8fb7bc1bfe0f..d699fe53e1c3 100644 --- a/drivers/isdn/isdnloop/isdnloop.h +++ b/drivers/isdn/isdnloop/isdnloop.h @@ -33,7 +33,6 @@ typedef struct isdnloop_sdef { #ifdef __KERNEL__ /* Kernel includes */ -#include #include #include #include diff --git a/drivers/isdn/sc/includes.h b/drivers/isdn/sc/includes.h index 4611da6e9231..5286e0c810a9 100644 --- a/drivers/isdn/sc/includes.h +++ b/drivers/isdn/sc/includes.h @@ -4,7 +4,6 @@ * */ -#include #include #include #include diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index 01654fcabc52..e59694bc5758 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c @@ -21,7 +21,6 @@ */ #include -#include #include #include #include diff --git a/drivers/media/video/arv.c b/drivers/media/video/arv.c index 0823ddaf7004..881cdcb1875d 100644 --- a/drivers/media/video/arv.c +++ b/drivers/media/video/arv.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/media/video/zr36016.c b/drivers/media/video/zr36016.c index d4740a89cea1..4ed898585c70 100644 --- a/drivers/media/video/zr36016.c +++ b/drivers/media/video/zr36016.c @@ -26,7 +26,6 @@ #define ZR016_VERSION "v0.7" -#include #include #include #include diff --git a/drivers/media/video/zr36050.c b/drivers/media/video/zr36050.c index 13b1e7b6fd6e..0144576a6123 100644 --- a/drivers/media/video/zr36050.c +++ b/drivers/media/video/zr36050.c @@ -26,7 +26,6 @@ #define ZR050_VERSION "v0.7.1" -#include #include #include #include diff --git a/drivers/media/video/zr36060.c b/drivers/media/video/zr36060.c index b50dc403e6db..129744a07abd 100644 --- a/drivers/media/video/zr36060.c +++ b/drivers/media/video/zr36060.c @@ -26,7 +26,6 @@ #define ZR060_VERSION "v0.7" -#include #include #include #include diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index 790a2932ded9..65c2ec5c421b 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c @@ -47,7 +47,6 @@ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ #include -#include #include #include #include diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h index e7efeb7740b9..5f5b3fb5b4d7 100644 --- a/drivers/message/fusion/mptbase.h +++ b/drivers/message/fusion/mptbase.h @@ -49,7 +49,6 @@ #define MPTBASE_H_INCLUDED /*{-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ -#include #include #include #include diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c index cb2d59d5f5af..602138f8544d 100644 --- a/drivers/message/fusion/mptctl.c +++ b/drivers/message/fusion/mptctl.c @@ -45,7 +45,6 @@ */ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ -#include #include #include #include diff --git a/drivers/message/fusion/mptctl.h b/drivers/message/fusion/mptctl.h index 28754a9cb803..518996e03481 100644 --- a/drivers/message/fusion/mptctl.h +++ b/drivers/message/fusion/mptctl.h @@ -49,7 +49,6 @@ #define MPTCTL_H_INCLUDED /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ -#include "linux/version.h" /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ diff --git a/drivers/message/fusion/mptlan.h b/drivers/message/fusion/mptlan.h index 750e343eb981..3726ecba5707 100644 --- a/drivers/message/fusion/mptlan.h +++ b/drivers/message/fusion/mptlan.h @@ -66,7 +66,6 @@ #include #include #include -#include #include #include // #include diff --git a/drivers/misc/hdpuftrs/hdpu_cpustate.c b/drivers/misc/hdpuftrs/hdpu_cpustate.c index 9c4dd682ac74..bc2b72b32905 100644 --- a/drivers/misc/hdpuftrs/hdpu_cpustate.c +++ b/drivers/misc/hdpuftrs/hdpu_cpustate.c @@ -14,7 +14,6 @@ * */ -#include #include #include #include diff --git a/drivers/misc/hdpuftrs/hdpu_nexus.c b/drivers/misc/hdpuftrs/hdpu_nexus.c index 165f3405df27..4bb461793851 100644 --- a/drivers/misc/hdpuftrs/hdpu_nexus.c +++ b/drivers/misc/hdpuftrs/hdpu_nexus.c @@ -14,7 +14,6 @@ * */ -#include #include #include #include diff --git a/drivers/misc/ibmasm/ibmasm.h b/drivers/misc/ibmasm/ibmasm.h index ecce4ffd3e23..d7e20a34f88d 100644 --- a/drivers/misc/ibmasm/ibmasm.h +++ b/drivers/misc/ibmasm/ibmasm.h @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/mtd/chips/cfi_cmdset_0020.c b/drivers/mtd/chips/cfi_cmdset_0020.c index c4a19d2dc67f..0807c1c91e55 100644 --- a/drivers/mtd/chips/cfi_cmdset_0020.c +++ b/drivers/mtd/chips/cfi_cmdset_0020.c @@ -20,7 +20,6 @@ * - Plugged memory leak in cfi_staa_writev(). */ -#include #include #include #include diff --git a/drivers/mtd/devices/pmc551.c b/drivers/mtd/devices/pmc551.c index de48b35f5609..666cce1bf60c 100644 --- a/drivers/mtd/devices/pmc551.c +++ b/drivers/mtd/devices/pmc551.c @@ -82,7 +82,6 @@ * * Comb the init routine. It's still a bit cludgy on a few things. */ -#include #include #include #include diff --git a/drivers/mtd/maps/ebony.c b/drivers/mtd/maps/ebony.c index c0daf58357ca..60a6e51d662f 100644 --- a/drivers/mtd/maps/ebony.c +++ b/drivers/mtd/maps/ebony.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/mtd/maps/ocotea.c b/drivers/mtd/maps/ocotea.c index 6e559bc14636..c223514ca2eb 100644 --- a/drivers/mtd/maps/ocotea.c +++ b/drivers/mtd/maps/ocotea.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/mtd/maps/walnut.c b/drivers/mtd/maps/walnut.c index 5c17bca3a37e..f46bec66150f 100644 --- a/drivers/mtd/maps/walnut.c +++ b/drivers/mtd/maps/walnut.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/mtd/nand/au1550nd.c b/drivers/mtd/nand/au1550nd.c index 3cafcdf28aed..9c5945d6df88 100644 --- a/drivers/mtd/nand/au1550nd.c +++ b/drivers/mtd/nand/au1550nd.c @@ -17,6 +17,7 @@ #include #include #include +#include #include /* fixme: this is ugly */ diff --git a/drivers/mtd/nand/autcpu12.c b/drivers/mtd/nand/autcpu12.c index 056dfc17a075..a3c7fea404d0 100644 --- a/drivers/mtd/nand/autcpu12.c +++ b/drivers/mtd/nand/autcpu12.c @@ -27,7 +27,6 @@ * 10-06-2002 TG 128K card support added */ -#include #include #include #include diff --git a/drivers/net/b44.c b/drivers/net/b44.c index 0ee3e27969c6..819a17921cb9 100644 --- a/drivers/net/b44.c +++ b/drivers/net/b44.c @@ -18,7 +18,6 @@ #include #include #include -#include #include #include diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c index 50f43dbf31ae..1f7ca453bb4a 100644 --- a/drivers/net/cassini.c +++ b/drivers/net/cassini.c @@ -67,7 +67,6 @@ */ #include -#include #include #include diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c index c0af6fb1fbba..f8c9bcdab68b 100644 --- a/drivers/net/dm9000.c +++ b/drivers/net/dm9000.c @@ -60,7 +60,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/net/fs_enet/fs_enet.h b/drivers/net/fs_enet/fs_enet.h index 1105543b9d88..e7ec96c964a9 100644 --- a/drivers/net/fs_enet/fs_enet.h +++ b/drivers/net/fs_enet/fs_enet.h @@ -4,7 +4,6 @@ #include #include #include -#include #include #include diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index 962580f2c4ab..54d294ad6df5 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c @@ -90,7 +90,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h index c77ca6c0d04a..220084e53341 100644 --- a/drivers/net/gianfar.h +++ b/drivers/net/gianfar.h @@ -43,7 +43,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/net/gianfar_ethtool.c b/drivers/net/gianfar_ethtool.c index 68e3578e7613..5a2d810ce575 100644 --- a/drivers/net/gianfar_ethtool.c +++ b/drivers/net/gianfar_ethtool.c @@ -34,7 +34,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/net/gianfar_mii.c b/drivers/net/gianfar_mii.c index 5a74d3d3dbe1..7263395d78bb 100644 --- a/drivers/net/gianfar_mii.c +++ b/drivers/net/gianfar_mii.c @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c index b71fab6e34f4..e92c17f6931c 100644 --- a/drivers/net/hp100.c +++ b/drivers/net/hp100.c @@ -96,7 +96,6 @@ #undef HP100_MULTICAST_FILTER /* Need to be debugged... */ -#include #include #include #include diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c index 94239f67f3a3..be191d80ef9c 100644 --- a/drivers/net/ibmveth.c +++ b/drivers/net/ibmveth.c @@ -35,7 +35,6 @@ #include #include -#include #include #include #include diff --git a/drivers/net/iseries_veth.c b/drivers/net/iseries_veth.c index d86d8f055a6c..77eadf84cb2c 100644 --- a/drivers/net/iseries_veth.c +++ b/drivers/net/iseries_veth.c @@ -58,7 +58,6 @@ #include #include -#include #include #include #include diff --git a/drivers/net/mac8390.c b/drivers/net/mac8390.c index ce5761816a64..d8c99f038fa0 100644 --- a/drivers/net/mac8390.c +++ b/drivers/net/mac8390.c @@ -15,7 +15,6 @@ * and fixed access to Sonic Sys card which masquerades as a Farallon * by rayk@knightsmanor.org */ -#include #include #include #include diff --git a/drivers/net/mv643xx_eth.h b/drivers/net/mv643xx_eth.h index bcfda5192da0..f769f9b626ea 100644 --- a/drivers/net/mv643xx_eth.h +++ b/drivers/net/mv643xx_eth.h @@ -1,7 +1,6 @@ #ifndef __MV643XX_ETH_H__ #define __MV643XX_ETH_H__ -#include #include #include #include diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index 0745dd9d01f3..8e41f4cea272 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c @@ -55,7 +55,6 @@ #include #include #include -#include #include #include diff --git a/drivers/net/sk98lin/h/skdrv1st.h b/drivers/net/sk98lin/h/skdrv1st.h index 308440bd0e12..91b8d4f45904 100644 --- a/drivers/net/sk98lin/h/skdrv1st.h +++ b/drivers/net/sk98lin/h/skdrv1st.h @@ -39,9 +39,6 @@ #ifndef __INC_SKDRV1ST_H #define __INC_SKDRV1ST_H -/* Check kernel version */ -#include - typedef struct s_AC SK_AC; /* Set card versions */ diff --git a/drivers/net/sk_mca.c b/drivers/net/sk_mca.c index 4c56b8d8221b..e5d6d95960c7 100644 --- a/drivers/net/sk_mca.c +++ b/drivers/net/sk_mca.c @@ -93,7 +93,6 @@ History: #include #include #include -#include #include #include #include diff --git a/drivers/net/sk_mca.h b/drivers/net/sk_mca.h index 7e7c99582746..d6fa1823dfa6 100644 --- a/drivers/net/sk_mca.h +++ b/drivers/net/sk_mca.h @@ -1,5 +1,3 @@ -#include - #ifndef _SK_MCA_INCLUDE_ #define _SK_MCA_INCLUDE_ diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c index 38b2b0a3ce96..d167deda9a53 100644 --- a/drivers/net/starfire.c +++ b/drivers/net/starfire.c @@ -147,7 +147,6 @@ TODO: - fix forced speed/duplexing code (broken a long time ago, when #define DRV_RELDATE "October 3, 2005" #include -#include #include #include #include diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c index a368d08e7d19..82c6b757d306 100644 --- a/drivers/net/via-velocity.c +++ b/drivers/net/via-velocity.c @@ -61,7 +61,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/net/wireless/hostap/hostap.c b/drivers/net/wireless/hostap/hostap.c index 6a96cd9f2685..3d2ea61033be 100644 --- a/drivers/net/wireless/hostap/hostap.c +++ b/drivers/net/wireless/hostap/hostap.c @@ -13,7 +13,6 @@ */ #include -#include #include #include #include diff --git a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c index 59fc15572395..abfae7fedebc 100644 --- a/drivers/net/wireless/hostap/hostap_hw.c +++ b/drivers/net/wireless/hostap/hostap_hw.c @@ -31,7 +31,6 @@ #include -#include #include #include diff --git a/drivers/net/wireless/hostap/hostap_pci.c b/drivers/net/wireless/hostap/hostap_pci.c index da0c80fb941c..2e85bdced2dd 100644 --- a/drivers/net/wireless/hostap/hostap_pci.c +++ b/drivers/net/wireless/hostap/hostap_pci.c @@ -5,7 +5,6 @@ * Andy Warner */ #include -#include #include #include #include diff --git a/drivers/net/wireless/hostap/hostap_plx.c b/drivers/net/wireless/hostap/hostap_plx.c index 78d67b408b2f..94fe2449f099 100644 --- a/drivers/net/wireless/hostap/hostap_plx.c +++ b/drivers/net/wireless/hostap/hostap_plx.c @@ -8,7 +8,6 @@ #include -#include #include #include #include diff --git a/drivers/net/wireless/ipw2100.h b/drivers/net/wireless/ipw2100.h index c9e99ce15d66..1f23650c077f 100644 --- a/drivers/net/wireless/ipw2100.h +++ b/drivers/net/wireless/ipw2100.h @@ -37,7 +37,6 @@ #include #include #include -#include #include // new driver API #include diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 3db0c32afe82..589aef8ba4e6 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -31,6 +31,7 @@ ******************************************************************************/ #include "ipw2200.h" +#include #define IPW2200_VERSION "1.0.0" #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2200/2915 Network Driver" diff --git a/drivers/net/wireless/ipw2200.h b/drivers/net/wireless/ipw2200.h index e9cf32bf3e31..0873b758f499 100644 --- a/drivers/net/wireless/ipw2200.h +++ b/drivers/net/wireless/ipw2200.h @@ -34,7 +34,6 @@ #include #include -#include #include #include #include diff --git a/drivers/net/wireless/orinoco.h b/drivers/net/wireless/orinoco.h index 7a17bb31fc89..f5d856db92a1 100644 --- a/drivers/net/wireless/orinoco.h +++ b/drivers/net/wireless/orinoco.h @@ -12,7 +12,6 @@ #include #include #include -#include #include "hermes.h" diff --git a/drivers/net/wireless/prism54/isl_38xx.c b/drivers/net/wireless/prism54/isl_38xx.c index adc7499136dc..aaa958798f3f 100644 --- a/drivers/net/wireless/prism54/isl_38xx.c +++ b/drivers/net/wireless/prism54/isl_38xx.c @@ -18,7 +18,6 @@ * */ -#include #include #include #include diff --git a/drivers/net/wireless/prism54/isl_38xx.h b/drivers/net/wireless/prism54/isl_38xx.h index e83e4912ab66..8af20980af8d 100644 --- a/drivers/net/wireless/prism54/isl_38xx.h +++ b/drivers/net/wireless/prism54/isl_38xx.h @@ -20,7 +20,6 @@ #ifndef _ISL_38XX_H #define _ISL_38XX_H -#include #include #include diff --git a/drivers/net/wireless/prism54/isl_ioctl.c b/drivers/net/wireless/prism54/isl_ioctl.c index 5c1a1adf1ff8..135a156db25d 100644 --- a/drivers/net/wireless/prism54/isl_ioctl.c +++ b/drivers/net/wireless/prism54/isl_ioctl.c @@ -20,7 +20,6 @@ * */ -#include #include #include #include diff --git a/drivers/net/wireless/prism54/islpci_dev.c b/drivers/net/wireless/prism54/islpci_dev.c index 78bdb359835e..5ddf29599032 100644 --- a/drivers/net/wireless/prism54/islpci_dev.c +++ b/drivers/net/wireless/prism54/islpci_dev.c @@ -19,7 +19,6 @@ * */ -#include #include #include diff --git a/drivers/net/wireless/prism54/islpci_dev.h b/drivers/net/wireless/prism54/islpci_dev.h index efbed4397951..07053165e4c5 100644 --- a/drivers/net/wireless/prism54/islpci_dev.h +++ b/drivers/net/wireless/prism54/islpci_dev.h @@ -23,7 +23,6 @@ #ifndef _ISLPCI_DEV_H #define _ISLPCI_DEV_H -#include #include #include #include diff --git a/drivers/net/wireless/prism54/islpci_eth.c b/drivers/net/wireless/prism54/islpci_eth.c index fc1eb3564832..80ae081ab4b7 100644 --- a/drivers/net/wireless/prism54/islpci_eth.c +++ b/drivers/net/wireless/prism54/islpci_eth.c @@ -17,7 +17,6 @@ * */ -#include #include #include diff --git a/drivers/net/wireless/prism54/islpci_hotplug.c b/drivers/net/wireless/prism54/islpci_hotplug.c index dc040caab7d7..b41d666fea3c 100644 --- a/drivers/net/wireless/prism54/islpci_hotplug.c +++ b/drivers/net/wireless/prism54/islpci_hotplug.c @@ -18,7 +18,6 @@ * */ -#include #include #include #include diff --git a/drivers/pcmcia/au1000_pb1x00.c b/drivers/pcmcia/au1000_pb1x00.c index d414a3bb50b9..86c0808d6a05 100644 --- a/drivers/pcmcia/au1000_pb1x00.c +++ b/drivers/pcmcia/au1000_pb1x00.c @@ -30,7 +30,6 @@ #include #include #include -#include #include #include diff --git a/drivers/pcmcia/au1000_xxs1500.c b/drivers/pcmcia/au1000_xxs1500.c index f113b69d699b..01a895bc9a47 100644 --- a/drivers/pcmcia/au1000_xxs1500.c +++ b/drivers/pcmcia/au1000_xxs1500.c @@ -35,7 +35,6 @@ #include #include #include -#include #include #include diff --git a/drivers/s390/crypto/z90main.c b/drivers/s390/crypto/z90main.c index 04c2ef778ec6..4010f2bb85af 100644 --- a/drivers/s390/crypto/z90main.c +++ b/drivers/s390/crypto/z90main.c @@ -37,7 +37,6 @@ #include #include #include -#include #include "z90crypt.h" #include "z90common.h" diff --git a/drivers/s390/net/claw.c b/drivers/s390/net/claw.c index 1a1c3decea72..6b63d21612ec 100644 --- a/drivers/s390/net/claw.c +++ b/drivers/s390/net/claw.c @@ -88,7 +88,6 @@ #include #include #include -#include #include "cu3088.h" #include "claw.h" diff --git a/drivers/scsi/3w-xxxx.h b/drivers/scsi/3w-xxxx.h index 98bad773f240..4f81fc39ec57 100644 --- a/drivers/scsi/3w-xxxx.h +++ b/drivers/scsi/3w-xxxx.h @@ -54,7 +54,6 @@ #ifndef _3W_XXXX_H #define _3W_XXXX_H -#include #include /* AEN strings */ diff --git a/drivers/scsi/a2091.c b/drivers/scsi/a2091.c index f7a1751e892d..30a14ba77a6a 100644 --- a/drivers/scsi/a2091.c +++ b/drivers/scsi/a2091.c @@ -2,7 +2,6 @@ #include #include #include -#include #include #include diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.h b/drivers/scsi/aic7xxx/aic79xx_osm.h index 052c6619accc..bc44222d6cc3 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm.h +++ b/drivers/scsi/aic7xxx/aic79xx_osm.h @@ -49,7 +49,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.h b/drivers/scsi/aic7xxx/aic7xxx_osm.h index be9edbe26dbe..f2a95447142c 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.h +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.h @@ -66,7 +66,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/scsi/amiga7xx.c b/drivers/scsi/amiga7xx.c index 5f13546d6392..dea8446f5360 100644 --- a/drivers/scsi/amiga7xx.c +++ b/drivers/scsi/amiga7xx.c @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/scsi/bvme6000.c b/drivers/scsi/bvme6000.c index 29c7ed30c09e..130f30f51a9b 100644 --- a/drivers/scsi/bvme6000.c +++ b/drivers/scsi/bvme6000.c @@ -7,7 +7,6 @@ #include #include #include -#include #include #include diff --git a/drivers/scsi/gvp11.c b/drivers/scsi/gvp11.c index d12342fa8199..ab22387c9df1 100644 --- a/drivers/scsi/gvp11.c +++ b/drivers/scsi/gvp11.c @@ -2,7 +2,6 @@ #include #include #include -#include #include #include diff --git a/drivers/scsi/ibmmca.c b/drivers/scsi/ibmmca.c index 887a5c3ded28..8d97999db60e 100644 --- a/drivers/scsi/ibmmca.c +++ b/drivers/scsi/ibmmca.c @@ -18,12 +18,6 @@ */ #include -#ifndef LINUX_VERSION_CODE -#include -#endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,45) -#error "This driver works only with kernel 2.5.45 or higher!" -#endif #include #include #include diff --git a/drivers/scsi/ips.h b/drivers/scsi/ips.h index 505e967013de..adc6eabbf610 100644 --- a/drivers/scsi/ips.h +++ b/drivers/scsi/ips.h @@ -50,6 +50,7 @@ #ifndef _IPS_H_ #define _IPS_H_ +#include #include #include diff --git a/drivers/scsi/megaraid/mega_common.h b/drivers/scsi/megaraid/mega_common.h index 69df1a9b935d..8e547130e97d 100644 --- a/drivers/scsi/megaraid/mega_common.h +++ b/drivers/scsi/megaraid/mega_common.h @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/scsi/megaraid/megaraid_mm.h b/drivers/scsi/megaraid/megaraid_mm.h index 7e36c46e7c43..eb8c390a0fa3 100644 --- a/drivers/scsi/megaraid/megaraid_mm.h +++ b/drivers/scsi/megaraid/megaraid_mm.h @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c index 4245d05e628b..801a63bea8a5 100644 --- a/drivers/scsi/megaraid/megaraid_sas.c +++ b/drivers/scsi/megaraid/megaraid_sas.c @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/scsi/mvme147.c b/drivers/scsi/mvme147.c index 2fb31ee6d9f5..33380cee9b77 100644 --- a/drivers/scsi/mvme147.c +++ b/drivers/scsi/mvme147.c @@ -2,7 +2,6 @@ #include #include #include -#include #include #include diff --git a/drivers/scsi/mvme16x.c b/drivers/scsi/mvme16x.c index b2d8d8ea1604..29ec699e0e4d 100644 --- a/drivers/scsi/mvme16x.c +++ b/drivers/scsi/mvme16x.c @@ -7,7 +7,6 @@ #include #include #include -#include #include #include diff --git a/drivers/scsi/nsp32.h b/drivers/scsi/nsp32.h index 5664398fa0ad..5addf9fb1e15 100644 --- a/drivers/scsi/nsp32.h +++ b/drivers/scsi/nsp32.h @@ -16,6 +16,7 @@ #ifndef _NSP32_H #define _NSP32_H +#include //#define NSP32_DEBUG 9 /* diff --git a/drivers/scsi/pci2000.h b/drivers/scsi/pci2000.h index c65afc964121..6c962d7dca47 100644 --- a/drivers/scsi/pci2000.h +++ b/drivers/scsi/pci2000.h @@ -26,9 +26,6 @@ #ifndef PSI_EIDE_SCSIOP #define PSI_EIDE_SCSIOP 1 -#ifndef LINUX_VERSION_CODE -#include -#endif #define LINUXVERSION(v,p,s) (((v)<<16) + ((p)<<8) + (s)) /************************************************/ diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index aadf051274fa..b61fb1295b8b 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -48,10 +48,6 @@ #include -#ifndef LINUX_VERSION_CODE -#include -#endif - #include "scsi_logging.h" #include "scsi_debug.h" diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 62e3f340cc52..72ec59456e69 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -68,10 +68,6 @@ static int sg_proc_init(void); static void sg_proc_cleanup(void); #endif -#ifndef LINUX_VERSION_CODE -#include -#endif /* LINUX_VERSION_CODE */ - #define SG_ALLOW_DIO_DEF 0 #define SG_ALLOW_DIO_CODE /* compile out by commenting this define */ diff --git a/drivers/scsi/sgiwd93.c b/drivers/scsi/sgiwd93.c index 09fd203e4b86..f37147f8f7bf 100644 --- a/drivers/scsi/sgiwd93.c +++ b/drivers/scsi/sgiwd93.c @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/scsi/wd33c93.c b/drivers/scsi/wd33c93.c index 5754445fb36a..fd63add6a577 100644 --- a/drivers/scsi/wd33c93.c +++ b/drivers/scsi/wd33c93.c @@ -77,7 +77,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/telephony/ixj.h b/drivers/telephony/ixj.h index 51e3f7f6597b..fbea4541c234 100644 --- a/drivers/telephony/ixj.h +++ b/drivers/telephony/ixj.h @@ -40,7 +40,6 @@ *****************************************************************************/ #define IXJ_VERSION 3031 -#include #include #include diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c index 975ace3f5b1e..904519085334 100644 --- a/drivers/usb/gadget/dummy_hcd.c +++ b/drivers/usb/gadget/dummy_hcd.c @@ -49,7 +49,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/usb/gadget/lh7a40x_udc.h b/drivers/usb/gadget/lh7a40x_udc.h index 1bb455c045a9..9b2e6f7cbb8b 100644 --- a/drivers/usb/gadget/lh7a40x_udc.h +++ b/drivers/usb/gadget/lh7a40x_udc.h @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/usb/gadget/pxa2xx_udc.c b/drivers/usb/gadget/pxa2xx_udc.c index ee9cd7869d92..510d28a924db 100644 --- a/drivers/usb/gadget/pxa2xx_udc.c +++ b/drivers/usb/gadget/pxa2xx_udc.c @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/usb/gadget/rndis.c b/drivers/usb/gadget/rndis.c index 06b6eba925b5..9689efeb364c 100644 --- a/drivers/usb/gadget/rndis.c +++ b/drivers/usb/gadget/rndis.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/usb/host/hc_crisv10.c b/drivers/usb/host/hc_crisv10.c index a8267cf17db4..0eaabeb37ac3 100644 --- a/drivers/usb/host/hc_crisv10.c +++ b/drivers/usb/host/hc_crisv10.c @@ -14,7 +14,6 @@ #include #include #include -#include #include #include diff --git a/drivers/usb/media/pwc/pwc-if.c b/drivers/usb/media/pwc/pwc-if.c index b77e65c03659..5524fd70210b 100644 --- a/drivers/usb/media/pwc/pwc-if.c +++ b/drivers/usb/media/pwc/pwc-if.c @@ -62,6 +62,7 @@ #include #include #include +#include #include #include "pwc.h" diff --git a/drivers/usb/media/pwc/pwc.h b/drivers/usb/media/pwc/pwc.h index 267869dab185..6dd76bb3dff1 100644 --- a/drivers/usb/media/pwc/pwc.h +++ b/drivers/usb/media/pwc/pwc.h @@ -25,8 +25,6 @@ #ifndef PWC_H #define PWC_H -#include - #include #include #include diff --git a/drivers/usb/media/w9968cf.c b/drivers/usb/media/w9968cf.c index f36c0b6c6e36..67612c81cb9f 100644 --- a/drivers/usb/media/w9968cf.c +++ b/drivers/usb/media/w9968cf.c @@ -25,7 +25,6 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * ***************************************************************************/ -#include #include #include #include diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c index c946c9a538a0..41ef2b606751 100644 --- a/drivers/usb/misc/sisusbvga/sisusb.c +++ b/drivers/usb/misc/sisusbvga/sisusb.c @@ -37,7 +37,6 @@ */ #include -#include #include #include #include diff --git a/drivers/usb/misc/sisusbvga/sisusb.h b/drivers/usb/misc/sisusbvga/sisusb.h index 401ff21d7881..1d7a77cc7c4a 100644 --- a/drivers/usb/misc/sisusbvga/sisusb.h +++ b/drivers/usb/misc/sisusbvga/sisusb.h @@ -37,6 +37,7 @@ #ifndef _SISUSB_H_ #define _SISUSB_H_ +#include #ifdef CONFIG_COMPAT #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,10) #include diff --git a/drivers/usb/misc/sisusbvga/sisusb_con.c b/drivers/usb/misc/sisusbvga/sisusb_con.c index 24584463553d..be5c1a25ae21 100644 --- a/drivers/usb/misc/sisusbvga/sisusb_con.c +++ b/drivers/usb/misc/sisusbvga/sisusb_con.c @@ -48,7 +48,6 @@ */ #include -#include #include #include #include diff --git a/drivers/usb/misc/sisusbvga/sisusb_init.c b/drivers/usb/misc/sisusbvga/sisusb_init.c index f28bc240f9b6..044fa4482f9f 100644 --- a/drivers/usb/misc/sisusbvga/sisusb_init.c +++ b/drivers/usb/misc/sisusbvga/sisusb_init.c @@ -37,7 +37,6 @@ */ #include -#include #include #include #include diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index acc81cb01d56..9d5015e99372 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c @@ -5,7 +5,6 @@ * */ -#include #include #include #include diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c index 470e6f0ee4dd..68c690605aa7 100644 --- a/drivers/video/backlight/lcd.c +++ b/drivers/video/backlight/lcd.c @@ -5,7 +5,6 @@ * */ -#include #include #include #include diff --git a/drivers/video/intelfb/intelfbdrv.c b/drivers/video/intelfb/intelfbdrv.c index 0799b999b314..427689e584da 100644 --- a/drivers/video/intelfb/intelfbdrv.c +++ b/drivers/video/intelfb/intelfbdrv.c @@ -122,7 +122,6 @@ #include #include #include -#include #include diff --git a/drivers/video/intelfb/intelfbhw.c b/drivers/video/intelfb/intelfbhw.c index ac94c2e5ff85..624c4bc96f0d 100644 --- a/drivers/video/intelfb/intelfbhw.c +++ b/drivers/video/intelfb/intelfbhw.c @@ -34,7 +34,6 @@ #include #include #include -#include #include diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index bbc3cc63854f..89c849da8504 100644 --- a/fs/9p/vfs_file.c +++ b/fs/9p/vfs_file.c @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include diff --git a/fs/adfs/adfs.h b/fs/adfs/adfs.h index fd528433de43..f6cd01352cc8 100644 --- a/fs/adfs/adfs.h +++ b/fs/adfs/adfs.h @@ -12,7 +12,6 @@ #define ADFS_NDA_PUBLIC_READ (1 << 5) #define ADFS_NDA_PUBLIC_WRITE (1 << 6) -#include #include "dir_f.h" struct buffer_head; diff --git a/fs/hfs/hfs_fs.h b/fs/hfs/hfs_fs.h index aae019aadf88..cc5dcd52e23d 100644 --- a/fs/hfs/hfs_fs.h +++ b/fs/hfs/hfs_fs.h @@ -9,7 +9,6 @@ #ifndef _LINUX_HFS_FS_H #define _LINUX_HFS_FS_H -#include #include #include #include diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c index 3f680c5675bf..d499393a8ae7 100644 --- a/fs/hfs/inode.c +++ b/fs/hfs/inode.c @@ -12,7 +12,6 @@ */ #include -#include #include #include "hfs_fs.h" diff --git a/fs/hfsplus/bnode.c b/fs/hfsplus/bnode.c index b85abc6e6f83..930cd9212de8 100644 --- a/fs/hfsplus/bnode.c +++ b/fs/hfsplus/bnode.c @@ -13,7 +13,6 @@ #include #include #include -#include #include "hfsplus_fs.h" #include "hfsplus_raw.h" diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c index 7bda76667a4a..50c8f44b6c66 100644 --- a/fs/hfsplus/dir.c +++ b/fs/hfsplus/dir.c @@ -13,7 +13,6 @@ #include #include #include -#include #include "hfsplus_fs.h" #include "hfsplus_raw.h" diff --git a/fs/hfsplus/extents.c b/fs/hfsplus/extents.c index e7235ca79a95..e3ff56a03011 100644 --- a/fs/hfsplus/extents.c +++ b/fs/hfsplus/extents.c @@ -11,7 +11,6 @@ #include #include #include -#include #include "hfsplus_fs.h" #include "hfsplus_raw.h" diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h index 2bc0cdd30e56..c60e5635498d 100644 --- a/fs/hfsplus/hfsplus_fs.h +++ b/fs/hfsplus/hfsplus_fs.h @@ -11,7 +11,6 @@ #define _LINUX_HFSPLUS_FS_H #include -#include #include #include "hfsplus_raw.h" diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c index f205773ddfbe..fc98583cf045 100644 --- a/fs/hfsplus/inode.c +++ b/fs/hfsplus/inode.c @@ -11,7 +11,6 @@ #include #include #include -#include #include #include "hfsplus_fs.h" diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c index 452fc1fdbd32..0ce1c455ae55 100644 --- a/fs/hfsplus/super.c +++ b/fs/hfsplus/super.c @@ -14,7 +14,6 @@ #include #include #include -#include #include #include diff --git a/fs/hfsplus/wrapper.c b/fs/hfsplus/wrapper.c index 0c51d6338b0b..95455e839231 100644 --- a/fs/hfsplus/wrapper.c +++ b/fs/hfsplus/wrapper.c @@ -12,7 +12,6 @@ #include #include #include -#include #include #include "hfsplus_fs.h" diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index a33fb1d91373..4684eb7d48c6 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c @@ -8,7 +8,6 @@ #include #include -#include #include #include #include diff --git a/fs/xfs/linux-2.6/xfs_linux.h b/fs/xfs/linux-2.6/xfs_linux.h index 44fed10af0dd..d8e21ba0cccc 100644 --- a/fs/xfs/linux-2.6/xfs_linux.h +++ b/fs/xfs/linux-2.6/xfs_linux.h @@ -72,7 +72,6 @@ #include #include #include -#include #include #include diff --git a/fs/xfs/xfs.h b/fs/xfs/xfs.h index 99b50d2bda9b..1a48dbb902a7 100644 --- a/fs/xfs/xfs.h +++ b/fs/xfs/xfs.h @@ -17,12 +17,5 @@ */ #ifndef __XFS_H__ #define __XFS_H__ - -#include -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) #include -#else -#include -#endif - #endif /* __XFS_H__ */ diff --git a/fs/xfs/xfs_dmapi.h b/fs/xfs/xfs_dmapi.h index 5a5c7a63e80b..864bf6955689 100644 --- a/fs/xfs/xfs_dmapi.h +++ b/fs/xfs/xfs_dmapi.h @@ -18,6 +18,7 @@ #ifndef __XFS_DMAPI_H__ #define __XFS_DMAPI_H__ +#include /* Values used to define the on-disk version of dm_attrname_t. All * on-disk attribute names start with the 8-byte string "SGI_DMI_". * diff --git a/include/linux/fs_enet_pd.h b/include/linux/fs_enet_pd.h index bef23bbf8690..783c476b8674 100644 --- a/include/linux/fs_enet_pd.h +++ b/include/linux/fs_enet_pd.h @@ -16,7 +16,6 @@ #ifndef FS_ENET_PD_H #define FS_ENET_PD_H -#include #include #define FS_ENET_NAME "fs_enet" diff --git a/include/linux/if_wanpipe_common.h b/include/linux/if_wanpipe_common.h index f25fec8ee2ca..6e5461d69fdd 100644 --- a/include/linux/if_wanpipe_common.h +++ b/include/linux/if_wanpipe_common.h @@ -17,8 +17,6 @@ #ifndef _WANPIPE_SOCK_DRIVER_COMMON_H #define _WANPIPE_SOCK_DRIVER_COMMON_H -#include - typedef struct { struct net_device *slave; atomic_t packet_sent; diff --git a/include/linux/istallion.h b/include/linux/istallion.h index 5f4ee646c119..1f996621bc9c 100644 --- a/include/linux/istallion.h +++ b/include/linux/istallion.h @@ -21,8 +21,6 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include - /*****************************************************************************/ #ifndef _ISTALLION_H #define _ISTALLION_H diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h index 39f1430bd6d5..3c9ea4b7adda 100644 --- a/include/linux/mtd/cfi.h +++ b/include/linux/mtd/cfi.h @@ -8,7 +8,6 @@ #define __MTD_CFI_H__ #include -#include #include #include #include diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index e95d0463a3e5..b6f2fdae65c6 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h @@ -14,7 +14,6 @@ #endif #include -#include #include #include #include diff --git a/include/linux/phonedev.h b/include/linux/phonedev.h index d54049eed0c3..a0e31adf3abe 100644 --- a/include/linux/phonedev.h +++ b/include/linux/phonedev.h @@ -2,7 +2,6 @@ #define __LINUX_PHONEDEV_H #include -#include #ifdef __KERNEL__ diff --git a/include/linux/stallion.h b/include/linux/stallion.h index e89b77b6505a..13a37f137ea2 100644 --- a/include/linux/stallion.h +++ b/include/linux/stallion.h @@ -21,8 +21,6 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include - /*****************************************************************************/ #ifndef _STALLION_H #define _STALLION_H diff --git a/sound/oss/msnd.c b/sound/oss/msnd.c index 4f1ff1bccdce..a7ad2b0a2ac0 100644 --- a/sound/oss/msnd.c +++ b/sound/oss/msnd.c @@ -24,7 +24,6 @@ * ********************************************************************/ -#include #include #include #include diff --git a/sound/oss/os.h b/sound/oss/os.h index 80dce329cc3a..0490562c7f7f 100644 --- a/sound/oss/os.h +++ b/sound/oss/os.h @@ -5,10 +5,8 @@ #undef DO_TIMINGS #include -#include #ifdef __KERNEL__ -#include #include #include #include diff --git a/sound/oss/rme96xx.c b/sound/oss/rme96xx.c index 7609c68a89f4..318dc51009fe 100644 --- a/sound/oss/rme96xx.c +++ b/sound/oss/rme96xx.c @@ -44,7 +44,6 @@ TODO: #define RMEVERSION "0.8" #endif -#include #include #include #include diff --git a/sound/oss/sh_dac_audio.c b/sound/oss/sh_dac_audio.c index c09cdeedc191..8a9917c919c2 100644 --- a/sound/oss/sh_dac_audio.c +++ b/sound/oss/sh_dac_audio.c @@ -2,7 +2,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/ppc/pmac.h b/sound/ppc/pmac.h index ae3bb6c6edff..bfff788e9847 100644 --- a/sound/ppc/pmac.h +++ b/sound/ppc/pmac.h @@ -22,7 +22,6 @@ #ifndef __PMAC_H #define __PMAC_H -#include #include #include #include "awacs.h" -- cgit v1.2.2 From 33096b1e735b0a36c289ced394da7a25e94bc815 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Tue, 8 Nov 2005 21:34:56 -0800 Subject: [PATCH] hpfs: remove spurious mtime update Remove mtime update in hpfs_file_write, it's done in generic_file_write already. Signed-off-by: Christoph Hellwig Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/hpfs/file.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/fs/hpfs/file.c b/fs/hpfs/file.c index ab144dabd870..7c995ac4081b 100644 --- a/fs/hpfs/file.c +++ b/fs/hpfs/file.c @@ -114,11 +114,8 @@ static ssize_t hpfs_file_write(struct file *file, const char __user *buf, ssize_t retval; retval = generic_file_write(file, buf, count, ppos); - if (retval > 0) { - struct inode *inode = file->f_dentry->d_inode; - inode->i_mtime = CURRENT_TIME_SEC; - hpfs_i(inode)->i_dirty = 1; - } + if (retval > 0) + hpfs_i(file->f_dentry->d_inode)->i_dirty = 1; return retval; } -- cgit v1.2.2 From 41a34a4fe1d4478b1c8b6b6ea634ab1adb156885 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Tue, 8 Nov 2005 21:34:57 -0800 Subject: [PATCH] fat: respect silent mount flag Pass down the silent flag to parse_options(). Without this fat gives warnings when mounting some non-fat rootfs with options. Signed-off-by: Christoph Hellwig Acked-by: OGAWA Hirofumi Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/fat/inode.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/fs/fat/inode.c b/fs/fat/inode.c index e2effe2dc9b2..a0f9b9fe1307 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c @@ -846,7 +846,7 @@ static match_table_t vfat_tokens = { {Opt_err, NULL} }; -static int parse_options(char *options, int is_vfat, int *debug, +static int parse_options(char *options, int is_vfat, int silent, int *debug, struct fat_mount_options *opts) { char *p; @@ -1008,8 +1008,11 @@ static int parse_options(char *options, int is_vfat, int *debug, break; /* unknown option */ default: - printk(KERN_ERR "FAT: Unrecognized mount option \"%s\" " - "or missing value\n", p); + if (!silent) { + printk(KERN_ERR + "FAT: Unrecognized mount option \"%s\" " + "or missing value\n", p); + } return -EINVAL; } } @@ -1091,7 +1094,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, sb->s_export_op = &fat_export_ops; sbi->dir_ops = fs_dir_inode_ops; - error = parse_options(data, isvfat, &debug, &sbi->options); + error = parse_options(data, isvfat, silent, &debug, &sbi->options); if (error) goto out_fail; -- cgit v1.2.2 From 0ad74ffa90fb20b4132ae6e67e473f24621c6af2 Mon Sep 17 00:00:00 2001 From: Jan Kara Date: Tue, 8 Nov 2005 21:34:58 -0800 Subject: [PATCH] Fix return value in reiserfs allocator Make reiserfs correctly return EDQUOT when the allocation failed due to quotas (so far we just returned ENOSPC). Signed-off-by: Jan Kara Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/reiserfs/file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c index c20babd6216d..7892a865b58a 100644 --- a/fs/reiserfs/file.c +++ b/fs/reiserfs/file.c @@ -251,12 +251,12 @@ static int reiserfs_allocate_blocks_for_region(struct reiserfs_transaction_handl blocks_to_allocate, blocks_to_allocate); if (res != CARRY_ON) { - res = -ENOSPC; + res = res == QUOTA_EXCEEDED ? -EDQUOT : -ENOSPC; pathrelse(&path); goto error_exit; } } else { - res = -ENOSPC; + res = res == QUOTA_EXCEEDED ? -EDQUOT : -ENOSPC; pathrelse(&path); goto error_exit; } -- cgit v1.2.2 From 2860b733f114e088b56c20da6145902c16b79a44 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Tue, 8 Nov 2005 21:34:59 -0800 Subject: [PATCH] remove CONFIG_EXT{2,3}_CHECK The CONFIG_EXT{2,3}_CHECK options where were never available, and all they did was to implement a subset of e2fsck in the kernel. Signed-off-by: Adrian Bunk Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/filesystems/ext2.txt | 2 -- fs/ext2/balloc.c | 73 -------------------------------------- fs/ext2/ialloc.c | 40 --------------------- fs/ext2/super.c | 16 +-------- fs/ext3/balloc.c | 73 -------------------------------------- fs/ext3/ialloc.c | 41 --------------------- fs/ext3/super.c | 17 +-------- 7 files changed, 2 insertions(+), 260 deletions(-) diff --git a/Documentation/filesystems/ext2.txt b/Documentation/filesystems/ext2.txt index d16334ec48ba..a8edb376b041 100644 --- a/Documentation/filesystems/ext2.txt +++ b/Documentation/filesystems/ext2.txt @@ -17,8 +17,6 @@ set using tune2fs(8). Kernel-determined defaults are indicated by (*). bsddf (*) Makes `df' act like BSD. minixdf Makes `df' act like Minix. -check Check block and inode bitmaps at mount time - (requires CONFIG_EXT2_CHECK). check=none, nocheck (*) Don't do extra checking of bitmaps on mount (check=normal and check=strict options removed) diff --git a/fs/ext2/balloc.c b/fs/ext2/balloc.c index 6591abef64d0..bb6908066494 100644 --- a/fs/ext2/balloc.c +++ b/fs/ext2/balloc.c @@ -624,76 +624,3 @@ unsigned long ext2_bg_num_gdb(struct super_block *sb, int group) return EXT2_SB(sb)->s_gdb_count; } -#ifdef CONFIG_EXT2_CHECK -/* Called at mount-time, super-block is locked */ -void ext2_check_blocks_bitmap (struct super_block * sb) -{ - struct buffer_head *bitmap_bh = NULL; - struct ext2_super_block * es; - unsigned long desc_count, bitmap_count, x, j; - unsigned long desc_blocks; - struct ext2_group_desc * desc; - int i; - - es = EXT2_SB(sb)->s_es; - desc_count = 0; - bitmap_count = 0; - desc = NULL; - for (i = 0; i < EXT2_SB(sb)->s_groups_count; i++) { - desc = ext2_get_group_desc (sb, i, NULL); - if (!desc) - continue; - desc_count += le16_to_cpu(desc->bg_free_blocks_count); - brelse(bitmap_bh); - bitmap_bh = read_block_bitmap(sb, i); - if (!bitmap_bh) - continue; - - if (ext2_bg_has_super(sb, i) && - !ext2_test_bit(0, bitmap_bh->b_data)) - ext2_error(sb, __FUNCTION__, - "Superblock in group %d is marked free", i); - - desc_blocks = ext2_bg_num_gdb(sb, i); - for (j = 0; j < desc_blocks; j++) - if (!ext2_test_bit(j + 1, bitmap_bh->b_data)) - ext2_error(sb, __FUNCTION__, - "Descriptor block #%ld in group " - "%d is marked free", j, i); - - if (!block_in_use(le32_to_cpu(desc->bg_block_bitmap), - sb, bitmap_bh->b_data)) - ext2_error(sb, "ext2_check_blocks_bitmap", - "Block bitmap for group %d is marked free", - i); - - if (!block_in_use(le32_to_cpu(desc->bg_inode_bitmap), - sb, bitmap_bh->b_data)) - ext2_error(sb, "ext2_check_blocks_bitmap", - "Inode bitmap for group %d is marked free", - i); - - for (j = 0; j < EXT2_SB(sb)->s_itb_per_group; j++) - if (!block_in_use(le32_to_cpu(desc->bg_inode_table) + j, - sb, bitmap_bh->b_data)) - ext2_error (sb, "ext2_check_blocks_bitmap", - "Block #%ld of the inode table in " - "group %d is marked free", j, i); - - x = ext2_count_free(bitmap_bh, sb->s_blocksize); - if (le16_to_cpu(desc->bg_free_blocks_count) != x) - ext2_error (sb, "ext2_check_blocks_bitmap", - "Wrong free blocks count for group %d, " - "stored = %d, counted = %lu", i, - le16_to_cpu(desc->bg_free_blocks_count), x); - bitmap_count += x; - } - if (le32_to_cpu(es->s_free_blocks_count) != bitmap_count) - ext2_error (sb, "ext2_check_blocks_bitmap", - "Wrong free blocks count in super block, " - "stored = %lu, counted = %lu", - (unsigned long)le32_to_cpu(es->s_free_blocks_count), - bitmap_count); - brelse(bitmap_bh); -} -#endif diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c index e2d6208633a7..74714af4ae69 100644 --- a/fs/ext2/ialloc.c +++ b/fs/ext2/ialloc.c @@ -700,43 +700,3 @@ unsigned long ext2_count_dirs (struct super_block * sb) return count; } -#ifdef CONFIG_EXT2_CHECK -/* Called at mount-time, super-block is locked */ -void ext2_check_inodes_bitmap (struct super_block * sb) -{ - struct ext2_super_block * es = EXT2_SB(sb)->s_es; - unsigned long desc_count = 0, bitmap_count = 0; - struct buffer_head *bitmap_bh = NULL; - int i; - - for (i = 0; i < EXT2_SB(sb)->s_groups_count; i++) { - struct ext2_group_desc *desc; - unsigned x; - - desc = ext2_get_group_desc(sb, i, NULL); - if (!desc) - continue; - desc_count += le16_to_cpu(desc->bg_free_inodes_count); - brelse(bitmap_bh); - bitmap_bh = read_inode_bitmap(sb, i); - if (!bitmap_bh) - continue; - - x = ext2_count_free(bitmap_bh, EXT2_INODES_PER_GROUP(sb) / 8); - if (le16_to_cpu(desc->bg_free_inodes_count) != x) - ext2_error (sb, "ext2_check_inodes_bitmap", - "Wrong free inodes count in group %d, " - "stored = %d, counted = %lu", i, - le16_to_cpu(desc->bg_free_inodes_count), x); - bitmap_count += x; - } - brelse(bitmap_bh); - if (percpu_counter_read(&EXT2_SB(sb)->s_freeinodes_counter) != - bitmap_count) - ext2_error(sb, "ext2_check_inodes_bitmap", - "Wrong free inodes count in super block, " - "stored = %lu, counted = %lu", - (unsigned long)le32_to_cpu(es->s_free_inodes_count), - bitmap_count); -} -#endif diff --git a/fs/ext2/super.c b/fs/ext2/super.c index 3c0c7c6a5b44..e4ed4b31a433 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c @@ -281,7 +281,7 @@ static unsigned long get_sb_block(void **data) enum { Opt_bsd_df, Opt_minix_df, Opt_grpid, Opt_nogrpid, Opt_resgid, Opt_resuid, Opt_sb, Opt_err_cont, Opt_err_panic, - Opt_err_ro, Opt_nouid32, Opt_check, Opt_nocheck, Opt_debug, + Opt_err_ro, Opt_nouid32, Opt_nocheck, Opt_debug, Opt_oldalloc, Opt_orlov, Opt_nobh, Opt_user_xattr, Opt_nouser_xattr, Opt_acl, Opt_noacl, Opt_xip, Opt_ignore, Opt_err, Opt_quota, Opt_usrquota, Opt_grpquota @@ -303,7 +303,6 @@ static match_table_t tokens = { {Opt_nouid32, "nouid32"}, {Opt_nocheck, "check=none"}, {Opt_nocheck, "nocheck"}, - {Opt_check, "check"}, {Opt_debug, "debug"}, {Opt_oldalloc, "oldalloc"}, {Opt_orlov, "orlov"}, @@ -376,13 +375,6 @@ static int parse_options (char * options, case Opt_nouid32: set_opt (sbi->s_mount_opt, NO_UID32); break; - case Opt_check: -#ifdef CONFIG_EXT2_CHECK - set_opt (sbi->s_mount_opt, CHECK); -#else - printk("EXT2 Check option not supported\n"); -#endif - break; case Opt_nocheck: clear_opt (sbi->s_mount_opt, CHECK); break; @@ -503,12 +495,6 @@ static int ext2_setup_super (struct super_block * sb, EXT2_BLOCKS_PER_GROUP(sb), EXT2_INODES_PER_GROUP(sb), sbi->s_mount_opt); -#ifdef CONFIG_EXT2_CHECK - if (test_opt (sb, CHECK)) { - ext2_check_blocks_bitmap (sb); - ext2_check_inodes_bitmap (sb); - } -#endif return res; } diff --git a/fs/ext3/balloc.c b/fs/ext3/balloc.c index 7992d21e0e09..ae1148c24c53 100644 --- a/fs/ext3/balloc.c +++ b/fs/ext3/balloc.c @@ -1517,76 +1517,3 @@ unsigned long ext3_bg_num_gdb(struct super_block *sb, int group) return EXT3_SB(sb)->s_gdb_count; } -#ifdef CONFIG_EXT3_CHECK -/* Called at mount-time, super-block is locked */ -void ext3_check_blocks_bitmap (struct super_block * sb) -{ - struct ext3_super_block *es; - unsigned long desc_count, bitmap_count, x, j; - unsigned long desc_blocks; - struct buffer_head *bitmap_bh = NULL; - struct ext3_group_desc *gdp; - int i; - - es = EXT3_SB(sb)->s_es; - desc_count = 0; - bitmap_count = 0; - gdp = NULL; - for (i = 0; i < EXT3_SB(sb)->s_groups_count; i++) { - gdp = ext3_get_group_desc (sb, i, NULL); - if (!gdp) - continue; - desc_count += le16_to_cpu(gdp->bg_free_blocks_count); - brelse(bitmap_bh); - bitmap_bh = read_block_bitmap(sb, i); - if (bitmap_bh == NULL) - continue; - - if (ext3_bg_has_super(sb, i) && - !ext3_test_bit(0, bitmap_bh->b_data)) - ext3_error(sb, __FUNCTION__, - "Superblock in group %d is marked free", i); - - desc_blocks = ext3_bg_num_gdb(sb, i); - for (j = 0; j < desc_blocks; j++) - if (!ext3_test_bit(j + 1, bitmap_bh->b_data)) - ext3_error(sb, __FUNCTION__, - "Descriptor block #%ld in group " - "%d is marked free", j, i); - - if (!block_in_use (le32_to_cpu(gdp->bg_block_bitmap), - sb, bitmap_bh->b_data)) - ext3_error (sb, "ext3_check_blocks_bitmap", - "Block bitmap for group %d is marked free", - i); - - if (!block_in_use (le32_to_cpu(gdp->bg_inode_bitmap), - sb, bitmap_bh->b_data)) - ext3_error (sb, "ext3_check_blocks_bitmap", - "Inode bitmap for group %d is marked free", - i); - - for (j = 0; j < EXT3_SB(sb)->s_itb_per_group; j++) - if (!block_in_use (le32_to_cpu(gdp->bg_inode_table) + j, - sb, bitmap_bh->b_data)) - ext3_error (sb, "ext3_check_blocks_bitmap", - "Block #%d of the inode table in " - "group %d is marked free", j, i); - - x = ext3_count_free(bitmap_bh, sb->s_blocksize); - if (le16_to_cpu(gdp->bg_free_blocks_count) != x) - ext3_error (sb, "ext3_check_blocks_bitmap", - "Wrong free blocks count for group %d, " - "stored = %d, counted = %lu", i, - le16_to_cpu(gdp->bg_free_blocks_count), x); - bitmap_count += x; - } - brelse(bitmap_bh); - if (le32_to_cpu(es->s_free_blocks_count) != bitmap_count) - ext3_error (sb, "ext3_check_blocks_bitmap", - "Wrong free blocks count in super block, " - "stored = %lu, counted = %lu", - (unsigned long)le32_to_cpu(es->s_free_blocks_count), - bitmap_count); -} -#endif diff --git a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c index df3f517c54ac..9e4a24376210 100644 --- a/fs/ext3/ialloc.c +++ b/fs/ext3/ialloc.c @@ -756,44 +756,3 @@ unsigned long ext3_count_dirs (struct super_block * sb) return count; } -#ifdef CONFIG_EXT3_CHECK -/* Called at mount-time, super-block is locked */ -void ext3_check_inodes_bitmap (struct super_block * sb) -{ - struct ext3_super_block * es; - unsigned long desc_count, bitmap_count, x; - struct buffer_head *bitmap_bh = NULL; - struct ext3_group_desc * gdp; - int i; - - es = EXT3_SB(sb)->s_es; - desc_count = 0; - bitmap_count = 0; - gdp = NULL; - for (i = 0; i < EXT3_SB(sb)->s_groups_count; i++) { - gdp = ext3_get_group_desc (sb, i, NULL); - if (!gdp) - continue; - desc_count += le16_to_cpu(gdp->bg_free_inodes_count); - brelse(bitmap_bh); - bitmap_bh = read_inode_bitmap(sb, i); - if (!bitmap_bh) - continue; - - x = ext3_count_free(bitmap_bh, EXT3_INODES_PER_GROUP(sb) / 8); - if (le16_to_cpu(gdp->bg_free_inodes_count) != x) - ext3_error (sb, "ext3_check_inodes_bitmap", - "Wrong free inodes count in group %d, " - "stored = %d, counted = %lu", i, - le16_to_cpu(gdp->bg_free_inodes_count), x); - bitmap_count += x; - } - brelse(bitmap_bh); - if (le32_to_cpu(es->s_free_inodes_count) != bitmap_count) - ext3_error (sb, "ext3_check_inodes_bitmap", - "Wrong free inodes count in super block, " - "stored = %lu, counted = %lu", - (unsigned long)le32_to_cpu(es->s_free_inodes_count), - bitmap_count); -} -#endif diff --git a/fs/ext3/super.c b/fs/ext3/super.c index f594989ccb7a..4e6730622d90 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c @@ -625,7 +625,7 @@ static struct export_operations ext3_export_ops = { enum { Opt_bsd_df, Opt_minix_df, Opt_grpid, Opt_nogrpid, Opt_resgid, Opt_resuid, Opt_sb, Opt_err_cont, Opt_err_panic, Opt_err_ro, - Opt_nouid32, Opt_check, Opt_nocheck, Opt_debug, Opt_oldalloc, Opt_orlov, + Opt_nouid32, Opt_nocheck, Opt_debug, Opt_oldalloc, Opt_orlov, Opt_user_xattr, Opt_nouser_xattr, Opt_acl, Opt_noacl, Opt_reservation, Opt_noreservation, Opt_noload, Opt_nobh, Opt_commit, Opt_journal_update, Opt_journal_inum, @@ -652,7 +652,6 @@ static match_table_t tokens = { {Opt_nouid32, "nouid32"}, {Opt_nocheck, "nocheck"}, {Opt_nocheck, "check=none"}, - {Opt_check, "check"}, {Opt_debug, "debug"}, {Opt_oldalloc, "oldalloc"}, {Opt_orlov, "orlov"}, @@ -773,14 +772,6 @@ static int parse_options (char * options, struct super_block *sb, case Opt_nouid32: set_opt (sbi->s_mount_opt, NO_UID32); break; - case Opt_check: -#ifdef CONFIG_EXT3_CHECK - set_opt (sbi->s_mount_opt, CHECK); -#else - printk(KERN_ERR - "EXT3 Check option not supported\n"); -#endif - break; case Opt_nocheck: clear_opt (sbi->s_mount_opt, CHECK); break; @@ -1115,12 +1106,6 @@ static int ext3_setup_super(struct super_block *sb, struct ext3_super_block *es, } else { printk("internal journal\n"); } -#ifdef CONFIG_EXT3_CHECK - if (test_opt (sb, CHECK)) { - ext3_check_blocks_bitmap (sb); - ext3_check_inodes_bitmap (sb); - } -#endif return res; } -- cgit v1.2.2 From 55e64b3003f03355d8e950af58d456b6314a5a62 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Tue, 8 Nov 2005 21:34:59 -0800 Subject: [PATCH] ext2: remove the ancient CHANGES file This patch removes an ancient changelog file. Signed-off-by: Adrian Bunk Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/ext2/CHANGES | 157 -------------------------------------------------------- 1 file changed, 157 deletions(-) delete mode 100644 fs/ext2/CHANGES diff --git a/fs/ext2/CHANGES b/fs/ext2/CHANGES deleted file mode 100644 index aa5aaf0e5911..000000000000 --- a/fs/ext2/CHANGES +++ /dev/null @@ -1,157 +0,0 @@ -Changes from version 0.5a to version 0.5b -========================================= - - Now that we have sysctl(), the immutable flag cannot be changed when - the system is running at security level > 0. - - Some cleanups in the code. - - More consistency checks on directories. - - The ext2.diff patch from Tom May has been - integrated. This patch replaces expensive "/" and "%" with - cheap ">>" and "&" where possible. - -Changes from version 0.5 to version 0.5a -======================================== - - Zero the partial block following the end of the file when a file - is truncated. - - Dates updated in the copyright. - - More checks when the filesystem is mounted: the count of blocks, - fragments, and inodes per group is checked against the block size. - - The buffers used by the error routines are now static variables, to - avoid using space on the kernel stack, as requested by Linus. - - Some cleanups in the error messages (some versions of syslog contain - a bug which truncates an error message if it contains '\n'). - - Check that no data can be written to a file past the 2GB limit. - - The famous readdir() bug has been fixed by Stephen Tweedie. - - Added a revision level in the superblock. - - Full support for O_SYNC flag of the open system call. - - New mount options: `resuid=#uid' and `resgid=#gid'. `resuid' causes - ext2fs to consider user #uid like root for the reserved blocks. - `resgid' acts the same way with group #gid. New fields in the - superblock contain default values for resuid and resgid and can - be modified by tune2fs. - Idea comes from Rene Cougnenc . - - New mount options: `bsddf' and `minixdf'. `bsddf' causes ext2fs - to remove the blocks used for FS structures from the total block - count in statfs. With `minixdf', ext2fs mimics Minix behavior - in statfs (i.e. it returns the total number of blocks on the - partition). This is intended to make bde happy :-) - - New file attributes: - - Immutable files cannot be modified. Data cannot be written to - these files. They cannot be removed, renamed and new links cannot - be created. Even root cannot modify the files. He has to remove - the immutable attribute first. - - Append-only files: can only be written in append-mode when writing. - They cannot be removed, renamed and new links cannot be created. - Note: files may only be added to an append-only directory. - - No-dump files: the attribute is not used by the kernel. My port - of dump uses it to avoid backing up files which are not important. - - New check in ext2_check_dir_entry: the inode number is checked. - - Support for big file systems: the copy of the FS descriptor is now - dynamically allocated (previous versions used a fixed size array). - This allows to mount 2GB+ FS. - - Reorganization of the ext2_inode structure to allow other operating - systems to create specific fields if they use ext2fs as their native - file system. Currently, ext2fs is only implemented in Linux but - will soon be part of Gnu Hurd and of Masix. - -Changes from version 0.4b to version 0.5 -======================================== - - New superblock fields: s_lastcheck and s_checkinterval added - by Uwe Ohse to implement timedependent checks - of the file system - - Real random numbers for secure rm added by Pierre del Perugia - - - The mount warnings related to the state of a fs are not printed - if the fs is mounted read-only, idea by Nick Holloway - - -Changes from version 0.4a to version 0.4b -========================================= - - Copyrights changed to include the name of my laboratory. - - Clean up of balloc.c and ialloc.c. - - More consistency checks. - - Block preallocation added by Stephen Tweedie. - - Direct reads of directories disallowed. - - Readahead implemented in readdir by Stephen Tweedie. - - Bugs in block and inodes allocation fixed. - - Readahead implemented in ext2_find_entry by Chip Salzenberg. - - New mount options: - `check=none|normal|strict' - `debug' - `errors=continue|remount-ro|panic' - `grpid', `bsdgroups' - `nocheck' - `nogrpid', `sysvgroups' - - truncate() now tries to deallocate contiguous blocks in a single call - to ext2_free_blocks(). - - lots of cosmetic changes. - -Changes from version 0.4 to version 0.4a -======================================== - - the `sync' option support is now complete. Version 0.4 was not - supporting it when truncating a file. I have tested the synchronous - writes and they work but they make the system very slow :-( I have - to work again on this to make it faster. - - when detecting an error on a mounted filesystem, version 0.4 used - to try to write a flag in the super block even if the filesystem had - been mounted read-only. This is fixed. - - the `sb=#' option now causes the kernel code to use the filesystem - descriptors located at block #+1. Version 0.4 used the superblock - backup located at block # but used the main copy of the descriptors. - - a new file attribute `S' is supported. This attribute causes - synchronous writes but is applied to a file not to the entire file - system (thanks to Michael Kraehe for - suggesting it). - - the directory cache is inhibited by default. The cache management - code seems to be buggy and I have to look at it carefully before - using it again. - - deleting a file with the `s' attribute (secure deletion) causes its - blocks to be overwritten with random values not with zeros (thanks to - Michael A. Griffith for suggesting it). - - lots of cosmetic changes have been made. - -Changes from version 0.3 to version 0.4 -======================================= - - Three new mount options are supported: `check', `sync' and `sb=#'. - `check' tells the kernel code to make more consistency checks - when the file system is mounted. Currently, the kernel code checks - that the blocks and inodes bitmaps are consistent with the free - blocks and inodes counts. More checks will be added in future - releases. - `sync' tells the kernel code to use synchronous writes when updating - an inode, a bitmap, a directory entry or an indirect block. This - can make the file system much slower but can be a big win for files - recovery in case of a crash (and we can now say to the BSD folks - that Linux also supports synchronous updates :-). - `sb=#' tells the kernel code to use an alternate super block instead - of its master copy. `#' is the number of the block (counted in - 1024 bytes blocks) which contains the alternate super block. - An ext2 file system typically contains backups of the super block - at blocks 8193, 16385, and so on. - - I have change the meaning of the valid flag used by e2fsck. it - now contains the state of the file system. If the kernel code - detects an inconsistency while the file system is mounted, it flags - it as erroneous and e2fsck will detect that on next run. - - The super block now contains a mount counter. This counter is - incremented each time the file system is mounted read/write. When - this counter becomes bigger than a maximal mount counts (also stored - in the super block), e2fsck checks the file system, even if it had - been unmounted cleanly, and resets this counter to 0. - - File attributes are now supported. One can associate a set of - attributes to a file. Three attributes are defined: - `c': the file is marked for automatic compression, - `s': the file is marked for secure deletion: when the file is - deleted, its blocks are zeroed and written back to the disk, - `u': the file is marked for undeletion: when the file is deleted, - its contents are saved to allow a future undeletion. - Currently, only the `s' attribute is implemented in the kernel - code. Support for the other attributes will be added in a future - release. - - a few bugs related to times updates have been fixed by Bruce - Evans and me. - - a bug related to the links count of deleted inodes has been fixed. - Previous versions used to keep the links count set to 1 when a file - was deleted. The new version now sets links_count to 0 when deleting - the last link. - - a race condition when deallocating an inode has been fixed by - Stephen Tweedie. - -- cgit v1.2.2 From e4a53cbabc81f04e24a5570b4aa6a6384bdbfc67 Mon Sep 17 00:00:00 2001 From: "Gabriel A. Devenyi" Date: Tue, 8 Nov 2005 21:35:00 -0800 Subject: [PATCH] drivers/block/pktcdvd.c: remove write-only variable in pkt_iosched_process_queue() Found this on Coverty's linux bug database (http://linuxbugsdb.coverity.com). The function pkt_iosched_process_queue makes a call to bdev_get_queue and stores the result but never uses it, so it looks like it can be safely removed. Signed-off-by: Gabriel A. Devenyi Signed-off-by: Adrian Bunk Acked-by: Peter Osterlund Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/block/pktcdvd.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index a280e679b1ca..59e5982a5db3 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c @@ -511,14 +511,11 @@ static void pkt_queue_bio(struct pktcdvd_device *pd, struct bio *bio) */ static void pkt_iosched_process_queue(struct pktcdvd_device *pd) { - request_queue_t *q; if (atomic_read(&pd->iosched.attention) == 0) return; atomic_set(&pd->iosched.attention, 0); - q = bdev_get_queue(pd->bdev); - for (;;) { struct bio *bio; int reads_queued, writes_queued; -- cgit v1.2.2 From e4543eddfd3bf3e0d625841377fa695a519edfd4 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Tue, 8 Nov 2005 21:35:04 -0800 Subject: [PATCH] add a vfs_permission helper Most permission() calls have a struct nameidata * available. This helper takes that as an argument and thus makes sure we pass it down for lookup intents and prepares for per-mount read-only support where we need a struct vfsmount for checking whether a file is writeable. Signed-off-by: Christoph Hellwig Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/exec.c | 4 ++-- fs/inotify.c | 2 +- fs/namei.c | 23 +++++++++++++++++++---- fs/namespace.c | 2 +- fs/open.c | 12 ++++++------ include/linux/fs.h | 1 + net/unix/af_unix.c | 2 +- 7 files changed, 31 insertions(+), 15 deletions(-) diff --git a/fs/exec.c b/fs/exec.c index 5a4e3acc2e9f..7bbb781b9ac6 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -135,7 +135,7 @@ asmlinkage long sys_uselib(const char __user * library) if (!S_ISREG(nd.dentry->d_inode->i_mode)) goto exit; - error = permission(nd.dentry->d_inode, MAY_READ | MAY_EXEC, &nd); + error = vfs_permission(&nd, MAY_READ | MAY_EXEC); if (error) goto exit; @@ -495,7 +495,7 @@ struct file *open_exec(const char *name) file = ERR_PTR(-EACCES); if (!(nd.mnt->mnt_flags & MNT_NOEXEC) && S_ISREG(inode->i_mode)) { - int err = permission(inode, MAY_EXEC, &nd); + int err = vfs_permission(&nd, MAY_EXEC); if (!err && !(inode->i_mode & 0111)) err = -EACCES; file = ERR_PTR(err); diff --git a/fs/inotify.c b/fs/inotify.c index 9fbaebfdf40b..bf7ce1d2412b 100644 --- a/fs/inotify.c +++ b/fs/inotify.c @@ -372,7 +372,7 @@ static int find_inode(const char __user *dirname, struct nameidata *nd) if (error) return error; /* you can only watch an inode if you have read permissions on it */ - error = permission(nd->dentry->d_inode, MAY_READ, NULL); + error = vfs_permission(nd, MAY_READ); if (error) path_release(nd); return error; diff --git a/fs/namei.c b/fs/namei.c index b3f8a1966c9c..25e4ab4ce8b7 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -256,6 +256,21 @@ int permission(struct inode *inode, int mask, struct nameidata *nd) return security_inode_permission(inode, mask, nd); } +/** + * vfs_permission - check for access rights to a given path + * @nd: lookup result that describes the path + * @mask: right to check for (%MAY_READ, %MAY_WRITE, %MAY_EXEC) + * + * Used to check for read/write/execute permissions on a path. + * We use "fsuid" for this, letting us set arbitrary permissions + * for filesystem access without changing the "normal" uids which + * are used for other things. + */ +int vfs_permission(struct nameidata *nd, int mask) +{ + return permission(nd->dentry->d_inode, mask, nd); +} + /* * get_write_access() gets write permission for a file. * put_write_access() releases this write permission. @@ -765,9 +780,8 @@ static fastcall int __link_path_walk(const char * name, struct nameidata *nd) nd->flags |= LOOKUP_CONTINUE; err = exec_permission_lite(inode, nd); - if (err == -EAGAIN) { - err = permission(inode, MAY_EXEC, nd); - } + if (err == -EAGAIN) + err = vfs_permission(nd, MAY_EXEC); if (err) break; @@ -1407,7 +1421,7 @@ int may_open(struct nameidata *nd, int acc_mode, int flag) if (S_ISDIR(inode->i_mode) && (flag & FMODE_WRITE)) return -EISDIR; - error = permission(inode, acc_mode, nd); + error = vfs_permission(nd, acc_mode); if (error) return error; @@ -2536,6 +2550,7 @@ EXPORT_SYMBOL(path_lookup); EXPORT_SYMBOL(path_release); EXPORT_SYMBOL(path_walk); EXPORT_SYMBOL(permission); +EXPORT_SYMBOL(vfs_permission); EXPORT_SYMBOL(unlock_rename); EXPORT_SYMBOL(vfs_create); EXPORT_SYMBOL(vfs_follow_link); diff --git a/fs/namespace.c b/fs/namespace.c index caa9187f67e5..2019899f2ab8 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -637,7 +637,7 @@ static int mount_is_safe(struct nameidata *nd) if (current->uid != nd->dentry->d_inode->i_uid) return -EPERM; } - if (permission(nd->dentry->d_inode, MAY_WRITE, nd)) + if (vfs_permission(nd, MAY_WRITE)) return -EPERM; return 0; #endif diff --git a/fs/open.c b/fs/open.c index 6e8136751e9a..baffc084580d 100644 --- a/fs/open.c +++ b/fs/open.c @@ -240,7 +240,7 @@ static inline long do_sys_truncate(const char __user * path, loff_t length) if (!S_ISREG(inode->i_mode)) goto dput_and_out; - error = permission(inode,MAY_WRITE,&nd); + error = vfs_permission(&nd, MAY_WRITE); if (error) goto dput_and_out; @@ -394,7 +394,7 @@ asmlinkage long sys_utime(char __user * filename, struct utimbuf __user * times) goto dput_and_out; if (current->fsuid != inode->i_uid && - (error = permission(inode,MAY_WRITE,&nd)) != 0) + (error = vfs_permission(&nd, MAY_WRITE)) != 0) goto dput_and_out; } down(&inode->i_sem); @@ -447,7 +447,7 @@ long do_utimes(char __user * filename, struct timeval * times) goto dput_and_out; if (current->fsuid != inode->i_uid && - (error = permission(inode,MAY_WRITE,&nd)) != 0) + (error = vfs_permission(&nd, MAY_WRITE)) != 0) goto dput_and_out; } down(&inode->i_sem); @@ -506,7 +506,7 @@ asmlinkage long sys_access(const char __user * filename, int mode) res = __user_walk(filename, LOOKUP_FOLLOW|LOOKUP_ACCESS, &nd); if (!res) { - res = permission(nd.dentry->d_inode, mode, &nd); + res = vfs_permission(&nd, mode); /* SuS v2 requires we report a read only fs too */ if(!res && (mode & S_IWOTH) && IS_RDONLY(nd.dentry->d_inode) && !special_file(nd.dentry->d_inode->i_mode)) @@ -530,7 +530,7 @@ asmlinkage long sys_chdir(const char __user * filename) if (error) goto out; - error = permission(nd.dentry->d_inode,MAY_EXEC,&nd); + error = vfs_permission(&nd, MAY_EXEC); if (error) goto dput_and_out; @@ -581,7 +581,7 @@ asmlinkage long sys_chroot(const char __user * filename) if (error) goto out; - error = permission(nd.dentry->d_inode,MAY_EXEC,&nd); + error = vfs_permission(&nd, MAY_EXEC); if (error) goto dput_and_out; diff --git a/include/linux/fs.h b/include/linux/fs.h index 1b5f502a4b8f..c3b8c1dc7cdf 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -874,6 +874,7 @@ static inline void unlock_super(struct super_block * sb) /* * VFS helper functions.. */ +extern int vfs_permission(struct nameidata *, int); extern int vfs_create(struct inode *, struct dentry *, int, struct nameidata *); extern int vfs_mkdir(struct inode *, struct dentry *, int); extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t); diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 41feca3bef86..acc73ba8bade 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -676,7 +676,7 @@ static struct sock *unix_find_other(struct sockaddr_un *sunname, int len, err = path_lookup(sunname->sun_path, LOOKUP_FOLLOW, &nd); if (err) goto fail; - err = permission(nd.dentry->d_inode,MAY_WRITE, &nd); + err = vfs_permission(&nd, MAY_WRITE); if (err) goto put_fail; -- cgit v1.2.2 From 8c744fb83da0771afa04695028e3550b798dad90 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Tue, 8 Nov 2005 21:35:04 -0800 Subject: [PATCH] add a file_permission helper A few more callers of permission() just want to check for a different access pattern on an already open file. This patch adds a wrapper for permission() that takes a file in preparation of per-mount read-only support and to clean up the callers a little. The helper is not intended for new code, everything without the interface set in stone should use vfs_permission() Signed-off-by: Christoph Hellwig Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/block/floppy.c | 3 +-- fs/binfmt_misc.c | 2 +- fs/exec.c | 2 +- fs/namei.c | 18 ++++++++++++++++++ fs/ncpfs/ioctl.c | 34 +++++++++++++++++++--------------- fs/open.c | 2 +- fs/udf/file.c | 2 +- include/linux/fs.h | 5 +++++ 8 files changed, 47 insertions(+), 21 deletions(-) diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index dd1935d55424..28002de783b6 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -3776,8 +3776,7 @@ static int floppy_open(struct inode *inode, struct file *filp) /* Allow ioctls if we have write-permissions even if read-only open. * Needed so that programs such as fdrawcmd still can work on write * protected disks */ - if (filp->f_mode & 2 - || permission(filp->f_dentry->d_inode, 2, NULL) == 0) + if ((filp->f_mode & FMODE_WRITE) || !file_permission(filp, MAY_WRITE)) filp->private_data = (void *)8; if (UFDCS->rawcmd == 1) diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c index 8ae0db6cd69c..2568eb41cb3a 100644 --- a/fs/binfmt_misc.c +++ b/fs/binfmt_misc.c @@ -150,7 +150,7 @@ static int load_misc_binary(struct linux_binprm *bprm, struct pt_regs *regs) /* if the binary is not readable than enforce mm->dumpable=0 regardless of the interpreter's permissions */ - if (permission(bprm->file->f_dentry->d_inode, MAY_READ, NULL)) + if (file_permission(bprm->file, MAY_READ)) bprm->interp_flags |= BINPRM_FLAGS_ENFORCE_NONDUMP; allow_write_access(bprm->file); diff --git a/fs/exec.c b/fs/exec.c index 7bbb781b9ac6..c466fec5de20 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -896,7 +896,7 @@ int flush_old_exec(struct linux_binprm * bprm) flush_thread(); if (bprm->e_uid != current->euid || bprm->e_gid != current->egid || - permission(bprm->file->f_dentry->d_inode,MAY_READ, NULL) || + file_permission(bprm->file, MAY_READ) || (bprm->interp_flags & BINPRM_FLAGS_ENFORCE_NONDUMP)) { suid_keys(current); current->mm->dumpable = suid_dumpable; diff --git a/fs/namei.c b/fs/namei.c index 25e4ab4ce8b7..b69f6ebadb95 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -271,6 +271,23 @@ int vfs_permission(struct nameidata *nd, int mask) return permission(nd->dentry->d_inode, mask, nd); } +/** + * file_permission - check for additional access rights to a given file + * @file: file to check access rights for + * @mask: right to check for (%MAY_READ, %MAY_WRITE, %MAY_EXEC) + * + * Used to check for read/write/execute permissions on an already opened + * file. + * + * Note: + * Do not use this function in new code. All access checks should + * be done using vfs_permission(). + */ +int file_permission(struct file *file, int mask) +{ + return permission(file->f_dentry->d_inode, mask, NULL); +} + /* * get_write_access() gets write permission for a file. * put_write_access() releases this write permission. @@ -2551,6 +2568,7 @@ EXPORT_SYMBOL(path_release); EXPORT_SYMBOL(path_walk); EXPORT_SYMBOL(permission); EXPORT_SYMBOL(vfs_permission); +EXPORT_SYMBOL(file_permission); EXPORT_SYMBOL(unlock_rename); EXPORT_SYMBOL(vfs_create); EXPORT_SYMBOL(vfs_follow_link); diff --git a/fs/ncpfs/ioctl.c b/fs/ncpfs/ioctl.c index 88df79356a1f..fd3efdca5ae3 100644 --- a/fs/ncpfs/ioctl.c +++ b/fs/ncpfs/ioctl.c @@ -30,11 +30,13 @@ #define NCP_PACKET_SIZE_INTERNAL 65536 static int -ncp_get_fs_info(struct ncp_server* server, struct inode* inode, struct ncp_fs_info __user *arg) +ncp_get_fs_info(struct ncp_server * server, struct file *file, + struct ncp_fs_info __user *arg) { + struct inode *inode = file->f_dentry->d_inode; struct ncp_fs_info info; - if ((permission(inode, MAY_WRITE, NULL) != 0) + if ((file_permission(file, MAY_WRITE) != 0) && (current->uid != server->m.mounted_uid)) { return -EACCES; } @@ -58,11 +60,13 @@ ncp_get_fs_info(struct ncp_server* server, struct inode* inode, struct ncp_fs_in } static int -ncp_get_fs_info_v2(struct ncp_server* server, struct inode* inode, struct ncp_fs_info_v2 __user * arg) +ncp_get_fs_info_v2(struct ncp_server * server, struct file *file, + struct ncp_fs_info_v2 __user * arg) { + struct inode *inode = file->f_dentry->d_inode; struct ncp_fs_info_v2 info2; - if ((permission(inode, MAY_WRITE, NULL) != 0) + if ((file_permission(file, MAY_WRITE) != 0) && (current->uid != server->m.mounted_uid)) { return -EACCES; } @@ -190,7 +194,7 @@ int ncp_ioctl(struct inode *inode, struct file *filp, switch (cmd) { case NCP_IOC_NCPREQUEST: - if ((permission(inode, MAY_WRITE, NULL) != 0) + if ((file_permission(filp, MAY_WRITE) != 0) && (current->uid != server->m.mounted_uid)) { return -EACCES; } @@ -245,16 +249,16 @@ int ncp_ioctl(struct inode *inode, struct file *filp, return ncp_conn_logged_in(inode->i_sb); case NCP_IOC_GET_FS_INFO: - return ncp_get_fs_info(server, inode, argp); + return ncp_get_fs_info(server, filp, argp); case NCP_IOC_GET_FS_INFO_V2: - return ncp_get_fs_info_v2(server, inode, argp); + return ncp_get_fs_info_v2(server, filp, argp); case NCP_IOC_GETMOUNTUID2: { unsigned long tmp = server->m.mounted_uid; - if ( (permission(inode, MAY_READ, NULL) != 0) + if ((file_permission(filp, MAY_READ) != 0) && (current->uid != server->m.mounted_uid)) { return -EACCES; @@ -268,7 +272,7 @@ int ncp_ioctl(struct inode *inode, struct file *filp, { struct ncp_setroot_ioctl sr; - if ( (permission(inode, MAY_READ, NULL) != 0) + if ((file_permission(filp, MAY_READ) != 0) && (current->uid != server->m.mounted_uid)) { return -EACCES; @@ -343,7 +347,7 @@ int ncp_ioctl(struct inode *inode, struct file *filp, #ifdef CONFIG_NCPFS_PACKET_SIGNING case NCP_IOC_SIGN_INIT: - if ((permission(inode, MAY_WRITE, NULL) != 0) + if ((file_permission(filp, MAY_WRITE) != 0) && (current->uid != server->m.mounted_uid)) { return -EACCES; @@ -366,7 +370,7 @@ int ncp_ioctl(struct inode *inode, struct file *filp, return 0; case NCP_IOC_SIGN_WANTED: - if ( (permission(inode, MAY_READ, NULL) != 0) + if ((file_permission(filp, MAY_READ) != 0) && (current->uid != server->m.mounted_uid)) { return -EACCES; @@ -379,7 +383,7 @@ int ncp_ioctl(struct inode *inode, struct file *filp, { int newstate; - if ( (permission(inode, MAY_WRITE, NULL) != 0) + if ((file_permission(filp, MAY_WRITE) != 0) && (current->uid != server->m.mounted_uid)) { return -EACCES; @@ -400,7 +404,7 @@ int ncp_ioctl(struct inode *inode, struct file *filp, #ifdef CONFIG_NCPFS_IOCTL_LOCKING case NCP_IOC_LOCKUNLOCK: - if ( (permission(inode, MAY_WRITE, NULL) != 0) + if ((file_permission(filp, MAY_WRITE) != 0) && (current->uid != server->m.mounted_uid)) { return -EACCES; @@ -605,7 +609,7 @@ outrel: #endif /* CONFIG_NCPFS_NLS */ case NCP_IOC_SETDENTRYTTL: - if ((permission(inode, MAY_WRITE, NULL) != 0) && + if ((file_permission(filp, MAY_WRITE) != 0) && (current->uid != server->m.mounted_uid)) return -EACCES; { @@ -635,7 +639,7 @@ outrel: so we have this out of switch */ if (cmd == NCP_IOC_GETMOUNTUID) { __kernel_uid_t uid = 0; - if ((permission(inode, MAY_READ, NULL) != 0) + if ((file_permission(filp, MAY_READ) != 0) && (current->uid != server->m.mounted_uid)) { return -EACCES; } diff --git a/fs/open.c b/fs/open.c index baffc084580d..f53a5b9ffb7d 100644 --- a/fs/open.c +++ b/fs/open.c @@ -563,7 +563,7 @@ asmlinkage long sys_fchdir(unsigned int fd) if (!S_ISDIR(inode->i_mode)) goto out_putf; - error = permission(inode, MAY_EXEC, NULL); + error = file_permission(file, MAY_EXEC); if (!error) set_fs_pwd(current->fs, mnt, dentry); out_putf: diff --git a/fs/udf/file.c b/fs/udf/file.c index bb40d63f328f..01f520c71dc1 100644 --- a/fs/udf/file.c +++ b/fs/udf/file.c @@ -186,7 +186,7 @@ int udf_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, { int result = -EINVAL; - if ( permission(inode, MAY_READ, NULL) != 0 ) + if ( file_permission(filp, MAY_READ) != 0 ) { udf_debug("no permission to access inode %lu\n", inode->i_ino); diff --git a/include/linux/fs.h b/include/linux/fs.h index c3b8c1dc7cdf..cc35b6ac778d 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -889,6 +889,11 @@ extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct de */ extern void dentry_unhash(struct dentry *dentry); +/* + * VFS file helper functions. + */ +extern int file_permission(struct file *, int); + /* * File types * -- cgit v1.2.2 From 49705b7743fd8f5632a95ec4c6547d169d27ac1f Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Tue, 8 Nov 2005 21:35:06 -0800 Subject: [PATCH] sanitize lookup_hash prototype ->permission and ->lookup have a struct nameidata * argument these days to pass down lookup intents. Unfortunately some callers of lookup_hash don't actually pass this one down. For lookup_one_len() we don't have a struct nameidata to pass down, but as this function is a library function only used by filesystem code this is an acceptable limitation. All other callers should pass down the nameidata, so this patch changes the lookup_hash interface to only take a struct nameidata argument and derives the other two arguments to __lookup_hash from it. All callers already have the nameidata argument available so this is not a problem. At the same time I'd like to deprecate the lookup_hash interface as there are better exported interfaces for filesystem usage. Before it can actually be removed I need to fix up rpc_pipefs. Signed-off-by: Christoph Hellwig Cc: Ram Pai Cc: Jeff Mahoney Cc: Al Viro Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/feature-removal-schedule.txt | 7 +++++++ fs/namei.c | 20 ++++++++++---------- include/linux/namei.h | 2 +- net/sunrpc/rpc_pipe.c | 6 +++--- 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index 910cc9998731..66e4ca28fc0a 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt @@ -118,3 +118,10 @@ Why: This interface has been obsoleted by the new layer3-independent to link against API-compatible library on top of libnfnetlink_queue instead of the current 'libipq'. Who: Harald Welte + +--------------------------- + +What: EXPORT_SYMBOL(lookup_hash) +When: January 2006 +Why: Too low-level interface. Use lookup_one_len or lookup_create instead. +Who: Christoph Hellwig diff --git a/fs/namei.c b/fs/namei.c index b69f6ebadb95..f02ec0e50fca 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -1204,9 +1204,9 @@ out: return dentry; } -struct dentry * lookup_hash(struct qstr *name, struct dentry * base) +struct dentry * lookup_hash(struct nameidata *nd) { - return __lookup_hash(name, base, NULL); + return __lookup_hash(&nd->last, nd->dentry, nd); } /* SMP-safe */ @@ -1230,7 +1230,7 @@ struct dentry * lookup_one_len(const char * name, struct dentry * base, int len) } this.hash = end_name_hash(hash); - return lookup_hash(&this, base); + return __lookup_hash(&this, base, NULL); access: return ERR_PTR(-EACCES); } @@ -1563,7 +1563,7 @@ int open_namei(const char * pathname, int flag, int mode, struct nameidata *nd) dir = nd->dentry; nd->flags &= ~LOOKUP_PARENT; down(&dir->d_inode->i_sem); - path.dentry = __lookup_hash(&nd->last, nd->dentry, nd); + path.dentry = lookup_hash(nd); path.mnt = nd->mnt; do_last: @@ -1665,7 +1665,7 @@ do_link: } dir = nd->dentry; down(&dir->d_inode->i_sem); - path.dentry = __lookup_hash(&nd->last, nd->dentry, nd); + path.dentry = lookup_hash(nd); path.mnt = nd->mnt; __putname(nd->last.name); goto do_last; @@ -1697,7 +1697,7 @@ struct dentry *lookup_create(struct nameidata *nd, int is_dir) /* * Do the final lookup. */ - dentry = lookup_hash(&nd->last, nd->dentry); + dentry = lookup_hash(nd); if (IS_ERR(dentry)) goto fail; @@ -1932,7 +1932,7 @@ asmlinkage long sys_rmdir(const char __user * pathname) goto exit1; } down(&nd.dentry->d_inode->i_sem); - dentry = lookup_hash(&nd.last, nd.dentry); + dentry = lookup_hash(&nd); error = PTR_ERR(dentry); if (!IS_ERR(dentry)) { error = vfs_rmdir(nd.dentry->d_inode, dentry); @@ -2001,7 +2001,7 @@ asmlinkage long sys_unlink(const char __user * pathname) if (nd.last_type != LAST_NORM) goto exit1; down(&nd.dentry->d_inode->i_sem); - dentry = lookup_hash(&nd.last, nd.dentry); + dentry = lookup_hash(&nd); error = PTR_ERR(dentry); if (!IS_ERR(dentry)) { /* Why not before? Because we want correct error value */ @@ -2344,7 +2344,7 @@ static inline int do_rename(const char * oldname, const char * newname) trap = lock_rename(new_dir, old_dir); - old_dentry = lookup_hash(&oldnd.last, old_dir); + old_dentry = lookup_hash(&oldnd); error = PTR_ERR(old_dentry); if (IS_ERR(old_dentry)) goto exit3; @@ -2364,7 +2364,7 @@ static inline int do_rename(const char * oldname, const char * newname) error = -EINVAL; if (old_dentry == trap) goto exit4; - new_dentry = lookup_hash(&newnd.last, new_dir); + new_dentry = lookup_hash(&newnd); error = PTR_ERR(new_dentry); if (IS_ERR(new_dentry)) goto exit4; diff --git a/include/linux/namei.h b/include/linux/namei.h index 1c975d0d9e94..455660eafba9 100644 --- a/include/linux/namei.h +++ b/include/linux/namei.h @@ -74,7 +74,7 @@ extern struct file *nameidata_to_filp(struct nameidata *nd, int flags); extern void release_open_intent(struct nameidata *); extern struct dentry * lookup_one_len(const char *, struct dentry *, int); -extern struct dentry * lookup_hash(struct qstr *, struct dentry *); +extern struct dentry * lookup_hash(struct nameidata *); extern int follow_down(struct vfsmount **, struct dentry **); extern int follow_up(struct vfsmount **, struct dentry **); diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index 4f188d0a5d11..81e00a6c19de 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c @@ -603,7 +603,7 @@ rpc_lookup_negative(char *path, struct nameidata *nd) return ERR_PTR(error); dir = nd->dentry->d_inode; down(&dir->i_sem); - dentry = lookup_hash(&nd->last, nd->dentry); + dentry = lookup_hash(nd); if (IS_ERR(dentry)) goto out_err; if (dentry->d_inode) { @@ -665,7 +665,7 @@ rpc_rmdir(char *path) return error; dir = nd.dentry->d_inode; down(&dir->i_sem); - dentry = lookup_hash(&nd.last, nd.dentry); + dentry = lookup_hash(&nd); if (IS_ERR(dentry)) { error = PTR_ERR(dentry); goto out_release; @@ -726,7 +726,7 @@ rpc_unlink(char *path) return error; dir = nd.dentry->d_inode; down(&dir->i_sem); - dentry = lookup_hash(&nd.last, nd.dentry); + dentry = lookup_hash(&nd); if (IS_ERR(dentry)) { error = PTR_ERR(dentry); goto out_release; -- cgit v1.2.2 From 7a81e316866be8053b18fe1dffc663f1ff19bfc3 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Tue, 8 Nov 2005 21:35:07 -0800 Subject: [PATCH] re-add TIOCSTART and TIOCSTOP compat_ioctl handlers We don't implement these ioctls, but some architectures define them in the headers. Bash picks them up and issues them frequently. Add compat_ioctl handlers to silence warnings about unhandled copat ioctls. Signed-off-by: Christoph Hellwig Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/compat_ioctl.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 4909754ea84a..71c9d45c0624 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -3051,6 +3051,16 @@ HANDLE_IOCTL(TIOCSSERIAL, serial_struct_ioctl) COMPATIBLE_IOCTL(TIOCGLTC) COMPATIBLE_IOCTL(TIOCSLTC) #endif +#ifdef TIOCSTART +/* + * For these two we have defintions in ioctls.h and/or termios.h on + * some architectures but no actual implemention. Some applications + * like bash call them if they are defined in the headers, so we provide + * entries here to avoid syslog message spew. + */ +COMPATIBLE_IOCTL(TIOCSTART) +COMPATIBLE_IOCTL(TIOCSTOP) +#endif /* Usbdevfs */ HANDLE_IOCTL(USBDEVFS_CONTROL32, do_usbdevfs_control) HANDLE_IOCTL(USBDEVFS_BULK32, do_usbdevfs_bulk) -- cgit v1.2.2 From 7e4c54a2a4f1cec6a652c6014714ee51b7e1311f Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Tue, 8 Nov 2005 21:35:07 -0800 Subject: [PATCH] remove ioctl32_handler_t Some architectures define and use this type in their compat_ioctl code, but all of them can easily use the identical ioctl_trans_handler_t type that is defined in common code. Signed-off-by: Christoph Hellwig Cc: Andi Kleen Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/ia64/ia32/ia32_ioctl.c | 4 +--- arch/mips/kernel/ioctl32.c | 4 +--- arch/sparc64/kernel/ioctl32.c | 4 +--- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/arch/ia64/ia32/ia32_ioctl.c b/arch/ia64/ia32/ia32_ioctl.c index 164b211f4174..88739394f6df 100644 --- a/arch/ia64/ia32/ia32_ioctl.c +++ b/arch/ia64/ia32/ia32_ioctl.c @@ -29,10 +29,8 @@ #define CODE #include "compat_ioctl.c" -typedef int (* ioctl32_handler_t)(unsigned int, unsigned int, unsigned long, struct file *); - #define COMPATIBLE_IOCTL(cmd) HANDLE_IOCTL((cmd),sys_ioctl) -#define HANDLE_IOCTL(cmd,handler) { (cmd), (ioctl32_handler_t)(handler), NULL }, +#define HANDLE_IOCTL(cmd,handler) { (cmd), (ioctl_trans_handler_t)(handler), NULL }, #define IOCTL_TABLE_START \ struct ioctl_trans ioctl_start[] = { #define IOCTL_TABLE_END \ diff --git a/arch/mips/kernel/ioctl32.c b/arch/mips/kernel/ioctl32.c index ed9b2da510be..9ea1fc748864 100644 --- a/arch/mips/kernel/ioctl32.c +++ b/arch/mips/kernel/ioctl32.c @@ -26,10 +26,8 @@ long sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg); #define CODE #include "compat_ioctl.c" -typedef int (* ioctl32_handler_t)(unsigned int, unsigned int, unsigned long, struct file *); - #define COMPATIBLE_IOCTL(cmd) HANDLE_IOCTL((cmd),sys_ioctl) -#define HANDLE_IOCTL(cmd,handler) { (cmd), (ioctl32_handler_t)(handler), NULL }, +#define HANDLE_IOCTL(cmd,handler) { (cmd), (ioctl_trans_handler_t)(handler), NULL }, #define IOCTL_TABLE_START \ struct ioctl_trans ioctl_start[] = { #define IOCTL_TABLE_END \ diff --git a/arch/sparc64/kernel/ioctl32.c b/arch/sparc64/kernel/ioctl32.c index 92e26304de90..c2e96daa5ab3 100644 --- a/arch/sparc64/kernel/ioctl32.c +++ b/arch/sparc64/kernel/ioctl32.c @@ -92,10 +92,8 @@ static int fbiogscursor(unsigned int fd, unsigned int cmd, unsigned long arg) return sys_ioctl (fd, FBIOSCURSOR, (unsigned long)p); } -typedef int (* ioctl32_handler_t)(unsigned int, unsigned int, unsigned long, struct file *); - #define COMPATIBLE_IOCTL(cmd) HANDLE_IOCTL((cmd),sys_ioctl) -#define HANDLE_IOCTL(cmd,handler) { (cmd), (ioctl32_handler_t)(handler), NULL }, +#define HANDLE_IOCTL(cmd,handler) { (cmd), (ioctl_trans_handler_t)(handler), NULL }, #define IOCTL_TABLE_START \ struct ioctl_trans ioctl_start[] = { #define IOCTL_TABLE_END \ -- cgit v1.2.2 From b05a581d4865d74c0e270d27156a88d2dee9494e Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Tue, 8 Nov 2005 21:35:08 -0800 Subject: [PATCH] move some COMPATIBLE_IOCTL entries from x86_64 to common code Signed-off-by: Christoph Hellwig Cc: Andi Kleen Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/x86_64/ia32/ia32_ioctl.c | 6 ------ include/linux/compat_ioctl.h | 8 ++++++++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/arch/x86_64/ia32/ia32_ioctl.c b/arch/x86_64/ia32/ia32_ioctl.c index 4ba0e293d5e5..e335bd0b637d 100644 --- a/arch/x86_64/ia32/ia32_ioctl.c +++ b/arch/x86_64/ia32/ia32_ioctl.c @@ -64,12 +64,6 @@ struct ioctl_trans ioctl_start[] = { #include #define DECLARES #include "compat_ioctl.c" -COMPATIBLE_IOCTL(HDIO_SET_KEEPSETTINGS) -COMPATIBLE_IOCTL(HDIO_SCAN_HWIF) -COMPATIBLE_IOCTL(BLKRASET) -COMPATIBLE_IOCTL(0x4B50) /* KDGHWCLK - not in the kernel, but don't complain */ -COMPATIBLE_IOCTL(0x4B51) /* KDSHWCLK - not in the kernel, but don't complain */ -COMPATIBLE_IOCTL(FIOQSIZE) /* And these ioctls need translation */ /* realtime device */ diff --git a/include/linux/compat_ioctl.h b/include/linux/compat_ioctl.h index ecb0d39c0798..4c63c2963019 100644 --- a/include/linux/compat_ioctl.h +++ b/include/linux/compat_ioctl.h @@ -10,6 +10,10 @@ #define ULONG_IOCTL(cmd) HANDLE_IOCTL((cmd),(ioctl_trans_handler_t)sys_ioctl) #endif + +COMPATIBLE_IOCTL(0x4B50) /* KDGHWCLK - not in the kernel, but don't complain */ +COMPATIBLE_IOCTL(0x4B51) /* KDSHWCLK - not in the kernel, but don't complain */ + /* Big T */ COMPATIBLE_IOCTL(TCGETA) COMPATIBLE_IOCTL(TCSETA) @@ -81,6 +85,8 @@ COMPATIBLE_IOCTL(HDIO_DRIVE_CMD) COMPATIBLE_IOCTL(HDIO_DRIVE_TASK) COMPATIBLE_IOCTL(HDIO_SET_PIO_MODE) COMPATIBLE_IOCTL(HDIO_SET_NICE) +COMPATIBLE_IOCTL(HDIO_SET_KEEPSETTINGS) +COMPATIBLE_IOCTL(HDIO_SCAN_HWIF) /* 0x02 -- Floppy ioctls */ COMPATIBLE_IOCTL(FDMSGON) COMPATIBLE_IOCTL(FDMSGOFF) @@ -99,6 +105,7 @@ COMPATIBLE_IOCTL(FDTWADDLE) COMPATIBLE_IOCTL(FDFMTTRK) COMPATIBLE_IOCTL(FDRAWCMD) /* 0x12 */ +COMPATIBLE_IOCTL(BLKRASET) COMPATIBLE_IOCTL(BLKROSET) COMPATIBLE_IOCTL(BLKROGET) COMPATIBLE_IOCTL(BLKRRPART) @@ -262,6 +269,7 @@ COMPATIBLE_IOCTL(RTC_WKALM_RD) /* Little m */ COMPATIBLE_IOCTL(MTIOCTOP) /* Socket level stuff */ +COMPATIBLE_IOCTL(FIOQSIZE) COMPATIBLE_IOCTL(FIOSETOWN) COMPATIBLE_IOCTL(SIOCSPGRP) COMPATIBLE_IOCTL(FIOGETOWN) -- cgit v1.2.2 From 29b2f784da28cc8289f17a07360997093b7b0156 Mon Sep 17 00:00:00 2001 From: Manu Abraham Date: Tue, 8 Nov 2005 21:35:09 -0800 Subject: [PATCH] dvb: dst: Correcty Identify Tuner and Daughterboards - Identify Tuner, Daughterboards correctly - Added partial support for VP-10320A (DVB-S), VP-20210 (DVB-C), VP-3040 (DVB-T) Signed-off-by: Manu Abraham Signed-off-by: Michael Krufky Cc: Johannes Stezenbach Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/dvb/bt8xx/dst.c | 58 ++++++++++++++++++++++++++++++++++-- drivers/media/dvb/bt8xx/dst_common.h | 2 ++ 2 files changed, 58 insertions(+), 2 deletions(-) diff --git a/drivers/media/dvb/bt8xx/dst.c b/drivers/media/dvb/bt8xx/dst.c index b3c9d7327ac1..6f9e5c168038 100644 --- a/drivers/media/dvb/bt8xx/dst.c +++ b/drivers/media/dvb/bt8xx/dst.c @@ -690,8 +690,8 @@ struct dst_types dst_tlist[] = { .device_id = "DTT-CI", .offset = 1, .dst_type = DST_TYPE_IS_TERR, - .type_flags = DST_TYPE_HAS_TS204 | DST_TYPE_HAS_FW_2, - .dst_feature = 0 + .type_flags = DST_TYPE_HAS_TS204 | DST_TYPE_HAS_NEWTUNE | DST_TYPE_HAS_FW_2 | DST_TYPE_HAS_MULTI_FE, + .dst_feature = DST_TYPE_HAS_CA }, { @@ -796,6 +796,56 @@ static int dst_get_vendor(struct dst_state *state) return 0; } +static int dst_get_tuner_info(struct dst_state *state) +{ + u8 get_tuner_1[] = { 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + u8 get_tuner_2[] = { 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + + get_tuner_1[7] = dst_check_sum(get_tuner_1, 7); + get_tuner_2[7] = dst_check_sum(get_tuner_2, 7); + if (state->type_flags & DST_TYPE_HAS_MULTI_FE) { + if (dst_command(state, get_tuner_2, 8) < 0) { + dprintk(verbose, DST_INFO, 1, "Unsupported Command"); + return -1; + } + } else { + if (dst_command(state, get_tuner_1, 8) < 0) { + dprintk(verbose, DST_INFO, 1, "Unsupported Command"); + return -1; + } + } + memset(&state->board_info, '\0', 8); + memcpy(&state->board_info, &state->rxbuffer, 8); + if (state->type_flags & DST_TYPE_HAS_MULTI_FE) { + if (state->board_info[1] == 0x0b) { + if (state->type_flags & DST_TYPE_HAS_TS204) + state->type_flags &= ~DST_TYPE_HAS_TS204; + state->type_flags |= DST_TYPE_HAS_NEWTUNE; + dprintk(verbose, DST_INFO, 1, "DST type has TS=188"); + } else { + if (state->type_flags & DST_TYPE_HAS_NEWTUNE) + state->type_flags &= ~DST_TYPE_HAS_NEWTUNE; + state->type_flags |= DST_TYPE_HAS_TS204; + dprintk(verbose, DST_INFO, 1, "DST type has TS=204"); + } + } else { + if (state->board_info[0] == 0xbc) { + if (state->type_flags & DST_TYPE_HAS_TS204) + state->type_flags &= ~DST_TYPE_HAS_TS204; + state->type_flags |= DST_TYPE_HAS_NEWTUNE; + dprintk(verbose, DST_INFO, 1, "DST type has TS=188, Daughterboard=[%d]", state->board_info[1]); + + } else if (state->board_info[0] == 0xcc) { + if (state->type_flags & DST_TYPE_HAS_NEWTUNE) + state->type_flags &= ~DST_TYPE_HAS_NEWTUNE; + state->type_flags |= DST_TYPE_HAS_TS204; + dprintk(verbose, DST_INFO, 1, "DST type has TS=204 Daughterboard=[%d]", state->board_info[1]); + } + } + + return 0; +} + static int dst_get_device_id(struct dst_state *state) { u8 reply; @@ -886,6 +936,10 @@ static int dst_probe(struct dst_state *state) dprintk(verbose, DST_INFO, 1, "MAC: Unsupported command"); return 0; } + if ((state->type_flags & DST_TYPE_HAS_MULTI_FE) || (state->type_flags & DST_TYPE_HAS_FW_BUILD)) { + if (dst_get_tuner_info(state) < 0) + dprintk(verbose, DST_INFO, 1, "Tuner: Unsupported command"); + } if (state->type_flags & DST_TYPE_HAS_FW_BUILD) { if (dst_fw_ver(state) < 0) { dprintk(verbose, DST_INFO, 1, "FW: Unsupported command"); diff --git a/drivers/media/dvb/bt8xx/dst_common.h b/drivers/media/dvb/bt8xx/dst_common.h index 3281a6ca3685..29b5430dbe4f 100644 --- a/drivers/media/dvb/bt8xx/dst_common.h +++ b/drivers/media/dvb/bt8xx/dst_common.h @@ -49,6 +49,7 @@ #define DST_TYPE_HAS_FW_BUILD 64 #define DST_TYPE_HAS_OBS_REGS 128 #define DST_TYPE_HAS_INC_COUNT 256 +#define DST_TYPE_HAS_MULTI_FE 512 /* Card capability list */ @@ -117,6 +118,7 @@ struct dst_state { u8 fw_version[8]; u8 card_info[8]; u8 vendor[8]; + u8 board_info[8]; }; struct dst_types { -- cgit v1.2.2 From 9691bb14d9ab646868a6392e9419070c304a9590 Mon Sep 17 00:00:00 2001 From: Martin Zwickel Date: Tue, 8 Nov 2005 21:35:10 -0800 Subject: [PATCH] dvb: add support for Technotrend Budget Card S1500 This patch adds support for the Technotrend Budget Card S1500 with a BSBE1 frontend and the LNBP21. Signed-off-by: Martin Zwickel Signed-off-by: Andrew de Quincey Signed-off-by: Michael Krufky Cc: Johannes Stezenbach Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/dvb/ttpci/budget.c | 118 +++++++++++++++++++++++++++++++++++---- 1 file changed, 108 insertions(+), 10 deletions(-) diff --git a/drivers/media/dvb/ttpci/budget.c b/drivers/media/dvb/ttpci/budget.c index 43d6c8268642..0f6ead848e4d 100644 --- a/drivers/media/dvb/ttpci/budget.c +++ b/drivers/media/dvb/ttpci/budget.c @@ -226,12 +226,14 @@ static int lnbp21_enable_high_lnb_voltage(struct dvb_frontend* fe, int arg) return 0; } -static void lnbp21_init(struct budget* budget) +static int lnbp21_init(struct budget* budget) { u8 buf = 0x00; struct i2c_msg msg = { .addr = 0x08, .flags = 0, .buf = &buf, .len = sizeof(buf) }; - i2c_transfer (&budget->i2c_adap, &msg, 1); + if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) + return -EIO; + return 0; } static int alps_bsrv2_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) @@ -273,7 +275,7 @@ static u8 alps_bsru6_inittab[] = { 0x01, 0x15, 0x02, 0x00, 0x03, 0x00, - 0x04, 0x7d, /* F22FR = 0x7d, F22 = f_VCO / 128 / 0x7d = 22 kHz */ + 0x04, 0x7d, /* F22FR = 0x7d, F22 = f_VCO / 128 / 0x7d = 22 kHz */ 0x05, 0x35, /* I2CT = 0, SCLT = 1, SDAT = 1 */ 0x06, 0x40, /* DAC not used, set to high impendance mode */ 0x07, 0x00, /* DAC LSB */ @@ -367,6 +369,80 @@ static struct stv0299_config alps_bsru6_config = { .pll_set = alps_bsru6_pll_set, }; +static u8 alps_bsbe1_inittab[] = { + 0x01, 0x15, + 0x02, 0x30, + 0x03, 0x00, + 0x04, 0x7d, /* F22FR = 0x7d, F22 = f_VCO / 128 / 0x7d = 22 kHz */ + 0x05, 0x35, /* I2CT = 0, SCLT = 1, SDAT = 1 */ + 0x06, 0x40, /* DAC not used, set to high impendance mode */ + 0x07, 0x00, /* DAC LSB */ + 0x08, 0x40, /* DiSEqC off, LNB power on OP2/LOCK pin on */ + 0x09, 0x00, /* FIFO */ + 0x0c, 0x51, /* OP1 ctl = Normal, OP1 val = 1 (LNB Power ON) */ + 0x0d, 0x82, /* DC offset compensation = ON, beta_agc1 = 2 */ + 0x0e, 0x23, /* alpha_tmg = 2, beta_tmg = 3 */ + 0x10, 0x3f, // AGC2 0x3d + 0x11, 0x84, + 0x12, 0xb5, // Lock detect: -64 Carrier freq detect:on + 0x15, 0xc9, // lock detector threshold + 0x16, 0x00, + 0x17, 0x00, + 0x18, 0x00, + 0x19, 0x00, + 0x1a, 0x00, + 0x1f, 0x50, + 0x20, 0x00, + 0x21, 0x00, + 0x22, 0x00, + 0x23, 0x00, + 0x28, 0x00, // out imp: normal out type: parallel FEC mode:0 + 0x29, 0x1e, // 1/2 threshold + 0x2a, 0x14, // 2/3 threshold + 0x2b, 0x0f, // 3/4 threshold + 0x2c, 0x09, // 5/6 threshold + 0x2d, 0x05, // 7/8 threshold + 0x2e, 0x01, + 0x31, 0x1f, // test all FECs + 0x32, 0x19, // viterbi and synchro search + 0x33, 0xfc, // rs control + 0x34, 0x93, // error control + 0x0f, 0x92, // 0x80 = inverse AGC + 0xff, 0xff +}; + +static int alps_bsbe1_pll_set(struct dvb_frontend* fe, struct i2c_adapter *i2c, struct dvb_frontend_parameters* params) +{ + int ret; + u8 data[4]; + u32 div; + struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) }; + + if ((params->frequency < 950000) || (params->frequency > 2150000)) + return -EINVAL; + + div = (params->frequency + (125 - 1)) / 125; // round correctly + data[0] = (div >> 8) & 0x7f; + data[1] = div & 0xff; + data[2] = 0x80 | ((div & 0x18000) >> 10) | 4; + data[3] = (params->frequency > 1530000) ? 0xE0 : 0xE4; + + ret = i2c_transfer(i2c, &msg, 1); + return (ret != 1) ? -EIO : 0; +} + +static struct stv0299_config alps_bsbe1_config = { + .demod_address = 0x68, + .inittab = alps_bsbe1_inittab, + .mclk = 88000000UL, + .invert = 1, + .enhanced_tuning = 0, + .skip_reinit = 0, + .min_delay_ms = 100, + .set_symbol_rate = alps_bsru6_set_symbol_rate, + .pll_set = alps_bsbe1_pll_set, +}; + static int alps_tdbe2_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) { struct budget* budget = (struct budget*) fe->dvb->priv; @@ -500,6 +576,19 @@ static u8 read_pwm(struct budget* budget) static void frontend_init(struct budget *budget) { switch(budget->dev->pci->subsystem_device) { + case 0x1017: + // try the ALPS BSBE1 now + budget->dvb_frontend = stv0299_attach(&alps_bsbe1_config, &budget->i2c_adap); + if (budget->dvb_frontend) { + budget->dvb_frontend->ops->set_voltage = lnbp21_set_voltage; + budget->dvb_frontend->ops->enable_high_lnb_voltage = lnbp21_enable_high_lnb_voltage; + if (lnbp21_init(budget)) { + printk("%s: No LNBP21 found!\n", __FUNCTION__); + goto error_out; + } + } + + break; case 0x1003: // Hauppauge/TT Nova budget (stv0299/ALPS BSRU6(tsa5059) OR ves1893/ALPS BSRV2(sp5659)) case 0x1013: // try the ALPS BSRV2 first of all @@ -554,7 +643,10 @@ static void frontend_init(struct budget *budget) if (budget->dvb_frontend) { budget->dvb_frontend->ops->set_voltage = lnbp21_set_voltage; budget->dvb_frontend->ops->enable_high_lnb_voltage = lnbp21_enable_high_lnb_voltage; - lnbp21_init(budget); + if (lnbp21_init(budget)) { + printk("%s: No LNBP21 found!\n", __FUNCTION__); + goto error_out; + } break; } } @@ -566,13 +658,17 @@ static void frontend_init(struct budget *budget) budget->dev->pci->subsystem_vendor, budget->dev->pci->subsystem_device); } else { - if (dvb_register_frontend(&budget->dvb_adapter, budget->dvb_frontend)) { - printk("budget: Frontend registration failed!\n"); - if (budget->dvb_frontend->ops->release) - budget->dvb_frontend->ops->release(budget->dvb_frontend); - budget->dvb_frontend = NULL; - } + if (dvb_register_frontend(&budget->dvb_adapter, budget->dvb_frontend)) + goto error_out; } + return; + +error_out: + printk("budget: Frontend registration failed!\n"); + if (budget->dvb_frontend->ops->release) + budget->dvb_frontend->ops->release(budget->dvb_frontend); + budget->dvb_frontend = NULL; + return; } static int budget_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_data *info) @@ -618,6 +714,7 @@ static int budget_detach (struct saa7146_dev* dev) static struct saa7146_extension budget_extension; +MAKE_BUDGET_INFO(ttbs2, "TT-Budget/WinTV-NOVA-S PCI (rev AL/alps bsbe1 lnbp21 frontend)", BUDGET_TT); MAKE_BUDGET_INFO(ttbs, "TT-Budget/WinTV-NOVA-S PCI", BUDGET_TT); MAKE_BUDGET_INFO(ttbc, "TT-Budget/WinTV-NOVA-C PCI", BUDGET_TT); MAKE_BUDGET_INFO(ttbt, "TT-Budget/WinTV-NOVA-T PCI", BUDGET_TT); @@ -630,6 +727,7 @@ static struct pci_device_id pci_tbl[] = { MAKE_EXTENSION_PCI(ttbc, 0x13c2, 0x1004), MAKE_EXTENSION_PCI(ttbt, 0x13c2, 0x1005), MAKE_EXTENSION_PCI(satel, 0x13c2, 0x1013), + MAKE_EXTENSION_PCI(ttbs2, 0x13c2, 0x1017), MAKE_EXTENSION_PCI(ttbs, 0x13c2, 0x1016), MAKE_EXTENSION_PCI(fsacs1,0x1131, 0x4f60), MAKE_EXTENSION_PCI(fsacs0,0x1131, 0x4f61), -- cgit v1.2.2 From 3765022171874d249535a1c8b8190f408fd85f21 Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Tue, 8 Nov 2005 21:35:11 -0800 Subject: [PATCH] dvb: stv0299: revert improper method Remove my badly thought out patch. This does need done, but in a proper way. Signed-off-by: Andrew de Quincey Signed-off-by: Michael Krufky Cc: Johannes Stezenbach Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/dvb/frontends/stv0299.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/media/dvb/frontends/stv0299.c b/drivers/media/dvb/frontends/stv0299.c index 889d9257215d..b1876618a37d 100644 --- a/drivers/media/dvb/frontends/stv0299.c +++ b/drivers/media/dvb/frontends/stv0299.c @@ -64,8 +64,12 @@ struct stv0299_state { u32 tuner_frequency; u32 symbol_rate; fe_code_rate_t fec_inner; + int errmode; }; +#define STATUS_BER 0 +#define STATUS_UCBLOCKS 1 + static int debug; static int debug_legacy_dish_switch; #define dprintk(args...) \ @@ -517,8 +521,7 @@ static int stv0299_read_ber(struct dvb_frontend* fe, u32* ber) { struct stv0299_state* state = fe->demodulator_priv; - stv0299_writeregI(state, 0x34, (stv0299_readreg(state, 0x34) & 0xcf) | 0x10); - msleep(100); + if (state->errmode != STATUS_BER) return 0; *ber = (stv0299_readreg (state, 0x1d) << 8) | stv0299_readreg (state, 0x1e); return 0; @@ -557,9 +560,8 @@ static int stv0299_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) { struct stv0299_state* state = fe->demodulator_priv; - stv0299_writeregI(state, 0x34, (stv0299_readreg(state, 0x34) & 0xcf) | 0x30); - msleep(100); - *ucblocks = (stv0299_readreg (state, 0x1d) << 8) | stv0299_readreg (state, 0x1e); + if (state->errmode != STATUS_UCBLOCKS) *ucblocks = 0; + else *ucblocks = (stv0299_readreg (state, 0x1d) << 8) | stv0299_readreg (state, 0x1e); return 0; } @@ -708,6 +710,7 @@ struct dvb_frontend* stv0299_attach(const struct stv0299_config* config, state->tuner_frequency = 0; state->symbol_rate = 0; state->fec_inner = 0; + state->errmode = STATUS_BER; /* check if the demod is there */ stv0299_writeregI(state, 0x02, 0x34); /* standby off */ -- cgit v1.2.2 From 3cff00d91292e744a510be7256f1c80e1b0be819 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 8 Nov 2005 21:35:12 -0800 Subject: [PATCH] dvb: Add ATSC support for DViCO FusionHDTV5 Lite Added ATSC support for DViCO FusionHDTV5 Lite. Signed-off-by: Michael Krufky Cc: Johannes Stezenbach Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/dvb/bt8xx/Kconfig | 4 +- drivers/media/dvb/bt8xx/dvb-bt8xx.c | 67 ++++++++++++++++++++++++++++++++++ drivers/media/dvb/bt8xx/dvb-bt8xx.h | 1 + drivers/media/dvb/frontends/lgdt330x.c | 1 + 4 files changed, 72 insertions(+), 1 deletion(-) diff --git a/drivers/media/dvb/bt8xx/Kconfig b/drivers/media/dvb/bt8xx/Kconfig index 1e85d16491b0..2337b41714e0 100644 --- a/drivers/media/dvb/bt8xx/Kconfig +++ b/drivers/media/dvb/bt8xx/Kconfig @@ -6,10 +6,12 @@ config DVB_BT8XX select DVB_NXT6000 select DVB_CX24110 select DVB_OR51211 + select DVB_LGDT330X help Support for PCI cards based on the Bt8xx PCI bridge. Examples are the Nebula cards, the Pinnacle PCTV cards, the Twinhan DST cards, - the pcHDTV HD2000 cards, and certain AVerMedia cards. + the pcHDTV HD2000 cards, the DViCO FusionHDTV Lite cards, and + some AVerMedia cards. Since these cards have no MPEG decoder onboard, they transmit only compressed MPEG data over the PCI bus, so you need diff --git a/drivers/media/dvb/bt8xx/dvb-bt8xx.c b/drivers/media/dvb/bt8xx/dvb-bt8xx.c index c5c7672cd538..96ef35ecab49 100644 --- a/drivers/media/dvb/bt8xx/dvb-bt8xx.c +++ b/drivers/media/dvb/bt8xx/dvb-bt8xx.c @@ -34,6 +34,7 @@ #include "dvb_frontend.h" #include "dvb-bt8xx.h" #include "bt878.h" +#include "dvb-pll.h" static int debug; @@ -546,6 +547,55 @@ static struct mt352_config digitv_alps_tded4_config = { .pll_set = digitv_alps_tded4_pll_set, }; +static int tdvs_tua6034_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) +{ + struct dvb_bt8xx_card *card = (struct dvb_bt8xx_card *) fe->dvb->priv; + u8 buf[4]; + struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = buf, .len = sizeof(buf) }; + int err; + + dvb_pll_configure(&dvb_pll_tdvs_tua6034, buf, params->frequency, 0); + dprintk("%s: tuner at 0x%02x bytes: 0x%02x 0x%02x 0x%02x 0x%02x\n", + __FUNCTION__, msg.addr, buf[0],buf[1],buf[2],buf[3]); + if ((err = i2c_transfer(card->i2c_adapter, &msg, 1)) != 1) { + printk(KERN_WARNING "dvb-bt8xx: %s error " + "(addr %02x <- %02x, err = %i)\n", + __FUNCTION__, buf[0], buf[1], err); + if (err < 0) + return err; + else + return -EREMOTEIO; + } + + /* Set the Auxiliary Byte. */ + buf[2] &= ~0x20; + buf[2] |= 0x18; + buf[3] = 0x50; + i2c_transfer(card->i2c_adapter, &msg, 1); + + return 0; +} + +static struct lgdt330x_config tdvs_tua6034_config = { + .demod_address = 0x0e, + .demod_chip = LGDT3303, + .serial_mpeg = 0x40, /* TPSERIAL for 3303 in TOP_CONTROL */ + .pll_set = tdvs_tua6034_pll_set, +}; + +static void lgdt330x_reset(struct dvb_bt8xx_card *bt) +{ + /* Set pin 27 of the lgdt3303 chip high to reset the frontend */ + + /* Pulse the reset line */ + bttv_write_gpio(bt->bttv_nr, 0x00e00007, 0x00000001); /* High */ + bttv_write_gpio(bt->bttv_nr, 0x00e00007, 0x00000000); /* Low */ + msleep(100); + + bttv_write_gpio(bt->bttv_nr, 0x00e00007, 0x00000001); /* High */ + msleep(100); +} + static void frontend_init(struct dvb_bt8xx_card *card, u32 type) { int ret; @@ -562,6 +612,15 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type) break; #endif +#ifdef BTTV_DVICO_FUSIONHDTV_5_LITE + case BTTV_DVICO_FUSIONHDTV_5_LITE: + lgdt330x_reset(card); + card->fe = lgdt330x_attach(&tdvs_tua6034_config, card->i2c_adapter); + if (card->fe != NULL) + dprintk ("dvb_bt8xx: lgdt330x detected\n"); + break; +#endif + #ifdef BTTV_TWINHAN_VP3021 case BTTV_TWINHAN_VP3021: #else @@ -765,6 +824,14 @@ static int dvb_bt8xx_probe(struct device *dev) * DA_APP(parallel) */ break; +#ifdef BTTV_DVICO_FUSIONHDTV_5_LITE + case BTTV_DVICO_FUSIONHDTV_5_LITE: +#endif + card->gpio_mode = 0x0400c060; + card->op_sync_orin = BT878_RISC_SYNC_MASK; + card->irq_err_ignore = BT878_AFBUS | BT878_AFDSR; + break; + #ifdef BTTV_TWINHAN_VP3021 case BTTV_TWINHAN_VP3021: #else diff --git a/drivers/media/dvb/bt8xx/dvb-bt8xx.h b/drivers/media/dvb/bt8xx/dvb-bt8xx.h index 9ec8e5bd6c1f..cf035a80361c 100644 --- a/drivers/media/dvb/bt8xx/dvb-bt8xx.h +++ b/drivers/media/dvb/bt8xx/dvb-bt8xx.h @@ -35,6 +35,7 @@ #include "nxt6000.h" #include "cx24110.h" #include "or51211.h" +#include "lgdt330x.h" struct dvb_bt8xx_card { struct semaphore lock; diff --git a/drivers/media/dvb/frontends/lgdt330x.c b/drivers/media/dvb/frontends/lgdt330x.c index 7852b83b82d4..145918877d2f 100644 --- a/drivers/media/dvb/frontends/lgdt330x.c +++ b/drivers/media/dvb/frontends/lgdt330x.c @@ -26,6 +26,7 @@ * DViCO FusionHDTV 3 Gold-Q * DViCO FusionHDTV 3 Gold-T * DViCO FusionHDTV 5 Gold + * DViCO FusionHDTV 5 Lite * * TODO: * signal strength always returns 0. -- cgit v1.2.2 From 634623d3ba6146e13d06d3f36188c189c8a58a23 Mon Sep 17 00:00:00 2001 From: Hartmut Hackmann Date: Tue, 8 Nov 2005 21:35:13 -0800 Subject: [PATCH] dvb: tda1004x: pll communication fixes - leave I2C bridge open at pll_sleep to support Philips EUROPA based cards. - give an error message if the communication with the pll fails. Signed-off-by: Hartmut Hackmann Signed-off-by: Michael Krufky Cc: Johannes Stezenbach Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/dvb/frontends/tda1004x.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/drivers/media/dvb/frontends/tda1004x.c b/drivers/media/dvb/frontends/tda1004x.c index 3529c618f828..7968743826fc 100644 --- a/drivers/media/dvb/frontends/tda1004x.c +++ b/drivers/media/dvb/frontends/tda1004x.c @@ -420,7 +420,7 @@ static void tda10046_init_plls(struct dvb_frontend* fe) struct tda1004x_state* state = fe->demodulator_priv; tda1004x_write_byteI(state, TDA10046H_CONFPLL1, 0xf0); - tda1004x_write_byteI(state, TDA10046H_CONFPLL2, 10); // PLL M = 10 + tda1004x_write_byteI(state, TDA10046H_CONFPLL2, 0x0a); // PLL M = 10 if (state->config->xtal_freq == TDA10046_XTAL_4M ) { dprintk("%s: setting up PLLs for a 4 MHz Xtal\n", __FUNCTION__); tda1004x_write_byteI(state, TDA10046H_CONFPLL3, 0); // PLL P = N = 0 @@ -597,7 +597,10 @@ static int tda10046_init(struct dvb_frontend* fe) // Init the tuner PLL if (state->config->pll_init) { tda1004x_enable_tuner_i2c(state); - state->config->pll_init(fe); + if (state->config->pll_init(fe)) { + printk(KERN_ERR "tda1004x: pll init failed\n"); + return -EIO; + } tda1004x_disable_tuner_i2c(state); } @@ -667,7 +670,10 @@ static int tda1004x_set_fe(struct dvb_frontend* fe, // set frequency tda1004x_enable_tuner_i2c(state); - state->config->pll_set(fe, fe_params); + if (state->config->pll_set(fe, fe_params)) { + printk(KERN_ERR "tda1004x: pll set failed\n"); + return -EIO; + } tda1004x_disable_tuner_i2c(state); // Hardcoded to use auto as much as possible on the TDA10045 as it @@ -832,6 +838,8 @@ static int tda1004x_set_fe(struct dvb_frontend* fe, case TDA1004X_DEMOD_TDA10046: tda1004x_write_mask(state, TDA1004X_AUTO, 0x40, 0x40); + msleep(1); + tda1004x_write_mask(state, TDA10046H_AGC_CONF, 4, 1); break; } @@ -1129,7 +1137,12 @@ static int tda1004x_sleep(struct dvb_frontend* fe) if (state->config->pll_sleep != NULL) { tda1004x_enable_tuner_i2c(state); state->config->pll_sleep(fe); - tda1004x_disable_tuner_i2c(state); + if (state->config->if_freq != TDA10046_FREQ_052) { + /* special hack for Philips EUROPA Based boards: + * keep the I2c bridge open for tuner access in analog mode + */ + tda1004x_disable_tuner_i2c(state); + } } tda1004x_write_mask(state, TDA1004X_CONFC4, 1, 1); break; -- cgit v1.2.2 From 6573dd752d50730d44c550ad0467d15871963655 Mon Sep 17 00:00:00 2001 From: Andreas Oberritter Date: Tue, 8 Nov 2005 21:35:14 -0800 Subject: [PATCH] dvb: pluto2: Removed unavoidable error message and related code Removed unavoidable error message and related code. Signed-off-by: Andreas Oberritter Signed-off-by: Michael Krufky Cc: Johannes Stezenbach Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/dvb/pluto2/pluto2.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/media/dvb/pluto2/pluto2.c b/drivers/media/dvb/pluto2/pluto2.c index 85b437bbddcd..bbebd1c4caca 100644 --- a/drivers/media/dvb/pluto2/pluto2.c +++ b/drivers/media/dvb/pluto2/pluto2.c @@ -286,15 +286,10 @@ static void pluto_dma_end(struct pluto *pluto, unsigned int nbpackets) * although one packet has been transfered. */ if ((nbpackets == 0) || (nbpackets > TS_DMA_PACKETS)) { - unsigned int i = 0, valid; + unsigned int i = 0; while (pluto->dma_buf[i] == 0x47) i += 188; - valid = i / 188; - if (nbpackets != valid) { - dev_err(&pluto->pdev->dev, "nbpackets=%u valid=%u\n", - nbpackets, valid); - nbpackets = valid; - } + nbpackets = i / 188; } dvb_dmx_swfilter_packets(&pluto->demux, pluto->dma_buf, nbpackets); -- cgit v1.2.2 From a18a80b09f78178f6404b538ab09937ee9044e2e Mon Sep 17 00:00:00 2001 From: Thorsten Maerz Date: Tue, 8 Nov 2005 21:35:15 -0800 Subject: [PATCH] dvb: remove duplicate key definitions The duplicate key definitions cause misinterpretations with other keys, e.g. the "TELETEXT" key clashes with "CHANNEL_UP" and thus can not be used with LIRC. This patch removes these duplicates. Signed-off-by: Thorsten Maerz Signed-off-by: Michael Krufky Cc: Johannes Stezenbach Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/dvb/dvb-usb/a800.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/media/dvb/dvb-usb/a800.c b/drivers/media/dvb/dvb-usb/a800.c index e55322ef76b3..49f541d9a042 100644 --- a/drivers/media/dvb/dvb-usb/a800.c +++ b/drivers/media/dvb/dvb-usb/a800.c @@ -43,11 +43,9 @@ static struct dvb_usb_rc_key a800_rc_keys[] = { { 0x02, 0x13, KEY_RIGHT }, /* R / CH RTN */ { 0x02, 0x17, KEY_PROG2 }, /* SNAP SHOT */ { 0x02, 0x10, KEY_PROG3 }, /* 16-CH PREV */ - { 0x02, 0x03, KEY_CHANNELUP }, /* CH UP */ { 0x02, 0x1e, KEY_VOLUMEDOWN }, /* VOL DOWN */ { 0x02, 0x0c, KEY_ZOOM }, /* FULL SCREEN */ { 0x02, 0x1f, KEY_VOLUMEUP }, /* VOL UP */ - { 0x02, 0x02, KEY_CHANNELDOWN }, /* CH DOWN */ { 0x02, 0x14, KEY_MUTE }, /* MUTE */ { 0x02, 0x08, KEY_AUDIO }, /* AUDIO */ { 0x02, 0x19, KEY_RECORD }, /* RECORD */ @@ -57,8 +55,6 @@ static struct dvb_usb_rc_key a800_rc_keys[] = { { 0x02, 0x1d, KEY_BACK }, /* << / RED */ { 0x02, 0x1c, KEY_FORWARD }, /* >> / YELLOW */ { 0x02, 0x03, KEY_TEXT }, /* TELETEXT */ - { 0x02, 0x01, KEY_FIRST }, /* |<< / GREEN */ - { 0x02, 0x00, KEY_LAST }, /* >>| / BLUE */ { 0x02, 0x04, KEY_EPG }, /* EPG */ { 0x02, 0x15, KEY_MENU }, /* MENU */ -- cgit v1.2.2 From 2b70a2f55e249308c57879df5723d96406e12b27 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 8 Nov 2005 21:35:16 -0800 Subject: [PATCH] dvb: microtune mt7202dtf: Fix charge pump setting Fix charge pump setting in microtune_mt7202dtf_pll_set(). Thanks to Jyrki Niskala for reporting. Signed-off-by: Johannes Stezenbach Signed-off-by: Michael Krufky Cc: Johannes Stezenbach Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/dvb/bt8xx/dvb-bt8xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/dvb/bt8xx/dvb-bt8xx.c b/drivers/media/dvb/bt8xx/dvb-bt8xx.c index 96ef35ecab49..1c5f1ec85352 100644 --- a/drivers/media/dvb/bt8xx/dvb-bt8xx.c +++ b/drivers/media/dvb/bt8xx/dvb-bt8xx.c @@ -280,7 +280,7 @@ static int microtune_mt7202dtf_pll_set(struct dvb_frontend* fe, struct dvb_front data[0] = (div >> 8) & 0x7f; data[1] = div & 0xff; data[2] = ((div >> 10) & 0x60) | cfg; - data[3] = cpump | band_select; + data[3] = (cpump << 6) | band_select; i2c_transfer(card->i2c_adapter, &msg, 1); return (div * 166666 - 36000000); -- cgit v1.2.2 From 93a14f15d35cd60742220995d3413d256ebde9ee Mon Sep 17 00:00:00 2001 From: Raymond Mantchala Date: Tue, 8 Nov 2005 21:35:17 -0800 Subject: [PATCH] dvb: dst: ASN.1 length field Fix ASN.1 length field Fix Signed-off-by: Raymond Mantchala Signed-off-by: Manu Abraham Signed-off-by: Michael Krufky Cc: Johannes Stezenbach Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/dvb/bt8xx/dst_ca.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/dvb/bt8xx/dst_ca.c b/drivers/media/dvb/bt8xx/dst_ca.c index 6776a592045f..8a8a3333cb8f 100644 --- a/drivers/media/dvb/bt8xx/dst_ca.c +++ b/drivers/media/dvb/bt8xx/dst_ca.c @@ -328,7 +328,8 @@ u32 asn_1_decode(u8 *asn_1_array) } else { word_count = length_field & 0x7f; for (count = 0; count < word_count; count++) { - length = (length | asn_1_array[count + 1]) << 8; + length = length << 8; + length += asn_1_array[count + 1]; dprintk(verbose, DST_CA_DEBUG, 1, " Length=[%04x]", length); } } -- cgit v1.2.2 From 174f80dfcba45677f12ba57479d03750dd9cad7b Mon Sep 17 00:00:00 2001 From: Peter Hagervall Date: Tue, 8 Nov 2005 21:35:18 -0800 Subject: [PATCH] dvb: fix sparse warnings Sparse warnings - remove address space related warnings Signed-off-by: Peter Hagervall Signed-off-by: Manu Abraham Signed-off-by: Michael Krufky Cc: Johannes Stezenbach Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/dvb/bt8xx/dst_ca.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/drivers/media/dvb/bt8xx/dst_ca.c b/drivers/media/dvb/bt8xx/dst_ca.c index 8a8a3333cb8f..492e829fe021 100644 --- a/drivers/media/dvb/bt8xx/dst_ca.c +++ b/drivers/media/dvb/bt8xx/dst_ca.c @@ -166,7 +166,7 @@ static int ca_get_app_info(struct dst_state *state) return 0; } -static int ca_get_slot_caps(struct dst_state *state, struct ca_caps *p_ca_caps, void *arg) +static int ca_get_slot_caps(struct dst_state *state, struct ca_caps *p_ca_caps, void __user *arg) { int i; u8 slot_cap[256]; @@ -192,20 +192,20 @@ static int ca_get_slot_caps(struct dst_state *state, struct ca_caps *p_ca_caps, p_ca_caps->descr_num = slot_cap[7]; p_ca_caps->descr_type = 1; - if (copy_to_user((struct ca_caps *)arg, p_ca_caps, sizeof (struct ca_caps))) + if (copy_to_user(arg, p_ca_caps, sizeof (struct ca_caps))) return -EFAULT; return 0; } /* Need some more work */ -static int ca_get_slot_descr(struct dst_state *state, struct ca_msg *p_ca_message, void *arg) +static int ca_get_slot_descr(struct dst_state *state, struct ca_msg *p_ca_message, void __user *arg) { return -EOPNOTSUPP; } -static int ca_get_slot_info(struct dst_state *state, struct ca_slot_info *p_ca_slot_info, void *arg) +static int ca_get_slot_info(struct dst_state *state, struct ca_slot_info *p_ca_slot_info, void __user *arg) { int i; static u8 slot_command[8] = {0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff}; @@ -238,19 +238,19 @@ static int ca_get_slot_info(struct dst_state *state, struct ca_slot_info *p_ca_s } else p_ca_slot_info->flags = 0; - if (copy_to_user((struct ca_slot_info *)arg, p_ca_slot_info, sizeof (struct ca_slot_info))) + if (copy_to_user(arg, p_ca_slot_info, sizeof (struct ca_slot_info))) return -EFAULT; return 0; } -static int ca_get_message(struct dst_state *state, struct ca_msg *p_ca_message, void *arg) +static int ca_get_message(struct dst_state *state, struct ca_msg *p_ca_message, void __user *arg) { u8 i = 0; u32 command = 0; - if (copy_from_user(p_ca_message, (void *)arg, sizeof (struct ca_msg))) + if (copy_from_user(p_ca_message, arg, sizeof (struct ca_msg))) return -EFAULT; if (p_ca_message->msg) { @@ -266,7 +266,7 @@ static int ca_get_message(struct dst_state *state, struct ca_msg *p_ca_message, switch (command) { case CA_APP_INFO: memcpy(p_ca_message->msg, state->messages, 128); - if (copy_to_user((void *)arg, p_ca_message, sizeof (struct ca_msg)) ) + if (copy_to_user(arg, p_ca_message, sizeof (struct ca_msg)) ) return -EFAULT; break; } @@ -315,7 +315,7 @@ static int write_to_8820(struct dst_state *state, struct ca_msg *hw_buffer, u8 l return 0; } -u32 asn_1_decode(u8 *asn_1_array) +static u32 asn_1_decode(u8 *asn_1_array) { u8 length_field = 0, word_count = 0, count = 0; u32 length = 0; @@ -400,7 +400,7 @@ static int dst_check_ca_pmt(struct dst_state *state, struct ca_msg *p_ca_message return 0; } -static int ca_send_message(struct dst_state *state, struct ca_msg *p_ca_message, void *arg) +static int ca_send_message(struct dst_state *state, struct ca_msg *p_ca_message, void __user *arg) { int i = 0; unsigned int ca_message_header_len; @@ -414,7 +414,7 @@ static int ca_send_message(struct dst_state *state, struct ca_msg *p_ca_message, } dprintk(verbose, DST_CA_DEBUG, 1, " "); - if (copy_from_user(p_ca_message, (void *)arg, sizeof (struct ca_msg))) + if (copy_from_user(p_ca_message, arg, sizeof (struct ca_msg))) return -EFAULT; if (p_ca_message->msg) { @@ -461,13 +461,14 @@ static int ca_send_message(struct dst_state *state, struct ca_msg *p_ca_message, return 0; } -static int dst_ca_ioctl(struct inode *inode, struct file *file, unsigned int cmd, void *arg) +static int dst_ca_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long ioctl_arg) { struct dvb_device* dvbdev = (struct dvb_device*) file->private_data; struct dst_state* state = (struct dst_state*) dvbdev->priv; struct ca_slot_info *p_ca_slot_info; struct ca_caps *p_ca_caps; struct ca_msg *p_ca_message; + void __user *arg = (void __user *)ioctl_arg; if ((p_ca_message = (struct ca_msg *) kmalloc(sizeof (struct ca_msg), GFP_KERNEL)) == NULL) { dprintk(verbose, DST_CA_ERROR, 1, " Memory allocation failure"); @@ -583,7 +584,7 @@ static int dst_ca_write(struct file *file, const char __user *buffer, size_t len static struct file_operations dst_ca_fops = { .owner = THIS_MODULE, - .ioctl = (void *)dst_ca_ioctl, + .ioctl = dst_ca_ioctl, .open = dst_ca_open, .release = dst_ca_release, .read = dst_ca_read, -- cgit v1.2.2 From f630558dfbd47301c2ce30f7e4acd2817a7455ac Mon Sep 17 00:00:00 2001 From: Perceval Anichini Date: Tue, 8 Nov 2005 21:35:19 -0800 Subject: [PATCH] dvb: dst: fix memory leaks fix memory leaks Signed-off-by: Perceval Anichini Signed-off-by: Manu Abraham Signed-off-by: Michael Krufky Cc: Johannes Stezenbach Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/dvb/bt8xx/dst_ca.c | 52 ++++++++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/drivers/media/dvb/bt8xx/dst_ca.c b/drivers/media/dvb/bt8xx/dst_ca.c index 492e829fe021..f77fda77b638 100644 --- a/drivers/media/dvb/bt8xx/dst_ca.c +++ b/drivers/media/dvb/bt8xx/dst_ca.c @@ -407,6 +407,7 @@ static int ca_send_message(struct dst_state *state, struct ca_msg *p_ca_message, u32 command = 0; struct ca_msg *hw_buffer; + int result = 0; if ((hw_buffer = (struct ca_msg *) kmalloc(sizeof (struct ca_msg), GFP_KERNEL)) == NULL) { dprintk(verbose, DST_CA_ERROR, 1, " Memory allocation failure"); @@ -414,8 +415,11 @@ static int ca_send_message(struct dst_state *state, struct ca_msg *p_ca_message, } dprintk(verbose, DST_CA_DEBUG, 1, " "); - if (copy_from_user(p_ca_message, arg, sizeof (struct ca_msg))) - return -EFAULT; + if (copy_from_user(p_ca_message, (void *)arg, sizeof (struct ca_msg))) { + result = -EFAULT; + goto free_mem_and_exit; + } + if (p_ca_message->msg) { ca_message_header_len = p_ca_message->length; /* Restore it back when you are done */ @@ -434,7 +438,8 @@ static int ca_send_message(struct dst_state *state, struct ca_msg *p_ca_message, dprintk(verbose, DST_CA_DEBUG, 1, "Command = SEND_CA_PMT"); if ((ca_set_pmt(state, p_ca_message, hw_buffer, 0, 0)) < 0) { // code simplification started dprintk(verbose, DST_CA_ERROR, 1, " -->CA_PMT Failed !"); - return -1; + result = -1; + goto free_mem_and_exit; } dprintk(verbose, DST_CA_INFO, 1, " -->CA_PMT Success !"); break; @@ -443,7 +448,8 @@ static int ca_send_message(struct dst_state *state, struct ca_msg *p_ca_message, /* Have to handle the 2 basic types of cards here */ if ((dst_check_ca_pmt(state, p_ca_message, hw_buffer)) < 0) { dprintk(verbose, DST_CA_ERROR, 1, " -->CA_PMT_REPLY Failed !"); - return -1; + result = -1; + goto free_mem_and_exit; } dprintk(verbose, DST_CA_INFO, 1, " -->CA_PMT_REPLY Success !"); break; @@ -452,13 +458,17 @@ static int ca_send_message(struct dst_state *state, struct ca_msg *p_ca_message, if ((ca_get_app_info(state)) < 0) { dprintk(verbose, DST_CA_ERROR, 1, " -->CA_APP_INFO_ENQUIRY Failed !"); - return -1; + result = -1; + goto free_mem_and_exit; } dprintk(verbose, DST_CA_INFO, 1, " -->CA_APP_INFO_ENQUIRY Success !"); break; } } - return 0; +free_mem_and_exit: + kfree (hw_buffer); + + return result; } static int dst_ca_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long ioctl_arg) @@ -469,6 +479,7 @@ static int dst_ca_ioctl(struct inode *inode, struct file *file, unsigned int cmd struct ca_caps *p_ca_caps; struct ca_msg *p_ca_message; void __user *arg = (void __user *)ioctl_arg; + int result = 0; if ((p_ca_message = (struct ca_msg *) kmalloc(sizeof (struct ca_msg), GFP_KERNEL)) == NULL) { dprintk(verbose, DST_CA_ERROR, 1, " Memory allocation failure"); @@ -488,14 +499,16 @@ static int dst_ca_ioctl(struct inode *inode, struct file *file, unsigned int cmd dprintk(verbose, DST_CA_INFO, 1, " Sending message"); if ((ca_send_message(state, p_ca_message, arg)) < 0) { dprintk(verbose, DST_CA_ERROR, 1, " -->CA_SEND_MSG Failed !"); - return -1; + result = -1; + goto free_mem_and_exit; } break; case CA_GET_MSG: dprintk(verbose, DST_CA_INFO, 1, " Getting message"); if ((ca_get_message(state, p_ca_message, arg)) < 0) { dprintk(verbose, DST_CA_ERROR, 1, " -->CA_GET_MSG Failed !"); - return -1; + result = -1; + goto free_mem_and_exit; } dprintk(verbose, DST_CA_INFO, 1, " -->CA_GET_MSG Success !"); break; @@ -508,7 +521,8 @@ static int dst_ca_ioctl(struct inode *inode, struct file *file, unsigned int cmd dprintk(verbose, DST_CA_INFO, 1, " Getting Slot info"); if ((ca_get_slot_info(state, p_ca_slot_info, arg)) < 0) { dprintk(verbose, DST_CA_ERROR, 1, " -->CA_GET_SLOT_INFO Failed !"); - return -1; + result = -1; + goto free_mem_and_exit; } dprintk(verbose, DST_CA_INFO, 1, " -->CA_GET_SLOT_INFO Success !"); break; @@ -516,7 +530,8 @@ static int dst_ca_ioctl(struct inode *inode, struct file *file, unsigned int cmd dprintk(verbose, DST_CA_INFO, 1, " Getting Slot capabilities"); if ((ca_get_slot_caps(state, p_ca_caps, arg)) < 0) { dprintk(verbose, DST_CA_ERROR, 1, " -->CA_GET_CAP Failed !"); - return -1; + result = -1; + goto free_mem_and_exit; } dprintk(verbose, DST_CA_INFO, 1, " -->CA_GET_CAP Success !"); break; @@ -524,7 +539,8 @@ static int dst_ca_ioctl(struct inode *inode, struct file *file, unsigned int cmd dprintk(verbose, DST_CA_INFO, 1, " Getting descrambler description"); if ((ca_get_slot_descr(state, p_ca_message, arg)) < 0) { dprintk(verbose, DST_CA_ERROR, 1, " -->CA_GET_DESCR_INFO Failed !"); - return -1; + result = -1; + goto free_mem_and_exit; } dprintk(verbose, DST_CA_INFO, 1, " -->CA_GET_DESCR_INFO Success !"); break; @@ -532,7 +548,8 @@ static int dst_ca_ioctl(struct inode *inode, struct file *file, unsigned int cmd dprintk(verbose, DST_CA_INFO, 1, " Setting descrambler"); if ((ca_set_slot_descr()) < 0) { dprintk(verbose, DST_CA_ERROR, 1, " -->CA_SET_DESCR Failed !"); - return -1; + result = -1; + goto free_mem_and_exit; } dprintk(verbose, DST_CA_INFO, 1, " -->CA_SET_DESCR Success !"); break; @@ -540,14 +557,19 @@ static int dst_ca_ioctl(struct inode *inode, struct file *file, unsigned int cmd dprintk(verbose, DST_CA_INFO, 1, " Setting PID"); if ((ca_set_pid()) < 0) { dprintk(verbose, DST_CA_ERROR, 1, " -->CA_SET_PID Failed !"); - return -1; + result = -1; + goto free_mem_and_exit; } dprintk(verbose, DST_CA_INFO, 1, " -->CA_SET_PID Success !"); default: - return -EOPNOTSUPP; + result = -EOPNOTSUPP; }; + free_mem_and_exit: + kfree (p_ca_message); + kfree (p_ca_slot_info); + kfree (p_ca_caps); - return 0; + return result; } static int dst_ca_open(struct inode *inode, struct file *file) -- cgit v1.2.2 From 4c09aa72b60f30650527afb384c1b3b1cb56aeea Mon Sep 17 00:00:00 2001 From: Manu Abraham Date: Tue, 8 Nov 2005 21:35:20 -0800 Subject: [PATCH] dvb: dst: fix broken support for vp-3040 TS204 fixes broken support for vp-3040 TS204 Thanks-to: Lee Hammerton Signed-off-by: Manu Abraham Cc: Johannes Stezenbach Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/dvb/bt8xx/dst.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/media/dvb/bt8xx/dst.c b/drivers/media/dvb/bt8xx/dst.c index 6f9e5c168038..418ffbbef966 100644 --- a/drivers/media/dvb/bt8xx/dst.c +++ b/drivers/media/dvb/bt8xx/dst.c @@ -905,10 +905,6 @@ static int dst_get_device_id(struct dst_state *state) state->dst_type = use_dst_type; dst_type_flags_print(state->type_flags); - if (state->type_flags & DST_TYPE_HAS_TS204) { - dst_packsize(state, 204); - } - return 0; } @@ -940,6 +936,9 @@ static int dst_probe(struct dst_state *state) if (dst_get_tuner_info(state) < 0) dprintk(verbose, DST_INFO, 1, "Tuner: Unsupported command"); } + if (state->type_flags & DST_TYPE_HAS_TS204) { + dst_packsize(state, 204); + } if (state->type_flags & DST_TYPE_HAS_FW_BUILD) { if (dst_fw_ver(state) < 0) { dprintk(verbose, DST_INFO, 1, "FW: Unsupported command"); -- cgit v1.2.2 From f5648e8a68daec5fd1c42c1500c662967adb8f6c Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Tue, 8 Nov 2005 21:35:22 -0800 Subject: [PATCH] dvb: dst: fix DST DVB-S get_frequency fix DST DVB-S get_frequency - fixes a bug that caused the returned frequency to wrong Signed-off-by: Tom Hughes Signed-off-by: Manu Abraham Signed-off-by: Michael Krufky Cc: Johannes Stezenbach Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/dvb/bt8xx/dst.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/media/dvb/bt8xx/dst.c b/drivers/media/dvb/bt8xx/dst.c index 418ffbbef966..bc833a55438f 100644 --- a/drivers/media/dvb/bt8xx/dst.c +++ b/drivers/media/dvb/bt8xx/dst.c @@ -1092,7 +1092,13 @@ static int dst_get_tuna(struct dst_state *state) } if (state->rx_tuna[2] == 0 && state->rx_tuna[3] == 0) return 0; - state->decode_freq = ((state->rx_tuna[2] & 0x7f) << 8) + state->rx_tuna[3]; + + if (state->dst_type == DST_TYPE_IS_SAT) { + state->decode_freq = ((state->rx_tuna[2] & 0x7f) << 8) + state->rx_tuna[3]; + } else { + state->decode_freq = ((state->rx_tuna[2] & 0x7f) << 16) + (state->rx_tuna[3] << 8) + state->rx_tuna[4]; + } + state->decode_freq = state->decode_freq * 1000; state->decode_lock = 1; state->diseq_flags |= HAS_LOCK; -- cgit v1.2.2 From 4fbbc7ee591ab19707d12e2f86a1ae11f7195423 Mon Sep 17 00:00:00 2001 From: Perceval Anichini Date: Tue, 8 Nov 2005 21:35:23 -0800 Subject: [PATCH] dvb: dst: remove redundant checksum calculation removes the redundant checksum calculation, which was also exported from the dst.c module Signed-off-by: Perceval Anichini Signed-off-by: Manu Abraham Signed-off-by: Michael Krufky Cc: Johannes Stezenbach Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/dvb/bt8xx/dst_ca.c | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/drivers/media/dvb/bt8xx/dst_ca.c b/drivers/media/dvb/bt8xx/dst_ca.c index f77fda77b638..16645e06dea2 100644 --- a/drivers/media/dvb/bt8xx/dst_ca.c +++ b/drivers/media/dvb/bt8xx/dst_ca.c @@ -69,26 +69,12 @@ static int ca_set_pid(void) } -static int put_checksum(u8 *check_string, int length) +static void put_checksum(u8 *check_string, int length) { - u8 i = 0, checksum = 0; - - dprintk(verbose, DST_CA_DEBUG, 1, " ========================= Checksum calculation ==========================="); - dprintk(verbose, DST_CA_DEBUG, 1, " String Length=[0x%02x]", length); - dprintk(verbose, DST_CA_DEBUG, 1, " String=["); - - while (i < length) { - dprintk(verbose, DST_CA_DEBUG, 0, " %02x", check_string[i]); - checksum += check_string[i]; - i++; - } - dprintk(verbose, DST_CA_DEBUG, 0, " ]\n"); - dprintk(verbose, DST_CA_DEBUG, 1, "Sum=[%02x]\n", checksum); - check_string[length] = ~checksum + 1; - dprintk(verbose, DST_CA_DEBUG, 1, " Checksum=[%02x]", check_string[length]); - dprintk(verbose, DST_CA_DEBUG, 1, " =========================================================================="); - - return 0; + dprintk(verbose, DST_CA_DEBUG, 1, " Computing string checksum."); + dprintk(verbose, DST_CA_DEBUG, 1, " -> string length : 0x%02x", length); + check_string[length] = dst_check_sum (check_string, length); + dprintk(verbose, DST_CA_DEBUG, 1, " -> checksum : 0x%02x", check_string[length]); } static int dst_ci_command(struct dst_state* state, u8 * data, u8 *ca_string, u8 len, int read) -- cgit v1.2.2 From 5c15c0b4fa850543b8ccfcf93686d24456cc384d Mon Sep 17 00:00:00 2001 From: Manu Abraham Date: Tue, 8 Nov 2005 21:35:24 -0800 Subject: [PATCH] dvb: dst: Fix possible buffer overflow Fixes a possible buffer overflow due to reading more than 8 bytes into an 8 byte long array Thanks to Perceval Anichini for pointing out the bug. Signed-off-by: Manu Abraham Signed-off-by: Michael Krufky Cc: Johannes Stezenbach Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/dvb/bt8xx/dst_ca.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/dvb/bt8xx/dst_ca.c b/drivers/media/dvb/bt8xx/dst_ca.c index 16645e06dea2..38c728945bf1 100644 --- a/drivers/media/dvb/bt8xx/dst_ca.c +++ b/drivers/media/dvb/bt8xx/dst_ca.c @@ -196,7 +196,7 @@ static int ca_get_slot_info(struct dst_state *state, struct ca_slot_info *p_ca_s int i; static u8 slot_command[8] = {0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff}; - u8 *slot_info = state->rxbuffer; + u8 *slot_info = state->messages; put_checksum(&slot_command[0], 7); if ((dst_put_ci(state, slot_command, sizeof (slot_command), slot_info, GET_REPLY)) < 0) { -- cgit v1.2.2 From b90ed914e513a6ad6184f7a46a0df0888dcfc177 Mon Sep 17 00:00:00 2001 From: Johannes Stezenbach Date: Tue, 8 Nov 2005 21:35:25 -0800 Subject: [PATCH] dvb: Fix integer overflow bug Fix integer overflow bug in read_signal_strength() reported by Anthony Leclerc. Signed-off-by: Johannes Stezenbach Signed-off-by: Michael Krufky Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/dvb/frontends/or51132.c | 7 ++++++- drivers/media/dvb/frontends/or51211.c | 8 ++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/media/dvb/frontends/or51132.c b/drivers/media/dvb/frontends/or51132.c index fc74c40d6477..78bded861d02 100644 --- a/drivers/media/dvb/frontends/or51132.c +++ b/drivers/media/dvb/frontends/or51132.c @@ -468,6 +468,7 @@ static int or51132_read_signal_strength(struct dvb_frontend* fe, u16* strength) unsigned char snd_buf[2]; u8 rcvr_stat; u16 snr_equ; + u32 signal_strength; int usK; snd_buf[0]=0x04; @@ -503,7 +504,11 @@ static int or51132_read_signal_strength(struct dvb_frontend* fe, u16* strength) usK = (rcvr_stat & 0x10) ? 3 : 0; /* The value reported back from the frontend will be FFFF=100% 0000=0% */ - *strength = (((8952 - i20Log10(snr_equ) - usK*100)/3+5)*65535)/1000; + signal_strength = (((8952 - i20Log10(snr_equ) - usK*100)/3+5)*65535)/1000; + if (signal_strength > 0xffff) + *strength = 0xffff; + else + *strength = signal_strength; dprintk("read_signal_strength %i\n",*strength); return 0; diff --git a/drivers/media/dvb/frontends/or51211.c b/drivers/media/dvb/frontends/or51211.c index 8a9db23dd1b7..531f76246e5f 100644 --- a/drivers/media/dvb/frontends/or51211.c +++ b/drivers/media/dvb/frontends/or51211.c @@ -339,6 +339,7 @@ static int or51211_read_signal_strength(struct dvb_frontend* fe, u16* strength) u8 rec_buf[2]; u8 snd_buf[4]; u8 snr_equ; + u32 signal_strength; /* SNR after Equalizer */ snd_buf[0] = 0x04; @@ -358,8 +359,11 @@ static int or51211_read_signal_strength(struct dvb_frontend* fe, u16* strength) snr_equ = rec_buf[0] & 0xff; /* The value reported back from the frontend will be FFFF=100% 0000=0% */ - *strength = (((5334 - i20Log10(snr_equ))/3+5)*65535)/1000; - + signal_strength = (((5334 - i20Log10(snr_equ))/3+5)*65535)/1000; + if (signal_strength > 0xffff) + *strength = 0xffff; + else + *strength = signal_strength; dprintk("read_signal_strength %i\n",*strength); return 0; -- cgit v1.2.2 From 83b75b049be981e579ba2cb88aa9bf3534bbbdb1 Mon Sep 17 00:00:00 2001 From: NooneImportant Date: Tue, 8 Nov 2005 21:35:27 -0800 Subject: [PATCH] dvb: let other frontends support FE_DISHNETWORK_SEND_LEGACY_CMD Add support to FE_DISHNETWORK_SEND_LEGACY_CMD code to support other frontends besides stv0299. The generic code is a fallback in the case that it doesn't work for some specific frontends (again stv0299 being a good example). Signed-off-by: NooneImportant Signed-off-by: Johannes Stezenbach Signed-off-by: Michael Krufky Cc: Johannes Stezenbach Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/dvb/dvb-core/dvb_frontend.c | 97 +++++++++++++++++++++++++++++++ drivers/media/dvb/dvb-core/dvb_frontend.h | 3 + drivers/media/dvb/frontends/stv0299.c | 38 ++---------- 3 files changed, 104 insertions(+), 34 deletions(-) diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c index a8bc84240b50..e36dbd9c4cc5 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c @@ -577,6 +577,49 @@ static void dvb_frontend_stop(struct dvb_frontend *fe) fepriv->thread_pid); } +s32 timeval_usec_diff(struct timeval lasttime, struct timeval curtime) +{ + return ((curtime.tv_usec < lasttime.tv_usec) ? + 1000000 - lasttime.tv_usec + curtime.tv_usec : + curtime.tv_usec - lasttime.tv_usec); +} +EXPORT_SYMBOL(timeval_usec_diff); + +static inline void timeval_usec_add(struct timeval *curtime, u32 add_usec) +{ + curtime->tv_usec += add_usec; + if (curtime->tv_usec >= 1000000) { + curtime->tv_usec -= 1000000; + curtime->tv_sec++; + } +} + +/* + * Sleep until gettimeofday() > waketime + add_usec + * This needs to be as precise as possible, but as the delay is + * usually between 2ms and 32ms, it is done using a scheduled msleep + * followed by usleep (normally a busy-wait loop) for the remainder + */ +void dvb_frontend_sleep_until(struct timeval *waketime, u32 add_usec) +{ + struct timeval lasttime; + s32 delta, newdelta; + + timeval_usec_add(waketime, add_usec); + + do_gettimeofday(&lasttime); + delta = timeval_usec_diff(lasttime, *waketime); + if (delta > 2500) { + msleep((delta - 1500) / 1000); + do_gettimeofday(&lasttime); + newdelta = timeval_usec_diff(lasttime, *waketime); + delta = (newdelta > delta) ? 0 : newdelta; + } + if (delta > 0) + udelay(delta); +} +EXPORT_SYMBOL(dvb_frontend_sleep_until); + static int dvb_frontend_start(struct dvb_frontend *fe) { int ret; @@ -728,6 +771,60 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file, err = fe->ops->dishnetwork_send_legacy_command(fe, (unsigned int) parg); fepriv->state = FESTATE_DISEQC; fepriv->status = 0; + } else if (fe->ops->set_voltage) { + /* + * NOTE: This is a fallback condition. Some frontends + * (stv0299 for instance) take longer than 8msec to + * respond to a set_voltage command. Those switches + * need custom routines to switch properly. For all + * other frontends, the following shoule work ok. + * Dish network legacy switches (as used by Dish500) + * are controlled by sending 9-bit command words + * spaced 8msec apart. + * the actual command word is switch/port dependant + * so it is up to the userspace application to send + * the right command. + * The command must always start with a '0' after + * initialization, so parg is 8 bits and does not + * include the initialization or start bit + */ + unsigned int cmd = ((unsigned int) parg) << 1; + struct timeval nexttime; + struct timeval tv[10]; + int i; + u8 last = 1; + if (dvb_frontend_debug) + printk("%s switch command: 0x%04x\n", __FUNCTION__, cmd); + do_gettimeofday(&nexttime); + if (dvb_frontend_debug) + memcpy(&tv[0], &nexttime, sizeof(struct timeval)); + /* before sending a command, initialize by sending + * a 32ms 18V to the switch + */ + fe->ops->set_voltage(fe, SEC_VOLTAGE_18); + dvb_frontend_sleep_until(&nexttime, 32000); + + for (i = 0; i < 9; i++) { + if (dvb_frontend_debug) + do_gettimeofday(&tv[i + 1]); + if ((cmd & 0x01) != last) { + /* set voltage to (last ? 13V : 18V) */ + fe->ops->set_voltage(fe, (last) ? SEC_VOLTAGE_13 : SEC_VOLTAGE_18); + last = (last) ? 0 : 1; + } + cmd = cmd >> 1; + if (i != 8) + dvb_frontend_sleep_until(&nexttime, 8000); + } + if (dvb_frontend_debug) { + printk("%s(%d): switch delay (should be 32k followed by all 8k\n", + __FUNCTION__, fe->dvb->num); + for (i = 1; i < 10; i++) + printk("%d: %d\n", i, timeval_usec_diff(tv[i-1] , tv[i])); + } + err = 0; + fepriv->state = FESTATE_DISEQC; + fepriv->status = 0; } break; diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.h b/drivers/media/dvb/dvb-core/dvb_frontend.h index 9c2c1d1136bd..348c9b0b988a 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.h +++ b/drivers/media/dvb/dvb-core/dvb_frontend.h @@ -101,4 +101,7 @@ extern int dvb_register_frontend(struct dvb_adapter* dvb, extern int dvb_unregister_frontend(struct dvb_frontend* fe); +extern void dvb_frontend_sleep_until(struct timeval *waketime, u32 add_usec); +extern s32 timeval_usec_diff(struct timeval lasttime, struct timeval curtime); + #endif diff --git a/drivers/media/dvb/frontends/stv0299.c b/drivers/media/dvb/frontends/stv0299.c index b1876618a37d..ae00d7a40d7c 100644 --- a/drivers/media/dvb/frontends/stv0299.c +++ b/drivers/media/dvb/frontends/stv0299.c @@ -387,36 +387,6 @@ static int stv0299_set_voltage (struct dvb_frontend* fe, fe_sec_voltage_t voltag }; } -static inline s32 stv0299_calc_usec_delay (struct timeval lasttime, struct timeval curtime) -{ - return ((curtime.tv_usec < lasttime.tv_usec) ? - 1000000 - lasttime.tv_usec + curtime.tv_usec : - curtime.tv_usec - lasttime.tv_usec); -} - -static void stv0299_sleep_until (struct timeval *waketime, u32 add_usec) -{ - struct timeval lasttime; - s32 delta, newdelta; - - waketime->tv_usec += add_usec; - if (waketime->tv_usec >= 1000000) { - waketime->tv_usec -= 1000000; - waketime->tv_sec++; - } - - do_gettimeofday (&lasttime); - delta = stv0299_calc_usec_delay (lasttime, *waketime); - if (delta > 2500) { - msleep ((delta - 1500) / 1000); - do_gettimeofday (&lasttime); - newdelta = stv0299_calc_usec_delay (lasttime, *waketime); - delta = (newdelta > delta) ? 0 : newdelta; - } - if (delta > 0) - udelay (delta); -} - static int stv0299_send_legacy_dish_cmd (struct dvb_frontend* fe, u32 cmd) { struct stv0299_state* state = fe->demodulator_priv; @@ -444,7 +414,7 @@ static int stv0299_send_legacy_dish_cmd (struct dvb_frontend* fe, u32 cmd) memcpy (&tv[0], &nexttime, sizeof (struct timeval)); stv0299_writeregI (state, 0x0c, reg0x0c | 0x50); /* set LNB to 18V */ - stv0299_sleep_until (&nexttime, 32000); + dvb_frontend_sleep_until(&nexttime, 32000); for (i=0; i<9; i++) { if (debug_legacy_dish_switch) @@ -458,13 +428,13 @@ static int stv0299_send_legacy_dish_cmd (struct dvb_frontend* fe, u32 cmd) cmd = cmd >> 1; if (i != 8) - stv0299_sleep_until (&nexttime, 8000); + dvb_frontend_sleep_until(&nexttime, 8000); } if (debug_legacy_dish_switch) { printk ("%s(%d): switch delay (should be 32k followed by all 8k\n", __FUNCTION__, fe->dvb->num); - for (i=1; i < 10; i++) - printk ("%d: %d\n", i, stv0299_calc_usec_delay (tv[i-1] , tv[i])); + for (i = 1; i < 10; i++) + printk ("%d: %d\n", i, timeval_usec_diff(tv[i-1] , tv[i])); } return 0; -- cgit v1.2.2 From 3528cc4e731b098b5743f8f91516e2e6c01dd1ce Mon Sep 17 00:00:00 2001 From: Andrew de Quincy Date: Tue, 8 Nov 2005 21:35:28 -0800 Subject: [PATCH] dvb: Remove broken stv0299 enhanced tuning code Remove broken stv0299 enhanced tuning code Signed-off-by: Michael Krufky Cc: Johannes Stezenbach Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/dvb/b2c2/flexcop-fe-tuner.c | 1 - drivers/media/dvb/frontends/stv0299.c | 53 +++++------------------ drivers/media/dvb/frontends/stv0299.h | 3 -- drivers/media/dvb/ttpci/av7110.c | 2 - drivers/media/dvb/ttpci/budget-av.c | 2 - drivers/media/dvb/ttpci/budget-ci.c | 2 - drivers/media/dvb/ttpci/budget-patch.c | 1 - drivers/media/dvb/ttpci/budget.c | 2 - drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c | 1 - 9 files changed, 10 insertions(+), 57 deletions(-) diff --git a/drivers/media/dvb/b2c2/flexcop-fe-tuner.c b/drivers/media/dvb/b2c2/flexcop-fe-tuner.c index 47e28b0ee951..bf5651b98bbb 100644 --- a/drivers/media/dvb/b2c2/flexcop-fe-tuner.c +++ b/drivers/media/dvb/b2c2/flexcop-fe-tuner.c @@ -234,7 +234,6 @@ static struct stv0299_config samsung_tbmu24112_config = { .inittab = samsung_tbmu24112_inittab, .mclk = 88000000UL, .invert = 0, - .enhanced_tuning = 0, .skip_reinit = 0, .lock_output = STV0229_LOCKOUTPUT_LK, .volt13_op0_op1 = STV0299_VOLT13_OP1, diff --git a/drivers/media/dvb/frontends/stv0299.c b/drivers/media/dvb/frontends/stv0299.c index ae00d7a40d7c..35dc8439be1b 100644 --- a/drivers/media/dvb/frontends/stv0299.c +++ b/drivers/media/dvb/frontends/stv0299.c @@ -553,49 +553,16 @@ static int stv0299_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par if (state->config->invert) invval = (~invval) & 1; stv0299_writeregI(state, 0x0c, (stv0299_readreg(state, 0x0c) & 0xfe) | invval); - if (state->config->enhanced_tuning) { - /* check if we should do a finetune */ - int frequency_delta = p->frequency - state->tuner_frequency; - int minmax = p->u.qpsk.symbol_rate / 2000; - if (minmax < 5000) minmax = 5000; - - if ((frequency_delta > -minmax) && (frequency_delta < minmax) && (frequency_delta != 0) && - (state->fec_inner == p->u.qpsk.fec_inner) && - (state->symbol_rate == p->u.qpsk.symbol_rate)) { - int Drot_freq = (frequency_delta << 16) / (state->config->mclk / 1000); - - // zap the derotator registers first - stv0299_writeregI(state, 0x22, 0x00); - stv0299_writeregI(state, 0x23, 0x00); - - // now set them as we want - stv0299_writeregI(state, 0x22, Drot_freq >> 8); - stv0299_writeregI(state, 0x23, Drot_freq); - } else { - /* A "normal" tune is requested */ - stv0299_writeregI(state, 0x05, 0xb5); /* enable i2c repeater on stv0299 */ - state->config->pll_set(fe, state->i2c, p); - stv0299_writeregI(state, 0x05, 0x35); /* disable i2c repeater on stv0299 */ - - stv0299_writeregI(state, 0x32, 0x80); - stv0299_writeregI(state, 0x22, 0x00); - stv0299_writeregI(state, 0x23, 0x00); - stv0299_writeregI(state, 0x32, 0x19); - stv0299_set_symbolrate (fe, p->u.qpsk.symbol_rate); - stv0299_set_FEC (state, p->u.qpsk.fec_inner); - } - } else { - stv0299_writeregI(state, 0x05, 0xb5); /* enable i2c repeater on stv0299 */ - state->config->pll_set(fe, state->i2c, p); - stv0299_writeregI(state, 0x05, 0x35); /* disable i2c repeater on stv0299 */ - - stv0299_set_FEC (state, p->u.qpsk.fec_inner); - stv0299_set_symbolrate (fe, p->u.qpsk.symbol_rate); - stv0299_writeregI(state, 0x22, 0x00); - stv0299_writeregI(state, 0x23, 0x00); - stv0299_readreg (state, 0x23); - stv0299_writeregI(state, 0x12, 0xb9); - } + stv0299_writeregI(state, 0x05, 0xb5); /* enable i2c repeater on stv0299 */ + state->config->pll_set(fe, state->i2c, p); + stv0299_writeregI(state, 0x05, 0x35); /* disable i2c repeater on stv0299 */ + + stv0299_set_FEC (state, p->u.qpsk.fec_inner); + stv0299_set_symbolrate (fe, p->u.qpsk.symbol_rate); + stv0299_writeregI(state, 0x22, 0x00); + stv0299_writeregI(state, 0x23, 0x00); + stv0299_readreg (state, 0x23); + stv0299_writeregI(state, 0x12, 0xb9); state->tuner_frequency = p->frequency; state->fec_inner = p->u.qpsk.fec_inner; diff --git a/drivers/media/dvb/frontends/stv0299.h b/drivers/media/dvb/frontends/stv0299.h index d0c4484861e1..9af3d71c89db 100644 --- a/drivers/media/dvb/frontends/stv0299.h +++ b/drivers/media/dvb/frontends/stv0299.h @@ -73,9 +73,6 @@ struct stv0299_config /* does the inversion require inversion? */ u8 invert:1; - /* Should the enhanced tuning code be used? */ - u8 enhanced_tuning:1; - /* Skip reinitialisation? */ u8 skip_reinit:1; diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c index 22b203f8ff27..820eea294326 100644 --- a/drivers/media/dvb/ttpci/av7110.c +++ b/drivers/media/dvb/ttpci/av7110.c @@ -1644,7 +1644,6 @@ static struct stv0299_config alps_bsru6_config = { .inittab = alps_bsru6_inittab, .mclk = 88000000UL, .invert = 1, - .enhanced_tuning = 0, .skip_reinit = 0, .lock_output = STV0229_LOCKOUTPUT_1, .volt13_op0_op1 = STV0299_VOLT13_OP1, @@ -1721,7 +1720,6 @@ static struct stv0299_config alps_bsbe1_config = { .inittab = alps_bsbe1_inittab, .mclk = 88000000UL, .invert = 1, - .enhanced_tuning = 0, .skip_reinit = 0, .min_delay_ms = 100, .set_symbol_rate = alps_bsru6_set_symbol_rate, diff --git a/drivers/media/dvb/ttpci/budget-av.c b/drivers/media/dvb/ttpci/budget-av.c index 7692cd23f839..ac108102b67a 100644 --- a/drivers/media/dvb/ttpci/budget-av.c +++ b/drivers/media/dvb/ttpci/budget-av.c @@ -531,7 +531,6 @@ static struct stv0299_config typhoon_config = { .inittab = typhoon_cinergy1200s_inittab, .mclk = 88000000UL, .invert = 0, - .enhanced_tuning = 0, .skip_reinit = 0, .lock_output = STV0229_LOCKOUTPUT_1, .volt13_op0_op1 = STV0299_VOLT13_OP0, @@ -546,7 +545,6 @@ static struct stv0299_config cinergy_1200s_config = { .inittab = typhoon_cinergy1200s_inittab, .mclk = 88000000UL, .invert = 0, - .enhanced_tuning = 0, .skip_reinit = 0, .lock_output = STV0229_LOCKOUTPUT_0, .volt13_op0_op1 = STV0299_VOLT13_OP0, diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c index 51c30ba68140..9263ed686fdc 100644 --- a/drivers/media/dvb/ttpci/budget-ci.c +++ b/drivers/media/dvb/ttpci/budget-ci.c @@ -580,7 +580,6 @@ static struct stv0299_config alps_bsru6_config = { .inittab = alps_bsru6_inittab, .mclk = 88000000UL, .invert = 1, - .enhanced_tuning = 0, .skip_reinit = 0, .lock_output = STV0229_LOCKOUTPUT_1, .volt13_op0_op1 = STV0299_VOLT13_OP1, @@ -710,7 +709,6 @@ static struct stv0299_config philips_su1278_tt_config = { .inittab = philips_su1278_tt_inittab, .mclk = 64000000UL, .invert = 0, - .enhanced_tuning = 1, .skip_reinit = 1, .lock_output = STV0229_LOCKOUTPUT_1, .volt13_op0_op1 = STV0299_VOLT13_OP1, diff --git a/drivers/media/dvb/ttpci/budget-patch.c b/drivers/media/dvb/ttpci/budget-patch.c index b1f21ef0e3b3..8ee4ac5b536b 100644 --- a/drivers/media/dvb/ttpci/budget-patch.c +++ b/drivers/media/dvb/ttpci/budget-patch.c @@ -379,7 +379,6 @@ static struct stv0299_config alps_bsru6_config = { .inittab = alps_bsru6_inittab, .mclk = 88000000UL, .invert = 1, - .enhanced_tuning = 0, .skip_reinit = 0, .lock_output = STV0229_LOCKOUTPUT_1, .volt13_op0_op1 = STV0299_VOLT13_OP1, diff --git a/drivers/media/dvb/ttpci/budget.c b/drivers/media/dvb/ttpci/budget.c index 0f6ead848e4d..ba308349ac9e 100644 --- a/drivers/media/dvb/ttpci/budget.c +++ b/drivers/media/dvb/ttpci/budget.c @@ -360,7 +360,6 @@ static struct stv0299_config alps_bsru6_config = { .inittab = alps_bsru6_inittab, .mclk = 88000000UL, .invert = 1, - .enhanced_tuning = 0, .skip_reinit = 0, .lock_output = STV0229_LOCKOUTPUT_1, .volt13_op0_op1 = STV0299_VOLT13_OP1, @@ -436,7 +435,6 @@ static struct stv0299_config alps_bsbe1_config = { .inittab = alps_bsbe1_inittab, .mclk = 88000000UL, .invert = 1, - .enhanced_tuning = 0, .skip_reinit = 0, .min_delay_ms = 100, .set_symbol_rate = alps_bsru6_set_symbol_rate, diff --git a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c index d200ab0ad9e7..2d519982eadc 100644 --- a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c +++ b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c @@ -1335,7 +1335,6 @@ static struct stv0299_config alps_stv0299_config = { .inittab = alps_bsru6_inittab, .mclk = 88000000UL, .invert = 1, - .enhanced_tuning = 0, .skip_reinit = 0, .lock_output = STV0229_LOCKOUTPUT_1, .volt13_op0_op1 = STV0299_VOLT13_OP1, -- cgit v1.2.2 From f7b67195ea571b8540ac79daf27f5932ec40c098 Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Tue, 8 Nov 2005 21:35:29 -0800 Subject: [PATCH] dvb: Remove DEBUG_LOCKLOSS stuff Remove DEBUG_LOCKLOSS stuff - as the problem has been found and resolved Signed-off-by: Andrew de Quincey Signed-off-by: Michael Krufky Cc: Johannes Stezenbach Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/dvb/dvb-core/dvb_frontend.c | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c index e36dbd9c4cc5..6ffa6b216363 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c @@ -42,8 +42,6 @@ #include "dvb_frontend.h" #include "dvbdev.h" -// #define DEBUG_LOCKLOSS 1 - static int dvb_frontend_debug; static int dvb_shutdown_timeout = 5; static int dvb_force_auto_inversion; @@ -438,25 +436,6 @@ static int dvb_frontend_thread(void *data) if (s & FE_HAS_LOCK) continue; else { /* if we _WERE_ tuned, but now don't have a lock */ -#ifdef DEBUG_LOCKLOSS - /* first of all try setting the tone again if it was on - this - * sometimes works around problems with noisy power supplies */ - if (fe->ops->set_tone && (fepriv->tone == SEC_TONE_ON)) { - fe->ops->set_tone(fe, fepriv->tone); - mdelay(100); - s = 0; - fe->ops->read_status(fe, &s); - if (s & FE_HAS_LOCK) { - printk("DVB%i: Lock was lost, but regained by setting " - "the tone. This may indicate your power supply " - "is noisy/slightly incompatable with this DVB-S " - "adapter\n", fe->dvb->num); - fepriv->state = FESTATE_TUNED; - continue; - } - } -#endif - /* some other reason for losing the lock - start zigzagging */ fepriv->state = FESTATE_ZIGZAG_FAST; fepriv->started_auto_step = fepriv->auto_step; check_wrapped = 0; -- cgit v1.2.2 From c0b11b914de27e0e82b5311cf9b498a1b008b591 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 8 Nov 2005 21:35:32 -0800 Subject: [PATCH] dvb: Add support for Air2PC/AirStar 2 ATSC 3rd generation (HD5000) Added support for Air2PC/AirStar 2 ATSC 3rd generation (HD5000) Signed-off-by: Taylor Jacob Signed-off-by: Michael Krufky Cc: Johannes Stezenbach Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/dvb/b2c2/flexcop-fe-tuner.c | 53 +++++++++++++++++++++++++++++++ drivers/media/dvb/b2c2/flexcop-misc.c | 1 + drivers/media/dvb/b2c2/flexcop-reg.h | 1 + drivers/media/dvb/b2c2/flexcop.c | 1 + drivers/media/dvb/frontends/dvb-pll.c | 2 +- drivers/media/dvb/frontends/lgdt330x.c | 15 +++++++-- drivers/media/dvb/frontends/lgdt330x.h | 4 +++ 7 files changed, 74 insertions(+), 3 deletions(-) diff --git a/drivers/media/dvb/b2c2/flexcop-fe-tuner.c b/drivers/media/dvb/b2c2/flexcop-fe-tuner.c index bf5651b98bbb..a35330315f65 100644 --- a/drivers/media/dvb/b2c2/flexcop-fe-tuner.c +++ b/drivers/media/dvb/b2c2/flexcop-fe-tuner.c @@ -13,6 +13,8 @@ #include "bcm3510.h" #include "stv0297.h" #include "mt312.h" +#include "lgdt330x.h" +#include "dvb-pll.h" /* lnb control */ @@ -295,6 +297,52 @@ static int flexcop_fe_request_firmware(struct dvb_frontend* fe, const struct fir return request_firmware(fw, name, fc->dev); } +static int lgdt3303_pll_set(struct dvb_frontend* fe, + struct dvb_frontend_parameters* params) +{ + struct flexcop_device *fc = fe->dvb->priv; + u8 buf[4]; + struct i2c_msg msg = + { .addr = 0x61, .flags = 0, .buf = buf, .len = 4 }; + int err; + + dvb_pll_configure(&dvb_pll_tdvs_tua6034,buf, params->frequency, 0); + dprintk(1, "%s: tuner at 0x%02x bytes: 0x%02x 0x%02x 0x%02x 0x%02x\n", + __FUNCTION__, msg.addr, buf[0],buf[1],buf[2],buf[3]); + if ((err = i2c_transfer(&fc->i2c_adap, &msg, 1)) != 1) { + printk(KERN_WARNING "lgdt3303: %s error " + "(addr %02x <- %02x, err = %i)\n", + __FUNCTION__, buf[0], buf[1], err); + if (err < 0) + return err; + else + return -EREMOTEIO; + } + + buf[0] = 0x86 | 0x18; + buf[1] = 0x50; + msg.len = 2; + if ((err = i2c_transfer(&fc->i2c_adap, &msg, 1)) != 1) { + printk(KERN_WARNING "lgdt3303: %s error " + "(addr %02x <- %02x, err = %i)\n", + __FUNCTION__, buf[0], buf[1], err); + if (err < 0) + return err; + else + return -EREMOTEIO; + } + + return 0; +} + +static struct lgdt330x_config air2pc_atsc_hd5000_config = { + .demod_address = 0x59, + .demod_chip = LGDT3303, + .serial_mpeg = 0x04, + .pll_set = lgdt3303_pll_set, + .clock_polarity_flip = 1, +}; + static struct nxt2002_config samsung_tbmv_config = { .demod_address = 0x0a, .request_firmware = flexcop_fe_request_firmware, @@ -457,6 +505,11 @@ int flexcop_frontend_init(struct flexcop_device *fc) fc->dev_type = FC_AIR_ATSC2; info("found the nxt2002 at i2c address: 0x%02x",samsung_tbmv_config.demod_address); } else + /* try the air atsc 3nd generation (lgdt3303) */ + if ((fc->fe = lgdt330x_attach(&air2pc_atsc_hd5000_config, &fc->i2c_adap)) != NULL) { + fc->dev_type = FC_AIR_ATSC3; + info("found the lgdt3303 at i2c address: 0x%02x",air2pc_atsc_hd5000_config.demod_address); + } else /* try the air atsc 1nd generation (bcm3510)/panasonic ct10s */ if ((fc->fe = bcm3510_attach(&air2pc_atsc_first_gen_config, &fc->i2c_adap)) != NULL) { fc->dev_type = FC_AIR_ATSC1; diff --git a/drivers/media/dvb/b2c2/flexcop-misc.c b/drivers/media/dvb/b2c2/flexcop-misc.c index 3a08d38b318a..62282d8dbfa8 100644 --- a/drivers/media/dvb/b2c2/flexcop-misc.c +++ b/drivers/media/dvb/b2c2/flexcop-misc.c @@ -51,6 +51,7 @@ const char *flexcop_device_names[] = { "Sky2PC/SkyStar 2 DVB-S", "Sky2PC/SkyStar 2 DVB-S (old version)", "Cable2PC/CableStar 2 DVB-C", + "Air2PC/AirStar 2 ATSC 3rd generation (HD5000)", }; const char *flexcop_bus_names[] = { diff --git a/drivers/media/dvb/b2c2/flexcop-reg.h b/drivers/media/dvb/b2c2/flexcop-reg.h index 4ae1eb5bfe98..23cc6431e2b8 100644 --- a/drivers/media/dvb/b2c2/flexcop-reg.h +++ b/drivers/media/dvb/b2c2/flexcop-reg.h @@ -26,6 +26,7 @@ typedef enum { FC_SKY, FC_SKY_OLD, FC_CABLE, + FC_AIR_ATSC3, } flexcop_device_type_t; typedef enum { diff --git a/drivers/media/dvb/b2c2/flexcop.c b/drivers/media/dvb/b2c2/flexcop.c index 12873d435406..123ed96f6faa 100644 --- a/drivers/media/dvb/b2c2/flexcop.c +++ b/drivers/media/dvb/b2c2/flexcop.c @@ -193,6 +193,7 @@ static void flexcop_reset(struct flexcop_device *fc) v204 = fc->read_ibi_reg(fc,misc_204); v204.misc_204.Per_reset_sig = 0; fc->write_ibi_reg(fc,misc_204,v204); + msleep(1); v204.misc_204.Per_reset_sig = 1; fc->write_ibi_reg(fc,misc_204,v204); } diff --git a/drivers/media/dvb/frontends/dvb-pll.c b/drivers/media/dvb/frontends/dvb-pll.c index 536c35d969b7..6668839f9474 100644 --- a/drivers/media/dvb/frontends/dvb-pll.c +++ b/drivers/media/dvb/frontends/dvb-pll.c @@ -226,7 +226,7 @@ struct dvb_pll_desc dvb_pll_tua6034 = { EXPORT_SYMBOL(dvb_pll_tua6034); /* Infineon TUA6034 - * used in LG Innotek TDVS-H062F + * used in LG TDVS H061F and LG TDVS H062F */ struct dvb_pll_desc dvb_pll_tdvs_tua6034 = { .name = "LG/Infineon TUA6034", diff --git a/drivers/media/dvb/frontends/lgdt330x.c b/drivers/media/dvb/frontends/lgdt330x.c index 145918877d2f..10fc4e7878af 100644 --- a/drivers/media/dvb/frontends/lgdt330x.c +++ b/drivers/media/dvb/frontends/lgdt330x.c @@ -27,6 +27,7 @@ * DViCO FusionHDTV 3 Gold-T * DViCO FusionHDTV 5 Gold * DViCO FusionHDTV 5 Lite + * Air2PC/AirStar 2 ATSC 3rd generation (HD5000) * * TODO: * signal strength always returns 0. @@ -223,6 +224,11 @@ static int lgdt330x_init(struct dvb_frontend* fe) 0x4c, 0x14 }; + static u8 flip_lgdt3303_init_data[] = { + 0x4c, 0x14, + 0x87, 0xf3 + }; + struct lgdt330x_state* state = fe->demodulator_priv; char *chip_name; int err; @@ -235,8 +241,13 @@ static int lgdt330x_init(struct dvb_frontend* fe) break; case LGDT3303: chip_name = "LGDT3303"; - err = i2c_write_demod_bytes(state, lgdt3303_init_data, - sizeof(lgdt3303_init_data)); + if (state->config->clock_polarity_flip) { + err = i2c_write_demod_bytes(state, flip_lgdt3303_init_data, + sizeof(flip_lgdt3303_init_data)); + } else { + err = i2c_write_demod_bytes(state, lgdt3303_init_data, + sizeof(lgdt3303_init_data)); + } break; default: chip_name = "undefined"; diff --git a/drivers/media/dvb/frontends/lgdt330x.h b/drivers/media/dvb/frontends/lgdt330x.h index e209ba1e47c5..2a6529cccf1a 100644 --- a/drivers/media/dvb/frontends/lgdt330x.h +++ b/drivers/media/dvb/frontends/lgdt330x.h @@ -47,6 +47,10 @@ struct lgdt330x_config /* Need to set device param for start_dma */ int (*set_ts_params)(struct dvb_frontend* fe, int is_punctured); + + /* Flip the polarity of the mpeg data transfer clock using alternate init data + * This option applies ONLY to LGDT3303 - 0:disabled (default) 1:enabled */ + int clock_polarity_flip; }; extern struct dvb_frontend* lgdt330x_attach(const struct lgdt330x_config* config, -- cgit v1.2.2 From 28fdd7599cb9c6c620caf13bcaea41e2532cb5fd Mon Sep 17 00:00:00 2001 From: Manu Abraham Date: Tue, 8 Nov 2005 21:35:33 -0800 Subject: [PATCH] dvb: Updated Documentation Updated Documentation Signed-off-by: Manu Abraham Signed-off-by: Michael Krufky Cc: Johannes Stezenbach Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/dvb/bt8xx.txt | 43 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/Documentation/dvb/bt8xx.txt b/Documentation/dvb/bt8xx.txt index cb63b7a93c82..ac3af17f2b6f 100644 --- a/Documentation/dvb/bt8xx.txt +++ b/Documentation/dvb/bt8xx.txt @@ -33,20 +33,23 @@ TwinHan (dst) are loaded automatically by the dvb-bt8xx device driver. -------------------------- $ modprobe bttv (normally bttv is being loaded automatically by kmod) - $ modprobe dvb-bt8xx (or just place dvb-bt8xx in /etc/modules for automatic loading) + $ modprobe dvb-bt8xx + +(or just place dvb-bt8xx in /etc/modules for automatic loading) 3b) TwinHan and Clones -------------------------- - $ modprobe bttv i2c_hw=1 card=0x71 + $ modprobe bttv card=0x71 $ modprobe dvb-bt8xx $ modprobe dst The value 0x71 will override the PCI type detection for dvb-bt8xx, -which is necessary for TwinHan cards. +which is necessary for TwinHan cards. Omission of this parameter might result +in a system lockup. -If you're having an older card (blue color circuit) and card=0x71 locks +If you're having an older card (blue color PCB) and card=0x71 locks up your machine, try using 0x68, too. If that does not work, ask on the mailing list. @@ -69,6 +72,38 @@ string' which you can see in your logs e.g. dst_get_device_id: Recognise [DSTMCI] +If you need to sent in bug reports on the dst, please do send in a complete +log with the verbose=4 module parameter. For general usage, the default setting +of verbose=1 is ideal. + + +4) Multiple cards +-------------------------- + +If you happen to be running multiple cards, it would be advisable to load +the bttv module with the card id. This would help to solve any module loading +problems that you might face. + +for example, if you happen to have a Twinhan and clones alongwith a FusionHDTV5 +card + + $ modprobe bttv card=0x71 card=0x87 + +Here the order of the card id is important and should be the same as that of the +physical order of the cards. Here card=0x71 represents the Twinhan and clones +and card=0x87 represents Fusion HDTV5. + +Some examples of card-id's + +Pinnacle Sat 0x5e +Nebula Digi TV 0x68 +PC HDTV 0x70 +Twinhan 0x71 +Fusion HDTV5 0x87 + +For a full list of card-id's, you can see the exported card-id's from +bttv-cards.c in linux-2.6.x/drivers/media/video/bttv.h +If you have problems with this please do ask on the mailing list. -- Authors: Richard Walker, Jamie Honan, Michael Hunold, Manu Abraham -- cgit v1.2.2 From 2cbeddc976645262dbe036d6ec0825f96af70da3 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 8 Nov 2005 21:35:35 -0800 Subject: [PATCH] dvb: Updated documentation for FusionHDTV Lite cards - Updated documentation for FusionHDTV Lite cards. We must differentiate the bt8xx based "Lite" cards from the cx2388x based "Gold" cards. - Provide location of CARDLIST.bttv Documentation, rather than instructing users to look at bttv.h - Include card decimal id numbers. These are valid for module arguments, and might be easier for some people to remember, rather than hex. Signed-off-by: Michael Krufky Cc: Johannes Stezenbach Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/dvb/bt8xx.txt | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/Documentation/dvb/bt8xx.txt b/Documentation/dvb/bt8xx.txt index ac3af17f2b6f..df6c05453cb5 100644 --- a/Documentation/dvb/bt8xx.txt +++ b/Documentation/dvb/bt8xx.txt @@ -1,5 +1,5 @@ -How to get the Nebula, PCTV and Twinhan DST cards working -========================================================= +How to get the Nebula, PCTV, FusionHDTV Lite and Twinhan DST cards working +========================================================================== This class of cards has a bt878a as the PCI interface, and require the bttv driver. @@ -26,11 +26,12 @@ Furthermore you need to enable In general you need to load the bttv driver, which will handle the gpio and i2c communication for us, plus the common dvb-bt8xx device driver. -The frontends for Nebula (nxt6000), Pinnacle PCTV (cx24110) and -TwinHan (dst) are loaded automatically by the dvb-bt8xx device driver. +The frontends for Nebula (nxt6000), Pinnacle PCTV (cx24110), TwinHan (dst), +FusionHDTV DVB-T Lite (mt352) and FusionHDTV5 Lite (lgdt330x) are loaded +automatically by the dvb-bt8xx device driver. -3a) Nebula / Pinnacle PCTV --------------------------- +3a) Nebula / Pinnacle PCTV / FusionHDTV Lite +--------------------------------------------- $ modprobe bttv (normally bttv is being loaded automatically by kmod) $ modprobe dvb-bt8xx @@ -67,8 +68,8 @@ verbose=0 means complete disabling of messages dst_addons takes values 0 and 0x20. A value of 0 means it is a FTA card. 0x20 means it has a Conditional Access slot. -The autodected values are determined bythe cards 'response -string' which you can see in your logs e.g. +The autodetected values are determined by the cards 'response string' +which you can see in your logs e.g. dst_get_device_id: Recognise [DSTMCI] @@ -84,25 +85,29 @@ If you happen to be running multiple cards, it would be advisable to load the bttv module with the card id. This would help to solve any module loading problems that you might face. -for example, if you happen to have a Twinhan and clones alongwith a FusionHDTV5 -card +For example, if you have a Twinhan and Clones card along with a FusionHDTV5 Lite $ modprobe bttv card=0x71 card=0x87 Here the order of the card id is important and should be the same as that of the physical order of the cards. Here card=0x71 represents the Twinhan and clones -and card=0x87 represents Fusion HDTV5. +and card=0x87 represents Fusion HDTV5 Lite. These arguments can also be +specified in decimal, rather than hex: + + $ modprobe bttv card=113 card=135 Some examples of card-id's -Pinnacle Sat 0x5e -Nebula Digi TV 0x68 -PC HDTV 0x70 -Twinhan 0x71 -Fusion HDTV5 0x87 +Pinnacle Sat 0x5e (94) +Nebula Digi TV 0x68 (104) +PC HDTV 0x70 (112) +Twinhan 0x71 (113) +FusionHDTV DVB-T Lite 0x80 (128) +FusionHDTV5 Lite 0x87 (135) + +For a full list of card-id's, see the V4L Documentation within the kernel +source: linux/Documentation/video4linux/CARDLIST.bttv -For a full list of card-id's, you can see the exported card-id's from -bttv-cards.c in linux-2.6.x/drivers/media/video/bttv.h If you have problems with this please do ask on the mailing list. -- -- cgit v1.2.2 From d28d57629ffcd30e11a6085e15ee1327fea60b60 Mon Sep 17 00:00:00 2001 From: Manu Abraham Date: Tue, 8 Nov 2005 21:35:36 -0800 Subject: [PATCH] dvb: dst: protect the read/write commands with a mutex We need to protect the read/write commands with a mutex. Bug reported by Henrik Sjoberg Signed-off-by: Manu Abraham Signed-off-by: Michael Krufky Cc: Johannes Stezenbach Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/dvb/bt8xx/dst.c | 34 +++++++++++++++++++++------------- drivers/media/dvb/bt8xx/dst_ca.c | 17 +++++++++++------ drivers/media/dvb/bt8xx/dst_common.h | 3 +++ 3 files changed, 35 insertions(+), 19 deletions(-) diff --git a/drivers/media/dvb/bt8xx/dst.c b/drivers/media/dvb/bt8xx/dst.c index bc833a55438f..0c718dca09ca 100644 --- a/drivers/media/dvb/bt8xx/dst.c +++ b/drivers/media/dvb/bt8xx/dst.c @@ -910,6 +910,7 @@ static int dst_get_device_id(struct dst_state *state) static int dst_probe(struct dst_state *state) { + sema_init(&state->dst_mutex, 1); if ((rdc_8820_reset(state)) < 0) { dprintk(verbose, DST_ERROR, 1, "RDC 8820 RESET Failed."); return -1; @@ -960,21 +961,23 @@ static int dst_probe(struct dst_state *state) int dst_command(struct dst_state *state, u8 *data, u8 len) { u8 reply; + + down(&state->dst_mutex); if ((dst_comm_init(state)) < 0) { dprintk(verbose, DST_NOTICE, 1, "DST Communication Initialization Failed."); - return -1; + goto error; } if (write_dst(state, data, len)) { dprintk(verbose, DST_INFO, 1, "Tring to recover.. "); if ((dst_error_recovery(state)) < 0) { dprintk(verbose, DST_ERROR, 1, "Recovery Failed."); - return -1; + goto error; } - return -1; + goto error; } if ((dst_pio_disable(state)) < 0) { dprintk(verbose, DST_ERROR, 1, "PIO Disable Failed."); - return -1; + goto error; } if (state->type_flags & DST_TYPE_HAS_FW_1) udelay(3000); @@ -982,36 +985,41 @@ int dst_command(struct dst_state *state, u8 *data, u8 len) dprintk(verbose, DST_DEBUG, 1, "Trying to recover.. "); if ((dst_error_recovery(state)) < 0) { dprintk(verbose, DST_INFO, 1, "Recovery Failed."); - return -1; + goto error; } - return -1; + goto error; } if (reply != ACK) { dprintk(verbose, DST_INFO, 1, "write not acknowledged 0x%02x ", reply); - return -1; + goto error; } if (len >= 2 && data[0] == 0 && (data[1] == 1 || data[1] == 3)) - return 0; + goto error; if (state->type_flags & DST_TYPE_HAS_FW_1) udelay(3000); else udelay(2000); if (!dst_wait_dst_ready(state, NO_DELAY)) - return -1; + goto error; if (read_dst(state, state->rxbuffer, FIXED_COMM)) { dprintk(verbose, DST_DEBUG, 1, "Trying to recover.. "); if ((dst_error_recovery(state)) < 0) { dprintk(verbose, DST_INFO, 1, "Recovery failed."); - return -1; + goto error; } - return -1; + goto error; } if (state->rxbuffer[7] != dst_check_sum(state->rxbuffer, 7)) { dprintk(verbose, DST_INFO, 1, "checksum failure"); - return -1; + goto error; } - + up(&state->dst_mutex); return 0; + +error: + up(&state->dst_mutex); + return -EIO; + } EXPORT_SYMBOL(dst_command); diff --git a/drivers/media/dvb/bt8xx/dst_ca.c b/drivers/media/dvb/bt8xx/dst_ca.c index 38c728945bf1..e6541aff3996 100644 --- a/drivers/media/dvb/bt8xx/dst_ca.c +++ b/drivers/media/dvb/bt8xx/dst_ca.c @@ -81,36 +81,41 @@ static int dst_ci_command(struct dst_state* state, u8 * data, u8 *ca_string, u8 { u8 reply; + down(&state->dst_mutex); dst_comm_init(state); msleep(65); if (write_dst(state, data, len)) { dprintk(verbose, DST_CA_INFO, 1, " Write not successful, trying to recover"); dst_error_recovery(state); - return -1; + goto error; } if ((dst_pio_disable(state)) < 0) { dprintk(verbose, DST_CA_ERROR, 1, " DST PIO disable failed."); - return -1; + goto error; } if (read_dst(state, &reply, GET_ACK) < 0) { dprintk(verbose, DST_CA_INFO, 1, " Read not successful, trying to recover"); dst_error_recovery(state); - return -1; + goto error; } if (read) { if (! dst_wait_dst_ready(state, LONG_DELAY)) { dprintk(verbose, DST_CA_NOTICE, 1, " 8820 not ready"); - return -1; + goto error; } if (read_dst(state, ca_string, 128) < 0) { /* Try to make this dynamic */ dprintk(verbose, DST_CA_INFO, 1, " Read not successful, trying to recover"); dst_error_recovery(state); - return -1; + goto error; } } - + up(&state->dst_mutex); return 0; + +error: + up(&state->dst_mutex); + return -EIO; } diff --git a/drivers/media/dvb/bt8xx/dst_common.h b/drivers/media/dvb/bt8xx/dst_common.h index 29b5430dbe4f..81557f38fe38 100644 --- a/drivers/media/dvb/bt8xx/dst_common.h +++ b/drivers/media/dvb/bt8xx/dst_common.h @@ -22,6 +22,7 @@ #ifndef DST_COMMON_H #define DST_COMMON_H +#include #include #include #include "bt878.h" @@ -119,6 +120,8 @@ struct dst_state { u8 card_info[8]; u8 vendor[8]; u8 board_info[8]; + + struct semaphore dst_mutex; }; struct dst_types { -- cgit v1.2.2 From f1016dec71a4ff3cf49110137c87ab988bd316e6 Mon Sep 17 00:00:00 2001 From: Henrik Sjoberg Date: Tue, 8 Nov 2005 21:35:38 -0800 Subject: [PATCH] dvb: dst: protect dst_write_tuna from simultaneous writes dst_write_tuna needs to be protected against simultaeneous writes, just like dst_command Signed-off-by: Henrik Sjoberg Signed-off-by: Manu Abraham Signed-off-by: Michael Krufky Cc: Johannes Stezenbach Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/dvb/bt8xx/dst.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/drivers/media/dvb/bt8xx/dst.c b/drivers/media/dvb/bt8xx/dst.c index 0c718dca09ca..8977c7a313df 100644 --- a/drivers/media/dvb/bt8xx/dst.c +++ b/drivers/media/dvb/bt8xx/dst.c @@ -1077,7 +1077,7 @@ static int dst_get_tuna(struct dst_state *state) return 0; state->diseq_flags &= ~(HAS_LOCK); if (!dst_wait_dst_ready(state, NO_DELAY)) - return 0; + return -EIO; if (state->type_flags & DST_TYPE_HAS_NEWTUNE) /* how to get variable length reply ???? */ retval = read_dst(state, state->rx_tuna, 10); @@ -1085,22 +1085,21 @@ static int dst_get_tuna(struct dst_state *state) retval = read_dst(state, &state->rx_tuna[2], FIXED_COMM); if (retval < 0) { dprintk(verbose, DST_DEBUG, 1, "read not successful"); - return 0; + return retval; } if (state->type_flags & DST_TYPE_HAS_NEWTUNE) { if (state->rx_tuna[9] != dst_check_sum(&state->rx_tuna[0], 9)) { dprintk(verbose, DST_INFO, 1, "checksum failure ? "); - return 0; + return -EIO; } } else { if (state->rx_tuna[9] != dst_check_sum(&state->rx_tuna[2], 7)) { dprintk(verbose, DST_INFO, 1, "checksum failure? "); - return 0; + return -EIO; } } if (state->rx_tuna[2] == 0 && state->rx_tuna[3] == 0) return 0; - if (state->dst_type == DST_TYPE_IS_SAT) { state->decode_freq = ((state->rx_tuna[2] & 0x7f) << 8) + state->rx_tuna[3]; } else { @@ -1129,10 +1128,10 @@ static int dst_write_tuna(struct dvb_frontend *fe) dst_set_voltage(fe, SEC_VOLTAGE_13); } state->diseq_flags &= ~(HAS_LOCK | ATTEMPT_TUNE); - + down(&state->dst_mutex); if ((dst_comm_init(state)) < 0) { dprintk(verbose, DST_DEBUG, 1, "DST Communication initialization failed."); - return -1; + goto error; } if (state->type_flags & DST_TYPE_HAS_NEWTUNE) { state->tx_tuna[9] = dst_check_sum(&state->tx_tuna[0], 9); @@ -1144,23 +1143,29 @@ static int dst_write_tuna(struct dvb_frontend *fe) if (retval < 0) { dst_pio_disable(state); dprintk(verbose, DST_DEBUG, 1, "write not successful"); - return retval; + goto werr; } if ((dst_pio_disable(state)) < 0) { dprintk(verbose, DST_DEBUG, 1, "DST PIO disable failed !"); - return -1; + goto error; } if ((read_dst(state, &reply, GET_ACK) < 0)) { dprintk(verbose, DST_DEBUG, 1, "read verify not successful."); - return -1; + goto error; } if (reply != ACK) { dprintk(verbose, DST_DEBUG, 1, "write not acknowledged 0x%02x ", reply); - return 0; + goto error; } state->diseq_flags |= ATTEMPT_TUNE; + retval = dst_get_tuna(state); +werr: + up(&state->dst_mutex); + return retval; - return dst_get_tuna(state); +error: + up(&state->dst_mutex); + return -EIO; } /* -- cgit v1.2.2 From 147418c9ca7bdffadafb0122c15b1eae167142f4 Mon Sep 17 00:00:00 2001 From: Kirk Lapray Date: Tue, 8 Nov 2005 21:35:39 -0800 Subject: [PATCH] dvb: add support for plls used by nxt200x - Added support for the following: Philips TUV1236D - ATI HDTV Wonder ALPS TDHU2 - AverTVHD MCE A180 Samsung TBMV30111IN - Air2PC ATSC - 2nd generation These will be used in a new NXT200X driver that incorporates the NXT2002 driver and adds support for a couple NXT2004 based cards. Signed-off-by: Kirk Lapray Signed-off-by: Michael Krufky Cc: Johannes Stezenbach Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/dvb/frontends/dvb-pll.c | 52 +++++++++++++++++++++++++++++++++++ drivers/media/dvb/frontends/dvb-pll.h | 4 +++ 2 files changed, 56 insertions(+) diff --git a/drivers/media/dvb/frontends/dvb-pll.c b/drivers/media/dvb/frontends/dvb-pll.c index 6668839f9474..6ba7433c2aa7 100644 --- a/drivers/media/dvb/frontends/dvb-pll.c +++ b/drivers/media/dvb/frontends/dvb-pll.c @@ -292,6 +292,58 @@ struct dvb_pll_desc dvb_pll_tded4 = { }; EXPORT_SYMBOL(dvb_pll_tded4); +/* ALPS TDHU2 + * used in AverTVHD MCE A180 + */ +struct dvb_pll_desc dvb_pll_tdhu2 = { + .name = "ALPS TDHU2", + .min = 54000000, + .max = 864000000, + .count = 4, + .entries = { + { 162000000, 44000000, 62500, 0x85, 0x01 }, + { 426000000, 44000000, 62500, 0x85, 0x02 }, + { 782000000, 44000000, 62500, 0x85, 0x08 }, + { 999999999, 44000000, 62500, 0x85, 0x88 }, + } +}; +EXPORT_SYMBOL(dvb_pll_tdhu2); + +/* Philips TUV1236D + * used in ATI HDTV Wonder + */ +struct dvb_pll_desc dvb_pll_tuv1236d = { + .name = "Philips TUV1236D", + .min = 57000000, + .max = 864000000, + .count = 3, + .entries = { + { 157250000, 44000000, 62500, 0xc6, 0x41 }, + { 454000000, 44000000, 62500, 0xc6, 0x42 }, + { 999999999, 44000000, 62500, 0xc6, 0x44 }, + }, +}; +EXPORT_SYMBOL(dvb_pll_tuv1236d); + +/* Samsung TBMV30111IN + * used in Air2PC ATSC - 2nd generation (nxt2002) + */ +struct dvb_pll_desc dvb_pll_tbmv30111in = { + .name = "Samsung TBMV30111IN", + .min = 54000000, + .max = 860000000, + .count = 4, + .entries = { + { 172000000, 44000000, 166666, 0xb4, 0x01 }, + { 214000000, 44000000, 166666, 0xb4, 0x02 }, + { 467000000, 44000000, 166666, 0xbc, 0x02 }, + { 721000000, 44000000, 166666, 0xbc, 0x08 }, + { 841000000, 44000000, 166666, 0xf4, 0x08 }, + { 999999999, 44000000, 166666, 0xfc, 0x02 }, + } +}; +EXPORT_SYMBOL(dvb_pll_tbmv30111in); + /* ----------------------------------------------------------- */ /* code */ diff --git a/drivers/media/dvb/frontends/dvb-pll.h b/drivers/media/dvb/frontends/dvb-pll.h index 205b2d1a8852..497d31dcf41e 100644 --- a/drivers/media/dvb/frontends/dvb-pll.h +++ b/drivers/media/dvb/frontends/dvb-pll.h @@ -36,6 +36,10 @@ extern struct dvb_pll_desc dvb_pll_tda665x; extern struct dvb_pll_desc dvb_pll_fmd1216me; extern struct dvb_pll_desc dvb_pll_tded4; +extern struct dvb_pll_desc dvb_pll_tuv1236d; +extern struct dvb_pll_desc dvb_pll_tdhu2; +extern struct dvb_pll_desc dvb_pll_tbmv30111in; + int dvb_pll_configure(struct dvb_pll_desc *desc, u8 *buf, u32 freq, int bandwidth); -- cgit v1.2.2 From 163d8fed1640c9a6c9f54e261ad5c755e373d04e Mon Sep 17 00:00:00 2001 From: Stuart Auchterlonie Date: Tue, 8 Nov 2005 21:35:40 -0800 Subject: [PATCH] dvb: Nebula nxt6000 requires fe reset Nebula nxt6000 requires fe reset. Signed-off-by: Stuart Auchterlonie Signed-off-by: Michael Krufky Cc: Johannes Stezenbach Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/dvb/bt8xx/dvb-bt8xx.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/media/dvb/bt8xx/dvb-bt8xx.c b/drivers/media/dvb/bt8xx/dvb-bt8xx.c index 1c5f1ec85352..05554e3949db 100644 --- a/drivers/media/dvb/bt8xx/dvb-bt8xx.c +++ b/drivers/media/dvb/bt8xx/dvb-bt8xx.c @@ -523,9 +523,7 @@ static void digitv_alps_tded4_reset(struct dvb_bt8xx_card *bt) /* * Reset the frontend, must be called before trying * to initialise the MT352 or mt352_attach - * will fail. - * - * Presumably not required for the NXT6000 frontend. + * will fail. Same goes for the nxt6000 frontend. * */ @@ -632,6 +630,7 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type) */ /* Old Nebula (marked (c)2003 on high profile pci card) has nxt6000 demod */ + digitv_alps_tded4_reset(card); card->fe = nxt6000_attach(&vp3021_alps_tded4_config, card->i2c_adapter); if (card->fe != NULL) { dprintk ("dvb_bt8xx: an nxt6000 was detected on your digitv card\n"); -- cgit v1.2.2 From ff29d06a102b35f9523ab4b6c38c9eb9948d1c80 Mon Sep 17 00:00:00 2001 From: Oliver Endriss Date: Tue, 8 Nov 2005 21:35:43 -0800 Subject: [PATCH] dvb: stv0299: reduce i2c xfer and set register 0x12 from inittab stv0299_set_frontend(): reduced number of i2c transfers, set register 0x12 from inittab Signed-off-by: Oliver Endriss Signed-off-by: Michael Krufky Cc: Johannes Stezenbach Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/dvb/frontends/stv0299.c | 2 -- drivers/media/dvb/ttpci/av7110.c | 4 ++-- drivers/media/dvb/ttpci/budget-av.c | 2 +- drivers/media/dvb/ttpci/budget-ci.c | 2 +- drivers/media/dvb/ttpci/budget-patch.c | 2 +- drivers/media/dvb/ttpci/budget.c | 4 ++-- 6 files changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/media/dvb/frontends/stv0299.c b/drivers/media/dvb/frontends/stv0299.c index 35dc8439be1b..29c48665e130 100644 --- a/drivers/media/dvb/frontends/stv0299.c +++ b/drivers/media/dvb/frontends/stv0299.c @@ -561,8 +561,6 @@ static int stv0299_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par stv0299_set_symbolrate (fe, p->u.qpsk.symbol_rate); stv0299_writeregI(state, 0x22, 0x00); stv0299_writeregI(state, 0x23, 0x00); - stv0299_readreg (state, 0x23); - stv0299_writeregI(state, 0x12, 0xb9); state->tuner_frequency = p->frequency; state->fec_inner = p->u.qpsk.fec_inner; diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c index 820eea294326..87ea52757a21 100644 --- a/drivers/media/dvb/ttpci/av7110.c +++ b/drivers/media/dvb/ttpci/av7110.c @@ -1566,7 +1566,7 @@ static u8 alps_bsru6_inittab[] = { 0x0e, 0x23, /* alpha_tmg = 2, beta_tmg = 3 */ 0x10, 0x3f, // AGC2 0x3d 0x11, 0x84, - 0x12, 0xb5, // Lock detect: -64 Carrier freq detect:on + 0x12, 0xb9, 0x15, 0xc9, // lock detector threshold 0x16, 0x00, 0x17, 0x00, @@ -1668,7 +1668,7 @@ static u8 alps_bsbe1_inittab[] = { 0x0e, 0x23, /* alpha_tmg = 2, beta_tmg = 3 */ 0x10, 0x3f, // AGC2 0x3d 0x11, 0x84, - 0x12, 0xb5, // Lock detect: -64 Carrier freq detect:on + 0x12, 0xb9, 0x15, 0xc9, // lock detector threshold 0x16, 0x00, 0x17, 0x00, diff --git a/drivers/media/dvb/ttpci/budget-av.c b/drivers/media/dvb/ttpci/budget-av.c index ac108102b67a..aa75dc03a0b3 100644 --- a/drivers/media/dvb/ttpci/budget-av.c +++ b/drivers/media/dvb/ttpci/budget-av.c @@ -499,7 +499,7 @@ static u8 typhoon_cinergy1200s_inittab[] = { 0x0e, 0x23, /* alpha_tmg = 2, beta_tmg = 3 */ 0x10, 0x3f, // AGC2 0x3d 0x11, 0x84, - 0x12, 0xb5, // Lock detect: -64 Carrier freq detect:on + 0x12, 0xb9, 0x15, 0xc9, // lock detector threshold 0x16, 0x00, 0x17, 0x00, diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c index 9263ed686fdc..75fb92d60998 100644 --- a/drivers/media/dvb/ttpci/budget-ci.c +++ b/drivers/media/dvb/ttpci/budget-ci.c @@ -490,7 +490,7 @@ static u8 alps_bsru6_inittab[] = { 0x0e, 0x23, /* alpha_tmg = 2, beta_tmg = 3 */ 0x10, 0x3f, // AGC2 0x3d 0x11, 0x84, - 0x12, 0xb5, // Lock detect: -64 Carrier freq detect:on + 0x12, 0xb9, 0x15, 0xc9, // lock detector threshold 0x16, 0x00, 0x17, 0x00, diff --git a/drivers/media/dvb/ttpci/budget-patch.c b/drivers/media/dvb/ttpci/budget-patch.c index 8ee4ac5b536b..755df81cbc49 100644 --- a/drivers/media/dvb/ttpci/budget-patch.c +++ b/drivers/media/dvb/ttpci/budget-patch.c @@ -305,7 +305,7 @@ static u8 alps_bsru6_inittab[] = { 0x0e, 0x23, /* alpha_tmg = 2, beta_tmg = 3 */ 0x10, 0x3f, // AGC2 0x3d 0x11, 0x84, - 0x12, 0xb5, // Lock detect: -64 Carrier freq detect:on + 0x12, 0xb9, 0x15, 0xc9, // lock detector threshold 0x16, 0x00, 0x17, 0x00, diff --git a/drivers/media/dvb/ttpci/budget.c b/drivers/media/dvb/ttpci/budget.c index ba308349ac9e..4fd8bbc47037 100644 --- a/drivers/media/dvb/ttpci/budget.c +++ b/drivers/media/dvb/ttpci/budget.c @@ -286,7 +286,7 @@ static u8 alps_bsru6_inittab[] = { 0x0e, 0x23, /* alpha_tmg = 2, beta_tmg = 3 */ 0x10, 0x3f, // AGC2 0x3d 0x11, 0x84, - 0x12, 0xb5, // Lock detect: -64 Carrier freq detect:on + 0x12, 0xb9, 0x15, 0xc9, // lock detector threshold 0x16, 0x00, 0x17, 0x00, @@ -383,7 +383,7 @@ static u8 alps_bsbe1_inittab[] = { 0x0e, 0x23, /* alpha_tmg = 2, beta_tmg = 3 */ 0x10, 0x3f, // AGC2 0x3d 0x11, 0x84, - 0x12, 0xb5, // Lock detect: -64 Carrier freq detect:on + 0x12, 0xb9, 0x15, 0xc9, // lock detector threshold 0x16, 0x00, 0x17, 0x00, -- cgit v1.2.2 From 7f44dcda3f659ce47c1660a705802f12a2403a90 Mon Sep 17 00:00:00 2001 From: Oliver Endriss Date: Tue, 8 Nov 2005 21:35:44 -0800 Subject: [PATCH] dvb: fixed inittab register 0x12 for BSRU6/BSBE1 fixed inittab register 0x12 for BSRU6/BSBE1 Signed-off-by: Oliver Endriss Signed-off-by: Michael Krufky Cc: Johannes Stezenbach Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c index 2d519982eadc..fd53d6010502 100644 --- a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c +++ b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c @@ -1198,7 +1198,7 @@ static u8 alps_bsbe1_inittab[] = { 0x0e, 0x23, /* alpha_tmg = 2, beta_tmg = 3 */ 0x10, 0x3f, // AGC2 0x3d 0x11, 0x84, - 0x12, 0xb5, // Lock detect: -64 Carrier freq detect:on + 0x12, 0xb9, 0x15, 0xc9, // lock detector threshold 0x16, 0x00, 0x17, 0x00, @@ -1240,7 +1240,7 @@ static u8 alps_bsru6_inittab[] = { 0x0e, 0x23, /* alpha_tmg = 2, beta_tmg = 3 */ 0x10, 0x3f, // AGC2 0x3d 0x11, 0x84, - 0x12, 0xb5, // Lock detect: -64 Carrier freq detect:on + 0x12, 0xb9, 0x15, 0xc9, // lock detector threshold 0x16, 0x00, 0x17, 0x00, -- cgit v1.2.2 From 04a45929e7f00ed4fc7b1d375397f808c8a5d0eb Mon Sep 17 00:00:00 2001 From: Kirk Lapray Date: Tue, 8 Nov 2005 21:35:46 -0800 Subject: [PATCH] dvb: add nxt200x frontend module * nxt200x.c, nxt200x.h - New frontend module that supports both NXT2002 and NXT2004. So far, only tested on NXT2004. After testing on NXT2002, we should deprecate the nxt2002 module, and implement this one instead on the applicable cards. * get_dvb_firmware: - Added support for the NXT2004 firmware. This firmware works with both the ATI HDTV Wonder and the AVerTVHD MCE a180. This was originally written by Jean-Francois Thibert * dvb-pll.c - Fixed minimum frequency for tuv1236d. It seems that the data sheets are wrong. Signed-off-by: Kirk Lapray Signed-off-by: Michael Krufky Cc: Johannes Stezenbach Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/dvb/get_dvb_firmware | 19 +- drivers/media/dvb/frontends/Kconfig | 8 + drivers/media/dvb/frontends/Makefile | 1 + drivers/media/dvb/frontends/dvb-pll.c | 2 +- drivers/media/dvb/frontends/nxt200x.c | 1203 +++++++++++++++++++++++++++++++++ drivers/media/dvb/frontends/nxt200x.h | 58 ++ 6 files changed, 1289 insertions(+), 2 deletions(-) create mode 100644 drivers/media/dvb/frontends/nxt200x.c create mode 100644 drivers/media/dvb/frontends/nxt200x.h diff --git a/Documentation/dvb/get_dvb_firmware b/Documentation/dvb/get_dvb_firmware index a750f0101d9d..be6eb4c75991 100644 --- a/Documentation/dvb/get_dvb_firmware +++ b/Documentation/dvb/get_dvb_firmware @@ -22,7 +22,7 @@ use File::Temp qw/ tempdir /; use IO::Handle; @components = ( "sp8870", "sp887x", "tda10045", "tda10046", "av7110", "dec2000t", - "dec2540t", "dec3000s", "vp7041", "dibusb", "nxt2002", + "dec2540t", "dec3000s", "vp7041", "dibusb", "nxt2002", "nxt2004", "or51211", "or51132_qam", "or51132_vsb"); # Check args @@ -252,6 +252,23 @@ sub nxt2002 { $outfile; } +sub nxt2004 { + my $sourcefile = "AVerTVHD_MCE_A180_Drv_v1.2.2.16.zip"; + my $url = "http://www.aver.com/support/Drivers/$sourcefile"; + my $hash = "111cb885b1e009188346d72acfed024c"; + my $outfile = "dvb-fe-nxt2004.fw"; + my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1); + + checkstandard(); + + wgetfile($sourcefile, $url); + unzip($sourcefile, $tmpdir); + verify("$tmpdir/3xHybrid.sys", $hash); + extract("$tmpdir/3xHybrid.sys", 465304, 9584, $outfile); + + $outfile; +} + sub or51211 { my $fwfile = "dvb-fe-or51211.fw"; my $url = "http://linuxtv.org/downloads/firmware/$fwfile"; diff --git a/drivers/media/dvb/frontends/Kconfig b/drivers/media/dvb/frontends/Kconfig index a50a41f6f79d..8e269e1c1f9d 100644 --- a/drivers/media/dvb/frontends/Kconfig +++ b/drivers/media/dvb/frontends/Kconfig @@ -164,6 +164,14 @@ config DVB_NXT2002 help An ATSC 8VSB tuner module. Say Y when you want to support this frontend. +config DVB_NXT200X + tristate "Nextwave NXT2002/NXT2004 based" + depends on DVB_CORE + select FW_LOADER + help + An ATSC 8VSB and QAM64/256 tuner module. Say Y when you want + to support this frontend. + config DVB_OR51211 tristate "or51211 based (pcHDTV HD2000 card)" depends on DVB_CORE diff --git a/drivers/media/dvb/frontends/Makefile b/drivers/media/dvb/frontends/Makefile index ad8658ffd60a..1692ee65ba5d 100644 --- a/drivers/media/dvb/frontends/Makefile +++ b/drivers/media/dvb/frontends/Makefile @@ -26,6 +26,7 @@ obj-$(CONFIG_DVB_TDA80XX) += tda80xx.o obj-$(CONFIG_DVB_TDA10021) += tda10021.o obj-$(CONFIG_DVB_STV0297) += stv0297.o obj-$(CONFIG_DVB_NXT2002) += nxt2002.o +obj-$(CONFIG_DVB_NXT2002) += nxt200x.o obj-$(CONFIG_DVB_OR51211) += or51211.o obj-$(CONFIG_DVB_OR51132) += or51132.o obj-$(CONFIG_DVB_BCM3510) += bcm3510.o diff --git a/drivers/media/dvb/frontends/dvb-pll.c b/drivers/media/dvb/frontends/dvb-pll.c index 6ba7433c2aa7..f857b869616c 100644 --- a/drivers/media/dvb/frontends/dvb-pll.c +++ b/drivers/media/dvb/frontends/dvb-pll.c @@ -314,7 +314,7 @@ EXPORT_SYMBOL(dvb_pll_tdhu2); */ struct dvb_pll_desc dvb_pll_tuv1236d = { .name = "Philips TUV1236D", - .min = 57000000, + .min = 54000000, .max = 864000000, .count = 3, .entries = { diff --git a/drivers/media/dvb/frontends/nxt200x.c b/drivers/media/dvb/frontends/nxt200x.c new file mode 100644 index 000000000000..1d729be9b75c --- /dev/null +++ b/drivers/media/dvb/frontends/nxt200x.c @@ -0,0 +1,1203 @@ +/* + * Support for NXT2002 and NXT2004 - VSB/QAM + * + * Copyright (C) 2005 Kirk Lapray (kirk.lapray@gmail.com) + * based on nxt2002 by Taylor Jacob + * and nxt2004 by Jean-Francois Thibert (jeanfrancois@sagetv.com) + * + * 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. + * +*/ + +/* + * NOTES ABOUT THIS DRIVER + * + * This Linux driver supports: + * B2C2/BBTI Technisat Air2PC - ATSC (NXT2002) + * AverTVHD MCE A180 (NXT2004) + * ATI HDTV Wonder (NXT2004) + * + * This driver needs external firmware. Please use the command + * "/Documentation/dvb/get_dvb_firmware nxt2002" or + * "/Documentation/dvb/get_dvb_firmware nxt2004" to + * download/extract the appropriate firmware, and then copy it to + * /usr/lib/hotplug/firmware/ or /lib/firmware/ + * (depending on configuration of firmware hotplug). + */ +#define NXT2002_DEFAULT_FIRMWARE "dvb-fe-nxt2002.fw" +#define NXT2004_DEFAULT_FIRMWARE "dvb-fe-nxt2004.fw" +#define CRC_CCIT_MASK 0x1021 + +#include +#include +#include +#include + +#include "dvb_frontend.h" +#include "dvb-pll.h" +#include "nxt200x.h" + +struct nxt200x_state { + + struct i2c_adapter* i2c; + struct dvb_frontend_ops ops; + const struct nxt200x_config* config; + struct dvb_frontend frontend; + + /* demodulator private data */ + nxt_chip_type demod_chip; + u8 initialised:1; +}; + +static int debug; +#define dprintk(args...) \ + do { \ + if (debug) printk(KERN_DEBUG "nxt200x: " args); \ + } while (0) + +static int i2c_writebytes (struct nxt200x_state* state, u8 addr, u8 *buf, u8 len) +{ + int err; + struct i2c_msg msg = { .addr = addr, .flags = 0, .buf = buf, .len = len }; + + if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) { + printk (KERN_WARNING "nxt200x: %s: i2c write error (addr 0x%02x, err == %i)\n", + __FUNCTION__, addr, err); + return -EREMOTEIO; + } + return 0; +} + +static u8 i2c_readbytes (struct nxt200x_state* state, u8 addr, u8* buf, u8 len) +{ + int err; + struct i2c_msg msg = { .addr = addr, .flags = I2C_M_RD, .buf = buf, .len = len }; + + if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) { + printk (KERN_WARNING "nxt200x: %s: i2c read error (addr 0x%02x, err == %i)\n", + __FUNCTION__, addr, err); + return -EREMOTEIO; + } + return 0; +} + +static int nxt200x_writebytes (struct nxt200x_state* state, u8 reg, u8 *buf, u8 len) +{ + u8 buf2 [len+1]; + int err; + struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = buf2, .len = len + 1 }; + + buf2[0] = reg; + memcpy(&buf2[1], buf, len); + + if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) { + printk (KERN_WARNING "nxt200x: %s: i2c write error (addr 0x%02x, err == %i)\n", + __FUNCTION__, state->config->demod_address, err); + return -EREMOTEIO; + } + return 0; +} + +static u8 nxt200x_readbytes (struct nxt200x_state* state, u8 reg, u8* buf, u8 len) +{ + u8 reg2 [] = { reg }; + + struct i2c_msg msg [] = { { .addr = state->config->demod_address, .flags = 0, .buf = reg2, .len = 1 }, + { .addr = state->config->demod_address, .flags = I2C_M_RD, .buf = buf, .len = len } }; + + int err; + + if ((err = i2c_transfer (state->i2c, msg, 2)) != 2) { + printk (KERN_WARNING "nxt200x: %s: i2c read error (addr 0x%02x, err == %i)\n", + __FUNCTION__, state->config->demod_address, err); + return -EREMOTEIO; + } + return 0; +} + +static u16 nxt200x_crc(u16 crc, u8 c) +{ + u8 i; + u16 input = (u16) c & 0xFF; + + input<<=8; + for(i=0; i<8; i++) { + if((crc^input) & 0x8000) + crc=(crc<<1)^CRC_CCIT_MASK; + else + crc<<=1; + input<<=1; + } + return crc; +} + +static int nxt200x_writereg_multibyte (struct nxt200x_state* state, u8 reg, u8* data, u8 len) +{ + u8 attr, len2, buf; + dprintk("%s\n", __FUNCTION__); + + /* set mutli register register */ + nxt200x_writebytes(state, 0x35, ®, 1); + + /* send the actual data */ + nxt200x_writebytes(state, 0x36, data, len); + + switch (state->demod_chip) { + case NXT2002: + len2 = len; + buf = 0x02; + break; + case NXT2004: + /* probably not right, but gives correct values */ + attr = 0x02; + if (reg & 0x80) { + attr = attr << 1; + if (reg & 0x04) + attr = attr >> 1; + } + /* set write bit */ + len2 = ((attr << 4) | 0x10) | len; + buf = 0x80; + break; + default: + return -EINVAL; + break; + } + + /* set multi register length */ + nxt200x_writebytes(state, 0x34, &len2, 1); + + /* toggle the multireg write bit */ + nxt200x_writebytes(state, 0x21, &buf, 1); + + nxt200x_readbytes(state, 0x21, &buf, 1); + + switch (state->demod_chip) { + case NXT2002: + if ((buf & 0x02) == 0) + return 0; + break; + case NXT2004: + if (buf == 0) + return 0; + break; + default: + return -EINVAL; + break; + } + + printk(KERN_WARNING "nxt200x: Error writing multireg register 0x%02X\n",reg); + + return 0; +} + +static int nxt200x_readreg_multibyte (struct nxt200x_state* state, u8 reg, u8* data, u8 len) +{ + int i; + u8 buf, len2, attr; + dprintk("%s\n", __FUNCTION__); + + /* set mutli register register */ + nxt200x_writebytes(state, 0x35, ®, 1); + + switch (state->demod_chip) { + case NXT2002: + /* set multi register length */ + len2 = len & 0x80; + nxt200x_writebytes(state, 0x34, &len2, 1); + + /* read the actual data */ + nxt200x_readbytes(state, reg, data, len); + return 0; + break; + case NXT2004: + /* probably not right, but gives correct values */ + attr = 0x02; + if (reg & 0x80) { + attr = attr << 1; + if (reg & 0x04) + attr = attr >> 1; + } + + /* set multi register length */ + len2 = (attr << 4) | len; + nxt200x_writebytes(state, 0x34, &len2, 1); + + /* toggle the multireg bit*/ + buf = 0x80; + nxt200x_writebytes(state, 0x21, &buf, 1); + + /* read status */ + nxt200x_readbytes(state, 0x21, &buf, 1); + + if (buf == 0) + { + /* read the actual data */ + for(i = 0; i < len; i++) { + nxt200x_readbytes(state, 0x36 + i, &data[i], 1); + } + return 0; + } + break; + default: + return -EINVAL; + break; + } + + printk(KERN_WARNING "nxt200x: Error reading multireg register 0x%02X\n",reg); + + return 0; +} + +static void nxt200x_microcontroller_stop (struct nxt200x_state* state) +{ + u8 buf, stopval, counter = 0; + dprintk("%s\n", __FUNCTION__); + + /* set correct stop value */ + switch (state->demod_chip) { + case NXT2002: + stopval = 0x40; + break; + case NXT2004: + stopval = 0x10; + break; + default: + stopval = 0; + break; + } + + buf = 0x80; + nxt200x_writebytes(state, 0x22, &buf, 1); + + while (counter < 20) { + nxt200x_readbytes(state, 0x31, &buf, 1); + if (buf & stopval) + return; + msleep(10); + counter++; + } + + printk(KERN_WARNING "nxt200x: Timeout waiting for nxt200x to stop. This is ok after firmware upload.\n"); + return; +} + +static void nxt200x_microcontroller_start (struct nxt200x_state* state) +{ + u8 buf; + dprintk("%s\n", __FUNCTION__); + + buf = 0x00; + nxt200x_writebytes(state, 0x22, &buf, 1); +} + +static void nxt2004_microcontroller_init (struct nxt200x_state* state) +{ + u8 buf[9]; + u8 counter = 0; + dprintk("%s\n", __FUNCTION__); + + buf[0] = 0x00; + nxt200x_writebytes(state, 0x2b, buf, 1); + buf[0] = 0x70; + nxt200x_writebytes(state, 0x34, buf, 1); + buf[0] = 0x04; + nxt200x_writebytes(state, 0x35, buf, 1); + buf[0] = 0x01; buf[1] = 0x23; buf[2] = 0x45; buf[3] = 0x67; buf[4] = 0x89; + buf[5] = 0xAB; buf[6] = 0xCD; buf[7] = 0xEF; buf[8] = 0xC0; + nxt200x_writebytes(state, 0x36, buf, 9); + buf[0] = 0x80; + nxt200x_writebytes(state, 0x21, buf, 1); + + while (counter < 20) { + nxt200x_readbytes(state, 0x21, buf, 1); + if (buf[0] == 0) + return; + msleep(10); + counter++; + } + + printk(KERN_WARNING "nxt200x: Timeout waiting for nxt2004 to init.\n"); + + return; +} + +static int nxt200x_writetuner (struct nxt200x_state* state, u8* data) +{ + u8 buf, count = 0; + + dprintk("%s\n", __FUNCTION__); + + dprintk("Tuner Bytes: %02X %02X %02X %02X\n", data[0], data[1], data[2], data[3]); + + /* if pll is a Philips TUV1236D then write directly to tuner */ + if (strcmp(state->config->pll_desc->name, "Philips TUV1236D") == 0) { + if (i2c_writebytes(state, state->config->pll_address, data, 4)) + printk(KERN_WARNING "nxt200x: error writing to tuner\n"); + /* wait until we have a lock */ + while (count < 20) { + i2c_readbytes(state, state->config->pll_address, &buf, 1); + if (buf & 0x40) + return 0; + msleep(100); + count++; + } + printk("nxt200x: timeout waiting for tuner lock\n"); + return 0; + } else { + /* set the i2c transfer speed to the tuner */ + buf = 0x03; + nxt200x_writebytes(state, 0x20, &buf, 1); + + /* setup to transfer 4 bytes via i2c */ + buf = 0x04; + nxt200x_writebytes(state, 0x34, &buf, 1); + + /* write actual tuner bytes */ + nxt200x_writebytes(state, 0x36, data, 4); + + /* set tuner i2c address */ + buf = state->config->pll_address; + nxt200x_writebytes(state, 0x35, &buf, 1); + + /* write UC Opmode to begin transfer */ + buf = 0x80; + nxt200x_writebytes(state, 0x21, &buf, 1); + + while (count < 20) { + nxt200x_readbytes(state, 0x21, &buf, 1); + if ((buf & 0x80)== 0x00) + return 0; + msleep(100); + count++; + } + printk("nxt200x: timeout error writing tuner\n"); + return 0; + } +} + +static void nxt200x_agc_reset(struct nxt200x_state* state) +{ + u8 buf; + dprintk("%s\n", __FUNCTION__); + + switch (state->demod_chip) { + case NXT2002: + buf = 0x08; + nxt200x_writebytes(state, 0x08, &buf, 1); + buf = 0x00; + nxt200x_writebytes(state, 0x08, &buf, 1); + break; + case NXT2004: + nxt200x_readreg_multibyte(state, 0x08, &buf, 1); + buf = 0x08; + nxt200x_writereg_multibyte(state, 0x08, &buf, 1); + buf = 0x00; + nxt200x_writereg_multibyte(state, 0x08, &buf, 1); + break; + default: + break; + } + return; +} + +static int nxt2002_load_firmware (struct dvb_frontend* fe, const struct firmware *fw) +{ + + struct nxt200x_state* state = fe->demodulator_priv; + u8 buf[3], written = 0, chunkpos = 0; + u16 rambase, position, crc = 0; + + dprintk("%s\n", __FUNCTION__); + dprintk("Firmware is %zu bytes\n", fw->size); + + /* Get the RAM base for this nxt2002 */ + nxt200x_readbytes(state, 0x10, buf, 1); + + if (buf[0] & 0x10) + rambase = 0x1000; + else + rambase = 0x0000; + + dprintk("rambase on this nxt2002 is %04X\n", rambase); + + /* Hold the micro in reset while loading firmware */ + buf[0] = 0x80; + nxt200x_writebytes(state, 0x2B, buf, 1); + + for (position = 0; position < fw->size; position++) { + if (written == 0) { + crc = 0; + chunkpos = 0x28; + buf[0] = ((rambase + position) >> 8); + buf[1] = (rambase + position) & 0xFF; + buf[2] = 0x81; + /* write starting address */ + nxt200x_writebytes(state, 0x29, buf, 3); + } + written++; + chunkpos++; + + if ((written % 4) == 0) + nxt200x_writebytes(state, chunkpos, &fw->data[position-3], 4); + + crc = nxt200x_crc(crc, fw->data[position]); + + if ((written == 255) || (position+1 == fw->size)) { + /* write remaining bytes of firmware */ + nxt200x_writebytes(state, chunkpos+4-(written %4), + &fw->data[position-(written %4) + 1], + written %4); + buf[0] = crc << 8; + buf[1] = crc & 0xFF; + + /* write crc */ + nxt200x_writebytes(state, 0x2C, buf, 2); + + /* do a read to stop things */ + nxt200x_readbytes(state, 0x2A, buf, 1); + + /* set transfer mode to complete */ + buf[0] = 0x80; + nxt200x_writebytes(state, 0x2B, buf, 1); + + written = 0; + } + } + + return 0; +}; + +static int nxt2004_load_firmware (struct dvb_frontend* fe, const struct firmware *fw) +{ + + struct nxt200x_state* state = fe->demodulator_priv; + u8 buf[3]; + u16 rambase, position, crc=0; + + dprintk("%s\n", __FUNCTION__); + dprintk("Firmware is %zu bytes\n", fw->size); + + /* set rambase */ + rambase = 0x1000; + + /* hold the micro in reset while loading firmware */ + buf[0] = 0x80; + nxt200x_writebytes(state, 0x2B, buf,1); + + /* calculate firmware CRC */ + for (position = 0; position < fw->size; position++) { + crc = nxt200x_crc(crc, fw->data[position]); + } + + buf[0] = rambase >> 8; + buf[1] = rambase & 0xFF; + buf[2] = 0x81; + /* write starting address */ + nxt200x_writebytes(state,0x29,buf,3); + + for (position = 0; position < fw->size;) { + nxt200x_writebytes(state, 0x2C, &fw->data[position], + fw->size-position > 255 ? 255 : fw->size-position); + position += (fw->size-position > 255 ? 255 : fw->size-position); + } + buf[0] = crc >> 8; + buf[1] = crc & 0xFF; + + dprintk("firmware crc is 0x%02X 0x%02X\n", buf[0], buf[1]); + + /* write crc */ + nxt200x_writebytes(state, 0x2C, buf,2); + + /* do a read to stop things */ + nxt200x_readbytes(state, 0x2C, buf, 1); + + /* set transfer mode to complete */ + buf[0] = 0x80; + nxt200x_writebytes(state, 0x2B, buf,1); + + return 0; +}; + +static int nxt200x_setup_frontend_parameters (struct dvb_frontend* fe, + struct dvb_frontend_parameters *p) +{ + struct nxt200x_state* state = fe->demodulator_priv; + u8 buf[4]; + + /* stop the micro first */ + nxt200x_microcontroller_stop(state); + + if (state->demod_chip == NXT2004) { + /* make sure demod is set to digital */ + buf[0] = 0x04; + nxt200x_writebytes(state, 0x14, buf, 1); + buf[0] = 0x00; + nxt200x_writebytes(state, 0x17, buf, 1); + } + + /* get tuning information */ + dvb_pll_configure(state->config->pll_desc, buf, p->frequency, 0); + + /* set additional params */ + switch (p->u.vsb.modulation) { + case QAM_64: + case QAM_256: + /* Set punctured clock for QAM */ + /* This is just a guess since I am unable to test it */ + state->config->set_ts_params(fe, 1); + + /* set to use cable input */ + buf[3] |= 0x08; + break; + case VSB_8: + /* Set non-punctured clock for VSB */ + state->config->set_ts_params(fe, 0); + break; + default: + return -EINVAL; + break; + } + + /* write frequency information */ + nxt200x_writetuner(state, buf); + + /* reset the agc now that tuning has been completed */ + nxt200x_agc_reset(state); + + /* set target power level */ + switch (p->u.vsb.modulation) { + case QAM_64: + case QAM_256: + buf[0] = 0x74; + break; + case VSB_8: + buf[0] = 0x70; + break; + default: + return -EINVAL; + break; + } + nxt200x_writebytes(state, 0x42, buf, 1); + + /* configure sdm */ + switch (state->demod_chip) { + case NXT2002: + buf[0] = 0x87; + break; + case NXT2004: + buf[0] = 0x07; + break; + default: + return -EINVAL; + break; + } + nxt200x_writebytes(state, 0x57, buf, 1); + + /* write sdm1 input */ + buf[0] = 0x10; + buf[1] = 0x00; + nxt200x_writebytes(state, 0x58, buf, 2); + + /* write sdmx input */ + switch (p->u.vsb.modulation) { + case QAM_64: + buf[0] = 0x68; + break; + case QAM_256: + buf[0] = 0x64; + break; + case VSB_8: + buf[0] = 0x60; + break; + default: + return -EINVAL; + break; + } + buf[1] = 0x00; + nxt200x_writebytes(state, 0x5C, buf, 2); + + /* write adc power lpf fc */ + buf[0] = 0x05; + nxt200x_writebytes(state, 0x43, buf, 1); + + if (state->demod_chip == NXT2004) { + /* write ??? */ + buf[0] = 0x00; + buf[1] = 0x00; + nxt200x_writebytes(state, 0x46, buf, 2); + } + + /* write accumulator2 input */ + buf[0] = 0x80; + buf[1] = 0x00; + nxt200x_writebytes(state, 0x4B, buf, 2); + + /* write kg1 */ + buf[0] = 0x00; + nxt200x_writebytes(state, 0x4D, buf, 1); + + /* write sdm12 lpf fc */ + buf[0] = 0x44; + nxt200x_writebytes(state, 0x55, buf, 1); + + /* write agc control reg */ + buf[0] = 0x04; + nxt200x_writebytes(state, 0x41, buf, 1); + + if (state->demod_chip == NXT2004) { + nxt200x_readreg_multibyte(state, 0x80, buf, 1); + buf[0] = 0x24; + nxt200x_writereg_multibyte(state, 0x80, buf, 1); + + /* soft reset? */ + nxt200x_readreg_multibyte(state, 0x08, buf, 1); + buf[0] = 0x10; + nxt200x_writereg_multibyte(state, 0x08, buf, 1); + nxt200x_readreg_multibyte(state, 0x08, buf, 1); + buf[0] = 0x00; + nxt200x_writereg_multibyte(state, 0x08, buf, 1); + + nxt200x_readreg_multibyte(state, 0x80, buf, 1); + buf[0] = 0x04; + nxt200x_writereg_multibyte(state, 0x80, buf, 1); + buf[0] = 0x00; + nxt200x_writereg_multibyte(state, 0x81, buf, 1); + buf[0] = 0x80; buf[1] = 0x00; buf[2] = 0x00; + nxt200x_writereg_multibyte(state, 0x82, buf, 3); + nxt200x_readreg_multibyte(state, 0x88, buf, 1); + buf[0] = 0x11; + nxt200x_writereg_multibyte(state, 0x88, buf, 1); + nxt200x_readreg_multibyte(state, 0x80, buf, 1); + buf[0] = 0x44; + nxt200x_writereg_multibyte(state, 0x80, buf, 1); + } + + /* write agc ucgp0 */ + switch (p->u.vsb.modulation) { + case QAM_64: + buf[0] = 0x02; + break; + case QAM_256: + buf[0] = 0x03; + break; + case VSB_8: + buf[0] = 0x00; + break; + default: + return -EINVAL; + break; + } + nxt200x_writebytes(state, 0x30, buf, 1); + + /* write agc control reg */ + buf[0] = 0x00; + nxt200x_writebytes(state, 0x41, buf, 1); + + /* write accumulator2 input */ + buf[0] = 0x80; + buf[1] = 0x00; + nxt200x_writebytes(state, 0x49, buf,2); + nxt200x_writebytes(state, 0x4B, buf,2); + + /* write agc control reg */ + buf[0] = 0x04; + nxt200x_writebytes(state, 0x41, buf, 1); + + nxt200x_microcontroller_start(state); + + if (state->demod_chip == NXT2004) { + nxt2004_microcontroller_init(state); + + /* ???? */ + buf[0] = 0xF0; + buf[1] = 0x00; + nxt200x_writebytes(state, 0x5C, buf, 2); + } + + /* adjacent channel detection should be done here, but I don't + have any stations with this need so I cannot test it */ + + return 0; +} + +static int nxt200x_read_status(struct dvb_frontend* fe, fe_status_t* status) +{ + struct nxt200x_state* state = fe->demodulator_priv; + u8 lock; + nxt200x_readbytes(state, 0x31, &lock, 1); + + *status = 0; + if (lock & 0x20) { + *status |= FE_HAS_SIGNAL; + *status |= FE_HAS_CARRIER; + *status |= FE_HAS_VITERBI; + *status |= FE_HAS_SYNC; + *status |= FE_HAS_LOCK; + } + return 0; +} + +static int nxt200x_read_ber(struct dvb_frontend* fe, u32* ber) +{ + struct nxt200x_state* state = fe->demodulator_priv; + u8 b[3]; + + nxt200x_readreg_multibyte(state, 0xE6, b, 3); + + *ber = ((b[0] << 8) + b[1]) * 8; + + return 0; +} + +static int nxt200x_read_signal_strength(struct dvb_frontend* fe, u16* strength) +{ + struct nxt200x_state* state = fe->demodulator_priv; + u8 b[2]; + u16 temp = 0; + + /* setup to read cluster variance */ + b[0] = 0x00; + nxt200x_writebytes(state, 0xA1, b, 1); + + /* get multreg val */ + nxt200x_readreg_multibyte(state, 0xA6, b, 2); + + temp = (b[0] << 8) | b[1]; + *strength = ((0x7FFF - temp) & 0x0FFF) * 16; + + return 0; +} + +static int nxt200x_read_snr(struct dvb_frontend* fe, u16* snr) +{ + + struct nxt200x_state* state = fe->demodulator_priv; + u8 b[2]; + u16 temp = 0, temp2; + u32 snrdb = 0; + + /* setup to read cluster variance */ + b[0] = 0x00; + nxt200x_writebytes(state, 0xA1, b, 1); + + /* get multreg val from 0xA6 */ + nxt200x_readreg_multibyte(state, 0xA6, b, 2); + + temp = (b[0] << 8) | b[1]; + temp2 = 0x7FFF - temp; + + /* snr will be in db */ + if (temp2 > 0x7F00) + snrdb = 1000*24 + ( 1000*(30-24) * ( temp2 - 0x7F00 ) / ( 0x7FFF - 0x7F00 ) ); + else if (temp2 > 0x7EC0) + snrdb = 1000*18 + ( 1000*(24-18) * ( temp2 - 0x7EC0 ) / ( 0x7F00 - 0x7EC0 ) ); + else if (temp2 > 0x7C00) + snrdb = 1000*12 + ( 1000*(18-12) * ( temp2 - 0x7C00 ) / ( 0x7EC0 - 0x7C00 ) ); + else + snrdb = 1000*0 + ( 1000*(12-0) * ( temp2 - 0 ) / ( 0x7C00 - 0 ) ); + + /* the value reported back from the frontend will be FFFF=32db 0000=0db */ + *snr = snrdb * (0xFFFF/32000); + + return 0; +} + +static int nxt200x_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) +{ + struct nxt200x_state* state = fe->demodulator_priv; + u8 b[3]; + + nxt200x_readreg_multibyte(state, 0xE6, b, 3); + *ucblocks = b[2]; + + return 0; +} + +static int nxt200x_sleep(struct dvb_frontend* fe) +{ + return 0; +} + +static int nxt2002_init(struct dvb_frontend* fe) +{ + struct nxt200x_state* state = fe->demodulator_priv; + const struct firmware *fw; + int ret; + u8 buf[2]; + + /* request the firmware, this will block until someone uploads it */ + printk("nxt2002: Waiting for firmware upload (%s)...\n", NXT2002_DEFAULT_FIRMWARE); + ret = request_firmware(&fw, NXT2002_DEFAULT_FIRMWARE, &state->i2c->dev); + printk("nxt2002: Waiting for firmware upload(2)...\n"); + if (ret) { + printk("nxt2002: No firmware uploaded (timeout or file not found?)\n"); + return ret; + } + + ret = nxt2002_load_firmware(fe, fw); + if (ret) { + printk("nxt2002: Writing firmware to device failed\n"); + release_firmware(fw); + return ret; + } + printk("nxt2002: Firmware upload complete\n"); + + /* Put the micro into reset */ + nxt200x_microcontroller_stop(state); + + /* ensure transfer is complete */ + buf[0]=0x00; + nxt200x_writebytes(state, 0x2B, buf, 1); + + /* Put the micro into reset for real this time */ + nxt200x_microcontroller_stop(state); + + /* soft reset everything (agc,frontend,eq,fec)*/ + buf[0] = 0x0F; + nxt200x_writebytes(state, 0x08, buf, 1); + buf[0] = 0x00; + nxt200x_writebytes(state, 0x08, buf, 1); + + /* write agc sdm configure */ + buf[0] = 0xF1; + nxt200x_writebytes(state, 0x57, buf, 1); + + /* write mod output format */ + buf[0] = 0x20; + nxt200x_writebytes(state, 0x09, buf, 1); + + /* write fec mpeg mode */ + buf[0] = 0x7E; + buf[1] = 0x00; + nxt200x_writebytes(state, 0xE9, buf, 2); + + /* write mux selection */ + buf[0] = 0x00; + nxt200x_writebytes(state, 0xCC, buf, 1); + + return 0; +} + +static int nxt2004_init(struct dvb_frontend* fe) +{ + struct nxt200x_state* state = fe->demodulator_priv; + const struct firmware *fw; + int ret; + u8 buf[3]; + + /* ??? */ + buf[0]=0x00; + nxt200x_writebytes(state, 0x1E, buf, 1); + + /* request the firmware, this will block until someone uploads it */ + printk("nxt2004: Waiting for firmware upload (%s)...\n", NXT2004_DEFAULT_FIRMWARE); + ret = request_firmware(&fw, NXT2004_DEFAULT_FIRMWARE, &state->i2c->dev); + printk("nxt2004: Waiting for firmware upload(2)...\n"); + if (ret) { + printk("nxt2004: No firmware uploaded (timeout or file not found?)\n"); + return ret; + } + + ret = nxt2004_load_firmware(fe, fw); + if (ret) { + printk("nxt2004: Writing firmware to device failed\n"); + release_firmware(fw); + return ret; + } + printk("nxt2004: Firmware upload complete\n"); + + /* ensure transfer is complete */ + buf[0] = 0x01; + nxt200x_writebytes(state, 0x19, buf, 1); + + nxt2004_microcontroller_init(state); + nxt200x_microcontroller_stop(state); + nxt200x_microcontroller_stop(state); + nxt2004_microcontroller_init(state); + nxt200x_microcontroller_stop(state); + + /* soft reset everything (agc,frontend,eq,fec)*/ + buf[0] = 0xFF; + nxt200x_writereg_multibyte(state, 0x08, buf, 1); + buf[0] = 0x00; + nxt200x_writereg_multibyte(state, 0x08, buf, 1); + + /* write agc sdm configure */ + buf[0] = 0xD7; + nxt200x_writebytes(state, 0x57, buf, 1); + + /* ???*/ + buf[0] = 0x07; + buf[1] = 0xfe; + nxt200x_writebytes(state, 0x35, buf, 2); + buf[0] = 0x12; + nxt200x_writebytes(state, 0x34, buf, 1); + buf[0] = 0x80; + nxt200x_writebytes(state, 0x21, buf, 1); + + /* ???*/ + buf[0] = 0x21; + nxt200x_writebytes(state, 0x0A, buf, 1); + + /* ???*/ + buf[0] = 0x01; + nxt200x_writereg_multibyte(state, 0x80, buf, 1); + + /* write fec mpeg mode */ + buf[0] = 0x7E; + buf[1] = 0x00; + nxt200x_writebytes(state, 0xE9, buf, 2); + + /* write mux selection */ + buf[0] = 0x00; + nxt200x_writebytes(state, 0xCC, buf, 1); + + /* ???*/ + nxt200x_readreg_multibyte(state, 0x80, buf, 1); + buf[0] = 0x00; + nxt200x_writereg_multibyte(state, 0x80, buf, 1); + + /* soft reset? */ + nxt200x_readreg_multibyte(state, 0x08, buf, 1); + buf[0] = 0x10; + nxt200x_writereg_multibyte(state, 0x08, buf, 1); + nxt200x_readreg_multibyte(state, 0x08, buf, 1); + buf[0] = 0x00; + nxt200x_writereg_multibyte(state, 0x08, buf, 1); + + /* ???*/ + nxt200x_readreg_multibyte(state, 0x80, buf, 1); + buf[0] = 0x01; + nxt200x_writereg_multibyte(state, 0x80, buf, 1); + buf[0] = 0x70; + nxt200x_writereg_multibyte(state, 0x81, buf, 1); + buf[0] = 0x31; buf[1] = 0x5E; buf[2] = 0x66; + nxt200x_writereg_multibyte(state, 0x82, buf, 3); + + nxt200x_readreg_multibyte(state, 0x88, buf, 1); + buf[0] = 0x11; + nxt200x_writereg_multibyte(state, 0x88, buf, 1); + nxt200x_readreg_multibyte(state, 0x80, buf, 1); + buf[0] = 0x40; + nxt200x_writereg_multibyte(state, 0x80, buf, 1); + + nxt200x_readbytes(state, 0x10, buf, 1); + buf[0] = 0x10; + nxt200x_writebytes(state, 0x10, buf, 1); + nxt200x_readbytes(state, 0x0A, buf, 1); + buf[0] = 0x21; + nxt200x_writebytes(state, 0x0A, buf, 1); + + nxt2004_microcontroller_init(state); + + buf[0] = 0x21; + nxt200x_writebytes(state, 0x0A, buf, 1); + buf[0] = 0x7E; + nxt200x_writebytes(state, 0xE9, buf, 1); + buf[0] = 0x00; + nxt200x_writebytes(state, 0xEA, buf, 1); + + nxt200x_readreg_multibyte(state, 0x80, buf, 1); + buf[0] = 0x00; + nxt200x_writereg_multibyte(state, 0x80, buf, 1); + nxt200x_readreg_multibyte(state, 0x80, buf, 1); + buf[0] = 0x00; + nxt200x_writereg_multibyte(state, 0x80, buf, 1); + + /* soft reset? */ + nxt200x_readreg_multibyte(state, 0x08, buf, 1); + buf[0] = 0x10; + nxt200x_writereg_multibyte(state, 0x08, buf, 1); + nxt200x_readreg_multibyte(state, 0x08, buf, 1); + buf[0] = 0x00; + nxt200x_writereg_multibyte(state, 0x08, buf, 1); + + nxt200x_readreg_multibyte(state, 0x80, buf, 1); + buf[0] = 0x04; + nxt200x_writereg_multibyte(state, 0x80, buf, 1); + buf[0] = 0x00; + nxt200x_writereg_multibyte(state, 0x81, buf, 1); + buf[0] = 0x80; buf[1] = 0x00; buf[2] = 0x00; + nxt200x_writereg_multibyte(state, 0x82, buf, 3); + + nxt200x_readreg_multibyte(state, 0x88, buf, 1); + buf[0] = 0x11; + nxt200x_writereg_multibyte(state, 0x88, buf, 1); + + nxt200x_readreg_multibyte(state, 0x80, buf, 1); + buf[0] = 0x44; + nxt200x_writereg_multibyte(state, 0x80, buf, 1); + + /* initialize tuner */ + nxt200x_readbytes(state, 0x10, buf, 1); + buf[0] = 0x12; + nxt200x_writebytes(state, 0x10, buf, 1); + buf[0] = 0x04; + nxt200x_writebytes(state, 0x13, buf, 1); + buf[0] = 0x00; + nxt200x_writebytes(state, 0x16, buf, 1); + buf[0] = 0x04; + nxt200x_writebytes(state, 0x14, buf, 1); + buf[0] = 0x00; + nxt200x_writebytes(state, 0x14, buf, 1); + nxt200x_writebytes(state, 0x17, buf, 1); + nxt200x_writebytes(state, 0x14, buf, 1); + nxt200x_writebytes(state, 0x17, buf, 1); + + return 0; +} + +static int nxt200x_init(struct dvb_frontend* fe) +{ + struct nxt200x_state* state = fe->demodulator_priv; + int ret = 0; + + if (!state->initialised) { + switch (state->demod_chip) { + case NXT2002: + ret = nxt2002_init(fe); + break; + case NXT2004: + ret = nxt2004_init(fe); + break; + default: + return -EINVAL; + break; + } + state->initialised = 1; + } + return ret; +} + +static int nxt200x_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fesettings) +{ + fesettings->min_delay_ms = 500; + fesettings->step_size = 0; + fesettings->max_drift = 0; + return 0; +} + +static void nxt200x_release(struct dvb_frontend* fe) +{ + struct nxt200x_state* state = fe->demodulator_priv; + kfree(state); +} + +static struct dvb_frontend_ops nxt200x_ops; + +struct dvb_frontend* nxt200x_attach(const struct nxt200x_config* config, + struct i2c_adapter* i2c) +{ + struct nxt200x_state* state = NULL; + u8 buf [] = {0,0,0,0,0}; + + /* allocate memory for the internal state */ + state = (struct nxt200x_state*) kmalloc(sizeof(struct nxt200x_state), GFP_KERNEL); + if (state == NULL) + goto error; + memset(state,0,sizeof(*state)); + + /* setup the state */ + state->config = config; + state->i2c = i2c; + memcpy(&state->ops, &nxt200x_ops, sizeof(struct dvb_frontend_ops)); + state->initialised = 0; + + /* read card id */ + nxt200x_readbytes(state, 0x00, buf, 5); + dprintk("NXT info: %02X %02X %02X %02X %02X\n", + buf[0], buf[1], buf[2], buf[3], buf[4]); + + /* set demod chip */ + switch (buf[0]) { + case 0x04: + state->demod_chip = NXT2002; + printk("nxt200x: NXT2002 Detected\n"); + break; + case 0x05: + state->demod_chip = NXT2004; + printk("nxt200x: NXT2004 Detected\n"); + break; + default: + goto error; + } + + /* make sure demod chip is supported */ + switch (state->demod_chip) { + case NXT2002: + if (buf[0] != 0x04) goto error; /* device id */ + if (buf[1] != 0x02) goto error; /* fab id */ + if (buf[2] != 0x11) goto error; /* month */ + if (buf[3] != 0x20) goto error; /* year msb */ + if (buf[4] != 0x00) goto error; /* year lsb */ + break; + case NXT2004: + if (buf[0] != 0x05) goto error; /* device id */ + break; + default: + goto error; + } + + /* create dvb_frontend */ + state->frontend.ops = &state->ops; + state->frontend.demodulator_priv = state; + return &state->frontend; + +error: + if (state) + kfree(state); + printk("Unknown/Unsupported NXT chip: %02X %02X %02X %02X %02X\n", + buf[0], buf[1], buf[2], buf[3], buf[4]); + return NULL; +} + +static struct dvb_frontend_ops nxt200x_ops = { + + .info = { + .name = "Nextwave NXT200X VSB/QAM frontend", + .type = FE_ATSC, + .frequency_min = 54000000, + .frequency_max = 860000000, + .frequency_stepsize = 166666, /* stepsize is just a guess */ + .caps = FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | + FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO | + FE_CAN_8VSB | FE_CAN_QAM_64 | FE_CAN_QAM_256 + }, + + .release = nxt200x_release, + + .init = nxt200x_init, + .sleep = nxt200x_sleep, + + .set_frontend = nxt200x_setup_frontend_parameters, + .get_tune_settings = nxt200x_get_tune_settings, + + .read_status = nxt200x_read_status, + .read_ber = nxt200x_read_ber, + .read_signal_strength = nxt200x_read_signal_strength, + .read_snr = nxt200x_read_snr, + .read_ucblocks = nxt200x_read_ucblocks, +}; + +module_param(debug, int, 0644); +MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off)."); + +MODULE_DESCRIPTION("NXT200X (ATSC 8VSB & ITU-T J.83 AnnexB 64/256 QAM) Demodulator Driver"); +MODULE_AUTHOR("Kirk Lapray, Jean-Francois Thibert, and Taylor Jacob"); +MODULE_LICENSE("GPL"); + +EXPORT_SYMBOL(nxt200x_attach); + diff --git a/drivers/media/dvb/frontends/nxt200x.h b/drivers/media/dvb/frontends/nxt200x.h new file mode 100644 index 000000000000..8dc3f03ecdf7 --- /dev/null +++ b/drivers/media/dvb/frontends/nxt200x.h @@ -0,0 +1,58 @@ +/* + * Support for NXT2002 and NXT2004 - VSB/QAM + * + * Copyright (C) 2005 Kirk Lapray (kirk.lapray@gmail.com) + * based on nxt2002 by Taylor Jacob + * and nxt2004 by Jean-Francois Thibert (jeanfrancois@sagetv.com) + * + * 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. + * +*/ + +#ifndef NXT200X_H +#define NXT200X_H + +#include +#include + +typedef enum nxt_chip_t { + NXTUNDEFINED, + NXT2002, + NXT2004 +}nxt_chip_type; + +struct nxt200x_config +{ + /* the demodulator's i2c address */ + u8 demod_address; + + /* tuner information */ + u8 pll_address; + struct dvb_pll_desc *pll_desc; + + /* need to set device param for start_dma */ + int (*set_ts_params)(struct dvb_frontend* fe, int is_punctured); +}; + +extern struct dvb_frontend* nxt200x_attach(const struct nxt200x_config* config, + struct i2c_adapter* i2c); + +#endif /* NXT200X_H */ + +/* + * Local variables: + * c-basic-offset: 8 + * End: + */ -- cgit v1.2.2 From c6dd2d5d61b000509e3a7f6c06778b16a4ef10ba Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 8 Nov 2005 21:35:47 -0800 Subject: [PATCH] dvb: nxt200x: check callback fix Check that a callback (set_ts_params) is set before calling it. Signed-off-by: Michael Krufky Cc: Johannes Stezenbach Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/dvb/frontends/nxt200x.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/media/dvb/frontends/nxt200x.c b/drivers/media/dvb/frontends/nxt200x.c index 1d729be9b75c..d1b9f8b9b437 100644 --- a/drivers/media/dvb/frontends/nxt200x.c +++ b/drivers/media/dvb/frontends/nxt200x.c @@ -557,14 +557,16 @@ static int nxt200x_setup_frontend_parameters (struct dvb_frontend* fe, case QAM_256: /* Set punctured clock for QAM */ /* This is just a guess since I am unable to test it */ - state->config->set_ts_params(fe, 1); + if (state->config->set_ts_params) + state->config->set_ts_params(fe, 1); /* set to use cable input */ buf[3] |= 0x08; break; case VSB_8: /* Set non-punctured clock for VSB */ - state->config->set_ts_params(fe, 0); + if (state->config->set_ts_params) + state->config->set_ts_params(fe, 0); break; default: return -EINVAL; -- cgit v1.2.2 From 6d35ae3d1137c92a315b7ff10aecd45b1f37d99e Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 8 Nov 2005 21:35:48 -0800 Subject: [PATCH] dvb: nxt200x: remove null check before kfree() Removed unnecessary null check before kfree() ...inspired by the big patch from Jesper Juhl. Signed-off-by: Michael Krufky Cc: Johannes Stezenbach Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/dvb/frontends/nxt200x.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/media/dvb/frontends/nxt200x.c b/drivers/media/dvb/frontends/nxt200x.c index d1b9f8b9b437..97ee8017dac8 100644 --- a/drivers/media/dvb/frontends/nxt200x.c +++ b/drivers/media/dvb/frontends/nxt200x.c @@ -1159,8 +1159,7 @@ struct dvb_frontend* nxt200x_attach(const struct nxt200x_config* config, return &state->frontend; error: - if (state) - kfree(state); + kfree(state); printk("Unknown/Unsupported NXT chip: %02X %02X %02X %02X %02X\n", buf[0], buf[1], buf[2], buf[3], buf[4]); return NULL; -- cgit v1.2.2 From f0fa86a574843264bdcbed4c84b41a2778861fde Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 8 Nov 2005 21:35:49 -0800 Subject: [PATCH] dvb: determine tuner write method based on nxt chip - Add support for AVerTVHD MCE a180. - Instead of determining how to write to the tuner based on which NIM is being used, make this determination based on whether the chip is a NXT2002 or NXT2004. - If NXT2004, write directly to tuner. If NXT2002, write through NXT chip. Signed-off-by: Michael Krufky Cc: Johannes Stezenbach Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/dvb/frontends/nxt200x.c | 82 +++++++++++++++++++---------------- 1 file changed, 44 insertions(+), 38 deletions(-) diff --git a/drivers/media/dvb/frontends/nxt200x.c b/drivers/media/dvb/frontends/nxt200x.c index 97ee8017dac8..aee170805caf 100644 --- a/drivers/media/dvb/frontends/nxt200x.c +++ b/drivers/media/dvb/frontends/nxt200x.c @@ -342,50 +342,56 @@ static int nxt200x_writetuner (struct nxt200x_state* state, u8* data) dprintk("Tuner Bytes: %02X %02X %02X %02X\n", data[0], data[1], data[2], data[3]); - /* if pll is a Philips TUV1236D then write directly to tuner */ - if (strcmp(state->config->pll_desc->name, "Philips TUV1236D") == 0) { - if (i2c_writebytes(state, state->config->pll_address, data, 4)) - printk(KERN_WARNING "nxt200x: error writing to tuner\n"); - /* wait until we have a lock */ - while (count < 20) { - i2c_readbytes(state, state->config->pll_address, &buf, 1); - if (buf & 0x40) - return 0; - msleep(100); - count++; - } - printk("nxt200x: timeout waiting for tuner lock\n"); - return 0; - } else { - /* set the i2c transfer speed to the tuner */ - buf = 0x03; - nxt200x_writebytes(state, 0x20, &buf, 1); + /* if NXT2004, write directly to tuner. if NXT2002, write through NXT chip. + * direct write is required for Philips TUV1236D and ALPS TDHU2 */ + switch (state->demod_chip) { + case NXT2004: + if (i2c_writebytes(state, state->config->pll_address, data, 4)) + printk(KERN_WARNING "nxt200x: error writing to tuner\n"); + /* wait until we have a lock */ + while (count < 20) { + i2c_readbytes(state, state->config->pll_address, &buf, 1); + if (buf & 0x40) + return 0; + msleep(100); + count++; + } + printk("nxt2004: timeout waiting for tuner lock\n"); + break; + case NXT2002: + /* set the i2c transfer speed to the tuner */ + buf = 0x03; + nxt200x_writebytes(state, 0x20, &buf, 1); - /* setup to transfer 4 bytes via i2c */ - buf = 0x04; - nxt200x_writebytes(state, 0x34, &buf, 1); + /* setup to transfer 4 bytes via i2c */ + buf = 0x04; + nxt200x_writebytes(state, 0x34, &buf, 1); - /* write actual tuner bytes */ - nxt200x_writebytes(state, 0x36, data, 4); + /* write actual tuner bytes */ + nxt200x_writebytes(state, 0x36, data, 4); - /* set tuner i2c address */ - buf = state->config->pll_address; - nxt200x_writebytes(state, 0x35, &buf, 1); + /* set tuner i2c address */ + buf = state->config->pll_address; + nxt200x_writebytes(state, 0x35, &buf, 1); - /* write UC Opmode to begin transfer */ - buf = 0x80; - nxt200x_writebytes(state, 0x21, &buf, 1); + /* write UC Opmode to begin transfer */ + buf = 0x80; + nxt200x_writebytes(state, 0x21, &buf, 1); - while (count < 20) { - nxt200x_readbytes(state, 0x21, &buf, 1); - if ((buf & 0x80)== 0x00) - return 0; - msleep(100); - count++; - } - printk("nxt200x: timeout error writing tuner\n"); - return 0; + while (count < 20) { + nxt200x_readbytes(state, 0x21, &buf, 1); + if ((buf & 0x80)== 0x00) + return 0; + msleep(100); + count++; + } + printk("nxt2002: timeout error writing tuner\n"); + break; + default: + return -EINVAL; + break; } + return 0; } static void nxt200x_agc_reset(struct nxt200x_state* state) -- cgit v1.2.2 From b3967d6c251d8482fe42a1aad3cc292ee04c0a6b Mon Sep 17 00:00:00 2001 From: Mark Adams Date: Tue, 8 Nov 2005 21:35:50 -0800 Subject: [PATCH] dvb: fix bug in demux that caused lost mpeg sections Fix a bug in the software demux which causes large MPEG sections to be lost when they follow very small sections. The problem happens when two sections begin in the same transport packet. The dvb_demux code resets its buffer only before the first of these sections. This means that when the second (or subsequent) section begins, there is up to 182 bytes of buffer space already used. If the following section is close to the maximum size, it currently won't fit in the (4096-byte) buffer and is thrown away. The fix is simply to enlarge the buffer by the size of one transport packet and correct one usage of the SECFEED_SIZE definition where what is really meant is the maximum size of a section. Signed-off-by: Mark Adams Signed-off-by: Michael Krufky Cc: Johannes Stezenbach Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/dvb/dvb-core/demux.h | 5 ++++- drivers/media/dvb/dvb-core/dvb_demux.c | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/media/dvb/dvb-core/demux.h b/drivers/media/dvb/dvb-core/demux.h index 9719a3b30f78..7d7b0067f228 100644 --- a/drivers/media/dvb/dvb-core/demux.h +++ b/drivers/media/dvb/dvb-core/demux.h @@ -48,8 +48,11 @@ * DMX_MAX_SECFEED_SIZE: Maximum length (in bytes) of a private section feed filter. */ +#ifndef DMX_MAX_SECTION_SIZE +#define DMX_MAX_SECTION_SIZE 4096 +#endif #ifndef DMX_MAX_SECFEED_SIZE -#define DMX_MAX_SECFEED_SIZE 4096 +#define DMX_MAX_SECFEED_SIZE (DMX_MAX_SECTION_SIZE + 188) #endif diff --git a/drivers/media/dvb/dvb-core/dvb_demux.c b/drivers/media/dvb/dvb-core/dvb_demux.c index dc476dda2b71..b4c899b15959 100644 --- a/drivers/media/dvb/dvb-core/dvb_demux.c +++ b/drivers/media/dvb/dvb-core/dvb_demux.c @@ -246,7 +246,7 @@ static int dvb_dmx_swfilter_section_copy_dump(struct dvb_demux_feed *feed, for (n = 0; sec->secbufp + 2 < limit; n++) { seclen = section_length(sec->secbuf); - if (seclen <= 0 || seclen > DMX_MAX_SECFEED_SIZE + if (seclen <= 0 || seclen > DMX_MAX_SECTION_SIZE || seclen + sec->secbufp > limit) return 0; sec->seclen = seclen; -- cgit v1.2.2 From f93cf038d5930810e7e280e70de6e0c07ad959da Mon Sep 17 00:00:00 2001 From: Kirk Lapray Date: Tue, 8 Nov 2005 21:35:51 -0800 Subject: [PATCH] dvb: Remove status check from nxt200x_readreg_multibyte Remove status check from nxt200x_readreg_multibyte, it really shouldn't be necessary. Signed-off-by: Kirk Lapray Signed-off-by: Michael Krufky Cc: Johannes Stezenbach Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/dvb/frontends/nxt200x.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/drivers/media/dvb/frontends/nxt200x.c b/drivers/media/dvb/frontends/nxt200x.c index aee170805caf..4cffe7ad9710 100644 --- a/drivers/media/dvb/frontends/nxt200x.c +++ b/drivers/media/dvb/frontends/nxt200x.c @@ -239,26 +239,16 @@ static int nxt200x_readreg_multibyte (struct nxt200x_state* state, u8 reg, u8* d buf = 0x80; nxt200x_writebytes(state, 0x21, &buf, 1); - /* read status */ - nxt200x_readbytes(state, 0x21, &buf, 1); - - if (buf == 0) - { - /* read the actual data */ - for(i = 0; i < len; i++) { - nxt200x_readbytes(state, 0x36 + i, &data[i], 1); - } - return 0; + /* read the actual data */ + for(i = 0; i < len; i++) { + nxt200x_readbytes(state, 0x36 + i, &data[i], 1); } + return 0; break; default: return -EINVAL; break; } - - printk(KERN_WARNING "nxt200x: Error reading multireg register 0x%02X\n",reg); - - return 0; } static void nxt200x_microcontroller_stop (struct nxt200x_state* state) -- cgit v1.2.2 From f6f4b725461d1f3e2587993b22b0c6fe524d9259 Mon Sep 17 00:00:00 2001 From: Patrick Boettcher Date: Tue, 8 Nov 2005 21:35:52 -0800 Subject: [PATCH] dvb: Add support for the Artec T1 USB2.0 box Adding support for the Artec T1 USB2.0 box (real USB2.0) Signed-off-by: Patrick Boettcher Signed-off-by: Michael Krufky Cc: Johannes Stezenbach Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/dvb/dvb-usb/dibusb-mb.c | 59 ++++++++++++++++++++++++++++++--- drivers/media/dvb/dvb-usb/dibusb.h | 4 ++- drivers/media/dvb/dvb-usb/dvb-usb-ids.h | 5 +++ 3 files changed, 63 insertions(+), 5 deletions(-) diff --git a/drivers/media/dvb/dvb-usb/dibusb-mb.c b/drivers/media/dvb/dvb-usb/dibusb-mb.c index 0058505634a0..aa271a2496d5 100644 --- a/drivers/media/dvb/dvb-usb/dibusb-mb.c +++ b/drivers/media/dvb/dvb-usb/dibusb-mb.c @@ -82,13 +82,15 @@ static int dibusb_tuner_probe_and_attach(struct dvb_usb_device *d) static struct dvb_usb_properties dibusb1_1_properties; static struct dvb_usb_properties dibusb1_1_an2235_properties; static struct dvb_usb_properties dibusb2_0b_properties; +static struct dvb_usb_properties artec_t1_usb2_properties; static int dibusb_probe(struct usb_interface *intf, const struct usb_device_id *id) { if (dvb_usb_device_init(intf,&dibusb1_1_properties,THIS_MODULE,NULL) == 0 || dvb_usb_device_init(intf,&dibusb1_1_an2235_properties,THIS_MODULE,NULL) == 0 || - dvb_usb_device_init(intf,&dibusb2_0b_properties,THIS_MODULE,NULL) == 0) + dvb_usb_device_init(intf,&dibusb2_0b_properties,THIS_MODULE,NULL) == 0 || + dvb_usb_device_init(intf,&artec_t1_usb2_properties,THIS_MODULE,NULL) == 0) return 0; return -EINVAL; @@ -128,10 +130,13 @@ static struct usb_device_id dibusb_dib3000mb_table [] = { /* 27 */ { USB_DEVICE(USB_VID_KWORLD, USB_PID_KWORLD_VSTREAM_COLD) }, +/* 28 */ { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_USB2_COLD) }, +/* 29 */ { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_USB2_WARM) }, + // #define DVB_USB_DIBUSB_MB_FAULTY_USB_IDs #ifdef DVB_USB_DIBUSB_MB_FAULTY_USB_IDs -/* 28 */ { USB_DEVICE(USB_VID_ANCHOR, USB_PID_ULTIMA_TVBOX_ANCHOR_COLD) }, +/* 30 */ { USB_DEVICE(USB_VID_ANCHOR, USB_PID_ULTIMA_TVBOX_ANCHOR_COLD) }, #endif { } /* Terminating entry */ }; @@ -264,7 +269,7 @@ static struct dvb_usb_properties dibusb1_1_an2235_properties = { }, #ifdef DVB_USB_DIBUSB_MB_FAULTY_USB_IDs { "Artec T1 USB1.1 TVBOX with AN2235 (faulty USB IDs)", - { &dibusb_dib3000mb_table[28], NULL }, + { &dibusb_dib3000mb_table[30], NULL }, { NULL }, }, #endif @@ -273,7 +278,7 @@ static struct dvb_usb_properties dibusb1_1_an2235_properties = { static struct dvb_usb_properties dibusb2_0b_properties = { .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_PID_FILTER_CAN_BE_TURNED_OFF | DVB_USB_IS_AN_I2C_ADAPTER, - .pid_filter_count = 32, + .pid_filter_count = 16, .usb_ctrl = CYPRESS_FX2, @@ -321,6 +326,52 @@ static struct dvb_usb_properties dibusb2_0b_properties = { } }; +static struct dvb_usb_properties artec_t1_usb2_properties = { + .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_PID_FILTER_CAN_BE_TURNED_OFF | DVB_USB_IS_AN_I2C_ADAPTER, + .pid_filter_count = 16, + + .usb_ctrl = CYPRESS_FX2, + + .firmware = "dvb-usb-dibusb-6.0.0.8.fw", + + .size_of_priv = sizeof(struct dibusb_state), + + .streaming_ctrl = dibusb2_0_streaming_ctrl, + .pid_filter = dibusb_pid_filter, + .pid_filter_ctrl = dibusb_pid_filter_ctrl, + .power_ctrl = dibusb2_0_power_ctrl, + .frontend_attach = dibusb_dib3000mb_frontend_attach, + .tuner_attach = dibusb_tuner_probe_and_attach, + + .rc_interval = DEFAULT_RC_INTERVAL, + .rc_key_map = dibusb_rc_keys, + .rc_key_map_size = 63, /* wow, that is ugly ... I want to load it to the driver dynamically */ + .rc_query = dibusb_rc_query, + + .i2c_algo = &dibusb_i2c_algo, + + .generic_bulk_ctrl_endpoint = 0x01, + /* parameter for the MPEG2-data transfer */ + .urb = { + .type = DVB_USB_BULK, + .count = 7, + .endpoint = 0x06, + .u = { + .bulk = { + .buffersize = 4096, + } + } + }, + + .num_device_descs = 1, + .devices = { + { "Artec T1 USB2.0", + { &dibusb_dib3000mb_table[28], NULL }, + { &dibusb_dib3000mb_table[29], NULL }, + }, + } +}; + static struct usb_driver dibusb_driver = { .owner = THIS_MODULE, .name = "dvb_usb_dibusb_mb", diff --git a/drivers/media/dvb/dvb-usb/dibusb.h b/drivers/media/dvb/dvb-usb/dibusb.h index 6611f62977c0..2d99d05c7eab 100644 --- a/drivers/media/dvb/dvb-usb/dibusb.h +++ b/drivers/media/dvb/dvb-usb/dibusb.h @@ -11,7 +11,9 @@ #ifndef _DVB_USB_DIBUSB_H_ #define _DVB_USB_DIBUSB_H_ -#define DVB_USB_LOG_PREFIX "dibusb" +#ifndef DVB_USB_LOG_PREFIX + #define DVB_USB_LOG_PREFIX "dibusb" +#endif #include "dvb-usb.h" #include "dib3000.h" diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h index 0818996bf150..6be99e537e12 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h @@ -43,10 +43,14 @@ #define USB_PID_COMPRO_DVBU2000_WARM 0xd001 #define USB_PID_COMPRO_DVBU2000_UNK_COLD 0x010c #define USB_PID_COMPRO_DVBU2000_UNK_WARM 0x010d +#define USB_PID_DIBCOM_HOOK_DEFAULT 0x0064 +#define USB_PID_DIBCOM_HOOK_DEFAULT_REENUM 0x0065 #define USB_PID_DIBCOM_MOD3000_COLD 0x0bb8 #define USB_PID_DIBCOM_MOD3000_WARM 0x0bb9 #define USB_PID_DIBCOM_MOD3001_COLD 0x0bc6 #define USB_PID_DIBCOM_MOD3001_WARM 0x0bc7 +#define USB_PID_DIBCOM_STK7700 0x1e14 +#define USB_PID_DIBCOM_STK7700_REENUM 0x1e15 #define USB_PID_DIBCOM_ANCHOR_2135_COLD 0x2131 #define USB_PID_GRANDTEC_DVBT_USB_COLD 0x0fa0 #define USB_PID_GRANDTEC_DVBT_USB_WARM 0x0fa1 @@ -68,6 +72,7 @@ #define USB_PID_ULTIMA_TVBOX_AN2235_WARM 0x8108 #define USB_PID_ULTIMA_TVBOX_ANCHOR_COLD 0x2235 #define USB_PID_ULTIMA_TVBOX_USB2_COLD 0x8109 +#define USB_PID_ULTIMA_TVBOX_USB2_WARM 0x810a #define USB_PID_ULTIMA_TVBOX_USB2_FX_COLD 0x8613 #define USB_PID_ULTIMA_TVBOX_USB2_FX_WARM 0x1002 #define USB_PID_UNK_HYPER_PALTEK_COLD 0x005e -- cgit v1.2.2 From de122dfda505e693f75e73628e026e4f6250ede7 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 8 Nov 2005 21:35:53 -0800 Subject: [PATCH] dvb: documentation updates for hybrid v4l/dvb cards Updated documentation to include "hybrid" v4l/dvb and ATSC cards. Signed-off-by: Michael Krufky Cc: Johannes Stezenbach Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/dvb/cards.txt | 37 +++++++++++++++++++++++++++++++++++++ Documentation/dvb/contributors.txt | 17 +++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/Documentation/dvb/cards.txt b/Documentation/dvb/cards.txt index efdc4ee9d40c..19329cf7b097 100644 --- a/Documentation/dvb/cards.txt +++ b/Documentation/dvb/cards.txt @@ -41,6 +41,12 @@ o Frontends drivers: - dib3000mb : DiBcom 3000-MB demodulator DVB-S/C/T: - dst : TwinHan DST Frontend + ATSC: + - nxt200x : Nxtwave NXT2002 & NXT2004 + - or51211 : or51211 based (pcHDTV HD2000 card) + - or51132 : or51132 based (pcHDTV HD3000 card) + - bcm3510 : Broadcom BCM3510 + - lgdt330x : LG Electronics DT3302 & DT3303 o Cards based on the Phillips saa7146 multimedia PCI bridge chip: @@ -62,6 +68,10 @@ o Cards based on the Conexant Bt8xx PCI bridge: - Nebula Electronics DigiTV - TwinHan DST - Avermedia DVB-T + - ChainTech digitop DST-1000 DVB-S + - pcHDTV HD-2000 TV + - DViCO FusionHDTV DVB-T Lite + - DViCO FusionHDTV5 Lite o Technotrend / Hauppauge DVB USB devices: - Nova USB @@ -83,3 +93,30 @@ o DiBcom DVB-T USB based devices: - DiBcom USB2.0 DVB-T reference device (non-public) o Experimental support for the analog module of the Siemens DVB-C PCI card + +o Cards based on the Conexant cx2388x PCI bridge: + - ADS Tech Instant TV DVB-T PCI + - ATI HDTV Wonder + - digitalnow DNTV Live! DVB-T + - DViCO FusionHDTV DVB-T1 + - DViCO FusionHDTV DVB-T Plus + - DViCO FusionHDTV3 Gold-Q + - DViCO FusionHDTV3 Gold-T + - DViCO FusionHDTV5 Gold + - Hauppauge Nova-T DVB-T + - KWorld/VStream XPert DVB-T + - pcHDTV HD3000 HDTV + - TerraTec Cinergy 1400 DVB-T + - WinFast DTV1000-T + +o Cards based on the Phillips saa7134 PCI bridge: + - Medion 7134 + - Pinnacle PCTV 300i DVB-T + PAL + - LifeView FlyDVB-T DUO + - Typhoon DVB-T Duo Digital/Analog Cardbus + - Philips TOUGH DVB-T reference design + - Philips EUROPA V3 reference design + - Compro Videomate DVB-T300 + - Compro Videomate DVB-T200 + - AVerMedia AVerTVHD MCE A180 + diff --git a/Documentation/dvb/contributors.txt b/Documentation/dvb/contributors.txt index c9d5ce370701..2cbd2d0f6fdf 100644 --- a/Documentation/dvb/contributors.txt +++ b/Documentation/dvb/contributors.txt @@ -75,5 +75,22 @@ Ernst Peinlich Peter Beutner for the IR code for the ttusb-dec driver +Wilson Michaels + for the lgdt330x frontend driver, and various bugfixes + +Michael Krufky + for maintaining v4l/dvb inter-tree dependencies + +Taylor Jacob + for the nxt2002 frontend driver + +Jean-Francois Thibert + for the nxt2004 frontend driver + +Kirk Lapray + for the or51211 and or51132 frontend drivers, and + for merging the nxt2002 and nxt2004 modules into a + single nxt200x frontend driver. + (If you think you should be in this list, but you are not, drop a line to the DVB mailing list) -- cgit v1.2.2 From d371d6a04c6b50125e8dbf9a2234cc694f6e3cdf Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Tue, 8 Nov 2005 21:35:54 -0800 Subject: [PATCH] dvb-usb-urb printk fix drivers/media/dvb/dvb-usb/dvb-usb-urb.c: In function `dvb_usb_allocate_stream_buffers': drivers/media/dvb/dvb-usb/dvb-usb-urb.c:199: warning: int format, different type arg (arg 4) Don't assume that dma_addr_t is 32-bit. (dvb has quite a few such warnings. Please compile it with a 64-bit compiler, fix them up - some are oopsable). Cc: Johannes Stezenbach Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/dvb/dvb-usb/dvb-usb-urb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-urb.c b/drivers/media/dvb/dvb-usb/dvb-usb-urb.c index f5799a4c228e..36b7048c02d2 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-urb.c +++ b/drivers/media/dvb/dvb-usb/dvb-usb-urb.c @@ -196,7 +196,9 @@ static int dvb_usb_allocate_stream_buffers(struct dvb_usb_device *d, int num, un dvb_usb_free_stream_buffers(d); return -ENOMEM; } - deb_mem("buffer %d: %p (dma: %d)\n",d->buf_num,d->buf_list[d->buf_num],d->dma_addr[d->buf_num]); + deb_mem("buffer %d: %p (dma: %llu)\n", + d->buf_num, d->buf_list[d->buf_num], + (unsigned long long)d->dma_addr[d->buf_num]); memset(d->buf_list[d->buf_num],0,size); } deb_mem("allocation successful\n"); -- cgit v1.2.2 From 66944e998a7e1164895e9bd7cae9f841a9f46ef5 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 8 Nov 2005 21:35:55 -0800 Subject: [PATCH] dvb: lgdt330x: Correct QAM symbol_rate_min for lgdt3302 and lgdt3303 Correct QAM symbol_rate_min for lgdt3302 and lgdt3303 Thanks to: Mac Michaels and Steve Malenfant Signed-off-by: Mac Michaels Signed-off-by: Michael Krufky Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/dvb/frontends/lgdt330x.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/media/dvb/frontends/lgdt330x.c b/drivers/media/dvb/frontends/lgdt330x.c index 10fc4e7878af..6a33f5a19a8d 100644 --- a/drivers/media/dvb/frontends/lgdt330x.c +++ b/drivers/media/dvb/frontends/lgdt330x.c @@ -755,9 +755,8 @@ static struct dvb_frontend_ops lgdt3302_ops = { .frequency_min= 54000000, .frequency_max= 858000000, .frequency_stepsize= 62500, - /* Symbol rate is for all VSB modes need to check QAM */ - .symbol_rate_min = 10762000, - .symbol_rate_max = 10762000, + .symbol_rate_min = 5056941, /* QAM 64 */ + .symbol_rate_max = 10762000, /* VSB 8 */ .caps = FE_CAN_QAM_64 | FE_CAN_QAM_256 | FE_CAN_8VSB }, .init = lgdt330x_init, @@ -779,9 +778,8 @@ static struct dvb_frontend_ops lgdt3303_ops = { .frequency_min= 54000000, .frequency_max= 858000000, .frequency_stepsize= 62500, - /* Symbol rate is for all VSB modes need to check QAM */ - .symbol_rate_min = 10762000, - .symbol_rate_max = 10762000, + .symbol_rate_min = 5056941, /* QAM 64 */ + .symbol_rate_max = 10762000, /* VSB 8 */ .caps = FE_CAN_QAM_64 | FE_CAN_QAM_256 | FE_CAN_8VSB }, .init = lgdt330x_init, -- cgit v1.2.2 From 496157d089c3caeda35017833ea3bb895f29ed15 Mon Sep 17 00:00:00 2001 From: Kirk Lapray Date: Tue, 8 Nov 2005 21:35:55 -0800 Subject: [PATCH] dvb: nxt200x: Fix typo in Makefile for nxt200x - Fix Typo: Change CONFIG_DVB_NXT2002 to CONFIG_DVB_NXT200X for the nxt200x module. Signed-off-by: Kirk Lapray Signed-off-by: Michael Krufky Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/dvb/frontends/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/dvb/frontends/Makefile b/drivers/media/dvb/frontends/Makefile index 1692ee65ba5d..a98760fe08a1 100644 --- a/drivers/media/dvb/frontends/Makefile +++ b/drivers/media/dvb/frontends/Makefile @@ -26,7 +26,7 @@ obj-$(CONFIG_DVB_TDA80XX) += tda80xx.o obj-$(CONFIG_DVB_TDA10021) += tda10021.o obj-$(CONFIG_DVB_STV0297) += stv0297.o obj-$(CONFIG_DVB_NXT2002) += nxt2002.o -obj-$(CONFIG_DVB_NXT2002) += nxt200x.o +obj-$(CONFIG_DVB_NXT200X) += nxt200x.o obj-$(CONFIG_DVB_OR51211) += or51211.o obj-$(CONFIG_DVB_OR51132) += or51132.o obj-$(CONFIG_DVB_BCM3510) += bcm3510.o -- cgit v1.2.2 From cc952d03c0c36ec9a4c2a683015dbb98e8a889df Mon Sep 17 00:00:00 2001 From: Kirk Lapray Date: Tue, 8 Nov 2005 21:36:02 -0800 Subject: [PATCH] dvb: nxt200x: Add function for nxt200x to change pll input - Added function for nxt200x to change pll input - For VSB set to input 0, for QAM set to input 1 - will only be set for cards that have set_pll_input defined Signed-off-by: Kirk Lapray Signed-off-by: Michael Krufky Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/dvb/frontends/nxt200x.c | 9 +++++++-- drivers/media/dvb/frontends/nxt200x.h | 3 +++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/media/dvb/frontends/nxt200x.c b/drivers/media/dvb/frontends/nxt200x.c index 4cffe7ad9710..bad0933eb714 100644 --- a/drivers/media/dvb/frontends/nxt200x.c +++ b/drivers/media/dvb/frontends/nxt200x.c @@ -556,13 +556,18 @@ static int nxt200x_setup_frontend_parameters (struct dvb_frontend* fe, if (state->config->set_ts_params) state->config->set_ts_params(fe, 1); - /* set to use cable input */ - buf[3] |= 0x08; + /* set input */ + if (state->config->set_pll_input) + state->config->set_pll_input(buf, 1); break; case VSB_8: /* Set non-punctured clock for VSB */ if (state->config->set_ts_params) state->config->set_ts_params(fe, 0); + + /* set input */ + if (state->config->set_pll_input) + state->config->set_pll_input(buf, 0); break; default: return -EINVAL; diff --git a/drivers/media/dvb/frontends/nxt200x.h b/drivers/media/dvb/frontends/nxt200x.h index 8dc3f03ecdf7..1d9d70bc37ef 100644 --- a/drivers/media/dvb/frontends/nxt200x.h +++ b/drivers/media/dvb/frontends/nxt200x.h @@ -42,6 +42,9 @@ struct nxt200x_config u8 pll_address; struct dvb_pll_desc *pll_desc; + /* used to set pll input */ + int (*set_pll_input)(u8* buf, int input); + /* need to set device param for start_dma */ int (*set_ts_params)(struct dvb_frontend* fe, int is_punctured); }; -- cgit v1.2.2 From 2d14f78e4bfa55e5a534cc4c03ddab8841a1b32e Mon Sep 17 00:00:00 2001 From: Glen Gray Date: Tue, 8 Nov 2005 21:36:12 -0800 Subject: [PATCH] v4l: 627: added support for oem version of flytv platinum mini with a - Added support for OEM version of FlyTV Platinum mini with a subvendor id of 0x4e42. - Added the OEM PCI id's to the docs/CARDLIST.saa7134 for item 39 - Modified the vmux in the SAA7134_BOARD_FLYTVPLATINUM_MINI driver data from 0 (Composite over S-Video) to 3 (Composite). Signed-off-by: Glen Gray Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/video4linux/CARDLIST.saa7134 | 2 +- drivers/media/video/saa7134/saa7134-cards.c | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134 index dc57225f39be..33b6cf9bc1b9 100644 --- a/Documentation/video4linux/CARDLIST.saa7134 +++ b/Documentation/video4linux/CARDLIST.saa7134 @@ -37,7 +37,7 @@ 36 -> UPMOST PURPLE TV [12ab:0800] 37 -> Items MuchTV Plus / IT-005 38 -> Terratec Cinergy 200 TV [153B:1152] - 39 -> LifeView FlyTV Platinum Mini [5168:0212] + 39 -> LifeView FlyTV Platinum Mini [5168:0212,4e42:0212] 40 -> Compro VideoMate TV PVR/FM [185b:c100] 41 -> Compro VideoMate TV Gold+ [185b:c100] 42 -> Sabrent SBT-TVFM (saa7130) diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index acc7a4335e23..a67a0a11c6db 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c @@ -191,9 +191,13 @@ struct saa7134_board saa7134_boards[] = { .amux = TV, .tv = 1, },{ - .name = name_comp1, + .name = name_comp1, /* Composite signal on S-Video input */ .vmux = 0, .amux = LINE2, + },{ + .name = name_comp2, /* Composite input */ + .vmux = 3, + .amux = LINE2, },{ .name = name_svideo, .vmux = 8, @@ -2190,6 +2194,12 @@ struct pci_device_id saa7134_pci_tbl[] = { .subvendor = 0x5168, .subdevice = 0x0212, /* minipci, LR212 */ .driver_data = SAA7134_BOARD_FLYTVPLATINUM_MINI, + },{ + .vendor = PCI_VENDOR_ID_PHILIPS, + .device = PCI_DEVICE_ID_PHILIPS_SAA7133, + .subvendor = 0x4e42, + .subdevice = 0x0212, /* OEM minipci, LR212 */ + .driver_data = SAA7134_BOARD_FLYTVPLATINUM_MINI, },{ .vendor = PCI_VENDOR_ID_PHILIPS, .device = PCI_DEVICE_ID_PHILIPS_SAA7133, -- cgit v1.2.2 From d45170ed6731a55885386f0e8d04578f77d3045d Mon Sep 17 00:00:00 2001 From: "Nickolay V. Shmyrev" Date: Tue, 8 Nov 2005 21:36:15 -0800 Subject: [PATCH] v4l: 628: added new avermedia card 550 - Added new Avermedia card 550 Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/video4linux/CARDLIST.cx88 | 1 + drivers/media/video/cx88/cx88-cards.c | 31 +++++++++++++++++++++++++++++++ drivers/media/video/cx88/cx88.h | 1 + 3 files changed, 33 insertions(+) diff --git a/Documentation/video4linux/CARDLIST.cx88 b/Documentation/video4linux/CARDLIST.cx88 index 03deb0726aa4..fa7e38567d86 100644 --- a/Documentation/video4linux/CARDLIST.cx88 +++ b/Documentation/video4linux/CARDLIST.cx88 @@ -30,3 +30,4 @@ card=28 - DViCO FusionHDTV 3 Gold-T card=29 - ADS Tech Instant TV DVB-T PCI card=30 - TerraTec Cinergy 1400 DVB-T card=31 - DViCO FusionHDTV 5 Gold +card=32 - AverMedia UltraTV Media Center PCI 550 diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c index 4da91d535a5b..8d840afc745d 100644 --- a/drivers/media/video/cx88/cx88-cards.c +++ b/drivers/media/video/cx88/cx88-cards.c @@ -776,6 +776,33 @@ struct cx88_board cx88_boards[] = { }}, .dvb = 1, }, + [CX88_BOARD_AVERMEDIA_ULTRATV_MC_550] = { + .name = "AverMedia UltraTV Media Center PCI 550", + .tuner_type = TUNER_PHILIPS_FM1236_MK3, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .tda9887_conf = TDA9887_PRESENT, + .blackbird = 1, + .input = {{ + .type = CX88_VMUX_COMPOSITE1, + .vmux = 0, + .gpio0 = 0x0000cd73, + },{ + .type = CX88_VMUX_SVIDEO, + .vmux = 1, + .gpio0 = 0x0000cd73, + },{ + .type = CX88_VMUX_TELEVISION, + .vmux = 3, + .gpio0 = 0x0000cdb3, + }}, + .radio = { + .type = CX88_RADIO, + .vmux = 2, + .gpio0 = 0x0000cdf3, + }, + }, }; const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards); @@ -907,6 +934,10 @@ struct cx88_subid cx88_subids[] = { .subvendor = 0x18ac, .subdevice = 0xd500, .card = CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD, + },{ + .subvendor = 0x1461, + .subdevice = 0x8011, + .card = CX88_BOARD_AVERMEDIA_ULTRATV_MC_550, }, }; const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids); diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h index f48dd4353568..88050a0043ab 100644 --- a/drivers/media/video/cx88/cx88.h +++ b/drivers/media/video/cx88/cx88.h @@ -174,6 +174,7 @@ extern struct sram_channel cx88_sram_channels[]; #define CX88_BOARD_ADSTECH_DVB_T_PCI 29 #define CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1 30 #define CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD 31 +#define CX88_BOARD_AVERMEDIA_ULTRATV_MC_550 32 enum cx88_itype { CX88_VMUX_COMPOSITE1 = 1, -- cgit v1.2.2 From a8ff417e7310c63b890cbd94c67043ec153f8709 Mon Sep 17 00:00:00 2001 From: "Nickolay V. Shmyrev" Date: Tue, 8 Nov 2005 21:36:16 -0800 Subject: [PATCH] v4l: 629: added behold tv 409 fm - Added Behold TV 409 FM Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/video4linux/CARDLIST.saa7134 | 1 + drivers/media/video/saa7134/saa7134-cards.c | 36 ++++++++++++++++++++++++++++- drivers/media/video/saa7134/saa7134-input.c | 1 + drivers/media/video/saa7134/saa7134.h | 1 + 4 files changed, 38 insertions(+), 1 deletion(-) diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134 index 33b6cf9bc1b9..24a04af5d4b0 100644 --- a/Documentation/video4linux/CARDLIST.saa7134 +++ b/Documentation/video4linux/CARDLIST.saa7134 @@ -65,3 +65,4 @@ 64 -> FlyTV mini Asus Digimatrix [1043:0210,1043:0210] 65 -> V-Stream Studio TV Terminator 66 -> Yuan TUN-900 (saa7135) + 67 -> Beholder BeholdTV 409 FM [0000:4091] diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index a67a0a11c6db..9491999e6329 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c @@ -2113,9 +2113,36 @@ struct saa7134_board saa7134_boards[] = { .gpio = 0x01, }, }, + [SAA7134_BOARD_BEHOLD_409FM] = { + /* , Sergey */ + .name = "Beholder BeholdTV 409 FM", + .audio_clock = 0x00187de7, + .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .tda9887_conf = TDA9887_PRESENT, + .inputs = {{ + .name = name_tv, + .vmux = 3, + .amux = TV, + .tv = 1, + },{ + .name = name_comp1, + .vmux = 1, + .amux = LINE1, + },{ + .name = name_svideo, + .vmux = 8, + .amux = LINE1, + }}, + .radio = { + .name = name_radio, + .amux = LINE2, + }, + }, }; - const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards); /* ------------------------------------------------------------------ */ @@ -2472,6 +2499,12 @@ struct pci_device_id saa7134_pci_tbl[] = { .driver_data = SAA7134_BOARD_FLYTV_DIGIMATRIX, },{ + .vendor = PCI_VENDOR_ID_PHILIPS, + .device = PCI_DEVICE_ID_PHILIPS_SAA7133, + .subvendor = 0x0000, /* It shouldn't break anything, since subdevice id seems unique */ + .subdevice = 0x4091, + .driver_data = SAA7134_BOARD_BEHOLD_409FM, + },{ /* --- boards without eeprom + subsystem ID --- */ .vendor = PCI_VENDOR_ID_PHILIPS, .device = PCI_DEVICE_ID_PHILIPS_SAA7134, @@ -2562,6 +2595,7 @@ int saa7134_board_init1(struct saa7134_dev *dev) case SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII: case SAA7134_BOARD_MANLI_MTV001: case SAA7134_BOARD_MANLI_MTV002: + case SAA7134_BOARD_BEHOLD_409FM: case SAA7134_BOARD_AVACSSMARTTV: dev->has_remote = 1; break; diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index 242cb235cf92..8e2cc9d75cd5 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -516,6 +516,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) break; case SAA7134_BOARD_MANLI_MTV001: case SAA7134_BOARD_MANLI_MTV002: + case SAA7134_BOARD_BEHOLD_409FM: ir_codes = manli_codes; mask_keycode = 0x001f00; mask_keyup = 0x004000; diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index 860b89530e2a..45fe6af1eccb 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h @@ -187,6 +187,7 @@ struct saa7134_format { #define SAA7134_BOARD_FLYTV_DIGIMATRIX 64 #define SAA7134_BOARD_KWORLD_TERMINATOR 65 #define SAA7134_BOARD_YUAN_TUN900 66 +#define SAA7134_BOARD_BEHOLD_409FM 67 #define SAA7134_MAXBOARDS 8 #define SAA7134_INPUT_MAX 8 -- cgit v1.2.2 From 7df64e8c9cee596c2609c99b0ca1ebb6ae2d5b1d Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 8 Nov 2005 21:36:16 -0800 Subject: [PATCH] v4l: 630: capitalized hex a f changed to lowercase in pci subsystem id constants - Capitalized hex A-F changed to lowercase in pci subsystem id constants Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/video4linux/CARDLIST.saa7134 | 8 ++++---- drivers/media/video/cx88/cx88-cards.c | 14 +++++++------- drivers/media/video/saa7134/saa7134-cards.c | 8 ++++---- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134 index 24a04af5d4b0..f31c2f8e4048 100644 --- a/Documentation/video4linux/CARDLIST.saa7134 +++ b/Documentation/video4linux/CARDLIST.saa7134 @@ -6,10 +6,10 @@ 5 -> SKNet Monster TV [1131:4e85] 6 -> Tevion MD 9717 7 -> KNC One TV-Station RDS / Typhoon TV Tuner RDS [1131:fe01,1894:fe01] - 8 -> Terratec Cinergy 400 TV [153B:1142] + 8 -> Terratec Cinergy 400 TV [153b:1142] 9 -> Medion 5044 10 -> Kworld/KuroutoShikou SAA7130-TVPCI - 11 -> Terratec Cinergy 600 TV [153B:1143] + 11 -> Terratec Cinergy 600 TV [153b:1143] 12 -> Medion 7134 [16be:0003] 13 -> Typhoon TV+Radio 90031 14 -> ELSA EX-VISION 300TV [1048:226b] @@ -36,7 +36,7 @@ 35 -> AverMedia AverTV Studio 305 [1461:2115] 36 -> UPMOST PURPLE TV [12ab:0800] 37 -> Items MuchTV Plus / IT-005 - 38 -> Terratec Cinergy 200 TV [153B:1152] + 38 -> Terratec Cinergy 200 TV [153b:1152] 39 -> LifeView FlyTV Platinum Mini [5168:0212,4e42:0212] 40 -> Compro VideoMate TV PVR/FM [185b:c100] 41 -> Compro VideoMate TV Gold+ [185b:c100] @@ -46,7 +46,7 @@ 45 -> Avermedia AVerTV Studio 307 [1461:9715] 46 -> AVerMedia Cardbus TV/Radio (E500) [1461:d6ee] 47 -> Terratec Cinergy 400 mobile [153b:1162] - 48 -> Terratec Cinergy 600 TV MK3 [153B:1158] + 48 -> Terratec Cinergy 600 TV MK3 [153b:1158] 49 -> Compro VideoMate Gold+ Pal [185b:c200] 50 -> Pinnacle PCTV 300i DVB-T + PAL [11bd:002d] 51 -> ProVideo PV952 [1540:9524] diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c index 8d840afc745d..5a85802047f9 100644 --- a/drivers/media/video/cx88/cx88-cards.c +++ b/drivers/media/video/cx88/cx88-cards.c @@ -879,8 +879,8 @@ struct cx88_subid cx88_subids[] = { .subdevice = 0xd820, .card = CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T, },{ - .subvendor = 0x18AC, - .subdevice = 0xDB00, + .subvendor = 0x18ac, + .subdevice = 0xdb00, .card = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1, },{ .subvendor = 0x0070, @@ -895,8 +895,8 @@ struct cx88_subid cx88_subids[] = { .subdevice = 0x2580, .card = CX88_BOARD_PROVIDEO_PV259, },{ - .subvendor = 0x18AC, - .subdevice = 0xDB10, + .subvendor = 0x18ac, + .subdevice = 0xdb10, .card = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS, },{ .subvendor = 0x1554, @@ -907,15 +907,15 @@ struct cx88_subid cx88_subids[] = { .subdevice = 0x3000, /* HD-3000 card */ .card = CX88_BOARD_PCHDTV_HD3000, },{ - .subvendor = 0x17DE, - .subdevice = 0xA8A6, + .subvendor = 0x17de, + .subdevice = 0xa8a6, .card = CX88_BOARD_DNTV_LIVE_DVB_T, },{ .subvendor = 0x0070, .subdevice = 0x2801, .card = CX88_BOARD_HAUPPAUGE_ROSLYN, },{ - .subvendor = 0x14F1, + .subvendor = 0x14f1, .subdevice = 0x0342, .card = CX88_BOARD_DIGITALLOGIC_MEC, },{ diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index 9491999e6329..bca5b7038a8c 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c @@ -2176,19 +2176,19 @@ struct pci_device_id saa7134_pci_tbl[] = { },{ .vendor = PCI_VENDOR_ID_PHILIPS, .device = PCI_DEVICE_ID_PHILIPS_SAA7134, - .subvendor = 0x153B, + .subvendor = 0x153b, .subdevice = 0x1142, .driver_data = SAA7134_BOARD_CINERGY400, },{ .vendor = PCI_VENDOR_ID_PHILIPS, .device = PCI_DEVICE_ID_PHILIPS_SAA7134, - .subvendor = 0x153B, + .subvendor = 0x153b, .subdevice = 0x1143, .driver_data = SAA7134_BOARD_CINERGY600, },{ .vendor = PCI_VENDOR_ID_PHILIPS, .device = PCI_DEVICE_ID_PHILIPS_SAA7134, - .subvendor = 0x153B, + .subvendor = 0x153b, .subdevice = 0x1158, .driver_data = SAA7134_BOARD_CINERGY600_MK3, },{ @@ -2406,7 +2406,7 @@ struct pci_device_id saa7134_pci_tbl[] = { },{ .vendor = PCI_VENDOR_ID_PHILIPS, .device = PCI_DEVICE_ID_PHILIPS_SAA7130, - .subvendor = 0x153B, + .subvendor = 0x153b, .subdevice = 0x1152, .driver_data = SAA7134_BOARD_CINERGY200, },{ -- cgit v1.2.2 From 31629424132c87f7c8bd79d7ed4d014354a06427 Mon Sep 17 00:00:00 2001 From: Catalin Climov Date: Tue, 8 Nov 2005 21:36:17 -0800 Subject: [PATCH] v4l: 631: implemented the v4l2 mpeg api for blackbird cards - Implemented the v4l2 mpeg api for blackbird cards. Signed-off-by: Catalin Climov Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/cx88/cx88-blackbird.c | 638 +++++++++++++++++++++++++++--- drivers/media/video/cx88/cx88-mpeg.c | 7 +- drivers/media/video/cx88/cx88-video.c | 2 - drivers/media/video/cx88/cx88.h | 19 +- 4 files changed, 595 insertions(+), 71 deletions(-) diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c index 0c0c59e94774..eca36b8539fa 100644 --- a/drivers/media/video/cx88/cx88-blackbird.c +++ b/drivers/media/video/cx88/cx88-blackbird.c @@ -38,7 +38,7 @@ MODULE_AUTHOR("Jelle Foks "); MODULE_AUTHOR("Gerd Knorr [SuSE Labs]"); MODULE_LICENSE("GPL"); -static unsigned int mpegbufs = 8; +static unsigned int mpegbufs = 32; module_param(mpegbufs,int,0644); MODULE_PARM_DESC(mpegbufs,"number of mpeg buffers, range 2-32"); @@ -683,84 +683,553 @@ DB* DVD | MPEG2 | 720x576PAL | CBR | 600 :Good | 6000 Kbps | 25fps | M ================================================================================================================= *DB: "DirectBurn" */ -static void blackbird_codec_settings(struct cx8802_dev *dev) + +static struct blackbird_dnr default_dnr_params = { + .mode = BLACKBIRD_DNR_BITS_MANUAL, + .type = BLACKBIRD_MEDIAN_FILTER_DISABLED, + .spatial = 0, + .temporal = 0 +}; +static struct v4l2_mpeg_compression default_mpeg_params = { + .st_type = V4L2_MPEG_PS_2, + .st_bitrate = { + .mode = V4L2_BITRATE_CBR, + .min = 0, + .target = 0, + .max = 0 + }, + .ts_pid_pmt = 16, + .ts_pid_audio = 260, + .ts_pid_video = 256, + .ts_pid_pcr = 259, + .ps_size = 0, + .au_type = V4L2_MPEG_AU_2_II, + .au_bitrate = { + .mode = V4L2_BITRATE_CBR, + .min = 224, + .target = 224, + .max = 224 + }, + .au_sample_rate = 44100, + .au_pesid = 0, + .vi_type = V4L2_MPEG_VI_2, + .vi_aspect_ratio = V4L2_MPEG_ASPECT_4_3, + .vi_bitrate = { + .mode = V4L2_BITRATE_CBR, + .min = 4000, + .target = 4500, + .max = 6000 + }, + .vi_frame_rate = 25, + .vi_frames_per_gop = 15, + .vi_bframes_count = 2, + .vi_pesid = 0, + .closed_gops = 0, + .pulldown = 0 +}; + +static enum blackbird_stream_type mpeg_stream_types[] = { + [V4L2_MPEG_SS_1] = BLACKBIRD_STREAM_MPEG1, + [V4L2_MPEG_PS_2] = BLACKBIRD_STREAM_PROGRAM, + [V4L2_MPEG_TS_2] = BLACKBIRD_STREAM_TRANSPORT, + [V4L2_MPEG_PS_DVD] = BLACKBIRD_STREAM_DVD, +}; +static enum blackbird_aspect_ratio mpeg_stream_ratios[] = { + [V4L2_MPEG_ASPECT_SQUARE] = BLACKBIRD_ASPECT_RATIO_1_1_SQUARE, + [V4L2_MPEG_ASPECT_4_3] = BLACKBIRD_ASPECT_RATIO_4_3, + [V4L2_MPEG_ASPECT_16_9] = BLACKBIRD_ASPECT_RATIO_16_9, + [V4L2_MPEG_ASPECT_1_221] = BLACKBIRD_ASPECT_RATIO_221_100, +}; +static enum blackbird_video_bitrate_type mpeg_video_bitrates[] = { + [V4L2_BITRATE_NONE] = BLACKBIRD_VIDEO_CBR, + [V4L2_BITRATE_CBR] = BLACKBIRD_VIDEO_CBR, + [V4L2_BITRATE_VBR] = BLACKBIRD_VIDEO_VBR, +}; +/* find the best layer I/II bitrate to fit a given numeric value */ +struct bitrate_bits { + u32 bits; /* layer bits for the best fit */ + u32 rate; /* actual numeric value for the layer best fit */ +}; +struct bitrate_approximation { + u32 target; /* numeric value of the rate we want */ + struct bitrate_bits layer[2]; +}; +static struct bitrate_approximation mpeg_audio_bitrates[] = { + /* target layer[0].bits layer[0].rate layer[1].bits layer[1].rate */ + { 0, { { 0, 0, }, { 0, 0, }, }, }, + { 32, { { BLACKBIRD_AUDIO_BITS_LAYER_1_32 , 32, }, { BLACKBIRD_AUDIO_BITS_LAYER_2_32 , 32, }, }, }, + { 48, { { BLACKBIRD_AUDIO_BITS_LAYER_1_64 , 64, }, { BLACKBIRD_AUDIO_BITS_LAYER_2_48 , 48, }, }, }, + { 56, { { BLACKBIRD_AUDIO_BITS_LAYER_1_64 , 64, }, { BLACKBIRD_AUDIO_BITS_LAYER_2_56 , 56, }, }, }, + { 64, { { BLACKBIRD_AUDIO_BITS_LAYER_1_64 , 64, }, { BLACKBIRD_AUDIO_BITS_LAYER_2_64 , 64, }, }, }, + { 80, { { BLACKBIRD_AUDIO_BITS_LAYER_1_96 , 96, }, { BLACKBIRD_AUDIO_BITS_LAYER_2_80 , 80, }, }, }, + { 96, { { BLACKBIRD_AUDIO_BITS_LAYER_1_96 , 96, }, { BLACKBIRD_AUDIO_BITS_LAYER_2_96 , 96, }, }, }, + { 112, { { BLACKBIRD_AUDIO_BITS_LAYER_1_128, 128, }, { BLACKBIRD_AUDIO_BITS_LAYER_2_112, 112, }, }, }, + { 128, { { BLACKBIRD_AUDIO_BITS_LAYER_1_128, 128, }, { BLACKBIRD_AUDIO_BITS_LAYER_2_128, 128, }, }, }, + { 160, { { BLACKBIRD_AUDIO_BITS_LAYER_1_160, 160, }, { BLACKBIRD_AUDIO_BITS_LAYER_2_160, 160, }, }, }, + { 192, { { BLACKBIRD_AUDIO_BITS_LAYER_1_192, 192, }, { BLACKBIRD_AUDIO_BITS_LAYER_2_192, 192, }, }, }, + { 224, { { BLACKBIRD_AUDIO_BITS_LAYER_1_224, 224, }, { BLACKBIRD_AUDIO_BITS_LAYER_2_224, 224, }, }, }, + { 256, { { BLACKBIRD_AUDIO_BITS_LAYER_1_256, 256, }, { BLACKBIRD_AUDIO_BITS_LAYER_2_256, 256, }, }, }, + { 288, { { BLACKBIRD_AUDIO_BITS_LAYER_1_288, 288, }, { BLACKBIRD_AUDIO_BITS_LAYER_2_320, 320, }, }, }, + { 320, { { BLACKBIRD_AUDIO_BITS_LAYER_1_320, 320, }, { BLACKBIRD_AUDIO_BITS_LAYER_2_320, 320, }, }, }, + { 352, { { BLACKBIRD_AUDIO_BITS_LAYER_1_352, 352, }, { BLACKBIRD_AUDIO_BITS_LAYER_2_384, 384, }, }, }, + { 384, { { BLACKBIRD_AUDIO_BITS_LAYER_1_384, 384, }, { BLACKBIRD_AUDIO_BITS_LAYER_2_384, 384, }, }, }, + { 416, { { BLACKBIRD_AUDIO_BITS_LAYER_1_416, 416, }, { BLACKBIRD_AUDIO_BITS_LAYER_2_384, 384, }, }, }, + { 448, { { BLACKBIRD_AUDIO_BITS_LAYER_1_448, 448, }, { BLACKBIRD_AUDIO_BITS_LAYER_2_384, 384, }, }, }, +}; +static const int BITRATES_SIZE = ARRAY_SIZE(mpeg_audio_bitrates); + +static void blackbird_set_default_params(struct cx8802_dev *dev) { - int bitrate_mode = 1; - int bitrate = 7500000; - int bitrate_peak = 7500000; - bitrate_mode = BLACKBIRD_VIDEO_CBR; - bitrate = 4000*1024; - bitrate_peak = 4000*1024; + struct v4l2_mpeg_compression *params = &dev->params; /* assign stream type */ - blackbird_api_cmd(dev, BLACKBIRD_API_SET_STREAM_TYPE, 1, 0, BLACKBIRD_STREAM_PROGRAM); - - /* assign output port */ - blackbird_api_cmd(dev, BLACKBIRD_API_SET_OUTPUT_PORT, 1, 0, BLACKBIRD_OUTPUT_PORT_STREAMING); /* Host */ + if( params->st_type >= ARRAY_SIZE(mpeg_stream_types) ) + params->st_type = V4L2_MPEG_PS_2; + if( params->st_type == V4L2_MPEG_SS_1 ) + params->vi_type = V4L2_MPEG_VI_1; + else + params->vi_type = V4L2_MPEG_VI_2; + blackbird_api_cmd(dev, BLACKBIRD_API_SET_STREAM_TYPE, 1, 0, mpeg_stream_types[params->st_type]); /* assign framerate */ - blackbird_api_cmd(dev, BLACKBIRD_API_SET_FRAMERATE, 1, 0, BLACKBIRD_FRAMERATE_PAL_25); - - /* assign frame size */ - blackbird_api_cmd(dev, BLACKBIRD_API_SET_RESOLUTION, 2, 0, - dev->height, dev->width); + if( params->vi_frame_rate <= 25 ) + { + params->vi_frame_rate = 25; + blackbird_api_cmd(dev, BLACKBIRD_API_SET_FRAMERATE, 1, 0, BLACKBIRD_FRAMERATE_PAL_25); + } + else + { + params->vi_frame_rate = 30; + blackbird_api_cmd(dev, BLACKBIRD_API_SET_FRAMERATE, 1, 0, BLACKBIRD_FRAMERATE_NTSC_30); + } /* assign aspect ratio */ - blackbird_api_cmd(dev, BLACKBIRD_API_SET_ASPECT_RATIO, 1, 0, BLACKBIRD_ASPECT_RATIO_4_3); - - /* assign bitrates */ - blackbird_api_cmd(dev, BLACKBIRD_API_SET_VIDEO_BITRATE, 5, 0, - bitrate_mode, /* mode */ - bitrate, /* bps */ - bitrate_peak / BLACKBIRD_PEAK_RATE_DIVISOR, /* peak/400 */ - BLACKBIRD_MUX_RATE_DEFAULT /*, 0x70*/); /* encoding buffer, ckennedy */ + if( params->vi_aspect_ratio >= ARRAY_SIZE(mpeg_stream_ratios) ) + params->vi_aspect_ratio = V4L2_MPEG_ASPECT_4_3; + blackbird_api_cmd(dev, BLACKBIRD_API_SET_ASPECT_RATIO, 1, 0, mpeg_stream_ratios[params->vi_aspect_ratio]); /* assign gop properties */ - blackbird_api_cmd(dev, BLACKBIRD_API_SET_GOP_STRUCTURE, 2, 0, 15, 3); + blackbird_api_cmd(dev, BLACKBIRD_API_SET_GOP_STRUCTURE, 2, 0, params->vi_frames_per_gop, params->vi_bframes_count+1); + + /* assign gop closure */ + blackbird_api_cmd(dev, BLACKBIRD_API_SET_GOP_CLOSURE, 1, 0, params->closed_gops); /* assign 3 2 pulldown */ - blackbird_api_cmd(dev, BLACKBIRD_API_SET_3_2_PULLDOWN, 1, 0, BLACKBIRD_3_2_PULLDOWN_DISABLED); + blackbird_api_cmd(dev, BLACKBIRD_API_SET_3_2_PULLDOWN, 1, 0, params->pulldown); + + /* make sure the params are within bounds */ + if( params->st_bitrate.mode >= ARRAY_SIZE(mpeg_video_bitrates) ) + params->vi_bitrate.mode = V4L2_BITRATE_NONE; + if( params->vi_bitrate.mode >= ARRAY_SIZE(mpeg_video_bitrates) ) + params->vi_bitrate.mode = V4L2_BITRATE_NONE; + if( params->au_bitrate.mode >= ARRAY_SIZE(mpeg_video_bitrates) ) + params->au_bitrate.mode = V4L2_BITRATE_NONE; /* assign audio properties */ /* note: it's not necessary to set the samplerate, the mpeg encoder seems to autodetect/adjust */ - /* blackbird_api_cmd(dev, IVTV_API_ASSIGN_AUDIO_PROPERTIES, 1, 0, (2<<2) | (8<<4)); - blackbird_api_cmd(dev, IVTV_API_ASSIGN_AUDIO_PROPERTIES, 1, 0, 0 | (2 << 2) | (14 << 4)); */ - blackbird_api_cmd(dev, BLACKBIRD_API_SET_AUDIO_PARAMS, 1, 0, - BLACKBIRD_AUDIO_BITS_44100HZ | - BLACKBIRD_AUDIO_BITS_LAYER_2 | - BLACKBIRD_AUDIO_BITS_LAYER_2_224 | - BLACKBIRD_AUDIO_BITS_STEREO | + u32 au_params = BLACKBIRD_AUDIO_BITS_STEREO | /* BLACKBIRD_AUDIO_BITS_BOUND_4 | */ BLACKBIRD_AUDIO_BITS_EMPHASIS_NONE | BLACKBIRD_AUDIO_BITS_CRC_OFF | BLACKBIRD_AUDIO_BITS_COPYRIGHT_OFF | - BLACKBIRD_AUDIO_BITS_COPY - ); + BLACKBIRD_AUDIO_BITS_COPY | + 0; + if( params->au_sample_rate <= 32000 ) + { + params->au_sample_rate = 32000; + au_params |= BLACKBIRD_AUDIO_BITS_32000HZ; + } + else if( params->au_sample_rate <= 44100 ) + { + params->au_sample_rate = 44100; + au_params |= BLACKBIRD_AUDIO_BITS_44100HZ; + } + else + { + params->au_sample_rate = 48000; + au_params |= BLACKBIRD_AUDIO_BITS_48000HZ; + } + if( params->au_type == V4L2_MPEG_AU_2_I ) + { + au_params |= BLACKBIRD_AUDIO_BITS_LAYER_1; + } + else + { + /* TODO: try to handle the other formats more gracefully */ + params->au_type = V4L2_MPEG_AU_2_II; + au_params |= BLACKBIRD_AUDIO_BITS_LAYER_2; + } + if( params->au_bitrate.mode ) + { + if( params->au_bitrate.mode == V4L2_BITRATE_CBR ) + params->au_bitrate.max = params->vi_bitrate.target; + else + params->au_bitrate.target = params->vi_bitrate.max; + + int layer = params->au_type; + if( params->au_bitrate.target == 0 ) + { + /* TODO: use the minimum possible bitrate instead of 0 ? */ + au_params |= 0; + } + else if( params->au_bitrate.target >= + mpeg_audio_bitrates[BITRATES_SIZE-1].layer[layer].rate ) + { + /* clamp the bitrate to the max supported by the standard */ + params->au_bitrate.target = mpeg_audio_bitrates[BITRATES_SIZE-1].layer[layer].rate; + params->au_bitrate.max = params->au_bitrate.target; + au_params |= mpeg_audio_bitrates[BITRATES_SIZE-1].layer[layer].bits; + } + else + { + /* round up to the nearest supported bitrate */ + int i; + for(i = 1; i < BITRATES_SIZE; i++) + { + if( params->au_bitrate.target > mpeg_audio_bitrates[i-1].layer[layer].rate && + params->au_bitrate.target <= mpeg_audio_bitrates[i].layer[layer].rate ) + { + params->au_bitrate.target = mpeg_audio_bitrates[i].layer[layer].rate; + params->au_bitrate.max = params->au_bitrate.target; + au_params |= mpeg_audio_bitrates[i].layer[layer].bits; + break; + } + } + } + } + else + { + /* TODO: ??? */ + params->au_bitrate.target = params->au_bitrate.max = 0; + au_params |= 0; + } + blackbird_api_cmd(dev, BLACKBIRD_API_SET_AUDIO_PARAMS, 1, 0, au_params ); + + /* assign bitrates */ + if( params->vi_bitrate.mode ) + { + /* bitrate is set, let's figure out the cbr/vbr mess */ + if( params->vi_bitrate.max < params->vi_bitrate.target ) + { + if( params->vi_bitrate.mode == V4L2_BITRATE_CBR ) + params->vi_bitrate.max = params->vi_bitrate.target; + else + params->vi_bitrate.target = params->vi_bitrate.max; + } + } + else + { + if( params->st_bitrate.max < params->st_bitrate.target ) + { + if( params->st_bitrate.mode == V4L2_BITRATE_VBR ) + params->st_bitrate.target = params->st_bitrate.max; + else + params->st_bitrate.max = params->st_bitrate.target; + } + /* calculate vi_bitrate = st_bitrate - au_bitrate */ + params->vi_bitrate.max = params->st_bitrate.max - params->au_bitrate.max; + params->vi_bitrate.target = params->st_bitrate.target - params->au_bitrate.target; + } + blackbird_api_cmd(dev, BLACKBIRD_API_SET_VIDEO_BITRATE, 4, 0, + mpeg_video_bitrates[params->vi_bitrate.mode], + params->vi_bitrate.target * 1000, /* kbps -> bps */ + params->vi_bitrate.max * 1000 / BLACKBIRD_PEAK_RATE_DIVISOR, /* peak/400 */ + BLACKBIRD_MUX_RATE_DEFAULT /*, 0x70*/); /* encoding buffer, ckennedy */ + + /* TODO: implement the stream ID stuff: + ts_pid_pmt, ts_pid_audio, ts_pid_video, ts_pid_pcr, + ps_size, au_pesid, vi_pesid + */ +} +#define CHECK_PARAM( name ) ( dev->params.name != params->name ) +#define IF_PARAM( name ) if( CHECK_PARAM( name ) ) +#define UPDATE_PARAM( name ) dev->params.name = params->name +void blackbird_set_params(struct cx8802_dev *dev, struct v4l2_mpeg_compression *params) +{ + /* assign stream type */ + if( params->st_type >= ARRAY_SIZE(mpeg_stream_types) ) + params->st_type = V4L2_MPEG_PS_2; + if( params->st_type == V4L2_MPEG_SS_1 ) + params->vi_type = V4L2_MPEG_VI_1; + else + params->vi_type = V4L2_MPEG_VI_2; + if( CHECK_PARAM( st_type ) || CHECK_PARAM( vi_type ) ) + { + UPDATE_PARAM( st_type ); + UPDATE_PARAM( vi_type ); + blackbird_api_cmd(dev, BLACKBIRD_API_SET_STREAM_TYPE, 1, 0, mpeg_stream_types[params->st_type]); + } + + /* assign framerate */ + if( params->vi_frame_rate <= 25 ) + params->vi_frame_rate = 25; + else + params->vi_frame_rate = 30; + IF_PARAM( vi_frame_rate ) + { + UPDATE_PARAM( vi_frame_rate ); + if( params->vi_frame_rate == 25 ) + blackbird_api_cmd(dev, BLACKBIRD_API_SET_FRAMERATE, 1, 0, BLACKBIRD_FRAMERATE_PAL_25); + else + blackbird_api_cmd(dev, BLACKBIRD_API_SET_FRAMERATE, 1, 0, BLACKBIRD_FRAMERATE_NTSC_30); + } + + /* assign aspect ratio */ + if( params->vi_aspect_ratio >= ARRAY_SIZE(mpeg_stream_ratios) ) + params->vi_aspect_ratio = V4L2_MPEG_ASPECT_4_3; + IF_PARAM( vi_aspect_ratio ) + { + UPDATE_PARAM( vi_aspect_ratio ); + blackbird_api_cmd(dev, BLACKBIRD_API_SET_ASPECT_RATIO, 1, 0, mpeg_stream_ratios[params->vi_aspect_ratio]); + } + + /* assign gop properties */ + if( CHECK_PARAM( vi_frames_per_gop ) || CHECK_PARAM( vi_bframes_count ) ) + { + UPDATE_PARAM( vi_frames_per_gop ); + UPDATE_PARAM( vi_bframes_count ); + blackbird_api_cmd(dev, BLACKBIRD_API_SET_GOP_STRUCTURE, 2, 0, params->vi_frames_per_gop, params->vi_bframes_count+1); + } /* assign gop closure */ - blackbird_api_cmd(dev, BLACKBIRD_API_SET_GOP_CLOSURE, 1, 0, BLACKBIRD_GOP_CLOSURE_OFF); + IF_PARAM( closed_gops ) + { + UPDATE_PARAM( closed_gops ); + blackbird_api_cmd(dev, BLACKBIRD_API_SET_GOP_CLOSURE, 1, 0, params->closed_gops); + } + + /* assign 3 2 pulldown */ + IF_PARAM( pulldown ) + { + UPDATE_PARAM( pulldown ); + blackbird_api_cmd(dev, BLACKBIRD_API_SET_3_2_PULLDOWN, 1, 0, params->pulldown); + } + + /* make sure the params are within bounds */ + if( params->st_bitrate.mode >= ARRAY_SIZE(mpeg_video_bitrates) ) + params->vi_bitrate.mode = V4L2_BITRATE_NONE; + if( params->vi_bitrate.mode >= ARRAY_SIZE(mpeg_video_bitrates) ) + params->vi_bitrate.mode = V4L2_BITRATE_NONE; + if( params->au_bitrate.mode >= ARRAY_SIZE(mpeg_video_bitrates) ) + params->au_bitrate.mode = V4L2_BITRATE_NONE; + + /* assign audio properties */ + /* note: it's not necessary to set the samplerate, the mpeg encoder seems to autodetect/adjust */ + u32 au_params = BLACKBIRD_AUDIO_BITS_STEREO | + /* BLACKBIRD_AUDIO_BITS_BOUND_4 | */ + BLACKBIRD_AUDIO_BITS_EMPHASIS_NONE | + BLACKBIRD_AUDIO_BITS_CRC_OFF | + BLACKBIRD_AUDIO_BITS_COPYRIGHT_OFF | + BLACKBIRD_AUDIO_BITS_COPY | + 0; + if( params->au_sample_rate < 32000 ) + { + params->au_sample_rate = 32000; + au_params |= BLACKBIRD_AUDIO_BITS_32000HZ; + } + else if( params->au_sample_rate < 44100 ) + { + params->au_sample_rate = 44100; + au_params |= BLACKBIRD_AUDIO_BITS_44100HZ; + } + else + { + params->au_sample_rate = 48000; + au_params |= BLACKBIRD_AUDIO_BITS_48000HZ; + } + if( params->au_type == V4L2_MPEG_AU_2_I ) + { + au_params |= BLACKBIRD_AUDIO_BITS_LAYER_1; + } + else + { + /* TODO: try to handle the other formats more gracefully */ + params->au_type = V4L2_MPEG_AU_2_II; + au_params |= BLACKBIRD_AUDIO_BITS_LAYER_2; + } + if( params->au_bitrate.mode ) + { + if( params->au_bitrate.mode == V4L2_BITRATE_CBR ) + params->au_bitrate.max = params->vi_bitrate.target; + else + params->au_bitrate.target = params->vi_bitrate.max; + int layer = params->au_type; + if( params->au_bitrate.target == 0 ) + { + /* TODO: use the minimum possible bitrate instead of 0 ? */ + au_params |= 0; + } + else if( params->au_bitrate.target >= + mpeg_audio_bitrates[BITRATES_SIZE-1].layer[layer].rate ) + { + /* clamp the bitrate to the max supported by the standard */ + params->au_bitrate.target = mpeg_audio_bitrates[BITRATES_SIZE-1].layer[layer].rate; + params->au_bitrate.max = params->au_bitrate.target; + au_params |= mpeg_audio_bitrates[BITRATES_SIZE-1].layer[layer].bits; + } + else + { + /* round up to the nearest supported bitrate */ + int i; + for(i = 1; i < BITRATES_SIZE; i++) + { + if( params->au_bitrate.target > mpeg_audio_bitrates[i-1].layer[layer].rate && + params->au_bitrate.target <= mpeg_audio_bitrates[i].layer[layer].rate ) + { + params->au_bitrate.target = mpeg_audio_bitrates[i].layer[layer].rate; + params->au_bitrate.max = params->au_bitrate.target; + au_params |= mpeg_audio_bitrates[i].layer[layer].bits; + break; + } + } + } + } + else + { + /* TODO: ??? */ + params->au_bitrate.target = params->au_bitrate.max = 0; + au_params |= 0; + } + if( CHECK_PARAM( au_type ) || CHECK_PARAM( au_sample_rate ) + || CHECK_PARAM( au_bitrate.mode ) || CHECK_PARAM( au_bitrate.max ) + || CHECK_PARAM( au_bitrate.target ) + ) + { + UPDATE_PARAM( au_type ); + UPDATE_PARAM( au_sample_rate ); + UPDATE_PARAM( au_bitrate ); + blackbird_api_cmd(dev, BLACKBIRD_API_SET_AUDIO_PARAMS, 1, 0, au_params ); + } + /* assign bitrates */ + if( params->vi_bitrate.mode ) + { + /* bitrate is set, let's figure out the cbr/vbr mess */ + if( params->vi_bitrate.max < params->vi_bitrate.target ) + { + if( params->vi_bitrate.mode == V4L2_BITRATE_CBR ) + params->vi_bitrate.max = params->vi_bitrate.target; + else + params->vi_bitrate.target = params->vi_bitrate.max; + } + } + else + { + if( params->st_bitrate.max < params->st_bitrate.target ) + { + if( params->st_bitrate.mode == V4L2_BITRATE_VBR ) + params->st_bitrate.target = params->st_bitrate.max; + else + params->st_bitrate.max = params->st_bitrate.target; + } + /* calculate vi_bitrate = st_bitrate - au_bitrate */ + params->vi_bitrate.max = params->st_bitrate.max - params->au_bitrate.max; + params->vi_bitrate.target = params->st_bitrate.target - params->au_bitrate.target; + } + UPDATE_PARAM( st_bitrate ); + if( CHECK_PARAM( vi_bitrate.mode ) || CHECK_PARAM( vi_bitrate.max ) + || CHECK_PARAM( vi_bitrate.target ) + ) + { + UPDATE_PARAM( vi_bitrate ); + blackbird_api_cmd(dev, BLACKBIRD_API_SET_VIDEO_BITRATE, 4, 0, + mpeg_video_bitrates[params->vi_bitrate.mode], + params->vi_bitrate.target * 1000, /* kbps -> bps */ + params->vi_bitrate.max * 1000 / BLACKBIRD_PEAK_RATE_DIVISOR, /* peak/400 */ + BLACKBIRD_MUX_RATE_DEFAULT /*, 0x70*/); /* encoding buffer, ckennedy */ + } + + /* TODO: implement the stream ID stuff: + ts_pid_pmt, ts_pid_audio, ts_pid_video, ts_pid_pcr, + ps_size, au_pesid, vi_pesid + */ + UPDATE_PARAM( ts_pid_pmt ); + UPDATE_PARAM( ts_pid_audio ); + UPDATE_PARAM( ts_pid_video ); + UPDATE_PARAM( ts_pid_pcr ); + UPDATE_PARAM( ps_size ); + UPDATE_PARAM( au_pesid ); + UPDATE_PARAM( vi_pesid ); +} + +static void blackbird_set_default_dnr_params(struct cx8802_dev *dev) +{ /* assign dnr filter mode */ + if( dev->dnr_params.mode > BLACKBIRD_DNR_BITS_AUTO ) + dev->dnr_params.mode = BLACKBIRD_DNR_BITS_MANUAL; + if( dev->dnr_params.type > BLACKBIRD_MEDIAN_FILTER_DIAGONAL ) + dev->dnr_params.type = BLACKBIRD_MEDIAN_FILTER_DISABLED; blackbird_api_cmd(dev, BLACKBIRD_API_SET_DNR_MODE, 2, 0, - BLACKBIRD_DNR_BITS_MANUAL, - BLACKBIRD_MEDIAN_FILTER_DISABLED - ); + dev->dnr_params.mode, + dev->dnr_params.type + ); + + /* assign dnr filter props*/ + if( dev->dnr_params.spatial > 15 ) + dev->dnr_params.spatial = 15; + if( dev->dnr_params.temporal > 31 ) + dev->dnr_params.temporal = 31; + blackbird_api_cmd(dev, BLACKBIRD_API_SET_MANUAL_DNR, 2, 0, + dev->dnr_params.spatial, + dev->dnr_params.temporal + ); +} +#define CHECK_DNR_PARAM( name ) ( dev->dnr_params.name != dnr_params->name ) +#define UPDATE_DNR_PARAM( name ) dev->dnr_params.name = dnr_params->name +void blackbird_set_dnr_params(struct cx8802_dev *dev, struct blackbird_dnr* dnr_params) +{ + /* assign dnr filter mode */ + /* clamp values */ + if( dnr_params->mode > BLACKBIRD_DNR_BITS_AUTO ) + dnr_params->mode = BLACKBIRD_DNR_BITS_MANUAL; + if( dnr_params->type > BLACKBIRD_MEDIAN_FILTER_DIAGONAL ) + dnr_params->type = BLACKBIRD_MEDIAN_FILTER_DISABLED; + /* check if the params actually changed */ + if( CHECK_DNR_PARAM( mode ) || CHECK_DNR_PARAM( type ) ) + { + UPDATE_DNR_PARAM( mode ); + UPDATE_DNR_PARAM( type ); + blackbird_api_cmd(dev, BLACKBIRD_API_SET_DNR_MODE, 2, 0, dnr_params->mode, dnr_params->type); + } /* assign dnr filter props*/ - blackbird_api_cmd(dev, BLACKBIRD_API_SET_MANUAL_DNR, 2, 0, 0, 0); + if( dnr_params->spatial > 15 ) + dnr_params->spatial = 15; + if( dnr_params->temporal > 31 ) + dnr_params->temporal = 31; + if( CHECK_DNR_PARAM( spatial ) || CHECK_DNR_PARAM( temporal ) ) + { + UPDATE_DNR_PARAM( spatial ); + UPDATE_DNR_PARAM( temporal ); + blackbird_api_cmd(dev, BLACKBIRD_API_SET_MANUAL_DNR, 2, 0, dnr_params->spatial, dnr_params->temporal); + } +} + +static void blackbird_codec_settings(struct cx8802_dev *dev) +{ + + /* assign output port */ + blackbird_api_cmd(dev, BLACKBIRD_API_SET_OUTPUT_PORT, 1, 0, BLACKBIRD_OUTPUT_PORT_STREAMING); /* Host */ + + /* assign frame size */ + blackbird_api_cmd(dev, BLACKBIRD_API_SET_RESOLUTION, 2, 0, + dev->height, dev->width); /* assign coring levels (luma_h, luma_l, chroma_h, chroma_l) */ blackbird_api_cmd(dev, BLACKBIRD_API_SET_DNR_MEDIAN, 4, 0, 0, 255, 0, 255); /* assign spatial filter type: luma_t: horiz_only, chroma_t: horiz_only */ blackbird_api_cmd(dev, BLACKBIRD_API_SET_SPATIAL_FILTER, 2, 0, - BLACKBIRD_SPATIAL_FILTER_LUMA_1D_HORIZ, - BLACKBIRD_SPATIAL_FILTER_CHROMA_1D_HORIZ - ); + BLACKBIRD_SPATIAL_FILTER_LUMA_1D_HORIZ, + BLACKBIRD_SPATIAL_FILTER_CHROMA_1D_HORIZ + ); /* assign frame drop rate */ /* blackbird_api_cmd(dev, IVTV_API_ASSIGN_FRAME_DROP_RATE, 1, 0, 0); */ + + blackbird_set_default_params(dev); + blackbird_set_default_dnr_params(dev); } static int blackbird_initialize_codec(struct cx8802_dev *dev) @@ -851,15 +1320,10 @@ static int bb_buf_setup(struct videobuf_queue *q, struct cx8802_fh *fh = q->priv_data; fh->dev->ts_packet_size = 188 * 4; /* was: 512 */ - fh->dev->ts_packet_count = 32; /* was: 100 */ + fh->dev->ts_packet_count = mpegbufs; /* was: 100 */ *size = fh->dev->ts_packet_size * fh->dev->ts_packet_count; - if (0 == *count) - *count = mpegbufs; - if (*count < 2) - *count = 2; - if (*count > 32) - *count = 32; + *count = fh->dev->ts_packet_count; return 0; } @@ -868,7 +1332,7 @@ bb_buf_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, enum v4l2_field field) { struct cx8802_fh *fh = q->priv_data; - return cx8802_buf_prepare(fh->dev, (struct cx88_buffer*)vb); + return cx8802_buf_prepare(fh->dev, (struct cx88_buffer*)vb, field); } static void @@ -920,8 +1384,6 @@ static int mpeg_do_ioctl(struct inode *inode, struct file *file, V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | V4L2_CAP_STREAMING | - V4L2_CAP_VBI_CAPTURE | - V4L2_CAP_VIDEO_OVERLAY | 0; if (UNSET != core->tuner_type) cap->capabilities |= V4L2_CAP_TUNER; @@ -941,27 +1403,52 @@ static int mpeg_do_ioctl(struct inode *inode, struct file *file, memset(f,0,sizeof(*f)); f->index = index; - strlcpy(f->description, "MPEG TS", sizeof(f->description)); + strlcpy(f->description, "MPEG", sizeof(f->description)); f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; f->pixelformat = V4L2_PIX_FMT_MPEG; return 0; } case VIDIOC_G_FMT: - case VIDIOC_S_FMT: - case VIDIOC_TRY_FMT: { - /* FIXME -- quick'n'dirty for exactly one size ... */ struct v4l2_format *f = arg; memset(f,0,sizeof(*f)); f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG; + f->fmt.pix.bytesperline = 0; + f->fmt.pix.sizeimage = dev->ts_packet_size * dev->ts_packet_count; /* 188 * 4 * 1024; */ + f->fmt.pix.colorspace = 0; f->fmt.pix.width = dev->width; f->fmt.pix.height = dev->height; + f->fmt.pix.field = fh->mpegq.field; + dprintk(0,"VIDIOC_G_FMT: w: %d, h: %d, f: %d\n", + dev->width, dev->height, fh->mpegq.field ); + return 0; + } + case VIDIOC_TRY_FMT: + { + struct v4l2_format *f = arg; + + f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG; - f->fmt.pix.field = V4L2_FIELD_NONE; f->fmt.pix.bytesperline = 0; - f->fmt.pix.sizeimage = 188 * 4 * 1024; /* 1024 * 512 */ /* FIXME: BUFFER_SIZE */; + f->fmt.pix.sizeimage = dev->ts_packet_size * dev->ts_packet_count; /* 188 * 4 * 1024; */; f->fmt.pix.colorspace = 0; + dprintk(0,"VIDIOC_TRY_FMT: w: %d, h: %d, f: %d\n", + dev->width, dev->height, fh->mpegq.field ); + return 0; + } + case VIDIOC_S_FMT: + { + struct v4l2_format *f = arg; + + f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG; + f->fmt.pix.bytesperline = 0; + f->fmt.pix.sizeimage = dev->ts_packet_size * dev->ts_packet_count; /* 188 * 4 * 1024; */; + f->fmt.pix.colorspace = 0; + dprintk(0,"VIDIOC_S_FMT: w: %d, h: %d, f: %d\n", + f->fmt.pix.width, f->fmt.pix.height, f->fmt.pix.field ); return 0; } @@ -985,6 +1472,22 @@ static int mpeg_do_ioctl(struct inode *inode, struct file *file, case VIDIOC_STREAMOFF: return videobuf_streamoff(&fh->mpegq); + /* --- mpeg compression -------------------------------------- */ + case VIDIOC_G_MPEGCOMP: + { + struct v4l2_mpeg_compression *f = arg; + + memcpy(f,&dev->params,sizeof(*f)); + return 0; + } + case VIDIOC_S_MPEGCOMP: + { + struct v4l2_mpeg_compression *f = arg; + + blackbird_set_params(dev, f); + return 0; + } + default: return cx88_do_ioctl( inode, file, 0, dev->core, cmd, arg, cx88_ioctl_hook ); } @@ -1034,16 +1537,17 @@ static int mpeg_open(struct inode *inode, struct file *file) file->private_data = fh; fh->dev = dev; - /* FIXME: locking against other video device */ - cx88_set_scale(dev->core, dev->width, dev->height, - V4L2_FIELD_INTERLACED); - videobuf_queue_init(&fh->mpegq, &blackbird_qops, dev->pci, &dev->slock, V4L2_BUF_TYPE_VIDEO_CAPTURE, - V4L2_FIELD_TOP, + V4L2_FIELD_INTERLACED, sizeof(struct cx88_buffer), fh); + + /* FIXME: locking against other video device */ + cx88_set_scale(dev->core, dev->width, dev->height, + fh->mpegq.field); + return 0; } @@ -1173,6 +1677,8 @@ static int __devinit blackbird_probe(struct pci_dev *pci_dev, dev->core = core; dev->width = 720; dev->height = 576; + memcpy(&dev->params,&default_mpeg_params,sizeof(default_mpeg_params)); + memcpy(&dev->dnr_params,&default_dnr_params,sizeof(default_dnr_params)); err = cx8802_init_common(dev); if (0 != err) @@ -1257,6 +1763,8 @@ module_exit(blackbird_fini); EXPORT_SYMBOL(cx88_ioctl_hook); EXPORT_SYMBOL(cx88_ioctl_translator); +EXPORT_SYMBOL(blackbird_set_params); +EXPORT_SYMBOL(blackbird_set_dnr_params); /* ----------------------------------------------------------- */ /* diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c index ee2300e1ae0b..2c4fbe9258d9 100644 --- a/drivers/media/video/cx88/cx88-mpeg.c +++ b/drivers/media/video/cx88/cx88-mpeg.c @@ -54,7 +54,7 @@ static int cx8802_start_dma(struct cx8802_dev *dev, { struct cx88_core *core = dev->core; - dprintk(0, "cx8802_start_dma %d\n", buf->vb.width); + dprintk(0, "cx8802_start_dma w: %d, h: %d, f: %d\n", dev->width, dev->height, buf->vb.field); /* setup fifo + format */ cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH28], @@ -158,7 +158,8 @@ static int cx8802_restart_queue(struct cx8802_dev *dev, /* ------------------------------------------------------------------ */ -int cx8802_buf_prepare(struct cx8802_dev *dev, struct cx88_buffer *buf) +int cx8802_buf_prepare(struct cx8802_dev *dev, struct cx88_buffer *buf, + enum v4l2_field field) { int size = dev->ts_packet_size * dev->ts_packet_count; int rc; @@ -171,7 +172,7 @@ int cx8802_buf_prepare(struct cx8802_dev *dev, struct cx88_buffer *buf) buf->vb.width = dev->ts_packet_size; buf->vb.height = dev->ts_packet_count; buf->vb.size = size; - buf->vb.field = V4L2_FIELD_TOP; + buf->vb.field = field /*V4L2_FIELD_TOP*/; if (0 != (rc = videobuf_iolock(dev->pci,&buf->vb,NULL))) goto fail; diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index 3dbc074fb515..67630f61c470 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c @@ -1258,8 +1258,6 @@ int cx88_do_ioctl(struct inode *inode, struct file *file, int radio, if (video_debug > 1) cx88_print_ioctl(core->name,cmd); - printk( KERN_INFO "CORE IOCTL: 0x%x\n", cmd ); - cx88_print_ioctl(core->name,cmd); dprintk( 1, "CORE IOCTL: 0x%x\n", cmd ); switch (cmd) { diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h index 88050a0043ab..b18205b3fa24 100644 --- a/drivers/media/video/cx88/cx88.h +++ b/drivers/media/video/cx88/cx88.h @@ -371,6 +371,14 @@ struct cx8802_suspend_state { int disabled; }; +/* TODO: move this to struct v4l2_mpeg_compression ? */ +struct blackbird_dnr { + u32 mode; + u32 type; + u32 spatial; + u32 temporal; +}; + struct cx8802_dev { struct cx88_core *core; spinlock_t slock; @@ -401,6 +409,10 @@ struct cx8802_dev { /* for switching modulation types */ unsigned char ts_gen_cntrl; + + /* mpeg params */ + struct v4l2_mpeg_compression params; + struct blackbird_dnr dnr_params; }; /* ----------------------------------------------------------- */ @@ -542,7 +554,8 @@ void cx88_ir_irq(struct cx88_core *core); /* ----------------------------------------------------------- */ /* cx88-mpeg.c */ -int cx8802_buf_prepare(struct cx8802_dev *dev, struct cx88_buffer *buf); +int cx8802_buf_prepare(struct cx8802_dev *dev, struct cx88_buffer *buf, + enum v4l2_field field); void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf); void cx8802_cancel_buffers(struct cx8802_dev *dev); @@ -563,6 +576,10 @@ extern int cx88_do_ioctl(struct inode *inode, struct file *file, int radio, extern int (*cx88_ioctl_hook)(struct inode *inode, struct file *file, unsigned int cmd, void *arg); extern unsigned int (*cx88_ioctl_translator)(unsigned int cmd); +void blackbird_set_params(struct cx8802_dev *dev, + struct v4l2_mpeg_compression *params); +void blackbird_set_dnr_params(struct cx8802_dev *dev, + struct blackbird_dnr* dnr_params); /* * Local variables: -- cgit v1.2.2 From ccd7b6500275e34e2fb90bcf316a5a721d5cdb52 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 8 Nov 2005 21:36:19 -0800 Subject: [PATCH] v4l: 633: climov s previous patch missing changelog entry - Fixes broken compile of cx88-dvb.c Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/cx88/cx88-dvb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index 4334744652de..f3efb07a7613 100644 --- a/drivers/media/video/cx88/cx88-dvb.c +++ b/drivers/media/video/cx88/cx88-dvb.c @@ -78,7 +78,7 @@ static int dvb_buf_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, enum v4l2_field field) { struct cx8802_dev *dev = q->priv_data; - return cx8802_buf_prepare(dev, (struct cx88_buffer*)vb); + return cx8802_buf_prepare(dev, (struct cx88_buffer*)vb,field); } static void dvb_buf_queue(struct videobuf_queue *q, struct videobuf_buffer *vb) -- cgit v1.2.2 From 87f0783159783a315c68a00e50706cd01aa10511 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 8 Nov 2005 21:36:19 -0800 Subject: [PATCH] v4l: 634: implemented tuner set standby on cx88 init - Implemented TUNER_SET_STANDBY on cx88 init. Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/cx88/cx88-core.c | 1 + drivers/media/video/cx88/cx88-dvb.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c index dc5c5c1f3461..3ce000a5b7f9 100644 --- a/drivers/media/video/cx88/cx88-core.c +++ b/drivers/media/video/cx88/cx88-core.c @@ -1146,6 +1146,7 @@ struct cx88_core* cx88_core_get(struct pci_dev *pci) /* init hardware */ cx88_reset(core); cx88_i2c_init(core,pci); + cx88_call_i2c_clients (core, TUNER_SET_STANDBY, NULL); cx88_card_setup(core); cx88_ir_init(core,pci); diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index f3efb07a7613..ecb12c80b380 100644 --- a/drivers/media/video/cx88/cx88-dvb.c +++ b/drivers/media/video/cx88/cx88-dvb.c @@ -403,6 +403,9 @@ static int dvb_register(struct cx8802_dev *dev) /* Put the analog decoder in standby to keep it quiet */ cx88_call_i2c_clients (dev->core, TUNER_SET_STANDBY, NULL); + /* Put the analog decoder in standby to keep it quiet */ + cx88_call_i2c_clients (dev->core, TUNER_SET_STANDBY, NULL); + /* register everything */ return videobuf_dvb_register(&dev->dvb, THIS_MODULE, dev); } -- cgit v1.2.2 From cc9d8d49bb13fdcea521f907e120d3a7c7ce94f8 Mon Sep 17 00:00:00 2001 From: Ricardo Cerqueira Date: Tue, 8 Nov 2005 21:36:20 -0800 Subject: [PATCH] v4l: 635: add bttv card 137 conceptronic ctvfmi v2 - Add bttv card 137 - Conceptronic CTVFMi v2 Signed-off-by: Ricardo Cerqueira Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/video4linux/CARDLIST.bttv | 1 + drivers/media/video/bttv-cards.c | 15 +++++++ drivers/media/video/bttv.h | 1 + drivers/media/video/ir-kbd-gpio.c | 71 +++++++++++++++++++++++++++++++++ 4 files changed, 88 insertions(+) diff --git a/Documentation/video4linux/CARDLIST.bttv b/Documentation/video4linux/CARDLIST.bttv index ec785f9f15a3..89460a5babfa 100644 --- a/Documentation/video4linux/CARDLIST.bttv +++ b/Documentation/video4linux/CARDLIST.bttv @@ -135,3 +135,4 @@ card=133 - Kodicom 4400R (slave) card=134 - Adlink RTV24 card=135 - DViCO FusionHDTV 5 Lite card=136 - Acorp Y878F +card=137 - Conceptronic CTVFMi v2 diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bttv-cards.c index 0881a17d5226..75033f06551f 100644 --- a/drivers/media/video/bttv-cards.c +++ b/drivers/media/video/bttv-cards.c @@ -2418,6 +2418,21 @@ struct tvcard bttv_tvcards[] = { .tuner_type = TUNER_YMEC_TVF66T5_B_DFF, .tuner_addr = 0xc1 >>1, .has_radio = 1, +},{ + /* ---- card 0x89 ---------------------------------- */ + .name = "Conceptronic CTVFMi v2", + .video_inputs = 3, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 0x001c0007, + .muxsel = { 2, 3, 1, 1 }, + .audiomux = { 0, 1, 2, 2, 3 }, + .needs_tvaudio = 0, + .pll = PLL_28, + .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, + .tuner_addr = ADDR_UNSET, + .has_remote = 1, }}; static const unsigned int bttv_num_tvcards = ARRAY_SIZE(bttv_tvcards); diff --git a/drivers/media/video/bttv.h b/drivers/media/video/bttv.h index d254e90e3bb9..dcdf9cde7857 100644 --- a/drivers/media/video/bttv.h +++ b/drivers/media/video/bttv.h @@ -137,6 +137,7 @@ #define BTTV_ADLINK_RTV24 0x86 #define BTTV_DVICO_FUSIONHDTV_5_LITE 0x87 #define BTTV_ACORP_Y878F 0x88 +#define BTTV_CONCEPTRONIC_CTVFMI2 0x89 /* i2c address list */ #define I2C_TSA5522 0xc2 diff --git a/drivers/media/video/ir-kbd-gpio.c b/drivers/media/video/ir-kbd-gpio.c index 234151e48edc..1861d31f11b8 100644 --- a/drivers/media/video/ir-kbd-gpio.c +++ b/drivers/media/video/ir-kbd-gpio.c @@ -156,6 +156,71 @@ static IR_KEYTAB_TYPE ir_codes_apac_viewcomp[IR_KEYTAB_SIZE] = { /* ---------------------------------------------------------------------- */ +/* Ricardo Cerqueira */ +/* Weird matching, since the remote has "uncommon" keys */ + +static IR_KEYTAB_TYPE ir_codes_conceptronic[IR_KEYTAB_SIZE] = { + + [ 30 ] = KEY_POWER, // power + [ 7 ] = KEY_SWITCHVIDEOMODE, // source + [ 28 ] = KEY_SEARCH, // scan + +/* FIXME: duplicate keycodes? + * + * These four keys seem to share the same GPIO as CH+, CH-, <<< and >>> + * The GPIO values are + * 6397fb for both "Scan <" and "CH -", + * 639ffb for "Scan >" and "CH+", + * 6384fb for "Tune <" and "<<<", + * 638cfb for "Tune >" and ">>>", regardless of the mask. + * + * [ 23 ] = KEY_BACK, // fm scan << + * [ 31 ] = KEY_FORWARD, // fm scan >> + * + * [ 4 ] = KEY_LEFT, // fm tuning < + * [ 12 ] = KEY_RIGHT, // fm tuning > + * + * For now, these four keys are disabled. Pressing them will generate + * the CH+/CH-/<<>> events + */ + + [ 3 ] = KEY_TUNER, // TV/FM + + [ 0 ] = KEY_RECORD, + [ 8 ] = KEY_STOP, + [ 17 ] = KEY_PLAY, + + [ 26 ] = KEY_PLAYPAUSE, // freeze + [ 25 ] = KEY_ZOOM, // zoom + [ 15 ] = KEY_TEXT, // min + + [ 1 ] = KEY_KP1, + [ 11 ] = KEY_KP2, + [ 27 ] = KEY_KP3, + [ 5 ] = KEY_KP4, + [ 9 ] = KEY_KP5, + [ 21 ] = KEY_KP6, + [ 6 ] = KEY_KP7, + [ 10 ] = KEY_KP8, + [ 18 ] = KEY_KP9, + [ 2 ] = KEY_KP0, + [ 16 ] = KEY_LAST, // +100 + [ 19 ] = KEY_LIST, // recall + + [ 31 ] = KEY_CHANNELUP, // chn down + [ 23 ] = KEY_CHANNELDOWN, // chn up + [ 22 ] = KEY_VOLUMEUP, // vol down + [ 20 ] = KEY_VOLUMEDOWN, // vol up + + [ 4 ] = KEY_KPMINUS, // <<< + [ 14 ] = KEY_SETUP, // function + [ 12 ] = KEY_KPPLUS, // >>> + + [ 13 ] = KEY_GOTO, // mts + [ 29 ] = KEY_REFRESH, // reset + [ 24 ] = KEY_MUTE // mute/unmute +}; + struct IR { struct bttv_sub_device *sub; struct input_dev *input; @@ -329,6 +394,12 @@ static int ir_probe(struct device *dev) ir->mask_keyup = 0x008000; ir->polling = 50; // ms break; + case BTTV_CONCEPTRONIC_CTVFMI2: + ir_codes = ir_codes_conceptronic; + ir->mask_keycode = 0x001F00; + ir->mask_keyup = 0x006000; + ir->polling = 50; // ms + break; } if (NULL == ir_codes) { kfree(ir); -- cgit v1.2.2 From 7c08fb02f1a1b86292aa144cc876a95fbe2a5606 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 8 Nov 2005 21:36:21 -0800 Subject: [PATCH] v4l: 636: don t enable gpioirq until after card probe - Don't enable gpioirq until after card probe. Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/bttv-cards.c | 14 ++++++-------- drivers/media/video/bttv-driver.c | 11 +++++------ 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bttv-cards.c index 75033f06551f..e872cd47a648 100644 --- a/drivers/media/video/bttv-cards.c +++ b/drivers/media/video/bttv-cards.c @@ -1731,10 +1731,7 @@ struct tvcard bttv_tvcards[] = { .no_msp34xx = 1, .no_tda9875 = 1, .no_tda7432 = 1, - .gpiomask = 0x01, - .audiomux = { 0, 0, 0, 0, 1 }, .muxsel = { 3, 0, 1, 2}, - .needs_tvaudio = 0, .pll = PLL_28, .no_gpioirq = 1, .has_dvb = 1, @@ -2808,11 +2805,12 @@ void __devinit bttv_init_card1(struct bttv *btv) break; case BTTV_TWINHAN_DST: case BTTV_AVDVBT_771: + case BTTV_PINNACLESAT: btv->use_i2c_hw = 1; break; - case BTTV_ADLINK_RTV24: - init_RTV24( btv ); - break; + case BTTV_ADLINK_RTV24: + init_RTV24( btv ); + break; } if (!bttv_tvcards[btv->c.type].has_dvb) @@ -2997,8 +2995,8 @@ void __devinit bttv_init_card2(struct bttv *btv) btv->has_radio=1; if (bttv_tvcards[btv->c.type].has_remote) btv->has_remote=1; - if (bttv_tvcards[btv->c.type].no_gpioirq) - btv->gpioirq=0; + if (!bttv_tvcards[btv->c.type].no_gpioirq) + btv->gpioirq=1; if (bttv_tvcards[btv->c.type].audio_hook) btv->audio_hook=bttv_tvcards[btv->c.type].audio_hook; diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c index d538a994ff04..4826cf0d39d2 100644 --- a/drivers/media/video/bttv-driver.c +++ b/drivers/media/video/bttv-driver.c @@ -3889,18 +3889,17 @@ static int __devinit bttv_probe(struct pci_dev *dev, btv->timeout.function = bttv_irq_timeout; btv->timeout.data = (unsigned long)btv; - btv->i2c_rc = -1; - btv->tuner_type = UNSET; - btv->pinnacle_id = UNSET; + btv->i2c_rc = -1; + btv->tuner_type = UNSET; + btv->pinnacle_id = UNSET; btv->new_input = UNSET; - btv->gpioirq = 1; btv->has_radio=radio[btv->c.nr]; /* pci stuff (init, get irq/mmio, ... */ btv->c.pci = dev; - btv->id = dev->device; + btv->id = dev->device; if (pci_enable_device(dev)) { - printk(KERN_WARNING "bttv%d: Can't enable device.\n", + printk(KERN_WARNING "bttv%d: Can't enable device.\n", btv->c.nr); return -EIO; } -- cgit v1.2.2 From 6b96144026e27b9250713f86355e83095204d5f2 Mon Sep 17 00:00:00 2001 From: "Nickolay V. Shmyrev" Date: Tue, 8 Nov 2005 21:36:22 -0800 Subject: [PATCH] v4l: 639: added new card gotview pci 7135 - Added new card GoTView PCI 7135 Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/video4linux/CARDLIST.saa7134 | 1 + drivers/media/video/saa7134/saa7134-cards.c | 53 ++++++++++++++++++++++++++++- drivers/media/video/saa7134/saa7134-input.c | 49 ++++++++++++++++++++++++++ drivers/media/video/saa7134/saa7134.h | 1 + 4 files changed, 103 insertions(+), 1 deletion(-) diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134 index f31c2f8e4048..411f842c5d1a 100644 --- a/Documentation/video4linux/CARDLIST.saa7134 +++ b/Documentation/video4linux/CARDLIST.saa7134 @@ -66,3 +66,4 @@ 65 -> V-Stream Studio TV Terminator 66 -> Yuan TUN-900 (saa7135) 67 -> Beholder BeholdTV 409 FM [0000:4091] + 68 -> GoTView 7135 PCI [5456:7135] diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index bca5b7038a8c..088376d3c95b 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c @@ -2141,6 +2141,50 @@ struct saa7134_board saa7134_boards[] = { .amux = LINE2, }, }, + [SAA7134_BOARD_GOTVIEW_7135] = { + /* Mike Baikov */ + /* Andrey Cvetcov */ + .name = "GoTView 7135 PCI", + .audio_clock = 0x00187de7, + .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .tda9887_conf = TDA9887_PRESENT, + .gpiomask = 0x00200003, + .inputs = {{ + .name = name_tv, + .vmux = 1, + .amux = TV, + .tv = 1, + .gpio = 0x00200003, + },{ + .name = name_tv_mono, + .vmux = 1, + .amux = LINE2, + .gpio = 0x00200003, + },{ + .name = name_comp1, + .vmux = 3, + .amux = LINE1, + .gpio = 0x00200003, + },{ + .name = name_svideo, + .vmux = 8, + .amux = LINE1, + .gpio = 0x00200003, + }}, + .radio = { + .name = name_radio, + .amux = LINE2, + .gpio = 0x00200003, + }, + .mute = { + .name = name_mute, + .amux = TV, + .gpio = 0x00200003, + }, + }, }; const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards); @@ -2504,6 +2548,12 @@ struct pci_device_id saa7134_pci_tbl[] = { .subvendor = 0x0000, /* It shouldn't break anything, since subdevice id seems unique */ .subdevice = 0x4091, .driver_data = SAA7134_BOARD_BEHOLD_409FM, + },{ + .vendor = PCI_VENDOR_ID_PHILIPS, + .device = PCI_DEVICE_ID_PHILIPS_SAA7133, + .subvendor = 0x5456, /* GoTView */ + .subdevice = 0x7135, + .driver_data = SAA7134_BOARD_GOTVIEW_7135, },{ /* --- boards without eeprom + subsystem ID --- */ .vendor = PCI_VENDOR_ID_PHILIPS, @@ -2597,6 +2647,7 @@ int saa7134_board_init1(struct saa7134_dev *dev) case SAA7134_BOARD_MANLI_MTV002: case SAA7134_BOARD_BEHOLD_409FM: case SAA7134_BOARD_AVACSSMARTTV: + case SAA7134_BOARD_GOTVIEW_7135: dev->has_remote = 1; break; case SAA7134_BOARD_MD5044: @@ -2613,7 +2664,7 @@ int saa7134_board_init1(struct saa7134_dev *dev) break; case SAA7134_BOARD_FLYDVBTDUO: case SAA7134_BOARD_THYPHOON_DVBT_DUO_CARDBUS: - /* turn the fan on Hac: static for the time being */ + /* turn the fan on */ saa_writeb(SAA7134_GPIO_GPMODE3, 0x08); saa_writeb(SAA7134_GPIO_GPSTATUS3, 0x06); break; diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index 8e2cc9d75cd5..899abd8ba0d1 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -401,6 +401,48 @@ static IR_KEYTAB_TYPE manli_codes[IR_KEYTAB_SIZE] = { // 0x1d unused ? }; + + +/* Mike Baikov Mike Baikov */ +static IR_KEYTAB_TYPE gotview7135_codes[IR_KEYTAB_SIZE] = { + + [ 33 ] = KEY_POWER, + [ 105] = KEY_TV, + [ 51 ] = KEY_KP0, + [ 81 ] = KEY_KP1, + [ 49 ] = KEY_KP2, + [ 113] = KEY_KP3, + [ 59 ] = KEY_KP4, + [ 88 ] = KEY_KP5, + [ 65 ] = KEY_KP6, + [ 72 ] = KEY_KP7, + [ 48 ] = KEY_KP8, + [ 83 ] = KEY_KP9, + [ 115] = KEY_AGAIN, /* LOOP */ + [ 10 ] = KEY_AUDIO, + [ 97 ] = KEY_PRINT, /* PREVIEW */ + [ 122] = KEY_VIDEO, + [ 32 ] = KEY_CHANNELUP, + [ 64 ] = KEY_CHANNELDOWN, + [ 24 ] = KEY_VOLUMEDOWN, + [ 80 ] = KEY_VOLUMEUP, + [ 16 ] = KEY_MUTE, + [ 74 ] = KEY_SEARCH, + [ 123] = KEY_SHUFFLE, /* SNAPSHOT */ + [ 34 ] = KEY_RECORD, + [ 98 ] = KEY_STOP, + [ 120] = KEY_PLAY, + [ 57 ] = KEY_REWIND, + [ 89 ] = KEY_PAUSE, + [ 25 ] = KEY_FORWARD, + [ 9 ] = KEY_ZOOM, + + [ 82 ] = KEY_F21, /* LIVE TIMESHIFT */ + [ 26 ] = KEY_F22, /* MIN TIMESHIFT */ + [ 58 ] = KEY_F23, /* TIMESHIFT */ + [ 112] = KEY_F24, /* NORMAL TIMESHIFT */ +}; + /* ---------------------------------------------------------------------- */ static int build_key(struct saa7134_dev *dev) @@ -523,6 +565,13 @@ int saa7134_input_init1(struct saa7134_dev *dev) mask_keydown = 0x002000; polling = 50; // ms break; + case SAA7134_BOARD_GOTVIEW_7135: + ir_codes = gotview7135_codes; + mask_keycode = 0x0003EC; + mask_keyup = 0x008000; + mask_keydown = 0x000010; + polling = 50; // ms + break; case SAA7134_BOARD_VIDEOMATE_TV_PVR: case SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII: ir_codes = videomate_tv_pvr_codes; diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index 45fe6af1eccb..291c2e8d1086 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h @@ -188,6 +188,7 @@ struct saa7134_format { #define SAA7134_BOARD_KWORLD_TERMINATOR 65 #define SAA7134_BOARD_YUAN_TUN900 66 #define SAA7134_BOARD_BEHOLD_409FM 67 +#define SAA7134_BOARD_GOTVIEW_7135 68 #define SAA7134_MAXBOARDS 8 #define SAA7134_INPUT_MAX 8 -- cgit v1.2.2 From dcd555ece9a2228d918a439480d748c163a11d00 Mon Sep 17 00:00:00 2001 From: "Nickolay V. Shmyrev" Date: Tue, 8 Nov 2005 21:36:23 -0800 Subject: [PATCH] v4l: 640: fixed typos - Fixed typos Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/saa7134/saa7134-cards.c | 2 +- drivers/media/video/saa7134/saa7134-input.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index 088376d3c95b..fea2188b2fa9 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c @@ -2142,7 +2142,7 @@ struct saa7134_board saa7134_boards[] = { }, }, [SAA7134_BOARD_GOTVIEW_7135] = { - /* Mike Baikov */ + /* Mike Baikov */ /* Andrey Cvetcov */ .name = "GoTView 7135 PCI", .audio_clock = 0x00187de7, diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index 899abd8ba0d1..c473ddcbd741 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -403,7 +403,7 @@ static IR_KEYTAB_TYPE manli_codes[IR_KEYTAB_SIZE] = { }; -/* Mike Baikov Mike Baikov */ +/* Mike Baikov */ static IR_KEYTAB_TYPE gotview7135_codes[IR_KEYTAB_SIZE] = { [ 33 ] = KEY_POWER, -- cgit v1.2.2 From 84cd961cab8abd764f74d27ee47feff8942fca10 Mon Sep 17 00:00:00 2001 From: "Nickolay V. Shmyrev" Date: Tue, 8 Nov 2005 21:36:24 -0800 Subject: [PATCH] v4l: 643: use key media instead of key videomodeswitch since - Use KEY_MEDIA instead of KEY_VIDEOMODESWITCH Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/ir-kbd-gpio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/video/ir-kbd-gpio.c b/drivers/media/video/ir-kbd-gpio.c index 1861d31f11b8..28b58976f8e0 100644 --- a/drivers/media/video/ir-kbd-gpio.c +++ b/drivers/media/video/ir-kbd-gpio.c @@ -162,7 +162,7 @@ static IR_KEYTAB_TYPE ir_codes_apac_viewcomp[IR_KEYTAB_SIZE] = { static IR_KEYTAB_TYPE ir_codes_conceptronic[IR_KEYTAB_SIZE] = { [ 30 ] = KEY_POWER, // power - [ 7 ] = KEY_SWITCHVIDEOMODE, // source + [ 7 ] = KEY_MEDIA, // source [ 28 ] = KEY_SEARCH, // scan /* FIXME: duplicate keycodes? -- cgit v1.2.2 From 6f3c343bfa61532e02b95d409455a8bab6b47a6b Mon Sep 17 00:00:00 2001 From: "Nickolay V. Shmyrev" Date: Tue, 8 Nov 2005 21:36:24 -0800 Subject: [PATCH] v4l: 644: lower switch from vhf lo to vhf hi for philips 1216me mk3 - Lower switch from VHF_LO to VHF_HI for Philips 1216ME MK3 Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/tuner-simple.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c index 8edd73abe1d8..0ae39be3ca56 100644 --- a/drivers/media/video/tuner-simple.c +++ b/drivers/media/video/tuner-simple.c @@ -185,7 +185,7 @@ static struct tunertype tuners[] = { { "LG PAL (newer TAPC series)", LGINNOTEK, PAL, 16*170.00, 16*450.00, 0x01,0x02,0x08,0x8e,623}, { "Philips PAL/SECAM multi (FM1216ME MK3)", Philips, PAL, - 16*160.00,16*442.00,0x01,0x02,0x04,0x8e,623 }, + 16*158.00,16*442.00,0x01,0x02,0x04,0x8e,623 }, { "LG NTSC (newer TAPC series)", LGINNOTEK, NTSC, 16*170.00, 16*450.00, 0x01,0x02,0x08,0x8e,732}, -- cgit v1.2.2 From b01bc14a2c67b0b562d8201a864d7b4aada07ab4 Mon Sep 17 00:00:00 2001 From: "Nickolay V. Shmyrev" Date: Tue, 8 Nov 2005 21:36:25 -0800 Subject: [PATCH] v4l: 645: refine input handling for manli beholder - Refine input handling for Manli/Beholder. Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/saa7134/saa7134-input.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index c473ddcbd741..baf16a348f44 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -562,7 +562,6 @@ int saa7134_input_init1(struct saa7134_dev *dev) ir_codes = manli_codes; mask_keycode = 0x001f00; mask_keyup = 0x004000; - mask_keydown = 0x002000; polling = 50; // ms break; case SAA7134_BOARD_GOTVIEW_7135: -- cgit v1.2.2 From 99d6c34864342c2071e3a9820bb797374a314fb2 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 8 Nov 2005 21:36:26 -0800 Subject: [PATCH] v4l: 646: enable dvb support for dvico fusionhdtv5 lite - Enable DVB support for DViCO FusionHDTV5 Lite. Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/bttv-cards.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bttv-cards.c index e872cd47a648..e94bffbedfdd 100644 --- a/drivers/media/video/bttv-cards.c +++ b/drivers/media/video/bttv-cards.c @@ -2399,6 +2399,7 @@ struct tvcard bttv_tvcards[] = { .no_msp34xx = 1, .no_tda9875 = 1, .no_tda7432 = 1, + .has_dvb = 1, },{ /* ---- card 0x88---------------------------------- */ /* Mauro Carvalho Chehab */ -- cgit v1.2.2 From c35d4b84f19d3f4b6a2fec652519e721f2cca169 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:36:27 -0800 Subject: [PATCH] v4l: 647: included cb3 structures on tda8290 that should be changed according with - Included CB3 structures on tda8290 Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/tda8290.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/media/video/tda8290.c b/drivers/media/video/tda8290.c index c65f0c7680a2..61268f8a9eec 100644 --- a/drivers/media/video/tda8290.c +++ b/drivers/media/video/tda8290.c @@ -90,6 +90,11 @@ static unsigned char i2c_cb1_50[2] = { 0x30, 0x50 }; static unsigned char i2c_agc2_7F[2] = { 0x60, 0x7F }; static unsigned char i2c_agc3_08[2] = { 0x80, 0x08 }; +/* FIXME: European PAL/SECAM should select 9MHz Lowpass Filter, while + NTSC/M and PAL/M should be using 7MHz filter, by selecting CB3 */ +static unsigned char i2c_cb3_9MHz[2] = { 0xc0, 0x39 }; +static unsigned char i2c_cb3_7MHz[2] = { 0xc0, 0x3B }; + static struct i2c_msg i2c_msg_init[] = { { I2C_ADDR_TDA8275, 0, ARRAY_SIZE(i2c_init_tda8275), i2c_init_tda8275 }, { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_disable_bridge), i2c_disable_bridge }, -- cgit v1.2.2 From b1706b91051e1270e0bd5134219e48732a9d6c42 Mon Sep 17 00:00:00 2001 From: Torsten Seeboth Date: Tue, 8 Nov 2005 21:36:27 -0800 Subject: [PATCH] v4l: 648: some clean up in cx88 tvaudio c - Some clean up in cx88-tvaudio.c Signed-off-by: Torsten Seeboth Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/cx88/cx88-core.c | 10 +- drivers/media/video/cx88/cx88-tvaudio.c | 643 +++++++++++++++----------------- drivers/media/video/cx88/cx88.h | 19 +- 3 files changed, 325 insertions(+), 347 deletions(-) diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c index 3ce000a5b7f9..87212759149e 100644 --- a/drivers/media/video/cx88/cx88-core.c +++ b/drivers/media/video/cx88/cx88-core.c @@ -845,19 +845,19 @@ static int set_tvaudio(struct cx88_core *core) return 0; if (V4L2_STD_PAL_BG & norm->id) { - core->tvaudio = nicam ? WW_NICAM_BGDKL : WW_A2_BG; + core->tvaudio = WW_BG; } else if (V4L2_STD_PAL_DK & norm->id) { - core->tvaudio = nicam ? WW_NICAM_BGDKL : WW_A2_DK; + core->tvaudio = WW_DK; } else if (V4L2_STD_PAL_I & norm->id) { - core->tvaudio = WW_NICAM_I; + core->tvaudio = WW_I; } else if (V4L2_STD_SECAM_L & norm->id) { - core->tvaudio = WW_SYSTEM_L_AM; + core->tvaudio = WW_L; } else if (V4L2_STD_SECAM_DK & norm->id) { - core->tvaudio = WW_A2_DK; + core->tvaudio = WW_DK; } else if ((V4L2_STD_NTSC_M & norm->id) || (V4L2_STD_PAL_M & norm->id)) { diff --git a/drivers/media/video/cx88/cx88-tvaudio.c b/drivers/media/video/cx88/cx88-tvaudio.c index 2765acee0285..b6431cb78a59 100644 --- a/drivers/media/video/cx88/cx88-tvaudio.c +++ b/drivers/media/video/cx88/cx88-tvaudio.c @@ -271,248 +271,102 @@ static void set_audio_standard_BTSC(struct cx88_core *core, unsigned int sap, u3 } } - -static void set_audio_standard_NICAM_L(struct cx88_core *core, int stereo) +static void set_audio_standard_NICAM(struct cx88_core *core, u32 mode) { - /* This is probably weird.. - * Let's operate and find out. */ - - static const struct rlist nicam_l_mono[] = { - { AUD_ERRLOGPERIOD_R, 0x00000064 }, - { AUD_ERRINTRPTTHSHLD1_R, 0x00000FFF }, - { AUD_ERRINTRPTTHSHLD2_R, 0x0000001F }, - { AUD_ERRINTRPTTHSHLD3_R, 0x0000000F }, - - { AUD_PDF_DDS_CNST_BYTE2, 0x48 }, - { AUD_PDF_DDS_CNST_BYTE1, 0x3D }, - { AUD_QAM_MODE, 0x00 }, - { AUD_PDF_DDS_CNST_BYTE0, 0xf5 }, - { AUD_PHACC_FREQ_8MSB, 0x3a }, - { AUD_PHACC_FREQ_8LSB, 0x4a }, - - { AUD_DEEMPHGAIN_R, 0x6680 }, - { AUD_DEEMPHNUMER1_R, 0x353DE }, - { AUD_DEEMPHNUMER2_R, 0x1B1 }, - { AUD_DEEMPHDENOM1_R, 0x0F3D0 }, - { AUD_DEEMPHDENOM2_R, 0x0 }, - { AUD_FM_MODE_ENABLE, 0x7 }, - { AUD_POLYPH80SCALEFAC, 0x3 }, - { AUD_AFE_12DB_EN, 0x1 }, - { AAGC_GAIN, 0x0 }, - { AAGC_HYST, 0x18 }, - { AAGC_DEF, 0x20 }, - { AUD_DN0_FREQ, 0x0 }, - { AUD_POLY0_DDS_CONSTANT, 0x0E4DB2 }, - { AUD_DCOC_0_SRC, 0x21 }, - { AUD_IIR1_0_SEL, 0x0 }, - { AUD_IIR1_0_SHIFT, 0x7 }, - { AUD_IIR1_1_SEL, 0x2 }, - { AUD_IIR1_1_SHIFT, 0x0 }, - { AUD_DCOC_1_SRC, 0x3 }, - { AUD_DCOC1_SHIFT, 0x0 }, - { AUD_DCOC_PASS_IN, 0x0 }, - { AUD_IIR1_2_SEL, 0x23 }, - { AUD_IIR1_2_SHIFT, 0x0 }, - { AUD_IIR1_3_SEL, 0x4 }, - { AUD_IIR1_3_SHIFT, 0x7 }, - { AUD_IIR1_4_SEL, 0x5 }, - { AUD_IIR1_4_SHIFT, 0x7 }, - { AUD_IIR3_0_SEL, 0x7 }, - { AUD_IIR3_0_SHIFT, 0x0 }, - { AUD_DEEMPH0_SRC_SEL, 0x11 }, - { AUD_DEEMPH0_SHIFT, 0x0 }, - { AUD_DEEMPH0_G0, 0x7000 }, - { AUD_DEEMPH0_A0, 0x0 }, - { AUD_DEEMPH0_B0, 0x0 }, - { AUD_DEEMPH0_A1, 0x0 }, - { AUD_DEEMPH0_B1, 0x0 }, - { AUD_DEEMPH1_SRC_SEL, 0x11 }, - { AUD_DEEMPH1_SHIFT, 0x0 }, - { AUD_DEEMPH1_G0, 0x7000 }, - { AUD_DEEMPH1_A0, 0x0 }, - { AUD_DEEMPH1_B0, 0x0 }, - { AUD_DEEMPH1_A1, 0x0 }, - { AUD_DEEMPH1_B1, 0x0 }, - { AUD_OUT0_SEL, 0x3F }, - { AUD_OUT1_SEL, 0x3F }, - { AUD_DMD_RA_DDS, 0x0F5C285 }, - { AUD_PLL_INT, 0x1E }, - { AUD_PLL_DDS, 0x0 }, - { AUD_PLL_FRAC, 0x0E542 }, - - // setup QAM registers - { AUD_RATE_ADJ1, 0x00000100 }, - { AUD_RATE_ADJ2, 0x00000200 }, - { AUD_RATE_ADJ3, 0x00000300 }, - { AUD_RATE_ADJ4, 0x00000400 }, - { AUD_RATE_ADJ5, 0x00000500 }, - { AUD_RATE_THRES_DMD, 0x000000C0 }, - { /* end of list */ }, - }; - static const struct rlist nicam_l[] = { - // setup QAM registers - { AUD_RATE_ADJ1, 0x00000060 }, - { AUD_RATE_ADJ2, 0x000000F9 }, - { AUD_RATE_ADJ3, 0x000001CC }, - { AUD_RATE_ADJ4, 0x000002B3 }, - { AUD_RATE_ADJ5, 0x00000726 }, - { AUD_DEEMPHDENOM1_R, 0x0000F3D0 }, - { AUD_DEEMPHDENOM2_R, 0x00000000 }, - { AUD_ERRLOGPERIOD_R, 0x00000064 }, - { AUD_ERRINTRPTTHSHLD1_R, 0x00000FFF }, - { AUD_ERRINTRPTTHSHLD2_R, 0x0000001F }, - { AUD_ERRINTRPTTHSHLD3_R, 0x0000000F }, - { AUD_POLYPH80SCALEFAC, 0x00000003 }, - { AUD_DMD_RA_DDS, 0x00C00000 }, - { AUD_PLL_INT, 0x0000001E }, - { AUD_PLL_DDS, 0x00000000 }, - { AUD_PLL_FRAC, 0x0000E542 }, - { AUD_START_TIMER, 0x00000000 }, - { AUD_DEEMPHNUMER1_R, 0x000353DE }, - { AUD_DEEMPHNUMER2_R, 0x000001B1 }, - { AUD_PDF_DDS_CNST_BYTE2, 0x06 }, - { AUD_PDF_DDS_CNST_BYTE1, 0x82 }, - { AUD_QAM_MODE, 0x05 }, - { AUD_PDF_DDS_CNST_BYTE0, 0x12 }, - { AUD_PHACC_FREQ_8MSB, 0x34 }, - { AUD_PHACC_FREQ_8LSB, 0x4C }, - { AUD_DEEMPHGAIN_R, 0x00006680 }, - { AUD_RATE_THRES_DMD, 0x000000C0 }, - { /* end of list */ }, - } ; - dprintk("%s (status: devel), stereo : %d\n",__FUNCTION__,stereo); - - if (!stereo) { - /* AM Mono */ - set_audio_start(core, SEL_A2); - set_audio_registers(core, nicam_l_mono); - set_audio_finish(core, EN_A2_FORCE_MONO1); - } else { - /* Nicam Stereo */ - set_audio_start(core, SEL_NICAM); - set_audio_registers(core, nicam_l); - set_audio_finish(core, 0x1924); /* FIXME */ - } -} - -static void set_audio_standard_PAL_I(struct cx88_core *core, int stereo) -{ - static const struct rlist pal_i_fm_mono[] = { - {AUD_ERRLOGPERIOD_R, 0x00000064}, - {AUD_ERRINTRPTTHSHLD1_R, 0x00000fff}, - {AUD_ERRINTRPTTHSHLD2_R, 0x0000001f}, - {AUD_ERRINTRPTTHSHLD3_R, 0x0000000f}, - {AUD_PDF_DDS_CNST_BYTE2, 0x06}, - {AUD_PDF_DDS_CNST_BYTE1, 0x82}, - {AUD_PDF_DDS_CNST_BYTE0, 0x12}, - {AUD_QAM_MODE, 0x05}, - {AUD_PHACC_FREQ_8MSB, 0x3a}, - {AUD_PHACC_FREQ_8LSB, 0x93}, - {AUD_DMD_RA_DDS, 0x002a4f2f}, - {AUD_PLL_INT, 0x0000001e}, - {AUD_PLL_DDS, 0x00000004}, - {AUD_PLL_FRAC, 0x0000e542}, - {AUD_RATE_ADJ1, 0x00000100}, - {AUD_RATE_ADJ2, 0x00000200}, - {AUD_RATE_ADJ3, 0x00000300}, - {AUD_RATE_ADJ4, 0x00000400}, - {AUD_RATE_ADJ5, 0x00000500}, - {AUD_THR_FR, 0x00000000}, - {AUD_PILOT_BQD_1_K0, 0x0000755b}, - {AUD_PILOT_BQD_1_K1, 0x00551340}, - {AUD_PILOT_BQD_1_K2, 0x006d30be}, - {AUD_PILOT_BQD_1_K3, 0xffd394af}, - {AUD_PILOT_BQD_1_K4, 0x00400000}, - {AUD_PILOT_BQD_2_K0, 0x00040000}, - {AUD_PILOT_BQD_2_K1, 0x002a4841}, - {AUD_PILOT_BQD_2_K2, 0x00400000}, - {AUD_PILOT_BQD_2_K3, 0x00000000}, - {AUD_PILOT_BQD_2_K4, 0x00000000}, - {AUD_MODE_CHG_TIMER, 0x00000060}, - {AUD_AFE_12DB_EN, 0x00000001}, - {AAGC_HYST, 0x0000000a}, - {AUD_CORDIC_SHIFT_0, 0x00000007}, - {AUD_CORDIC_SHIFT_1, 0x00000007}, - {AUD_C1_UP_THR, 0x00007000}, - {AUD_C1_LO_THR, 0x00005400}, - {AUD_C2_UP_THR, 0x00005400}, - {AUD_C2_LO_THR, 0x00003000}, - {AUD_DCOC_0_SRC, 0x0000001a}, - {AUD_DCOC0_SHIFT, 0x00000000}, - {AUD_DCOC_0_SHIFT_IN0, 0x0000000a}, - {AUD_DCOC_0_SHIFT_IN1, 0x00000008}, - {AUD_DCOC_PASS_IN, 0x00000003}, - {AUD_IIR3_0_SEL, 0x00000021}, - {AUD_DN2_AFC, 0x00000002}, - {AUD_DCOC_1_SRC, 0x0000001b}, - {AUD_DCOC1_SHIFT, 0x00000000}, - {AUD_DCOC_1_SHIFT_IN0, 0x0000000a}, - {AUD_DCOC_1_SHIFT_IN1, 0x00000008}, - {AUD_IIR3_1_SEL, 0x00000023}, - {AUD_DN0_FREQ, 0x000035a3}, - {AUD_DN2_FREQ, 0x000029c7}, - {AUD_CRDC0_SRC_SEL, 0x00000511}, - {AUD_IIR1_0_SEL, 0x00000001}, - {AUD_IIR1_1_SEL, 0x00000000}, - {AUD_IIR3_2_SEL, 0x00000003}, - {AUD_IIR3_2_SHIFT, 0x00000000}, - {AUD_IIR3_0_SEL, 0x00000002}, - {AUD_IIR2_0_SEL, 0x00000021}, - {AUD_IIR2_0_SHIFT, 0x00000002}, - {AUD_DEEMPH0_SRC_SEL, 0x0000000b}, - {AUD_DEEMPH1_SRC_SEL, 0x0000000b}, - {AUD_POLYPH80SCALEFAC, 0x00000001}, - {AUD_START_TIMER, 0x00000000}, + { AUD_AFE_12DB_EN, 0x00000001}, + { AUD_RATE_ADJ1, 0x00000060 }, + { AUD_RATE_ADJ2, 0x000000F9 }, + { AUD_RATE_ADJ3, 0x000001CC }, + { AUD_RATE_ADJ4, 0x000002B3 }, + { AUD_RATE_ADJ5, 0x00000726 }, + { AUD_DEEMPHDENOM1_R, 0x0000F3D0 }, + { AUD_DEEMPHDENOM2_R, 0x00000000 }, + { AUD_ERRLOGPERIOD_R, 0x00000064 }, + { AUD_ERRINTRPTTHSHLD1_R, 0x00000FFF }, + { AUD_ERRINTRPTTHSHLD2_R, 0x0000001F }, + { AUD_ERRINTRPTTHSHLD3_R, 0x0000000F }, + { AUD_POLYPH80SCALEFAC, 0x00000003 }, + { AUD_DMD_RA_DDS, 0x00C00000 }, + { AUD_PLL_INT, 0x0000001E }, + { AUD_PLL_DDS, 0x00000000 }, + { AUD_PLL_FRAC, 0x0000E542 }, + { AUD_START_TIMER, 0x00000000 }, + { AUD_DEEMPHNUMER1_R, 0x000353DE }, + { AUD_DEEMPHNUMER2_R, 0x000001B1 }, + { AUD_PDF_DDS_CNST_BYTE2, 0x06 }, + { AUD_PDF_DDS_CNST_BYTE1, 0x82 }, + { AUD_PDF_DDS_CNST_BYTE0, 0x12 }, + { AUD_QAM_MODE, 0x05 }, + { AUD_PHACC_FREQ_8MSB, 0x34 }, + { AUD_PHACC_FREQ_8LSB, 0x4C }, + { AUD_DEEMPHGAIN_R, 0x00006680 }, + { AUD_RATE_THRES_DMD, 0x000000C0 }, { /* end of list */ }, - }; + } ; - static const struct rlist pal_i_nicam[] = { + static const struct rlist nicam_bgdki_common[] = { + { AUD_AFE_12DB_EN, 0x00000001}, { AUD_RATE_ADJ1, 0x00000010 }, { AUD_RATE_ADJ2, 0x00000040 }, { AUD_RATE_ADJ3, 0x00000100 }, { AUD_RATE_ADJ4, 0x00000400 }, { AUD_RATE_ADJ5, 0x00001000 }, - // { AUD_DMD_RA_DDS, 0x00c0d5ce }, - { AUD_DEEMPHGAIN_R, 0x000023c2 }, - { AUD_DEEMPHNUMER1_R, 0x0002a7bc }, - { AUD_DEEMPHNUMER2_R, 0x0003023e }, - { AUD_DEEMPHDENOM1_R, 0x0000f3d0 }, - { AUD_DEEMPHDENOM2_R, 0x00000000 }, - { AUD_DEEMPHDENOM2_R, 0x00000000 }, - { AUD_ERRLOGPERIOD_R, 0x00000fff }, - { AUD_ERRINTRPTTHSHLD1_R, 0x000003ff }, - { AUD_ERRINTRPTTHSHLD2_R, 0x000000ff }, - { AUD_ERRINTRPTTHSHLD3_R, 0x0000003f }, - { AUD_POLYPH80SCALEFAC, 0x00000003 }, - { AUD_PDF_DDS_CNST_BYTE2, 0x06 }, + //{ AUD_DMD_RA_DDS, 0x00c0d5ce }, + { AUD_ERRLOGPERIOD_R, 0x00000fff}, + { AUD_ERRINTRPTTHSHLD1_R, 0x000003ff}, + { AUD_ERRINTRPTTHSHLD2_R, 0x000000ff}, + { AUD_ERRINTRPTTHSHLD3_R, 0x0000003f}, + { AUD_POLYPH80SCALEFAC, 0x00000003}, + { AUD_DEEMPHGAIN_R, 0x000023c2}, + { AUD_DEEMPHNUMER1_R, 0x0002a7bc}, + { AUD_DEEMPHNUMER2_R, 0x0003023e}, + { AUD_DEEMPHDENOM1_R, 0x0000f3d0}, + { AUD_DEEMPHDENOM2_R, 0x00000000}, { AUD_PDF_DDS_CNST_BYTE1, 0x82 }, { AUD_PDF_DDS_CNST_BYTE0, 0x16 }, { AUD_QAM_MODE, 0x05 }, + { /* end of list */ }, + }; + + static const struct rlist nicam_i[] = { { AUD_PDF_DDS_CNST_BYTE0, 0x12 }, { AUD_PHACC_FREQ_8MSB, 0x3a }, { AUD_PHACC_FREQ_8LSB, 0x93 }, { /* end of list */ }, }; - dprintk("%s (status: devel), stereo : %d\n",__FUNCTION__,stereo); + static const struct rlist nicam_default[] = { + { AUD_PDF_DDS_CNST_BYTE0, 0x16 }, + { AUD_PHACC_FREQ_8MSB, 0x34 }, + { AUD_PHACC_FREQ_8LSB, 0x4c }, + { /* end of list */ }, + }; - if (!stereo) { - /* FM Mono */ - set_audio_start(core, SEL_A2); - set_audio_registers(core, pal_i_fm_mono); - set_audio_finish(core, EN_DMTRX_SUMDIFF | EN_A2_FORCE_MONO1); - } else { - /* Nicam Stereo */ - set_audio_start(core, SEL_NICAM); - set_audio_registers(core, pal_i_nicam); - set_audio_finish(core, EN_DMTRX_LR | EN_DMTRX_BYPASS | EN_NICAM_AUTO_STEREO); - } + switch (core->tvaudio) { + case WW_L: + dprintk("%s SECAM-L NICAM (status: devel)\n",__FUNCTION__); + set_audio_registers(core, nicam_l); + break; + case WW_I: + dprintk("%s PAL-I NICAM (status: devel)\n",__FUNCTION__); + set_audio_registers(core, nicam_bgdki_common); + set_audio_registers(core, nicam_i); + break; + default: + dprintk("%s PAL-BGDK NICAM (status: unknown)\n",__FUNCTION__); + set_audio_registers(core, nicam_bgdki_common); + set_audio_registers(core, nicam_default); + break; + }; + + mode |= EN_DMTRX_LR | EN_DMTRX_BYPASS; + set_audio_finish(core, mode); } static void set_audio_standard_A2(struct cx88_core *core, u32 mode) { - static const struct rlist a2_common[] = { + static const struct rlist a2_bgdk_common[] = { {AUD_ERRLOGPERIOD_R, 0x00000064}, {AUD_ERRINTRPTTHSHLD1_R, 0x00000fff}, {AUD_ERRINTRPTTHSHLD2_R, 0x0000001f}, @@ -576,7 +430,7 @@ static void set_audio_standard_A2(struct cx88_core *core, u32 mode) {AUD_C1_LO_THR, 0x00005400}, {AUD_C2_UP_THR, 0x00005400}, {AUD_C2_LO_THR, 0x00003000}, - { /* end of list */ }, + { /* end of list */ }, }; static const struct rlist a2_dk[] = { @@ -587,24 +441,145 @@ static void set_audio_standard_A2(struct cx88_core *core, u32 mode) {AUD_C2_LO_THR, 0x00003000}, {AUD_DN0_FREQ, 0x00003a1c}, {AUD_DN2_FREQ, 0x0000d2e0}, - { /* end of list */ }, + { /* end of list */ }, }; -/* unknown, probably NTSC-M */ - static const struct rlist a2_m[] = { - {AUD_DMD_RA_DDS, 0x002a0425}, - {AUD_C1_UP_THR, 0x00003c00}, - {AUD_C1_LO_THR, 0x00003000}, - {AUD_C2_UP_THR, 0x00006000}, - {AUD_C2_LO_THR, 0x00003c00}, - {AUD_DEEMPH0_A0, 0x00007a80}, - {AUD_DEEMPH1_A0, 0x00007a80}, - {AUD_DEEMPH0_G0, 0x00001200}, - {AUD_DEEMPH1_G0, 0x00001200}, - {AUD_DN0_FREQ, 0x0000283b}, - {AUD_DN1_FREQ, 0x00003418}, - {AUD_DN2_FREQ, 0x000029c7}, - {AUD_POLY0_DDS_CONSTANT, 0x000a7540}, - { /* end of list */ }, + + static const struct rlist a1_i[] = { + {AUD_ERRLOGPERIOD_R, 0x00000064}, + {AUD_ERRINTRPTTHSHLD1_R, 0x00000fff}, + {AUD_ERRINTRPTTHSHLD2_R, 0x0000001f}, + {AUD_ERRINTRPTTHSHLD3_R, 0x0000000f}, + {AUD_PDF_DDS_CNST_BYTE2, 0x06}, + {AUD_PDF_DDS_CNST_BYTE1, 0x82}, + {AUD_PDF_DDS_CNST_BYTE0, 0x12}, + {AUD_QAM_MODE, 0x05}, + {AUD_PHACC_FREQ_8MSB, 0x3a}, + {AUD_PHACC_FREQ_8LSB, 0x93}, + {AUD_DMD_RA_DDS, 0x002a4f2f}, + {AUD_PLL_INT, 0x0000001e}, + {AUD_PLL_DDS, 0x00000004}, + {AUD_PLL_FRAC, 0x0000e542}, + {AUD_RATE_ADJ1, 0x00000100}, + {AUD_RATE_ADJ2, 0x00000200}, + {AUD_RATE_ADJ3, 0x00000300}, + {AUD_RATE_ADJ4, 0x00000400}, + {AUD_RATE_ADJ5, 0x00000500}, + {AUD_THR_FR, 0x00000000}, + {AUD_PILOT_BQD_1_K0, 0x0000755b}, + {AUD_PILOT_BQD_1_K1, 0x00551340}, + {AUD_PILOT_BQD_1_K2, 0x006d30be}, + {AUD_PILOT_BQD_1_K3, 0xffd394af}, + {AUD_PILOT_BQD_1_K4, 0x00400000}, + {AUD_PILOT_BQD_2_K0, 0x00040000}, + {AUD_PILOT_BQD_2_K1, 0x002a4841}, + {AUD_PILOT_BQD_2_K2, 0x00400000}, + {AUD_PILOT_BQD_2_K3, 0x00000000}, + {AUD_PILOT_BQD_2_K4, 0x00000000}, + {AUD_MODE_CHG_TIMER, 0x00000060}, + {AUD_AFE_12DB_EN, 0x00000001}, + {AAGC_HYST, 0x0000000a}, + {AUD_CORDIC_SHIFT_0, 0x00000007}, + {AUD_CORDIC_SHIFT_1, 0x00000007}, + {AUD_C1_UP_THR, 0x00007000}, + {AUD_C1_LO_THR, 0x00005400}, + {AUD_C2_UP_THR, 0x00005400}, + {AUD_C2_LO_THR, 0x00003000}, + {AUD_DCOC_0_SRC, 0x0000001a}, + {AUD_DCOC0_SHIFT, 0x00000000}, + {AUD_DCOC_0_SHIFT_IN0, 0x0000000a}, + {AUD_DCOC_0_SHIFT_IN1, 0x00000008}, + {AUD_DCOC_PASS_IN, 0x00000003}, + {AUD_IIR3_0_SEL, 0x00000021}, + {AUD_DN2_AFC, 0x00000002}, + {AUD_DCOC_1_SRC, 0x0000001b}, + {AUD_DCOC1_SHIFT, 0x00000000}, + {AUD_DCOC_1_SHIFT_IN0, 0x0000000a}, + {AUD_DCOC_1_SHIFT_IN1, 0x00000008}, + {AUD_IIR3_1_SEL, 0x00000023}, + {AUD_DN0_FREQ, 0x000035a3}, + {AUD_DN2_FREQ, 0x000029c7}, + {AUD_CRDC0_SRC_SEL, 0x00000511}, + {AUD_IIR1_0_SEL, 0x00000001}, + {AUD_IIR1_1_SEL, 0x00000000}, + {AUD_IIR3_2_SEL, 0x00000003}, + {AUD_IIR3_2_SHIFT, 0x00000000}, + {AUD_IIR3_0_SEL, 0x00000002}, + {AUD_IIR2_0_SEL, 0x00000021}, + {AUD_IIR2_0_SHIFT, 0x00000002}, + {AUD_DEEMPH0_SRC_SEL, 0x0000000b}, + {AUD_DEEMPH1_SRC_SEL, 0x0000000b}, + {AUD_POLYPH80SCALEFAC, 0x00000001}, + {AUD_START_TIMER, 0x00000000}, + { /* end of list */ }, + }; + + static const struct rlist am_l[] = { + {AUD_ERRLOGPERIOD_R, 0x00000064}, + {AUD_ERRINTRPTTHSHLD1_R, 0x00000FFF}, + {AUD_ERRINTRPTTHSHLD2_R, 0x0000001F}, + {AUD_ERRINTRPTTHSHLD3_R, 0x0000000F}, + {AUD_PDF_DDS_CNST_BYTE2, 0x48}, + {AUD_PDF_DDS_CNST_BYTE1, 0x3D}, + {AUD_QAM_MODE, 0x00}, + {AUD_PDF_DDS_CNST_BYTE0, 0xf5}, + {AUD_PHACC_FREQ_8MSB, 0x3a}, + {AUD_PHACC_FREQ_8LSB, 0x4a}, + {AUD_DEEMPHGAIN_R, 0x00006680}, + {AUD_DEEMPHNUMER1_R, 0x000353DE}, + {AUD_DEEMPHNUMER2_R, 0x000001B1}, + {AUD_DEEMPHDENOM1_R, 0x0000F3D0}, + {AUD_DEEMPHDENOM2_R, 0x00000000}, + {AUD_FM_MODE_ENABLE, 0x00000007}, + {AUD_POLYPH80SCALEFAC, 0x00000003}, + {AUD_AFE_12DB_EN, 0x00000001}, + {AAGC_GAIN, 0x00000000}, + {AAGC_HYST, 0x00000018}, + {AAGC_DEF, 0x00000020}, + {AUD_DN0_FREQ, 0x00000000}, + {AUD_POLY0_DDS_CONSTANT, 0x000E4DB2}, + {AUD_DCOC_0_SRC, 0x00000021}, + {AUD_IIR1_0_SEL, 0x00000000}, + {AUD_IIR1_0_SHIFT, 0x00000007}, + {AUD_IIR1_1_SEL, 0x00000002}, + {AUD_IIR1_1_SHIFT, 0x00000000}, + {AUD_DCOC_1_SRC, 0x00000003}, + {AUD_DCOC1_SHIFT, 0x00000000}, + {AUD_DCOC_PASS_IN, 0x00000000}, + {AUD_IIR1_2_SEL, 0x00000023}, + {AUD_IIR1_2_SHIFT, 0x00000000}, + {AUD_IIR1_3_SEL, 0x00000004}, + {AUD_IIR1_3_SHIFT, 0x00000007}, + {AUD_IIR1_4_SEL, 0x00000005}, + {AUD_IIR1_4_SHIFT, 0x00000007}, + {AUD_IIR3_0_SEL, 0x00000007}, + {AUD_IIR3_0_SHIFT, 0x00000000}, + {AUD_DEEMPH0_SRC_SEL, 0x00000011}, + {AUD_DEEMPH0_SHIFT, 0x00000000}, + {AUD_DEEMPH0_G0, 0x00007000}, + {AUD_DEEMPH0_A0, 0x00000000}, + {AUD_DEEMPH0_B0, 0x00000000}, + {AUD_DEEMPH0_A1, 0x00000000}, + {AUD_DEEMPH0_B1, 0x00000000}, + {AUD_DEEMPH1_SRC_SEL, 0x00000011}, + {AUD_DEEMPH1_SHIFT, 0x00000000}, + {AUD_DEEMPH1_G0, 0x00007000}, + {AUD_DEEMPH1_A0, 0x00000000}, + {AUD_DEEMPH1_B0, 0x00000000}, + {AUD_DEEMPH1_A1, 0x00000000}, + {AUD_DEEMPH1_B1, 0x00000000}, + {AUD_OUT0_SEL, 0x0000003F}, + {AUD_OUT1_SEL, 0x0000003F}, + {AUD_DMD_RA_DDS, 0x00F5C285}, + {AUD_PLL_INT, 0x0000001E}, + {AUD_PLL_DDS, 0x00000000}, + {AUD_PLL_FRAC, 0x0000E542}, + {AUD_RATE_ADJ1, 0x00000100}, + {AUD_RATE_ADJ2, 0x00000200}, + {AUD_RATE_ADJ3, 0x00000300}, + {AUD_RATE_ADJ4, 0x00000400}, + {AUD_RATE_ADJ5, 0x00000500}, + {AUD_RATE_THRES_DMD, 0x000000C0}, + {/* end of list */ }, }; static const struct rlist a2_deemph50[] = { @@ -616,32 +591,32 @@ static void set_audio_standard_A2(struct cx88_core *core, u32 mode) { /* end of list */ }, }; - static const struct rlist a2_deemph75[] = { - {AUD_DEEMPH0_G0, 0x00000480}, - {AUD_DEEMPH1_G0, 0x00000480}, - {AUD_DEEMPHGAIN_R, 0x00009000}, - {AUD_DEEMPHNUMER1_R, 0x000353de}, - {AUD_DEEMPHNUMER2_R, 0x000001b1}, - { /* end of list */ }, - }; - set_audio_start(core, SEL_A2); - set_audio_registers(core, a2_common); switch (core->tvaudio) { - case WW_A2_BG: - dprintk("%s PAL-BG A2 (status: known-good)\n",__FUNCTION__); - set_audio_registers(core, a2_bg); - set_audio_registers(core, a2_deemph50); + case WW_BG: + dprintk("%s PAL-BG A1/2 (status: known-good)\n",__FUNCTION__); + set_audio_registers(core, a2_bgdk_common); + set_audio_registers(core, a2_bg); + set_audio_registers(core, a2_deemph50); break; - case WW_A2_DK: - dprintk("%s PAL-DK A2 (status: known-good)\n",__FUNCTION__); - set_audio_registers(core, a2_dk); - set_audio_registers(core, a2_deemph50); + case WW_DK: + dprintk("%s PAL-DK A1/2 (status: known-good)\n",__FUNCTION__); + set_audio_registers(core, a2_bgdk_common); + set_audio_registers(core, a2_dk); + set_audio_registers(core, a2_deemph50); break; - case WW_A2_M: - dprintk("%s NTSC-M A2 (status: unknown)\n",__FUNCTION__); - set_audio_registers(core, a2_m); - set_audio_registers(core, a2_deemph75); + case WW_I: + dprintk("%s PAL-I A1 (status: known-good)\n",__FUNCTION__); + set_audio_registers(core, a1_i); + set_audio_registers(core, a2_deemph50); + break; + case WW_L: + dprintk("%s AM-L (status: devel)\n",__FUNCTION__); + set_audio_registers(core, am_l); + break; + default: + dprintk("%s Warning: wrong value\n",__FUNCTION__); + return; break; }; @@ -728,22 +703,53 @@ static void set_audio_standard_FM(struct cx88_core *core, enum cx88_deemph_type /* ----------------------------------------------------------- */ +int cx88_detect_nicam(struct cx88_core *core) +{ + int i, j=0; + + dprintk("start nicam autodetect.\n"); + + for(i=0; i<6; i++) { + /* if bit1=1 then nicam is detected */ + j+= ((cx_read(AUD_NICAM_STATUS2) & 0x02) >> 1); + + /* 3x detected: absolutly sure now */ + if(j==3) { + dprintk("nicam is detected.\n"); + return 1; + } + + /* wait a little bit for next reading status */ + msleep (10); + } + + dprintk("nicam is not detected.\n"); + return 0; +} + void cx88_set_tvaudio(struct cx88_core *core) { switch (core->tvaudio) { case WW_BTSC: set_audio_standard_BTSC(core, 0, EN_BTSC_AUTO_STEREO); break; - case WW_NICAM_BGDKL: - set_audio_standard_NICAM_L(core,0); - break; - case WW_NICAM_I: - set_audio_standard_PAL_I(core,0); - break; - case WW_A2_BG: - case WW_A2_DK: - case WW_A2_M: - set_audio_standard_A2(core, EN_A2_FORCE_MONO1); + case WW_BG: + case WW_DK: + case WW_I: + case WW_L: + /* prepare all dsp registers */ + set_audio_standard_A2(core, EN_A2_FORCE_MONO1); + + /* set nicam mode - otherwise + AUD_NICAM_STATUS2 contains wrong values */ + set_audio_standard_NICAM(core, EN_NICAM_FORCE_MONO1); + if(0 == cx88_detect_nicam(core)) { + /* fall back to fm / am mono */ + set_audio_standard_A2(core, EN_A2_FORCE_MONO1); + core->use_nicam = 0; + } else { + core->use_nicam = 1; + } break; case WW_EIAJ: set_audio_standard_EIAJ(core); @@ -751,9 +757,6 @@ void cx88_set_tvaudio(struct cx88_core *core) case WW_FM: set_audio_standard_FM(core,FM_NO_DEEMPH); break; - case WW_SYSTEM_L_AM: - set_audio_standard_NICAM_L(core, 1); - break; case WW_NONE: default: printk("%s/0: unknown tv audio mode [%d]\n", @@ -766,14 +769,6 @@ void cx88_set_tvaudio(struct cx88_core *core) void cx88_newstation(struct cx88_core *core) { core->audiomode_manual = UNSET; - - switch (core->tvaudio) { - case WW_SYSTEM_L_AM: - /* try nicam ... */ - core->audiomode_current = V4L2_TUNER_MODE_STEREO; - set_audio_standard_NICAM_L(core, 1); - break; - } } void cx88_get_stereo(struct cx88_core *core, struct v4l2_tuner *t) @@ -879,58 +874,42 @@ void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual) break; } break; - case WW_A2_BG: - case WW_A2_DK: - case WW_A2_M: - switch (mode) { - case V4L2_TUNER_MODE_MONO: - case V4L2_TUNER_MODE_LANG1: - set_audio_standard_A2(core, EN_A2_FORCE_MONO1); - break; - case V4L2_TUNER_MODE_LANG2: - set_audio_standard_A2(core, EN_A2_FORCE_MONO2); - break; - case V4L2_TUNER_MODE_STEREO: - set_audio_standard_A2(core, EN_A2_FORCE_STEREO); - break; - } - break; - case WW_NICAM_BGDKL: - switch (mode) { - case V4L2_TUNER_MODE_MONO: - ctl = EN_NICAM_FORCE_MONO1; - mask = 0x3f; - break; - case V4L2_TUNER_MODE_LANG1: - ctl = EN_NICAM_AUTO_MONO2; - mask = 0x3f; - break; - case V4L2_TUNER_MODE_STEREO: - ctl = EN_NICAM_FORCE_STEREO | EN_DMTRX_LR; - mask = 0x93f; - break; - } - break; - case WW_SYSTEM_L_AM: - switch (mode) { - case V4L2_TUNER_MODE_MONO: - case V4L2_TUNER_MODE_LANG1: /* FIXME */ - set_audio_standard_NICAM_L(core, 0); - break; - case V4L2_TUNER_MODE_STEREO: - set_audio_standard_NICAM_L(core, 1); - break; - } - break; - case WW_NICAM_I: - switch (mode) { - case V4L2_TUNER_MODE_MONO: - case V4L2_TUNER_MODE_LANG1: - set_audio_standard_PAL_I(core, 0); - break; - case V4L2_TUNER_MODE_STEREO: - set_audio_standard_PAL_I(core, 1); - break; + case WW_BG: + case WW_DK: + case WW_I: + case WW_L: + if(1 == core->use_nicam) { + switch (mode) { + case V4L2_TUNER_MODE_MONO: + case V4L2_TUNER_MODE_LANG1: + set_audio_standard_NICAM(core, EN_NICAM_FORCE_MONO1); + break; + case V4L2_TUNER_MODE_LANG2: + set_audio_standard_NICAM(core, EN_NICAM_FORCE_MONO2); + break; + case V4L2_TUNER_MODE_STEREO: + set_audio_standard_NICAM(core, EN_NICAM_FORCE_STEREO); + break; + } + } else { + if ( (core->tvaudio == WW_I) || (core->tvaudio == WW_L) ) { + /* fall back to fm / am mono */ + set_audio_standard_A2(core, EN_A2_FORCE_MONO1); + } else { + /* TODO: Add A2 autodection */ + switch (mode) { + case V4L2_TUNER_MODE_MONO: + case V4L2_TUNER_MODE_LANG1: + set_audio_standard_A2(core, EN_A2_FORCE_MONO1); + break; + case V4L2_TUNER_MODE_LANG2: + set_audio_standard_A2(core, EN_A2_FORCE_MONO2); + break; + case V4L2_TUNER_MODE_STEREO: + set_audio_standard_A2(core, EN_A2_FORCE_STEREO); + break; + } + } } break; case WW_FM: diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h index b18205b3fa24..3d885b4025d8 100644 --- a/drivers/media/video/cx88/cx88.h +++ b/drivers/media/video/cx88/cx88.h @@ -288,6 +288,7 @@ struct cx88_core { u32 audiomode_current; u32 input; u32 astat; + u32 use_nicam; /* IR remote control state */ struct cx88_IR *ir; @@ -527,22 +528,20 @@ extern void cx88_card_setup(struct cx88_core *core); #define WW_NONE 1 #define WW_BTSC 2 -#define WW_NICAM_I 3 -#define WW_NICAM_BGDKL 4 -#define WW_A1 5 -#define WW_A2_BG 6 -#define WW_A2_DK 7 -#define WW_A2_M 8 -#define WW_EIAJ 9 -#define WW_SYSTEM_L_AM 10 -#define WW_I2SPT 11 -#define WW_FM 12 +#define WW_BG 3 +#define WW_DK 4 +#define WW_I 5 +#define WW_L 6 +#define WW_EIAJ 7 +#define WW_I2SPT 8 +#define WW_FM 9 void cx88_set_tvaudio(struct cx88_core *core); void cx88_newstation(struct cx88_core *core); void cx88_get_stereo(struct cx88_core *core, struct v4l2_tuner *t); void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual); int cx88_audio_thread(void *data); +int cx88_detect_nicam(struct cx88_core *core); /* ----------------------------------------------------------- */ /* cx88-input.c */ -- cgit v1.2.2 From c5df599b67b5a061d28a2154a49f9704e0d1040b Mon Sep 17 00:00:00 2001 From: Catalin Climov Date: Tue, 8 Nov 2005 21:36:28 -0800 Subject: [PATCH] v4l: 649: fixed gcc 4 0 compile warnings by moving var declarations to the top of the function or block - Fixed gcc 4.0 compile warnings by moving var declarations to the top of the function or block. Signed-off-by: Catalin Climov Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/cx88/cx88-blackbird.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c index eca36b8539fa..fac67d98a745 100644 --- a/drivers/media/video/cx88/cx88-blackbird.c +++ b/drivers/media/video/cx88/cx88-blackbird.c @@ -781,6 +781,7 @@ static const int BITRATES_SIZE = ARRAY_SIZE(mpeg_audio_bitrates); static void blackbird_set_default_params(struct cx8802_dev *dev) { struct v4l2_mpeg_compression *params = &dev->params; + u32 au_params; /* assign stream type */ if( params->st_type >= ARRAY_SIZE(mpeg_stream_types) ) @@ -827,7 +828,7 @@ static void blackbird_set_default_params(struct cx8802_dev *dev) /* assign audio properties */ /* note: it's not necessary to set the samplerate, the mpeg encoder seems to autodetect/adjust */ - u32 au_params = BLACKBIRD_AUDIO_BITS_STEREO | + au_params = BLACKBIRD_AUDIO_BITS_STEREO | /* BLACKBIRD_AUDIO_BITS_BOUND_4 | */ BLACKBIRD_AUDIO_BITS_EMPHASIS_NONE | BLACKBIRD_AUDIO_BITS_CRC_OFF | @@ -861,12 +862,14 @@ static void blackbird_set_default_params(struct cx8802_dev *dev) } if( params->au_bitrate.mode ) { + int layer; + if( params->au_bitrate.mode == V4L2_BITRATE_CBR ) params->au_bitrate.max = params->vi_bitrate.target; else params->au_bitrate.target = params->vi_bitrate.max; - int layer = params->au_type; + layer = params->au_type; if( params->au_bitrate.target == 0 ) { /* TODO: use the minimum possible bitrate instead of 0 ? */ @@ -946,6 +949,8 @@ static void blackbird_set_default_params(struct cx8802_dev *dev) #define UPDATE_PARAM( name ) dev->params.name = params->name void blackbird_set_params(struct cx8802_dev *dev, struct v4l2_mpeg_compression *params) { + u32 au_params; + /* assign stream type */ if( params->st_type >= ARRAY_SIZE(mpeg_stream_types) ) params->st_type = V4L2_MPEG_PS_2; @@ -1015,7 +1020,7 @@ void blackbird_set_params(struct cx8802_dev *dev, struct v4l2_mpeg_compression * /* assign audio properties */ /* note: it's not necessary to set the samplerate, the mpeg encoder seems to autodetect/adjust */ - u32 au_params = BLACKBIRD_AUDIO_BITS_STEREO | + au_params = BLACKBIRD_AUDIO_BITS_STEREO | /* BLACKBIRD_AUDIO_BITS_BOUND_4 | */ BLACKBIRD_AUDIO_BITS_EMPHASIS_NONE | BLACKBIRD_AUDIO_BITS_CRC_OFF | @@ -1049,12 +1054,14 @@ void blackbird_set_params(struct cx8802_dev *dev, struct v4l2_mpeg_compression * } if( params->au_bitrate.mode ) { + int layer; + if( params->au_bitrate.mode == V4L2_BITRATE_CBR ) params->au_bitrate.max = params->vi_bitrate.target; else params->au_bitrate.target = params->vi_bitrate.max; - int layer = params->au_type; + layer = params->au_type; if( params->au_bitrate.target == 0 ) { /* TODO: use the minimum possible bitrate instead of 0 ? */ -- cgit v1.2.2 From f9e7a0203def0704beaf4af1ff2c772f9fa712cf Mon Sep 17 00:00:00 2001 From: Peter Hagervall Date: Tue, 8 Nov 2005 21:36:29 -0800 Subject: [PATCH] v4l: 651: fix a number of sparse warnings - Fix a number of sparse warnings. Signed-off-by: Peter Hagervall Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/cx88/cx88-core.c | 2 +- drivers/media/video/cx88/cx88-video.c | 2 +- drivers/media/video/cx88/cx88.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c index 87212759149e..8f1c27fdae6a 100644 --- a/drivers/media/video/cx88/cx88-core.c +++ b/drivers/media/video/cx88/cx88-core.c @@ -431,7 +431,7 @@ int cx88_sram_channel_setup(struct cx88_core *core, /* ------------------------------------------------------------------ */ /* debug helper code */ -int cx88_risc_decode(u32 risc) +static int cx88_risc_decode(u32 risc) { static char *instr[16] = { [ RISC_SYNC >> 28 ] = "sync", diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index 67630f61c470..a29c12754ef6 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c @@ -787,7 +787,7 @@ static int video_open(struct inode *inode, struct file *file) } static ssize_t -video_read(struct file *file, char *data, size_t count, loff_t *ppos) +video_read(struct file *file, char __user *data, size_t count, loff_t *ppos) { struct cx8800_fh *fh = file->private_data; diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h index 3d885b4025d8..bd27b56ace26 100644 --- a/drivers/media/video/cx88/cx88.h +++ b/drivers/media/video/cx88/cx88.h @@ -204,8 +204,8 @@ struct cx88_board { int tda9887_conf; struct cx88_input input[MAX_CX88_INPUT]; struct cx88_input radio; - int blackbird:1; - int dvb:1; + unsigned int blackbird:1; + unsigned int dvb:1; }; struct cx88_subid { -- cgit v1.2.2 From 3aa4f48aee93e793071e26d6807efdf6eb111614 Mon Sep 17 00:00:00 2001 From: Hartmut Hackmann Date: Tue, 8 Nov 2005 21:36:30 -0800 Subject: [PATCH] v4l: 653: ts dma buffer synchronization was inverted - TS DMA buffer synchronization was inverted Signed-off-by: Hartmut Hackmann Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/saa7134/saa7134-ts.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/drivers/media/video/saa7134/saa7134-ts.c b/drivers/media/video/saa7134/saa7134-ts.c index 463885601ab4..cdfd69873ba9 100644 --- a/drivers/media/video/saa7134/saa7134-ts.c +++ b/drivers/media/video/saa7134/saa7134-ts.c @@ -46,17 +46,11 @@ static int buffer_activate(struct saa7134_dev *dev, struct saa7134_buf *buf, struct saa7134_buf *next) { - u32 control; dprintk("buffer_activate [%p]",buf); buf->vb.state = STATE_ACTIVE; buf->top_seen = 0; - /* dma: setup channel 5 (= TS) */ - control = SAA7134_RS_CONTROL_BURST_16 | - SAA7134_RS_CONTROL_ME | - (buf->pt->dma >> 12); - if (NULL == next) next = buf; if (V4L2_FIELD_TOP == buf->vb.field) { @@ -68,8 +62,6 @@ static int buffer_activate(struct saa7134_dev *dev, saa_writel(SAA7134_RS_BA1(5),saa7134_buffer_base(next)); saa_writel(SAA7134_RS_BA2(5),saa7134_buffer_base(buf)); } - saa_writel(SAA7134_RS_PITCH(5),TS_PACKET_SIZE); - saa_writel(SAA7134_RS_CONTROL(5),control); /* start DMA */ saa7134_set_dmabits(dev); @@ -84,6 +76,7 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, struct saa7134_dev *dev = q->priv_data; struct saa7134_buf *buf = container_of(vb,struct saa7134_buf,vb); unsigned int lines, llength, size; + u32 control; int err; dprintk("buffer_prepare [%p,%s]\n",buf,v4l2_field_names[field]); @@ -115,6 +108,18 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, if (err) goto oops; } + + /* dma: setup channel 5 (= TS) */ + control = SAA7134_RS_CONTROL_BURST_16 | + SAA7134_RS_CONTROL_ME | + (buf->pt->dma >> 12); + + saa_writeb(SAA7134_TS_DMA0, ((lines-1)&0xff)); + saa_writeb(SAA7134_TS_DMA1, (((lines-1)>>8)&0xff)); + saa_writeb(SAA7134_TS_DMA2, ((((lines-1)>>16)&0x3f) | 0x00)); /* TSNOPIT=0, TSCOLAP=0 */ + saa_writel(SAA7134_RS_PITCH(5),TS_PACKET_SIZE); + saa_writel(SAA7134_RS_CONTROL(5),control); + buf->vb.state = STATE_PREPARED; buf->activate = buffer_activate; buf->vb.field = field; @@ -164,11 +169,11 @@ EXPORT_SYMBOL_GPL(saa7134_ts_qops); /* ----------------------------------------------------------- */ /* exported stuff */ -static unsigned int tsbufs = 4; +static unsigned int tsbufs = 8; module_param(tsbufs, int, 0444); MODULE_PARM_DESC(tsbufs,"number of ts buffers, range 2-32"); -static unsigned int ts_nr_packets = 30; +static unsigned int ts_nr_packets = 64; module_param(ts_nr_packets, int, 0444); MODULE_PARM_DESC(ts_nr_packets,"size of a ts buffers (in ts packets)"); @@ -220,10 +225,10 @@ void saa7134_irq_ts_done(struct saa7134_dev *dev, unsigned long status) if (dev->ts_q.curr) { field = dev->ts_q.curr->vb.field; if (field == V4L2_FIELD_TOP) { - if ((status & 0x100000) != 0x100000) + if ((status & 0x100000) != 0x000000) goto done; } else { - if ((status & 0x100000) != 0x000000) + if ((status & 0x100000) != 0x100000) goto done; } saa7134_buffer_finish(dev,&dev->ts_q,STATE_DONE); -- cgit v1.2.2 From 93df3413f1b4c437b93c5b64562632f4f0e2b3ca Mon Sep 17 00:00:00 2001 From: Hartmut Hackmann Date: Tue, 8 Nov 2005 21:36:31 -0800 Subject: [PATCH] v4l: 655: added support for the philips td1316 tuner - Added support for the Philips TD1316 tuner Signed-off-by: Hartmut Hackmann Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/tuner-core.c | 7 +++++++ drivers/media/video/tuner-simple.c | 2 ++ include/media/tuner.h | 1 + 3 files changed, 10 insertions(+) diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index ad85bef1c3d5..949c2550fcf5 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c @@ -189,6 +189,13 @@ static void set_type(struct i2c_client *c, unsigned int type, i2c_master_send(c, buffer, 4); default_tuner_init(c); break; + case TUNER_PHILIPS_TD1316: + buffer[0] = 0x0b; + buffer[1] = 0xdc; + buffer[2] = 0x86; + buffer[3] = 0xa4; + i2c_master_send(c,buffer,4); + default_tuner_init(c); default: default_tuner_init(c); break; diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c index 0ae39be3ca56..3af055970dd2 100644 --- a/drivers/media/video/tuner-simple.c +++ b/drivers/media/video/tuner-simple.c @@ -248,6 +248,8 @@ static struct tunertype tuners[] = { 16*160.25,16*464.25,0x01,0x02,0x08,0x8e,623}, { "LG NTSC (TALN mini series)", LGINNOTEK, NTSC, 16*137.25,16*373.25,0x01,0x02,0x08,0x8e,732 }, + { "Philips TD1316 Hybrid Tuner", Philips, PAL, + 16*160.00,16*442.00,0xa1,0xa2,0xa4,0xc8,623 }, }; unsigned const int tuner_count = ARRAY_SIZE(tuners); diff --git a/include/media/tuner.h b/include/media/tuner.h index 4ad08e24a1aa..4f47eac90caf 100644 --- a/include/media/tuner.h +++ b/include/media/tuner.h @@ -110,6 +110,7 @@ #define TUNER_LG_TDVS_H062F 64 /* DViCO FusionHDTV 5 */ #define TUNER_YMEC_TVF66T5_B_DFF 65 /* Acorp Y878F */ #define TUNER_LG_NTSC_TALN_MINI 66 +#define TUNER_PHILIPS_TD1316 67 #define NOTUNER 0 #define PAL 1 /* PAL_BG */ -- cgit v1.2.2 From 2cf36ac447308046d1c1d50b9f662bddbba56b33 Mon Sep 17 00:00:00 2001 From: Hartmut Hackmann Date: Tue, 8 Nov 2005 21:36:32 -0800 Subject: [PATCH] v4l: 656: added support for the following cards - Added support for the following cards: - Philips EUROPA reference desigh - Compro VideoMate DVB-T300 - Compro VideoMate DVB-T200 (initial) Signed-off-by: Hartmut Hackmann Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/saa7134/saa7134-cards.c | 104 ++++++++++++++++++- drivers/media/video/saa7134/saa7134-dvb.c | 152 ++++++++++++++++++++++++---- drivers/media/video/saa7134/saa7134.h | 3 + 3 files changed, 236 insertions(+), 23 deletions(-) diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index fea2188b2fa9..8291ed709736 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c @@ -2185,6 +2185,72 @@ struct saa7134_board saa7134_boards[] = { .gpio = 0x00200003, }, }, + [SAA7134_BOARD_PHILIPS_EUROPA] = { + .name = "Philips EUROPA V3 reference design", + .audio_clock = 0x00187de7, + .tuner_type = TUNER_PHILIPS_TD1316, + .radio_type = UNSET, + .tuner_addr = 0x61, + .radio_addr = ADDR_UNSET, + .tda9887_conf = TDA9887_PRESENT, + .mpeg = SAA7134_MPEG_DVB, + .inputs = {{ + .name = name_tv, + .vmux = 3, + .amux = TV, + .tv = 1, + },{ + .name = name_comp1, + .vmux = 0, + .amux = LINE2, + },{ + .name = name_svideo, + .vmux = 8, + .amux = LINE2, + }}, + }, + [SAA7134_BOARD_VIDEOMATE_DVBT_300] = { + .name = "Compro Videomate DVB-T300", + .audio_clock = 0x00187de7, + .tuner_type = TUNER_PHILIPS_TD1316, + .radio_type = UNSET, + .tuner_addr = 0x61, + .radio_addr = ADDR_UNSET, + .tda9887_conf = TDA9887_PRESENT, + .mpeg = SAA7134_MPEG_DVB, + .inputs = {{ + .name = name_tv, + .vmux = 3, + .amux = TV, + .tv = 1, + },{ + .name = name_comp1, + .vmux = 1, + .amux = LINE2, + },{ + .name = name_svideo, + .vmux = 8, + .amux = LINE2, + }}, + }, + [SAA7134_BOARD_VIDEOMATE_DVBT_200] = { + .name = "Compro Videomate DVB-T200", + .tuner_type = TUNER_ABSENT, + .audio_clock = 0x00187de7, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .mpeg = SAA7134_MPEG_DVB, + .inputs = {{ + .name = name_comp1, + .vmux = 0, + .amux = LINE1, + },{ + .name = name_svideo, + .vmux = 8, + .amux = LINE1, + }}, + }, }; const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards); @@ -2555,6 +2621,24 @@ struct pci_device_id saa7134_pci_tbl[] = { .subdevice = 0x7135, .driver_data = SAA7134_BOARD_GOTVIEW_7135, },{ + .vendor = PCI_VENDOR_ID_PHILIPS, + .device = PCI_DEVICE_ID_PHILIPS_SAA7134, + .subvendor = PCI_VENDOR_ID_PHILIPS, + .subdevice = 0x2004, + .driver_data = SAA7134_BOARD_PHILIPS_EUROPA, + },{ + .vendor = PCI_VENDOR_ID_PHILIPS, + .device = PCI_DEVICE_ID_PHILIPS_SAA7134, + .subvendor = 0x185b, + .subdevice = 0xc900, + .driver_data = SAA7134_BOARD_VIDEOMATE_DVBT_300, + },{ + .vendor = PCI_VENDOR_ID_PHILIPS, + .device = PCI_DEVICE_ID_PHILIPS_SAA7130, + .subvendor = 0x185b, + .subdevice = 0xc901, + .driver_data = SAA7134_BOARD_VIDEOMATE_DVBT_200, + },{ /* --- boards without eeprom + subsystem ID --- */ .vendor = PCI_VENDOR_ID_PHILIPS, .device = PCI_DEVICE_ID_PHILIPS_SAA7134, @@ -2708,7 +2792,7 @@ int saa7134_board_init2(struct saa7134_dev *dev) saa7134_i2c_call_clients (dev, TUNER_SET_TYPE_ADDR, &tun_setup); } break; -case SAA7134_BOARD_MD7134: + case SAA7134_BOARD_MD7134: { struct tuner_setup tun_setup; u8 subaddr; @@ -2775,6 +2859,24 @@ case SAA7134_BOARD_MD7134: saa7134_i2c_call_clients (dev, TUNER_SET_TYPE_ADDR,&tun_setup); } break; + case SAA7134_BOARD_PHILIPS_EUROPA: + case SAA7134_BOARD_VIDEOMATE_DVBT_300: + /* The Philips EUROPA based hybrid boards have the tuner connected through + * the channel decoder. We have to make it transparent to find it + */ + { + struct tuner_setup tun_setup; + u8 data[] = { 0x07, 0x02}; + struct i2c_msg msg = {.addr=0x08, .flags=0, .buf=data, .len = sizeof(data)}; + i2c_transfer(&dev->i2c_adap, &msg, 1); + + tun_setup.mode_mask = T_ANALOG_TV | T_DIGITAL_TV; + tun_setup.type = dev->tuner_type; + tun_setup.addr = dev->tuner_addr; + + saa7134_i2c_call_clients (dev, TUNER_SET_TYPE_ADDR,&tun_setup); + } + break; } return 0; } diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c index 639ae51a052d..f8e01030fbc7 100644 --- a/drivers/media/video/saa7134/saa7134-dvb.c +++ b/drivers/media/video/saa7134/saa7134-dvb.c @@ -151,25 +151,12 @@ static struct mt352_config pinnacle_300i = { /* ------------------------------------------------------------------ */ #ifdef HAVE_TDA1004X -static int philips_tu1216_pll_init(struct dvb_frontend *fe) -{ - struct saa7134_dev *dev = fe->dvb->priv; - static u8 tu1216_init[] = { 0x0b, 0xf5, 0x85, 0xab }; - struct i2c_msg tuner_msg = {.addr = 0x60,.flags = 0,.buf = tu1216_init,.len = sizeof(tu1216_init) }; - - /* setup PLL configuration */ - if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) - return -EIO; - msleep(1); - - return 0; -} -static int philips_tu1216_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) +static int philips_tda6651_pll_set(u8 addr, struct dvb_frontend *fe, struct dvb_frontend_parameters *params) { struct saa7134_dev *dev = fe->dvb->priv; u8 tuner_buf[4]; - struct i2c_msg tuner_msg = {.addr = 0x60,.flags = 0,.buf = tuner_buf,.len = + struct i2c_msg tuner_msg = {.addr = addr,.flags = 0,.buf = tuner_buf,.len = sizeof(tuner_buf) }; int tuner_frequency = 0; u8 band, cp, filter; @@ -242,11 +229,36 @@ static int philips_tu1216_pll_set(struct dvb_frontend *fe, struct dvb_frontend_p if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) return -EIO; + msleep(1); + return 0; +} + +static int philips_tda6651_pll_init(u8 addr, struct dvb_frontend *fe) +{ + struct saa7134_dev *dev = fe->dvb->priv; + static u8 tu1216_init[] = { 0x0b, 0xf5, 0x85, 0xab }; + struct i2c_msg tuner_msg = {.addr = addr,.flags = 0,.buf = tu1216_init,.len = sizeof(tu1216_init) }; + /* setup PLL configuration */ + if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) + return -EIO; msleep(1); + return 0; } +/* ------------------------------------------------------------------ */ + +static int philips_tu1216_pll_60_init(struct dvb_frontend *fe) +{ + return philips_tda6651_pll_init(0x60, fe); +} + +static int philips_tu1216_pll_60_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) +{ + return philips_tda6651_pll_set(0x60, fe, params); +} + static int philips_tu1216_request_firmware(struct dvb_frontend *fe, const struct firmware **fw, char *name) { @@ -254,22 +266,108 @@ static int philips_tu1216_request_firmware(struct dvb_frontend *fe, return request_firmware(fw, name, &dev->pci->dev); } -static struct tda1004x_config philips_tu1216_config = { +static struct tda1004x_config philips_tu1216_60_config = { .demod_address = 0x8, .invert = 1, - .invert_oclk = 1, + .invert_oclk = 0, .xtal_freq = TDA10046_XTAL_4M, .agc_config = TDA10046_AGC_DEFAULT, .if_freq = TDA10046_FREQ_3617, - .pll_init = philips_tu1216_pll_init, - .pll_set = philips_tu1216_pll_set, + .pll_init = philips_tu1216_pll_60_init, + .pll_set = philips_tu1216_pll_60_set, .pll_sleep = NULL, .request_firmware = philips_tu1216_request_firmware, }; /* ------------------------------------------------------------------ */ +static int philips_tu1216_pll_61_init(struct dvb_frontend *fe) +{ + return philips_tda6651_pll_init(0x61, fe); +} + +static int philips_tu1216_pll_61_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) +{ + return philips_tda6651_pll_set(0x61, fe, params); +} + +static struct tda1004x_config philips_tu1216_61_config = { + + .demod_address = 0x8, + .invert = 1, + .invert_oclk = 0, + .xtal_freq = TDA10046_XTAL_4M, + .agc_config = TDA10046_AGC_DEFAULT, + .if_freq = TDA10046_FREQ_3617, + .pll_init = philips_tu1216_pll_61_init, + .pll_set = philips_tu1216_pll_61_set, + .pll_sleep = NULL, + .request_firmware = philips_tu1216_request_firmware, +}; + +/* ------------------------------------------------------------------ */ + +static int philips_europa_pll_init(struct dvb_frontend *fe) +{ + struct saa7134_dev *dev = fe->dvb->priv; + static u8 msg[] = { 0x0b, 0xf5, 0x86, 0xab }; + struct i2c_msg init_msg = {.addr = 0x61,.flags = 0,.buf = msg,.len = sizeof(msg) }; + + /* setup PLL configuration */ + if (i2c_transfer(&dev->i2c_adap, &init_msg, 1) != 1) + return -EIO; + msleep(1); + + /* switch the board to dvb mode */ + init_msg.addr = 0x43; + init_msg.len = 0x02; + msg[0] = 0x00; + msg[1] = 0x40; + if (i2c_transfer(&dev->i2c_adap, &init_msg, 1) != 1) + return -EIO; + + return 0; +} + +static int philips_td1316_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) +{ + return philips_tda6651_pll_set(0x61, fe, params); +} + +static void philips_europa_analog(struct dvb_frontend *fe) +{ + struct saa7134_dev *dev = fe->dvb->priv; + /* this message actually turns the tuner back to analog mode */ + static u8 msg[] = { 0x0b, 0xdc, 0x86, 0xa4 }; + struct i2c_msg analog_msg = {.addr = 0x61,.flags = 0,.buf = msg,.len = sizeof(msg) }; + + i2c_transfer(&dev->i2c_adap, &analog_msg, 1); + msleep(1); + + /* switch the board to analog mode */ + analog_msg.addr = 0x43; + analog_msg.len = 0x02; + msg[0] = 0x00; + msg[1] = 0x14; + i2c_transfer(&dev->i2c_adap, &analog_msg, 1); +} + +static struct tda1004x_config philips_europa_config = { + + .demod_address = 0x8, + .invert = 0, + .invert_oclk = 0, + .xtal_freq = TDA10046_XTAL_4M, + .agc_config = TDA10046_AGC_IFO_AUTO_POS, + .if_freq = TDA10046_FREQ_052, + .pll_init = philips_europa_pll_init, + .pll_set = philips_td1316_pll_set, + .pll_sleep = philips_europa_analog, + .request_firmware = NULL, +}; + +/* ------------------------------------------------------------------ */ static int philips_fmd1216_pll_init(struct dvb_frontend *fe) { @@ -382,7 +480,6 @@ static int philips_fmd1216_pll_set(struct dvb_frontend *fe, struct dvb_frontend_ return 0; } -#ifdef HAVE_TDA1004X static struct tda1004x_config medion_cardbus = { .demod_address = 0x08, .invert = 1, @@ -395,7 +492,6 @@ static struct tda1004x_config medion_cardbus = { .pll_sleep = philips_fmd1216_analog, .request_firmware = NULL, }; -#endif /* ------------------------------------------------------------------ */ @@ -558,7 +654,7 @@ static int dvb_init(struct saa7134_dev *dev) &dev->i2c_adap); break; case SAA7134_BOARD_PHILIPS_TOUGH: - dev->dvb.frontend = tda10046_attach(&philips_tu1216_config, + dev->dvb.frontend = tda10046_attach(&philips_tu1216_60_config, &dev->i2c_adap); break; case SAA7134_BOARD_FLYDVBTDUO: @@ -569,6 +665,18 @@ static int dvb_init(struct saa7134_dev *dev) dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config, &dev->i2c_adap); break; + case SAA7134_BOARD_PHILIPS_EUROPA: + dev->dvb.frontend = tda10046_attach(&philips_europa_config, + &dev->i2c_adap); + break; + case SAA7134_BOARD_VIDEOMATE_DVBT_300: + dev->dvb.frontend = tda10046_attach(&philips_europa_config, + &dev->i2c_adap); + break; + case SAA7134_BOARD_VIDEOMATE_DVBT_200: + dev->dvb.frontend = tda10046_attach(&philips_tu1216_61_config, + &dev->i2c_adap); + break; #endif default: printk("%s: Huh? unknown DVB card?\n",dev->name); diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index 291c2e8d1086..69a2cebe8860 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h @@ -189,6 +189,9 @@ struct saa7134_format { #define SAA7134_BOARD_YUAN_TUN900 66 #define SAA7134_BOARD_BEHOLD_409FM 67 #define SAA7134_BOARD_GOTVIEW_7135 68 +#define SAA7134_BOARD_PHILIPS_EUROPA 69 +#define SAA7134_BOARD_VIDEOMATE_DVBT_300 70 +#define SAA7134_BOARD_VIDEOMATE_DVBT_200 71 #define SAA7134_MAXBOARDS 8 #define SAA7134_INPUT_MAX 8 -- cgit v1.2.2 From 84a5e55c70d881451208ec56609ccd75053c08fa Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 8 Nov 2005 21:36:33 -0800 Subject: [PATCH] v4l: 657: update documentation - Update tuner documentation Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/video4linux/CARDLIST.saa7134 | 3 +++ Documentation/video4linux/CARDLIST.tuner | 1 + 2 files changed, 4 insertions(+) diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134 index 411f842c5d1a..b2643051339e 100644 --- a/Documentation/video4linux/CARDLIST.saa7134 +++ b/Documentation/video4linux/CARDLIST.saa7134 @@ -67,3 +67,6 @@ 66 -> Yuan TUN-900 (saa7135) 67 -> Beholder BeholdTV 409 FM [0000:4091] 68 -> GoTView 7135 PCI [5456:7135] + 69 -> Philips EUROPA V3 reference design [1131:2004] + 70 -> Compro Videomate DVB-T300 [185b:c900] + 71 -> Compro Videomate DVB-T200 [185b:c901] diff --git a/Documentation/video4linux/CARDLIST.tuner b/Documentation/video4linux/CARDLIST.tuner index f5876be658a6..84203302b271 100644 --- a/Documentation/video4linux/CARDLIST.tuner +++ b/Documentation/video4linux/CARDLIST.tuner @@ -65,3 +65,4 @@ tuner=63 - Philips FMD1216ME MK3 Hybrid Tuner tuner=64 - LG TDVS-H062F/TUA6034 tuner=65 - Ymec TVF66T5-B/DFF tuner=66 - LG NTSC (TALN mini series) +tuner=67 - Philips TD1316 Hybrid Tuner -- cgit v1.2.2 From fd1c388125d713b403569d96d9845470142884a2 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:36:34 -0800 Subject: [PATCH] v4l: 660: small fixes - Small fixes on tuner debug message. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/tuner-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index 949c2550fcf5..44fa1423c1a9 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c @@ -695,7 +695,7 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) break; } default: - tuner_dbg("Unimplemented IOCTL 0x%08x(dir=%d,tp=0x%02x,nr=%d,sz=%d)\n", + tuner_dbg("Unimplemented IOCTL 0x%08x(dir=%d,tp='%c',nr=%d,sz=%d)\n", cmd, _IOC_DIR(cmd), _IOC_TYPE(cmd), _IOC_NR(cmd), _IOC_SIZE(cmd)); break; -- cgit v1.2.2 From bb881f142465a7a70bc9a364786e39aa4aaba4d2 Mon Sep 17 00:00:00 2001 From: "Nickolay V. Shmyrev" Date: Tue, 8 Nov 2005 21:36:35 -0800 Subject: [PATCH] v4l: 663: add new rtd cards - Add new RTD cards Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/video4linux/CARDLIST.saa7134 | 2 + drivers/media/video/saa7134/saa7134-cards.c | 91 +++++++++++++++++++++++++++++ drivers/media/video/saa7134/saa7134-reg.h | 1 + drivers/media/video/saa7134/saa7134-video.c | 9 ++- drivers/media/video/saa7134/saa7134.h | 2 + 5 files changed, 103 insertions(+), 2 deletions(-) diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134 index b2643051339e..82b5f7c73c83 100644 --- a/Documentation/video4linux/CARDLIST.saa7134 +++ b/Documentation/video4linux/CARDLIST.saa7134 @@ -70,3 +70,5 @@ 69 -> Philips EUROPA V3 reference design [1131:2004] 70 -> Compro Videomate DVB-T300 [185b:c900] 71 -> Compro Videomate DVB-T200 [185b:c901] + 72 -> RTD Embedded Technologies VFG7350 [1435:7350] + 73 -> RTD Embedded Technologies VFG7330 [1435:7330] diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index 8291ed709736..8bb2faf2635a 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c @@ -2251,6 +2251,74 @@ struct saa7134_board saa7134_boards[] = { .amux = LINE1, }}, }, + [SAA7134_BOARD_RTD_VFG7350] = { + .name = "RTD Embedded Technologies VFG7350", + .audio_clock = 0x00200000, + .tuner_type = TUNER_ABSENT, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .inputs = {{ + .name = "Composite 0", + .vmux = 0, + .amux = LINE1, + },{ + .name = "Composite 1", + .vmux = 1, + .amux = LINE2, + },{ + .name = "Composite 2", + .vmux = 2, + .amux = LINE1, + },{ + .name = "Composite 3", + .vmux = 3, + .amux = LINE2, + },{ + .name = "S-Video 0", + .vmux = 8, + .amux = LINE1, + },{ + .name = "S-Video 1", + .vmux = 9, + .amux = LINE2, + }}, + .mpeg = SAA7134_MPEG_EMPRESS, + .video_out = CCIR656, + }, + [SAA7134_BOARD_RTD_VFG7330] = { + .name = "RTD Embedded Technologies VFG7330", + .audio_clock = 0x00200000, + .tuner_type = TUNER_ABSENT, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .inputs = {{ + .name = "Composite 0", + .vmux = 0, + .amux = LINE1, + },{ + .name = "Composite 1", + .vmux = 1, + .amux = LINE2, + },{ + .name = "Composite 2", + .vmux = 2, + .amux = LINE1, + },{ + .name = "Composite 3", + .vmux = 3, + .amux = LINE2, + },{ + .name = "S-Video 0", + .vmux = 8, + .amux = LINE1, + },{ + .name = "S-Video 1", + .vmux = 9, + .amux = LINE2, + }}, + }, }; const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards); @@ -2639,6 +2707,18 @@ struct pci_device_id saa7134_pci_tbl[] = { .subdevice = 0xc901, .driver_data = SAA7134_BOARD_VIDEOMATE_DVBT_200, },{ + .vendor = PCI_VENDOR_ID_PHILIPS, + .device = PCI_DEVICE_ID_PHILIPS_SAA7133, + .subvendor = 0x1435, + .subdevice = 0x7350, + .driver_data = SAA7134_BOARD_RTD_VFG7350, + },{ + .vendor = PCI_VENDOR_ID_PHILIPS, + .device = PCI_DEVICE_ID_PHILIPS_SAA7133, + .subvendor = 0x1435, + .subdevice = 0x7330, + .driver_data = SAA7134_BOARD_RTD_VFG7330, + },{ /* --- boards without eeprom + subsystem ID --- */ .vendor = PCI_VENDOR_ID_PHILIPS, .device = PCI_DEVICE_ID_PHILIPS_SAA7134, @@ -2758,6 +2838,17 @@ int saa7134_board_init1(struct saa7134_dev *dev) saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0xffffffff, 0xffffffff); msleep(1); break; + case SAA7134_BOARD_RTD_VFG7350: + + /* + * Make sure Production Test Register at offset 0x1D1 is cleared + * to take chip out of test mode. Clearing bit 4 (TST_EN_AOUT) + * prevents pin 105 from remaining low; keeping pin 105 low + * continually resets the SAA6752 chip. + */ + + saa_writeb (SAA7134_PRODUCTION_TEST_MODE, 0x00); + break; } return 0; } diff --git a/drivers/media/video/saa7134/saa7134-reg.h b/drivers/media/video/saa7134/saa7134-reg.h index ae0c7a165390..fce4f185ef92 100644 --- a/drivers/media/video/saa7134/saa7134-reg.h +++ b/drivers/media/video/saa7134/saa7134-reg.h @@ -348,6 +348,7 @@ /* test modes */ #define SAA7134_SPECIAL_MODE 0x1d0 +#define SAA7134_PRODUCTION_TEST_MODE 0x1d1 /* audio -- saa7133 + saa7135 only */ #define SAA7135_DSP_RWSTATE 0x580 diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index 35e5e85f669a..d395403afe5a 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c @@ -1666,6 +1666,7 @@ static int video_do_ioctl(struct inode *inode, struct file *file, case VIDIOC_QUERYCAP: { struct v4l2_capability *cap = arg; + unsigned int tuner_type = dev->tuner_type; memset(cap,0,sizeof(*cap)); strcpy(cap->driver, "saa7134"); @@ -1677,9 +1678,13 @@ static int video_do_ioctl(struct inode *inode, struct file *file, V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_OVERLAY | V4L2_CAP_VBI_CAPTURE | - V4L2_CAP_TUNER | V4L2_CAP_READWRITE | - V4L2_CAP_STREAMING; + V4L2_CAP_STREAMING | + V4L2_CAP_TUNER; + + if ((tuner_type == TUNER_ABSENT) || (tuner_type == UNSET)) + cap->capabilities &= ~V4L2_CAP_TUNER; + return 0; } diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index 69a2cebe8860..ad8e89d6bf50 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h @@ -192,6 +192,8 @@ struct saa7134_format { #define SAA7134_BOARD_PHILIPS_EUROPA 69 #define SAA7134_BOARD_VIDEOMATE_DVBT_300 70 #define SAA7134_BOARD_VIDEOMATE_DVBT_200 71 +#define SAA7134_BOARD_RTD_VFG7350 72 +#define SAA7134_BOARD_RTD_VFG7330 73 #define SAA7134_MAXBOARDS 8 #define SAA7134_INPUT_MAX 8 -- cgit v1.2.2 From e222f83406f987c661b6da2d3fb4fc8ae8b5c660 Mon Sep 17 00:00:00 2001 From: "Hans J. Koch" Date: Tue, 8 Nov 2005 21:36:35 -0800 Subject: [PATCH] v4l: 664: improved coding style for timer settings - Improved coding style for timer settings Signed-off-by: Hans J. Koch Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/saa6588.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/video/saa6588.c b/drivers/media/video/saa6588.c index 72b70eb5da1d..31a9797bd973 100644 --- a/drivers/media/video/saa6588.c +++ b/drivers/media/video/saa6588.c @@ -328,7 +328,7 @@ static void saa6588_work(void *data) struct saa6588 *s = (struct saa6588 *)data; saa6588_i2c_poll(s); - mod_timer(&s->timer, jiffies + HZ / 50); /* 20 msec */ + mod_timer(&s->timer, jiffies + msecs_to_jiffies(20)); } static int saa6588_configure(struct saa6588 *s) -- cgit v1.2.2 From 17a05ef33a3c9489f659c4e40f8bfafd834e0cb9 Mon Sep 17 00:00:00 2001 From: "Nickolay V. Shmyrev" Date: Tue, 8 Nov 2005 21:36:36 -0800 Subject: [PATCH] v4l: 665: fix for problem with audio register setup via dsp access - Fix for problem with audio register setup via DSP access Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/saa7134/saa7134-core.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index e5e36f3c6250..109c815c5e6c 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c @@ -646,14 +646,6 @@ static int saa7134_hwinit1(struct saa7134_dev *dev) saa7134_ts_init1(dev); saa7134_input_init1(dev); - switch (dev->pci->device) { - case PCI_DEVICE_ID_PHILIPS_SAA7134: - case PCI_DEVICE_ID_PHILIPS_SAA7133: - case PCI_DEVICE_ID_PHILIPS_SAA7135: - saa7134_oss_init1(dev); - break; - } - /* RAM FIFO config */ saa_writel(SAA7134_FIFO_SIZE, 0x08070503); saa_writel(SAA7134_THRESHOULD,0x02020202); @@ -668,6 +660,21 @@ static int saa7134_hwinit1(struct saa7134_dev *dev) SAA7134_MAIN_CTRL_ESFE | SAA7134_MAIN_CTRL_EBDAC); + /* + * Initialize OSS _after_ enabling audio clock PLL and audio processing. + * OSS initialization writes to registers via the audio DSP; these + * writes will fail unless the audio clock has been started. At worst, + * audio will not work. + */ + + switch (dev->pci->device) { + case PCI_DEVICE_ID_PHILIPS_SAA7134: + case PCI_DEVICE_ID_PHILIPS_SAA7133: + case PCI_DEVICE_ID_PHILIPS_SAA7135: + saa7134_oss_init1(dev); + break; + } + /* enable peripheral devices */ saa_writeb(SAA7134_SPECIAL_MODE, 0x01); -- cgit v1.2.2 From 9f95a0bf8594f59c708492d5ab6ea9a72621f0dd Mon Sep 17 00:00:00 2001 From: "Nickolay V. Shmyrev" Date: Tue, 8 Nov 2005 21:36:37 -0800 Subject: [PATCH] v4l: 667: remove some if 0 which doesn t have any sense - Remove some #if 0 which doesn't have any sense Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/cx88/cx88-video.c | 2 +- drivers/media/video/saa7134/saa7134-video.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index a29c12754ef6..4c99fc39bb2a 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c @@ -1256,9 +1256,9 @@ int cx88_do_ioctl(struct inode *inode, struct file *file, int radio, { int err; + dprintk( 1, "CORE IOCTL: 0x%x\n", cmd ); if (video_debug > 1) cx88_print_ioctl(core->name,cmd); - dprintk( 1, "CORE IOCTL: 0x%x\n", cmd ); switch (cmd) { /* ---------- tv norms ---------- */ diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index d395403afe5a..cd1f70fffdec 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c @@ -1798,9 +1798,9 @@ static int video_do_ioctl(struct inode *inode, struct file *file, crop->c.height = b->top - crop->c.top + b->height; if (crop->c.left < b->left) - crop->c.top = b->left; + crop->c.left = b->left; if (crop->c.left > b->left + b->width) - crop->c.top = b->left + b->width; + crop->c.left = b->left + b->width; if (crop->c.width > b->left - crop->c.left + b->width) crop->c.width = b->left - crop->c.left + b->width; -- cgit v1.2.2 From 699a40690b5facb3aa1256304cd6b97691eb5fdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Miguel=20Garc=EDa?= Date: Tue, 8 Nov 2005 21:36:38 -0800 Subject: [PATCH] v4l: 669: added prolink pixelview pv bt878p rev 2e compatibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Added Prolink Pixelview PV-BT878P+ (Rev.2E) compatibility Signed-off-by: Luis Miguel García Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/bttv-cards.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bttv-cards.c index e94bffbedfdd..5672d0ef2bf0 100644 --- a/drivers/media/video/bttv-cards.c +++ b/drivers/media/video/bttv-cards.c @@ -2431,6 +2431,20 @@ struct tvcard bttv_tvcards[] = { .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, .tuner_addr = ADDR_UNSET, .has_remote = 1, +},{ + .name = "Prolink Pixelview PV-BT878P+ (Rev.2E)", + .video_inputs = 5, + .audio_inputs = 1, + .tuner = 0, + .svhs = 3, + .gpiomask = 0x01fe00, + .muxsel = { 2,3,1,1,-1 }, + .digital_mode = DIGITAL_MODE_CAMERA, + .audiomux = { 0x00400, 0x10400, 0x04400, 0x80000, 0x12400, 0x46000 }, + .no_msp34xx = 1, + .pll = PLL_28, + .tuner_type = TUNER_LG_PAL_FM, + .has_remote = 1, }}; static const unsigned int bttv_num_tvcards = ARRAY_SIZE(bttv_tvcards); -- cgit v1.2.2 From caa812e4a5d77703f4839b5d25139aa05615ddb3 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:36:39 -0800 Subject: [PATCH] v4l: 670: cardlist update - Cardlist update. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/video4linux/CARDLIST.bttv | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/video4linux/CARDLIST.bttv b/Documentation/video4linux/CARDLIST.bttv index 89460a5babfa..5deb052f3078 100644 --- a/Documentation/video4linux/CARDLIST.bttv +++ b/Documentation/video4linux/CARDLIST.bttv @@ -136,3 +136,4 @@ card=134 - Adlink RTV24 card=135 - DViCO FusionHDTV 5 Lite card=136 - Acorp Y878F card=137 - Conceptronic CTVFMi v2 +card=138 - Prolink Pixelview PV-BT878P+ (Rev.2E) -- cgit v1.2.2 From 46a3a575bcc6a82b8538dd7a02fef634853ad31e Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 8 Nov 2005 21:36:39 -0800 Subject: [PATCH] v4l: 672: fix build for 2.6.14 - Fix build for 2.6.14 Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/ir-kbd-i2c.c | 2 -- drivers/media/video/saa6588.c | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index 9703d3d351f9..225fee93cfd4 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c @@ -37,9 +37,7 @@ #include #include #include - #include - #include /* Mark Phalan */ diff --git a/drivers/media/video/saa6588.c b/drivers/media/video/saa6588.c index 31a9797bd973..5252a4ca3fd1 100644 --- a/drivers/media/video/saa6588.c +++ b/drivers/media/video/saa6588.c @@ -434,9 +434,9 @@ static int saa6588_probe(struct i2c_adapter *adap) return i2c_probe(adap, &addr_data, saa6588_attach); #else switch (adap->id) { - case I2C_ALGO_BIT | I2C_HW_B_BT848: - case I2C_ALGO_BIT | I2C_HW_B_RIVA: - case I2C_ALGO_SAA7134: + case I2C_HW_B_BT848: + case I2C_HW_B_RIVA: + case I2C_HW_SAA7134: return i2c_probe(adap, &addr_data, saa6588_attach); break; } -- cgit v1.2.2 From cd4665c5dcf9916dc2f71d30c7e7830ee7cbf884 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:36:40 -0800 Subject: [PATCH] v4l: 673: initial code for texas instruments tvp5150a and tvp5150am1 - Initial code for Texas Instruments TVP5150A and TVP5150AM1 Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/tvp5150.c | 378 ++++++++++++++++++++++++++++++++++++++ drivers/media/video/tvp5150_reg.h | 173 +++++++++++++++++ 2 files changed, 551 insertions(+) create mode 100644 drivers/media/video/tvp5150.c create mode 100644 drivers/media/video/tvp5150_reg.h diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c new file mode 100644 index 000000000000..e575877f8269 --- /dev/null +++ b/drivers/media/video/tvp5150.c @@ -0,0 +1,378 @@ +/* + * tvp5150 - Texas Instruments TVP5150A(M) video decoder driver + * + * Copyright (c) 2005 Mauro Carvalho Chehab (mchehab@brturbo.com.br) + * This code is placed under the terms of the GNU General Public License + */ + +#include +#include +#include +#include + +#include "tvp5150_reg.h" + +MODULE_DESCRIPTION("Texas Instruments TVP5150A video decoder driver");/* standard i2c insmod options */ +MODULE_AUTHOR("Mauro Carvalho Chehab"); +MODULE_LICENSE("GPL"); + +static unsigned short normal_i2c[] = { + 0xb8 >>1, + 0xba >>1, + I2C_CLIENT_END +}; + +I2C_CLIENT_INSMOD; + +static int debug = 0; +module_param(debug, int, 0); +MODULE_PARM_DESC(debug, "Debug level (0-1)"); + +#define dprintk(num, format, args...) \ + do { \ + if (debug >= num) \ + printk(format , ##args); \ + } while (0) + +struct tvp5150 { + struct i2c_client *client; +}; + +static inline int tvp5150_read(struct i2c_client *c,unsigned char addr) +{ + unsigned char buffer[1]; + int rc; +/* struct tvp5150 *core = i2c_get_clientdata(c); */ + + buffer[0] = addr; + if (1 != (rc = i2c_master_send(c, buffer, 1))) + dprintk(0,"i2c i/o error: rc == %d (should be 1)\n", rc); + + msleep(10); + + if (1 != (rc = i2c_master_recv(c, buffer, 1))) + dprintk(0,"i2c i/o error: rc == %d (should be 1)\n", rc); + + return (buffer[0]); +} + +static inline void tvp5150_write(struct i2c_client *c,unsigned char addr, unsigned char value) +{ + unsigned char buffer[2]; + int rc; +/* struct tvp5150 *core = i2c_get_clientdata(c); */ + + buffer[0] = addr; + buffer[2] = addr; + if (2 != (rc = i2c_master_send(c, buffer, 2))) + dprintk(0,"i2c i/o error: rc == %d (should be 2)\n", rc); +} + +static void dump_reg (struct i2c_client *c) +{ + dprintk (2, "tvp5150: Video input source selection #1 = 0x%02x\n", tvp5150_read(c,TVP5150_VD_IN_SRC_SEL_1)); + dprintk (2, "tvp5150: Analog channel controls = 0x%02x\n", tvp5150_read(c,TVP5150_ANAL_CHL_CTL)); + dprintk (2, "tvp5150: Operation mode controls = 0x%02x\n", tvp5150_read(c,TVP5150_OP_MODE_CTL)); + dprintk (2, "tvp5150: Miscellaneous controls = 0x%02x\n", tvp5150_read(c,TVP5150_MISC_CTL)); + dprintk (2, "tvp5150: Autoswitch mask: TVP5150A / TVP5150AM = 0x%02x\n", tvp5150_read(c,TVP5150_AUTOSW_MSK)); + dprintk (2, "tvp5150: Color killer threshold control = 0x%02x\n", tvp5150_read(c,TVP5150_COLOR_KIL_THSH_CTL)); + dprintk (2, "tvp5150: Luminance processing control #1 = 0x%02x\n", tvp5150_read(c,TVP5150_LUMA_PROC_CTL_1)); + dprintk (2, "tvp5150: Luminance processing control #2 = 0x%02x\n", tvp5150_read(c,TVP5150_LUMA_PROC_CTL_2)); + dprintk (2, "tvp5150: Brightness control = 0x%02x\n", tvp5150_read(c,TVP5150_BRIGHT_CTL)); + dprintk (2, "tvp5150: Color saturation control = 0x%02x\n", tvp5150_read(c,TVP5150_SATURATION_CTL)); + dprintk (2, "tvp5150: Hue control = 0x%02x\n", tvp5150_read(c,TVP5150_HUE_CTL)); + dprintk (2, "tvp5150: Contrast control = 0x%02x\n", tvp5150_read(c,TVP5150_CONTRAST_CTL)); + dprintk (2, "tvp5150: Outputs and data rates select = 0x%02x\n", tvp5150_read(c,TVP5150_DATA_RATE_SEL)); + dprintk (2, "tvp5150: Luminance processing control #3 = 0x%02x\n", tvp5150_read(c,TVP5150_LUMA_PROC_CTL_3)); + dprintk (2, "tvp5150: Configuration shared pins = 0x%02x\n", tvp5150_read(c,TVP5150_CONF_SHARED_PIN)); + dprintk (2, "tvp5150: Active video cropping start MSB = 0x%02x\n", tvp5150_read(c,TVP5150_ACT_VD_CROP_ST_MSB)); + dprintk (2, "tvp5150: Active video cropping start LSB = 0x%02x\n", tvp5150_read(c,TVP5150_ACT_VD_CROP_ST_LSB)); + dprintk (2, "tvp5150: Active video cropping stop MSB = 0x%02x\n", tvp5150_read(c,TVP5150_ACT_VD_CROP_STP_MSB)); + dprintk (2, "tvp5150: Active video cropping stop LSB = 0x%02x\n", tvp5150_read(c,TVP5150_ACT_VD_CROP_STP_LSB)); + dprintk (2, "tvp5150: Genlock/RTC = 0x%02x\n", tvp5150_read(c,TVP5150_GENLOCK)); + dprintk (2, "tvp5150: Horizontal sync start = 0x%02x\n", tvp5150_read(c,TVP5150_HORIZ_SYNC_START)); + dprintk (2, "tvp5150: Vertical blanking start = 0x%02x\n", tvp5150_read(c,TVP5150_VERT_BLANKING_START)); + dprintk (2, "tvp5150: Vertical blanking stop = 0x%02x\n", tvp5150_read(c,TVP5150_VERT_BLANKING_STOP)); + dprintk (2, "tvp5150: Chrominance processing control #1 = 0x%02x\n", tvp5150_read(c,TVP5150_CHROMA_PROC_CTL_1)); + dprintk (2, "tvp5150: Chrominance processing control #2 = 0x%02x\n", tvp5150_read(c,TVP5150_CHROMA_PROC_CTL_2)); + dprintk (2, "tvp5150: Interrupt reset register B = 0x%02x\n", tvp5150_read(c,TVP5150_INT_RESET_REG_B)); + dprintk (2, "tvp5150: Interrupt enable register B = 0x%02x\n", tvp5150_read(c,TVP5150_INT_ENABLE_REG_B)); + dprintk (2, "tvp5150: Interrupt configuration register B = 0x%02x\n", tvp5150_read(c,TVP5150_INTT_CONFIG_REG_B)); + dprintk (2, "tvp5150: Video standard = 0x%02x\n", tvp5150_read(c,TVP5150_VIDEO_STD)); + dprintk (2, "tvp5150: Cb gain factor = 0x%02x\n", tvp5150_read(c,TVP5150_CB_GAIN_FACT)); + dprintk (2, "tvp5150: Cr gain factor = 0x%02x\n", tvp5150_read(c,TVP5150_CR_GAIN_FACTOR)); + dprintk (2, "tvp5150: Macrovision on counter = 0x%02x\n", tvp5150_read(c,TVP5150_MACROVISION_ON_CTR)); + dprintk (2, "tvp5150: Macrovision off counter = 0x%02x\n", tvp5150_read(c,TVP5150_MACROVISION_OFF_CTR)); + dprintk (2, "tvp5150: revision select (TVP5150AM1 only) = 0x%02x\n", tvp5150_read(c,TVP5150_REV_SELECT)); + dprintk (2, "tvp5150: MSB of device ID = 0x%02x\n", tvp5150_read(c,TVP5150_MSB_DEV_ID)); + dprintk (2, "tvp5150: LSB of device ID = 0x%02x\n", tvp5150_read(c,TVP5150_LSB_DEV_ID)); + dprintk (2, "tvp5150: ROM major version = 0x%02x\n", tvp5150_read(c,TVP5150_ROM_MAJOR_VER)); + dprintk (2, "tvp5150: ROM minor version = 0x%02x\n", tvp5150_read(c,TVP5150_ROM_MINOR_VER)); + dprintk (2, "tvp5150: Vertical line count MSB = 0x%02x\n", tvp5150_read(c,TVP5150_VERT_LN_COUNT_MSB)); + dprintk (2, "tvp5150: Vertical line count LSB = 0x%02x\n", tvp5150_read(c,TVP5150_VERT_LN_COUNT_LSB)); + dprintk (2, "tvp5150: Interrupt status register B = 0x%02x\n", tvp5150_read(c,TVP5150_INT_STATUS_REG_B)); + dprintk (2, "tvp5150: Interrupt active register B = 0x%02x\n", tvp5150_read(c,TVP5150_INT_ACTIVE_REG_B)); + dprintk (2, "tvp5150: Status register #1 = 0x%02x\n", tvp5150_read(c,TVP5150_STATUS_REG_1)); + dprintk (2, "tvp5150: Status register #2 = 0x%02x\n", tvp5150_read(c,TVP5150_STATUS_REG_2)); + dprintk (2, "tvp5150: Status register #3 = 0x%02x\n", tvp5150_read(c,TVP5150_STATUS_REG_3)); + dprintk (2, "tvp5150: Status register #4 = 0x%02x\n", tvp5150_read(c,TVP5150_STATUS_REG_4)); + dprintk (2, "tvp5150: Status register #5 = 0x%02x\n", tvp5150_read(c,TVP5150_STATUS_REG_5)); + dprintk (2, "tvp5150: Closed caption data registers = 0x%02x\n", tvp5150_read(c,TVP5150_CC_DATA_REG1)); + dprintk (2, "tvp5150: Closed caption data registers = 0x%02x\n", tvp5150_read(c,TVP5150_CC_DATA_REG2)); + dprintk (2, "tvp5150: Closed caption data registers = 0x%02x\n", tvp5150_read(c,TVP5150_CC_DATA_REG3)); + dprintk (2, "tvp5150: Closed caption data registers = 0x%02x\n", tvp5150_read(c,TVP5150_CC_DATA_REG4)); + dprintk (2, "tvp5150: WSS data registers = 0x%02x\n", tvp5150_read(c,TVP5150_WSS_DATA_REG1)); + dprintk (2, "tvp5150: WSS data registers = 0x%02x\n", tvp5150_read(c,TVP5150_WSS_DATA_REG2)); + dprintk (2, "tvp5150: WSS data registers = 0x%02x\n", tvp5150_read(c,TVP5150_WSS_DATA_REG3)); + dprintk (2, "tvp5150: WSS data registers = 0x%02x\n", tvp5150_read(c,TVP5150_WSS_DATA_REG4)); + dprintk (2, "tvp5150: WSS data registers = 0x%02x\n", tvp5150_read(c,TVP5150_WSS_DATA_REG5)); + dprintk (2, "tvp5150: WSS data registers = 0x%02x\n", tvp5150_read(c,TVP5150_WSS_DATA_REG6)); + dprintk (2, "tvp5150: VPS data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VPS_DATA_REG1)); + dprintk (2, "tvp5150: VPS data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VPS_DATA_REG2)); + dprintk (2, "tvp5150: VPS data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VPS_DATA_REG3)); + dprintk (2, "tvp5150: VPS data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VPS_DATA_REG4)); + dprintk (2, "tvp5150: VPS data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VPS_DATA_REG5)); + dprintk (2, "tvp5150: VPS data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VPS_DATA_REG6)); + dprintk (2, "tvp5150: VPS data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VPS_DATA_REG7)); + dprintk (2, "tvp5150: VPS data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VPS_DATA_REG8)); + dprintk (2, "tvp5150: VPS data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VPS_DATA_REG9)); + dprintk (2, "tvp5150: VPS data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VPS_DATA_REG10)); + dprintk (2, "tvp5150: VPS data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VPS_DATA_REG11)); + dprintk (2, "tvp5150: VPS data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VPS_DATA_REG12)); + dprintk (2, "tvp5150: VPS data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VPS_DATA_REG13)); + dprintk (2, "tvp5150: VITC data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VITC_DATA_REG1)); + dprintk (2, "tvp5150: VITC data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VITC_DATA_REG2)); + dprintk (2, "tvp5150: VITC data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VITC_DATA_REG3)); + dprintk (2, "tvp5150: VITC data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VITC_DATA_REG4)); + dprintk (2, "tvp5150: VITC data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VITC_DATA_REG5)); + dprintk (2, "tvp5150: VITC data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VITC_DATA_REG6)); + dprintk (2, "tvp5150: VITC data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VITC_DATA_REG7)); + dprintk (2, "tvp5150: VITC data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VITC_DATA_REG8)); + dprintk (2, "tvp5150: VITC data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VITC_DATA_REG9)); + dprintk (2, "tvp5150: VBI FIFO read data = 0x%02x\n", tvp5150_read(c,TVP5150_VBI_FIFO_READ_DATA)); + dprintk (2, "tvp5150: Teletext filter 1 = 0x%02x\n", tvp5150_read(c,TVP5150_TELETEXT_FIL_1_1)); + dprintk (2, "tvp5150: Teletext filter 1 = 0x%02x\n", tvp5150_read(c,TVP5150_TELETEXT_FIL_1_2)); + dprintk (2, "tvp5150: Teletext filter 1 = 0x%02x\n", tvp5150_read(c,TVP5150_TELETEXT_FIL_1_3)); + dprintk (2, "tvp5150: Teletext filter 1 = 0x%02x\n", tvp5150_read(c,TVP5150_TELETEXT_FIL_1_4)); + dprintk (2, "tvp5150: Teletext filter 1 = 0x%02x\n", tvp5150_read(c,TVP5150_TELETEXT_FIL_1_5)); + dprintk (2, "tvp5150: Teletext filter 2 = 0x%02x\n", tvp5150_read(c,TVP5150_TELETEXT_FIL_2_1)); + dprintk (2, "tvp5150: Teletext filter 2 = 0x%02x\n", tvp5150_read(c,TVP5150_TELETEXT_FIL_2_2)); + dprintk (2, "tvp5150: Teletext filter 2 = 0x%02x\n", tvp5150_read(c,TVP5150_TELETEXT_FIL_2_3)); + dprintk (2, "tvp5150: Teletext filter 2 = 0x%02x\n", tvp5150_read(c,TVP5150_TELETEXT_FIL_2_4)); + dprintk (2, "tvp5150: Teletext filter 2 = 0x%02x\n", tvp5150_read(c,TVP5150_TELETEXT_FIL_2_5)); + dprintk (2, "tvp5150: Teletext filter enable = 0x%02x\n", tvp5150_read(c,TVP5150_TELETEXT_FIL_ENA)); + dprintk (2, "tvp5150: Interrupt status register A = 0x%02x\n", tvp5150_read(c,TVP5150_INT_STATUS_REG_A)); + dprintk (2, "tvp5150: Interrupt enable register A = 0x%02x\n", tvp5150_read(c,TVP5150_INT_ENABLE_REG_A)); + dprintk (2, "tvp5150: Interrupt configuration = 0x%02x\n", tvp5150_read(c,TVP5150_INT_CONF)); + dprintk (2, "tvp5150: VDP configuration RAM data = 0x%02x\n", tvp5150_read(c,TVP5150_VDP_CONF_RAM_DATA)); + dprintk (2, "tvp5150: Configuration RAM address low byte = 0x%02x\n", tvp5150_read(c,TVP5150_CONF_RAM_ADDR_LOW)); + dprintk (2, "tvp5150: Configuration RAM address high byte = 0x%02x\n", tvp5150_read(c,TVP5150_CONF_RAM_ADDR_HIGH)); + dprintk (2, "tvp5150: VDP status register = 0x%02x\n", tvp5150_read(c,TVP5150_VDP_STATUS_REG)); + dprintk (2, "tvp5150: FIFO word count = 0x%02x\n", tvp5150_read(c,TVP5150_FIFO_WORD_COUNT)); + dprintk (2, "tvp5150: FIFO interrupt threshold = 0x%02x\n", tvp5150_read(c,TVP5150_FIFO_INT_THRESHOLD)); + dprintk (2, "tvp5150: FIFO reset = 0x%02x\n", tvp5150_read(c,TVP5150_FIFO_RESET)); + dprintk (2, "tvp5150: Line number interrupt = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_NUMBER_INT)); + dprintk (2, "tvp5150: Pixel alignment register low byte = 0x%02x\n", tvp5150_read(c,TVP5150_PIX_ALIGN_REG_LOW)); + dprintk (2, "tvp5150: Pixel alignment register high byte = 0x%02x\n", tvp5150_read(c,TVP5150_PIX_ALIGN_REG_HIGH)); + dprintk (2, "tvp5150: FIFO output control = 0x%02x\n", tvp5150_read(c,TVP5150_FIFO_OUT_CTRL)); + dprintk (2, "tvp5150: Full field enable 1 = 0x%02x\n", tvp5150_read(c,TVP5150_FULL_FIELD_ENA_1)); + dprintk (2, "tvp5150: Full field enable 2 = 0x%02x\n", tvp5150_read(c,TVP5150_FULL_FIELD_ENA_2)); + dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_1)); + dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_2)); + dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_3)); + dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_4)); + dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_5)); + dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_6)); + dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_7)); + dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_8)); + dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_9)); + dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_10)); + dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_11)); + dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_12)); + dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_13)); + dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_14)); + dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_15)); + dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_16)); + dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_17)); + dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_18)); + dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_19)); + dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_20)); + dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_21)); + dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_22)); + dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_23)); + dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_24)); + dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_25)); + dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_27)); + dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_28)); + dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_29)); + dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_30)); + dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_31)); + dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_32)); + dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_33)); + dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_34)); + dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_35)); + dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_36)); + dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_37)); + dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_38)); + dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_39)); + dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_40)); + dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_41)); + dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_42)); + dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_43)); + dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_44)); + dprintk (2, "tvp5150: Full field mode register = 0x%02x\n", tvp5150_read(c,TVP5150_FULL_FIELD_MODE_REG)); +} + +/**************************************************************************** + Basic functions + ****************************************************************************/ +enum tvp5150_input { + TVP5150_ANALOG_CH0 = 0, + TVP5150_SVIDEO = 1, + TVP5150_ANALOG_CH1 = 2, + TVP5150_BLACK_SCREEN = 8 +}; + +static inline void tvp5150_selmux(struct i2c_client *c, enum tvp5150_input input) +{ + tvp5150_write(c,TVP5150_VD_IN_SRC_SEL_1,input); +}; + +static inline void tvp5150_reset(struct i2c_client *c) +{ + /* Automatic offset and AGC enabled*/ + tvp5150_write(c,TVP5150_ANAL_CHL_CTL,0x15); + + /* Normal Operation */ + tvp5150_write(c,TVP5150_OP_MODE_CTL,0x00); + + /* Activate YCrCb output 0x9 or 0xd ? */ + tvp5150_write(c,TVP5150_MISC_CTL,0x09); + + /* Activates video std autodetection for PAL/M and PAL/N */ + tvp5150_write(c,TVP5150_AUTOSW_MSK,0xf0); + + /* Default format: 0x47, 4:2:2: 0x40 */ + tvp5150_write(c,TVP5150_DATA_RATE_SEL,0x47); + + tvp5150_selmux(c,TVP5150_ANALOG_CH0); +}; + + +/**************************************************************************** + I2C Client & Driver + ****************************************************************************/ +static struct i2c_driver driver; + +static struct i2c_client client_template = +{ + .name = "(unset)", + .flags = I2C_CLIENT_ALLOW_USE, + .driver = &driver, +}; + +static int +tvp5150_detect_client (struct i2c_adapter *adapter, + int address, + int kind) +{ + struct i2c_client *client; + struct tvp5150 *core; + int rv; + + dprintk(1, + KERN_INFO + "tvp5150.c: detecting tvp5150 client on address 0x%x\n", + address << 1); + + client_template.adapter = adapter; + client_template.addr = address; + + /* Check if the adapter supports the needed features */ + if (!i2c_check_functionality + (adapter, + I2C_FUNC_SMBUS_READ_BYTE | I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) + return 0; + + client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); + if (client == 0) + return -ENOMEM; + memcpy(client,&client_template,sizeof(struct i2c_client)); + + core = kmalloc(sizeof(struct tvp5150), GFP_KERNEL); + if (core == 0) { + kfree(client); + return -ENOMEM; + } + memset(core, 0, sizeof(struct tvp5150)); + i2c_set_clientdata(client, core); + + rv = i2c_attach_client(client); + + if (rv) { + kfree(client); + kfree(core); + return rv; + } + + tvp5150_reset(client); + dump_reg (client); + + return 0; +} + +static int +tvp5150_attach_adapter (struct i2c_adapter *adapter) +{ + dprintk(1, + KERN_INFO + "tvp5150.c: starting probe for adapter %s (0x%x)\n", + adapter->name, adapter->id); + return i2c_probe(adapter, &addr_data, &tvp5150_detect_client); +} + +static int +tvp5150_detach_client (struct i2c_client *client) +{ + struct tvp5150 *decoder = i2c_get_clientdata(client); + int err; + + err = i2c_detach_client(client); + if (err) { + return err; + } + + kfree(decoder); + kfree(client); + + return 0; +} + +/* ----------------------------------------------------------------------- */ + +static struct i2c_driver driver = { + .owner = THIS_MODULE, + .name = "tvp5150", + + /* FIXME */ + .id = I2C_DRIVERID_SAA7110, + .flags = I2C_DF_NOTIFY, + + .attach_adapter = tvp5150_attach_adapter, + .detach_client = tvp5150_detach_client, +}; + +static int __init +tvp5150_init (void) +{ + return i2c_add_driver(&driver); +} + +static void __exit +tvp5150_exit (void) +{ + i2c_del_driver(&driver); +} + +module_init(tvp5150_init); +module_exit(tvp5150_exit); diff --git a/drivers/media/video/tvp5150_reg.h b/drivers/media/video/tvp5150_reg.h new file mode 100644 index 000000000000..cd45c1ded786 --- /dev/null +++ b/drivers/media/video/tvp5150_reg.h @@ -0,0 +1,173 @@ +#define TVP5150_VD_IN_SRC_SEL_1 0x00 /* Video input source selection #1 */ +#define TVP5150_ANAL_CHL_CTL 0x01 /* Analog channel controls */ +#define TVP5150_OP_MODE_CTL 0x02 /* Operation mode controls */ +#define TVP5150_MISC_CTL 0x03 /* Miscellaneous controls */ +#define TVP5150_AUTOSW_MSK 0x04 /* Autoswitch mask: TVP5150A / TVP5150AM */ + +/* Reserved 05h */ + +#define TVP5150_COLOR_KIL_THSH_CTL 0x06 /* Color killer threshold control */ +#define TVP5150_LUMA_PROC_CTL_1 0x07 /* Luminance processing control #1 */ +#define TVP5150_LUMA_PROC_CTL_2 0x08 /* Luminance processing control #2 */ +#define TVP5150_BRIGHT_CTL 0x09 /* Brightness control */ +#define TVP5150_SATURATION_CTL 0x0a /* Color saturation control */ +#define TVP5150_HUE_CTL 0x0b /* Hue control */ +#define TVP5150_CONTRAST_CTL 0x0c /* Contrast control */ +#define TVP5150_DATA_RATE_SEL 0x0d /* Outputs and data rates select */ +#define TVP5150_LUMA_PROC_CTL_3 0x0e /* Luminance processing control #3 */ +#define TVP5150_CONF_SHARED_PIN 0x0f /* Configuration shared pins */ + +/* Reserved 10h */ + +#define TVP5150_ACT_VD_CROP_ST_MSB 0x11 /* Active video cropping start MSB */ +#define TVP5150_ACT_VD_CROP_ST_LSB 0x12 /* Active video cropping start LSB */ +#define TVP5150_ACT_VD_CROP_STP_MSB 0x13 /* Active video cropping stop MSB */ +#define TVP5150_ACT_VD_CROP_STP_LSB 0x14 /* Active video cropping stop LSB */ +#define TVP5150_GENLOCK 0x15 /* Genlock/RTC */ +#define TVP5150_HORIZ_SYNC_START 0x16 /* Horizontal sync start */ + +/* Reserved 17h */ + +#define TVP5150_VERT_BLANKING_START 0x18 /* Vertical blanking start */ +#define TVP5150_VERT_BLANKING_STOP 0x19 /* Vertical blanking stop */ +#define TVP5150_CHROMA_PROC_CTL_1 0x1a /* Chrominance processing control #1 */ +#define TVP5150_CHROMA_PROC_CTL_2 0x1b /* Chrominance processing control #2 */ +#define TVP5150_INT_RESET_REG_B 0x1c /* Interrupt reset register B */ +#define TVP5150_INT_ENABLE_REG_B 0x1d /* Interrupt enable register B */ +#define TVP5150_INTT_CONFIG_REG_B 0x1e /* Interrupt configuration register B */ + +/* Reserved 1Fh-27h */ + +#define TVP5150_VIDEO_STD 0x28 /* Video standard */ + +/* Reserved 29h-2bh */ + +#define TVP5150_CB_GAIN_FACT 0x2c /* Cb gain factor */ +#define TVP5150_CR_GAIN_FACTOR 0x2d /* Cr gain factor */ +#define TVP5150_MACROVISION_ON_CTR 0x2e /* Macrovision on counter */ +#define TVP5150_MACROVISION_OFF_CTR 0x2f /* Macrovision off counter */ +#define TVP5150_REV_SELECT 0x30 /* revision select (TVP5150AM1 only) */ + +/* Reserved 31h-7Fh */ + +#define TVP5150_MSB_DEV_ID 0x80 /* MSB of device ID */ +#define TVP5150_LSB_DEV_ID 0x81 /* LSB of device ID */ +#define TVP5150_ROM_MAJOR_VER 0x82 /* ROM major version */ +#define TVP5150_ROM_MINOR_VER 0x83 /* ROM minor version */ +#define TVP5150_VERT_LN_COUNT_MSB 0x84 /* Vertical line count MSB */ +#define TVP5150_VERT_LN_COUNT_LSB 0x85 /* Vertical line count LSB */ +#define TVP5150_INT_STATUS_REG_B 0x86 /* Interrupt status register B */ +#define TVP5150_INT_ACTIVE_REG_B 0x87 /* Interrupt active register B */ +#define TVP5150_STATUS_REG_1 0x88 /* Status register #1 */ +#define TVP5150_STATUS_REG_2 0x89 /* Status register #2 */ +#define TVP5150_STATUS_REG_3 0x8a /* Status register #3 */ +#define TVP5150_STATUS_REG_4 0x8b /* Status register #4 */ +#define TVP5150_STATUS_REG_5 0x8c /* Status register #5 */ +/* Reserved 8Dh-8Fh */ +#define TVP5150_CC_DATA_REG1 0x90 /* Closed caption data registers */ +#define TVP5150_CC_DATA_REG2 0x91 /* Closed caption data registers */ +#define TVP5150_CC_DATA_REG3 0x92 /* Closed caption data registers */ +#define TVP5150_CC_DATA_REG4 0x93 /* Closed caption data registers */ +#define TVP5150_WSS_DATA_REG1 0X94 /* WSS data registers */ +#define TVP5150_WSS_DATA_REG2 0X95 /* WSS data registers */ +#define TVP5150_WSS_DATA_REG3 0X96 /* WSS data registers */ +#define TVP5150_WSS_DATA_REG4 0X97 /* WSS data registers */ +#define TVP5150_WSS_DATA_REG5 0X98 /* WSS data registers */ +#define TVP5150_WSS_DATA_REG6 0X99 /* WSS data registers */ +#define TVP5150_VPS_DATA_REG1 0x9a /* VPS data registers */ +#define TVP5150_VPS_DATA_REG2 0x9b /* VPS data registers */ +#define TVP5150_VPS_DATA_REG3 0x9c /* VPS data registers */ +#define TVP5150_VPS_DATA_REG4 0x9d /* VPS data registers */ +#define TVP5150_VPS_DATA_REG5 0x9e /* VPS data registers */ +#define TVP5150_VPS_DATA_REG6 0x9f /* VPS data registers */ +#define TVP5150_VPS_DATA_REG7 0xa0 /* VPS data registers */ +#define TVP5150_VPS_DATA_REG8 0xa1 /* VPS data registers */ +#define TVP5150_VPS_DATA_REG9 0xa2 /* VPS data registers */ +#define TVP5150_VPS_DATA_REG10 0xa3 /* VPS data registers */ +#define TVP5150_VPS_DATA_REG11 0xa4 /* VPS data registers */ +#define TVP5150_VPS_DATA_REG12 0xa5 /* VPS data registers */ +#define TVP5150_VPS_DATA_REG13 0xa6 /* VPS data registers */ +#define TVP5150_VITC_DATA_REG1 0xa7 /* VITC data registers */ +#define TVP5150_VITC_DATA_REG2 0xa8 /* VITC data registers */ +#define TVP5150_VITC_DATA_REG3 0xa9 /* VITC data registers */ +#define TVP5150_VITC_DATA_REG4 0xaa /* VITC data registers */ +#define TVP5150_VITC_DATA_REG5 0xab /* VITC data registers */ +#define TVP5150_VITC_DATA_REG6 0xac /* VITC data registers */ +#define TVP5150_VITC_DATA_REG7 0xad /* VITC data registers */ +#define TVP5150_VITC_DATA_REG8 0xae /* VITC data registers */ +#define TVP5150_VITC_DATA_REG9 0xaf /* VITC data registers */ +#define TVP5150_VBI_FIFO_READ_DATA 0xb0 /* VBI FIFO read data */ +#define TVP5150_TELETEXT_FIL_1_1 0xb1 /* Teletext filter 1 */ +#define TVP5150_TELETEXT_FIL_1_2 0xb2 /* Teletext filter 1 */ +#define TVP5150_TELETEXT_FIL_1_3 0xb3 /* Teletext filter 1 */ +#define TVP5150_TELETEXT_FIL_1_4 0xb4 /* Teletext filter 1 */ +#define TVP5150_TELETEXT_FIL_1_5 0xb5 /* Teletext filter 1 */ +#define TVP5150_TELETEXT_FIL_2_1 0xb6 /* Teletext filter 2 */ +#define TVP5150_TELETEXT_FIL_2_2 0xb7 /* Teletext filter 2 */ +#define TVP5150_TELETEXT_FIL_2_3 0xb8 /* Teletext filter 2 */ +#define TVP5150_TELETEXT_FIL_2_4 0xb9 /* Teletext filter 2 */ +#define TVP5150_TELETEXT_FIL_2_5 0xba /* Teletext filter 2 */ +#define TVP5150_TELETEXT_FIL_ENA 0xbb /* Teletext filter enable */ +/* Reserved BCh-BFh */ +#define TVP5150_INT_STATUS_REG_A 0xc0 /* Interrupt status register A */ +#define TVP5150_INT_ENABLE_REG_A 0xc1 /* Interrupt enable register A */ +#define TVP5150_INT_CONF 0xc2 /* Interrupt configuration */ +#define TVP5150_VDP_CONF_RAM_DATA 0xc3 /* VDP configuration RAM data */ +#define TVP5150_CONF_RAM_ADDR_LOW 0xc4 /* Configuration RAM address low byte */ +#define TVP5150_CONF_RAM_ADDR_HIGH 0xc5 /* Configuration RAM address high byte */ +#define TVP5150_VDP_STATUS_REG 0xc6 /* VDP status register */ +#define TVP5150_FIFO_WORD_COUNT 0xc7 /* FIFO word count */ +#define TVP5150_FIFO_INT_THRESHOLD 0xc8 /* FIFO interrupt threshold */ +#define TVP5150_FIFO_RESET 0xc9 /* FIFO reset */ +#define TVP5150_LINE_NUMBER_INT 0xca /* Line number interrupt */ +#define TVP5150_PIX_ALIGN_REG_LOW 0xcb /* Pixel alignment register low byte */ +#define TVP5150_PIX_ALIGN_REG_HIGH 0xcc /* Pixel alignment register high byte */ +#define TVP5150_FIFO_OUT_CTRL 0xcd /* FIFO output control */ +/* Reserved CEh */ +#define TVP5150_FULL_FIELD_ENA_1 0xcf /* Full field enable 1 */ +#define TVP5150_FULL_FIELD_ENA_2 0xd0 /* Full field enable 2 */ +#define TVP5150_LINE_MODE_REG_1 0xd1 /* Line mode registers */ +#define TVP5150_LINE_MODE_REG_2 0xd2 /* Line mode registers */ +#define TVP5150_LINE_MODE_REG_3 0xd3 /* Line mode registers */ +#define TVP5150_LINE_MODE_REG_4 0xd4 /* Line mode registers */ +#define TVP5150_LINE_MODE_REG_5 0xd5 /* Line mode registers */ +#define TVP5150_LINE_MODE_REG_6 0xd6 /* Line mode registers */ +#define TVP5150_LINE_MODE_REG_7 0xd7 /* Line mode registers */ +#define TVP5150_LINE_MODE_REG_8 0xd8 /* Line mode registers */ +#define TVP5150_LINE_MODE_REG_9 0xd9 /* Line mode registers */ +#define TVP5150_LINE_MODE_REG_10 0xda /* Line mode registers */ +#define TVP5150_LINE_MODE_REG_11 0xdb /* Line mode registers */ +#define TVP5150_LINE_MODE_REG_12 0xdc /* Line mode registers */ +#define TVP5150_LINE_MODE_REG_13 0xdd /* Line mode registers */ +#define TVP5150_LINE_MODE_REG_14 0xde /* Line mode registers */ +#define TVP5150_LINE_MODE_REG_15 0xdf /* Line mode registers */ +#define TVP5150_LINE_MODE_REG_16 0xe0 /* Line mode registers */ +#define TVP5150_LINE_MODE_REG_17 0xe1 /* Line mode registers */ +#define TVP5150_LINE_MODE_REG_18 0xe2 /* Line mode registers */ +#define TVP5150_LINE_MODE_REG_19 0xe3 /* Line mode registers */ +#define TVP5150_LINE_MODE_REG_20 0xe4 /* Line mode registers */ +#define TVP5150_LINE_MODE_REG_21 0xe5 /* Line mode registers */ +#define TVP5150_LINE_MODE_REG_22 0xe6 /* Line mode registers */ +#define TVP5150_LINE_MODE_REG_23 0xe7 /* Line mode registers */ +#define TVP5150_LINE_MODE_REG_24 0xe8 /* Line mode registers */ +#define TVP5150_LINE_MODE_REG_25 0xe9 /* Line mode registers */ +#define TVP5150_LINE_MODE_REG_27 0xea /* Line mode registers */ +#define TVP5150_LINE_MODE_REG_28 0xeb /* Line mode registers */ +#define TVP5150_LINE_MODE_REG_29 0xec /* Line mode registers */ +#define TVP5150_LINE_MODE_REG_30 0xed /* Line mode registers */ +#define TVP5150_LINE_MODE_REG_31 0xee /* Line mode registers */ +#define TVP5150_LINE_MODE_REG_32 0xef /* Line mode registers */ +#define TVP5150_LINE_MODE_REG_33 0xf0 /* Line mode registers */ +#define TVP5150_LINE_MODE_REG_34 0xf1 /* Line mode registers */ +#define TVP5150_LINE_MODE_REG_35 0xf2 /* Line mode registers */ +#define TVP5150_LINE_MODE_REG_36 0xf3 /* Line mode registers */ +#define TVP5150_LINE_MODE_REG_37 0xf4 /* Line mode registers */ +#define TVP5150_LINE_MODE_REG_38 0xf5 /* Line mode registers */ +#define TVP5150_LINE_MODE_REG_39 0xf6 /* Line mode registers */ +#define TVP5150_LINE_MODE_REG_40 0xf7 /* Line mode registers */ +#define TVP5150_LINE_MODE_REG_41 0xf8 /* Line mode registers */ +#define TVP5150_LINE_MODE_REG_42 0xf9 /* Line mode registers */ +#define TVP5150_LINE_MODE_REG_43 0xfa /* Line mode registers */ +#define TVP5150_LINE_MODE_REG_44 0xfb /* Line mode registers */ +#define TVP5150_FULL_FIELD_MODE_REG 0xfc /* Full field mode register */ +/* Reserved FDh-FFh */ -- cgit v1.2.2 From 35f8d4d623953b5d868d9735a4c10e57dca6dc97 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 8 Nov 2005 21:36:41 -0800 Subject: [PATCH] v4l: 674: move some if kernel version into compat.h - Move some #if kernel version into compat.h Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/cx88/cx88-dvb.c | 1 - drivers/media/video/saa7134/saa7134-dvb.c | 1 - 2 files changed, 2 deletions(-) diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index ecb12c80b380..82e686135f60 100644 --- a/drivers/media/video/cx88/cx88-dvb.c +++ b/drivers/media/video/cx88/cx88-dvb.c @@ -29,7 +29,6 @@ #include #include - #include "cx88.h" #include "dvb-pll.h" diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c index f8e01030fbc7..87641f7e4322 100644 --- a/drivers/media/video/saa7134/saa7134-dvb.c +++ b/drivers/media/video/saa7134/saa7134-dvb.c @@ -29,7 +29,6 @@ #include #include - #include "saa7134-reg.h" #include "saa7134.h" -- cgit v1.2.2 From 84486d53b7fab2cf939acd378959fc4896d3bb68 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:36:41 -0800 Subject: [PATCH] v4l: 675: tvp5150 included on makefile - Tvp5150 included on makefile. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/tvp5150.c | 653 ++++++++++++++++++++++++++++++------------ 1 file changed, 472 insertions(+), 181 deletions(-) diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c index e575877f8269..bd1201d7adf1 100644 --- a/drivers/media/video/tvp5150.c +++ b/drivers/media/video/tvp5150.c @@ -9,16 +9,17 @@ #include #include #include +#include #include "tvp5150_reg.h" -MODULE_DESCRIPTION("Texas Instruments TVP5150A video decoder driver");/* standard i2c insmod options */ +MODULE_DESCRIPTION("Texas Instruments TVP5150A video decoder driver"); /* standard i2c insmod options */ MODULE_AUTHOR("Mauro Carvalho Chehab"); MODULE_LICENSE("GPL"); static unsigned short normal_i2c[] = { - 0xb8 >>1, - 0xba >>1, + 0xb8 >> 1, + 0xba >> 1, I2C_CLIENT_END }; @@ -36,228 +37,519 @@ MODULE_PARM_DESC(debug, "Debug level (0-1)"); struct tvp5150 { struct i2c_client *client; + + int norm; + int input; + int enable; + int bright; + int contrast; + int hue; + int sat; }; -static inline int tvp5150_read(struct i2c_client *c,unsigned char addr) +static inline int tvp5150_read(struct i2c_client *c, unsigned char addr) { unsigned char buffer[1]; int rc; -/* struct tvp5150 *core = i2c_get_clientdata(c); */ buffer[0] = addr; if (1 != (rc = i2c_master_send(c, buffer, 1))) - dprintk(0,"i2c i/o error: rc == %d (should be 1)\n", rc); + dprintk(0, "i2c i/o error: rc == %d (should be 1)\n", rc); msleep(10); if (1 != (rc = i2c_master_recv(c, buffer, 1))) - dprintk(0,"i2c i/o error: rc == %d (should be 1)\n", rc); + dprintk(0, "i2c i/o error: rc == %d (should be 1)\n", rc); return (buffer[0]); } -static inline void tvp5150_write(struct i2c_client *c,unsigned char addr, unsigned char value) +static inline void tvp5150_write(struct i2c_client *c, unsigned char addr, + unsigned char value) { unsigned char buffer[2]; int rc; /* struct tvp5150 *core = i2c_get_clientdata(c); */ buffer[0] = addr; - buffer[2] = addr; + buffer[1] = value; + dprintk(1,"tvp5150: writing 0x%02x 0x%02x\n",buffer[0],buffer[1]); if (2 != (rc = i2c_master_send(c, buffer, 2))) - dprintk(0,"i2c i/o error: rc == %d (should be 2)\n", rc); + dprintk(0, "i2c i/o error: rc == %d (should be 2)\n", rc); } -static void dump_reg (struct i2c_client *c) +static void dump_reg(struct i2c_client *c) { - dprintk (2, "tvp5150: Video input source selection #1 = 0x%02x\n", tvp5150_read(c,TVP5150_VD_IN_SRC_SEL_1)); - dprintk (2, "tvp5150: Analog channel controls = 0x%02x\n", tvp5150_read(c,TVP5150_ANAL_CHL_CTL)); - dprintk (2, "tvp5150: Operation mode controls = 0x%02x\n", tvp5150_read(c,TVP5150_OP_MODE_CTL)); - dprintk (2, "tvp5150: Miscellaneous controls = 0x%02x\n", tvp5150_read(c,TVP5150_MISC_CTL)); - dprintk (2, "tvp5150: Autoswitch mask: TVP5150A / TVP5150AM = 0x%02x\n", tvp5150_read(c,TVP5150_AUTOSW_MSK)); - dprintk (2, "tvp5150: Color killer threshold control = 0x%02x\n", tvp5150_read(c,TVP5150_COLOR_KIL_THSH_CTL)); - dprintk (2, "tvp5150: Luminance processing control #1 = 0x%02x\n", tvp5150_read(c,TVP5150_LUMA_PROC_CTL_1)); - dprintk (2, "tvp5150: Luminance processing control #2 = 0x%02x\n", tvp5150_read(c,TVP5150_LUMA_PROC_CTL_2)); - dprintk (2, "tvp5150: Brightness control = 0x%02x\n", tvp5150_read(c,TVP5150_BRIGHT_CTL)); - dprintk (2, "tvp5150: Color saturation control = 0x%02x\n", tvp5150_read(c,TVP5150_SATURATION_CTL)); - dprintk (2, "tvp5150: Hue control = 0x%02x\n", tvp5150_read(c,TVP5150_HUE_CTL)); - dprintk (2, "tvp5150: Contrast control = 0x%02x\n", tvp5150_read(c,TVP5150_CONTRAST_CTL)); - dprintk (2, "tvp5150: Outputs and data rates select = 0x%02x\n", tvp5150_read(c,TVP5150_DATA_RATE_SEL)); - dprintk (2, "tvp5150: Luminance processing control #3 = 0x%02x\n", tvp5150_read(c,TVP5150_LUMA_PROC_CTL_3)); - dprintk (2, "tvp5150: Configuration shared pins = 0x%02x\n", tvp5150_read(c,TVP5150_CONF_SHARED_PIN)); - dprintk (2, "tvp5150: Active video cropping start MSB = 0x%02x\n", tvp5150_read(c,TVP5150_ACT_VD_CROP_ST_MSB)); - dprintk (2, "tvp5150: Active video cropping start LSB = 0x%02x\n", tvp5150_read(c,TVP5150_ACT_VD_CROP_ST_LSB)); - dprintk (2, "tvp5150: Active video cropping stop MSB = 0x%02x\n", tvp5150_read(c,TVP5150_ACT_VD_CROP_STP_MSB)); - dprintk (2, "tvp5150: Active video cropping stop LSB = 0x%02x\n", tvp5150_read(c,TVP5150_ACT_VD_CROP_STP_LSB)); - dprintk (2, "tvp5150: Genlock/RTC = 0x%02x\n", tvp5150_read(c,TVP5150_GENLOCK)); - dprintk (2, "tvp5150: Horizontal sync start = 0x%02x\n", tvp5150_read(c,TVP5150_HORIZ_SYNC_START)); - dprintk (2, "tvp5150: Vertical blanking start = 0x%02x\n", tvp5150_read(c,TVP5150_VERT_BLANKING_START)); - dprintk (2, "tvp5150: Vertical blanking stop = 0x%02x\n", tvp5150_read(c,TVP5150_VERT_BLANKING_STOP)); - dprintk (2, "tvp5150: Chrominance processing control #1 = 0x%02x\n", tvp5150_read(c,TVP5150_CHROMA_PROC_CTL_1)); - dprintk (2, "tvp5150: Chrominance processing control #2 = 0x%02x\n", tvp5150_read(c,TVP5150_CHROMA_PROC_CTL_2)); - dprintk (2, "tvp5150: Interrupt reset register B = 0x%02x\n", tvp5150_read(c,TVP5150_INT_RESET_REG_B)); - dprintk (2, "tvp5150: Interrupt enable register B = 0x%02x\n", tvp5150_read(c,TVP5150_INT_ENABLE_REG_B)); - dprintk (2, "tvp5150: Interrupt configuration register B = 0x%02x\n", tvp5150_read(c,TVP5150_INTT_CONFIG_REG_B)); - dprintk (2, "tvp5150: Video standard = 0x%02x\n", tvp5150_read(c,TVP5150_VIDEO_STD)); - dprintk (2, "tvp5150: Cb gain factor = 0x%02x\n", tvp5150_read(c,TVP5150_CB_GAIN_FACT)); - dprintk (2, "tvp5150: Cr gain factor = 0x%02x\n", tvp5150_read(c,TVP5150_CR_GAIN_FACTOR)); - dprintk (2, "tvp5150: Macrovision on counter = 0x%02x\n", tvp5150_read(c,TVP5150_MACROVISION_ON_CTR)); - dprintk (2, "tvp5150: Macrovision off counter = 0x%02x\n", tvp5150_read(c,TVP5150_MACROVISION_OFF_CTR)); - dprintk (2, "tvp5150: revision select (TVP5150AM1 only) = 0x%02x\n", tvp5150_read(c,TVP5150_REV_SELECT)); - dprintk (2, "tvp5150: MSB of device ID = 0x%02x\n", tvp5150_read(c,TVP5150_MSB_DEV_ID)); - dprintk (2, "tvp5150: LSB of device ID = 0x%02x\n", tvp5150_read(c,TVP5150_LSB_DEV_ID)); - dprintk (2, "tvp5150: ROM major version = 0x%02x\n", tvp5150_read(c,TVP5150_ROM_MAJOR_VER)); - dprintk (2, "tvp5150: ROM minor version = 0x%02x\n", tvp5150_read(c,TVP5150_ROM_MINOR_VER)); - dprintk (2, "tvp5150: Vertical line count MSB = 0x%02x\n", tvp5150_read(c,TVP5150_VERT_LN_COUNT_MSB)); - dprintk (2, "tvp5150: Vertical line count LSB = 0x%02x\n", tvp5150_read(c,TVP5150_VERT_LN_COUNT_LSB)); - dprintk (2, "tvp5150: Interrupt status register B = 0x%02x\n", tvp5150_read(c,TVP5150_INT_STATUS_REG_B)); - dprintk (2, "tvp5150: Interrupt active register B = 0x%02x\n", tvp5150_read(c,TVP5150_INT_ACTIVE_REG_B)); - dprintk (2, "tvp5150: Status register #1 = 0x%02x\n", tvp5150_read(c,TVP5150_STATUS_REG_1)); - dprintk (2, "tvp5150: Status register #2 = 0x%02x\n", tvp5150_read(c,TVP5150_STATUS_REG_2)); - dprintk (2, "tvp5150: Status register #3 = 0x%02x\n", tvp5150_read(c,TVP5150_STATUS_REG_3)); - dprintk (2, "tvp5150: Status register #4 = 0x%02x\n", tvp5150_read(c,TVP5150_STATUS_REG_4)); - dprintk (2, "tvp5150: Status register #5 = 0x%02x\n", tvp5150_read(c,TVP5150_STATUS_REG_5)); - dprintk (2, "tvp5150: Closed caption data registers = 0x%02x\n", tvp5150_read(c,TVP5150_CC_DATA_REG1)); - dprintk (2, "tvp5150: Closed caption data registers = 0x%02x\n", tvp5150_read(c,TVP5150_CC_DATA_REG2)); - dprintk (2, "tvp5150: Closed caption data registers = 0x%02x\n", tvp5150_read(c,TVP5150_CC_DATA_REG3)); - dprintk (2, "tvp5150: Closed caption data registers = 0x%02x\n", tvp5150_read(c,TVP5150_CC_DATA_REG4)); - dprintk (2, "tvp5150: WSS data registers = 0x%02x\n", tvp5150_read(c,TVP5150_WSS_DATA_REG1)); - dprintk (2, "tvp5150: WSS data registers = 0x%02x\n", tvp5150_read(c,TVP5150_WSS_DATA_REG2)); - dprintk (2, "tvp5150: WSS data registers = 0x%02x\n", tvp5150_read(c,TVP5150_WSS_DATA_REG3)); - dprintk (2, "tvp5150: WSS data registers = 0x%02x\n", tvp5150_read(c,TVP5150_WSS_DATA_REG4)); - dprintk (2, "tvp5150: WSS data registers = 0x%02x\n", tvp5150_read(c,TVP5150_WSS_DATA_REG5)); - dprintk (2, "tvp5150: WSS data registers = 0x%02x\n", tvp5150_read(c,TVP5150_WSS_DATA_REG6)); - dprintk (2, "tvp5150: VPS data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VPS_DATA_REG1)); - dprintk (2, "tvp5150: VPS data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VPS_DATA_REG2)); - dprintk (2, "tvp5150: VPS data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VPS_DATA_REG3)); - dprintk (2, "tvp5150: VPS data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VPS_DATA_REG4)); - dprintk (2, "tvp5150: VPS data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VPS_DATA_REG5)); - dprintk (2, "tvp5150: VPS data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VPS_DATA_REG6)); - dprintk (2, "tvp5150: VPS data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VPS_DATA_REG7)); - dprintk (2, "tvp5150: VPS data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VPS_DATA_REG8)); - dprintk (2, "tvp5150: VPS data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VPS_DATA_REG9)); - dprintk (2, "tvp5150: VPS data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VPS_DATA_REG10)); - dprintk (2, "tvp5150: VPS data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VPS_DATA_REG11)); - dprintk (2, "tvp5150: VPS data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VPS_DATA_REG12)); - dprintk (2, "tvp5150: VPS data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VPS_DATA_REG13)); - dprintk (2, "tvp5150: VITC data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VITC_DATA_REG1)); - dprintk (2, "tvp5150: VITC data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VITC_DATA_REG2)); - dprintk (2, "tvp5150: VITC data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VITC_DATA_REG3)); - dprintk (2, "tvp5150: VITC data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VITC_DATA_REG4)); - dprintk (2, "tvp5150: VITC data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VITC_DATA_REG5)); - dprintk (2, "tvp5150: VITC data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VITC_DATA_REG6)); - dprintk (2, "tvp5150: VITC data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VITC_DATA_REG7)); - dprintk (2, "tvp5150: VITC data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VITC_DATA_REG8)); - dprintk (2, "tvp5150: VITC data registers = 0x%02x\n", tvp5150_read(c,TVP5150_VITC_DATA_REG9)); - dprintk (2, "tvp5150: VBI FIFO read data = 0x%02x\n", tvp5150_read(c,TVP5150_VBI_FIFO_READ_DATA)); - dprintk (2, "tvp5150: Teletext filter 1 = 0x%02x\n", tvp5150_read(c,TVP5150_TELETEXT_FIL_1_1)); - dprintk (2, "tvp5150: Teletext filter 1 = 0x%02x\n", tvp5150_read(c,TVP5150_TELETEXT_FIL_1_2)); - dprintk (2, "tvp5150: Teletext filter 1 = 0x%02x\n", tvp5150_read(c,TVP5150_TELETEXT_FIL_1_3)); - dprintk (2, "tvp5150: Teletext filter 1 = 0x%02x\n", tvp5150_read(c,TVP5150_TELETEXT_FIL_1_4)); - dprintk (2, "tvp5150: Teletext filter 1 = 0x%02x\n", tvp5150_read(c,TVP5150_TELETEXT_FIL_1_5)); - dprintk (2, "tvp5150: Teletext filter 2 = 0x%02x\n", tvp5150_read(c,TVP5150_TELETEXT_FIL_2_1)); - dprintk (2, "tvp5150: Teletext filter 2 = 0x%02x\n", tvp5150_read(c,TVP5150_TELETEXT_FIL_2_2)); - dprintk (2, "tvp5150: Teletext filter 2 = 0x%02x\n", tvp5150_read(c,TVP5150_TELETEXT_FIL_2_3)); - dprintk (2, "tvp5150: Teletext filter 2 = 0x%02x\n", tvp5150_read(c,TVP5150_TELETEXT_FIL_2_4)); - dprintk (2, "tvp5150: Teletext filter 2 = 0x%02x\n", tvp5150_read(c,TVP5150_TELETEXT_FIL_2_5)); - dprintk (2, "tvp5150: Teletext filter enable = 0x%02x\n", tvp5150_read(c,TVP5150_TELETEXT_FIL_ENA)); - dprintk (2, "tvp5150: Interrupt status register A = 0x%02x\n", tvp5150_read(c,TVP5150_INT_STATUS_REG_A)); - dprintk (2, "tvp5150: Interrupt enable register A = 0x%02x\n", tvp5150_read(c,TVP5150_INT_ENABLE_REG_A)); - dprintk (2, "tvp5150: Interrupt configuration = 0x%02x\n", tvp5150_read(c,TVP5150_INT_CONF)); - dprintk (2, "tvp5150: VDP configuration RAM data = 0x%02x\n", tvp5150_read(c,TVP5150_VDP_CONF_RAM_DATA)); - dprintk (2, "tvp5150: Configuration RAM address low byte = 0x%02x\n", tvp5150_read(c,TVP5150_CONF_RAM_ADDR_LOW)); - dprintk (2, "tvp5150: Configuration RAM address high byte = 0x%02x\n", tvp5150_read(c,TVP5150_CONF_RAM_ADDR_HIGH)); - dprintk (2, "tvp5150: VDP status register = 0x%02x\n", tvp5150_read(c,TVP5150_VDP_STATUS_REG)); - dprintk (2, "tvp5150: FIFO word count = 0x%02x\n", tvp5150_read(c,TVP5150_FIFO_WORD_COUNT)); - dprintk (2, "tvp5150: FIFO interrupt threshold = 0x%02x\n", tvp5150_read(c,TVP5150_FIFO_INT_THRESHOLD)); - dprintk (2, "tvp5150: FIFO reset = 0x%02x\n", tvp5150_read(c,TVP5150_FIFO_RESET)); - dprintk (2, "tvp5150: Line number interrupt = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_NUMBER_INT)); - dprintk (2, "tvp5150: Pixel alignment register low byte = 0x%02x\n", tvp5150_read(c,TVP5150_PIX_ALIGN_REG_LOW)); - dprintk (2, "tvp5150: Pixel alignment register high byte = 0x%02x\n", tvp5150_read(c,TVP5150_PIX_ALIGN_REG_HIGH)); - dprintk (2, "tvp5150: FIFO output control = 0x%02x\n", tvp5150_read(c,TVP5150_FIFO_OUT_CTRL)); - dprintk (2, "tvp5150: Full field enable 1 = 0x%02x\n", tvp5150_read(c,TVP5150_FULL_FIELD_ENA_1)); - dprintk (2, "tvp5150: Full field enable 2 = 0x%02x\n", tvp5150_read(c,TVP5150_FULL_FIELD_ENA_2)); - dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_1)); - dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_2)); - dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_3)); - dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_4)); - dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_5)); - dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_6)); - dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_7)); - dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_8)); - dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_9)); - dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_10)); - dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_11)); - dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_12)); - dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_13)); - dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_14)); - dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_15)); - dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_16)); - dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_17)); - dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_18)); - dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_19)); - dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_20)); - dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_21)); - dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_22)); - dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_23)); - dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_24)); - dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_25)); - dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_27)); - dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_28)); - dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_29)); - dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_30)); - dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_31)); - dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_32)); - dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_33)); - dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_34)); - dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_35)); - dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_36)); - dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_37)); - dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_38)); - dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_39)); - dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_40)); - dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_41)); - dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_42)); - dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_43)); - dprintk (2, "tvp5150: Line mode registers = 0x%02x\n", tvp5150_read(c,TVP5150_LINE_MODE_REG_44)); - dprintk (2, "tvp5150: Full field mode register = 0x%02x\n", tvp5150_read(c,TVP5150_FULL_FIELD_MODE_REG)); + printk("tvp5150: Video input source selection #1 = 0x%02x\n", + tvp5150_read(c, TVP5150_VD_IN_SRC_SEL_1)); + printk("tvp5150: Analog channel controls = 0x%02x\n", + tvp5150_read(c, TVP5150_ANAL_CHL_CTL)); + printk("tvp5150: Operation mode controls = 0x%02x\n", + tvp5150_read(c, TVP5150_OP_MODE_CTL)); + printk("tvp5150: Miscellaneous controls = 0x%02x\n", + tvp5150_read(c, TVP5150_MISC_CTL)); + printk("tvp5150: Autoswitch mask: TVP5150A / TVP5150AM = 0x%02x\n", + tvp5150_read(c, TVP5150_AUTOSW_MSK)); + printk("tvp5150: Color killer threshold control = 0x%02x\n", + tvp5150_read(c, TVP5150_COLOR_KIL_THSH_CTL)); + printk("tvp5150: Luminance processing control #1 = 0x%02x\n", + tvp5150_read(c, TVP5150_LUMA_PROC_CTL_1)); + printk("tvp5150: Luminance processing control #2 = 0x%02x\n", + tvp5150_read(c, TVP5150_LUMA_PROC_CTL_2)); + printk("tvp5150: Brightness control = 0x%02x\n", + tvp5150_read(c, TVP5150_BRIGHT_CTL)); + printk("tvp5150: Color saturation control = 0x%02x\n", + tvp5150_read(c, TVP5150_SATURATION_CTL)); + printk("tvp5150: Hue control = 0x%02x\n", + tvp5150_read(c, TVP5150_HUE_CTL)); + printk("tvp5150: Contrast control = 0x%02x\n", + tvp5150_read(c, TVP5150_CONTRAST_CTL)); + printk("tvp5150: Outputs and data rates select = 0x%02x\n", + tvp5150_read(c, TVP5150_DATA_RATE_SEL)); + printk("tvp5150: Luminance processing control #3 = 0x%02x\n", + tvp5150_read(c, TVP5150_LUMA_PROC_CTL_3)); + printk("tvp5150: Configuration shared pins = 0x%02x\n", + tvp5150_read(c, TVP5150_CONF_SHARED_PIN)); + printk("tvp5150: Active video cropping start MSB = 0x%02x\n", + tvp5150_read(c, TVP5150_ACT_VD_CROP_ST_MSB)); + printk("tvp5150: Active video cropping start LSB = 0x%02x\n", + tvp5150_read(c, TVP5150_ACT_VD_CROP_ST_LSB)); + printk("tvp5150: Active video cropping stop MSB = 0x%02x\n", + tvp5150_read(c, TVP5150_ACT_VD_CROP_STP_MSB)); + printk("tvp5150: Active video cropping stop LSB = 0x%02x\n", + tvp5150_read(c, TVP5150_ACT_VD_CROP_STP_LSB)); + printk("tvp5150: Genlock/RTC = 0x%02x\n", + tvp5150_read(c, TVP5150_GENLOCK)); + printk("tvp5150: Horizontal sync start = 0x%02x\n", + tvp5150_read(c, TVP5150_HORIZ_SYNC_START)); + printk("tvp5150: Vertical blanking start = 0x%02x\n", + tvp5150_read(c, TVP5150_VERT_BLANKING_START)); + printk("tvp5150: Vertical blanking stop = 0x%02x\n", + tvp5150_read(c, TVP5150_VERT_BLANKING_STOP)); + printk("tvp5150: Chrominance processing control #1 = 0x%02x\n", + tvp5150_read(c, TVP5150_CHROMA_PROC_CTL_1)); + printk("tvp5150: Chrominance processing control #2 = 0x%02x\n", + tvp5150_read(c, TVP5150_CHROMA_PROC_CTL_2)); + printk("tvp5150: Interrupt reset register B = 0x%02x\n", + tvp5150_read(c, TVP5150_INT_RESET_REG_B)); + printk("tvp5150: Interrupt enable register B = 0x%02x\n", + tvp5150_read(c, TVP5150_INT_ENABLE_REG_B)); + printk("tvp5150: Interrupt configuration register B = 0x%02x\n", + tvp5150_read(c, TVP5150_INTT_CONFIG_REG_B)); + printk("tvp5150: Video standard = 0x%02x\n", + tvp5150_read(c, TVP5150_VIDEO_STD)); + printk("tvp5150: Cb gain factor = 0x%02x\n", + tvp5150_read(c, TVP5150_CB_GAIN_FACT)); + printk("tvp5150: Cr gain factor = 0x%02x\n", + tvp5150_read(c, TVP5150_CR_GAIN_FACTOR)); + printk("tvp5150: Macrovision on counter = 0x%02x\n", + tvp5150_read(c, TVP5150_MACROVISION_ON_CTR)); + printk("tvp5150: Macrovision off counter = 0x%02x\n", + tvp5150_read(c, TVP5150_MACROVISION_OFF_CTR)); + printk("tvp5150: revision select (TVP5150AM1 only) = 0x%02x\n", + tvp5150_read(c, TVP5150_REV_SELECT)); + printk("tvp5150: MSB of device ID = 0x%02x\n", + tvp5150_read(c, TVP5150_MSB_DEV_ID)); + printk("tvp5150: LSB of device ID = 0x%02x\n", + tvp5150_read(c, TVP5150_LSB_DEV_ID)); + printk("tvp5150: ROM major version = 0x%02x\n", + tvp5150_read(c, TVP5150_ROM_MAJOR_VER)); + printk("tvp5150: ROM minor version = 0x%02x\n", + tvp5150_read(c, TVP5150_ROM_MINOR_VER)); + printk("tvp5150: Vertical line count MSB = 0x%02x\n", + tvp5150_read(c, TVP5150_VERT_LN_COUNT_MSB)); + printk("tvp5150: Vertical line count LSB = 0x%02x\n", + tvp5150_read(c, TVP5150_VERT_LN_COUNT_LSB)); + printk("tvp5150: Interrupt status register B = 0x%02x\n", + tvp5150_read(c, TVP5150_INT_STATUS_REG_B)); + printk("tvp5150: Interrupt active register B = 0x%02x\n", + tvp5150_read(c, TVP5150_INT_ACTIVE_REG_B)); + printk("tvp5150: Status register #1 = 0x%02x\n", + tvp5150_read(c, TVP5150_STATUS_REG_1)); + printk("tvp5150: Status register #2 = 0x%02x\n", + tvp5150_read(c, TVP5150_STATUS_REG_2)); + printk("tvp5150: Status register #3 = 0x%02x\n", + tvp5150_read(c, TVP5150_STATUS_REG_3)); + printk("tvp5150: Status register #4 = 0x%02x\n", + tvp5150_read(c, TVP5150_STATUS_REG_4)); + printk("tvp5150: Status register #5 = 0x%02x\n", + tvp5150_read(c, TVP5150_STATUS_REG_5)); + printk("tvp5150: Closed caption data registers = 0x%02x\n", + tvp5150_read(c, TVP5150_CC_DATA_REG1)); + printk("tvp5150: Closed caption data registers = 0x%02x\n", + tvp5150_read(c, TVP5150_CC_DATA_REG2)); + printk("tvp5150: Closed caption data registers = 0x%02x\n", + tvp5150_read(c, TVP5150_CC_DATA_REG3)); + printk("tvp5150: Closed caption data registers = 0x%02x\n", + tvp5150_read(c, TVP5150_CC_DATA_REG4)); + printk("tvp5150: WSS data registers = 0x%02x\n", + tvp5150_read(c, TVP5150_WSS_DATA_REG1)); + printk("tvp5150: WSS data registers = 0x%02x\n", + tvp5150_read(c, TVP5150_WSS_DATA_REG2)); + printk("tvp5150: WSS data registers = 0x%02x\n", + tvp5150_read(c, TVP5150_WSS_DATA_REG3)); + printk("tvp5150: WSS data registers = 0x%02x\n", + tvp5150_read(c, TVP5150_WSS_DATA_REG4)); + printk("tvp5150: WSS data registers = 0x%02x\n", + tvp5150_read(c, TVP5150_WSS_DATA_REG5)); + printk("tvp5150: WSS data registers = 0x%02x\n", + tvp5150_read(c, TVP5150_WSS_DATA_REG6)); + printk("tvp5150: VPS data registers = 0x%02x\n", + tvp5150_read(c, TVP5150_VPS_DATA_REG1)); + printk("tvp5150: VPS data registers = 0x%02x\n", + tvp5150_read(c, TVP5150_VPS_DATA_REG2)); + printk("tvp5150: VPS data registers = 0x%02x\n", + tvp5150_read(c, TVP5150_VPS_DATA_REG3)); + printk("tvp5150: VPS data registers = 0x%02x\n", + tvp5150_read(c, TVP5150_VPS_DATA_REG4)); + printk("tvp5150: VPS data registers = 0x%02x\n", + tvp5150_read(c, TVP5150_VPS_DATA_REG5)); + printk("tvp5150: VPS data registers = 0x%02x\n", + tvp5150_read(c, TVP5150_VPS_DATA_REG6)); + printk("tvp5150: VPS data registers = 0x%02x\n", + tvp5150_read(c, TVP5150_VPS_DATA_REG7)); + printk("tvp5150: VPS data registers = 0x%02x\n", + tvp5150_read(c, TVP5150_VPS_DATA_REG8)); + printk("tvp5150: VPS data registers = 0x%02x\n", + tvp5150_read(c, TVP5150_VPS_DATA_REG9)); + printk("tvp5150: VPS data registers = 0x%02x\n", + tvp5150_read(c, TVP5150_VPS_DATA_REG10)); + printk("tvp5150: VPS data registers = 0x%02x\n", + tvp5150_read(c, TVP5150_VPS_DATA_REG11)); + printk("tvp5150: VPS data registers = 0x%02x\n", + tvp5150_read(c, TVP5150_VPS_DATA_REG12)); + printk("tvp5150: VPS data registers = 0x%02x\n", + tvp5150_read(c, TVP5150_VPS_DATA_REG13)); + printk("tvp5150: VITC data registers = 0x%02x\n", + tvp5150_read(c, TVP5150_VITC_DATA_REG1)); + printk("tvp5150: VITC data registers = 0x%02x\n", + tvp5150_read(c, TVP5150_VITC_DATA_REG2)); + printk("tvp5150: VITC data registers = 0x%02x\n", + tvp5150_read(c, TVP5150_VITC_DATA_REG3)); + printk("tvp5150: VITC data registers = 0x%02x\n", + tvp5150_read(c, TVP5150_VITC_DATA_REG4)); + printk("tvp5150: VITC data registers = 0x%02x\n", + tvp5150_read(c, TVP5150_VITC_DATA_REG5)); + printk("tvp5150: VITC data registers = 0x%02x\n", + tvp5150_read(c, TVP5150_VITC_DATA_REG6)); + printk("tvp5150: VITC data registers = 0x%02x\n", + tvp5150_read(c, TVP5150_VITC_DATA_REG7)); + printk("tvp5150: VITC data registers = 0x%02x\n", + tvp5150_read(c, TVP5150_VITC_DATA_REG8)); + printk("tvp5150: VITC data registers = 0x%02x\n", + tvp5150_read(c, TVP5150_VITC_DATA_REG9)); + printk("tvp5150: VBI FIFO read data = 0x%02x\n", + tvp5150_read(c, TVP5150_VBI_FIFO_READ_DATA)); + printk("tvp5150: Teletext filter 1 = 0x%02x\n", + tvp5150_read(c, TVP5150_TELETEXT_FIL_1_1)); + printk("tvp5150: Teletext filter 1 = 0x%02x\n", + tvp5150_read(c, TVP5150_TELETEXT_FIL_1_2)); + printk("tvp5150: Teletext filter 1 = 0x%02x\n", + tvp5150_read(c, TVP5150_TELETEXT_FIL_1_3)); + printk("tvp5150: Teletext filter 1 = 0x%02x\n", + tvp5150_read(c, TVP5150_TELETEXT_FIL_1_4)); + printk("tvp5150: Teletext filter 1 = 0x%02x\n", + tvp5150_read(c, TVP5150_TELETEXT_FIL_1_5)); + printk("tvp5150: Teletext filter 2 = 0x%02x\n", + tvp5150_read(c, TVP5150_TELETEXT_FIL_2_1)); + printk("tvp5150: Teletext filter 2 = 0x%02x\n", + tvp5150_read(c, TVP5150_TELETEXT_FIL_2_2)); + printk("tvp5150: Teletext filter 2 = 0x%02x\n", + tvp5150_read(c, TVP5150_TELETEXT_FIL_2_3)); + printk("tvp5150: Teletext filter 2 = 0x%02x\n", + tvp5150_read(c, TVP5150_TELETEXT_FIL_2_4)); + printk("tvp5150: Teletext filter 2 = 0x%02x\n", + tvp5150_read(c, TVP5150_TELETEXT_FIL_2_5)); + printk("tvp5150: Teletext filter enable = 0x%02x\n", + tvp5150_read(c, TVP5150_TELETEXT_FIL_ENA)); + printk("tvp5150: Interrupt status register A = 0x%02x\n", + tvp5150_read(c, TVP5150_INT_STATUS_REG_A)); + printk("tvp5150: Interrupt enable register A = 0x%02x\n", + tvp5150_read(c, TVP5150_INT_ENABLE_REG_A)); + printk("tvp5150: Interrupt configuration = 0x%02x\n", + tvp5150_read(c, TVP5150_INT_CONF)); + printk("tvp5150: VDP configuration RAM data = 0x%02x\n", + tvp5150_read(c, TVP5150_VDP_CONF_RAM_DATA)); + printk("tvp5150: Configuration RAM address low byte = 0x%02x\n", + tvp5150_read(c, TVP5150_CONF_RAM_ADDR_LOW)); + printk("tvp5150: Configuration RAM address high byte = 0x%02x\n", + tvp5150_read(c, TVP5150_CONF_RAM_ADDR_HIGH)); + printk("tvp5150: VDP status register = 0x%02x\n", + tvp5150_read(c, TVP5150_VDP_STATUS_REG)); + printk("tvp5150: FIFO word count = 0x%02x\n", + tvp5150_read(c, TVP5150_FIFO_WORD_COUNT)); + printk("tvp5150: FIFO interrupt threshold = 0x%02x\n", + tvp5150_read(c, TVP5150_FIFO_INT_THRESHOLD)); + printk("tvp5150: FIFO reset = 0x%02x\n", + tvp5150_read(c, TVP5150_FIFO_RESET)); + printk("tvp5150: Line number interrupt = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_NUMBER_INT)); + printk("tvp5150: Pixel alignment register low byte = 0x%02x\n", + tvp5150_read(c, TVP5150_PIX_ALIGN_REG_LOW)); + printk("tvp5150: Pixel alignment register high byte = 0x%02x\n", + tvp5150_read(c, TVP5150_PIX_ALIGN_REG_HIGH)); + printk("tvp5150: FIFO output control = 0x%02x\n", + tvp5150_read(c, TVP5150_FIFO_OUT_CTRL)); + printk("tvp5150: Full field enable 1 = 0x%02x\n", + tvp5150_read(c, TVP5150_FULL_FIELD_ENA_1)); + printk("tvp5150: Full field enable 2 = 0x%02x\n", + tvp5150_read(c, TVP5150_FULL_FIELD_ENA_2)); + printk("tvp5150: Line mode registers = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_MODE_REG_1)); + printk("tvp5150: Line mode registers = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_MODE_REG_2)); + printk("tvp5150: Line mode registers = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_MODE_REG_3)); + printk("tvp5150: Line mode registers = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_MODE_REG_4)); + printk("tvp5150: Line mode registers = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_MODE_REG_5)); + printk("tvp5150: Line mode registers = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_MODE_REG_6)); + printk("tvp5150: Line mode registers = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_MODE_REG_7)); + printk("tvp5150: Line mode registers = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_MODE_REG_8)); + printk("tvp5150: Line mode registers = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_MODE_REG_9)); + printk("tvp5150: Line mode registers = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_MODE_REG_10)); + printk("tvp5150: Line mode registers = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_MODE_REG_11)); + printk("tvp5150: Line mode registers = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_MODE_REG_12)); + printk("tvp5150: Line mode registers = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_MODE_REG_13)); + printk("tvp5150: Line mode registers = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_MODE_REG_14)); + printk("tvp5150: Line mode registers = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_MODE_REG_15)); + printk("tvp5150: Line mode registers = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_MODE_REG_16)); + printk("tvp5150: Line mode registers = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_MODE_REG_17)); + printk("tvp5150: Line mode registers = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_MODE_REG_18)); + printk("tvp5150: Line mode registers = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_MODE_REG_19)); + printk("tvp5150: Line mode registers = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_MODE_REG_20)); + printk("tvp5150: Line mode registers = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_MODE_REG_21)); + printk("tvp5150: Line mode registers = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_MODE_REG_22)); + printk("tvp5150: Line mode registers = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_MODE_REG_23)); + printk("tvp5150: Line mode registers = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_MODE_REG_24)); + printk("tvp5150: Line mode registers = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_MODE_REG_25)); + printk("tvp5150: Line mode registers = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_MODE_REG_27)); + printk("tvp5150: Line mode registers = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_MODE_REG_28)); + printk("tvp5150: Line mode registers = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_MODE_REG_29)); + printk("tvp5150: Line mode registers = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_MODE_REG_30)); + printk("tvp5150: Line mode registers = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_MODE_REG_31)); + printk("tvp5150: Line mode registers = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_MODE_REG_32)); + printk("tvp5150: Line mode registers = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_MODE_REG_33)); + printk("tvp5150: Line mode registers = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_MODE_REG_34)); + printk("tvp5150: Line mode registers = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_MODE_REG_35)); + printk("tvp5150: Line mode registers = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_MODE_REG_36)); + printk("tvp5150: Line mode registers = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_MODE_REG_37)); + printk("tvp5150: Line mode registers = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_MODE_REG_38)); + printk("tvp5150: Line mode registers = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_MODE_REG_39)); + printk("tvp5150: Line mode registers = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_MODE_REG_40)); + printk("tvp5150: Line mode registers = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_MODE_REG_41)); + printk("tvp5150: Line mode registers = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_MODE_REG_42)); + printk("tvp5150: Line mode registers = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_MODE_REG_43)); + printk("tvp5150: Line mode registers = 0x%02x\n", + tvp5150_read(c, TVP5150_LINE_MODE_REG_44)); + printk("tvp5150: Full field mode register = 0x%02x\n", + tvp5150_read(c, TVP5150_FULL_FIELD_MODE_REG)); } /**************************************************************************** Basic functions ****************************************************************************/ enum tvp5150_input { - TVP5150_ANALOG_CH0 = 0, - TVP5150_SVIDEO = 1, - TVP5150_ANALOG_CH1 = 2, - TVP5150_BLACK_SCREEN = 8 + TVP5150_ANALOG_CH0 = 0, + TVP5150_SVIDEO = 1, + TVP5150_ANALOG_CH1 = 2, + TVP5150_BLACK_SCREEN = 8 }; -static inline void tvp5150_selmux(struct i2c_client *c, enum tvp5150_input input) +static inline void tvp5150_selmux(struct i2c_client *c, + enum tvp5150_input input) { - tvp5150_write(c,TVP5150_VD_IN_SRC_SEL_1,input); + int tvp_input; + + /* FIXME: It is dependent of basic driver */ + switch (input) + { + case 2: + tvp_input=TVP5150_ANALOG_CH0; + break; + case 0: + tvp_input=TVP5150_ANALOG_CH1; + break; + case 1: + tvp_input=TVP5150_SVIDEO; + break; + default: + tvp_input=TVP5150_BLACK_SCREEN; + } + + tvp5150_write(c, TVP5150_VD_IN_SRC_SEL_1, tvp_input); }; static inline void tvp5150_reset(struct i2c_client *c) { - /* Automatic offset and AGC enabled*/ - tvp5150_write(c,TVP5150_ANAL_CHL_CTL,0x15); + tvp5150_write(c, TVP5150_CONF_SHARED_PIN, 2); + + /* Automatic offset and AGC enabled */ + tvp5150_write(c, TVP5150_ANAL_CHL_CTL, 0x15); /* Normal Operation */ - tvp5150_write(c,TVP5150_OP_MODE_CTL,0x00); +// tvp5150_write(c, TVP5150_OP_MODE_CTL, 0x00); /* Activate YCrCb output 0x9 or 0xd ? */ - tvp5150_write(c,TVP5150_MISC_CTL,0x09); + tvp5150_write(c, TVP5150_MISC_CTL, 0x6f); /* Activates video std autodetection for PAL/M and PAL/N */ - tvp5150_write(c,TVP5150_AUTOSW_MSK,0xf0); + tvp5150_write(c, TVP5150_AUTOSW_MSK, 0xf0); /* Default format: 0x47, 4:2:2: 0x40 */ - tvp5150_write(c,TVP5150_DATA_RATE_SEL,0x47); + tvp5150_write(c, TVP5150_DATA_RATE_SEL, 0x47); + + tvp5150_selmux(c, TVP5150_ANALOG_CH0); - tvp5150_selmux(c,TVP5150_ANALOG_CH0); + tvp5150_write(c, TVP5150_CHROMA_PROC_CTL_1, 0x0c); + tvp5150_write(c, TVP5150_CHROMA_PROC_CTL_2, 0x54); + + tvp5150_write(c, 0x27, 0x20); /* ?????????? */ + + tvp5150_write(c, TVP5150_VIDEO_STD, 0x0); /* Auto switch */ + + tvp5150_write(c, TVP5150_HUE_CTL, 0x0); }; +/**************************************************************************** + I2C Command + ****************************************************************************/ +static int tvp5150_command(struct i2c_client *client, + unsigned int cmd, void *arg) +{ + struct tvp5150 *decoder = i2c_get_clientdata(client); + + switch (cmd) { + + case 0: + case DECODER_INIT: + tvp5150_reset(client); + break; + + case DECODER_DUMP: + dump_reg(client); + break; + + case DECODER_GET_CAPABILITIES: + { + struct video_decoder_capability *cap = arg; + + cap->flags = VIDEO_DECODER_PAL | + VIDEO_DECODER_NTSC | + VIDEO_DECODER_SECAM | + VIDEO_DECODER_AUTO | VIDEO_DECODER_CCIR; + cap->inputs = 3; + cap->outputs = 1; + break; + } + case DECODER_GET_STATUS: + { + break; + } + + case DECODER_SET_GPIO: + break; + + case DECODER_SET_VBI_BYPASS: + break; + + case DECODER_SET_NORM: + { + int *iarg = arg; + + switch (*iarg) { + + case VIDEO_MODE_NTSC: + break; + + case VIDEO_MODE_PAL: + break; + + case VIDEO_MODE_SECAM: + break; + + case VIDEO_MODE_AUTO: + break; + + default: + return -EINVAL; + + } + decoder->norm = *iarg; + break; + } + case DECODER_SET_INPUT: + { + int *iarg = arg; + if (*iarg < 0 || *iarg > 3) { + return -EINVAL; + } + + tvp5150_selmux(client, *iarg); + + break; + } + case DECODER_SET_OUTPUT: + { + int *iarg = arg; + + /* not much choice of outputs */ + if (*iarg != 0) { + return -EINVAL; + } + break; + } + case DECODER_ENABLE_OUTPUT: +// int *iarg = arg; +// int enable = (*iarg != 0); + + break; + + case DECODER_SET_PICTURE: + default: + return -EINVAL; + } + + return 0; +} /**************************************************************************** I2C Client & Driver @@ -271,10 +563,8 @@ static struct i2c_client client_template = .driver = &driver, }; -static int -tvp5150_detect_client (struct i2c_adapter *adapter, - int address, - int kind) +static int tvp5150_detect_client (struct i2c_adapter *adapter, + int address, int kind) { struct i2c_client *client; struct tvp5150 *core; @@ -297,7 +587,7 @@ tvp5150_detect_client (struct i2c_adapter *adapter, client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); if (client == 0) return -ENOMEM; - memcpy(client,&client_template,sizeof(struct i2c_client)); + memcpy(client,&client_template,sizeof(struct i2c_client)); core = kmalloc(sizeof(struct tvp5150), GFP_KERNEL); if (core == 0) { @@ -315,7 +605,6 @@ tvp5150_detect_client (struct i2c_adapter *adapter, return rv; } - tvp5150_reset(client); dump_reg (client); return 0; @@ -360,6 +649,8 @@ static struct i2c_driver driver = { .attach_adapter = tvp5150_attach_adapter, .detach_client = tvp5150_detach_client, + + .command = tvp5150_command, }; static int __init -- cgit v1.2.2 From 83331624aac006b615f6853aacd28aef3111ef07 Mon Sep 17 00:00:00 2001 From: Hartmut Hackmann Date: Tue, 8 Nov 2005 21:36:42 -0800 Subject: [PATCH] v4l: 677: increased eeprom dump to 128 bytes - Increased eeprom dump to 128 bytes Signed-off-by: Hartmut Hackmann Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/saa7134/saa7134.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index ad8e89d6bf50..4169c2a857f1 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h @@ -428,7 +428,7 @@ struct saa7134_dev { /* i2c i/o */ struct i2c_adapter i2c_adap; struct i2c_client i2c_client; - unsigned char eedata[64]; + unsigned char eedata[128]; /* video overlay */ struct v4l2_framebuffer ovbuf; -- cgit v1.2.2 From 4c86f973ba0f49af1f4c54ff3d1935093c173450 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:36:43 -0800 Subject: [PATCH] v4l: 678: fixed input selection - Fixed input selection. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/tvp5150.c | 62 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 54 insertions(+), 8 deletions(-) diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c index bd1201d7adf1..6e3ba23104d2 100644 --- a/drivers/media/video/tvp5150.c +++ b/drivers/media/video/tvp5150.c @@ -397,6 +397,7 @@ enum tvp5150_input { static inline void tvp5150_selmux(struct i2c_client *c, enum tvp5150_input input) { + struct tvp5150 *decoder = i2c_get_clientdata(c); int tvp_input; /* FIXME: It is dependent of basic driver */ @@ -415,11 +416,16 @@ static inline void tvp5150_selmux(struct i2c_client *c, tvp_input=TVP5150_BLACK_SCREEN; } + if (!decoder->enable) + tvp_input|=TVP5150_BLACK_SCREEN; + tvp5150_write(c, TVP5150_VD_IN_SRC_SEL_1, tvp_input); }; static inline void tvp5150_reset(struct i2c_client *c) { + struct tvp5150 *decoder = i2c_get_clientdata(c); + tvp5150_write(c, TVP5150_CONF_SHARED_PIN, 2); /* Automatic offset and AGC enabled */ @@ -431,13 +437,13 @@ static inline void tvp5150_reset(struct i2c_client *c) /* Activate YCrCb output 0x9 or 0xd ? */ tvp5150_write(c, TVP5150_MISC_CTL, 0x6f); - /* Activates video std autodetection for PAL/M and PAL/N */ - tvp5150_write(c, TVP5150_AUTOSW_MSK, 0xf0); + /* Activates video std autodetection for all standards */ + tvp5150_write(c, TVP5150_AUTOSW_MSK, 0x0); /* Default format: 0x47, 4:2:2: 0x40 */ tvp5150_write(c, TVP5150_DATA_RATE_SEL, 0x47); - tvp5150_selmux(c, TVP5150_ANALOG_CH0); + tvp5150_selmux(c, decoder->input); tvp5150_write(c, TVP5150_CHROMA_PROC_CTL_1, 0x0c); tvp5150_write(c, TVP5150_CHROMA_PROC_CTL_2, 0x54); @@ -446,7 +452,10 @@ static inline void tvp5150_reset(struct i2c_client *c) tvp5150_write(c, TVP5150_VIDEO_STD, 0x0); /* Auto switch */ - tvp5150_write(c, TVP5150_HUE_CTL, 0x0); + tvp5150_write(c, TVP5150_BRIGHT_CTL, decoder->bright >> 8); + tvp5150_write(c, TVP5150_CONTRAST_CTL, decoder->contrast >> 8); + tvp5150_write(c, TVP5150_SATURATION_CTL, decoder->contrast >> 8); + tvp5150_write(c, TVP5150_HUE_CTL, (decoder->hue - 32768) >> 8); }; /**************************************************************************** @@ -523,7 +532,8 @@ static int tvp5150_command(struct i2c_client *client, return -EINVAL; } - tvp5150_selmux(client, *iarg); + decoder->input=*iarg; + tvp5150_selmux(client, decoder->input); break; } @@ -538,12 +548,40 @@ static int tvp5150_command(struct i2c_client *client, break; } case DECODER_ENABLE_OUTPUT: -// int *iarg = arg; -// int enable = (*iarg != 0); + { + int *iarg = arg; - break; + decoder->enable = (*iarg != 0); + + tvp5150_selmux(client, decoder->input); + break; + } case DECODER_SET_PICTURE: + { + struct video_picture *pic = arg; + if (decoder->bright != pic->brightness) { + /* We want 0 to 255 we get 0-65535 */ + decoder->bright = pic->brightness; + tvp5150_write(client, TVP5150_BRIGHT_CTL, decoder->bright >> 8); + } + if (decoder->contrast != pic->contrast) { + /* We want 0 to 255 we get 0-65535 */ + decoder->contrast = pic->contrast; + tvp5150_write(client, TVP5150_CONTRAST_CTL, decoder->contrast >> 8); + } + if (decoder->sat != pic->colour) { + /* We want 0 to 255 we get 0-65535 */ + decoder->sat = pic->colour; + tvp5150_write(client, TVP5150_SATURATION_CTL, decoder->contrast >> 8); + } + if (decoder->hue != pic->hue) { + /* We want -128 to 127 we get 0-65535 */ + decoder->hue = pic->hue; + tvp5150_write(client, TVP5150_HUE_CTL, (decoder->hue - 32768) >> 8); + } + break; + } default: return -EINVAL; } @@ -599,6 +637,14 @@ static int tvp5150_detect_client (struct i2c_adapter *adapter, rv = i2c_attach_client(client); + core->norm = VIDEO_MODE_AUTO; + core->input = 2; + core->enable = 1; + core->bright = 32768; + core->contrast = 32768; + core->hue = 32768; + core->sat = 32768; + if (rv) { kfree(client); kfree(core); -- cgit v1.2.2 From 372dffdb4b2d23e94b657d2321c16c4c86df45d2 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:36:44 -0800 Subject: [PATCH] v4l: 683: some v4l2 api calls implemented on msp3400.c - Some V4L2 API calls implemented on msp3400.c. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/msp3400.c | 95 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) diff --git a/drivers/media/video/msp3400.c b/drivers/media/video/msp3400.c index e75e7948fd9d..6e2b0775a74e 100644 --- a/drivers/media/video/msp3400.c +++ b/drivers/media/video/msp3400.c @@ -382,6 +382,7 @@ static void msp3400c_setvolume(struct i2c_client *client, { int val = 0, bal = 0; +muted=0; if (!muted) { /* 0x7f instead if 0x73 here has sound quality issues, * probably due to overmodulation + clipping ... */ @@ -989,6 +990,8 @@ static int msp34xx_modus(int norm) { switch (norm) { case VIDEO_MODE_PAL: + dprintk(KERN_DEBUG "msp34xx: video mode selected to PAL\n"); + #if 1 /* experimental: not sure this works with all chip versions */ return 0x7003; @@ -997,12 +1000,16 @@ static int msp34xx_modus(int norm) return 0x1003; #endif case VIDEO_MODE_NTSC: /* BTSC */ + dprintk(KERN_DEBUG "msp34xx: video mode selected to NTSC\n"); return 0x2003; case VIDEO_MODE_SECAM: + dprintk(KERN_DEBUG "msp34xx: video mode selected to SECAM\n"); return 0x0003; case VIDEO_MODE_RADIO: + dprintk(KERN_DEBUG "msp34xx: video mode selected to Radio\n"); return 0x0003; case VIDEO_MODE_AUTO: + dprintk(KERN_DEBUG "msp34xx: video mode selected to Auto\n"); return 0x2003; default: return 0x0003; @@ -1495,6 +1502,7 @@ static int msp_attach(struct i2c_adapter *adap, int addr, int kind) dprintk("msp34xx: error while reading chip version\n"); return -1; } + printk(KERN_INFO "msp34xx: rev1=0x%04x, rev2=0x%04x\n", msp->rev1, msp->rev2); msp3400c_setvolume(c, msp->muted, msp->volume, msp->balance); @@ -1762,6 +1770,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) msp_any_set_audmode(client,mode_v4l1_to_v4l2(va->mode)); break; } + case VIDIOCSCHAN: { struct video_channel *vc = arg; @@ -1782,6 +1791,92 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) } /* --- v4l2 ioctls --- */ + case VIDIOC_S_STD: + { + v4l2_std_id *id = arg; + + /*FIXME: use V4L2 mode flags on msp3400 instead of V4L1*/ + if (*id & V4L2_STD_PAL) { + msp->norm=VIDEO_MODE_PAL; + } else if (*id & V4L2_STD_SECAM) { + msp->norm=VIDEO_MODE_SECAM; + } else { + msp->norm=VIDEO_MODE_NTSC; + } + + msp_wake_thread(client); + return 0; + } + + case VIDIOC_G_AUDIO: + { + struct v4l2_audio *a = arg; + + memset(a,0,sizeof(*a)); + + switch (a->index) { + case AUDIO_RADIO: + strcpy(a->name,"Radio"); + break; + case AUDIO_EXTERN_1: + strcpy(a->name,"Extern 1"); + break; + case AUDIO_EXTERN_2: + strcpy(a->name,"Extern 2"); + break; + case AUDIO_TUNER: + strcpy(a->name,"Television"); + break; + default: + return -EINVAL; + } + + msp_any_detect_stereo(client); + if (msp->audmode == V4L2_TUNER_MODE_STEREO) { + a->capability=V4L2_AUDCAP_STEREO; + } + + break; + } + case VIDIOC_S_AUDIO: + { + struct v4l2_audio *sarg = arg; + + switch (sarg->index) { + case AUDIO_RADIO: + /* Hauppauge uses IN2 for the radio */ + msp->mode = MSP_MODE_FM_RADIO; + scart = SCART_IN2; + break; + case AUDIO_EXTERN_1: + /* IN1 is often used for external input ... */ + msp->mode = MSP_MODE_EXTERN; + scart = SCART_IN1; + break; + case AUDIO_EXTERN_2: + /* ... sometimes it is IN2 through ;) */ + msp->mode = MSP_MODE_EXTERN; + scart = SCART_IN2; + break; + case AUDIO_TUNER: + msp->mode = -1; + break; + } + if (scart) { + msp->rxsubchans = V4L2_TUNER_SUB_STEREO; + msp->audmode = V4L2_TUNER_MODE_STEREO; + msp3400c_set_scart(client,scart,0); + msp3400c_write(client,I2C_MSP3400C_DFP,0x000d,0x1900); + } + if (sarg->capability==V4L2_AUDCAP_STEREO) { + msp->audmode = V4L2_TUNER_MODE_STEREO; + } else { + msp->audmode &= ~V4L2_TUNER_MODE_STEREO; + } + msp_any_set_audmode(client, msp->audmode); + msp_wake_thread(client); + break; + } case VIDIOC_G_TUNER: { struct v4l2_tuner *vt = arg; -- cgit v1.2.2 From 20f441f6900d786606583263d89653c48c7093a8 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Tue, 8 Nov 2005 21:36:44 -0800 Subject: [PATCH] v4l: 685: update the tveeprom tuner list with the tuner - Update the tveeprom tuner list with the tuner Signed-off-by: Hans Verkuil Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/tuner-simple.c | 4 ++-- drivers/media/video/tveeprom.c | 22 ++++++++++++++-------- include/media/tuner.h | 2 +- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c index 3af055970dd2..b75ad2d4488a 100644 --- a/drivers/media/video/tuner-simple.c +++ b/drivers/media/video/tuner-simple.c @@ -222,7 +222,7 @@ static struct tunertype tuners[] = { 16*160.00,16*454.00,0x41,0x42,0x04,0x8e,940}, /* UHF band untested */ { "tda8290+75", Philips, PAL|NTSC, /* see tda8290.c for details */ }, - { "LG PAL (TAPE series)", LGINNOTEK, PAL, + { "TCL 2002MB", TCL, PAL, 16*170.00, 16*450.00, 0x01,0x02,0x08,0xce,623}, { "Philips PAL/SECAM multi (FQ1216AME MK4)", Philips, PAL, 16*160.00,16*442.00,0x01,0x02,0x04,0xce,623 }, @@ -233,7 +233,7 @@ static struct tunertype tuners[] = { { "Ymec TVision TVF-5533MF", Philips, NTSC, 16*160.00,16*454.00,0x01,0x02,0x04,0x8e,732}, - /* 60-66 */ + /* 60-67 */ { "Thomson DDT 7611 (ATSC/NTSC)", THOMSON, ATSC, 16*157.25,16*454.00,0x39,0x3a,0x3c,0x8e,732}, { "Tena TNF9533-D/IF/TNF9533-B/DF", Philips, PAL, diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c index 5344d5592199..6453b71f2997 100644 --- a/drivers/media/video/tveeprom.c +++ b/drivers/media/video/tveeprom.c @@ -200,15 +200,21 @@ hauppauge_tuner[] = { TUNER_ABSENT, "Philips FQ1286A MK4"}, { TUNER_ABSENT, "Philips FQ1216ME MK5"}, { TUNER_ABSENT, "Philips FQ1236 MK5"}, - { TUNER_ABSENT, "Unspecified"}, - { TUNER_LG_PAL_TAPE, "LG PAL (TAPE Series)"}, - { TUNER_ABSENT, "Unspecified"}, + { TUNER_ABSENT, "Samsung TCPG_6121P30A"}, + { TUNER_TCL_2002MB, "TCL 2002MB_3H"}, + { TUNER_ABSENT, "TCL 2002MI_3H"}, { TUNER_TCL_2002N, "TCL 2002N 5H"}, - /* 100-103 */ - { TUNER_ABSENT, "Unspecified"}, - { TUNER_TEA5767, "Philips TEA5767HN FM Radio"}, - { TUNER_ABSENT, "Unspecified"}, - { TUNER_PHILIPS_FM1236_MK3, "TCL MFNM05 4"}, + /* 100-109 */ + { TUNER_ABSENT, "Philips FMD1216ME"}, + { TUNER_TEA5767, "Philips TEA5768HL FM Radio"}, + { TUNER_ABSENT, "Panasonic ENV57H12D5"}, + { TUNER_ABSENT, "TCL MFNM05-4"}, + { TUNER_ABSENT, "TCL MNM05-4"}, + { TUNER_PHILIPS_FM1216ME_MK3, "TCL MPE05-2"}, + { TUNER_ABSENT, "TCL MQNM05-4"}, + { TUNER_ABSENT, "LG TAPC-W701D"}, + { TUNER_ABSENT, "TCL 9886P-WM"}, + { TUNER_ABSENT, "TCL 1676NM-WM"}, }; /* This list is supplied by Hauppauge. Thanks! */ diff --git a/include/media/tuner.h b/include/media/tuner.h index 4f47eac90caf..bf925702fbbf 100644 --- a/include/media/tuner.h +++ b/include/media/tuner.h @@ -95,7 +95,7 @@ #define TUNER_THOMSON_DTT7610 52 #define TUNER_PHILIPS_FQ1286 53 #define TUNER_PHILIPS_TDA8290 54 -#define TUNER_LG_PAL_TAPE 55 /* Hauppauge PVR-150 PAL */ +#define TUNER_TCL_2002MB 55 /* Hauppauge PVR-150 PAL */ #define TUNER_PHILIPS_FQ1216AME_MK4 56 /* Hauppauge PVR-150 PAL */ #define TUNER_PHILIPS_FQ1236A_MK4 57 /* Hauppauge PVR-500MCE NTSC */ -- cgit v1.2.2 From 9b71521b66da26129255ade6ad71f708032bc0e0 Mon Sep 17 00:00:00 2001 From: "Robert W. Boone" Date: Tue, 8 Nov 2005 21:36:45 -0800 Subject: [PATCH] v4l: 686: change the number of lines in the input signal when the - Change the number of lines in the input signal when the video standard is changed. - Fix comments style. Signed-off-by: Robert W. Boone Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/saa7134/saa6752hs.c | 130 +++++++++++++++++--------------- 1 file changed, 70 insertions(+), 60 deletions(-) diff --git a/drivers/media/video/saa7134/saa6752hs.c b/drivers/media/video/saa7134/saa6752hs.c index 382911c6ef22..dac720ea3b06 100644 --- a/drivers/media/video/saa7134/saa6752hs.c +++ b/drivers/media/video/saa7134/saa6752hs.c @@ -57,6 +57,7 @@ struct saa6752hs_state { struct i2c_client client; struct v4l2_mpeg_compression params; enum saa6752hs_videoformat video_format; + v4l2_std_id standard; }; enum saa6752hs_command { @@ -74,58 +75,58 @@ enum saa6752hs_command { /* ---------------------------------------------------------------------- */ static u8 PAT[] = { - 0xc2, // i2c register - 0x00, // table number for encoder + 0xc2, /* i2c register */ + 0x00, /* table number for encoder */ - 0x47, // sync - 0x40, 0x00, // transport_error_indicator(0), payload_unit_start(1), transport_priority(0), pid(0) - 0x10, // transport_scrambling_control(00), adaptation_field_control(01), continuity_counter(0) + 0x47, /* sync */ + 0x40, 0x00, /* transport_error_indicator(0), payload_unit_start(1), transport_priority(0), pid(0) */ + 0x10, /* transport_scrambling_control(00), adaptation_field_control(01), continuity_counter(0) */ - 0x00, // PSI pointer to start of table + 0x00, /* PSI pointer to start of table */ - 0x00, // tid(0) - 0xb0, 0x0d, // section_syntax_indicator(1), section_length(13) + 0x00, /* tid(0) */ + 0xb0, 0x0d, /* section_syntax_indicator(1), section_length(13) */ - 0x00, 0x01, // transport_stream_id(1) + 0x00, 0x01, /* transport_stream_id(1) */ - 0xc1, // version_number(0), current_next_indicator(1) + 0xc1, /* version_number(0), current_next_indicator(1) */ - 0x00, 0x00, // section_number(0), last_section_number(0) + 0x00, 0x00, /* section_number(0), last_section_number(0) */ - 0x00, 0x01, // program_number(1) + 0x00, 0x01, /* program_number(1) */ - 0xe0, 0x00, // PMT PID + 0xe0, 0x00, /* PMT PID */ - 0x00, 0x00, 0x00, 0x00 // CRC32 + 0x00, 0x00, 0x00, 0x00 /* CRC32 */ }; static u8 PMT[] = { - 0xc2, // i2c register - 0x01, // table number for encoder + 0xc2, /* i2c register */ + 0x01, /* table number for encoder */ - 0x47, // sync - 0x40, 0x00, // transport_error_indicator(0), payload_unit_start(1), transport_priority(0), pid - 0x10, // transport_scrambling_control(00), adaptation_field_control(01), continuity_counter(0) + 0x47, /* sync */ + 0x40, 0x00, /* transport_error_indicator(0), payload_unit_start(1), transport_priority(0), pid */ + 0x10, /* transport_scrambling_control(00), adaptation_field_control(01), continuity_counter(0) */ - 0x00, // PSI pointer to start of table + 0x00, /* PSI pointer to start of table */ - 0x02, // tid(2) - 0xb0, 0x17, // section_syntax_indicator(1), section_length(23) + 0x02, /* tid(2) */ + 0xb0, 0x17, /* section_syntax_indicator(1), section_length(23) */ - 0x00, 0x01, // program_number(1) + 0x00, 0x01, /* program_number(1) */ - 0xc1, // version_number(0), current_next_indicator(1) + 0xc1, /* version_number(0), current_next_indicator(1) */ - 0x00, 0x00, // section_number(0), last_section_number(0) + 0x00, 0x00, /* section_number(0), last_section_number(0) */ - 0xe0, 0x00, // PCR_PID + 0xe0, 0x00, /* PCR_PID */ - 0xf0, 0x00, // program_info_length(0) + 0xf0, 0x00, /* program_info_length(0) */ - 0x02, 0xe0, 0x00, 0xf0, 0x00, // video stream type(2), pid - 0x04, 0xe0, 0x00, 0xf0, 0x00, // audio stream type(4), pid + 0x02, 0xe0, 0x00, 0xf0, 0x00, /* video stream type(2), pid */ + 0x04, 0xe0, 0x00, 0xf0, 0x00, /* audio stream type(4), pid */ - 0x00, 0x00, 0x00, 0x00 // CRC32 + 0x00, 0x00, 0x00, 0x00 /* CRC32 */ }; static struct v4l2_mpeg_compression param_defaults = @@ -166,7 +167,7 @@ static int saa6752hs_chip_command(struct i2c_client* client, unsigned long timeout; int status = 0; - // execute the command + /* execute the command */ switch(command) { case SAA6752HS_COMMAND_RESET: buf[0] = 0x00; @@ -200,11 +201,11 @@ static int saa6752hs_chip_command(struct i2c_client* client, return -EINVAL; } - // set it and wait for it to be so + /* set it and wait for it to be so */ i2c_master_send(client, buf, 1); timeout = jiffies + HZ * 3; for (;;) { - // get the current status + /* get the current status */ buf[0] = 0x10; i2c_master_send(client, buf, 1); i2c_master_recv(client, buf, 1); @@ -216,14 +217,12 @@ static int saa6752hs_chip_command(struct i2c_client* client, break; } - // wait a bit msleep(10); } - // delay a bit to let encoder settle + /* delay a bit to let encoder settle */ msleep(50); - // done return status; } @@ -233,44 +232,43 @@ static int saa6752hs_set_bitrate(struct i2c_client* client, { u8 buf[3]; - // set the bitrate mode + /* set the bitrate mode */ buf[0] = 0x71; buf[1] = (params->vi_bitrate.mode == V4L2_BITRATE_VBR) ? 0 : 1; i2c_master_send(client, buf, 2); - // set the video bitrate + /* set the video bitrate */ if (params->vi_bitrate.mode == V4L2_BITRATE_VBR) { - // set the target bitrate + /* set the target bitrate */ buf[0] = 0x80; buf[1] = params->vi_bitrate.target >> 8; buf[2] = params->vi_bitrate.target & 0xff; i2c_master_send(client, buf, 3); - // set the max bitrate + /* set the max bitrate */ buf[0] = 0x81; buf[1] = params->vi_bitrate.max >> 8; buf[2] = params->vi_bitrate.max & 0xff; i2c_master_send(client, buf, 3); } else { - // set the target bitrate (no max bitrate for CBR) + /* set the target bitrate (no max bitrate for CBR) */ buf[0] = 0x81; buf[1] = params->vi_bitrate.target >> 8; buf[2] = params->vi_bitrate.target & 0xff; i2c_master_send(client, buf, 3); } - // set the audio bitrate + /* set the audio bitrate */ buf[0] = 0x94; buf[1] = (256 == params->au_bitrate.target) ? 0 : 1; i2c_master_send(client, buf, 2); - // set the total bitrate + /* set the total bitrate */ buf[0] = 0xb1; buf[1] = params->st_bitrate.target >> 8; buf[2] = params->st_bitrate.target & 0xff; i2c_master_send(client, buf, 3); - // return success return 0; } @@ -376,36 +374,43 @@ static int saa6752hs_init(struct i2c_client* client) h = i2c_get_clientdata(client); - // Set video format - must be done first as it resets other settings + /* Set video format - must be done first as it resets other settings */ buf[0] = 0x41; buf[1] = h->video_format; i2c_master_send(client, buf, 2); - // set bitrate + /* Set number of lines in input signal */ + buf[0] = 0x40; + buf[1] = 0x00; + if (h->standard & V4L2_STD_525_60) + buf[1] = 0x01; + i2c_master_send(client, buf, 2); + + /* set bitrate */ saa6752hs_set_bitrate(client, &h->params); - // Set GOP structure {3, 13} + /* Set GOP structure {3, 13} */ buf[0] = 0x72; buf[1] = 0x03; buf[2] = 0x0D; i2c_master_send(client,buf,3); - // Set minimum Q-scale {4} + /* Set minimum Q-scale {4} */ buf[0] = 0x82; buf[1] = 0x04; i2c_master_send(client,buf,2); - // Set maximum Q-scale {12} + /* Set maximum Q-scale {12} */ buf[0] = 0x83; buf[1] = 0x0C; i2c_master_send(client,buf,2); - // Set Output Protocol + /* Set Output Protocol */ buf[0] = 0xD0; buf[1] = 0x81; i2c_master_send(client,buf,2); - // Set video output stream format {TS} + /* Set video output stream format {TS} */ buf[0] = 0xB0; buf[1] = 0x05; i2c_master_send(client,buf,2); @@ -436,39 +441,39 @@ static int saa6752hs_init(struct i2c_client* client) localPMT[sizeof(PMT) - 2] = (crc >> 8) & 0xFF; localPMT[sizeof(PMT) - 1] = crc & 0xFF; - // Set Audio PID + /* Set Audio PID */ buf[0] = 0xC1; buf[1] = (h->params.ts_pid_audio >> 8) & 0xFF; buf[2] = h->params.ts_pid_audio & 0xFF; i2c_master_send(client,buf,3); - // Set Video PID + /* Set Video PID */ buf[0] = 0xC0; buf[1] = (h->params.ts_pid_video >> 8) & 0xFF; buf[2] = h->params.ts_pid_video & 0xFF; i2c_master_send(client,buf,3); - // Set PCR PID + /* Set PCR PID */ buf[0] = 0xC4; buf[1] = (h->params.ts_pid_pcr >> 8) & 0xFF; buf[2] = h->params.ts_pid_pcr & 0xFF; i2c_master_send(client,buf,3); - // Send SI tables + /* Send SI tables */ i2c_master_send(client,localPAT,sizeof(PAT)); i2c_master_send(client,localPMT,sizeof(PMT)); - // mute then unmute audio. This removes buzzing artefacts + /* mute then unmute audio. This removes buzzing artefacts */ buf[0] = 0xa4; buf[1] = 1; i2c_master_send(client, buf, 2); buf[1] = 0; i2c_master_send(client, buf, 2); - // start it going + /* start it going */ saa6752hs_chip_command(client, SAA6752HS_COMMAND_START); - // readout current state + /* readout current state */ buf[0] = 0xE1; buf[1] = 0xA7; buf[2] = 0xFE; @@ -477,7 +482,7 @@ static int saa6752hs_init(struct i2c_client* client) i2c_master_send(client, buf, 5); i2c_master_recv(client, buf2, 4); - // change aspect ratio + /* change aspect ratio */ buf[0] = 0xE0; buf[1] = 0xA7; buf[2] = 0xFE; @@ -498,7 +503,6 @@ static int saa6752hs_init(struct i2c_client* client) buf[8] = buf2[3]; i2c_master_send(client, buf, 9); - // return success return 0; } @@ -516,6 +520,9 @@ static int saa6752hs_attach(struct i2c_adapter *adap, int addr, int kind) h->client.adapter = adap; h->client.addr = addr; + /* Assume 625 input lines */ + h->standard = 0; + i2c_set_clientdata(&h->client, h); i2c_attach_client(&h->client); return 0; @@ -576,6 +583,9 @@ saa6752hs_command(struct i2c_client *client, unsigned int cmd, void *arg) saa6752hs_set_subsampling(client, f); break; } + case VIDIOC_S_STD: + h->standard = *((v4l2_std_id *) arg); + break; default: /* nothing */ break; -- cgit v1.2.2 From 93e960ff2d94a68403f87bbd2e664509bdfefbae Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 8 Nov 2005 21:36:46 -0800 Subject: [PATCH] v4l: 687: fix source charset make symbols utf 8 - Fix source charset. Make symbols UTF-8. Signed-off-by: David Woodhouse . Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/bttv-cards.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bttv-cards.c index 5672d0ef2bf0..c6010692746d 100644 --- a/drivers/media/video/bttv-cards.c +++ b/drivers/media/video/bttv-cards.c @@ -1063,7 +1063,7 @@ struct tvcard bttv_tvcards[] = { },{ /* ---- card 0x34 ---------------------------------- */ - /* David Härdeman */ + /* David Härdeman */ .name = "Pinnacle PCTV Studio Pro", .video_inputs = 4, .audio_inputs = 1, @@ -3370,7 +3370,7 @@ void bttv_tda9880_setnorm(struct bttv *btv, int norm) /* * reset/enable the MSP on some Hauppauge cards - * Thanks to Kyösti Mälkki (kmalkki@cc.hut.fi)! + * Thanks to Kyösti Mälkki (kmalkki@cc.hut.fi)! * * Hauppauge: pin 5 * Voodoo: pin 20 -- cgit v1.2.2 From fea095fe4c8f7f615472ee8036fe511b47eec53d Mon Sep 17 00:00:00 2001 From: "Nickolay V. Shmyrev" Date: Tue, 8 Nov 2005 21:36:47 -0800 Subject: [PATCH] v4l: 688: add remote for dvb t300 remote - Add remote for DVB-T300 Remote. Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/saa7134/saa7134-cards.c | 1 + drivers/media/video/saa7134/saa7134-input.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index 8bb2faf2635a..9600305771bc 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c @@ -2807,6 +2807,7 @@ int saa7134_board_init1(struct saa7134_dev *dev) /* case SAA7134_BOARD_SABRENT_SBTTVFM: */ /* not finished yet */ case SAA7134_BOARD_VIDEOMATE_TV_PVR: case SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII: + case SAA7134_BOARD_VIDEOMATE_DVBT_300: case SAA7134_BOARD_MANLI_MTV001: case SAA7134_BOARD_MANLI_MTV002: case SAA7134_BOARD_BEHOLD_409FM: diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index baf16a348f44..b69b18c5f189 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -578,6 +578,11 @@ int saa7134_input_init1(struct saa7134_dev *dev) mask_keyup = 0x400000; polling = 50; // ms break; + case SAA7134_BOARD_VIDEOMATE_DVBT_300: + ir_codes = videomate_tv_pvr_codes; + mask_keycode = 0x003F00; + mask_keyup = 0x040000; + break; } if (NULL == ir_codes) { printk("%s: Oops: IR config error [card=%d]\n", -- cgit v1.2.2 From 5ea246862863d712bacf3f2c0cb43de7bf1feeba Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:36:48 -0800 Subject: [PATCH] v4l: 689: cx88 cardlist updated now it also includes pci subsystem ids - Cx88 cardlist updated. Now, it also includes PCI subsystem IDs. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/video4linux/CARDLIST.cx88 | 66 ++++++++++++++++----------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/Documentation/video4linux/CARDLIST.cx88 b/Documentation/video4linux/CARDLIST.cx88 index fa7e38567d86..f0b3b49a4fdf 100644 --- a/Documentation/video4linux/CARDLIST.cx88 +++ b/Documentation/video4linux/CARDLIST.cx88 @@ -1,33 +1,33 @@ -card=0 - UNKNOWN/GENERIC -card=1 - Hauppauge WinTV 34xxx models -card=2 - GDI Black Gold -card=3 - PixelView -card=4 - ATI TV Wonder Pro -card=5 - Leadtek Winfast 2000XP Expert -card=6 - AverTV Studio 303 (M126) -card=7 - MSI TV-@nywhere Master -card=8 - Leadtek Winfast DV2000 -card=9 - Leadtek PVR 2000 -card=10 - IODATA GV-VCP3/PCI -card=11 - Prolink PlayTV PVR -card=12 - ASUS PVR-416 -card=13 - MSI TV-@nywhere -card=14 - KWorld/VStream XPert DVB-T -card=15 - DViCO FusionHDTV DVB-T1 -card=16 - KWorld LTV883RF -card=17 - DViCO FusionHDTV 3 Gold-Q -card=18 - Hauppauge Nova-T DVB-T -card=19 - Conexant DVB-T reference design -card=20 - Provideo PV259 -card=21 - DViCO FusionHDTV DVB-T Plus -card=22 - digitalnow DNTV Live! DVB-T -card=23 - pcHDTV HD3000 HDTV -card=24 - Hauppauge WinTV 28xxx (Roslyn) models -card=25 - Digital-Logic MICROSPACE Entertainment Center (MEC) -card=26 - IODATA GV/BCTV7E -card=27 - PixelView PlayTV Ultra Pro (Stereo) -card=28 - DViCO FusionHDTV 3 Gold-T -card=29 - ADS Tech Instant TV DVB-T PCI -card=30 - TerraTec Cinergy 1400 DVB-T -card=31 - DViCO FusionHDTV 5 Gold -card=32 - AverMedia UltraTV Media Center PCI 550 + 0 -> UNKNOWN/GENERIC + 1 -> Hauppauge WinTV 34xxx models [0070:3400,0070:3401] + 2 -> GDI Black Gold [14c7:0106,14c7:0107] + 3 -> PixelView [1554:4811] + 4 -> ATI TV Wonder Pro [1002:00f8] + 5 -> Leadtek Winfast 2000XP Expert [107d:6611,107d:6613] + 6 -> AverTV Studio 303 (M126) [1461:000b] + 7 -> MSI TV-@nywhere Master [1462:8606] + 8 -> Leadtek Winfast DV2000 [107d:6620] + 9 -> Leadtek PVR 2000 [107d:663b,107d:663C] + 10 -> IODATA GV-VCP3/PCI [10fc:d003] + 11 -> Prolink PlayTV PVR + 12 -> ASUS PVR-416 [1043:4823] + 13 -> MSI TV-@nywhere + 14 -> KWorld/VStream XPert DVB-T [17de:08a6] + 15 -> DViCO FusionHDTV DVB-T1 [18ac:db00] + 16 -> KWorld LTV883RF + 17 -> DViCO FusionHDTV 3 Gold-Q [18ac:d810] + 18 -> Hauppauge Nova-T DVB-T [0070:9002] + 19 -> Conexant DVB-T reference design [14f1:0187] + 20 -> Provideo PV259 [1540:2580] + 21 -> DViCO FusionHDTV DVB-T Plus [18ac:db10] + 22 -> pcHDTV HD3000 HDTV [7063:3000] + 23 -> digitalnow DNTV Live! DVB-T [17de:a8a6] + 24 -> Hauppauge WinTV 28xxx (Roslyn) models [0070:2801] + 25 -> Digital-Logic MICROSPACE Entertainment Center (MEC) [14f1:0342] + 26 -> IODATA GV/BCTV7E [10fc:d035] + 27 -> PixelView PlayTV Ultra Pro (Stereo) + 28 -> DViCO FusionHDTV 3 Gold-T [18ac:d820] + 29 -> ADS Tech Instant TV DVB-T PCI [1421:0334] + 30 -> TerraTec Cinergy 1400 DVB-T [153b:1166] + 31 -> DViCO FusionHDTV 5 Gold [18ac:d500] + 32 -> AverMedia UltraTV Media Center PCI 550 [1461:8011] -- cgit v1.2.2 From 058afaf80932445fb33f957d29758479a65932ce Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:36:49 -0800 Subject: [PATCH] v4l: 690: added support for lifeview flytv platinum mini2 - Added support for LifeView FlyTV Platinum Mini2. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/video4linux/CARDLIST.saa7134 | 1 + drivers/media/video/saa7134/saa7134-cards.c | 33 +++++++++++++++++++++++++++++ drivers/media/video/saa7134/saa7134.h | 1 + 3 files changed, 35 insertions(+) diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134 index 82b5f7c73c83..57439d081570 100644 --- a/Documentation/video4linux/CARDLIST.saa7134 +++ b/Documentation/video4linux/CARDLIST.saa7134 @@ -72,3 +72,4 @@ 71 -> Compro Videomate DVB-T200 [185b:c901] 72 -> RTD Embedded Technologies VFG7350 [1435:7350] 73 -> RTD Embedded Technologies VFG7330 [1435:7330] + 74 -> LifeView FlyTV Platinum Mini2 [14c0:1212] diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index 9600305771bc..a096799dc5f9 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c @@ -2319,6 +2319,33 @@ struct saa7134_board saa7134_boards[] = { .amux = LINE2, }}, }, + [SAA7134_BOARD_FLYTVPLATINUM_MINI2] = { + .name = "LifeView FlyTV Platinum Mini2", + .audio_clock = 0x00200000, + .tuner_type = TUNER_PHILIPS_TDA8290, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + + .inputs = {{ + .name = name_tv, + .vmux = 1, + .amux = TV, + .tv = 1, + },{ + .name = name_comp1, /* Composite signal on S-Video input */ + .vmux = 0, + .amux = LINE2, + },{ + .name = name_comp2, /* Composite input */ + .vmux = 3, + .amux = LINE2, + },{ + .name = name_svideo, + .vmux = 8, + .amux = LINE2, + }}, + }, }; const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards); @@ -2399,6 +2426,12 @@ struct pci_device_id saa7134_pci_tbl[] = { .subvendor = 0x5168, .subdevice = 0x0212, /* minipci, LR212 */ .driver_data = SAA7134_BOARD_FLYTVPLATINUM_MINI, + },{ + .vendor = PCI_VENDOR_ID_PHILIPS, + .device = PCI_DEVICE_ID_PHILIPS_SAA7133, + .subvendor = 0x14c0, + .subdevice = 0x1212, /* minipci, LR1212 */ + .driver_data = SAA7134_BOARD_FLYTVPLATINUM_MINI2, },{ .vendor = PCI_VENDOR_ID_PHILIPS, .device = PCI_DEVICE_ID_PHILIPS_SAA7133, diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index 4169c2a857f1..e907d86da7b5 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h @@ -194,6 +194,7 @@ struct saa7134_format { #define SAA7134_BOARD_VIDEOMATE_DVBT_200 71 #define SAA7134_BOARD_RTD_VFG7350 72 #define SAA7134_BOARD_RTD_VFG7330 73 +#define SAA7134_BOARD_FLYTVPLATINUM_MINI2 74 #define SAA7134_MAXBOARDS 8 #define SAA7134_INPUT_MAX 8 -- cgit v1.2.2 From 70b6934a6c6b5f242a42978f3c5e4f45d476dddb Mon Sep 17 00:00:00 2001 From: "Nickolay V. Shmyrev" Date: Tue, 8 Nov 2005 21:36:50 -0800 Subject: [PATCH] v4l: 691: set if of tda8275 according to tv norm - Set IF of tda8275 according to tv norm. Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/tda8290.c | 21 ++++++++++++++------- include/media/tuner.h | 1 + 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/media/video/tda8290.c b/drivers/media/video/tda8290.c index 61268f8a9eec..1e2acc4abbe6 100644 --- a/drivers/media/video/tda8290.c +++ b/drivers/media/video/tda8290.c @@ -181,18 +181,25 @@ static void set_audio(struct tuner *t) { t->i2c_easy_mode[0] = 0x01; - if (t->std & V4L2_STD_MN) + if (t->std & V4L2_STD_MN) { + t->sgIF = 736; t->i2c_easy_mode[1] = 0x01; - else if (t->std & V4L2_STD_B) + } else if (t->std & V4L2_STD_B) { + t->sgIF = 864; t->i2c_easy_mode[1] = 0x02; - else if (t->std & V4L2_STD_GH) + } else if (t->std & V4L2_STD_GH) { + t->sgIF = 992; t->i2c_easy_mode[1] = 0x04; - else if (t->std & V4L2_STD_PAL_I) + } else if (t->std & V4L2_STD_PAL_I) { + t->sgIF = 992; t->i2c_easy_mode[1] = 0x08; - else if (t->std & V4L2_STD_DK) + } else if (t->std & V4L2_STD_DK) { + t->sgIF = 992; t->i2c_easy_mode[1] = 0x10; - else if (t->std & V4L2_STD_SECAM_L) + } else if (t->std & V4L2_STD_SECAM_L) { + t->sgIF = 992; t->i2c_easy_mode[1] = 0x20; + } } static void set_tv_freq(struct i2c_client *c, unsigned int freq) @@ -200,7 +207,7 @@ static void set_tv_freq(struct i2c_client *c, unsigned int freq) struct tuner *t = i2c_get_clientdata(c); set_audio(t); - set_frequency(t, 864, freq); + set_frequency(t, t->sgIF, freq); tda8290_tune(c); } diff --git a/include/media/tuner.h b/include/media/tuner.h index bf925702fbbf..97e16bddf651 100644 --- a/include/media/tuner.h +++ b/include/media/tuner.h @@ -191,6 +191,7 @@ struct tuner { /* used by tda8290 */ unsigned char i2c_easy_mode[2]; unsigned char i2c_set_freq[8]; + unsigned int sgIF; /* function ptrs */ void (*tv_freq)(struct i2c_client *c, unsigned int freq); -- cgit v1.2.2 From 2bfa1ac6ce854a7f895d5c9d6c273ef770fad9ae Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:36:51 -0800 Subject: [PATCH] v4l: 692: bttv coding style and card ids - BTTV Boards now use the same CodingStyle as cx88 and saa7134. - Included missing card numbers Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/bttv-cards.c | 4433 ++++++++++++++++++++------------------ 1 file changed, 2296 insertions(+), 2137 deletions(-) diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bttv-cards.c index c6010692746d..12f38e8cd0a4 100644 --- a/drivers/media/video/bttv-cards.c +++ b/drivers/media/video/bttv-cards.c @@ -309,2143 +309,2303 @@ static struct CARD { /* array with description for bt848 / bt878 tv/grabber cards */ struct tvcard bttv_tvcards[] = { -{ -/* ---- card 0x00 ---------------------------------- */ - .name = " *** UNKNOWN/GENERIC *** ", - .video_inputs = 4, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .muxsel = { 2, 3, 1, 0}, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, -},{ - .name = "MIRO PCTV", - .video_inputs = 4, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 15, - .muxsel = { 2, 3, 1, 1}, - .audiomux = { 2, 0, 0, 0, 10}, - .needs_tvaudio = 1, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, -},{ - .name = "Hauppauge (bt848)", - .video_inputs = 4, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 7, - .muxsel = { 2, 3, 1, 1}, - .audiomux = { 0, 1, 2, 3, 4}, - .needs_tvaudio = 1, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, -},{ - .name = "STB, Gateway P/N 6000699 (bt848)", - .video_inputs = 3, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 7, - .muxsel = { 2, 3, 1, 1}, - .audiomux = { 4, 0, 2, 3, 1}, - .no_msp34xx = 1, - .needs_tvaudio = 1, - .tuner_type = TUNER_PHILIPS_NTSC, - .tuner_addr = ADDR_UNSET, - .pll = PLL_28, - .has_radio = 1, -},{ - -/* ---- card 0x04 ---------------------------------- */ - .name = "Intel Create and Share PCI/ Smart Video Recorder III", - .video_inputs = 4, - .audio_inputs = 0, - .tuner = -1, - .svhs = 2, - .gpiomask = 0, - .muxsel = { 2, 3, 1, 1}, - .audiomux = { 0 }, - .needs_tvaudio = 0, - .tuner_type = 4, - .tuner_addr = ADDR_UNSET, -},{ - .name = "Diamond DTV2000", - .video_inputs = 4, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 3, - .muxsel = { 2, 3, 1, 0}, - .audiomux = { 0, 1, 0, 1, 3}, - .needs_tvaudio = 1, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, -},{ - .name = "AVerMedia TVPhone", - .video_inputs = 3, - .audio_inputs = 1, - .tuner = 0, - .svhs = 3, - .muxsel = { 2, 3, 1, 1}, - .gpiomask = 0x0f, - .audiomux = { 0x0c, 0x04, 0x08, 0x04, 0}, - /* 0x04 for some cards ?? */ - .needs_tvaudio = 1, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, - .audio_hook = avermedia_tvphone_audio, - .has_remote = 1, -},{ - .name = "MATRIX-Vision MV-Delta", - .video_inputs = 5, - .audio_inputs = 1, - .tuner = -1, - .svhs = 3, - .gpiomask = 0, - .muxsel = { 2, 3, 1, 0, 0}, - .audiomux = {0 }, - .needs_tvaudio = 1, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, -},{ - -/* ---- card 0x08 ---------------------------------- */ - .name = "Lifeview FlyVideo II (Bt848) LR26 / MAXI TV Video PCI2 LR26", - .video_inputs = 4, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 0xc00, - .muxsel = { 2, 3, 1, 1}, - .audiomux = { 0, 0xc00, 0x800, 0x400, 0xc00, 0}, - .needs_tvaudio = 1, - .pll = PLL_28, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, -},{ - .name = "IMS/IXmicro TurboTV", - .video_inputs = 3, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 3, - .muxsel = { 2, 3, 1, 1}, - .audiomux = { 1, 1, 2, 3, 0}, - .needs_tvaudio = 0, - .pll = PLL_28, - .tuner_type = TUNER_TEMIC_PAL, - .tuner_addr = ADDR_UNSET, -},{ - .name = "Hauppauge (bt878)", - .video_inputs = 4, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 0x0f, /* old: 7 */ - .muxsel = { 2, 0, 1, 1}, - .audiomux = { 0, 1, 2, 3, 4}, - .needs_tvaudio = 1, - .pll = PLL_28, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, -},{ - .name = "MIRO PCTV pro", - .video_inputs = 3, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 0x3014f, - .muxsel = { 2, 3, 1, 1}, - .audiomux = { 0x20001,0x10001, 0, 0,10}, - .needs_tvaudio = 1, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, -},{ - -/* ---- card 0x0c ---------------------------------- */ - .name = "ADS Technologies Channel Surfer TV (bt848)", - .video_inputs = 3, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 15, - .muxsel = { 2, 3, 1, 1}, - .audiomux = { 13, 14, 11, 7, 0, 0}, - .needs_tvaudio = 1, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, -},{ - .name = "AVerMedia TVCapture 98", - .video_inputs = 3, - .audio_inputs = 4, - .tuner = 0, - .svhs = 2, - .gpiomask = 15, - .muxsel = { 2, 3, 1, 1}, - .audiomux = { 13, 14, 11, 7, 0, 0}, - .needs_tvaudio = 1, - .msp34xx_alt = 1, - .pll = PLL_28, - .tuner_type = TUNER_PHILIPS_PAL, - .tuner_addr = ADDR_UNSET, - .audio_hook = avermedia_tv_stereo_audio, -},{ - .name = "Aimslab Video Highway Xtreme (VHX)", - .video_inputs = 3, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 7, - .muxsel = { 2, 3, 1, 1}, - .audiomux = { 0, 2, 1, 3, 4}, /* old: { 0, 1, 2, 3, 4} */ - .needs_tvaudio = 1, - .pll = PLL_28, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, -},{ - .name = "Zoltrix TV-Max", - .video_inputs = 3, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 15, - .muxsel = { 2, 3, 1, 1}, - .audiomux = {0 , 0, 1 , 0, 10}, - .needs_tvaudio = 1, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, -},{ - -/* ---- card 0x10 ---------------------------------- */ - .name = "Prolink Pixelview PlayTV (bt878)", - .video_inputs = 3, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 0x01fe00, - .muxsel = { 2, 3, 1, 1}, - /* 2003-10-20 by "Anton A. Arapov" */ - .audiomux = { 0x001e00, 0, 0x018000, 0x014000, 0x002000, 0 }, - .needs_tvaudio = 1, - .pll = PLL_28, - .tuner_type = -1, -},{ - .name = "Leadtek WinView 601", - .video_inputs = 3, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 0x8300f8, - .muxsel = { 2, 3, 1, 1,0}, - .audiomux = { 0x4fa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007}, - .needs_tvaudio = 1, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, - .audio_hook = winview_audio, - .has_radio = 1, -},{ - .name = "AVEC Intercapture", - .video_inputs = 3, - .audio_inputs = 2, - .tuner = 0, - .svhs = 2, - .gpiomask = 0, - .muxsel = {2, 3, 1, 1}, - .audiomux = {1, 0, 0, 0, 0}, - .needs_tvaudio = 1, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, -},{ - .name = "Lifeview FlyVideo II EZ /FlyKit LR38 Bt848 (capture only)", - .video_inputs = 4, - .audio_inputs = 1, - .tuner = -1, - .svhs = -1, - .gpiomask = 0x8dff00, - .muxsel = { 2, 3, 1, 1}, - .audiomux = { 0 }, - .no_msp34xx = 1, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, -},{ - -/* ---- card 0x14 ---------------------------------- */ - .name = "CEI Raffles Card", - .video_inputs = 3, - .audio_inputs = 3, - .tuner = 0, - .svhs = 2, - .muxsel = {2, 3, 1, 1}, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, -},{ - .name = "Lifeview FlyVideo 98/ Lucky Star Image World ConferenceTV LR50", - .video_inputs = 4, - .audio_inputs = 2, /* tuner, line in */ - .tuner = 0, - .svhs = 2, - .gpiomask = 0x1800, - .muxsel = { 2, 3, 1, 1}, - .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800}, - .pll = PLL_28, - .tuner_type = TUNER_PHILIPS_PAL_I, - .tuner_addr = ADDR_UNSET, -},{ - .name = "Askey CPH050/ Phoebe Tv Master + FM", - .video_inputs = 3, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 0xc00, - .muxsel = { 2, 3, 1, 1}, - .audiomux = {0, 1, 0x800, 0x400, 0xc00, 0}, - .needs_tvaudio = 1, - .pll = PLL_28, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, -},{ - .name = "Modular Technology MM201/MM202/MM205/MM210/MM215 PCTV, bt878", - .video_inputs = 3, - .audio_inputs = 1, - .tuner = 0, - .svhs = -1, - .gpiomask = 7, - .muxsel = { 2, 3, -1 }, - .digital_mode = DIGITAL_MODE_CAMERA, - .audiomux = { 0, 0, 0, 0, 0 }, - .no_msp34xx = 1, - .pll = PLL_28, - .tuner_type = TUNER_ALPS_TSBB5_PAL_I, - .tuner_addr = ADDR_UNSET, -},{ - -/* ---- card 0x18 ---------------------------------- */ - .name = "Askey CPH05X/06X (bt878) [many vendors]", - .video_inputs = 3, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 0xe00, - .muxsel = { 2, 3, 1, 1}, - .audiomux = {0x400, 0x400, 0x400, 0x400, 0xc00}, - .needs_tvaudio = 1, - .pll = PLL_28, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, - .has_remote = 1, -},{ - .name = "Terratec TerraTV+ Version 1.0 (Bt848)/ Terra TValue Version 1.0/ Vobis TV-Boostar", - .video_inputs = 3, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 0x1f0fff, - .muxsel = { 2, 3, 1, 1}, - .audiomux = { 0x20000, 0x30000, 0x10000, 0, 0x40000}, - .needs_tvaudio = 0, - .tuner_type = TUNER_PHILIPS_PAL, - .tuner_addr = ADDR_UNSET, - .audio_hook = terratv_audio, -},{ - .name = "Hauppauge WinCam newer (bt878)", - .video_inputs = 4, - .audio_inputs = 1, - .tuner = 0, - .svhs = 3, - .gpiomask = 7, - .muxsel = { 2, 0, 1, 1}, - .audiomux = { 0, 1, 2, 3, 4}, - .needs_tvaudio = 1, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, -},{ - .name = "Lifeview FlyVideo 98/ MAXI TV Video PCI2 LR50", - .video_inputs = 4, - .audio_inputs = 2, - .tuner = 0, - .svhs = 2, - .gpiomask = 0x1800, - .muxsel = { 2, 3, 1, 1}, - .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800}, - .pll = PLL_28, - .tuner_type = TUNER_PHILIPS_SECAM, - .tuner_addr = ADDR_UNSET, -},{ - -/* ---- card 0x1c ---------------------------------- */ - .name = "Terratec TerraTV+ Version 1.1 (bt878)", - .video_inputs = 3, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 0x1f0fff, - .muxsel = { 2, 3, 1, 1}, - .audiomux = { 0x20000, 0x30000, 0x10000, 0x00000, 0x40000}, - .needs_tvaudio = 0, - .tuner_type = TUNER_PHILIPS_PAL, - .tuner_addr = ADDR_UNSET, - .audio_hook = terratv_audio, - /* GPIO wiring: - External 20 pin connector (for Active Radio Upgrade board) - gpio00: i2c-sda - gpio01: i2c-scl - gpio02: om5610-data - gpio03: om5610-clk - gpio04: om5610-wre - gpio05: om5610-stereo - gpio06: rds6588-davn - gpio07: Pin 7 n.c. - gpio08: nIOW - gpio09+10: nIOR, nSEL ?? (bt878) - gpio09: nIOR (bt848) - gpio10: nSEL (bt848) - Sound Routing: - gpio16: u2-A0 (1st 4052bt) - gpio17: u2-A1 - gpio18: u2-nEN - gpio19: u4-A0 (2nd 4052) - gpio20: u4-A1 - u4-nEN - GND - Btspy: - 00000 : Cdrom (internal audio input) - 10000 : ext. Video audio input - 20000 : TV Mono - a0000 : TV Mono/2 - 1a0000 : TV Stereo - 30000 : Radio - 40000 : Mute -*/ - -},{ - /* Jannik Fritsch */ - .name = "Imagenation PXC200", - .video_inputs = 5, - .audio_inputs = 1, - .tuner = -1, - .svhs = 1, /* was: 4 */ - .gpiomask = 0, - .muxsel = { 2, 3, 1, 0, 0}, - .audiomux = { 0 }, - .needs_tvaudio = 1, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, - .muxsel_hook = PXC200_muxsel, - -},{ - .name = "Lifeview FlyVideo 98 LR50", - .video_inputs = 4, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 0x1800, /* 0x8dfe00 */ - .muxsel = { 2, 3, 1, 1}, - .audiomux = { 0, 0x0800, 0x1000, 0x1000, 0x1800, 0 }, - .pll = PLL_28, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, -},{ - .name = "Formac iProTV, Formac ProTV I (bt848)", - .video_inputs = 4, - .audio_inputs = 1, - .tuner = 0, - .svhs = 3, - .gpiomask = 1, - .muxsel = { 2, 3, 1, 1}, - .audiomux = { 1, 0, 0, 0, 0 }, - .pll = PLL_28, - .tuner_type = TUNER_PHILIPS_PAL, - .tuner_addr = ADDR_UNSET, -},{ - -/* ---- card 0x20 ---------------------------------- */ - .name = "Intel Create and Share PCI/ Smart Video Recorder III", - .video_inputs = 4, - .audio_inputs = 0, - .tuner = -1, - .svhs = 2, - .gpiomask = 0, - .muxsel = { 2, 3, 1, 1}, - .audiomux = { 0 }, - .needs_tvaudio = 0, - .tuner_type = 4, - .tuner_addr = ADDR_UNSET, -},{ - .name = "Terratec TerraTValue Version Bt878", - .video_inputs = 3, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 0xffff00, - .muxsel = { 2, 3, 1, 1}, - .audiomux = { 0x500, 0, 0x300, 0x900, 0x900}, - .needs_tvaudio = 1, - .pll = PLL_28, - .tuner_type = TUNER_PHILIPS_PAL, - .tuner_addr = ADDR_UNSET, -},{ - .name = "Leadtek WinFast 2000/ WinFast 2000 XP", - .video_inputs = 4, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .muxsel = { 2, 3, 1, 1, 0}, /* TV, CVid, SVid, CVid over SVid connector */ - /* Alexander Varakin [stereo version] */ - .gpiomask = 0xb33000, - .audiomux = { 0x122000,0x1000,0x0000,0x620000,0x800000 }, - /* Audio Routing for "WinFast 2000 XP" (no tv stereo !) - gpio23 -- hef4052:nEnable (0x800000) - gpio12 -- hef4052:A1 - gpio13 -- hef4052:A0 - 0x0000: external audio - 0x1000: FM - 0x2000: TV - 0x3000: n.c. - Note: There exists another variant "Winfast 2000" with tv stereo !? - Note: eeprom only contains FF and pci subsystem id 107d:6606 - */ - .needs_tvaudio = 0, - .pll = PLL_28, - .has_radio = 1, - .tuner_type = 5, /* default for now, gpio reads BFFF06 for Pal bg+dk */ - .tuner_addr = ADDR_UNSET, - .audio_hook = winfast2000_audio, - .has_remote = 1, -},{ - .name = "Lifeview FlyVideo 98 LR50 / Chronos Video Shuttle II", - .video_inputs = 4, - .audio_inputs = 3, - .tuner = 0, - .svhs = 2, - .gpiomask = 0x1800, - .muxsel = { 2, 3, 1, 1}, - .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800}, - .pll = PLL_28, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, -},{ - -/* ---- card 0x24 ---------------------------------- */ - .name = "Lifeview FlyVideo 98FM LR50 / Typhoon TView TV/FM Tuner", - .video_inputs = 4, - .audio_inputs = 3, - .tuner = 0, - .svhs = 2, - .gpiomask = 0x1800, - .muxsel = { 2, 3, 1, 1}, - .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800, 0 }, - .pll = PLL_28, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, - .has_radio = 1, -},{ - .name = "Prolink PixelView PlayTV pro", - .video_inputs = 3, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 0xff, - .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 0x21, 0x20, 0x24, 0x2c, 0x29, 0x29 }, - .no_msp34xx = 1, - .pll = PLL_28, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, -},{ - .name = "Askey CPH06X TView99", - .video_inputs = 4, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 0x551e00, - .muxsel = { 2, 3, 1, 0}, - .audiomux = { 0x551400, 0x551200, 0, 0, 0x551c00, 0x551200 }, - .needs_tvaudio = 1, - .pll = PLL_28, - .tuner_type = 1, - .tuner_addr = ADDR_UNSET, - .has_remote = 1, -},{ - .name = "Pinnacle PCTV Studio/Rave", - .video_inputs = 3, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 0x03000F, - .muxsel = { 2, 3, 1, 1}, - .audiomux = { 2, 0xd0001, 0, 0, 1}, - .needs_tvaudio = 0, - .pll = PLL_28, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, -},{ - -/* ---- card 0x28 ---------------------------------- */ - .name = "STB TV PCI FM, Gateway P/N 6000704 (bt878), 3Dfx VoodooTV 100", - .video_inputs = 3, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 7, - .muxsel = { 2, 3, 1, 1}, - .audiomux = { 4, 0, 2, 3, 1}, - .no_msp34xx = 1, - .needs_tvaudio = 1, - .tuner_type = TUNER_PHILIPS_NTSC, - .tuner_addr = ADDR_UNSET, - .pll = PLL_28, - .has_radio = 1, -},{ - .name = "AVerMedia TVPhone 98", - .video_inputs = 3, - .audio_inputs = 4, - .tuner = 0, - .svhs = 2, - .gpiomask = 15, - .muxsel = { 2, 3, 1, 1}, - .audiomux = { 13, 4, 11, 7, 0, 0}, - .needs_tvaudio = 1, - .pll = PLL_28, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, - .has_radio = 1, - .audio_hook = avermedia_tvphone_audio, -},{ - .name = "ProVideo PV951", /* pic16c54 */ - .video_inputs = 3, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 0, - .muxsel = { 2, 3, 1, 1}, - .audiomux = { 0, 0, 0, 0, 0}, - .needs_tvaudio = 1, - .no_msp34xx = 1, - .pll = PLL_28, - .tuner_type = 1, - .tuner_addr = ADDR_UNSET, -},{ - .name = "Little OnAir TV", - .video_inputs = 3, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 0xe00b, - .muxsel = {2, 3, 1, 1}, - .audiomux = {0xff9ff6, 0xff9ff6, 0xff1ff7, 0, 0xff3ffc}, - .no_msp34xx = 1, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, -},{ - -/* ---- card 0x2c ---------------------------------- */ - .name = "Sigma TVII-FM", - .video_inputs = 2, - .audio_inputs = 1, - .tuner = 0, - .svhs = -1, - .gpiomask = 3, - .muxsel = {2, 3, 1, 1}, - .audiomux = {1, 1, 0, 2, 3}, - .no_msp34xx = 1, - .pll = PLL_NONE, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, -},{ - .name = "MATRIX-Vision MV-Delta 2", - .video_inputs = 5, - .audio_inputs = 1, - .tuner = -1, - .svhs = 3, - .gpiomask = 0, - .muxsel = { 2, 3, 1, 0, 0}, - .audiomux = {0 }, - .no_msp34xx = 1, - .pll = PLL_28, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, -},{ - .name = "Zoltrix Genie TV/FM", - .video_inputs = 3, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 0xbcf03f, - .muxsel = { 2, 3, 1, 1}, - .audiomux = { 0xbc803f, 0xbc903f, 0xbcb03f, 0, 0xbcb03f}, - .no_msp34xx = 1, - .pll = PLL_28, - .tuner_type = 21, - .tuner_addr = ADDR_UNSET, -},{ - .name = "Terratec TV/Radio+", - .video_inputs = 3, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 0x70000, - .muxsel = { 2, 3, 1, 1}, - .audiomux = { 0x20000, 0x30000, 0x10000, 0, 0x40000, 0x20000 }, - .needs_tvaudio = 1, - .no_msp34xx = 1, - .pll = PLL_35, - .tuner_type = 1, - .tuner_addr = ADDR_UNSET, - .has_radio = 1, -},{ - -/* ---- card 0x30 ---------------------------------- */ - .name = "Askey CPH03x/ Dynalink Magic TView", - .video_inputs = 3, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 15, - .muxsel = { 2, 3, 1, 1}, - .audiomux = {2,0,0,0,1}, - .needs_tvaudio = 1, - .pll = PLL_28, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, -},{ - .name = "IODATA GV-BCTV3/PCI", - .video_inputs = 3, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 0x010f00, - .muxsel = {2, 3, 0, 0}, - .audiomux = {0x10000, 0, 0x10000, 0, 0, 0}, - .no_msp34xx = 1, - .pll = PLL_28, - .tuner_type = TUNER_ALPS_TSHC6_NTSC, - .tuner_addr = ADDR_UNSET, - .audio_hook = gvbctv3pci_audio, -},{ - .name = "Prolink PV-BT878P+4E / PixelView PlayTV PAK / Lenco MXTV-9578 CP", - .video_inputs = 5, - .audio_inputs = 1, - .tuner = 0, - .svhs = 3, - .gpiomask = 0xAA0000, - .muxsel = { 2,3,1,1,-1 }, - .digital_mode = DIGITAL_MODE_CAMERA, - .audiomux = { 0x20000, 0, 0x80000, 0x80000, 0xa8000, 0x46000 }, - .no_msp34xx = 1, - .pll = PLL_28, - .tuner_type = TUNER_PHILIPS_PAL_I, - .tuner_addr = ADDR_UNSET, - .has_remote = 1, - /* GPIO wiring: (different from Rev.4C !) - GPIO17: U4.A0 (first hef4052bt) - GPIO19: U4.A1 - GPIO20: U5.A1 (second hef4052bt) - GPIO21: U4.nEN - GPIO22: BT832 Reset Line - GPIO23: A5,A0, U5,nEN - Note: At i2c=0x8a is a Bt832 chip, which changes to 0x88 after being reset via GPIO22 - */ -},{ - .name = "Eagle Wireless Capricorn2 (bt878A)", - .video_inputs = 4, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 7, - .muxsel = { 2, 0, 1, 1}, - .audiomux = { 0, 1, 2, 3, 4}, - .pll = PLL_28, - .tuner_type = -1 /* TUNER_ALPS_TMDH2_NTSC */, - .tuner_addr = ADDR_UNSET, -},{ - -/* ---- card 0x34 ---------------------------------- */ - /* David Härdeman */ - .name = "Pinnacle PCTV Studio Pro", - .video_inputs = 4, - .audio_inputs = 1, - .tuner = 0, - .svhs = 3, - .gpiomask = 0x03000F, - .muxsel = { 2, 3, 1, 1}, - .audiomux = { 1, 0xd0001, 0, 0, 10}, - /* sound path (5 sources): - MUX1 (mask 0x03), Enable Pin 0x08 (0=enable, 1=disable) - 0= ext. Audio IN - 1= from MUX2 - 2= Mono TV sound from Tuner - 3= not connected - MUX2 (mask 0x30000): - 0,2,3= from MSP34xx - 1= FM stereo Radio from Tuner */ - .needs_tvaudio = 0, - .pll = PLL_28, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, -},{ - /* Claas Langbehn , - Sven Grothklags */ - .name = "Typhoon TView RDS + FM Stereo / KNC1 TV Station RDS", - .video_inputs = 4, - .audio_inputs = 3, - .tuner = 0, - .svhs = 2, - .gpiomask = 0x1c, - .muxsel = { 2, 3, 1, 1}, - .audiomux = { 0, 0, 0x10, 8, 4 }, - .needs_tvaudio = 1, - .pll = PLL_28, - .tuner_type = TUNER_PHILIPS_PAL, - .tuner_addr = ADDR_UNSET, - .has_radio = 1, -},{ - /* Tim Röstermundt - in de.comp.os.unix.linux.hardware: - options bttv card=0 pll=1 radio=1 gpiomask=0x18e0 - audiomux=0x44c71f,0x44d71f,0,0x44d71f,0x44dfff - options tuner type=5 */ - .name = "Lifeview FlyVideo 2000 /FlyVideo A2/ Lifetec LT 9415 TV [LR90]", - .video_inputs = 4, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 0x18e0, - .muxsel = { 2, 3, 1, 1}, - .audiomux = { 0x0000,0x0800,0x1000,0x1000,0x18e0 }, - /* For cards with tda9820/tda9821: - 0x0000: Tuner normal stereo - 0x0080: Tuner A2 SAP (second audio program = Zweikanalton) - 0x0880: Tuner A2 stereo */ - .pll = PLL_28, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, -},{ - /* Miguel Angel Alvarez - old Easy TV BT848 version (model CPH031) */ - .name = "Askey CPH031/ BESTBUY Easy TV", - .video_inputs = 4, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 0xF, - .muxsel = { 2, 3, 1, 0}, - .audiomux = { 2, 0, 0, 0, 10}, - .needs_tvaudio = 0, - .pll = PLL_28, - .tuner_type = TUNER_TEMIC_PAL, - .tuner_addr = ADDR_UNSET, -},{ - -/* ---- card 0x38 ---------------------------------- */ - /* Gordon Heydon */ - .name = "GrandTec 'Grand Video Capture' (Bt848)", - .video_inputs = 2, - .audio_inputs = 0, - .tuner = -1, - .svhs = 1, - .gpiomask = 0, - .muxsel = { 3, 1 }, - .audiomux = { 0 }, - .needs_tvaudio = 0, - .no_msp34xx = 1, - .pll = PLL_35, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, -},{ - /* Daniel Herrington */ - .name = "Askey CPH060/ Phoebe TV Master Only (No FM)", - .video_inputs = 3, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 0xe00, - .muxsel = { 2, 3, 1, 1}, - .audiomux = { 0x400, 0x400, 0x400, 0x400, 0x800, 0x400 }, - .needs_tvaudio = 1, - .pll = PLL_28, - .tuner_type = TUNER_TEMIC_4036FY5_NTSC, - .tuner_addr = ADDR_UNSET, -},{ - /* Matti Mottus */ - .name = "Askey CPH03x TV Capturer", - .video_inputs = 4, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 0x03000F, - .muxsel = { 2, 3, 1, 0}, - .audiomux = { 2,0,0,0,1 }, - .pll = PLL_28, - .tuner_type = 0, - .tuner_addr = ADDR_UNSET, -},{ - -/* ---- card 0x3c ---------------------------------- */ - /* Philip Blundell */ - .name = "Modular Technology MM100PCTV", - .video_inputs = 2, - .audio_inputs = 2, - .tuner = 0, - .svhs = -1, - .gpiomask = 11, - .muxsel = { 2, 3, 1, 1}, - .audiomux = { 2, 0, 0, 1, 8}, - .pll = PLL_35, - .tuner_type = TUNER_TEMIC_PAL, - .tuner_addr = ADDR_UNSET, -},{ - /* Adrian Cox - new Easy TV BT878 version (model CPH061) - special thanks to Informatica Mieres for providing the card */ - .name = "Askey CPH061/ BESTBUY Easy TV (bt878)", - .video_inputs = 3, - .audio_inputs = 2, - .tuner = 0, - .svhs = 2, - .gpiomask = 0xFF, - .muxsel = { 2, 3, 1, 0}, - .audiomux = { 1, 0, 4, 4, 9}, - .needs_tvaudio = 0, - .pll = PLL_28, - .tuner_type = TUNER_PHILIPS_PAL, - .tuner_addr = ADDR_UNSET, -},{ - /* Lukas Gebauer */ - .name = "ATI TV-Wonder", - .video_inputs = 3, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 0xf03f, - .muxsel = { 2, 3, 1, 0 }, - .audiomux = { 0xbffe, 0, 0xbfff, 0, 0xbffe}, - .pll = PLL_28, - .tuner_type = TUNER_TEMIC_4006FN5_MULTI_PAL, - .tuner_addr = ADDR_UNSET, -},{ - -/* ---- card 0x40 ---------------------------------- */ - /* Lukas Gebauer */ - .name = "ATI TV-Wonder VE", - .video_inputs = 2, - .audio_inputs = 1, - .tuner = 0, - .svhs = -1, - .gpiomask = 1, - .muxsel = { 2, 3, 0, 1}, - .audiomux = { 0, 0, 1, 0, 0}, - .no_msp34xx = 1, - .pll = PLL_28, - .tuner_type = TUNER_TEMIC_4006FN5_MULTI_PAL, - .tuner_addr = ADDR_UNSET, -},{ - /* DeeJay */ - .name = "IODATA GV-BCTV4/PCI", - .video_inputs = 3, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 0x010f00, - .muxsel = {2, 3, 0, 0}, - .audiomux = {0x10000, 0, 0x10000, 0, 0, 0}, - .no_msp34xx = 1, - .pll = PLL_28, - .tuner_type = TUNER_SHARP_2U5JF5540_NTSC, - .tuner_addr = ADDR_UNSET, - .audio_hook = gvbctv3pci_audio, -},{ - -/* ---- card 0x44 ---------------------------------- */ - .name = "3Dfx VoodooTV FM (Euro), VoodooTV 200 (USA)", - /* try "insmod msp3400 simple=0" if you have - * sound problems with this card. */ - .video_inputs = 4, - .audio_inputs = 1, - .tuner = 0, - .svhs = -1, - .gpiomask = 0x4f8a00, - /* 0x100000: 1=MSP enabled (0=disable again) - * 0x010000: Connected to "S0" on tda9880 (0=Pal/BG, 1=NTSC) */ - .audiomux = {0x947fff, 0x987fff,0x947fff,0x947fff, 0x947fff}, - /* tvtuner, radio, external,internal, mute, stereo - * tuner, Composit, SVid, Composit-on-Svid-adapter */ - .muxsel = { 2, 3 ,0 ,1}, - .tuner_type = TUNER_MT2032, - .tuner_addr = ADDR_UNSET, - .pll = PLL_28, - .has_radio = 1, -},{ - /* Philip Blundell */ - .name = "Active Imaging AIMMS", - .video_inputs = 1, - .audio_inputs = 0, - .tuner = -1, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, - .pll = PLL_28, - .muxsel = { 2 }, - .gpiomask = 0 -},{ - /* Tomasz Pyra */ - .name = "Prolink Pixelview PV-BT878P+ (Rev.4C,8E)", - .video_inputs = 3, - .audio_inputs = 4, - .tuner = 0, - .svhs = 2, - .gpiomask = 15, - .muxsel = { 2, 3, 1, 1}, - .audiomux = { 0, 0, 11, 7, 13, 0}, /* TV and Radio with same GPIO ! */ - .needs_tvaudio = 1, - .pll = PLL_28, - .tuner_type = 25, - .tuner_addr = ADDR_UNSET, - .has_remote = 1, - /* GPIO wiring: - GPIO0: U4.A0 (hef4052bt) - GPIO1: U4.A1 - GPIO2: U4.A1 (second hef4052bt) - GPIO3: U4.nEN, U5.A0, A5.nEN - GPIO8-15: vrd866b ? - */ -},{ - .name = "Lifeview FlyVideo 98EZ (capture only) LR51", - .video_inputs = 4, - .audio_inputs = 0, - .tuner = -1, - .svhs = 2, - .muxsel = { 2, 3, 1, 1}, /* AV1, AV2, SVHS, CVid adapter on SVHS */ - .pll = PLL_28, - .no_msp34xx = 1, - .tuner_type = UNSET, - .tuner_addr = ADDR_UNSET, -},{ - -/* ---- card 0x48 ---------------------------------- */ - /* Dariusz Kowalewski */ - .name = "Prolink Pixelview PV-BT878P+9B (PlayTV Pro rev.9B FM+NICAM)", - .video_inputs = 4, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 0x3f, - .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 0x01, 0x00, 0x03, 0x03, 0x09, 0x02 }, - .needs_tvaudio = 1, - .no_msp34xx = 1, - .no_tda9875 = 1, - .pll = PLL_28, - .tuner_type = 5, - .tuner_addr = ADDR_UNSET, - .audio_hook = pvbt878p9b_audio, /* Note: not all cards have stereo */ - .has_radio = 1, /* Note: not all cards have radio */ - .has_remote = 1, - /* GPIO wiring: - GPIO0: A0 hef4052 - GPIO1: A1 hef4052 - GPIO3: nEN hef4052 - GPIO8-15: vrd866b - GPIO20,22,23: R30,R29,R28 - */ -},{ - /* Clay Kunz */ - /* you must jumper JP5 for the card to work */ - .name = "Sensoray 311", - .video_inputs = 5, - .audio_inputs = 0, - .tuner = -1, - .svhs = 4, - .gpiomask = 0, - .muxsel = { 2, 3, 1, 0, 0}, - .audiomux = { 0 }, - .needs_tvaudio = 0, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, -},{ - /* Miguel Freitas */ - .name = "RemoteVision MX (RV605)", - .video_inputs = 16, - .audio_inputs = 0, - .tuner = -1, - .svhs = -1, - .gpiomask = 0x00, - .gpiomask2 = 0x07ff, - .muxsel = { 0x33, 0x13, 0x23, 0x43, 0xf3, 0x73, 0xe3, 0x03, - 0xd3, 0xb3, 0xc3, 0x63, 0x93, 0x53, 0x83, 0xa3 }, - .no_msp34xx = 1, - .no_tda9875 = 1, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, - .muxsel_hook = rv605_muxsel, -},{ - .name = "Powercolor MTV878/ MTV878R/ MTV878F", - .video_inputs = 3, - .audio_inputs = 2, - .tuner = 0, - .svhs = 2, - .gpiomask = 0x1C800F, /* Bit0-2: Audio select, 8-12:remote control 14:remote valid 15:remote reset */ - .muxsel = { 2, 1, 1, }, - .audiomux = { 0, 1, 2, 2, 4 }, - .needs_tvaudio = 0, - .tuner_type = TUNER_PHILIPS_PAL, - .tuner_addr = ADDR_UNSET, - .pll = PLL_28, - .has_radio = 1, -},{ - -/* ---- card 0x4c ---------------------------------- */ - /* Masaki Suzuki */ - .name = "Canopus WinDVR PCI (COMPAQ Presario 3524JP, 5112JP)", - .video_inputs = 3, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 0x140007, - .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 0, 1, 2, 3, 4, 0 }, - .tuner_type = TUNER_PHILIPS_NTSC, - .tuner_addr = ADDR_UNSET, - .audio_hook = windvr_audio, -},{ - .name = "GrandTec Multi Capture Card (Bt878)", - .video_inputs = 4, - .audio_inputs = 0, - .tuner = -1, - .svhs = -1, - .gpiomask = 0, - .muxsel = { 2, 3, 1, 0 }, - .audiomux = { 0 }, - .needs_tvaudio = 0, - .no_msp34xx = 1, - .pll = PLL_28, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, -},{ - .name = "Jetway TV/Capture JW-TV878-FBK, Kworld KW-TV878RF", - .video_inputs = 4, - .audio_inputs = 3, - .tuner = 0, - .svhs = 2, - .gpiomask = 7, - .muxsel = { 2, 3, 1, 1 }, /* Tuner, SVid, SVHS, SVid to SVHS connector */ - .audiomux = { 0 ,0 ,4, 4,4,4},/* Yes, this tuner uses the same audio output for TV and FM radio! - * This card lacks external Audio In, so we mute it on Ext. & Int. - * The PCB can take a sbx1637/sbx1673, wiring unknown. - * This card lacks PCI subsystem ID, sigh. - * audiomux=1: lower volume, 2+3: mute - * btwincap uses 0x80000/0x80003 - */ - .needs_tvaudio = 0, - .no_msp34xx = 1, - .pll = PLL_28, - .tuner_type = 5, - .tuner_addr = ADDR_UNSET, - /* Samsung TCPA9095PC27A (BG+DK), philips compatible, w/FM, stereo and - radio signal strength indicators work fine. */ - .has_radio = 1, - /* GPIO Info: - GPIO0,1: HEF4052 A0,A1 - GPIO2: HEF4052 nENABLE - GPIO3-7: n.c. - GPIO8-13: IRDC357 data0-5 (data6 n.c. ?) [chip not present on my card] - GPIO14,15: ?? - GPIO16-21: n.c. - GPIO22,23: ?? - ?? : mtu8b56ep microcontroller for IR (GPIO wiring unknown)*/ -},{ - /* Arthur Tetzlaff-Deas, DSP Design Ltd */ - .name = "DSP Design TCVIDEO", - .video_inputs = 4, - .svhs = -1, - .muxsel = { 2, 3, 1, 0}, - .pll = PLL_28, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, -},{ - - /* ---- card 0x50 ---------------------------------- */ - .name = "Hauppauge WinTV PVR", - .video_inputs = 4, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .muxsel = { 2, 0, 1, 1}, - .needs_tvaudio = 1, - .pll = PLL_28, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, - - .gpiomask = 7, - .audiomux = {7}, -},{ - .name = "IODATA GV-BCTV5/PCI", - .video_inputs = 3, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 0x0f0f80, - .muxsel = {2, 3, 1, 0}, - .audiomux = {0x030000, 0x010000, 0, 0, 0x020000, 0}, - .no_msp34xx = 1, - .pll = PLL_28, - .tuner_type = TUNER_PHILIPS_NTSC_M, - .tuner_addr = ADDR_UNSET, - .audio_hook = gvbctv5pci_audio, - .has_radio = 1, -},{ - .name = "Osprey 100/150 (878)", /* 0x1(2|3)-45C6-C1 */ - .video_inputs = 4, /* id-inputs-clock */ - .audio_inputs = 0, - .tuner = -1, - .svhs = 3, - .muxsel = { 3, 2, 0, 1 }, - .pll = PLL_28, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, - .no_msp34xx = 1, - .no_tda9875 = 1, - .no_tda7432 = 1, -},{ - .name = "Osprey 100/150 (848)", /* 0x04-54C0-C1 & older boards */ - .video_inputs = 3, - .audio_inputs = 0, - .tuner = -1, - .svhs = 2, - .muxsel = { 2, 3, 1 }, - .pll = PLL_28, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, - .no_msp34xx = 1, - .no_tda9875 = 1, - .no_tda7432 = 1, -},{ - - /* ---- card 0x54 ---------------------------------- */ - .name = "Osprey 101 (848)", /* 0x05-40C0-C1 */ - .video_inputs = 2, - .audio_inputs = 0, - .tuner = -1, - .svhs = 1, - .muxsel = { 3, 1 }, - .pll = PLL_28, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, - .no_msp34xx = 1, - .no_tda9875 = 1, - .no_tda7432 = 1, -},{ - .name = "Osprey 101/151", /* 0x1(4|5)-0004-C4 */ - .video_inputs = 1, - .audio_inputs = 0, - .tuner = -1, - .svhs = -1, - .muxsel = { 0 }, - .pll = PLL_28, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, - .no_msp34xx = 1, - .no_tda9875 = 1, - .no_tda7432 = 1, -},{ - .name = "Osprey 101/151 w/ svid", /* 0x(16|17|20)-00C4-C1 */ - .video_inputs = 2, - .audio_inputs = 0, - .tuner = -1, - .svhs = 1, - .muxsel = { 0, 1 }, - .pll = PLL_28, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, - .no_msp34xx = 1, - .no_tda9875 = 1, - .no_tda7432 = 1, -},{ - .name = "Osprey 200/201/250/251", /* 0x1(8|9|E|F)-0004-C4 */ - .video_inputs = 1, - .audio_inputs = 1, - .tuner = -1, - .svhs = -1, - .muxsel = { 0 }, - .pll = PLL_28, - .tuner_type = UNSET, - .tuner_addr = ADDR_UNSET, - .no_msp34xx = 1, - .no_tda9875 = 1, - .no_tda7432 = 1, -},{ - - /* ---- card 0x58 ---------------------------------- */ - .name = "Osprey 200/250", /* 0x1(A|B)-00C4-C1 */ - .video_inputs = 2, - .audio_inputs = 1, - .tuner = -1, - .svhs = 1, - .muxsel = { 0, 1 }, - .pll = PLL_28, - .tuner_type = UNSET, - .tuner_addr = ADDR_UNSET, - .no_msp34xx = 1, - .no_tda9875 = 1, - .no_tda7432 = 1, -},{ - .name = "Osprey 210/220", /* 0x1(A|B)-04C0-C1 */ - .video_inputs = 2, - .audio_inputs = 1, - .tuner = -1, - .svhs = 1, - .muxsel = { 2, 3 }, - .pll = PLL_28, - .tuner_type = UNSET, - .tuner_addr = ADDR_UNSET, - .no_msp34xx = 1, - .no_tda9875 = 1, - .no_tda7432 = 1, -},{ - .name = "Osprey 500", /* 500 */ - .video_inputs = 2, - .audio_inputs = 1, - .tuner = -1, - .svhs = 1, - .muxsel = { 2, 3 }, - .pll = PLL_28, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, - .no_msp34xx = 1, - .no_tda9875 = 1, - .no_tda7432 = 1, -},{ - .name = "Osprey 540", /* 540 */ - .video_inputs = 4, - .audio_inputs = 1, - .tuner = -1, - .pll = PLL_28, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, - .no_msp34xx = 1, - .no_tda9875 = 1, - .no_tda7432 = 1, -},{ - - /* ---- card 0x5C ---------------------------------- */ - .name = "Osprey 2000", /* 2000 */ - .video_inputs = 2, - .audio_inputs = 1, - .tuner = -1, - .svhs = 1, - .muxsel = { 2, 3 }, - .pll = PLL_28, - .tuner_type = UNSET, - .tuner_addr = ADDR_UNSET, - .no_msp34xx = 1, - .no_tda9875 = 1, - .no_tda7432 = 1, /* must avoid, conflicts with the bt860 */ -},{ - /* M G Berberich */ - .name = "IDS Eagle", - .video_inputs = 4, - .audio_inputs = 0, - .tuner = -1, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, - .svhs = -1, - .gpiomask = 0, - .muxsel = { 0, 1, 2, 3 }, - .muxsel_hook = eagle_muxsel, - .no_msp34xx = 1, - .no_tda9875 = 1, - .pll = PLL_28, -},{ - .name = "Pinnacle PCTV Sat", - .video_inputs = 2, - .audio_inputs = 0, - .svhs = 1, - .tuner = -1, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, - .no_msp34xx = 1, - .no_tda9875 = 1, - .no_tda7432 = 1, - .muxsel = { 3, 0, 1, 2}, - .pll = PLL_28, - .no_gpioirq = 1, - .has_dvb = 1, -},{ - .name = "Formac ProTV II (bt878)", - .video_inputs = 4, - .audio_inputs = 1, - .tuner = 0, - .svhs = 3, - .gpiomask = 2, - /* TV, Comp1, Composite over SVID con, SVID */ - .muxsel = { 2, 3, 1, 1}, - .audiomux = { 2, 2, 0, 0, 0 }, - .pll = PLL_28, - .has_radio = 1, - .tuner_type = TUNER_PHILIPS_PAL, - .tuner_addr = ADDR_UNSET, -/* sound routing: - GPIO=0x00,0x01,0x03: mute (?) - 0x02: both TV and radio (tuner: FM1216/I) - The card has onboard audio connectors labeled "cdrom" and "board", - not soldered here, though unknown wiring. - Card lacks: external audio in, pci subsystem id. -*/ -},{ - - /* ---- card 0x60 ---------------------------------- */ - .name = "MachTV", - .video_inputs = 3, - .audio_inputs = 1, - .tuner = 0, - .svhs = -1, - .gpiomask = 7, - .muxsel = { 2, 3, 1, 1}, - .audiomux = { 0, 1, 2, 3, 4}, - .needs_tvaudio = 1, - .tuner_type = 5, - .tuner_addr = ADDR_UNSET, - .pll = 1, -},{ - .name = "Euresys Picolo", - .video_inputs = 3, - .audio_inputs = 0, - .tuner = -1, - .svhs = 2, - .gpiomask = 0, - .no_msp34xx = 1, - .no_tda9875 = 1, - .no_tda7432 = 1, - .muxsel = { 2, 0, 1}, - .pll = PLL_28, - .tuner_type = UNSET, - .tuner_addr = ADDR_UNSET, -},{ - /* Luc Van Hoeylandt */ - .name = "ProVideo PV150", /* 0x4f */ - .video_inputs = 2, - .audio_inputs = 0, - .tuner = -1, - .svhs = -1, - .gpiomask = 0, - .muxsel = { 2, 3 }, - .audiomux = { 0 }, - .needs_tvaudio = 0, - .no_msp34xx = 1, - .pll = PLL_28, - .tuner_type = UNSET, - .tuner_addr = ADDR_UNSET, -},{ - /* Hiroshi Takekawa */ - /* This card lacks subsystem ID */ - .name = "AD-TVK503", /* 0x63 */ - .video_inputs = 4, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 0x001e8007, - .muxsel = { 2, 3, 1, 0 }, - /* Tuner, Radio, external, internal, off, on */ - .audiomux = { 0x08, 0x0f, 0x0a, 0x08, 0x0f, 0x08 }, - .needs_tvaudio = 0, - .no_msp34xx = 1, - .pll = PLL_28, - .tuner_type = 2, - .tuner_addr = ADDR_UNSET, - .audio_hook = adtvk503_audio, -},{ - - /* ---- card 0x64 ---------------------------------- */ - .name = "Hercules Smart TV Stereo", - .video_inputs = 4, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 0x00, - .muxsel = { 2, 3, 1, 1 }, - .needs_tvaudio = 1, - .no_msp34xx = 1, - .pll = PLL_28, - .tuner_type = 5, - .tuner_addr = ADDR_UNSET, - /* Notes: - - card lacks subsystem ID - - stereo variant w/ daughter board with tda9874a @0xb0 - - Audio Routing: - always from tda9874 independent of GPIO (?) - external line in: unknown - - Other chips: em78p156elp @ 0x96 (probably IR remote control) - hef4053 (instead 4052) for unknown function - */ -},{ - .name = "Pace TV & Radio Card", - .video_inputs = 4, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .muxsel = { 2, 3, 1, 1}, /* Tuner, CVid, SVid, CVid over SVid connector */ - .gpiomask = 0, - .no_tda9875 = 1, - .no_tda7432 = 1, - .tuner_type = 1, - .tuner_addr = ADDR_UNSET, - .has_radio = 1, - .pll = PLL_28, - /* Bt878, Bt832, FI1246 tuner; no pci subsystem id - only internal line out: (4pin header) RGGL - Radio must be decoded by msp3410d (not routed through)*/ - /* - .digital_mode = DIGITAL_MODE_CAMERA, todo! - */ -},{ - /* Chris Willing */ - .name = "IVC-200", - .video_inputs = 1, - .audio_inputs = 0, - .tuner = -1, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, - .svhs = -1, - .gpiomask = 0xdf, - .muxsel = { 2 }, - .pll = PLL_28, -},{ - .name = "Grand X-Guard / Trust 814PCI", - .video_inputs = 16, - .audio_inputs = 0, - .tuner = -1, - .svhs = -1, - .tuner_type = 4, - .tuner_addr = ADDR_UNSET, - .gpiomask2 = 0xff, - .muxsel = { 2,2,2,2, 3,3,3,3, 1,1,1,1, 0,0,0,0 }, - .muxsel_hook = xguard_muxsel, - .no_msp34xx = 1, - .no_tda9875 = 1, - .no_tda7432 = 1, - .pll = PLL_28, -},{ - - /* ---- card 0x68 ---------------------------------- */ - .name = "Nebula Electronics DigiTV", - .video_inputs = 1, - .tuner = -1, - .svhs = -1, - .muxsel = { 2, 3, 1, 0}, - .no_msp34xx = 1, - .no_tda9875 = 1, - .no_tda7432 = 1, - .pll = PLL_28, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, - .has_dvb = 1, - .no_gpioirq = 1, -},{ - /* Jorge Boncompte - DTI2 */ - .name = "ProVideo PV143", - .video_inputs = 4, - .audio_inputs = 0, - .tuner = -1, - .svhs = -1, - .gpiomask = 0, - .muxsel = { 2, 3, 1, 0 }, - .audiomux = { 0 }, - .needs_tvaudio = 0, - .no_msp34xx = 1, - .pll = PLL_28, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, -},{ - /* M.Klahr@phytec.de */ - .name = "PHYTEC VD-009-X1 MiniDIN (bt878)", - .video_inputs = 4, - .audio_inputs = 0, - .tuner = -1, /* card has no tuner */ - .svhs = 3, - .gpiomask = 0x00, - .muxsel = { 2, 3, 1, 0}, - .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */ - .needs_tvaudio = 1, - .pll = PLL_28, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, -},{ - .name = "PHYTEC VD-009-X1 Combi (bt878)", - .video_inputs = 4, - .audio_inputs = 0, - .tuner = -1, /* card has no tuner */ - .svhs = 3, - .gpiomask = 0x00, - .muxsel = { 2, 3, 1, 1}, - .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */ - .needs_tvaudio = 1, - .pll = PLL_28, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, -},{ - - /* ---- card 0x6c ---------------------------------- */ - .name = "PHYTEC VD-009 MiniDIN (bt878)", - .video_inputs = 10, - .audio_inputs = 0, - .tuner = -1, /* card has no tuner */ - .svhs = 9, - .gpiomask = 0x00, - .gpiomask2 = 0x03, /* gpiomask2 defines the bits used to switch audio - via the upper nibble of muxsel. here: used for - xternal video-mux */ - .muxsel = { 0x02, 0x12, 0x22, 0x32, 0x03, 0x13, 0x23, 0x33, 0x01, 0x00 }, - .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */ - .needs_tvaudio = 1, - .pll = PLL_28, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, -},{ - .name = "PHYTEC VD-009 Combi (bt878)", - .video_inputs = 10, - .audio_inputs = 0, - .tuner = -1, /* card has no tuner */ - .svhs = 9, - .gpiomask = 0x00, - .gpiomask2 = 0x03, /* gpiomask2 defines the bits used to switch audio - via the upper nibble of muxsel. here: used for - xternal video-mux */ - .muxsel = { 0x02, 0x12, 0x22, 0x32, 0x03, 0x13, 0x23, 0x33, 0x01, 0x01 }, - .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */ - .needs_tvaudio = 1, - .pll = PLL_28, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, -},{ - .name = "IVC-100", - .video_inputs = 4, - .audio_inputs = 0, - .tuner = -1, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, - .svhs = -1, - .gpiomask = 0xdf, - .muxsel = { 2, 3, 1, 0 }, - .pll = PLL_28, -},{ - /* IVC-120G - Alan Garfield */ - .name = "IVC-120G", - .video_inputs = 16, - .audio_inputs = 0, /* card has no audio */ - .tuner = -1, /* card has no tuner */ - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, - .svhs = -1, /* card has no svhs */ - .needs_tvaudio = 0, - .no_msp34xx = 1, - .no_tda9875 = 1, - .no_tda7432 = 1, - .gpiomask = 0x00, - .muxsel = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, - 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10 }, - .muxsel_hook = ivc120_muxsel, - .pll = PLL_28, -},{ - - /* ---- card 0x70 ---------------------------------- */ - .name = "pcHDTV HD-2000 TV", - .video_inputs = 4, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .muxsel = { 2, 3, 1, 0}, - .tuner_type = TUNER_PHILIPS_ATSC, - .tuner_addr = ADDR_UNSET, - .has_dvb = 1, -},{ - .name = "Twinhan DST + clones", - .no_msp34xx = 1, - .no_tda9875 = 1, - .no_tda7432 = 1, - .tuner_type = TUNER_ABSENT, - .tuner_addr = ADDR_UNSET, - .no_video = 1, - .has_dvb = 1, -},{ - .name = "Winfast VC100", - .video_inputs = 3, - .audio_inputs = 0, - .svhs = 1, - .tuner = -1, - .muxsel = { 3, 1, 1, 3}, /* Vid In, SVid In, Vid over SVid in connector */ - .no_msp34xx = 1, - .no_tda9875 = 1, - .no_tda7432 = 1, - .tuner_type = TUNER_ABSENT, - .tuner_addr = ADDR_UNSET, - .pll = PLL_28, -},{ - .name = "Teppro TEV-560/InterVision IV-560", - .video_inputs = 3, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 3, - .muxsel = { 2, 3, 1, 1}, - .audiomux = { 1, 1, 1, 1, 0}, - .needs_tvaudio = 1, - .tuner_type = TUNER_PHILIPS_PAL, - .tuner_addr = ADDR_UNSET, - .pll = PLL_35, -},{ - - /* ---- card 0x74 ---------------------------------- */ - .name = "SIMUS GVC1100", - .video_inputs = 4, - .audio_inputs = 0, - .tuner = -1, - .svhs = -1, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, - .pll = PLL_28, - .muxsel = { 2, 2, 2, 2}, - .gpiomask = 0x3F, - .muxsel_hook = gvc1100_muxsel, -},{ - /* Carlos Silva r3pek@r3pek.homelinux.org || card 0x75 */ - .name = "NGS NGSTV+", - .video_inputs = 3, - .tuner = 0, - .svhs = 2, - .gpiomask = 0x008007, - .muxsel = {2, 3, 0, 0}, - .audiomux = {0, 0, 0, 0, 0x000003, 0}, - .pll = PLL_28, - .tuner_type = TUNER_PHILIPS_PAL, - .tuner_addr = ADDR_UNSET, - .has_remote = 1, -},{ - /* http://linuxmedialabs.com */ - .name = "LMLBT4", - .video_inputs = 4, /* IN1,IN2,IN3,IN4 */ - .audio_inputs = 0, - .tuner = -1, - .svhs = -1, - .muxsel = { 2, 3, 1, 0 }, - .no_msp34xx = 1, - .no_tda9875 = 1, - .no_tda7432 = 1, - .needs_tvaudio = 0, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, -},{ - /* Helmroos Harri */ - .name = "Tekram M205 PRO", - .video_inputs = 3, - .audio_inputs = 1, - .tuner = 0, - .tuner_type = TUNER_PHILIPS_PAL, - .tuner_addr = ADDR_UNSET, - .svhs = 2, - .needs_tvaudio = 0, - .gpiomask = 0x68, - .muxsel = { 2, 3, 1}, - .audiomux = { 0x68, 0x68, 0x61, 0x61, 0x00 }, - .pll = PLL_28, -},{ - - /* ---- card 0x78 ---------------------------------- */ - /* Javier Cendan Ares */ - /* bt878 TV + FM without subsystem ID */ - .name = "Conceptronic CONTVFMi", - .video_inputs = 3, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 0x008007, - .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 0, 1, 2, 2, 3 }, - .needs_tvaudio = 0, - .pll = PLL_28, - .tuner_type = TUNER_PHILIPS_PAL, - .tuner_addr = ADDR_UNSET, - .has_remote = 1, - .has_radio = 1, -},{ - /*Eric DEBIEF */ - /*EURESYS Picolo Tetra : 4 Conexant Fusion 878A, no audio, video input set with analog multiplexers GPIO controled*/ - /* adds picolo_tetra_muxsel(), picolo_tetra_init(), the folowing declaration strucure, and #define BTTV_PICOLO_TETRA_CHIP*/ - /*0x79 in bttv.h*/ - .name = "Euresys Picolo Tetra", - .video_inputs = 4, - .audio_inputs = 0, - .tuner = -1, - .svhs = -1, - .gpiomask = 0, - .gpiomask2 = 0x3C<<16,/*Set the GPIO[18]->GPIO[21] as output pin.==> drive the video inputs through analog multiplexers*/ - .no_msp34xx = 1, - .no_tda9875 = 1, - .no_tda7432 = 1, - .muxsel = {2,2,2,2},/*878A input is always MUX0, see above.*/ - .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */ - .pll = PLL_28, - .needs_tvaudio = 0, - .muxsel_hook = picolo_tetra_muxsel,/*Required as it doesn't follow the classic input selection policy*/ - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, -},{ - /* Spirit TV Tuner from http://spiritmodems.com.au */ - /* Stafford Goodsell */ - .name = "Spirit TV Tuner", - .video_inputs = 3, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 0x0000000f, - .muxsel = { 2, 1, 1 }, - .audiomux = { 0x02, 0x00, 0x00, 0x00, 0x00}, - .tuner_type = TUNER_TEMIC_PAL, - .tuner_addr = ADDR_UNSET, - .no_msp34xx = 1, - .no_tda9875 = 1, -},{ - /* Wolfram Joost */ - .name = "AVerMedia AVerTV DVB-T 771", - .video_inputs = 2, - .svhs = 1, - .tuner = -1, - .tuner_type = TUNER_ABSENT, - .tuner_addr = ADDR_UNSET, - .muxsel = { 3 , 3 }, - .no_msp34xx = 1, - .no_tda9875 = 1, - .no_tda7432 = 1, - .pll = PLL_28, - .has_dvb = 1, - .no_gpioirq = 1, - .has_remote = 1, -},{ - /* ---- card 0x7c ---------------------------------- */ - /* Matt Jesson */ - /* Based on the Nebula card data - added remote and new card number - BTTV_AVDVBT_761, see also ir-kbd-gpio.c */ - .name = "AverMedia AverTV DVB-T 761", - .video_inputs = 2, - .tuner = -1, - .svhs = 1, - .muxsel = { 3, 1, 2, 0}, /* Comp0, S-Video, ?, ? */ - .no_msp34xx = 1, - .no_tda9875 = 1, - .no_tda7432 = 1, - .pll = PLL_28, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, - .has_dvb = 1, - .no_gpioirq = 1, - .has_remote = 1, -},{ - /* andre.schwarz@matrix-vision.de */ - .name = "MATRIX Vision Sigma-SQ", - .video_inputs = 16, - .audio_inputs = 0, - .tuner = -1, - .svhs = -1, - .gpiomask = 0x0, - .muxsel = { 2, 2, 2, 2, 2, 2, 2, 2, - 3, 3, 3, 3, 3, 3, 3, 3 }, - .muxsel_hook = sigmaSQ_muxsel, - .audiomux = { 0 }, - .no_msp34xx = 1, - .pll = PLL_28, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, -},{ - /* andre.schwarz@matrix-vision.de */ - .name = "MATRIX Vision Sigma-SLC", - .video_inputs = 4, - .audio_inputs = 0, - .tuner = -1, - .svhs = -1, - .gpiomask = 0x0, - .muxsel = { 2, 2, 2, 2 }, - .muxsel_hook = sigmaSLC_muxsel, - .audiomux = { 0 }, - .no_msp34xx = 1, - .pll = PLL_28, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, -},{ - /* BTTV_APAC_VIEWCOMP */ - /* Attila Kondoros */ - /* bt878 TV + FM 0x00000000 subsystem ID */ - .name = "APAC Viewcomp 878(AMAX)", - .video_inputs = 2, - .audio_inputs = 1, - .tuner = 0, - .svhs = -1, - .gpiomask = 0xFF, - .muxsel = { 2, 3, 1, 1}, - .audiomux = { 2, 0, 0, 0, 10}, - .needs_tvaudio = 0, - .pll = PLL_28, - .tuner_type = TUNER_PHILIPS_PAL, - .tuner_addr = ADDR_UNSET, - .has_remote = 1, /* miniremote works, see ir-kbd-gpio.c */ - .has_radio = 1, /* not every card has radio */ -},{ - - /* ---- card 0x80 ---------------------------------- */ - /* Chris Pascoe */ - .name = "DViCO FusionHDTV DVB-T Lite", - .tuner = -1, - .no_msp34xx = 1, - .no_tda9875 = 1, - .no_tda7432 = 1, - .pll = PLL_28, - .no_video = 1, - .has_dvb = 1, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, -},{ - /* Steven */ - .name = "V-Gear MyVCD", - .video_inputs = 3, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 0x3f, - .muxsel = {2, 3, 1, 0}, - .audiomux = {0x31, 0x31, 0x31, 0x31, 0x31, 0x31}, - .no_msp34xx = 1, - .pll = PLL_28, - .tuner_type = TUNER_PHILIPS_NTSC_M, - .tuner_addr = ADDR_UNSET, - .has_radio = 0, -},{ - /* Rick C */ - .name = "Super TV Tuner", - .video_inputs = 4, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .muxsel = { 2, 3, 1, 0}, - .tuner_type = TUNER_PHILIPS_NTSC, - .tuner_addr = ADDR_UNSET, - .gpiomask = 0x008007, - .audiomux = { 0, 0x000001,0,0, 0}, - .needs_tvaudio = 1, - .has_radio = 1, -},{ - /* Chris Fanning */ - .name = "Tibet Systems 'Progress DVR' CS16", - .video_inputs = 16, - .audio_inputs = 0, - .tuner = -1, - .svhs = -1, - .muxsel = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }, - .pll = PLL_28, - .no_msp34xx = 1, - .no_tda9875 = 1, - .no_tda7432 = 1, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, - .muxsel_hook = tibetCS16_muxsel, -}, -{ - /* Bill Brack */ - /* - * Note that, because of the card's wiring, the "master" - * BT878A chip (i.e. the one which controls the analog switch - * and must use this card type) is the 2nd one detected. The - * other 3 chips should use card type 0x85, whose description - * follows this one. There is a EEPROM on the card (which is - * connected to the I2C of one of those other chips), but is - * not currently handled. There is also a facility for a - * "monitor", which is also not currently implemented. + [BTTV_UNKNOWN] = { + /* ---- card 0x00 ---------------------------------- */ + .name = " *** UNKNOWN/GENERIC *** ", + .video_inputs = 4, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .muxsel = { 2, 3, 1, 0}, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + }, + [BTTV_MIRO] = { + .name = "MIRO PCTV", + .video_inputs = 4, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 15, + .muxsel = { 2, 3, 1, 1}, + .audiomux = { 2, 0, 0, 0, 10}, + .needs_tvaudio = 1, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + }, + [BTTV_HAUPPAUGE] = { + .name = "Hauppauge (bt848)", + .video_inputs = 4, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 7, + .muxsel = { 2, 3, 1, 1}, + .audiomux = { 0, 1, 2, 3, 4}, + .needs_tvaudio = 1, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + }, + [BTTV_STB] = { + .name = "STB, Gateway P/N 6000699 (bt848)", + .video_inputs = 3, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 7, + .muxsel = { 2, 3, 1, 1}, + .audiomux = { 4, 0, 2, 3, 1}, + .no_msp34xx = 1, + .needs_tvaudio = 1, + .tuner_type = TUNER_PHILIPS_NTSC, + .tuner_addr = ADDR_UNSET, + .pll = PLL_28, + .has_radio = 1, + }, + + /* ---- card 0x04 ---------------------------------- */ + [BTTV_INTEL] = { + .name = "Intel Create and Share PCI/ Smart Video Recorder III", + .video_inputs = 4, + .audio_inputs = 0, + .tuner = -1, + .svhs = 2, + .gpiomask = 0, + .muxsel = { 2, 3, 1, 1}, + .audiomux = { 0 }, + .needs_tvaudio = 0, + .tuner_type = 4, + .tuner_addr = ADDR_UNSET, + }, + [BTTV_DIAMOND] = { + .name = "Diamond DTV2000", + .video_inputs = 4, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 3, + .muxsel = { 2, 3, 1, 0}, + .audiomux = { 0, 1, 0, 1, 3}, + .needs_tvaudio = 1, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + }, + [BTTV_AVERMEDIA] = { + .name = "AVerMedia TVPhone", + .video_inputs = 3, + .audio_inputs = 1, + .tuner = 0, + .svhs = 3, + .muxsel = { 2, 3, 1, 1}, + .gpiomask = 0x0f, + .audiomux = { 0x0c, 0x04, 0x08, 0x04, 0}, + /* 0x04 for some cards ?? */ + .needs_tvaudio = 1, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + .audio_hook = avermedia_tvphone_audio, + .has_remote = 1, + }, + [BTTV_MATRIX_VISION] = { + .name = "MATRIX-Vision MV-Delta", + .video_inputs = 5, + .audio_inputs = 1, + .tuner = -1, + .svhs = 3, + .gpiomask = 0, + .muxsel = { 2, 3, 1, 0, 0}, + .audiomux = {0 }, + .needs_tvaudio = 1, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + }, + + /* ---- card 0x08 ---------------------------------- */ + [BTTV_FLYVIDEO] = { + .name = "Lifeview FlyVideo II (Bt848) LR26 / MAXI TV Video PCI2 LR26", + .video_inputs = 4, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 0xc00, + .muxsel = { 2, 3, 1, 1}, + .audiomux = { 0, 0xc00, 0x800, 0x400, 0xc00, 0}, + .needs_tvaudio = 1, + .pll = PLL_28, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + }, + [BTTV_TURBOTV] = { + .name = "IMS/IXmicro TurboTV", + .video_inputs = 3, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 3, + .muxsel = { 2, 3, 1, 1}, + .audiomux = { 1, 1, 2, 3, 0}, + .needs_tvaudio = 0, + .pll = PLL_28, + .tuner_type = TUNER_TEMIC_PAL, + .tuner_addr = ADDR_UNSET, + }, + [BTTV_HAUPPAUGE878] = { + .name = "Hauppauge (bt878)", + .video_inputs = 4, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 0x0f, /* old: 7 */ + .muxsel = { 2, 0, 1, 1}, + .audiomux = { 0, 1, 2, 3, 4}, + .needs_tvaudio = 1, + .pll = PLL_28, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + }, + [BTTV_MIROPRO] = { + .name = "MIRO PCTV pro", + .video_inputs = 3, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 0x3014f, + .muxsel = { 2, 3, 1, 1}, + .audiomux = { 0x20001,0x10001, 0, 0,10}, + .needs_tvaudio = 1, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + }, + + /* ---- card 0x0c ---------------------------------- */ + [BTTV_ADSTECH_TV] = { + .name = "ADS Technologies Channel Surfer TV (bt848)", + .video_inputs = 3, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 15, + .muxsel = { 2, 3, 1, 1}, + .audiomux = { 13, 14, 11, 7, 0, 0}, + .needs_tvaudio = 1, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + }, + [BTTV_AVERMEDIA98] = { + .name = "AVerMedia TVCapture 98", + .video_inputs = 3, + .audio_inputs = 4, + .tuner = 0, + .svhs = 2, + .gpiomask = 15, + .muxsel = { 2, 3, 1, 1}, + .audiomux = { 13, 14, 11, 7, 0, 0}, + .needs_tvaudio = 1, + .msp34xx_alt = 1, + .pll = PLL_28, + .tuner_type = TUNER_PHILIPS_PAL, + .tuner_addr = ADDR_UNSET, + .audio_hook = avermedia_tv_stereo_audio, + }, + [BTTV_VHX] = { + .name = "Aimslab Video Highway Xtreme (VHX)", + .video_inputs = 3, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 7, + .muxsel = { 2, 3, 1, 1}, + .audiomux = { 0, 2, 1, 3, 4}, /* old: { 0, 1, 2, 3, 4} */ + .needs_tvaudio = 1, + .pll = PLL_28, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + }, + [BTTV_ZOLTRIX] = { + .name = "Zoltrix TV-Max", + .video_inputs = 3, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 15, + .muxsel = { 2, 3, 1, 1}, + .audiomux = {0 , 0, 1 , 0, 10}, + .needs_tvaudio = 1, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + }, + + /* ---- card 0x10 ---------------------------------- */ + [BTTV_PIXVIEWPLAYTV] = { + .name = "Prolink Pixelview PlayTV (bt878)", + .video_inputs = 3, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 0x01fe00, + .muxsel = { 2, 3, 1, 1}, + #if 0 + /* old */ + .audiomux = { 0x01c000, 0, 0x018000, 0x014000, 0x002000, 0 }, + #else + /* 2003-10-20 by "Anton A. Arapov" */ + .audiomux = { 0x001e00, 0, 0x018000, 0x014000, 0x002000, 0 }, + #endif + .needs_tvaudio = 1, + .pll = PLL_28, + .tuner_type = -1, + }, + [BTTV_WINVIEW_601] = { + .name = "Leadtek WinView 601", + .video_inputs = 3, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 0x8300f8, + .muxsel = { 2, 3, 1, 1,0}, + .audiomux = { 0x4fa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007}, + .needs_tvaudio = 1, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + .audio_hook = winview_audio, + .has_radio = 1, + }, + [BTTV_AVEC_INTERCAP] = { + .name = "AVEC Intercapture", + .video_inputs = 3, + .audio_inputs = 2, + .tuner = 0, + .svhs = 2, + .gpiomask = 0, + .muxsel = {2, 3, 1, 1}, + .audiomux = {1, 0, 0, 0, 0}, + .needs_tvaudio = 1, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + }, + [BTTV_LIFE_FLYKIT] = { + .name = "Lifeview FlyVideo II EZ /FlyKit LR38 Bt848 (capture only)", + .video_inputs = 4, + .audio_inputs = 1, + .tuner = -1, + .svhs = -1, + .gpiomask = 0x8dff00, + .muxsel = { 2, 3, 1, 1}, + .audiomux = { 0 }, + .no_msp34xx = 1, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + }, + + /* ---- card 0x14 ---------------------------------- */ + [BTTV_CEI_RAFFLES] = { + .name = "CEI Raffles Card", + .video_inputs = 3, + .audio_inputs = 3, + .tuner = 0, + .svhs = 2, + .muxsel = {2, 3, 1, 1}, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + }, + [BTTV_CONFERENCETV] = { + .name = "Lifeview FlyVideo 98/ Lucky Star Image World ConferenceTV LR50", + .video_inputs = 4, + .audio_inputs = 2, /* tuner, line in */ + .tuner = 0, + .svhs = 2, + .gpiomask = 0x1800, + .muxsel = { 2, 3, 1, 1}, + .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800}, + .pll = PLL_28, + .tuner_type = TUNER_PHILIPS_PAL_I, + .tuner_addr = ADDR_UNSET, + }, + [BTTV_PHOEBE_TVMAS] = { + .name = "Askey CPH050/ Phoebe Tv Master + FM", + .video_inputs = 3, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 0xc00, + .muxsel = { 2, 3, 1, 1}, + .audiomux = {0, 1, 0x800, 0x400, 0xc00, 0}, + .needs_tvaudio = 1, + .pll = PLL_28, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + }, + [BTTV_MODTEC_205] = { + .name = "Modular Technology MM201/MM202/MM205/MM210/MM215 PCTV, bt878", + .video_inputs = 3, + .audio_inputs = 1, + .tuner = 0, + .svhs = -1, + .gpiomask = 7, + .muxsel = { 2, 3, -1 }, + .digital_mode = DIGITAL_MODE_CAMERA, + .audiomux = { 0, 0, 0, 0, 0 }, + .no_msp34xx = 1, + .pll = PLL_28, + .tuner_type = TUNER_ALPS_TSBB5_PAL_I, + .tuner_addr = ADDR_UNSET, + }, + + /* ---- card 0x18 ---------------------------------- */ + [BTTV_MAGICTVIEW061] = { + .name = "Askey CPH05X/06X (bt878) [many vendors]", + .video_inputs = 3, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 0xe00, + .muxsel = { 2, 3, 1, 1}, + .audiomux = {0x400, 0x400, 0x400, 0x400, 0xc00}, + .needs_tvaudio = 1, + .pll = PLL_28, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + .has_remote = 1, + }, + [BTTV_VOBIS_BOOSTAR] = { + .name = "Terratec TerraTV+ Version 1.0 (Bt848)/ Terra TValue Version 1.0/ Vobis TV-Boostar", + .video_inputs = 3, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 0x1f0fff, + .muxsel = { 2, 3, 1, 1}, + .audiomux = { 0x20000, 0x30000, 0x10000, 0, 0x40000}, + .needs_tvaudio = 0, + .tuner_type = TUNER_PHILIPS_PAL, + .tuner_addr = ADDR_UNSET, + .audio_hook = terratv_audio, + }, + [BTTV_HAUPPAUG_WCAM] = { + .name = "Hauppauge WinCam newer (bt878)", + .video_inputs = 4, + .audio_inputs = 1, + .tuner = 0, + .svhs = 3, + .gpiomask = 7, + .muxsel = { 2, 0, 1, 1}, + .audiomux = { 0, 1, 2, 3, 4}, + .needs_tvaudio = 1, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + }, + [BTTV_MAXI] = { + .name = "Lifeview FlyVideo 98/ MAXI TV Video PCI2 LR50", + .video_inputs = 4, + .audio_inputs = 2, + .tuner = 0, + .svhs = 2, + .gpiomask = 0x1800, + .muxsel = { 2, 3, 1, 1}, + .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800}, + .pll = PLL_28, + .tuner_type = TUNER_PHILIPS_SECAM, + .tuner_addr = ADDR_UNSET, + }, + + /* ---- card 0x1c ---------------------------------- */ + [BTTV_TERRATV] = { + .name = "Terratec TerraTV+ Version 1.1 (bt878)", + .video_inputs = 3, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 0x1f0fff, + .muxsel = { 2, 3, 1, 1}, + .audiomux = { 0x20000, 0x30000, 0x10000, 0x00000, 0x40000}, + .needs_tvaudio = 0, + .tuner_type = TUNER_PHILIPS_PAL, + .tuner_addr = ADDR_UNSET, + .audio_hook = terratv_audio, + /* GPIO wiring: + External 20 pin connector (for Active Radio Upgrade board) + gpio00: i2c-sda + gpio01: i2c-scl + gpio02: om5610-data + gpio03: om5610-clk + gpio04: om5610-wre + gpio05: om5610-stereo + gpio06: rds6588-davn + gpio07: Pin 7 n.c. + gpio08: nIOW + gpio09+10: nIOR, nSEL ?? (bt878) + gpio09: nIOR (bt848) + gpio10: nSEL (bt848) + Sound Routing: + gpio16: u2-A0 (1st 4052bt) + gpio17: u2-A1 + gpio18: u2-nEN + gpio19: u4-A0 (2nd 4052) + gpio20: u4-A1 + u4-nEN - GND + Btspy: + 00000 : Cdrom (internal audio input) + 10000 : ext. Video audio input + 20000 : TV Mono + a0000 : TV Mono/2 + 1a0000 : TV Stereo + 30000 : Radio + 40000 : Mute */ - .name = "Kodicom 4400R (master)", - .video_inputs = 16, - .audio_inputs = 0, - .tuner = -1, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, - .svhs = -1, - /* GPIO bits 0-9 used for analog switch: - * 00 - 03: camera selector - * 04 - 06: channel (controller) selector - * 07: data (1->on, 0->off) - * 08: strobe - * 09: reset - * bit 16 is input from sync separator for the channel - */ - .gpiomask = 0x0003ff, - .no_gpioirq = 1, - .muxsel = { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, - .pll = PLL_28, - .no_msp34xx = 1, - .no_tda7432 = 1, - .no_tda9875 = 1, - .muxsel_hook = kodicom4400r_muxsel, -}, -{ - /* Bill Brack */ - /* Note that, for reasons unknown, the "master" BT878A chip (i.e. the - * one which controls the analog switch, and must use the card type) - * is the 2nd one detected. The other 3 chips should use this card - * type + + }, + [BTTV_PXC200] = { + /* Jannik Fritsch */ + .name = "Imagenation PXC200", + .video_inputs = 5, + .audio_inputs = 1, + .tuner = -1, + .svhs = 1, /* was: 4 */ + .gpiomask = 0, + .muxsel = { 2, 3, 1, 0, 0}, + .audiomux = { 0 }, + .needs_tvaudio = 1, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + .muxsel_hook = PXC200_muxsel, + + }, + [BTTV_FLYVIDEO_98] = { + .name = "Lifeview FlyVideo 98 LR50", + .video_inputs = 4, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 0x1800, /* 0x8dfe00 */ + .muxsel = { 2, 3, 1, 1}, + .audiomux = { 0, 0x0800, 0x1000, 0x1000, 0x1800, 0 }, + .pll = PLL_28, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + }, + [BTTV_IPROTV] = { + .name = "Formac iProTV, Formac ProTV I (bt848)", + .video_inputs = 4, + .audio_inputs = 1, + .tuner = 0, + .svhs = 3, + .gpiomask = 1, + .muxsel = { 2, 3, 1, 1}, + .audiomux = { 1, 0, 0, 0, 0 }, + .pll = PLL_28, + .tuner_type = TUNER_PHILIPS_PAL, + .tuner_addr = ADDR_UNSET, + }, + + /* ---- card 0x20 ---------------------------------- */ + [BTTV_INTEL_C_S_PCI] = { + .name = "Intel Create and Share PCI/ Smart Video Recorder III", + .video_inputs = 4, + .audio_inputs = 0, + .tuner = -1, + .svhs = 2, + .gpiomask = 0, + .muxsel = { 2, 3, 1, 1}, + .audiomux = { 0 }, + .needs_tvaudio = 0, + .tuner_type = 4, + .tuner_addr = ADDR_UNSET, + }, + [BTTV_TERRATVALUE] = { + .name = "Terratec TerraTValue Version Bt878", + .video_inputs = 3, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 0xffff00, + .muxsel = { 2, 3, 1, 1}, + .audiomux = { 0x500, 0, 0x300, 0x900, 0x900}, + .needs_tvaudio = 1, + .pll = PLL_28, + .tuner_type = TUNER_PHILIPS_PAL, + .tuner_addr = ADDR_UNSET, + }, + [BTTV_WINFAST2000] = { + .name = "Leadtek WinFast 2000/ WinFast 2000 XP", + .video_inputs = 4, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .muxsel = { 2, 3, 1, 1, 0}, /* TV, CVid, SVid, CVid over SVid connector */ + #if 0 + .gpiomask = 0xc33000, + .audiomux = { 0x422000,0x1000,0x0000,0x620000,0x800000 }, + #else + /* Alexander Varakin [stereo version] */ + .gpiomask = 0xb33000, + .audiomux = { 0x122000,0x1000,0x0000,0x620000,0x800000 }, + #endif + /* Audio Routing for "WinFast 2000 XP" (no tv stereo !) + gpio23 -- hef4052:nEnable (0x800000) + gpio12 -- hef4052:A1 + gpio13 -- hef4052:A0 + 0x0000: external audio + 0x1000: FM + 0x2000: TV + 0x3000: n.c. + Note: There exists another variant "Winfast 2000" with tv stereo !? + Note: eeprom only contains FF and pci subsystem id 107d:6606 + */ + .needs_tvaudio = 0, + .pll = PLL_28, + .has_radio = 1, + .tuner_type = 5, /* default for now, gpio reads BFFF06 for Pal bg+dk */ + .tuner_addr = ADDR_UNSET, + .audio_hook = winfast2000_audio, + .has_remote = 1, + }, + [BTTV_CHRONOS_VS2] = { + .name = "Lifeview FlyVideo 98 LR50 / Chronos Video Shuttle II", + .video_inputs = 4, + .audio_inputs = 3, + .tuner = 0, + .svhs = 2, + .gpiomask = 0x1800, + .muxsel = { 2, 3, 1, 1}, + .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800}, + .pll = PLL_28, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + }, + + /* ---- card 0x24 ---------------------------------- */ + [BTTV_TYPHOON_TVIEW] = { + .name = "Lifeview FlyVideo 98FM LR50 / Typhoon TView TV/FM Tuner", + .video_inputs = 4, + .audio_inputs = 3, + .tuner = 0, + .svhs = 2, + .gpiomask = 0x1800, + .muxsel = { 2, 3, 1, 1}, + .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800, 0 }, + .pll = PLL_28, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + .has_radio = 1, + }, + [BTTV_PXELVWPLTVPRO] = { + .name = "Prolink PixelView PlayTV pro", + .video_inputs = 3, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 0xff, + .muxsel = { 2, 3, 1, 1 }, + .audiomux = { 0x21, 0x20, 0x24, 0x2c, 0x29, 0x29 }, + .no_msp34xx = 1, + .pll = PLL_28, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + }, + [BTTV_MAGICTVIEW063] = { + .name = "Askey CPH06X TView99", + .video_inputs = 4, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 0x551e00, + .muxsel = { 2, 3, 1, 0}, + .audiomux = { 0x551400, 0x551200, 0, 0, 0x551c00, 0x551200 }, + .needs_tvaudio = 1, + .pll = PLL_28, + .tuner_type = 1, + .tuner_addr = ADDR_UNSET, + .has_remote = 1, + }, + [BTTV_PINNACLE] = { + .name = "Pinnacle PCTV Studio/Rave", + .video_inputs = 3, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 0x03000F, + .muxsel = { 2, 3, 1, 1}, + .audiomux = { 2, 0xd0001, 0, 0, 1}, + .needs_tvaudio = 0, + .pll = PLL_28, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + }, + + /* ---- card 0x28 ---------------------------------- */ + [BTTV_STB2] = { + .name = "STB TV PCI FM, Gateway P/N 6000704 (bt878), 3Dfx VoodooTV 100", + .video_inputs = 3, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 7, + .muxsel = { 2, 3, 1, 1}, + .audiomux = { 4, 0, 2, 3, 1}, + .no_msp34xx = 1, + .needs_tvaudio = 1, + .tuner_type = TUNER_PHILIPS_NTSC, + .tuner_addr = ADDR_UNSET, + .pll = PLL_28, + .has_radio = 1, + }, + [BTTV_AVPHONE98] = { + .name = "AVerMedia TVPhone 98", + .video_inputs = 3, + .audio_inputs = 4, + .tuner = 0, + .svhs = 2, + .gpiomask = 15, + .muxsel = { 2, 3, 1, 1}, + .audiomux = { 13, 4, 11, 7, 0, 0}, + .needs_tvaudio = 1, + .pll = PLL_28, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + .has_radio = 1, + .audio_hook = avermedia_tvphone_audio, + }, + [BTTV_PV951] = { + .name = "ProVideo PV951", /* pic16c54 */ + .video_inputs = 3, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 0, + .muxsel = { 2, 3, 1, 1}, + .audiomux = { 0, 0, 0, 0, 0}, + .needs_tvaudio = 1, + .no_msp34xx = 1, + .pll = PLL_28, + .tuner_type = 1, + .tuner_addr = ADDR_UNSET, + }, + [BTTV_ONAIR_TV] = { + .name = "Little OnAir TV", + .video_inputs = 3, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 0xe00b, + .muxsel = {2, 3, 1, 1}, + .audiomux = {0xff9ff6, 0xff9ff6, 0xff1ff7, 0, 0xff3ffc}, + .no_msp34xx = 1, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + }, + + /* ---- card 0x2c ---------------------------------- */ + [BTTV_SIGMA_TVII_FM] = { + .name = "Sigma TVII-FM", + .video_inputs = 2, + .audio_inputs = 1, + .tuner = 0, + .svhs = -1, + .gpiomask = 3, + .muxsel = {2, 3, 1, 1}, + .audiomux = {1, 1, 0, 2, 3}, + .no_msp34xx = 1, + .pll = PLL_NONE, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + }, + [BTTV_MATRIX_VISION2] = { + .name = "MATRIX-Vision MV-Delta 2", + .video_inputs = 5, + .audio_inputs = 1, + .tuner = -1, + .svhs = 3, + .gpiomask = 0, + .muxsel = { 2, 3, 1, 0, 0}, + .audiomux = {0 }, + .no_msp34xx = 1, + .pll = PLL_28, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + }, + [BTTV_ZOLTRIX_GENIE] = { + .name = "Zoltrix Genie TV/FM", + .video_inputs = 3, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 0xbcf03f, + .muxsel = { 2, 3, 1, 1}, + .audiomux = { 0xbc803f, 0xbc903f, 0xbcb03f, 0, 0xbcb03f}, + .no_msp34xx = 1, + .pll = PLL_28, + .tuner_type = 21, + .tuner_addr = ADDR_UNSET, + }, + [BTTV_TERRATVRADIO] = { + .name = "Terratec TV/Radio+", + .video_inputs = 3, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 0x70000, + .muxsel = { 2, 3, 1, 1}, + .audiomux = { 0x20000, 0x30000, 0x10000, 0, 0x40000, 0x20000 }, + .needs_tvaudio = 1, + .no_msp34xx = 1, + .pll = PLL_35, + .tuner_type = 1, + .tuner_addr = ADDR_UNSET, + .has_radio = 1, + }, + + /* ---- card 0x30 ---------------------------------- */ + [BTTV_DYNALINK] = { + .name = "Askey CPH03x/ Dynalink Magic TView", + .video_inputs = 3, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 15, + .muxsel = { 2, 3, 1, 1}, + .audiomux = {2,0,0,0,1}, + .needs_tvaudio = 1, + .pll = PLL_28, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + }, + [BTTV_GVBCTV3PCI] = { + .name = "IODATA GV-BCTV3/PCI", + .video_inputs = 3, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 0x010f00, + .muxsel = {2, 3, 0, 0}, + .audiomux = {0x10000, 0, 0x10000, 0, 0, 0}, + .no_msp34xx = 1, + .pll = PLL_28, + .tuner_type = TUNER_ALPS_TSHC6_NTSC, + .tuner_addr = ADDR_UNSET, + .audio_hook = gvbctv3pci_audio, + }, + [BTTV_PXELVWPLTVPAK] = { + .name = "Prolink PV-BT878P+4E / PixelView PlayTV PAK / Lenco MXTV-9578 CP", + .video_inputs = 5, + .audio_inputs = 1, + .tuner = 0, + .svhs = 3, + .gpiomask = 0xAA0000, + .muxsel = { 2,3,1,1,-1 }, + .digital_mode = DIGITAL_MODE_CAMERA, + .audiomux = { 0x20000, 0, 0x80000, 0x80000, 0xa8000, 0x46000 }, + .no_msp34xx = 1, + .pll = PLL_28, + .tuner_type = TUNER_PHILIPS_PAL_I, + .tuner_addr = ADDR_UNSET, + .has_remote = 1, + /* GPIO wiring: (different from Rev.4C !) + GPIO17: U4.A0 (first hef4052bt) + GPIO19: U4.A1 + GPIO20: U5.A1 (second hef4052bt) + GPIO21: U4.nEN + GPIO22: BT832 Reset Line + GPIO23: A5,A0, U5,nEN + Note: At i2c=0x8a is a Bt832 chip, which changes to 0x88 after being reset via GPIO22 + */ + }, + [BTTV_EAGLE] = { + .name = "Eagle Wireless Capricorn2 (bt878A)", + .video_inputs = 4, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 7, + .muxsel = { 2, 0, 1, 1}, + .audiomux = { 0, 1, 2, 3, 4}, + .pll = PLL_28, + .tuner_type = -1 /* TUNER_ALPS_TMDH2_NTSC */, + .tuner_addr = ADDR_UNSET, + }, + + /* ---- card 0x34 ---------------------------------- */ + [BTTV_PINNACLEPRO] = { + /* David Härdeman */ + .name = "Pinnacle PCTV Studio Pro", + .video_inputs = 4, + .audio_inputs = 1, + .tuner = 0, + .svhs = 3, + .gpiomask = 0x03000F, + .muxsel = { 2, 3, 1, 1}, + .audiomux = { 1, 0xd0001, 0, 0, 10}, + /* sound path (5 sources): + MUX1 (mask 0x03), Enable Pin 0x08 (0=enable, 1=disable) + 0= ext. Audio IN + 1= from MUX2 + 2= Mono TV sound from Tuner + 3= not connected + MUX2 (mask 0x30000): + 0,2,3= from MSP34xx + 1= FM stereo Radio from Tuner */ + .needs_tvaudio = 0, + .pll = PLL_28, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + }, + [BTTV_TVIEW_RDS_FM] = { + /* Claas Langbehn , + Sven Grothklags */ + .name = "Typhoon TView RDS + FM Stereo / KNC1 TV Station RDS", + .video_inputs = 4, + .audio_inputs = 3, + .tuner = 0, + .svhs = 2, + .gpiomask = 0x1c, + .muxsel = { 2, 3, 1, 1}, + .audiomux = { 0, 0, 0x10, 8, 4 }, + .needs_tvaudio = 1, + .pll = PLL_28, + .tuner_type = TUNER_PHILIPS_PAL, + .tuner_addr = ADDR_UNSET, + .has_radio = 1, + }, + [BTTV_LIFETEC_9415] = { + /* Tim Röstermundt + in de.comp.os.unix.linux.hardware: + options bttv card=0 pll=1 radio=1 gpiomask=0x18e0 + audiomux=0x44c71f,0x44d71f,0,0x44d71f,0x44dfff + options tuner type=5 */ + .name = "Lifeview FlyVideo 2000 /FlyVideo A2/ Lifetec LT 9415 TV [LR90]", + .video_inputs = 4, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 0x18e0, + .muxsel = { 2, 3, 1, 1}, + .audiomux = { 0x0000,0x0800,0x1000,0x1000,0x18e0 }, + /* For cards with tda9820/tda9821: + 0x0000: Tuner normal stereo + 0x0080: Tuner A2 SAP (second audio program = Zweikanalton) + 0x0880: Tuner A2 stereo */ + .pll = PLL_28, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + }, + [BTTV_BESTBUY_EASYTV] = { + /* Miguel Angel Alvarez + old Easy TV BT848 version (model CPH031) */ + .name = "Askey CPH031/ BESTBUY Easy TV", + .video_inputs = 4, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 0xF, + .muxsel = { 2, 3, 1, 0}, + .audiomux = { 2, 0, 0, 0, 10}, + .needs_tvaudio = 0, + .pll = PLL_28, + .tuner_type = TUNER_TEMIC_PAL, + .tuner_addr = ADDR_UNSET, + }, + + /* ---- card 0x38 ---------------------------------- */ + [BTTV_FLYVIDEO_98FM] = { + /* Gordon Heydon */ + [BTTV_GRANDTEC] = { + .name = "GrandTec 'Grand Video Capture' (Bt848)", + .video_inputs = 2, + .audio_inputs = 0, + .tuner = -1, + .svhs = 1, + .gpiomask = 0, + .muxsel = { 3, 1 }, + .audiomux = { 0 }, + .needs_tvaudio = 0, + .no_msp34xx = 1, + .pll = PLL_35, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + }, + [BTTV_ASKEY_CPH060] = { + /* Daniel Herrington */ + .name = "Askey CPH060/ Phoebe TV Master Only (No FM)", + .video_inputs = 3, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 0xe00, + .muxsel = { 2, 3, 1, 1}, + .audiomux = { 0x400, 0x400, 0x400, 0x400, 0x800, 0x400 }, + .needs_tvaudio = 1, + .pll = PLL_28, + .tuner_type = TUNER_TEMIC_4036FY5_NTSC, + .tuner_addr = ADDR_UNSET, + }, + [BTTV_ASKEY_CPH03X] = { + /* Matti Mottus */ + .name = "Askey CPH03x TV Capturer", + .video_inputs = 4, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 0x03000F, + .muxsel = { 2, 3, 1, 0}, + .audiomux = { 2,0,0,0,1 }, + .pll = PLL_28, + .tuner_type = 0, + .tuner_addr = ADDR_UNSET, + }, + + /* ---- card 0x3c ---------------------------------- */ + [BTTV_MM100PCTV] = { + /* Philip Blundell */ + .name = "Modular Technology MM100PCTV", + .video_inputs = 2, + .audio_inputs = 2, + .tuner = 0, + .svhs = -1, + .gpiomask = 11, + .muxsel = { 2, 3, 1, 1}, + .audiomux = { 2, 0, 0, 1, 8}, + .pll = PLL_35, + .tuner_type = TUNER_TEMIC_PAL, + .tuner_addr = ADDR_UNSET, + }, + [BTTV_GMV1] = { + /* Adrian Cox + new Easy TV BT878 version (model CPH061) + special thanks to Informatica Mieres for providing the card */ + .name = "Askey CPH061/ BESTBUY Easy TV (bt878)", + .video_inputs = 3, + .audio_inputs = 2, + .tuner = 0, + .svhs = 2, + .gpiomask = 0xFF, + .muxsel = { 2, 3, 1, 0}, + .audiomux = { 1, 0, 4, 4, 9}, + .needs_tvaudio = 0, + .pll = PLL_28, + .tuner_type = TUNER_PHILIPS_PAL, + .tuner_addr = ADDR_UNSET, + }, + [BTTV_ATI_TVWONDER] = { + /* Lukas Gebauer */ + .name = "ATI TV-Wonder", + .video_inputs = 3, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 0xf03f, + .muxsel = { 2, 3, 1, 0 }, + .audiomux = { 0xbffe, 0, 0xbfff, 0, 0xbffe}, + .pll = PLL_28, + .tuner_type = TUNER_TEMIC_4006FN5_MULTI_PAL, + .tuner_addr = ADDR_UNSET, + }, + + /* ---- card 0x40 ---------------------------------- */ + [BTTV_ATI_TVWONDERVE] = { + /* Lukas Gebauer */ + .name = "ATI TV-Wonder VE", + .video_inputs = 2, + .audio_inputs = 1, + .tuner = 0, + .svhs = -1, + .gpiomask = 1, + .muxsel = { 2, 3, 0, 1}, + .audiomux = { 0, 0, 1, 0, 0}, + .no_msp34xx = 1, + .pll = PLL_28, + .tuner_type = TUNER_TEMIC_4006FN5_MULTI_PAL, + .tuner_addr = ADDR_UNSET, + }, + [BTTV_FLYVIDEO2000] = { + /* DeeJay */ + .name = "IODATA GV-BCTV4/PCI", + .video_inputs = 3, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 0x010f00, + .muxsel = {2, 3, 0, 0}, + .audiomux = {0x10000, 0, 0x10000, 0, 0, 0}, + .no_msp34xx = 1, + .pll = PLL_28, + .tuner_type = TUNER_SHARP_2U5JF5540_NTSC, + .tuner_addr = ADDR_UNSET, + .audio_hook = gvbctv3pci_audio, + }, + + /* ---- card 0x44 ---------------------------------- */ + [BTTV_VOODOOTV_FM] = { + .name = "3Dfx VoodooTV FM (Euro), VoodooTV 200 (USA)", + /* try "insmod msp3400 simple=0" if you have + * sound problems with this card. */ + .video_inputs = 4, + .audio_inputs = 1, + .tuner = 0, + .svhs = -1, + .gpiomask = 0x4f8a00, + /* 0x100000: 1=MSP enabled (0=disable again) + * 0x010000: Connected to "S0" on tda9880 (0=Pal/BG, 1=NTSC) */ + .audiomux = {0x947fff, 0x987fff,0x947fff,0x947fff, 0x947fff}, + /* tvtuner, radio, external,internal, mute, stereo + * tuner, Composit, SVid, Composit-on-Svid-adapter */ + .muxsel = { 2, 3 ,0 ,1}, + .tuner_type = TUNER_MT2032, + .tuner_addr = ADDR_UNSET, + .pll = PLL_28, + .has_radio = 1, + }, + [BTTV_AIMMS] = { + /* Philip Blundell */ + .name = "Active Imaging AIMMS", + .video_inputs = 1, + .audio_inputs = 0, + .tuner = -1, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + .pll = PLL_28, + .muxsel = { 2 }, + .gpiomask = 0 + }, + [BTTV_PV_BT878P_PLUS] = { + /* Tomasz Pyra */ + .name = "Prolink Pixelview PV-BT878P+ (Rev.4C,8E)", + .video_inputs = 3, + .audio_inputs = 4, + .tuner = 0, + .svhs = 2, + .gpiomask = 15, + .muxsel = { 2, 3, 1, 1}, + .audiomux = { 0, 0, 11, 7, 13, 0}, /* TV and Radio with same GPIO ! */ + .needs_tvaudio = 1, + .pll = PLL_28, + .tuner_type = 25, + .tuner_addr = ADDR_UNSET, + .has_remote = 1, + /* GPIO wiring: + GPIO0: U4.A0 (hef4052bt) + GPIO1: U4.A1 + GPIO2: U4.A1 (second hef4052bt) + GPIO3: U4.nEN, U5.A0, A5.nEN + GPIO8-15: vrd866b ? + */ + }, + [BTTV_FLYVIDEO98EZ] = { + .name = "Lifeview FlyVideo 98EZ (capture only) LR51", + .video_inputs = 4, + .audio_inputs = 0, + .tuner = -1, + .svhs = 2, + .muxsel = { 2, 3, 1, 1}, /* AV1, AV2, SVHS, CVid adapter on SVHS */ + .pll = PLL_28, + .no_msp34xx = 1, + .tuner_type = UNSET, + .tuner_addr = ADDR_UNSET, + }, + + /* ---- card 0x48 ---------------------------------- */ + [BTTV_PV_BT878P_9B] = { + /* Dariusz Kowalewski */ + .name = "Prolink Pixelview PV-BT878P+9B (PlayTV Pro rev.9B FM+NICAM)", + .video_inputs = 4, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 0x3f, + .muxsel = { 2, 3, 1, 1 }, + .audiomux = { 0x01, 0x00, 0x03, 0x03, 0x09, 0x02 }, + .needs_tvaudio = 1, + .no_msp34xx = 1, + .no_tda9875 = 1, + .pll = PLL_28, + .tuner_type = 5, + .tuner_addr = ADDR_UNSET, + .audio_hook = pvbt878p9b_audio, /* Note: not all cards have stereo */ + .has_radio = 1, /* Note: not all cards have radio */ + .has_remote = 1, + /* GPIO wiring: + GPIO0: A0 hef4052 + GPIO1: A1 hef4052 + GPIO3: nEN hef4052 + GPIO8-15: vrd866b + GPIO20,22,23: R30,R29,R28 + */ + }, + [BTTV_SENSORAY311] = { + /* Clay Kunz */ + /* you must jumper JP5 for the card to work */ + .name = "Sensoray 311", + .video_inputs = 5, + .audio_inputs = 0, + .tuner = -1, + .svhs = 4, + .gpiomask = 0, + .muxsel = { 2, 3, 1, 0, 0}, + .audiomux = { 0 }, + .needs_tvaudio = 0, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + }, + [BTTV_RV605] = { + /* Miguel Freitas */ + .name = "RemoteVision MX (RV605)", + .video_inputs = 16, + .audio_inputs = 0, + .tuner = -1, + .svhs = -1, + .gpiomask = 0x00, + .gpiomask2 = 0x07ff, + .muxsel = { 0x33, 0x13, 0x23, 0x43, 0xf3, 0x73, 0xe3, 0x03, + 0xd3, 0xb3, 0xc3, 0x63, 0x93, 0x53, 0x83, 0xa3 }, + .no_msp34xx = 1, + .no_tda9875 = 1, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + .muxsel_hook = rv605_muxsel, + }, + [BTTV_POWERCLR_MTV878] = { + .name = "Powercolor MTV878/ MTV878R/ MTV878F", + .video_inputs = 3, + .audio_inputs = 2, + .tuner = 0, + .svhs = 2, + .gpiomask = 0x1C800F, /* Bit0-2: Audio select, 8-12:remote control 14:remote valid 15:remote reset */ + .muxsel = { 2, 1, 1, }, + .audiomux = { 0, 1, 2, 2, 4 }, + .needs_tvaudio = 0, + .tuner_type = TUNER_PHILIPS_PAL, + .tuner_addr = ADDR_UNSET, + .pll = PLL_28, + .has_radio = 1, + }, + + /* ---- card 0x4c ---------------------------------- */ + [BTTV_WINDVR] = { + /* Masaki Suzuki */ + .name = "Canopus WinDVR PCI (COMPAQ Presario 3524JP, 5112JP)", + .video_inputs = 3, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 0x140007, + .muxsel = { 2, 3, 1, 1 }, + .audiomux = { 0, 1, 2, 3, 4, 0 }, + .tuner_type = TUNER_PHILIPS_NTSC, + .tuner_addr = ADDR_UNSET, + .audio_hook = windvr_audio, + }, + [BTTV_GRANDTEC_MULTI] = { + .name = "GrandTec Multi Capture Card (Bt878)", + .video_inputs = 4, + .audio_inputs = 0, + .tuner = -1, + .svhs = -1, + .gpiomask = 0, + .muxsel = { 2, 3, 1, 0 }, + .audiomux = { 0 }, + .needs_tvaudio = 0, + .no_msp34xx = 1, + .pll = PLL_28, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + }, + [BTTV_KWORLD] = { + .name = "Jetway TV/Capture JW-TV878-FBK, Kworld KW-TV878RF", + .video_inputs = 4, + .audio_inputs = 3, + .tuner = 0, + .svhs = 2, + .gpiomask = 7, + .muxsel = { 2, 3, 1, 1 }, /* Tuner, SVid, SVHS, SVid to SVHS connector */ + .audiomux = { 0 ,0 ,4, 4,4,4},/* Yes, this tuner uses the same audio output for TV and FM radio! + * This card lacks external Audio In, so we mute it on Ext. & Int. + * The PCB can take a sbx1637/sbx1673, wiring unknown. + * This card lacks PCI subsystem ID, sigh. + * audiomux=1: lower volume, 2+3: mute + * btwincap uses 0x80000/0x80003 + */ + .needs_tvaudio = 0, + .no_msp34xx = 1, + .pll = PLL_28, + .tuner_type = 5, + .tuner_addr = ADDR_UNSET, + /* Samsung TCPA9095PC27A (BG+DK), philips compatible, w/FM, stereo and + radio signal strength indicators work fine. */ + .has_radio = 1, + /* GPIO Info: + GPIO0,1: HEF4052 A0,A1 + GPIO2: HEF4052 nENABLE + GPIO3-7: n.c. + GPIO8-13: IRDC357 data0-5 (data6 n.c. ?) [chip not present on my card] + GPIO14,15: ?? + GPIO16-21: n.c. + GPIO22,23: ?? + ?? : mtu8b56ep microcontroller for IR (GPIO wiring unknown)*/ + }, + [BTTV_DSP_TCVIDEO] = { + /* Arthur Tetzlaff-Deas, DSP Design Ltd */ + .name = "DSP Design TCVIDEO", + .video_inputs = 4, + .svhs = -1, + .muxsel = { 2, 3, 1, 0}, + .pll = PLL_28, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + }, + + /* ---- card 0x50 ---------------------------------- */ + [BTTV_HAUPPAUGEPVR] = { + .name = "Hauppauge WinTV PVR", + .video_inputs = 4, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .muxsel = { 2, 0, 1, 1}, + .needs_tvaudio = 1, + .pll = PLL_28, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + + .gpiomask = 7, + .audiomux = {7}, + }, + [BTTV_GVBCTV5PCI] = { + .name = "IODATA GV-BCTV5/PCI", + .video_inputs = 3, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 0x0f0f80, + .muxsel = {2, 3, 1, 0}, + .audiomux = {0x030000, 0x010000, 0, 0, 0x020000, 0}, + .no_msp34xx = 1, + .pll = PLL_28, + .tuner_type = TUNER_PHILIPS_NTSC_M, + .tuner_addr = ADDR_UNSET, + .audio_hook = gvbctv5pci_audio, + .has_radio = 1, + }, + [BTTV_OSPREY1x0] = { + .name = "Osprey 100/150 (878)", /* 0x1(2|3)-45C6-C1 */ + .video_inputs = 4, /* id-inputs-clock */ + .audio_inputs = 0, + .tuner = -1, + .svhs = 3, + .muxsel = { 3, 2, 0, 1 }, + .pll = PLL_28, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + .no_msp34xx = 1, + .no_tda9875 = 1, + .no_tda7432 = 1, + }, + [BTTV_OSPREY1x0_848] = { + .name = "Osprey 100/150 (848)", /* 0x04-54C0-C1 & older boards */ + .video_inputs = 3, + .audio_inputs = 0, + .tuner = -1, + .svhs = 2, + .muxsel = { 2, 3, 1 }, + .pll = PLL_28, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + .no_msp34xx = 1, + .no_tda9875 = 1, + .no_tda7432 = 1, + }, + + /* ---- card 0x54 ---------------------------------- */ + [BTTV_OSPREY101_848] = { + .name = "Osprey 101 (848)", /* 0x05-40C0-C1 */ + .video_inputs = 2, + .audio_inputs = 0, + .tuner = -1, + .svhs = 1, + .muxsel = { 3, 1 }, + .pll = PLL_28, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + .no_msp34xx = 1, + .no_tda9875 = 1, + .no_tda7432 = 1, + }, + [BTTV_OSPREY1x1] = { + .name = "Osprey 101/151", /* 0x1(4|5)-0004-C4 */ + .video_inputs = 1, + .audio_inputs = 0, + .tuner = -1, + .svhs = -1, + .muxsel = { 0 }, + .pll = PLL_28, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + .no_msp34xx = 1, + .no_tda9875 = 1, + .no_tda7432 = 1, + }, + [BTTV_OSPREY1x1_SVID] = { + .name = "Osprey 101/151 w/ svid", /* 0x(16|17|20)-00C4-C1 */ + .video_inputs = 2, + .audio_inputs = 0, + .tuner = -1, + .svhs = 1, + .muxsel = { 0, 1 }, + .pll = PLL_28, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + .no_msp34xx = 1, + .no_tda9875 = 1, + .no_tda7432 = 1, + }, + [BTTV_OSPREY2xx] = { + .name = "Osprey 200/201/250/251", /* 0x1(8|9|E|F)-0004-C4 */ + .video_inputs = 1, + .audio_inputs = 1, + .tuner = -1, + .svhs = -1, + .muxsel = { 0 }, + .pll = PLL_28, + .tuner_type = UNSET, + .tuner_addr = ADDR_UNSET, + .no_msp34xx = 1, + .no_tda9875 = 1, + .no_tda7432 = 1, + }, + + /* ---- card 0x58 ---------------------------------- */ + [BTTV_OSPREY2x0_SVID] = { + .name = "Osprey 200/250", /* 0x1(A|B)-00C4-C1 */ + .video_inputs = 2, + .audio_inputs = 1, + .tuner = -1, + .svhs = 1, + .muxsel = { 0, 1 }, + .pll = PLL_28, + .tuner_type = UNSET, + .tuner_addr = ADDR_UNSET, + .no_msp34xx = 1, + .no_tda9875 = 1, + .no_tda7432 = 1, + }, + [BTTV_OSPREY2x0] = { + .name = "Osprey 210/220", /* 0x1(A|B)-04C0-C1 */ + .video_inputs = 2, + .audio_inputs = 1, + .tuner = -1, + .svhs = 1, + .muxsel = { 2, 3 }, + .pll = PLL_28, + .tuner_type = UNSET, + .tuner_addr = ADDR_UNSET, + .no_msp34xx = 1, + .no_tda9875 = 1, + .no_tda7432 = 1, + }, + [BTTV_OSPREY500] = { + .name = "Osprey 500", /* 500 */ + .video_inputs = 2, + .audio_inputs = 1, + .tuner = -1, + .svhs = 1, + .muxsel = { 2, 3 }, + .pll = PLL_28, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + .no_msp34xx = 1, + .no_tda9875 = 1, + .no_tda7432 = 1, + }, + [BTTV_OSPREY540] = { + .name = "Osprey 540", /* 540 */ + .video_inputs = 4, + .audio_inputs = 1, + .tuner = -1, + #if 0 /* TODO ... */ + .svhs = OSPREY540_SVID_ANALOG, + .muxsel = { [OSPREY540_COMP_ANALOG] = 2, + [OSPREY540_SVID_ANALOG] = 3, }, + #endif + .pll = PLL_28, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + .no_msp34xx = 1, + .no_tda9875 = 1, + .no_tda7432 = 1, + #if 0 /* TODO ... */ + .muxsel_hook = osprey_540_muxsel, + .picture_hook = osprey_540_set_picture, + #endif + }, + + /* ---- card 0x5C ---------------------------------- */ + [BTTV_OSPREY2000] = { + .name = "Osprey 2000", /* 2000 */ + .video_inputs = 2, + .audio_inputs = 1, + .tuner = -1, + .svhs = 1, + .muxsel = { 2, 3 }, + .pll = PLL_28, + .tuner_type = UNSET, + .tuner_addr = ADDR_UNSET, + .no_msp34xx = 1, + .no_tda9875 = 1, + .no_tda7432 = 1, /* must avoid, conflicts with the bt860 */ + }, + [BTTV_IDS_EAGLE] = { + /* M G Berberich */ + .name = "IDS Eagle", + .video_inputs = 4, + .audio_inputs = 0, + .tuner = -1, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + .svhs = -1, + .gpiomask = 0, + .muxsel = { 0, 1, 2, 3 }, + .muxsel_hook = eagle_muxsel, + .no_msp34xx = 1, + .no_tda9875 = 1, + .pll = PLL_28, + }, + [BTTV_PINNACLESAT] = { + .name = "Pinnacle PCTV Sat", + .video_inputs = 2, + .audio_inputs = 0, + .svhs = 1, + .tuner = -1, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + .no_msp34xx = 1, + .no_tda9875 = 1, + .no_tda7432 = 1, + .muxsel = { 3, 0, 1, 2}, + .pll = PLL_28, + .no_gpioirq = 1, + .has_dvb = 1, + }, + [BTTV_FORMAC_PROTV] = { + .name = "Formac ProTV II (bt878)", + .video_inputs = 4, + .audio_inputs = 1, + .tuner = 0, + .svhs = 3, + .gpiomask = 2, + /* TV, Comp1, Composite over SVID con, SVID */ + .muxsel = { 2, 3, 1, 1}, + .audiomux = { 2, 2, 0, 0, 0 }, + .pll = PLL_28, + .has_radio = 1, + .tuner_type = TUNER_PHILIPS_PAL, + .tuner_addr = ADDR_UNSET, + /* sound routing: + GPIO=0x00,0x01,0x03: mute (?) + 0x02: both TV and radio (tuner: FM1216/I) + The card has onboard audio connectors labeled "cdrom" and "board", + not soldered here, though unknown wiring. + Card lacks: external audio in, pci subsystem id. */ - .name = "Kodicom 4400R (slave)", - .video_inputs = 16, - .audio_inputs = 0, - .tuner = -1, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, - .svhs = -1, - .gpiomask = 0x010000, - .no_gpioirq = 1, - .muxsel = { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, - .pll = PLL_28, - .no_msp34xx = 1, - .no_tda7432 = 1, - .no_tda9875 = 1, - .muxsel_hook = kodicom4400r_muxsel, -}, -{ - /* ---- card 0x86---------------------------------- */ - /* Michael Henson */ - /* Adlink RTV24 with special unlock codes */ - .name = "Adlink RTV24", - .video_inputs = 4, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .muxsel = { 2, 3, 1, 0}, - .tuner_type = -1, - .tuner_addr = ADDR_UNSET, - .pll = PLL_28, -}, -{ - /* ---- card 0x87---------------------------------- */ - /* Michael Krufky */ - .name = "DViCO FusionHDTV 5 Lite", - .tuner = 0, - .tuner_type = TUNER_LG_TDVS_H062F, - .tuner_addr = ADDR_UNSET, - .video_inputs = 3, - .audio_inputs = 1, - .svhs = 2, - .muxsel = { 2, 3, 1 }, - .gpiomask = 0x00e00007, - .audiomux = { 0x00400005, 0, 0x00000001, 0, 0x00c00007, 0 }, - .no_msp34xx = 1, - .no_tda9875 = 1, - .no_tda7432 = 1, - .has_dvb = 1, -},{ - /* ---- card 0x88---------------------------------- */ - /* Mauro Carvalho Chehab */ - .name = "Acorp Y878F", - .video_inputs = 3, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 0x01fe00, - .muxsel = { 2, 3, 1, 1}, - .audiomux = { 0x001e00, 0, 0x018000, 0x014000, 0x002000, 0 }, - .needs_tvaudio = 1, - .pll = PLL_28, - .tuner_type = TUNER_YMEC_TVF66T5_B_DFF, - .tuner_addr = 0xc1 >>1, - .has_radio = 1, -},{ - /* ---- card 0x89 ---------------------------------- */ - .name = "Conceptronic CTVFMi v2", - .video_inputs = 3, - .audio_inputs = 1, - .tuner = 0, - .svhs = 2, - .gpiomask = 0x001c0007, - .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 0, 1, 2, 2, 3 }, - .needs_tvaudio = 0, - .pll = PLL_28, - .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, - .tuner_addr = ADDR_UNSET, - .has_remote = 1, -},{ - .name = "Prolink Pixelview PV-BT878P+ (Rev.2E)", - .video_inputs = 5, - .audio_inputs = 1, - .tuner = 0, - .svhs = 3, - .gpiomask = 0x01fe00, - .muxsel = { 2,3,1,1,-1 }, - .digital_mode = DIGITAL_MODE_CAMERA, - .audiomux = { 0x00400, 0x10400, 0x04400, 0x80000, 0x12400, 0x46000 }, - .no_msp34xx = 1, - .pll = PLL_28, - .tuner_type = TUNER_LG_PAL_FM, - .has_remote = 1, -}}; + }, + + /* ---- card 0x60 ---------------------------------- */ + [BTTV_MACHTV] = { + .name = "MachTV", + .video_inputs = 3, + .audio_inputs = 1, + .tuner = 0, + .svhs = -1, + .gpiomask = 7, + .muxsel = { 2, 3, 1, 1}, + .audiomux = { 0, 1, 2, 3, 4}, + .needs_tvaudio = 1, + .tuner_type = 5, + .tuner_addr = ADDR_UNSET, + .pll = 1, + }, + [BTTV_EURESYS_PICOLO] = { + .name = "Euresys Picolo", + .video_inputs = 3, + .audio_inputs = 0, + .tuner = -1, + .svhs = 2, + .gpiomask = 0, + .no_msp34xx = 1, + .no_tda9875 = 1, + .no_tda7432 = 1, + .muxsel = { 2, 0, 1}, + .pll = PLL_28, + .tuner_type = UNSET, + .tuner_addr = ADDR_UNSET, + }, + [BTTV_PV150] = { + /* Luc Van Hoeylandt */ + .name = "ProVideo PV150", /* 0x4f */ + .video_inputs = 2, + .audio_inputs = 0, + .tuner = -1, + .svhs = -1, + .gpiomask = 0, + .muxsel = { 2, 3 }, + .audiomux = { 0 }, + .needs_tvaudio = 0, + .no_msp34xx = 1, + .pll = PLL_28, + .tuner_type = UNSET, + .tuner_addr = ADDR_UNSET, + }, + [BTTV_AD_TVK503] = { + /* Hiroshi Takekawa */ + /* This card lacks subsystem ID */ + .name = "AD-TVK503", /* 0x63 */ + .video_inputs = 4, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 0x001e8007, + .muxsel = { 2, 3, 1, 0 }, + /* Tuner, Radio, external, internal, off, on */ + .audiomux = { 0x08, 0x0f, 0x0a, 0x08, 0x0f, 0x08 }, + .needs_tvaudio = 0, + .no_msp34xx = 1, + .pll = PLL_28, + .tuner_type = 2, + .tuner_addr = ADDR_UNSET, + .audio_hook = adtvk503_audio, + }, + + /* ---- card 0x64 ---------------------------------- */ + [BTTV_HERCULES_SM_TV] = { + .name = "Hercules Smart TV Stereo", + .video_inputs = 4, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 0x00, + .muxsel = { 2, 3, 1, 1 }, + .needs_tvaudio = 1, + .no_msp34xx = 1, + .pll = PLL_28, + .tuner_type = 5, + .tuner_addr = ADDR_UNSET, + /* Notes: + - card lacks subsystem ID + - stereo variant w/ daughter board with tda9874a @0xb0 + - Audio Routing: + always from tda9874 independent of GPIO (?) + external line in: unknown + - Other chips: em78p156elp @ 0x96 (probably IR remote control) + hef4053 (instead 4052) for unknown function + */ + }, + [BTTV_PACETV] = { + .name = "Pace TV & Radio Card", + .video_inputs = 4, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .muxsel = { 2, 3, 1, 1}, /* Tuner, CVid, SVid, CVid over SVid connector */ + .gpiomask = 0, + .no_tda9875 = 1, + .no_tda7432 = 1, + .tuner_type = 1, + .tuner_addr = ADDR_UNSET, + .has_radio = 1, + .pll = PLL_28, + /* Bt878, Bt832, FI1246 tuner; no pci subsystem id + only internal line out: (4pin header) RGGL + Radio must be decoded by msp3410d (not routed through)*/ + /* + .digital_mode = DIGITAL_MODE_CAMERA, todo! + */ + }, + [BTTV_IVC200] = { + /* Chris Willing */ + .name = "IVC-200", + .video_inputs = 1, + .audio_inputs = 0, + .tuner = -1, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + .svhs = -1, + .gpiomask = 0xdf, + .muxsel = { 2 }, + .pll = PLL_28, + }, + [BTTV_XGUARD] = { + .name = "Grand X-Guard / Trust 814PCI", + .video_inputs = 16, + .audio_inputs = 0, + .tuner = -1, + .svhs = -1, + .tuner_type = 4, + .tuner_addr = ADDR_UNSET, + .gpiomask2 = 0xff, + .muxsel = { 2,2,2,2, 3,3,3,3, 1,1,1,1, 0,0,0,0 }, + .muxsel_hook = xguard_muxsel, + .no_msp34xx = 1, + .no_tda9875 = 1, + .no_tda7432 = 1, + .pll = PLL_28, + }, + + /* ---- card 0x68 ---------------------------------- */ + [BTTV_NEBULA_DIGITV] = { + .name = "Nebula Electronics DigiTV", + .video_inputs = 1, + .tuner = -1, + .svhs = -1, + .muxsel = { 2, 3, 1, 0}, + .no_msp34xx = 1, + .no_tda9875 = 1, + .no_tda7432 = 1, + .pll = PLL_28, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + .has_dvb = 1, + .no_gpioirq = 1, + }, + [BTTV_PV143] = { + /* Jorge Boncompte - DTI2 */ + .name = "ProVideo PV143", + .video_inputs = 4, + .audio_inputs = 0, + .tuner = -1, + .svhs = -1, + .gpiomask = 0, + .muxsel = { 2, 3, 1, 0 }, + .audiomux = { 0 }, + .needs_tvaudio = 0, + .no_msp34xx = 1, + .pll = PLL_28, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + }, + [BTTV_VD009X1_MINIDIN] = { + /* M.Klahr@phytec.de */ + .name = "PHYTEC VD-009-X1 MiniDIN (bt878)", + .video_inputs = 4, + .audio_inputs = 0, + .tuner = -1, /* card has no tuner */ + .svhs = 3, + .gpiomask = 0x00, + .muxsel = { 2, 3, 1, 0}, + .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */ + .needs_tvaudio = 1, + .pll = PLL_28, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + }, + [BTTV_VD009X1_COMBI] = { + .name = "PHYTEC VD-009-X1 Combi (bt878)", + .video_inputs = 4, + .audio_inputs = 0, + .tuner = -1, /* card has no tuner */ + .svhs = 3, + .gpiomask = 0x00, + .muxsel = { 2, 3, 1, 1}, + .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */ + .needs_tvaudio = 1, + .pll = PLL_28, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + }, + + /* ---- card 0x6c ---------------------------------- */ + [BTTV_VD009_MINIDIN] = { + .name = "PHYTEC VD-009 MiniDIN (bt878)", + .video_inputs = 10, + .audio_inputs = 0, + .tuner = -1, /* card has no tuner */ + .svhs = 9, + .gpiomask = 0x00, + .gpiomask2 = 0x03, /* gpiomask2 defines the bits used to switch audio + via the upper nibble of muxsel. here: used for + xternal video-mux */ + .muxsel = { 0x02, 0x12, 0x22, 0x32, 0x03, 0x13, 0x23, 0x33, 0x01, 0x00 }, + .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */ + .needs_tvaudio = 1, + .pll = PLL_28, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + }, + [BTTV_VD009_COMBI] = { + .name = "PHYTEC VD-009 Combi (bt878)", + .video_inputs = 10, + .audio_inputs = 0, + .tuner = -1, /* card has no tuner */ + .svhs = 9, + .gpiomask = 0x00, + .gpiomask2 = 0x03, /* gpiomask2 defines the bits used to switch audio + via the upper nibble of muxsel. here: used for + xternal video-mux */ + .muxsel = { 0x02, 0x12, 0x22, 0x32, 0x03, 0x13, 0x23, 0x33, 0x01, 0x01 }, + .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */ + .needs_tvaudio = 1, + .pll = PLL_28, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + }, + [BTTV_IVC100] = { + .name = "IVC-100", + .video_inputs = 4, + .audio_inputs = 0, + .tuner = -1, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + .svhs = -1, + .gpiomask = 0xdf, + .muxsel = { 2, 3, 1, 0 }, + .pll = PLL_28, + }, + [BTTV_IVC120] = { + /* IVC-120G - Alan Garfield */ + .name = "IVC-120G", + .video_inputs = 16, + .audio_inputs = 0, /* card has no audio */ + .tuner = -1, /* card has no tuner */ + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + .svhs = -1, /* card has no svhs */ + .needs_tvaudio = 0, + .no_msp34xx = 1, + .no_tda9875 = 1, + .no_tda7432 = 1, + .gpiomask = 0x00, + .muxsel = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10 }, + .muxsel_hook = ivc120_muxsel, + .pll = PLL_28, + }, + + /* ---- card 0x70 ---------------------------------- */ + [BTTV_PC_HDTV] = { + .name = "pcHDTV HD-2000 TV", + .video_inputs = 4, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .muxsel = { 2, 3, 1, 0}, + .tuner_type = TUNER_PHILIPS_ATSC, + .tuner_addr = ADDR_UNSET, + .has_dvb = 1, + }, + [BTTV_TWINHAN_DST] = { + .name = "Twinhan DST + clones", + .no_msp34xx = 1, + .no_tda9875 = 1, + .no_tda7432 = 1, + .tuner_type = TUNER_ABSENT, + .tuner_addr = ADDR_UNSET, + .no_video = 1, + .has_dvb = 1, + }, + [BTTV_WINFASTVC100] = { + .name = "Winfast VC100", + .video_inputs = 3, + .audio_inputs = 0, + .svhs = 1, + .tuner = -1, + .muxsel = { 3, 1, 1, 3}, /* Vid In, SVid In, Vid over SVid in connector */ + .no_msp34xx = 1, + .no_tda9875 = 1, + .no_tda7432 = 1, + .tuner_type = TUNER_ABSENT, + .tuner_addr = ADDR_UNSET, + .pll = PLL_28, + }, + [BTTV_TEV560] = { + .name = "Teppro TEV-560/InterVision IV-560", + .video_inputs = 3, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 3, + .muxsel = { 2, 3, 1, 1}, + .audiomux = { 1, 1, 1, 1, 0}, + .needs_tvaudio = 1, + .tuner_type = TUNER_PHILIPS_PAL, + .tuner_addr = ADDR_UNSET, + .pll = PLL_35, + }, + + /* ---- card 0x74 ---------------------------------- */ + [BTTV_SIMUS_GVC1100] = { + .name = "SIMUS GVC1100", + .video_inputs = 4, + .audio_inputs = 0, + .tuner = -1, + .svhs = -1, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + .pll = PLL_28, + .muxsel = { 2, 2, 2, 2}, + .gpiomask = 0x3F, + .muxsel_hook = gvc1100_muxsel, + }, + [BTTV_NGSTV_PLUS] = { + /* Carlos Silva r3pek@r3pek.homelinux.org || card 0x75 */ + .name = "NGS NGSTV+", + .video_inputs = 3, + .tuner = 0, + .svhs = 2, + .gpiomask = 0x008007, + .muxsel = {2, 3, 0, 0}, + .audiomux = {0, 0, 0, 0, 0x000003, 0}, + .pll = PLL_28, + .tuner_type = TUNER_PHILIPS_PAL, + .tuner_addr = ADDR_UNSET, + .has_remote = 1, + }, + [BTTV_LMLBT4] = { + /* http://linuxmedialabs.com */ + .name = "LMLBT4", + .video_inputs = 4, /* IN1,IN2,IN3,IN4 */ + .audio_inputs = 0, + .tuner = -1, + .svhs = -1, + .muxsel = { 2, 3, 1, 0 }, + .no_msp34xx = 1, + .no_tda9875 = 1, + .no_tda7432 = 1, + .needs_tvaudio = 0, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + }, + [BTTV_TEKRAM_M205] = { + /* Helmroos Harri */ + .name = "Tekram M205 PRO", + .video_inputs = 3, + .audio_inputs = 1, + .tuner = 0, + .tuner_type = TUNER_PHILIPS_PAL, + .tuner_addr = ADDR_UNSET, + .svhs = 2, + .needs_tvaudio = 0, + .gpiomask = 0x68, + .muxsel = { 2, 3, 1}, + .audiomux = { 0x68, 0x68, 0x61, 0x61, 0x00 }, + .pll = PLL_28, + }, + + /* ---- card 0x78 ---------------------------------- */ + [BTTV_CONTVFMI] = { + /* Javier Cendan Ares */ + /* bt878 TV + FM without subsystem ID */ + .name = "Conceptronic CONTVFMi", + .video_inputs = 3, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 0x008007, + .muxsel = { 2, 3, 1, 1 }, + .audiomux = { 0, 1, 2, 2, 3 }, + .needs_tvaudio = 0, + .pll = PLL_28, + .tuner_type = TUNER_PHILIPS_PAL, + .tuner_addr = ADDR_UNSET, + .has_remote = 1, + .has_radio = 1, + }, + [BTTV_PICOLO_TETRA_CHIP] = { + /*Eric DEBIEF */ + /*EURESYS Picolo Tetra : 4 Conexant Fusion 878A, no audio, video input set with analog multiplexers GPIO controled*/ + /* adds picolo_tetra_muxsel(), picolo_tetra_init(), the folowing declaration strucure, and #define BTTV_PICOLO_TETRA_CHIP*/ + /*0x79 in bttv.h*/ + .name = "Euresys Picolo Tetra", + .video_inputs = 4, + .audio_inputs = 0, + .tuner = -1, + .svhs = -1, + .gpiomask = 0, + .gpiomask2 = 0x3C<<16,/*Set the GPIO[18]->GPIO[21] as output pin.==> drive the video inputs through analog multiplexers*/ + .no_msp34xx = 1, + .no_tda9875 = 1, + .no_tda7432 = 1, + .muxsel = {2,2,2,2},/*878A input is always MUX0, see above.*/ + .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */ + .pll = PLL_28, + .needs_tvaudio = 0, + .muxsel_hook = picolo_tetra_muxsel,/*Required as it doesn't follow the classic input selection policy*/ + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + }, + [BTTV_SPIRIT_TV] = { + /* Spirit TV Tuner from http://spiritmodems.com.au */ + /* Stafford Goodsell */ + .name = "Spirit TV Tuner", + .video_inputs = 3, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 0x0000000f, + .muxsel = { 2, 1, 1 }, + .audiomux = { 0x02, 0x00, 0x00, 0x00, 0x00}, + .tuner_type = TUNER_TEMIC_PAL, + .tuner_addr = ADDR_UNSET, + .no_msp34xx = 1, + .no_tda9875 = 1, + }, + [BTTV_AVDVBT_771] = { + /* Wolfram Joost */ + .name = "AVerMedia AVerTV DVB-T 771", + .video_inputs = 2, + .svhs = 1, + .tuner = -1, + .tuner_type = TUNER_ABSENT, + .tuner_addr = ADDR_UNSET, + .muxsel = { 3 , 3 }, + .no_msp34xx = 1, + .no_tda9875 = 1, + .no_tda7432 = 1, + .pll = PLL_28, + .has_dvb = 1, + .no_gpioirq = 1, + .has_remote = 1, + }, + /* ---- card 0x7c ---------------------------------- */ + [BTTV_AVDVBT_761] = { + /* Matt Jesson */ + /* Based on the Nebula card data - added remote and new card number - BTTV_AVDVBT_761, see also ir-kbd-gpio.c */ + .name = "AverMedia AverTV DVB-T 761", + .video_inputs = 2, + .tuner = -1, + .svhs = 1, + .muxsel = { 3, 1, 2, 0}, /* Comp0, S-Video, ?, ? */ + .no_msp34xx = 1, + .no_tda9875 = 1, + .no_tda7432 = 1, + .pll = PLL_28, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + .has_dvb = 1, + .no_gpioirq = 1, + .has_remote = 1, + }, + [BTTV_MATRIX_VISIONSQ] = { + /* andre.schwarz@matrix-vision.de */ + .name = "MATRIX Vision Sigma-SQ", + .video_inputs = 16, + .audio_inputs = 0, + .tuner = -1, + .svhs = -1, + .gpiomask = 0x0, + .muxsel = { 2, 2, 2, 2, 2, 2, 2, 2, + 3, 3, 3, 3, 3, 3, 3, 3 }, + .muxsel_hook = sigmaSQ_muxsel, + .audiomux = { 0 }, + .no_msp34xx = 1, + .pll = PLL_28, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + }, + [BTTV_MATRIX_VISIONSLC] = { + /* andre.schwarz@matrix-vision.de */ + .name = "MATRIX Vision Sigma-SLC", + .video_inputs = 4, + .audio_inputs = 0, + .tuner = -1, + .svhs = -1, + .gpiomask = 0x0, + .muxsel = { 2, 2, 2, 2 }, + .muxsel_hook = sigmaSLC_muxsel, + .audiomux = { 0 }, + .no_msp34xx = 1, + .pll = PLL_28, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + }, + /* BTTV_APAC_VIEWCOMP */ + [BTTV_APAC_VIEWCOMP] = { + /* Attila Kondoros */ + /* bt878 TV + FM 0x00000000 subsystem ID */ + .name = "APAC Viewcomp 878(AMAX)", + .video_inputs = 2, + .audio_inputs = 1, + .tuner = 0, + .svhs = -1, + .gpiomask = 0xFF, + .muxsel = { 2, 3, 1, 1}, + .audiomux = { 2, 0, 0, 0, 10}, + .needs_tvaudio = 0, + .pll = PLL_28, + .tuner_type = TUNER_PHILIPS_PAL, + .tuner_addr = ADDR_UNSET, + .has_remote = 1, /* miniremote works, see ir-kbd-gpio.c */ + .has_radio = 1, /* not every card has radio */ + }, + + /* ---- card 0x80 ---------------------------------- */ + [BTTV_DVICO_DVBT_LITE] = { + /* Chris Pascoe */ + .name = "DViCO FusionHDTV DVB-T Lite", + .tuner = -1, + .no_msp34xx = 1, + .no_tda9875 = 1, + .no_tda7432 = 1, + .pll = PLL_28, + .no_video = 1, + .has_dvb = 1, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + }, + [BTTV_VGEAR_MYVCD] = { + /* Steven */ + .name = "V-Gear MyVCD", + .video_inputs = 3, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 0x3f, + .muxsel = {2, 3, 1, 0}, + .audiomux = {0x31, 0x31, 0x31, 0x31, 0x31, 0x31}, + .no_msp34xx = 1, + .pll = PLL_28, + .tuner_type = TUNER_PHILIPS_NTSC_M, + .tuner_addr = ADDR_UNSET, + .has_radio = 0, + #if 0 + .has_remote = 1, + #endif + }, + [BTTV_SUPER_TV] = { + /* Rick C */ + .name = "Super TV Tuner", + .video_inputs = 4, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .muxsel = { 2, 3, 1, 0}, + .tuner_type = TUNER_PHILIPS_NTSC, + .tuner_addr = ADDR_UNSET, + .gpiomask = 0x008007, + .audiomux = { 0, 0x000001,0,0, 0}, + .needs_tvaudio = 1, + .has_radio = 1, + }, + [BTTV_TIBET_CS16] = { + /* Chris Fanning */ + .name = "Tibet Systems 'Progress DVR' CS16", + .video_inputs = 16, + .audio_inputs = 0, + .tuner = -1, + .svhs = -1, + .muxsel = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }, + .pll = PLL_28, + .no_msp34xx = 1, + .no_tda9875 = 1, + .no_tda7432 = 1, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + .muxsel_hook = tibetCS16_muxsel, + }, + { + /* Bill Brack */ + /* + * Note that, because of the card's wiring, the "master" + * BT878A chip (i.e. the one which controls the analog switch + * and must use this card type) is the 2nd one detected. The + * other 3 chips should use card type 0x85, whose description + * follows this one. There is a EEPROM on the card (which is + * connected to the I2C of one of those other chips), but is + * not currently handled. There is also a facility for a + * "monitor", which is also not currently implemented. + */ + .name = "Kodicom 4400R (master)", + .video_inputs = 16, + .audio_inputs = 0, + .tuner = -1, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + .svhs = -1, + /* GPIO bits 0-9 used for analog switch: + * 00 - 03: camera selector + * 04 - 06: channel (controller) selector + * 07: data (1->on, 0->off) + * 08: strobe + * 09: reset + * bit 16 is input from sync separator for the channel + */ + .gpiomask = 0x0003ff, + .no_gpioirq = 1, + .muxsel = { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, + .pll = PLL_28, + .no_msp34xx = 1, + .no_tda7432 = 1, + .no_tda9875 = 1, + .muxsel_hook = kodicom4400r_muxsel, + }, + { + /* Bill Brack */ + /* Note that, for reasons unknown, the "master" BT878A chip (i.e. the + * one which controls the analog switch, and must use the card type) + * is the 2nd one detected. The other 3 chips should use this card + * type + */ + .name = "Kodicom 4400R (slave)", + .video_inputs = 16, + .audio_inputs = 0, + .tuner = -1, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + .svhs = -1, + .gpiomask = 0x010000, + .no_gpioirq = 1, + .muxsel = { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, + .pll = PLL_28, + .no_msp34xx = 1, + .no_tda7432 = 1, + .no_tda9875 = 1, + .muxsel_hook = kodicom4400r_muxsel, + }, + { + /* ---- card 0x86---------------------------------- */ + /* Michael Henson */ + /* Adlink RTV24 with special unlock codes */ + .name = "Adlink RTV24", + .video_inputs = 4, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .muxsel = { 2, 3, 1, 0}, + .tuner_type = -1, + .tuner_addr = ADDR_UNSET, + .pll = PLL_28, + }, + { + /* ---- card 0x87---------------------------------- */ + /* Michael Krufky */ + .name = "DViCO FusionHDTV 5 Lite", + .tuner = 0, + .tuner_type = TUNER_LG_TDVS_H062F, + .tuner_addr = ADDR_UNSET, + .video_inputs = 2, + .audio_inputs = 1, + .svhs = 2, + .muxsel = { 2, 3 }, + .gpiomask = 0x00e00007, + .audiomux = { 0x00400005, 0, 0x00000001, 0, 0x00c00007, 0 }, + .no_msp34xx = 1, + .no_tda9875 = 1, + .no_tda7432 = 1, + .has_dvb = 1, + }, + /* ---- card 0x88---------------------------------- */ + [BTTV_KODICOM_4400R] = { + /* Mauro Carvalho Chehab */ + .name = "Acorp Y878F", + .video_inputs = 3, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 0x01fe00, + .muxsel = { 2, 3, 1, 1}, + .audiomux = { 0x001e00, 0, 0x018000, 0x014000, 0x002000, 0 }, + .needs_tvaudio = 1, + .pll = PLL_28, + .tuner_type = TUNER_YMEC_TVF66T5_B_DFF, + .tuner_addr = 0xc1 >>1, + .has_radio = 1, + }, + /* ---- card 0x89 ---------------------------------- */ + [BTTV_KODICOM_4400R_SL] = { + .name = "Conceptronic CTVFMi v2", + .video_inputs = 3, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 0x001c0007, + .muxsel = { 2, 3, 1, 1 }, + .audiomux = { 0, 1, 2, 2, 3 }, + .needs_tvaudio = 0, + .pll = PLL_28, + .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, + .tuner_addr = ADDR_UNSET, + .has_remote = 1, + #if 0 + .has_radio = 1, + #endif + }, + [BTTV_ADLINK_RTV24] = { + .name = "Prolink Pixelview PV-BT878P+ (Rev.2E)", + .video_inputs = 5, + .audio_inputs = 1, + .tuner = 0, + .svhs = 3, + .gpiomask = 0x01fe00, + .muxsel = { 2,3,1,1,-1 }, + .digital_mode = DIGITAL_MODE_CAMERA, + .audiomux = { 0x00400, 0x10400, 0x04400, 0x80000, 0x12400, 0x46000 }, + .no_msp34xx = 1, + .pll = PLL_28, + .tuner_type = TUNER_LG_PAL_FM, + .has_remote = 1, + } +}; static const unsigned int bttv_num_tvcards = ARRAY_SIZE(bttv_tvcards); @@ -4513,8 +4673,7 @@ void __devinit bttv_check_chipset(void) } if (UNSET != latency) printk(KERN_INFO "bttv: pci latency fixup [%d]\n",latency); - - while ((dev = pci_find_device(PCI_VENDOR_ID_INTEL, + while ((dev = pci_get_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82441, dev))) { unsigned char b; pci_read_config_byte(dev, 0x53, &b); -- cgit v1.2.2 From 5a25e84b3ca053f240dc8fa3320bc843a0a394f5 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:36:52 -0800 Subject: [PATCH] vl4: 693: bttv board renaming - Boards renamed to BTTV_BOARD_xxx Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/bttv-cards.c | 737 +++++++++++++++++++------------------- drivers/media/video/bttv-driver.c | 4 +- drivers/media/video/bttv.h | 259 ++++++++------ drivers/media/video/ir-kbd-gpio.c | 26 +- 4 files changed, 523 insertions(+), 503 deletions(-) diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bttv-cards.c index 12f38e8cd0a4..1553d4a1c20b 100644 --- a/drivers/media/video/bttv-cards.c +++ b/drivers/media/video/bttv-cards.c @@ -145,162 +145,162 @@ static struct CARD { int cardnr; char *name; } cards[] __devinitdata = { - { 0x13eb0070, BTTV_HAUPPAUGE878, "Hauppauge WinTV" }, - { 0x39000070, BTTV_HAUPPAUGE878, "Hauppauge WinTV-D" }, - { 0x45000070, BTTV_HAUPPAUGEPVR, "Hauppauge WinTV/PVR" }, - { 0xff000070, BTTV_OSPREY1x0, "Osprey-100" }, - { 0xff010070, BTTV_OSPREY2x0_SVID,"Osprey-200" }, - { 0xff020070, BTTV_OSPREY500, "Osprey-500" }, - { 0xff030070, BTTV_OSPREY2000, "Osprey-2000" }, - { 0xff040070, BTTV_OSPREY540, "Osprey-540" }, - - { 0x00011002, BTTV_ATI_TVWONDER, "ATI TV Wonder" }, - { 0x00031002, BTTV_ATI_TVWONDERVE,"ATI TV Wonder/VE" }, - - { 0x6606107d, BTTV_WINFAST2000, "Leadtek WinFast TV 2000" }, - { 0x6607107d, BTTV_WINFASTVC100, "Leadtek WinFast VC 100" }, - { 0x6609107d, BTTV_WINFAST2000, "Leadtek TV 2000 XP" }, - { 0x263610b4, BTTV_STB2, "STB TV PCI FM, Gateway P/N 6000704" }, - { 0x264510b4, BTTV_STB2, "STB TV PCI FM, Gateway P/N 6000704" }, - { 0x402010fc, BTTV_GVBCTV3PCI, "I-O Data Co. GV-BCTV3/PCI" }, - { 0x405010fc, BTTV_GVBCTV4PCI, "I-O Data Co. GV-BCTV4/PCI" }, - { 0x407010fc, BTTV_GVBCTV5PCI, "I-O Data Co. GV-BCTV5/PCI" }, - { 0xd01810fc, BTTV_GVBCTV5PCI, "I-O Data Co. GV-BCTV5/PCI" }, - - { 0x001211bd, BTTV_PINNACLE, "Pinnacle PCTV" }, + { 0x13eb0070, BTTV_BOARD_HAUPPAUGE878, "Hauppauge WinTV" }, + { 0x39000070, BTTV_BOARD_HAUPPAUGE878, "Hauppauge WinTV-D" }, + { 0x45000070, BTTV_BOARD_HAUPPAUGEPVR, "Hauppauge WinTV/PVR" }, + { 0xff000070, BTTV_BOARD_OSPREY1x0, "Osprey-100" }, + { 0xff010070, BTTV_BOARD_OSPREY2x0_SVID,"Osprey-200" }, + { 0xff020070, BTTV_BOARD_OSPREY500, "Osprey-500" }, + { 0xff030070, BTTV_BOARD_OSPREY2000, "Osprey-2000" }, + { 0xff040070, BTTV_BOARD_OSPREY540, "Osprey-540" }, + + { 0x00011002, BTTV_BOARD_ATI_TVWONDER, "ATI TV Wonder" }, + { 0x00031002, BTTV_BOARD_ATI_TVWONDERVE,"ATI TV Wonder/VE" }, + + { 0x6606107d, BTTV_BOARD_WINFAST2000, "Leadtek WinFast TV 2000" }, + { 0x6607107d, BTTV_BOARD_WINFASTVC100, "Leadtek WinFast VC 100" }, + { 0x6609107d, BTTV_BOARD_WINFAST2000, "Leadtek TV 2000 XP" }, + { 0x263610b4, BTTV_BOARD_STB2, "STB TV PCI FM, Gateway P/N 6000704" }, + { 0x264510b4, BTTV_BOARD_STB2, "STB TV PCI FM, Gateway P/N 6000704" }, + { 0x402010fc, BTTV_BOARD_GVBCTV3PCI, "I-O Data Co. GV-BCTV3/PCI" }, + { 0x405010fc, BTTV_BOARD_GVBCTV4PCI, "I-O Data Co. GV-BCTV4/PCI" }, + { 0x407010fc, BTTV_BOARD_GVBCTV5PCI, "I-O Data Co. GV-BCTV5/PCI" }, + { 0xd01810fc, BTTV_BOARD_GVBCTV5PCI, "I-O Data Co. GV-BCTV5/PCI" }, + + { 0x001211bd, BTTV_BOARD_PINNACLE, "Pinnacle PCTV" }, /* some cards ship with byteswapped IDs ... */ - { 0x1200bd11, BTTV_PINNACLE, "Pinnacle PCTV [bswap]" }, - { 0xff00bd11, BTTV_PINNACLE, "Pinnacle PCTV [bswap]" }, + { 0x1200bd11, BTTV_BOARD_PINNACLE, "Pinnacle PCTV [bswap]" }, + { 0xff00bd11, BTTV_BOARD_PINNACLE, "Pinnacle PCTV [bswap]" }, /* this seems to happen as well ... */ - { 0xff1211bd, BTTV_PINNACLE, "Pinnacle PCTV" }, - - { 0x3000121a, BTTV_VOODOOTV_FM, "3Dfx VoodooTV FM/ VoodooTV 200" }, - { 0x263710b4, BTTV_VOODOOTV_FM, "3Dfx VoodooTV FM/ VoodooTV 200" }, - { 0x3060121a, BTTV_STB2, "3Dfx VoodooTV 100/ STB OEM" }, - - { 0x3000144f, BTTV_MAGICTVIEW063, "(Askey Magic/others) TView99 CPH06x" }, - { 0xa005144f, BTTV_MAGICTVIEW063, "CPH06X TView99-Card" }, - { 0x3002144f, BTTV_MAGICTVIEW061, "(Askey Magic/others) TView99 CPH05x" }, - { 0x3005144f, BTTV_MAGICTVIEW061, "(Askey Magic/others) TView99 CPH061/06L (T1/LC)" }, - { 0x5000144f, BTTV_MAGICTVIEW061, "Askey CPH050" }, - { 0x300014ff, BTTV_MAGICTVIEW061, "TView 99 (CPH061)" }, - { 0x300214ff, BTTV_PHOEBE_TVMAS, "Phoebe TV Master (CPH060)" }, - - { 0x00011461, BTTV_AVPHONE98, "AVerMedia TVPhone98" }, - { 0x00021461, BTTV_AVERMEDIA98, "AVermedia TVCapture 98" }, - { 0x00031461, BTTV_AVPHONE98, "AVerMedia TVPhone98" }, - { 0x00041461, BTTV_AVERMEDIA98, "AVerMedia TVCapture 98" }, - { 0x03001461, BTTV_AVERMEDIA98, "VDOMATE TV TUNER CARD" }, - - { 0x1117153b, BTTV_TERRATVALUE, "Terratec TValue (Philips PAL B/G)" }, - { 0x1118153b, BTTV_TERRATVALUE, "Terratec TValue (Temic PAL B/G)" }, - { 0x1119153b, BTTV_TERRATVALUE, "Terratec TValue (Philips PAL I)" }, - { 0x111a153b, BTTV_TERRATVALUE, "Terratec TValue (Temic PAL I)" }, - - { 0x1123153b, BTTV_TERRATVRADIO, "Terratec TV Radio+" }, - { 0x1127153b, BTTV_TERRATV, "Terratec TV+ (V1.05)" }, + { 0xff1211bd, BTTV_BOARD_PINNACLE, "Pinnacle PCTV" }, + + { 0x3000121a, BTTV_BOARD_VOODOOTV_FM, "3Dfx VoodooTV FM/ VoodooTV 200" }, + { 0x263710b4, BTTV_BOARD_VOODOOTV_FM, "3Dfx VoodooTV FM/ VoodooTV 200" }, + { 0x3060121a, BTTV_BOARD_STB2, "3Dfx VoodooTV 100/ STB OEM" }, + + { 0x3000144f, BTTV_BOARD_MAGICTVIEW063, "(Askey Magic/others) TView99 CPH06x" }, + { 0xa005144f, BTTV_BOARD_MAGICTVIEW063, "CPH06X TView99-Card" }, + { 0x3002144f, BTTV_BOARD_MAGICTVIEW061, "(Askey Magic/others) TView99 CPH05x" }, + { 0x3005144f, BTTV_BOARD_MAGICTVIEW061, "(Askey Magic/others) TView99 CPH061/06L (T1/LC)" }, + { 0x5000144f, BTTV_BOARD_MAGICTVIEW061, "Askey CPH050" }, + { 0x300014ff, BTTV_BOARD_MAGICTVIEW061, "TView 99 (CPH061)" }, + { 0x300214ff, BTTV_BOARD_PHOEBE_TVMAS, "Phoebe TV Master (CPH060)" }, + + { 0x00011461, BTTV_BOARD_AVPHONE98, "AVerMedia TVPhone98" }, + { 0x00021461, BTTV_BOARD_AVERMEDIA98, "AVermedia TVCapture 98" }, + { 0x00031461, BTTV_BOARD_AVPHONE98, "AVerMedia TVPhone98" }, + { 0x00041461, BTTV_BOARD_AVERMEDIA98, "AVerMedia TVCapture 98" }, + { 0x03001461, BTTV_BOARD_AVERMEDIA98, "VDOMATE TV TUNER CARD" }, + + { 0x1117153b, BTTV_BOARD_TERRATVALUE, "Terratec TValue (Philips PAL B/G)" }, + { 0x1118153b, BTTV_BOARD_TERRATVALUE, "Terratec TValue (Temic PAL B/G)" }, + { 0x1119153b, BTTV_BOARD_TERRATVALUE, "Terratec TValue (Philips PAL I)" }, + { 0x111a153b, BTTV_BOARD_TERRATVALUE, "Terratec TValue (Temic PAL I)" }, + + { 0x1123153b, BTTV_BOARD_TERRATVRADIO, "Terratec TV Radio+" }, + { 0x1127153b, BTTV_BOARD_TERRATV, "Terratec TV+ (V1.05)" }, /* clashes with FlyVideo - *{ 0x18521852, BTTV_TERRATV, "Terratec TV+ (V1.10)" }, */ - { 0x1134153b, BTTV_TERRATVALUE, "Terratec TValue (LR102)" }, - { 0x1135153b, BTTV_TERRATVALUER, "Terratec TValue Radio" }, /* LR102 */ - { 0x5018153b, BTTV_TERRATVALUE, "Terratec TValue" }, /* ?? */ - { 0xff3b153b, BTTV_TERRATVALUER, "Terratec TValue Radio" }, /* ?? */ - - { 0x400015b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV" }, - { 0x400a15b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV" }, - { 0x400d15b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV / Radio" }, - { 0x401015b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV / Radio" }, - { 0x401615b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV / Radio" }, - - { 0x1430aa00, BTTV_PV143, "Provideo PV143A" }, - { 0x1431aa00, BTTV_PV143, "Provideo PV143B" }, - { 0x1432aa00, BTTV_PV143, "Provideo PV143C" }, - { 0x1433aa00, BTTV_PV143, "Provideo PV143D" }, - { 0x1433aa03, BTTV_PV143, "Security Eyes" }, - - { 0x1460aa00, BTTV_PV150, "Provideo PV150A-1" }, - { 0x1461aa01, BTTV_PV150, "Provideo PV150A-2" }, - { 0x1462aa02, BTTV_PV150, "Provideo PV150A-3" }, - { 0x1463aa03, BTTV_PV150, "Provideo PV150A-4" }, - - { 0x1464aa04, BTTV_PV150, "Provideo PV150B-1" }, - { 0x1465aa05, BTTV_PV150, "Provideo PV150B-2" }, - { 0x1466aa06, BTTV_PV150, "Provideo PV150B-3" }, - { 0x1467aa07, BTTV_PV150, "Provideo PV150B-4" }, - - { 0xa132ff00, BTTV_IVC100, "IVC-100" }, - { 0xa1550000, BTTV_IVC200, "IVC-200" }, - { 0xa1550001, BTTV_IVC200, "IVC-200" }, - { 0xa1550002, BTTV_IVC200, "IVC-200" }, - { 0xa1550003, BTTV_IVC200, "IVC-200" }, - { 0xa1550100, BTTV_IVC200, "IVC-200G" }, - { 0xa1550101, BTTV_IVC200, "IVC-200G" }, - { 0xa1550102, BTTV_IVC200, "IVC-200G" }, - { 0xa1550103, BTTV_IVC200, "IVC-200G" }, - { 0xa182ff00, BTTV_IVC120, "IVC-120G" }, - { 0xa182ff01, BTTV_IVC120, "IVC-120G" }, - { 0xa182ff02, BTTV_IVC120, "IVC-120G" }, - { 0xa182ff03, BTTV_IVC120, "IVC-120G" }, - { 0xa182ff04, BTTV_IVC120, "IVC-120G" }, - { 0xa182ff05, BTTV_IVC120, "IVC-120G" }, - { 0xa182ff06, BTTV_IVC120, "IVC-120G" }, - { 0xa182ff07, BTTV_IVC120, "IVC-120G" }, - { 0xa182ff08, BTTV_IVC120, "IVC-120G" }, - { 0xa182ff09, BTTV_IVC120, "IVC-120G" }, - { 0xa182ff0a, BTTV_IVC120, "IVC-120G" }, - { 0xa182ff0b, BTTV_IVC120, "IVC-120G" }, - { 0xa182ff0c, BTTV_IVC120, "IVC-120G" }, - { 0xa182ff0d, BTTV_IVC120, "IVC-120G" }, - { 0xa182ff0e, BTTV_IVC120, "IVC-120G" }, - { 0xa182ff0f, BTTV_IVC120, "IVC-120G" }, - - { 0x41424344, BTTV_GRANDTEC, "GrandTec Multi Capture" }, - { 0x01020304, BTTV_XGUARD, "Grandtec Grand X-Guard" }, - - { 0x18501851, BTTV_CHRONOS_VS2, "FlyVideo 98 (LR50)/ Chronos Video Shuttle II" }, - { 0xa0501851, BTTV_CHRONOS_VS2, "FlyVideo 98 (LR50)/ Chronos Video Shuttle II" }, - { 0x18511851, BTTV_FLYVIDEO98EZ, "FlyVideo 98EZ (LR51)/ CyberMail AV" }, - { 0x18521852, BTTV_TYPHOON_TVIEW, "FlyVideo 98FM (LR50)/ Typhoon TView TV/FM Tuner" }, - { 0x41a0a051, BTTV_FLYVIDEO_98FM, "Lifeview FlyVideo 98 LR50 Rev Q" }, - { 0x18501f7f, BTTV_FLYVIDEO_98, "Lifeview Flyvideo 98" }, - - { 0x010115cb, BTTV_GMV1, "AG GMV1" }, - { 0x010114c7, BTTV_MODTEC_205, "Modular Technology MM201/MM202/MM205/MM210/MM215 PCTV" }, - - { 0x10b42636, BTTV_HAUPPAUGE878, "STB ???" }, - { 0x217d6606, BTTV_WINFAST2000, "Leadtek WinFast TV 2000" }, - { 0xfff6f6ff, BTTV_WINFAST2000, "Leadtek WinFast TV 2000" }, - { 0x03116000, BTTV_SENSORAY311, "Sensoray 311" }, - { 0x00790e11, BTTV_WINDVR, "Canopus WinDVR PCI" }, - { 0xa0fca1a0, BTTV_ZOLTRIX, "Face to Face Tvmax" }, - { 0x20007063, BTTV_PC_HDTV, "pcHDTV HD-2000 TV"}, - { 0x82b2aa6a, BTTV_SIMUS_GVC1100, "SIMUS GVC1100" }, - { 0x146caa0c, BTTV_PV951, "ituner spectra8" }, - { 0x200a1295, BTTV_PXC200, "ImageNation PXC200A" }, - - { 0x40111554, BTTV_PV_BT878P_9B, "Prolink Pixelview PV-BT" }, - { 0x17de0a01, BTTV_KWORLD, "Mecer TV/FM/Video Tuner" }, - - { 0x01051805, BTTV_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #1" }, - { 0x01061805, BTTV_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #2" }, - { 0x01071805, BTTV_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #3" }, - { 0x01081805, BTTV_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #4" }, - - { 0x15409511, BTTV_ACORP_Y878F, "Acorp Y878F" }, + *{ 0x18521852, BTTV_BOARD_TERRATV, "Terratec TV+ (V1.10)" }, */ + { 0x1134153b, BTTV_BOARD_TERRATVALUE, "Terratec TValue (LR102)" }, + { 0x1135153b, BTTV_BOARD_TERRATVALUER, "Terratec TValue Radio" }, /* LR102 */ + { 0x5018153b, BTTV_BOARD_TERRATVALUE, "Terratec TValue" }, /* ?? */ + { 0xff3b153b, BTTV_BOARD_TERRATVALUER, "Terratec TValue Radio" }, /* ?? */ + + { 0x400015b0, BTTV_BOARD_ZOLTRIX_GENIE, "Zoltrix Genie TV" }, + { 0x400a15b0, BTTV_BOARD_ZOLTRIX_GENIE, "Zoltrix Genie TV" }, + { 0x400d15b0, BTTV_BOARD_ZOLTRIX_GENIE, "Zoltrix Genie TV / Radio" }, + { 0x401015b0, BTTV_BOARD_ZOLTRIX_GENIE, "Zoltrix Genie TV / Radio" }, + { 0x401615b0, BTTV_BOARD_ZOLTRIX_GENIE, "Zoltrix Genie TV / Radio" }, + + { 0x1430aa00, BTTV_BOARD_PV143, "Provideo PV143A" }, + { 0x1431aa00, BTTV_BOARD_PV143, "Provideo PV143B" }, + { 0x1432aa00, BTTV_BOARD_PV143, "Provideo PV143C" }, + { 0x1433aa00, BTTV_BOARD_PV143, "Provideo PV143D" }, + { 0x1433aa03, BTTV_BOARD_PV143, "Security Eyes" }, + + { 0x1460aa00, BTTV_BOARD_PV150, "Provideo PV150A-1" }, + { 0x1461aa01, BTTV_BOARD_PV150, "Provideo PV150A-2" }, + { 0x1462aa02, BTTV_BOARD_PV150, "Provideo PV150A-3" }, + { 0x1463aa03, BTTV_BOARD_PV150, "Provideo PV150A-4" }, + + { 0x1464aa04, BTTV_BOARD_PV150, "Provideo PV150B-1" }, + { 0x1465aa05, BTTV_BOARD_PV150, "Provideo PV150B-2" }, + { 0x1466aa06, BTTV_BOARD_PV150, "Provideo PV150B-3" }, + { 0x1467aa07, BTTV_BOARD_PV150, "Provideo PV150B-4" }, + + { 0xa132ff00, BTTV_BOARD_IVC100, "IVC-100" }, + { 0xa1550000, BTTV_BOARD_IVC200, "IVC-200" }, + { 0xa1550001, BTTV_BOARD_IVC200, "IVC-200" }, + { 0xa1550002, BTTV_BOARD_IVC200, "IVC-200" }, + { 0xa1550003, BTTV_BOARD_IVC200, "IVC-200" }, + { 0xa1550100, BTTV_BOARD_IVC200, "IVC-200G" }, + { 0xa1550101, BTTV_BOARD_IVC200, "IVC-200G" }, + { 0xa1550102, BTTV_BOARD_IVC200, "IVC-200G" }, + { 0xa1550103, BTTV_BOARD_IVC200, "IVC-200G" }, + { 0xa182ff00, BTTV_BOARD_IVC120, "IVC-120G" }, + { 0xa182ff01, BTTV_BOARD_IVC120, "IVC-120G" }, + { 0xa182ff02, BTTV_BOARD_IVC120, "IVC-120G" }, + { 0xa182ff03, BTTV_BOARD_IVC120, "IVC-120G" }, + { 0xa182ff04, BTTV_BOARD_IVC120, "IVC-120G" }, + { 0xa182ff05, BTTV_BOARD_IVC120, "IVC-120G" }, + { 0xa182ff06, BTTV_BOARD_IVC120, "IVC-120G" }, + { 0xa182ff07, BTTV_BOARD_IVC120, "IVC-120G" }, + { 0xa182ff08, BTTV_BOARD_IVC120, "IVC-120G" }, + { 0xa182ff09, BTTV_BOARD_IVC120, "IVC-120G" }, + { 0xa182ff0a, BTTV_BOARD_IVC120, "IVC-120G" }, + { 0xa182ff0b, BTTV_BOARD_IVC120, "IVC-120G" }, + { 0xa182ff0c, BTTV_BOARD_IVC120, "IVC-120G" }, + { 0xa182ff0d, BTTV_BOARD_IVC120, "IVC-120G" }, + { 0xa182ff0e, BTTV_BOARD_IVC120, "IVC-120G" }, + { 0xa182ff0f, BTTV_BOARD_IVC120, "IVC-120G" }, + + { 0x41424344, BTTV_BOARD_GRANDTEC, "GrandTec Multi Capture" }, + { 0x01020304, BTTV_BOARD_XGUARD, "Grandtec Grand X-Guard" }, + + { 0x18501851, BTTV_BOARD_CHRONOS_VS2, "FlyVideo 98 (LR50)/ Chronos Video Shuttle II" }, + { 0xa0501851, BTTV_BOARD_CHRONOS_VS2, "FlyVideo 98 (LR50)/ Chronos Video Shuttle II" }, + { 0x18511851, BTTV_BOARD_FLYVIDEO98EZ, "FlyVideo 98EZ (LR51)/ CyberMail AV" }, + { 0x18521852, BTTV_BOARD_TYPHOON_TVIEW, "FlyVideo 98FM (LR50)/ Typhoon TView TV/FM Tuner" }, + { 0x41a0a051, BTTV_BOARD_FLYVIDEO_98FM, "Lifeview FlyVideo 98 LR50 Rev Q" }, + { 0x18501f7f, BTTV_BOARD_FLYVIDEO_98, "Lifeview Flyvideo 98" }, + + { 0x010115cb, BTTV_BOARD_GMV1, "AG GMV1" }, + { 0x010114c7, BTTV_BOARD_MODTEC_205, "Modular Technology MM201/MM202/MM205/MM210/MM215 PCTV" }, + + { 0x10b42636, BTTV_BOARD_HAUPPAUGE878, "STB ???" }, + { 0x217d6606, BTTV_BOARD_WINFAST2000, "Leadtek WinFast TV 2000" }, + { 0xfff6f6ff, BTTV_BOARD_WINFAST2000, "Leadtek WinFast TV 2000" }, + { 0x03116000, BTTV_BOARD_SENSORAY311, "Sensoray 311" }, + { 0x00790e11, BTTV_BOARD_WINDVR, "Canopus WinDVR PCI" }, + { 0xa0fca1a0, BTTV_BOARD_ZOLTRIX, "Face to Face Tvmax" }, + { 0x20007063, BTTV_BOARD_PC_HDTV, "pcHDTV HD-2000 TV"}, + { 0x82b2aa6a, BTTV_BOARD_SIMUS_GVC1100, "SIMUS GVC1100" }, + { 0x146caa0c, BTTV_BOARD_PV951, "ituner spectra8" }, + { 0x200a1295, BTTV_BOARD_PXC200, "ImageNation PXC200A" }, + + { 0x40111554, BTTV_BOARD_PV_BT878P_9B, "Prolink Pixelview PV-BT" }, + { 0x17de0a01, BTTV_BOARD_KWORLD, "Mecer TV/FM/Video Tuner" }, + + { 0x01051805, BTTV_BOARD_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #1" }, + { 0x01061805, BTTV_BOARD_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #2" }, + { 0x01071805, BTTV_BOARD_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #3" }, + { 0x01081805, BTTV_BOARD_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #4" }, + + { 0x15409511, BTTV_BOARD_ACORP_Y878F, "Acorp Y878F" }, /* likely broken, vendor id doesn't match the other magic views ... - * { 0xa0fca04f, BTTV_MAGICTVIEW063, "Guillemot Maxi TV Video 3" }, */ + * { 0xa0fca04f, BTTV_BOARD_MAGICTVIEW063, "Guillemot Maxi TV Video 3" }, */ /* DVB cards (using pci function .1 for mpeg data xfer) */ - { 0x01010071, BTTV_NEBULA_DIGITV, "Nebula Electronics DigiTV" }, - { 0x07611461, BTTV_AVDVBT_761, "AverMedia AverTV DVB-T 761" }, - { 0x001c11bd, BTTV_PINNACLESAT, "Pinnacle PCTV Sat" }, - { 0x002611bd, BTTV_TWINHAN_DST, "Pinnacle PCTV SAT CI" }, - { 0x00011822, BTTV_TWINHAN_DST, "Twinhan VisionPlus DVB" }, - { 0xfc00270f, BTTV_TWINHAN_DST, "ChainTech digitop DST-1000 DVB-S" }, - { 0x07711461, BTTV_AVDVBT_771, "AVermedia AverTV DVB-T 771" }, - { 0xdb1018ac, BTTV_DVICO_DVBT_LITE, "DViCO FusionHDTV DVB-T Lite" }, - { 0xd50018ac, BTTV_DVICO_FUSIONHDTV_5_LITE, "DViCO FusionHDTV 5 Lite" }, + { 0x01010071, BTTV_BOARD_NEBULA_DIGITV, "Nebula Electronics DigiTV" }, + { 0x07611461, BTTV_BOARD_AVDVBT_761, "AverMedia AverTV DVB-T 761" }, + { 0x001c11bd, BTTV_BOARD_PINNACLESAT, "Pinnacle PCTV Sat" }, + { 0x002611bd, BTTV_BOARD_TWINHAN_DST, "Pinnacle PCTV SAT CI" }, + { 0x00011822, BTTV_BOARD_TWINHAN_DST, "Twinhan VisionPlus DVB" }, + { 0xfc00270f, BTTV_BOARD_TWINHAN_DST, "ChainTech digitop DST-1000 DVB-S" }, + { 0x07711461, BTTV_BOARD_AVDVBT_771, "AVermedia AverTV DVB-T 771" }, + { 0xdb1018ac, BTTV_BOARD_DVICO_DVBT_LITE, "DViCO FusionHDTV DVB-T Lite" }, + { 0xd50018ac, BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE, "DViCO FusionHDTV 5 Lite" }, { 0, -1, NULL } }; @@ -309,8 +309,8 @@ static struct CARD { /* array with description for bt848 / bt878 tv/grabber cards */ struct tvcard bttv_tvcards[] = { - [BTTV_UNKNOWN] = { /* ---- card 0x00 ---------------------------------- */ + [BTTV_BOARD_UNKNOWN] = { .name = " *** UNKNOWN/GENERIC *** ", .video_inputs = 4, .audio_inputs = 1, @@ -320,7 +320,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = -1, .tuner_addr = ADDR_UNSET, }, - [BTTV_MIRO] = { + [BTTV_BOARD_MIRO] = { .name = "MIRO PCTV", .video_inputs = 4, .audio_inputs = 1, @@ -333,7 +333,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = -1, .tuner_addr = ADDR_UNSET, }, - [BTTV_HAUPPAUGE] = { + [BTTV_BOARD_HAUPPAUGE] = { .name = "Hauppauge (bt848)", .video_inputs = 4, .audio_inputs = 1, @@ -346,7 +346,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = -1, .tuner_addr = ADDR_UNSET, }, - [BTTV_STB] = { + [BTTV_BOARD_STB] = { .name = "STB, Gateway P/N 6000699 (bt848)", .video_inputs = 3, .audio_inputs = 1, @@ -364,7 +364,7 @@ struct tvcard bttv_tvcards[] = { }, /* ---- card 0x04 ---------------------------------- */ - [BTTV_INTEL] = { + [BTTV_BOARD_INTEL] = { .name = "Intel Create and Share PCI/ Smart Video Recorder III", .video_inputs = 4, .audio_inputs = 0, @@ -377,7 +377,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = 4, .tuner_addr = ADDR_UNSET, }, - [BTTV_DIAMOND] = { + [BTTV_BOARD_DIAMOND] = { .name = "Diamond DTV2000", .video_inputs = 4, .audio_inputs = 1, @@ -390,7 +390,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = -1, .tuner_addr = ADDR_UNSET, }, - [BTTV_AVERMEDIA] = { + [BTTV_BOARD_AVERMEDIA] = { .name = "AVerMedia TVPhone", .video_inputs = 3, .audio_inputs = 1, @@ -406,7 +406,7 @@ struct tvcard bttv_tvcards[] = { .audio_hook = avermedia_tvphone_audio, .has_remote = 1, }, - [BTTV_MATRIX_VISION] = { + [BTTV_BOARD_MATRIX_VISION] = { .name = "MATRIX-Vision MV-Delta", .video_inputs = 5, .audio_inputs = 1, @@ -421,7 +421,7 @@ struct tvcard bttv_tvcards[] = { }, /* ---- card 0x08 ---------------------------------- */ - [BTTV_FLYVIDEO] = { + [BTTV_BOARD_FLYVIDEO] = { .name = "Lifeview FlyVideo II (Bt848) LR26 / MAXI TV Video PCI2 LR26", .video_inputs = 4, .audio_inputs = 1, @@ -435,7 +435,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = -1, .tuner_addr = ADDR_UNSET, }, - [BTTV_TURBOTV] = { + [BTTV_BOARD_TURBOTV] = { .name = "IMS/IXmicro TurboTV", .video_inputs = 3, .audio_inputs = 1, @@ -449,7 +449,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = TUNER_TEMIC_PAL, .tuner_addr = ADDR_UNSET, }, - [BTTV_HAUPPAUGE878] = { + [BTTV_BOARD_HAUPPAUGE878] = { .name = "Hauppauge (bt878)", .video_inputs = 4, .audio_inputs = 1, @@ -463,7 +463,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = -1, .tuner_addr = ADDR_UNSET, }, - [BTTV_MIROPRO] = { + [BTTV_BOARD_MIROPRO] = { .name = "MIRO PCTV pro", .video_inputs = 3, .audio_inputs = 1, @@ -478,7 +478,7 @@ struct tvcard bttv_tvcards[] = { }, /* ---- card 0x0c ---------------------------------- */ - [BTTV_ADSTECH_TV] = { + [BTTV_BOARD_ADSTECH_TV] = { .name = "ADS Technologies Channel Surfer TV (bt848)", .video_inputs = 3, .audio_inputs = 1, @@ -491,7 +491,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = -1, .tuner_addr = ADDR_UNSET, }, - [BTTV_AVERMEDIA98] = { + [BTTV_BOARD_AVERMEDIA98] = { .name = "AVerMedia TVCapture 98", .video_inputs = 3, .audio_inputs = 4, @@ -507,7 +507,7 @@ struct tvcard bttv_tvcards[] = { .tuner_addr = ADDR_UNSET, .audio_hook = avermedia_tv_stereo_audio, }, - [BTTV_VHX] = { + [BTTV_BOARD_VHX] = { .name = "Aimslab Video Highway Xtreme (VHX)", .video_inputs = 3, .audio_inputs = 1, @@ -521,7 +521,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = -1, .tuner_addr = ADDR_UNSET, }, - [BTTV_ZOLTRIX] = { + [BTTV_BOARD_ZOLTRIX] = { .name = "Zoltrix TV-Max", .video_inputs = 3, .audio_inputs = 1, @@ -536,7 +536,7 @@ struct tvcard bttv_tvcards[] = { }, /* ---- card 0x10 ---------------------------------- */ - [BTTV_PIXVIEWPLAYTV] = { + [BTTV_BOARD_PIXVIEWPLAYTV] = { .name = "Prolink Pixelview PlayTV (bt878)", .video_inputs = 3, .audio_inputs = 1, @@ -555,7 +555,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = -1, }, - [BTTV_WINVIEW_601] = { + [BTTV_BOARD_WINVIEW_601] = { .name = "Leadtek WinView 601", .video_inputs = 3, .audio_inputs = 1, @@ -570,7 +570,7 @@ struct tvcard bttv_tvcards[] = { .audio_hook = winview_audio, .has_radio = 1, }, - [BTTV_AVEC_INTERCAP] = { + [BTTV_BOARD_AVEC_INTERCAP] = { .name = "AVEC Intercapture", .video_inputs = 3, .audio_inputs = 2, @@ -583,7 +583,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = -1, .tuner_addr = ADDR_UNSET, }, - [BTTV_LIFE_FLYKIT] = { + [BTTV_BOARD_LIFE_FLYKIT] = { .name = "Lifeview FlyVideo II EZ /FlyKit LR38 Bt848 (capture only)", .video_inputs = 4, .audio_inputs = 1, @@ -598,7 +598,7 @@ struct tvcard bttv_tvcards[] = { }, /* ---- card 0x14 ---------------------------------- */ - [BTTV_CEI_RAFFLES] = { + [BTTV_BOARD_CEI_RAFFLES] = { .name = "CEI Raffles Card", .video_inputs = 3, .audio_inputs = 3, @@ -608,7 +608,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = -1, .tuner_addr = ADDR_UNSET, }, - [BTTV_CONFERENCETV] = { + [BTTV_BOARD_CONFERENCETV] = { .name = "Lifeview FlyVideo 98/ Lucky Star Image World ConferenceTV LR50", .video_inputs = 4, .audio_inputs = 2, /* tuner, line in */ @@ -621,7 +621,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = TUNER_PHILIPS_PAL_I, .tuner_addr = ADDR_UNSET, }, - [BTTV_PHOEBE_TVMAS] = { + [BTTV_BOARD_PHOEBE_TVMAS] = { .name = "Askey CPH050/ Phoebe Tv Master + FM", .video_inputs = 3, .audio_inputs = 1, @@ -635,7 +635,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = -1, .tuner_addr = ADDR_UNSET, }, - [BTTV_MODTEC_205] = { + [BTTV_BOARD_MODTEC_205] = { .name = "Modular Technology MM201/MM202/MM205/MM210/MM215 PCTV, bt878", .video_inputs = 3, .audio_inputs = 1, @@ -652,7 +652,7 @@ struct tvcard bttv_tvcards[] = { }, /* ---- card 0x18 ---------------------------------- */ - [BTTV_MAGICTVIEW061] = { + [BTTV_BOARD_MAGICTVIEW061] = { .name = "Askey CPH05X/06X (bt878) [many vendors]", .video_inputs = 3, .audio_inputs = 1, @@ -667,7 +667,7 @@ struct tvcard bttv_tvcards[] = { .tuner_addr = ADDR_UNSET, .has_remote = 1, }, - [BTTV_VOBIS_BOOSTAR] = { + [BTTV_BOARD_VOBIS_BOOSTAR] = { .name = "Terratec TerraTV+ Version 1.0 (Bt848)/ Terra TValue Version 1.0/ Vobis TV-Boostar", .video_inputs = 3, .audio_inputs = 1, @@ -681,7 +681,7 @@ struct tvcard bttv_tvcards[] = { .tuner_addr = ADDR_UNSET, .audio_hook = terratv_audio, }, - [BTTV_HAUPPAUG_WCAM] = { + [BTTV_BOARD_HAUPPAUG_WCAM] = { .name = "Hauppauge WinCam newer (bt878)", .video_inputs = 4, .audio_inputs = 1, @@ -694,7 +694,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = -1, .tuner_addr = ADDR_UNSET, }, - [BTTV_MAXI] = { + [BTTV_BOARD_MAXI] = { .name = "Lifeview FlyVideo 98/ MAXI TV Video PCI2 LR50", .video_inputs = 4, .audio_inputs = 2, @@ -709,7 +709,7 @@ struct tvcard bttv_tvcards[] = { }, /* ---- card 0x1c ---------------------------------- */ - [BTTV_TERRATV] = { + [BTTV_BOARD_TERRATV] = { .name = "Terratec TerraTV+ Version 1.1 (bt878)", .video_inputs = 3, .audio_inputs = 1, @@ -754,7 +754,7 @@ struct tvcard bttv_tvcards[] = { */ }, - [BTTV_PXC200] = { + [BTTV_BOARD_PXC200] = { /* Jannik Fritsch */ .name = "Imagenation PXC200", .video_inputs = 5, @@ -770,7 +770,7 @@ struct tvcard bttv_tvcards[] = { .muxsel_hook = PXC200_muxsel, }, - [BTTV_FLYVIDEO_98] = { + [BTTV_BOARD_FLYVIDEO_98] = { .name = "Lifeview FlyVideo 98 LR50", .video_inputs = 4, .audio_inputs = 1, @@ -783,7 +783,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = -1, .tuner_addr = ADDR_UNSET, }, - [BTTV_IPROTV] = { + [BTTV_BOARD_IPROTV] = { .name = "Formac iProTV, Formac ProTV I (bt848)", .video_inputs = 4, .audio_inputs = 1, @@ -798,7 +798,7 @@ struct tvcard bttv_tvcards[] = { }, /* ---- card 0x20 ---------------------------------- */ - [BTTV_INTEL_C_S_PCI] = { + [BTTV_BOARD_INTEL_C_S_PCI] = { .name = "Intel Create and Share PCI/ Smart Video Recorder III", .video_inputs = 4, .audio_inputs = 0, @@ -811,7 +811,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = 4, .tuner_addr = ADDR_UNSET, }, - [BTTV_TERRATVALUE] = { + [BTTV_BOARD_TERRATVALUE] = { .name = "Terratec TerraTValue Version Bt878", .video_inputs = 3, .audio_inputs = 1, @@ -825,7 +825,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = TUNER_PHILIPS_PAL, .tuner_addr = ADDR_UNSET, }, - [BTTV_WINFAST2000] = { + [BTTV_BOARD_WINFAST2000] = { .name = "Leadtek WinFast 2000/ WinFast 2000 XP", .video_inputs = 4, .audio_inputs = 1, @@ -859,7 +859,7 @@ struct tvcard bttv_tvcards[] = { .audio_hook = winfast2000_audio, .has_remote = 1, }, - [BTTV_CHRONOS_VS2] = { + [BTTV_BOARD_CHRONOS_VS2] = { .name = "Lifeview FlyVideo 98 LR50 / Chronos Video Shuttle II", .video_inputs = 4, .audio_inputs = 3, @@ -874,7 +874,7 @@ struct tvcard bttv_tvcards[] = { }, /* ---- card 0x24 ---------------------------------- */ - [BTTV_TYPHOON_TVIEW] = { + [BTTV_BOARD_TYPHOON_TVIEW] = { .name = "Lifeview FlyVideo 98FM LR50 / Typhoon TView TV/FM Tuner", .video_inputs = 4, .audio_inputs = 3, @@ -888,7 +888,7 @@ struct tvcard bttv_tvcards[] = { .tuner_addr = ADDR_UNSET, .has_radio = 1, }, - [BTTV_PXELVWPLTVPRO] = { + [BTTV_BOARD_PXELVWPLTVPRO] = { .name = "Prolink PixelView PlayTV pro", .video_inputs = 3, .audio_inputs = 1, @@ -902,7 +902,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = -1, .tuner_addr = ADDR_UNSET, }, - [BTTV_MAGICTVIEW063] = { + [BTTV_BOARD_MAGICTVIEW063] = { .name = "Askey CPH06X TView99", .video_inputs = 4, .audio_inputs = 1, @@ -917,7 +917,7 @@ struct tvcard bttv_tvcards[] = { .tuner_addr = ADDR_UNSET, .has_remote = 1, }, - [BTTV_PINNACLE] = { + [BTTV_BOARD_PINNACLE] = { .name = "Pinnacle PCTV Studio/Rave", .video_inputs = 3, .audio_inputs = 1, @@ -933,7 +933,7 @@ struct tvcard bttv_tvcards[] = { }, /* ---- card 0x28 ---------------------------------- */ - [BTTV_STB2] = { + [BTTV_BOARD_STB2] = { .name = "STB TV PCI FM, Gateway P/N 6000704 (bt878), 3Dfx VoodooTV 100", .video_inputs = 3, .audio_inputs = 1, @@ -949,7 +949,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .has_radio = 1, }, - [BTTV_AVPHONE98] = { + [BTTV_BOARD_AVPHONE98] = { .name = "AVerMedia TVPhone 98", .video_inputs = 3, .audio_inputs = 4, @@ -965,7 +965,7 @@ struct tvcard bttv_tvcards[] = { .has_radio = 1, .audio_hook = avermedia_tvphone_audio, }, - [BTTV_PV951] = { + [BTTV_BOARD_PV951] = { .name = "ProVideo PV951", /* pic16c54 */ .video_inputs = 3, .audio_inputs = 1, @@ -980,7 +980,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = 1, .tuner_addr = ADDR_UNSET, }, - [BTTV_ONAIR_TV] = { + [BTTV_BOARD_ONAIR_TV] = { .name = "Little OnAir TV", .video_inputs = 3, .audio_inputs = 1, @@ -995,7 +995,7 @@ struct tvcard bttv_tvcards[] = { }, /* ---- card 0x2c ---------------------------------- */ - [BTTV_SIGMA_TVII_FM] = { + [BTTV_BOARD_SIGMA_TVII_FM] = { .name = "Sigma TVII-FM", .video_inputs = 2, .audio_inputs = 1, @@ -1009,7 +1009,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = -1, .tuner_addr = ADDR_UNSET, }, - [BTTV_MATRIX_VISION2] = { + [BTTV_BOARD_MATRIX_VISION2] = { .name = "MATRIX-Vision MV-Delta 2", .video_inputs = 5, .audio_inputs = 1, @@ -1023,7 +1023,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = -1, .tuner_addr = ADDR_UNSET, }, - [BTTV_ZOLTRIX_GENIE] = { + [BTTV_BOARD_ZOLTRIX_GENIE] = { .name = "Zoltrix Genie TV/FM", .video_inputs = 3, .audio_inputs = 1, @@ -1037,7 +1037,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = 21, .tuner_addr = ADDR_UNSET, }, - [BTTV_TERRATVRADIO] = { + [BTTV_BOARD_TERRATVRADIO] = { .name = "Terratec TV/Radio+", .video_inputs = 3, .audio_inputs = 1, @@ -1055,7 +1055,7 @@ struct tvcard bttv_tvcards[] = { }, /* ---- card 0x30 ---------------------------------- */ - [BTTV_DYNALINK] = { + [BTTV_BOARD_DYNALINK] = { .name = "Askey CPH03x/ Dynalink Magic TView", .video_inputs = 3, .audio_inputs = 1, @@ -1069,7 +1069,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = -1, .tuner_addr = ADDR_UNSET, }, - [BTTV_GVBCTV3PCI] = { + [BTTV_BOARD_GVBCTV3PCI] = { .name = "IODATA GV-BCTV3/PCI", .video_inputs = 3, .audio_inputs = 1, @@ -1084,7 +1084,7 @@ struct tvcard bttv_tvcards[] = { .tuner_addr = ADDR_UNSET, .audio_hook = gvbctv3pci_audio, }, - [BTTV_PXELVWPLTVPAK] = { + [BTTV_BOARD_PXELVWPLTVPAK] = { .name = "Prolink PV-BT878P+4E / PixelView PlayTV PAK / Lenco MXTV-9578 CP", .video_inputs = 5, .audio_inputs = 1, @@ -1109,7 +1109,7 @@ struct tvcard bttv_tvcards[] = { Note: At i2c=0x8a is a Bt832 chip, which changes to 0x88 after being reset via GPIO22 */ }, - [BTTV_EAGLE] = { + [BTTV_BOARD_EAGLE] = { .name = "Eagle Wireless Capricorn2 (bt878A)", .video_inputs = 4, .audio_inputs = 1, @@ -1124,7 +1124,7 @@ struct tvcard bttv_tvcards[] = { }, /* ---- card 0x34 ---------------------------------- */ - [BTTV_PINNACLEPRO] = { + [BTTV_BOARD_PINNACLEPRO] = { /* David Härdeman */ .name = "Pinnacle PCTV Studio Pro", .video_inputs = 4, @@ -1148,7 +1148,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = -1, .tuner_addr = ADDR_UNSET, }, - [BTTV_TVIEW_RDS_FM] = { + [BTTV_BOARD_TVIEW_RDS_FM] = { /* Claas Langbehn , Sven Grothklags */ .name = "Typhoon TView RDS + FM Stereo / KNC1 TV Station RDS", @@ -1165,7 +1165,7 @@ struct tvcard bttv_tvcards[] = { .tuner_addr = ADDR_UNSET, .has_radio = 1, }, - [BTTV_LIFETEC_9415] = { + [BTTV_BOARD_LIFETEC_9415] = { /* Tim Röstermundt in de.comp.os.unix.linux.hardware: options bttv card=0 pll=1 radio=1 gpiomask=0x18e0 @@ -1187,7 +1187,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = -1, .tuner_addr = ADDR_UNSET, }, - [BTTV_BESTBUY_EASYTV] = { + [BTTV_BOARD_BESTBUY_EASYTV] = { /* Miguel Angel Alvarez old Easy TV BT848 version (model CPH031) */ .name = "Askey CPH031/ BESTBUY Easy TV", @@ -1205,7 +1205,7 @@ struct tvcard bttv_tvcards[] = { }, /* ---- card 0x38 ---------------------------------- */ - [BTTV_FLYVIDEO_98FM] = { + [BTTV_BOARD_FLYVIDEO_98FM] = { /* Gordon Heydon */ - [BTTV_GRANDTEC] = { + [BTTV_BOARD_GRANDTEC] = { .name = "GrandTec 'Grand Video Capture' (Bt848)", .video_inputs = 2, .audio_inputs = 0, @@ -1237,7 +1237,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = -1, .tuner_addr = ADDR_UNSET, }, - [BTTV_ASKEY_CPH060] = { + [BTTV_BOARD_ASKEY_CPH060] = { /* Daniel Herrington */ .name = "Askey CPH060/ Phoebe TV Master Only (No FM)", .video_inputs = 3, @@ -1252,7 +1252,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = TUNER_TEMIC_4036FY5_NTSC, .tuner_addr = ADDR_UNSET, }, - [BTTV_ASKEY_CPH03X] = { + [BTTV_BOARD_ASKEY_CPH03X] = { /* Matti Mottus */ .name = "Askey CPH03x TV Capturer", .video_inputs = 4, @@ -1268,7 +1268,7 @@ struct tvcard bttv_tvcards[] = { }, /* ---- card 0x3c ---------------------------------- */ - [BTTV_MM100PCTV] = { + [BTTV_BOARD_MM100PCTV] = { /* Philip Blundell */ .name = "Modular Technology MM100PCTV", .video_inputs = 2, @@ -1282,7 +1282,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = TUNER_TEMIC_PAL, .tuner_addr = ADDR_UNSET, }, - [BTTV_GMV1] = { + [BTTV_BOARD_GMV1] = { /* Adrian Cox new Easy TV BT878 version (model CPH061) special thanks to Informatica Mieres for providing the card */ @@ -1315,7 +1315,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = TUNER_PHILIPS_PAL, .tuner_addr = ADDR_UNSET, }, - [BTTV_ATI_TVWONDER] = { + [BTTV_BOARD_ATI_TVWONDER] = { /* Lukas Gebauer */ .name = "ATI TV-Wonder", .video_inputs = 3, @@ -1331,7 +1331,7 @@ struct tvcard bttv_tvcards[] = { }, /* ---- card 0x40 ---------------------------------- */ - [BTTV_ATI_TVWONDERVE] = { + [BTTV_BOARD_ATI_TVWONDERVE] = { /* Lukas Gebauer */ .name = "ATI TV-Wonder VE", .video_inputs = 2, @@ -1346,7 +1346,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = TUNER_TEMIC_4006FN5_MULTI_PAL, .tuner_addr = ADDR_UNSET, }, - [BTTV_FLYVIDEO2000] = { + [BTTV_BOARD_FLYVIDEO2000] = { /* DeeJay */ .name = "IODATA GV-BCTV4/PCI", .video_inputs = 3, @@ -1400,7 +1400,7 @@ struct tvcard bttv_tvcards[] = { }, /* ---- card 0x44 ---------------------------------- */ - [BTTV_VOODOOTV_FM] = { + [BTTV_BOARD_VOODOOTV_FM] = { .name = "3Dfx VoodooTV FM (Euro), VoodooTV 200 (USA)", /* try "insmod msp3400 simple=0" if you have * sound problems with this card. */ @@ -1420,7 +1420,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .has_radio = 1, }, - [BTTV_AIMMS] = { + [BTTV_BOARD_AIMMS] = { /* Philip Blundell */ .name = "Active Imaging AIMMS", .video_inputs = 1, @@ -1432,7 +1432,7 @@ struct tvcard bttv_tvcards[] = { .muxsel = { 2 }, .gpiomask = 0 }, - [BTTV_PV_BT878P_PLUS] = { + [BTTV_BOARD_PV_BT878P_PLUS] = { /* Tomasz Pyra */ .name = "Prolink Pixelview PV-BT878P+ (Rev.4C,8E)", .video_inputs = 3, @@ -1455,7 +1455,7 @@ struct tvcard bttv_tvcards[] = { GPIO8-15: vrd866b ? */ }, - [BTTV_FLYVIDEO98EZ] = { + [BTTV_BOARD_FLYVIDEO98EZ] = { .name = "Lifeview FlyVideo 98EZ (capture only) LR51", .video_inputs = 4, .audio_inputs = 0, @@ -1469,7 +1469,7 @@ struct tvcard bttv_tvcards[] = { }, /* ---- card 0x48 ---------------------------------- */ - [BTTV_PV_BT878P_9B] = { + [BTTV_BOARD_PV_BT878P_9B] = { /* Dariusz Kowalewski */ .name = "Prolink Pixelview PV-BT878P+9B (PlayTV Pro rev.9B FM+NICAM)", .video_inputs = 4, @@ -1496,7 +1496,7 @@ struct tvcard bttv_tvcards[] = { GPIO20,22,23: R30,R29,R28 */ }, - [BTTV_SENSORAY311] = { + [BTTV_BOARD_SENSORAY311] = { /* Clay Kunz */ /* you must jumper JP5 for the card to work */ .name = "Sensoray 311", @@ -1511,7 +1511,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = -1, .tuner_addr = ADDR_UNSET, }, - [BTTV_RV605] = { + [BTTV_BOARD_RV605] = { /* Miguel Freitas */ .name = "RemoteVision MX (RV605)", .video_inputs = 16, @@ -1528,7 +1528,7 @@ struct tvcard bttv_tvcards[] = { .tuner_addr = ADDR_UNSET, .muxsel_hook = rv605_muxsel, }, - [BTTV_POWERCLR_MTV878] = { + [BTTV_BOARD_POWERCLR_MTV878] = { .name = "Powercolor MTV878/ MTV878R/ MTV878F", .video_inputs = 3, .audio_inputs = 2, @@ -1545,7 +1545,7 @@ struct tvcard bttv_tvcards[] = { }, /* ---- card 0x4c ---------------------------------- */ - [BTTV_WINDVR] = { + [BTTV_BOARD_WINDVR] = { /* Masaki Suzuki */ .name = "Canopus WinDVR PCI (COMPAQ Presario 3524JP, 5112JP)", .video_inputs = 3, @@ -1559,7 +1559,7 @@ struct tvcard bttv_tvcards[] = { .tuner_addr = ADDR_UNSET, .audio_hook = windvr_audio, }, - [BTTV_GRANDTEC_MULTI] = { + [BTTV_BOARD_GRANDTEC_MULTI] = { .name = "GrandTec Multi Capture Card (Bt878)", .video_inputs = 4, .audio_inputs = 0, @@ -1574,7 +1574,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = -1, .tuner_addr = ADDR_UNSET, }, - [BTTV_KWORLD] = { + [BTTV_BOARD_KWORLD] = { .name = "Jetway TV/Capture JW-TV878-FBK, Kworld KW-TV878RF", .video_inputs = 4, .audio_inputs = 3, @@ -1607,7 +1607,7 @@ struct tvcard bttv_tvcards[] = { GPIO22,23: ?? ?? : mtu8b56ep microcontroller for IR (GPIO wiring unknown)*/ }, - [BTTV_DSP_TCVIDEO] = { + [BTTV_BOARD_DSP_TCVIDEO] = { /* Arthur Tetzlaff-Deas, DSP Design Ltd */ .name = "DSP Design TCVIDEO", .video_inputs = 4, @@ -1619,7 +1619,7 @@ struct tvcard bttv_tvcards[] = { }, /* ---- card 0x50 ---------------------------------- */ - [BTTV_HAUPPAUGEPVR] = { + [BTTV_BOARD_HAUPPAUGEPVR] = { .name = "Hauppauge WinTV PVR", .video_inputs = 4, .audio_inputs = 1, @@ -1634,7 +1634,7 @@ struct tvcard bttv_tvcards[] = { .gpiomask = 7, .audiomux = {7}, }, - [BTTV_GVBCTV5PCI] = { + [BTTV_BOARD_GVBCTV5PCI] = { .name = "IODATA GV-BCTV5/PCI", .video_inputs = 3, .audio_inputs = 1, @@ -1650,7 +1650,7 @@ struct tvcard bttv_tvcards[] = { .audio_hook = gvbctv5pci_audio, .has_radio = 1, }, - [BTTV_OSPREY1x0] = { + [BTTV_BOARD_OSPREY1x0] = { .name = "Osprey 100/150 (878)", /* 0x1(2|3)-45C6-C1 */ .video_inputs = 4, /* id-inputs-clock */ .audio_inputs = 0, @@ -1664,7 +1664,7 @@ struct tvcard bttv_tvcards[] = { .no_tda9875 = 1, .no_tda7432 = 1, }, - [BTTV_OSPREY1x0_848] = { + [BTTV_BOARD_OSPREY1x0_848] = { .name = "Osprey 100/150 (848)", /* 0x04-54C0-C1 & older boards */ .video_inputs = 3, .audio_inputs = 0, @@ -1680,7 +1680,7 @@ struct tvcard bttv_tvcards[] = { }, /* ---- card 0x54 ---------------------------------- */ - [BTTV_OSPREY101_848] = { + [BTTV_BOARD_OSPREY101_848] = { .name = "Osprey 101 (848)", /* 0x05-40C0-C1 */ .video_inputs = 2, .audio_inputs = 0, @@ -1694,7 +1694,7 @@ struct tvcard bttv_tvcards[] = { .no_tda9875 = 1, .no_tda7432 = 1, }, - [BTTV_OSPREY1x1] = { + [BTTV_BOARD_OSPREY1x1] = { .name = "Osprey 101/151", /* 0x1(4|5)-0004-C4 */ .video_inputs = 1, .audio_inputs = 0, @@ -1708,7 +1708,7 @@ struct tvcard bttv_tvcards[] = { .no_tda9875 = 1, .no_tda7432 = 1, }, - [BTTV_OSPREY1x1_SVID] = { + [BTTV_BOARD_OSPREY1x1_SVID] = { .name = "Osprey 101/151 w/ svid", /* 0x(16|17|20)-00C4-C1 */ .video_inputs = 2, .audio_inputs = 0, @@ -1722,7 +1722,7 @@ struct tvcard bttv_tvcards[] = { .no_tda9875 = 1, .no_tda7432 = 1, }, - [BTTV_OSPREY2xx] = { + [BTTV_BOARD_OSPREY2xx] = { .name = "Osprey 200/201/250/251", /* 0x1(8|9|E|F)-0004-C4 */ .video_inputs = 1, .audio_inputs = 1, @@ -1738,7 +1738,7 @@ struct tvcard bttv_tvcards[] = { }, /* ---- card 0x58 ---------------------------------- */ - [BTTV_OSPREY2x0_SVID] = { + [BTTV_BOARD_OSPREY2x0_SVID] = { .name = "Osprey 200/250", /* 0x1(A|B)-00C4-C1 */ .video_inputs = 2, .audio_inputs = 1, @@ -1752,7 +1752,7 @@ struct tvcard bttv_tvcards[] = { .no_tda9875 = 1, .no_tda7432 = 1, }, - [BTTV_OSPREY2x0] = { + [BTTV_BOARD_OSPREY2x0] = { .name = "Osprey 210/220", /* 0x1(A|B)-04C0-C1 */ .video_inputs = 2, .audio_inputs = 1, @@ -1766,7 +1766,7 @@ struct tvcard bttv_tvcards[] = { .no_tda9875 = 1, .no_tda7432 = 1, }, - [BTTV_OSPREY500] = { + [BTTV_BOARD_OSPREY500] = { .name = "Osprey 500", /* 500 */ .video_inputs = 2, .audio_inputs = 1, @@ -1780,7 +1780,7 @@ struct tvcard bttv_tvcards[] = { .no_tda9875 = 1, .no_tda7432 = 1, }, - [BTTV_OSPREY540] = { + [BTTV_BOARD_OSPREY540] = { .name = "Osprey 540", /* 540 */ .video_inputs = 4, .audio_inputs = 1, @@ -1803,7 +1803,7 @@ struct tvcard bttv_tvcards[] = { }, /* ---- card 0x5C ---------------------------------- */ - [BTTV_OSPREY2000] = { + [BTTV_BOARD_OSPREY2000] = { .name = "Osprey 2000", /* 2000 */ .video_inputs = 2, .audio_inputs = 1, @@ -1817,7 +1817,7 @@ struct tvcard bttv_tvcards[] = { .no_tda9875 = 1, .no_tda7432 = 1, /* must avoid, conflicts with the bt860 */ }, - [BTTV_IDS_EAGLE] = { + [BTTV_BOARD_IDS_EAGLE] = { /* M G Berberich */ .name = "IDS Eagle", .video_inputs = 4, @@ -1833,7 +1833,7 @@ struct tvcard bttv_tvcards[] = { .no_tda9875 = 1, .pll = PLL_28, }, - [BTTV_PINNACLESAT] = { + [BTTV_BOARD_PINNACLESAT] = { .name = "Pinnacle PCTV Sat", .video_inputs = 2, .audio_inputs = 0, @@ -1849,7 +1849,7 @@ struct tvcard bttv_tvcards[] = { .no_gpioirq = 1, .has_dvb = 1, }, - [BTTV_FORMAC_PROTV] = { + [BTTV_BOARD_FORMAC_PROTV] = { .name = "Formac ProTV II (bt878)", .video_inputs = 4, .audio_inputs = 1, @@ -1873,7 +1873,7 @@ struct tvcard bttv_tvcards[] = { }, /* ---- card 0x60 ---------------------------------- */ - [BTTV_MACHTV] = { + [BTTV_BOARD_MACHTV] = { .name = "MachTV", .video_inputs = 3, .audio_inputs = 1, @@ -1887,7 +1887,7 @@ struct tvcard bttv_tvcards[] = { .tuner_addr = ADDR_UNSET, .pll = 1, }, - [BTTV_EURESYS_PICOLO] = { + [BTTV_BOARD_EURESYS_PICOLO] = { .name = "Euresys Picolo", .video_inputs = 3, .audio_inputs = 0, @@ -1902,7 +1902,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = UNSET, .tuner_addr = ADDR_UNSET, }, - [BTTV_PV150] = { + [BTTV_BOARD_PV150] = { /* Luc Van Hoeylandt */ .name = "ProVideo PV150", /* 0x4f */ .video_inputs = 2, @@ -1918,7 +1918,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = UNSET, .tuner_addr = ADDR_UNSET, }, - [BTTV_AD_TVK503] = { + [BTTV_BOARD_AD_TVK503] = { /* Hiroshi Takekawa */ /* This card lacks subsystem ID */ .name = "AD-TVK503", /* 0x63 */ @@ -1939,7 +1939,7 @@ struct tvcard bttv_tvcards[] = { }, /* ---- card 0x64 ---------------------------------- */ - [BTTV_HERCULES_SM_TV] = { + [BTTV_BOARD_HERCULES_SM_TV] = { .name = "Hercules Smart TV Stereo", .video_inputs = 4, .audio_inputs = 1, @@ -1962,7 +1962,7 @@ struct tvcard bttv_tvcards[] = { hef4053 (instead 4052) for unknown function */ }, - [BTTV_PACETV] = { + [BTTV_BOARD_PACETV] = { .name = "Pace TV & Radio Card", .video_inputs = 4, .audio_inputs = 1, @@ -1983,7 +1983,7 @@ struct tvcard bttv_tvcards[] = { .digital_mode = DIGITAL_MODE_CAMERA, todo! */ }, - [BTTV_IVC200] = { + [BTTV_BOARD_IVC200] = { /* Chris Willing */ .name = "IVC-200", .video_inputs = 1, @@ -1996,7 +1996,7 @@ struct tvcard bttv_tvcards[] = { .muxsel = { 2 }, .pll = PLL_28, }, - [BTTV_XGUARD] = { + [BTTV_BOARD_XGUARD] = { .name = "Grand X-Guard / Trust 814PCI", .video_inputs = 16, .audio_inputs = 0, @@ -2014,7 +2014,7 @@ struct tvcard bttv_tvcards[] = { }, /* ---- card 0x68 ---------------------------------- */ - [BTTV_NEBULA_DIGITV] = { + [BTTV_BOARD_NEBULA_DIGITV] = { .name = "Nebula Electronics DigiTV", .video_inputs = 1, .tuner = -1, @@ -2029,7 +2029,7 @@ struct tvcard bttv_tvcards[] = { .has_dvb = 1, .no_gpioirq = 1, }, - [BTTV_PV143] = { + [BTTV_BOARD_PV143] = { /* Jorge Boncompte - DTI2 */ .name = "ProVideo PV143", .video_inputs = 4, @@ -2045,7 +2045,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = -1, .tuner_addr = ADDR_UNSET, }, - [BTTV_VD009X1_MINIDIN] = { + [BTTV_BOARD_VD009X1_MINIDIN] = { /* M.Klahr@phytec.de */ .name = "PHYTEC VD-009-X1 MiniDIN (bt878)", .video_inputs = 4, @@ -2060,7 +2060,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = -1, .tuner_addr = ADDR_UNSET, }, - [BTTV_VD009X1_COMBI] = { + [BTTV_BOARD_VD009X1_COMBI] = { .name = "PHYTEC VD-009-X1 Combi (bt878)", .video_inputs = 4, .audio_inputs = 0, @@ -2076,7 +2076,7 @@ struct tvcard bttv_tvcards[] = { }, /* ---- card 0x6c ---------------------------------- */ - [BTTV_VD009_MINIDIN] = { + [BTTV_BOARD_VD009_MINIDIN] = { .name = "PHYTEC VD-009 MiniDIN (bt878)", .video_inputs = 10, .audio_inputs = 0, @@ -2093,7 +2093,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = -1, .tuner_addr = ADDR_UNSET, }, - [BTTV_VD009_COMBI] = { + [BTTV_BOARD_VD009_COMBI] = { .name = "PHYTEC VD-009 Combi (bt878)", .video_inputs = 10, .audio_inputs = 0, @@ -2110,7 +2110,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = -1, .tuner_addr = ADDR_UNSET, }, - [BTTV_IVC100] = { + [BTTV_BOARD_IVC100] = { .name = "IVC-100", .video_inputs = 4, .audio_inputs = 0, @@ -2122,7 +2122,7 @@ struct tvcard bttv_tvcards[] = { .muxsel = { 2, 3, 1, 0 }, .pll = PLL_28, }, - [BTTV_IVC120] = { + [BTTV_BOARD_IVC120] = { /* IVC-120G - Alan Garfield */ .name = "IVC-120G", .video_inputs = 16, @@ -2143,7 +2143,7 @@ struct tvcard bttv_tvcards[] = { }, /* ---- card 0x70 ---------------------------------- */ - [BTTV_PC_HDTV] = { + [BTTV_BOARD_PC_HDTV] = { .name = "pcHDTV HD-2000 TV", .video_inputs = 4, .audio_inputs = 1, @@ -2154,7 +2154,7 @@ struct tvcard bttv_tvcards[] = { .tuner_addr = ADDR_UNSET, .has_dvb = 1, }, - [BTTV_TWINHAN_DST] = { + [BTTV_BOARD_TWINHAN_DST] = { .name = "Twinhan DST + clones", .no_msp34xx = 1, .no_tda9875 = 1, @@ -2164,7 +2164,7 @@ struct tvcard bttv_tvcards[] = { .no_video = 1, .has_dvb = 1, }, - [BTTV_WINFASTVC100] = { + [BTTV_BOARD_WINFASTVC100] = { .name = "Winfast VC100", .video_inputs = 3, .audio_inputs = 0, @@ -2178,7 +2178,7 @@ struct tvcard bttv_tvcards[] = { .tuner_addr = ADDR_UNSET, .pll = PLL_28, }, - [BTTV_TEV560] = { + [BTTV_BOARD_TEV560] = { .name = "Teppro TEV-560/InterVision IV-560", .video_inputs = 3, .audio_inputs = 1, @@ -2194,7 +2194,7 @@ struct tvcard bttv_tvcards[] = { }, /* ---- card 0x74 ---------------------------------- */ - [BTTV_SIMUS_GVC1100] = { + [BTTV_BOARD_SIMUS_GVC1100] = { .name = "SIMUS GVC1100", .video_inputs = 4, .audio_inputs = 0, @@ -2207,7 +2207,7 @@ struct tvcard bttv_tvcards[] = { .gpiomask = 0x3F, .muxsel_hook = gvc1100_muxsel, }, - [BTTV_NGSTV_PLUS] = { + [BTTV_BOARD_NGSTV_PLUS] = { /* Carlos Silva r3pek@r3pek.homelinux.org || card 0x75 */ .name = "NGS NGSTV+", .video_inputs = 3, @@ -2221,7 +2221,7 @@ struct tvcard bttv_tvcards[] = { .tuner_addr = ADDR_UNSET, .has_remote = 1, }, - [BTTV_LMLBT4] = { + [BTTV_BOARD_LMLBT4] = { /* http://linuxmedialabs.com */ .name = "LMLBT4", .video_inputs = 4, /* IN1,IN2,IN3,IN4 */ @@ -2236,7 +2236,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = -1, .tuner_addr = ADDR_UNSET, }, - [BTTV_TEKRAM_M205] = { + [BTTV_BOARD_TEKRAM_M205] = { /* Helmroos Harri */ .name = "Tekram M205 PRO", .video_inputs = 3, @@ -2253,7 +2253,7 @@ struct tvcard bttv_tvcards[] = { }, /* ---- card 0x78 ---------------------------------- */ - [BTTV_CONTVFMI] = { + [BTTV_BOARD_CONTVFMI] = { /* Javier Cendan Ares */ /* bt878 TV + FM without subsystem ID */ .name = "Conceptronic CONTVFMi", @@ -2271,10 +2271,10 @@ struct tvcard bttv_tvcards[] = { .has_remote = 1, .has_radio = 1, }, - [BTTV_PICOLO_TETRA_CHIP] = { + [BTTV_BOARD_PICOLO_TETRA_CHIP] = { /*Eric DEBIEF */ /*EURESYS Picolo Tetra : 4 Conexant Fusion 878A, no audio, video input set with analog multiplexers GPIO controled*/ - /* adds picolo_tetra_muxsel(), picolo_tetra_init(), the folowing declaration strucure, and #define BTTV_PICOLO_TETRA_CHIP*/ + /* adds picolo_tetra_muxsel(), picolo_tetra_init(), the folowing declaration strucure, and #define BTTV_BOARD_PICOLO_TETRA_CHIP*/ /*0x79 in bttv.h*/ .name = "Euresys Picolo Tetra", .video_inputs = 4, @@ -2294,7 +2294,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = -1, .tuner_addr = ADDR_UNSET, }, - [BTTV_SPIRIT_TV] = { + [BTTV_BOARD_SPIRIT_TV] = { /* Spirit TV Tuner from http://spiritmodems.com.au */ /* Stafford Goodsell */ .name = "Spirit TV Tuner", @@ -2310,7 +2310,7 @@ struct tvcard bttv_tvcards[] = { .no_msp34xx = 1, .no_tda9875 = 1, }, - [BTTV_AVDVBT_771] = { + [BTTV_BOARD_AVDVBT_771] = { /* Wolfram Joost */ .name = "AVerMedia AVerTV DVB-T 771", .video_inputs = 2, @@ -2328,9 +2328,9 @@ struct tvcard bttv_tvcards[] = { .has_remote = 1, }, /* ---- card 0x7c ---------------------------------- */ - [BTTV_AVDVBT_761] = { + [BTTV_BOARD_AVDVBT_761] = { /* Matt Jesson */ - /* Based on the Nebula card data - added remote and new card number - BTTV_AVDVBT_761, see also ir-kbd-gpio.c */ + /* Based on the Nebula card data - added remote and new card number - BTTV_BOARD_AVDVBT_761, see also ir-kbd-gpio.c */ .name = "AverMedia AverTV DVB-T 761", .video_inputs = 2, .tuner = -1, @@ -2346,7 +2346,7 @@ struct tvcard bttv_tvcards[] = { .no_gpioirq = 1, .has_remote = 1, }, - [BTTV_MATRIX_VISIONSQ] = { + [BTTV_BOARD_MATRIX_VISIONSQ] = { /* andre.schwarz@matrix-vision.de */ .name = "MATRIX Vision Sigma-SQ", .video_inputs = 16, @@ -2363,7 +2363,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = -1, .tuner_addr = ADDR_UNSET, }, - [BTTV_MATRIX_VISIONSLC] = { + [BTTV_BOARD_MATRIX_VISIONSLC] = { /* andre.schwarz@matrix-vision.de */ .name = "MATRIX Vision Sigma-SLC", .video_inputs = 4, @@ -2379,8 +2379,8 @@ struct tvcard bttv_tvcards[] = { .tuner_type = -1, .tuner_addr = ADDR_UNSET, }, - /* BTTV_APAC_VIEWCOMP */ - [BTTV_APAC_VIEWCOMP] = { + /* BTTV_BOARD_APAC_VIEWCOMP */ + [BTTV_BOARD_APAC_VIEWCOMP] = { /* Attila Kondoros */ /* bt878 TV + FM 0x00000000 subsystem ID */ .name = "APAC Viewcomp 878(AMAX)", @@ -2400,7 +2400,7 @@ struct tvcard bttv_tvcards[] = { }, /* ---- card 0x80 ---------------------------------- */ - [BTTV_DVICO_DVBT_LITE] = { + [BTTV_BOARD_DVICO_DVBT_LITE] = { /* Chris Pascoe */ .name = "DViCO FusionHDTV DVB-T Lite", .tuner = -1, @@ -2413,7 +2413,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = -1, .tuner_addr = ADDR_UNSET, }, - [BTTV_VGEAR_MYVCD] = { + [BTTV_BOARD_VGEAR_MYVCD] = { /* Steven */ .name = "V-Gear MyVCD", .video_inputs = 3, @@ -2432,7 +2432,7 @@ struct tvcard bttv_tvcards[] = { .has_remote = 1, #endif }, - [BTTV_SUPER_TV] = { + [BTTV_BOARD_SUPER_TV] = { /* Rick C */ .name = "Super TV Tuner", .video_inputs = 4, @@ -2447,7 +2447,7 @@ struct tvcard bttv_tvcards[] = { .needs_tvaudio = 1, .has_radio = 1, }, - [BTTV_TIBET_CS16] = { + [BTTV_BOARD_TIBET_CS16] = { /* Chris Fanning */ .name = "Tibet Systems 'Progress DVR' CS16", .video_inputs = 16, @@ -2463,7 +2463,7 @@ struct tvcard bttv_tvcards[] = { .tuner_addr = ADDR_UNSET, .muxsel_hook = tibetCS16_muxsel, }, - { + [BTTV_BOARD_KODICOM_4400R] = { /* Bill Brack */ /* * Note that, because of the card's wiring, the "master" @@ -2499,7 +2499,7 @@ struct tvcard bttv_tvcards[] = { .no_tda9875 = 1, .muxsel_hook = kodicom4400r_muxsel, }, - { + [BTTV_BOARD_KODICOM_4400R_SL] = { /* Bill Brack */ /* Note that, for reasons unknown, the "master" BT878A chip (i.e. the * one which controls the analog switch, and must use the card type) @@ -2522,8 +2522,8 @@ struct tvcard bttv_tvcards[] = { .no_tda9875 = 1, .muxsel_hook = kodicom4400r_muxsel, }, - { /* ---- card 0x86---------------------------------- */ + [BTTV_BOARD_ADLINK_RTV24] = { /* Michael Henson */ /* Adlink RTV24 with special unlock codes */ .name = "Adlink RTV24", @@ -2536,8 +2536,8 @@ struct tvcard bttv_tvcards[] = { .tuner_addr = ADDR_UNSET, .pll = PLL_28, }, - { /* ---- card 0x87---------------------------------- */ + [BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE] = { /* Michael Krufky */ .name = "DViCO FusionHDTV 5 Lite", .tuner = 0, @@ -2555,7 +2555,7 @@ struct tvcard bttv_tvcards[] = { .has_dvb = 1, }, /* ---- card 0x88---------------------------------- */ - [BTTV_KODICOM_4400R] = { + [BTTV_BOARD_ACORP_Y878F] = { /* Mauro Carvalho Chehab */ .name = "Acorp Y878F", .video_inputs = 3, @@ -2572,7 +2572,7 @@ struct tvcard bttv_tvcards[] = { .has_radio = 1, }, /* ---- card 0x89 ---------------------------------- */ - [BTTV_KODICOM_4400R_SL] = { + [BTTV_BOARD_CONCEPTRONIC_CTVFMI2] = { .name = "Conceptronic CTVFMi v2", .video_inputs = 3, .audio_inputs = 1, @@ -2590,7 +2590,7 @@ struct tvcard bttv_tvcards[] = { .has_radio = 1, #endif }, - [BTTV_ADLINK_RTV24] = { + [BTTV_BOARD_PV_BT878P_2E] = { .name = "Prolink Pixelview PV-BT878P+ (Rev.2E)", .video_inputs = 5, .audio_inputs = 1, @@ -2604,8 +2604,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = TUNER_LG_PAL_FM, .has_remote = 1, - } -}; +}}; static const unsigned int bttv_num_tvcards = ARRAY_SIZE(bttv_tvcards); @@ -2697,11 +2696,11 @@ void identify_by_eeprom(struct bttv *btv, unsigned char eeprom_data[256]) int type = -1; if (0 == strncmp(eeprom_data,"GET MM20xPCTV",13)) - type = BTTV_MODTEC_205; + type = BTTV_BOARD_MODTEC_205; else if (0 == strncmp(eeprom_data+20,"Picolo",7)) - type = BTTV_EURESYS_PICOLO; + type = BTTV_BOARD_EURESYS_PICOLO; else if (eeprom_data[0] == 0x84 && eeprom_data[2]== 0) - type = BTTV_HAUPPAUGE; /* old bt848 */ + type = BTTV_BOARD_HAUPPAUGE; /* old bt848 */ if (-1 != type) { btv->c.type = type; @@ -2807,10 +2806,10 @@ static void miro_pinnacle_gpio(struct bttv *btv) btv->has_radio = 0; } if (-1 != msp) { - if (btv->c.type == BTTV_MIRO) - btv->c.type = BTTV_MIROPRO; - if (btv->c.type == BTTV_PINNACLE) - btv->c.type = BTTV_PINNACLEPRO; + if (btv->c.type == BTTV_BOARD_MIRO) + btv->c.type = BTTV_BOARD_MIROPRO; + if (btv->c.type == BTTV_BOARD_PINNACLE) + btv->c.type = BTTV_BOARD_PINNACLEPRO; } printk(KERN_INFO "bttv%d: miro: id=%d tuner=%d radio=%s stereo=%s\n", @@ -2851,7 +2850,7 @@ static void miro_pinnacle_gpio(struct bttv *btv) break; } if (-1 != msp) - btv->c.type = BTTV_PINNACLEPRO; + btv->c.type = BTTV_BOARD_PINNACLEPRO; printk(KERN_INFO "bttv%d: pinnacle/mt: id=%d info=\"%s\" radio=%s\n", btv->c.nr, id, info, btv->has_radio ? "yes" : "no"); @@ -2965,25 +2964,25 @@ static void bttv_reset_audio(struct bttv *btv) void __devinit bttv_init_card1(struct bttv *btv) { switch (btv->c.type) { - case BTTV_HAUPPAUGE: - case BTTV_HAUPPAUGE878: + case BTTV_BOARD_HAUPPAUGE: + case BTTV_BOARD_HAUPPAUGE878: boot_msp34xx(btv,5); break; - case BTTV_VOODOOTV_FM: + case BTTV_BOARD_VOODOOTV_FM: boot_msp34xx(btv,20); break; - case BTTV_AVERMEDIA98: + case BTTV_BOARD_AVERMEDIA98: boot_msp34xx(btv,11); break; - case BTTV_HAUPPAUGEPVR: + case BTTV_BOARD_HAUPPAUGEPVR: pvr_boot(btv); break; - case BTTV_TWINHAN_DST: - case BTTV_AVDVBT_771: - case BTTV_PINNACLESAT: + case BTTV_BOARD_TWINHAN_DST: + case BTTV_BOARD_AVDVBT_771: + case BTTV_BOARD_PINNACLESAT: btv->use_i2c_hw = 1; break; - case BTTV_ADLINK_RTV24: + case BTTV_BOARD_ADLINK_RTV24: init_RTV24( btv ); break; @@ -3000,51 +2999,51 @@ void __devinit bttv_init_card2(struct bttv *btv) btv->tuner_type = -1; - if (BTTV_UNKNOWN == btv->c.type) { + if (BTTV_BOARD_UNKNOWN == btv->c.type) { bttv_readee(btv,eeprom_data,0xa0); identify_by_eeprom(btv,eeprom_data); } switch (btv->c.type) { - case BTTV_MIRO: - case BTTV_MIROPRO: - case BTTV_PINNACLE: - case BTTV_PINNACLEPRO: + case BTTV_BOARD_MIRO: + case BTTV_BOARD_MIROPRO: + case BTTV_BOARD_PINNACLE: + case BTTV_BOARD_PINNACLEPRO: /* miro/pinnacle */ miro_pinnacle_gpio(btv); break; - case BTTV_FLYVIDEO_98: - case BTTV_MAXI: - case BTTV_LIFE_FLYKIT: - case BTTV_FLYVIDEO: - case BTTV_TYPHOON_TVIEW: - case BTTV_CHRONOS_VS2: - case BTTV_FLYVIDEO_98FM: - case BTTV_FLYVIDEO2000: - case BTTV_FLYVIDEO98EZ: - case BTTV_CONFERENCETV: - case BTTV_LIFETEC_9415: + case BTTV_BOARD_FLYVIDEO_98: + case BTTV_BOARD_MAXI: + case BTTV_BOARD_LIFE_FLYKIT: + case BTTV_BOARD_FLYVIDEO: + case BTTV_BOARD_TYPHOON_TVIEW: + case BTTV_BOARD_CHRONOS_VS2: + case BTTV_BOARD_FLYVIDEO_98FM: + case BTTV_BOARD_FLYVIDEO2000: + case BTTV_BOARD_FLYVIDEO98EZ: + case BTTV_BOARD_CONFERENCETV: + case BTTV_BOARD_LIFETEC_9415: flyvideo_gpio(btv); break; - case BTTV_HAUPPAUGE: - case BTTV_HAUPPAUGE878: - case BTTV_HAUPPAUGEPVR: + case BTTV_BOARD_HAUPPAUGE: + case BTTV_BOARD_HAUPPAUGE878: + case BTTV_BOARD_HAUPPAUGEPVR: /* pick up some config infos from the eeprom */ bttv_readee(btv,eeprom_data,0xa0); hauppauge_eeprom(btv); break; - case BTTV_AVERMEDIA98: - case BTTV_AVPHONE98: + case BTTV_BOARD_AVERMEDIA98: + case BTTV_BOARD_AVPHONE98: bttv_readee(btv,eeprom_data,0xa0); avermedia_eeprom(btv); break; - case BTTV_PXC200: + case BTTV_BOARD_PXC200: init_PXC200(btv); break; - case BTTV_PICOLO_TETRA_CHIP: + case BTTV_BOARD_PICOLO_TETRA_CHIP: picolo_tetra_init(btv); break; - case BTTV_VHX: + case BTTV_BOARD_VHX: btv->has_radio = 1; btv->has_matchbox = 1; btv->mbox_we = 0x20; @@ -3053,17 +3052,17 @@ void __devinit bttv_init_card2(struct bttv *btv) btv->mbox_data = 0x10; btv->mbox_mask = 0x38; break; - case BTTV_VOBIS_BOOSTAR: - case BTTV_TERRATV: + case BTTV_BOARD_VOBIS_BOOSTAR: + case BTTV_BOARD_TERRATV: terratec_active_radio_upgrade(btv); break; - case BTTV_MAGICTVIEW061: + case BTTV_BOARD_MAGICTVIEW061: if (btv->cardid == 0x3002144f) { btv->has_radio=1; printk("bttv%d: radio detected by subsystem id (CPH05x)\n",btv->c.nr); } break; - case BTTV_STB2: + case BTTV_BOARD_STB2: if (btv->cardid == 0x3060121a) { /* Fix up entry for 3DFX VoodooTV 100, which is an OEM STB card variant. */ @@ -3071,34 +3070,34 @@ void __devinit bttv_init_card2(struct bttv *btv) btv->tuner_type=TUNER_TEMIC_NTSC; } break; - case BTTV_OSPREY1x0: - case BTTV_OSPREY1x0_848: - case BTTV_OSPREY101_848: - case BTTV_OSPREY1x1: - case BTTV_OSPREY1x1_SVID: - case BTTV_OSPREY2xx: - case BTTV_OSPREY2x0_SVID: - case BTTV_OSPREY2x0: - case BTTV_OSPREY500: - case BTTV_OSPREY540: - case BTTV_OSPREY2000: + case BTTV_BOARD_OSPREY1x0: + case BTTV_BOARD_OSPREY1x0_848: + case BTTV_BOARD_OSPREY101_848: + case BTTV_BOARD_OSPREY1x1: + case BTTV_BOARD_OSPREY1x1_SVID: + case BTTV_BOARD_OSPREY2xx: + case BTTV_BOARD_OSPREY2x0_SVID: + case BTTV_BOARD_OSPREY2x0: + case BTTV_BOARD_OSPREY500: + case BTTV_BOARD_OSPREY540: + case BTTV_BOARD_OSPREY2000: bttv_readee(btv,eeprom_data,0xa0); osprey_eeprom(btv); break; - case BTTV_IDS_EAGLE: + case BTTV_BOARD_IDS_EAGLE: init_ids_eagle(btv); break; - case BTTV_MODTEC_205: + case BTTV_BOARD_MODTEC_205: bttv_readee(btv,eeprom_data,0xa0); modtec_eeprom(btv); break; - case BTTV_LMLBT4: + case BTTV_BOARD_LMLBT4: init_lmlbt4x(btv); break; - case BTTV_TIBET_CS16: + case BTTV_BOARD_TIBET_CS16: tibetCS16_init(btv); break; - case BTTV_KODICOM_4400R: + case BTTV_BOARD_KODICOM_4400R: kodicom4400r_init(btv); break; } @@ -3371,7 +3370,7 @@ static void __devinit osprey_eeprom(struct bttv *btv) checksum += ee[i]; if (checksum != ee[21]) return; - btv->c.type = BTTV_OSPREY1x0_848; + btv->c.type = BTTV_BOARD_OSPREY1x0_848; for (i = 12; i < 21; i++) serial *= 10, serial += ee[i] - '0'; } @@ -3400,47 +3399,47 @@ static void __devinit osprey_eeprom(struct bttv *btv) /* 848 based */ case 0x0004: - btv->c.type = BTTV_OSPREY1x0_848; + btv->c.type = BTTV_BOARD_OSPREY1x0_848; break; case 0x0005: - btv->c.type = BTTV_OSPREY101_848; + btv->c.type = BTTV_BOARD_OSPREY101_848; break; /* 878 based */ case 0x0012: case 0x0013: - btv->c.type = BTTV_OSPREY1x0; + btv->c.type = BTTV_BOARD_OSPREY1x0; break; case 0x0014: case 0x0015: - btv->c.type = BTTV_OSPREY1x1; + btv->c.type = BTTV_BOARD_OSPREY1x1; break; case 0x0016: case 0x0017: case 0x0020: - btv->c.type = BTTV_OSPREY1x1_SVID; + btv->c.type = BTTV_BOARD_OSPREY1x1_SVID; break; case 0x0018: case 0x0019: case 0x001E: case 0x001F: - btv->c.type = BTTV_OSPREY2xx; + btv->c.type = BTTV_BOARD_OSPREY2xx; break; case 0x001A: case 0x001B: - btv->c.type = BTTV_OSPREY2x0_SVID; + btv->c.type = BTTV_BOARD_OSPREY2x0_SVID; break; case 0x0040: - btv->c.type = BTTV_OSPREY500; + btv->c.type = BTTV_BOARD_OSPREY500; break; case 0x0050: case 0x0056: - btv->c.type = BTTV_OSPREY540; + btv->c.type = BTTV_BOARD_OSPREY540; /* bttv_osprey_540_init(btv); */ break; case 0x0060: case 0x0070: - btv->c.type = BTTV_OSPREY2x0; + btv->c.type = BTTV_BOARD_OSPREY2x0; /* enable output on select control lines */ gpio_inout(0xffffff,0x000303); break; @@ -3513,13 +3512,13 @@ void bttv_tda9880_setnorm(struct bttv *btv, int norm) { /* fix up our card entry */ if(norm==VIDEO_MODE_NTSC) { - bttv_tvcards[BTTV_VOODOOTV_FM].audiomux[0]=0x957fff; - bttv_tvcards[BTTV_VOODOOTV_FM].audiomux[4]=0x957fff; + bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].audiomux[0]=0x957fff; + bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].audiomux[4]=0x957fff; dprintk("bttv_tda9880_setnorm to NTSC\n"); } else { - bttv_tvcards[BTTV_VOODOOTV_FM].audiomux[0]=0x947fff; - bttv_tvcards[BTTV_VOODOOTV_FM].audiomux[4]=0x947fff; + bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].audiomux[0]=0x947fff; + bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].audiomux[4]=0x947fff; dprintk("bttv_tda9880_setnorm to PAL\n"); } /* set GPIO according */ diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c index 4826cf0d39d2..504d717b1158 100644 --- a/drivers/media/video/bttv-driver.c +++ b/drivers/media/video/bttv-driver.c @@ -964,7 +964,7 @@ i2c_vidiocschan(struct bttv *btv) c.norm = btv->tvnorm; c.channel = btv->input; bttv_call_i2c_clients(btv,VIDIOCSCHAN,&c); - if (btv->c.type == BTTV_VOODOOTV_FM) + if (btv->c.type == BTTV_BOARD_VOODOOTV_FM) bttv_tda9880_setnorm(btv,c.norm); } @@ -988,7 +988,7 @@ set_tvnorm(struct bttv *btv, unsigned int norm) bt848A_set_timing(btv); switch (btv->c.type) { - case BTTV_VOODOOTV_FM: + case BTTV_BOARD_VOODOOTV_FM: bttv_tda9880_setnorm(btv,norm); break; } diff --git a/drivers/media/video/bttv.h b/drivers/media/video/bttv.h index dcdf9cde7857..2005ca9383df 100644 --- a/drivers/media/video/bttv.h +++ b/drivers/media/video/bttv.h @@ -20,124 +20,145 @@ /* ---------------------------------------------------------- */ /* exported by bttv-cards.c */ -#define BTTV_UNKNOWN 0x00 -#define BTTV_MIRO 0x01 -#define BTTV_HAUPPAUGE 0x02 -#define BTTV_STB 0x03 -#define BTTV_INTEL 0x04 -#define BTTV_DIAMOND 0x05 -#define BTTV_AVERMEDIA 0x06 -#define BTTV_MATRIX_VISION 0x07 -#define BTTV_FLYVIDEO 0x08 -#define BTTV_TURBOTV 0x09 -#define BTTV_HAUPPAUGE878 0x0a -#define BTTV_MIROPRO 0x0b -#define BTTV_ADSTECH_TV 0x0c -#define BTTV_AVERMEDIA98 0x0d -#define BTTV_VHX 0x0e -#define BTTV_ZOLTRIX 0x0f -#define BTTV_PIXVIEWPLAYTV 0x10 -#define BTTV_WINVIEW_601 0x11 -#define BTTV_AVEC_INTERCAP 0x12 -#define BTTV_LIFE_FLYKIT 0x13 -#define BTTV_CEI_RAFFLES 0x14 -#define BTTV_CONFERENCETV 0x15 -#define BTTV_PHOEBE_TVMAS 0x16 -#define BTTV_MODTEC_205 0x17 -#define BTTV_MAGICTVIEW061 0x18 -#define BTTV_VOBIS_BOOSTAR 0x19 -#define BTTV_HAUPPAUG_WCAM 0x1a -#define BTTV_MAXI 0x1b -#define BTTV_TERRATV 0x1c -#define BTTV_PXC200 0x1d -#define BTTV_FLYVIDEO_98 0x1e -#define BTTV_IPROTV 0x1f -#define BTTV_INTEL_C_S_PCI 0x20 -#define BTTV_TERRATVALUE 0x21 -#define BTTV_WINFAST2000 0x22 -#define BTTV_CHRONOS_VS2 0x23 -#define BTTV_TYPHOON_TVIEW 0x24 -#define BTTV_PXELVWPLTVPRO 0x25 -#define BTTV_MAGICTVIEW063 0x26 -#define BTTV_PINNACLE 0x27 -#define BTTV_STB2 0x28 -#define BTTV_AVPHONE98 0x29 -#define BTTV_PV951 0x2a -#define BTTV_ONAIR_TV 0x2b -#define BTTV_SIGMA_TVII_FM 0x2c -#define BTTV_MATRIX_VISION2 0x2d -#define BTTV_ZOLTRIX_GENIE 0x2e -#define BTTV_TERRATVRADIO 0x2f -#define BTTV_DYNALINK 0x30 -#define BTTV_GVBCTV3PCI 0x31 -#define BTTV_PXELVWPLTVPAK 0x32 -#define BTTV_EAGLE 0x33 -#define BTTV_PINNACLEPRO 0x34 -#define BTTV_TVIEW_RDS_FM 0x35 -#define BTTV_LIFETEC_9415 0x36 -#define BTTV_BESTBUY_EASYTV 0x37 -#define BTTV_FLYVIDEO_98FM 0x38 -#define BTTV_GMV1 0x3d -#define BTTV_BESTBUY_EASYTV2 0x3e -#define BTTV_ATI_TVWONDER 0x3f -#define BTTV_ATI_TVWONDERVE 0x40 -#define BTTV_FLYVIDEO2000 0x41 -#define BTTV_TERRATVALUER 0x42 -#define BTTV_GVBCTV4PCI 0x43 -#define BTTV_VOODOOTV_FM 0x44 -#define BTTV_AIMMS 0x45 -#define BTTV_PV_BT878P_PLUS 0x46 -#define BTTV_FLYVIDEO98EZ 0x47 -#define BTTV_PV_BT878P_9B 0x48 -#define BTTV_SENSORAY311 0x49 -#define BTTV_RV605 0x4a -#define BTTV_WINDVR 0x4c -#define BTTV_GRANDTEC 0x4d -#define BTTV_KWORLD 0x4e -#define BTTV_HAUPPAUGEPVR 0x50 -#define BTTV_GVBCTV5PCI 0x51 -#define BTTV_OSPREY1x0 0x52 -#define BTTV_OSPREY1x0_848 0x53 -#define BTTV_OSPREY101_848 0x54 -#define BTTV_OSPREY1x1 0x55 -#define BTTV_OSPREY1x1_SVID 0x56 -#define BTTV_OSPREY2xx 0x57 -#define BTTV_OSPREY2x0_SVID 0x58 -#define BTTV_OSPREY2x0 0x59 -#define BTTV_OSPREY500 0x5a -#define BTTV_OSPREY540 0x5b -#define BTTV_OSPREY2000 0x5c -#define BTTV_IDS_EAGLE 0x5d -#define BTTV_PINNACLESAT 0x5e -#define BTTV_FORMAC_PROTV 0x5f -#define BTTV_EURESYS_PICOLO 0x61 -#define BTTV_PV150 0x62 -#define BTTV_AD_TVK503 0x63 -#define BTTV_IVC200 0x66 -#define BTTV_XGUARD 0x67 -#define BTTV_NEBULA_DIGITV 0x68 -#define BTTV_PV143 0x69 -#define BTTV_IVC100 0x6e -#define BTTV_IVC120 0x6f -#define BTTV_PC_HDTV 0x70 -#define BTTV_TWINHAN_DST 0x71 -#define BTTV_WINFASTVC100 0x72 -#define BTTV_SIMUS_GVC1100 0x74 -#define BTTV_NGSTV_PLUS 0x75 -#define BTTV_LMLBT4 0x76 -#define BTTV_PICOLO_TETRA_CHIP 0x79 -#define BTTV_AVDVBT_771 0x7b -#define BTTV_AVDVBT_761 0x7c -#define BTTV_MATRIX_VISIONSQ 0x7d -#define BTTV_MATRIX_VISIONSLC 0x7e -#define BTTV_APAC_VIEWCOMP 0x7f -#define BTTV_DVICO_DVBT_LITE 0x80 -#define BTTV_TIBET_CS16 0x83 -#define BTTV_KODICOM_4400R 0x84 -#define BTTV_ADLINK_RTV24 0x86 -#define BTTV_DVICO_FUSIONHDTV_5_LITE 0x87 -#define BTTV_ACORP_Y878F 0x88 -#define BTTV_CONCEPTRONIC_CTVFMI2 0x89 +#define BTTV_BOARD_UNKNOWN 0x00 +#define BTTV_BOARD_MIRO 0x01 +#define BTTV_BOARD_HAUPPAUGE 0x02 +#define BTTV_BOARD_STB 0x03 +#define BTTV_BOARD_INTEL 0x04 +#define BTTV_BOARD_DIAMOND 0x05 +#define BTTV_BOARD_AVERMEDIA 0x06 +#define BTTV_BOARD_MATRIX_VISION 0x07 +#define BTTV_BOARD_FLYVIDEO 0x08 +#define BTTV_BOARD_TURBOTV 0x09 +#define BTTV_BOARD_HAUPPAUGE878 0x0a +#define BTTV_BOARD_MIROPRO 0x0b +#define BTTV_BOARD_ADSTECH_TV 0x0c +#define BTTV_BOARD_AVERMEDIA98 0x0d +#define BTTV_BOARD_VHX 0x0e +#define BTTV_BOARD_ZOLTRIX 0x0f +#define BTTV_BOARD_PIXVIEWPLAYTV 0x10 +#define BTTV_BOARD_WINVIEW_601 0x11 +#define BTTV_BOARD_AVEC_INTERCAP 0x12 +#define BTTV_BOARD_LIFE_FLYKIT 0x13 +#define BTTV_BOARD_CEI_RAFFLES 0x14 +#define BTTV_BOARD_CONFERENCETV 0x15 +#define BTTV_BOARD_PHOEBE_TVMAS 0x16 +#define BTTV_BOARD_MODTEC_205 0x17 +#define BTTV_BOARD_MAGICTVIEW061 0x18 +#define BTTV_BOARD_VOBIS_BOOSTAR 0x19 +#define BTTV_BOARD_HAUPPAUG_WCAM 0x1a +#define BTTV_BOARD_MAXI 0x1b +#define BTTV_BOARD_TERRATV 0x1c +#define BTTV_BOARD_PXC200 0x1d +#define BTTV_BOARD_FLYVIDEO_98 0x1e +#define BTTV_BOARD_IPROTV 0x1f +#define BTTV_BOARD_INTEL_C_S_PCI 0x20 +#define BTTV_BOARD_TERRATVALUE 0x21 +#define BTTV_BOARD_WINFAST2000 0x22 +#define BTTV_BOARD_CHRONOS_VS2 0x23 +#define BTTV_BOARD_TYPHOON_TVIEW 0x24 +#define BTTV_BOARD_PXELVWPLTVPRO 0x25 +#define BTTV_BOARD_MAGICTVIEW063 0x26 +#define BTTV_BOARD_PINNACLE 0x27 +#define BTTV_BOARD_STB2 0x28 +#define BTTV_BOARD_AVPHONE98 0x29 +#define BTTV_BOARD_PV951 0x2a +#define BTTV_BOARD_ONAIR_TV 0x2b +#define BTTV_BOARD_SIGMA_TVII_FM 0x2c +#define BTTV_BOARD_MATRIX_VISION2 0x2d +#define BTTV_BOARD_ZOLTRIX_GENIE 0x2e +#define BTTV_BOARD_TERRATVRADIO 0x2f +#define BTTV_BOARD_DYNALINK 0x30 +#define BTTV_BOARD_GVBCTV3PCI 0x31 +#define BTTV_BOARD_PXELVWPLTVPAK 0x32 +#define BTTV_BOARD_EAGLE 0x33 +#define BTTV_BOARD_PINNACLEPRO 0x34 +#define BTTV_BOARD_TVIEW_RDS_FM 0x35 +#define BTTV_BOARD_LIFETEC_9415 0x36 +#define BTTV_BOARD_BESTBUY_EASYTV 0x37 +#define BTTV_BOARD_FLYVIDEO_98FM 0x38 +#define BTTV_BOARD_GRANDTEC 0x39 +#define BTTV_BOARD_ASKEY_CPH060 0x3a +#define BTTV_BOARD_ASKEY_CPH03X 0x3b +#define BTTV_BOARD_MM100PCTV 0x3c +#define BTTV_BOARD_GMV1 0x3d +#define BTTV_BOARD_BESTBUY_EASYTV2 0x3e +#define BTTV_BOARD_ATI_TVWONDER 0x3f +#define BTTV_BOARD_ATI_TVWONDERVE 0x40 +#define BTTV_BOARD_FLYVIDEO2000 0x41 +#define BTTV_BOARD_TERRATVALUER 0x42 +#define BTTV_BOARD_GVBCTV4PCI 0x43 +#define BTTV_BOARD_VOODOOTV_FM 0x44 +#define BTTV_BOARD_AIMMS 0x45 +#define BTTV_BOARD_PV_BT878P_PLUS 0x46 +#define BTTV_BOARD_FLYVIDEO98EZ 0x47 +#define BTTV_BOARD_PV_BT878P_9B 0x48 +#define BTTV_BOARD_SENSORAY311 0x49 +#define BTTV_BOARD_RV605 0x4a +#define BTTV_BOARD_POWERCLR_MTV878 0x4b +#define BTTV_BOARD_WINDVR 0x4c +#define BTTV_BOARD_GRANDTEC_MULTI 0x4d +#define BTTV_BOARD_KWORLD 0x4e +#define BTTV_BOARD_DSP_TCVIDEO 0x4f +#define BTTV_BOARD_HAUPPAUGEPVR 0x50 +#define BTTV_BOARD_GVBCTV5PCI 0x51 +#define BTTV_BOARD_OSPREY1x0 0x52 +#define BTTV_BOARD_OSPREY1x0_848 0x53 +#define BTTV_BOARD_OSPREY101_848 0x54 +#define BTTV_BOARD_OSPREY1x1 0x55 +#define BTTV_BOARD_OSPREY1x1_SVID 0x56 +#define BTTV_BOARD_OSPREY2xx 0x57 +#define BTTV_BOARD_OSPREY2x0_SVID 0x58 +#define BTTV_BOARD_OSPREY2x0 0x59 +#define BTTV_BOARD_OSPREY500 0x5a +#define BTTV_BOARD_OSPREY540 0x5b +#define BTTV_BOARD_OSPREY2000 0x5c +#define BTTV_BOARD_IDS_EAGLE 0x5d +#define BTTV_BOARD_PINNACLESAT 0x5e +#define BTTV_BOARD_FORMAC_PROTV 0x5f +#define BTTV_BOARD_MACHTV 0x60 +#define BTTV_BOARD_EURESYS_PICOLO 0x61 +#define BTTV_BOARD_PV150 0x62 +#define BTTV_BOARD_AD_TVK503 0x63 +#define BTTV_BOARD_HERCULES_SM_TV 0x64 +#define BTTV_BOARD_PACETV 0x65 +#define BTTV_BOARD_IVC200 0x66 +#define BTTV_BOARD_XGUARD 0x67 +#define BTTV_BOARD_NEBULA_DIGITV 0x68 +#define BTTV_BOARD_PV143 0x69 +#define BTTV_BOARD_VD009X1_MINIDIN 0x6a +#define BTTV_BOARD_VD009X1_COMBI 0x6b +#define BTTV_BOARD_VD009_MINIDIN 0x6c +#define BTTV_BOARD_VD009_COMBI 0x6d +#define BTTV_BOARD_IVC100 0x6e +#define BTTV_BOARD_IVC120 0x6f +#define BTTV_BOARD_PC_HDTV 0x70 +#define BTTV_BOARD_TWINHAN_DST 0x71 +#define BTTV_BOARD_WINFASTVC100 0x72 +#define BTTV_BOARD_TEV560 0x73 +#define BTTV_BOARD_SIMUS_GVC1100 0x74 +#define BTTV_BOARD_NGSTV_PLUS 0x75 +#define BTTV_BOARD_LMLBT4 0x76 +#define BTTV_BOARD_TEKRAM_M205 0x77 +#define BTTV_BOARD_CONTVFMI 0x78 +#define BTTV_BOARD_PICOLO_TETRA_CHIP 0x79 +#define BTTV_BOARD_SPIRIT_TV 0x7a +#define BTTV_BOARD_AVDVBT_771 0x7b +#define BTTV_BOARD_AVDVBT_761 0x7c +#define BTTV_BOARD_MATRIX_VISIONSQ 0x7d +#define BTTV_BOARD_MATRIX_VISIONSLC 0x7e +#define BTTV_BOARD_APAC_VIEWCOMP 0x7f +#define BTTV_BOARD_DVICO_DVBT_LITE 0x80 +#define BTTV_BOARD_VGEAR_MYVCD 0x81 +#define BTTV_BOARD_SUPER_TV 0x82 +#define BTTV_BOARD_TIBET_CS16 0x83 +#define BTTV_BOARD_KODICOM_4400R 0x84 +#define BTTV_BOARD_KODICOM_4400R_SL 0x85 +#define BTTV_BOARD_ADLINK_RTV24 0x86 +#define BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE 0x87 +#define BTTV_BOARD_ACORP_Y878F 0x88 +#define BTTV_BOARD_CONCEPTRONIC_CTVFMI2 0x89 +#define BTTV_BOARD_PV_BT878P_2E 0x8a /* i2c address list */ #define I2C_TSA5522 0xc2 @@ -247,7 +268,7 @@ extern int bttv_handle_chipset(struct bttv *btv); interface below for new code */ /* returns card type + card ID (for bt878-based ones) - for possible values see lines below beginning with #define BTTV_UNKNOWN + for possible values see lines below beginning with #define BTTV_BOARD_UNKNOWN returns negative value if error occurred */ extern int bttv_get_cardinfo(unsigned int card, int *type, diff --git a/drivers/media/video/ir-kbd-gpio.c b/drivers/media/video/ir-kbd-gpio.c index 28b58976f8e0..cc5973950c05 100644 --- a/drivers/media/video/ir-kbd-gpio.c +++ b/drivers/media/video/ir-kbd-gpio.c @@ -347,54 +347,54 @@ static int ir_probe(struct device *dev) /* detect & configure */ switch (sub->core->type) { - case BTTV_AVERMEDIA: - case BTTV_AVPHONE98: - case BTTV_AVERMEDIA98: + case BTTV_BOARD_AVERMEDIA: + case BTTV_BOARD_AVPHONE98: + case BTTV_BOARD_AVERMEDIA98: ir_codes = ir_codes_avermedia; ir->mask_keycode = 0xf88000; ir->mask_keydown = 0x010000; ir->polling = 50; // ms break; - case BTTV_AVDVBT_761: - case BTTV_AVDVBT_771: + case BTTV_BOARD_AVDVBT_761: + case BTTV_BOARD_AVDVBT_771: ir_codes = ir_codes_avermedia_dvbt; ir->mask_keycode = 0x0f00c0; ir->mask_keydown = 0x000020; ir->polling = 50; // ms break; - case BTTV_PXELVWPLTVPAK: + case BTTV_BOARD_PXELVWPLTVPAK: ir_codes = ir_codes_pixelview; ir->mask_keycode = 0x003e00; ir->mask_keyup = 0x010000; ir->polling = 50; // ms break; - case BTTV_PV_BT878P_9B: - case BTTV_PV_BT878P_PLUS: + case BTTV_BOARD_PV_BT878P_9B: + case BTTV_BOARD_PV_BT878P_PLUS: ir_codes = ir_codes_pixelview; ir->mask_keycode = 0x001f00; ir->mask_keyup = 0x008000; ir->polling = 50; // ms break; - case BTTV_WINFAST2000: + case BTTV_BOARD_WINFAST2000: ir_codes = ir_codes_winfast; ir->mask_keycode = 0x1f8; break; - case BTTV_MAGICTVIEW061: - case BTTV_MAGICTVIEW063: + case BTTV_BOARD_MAGICTVIEW061: + case BTTV_BOARD_MAGICTVIEW063: ir_codes = ir_codes_winfast; ir->mask_keycode = 0x0008e000; ir->mask_keydown = 0x00200000; break; - case BTTV_APAC_VIEWCOMP: + case BTTV_BOARD_APAC_VIEWCOMP: ir_codes = ir_codes_apac_viewcomp; ir->mask_keycode = 0x001f00; ir->mask_keyup = 0x008000; ir->polling = 50; // ms break; - case BTTV_CONCEPTRONIC_CTVFMI2: + case BTTV_BOARD_CONCEPTRONIC_CTVFMI2: ir_codes = ir_codes_conceptronic; ir->mask_keycode = 0x001F00; ir->mask_keyup = 0x006000; -- cgit v1.2.2 From da57a5d9050d83441769e275d54d88fbd768be49 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:36:53 -0800 Subject: [PATCH] v4l: 694: updated an entry to reflect changes on tuner-simple.c - Updated an entry to reflect changes on tuner-simple.c Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/video4linux/CARDLIST.bttv | 278 +++++++++++++++---------------- Documentation/video4linux/CARDLIST.tuner | 2 +- 2 files changed, 140 insertions(+), 140 deletions(-) diff --git a/Documentation/video4linux/CARDLIST.bttv b/Documentation/video4linux/CARDLIST.bttv index 5deb052f3078..a35465f50f99 100644 --- a/Documentation/video4linux/CARDLIST.bttv +++ b/Documentation/video4linux/CARDLIST.bttv @@ -1,139 +1,139 @@ -card=0 - *** UNKNOWN/GENERIC *** -card=1 - MIRO PCTV -card=2 - Hauppauge (bt848) -card=3 - STB, Gateway P/N 6000699 (bt848) -card=4 - Intel Create and Share PCI/ Smart Video Recorder III -card=5 - Diamond DTV2000 -card=6 - AVerMedia TVPhone -card=7 - MATRIX-Vision MV-Delta -card=8 - Lifeview FlyVideo II (Bt848) LR26 / MAXI TV Video PCI2 LR26 -card=9 - IMS/IXmicro TurboTV -card=10 - Hauppauge (bt878) -card=11 - MIRO PCTV pro -card=12 - ADS Technologies Channel Surfer TV (bt848) -card=13 - AVerMedia TVCapture 98 -card=14 - Aimslab Video Highway Xtreme (VHX) -card=15 - Zoltrix TV-Max -card=16 - Prolink Pixelview PlayTV (bt878) -card=17 - Leadtek WinView 601 -card=18 - AVEC Intercapture -card=19 - Lifeview FlyVideo II EZ /FlyKit LR38 Bt848 (capture only) -card=20 - CEI Raffles Card -card=21 - Lifeview FlyVideo 98/ Lucky Star Image World ConferenceTV LR50 -card=22 - Askey CPH050/ Phoebe Tv Master + FM -card=23 - Modular Technology MM201/MM202/MM205/MM210/MM215 PCTV, bt878 -card=24 - Askey CPH05X/06X (bt878) [many vendors] -card=25 - Terratec TerraTV+ Version 1.0 (Bt848)/ Terra TValue Version 1.0/ Vobis TV-Boostar -card=26 - Hauppauge WinCam newer (bt878) -card=27 - Lifeview FlyVideo 98/ MAXI TV Video PCI2 LR50 -card=28 - Terratec TerraTV+ Version 1.1 (bt878) -card=29 - Imagenation PXC200 -card=30 - Lifeview FlyVideo 98 LR50 -card=31 - Formac iProTV, Formac ProTV I (bt848) -card=32 - Intel Create and Share PCI/ Smart Video Recorder III -card=33 - Terratec TerraTValue Version Bt878 -card=34 - Leadtek WinFast 2000/ WinFast 2000 XP -card=35 - Lifeview FlyVideo 98 LR50 / Chronos Video Shuttle II -card=36 - Lifeview FlyVideo 98FM LR50 / Typhoon TView TV/FM Tuner -card=37 - Prolink PixelView PlayTV pro -card=38 - Askey CPH06X TView99 -card=39 - Pinnacle PCTV Studio/Rave -card=40 - STB TV PCI FM, Gateway P/N 6000704 (bt878), 3Dfx VoodooTV 100 -card=41 - AVerMedia TVPhone 98 -card=42 - ProVideo PV951 -card=43 - Little OnAir TV -card=44 - Sigma TVII-FM -card=45 - MATRIX-Vision MV-Delta 2 -card=46 - Zoltrix Genie TV/FM -card=47 - Terratec TV/Radio+ -card=48 - Askey CPH03x/ Dynalink Magic TView -card=49 - IODATA GV-BCTV3/PCI -card=50 - Prolink PV-BT878P+4E / PixelView PlayTV PAK / Lenco MXTV-9578 CP -card=51 - Eagle Wireless Capricorn2 (bt878A) -card=52 - Pinnacle PCTV Studio Pro -card=53 - Typhoon TView RDS + FM Stereo / KNC1 TV Station RDS -card=54 - Lifeview FlyVideo 2000 /FlyVideo A2/ Lifetec LT 9415 TV [LR90] -card=55 - Askey CPH031/ BESTBUY Easy TV -card=56 - Lifeview FlyVideo 98FM LR50 -card=57 - GrandTec 'Grand Video Capture' (Bt848) -card=58 - Askey CPH060/ Phoebe TV Master Only (No FM) -card=59 - Askey CPH03x TV Capturer -card=60 - Modular Technology MM100PCTV -card=61 - AG Electronics GMV1 -card=62 - Askey CPH061/ BESTBUY Easy TV (bt878) -card=63 - ATI TV-Wonder -card=64 - ATI TV-Wonder VE -card=65 - Lifeview FlyVideo 2000S LR90 -card=66 - Terratec TValueRadio -card=67 - IODATA GV-BCTV4/PCI -card=68 - 3Dfx VoodooTV FM (Euro), VoodooTV 200 (USA) -card=69 - Active Imaging AIMMS -card=70 - Prolink Pixelview PV-BT878P+ (Rev.4C,8E) -card=71 - Lifeview FlyVideo 98EZ (capture only) LR51 -card=72 - Prolink Pixelview PV-BT878P+9B (PlayTV Pro rev.9B FM+NICAM) -card=73 - Sensoray 311 -card=74 - RemoteVision MX (RV605) -card=75 - Powercolor MTV878/ MTV878R/ MTV878F -card=76 - Canopus WinDVR PCI (COMPAQ Presario 3524JP, 5112JP) -card=77 - GrandTec Multi Capture Card (Bt878) -card=78 - Jetway TV/Capture JW-TV878-FBK, Kworld KW-TV878RF -card=79 - DSP Design TCVIDEO -card=80 - Hauppauge WinTV PVR -card=81 - IODATA GV-BCTV5/PCI -card=82 - Osprey 100/150 (878) -card=83 - Osprey 100/150 (848) -card=84 - Osprey 101 (848) -card=85 - Osprey 101/151 -card=86 - Osprey 101/151 w/ svid -card=87 - Osprey 200/201/250/251 -card=88 - Osprey 200/250 -card=89 - Osprey 210/220 -card=90 - Osprey 500 -card=91 - Osprey 540 -card=92 - Osprey 2000 -card=93 - IDS Eagle -card=94 - Pinnacle PCTV Sat -card=95 - Formac ProTV II (bt878) -card=96 - MachTV -card=97 - Euresys Picolo -card=98 - ProVideo PV150 -card=99 - AD-TVK503 -card=100 - Hercules Smart TV Stereo -card=101 - Pace TV & Radio Card -card=102 - IVC-200 -card=103 - Grand X-Guard / Trust 814PCI -card=104 - Nebula Electronics DigiTV -card=105 - ProVideo PV143 -card=106 - PHYTEC VD-009-X1 MiniDIN (bt878) -card=107 - PHYTEC VD-009-X1 Combi (bt878) -card=108 - PHYTEC VD-009 MiniDIN (bt878) -card=109 - PHYTEC VD-009 Combi (bt878) -card=110 - IVC-100 -card=111 - IVC-120G -card=112 - pcHDTV HD-2000 TV -card=113 - Twinhan DST + clones -card=114 - Winfast VC100 -card=115 - Teppro TEV-560/InterVision IV-560 -card=116 - SIMUS GVC1100 -card=117 - NGS NGSTV+ -card=118 - LMLBT4 -card=119 - Tekram M205 PRO -card=120 - Conceptronic CONTVFMi -card=121 - Euresys Picolo Tetra -card=122 - Spirit TV Tuner -card=123 - AVerMedia AVerTV DVB-T 771 -card=124 - AverMedia AverTV DVB-T 761 -card=125 - MATRIX Vision Sigma-SQ -card=126 - MATRIX Vision Sigma-SLC -card=127 - APAC Viewcomp 878(AMAX) -card=128 - DViCO FusionHDTV DVB-T Lite -card=129 - V-Gear MyVCD -card=130 - Super TV Tuner -card=131 - Tibet Systems 'Progress DVR' CS16 -card=132 - Kodicom 4400R (master) -card=133 - Kodicom 4400R (slave) -card=134 - Adlink RTV24 -card=135 - DViCO FusionHDTV 5 Lite -card=136 - Acorp Y878F -card=137 - Conceptronic CTVFMi v2 -card=138 - Prolink Pixelview PV-BT878P+ (Rev.2E) + 0 -> *** UNKNOWN/GENERIC *** + 1 -> MIRO PCTV + 2 -> Hauppauge (bt848) + 3 -> STB, Gateway P/N 6000699 (bt848) + 4 -> Intel Create and Share PCI/ Smart Video Recorder III + 5 -> Diamond DTV2000 + 6 -> AVerMedia TVPhone + 7 -> MATRIX-Vision MV-Delta + 8 -> Lifeview FlyVideo II (Bt848) LR26 / MAXI TV Video PCI2 LR26 + 9 -> IMS/IXmicro TurboTV + 10 -> Hauppauge (bt878) [0070:13eb,0070:3900,2636:10b4] + 11 -> MIRO PCTV pro + 12 -> ADS Technologies Channel Surfer TV (bt848) + 13 -> AVerMedia TVCapture 98 [1461:0002,1461:0004,1461:0300] + 14 -> Aimslab Video Highway Xtreme (VHX) + 15 -> Zoltrix TV-Max + 16 -> Prolink Pixelview PlayTV (bt878) + 17 -> Leadtek WinView 601 + 18 -> AVEC Intercapture + 19 -> Lifeview FlyVideo II EZ /FlyKit LR38 Bt848 (capture only) + 20 -> CEI Raffles Card + 21 -> Lifeview FlyVideo 98/ Lucky Star Image World ConferenceTV LR50 + 22 -> Askey CPH050/ Phoebe Tv Master + FM [14ff:3002] + 23 -> Modular Technology MM201/MM202/MM205/MM210/MM215 PCTV, bt878 [14c7:0101] + 24 -> Askey CPH05X/06X (bt878) [many vendors] [144f:3002,144f:3005,144f:5000,14ff:3000] + 25 -> Terratec TerraTV+ Version 1.0 (Bt848)/ Terra TValue Version 1.0/ Vobis TV-Boostar + 26 -> Hauppauge WinCam newer (bt878) + 27 -> Lifeview FlyVideo 98/ MAXI TV Video PCI2 LR50 + 28 -> Terratec TerraTV+ Version 1.1 (bt878) [153b:1127,1852:1852] + 29 -> Imagenation PXC200 [1295:200a] + 30 -> Lifeview FlyVideo 98 LR50 [1f7f:1850] + 31 -> Formac iProTV, Formac ProTV I (bt848) + 32 -> Intel Create and Share PCI/ Smart Video Recorder III + 33 -> Terratec TerraTValue Version Bt878 [153b:1117,153b:1118,153b:1119,153b:111a,153b:1134,153b:5018] + 34 -> Leadtek WinFast 2000/ WinFast 2000 XP [107d:6606,107d:6609,6606:217d] + 35 -> Lifeview FlyVideo 98 LR50 / Chronos Video Shuttle II [1851:1850] + 36 -> Lifeview FlyVideo 98FM LR50 / Typhoon TView TV/FM Tuner [1852:1852] + 37 -> Prolink PixelView PlayTV pro + 38 -> Askey CPH06X TView99 [144f:3000] + 39 -> Pinnacle PCTV Studio/Rave [11bd:0012] + 40 -> STB TV PCI FM, Gateway P/N 6000704 (bt878), 3Dfx VoodooTV 100 [10b4:2636,10b4:2645,121a:3060] + 41 -> AVerMedia TVPhone 98 [1461:0001,1461:0003] + 42 -> ProVideo PV951 + 43 -> Little OnAir TV + 44 -> Sigma TVII-FM + 45 -> MATRIX-Vision MV-Delta 2 + 46 -> Zoltrix Genie TV/FM [15b0:4000,15b0:400a,15b0:400d,15b0:4010,15b0:4016] + 47 -> Terratec TV/Radio+ [153b:1123] + 48 -> Askey CPH03x/ Dynalink Magic TView + 49 -> IODATA GV-BCTV3/PCI [10fc:4020] + 50 -> Prolink PV-BT878P+4E / PixelView PlayTV PAK / Lenco MXTV-9578 CP + 51 -> Eagle Wireless Capricorn2 (bt878A) + 52 -> Pinnacle PCTV Studio Pro + 53 -> Typhoon TView RDS + FM Stereo / KNC1 TV Station RDS + 54 -> Lifeview FlyVideo 2000 /FlyVideo A2/ Lifetec LT 9415 TV [LR90] + 55 -> Askey CPH031/ BESTBUY Easy TV + 56 -> Lifeview FlyVideo 98FM LR50 + 57 -> GrandTec 'Grand Video Capture' (Bt848) [4344:4142] + 58 -> Askey CPH060/ Phoebe TV Master Only (No FM) + 59 -> Askey CPH03x TV Capturer + 60 -> Modular Technology MM100PCTV + 61 -> AG Electronics GMV1 [15cb:0101] + 62 -> Askey CPH061/ BESTBUY Easy TV (bt878) + 63 -> ATI TV-Wonder [1002:0001] + 64 -> ATI TV-Wonder VE [1002:0003] + 65 -> Lifeview FlyVideo 2000S LR90 + 66 -> Terratec TValueRadio [153b:1135] + 67 -> IODATA GV-BCTV4/PCI [10fc:4050] + 68 -> 3Dfx VoodooTV FM (Euro), VoodooTV 200 (USA) [121a:3000,10b4:2637] + 69 -> Active Imaging AIMMS + 70 -> Prolink Pixelview PV-BT878P+ (Rev.4C,8E) + 71 -> Lifeview FlyVideo 98EZ (capture only) LR51 [1851:1851] + 72 -> Prolink Pixelview PV-BT878P+9B (PlayTV Pro rev.9B FM+NICAM) [1554:4011] + 73 -> Sensoray 311 [6000:0311] + 74 -> RemoteVision MX (RV605) + 75 -> Powercolor MTV878/ MTV878R/ MTV878F + 76 -> Canopus WinDVR PCI (COMPAQ Presario 3524JP, 5112JP) [0e11:0079] + 77 -> GrandTec Multi Capture Card (Bt878) + 78 -> Jetway TV/Capture JW-TV878-FBK, Kworld KW-TV878RF [0a01:17de] + 79 -> DSP Design TCVIDEO + 80 -> Hauppauge WinTV PVR [0070:4500] + 81 -> IODATA GV-BCTV5/PCI [10fc:4070] + 82 -> Osprey 100/150 (878) + 83 -> Osprey 100/150 (848) + 84 -> Osprey 101 (848) + 85 -> Osprey 101/151 + 86 -> Osprey 101/151 w/ svid + 87 -> Osprey 200/201/250/251 + 88 -> Osprey 200/250 + 89 -> Osprey 210/220 + 90 -> Osprey 500 + 91 -> Osprey 540 + 92 -> Osprey 2000 + 93 -> IDS Eagle + 94 -> Pinnacle PCTV Sat [11bd:001c] + 95 -> Formac ProTV II (bt878) + 96 -> MachTV + 97 -> Euresys Picolo + 98 -> ProVideo PV150 + 99 -> AD-TVK503 +100 -> Hercules Smart TV Stereo +101 -> Pace TV & Radio Card +102 -> IVC-200 +103 -> Grand X-Guard / Trust 814PCI [0304:0102] +104 -> Nebula Electronics DigiTV [0071:0101] +105 -> ProVideo PV143 +106 -> PHYTEC VD-009-X1 MiniDIN (bt878) +107 -> PHYTEC VD-009-X1 Combi (bt878) +108 -> PHYTEC VD-009 MiniDIN (bt878) +109 -> PHYTEC VD-009 Combi (bt878) +110 -> IVC-100 +111 -> IVC-120G +112 -> pcHDTV HD-2000 TV [7063:2000] +113 -> Twinhan DST + clones [11bd:0026,1822:0001] +114 -> Winfast VC100 [107d:6607] +115 -> Teppro TEV-560/InterVision IV-560 +116 -> SIMUS GVC1100 +117 -> NGS NGSTV+ +118 -> LMLBT4 +119 -> Tekram M205 PRO +120 -> Conceptronic CONTVFMi +121 -> Euresys Picolo Tetra [1805:0105,1805:0106,1805:0107,1805:0108] +122 -> Spirit TV Tuner +123 -> AVerMedia AVerTV DVB-T 771 [1461:0771] +124 -> AverMedia AverTV DVB-T 761 [1461:0761] +125 -> MATRIX Vision Sigma-SQ +126 -> MATRIX Vision Sigma-SLC +127 -> APAC Viewcomp 878(AMAX) +128 -> DViCO FusionHDTV DVB-T Lite +129 -> V-Gear MyVCD +130 -> Super TV Tuner +131 -> Tibet Systems 'Progress DVR' CS16 +132 -> Kodicom 4400R (master) +133 -> Kodicom 4400R (slave) +134 -> Adlink RTV24 +135 -> DViCO FusionHDTV 5 Lite +136 -> Acorp Y878F [9511:1540] +137 -> Conceptronic CTVFMi v2 +138 -> Prolink Pixelview PV-BT878P+ (Rev.2E) diff --git a/Documentation/video4linux/CARDLIST.tuner b/Documentation/video4linux/CARDLIST.tuner index 84203302b271..0e2ea497ad7f 100644 --- a/Documentation/video4linux/CARDLIST.tuner +++ b/Documentation/video4linux/CARDLIST.tuner @@ -53,7 +53,7 @@ tuner=51 - Philips PAL/SECAM_D (FM 1256 I-H3) tuner=52 - Thomson DDT 7610 (ATSC/NTSC) tuner=53 - Philips FQ1286 tuner=54 - tda8290+75 -tuner=55 - LG PAL (TAPE series) +tuner=55 - TCL 2002MB tuner=56 - Philips PAL/SECAM multi (FQ1216AME MK4) tuner=57 - Philips FQ1236A MK4 tuner=58 - Ymec TVision TVF-8531MF/8831MF/8731MF -- cgit v1.2.2 From 6589d36a07864aa110dd4f1065c02f5bc7cc29a1 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:36:54 -0800 Subject: [PATCH] v4l: 695: added more pci id - Added more PCI ID. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/video4linux/CARDLIST.bttv | 46 ++++++++++++++++----------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/Documentation/video4linux/CARDLIST.bttv b/Documentation/video4linux/CARDLIST.bttv index a35465f50f99..dd7b565be69d 100644 --- a/Documentation/video4linux/CARDLIST.bttv +++ b/Documentation/video4linux/CARDLIST.bttv @@ -13,7 +13,7 @@ 12 -> ADS Technologies Channel Surfer TV (bt848) 13 -> AVerMedia TVCapture 98 [1461:0002,1461:0004,1461:0300] 14 -> Aimslab Video Highway Xtreme (VHX) - 15 -> Zoltrix TV-Max + 15 -> Zoltrix TV-Max [a1a0:a0fc] 16 -> Prolink Pixelview PlayTV (bt878) 17 -> Leadtek WinView 601 18 -> AVEC Intercapture @@ -32,15 +32,15 @@ 31 -> Formac iProTV, Formac ProTV I (bt848) 32 -> Intel Create and Share PCI/ Smart Video Recorder III 33 -> Terratec TerraTValue Version Bt878 [153b:1117,153b:1118,153b:1119,153b:111a,153b:1134,153b:5018] - 34 -> Leadtek WinFast 2000/ WinFast 2000 XP [107d:6606,107d:6609,6606:217d] - 35 -> Lifeview FlyVideo 98 LR50 / Chronos Video Shuttle II [1851:1850] + 34 -> Leadtek WinFast 2000/ WinFast 2000 XP [107d:6606,107d:6609,6606:217d,f6ff:fff6] + 35 -> Lifeview FlyVideo 98 LR50 / Chronos Video Shuttle II [1851:1850,1851:a050] 36 -> Lifeview FlyVideo 98FM LR50 / Typhoon TView TV/FM Tuner [1852:1852] 37 -> Prolink PixelView PlayTV pro - 38 -> Askey CPH06X TView99 [144f:3000] - 39 -> Pinnacle PCTV Studio/Rave [11bd:0012] + 38 -> Askey CPH06X TView99 [144f:3000,144f:a005,a04f:a0fc] + 39 -> Pinnacle PCTV Studio/Rave [11bd:0012,bd11:1200,bd11:ff00,11bd:ff12] 40 -> STB TV PCI FM, Gateway P/N 6000704 (bt878), 3Dfx VoodooTV 100 [10b4:2636,10b4:2645,121a:3060] 41 -> AVerMedia TVPhone 98 [1461:0001,1461:0003] - 42 -> ProVideo PV951 + 42 -> ProVideo PV951 [aa0c:146c] 43 -> Little OnAir TV 44 -> Sigma TVII-FM 45 -> MATRIX-Vision MV-Delta 2 @@ -54,7 +54,7 @@ 53 -> Typhoon TView RDS + FM Stereo / KNC1 TV Station RDS 54 -> Lifeview FlyVideo 2000 /FlyVideo A2/ Lifetec LT 9415 TV [LR90] 55 -> Askey CPH031/ BESTBUY Easy TV - 56 -> Lifeview FlyVideo 98FM LR50 + 56 -> Lifeview FlyVideo 98FM LR50 [a051:41a0] 57 -> GrandTec 'Grand Video Capture' (Bt848) [4344:4142] 58 -> Askey CPH060/ Phoebe TV Master Only (No FM) 59 -> Askey CPH03x TV Capturer @@ -64,7 +64,7 @@ 63 -> ATI TV-Wonder [1002:0001] 64 -> ATI TV-Wonder VE [1002:0003] 65 -> Lifeview FlyVideo 2000S LR90 - 66 -> Terratec TValueRadio [153b:1135] + 66 -> Terratec TValueRadio [153b:1135,153b:ff3b] 67 -> IODATA GV-BCTV4/PCI [10fc:4050] 68 -> 3Dfx VoodooTV FM (Euro), VoodooTV 200 (USA) [121a:3000,10b4:2637] 69 -> Active Imaging AIMMS @@ -79,42 +79,42 @@ 78 -> Jetway TV/Capture JW-TV878-FBK, Kworld KW-TV878RF [0a01:17de] 79 -> DSP Design TCVIDEO 80 -> Hauppauge WinTV PVR [0070:4500] - 81 -> IODATA GV-BCTV5/PCI [10fc:4070] - 82 -> Osprey 100/150 (878) + 81 -> IODATA GV-BCTV5/PCI [10fc:4070,10fc:d018] + 82 -> Osprey 100/150 (878) [0070:ff00] 83 -> Osprey 100/150 (848) 84 -> Osprey 101 (848) 85 -> Osprey 101/151 86 -> Osprey 101/151 w/ svid 87 -> Osprey 200/201/250/251 - 88 -> Osprey 200/250 + 88 -> Osprey 200/250 [0070:ff01] 89 -> Osprey 210/220 - 90 -> Osprey 500 - 91 -> Osprey 540 - 92 -> Osprey 2000 + 90 -> Osprey 500 [0070:ff02] + 91 -> Osprey 540 [0070:ff04] + 92 -> Osprey 2000 [0070:ff03] 93 -> IDS Eagle 94 -> Pinnacle PCTV Sat [11bd:001c] 95 -> Formac ProTV II (bt878) 96 -> MachTV 97 -> Euresys Picolo - 98 -> ProVideo PV150 + 98 -> ProVideo PV150 [aa00:1460,aa01:1461,aa02:1462,aa03:1463,aa04:1464,aa05:1465,aa06:1466,aa07:1467] 99 -> AD-TVK503 100 -> Hercules Smart TV Stereo 101 -> Pace TV & Radio Card -102 -> IVC-200 +102 -> IVC-200 [0000:a155,0001:a155,0002:a155,0003:a155,0100:a155,0101:a155,0102:a155,0103:a155] 103 -> Grand X-Guard / Trust 814PCI [0304:0102] 104 -> Nebula Electronics DigiTV [0071:0101] -105 -> ProVideo PV143 +105 -> ProVideo PV143 [aa00:1430,aa00:1431,aa00:1432,aa00:1433,aa03:1433] 106 -> PHYTEC VD-009-X1 MiniDIN (bt878) 107 -> PHYTEC VD-009-X1 Combi (bt878) 108 -> PHYTEC VD-009 MiniDIN (bt878) 109 -> PHYTEC VD-009 Combi (bt878) -110 -> IVC-100 -111 -> IVC-120G +110 -> IVC-100 [ff00:a132] +111 -> IVC-120G [ff00:a182,ff01:a182,ff02:a182,ff03:a182,ff04:a182,ff05:a182,ff06:a182,ff07:a182,ff08:a182,ff09:a182,ff0a:a182,ff0b:a182,ff0c:a182,ff0d:a182,ff0e:a182,ff0f:a182] 112 -> pcHDTV HD-2000 TV [7063:2000] -113 -> Twinhan DST + clones [11bd:0026,1822:0001] +113 -> Twinhan DST + clones [11bd:0026,1822:0001,270f:fc00] 114 -> Winfast VC100 [107d:6607] 115 -> Teppro TEV-560/InterVision IV-560 -116 -> SIMUS GVC1100 +116 -> SIMUS GVC1100 [aa6a:82b2] 117 -> NGS NGSTV+ 118 -> LMLBT4 119 -> Tekram M205 PRO @@ -126,14 +126,14 @@ 125 -> MATRIX Vision Sigma-SQ 126 -> MATRIX Vision Sigma-SLC 127 -> APAC Viewcomp 878(AMAX) -128 -> DViCO FusionHDTV DVB-T Lite +128 -> DViCO FusionHDTV DVB-T Lite [18ac:db10] 129 -> V-Gear MyVCD 130 -> Super TV Tuner 131 -> Tibet Systems 'Progress DVR' CS16 132 -> Kodicom 4400R (master) 133 -> Kodicom 4400R (slave) 134 -> Adlink RTV24 -135 -> DViCO FusionHDTV 5 Lite +135 -> DViCO FusionHDTV 5 Lite [18ac:d500] 136 -> Acorp Y878F [9511:1540] 137 -> Conceptronic CTVFMi v2 138 -> Prolink Pixelview PV-BT878P+ (Rev.2E) -- cgit v1.2.2 From 6af90ab5e7a9111a861fde33726ae960d30915f0 Mon Sep 17 00:00:00 2001 From: Arnaud Patard Date: Tue, 8 Nov 2005 21:36:55 -0800 Subject: [PATCH] v4l: 700: added ir for lifeview flytv platinum mini2 - Added IR for LifeView FlyTV Platinum Mini2. Signed-off-by: Arnaud Patard Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/saa7134/saa7134-cards.c | 1 + drivers/media/video/saa7134/saa7134-input.c | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index a096799dc5f9..3bb0644145bb 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c @@ -2823,6 +2823,7 @@ int saa7134_board_init1(struct saa7134_dev *dev) dev->has_remote = 1; board_flyvideo(dev); break; + case SAA7134_BOARD_FLYTVPLATINUM_MINI2: case SAA7134_BOARD_FLYTVPLATINUM_FM: case SAA7134_BOARD_CINERGY400: case SAA7134_BOARD_CINERGY600: diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index b69b18c5f189..f6fe5f889a4a 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -516,6 +516,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) case SAA7134_BOARD_FLYVIDEO2000: case SAA7134_BOARD_FLYVIDEO3000: case SAA7134_BOARD_FLYTVPLATINUM_FM: + case SAA7134_BOARD_FLYTVPLATINUM_MINI2: ir_codes = flyvideo_codes; mask_keycode = 0xEC00000; mask_keydown = 0x0040000; -- cgit v1.2.2 From 90a7ed47a37297bee1f4ce11484190ccac29ae7c Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:36:56 -0800 Subject: [PATCH] v4l: 702: included audio chips enum - Included audio chips enum Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/tveeprom.c | 432 +++++++++++++++++++++++------------------ include/media/audiochip.h | 17 ++ 2 files changed, 264 insertions(+), 185 deletions(-) diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c index 6453b71f2997..a9bad89b4d69 100644 --- a/drivers/media/video/tveeprom.c +++ b/drivers/media/video/tveeprom.c @@ -40,6 +40,7 @@ #include #include +#include "audiochip.h" MODULE_DESCRIPTION("i2c Hauppauge eeprom decoder driver"); MODULE_AUTHOR("John Klar"); @@ -134,8 +135,8 @@ hauppauge_tuner[] = { TUNER_TEMIC_4039FR5_NTSC, "Temic 4039FR5" }, { TUNER_PHILIPS_FQ1216ME, "Philips FQ1216 ME" }, { TUNER_TEMIC_4066FY5_PAL_I, "Temic 4066FY5" }, - { TUNER_PHILIPS_NTSC, "Philips TD1536" }, - { TUNER_PHILIPS_NTSC, "Philips TD1536D" }, + { TUNER_PHILIPS_NTSC, "Philips TD1536" }, + { TUNER_PHILIPS_NTSC, "Philips TD1536D" }, { TUNER_PHILIPS_NTSC, "Philips FMR1236" }, /* mono radio */ { TUNER_ABSENT, "Philips FI1256MP" }, /* 40-49 */ @@ -189,7 +190,7 @@ hauppauge_tuner[] = { TUNER_LG_PAL_NEW_TAPC, "TCL 2002MB 3"}, { TUNER_LG_PAL_NEW_TAPC, "TCL 2002MI 3"}, { TUNER_TCL_2002N, "TCL 2002N 6A"}, - { TUNER_ABSENT, "Philips FQ1236 MK3"}, + { TUNER_PHILIPS_FM1236_MK3, "Philips FQ1236 MK3"}, { TUNER_ABSENT, "Samsung TCPN 2121P30A"}, { TUNER_ABSENT, "Samsung TCPE 4121P30A"}, { TUNER_PHILIPS_FM1216ME_MK3, "TCL MFPE05 2"}, @@ -202,93 +203,129 @@ hauppauge_tuner[] = { TUNER_ABSENT, "Philips FQ1236 MK5"}, { TUNER_ABSENT, "Samsung TCPG_6121P30A"}, { TUNER_TCL_2002MB, "TCL 2002MB_3H"}, - { TUNER_ABSENT, "TCL 2002MI_3H"}, - { TUNER_TCL_2002N, "TCL 2002N 5H"}, + { TUNER_ABSENT, "TCL 2002MI_3H"}, + { TUNER_TCL_2002N, "TCL 2002N 5H"}, /* 100-109 */ { TUNER_ABSENT, "Philips FMD1216ME"}, - { TUNER_TEA5767, "Philips TEA5768HL FM Radio"}, - { TUNER_ABSENT, "Panasonic ENV57H12D5"}, - { TUNER_ABSENT, "TCL MFNM05-4"}, - { TUNER_ABSENT, "TCL MNM05-4"}, - { TUNER_PHILIPS_FM1216ME_MK3, "TCL MPE05-2"}, - { TUNER_ABSENT, "TCL MQNM05-4"}, - { TUNER_ABSENT, "LG TAPC-W701D"}, - { TUNER_ABSENT, "TCL 9886P-WM"}, - { TUNER_ABSENT, "TCL 1676NM-WM"}, + { TUNER_TEA5767, "Philips TEA5768HL FM Radio"}, + { TUNER_ABSENT, "Panasonic ENV57H12D5"}, + { TUNER_ABSENT, "TCL MFNM05-4"}, + { TUNER_ABSENT, "TCL MNM05-4"}, + { TUNER_PHILIPS_FM1216ME_MK3, "TCL MPE05-2"}, + { TUNER_ABSENT, "TCL MQNM05-4"}, + { TUNER_ABSENT, "LG TAPC-W701D"}, + { TUNER_ABSENT, "TCL 9886P-WM"}, + { TUNER_ABSENT, "TCL 1676NM-WM"}, }; -/* This list is supplied by Hauppauge. Thanks! */ -static const char *audioIC[] = { - /* 0-4 */ - "None", "TEA6300", "TEA6320", "TDA9850", "MSP3400C", - /* 5-9 */ - "MSP3410D", "MSP3415", "MSP3430", "MSP3438", "CS5331", - /* 10-14 */ - "MSP3435", "MSP3440", "MSP3445", "MSP3411", "MSP3416", - /* 15-19 */ - "MSP3425", "MSP3451", "MSP3418", "Type 0x12", "OKI7716", - /* 20-24 */ - "MSP4410", "MSP4420", "MSP4440", "MSP4450", "MSP4408", - /* 25-29 */ - "MSP4418", "MSP4428", "MSP4448", "MSP4458", "Type 0x1d", - /* 30-34 */ - "CX880", "CX881", "CX883", "CX882", "CX25840", - /* 35-38 */ - "CX25841", "CX25842", "CX25843", "CX23418", +static struct HAUPPAUGE_AUDIOIC +{ + enum audiochip id; + char *name; +} +audioIC[] = +{ + /* 0-4 */ + {AUDIO_CHIP_NONE, "None"}, + {AUDIO_CHIP_TEA6300, "TEA6300"}, + {AUDIO_CHIP_TEA6300, "TEA6320"}, + {AUDIO_CHIP_TDA985X, "TDA9850"}, + {AUDIO_CHIP_MSP34XX, "MSP3400C"}, + /* 5-9 */ + {AUDIO_CHIP_MSP34XX, "MSP3410D"}, + {AUDIO_CHIP_MSP34XX, "MSP3415"}, + {AUDIO_CHIP_MSP34XX, "MSP3430"}, + {AUDIO_CHIP_UNKNOWN, "MSP3438"}, + {AUDIO_CHIP_UNKNOWN, "CS5331"}, + /* 10-14 */ + {AUDIO_CHIP_MSP34XX, "MSP3435"}, + {AUDIO_CHIP_MSP34XX, "MSP3440"}, + {AUDIO_CHIP_MSP34XX, "MSP3445"}, + {AUDIO_CHIP_UNKNOWN, "MSP3411"}, + {AUDIO_CHIP_UNKNOWN, "MSP3416"}, + /* 15-19 */ + {AUDIO_CHIP_MSP34XX, "MSP3425"}, + {AUDIO_CHIP_UNKNOWN, "MSP3451"}, + {AUDIO_CHIP_UNKNOWN, "MSP3418"}, + {AUDIO_CHIP_UNKNOWN, "Type 0x12"}, + {AUDIO_CHIP_UNKNOWN, "OKI7716"}, + /* 20-24 */ + {AUDIO_CHIP_UNKNOWN, "MSP4410"}, + {AUDIO_CHIP_UNKNOWN, "MSP4420"}, + {AUDIO_CHIP_UNKNOWN, "MSP4440"}, + {AUDIO_CHIP_UNKNOWN, "MSP4450"}, + {AUDIO_CHIP_UNKNOWN, "MSP4408"}, + /* 25-29 */ + {AUDIO_CHIP_UNKNOWN, "MSP4418"}, + {AUDIO_CHIP_UNKNOWN, "MSP4428"}, + {AUDIO_CHIP_UNKNOWN, "MSP4448"}, + {AUDIO_CHIP_UNKNOWN, "MSP4458"}, + {AUDIO_CHIP_UNKNOWN, "Type 0x1d"}, + /* 30-34 */ + {AUDIO_CHIP_INTERNAL, "CX880"}, + {AUDIO_CHIP_INTERNAL, "CX881"}, + {AUDIO_CHIP_INTERNAL, "CX883"}, + {AUDIO_CHIP_INTERNAL, "CX882"}, + {AUDIO_CHIP_INTERNAL, "CX25840"}, + /* 35-38 */ + {AUDIO_CHIP_INTERNAL, "CX25841"}, + {AUDIO_CHIP_INTERNAL, "CX25842"}, + {AUDIO_CHIP_INTERNAL, "CX25843"}, + {AUDIO_CHIP_INTERNAL, "CX23418"}, }; /* This list is supplied by Hauppauge. Thanks! */ static const char *decoderIC[] = { - /* 0-4 */ - "None", "BT815", "BT817", "BT819", "BT815A", - /* 5-9 */ - "BT817A", "BT819A", "BT827", "BT829", "BT848", - /* 10-14 */ - "BT848A", "BT849A", "BT829A", "BT827A", "BT878", - /* 15-19 */ - "BT879", "BT880", "VPX3226E", "SAA7114", "SAA7115", - /* 20-24 */ - "CX880", "CX881", "CX883", "SAA7111", "SAA7113", - /* 25-29 */ - "CX882", "TVP5150A", "CX25840", "CX25841", "CX25842", - /* 30-31 */ - "CX25843", "CX23418", + /* 0-4 */ + "None", "BT815", "BT817", "BT819", "BT815A", + /* 5-9 */ + "BT817A", "BT819A", "BT827", "BT829", "BT848", + /* 10-14 */ + "BT848A", "BT849A", "BT829A", "BT827A", "BT878", + /* 15-19 */ + "BT879", "BT880", "VPX3226E", "SAA7114", "SAA7115", + /* 20-24 */ + "CX880", "CX881", "CX883", "SAA7111", "SAA7113", + /* 25-29 */ + "CX882", "TVP5150A", "CX25840", "CX25841", "CX25842", + /* 30-31 */ + "CX25843", "CX23418", }; static int hasRadioTuner(int tunerType) { switch (tunerType) { - case 18: //PNPEnv_TUNER_FR1236_MK2: - case 23: //PNPEnv_TUNER_FM1236: - case 38: //PNPEnv_TUNER_FMR1236: - case 16: //PNPEnv_TUNER_FR1216_MK2: - case 19: //PNPEnv_TUNER_FR1246_MK2: - case 21: //PNPEnv_TUNER_FM1216: - case 24: //PNPEnv_TUNER_FM1246: - case 17: //PNPEnv_TUNER_FR1216MF_MK2: - case 22: //PNPEnv_TUNER_FM1216MF: - case 20: //PNPEnv_TUNER_FR1256_MK2: - case 25: //PNPEnv_TUNER_FM1256: - case 33: //PNPEnv_TUNER_4039FR5: - case 42: //PNPEnv_TUNER_4009FR5: - case 52: //PNPEnv_TUNER_4049FM5: - case 54: //PNPEnv_TUNER_4049FM5_AltI2C: - case 44: //PNPEnv_TUNER_4009FN5: - case 31: //PNPEnv_TUNER_TCPB9085P: - case 30: //PNPEnv_TUNER_TCPN9085D: - case 46: //PNPEnv_TUNER_TP18NSR01F: - case 47: //PNPEnv_TUNER_TP18PSB01D: - case 49: //PNPEnv_TUNER_TAPC_I001D: - case 60: //PNPEnv_TUNER_TAPE_S001D_MK3: - case 57: //PNPEnv_TUNER_FM1216ME_MK3: - case 59: //PNPEnv_TUNER_FM1216MP_MK3: - case 58: //PNPEnv_TUNER_FM1236_MK3: - case 68: //PNPEnv_TUNER_TAPE_H001F_MK3: - case 61: //PNPEnv_TUNER_TAPE_M001D_MK3: - case 78: //PNPEnv_TUNER_TDA8275C1_8290_FM: - case 89: //PNPEnv_TUNER_TCL_MFPE05_2: - case 92: //PNPEnv_TUNER_PHILIPS_FQ1236A_MK4: - return 1; + case 18: //PNPEnv_TUNER_FR1236_MK2: + case 23: //PNPEnv_TUNER_FM1236: + case 38: //PNPEnv_TUNER_FMR1236: + case 16: //PNPEnv_TUNER_FR1216_MK2: + case 19: //PNPEnv_TUNER_FR1246_MK2: + case 21: //PNPEnv_TUNER_FM1216: + case 24: //PNPEnv_TUNER_FM1246: + case 17: //PNPEnv_TUNER_FR1216MF_MK2: + case 22: //PNPEnv_TUNER_FM1216MF: + case 20: //PNPEnv_TUNER_FR1256_MK2: + case 25: //PNPEnv_TUNER_FM1256: + case 33: //PNPEnv_TUNER_4039FR5: + case 42: //PNPEnv_TUNER_4009FR5: + case 52: //PNPEnv_TUNER_4049FM5: + case 54: //PNPEnv_TUNER_4049FM5_AltI2C: + case 44: //PNPEnv_TUNER_4009FN5: + case 31: //PNPEnv_TUNER_TCPB9085P: + case 30: //PNPEnv_TUNER_TCPN9085D: + case 46: //PNPEnv_TUNER_TP18NSR01F: + case 47: //PNPEnv_TUNER_TP18PSB01D: + case 49: //PNPEnv_TUNER_TAPC_I001D: + case 60: //PNPEnv_TUNER_TAPE_S001D_MK3: + case 57: //PNPEnv_TUNER_FM1216ME_MK3: + case 59: //PNPEnv_TUNER_FM1216MP_MK3: + case 58: //PNPEnv_TUNER_FM1236_MK3: + case 68: //PNPEnv_TUNER_TAPE_H001F_MK3: + case 61: //PNPEnv_TUNER_TAPE_M001D_MK3: + case 78: //PNPEnv_TUNER_TDA8275C1_8290_FM: + case 89: //PNPEnv_TUNER_TCL_MFPE05_2: + case 92: //PNPEnv_TUNER_PHILIPS_FQ1236A_MK4: + return 1; } return 0; } @@ -318,19 +355,27 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, ** # of inputs/outputs ??? */ - int i, j, len, done, beenhere, tag; + int i, j, len, done, beenhere, tag,start; - int tuner1 = 0, t_format1 = 0; + int tuner1 = 0, t_format1 = 0, audioic=-1; char *t_name1 = NULL; - const char *t_fmt_name1[8] = { " none", "", "", "", "", "", "", "" }; + const char *t_fmt_name1[8] = { " none", "", "", "", "", "", "", "" }; - int tuner2 = 0, t_format2 = 0; + int tuner2 = 0, t_format2 = 0; char *t_name2 = NULL; - const char *t_fmt_name2[8] = { " none", "", "", "", "", "", "", "" }; + const char *t_fmt_name2[8] = { " none", "", "", "", "", "", "", "" }; - memset(tvee, 0, sizeof(*tvee)); + memset(tvee, 0, sizeof(*tvee)); done = len = beenhere = 0; - for (i = 0; !done && i < 256; i += len) { + + /* Hack for processing eeprom for em28xx */ + if ((eeprom_data[0]==0x1a)&&(eeprom_data[1]==0xeb)&& + (eeprom_data[2]==0x67)&&(eeprom_data[3]==0x95)) + start=0xa0; + else + start=0; + + for (i = start; !done && i < 256; i += len) { if (eeprom_data[i] == 0x84) { len = eeprom_data[i + 1] + (eeprom_data[i + 2] << 8); i += 3; @@ -344,28 +389,28 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, ++i; } else { tveeprom_warn("Encountered bad packet header [%02x]. " - "Corrupt or not a Hauppauge eeprom.\n", eeprom_data[i]); + "Corrupt or not a Hauppauge eeprom.\n", eeprom_data[i]); return; } - if (debug) { - tveeprom_info("Tag [%02x] + %d bytes:", eeprom_data[i], len - 1); - for(j = 1; j < len; j++) { - printk(" %02x", eeprom_data[i + j]); - } - printk("\n"); - } + if (debug) { + tveeprom_info("Tag [%02x] + %d bytes:", eeprom_data[i], len - 1); + for(j = 1; j < len; j++) { + printk(" %02x", eeprom_data[i + j]); + } + printk("\n"); + } /* process by tag */ tag = eeprom_data[i]; switch (tag) { case 0x00: - /* tag: 'Comprehensive' */ + /* tag: 'Comprehensive' */ tuner1 = eeprom_data[i+6]; t_format1 = eeprom_data[i+5]; tvee->has_radio = eeprom_data[i+len-1]; - /* old style tag, don't know how to detect - IR presence, mark as unknown. */ + /* old style tag, don't know how to detect + IR presence, mark as unknown. */ tvee->has_ir = 2; tvee->model = eeprom_data[i+8] + @@ -376,7 +421,7 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, break; case 0x01: - /* tag: 'SerialID' */ + /* tag: 'SerialID' */ tvee->serial_number = eeprom_data[i+6] + (eeprom_data[i+7] << 8) + @@ -384,17 +429,21 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, break; case 0x02: - /* tag 'AudioInfo' - Note mask with 0x7F, high bit used on some older models - to indicate 4052 mux was removed in favor of using MSP - inputs directly. */ - tvee->audio_processor = eeprom_data[i+2] & 0x7f; + /* tag 'AudioInfo' + Note mask with 0x7F, high bit used on some older models + to indicate 4052 mux was removed in favor of using MSP + inputs directly. */ + audioic = eeprom_data[i+2] & 0x7f; + if (audioic < sizeof(audioIC)/sizeof(*audioIC)) + tvee->audio_processor = audioIC[audioic].id; + else + tvee->audio_processor = AUDIO_CHIP_UNKNOWN; break; - /* case 0x03: tag 'EEInfo' */ + /* case 0x03: tag 'EEInfo' */ case 0x04: - /* tag 'SerialID2' */ + /* tag 'SerialID2' */ tvee->serial_number = eeprom_data[i+5] + (eeprom_data[i+6] << 8) + @@ -402,15 +451,20 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, break; case 0x05: - /* tag 'Audio2' - Note mask with 0x7F, high bit used on some older models - to indicate 4052 mux was removed in favor of using MSP - inputs directly. */ - tvee->audio_processor = eeprom_data[i+1] & 0x7f; + /* tag 'Audio2' + Note mask with 0x7F, high bit used on some older models + to indicate 4052 mux was removed in favor of using MSP + inputs directly. */ + audioic = eeprom_data[i+1] & 0x7f; + if (audioic < sizeof(audioIC)/sizeof(*audioIC)) + tvee->audio_processor = audioIC[audioic].id; + else + tvee->audio_processor = AUDIO_CHIP_UNKNOWN; + break; case 0x06: - /* tag 'ModelRev' */ + /* tag 'ModelRev' */ tvee->model = eeprom_data[i+1] + (eeprom_data[i+2] << 8); @@ -420,55 +474,55 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, break; case 0x07: - /* tag 'Details': according to Hauppauge not interesting - on any PCI-era or later boards. */ + /* tag 'Details': according to Hauppauge not interesting + on any PCI-era or later boards. */ break; - /* there is no tag 0x08 defined */ + /* there is no tag 0x08 defined */ case 0x09: - /* tag 'Video' */ + /* tag 'Video' */ tvee->decoder_processor = eeprom_data[i + 1]; break; case 0x0a: - /* tag 'Tuner' */ + /* tag 'Tuner' */ if (beenhere == 0) { tuner1 = eeprom_data[i+2]; t_format1 = eeprom_data[i+1]; beenhere = 1; } else { - /* a second (radio) tuner may be present */ + /* a second (radio) tuner may be present */ tuner2 = eeprom_data[i+2]; t_format2 = eeprom_data[i+1]; - if (t_format2 == 0) { /* not a TV tuner? */ - tvee->has_radio = 1; /* must be radio */ - } - } + if (t_format2 == 0) { /* not a TV tuner? */ + tvee->has_radio = 1; /* must be radio */ + } + } break; - case 0x0b: - /* tag 'Inputs': according to Hauppauge this is specific - to each driver family, so no good assumptions can be - made. */ - break; + case 0x0b: + /* tag 'Inputs': according to Hauppauge this is specific + to each driver family, so no good assumptions can be + made. */ + break; - /* case 0x0c: tag 'Balun' */ - /* case 0x0d: tag 'Teletext' */ + /* case 0x0c: tag 'Balun' */ + /* case 0x0d: tag 'Teletext' */ case 0x0e: - /* tag: 'Radio' */ + /* tag: 'Radio' */ tvee->has_radio = eeprom_data[i+1]; break; - case 0x0f: - /* tag 'IRInfo' */ - tvee->has_ir = eeprom_data[i+1]; - break; + case 0x0f: + /* tag 'IRInfo' */ + tvee->has_ir = eeprom_data[i+1]; + break; - /* case 0x10: tag 'VBIInfo' */ - /* case 0x11: tag 'QCInfo' */ - /* case 0x12: tag 'InfoBits' */ + /* case 0x10: tag 'VBIInfo' */ + /* case 0x11: tag 'QCInfo' */ + /* case 0x12: tag 'InfoBits' */ default: tveeprom_dbg("Not sure what to do with tag [%02x]\n", tag); @@ -489,11 +543,11 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, tvee->rev_str[4] = 0; } - if (hasRadioTuner(tuner1) && !tvee->has_radio) { - tveeprom_info("The eeprom says no radio is present, but the tuner type\n"); - tveeprom_info("indicates otherwise. I will assume that radio is present.\n"); - tvee->has_radio = 1; - } + if (hasRadioTuner(tuner1) && !tvee->has_radio) { + tveeprom_info("The eeprom says no radio is present, but the tuner type\n"); + tveeprom_info("indicates otherwise. I will assume that radio is present.\n"); + tvee->has_radio = 1; + } if (tuner1 < sizeof(hauppauge_tuner)/sizeof(struct HAUPPAUGE_TUNER)) { tvee->tuner_type = hauppauge_tuner[tuner1].id; @@ -516,45 +570,53 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, tvee->tuner_formats |= hauppauge_tuner_fmt[i].id; t_fmt_name1[j++] = hauppauge_tuner_fmt[i].name; } - if (t_format2 & (1 << i)) { - tvee->tuner2_formats |= hauppauge_tuner_fmt[i].id; - t_fmt_name2[j++] = hauppauge_tuner_fmt[i].name; - } + if (t_format2 & (1 << i)) { + tvee->tuner2_formats |= hauppauge_tuner_fmt[i].id; + t_fmt_name2[j++] = hauppauge_tuner_fmt[i].name; + } } tveeprom_info("Hauppauge model %d, rev %s, serial# %d\n", - tvee->model, tvee->rev_str, tvee->serial_number); + tvee->model, tvee->rev_str, tvee->serial_number); tveeprom_info("tuner model is %s (idx %d, type %d)\n", - t_name1, tuner1, tvee->tuner_type); + t_name1, tuner1, tvee->tuner_type); tveeprom_info("TV standards%s%s%s%s%s%s%s%s (eeprom 0x%02x)\n", - t_fmt_name1[0], t_fmt_name1[1], t_fmt_name1[2], t_fmt_name1[3], - t_fmt_name1[4], t_fmt_name1[5], t_fmt_name1[6], t_fmt_name1[7], - t_format1); - if (tuner2) { - tveeprom_info("second tuner model is %s (idx %d, type %d)\n", - t_name2, tuner2, tvee->tuner2_type); - } - if (t_format2) { - tveeprom_info("TV standards%s%s%s%s%s%s%s%s (eeprom 0x%02x)\n", - t_fmt_name2[0], t_fmt_name2[1], t_fmt_name2[2], t_fmt_name2[3], - t_fmt_name2[4], t_fmt_name2[5], t_fmt_name2[6], t_fmt_name2[7], - t_format2); - } - tveeprom_info("audio processor is %s (idx %d)\n", - STRM(audioIC, tvee->audio_processor), - tvee->audio_processor); - if (tvee->decoder_processor) { - tveeprom_info("decoder processor is %s (idx %d)\n", - STRM(decoderIC, tvee->decoder_processor), - tvee->decoder_processor); - } - if (tvee->has_ir == 2) - tveeprom_info("has %sradio\n", - tvee->has_radio ? "" : "no "); - else - tveeprom_info("has %sradio, has %sIR remote\n", - tvee->has_radio ? "" : "no ", - tvee->has_ir ? "" : "no "); + t_fmt_name1[0], t_fmt_name1[1], t_fmt_name1[2], t_fmt_name1[3], + t_fmt_name1[4], t_fmt_name1[5], t_fmt_name1[6], t_fmt_name1[7], + t_format1); + if (tuner2) { + tveeprom_info("second tuner model is %s (idx %d, type %d)\n", + t_name2, tuner2, tvee->tuner2_type); + } + if (t_format2) { + tveeprom_info("TV standards%s%s%s%s%s%s%s%s (eeprom 0x%02x)\n", + t_fmt_name2[0], t_fmt_name2[1], t_fmt_name2[2], t_fmt_name2[3], + t_fmt_name2[4], t_fmt_name2[5], t_fmt_name2[6], t_fmt_name2[7], + t_format2); + } + if (audioic<0) { + tveeprom_info("audio processor is unknown (no idx)\n"); + tvee->audio_processor=AUDIO_CHIP_UNKNOWN; + } else { + if (audioic < sizeof(audioIC)/sizeof(*audioIC)) + tveeprom_info("audio processor is %s (idx %d)\n", + audioIC[audioic].name,audioic); + else + tveeprom_info("audio processor is unknown (idx %d)\n", + audioic); + } + if (tvee->decoder_processor) { + tveeprom_info("decoder processor is %s (idx %d)\n", + STRM(decoderIC, tvee->decoder_processor), + tvee->decoder_processor); + } + if (tvee->has_ir == 2) + tveeprom_info("has %sradio\n", + tvee->has_radio ? "" : "no "); + else + tveeprom_info("has %sradio, has %sIR remote\n", + tvee->has_radio ? "" : "no ", + tvee->has_ir ? "" : "no "); } EXPORT_SYMBOL(tveeprom_hauppauge_analog); @@ -575,18 +637,18 @@ int tveeprom_read(struct i2c_client *c, unsigned char *eedata, int len) tveeprom_warn("i2c eeprom read error (err=%d)\n", err); return -1; } - if (debug) { - int i; - - tveeprom_info("full 256-byte eeprom dump:\n"); - for (i = 0; i < len; i++) { - if (0 == (i % 16)) - tveeprom_info("%02x:", i); - printk(" %02x", eedata[i]); - if (15 == (i % 16)) - printk("\n"); - } - } + if (debug) { + int i; + + tveeprom_info("full 256-byte eeprom dump:\n"); + for (i = 0; i < len; i++) { + if (0 == (i % 16)) + tveeprom_info("%02x:", i); + printk(" %02x", eedata[i]); + if (15 == (i % 16)) + printk("\n"); + } + } return 0; } EXPORT_SYMBOL(tveeprom_read); diff --git a/include/media/audiochip.h b/include/media/audiochip.h index a7ceee9fc5e9..dd1e484e86d3 100644 --- a/include/media/audiochip.h +++ b/include/media/audiochip.h @@ -4,6 +4,23 @@ #ifndef AUDIOCHIP_H #define AUDIOCHIP_H +enum audiochip { + AUDIO_CHIP_NONE, + AUDIO_CHIP_UNKNOWN, + /* Provided by video chip */ + AUDIO_CHIP_INTERNAL, + /* Provided by tvaudio.c */ + AUDIO_CHIP_TDA8425, + AUDIO_CHIP_TEA6300, + AUDIO_CHIP_TEA6420, + AUDIO_CHIP_TDA9840, + AUDIO_CHIP_TDA985X, + AUDIO_CHIP_TDA9874, + AUDIO_CHIP_PIC16C54, + /* Provided by msp3400.c */ + AUDIO_CHIP_MSP34XX +}; + /* ---------------------------------------------------------------------- */ /* v4l device was opened in Radio mode */ -- cgit v1.2.2 From 10c2c8b18a9cd29fc3f5faa5ad8e825dcc8b58e6 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:36:56 -0800 Subject: [PATCH] v4l: 703: added new card prolink pixelview playtv mpeg2 pv m4900 - Added new card: Prolink PixelView PlayTV MPEG2 PV-M4900 Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/video4linux/CARDLIST.bttv | 1 + drivers/media/video/bttv-cards.c | 198 +++++++++++++++++++++++++++++--- drivers/media/video/bttv.h | 2 + 3 files changed, 185 insertions(+), 16 deletions(-) diff --git a/Documentation/video4linux/CARDLIST.bttv b/Documentation/video4linux/CARDLIST.bttv index dd7b565be69d..1fde0d70da1d 100644 --- a/Documentation/video4linux/CARDLIST.bttv +++ b/Documentation/video4linux/CARDLIST.bttv @@ -137,3 +137,4 @@ 136 -> Acorp Y878F [9511:1540] 137 -> Conceptronic CTVFMi v2 138 -> Prolink Pixelview PV-BT878P+ (Rev.2E) +139 -> Prolink PixelView PlayTV MPEG2 PV-M4900 diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bttv-cards.c index 1553d4a1c20b..adccbbf63dc0 100644 --- a/drivers/media/video/bttv-cards.c +++ b/drivers/media/video/bttv-cards.c @@ -319,6 +319,7 @@ struct tvcard bttv_tvcards[] = { .muxsel = { 2, 3, 1, 0}, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, [BTTV_BOARD_MIRO] = { .name = "MIRO PCTV", @@ -332,6 +333,7 @@ struct tvcard bttv_tvcards[] = { .needs_tvaudio = 1, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, [BTTV_BOARD_HAUPPAUGE] = { .name = "Hauppauge (bt848)", @@ -345,6 +347,7 @@ struct tvcard bttv_tvcards[] = { .needs_tvaudio = 1, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, [BTTV_BOARD_STB] = { .name = "STB, Gateway P/N 6000699 (bt848)", @@ -359,6 +362,7 @@ struct tvcard bttv_tvcards[] = { .needs_tvaudio = 1, .tuner_type = TUNER_PHILIPS_NTSC, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .pll = PLL_28, .has_radio = 1, }, @@ -376,6 +380,7 @@ struct tvcard bttv_tvcards[] = { .needs_tvaudio = 0, .tuner_type = 4, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, [BTTV_BOARD_DIAMOND] = { .name = "Diamond DTV2000", @@ -389,6 +394,7 @@ struct tvcard bttv_tvcards[] = { .needs_tvaudio = 1, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, [BTTV_BOARD_AVERMEDIA] = { .name = "AVerMedia TVPhone", @@ -403,6 +409,7 @@ struct tvcard bttv_tvcards[] = { .needs_tvaudio = 1, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .audio_hook = avermedia_tvphone_audio, .has_remote = 1, }, @@ -418,6 +425,7 @@ struct tvcard bttv_tvcards[] = { .needs_tvaudio = 1, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, /* ---- card 0x08 ---------------------------------- */ @@ -434,6 +442,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, [BTTV_BOARD_TURBOTV] = { .name = "IMS/IXmicro TurboTV", @@ -448,6 +457,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = TUNER_TEMIC_PAL, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, [BTTV_BOARD_HAUPPAUGE878] = { .name = "Hauppauge (bt878)", @@ -462,6 +472,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, [BTTV_BOARD_MIROPRO] = { .name = "MIRO PCTV pro", @@ -475,6 +486,7 @@ struct tvcard bttv_tvcards[] = { .needs_tvaudio = 1, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, /* ---- card 0x0c ---------------------------------- */ @@ -490,6 +502,7 @@ struct tvcard bttv_tvcards[] = { .needs_tvaudio = 1, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, [BTTV_BOARD_AVERMEDIA98] = { .name = "AVerMedia TVCapture 98", @@ -505,6 +518,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = TUNER_PHILIPS_PAL, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .audio_hook = avermedia_tv_stereo_audio, }, [BTTV_BOARD_VHX] = { @@ -520,6 +534,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, [BTTV_BOARD_ZOLTRIX] = { .name = "Zoltrix TV-Max", @@ -533,6 +548,7 @@ struct tvcard bttv_tvcards[] = { .needs_tvaudio = 1, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, /* ---- card 0x10 ---------------------------------- */ @@ -567,6 +583,7 @@ struct tvcard bttv_tvcards[] = { .needs_tvaudio = 1, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .audio_hook = winview_audio, .has_radio = 1, }, @@ -582,6 +599,7 @@ struct tvcard bttv_tvcards[] = { .needs_tvaudio = 1, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, [BTTV_BOARD_LIFE_FLYKIT] = { .name = "Lifeview FlyVideo II EZ /FlyKit LR38 Bt848 (capture only)", @@ -595,6 +613,7 @@ struct tvcard bttv_tvcards[] = { .no_msp34xx = 1, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, /* ---- card 0x14 ---------------------------------- */ @@ -607,6 +626,7 @@ struct tvcard bttv_tvcards[] = { .muxsel = {2, 3, 1, 1}, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, [BTTV_BOARD_CONFERENCETV] = { .name = "Lifeview FlyVideo 98/ Lucky Star Image World ConferenceTV LR50", @@ -620,6 +640,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = TUNER_PHILIPS_PAL_I, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, [BTTV_BOARD_PHOEBE_TVMAS] = { .name = "Askey CPH050/ Phoebe Tv Master + FM", @@ -634,6 +655,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, [BTTV_BOARD_MODTEC_205] = { .name = "Modular Technology MM201/MM202/MM205/MM210/MM215 PCTV, bt878", @@ -649,6 +671,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = TUNER_ALPS_TSBB5_PAL_I, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, /* ---- card 0x18 ---------------------------------- */ @@ -665,6 +688,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .has_remote = 1, }, [BTTV_BOARD_VOBIS_BOOSTAR] = { @@ -679,6 +703,7 @@ struct tvcard bttv_tvcards[] = { .needs_tvaudio = 0, .tuner_type = TUNER_PHILIPS_PAL, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .audio_hook = terratv_audio, }, [BTTV_BOARD_HAUPPAUG_WCAM] = { @@ -693,6 +718,7 @@ struct tvcard bttv_tvcards[] = { .needs_tvaudio = 1, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, [BTTV_BOARD_MAXI] = { .name = "Lifeview FlyVideo 98/ MAXI TV Video PCI2 LR50", @@ -706,6 +732,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = TUNER_PHILIPS_SECAM, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, /* ---- card 0x1c ---------------------------------- */ @@ -721,6 +748,7 @@ struct tvcard bttv_tvcards[] = { .needs_tvaudio = 0, .tuner_type = TUNER_PHILIPS_PAL, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .audio_hook = terratv_audio, /* GPIO wiring: External 20 pin connector (for Active Radio Upgrade board) @@ -767,6 +795,7 @@ struct tvcard bttv_tvcards[] = { .needs_tvaudio = 1, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .muxsel_hook = PXC200_muxsel, }, @@ -782,6 +811,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, [BTTV_BOARD_IPROTV] = { .name = "Formac iProTV, Formac ProTV I (bt848)", @@ -795,6 +825,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = TUNER_PHILIPS_PAL, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, /* ---- card 0x20 ---------------------------------- */ @@ -810,6 +841,7 @@ struct tvcard bttv_tvcards[] = { .needs_tvaudio = 0, .tuner_type = 4, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, [BTTV_BOARD_TERRATVALUE] = { .name = "Terratec TerraTValue Version Bt878", @@ -824,6 +856,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = TUNER_PHILIPS_PAL, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, [BTTV_BOARD_WINFAST2000] = { .name = "Leadtek WinFast 2000/ WinFast 2000 XP", @@ -856,6 +889,7 @@ struct tvcard bttv_tvcards[] = { .has_radio = 1, .tuner_type = 5, /* default for now, gpio reads BFFF06 for Pal bg+dk */ .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .audio_hook = winfast2000_audio, .has_remote = 1, }, @@ -871,6 +905,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, /* ---- card 0x24 ---------------------------------- */ @@ -886,6 +921,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .has_radio = 1, }, [BTTV_BOARD_PXELVWPLTVPRO] = { @@ -901,6 +937,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, [BTTV_BOARD_MAGICTVIEW063] = { .name = "Askey CPH06X TView99", @@ -915,6 +952,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = 1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .has_remote = 1, }, [BTTV_BOARD_PINNACLE] = { @@ -930,6 +968,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, /* ---- card 0x28 ---------------------------------- */ @@ -946,6 +985,7 @@ struct tvcard bttv_tvcards[] = { .needs_tvaudio = 1, .tuner_type = TUNER_PHILIPS_NTSC, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .pll = PLL_28, .has_radio = 1, }, @@ -962,6 +1002,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .has_radio = 1, .audio_hook = avermedia_tvphone_audio, }, @@ -979,6 +1020,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = 1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, [BTTV_BOARD_ONAIR_TV] = { .name = "Little OnAir TV", @@ -992,6 +1034,7 @@ struct tvcard bttv_tvcards[] = { .no_msp34xx = 1, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, /* ---- card 0x2c ---------------------------------- */ @@ -1008,6 +1051,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_NONE, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, [BTTV_BOARD_MATRIX_VISION2] = { .name = "MATRIX-Vision MV-Delta 2", @@ -1022,6 +1066,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, [BTTV_BOARD_ZOLTRIX_GENIE] = { .name = "Zoltrix Genie TV/FM", @@ -1036,6 +1081,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = 21, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, [BTTV_BOARD_TERRATVRADIO] = { .name = "Terratec TV/Radio+", @@ -1051,6 +1097,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_35, .tuner_type = 1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .has_radio = 1, }, @@ -1068,6 +1115,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, [BTTV_BOARD_GVBCTV3PCI] = { .name = "IODATA GV-BCTV3/PCI", @@ -1082,6 +1130,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = TUNER_ALPS_TSHC6_NTSC, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .audio_hook = gvbctv3pci_audio, }, [BTTV_BOARD_PXELVWPLTVPAK] = { @@ -1098,6 +1147,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = TUNER_PHILIPS_PAL_I, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .has_remote = 1, /* GPIO wiring: (different from Rev.4C !) GPIO17: U4.A0 (first hef4052bt) @@ -1121,6 +1171,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = -1 /* TUNER_ALPS_TMDH2_NTSC */, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, /* ---- card 0x34 ---------------------------------- */ @@ -1147,6 +1198,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, [BTTV_BOARD_TVIEW_RDS_FM] = { /* Claas Langbehn , @@ -1163,6 +1215,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = TUNER_PHILIPS_PAL, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .has_radio = 1, }, [BTTV_BOARD_LIFETEC_9415] = { @@ -1186,6 +1239,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, [BTTV_BOARD_BESTBUY_EASYTV] = { /* Miguel Angel Alvarez @@ -1202,6 +1256,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = TUNER_TEMIC_PAL, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, /* ---- card 0x38 ---------------------------------- */ @@ -1218,6 +1273,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = 5, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, /* This is the ultimate cheapo capture card * just a BT848A on a small PCB! @@ -1236,6 +1292,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_35, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, [BTTV_BOARD_ASKEY_CPH060] = { /* Daniel Herrington */ @@ -1251,6 +1308,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = TUNER_TEMIC_4036FY5_NTSC, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, [BTTV_BOARD_ASKEY_CPH03X] = { /* Matti Mottus */ @@ -1265,6 +1323,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = 0, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, /* ---- card 0x3c ---------------------------------- */ @@ -1281,6 +1340,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_35, .tuner_type = TUNER_TEMIC_PAL, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, [BTTV_BOARD_GMV1] = { /* Adrian Cox @@ -1314,6 +1375,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = TUNER_PHILIPS_PAL, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, [BTTV_BOARD_ATI_TVWONDER] = { /* Lukas Gebauer */ @@ -1328,6 +1390,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = TUNER_TEMIC_4006FN5_MULTI_PAL, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, /* ---- card 0x40 ---------------------------------- */ @@ -1345,6 +1408,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = TUNER_TEMIC_4006FN5_MULTI_PAL, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, [BTTV_BOARD_FLYVIDEO2000] = { /* DeeJay */ @@ -1526,6 +1599,7 @@ struct tvcard bttv_tvcards[] = { .no_tda9875 = 1, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .muxsel_hook = rv605_muxsel, }, [BTTV_BOARD_POWERCLR_MTV878] = { @@ -1540,6 +1614,7 @@ struct tvcard bttv_tvcards[] = { .needs_tvaudio = 0, .tuner_type = TUNER_PHILIPS_PAL, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .pll = PLL_28, .has_radio = 1, }, @@ -1557,6 +1632,7 @@ struct tvcard bttv_tvcards[] = { .audiomux = { 0, 1, 2, 3, 4, 0 }, .tuner_type = TUNER_PHILIPS_NTSC, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .audio_hook = windvr_audio, }, [BTTV_BOARD_GRANDTEC_MULTI] = { @@ -1573,6 +1649,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, [BTTV_BOARD_KWORLD] = { .name = "Jetway TV/Capture JW-TV878-FBK, Kworld KW-TV878RF", @@ -1594,6 +1671,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = 5, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, /* Samsung TCPA9095PC27A (BG+DK), philips compatible, w/FM, stereo and radio signal strength indicators work fine. */ .has_radio = 1, @@ -1616,6 +1694,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, /* ---- card 0x50 ---------------------------------- */ @@ -1630,6 +1709,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .gpiomask = 7, .audiomux = {7}, @@ -1647,6 +1727,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = TUNER_PHILIPS_NTSC_M, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .audio_hook = gvbctv5pci_audio, .has_radio = 1, }, @@ -1660,6 +1741,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .no_msp34xx = 1, .no_tda9875 = 1, .no_tda7432 = 1, @@ -1674,6 +1756,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .no_msp34xx = 1, .no_tda9875 = 1, .no_tda7432 = 1, @@ -1690,6 +1773,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .no_msp34xx = 1, .no_tda9875 = 1, .no_tda7432 = 1, @@ -1704,6 +1788,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .no_msp34xx = 1, .no_tda9875 = 1, .no_tda7432 = 1, @@ -1718,6 +1803,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .no_msp34xx = 1, .no_tda9875 = 1, .no_tda7432 = 1, @@ -1732,6 +1818,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = UNSET, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .no_msp34xx = 1, .no_tda9875 = 1, .no_tda7432 = 1, @@ -1748,6 +1835,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = UNSET, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .no_msp34xx = 1, .no_tda9875 = 1, .no_tda7432 = 1, @@ -1762,6 +1850,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = UNSET, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .no_msp34xx = 1, .no_tda9875 = 1, .no_tda7432 = 1, @@ -1776,6 +1865,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .no_msp34xx = 1, .no_tda9875 = 1, .no_tda7432 = 1, @@ -1793,6 +1883,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .no_msp34xx = 1, .no_tda9875 = 1, .no_tda7432 = 1, @@ -1813,6 +1904,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = UNSET, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .no_msp34xx = 1, .no_tda9875 = 1, .no_tda7432 = 1, /* must avoid, conflicts with the bt860 */ @@ -1825,6 +1917,7 @@ struct tvcard bttv_tvcards[] = { .tuner = -1, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .svhs = -1, .gpiomask = 0, .muxsel = { 0, 1, 2, 3 }, @@ -1841,6 +1934,7 @@ struct tvcard bttv_tvcards[] = { .tuner = -1, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .no_msp34xx = 1, .no_tda9875 = 1, .no_tda7432 = 1, @@ -1863,6 +1957,7 @@ struct tvcard bttv_tvcards[] = { .has_radio = 1, .tuner_type = TUNER_PHILIPS_PAL, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, /* sound routing: GPIO=0x00,0x01,0x03: mute (?) 0x02: both TV and radio (tuner: FM1216/I) @@ -1885,6 +1980,7 @@ struct tvcard bttv_tvcards[] = { .needs_tvaudio = 1, .tuner_type = 5, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .pll = 1, }, [BTTV_BOARD_EURESYS_PICOLO] = { @@ -1901,6 +1997,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = UNSET, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, [BTTV_BOARD_PV150] = { /* Luc Van Hoeylandt */ @@ -1917,6 +2014,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = UNSET, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, [BTTV_BOARD_AD_TVK503] = { /* Hiroshi Takekawa */ @@ -1935,6 +2033,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = 2, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .audio_hook = adtvk503_audio, }, @@ -1952,6 +2051,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = 5, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, /* Notes: - card lacks subsystem ID - stereo variant w/ daughter board with tda9874a @0xb0 @@ -1974,6 +2074,7 @@ struct tvcard bttv_tvcards[] = { .no_tda7432 = 1, .tuner_type = 1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .has_radio = 1, .pll = PLL_28, /* Bt878, Bt832, FI1246 tuner; no pci subsystem id @@ -1991,6 +2092,7 @@ struct tvcard bttv_tvcards[] = { .tuner = -1, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .svhs = -1, .gpiomask = 0xdf, .muxsel = { 2 }, @@ -2004,6 +2106,7 @@ struct tvcard bttv_tvcards[] = { .svhs = -1, .tuner_type = 4, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .gpiomask2 = 0xff, .muxsel = { 2,2,2,2, 3,3,3,3, 1,1,1,1, 0,0,0,0 }, .muxsel_hook = xguard_muxsel, @@ -2026,6 +2129,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .has_dvb = 1, .no_gpioirq = 1, }, @@ -2044,6 +2148,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, [BTTV_BOARD_VD009X1_MINIDIN] = { /* M.Klahr@phytec.de */ @@ -2059,6 +2164,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, [BTTV_BOARD_VD009X1_COMBI] = { .name = "PHYTEC VD-009-X1 Combi (bt878)", @@ -2073,6 +2179,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, /* ---- card 0x6c ---------------------------------- */ @@ -2092,6 +2199,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, [BTTV_BOARD_VD009_COMBI] = { .name = "PHYTEC VD-009 Combi (bt878)", @@ -2109,6 +2217,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, [BTTV_BOARD_IVC100] = { .name = "IVC-100", @@ -2117,6 +2226,7 @@ struct tvcard bttv_tvcards[] = { .tuner = -1, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .svhs = -1, .gpiomask = 0xdf, .muxsel = { 2, 3, 1, 0 }, @@ -2130,6 +2240,7 @@ struct tvcard bttv_tvcards[] = { .tuner = -1, /* card has no tuner */ .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .svhs = -1, /* card has no svhs */ .needs_tvaudio = 0, .no_msp34xx = 1, @@ -2152,6 +2263,7 @@ struct tvcard bttv_tvcards[] = { .muxsel = { 2, 3, 1, 0}, .tuner_type = TUNER_PHILIPS_ATSC, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .has_dvb = 1, }, [BTTV_BOARD_TWINHAN_DST] = { @@ -2161,6 +2273,7 @@ struct tvcard bttv_tvcards[] = { .no_tda7432 = 1, .tuner_type = TUNER_ABSENT, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .no_video = 1, .has_dvb = 1, }, @@ -2176,6 +2289,7 @@ struct tvcard bttv_tvcards[] = { .no_tda7432 = 1, .tuner_type = TUNER_ABSENT, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .pll = PLL_28, }, [BTTV_BOARD_TEV560] = { @@ -2190,6 +2304,7 @@ struct tvcard bttv_tvcards[] = { .needs_tvaudio = 1, .tuner_type = TUNER_PHILIPS_PAL, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .pll = PLL_35, }, @@ -2202,6 +2317,7 @@ struct tvcard bttv_tvcards[] = { .svhs = -1, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .pll = PLL_28, .muxsel = { 2, 2, 2, 2}, .gpiomask = 0x3F, @@ -2219,6 +2335,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = TUNER_PHILIPS_PAL, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .has_remote = 1, }, [BTTV_BOARD_LMLBT4] = { @@ -2235,6 +2352,7 @@ struct tvcard bttv_tvcards[] = { .needs_tvaudio = 0, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, [BTTV_BOARD_TEKRAM_M205] = { /* Helmroos Harri */ @@ -2244,6 +2362,7 @@ struct tvcard bttv_tvcards[] = { .tuner = 0, .tuner_type = TUNER_PHILIPS_PAL, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .svhs = 2, .needs_tvaudio = 0, .gpiomask = 0x68, @@ -2268,6 +2387,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = TUNER_PHILIPS_PAL, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .has_remote = 1, .has_radio = 1, }, @@ -2293,6 +2413,7 @@ struct tvcard bttv_tvcards[] = { .muxsel_hook = picolo_tetra_muxsel,/*Required as it doesn't follow the classic input selection policy*/ .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, [BTTV_BOARD_SPIRIT_TV] = { /* Spirit TV Tuner from http://spiritmodems.com.au */ @@ -2307,6 +2428,7 @@ struct tvcard bttv_tvcards[] = { .audiomux = { 0x02, 0x00, 0x00, 0x00, 0x00}, .tuner_type = TUNER_TEMIC_PAL, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .no_msp34xx = 1, .no_tda9875 = 1, }, @@ -2318,6 +2440,7 @@ struct tvcard bttv_tvcards[] = { .tuner = -1, .tuner_type = TUNER_ABSENT, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .muxsel = { 3 , 3 }, .no_msp34xx = 1, .no_tda9875 = 1, @@ -2342,6 +2465,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .has_dvb = 1, .no_gpioirq = 1, .has_remote = 1, @@ -2362,6 +2486,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, [BTTV_BOARD_MATRIX_VISIONSLC] = { /* andre.schwarz@matrix-vision.de */ @@ -2378,6 +2503,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, /* BTTV_BOARD_APAC_VIEWCOMP */ [BTTV_BOARD_APAC_VIEWCOMP] = { @@ -2395,6 +2521,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = TUNER_PHILIPS_PAL, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .has_remote = 1, /* miniremote works, see ir-kbd-gpio.c */ .has_radio = 1, /* not every card has radio */ }, @@ -2412,6 +2539,7 @@ struct tvcard bttv_tvcards[] = { .has_dvb = 1, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, }, [BTTV_BOARD_VGEAR_MYVCD] = { /* Steven */ @@ -2427,6 +2555,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = TUNER_PHILIPS_NTSC_M, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .has_radio = 0, #if 0 .has_remote = 1, @@ -2442,6 +2571,7 @@ struct tvcard bttv_tvcards[] = { .muxsel = { 2, 3, 1, 0}, .tuner_type = TUNER_PHILIPS_NTSC, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .gpiomask = 0x008007, .audiomux = { 0, 0x000001,0,0, 0}, .needs_tvaudio = 1, @@ -2461,6 +2591,7 @@ struct tvcard bttv_tvcards[] = { .no_tda7432 = 1, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .muxsel_hook = tibetCS16_muxsel, }, [BTTV_BOARD_KODICOM_4400R] = { @@ -2481,6 +2612,7 @@ struct tvcard bttv_tvcards[] = { .tuner = -1, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .svhs = -1, /* GPIO bits 0-9 used for analog switch: * 00 - 03: camera selector @@ -2512,6 +2644,7 @@ struct tvcard bttv_tvcards[] = { .tuner = -1, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .svhs = -1, .gpiomask = 0x010000, .no_gpioirq = 1, @@ -2534,6 +2667,7 @@ struct tvcard bttv_tvcards[] = { .muxsel = { 2, 3, 1, 0}, .tuner_type = -1, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .pll = PLL_28, }, /* ---- card 0x87---------------------------------- */ @@ -2543,6 +2677,7 @@ struct tvcard bttv_tvcards[] = { .tuner = 0, .tuner_type = TUNER_LG_TDVS_H062F, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .video_inputs = 2, .audio_inputs = 1, .svhs = 2, @@ -2569,6 +2704,7 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = TUNER_YMEC_TVF66T5_B_DFF, .tuner_addr = 0xc1 >>1, + .radio_addr = 0xc1 >>1, .has_radio = 1, }, /* ---- card 0x89 ---------------------------------- */ @@ -2585,26 +2721,50 @@ struct tvcard bttv_tvcards[] = { .pll = PLL_28, .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .has_remote = 1, #if 0 .has_radio = 1, #endif }, + /* ---- card 0x8a ---------------------------------- */ [BTTV_BOARD_PV_BT878P_2E] = { - .name = "Prolink Pixelview PV-BT878P+ (Rev.2E)", - .video_inputs = 5, - .audio_inputs = 1, - .tuner = 0, - .svhs = 3, - .gpiomask = 0x01fe00, - .muxsel = { 2,3,1,1,-1 }, - .digital_mode = DIGITAL_MODE_CAMERA, - .audiomux = { 0x00400, 0x10400, 0x04400, 0x80000, 0x12400, 0x46000 }, - .no_msp34xx = 1, - .pll = PLL_28, - .tuner_type = TUNER_LG_PAL_FM, - .has_remote = 1, -}}; + .name = "Prolink Pixelview PV-BT878P+ (Rev.2E)", + .video_inputs = 5, + .audio_inputs = 1, + .tuner = 0, + .svhs = 3, + .gpiomask = 0x01fe00, + .muxsel = { 2,3,1,1,-1 }, + .digital_mode = DIGITAL_MODE_CAMERA, + .audiomux = { 0x00400, 0x10400, 0x04400, 0x80000, 0x12400, 0x46000 }, + .no_msp34xx = 1, + .pll = PLL_28, + .tuner_type = TUNER_LG_PAL_FM, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .has_remote = 1, + }, + /* ---- card 0x8b ---------------------------------- */ + [BTTV_BOARD_PV_M4900] = { + /* Sérgio Fortier */ + .name = "Prolink PixelView PlayTV MPEG2 PV-M4900", + .video_inputs = 3, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 0x3f, + .muxsel = { 2, 3, 1, 1 }, + .audiomux = { 0x21, 0x20, 0x24, 0x2c, 0x29, 0x29 }, + .no_msp34xx = 1, + .pll = PLL_28, + .tuner_type = TUNER_YMEC_TVF_5533MF, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .has_radio = 1, + .has_remote = 1, + } +}; static const unsigned int bttv_num_tvcards = ARRAY_SIZE(bttv_tvcards); @@ -2995,7 +3155,7 @@ void __devinit bttv_init_card1(struct bttv *btv) void __devinit bttv_init_card2(struct bttv *btv) { int tda9887; - int addr=ADDR_UNSET; + int addr=ADDR_UNSET, radio_addr=ADDR_UNSET; btv->tuner_type = -1; @@ -3140,6 +3300,9 @@ void __devinit bttv_init_card2(struct bttv *btv) if (ADDR_UNSET != bttv_tvcards[btv->c.type].tuner_addr) addr = bttv_tvcards[btv->c.type].tuner_addr; + if (ADDR_UNSET != bttv_tvcards[btv->c.type].radio_addr) + radio_addr = bttv_tvcards[btv->c.type].radio_addr; + if (UNSET != bttv_tvcards[btv->c.type].tuner_type) if(UNSET == btv->tuner_type) btv->tuner_type = bttv_tvcards[btv->c.type].tuner_type; @@ -3152,10 +3315,13 @@ void __devinit bttv_init_card2(struct bttv *btv) if (btv->tuner_type != UNSET) { struct tuner_setup tun_setup; - tun_setup.mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV; + tun_setup.mode_mask = T_ANALOG_TV | T_DIGITAL_TV; tun_setup.type = btv->tuner_type; tun_setup.addr = addr; + if (addr == radio_addr) + tun_setup.mode_mask = T_RADIO; + bttv_call_i2c_clients(btv, TUNER_SET_TYPE_ADDR, &tun_setup); } diff --git a/drivers/media/video/bttv.h b/drivers/media/video/bttv.h index 2005ca9383df..a4194e1ea905 100644 --- a/drivers/media/video/bttv.h +++ b/drivers/media/video/bttv.h @@ -159,6 +159,7 @@ #define BTTV_BOARD_ACORP_Y878F 0x88 #define BTTV_BOARD_CONCEPTRONIC_CTVFMI2 0x89 #define BTTV_BOARD_PV_BT878P_2E 0x8a +#define BTTV_BOARD_PV_M4900 0x8b /* i2c address list */ #define I2C_TSA5522 0xc2 @@ -240,6 +241,7 @@ struct tvcard unsigned int tuner_type; unsigned int tuner_addr; + unsigned int radio_addr; unsigned int has_radio; void (*audio_hook)(struct bttv *btv, struct video_audio *v, int set); -- cgit v1.2.2 From afce892f66c196989fe7d938150201d337c553e5 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 8 Nov 2005 21:36:57 -0800 Subject: [PATCH] v4l: 704: enable support for the ir remote on compro videomate t200 - Enable support for the IR Remote on Compro Videomate T200 Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/saa7134/saa7134-cards.c | 1 + drivers/media/video/saa7134/saa7134-input.c | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index 3bb0644145bb..c59f4d775521 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c @@ -2842,6 +2842,7 @@ int saa7134_board_init1(struct saa7134_dev *dev) case SAA7134_BOARD_VIDEOMATE_TV_PVR: case SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII: case SAA7134_BOARD_VIDEOMATE_DVBT_300: + case SAA7134_BOARD_VIDEOMATE_DVBT_200: case SAA7134_BOARD_MANLI_MTV001: case SAA7134_BOARD_MANLI_MTV002: case SAA7134_BOARD_BEHOLD_409FM: diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index f6fe5f889a4a..8d211ba22316 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -580,6 +580,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) polling = 50; // ms break; case SAA7134_BOARD_VIDEOMATE_DVBT_300: + case SAA7134_BOARD_VIDEOMATE_DVBT_200: ir_codes = videomate_tv_pvr_codes; mask_keycode = 0x003F00; mask_keyup = 0x040000; -- cgit v1.2.2 From 0bcc37c328ac66ede45a6672f85795eee0b05b87 Mon Sep 17 00:00:00 2001 From: Alexander Wold Date: Tue, 8 Nov 2005 21:36:58 -0800 Subject: [PATCH] v4l: 705: added kworld vstream expertdvd - Added Kworld Vstream ExpertDVD. Signed-off-by: Alexander Wold Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/cx88/cx88-cards.c | 20 ++++++++++++++++++++ drivers/media/video/cx88/cx88.h | 1 + 2 files changed, 21 insertions(+) diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c index 5a85802047f9..888d25d48416 100644 --- a/drivers/media/video/cx88/cx88-cards.c +++ b/drivers/media/video/cx88/cx88-cards.c @@ -803,6 +803,26 @@ struct cx88_board cx88_boards[] = { .gpio0 = 0x0000cdf3, }, }, + [CX88_BOARD_KWORLD_VSTREAM_EXPERT_DVD] = { + /* Alexander Wold */ + .name = "Kworld V-Stream Xpert DVD", + .tuner_type = UNSET, + .input = {{ + .type = CX88_VMUX_COMPOSITE1, + .vmux = 1, + .gpio0 = 0x03000000, + .gpio1 = 0x01000000, + .gpio2 = 0x02000000, + .gpio3 = 0x00100000, + },{ + .type = CX88_VMUX_SVIDEO, + .vmux = 2, + .gpio0 = 0x03000000, + .gpio1 = 0x01000000, + .gpio2 = 0x02000000, + .gpio3 = 0x00100000, + }}, + }, }; const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards); diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h index bd27b56ace26..9b629221e799 100644 --- a/drivers/media/video/cx88/cx88.h +++ b/drivers/media/video/cx88/cx88.h @@ -175,6 +175,7 @@ extern struct sram_channel cx88_sram_channels[]; #define CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1 30 #define CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD 31 #define CX88_BOARD_AVERMEDIA_ULTRATV_MC_550 32 +#define CX88_BOARD_KWORLD_VSTREAM_EXPERT_DVD 33 enum cx88_itype { CX88_VMUX_COMPOSITE1 = 1, -- cgit v1.2.2 From 7b3c6d659fc392cfd80e57840c10ccd4c6ab62c5 Mon Sep 17 00:00:00 2001 From: "Nickolay V. Shmyrev" Date: Tue, 8 Nov 2005 21:36:59 -0800 Subject: [PATCH] v4l: 706: reindent cx88 tvaudio c to keep coding style - Reindent cx88-tvaudio.c to keep coding style. Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/cx88/cx88-tvaudio.c | 963 ++++++++++++++++---------------- 1 file changed, 484 insertions(+), 479 deletions(-) diff --git a/drivers/media/video/cx88/cx88-tvaudio.c b/drivers/media/video/cx88/cx88-tvaudio.c index b6431cb78a59..4ca1128bc76c 100644 --- a/drivers/media/video/cx88/cx88-tvaudio.c +++ b/drivers/media/video/cx88/cx88-tvaudio.c @@ -57,39 +57,38 @@ #include "cx88.h" static unsigned int audio_debug = 0; -module_param(audio_debug,int,0644); -MODULE_PARM_DESC(audio_debug,"enable debug messages [audio]"); +module_param(audio_debug, int, 0644); +MODULE_PARM_DESC(audio_debug, "enable debug messages [audio]"); #define dprintk(fmt, arg...) if (audio_debug) \ printk(KERN_DEBUG "%s/0: " fmt, core->name , ## arg) /* ----------------------------------------------------------- */ -static char *aud_ctl_names[64] = -{ - [ EN_BTSC_FORCE_MONO ] = "BTSC_FORCE_MONO", - [ EN_BTSC_FORCE_STEREO ] = "BTSC_FORCE_STEREO", - [ EN_BTSC_FORCE_SAP ] = "BTSC_FORCE_SAP", - [ EN_BTSC_AUTO_STEREO ] = "BTSC_AUTO_STEREO", - [ EN_BTSC_AUTO_SAP ] = "BTSC_AUTO_SAP", - [ EN_A2_FORCE_MONO1 ] = "A2_FORCE_MONO1", - [ EN_A2_FORCE_MONO2 ] = "A2_FORCE_MONO2", - [ EN_A2_FORCE_STEREO ] = "A2_FORCE_STEREO", - [ EN_A2_AUTO_MONO2 ] = "A2_AUTO_MONO2", - [ EN_A2_AUTO_STEREO ] = "A2_AUTO_STEREO", - [ EN_EIAJ_FORCE_MONO1 ] = "EIAJ_FORCE_MONO1", - [ EN_EIAJ_FORCE_MONO2 ] = "EIAJ_FORCE_MONO2", - [ EN_EIAJ_FORCE_STEREO ] = "EIAJ_FORCE_STEREO", - [ EN_EIAJ_AUTO_MONO2 ] = "EIAJ_AUTO_MONO2", - [ EN_EIAJ_AUTO_STEREO ] = "EIAJ_AUTO_STEREO", - [ EN_NICAM_FORCE_MONO1 ] = "NICAM_FORCE_MONO1", - [ EN_NICAM_FORCE_MONO2 ] = "NICAM_FORCE_MONO2", - [ EN_NICAM_FORCE_STEREO ] = "NICAM_FORCE_STEREO", - [ EN_NICAM_AUTO_MONO2 ] = "NICAM_AUTO_MONO2", - [ EN_NICAM_AUTO_STEREO ] = "NICAM_AUTO_STEREO", - [ EN_FMRADIO_FORCE_MONO ] = "FMRADIO_FORCE_MONO", - [ EN_FMRADIO_FORCE_STEREO ] = "FMRADIO_FORCE_STEREO", - [ EN_FMRADIO_AUTO_STEREO ] = "FMRADIO_AUTO_STEREO", +static char *aud_ctl_names[64] = { + [EN_BTSC_FORCE_MONO] = "BTSC_FORCE_MONO", + [EN_BTSC_FORCE_STEREO] = "BTSC_FORCE_STEREO", + [EN_BTSC_FORCE_SAP] = "BTSC_FORCE_SAP", + [EN_BTSC_AUTO_STEREO] = "BTSC_AUTO_STEREO", + [EN_BTSC_AUTO_SAP] = "BTSC_AUTO_SAP", + [EN_A2_FORCE_MONO1] = "A2_FORCE_MONO1", + [EN_A2_FORCE_MONO2] = "A2_FORCE_MONO2", + [EN_A2_FORCE_STEREO] = "A2_FORCE_STEREO", + [EN_A2_AUTO_MONO2] = "A2_AUTO_MONO2", + [EN_A2_AUTO_STEREO] = "A2_AUTO_STEREO", + [EN_EIAJ_FORCE_MONO1] = "EIAJ_FORCE_MONO1", + [EN_EIAJ_FORCE_MONO2] = "EIAJ_FORCE_MONO2", + [EN_EIAJ_FORCE_STEREO] = "EIAJ_FORCE_STEREO", + [EN_EIAJ_AUTO_MONO2] = "EIAJ_AUTO_MONO2", + [EN_EIAJ_AUTO_STEREO] = "EIAJ_AUTO_STEREO", + [EN_NICAM_FORCE_MONO1] = "NICAM_FORCE_MONO1", + [EN_NICAM_FORCE_MONO2] = "NICAM_FORCE_MONO2", + [EN_NICAM_FORCE_STEREO] = "NICAM_FORCE_STEREO", + [EN_NICAM_AUTO_MONO2] = "NICAM_AUTO_MONO2", + [EN_NICAM_AUTO_STEREO] = "NICAM_AUTO_STEREO", + [EN_FMRADIO_FORCE_MONO] = "FMRADIO_FORCE_MONO", + [EN_FMRADIO_FORCE_STEREO] = "FMRADIO_FORCE_STEREO", + [EN_FMRADIO_AUTO_STEREO] = "FMRADIO_AUTO_STEREO", }; struct rlist { @@ -97,8 +96,7 @@ struct rlist { u32 val; }; -static void set_audio_registers(struct cx88_core *core, - const struct rlist *l) +static void set_audio_registers(struct cx88_core *core, const struct rlist *l) { int i; @@ -119,17 +117,16 @@ static void set_audio_registers(struct cx88_core *core, } } -static void set_audio_start(struct cx88_core *core, - u32 mode) +static void set_audio_start(struct cx88_core *core, u32 mode) { // mute - cx_write(AUD_VOL_CTL, (1 << 6)); + cx_write(AUD_VOL_CTL, (1 << 6)); // start programming - cx_write(AUD_CTL, 0x0000); - cx_write(AUD_INIT, mode); - cx_write(AUD_INIT_LD, 0x0001); - cx_write(AUD_SOFT_RESET, 0x0001); + cx_write(AUD_CTL, 0x0000); + cx_write(AUD_INIT, mode); + cx_write(AUD_INIT_LD, 0x0001); + cx_write(AUD_SOFT_RESET, 0x0001); } static void set_audio_finish(struct cx88_core *core, u32 ctl) @@ -148,8 +145,8 @@ static void set_audio_finish(struct cx88_core *core, u32 ctl) cx_write(AUD_I2SCNTL, 0); //cx_write(AUD_APB_IN_RATE_ADJ, 0); } else { - ctl |= EN_DAC_ENABLE; - cx_write(AUD_CTL, ctl); + ctl |= EN_DAC_ENABLE; + cx_write(AUD_CTL, ctl); } /* finish programming */ @@ -162,110 +159,111 @@ static void set_audio_finish(struct cx88_core *core, u32 ctl) /* ----------------------------------------------------------- */ -static void set_audio_standard_BTSC(struct cx88_core *core, unsigned int sap, u32 mode) +static void set_audio_standard_BTSC(struct cx88_core *core, unsigned int sap, + u32 mode) { static const struct rlist btsc[] = { - { AUD_AFE_12DB_EN, 0x00000001 }, - { AUD_OUT1_SEL, 0x00000013 }, - { AUD_OUT1_SHIFT, 0x00000000 }, - { AUD_POLY0_DDS_CONSTANT, 0x0012010c }, - { AUD_DMD_RA_DDS, 0x00c3e7aa }, - { AUD_DBX_IN_GAIN, 0x00004734 }, - { AUD_DBX_WBE_GAIN, 0x00004640 }, - { AUD_DBX_SE_GAIN, 0x00008d31 }, - { AUD_DCOC_0_SRC, 0x0000001a }, - { AUD_IIR1_4_SEL, 0x00000021 }, - { AUD_DCOC_PASS_IN, 0x00000003 }, - { AUD_DCOC_0_SHIFT_IN0, 0x0000000a }, - { AUD_DCOC_0_SHIFT_IN1, 0x00000008 }, - { AUD_DCOC_1_SHIFT_IN0, 0x0000000a }, - { AUD_DCOC_1_SHIFT_IN1, 0x00000008 }, - { AUD_DN0_FREQ, 0x0000283b }, - { AUD_DN2_SRC_SEL, 0x00000008 }, - { AUD_DN2_FREQ, 0x00003000 }, - { AUD_DN2_AFC, 0x00000002 }, - { AUD_DN2_SHFT, 0x00000000 }, - { AUD_IIR2_2_SEL, 0x00000020 }, - { AUD_IIR2_2_SHIFT, 0x00000000 }, - { AUD_IIR2_3_SEL, 0x0000001f }, - { AUD_IIR2_3_SHIFT, 0x00000000 }, - { AUD_CRDC1_SRC_SEL, 0x000003ce }, - { AUD_CRDC1_SHIFT, 0x00000000 }, - { AUD_CORDIC_SHIFT_1, 0x00000007 }, - { AUD_DCOC_1_SRC, 0x0000001b }, - { AUD_DCOC1_SHIFT, 0x00000000 }, - { AUD_RDSI_SEL, 0x00000008 }, - { AUD_RDSQ_SEL, 0x00000008 }, - { AUD_RDSI_SHIFT, 0x00000000 }, - { AUD_RDSQ_SHIFT, 0x00000000 }, - { AUD_POLYPH80SCALEFAC, 0x00000003 }, + {AUD_AFE_12DB_EN, 0x00000001}, + {AUD_OUT1_SEL, 0x00000013}, + {AUD_OUT1_SHIFT, 0x00000000}, + {AUD_POLY0_DDS_CONSTANT, 0x0012010c}, + {AUD_DMD_RA_DDS, 0x00c3e7aa}, + {AUD_DBX_IN_GAIN, 0x00004734}, + {AUD_DBX_WBE_GAIN, 0x00004640}, + {AUD_DBX_SE_GAIN, 0x00008d31}, + {AUD_DCOC_0_SRC, 0x0000001a}, + {AUD_IIR1_4_SEL, 0x00000021}, + {AUD_DCOC_PASS_IN, 0x00000003}, + {AUD_DCOC_0_SHIFT_IN0, 0x0000000a}, + {AUD_DCOC_0_SHIFT_IN1, 0x00000008}, + {AUD_DCOC_1_SHIFT_IN0, 0x0000000a}, + {AUD_DCOC_1_SHIFT_IN1, 0x00000008}, + {AUD_DN0_FREQ, 0x0000283b}, + {AUD_DN2_SRC_SEL, 0x00000008}, + {AUD_DN2_FREQ, 0x00003000}, + {AUD_DN2_AFC, 0x00000002}, + {AUD_DN2_SHFT, 0x00000000}, + {AUD_IIR2_2_SEL, 0x00000020}, + {AUD_IIR2_2_SHIFT, 0x00000000}, + {AUD_IIR2_3_SEL, 0x0000001f}, + {AUD_IIR2_3_SHIFT, 0x00000000}, + {AUD_CRDC1_SRC_SEL, 0x000003ce}, + {AUD_CRDC1_SHIFT, 0x00000000}, + {AUD_CORDIC_SHIFT_1, 0x00000007}, + {AUD_DCOC_1_SRC, 0x0000001b}, + {AUD_DCOC1_SHIFT, 0x00000000}, + {AUD_RDSI_SEL, 0x00000008}, + {AUD_RDSQ_SEL, 0x00000008}, + {AUD_RDSI_SHIFT, 0x00000000}, + {AUD_RDSQ_SHIFT, 0x00000000}, + {AUD_POLYPH80SCALEFAC, 0x00000003}, { /* end of list */ }, }; static const struct rlist btsc_sap[] = { - { AUD_AFE_12DB_EN, 0x00000001 }, - { AUD_DBX_IN_GAIN, 0x00007200 }, - { AUD_DBX_WBE_GAIN, 0x00006200 }, - { AUD_DBX_SE_GAIN, 0x00006200 }, - { AUD_IIR1_1_SEL, 0x00000000 }, - { AUD_IIR1_3_SEL, 0x00000001 }, - { AUD_DN1_SRC_SEL, 0x00000007 }, - { AUD_IIR1_4_SHIFT, 0x00000006 }, - { AUD_IIR2_1_SHIFT, 0x00000000 }, - { AUD_IIR2_2_SHIFT, 0x00000000 }, - { AUD_IIR3_0_SHIFT, 0x00000000 }, - { AUD_IIR3_1_SHIFT, 0x00000000 }, - { AUD_IIR3_0_SEL, 0x0000000d }, - { AUD_IIR3_1_SEL, 0x0000000e }, - { AUD_DEEMPH1_SRC_SEL, 0x00000014 }, - { AUD_DEEMPH1_SHIFT, 0x00000000 }, - { AUD_DEEMPH1_G0, 0x00004000 }, - { AUD_DEEMPH1_A0, 0x00000000 }, - { AUD_DEEMPH1_B0, 0x00000000 }, - { AUD_DEEMPH1_A1, 0x00000000 }, - { AUD_DEEMPH1_B1, 0x00000000 }, - { AUD_OUT0_SEL, 0x0000003f }, - { AUD_OUT1_SEL, 0x0000003f }, - { AUD_DN1_AFC, 0x00000002 }, - { AUD_DCOC_0_SHIFT_IN0, 0x0000000a }, - { AUD_DCOC_0_SHIFT_IN1, 0x00000008 }, - { AUD_DCOC_1_SHIFT_IN0, 0x0000000a }, - { AUD_DCOC_1_SHIFT_IN1, 0x00000008 }, - { AUD_IIR1_0_SEL, 0x0000001d }, - { AUD_IIR1_2_SEL, 0x0000001e }, - { AUD_IIR2_1_SEL, 0x00000002 }, - { AUD_IIR2_2_SEL, 0x00000004 }, - { AUD_IIR3_2_SEL, 0x0000000f }, - { AUD_DCOC2_SHIFT, 0x00000001 }, - { AUD_IIR3_2_SHIFT, 0x00000001 }, - { AUD_DEEMPH0_SRC_SEL, 0x00000014 }, - { AUD_CORDIC_SHIFT_1, 0x00000006 }, - { AUD_POLY0_DDS_CONSTANT, 0x000e4db2 }, - { AUD_DMD_RA_DDS, 0x00f696e6 }, - { AUD_IIR2_3_SEL, 0x00000025 }, - { AUD_IIR1_4_SEL, 0x00000021 }, - { AUD_DN1_FREQ, 0x0000c965 }, - { AUD_DCOC_PASS_IN, 0x00000003 }, - { AUD_DCOC_0_SRC, 0x0000001a }, - { AUD_DCOC_1_SRC, 0x0000001b }, - { AUD_DCOC1_SHIFT, 0x00000000 }, - { AUD_RDSI_SEL, 0x00000009 }, - { AUD_RDSQ_SEL, 0x00000009 }, - { AUD_RDSI_SHIFT, 0x00000000 }, - { AUD_RDSQ_SHIFT, 0x00000000 }, - { AUD_POLYPH80SCALEFAC, 0x00000003 }, + {AUD_AFE_12DB_EN, 0x00000001}, + {AUD_DBX_IN_GAIN, 0x00007200}, + {AUD_DBX_WBE_GAIN, 0x00006200}, + {AUD_DBX_SE_GAIN, 0x00006200}, + {AUD_IIR1_1_SEL, 0x00000000}, + {AUD_IIR1_3_SEL, 0x00000001}, + {AUD_DN1_SRC_SEL, 0x00000007}, + {AUD_IIR1_4_SHIFT, 0x00000006}, + {AUD_IIR2_1_SHIFT, 0x00000000}, + {AUD_IIR2_2_SHIFT, 0x00000000}, + {AUD_IIR3_0_SHIFT, 0x00000000}, + {AUD_IIR3_1_SHIFT, 0x00000000}, + {AUD_IIR3_0_SEL, 0x0000000d}, + {AUD_IIR3_1_SEL, 0x0000000e}, + {AUD_DEEMPH1_SRC_SEL, 0x00000014}, + {AUD_DEEMPH1_SHIFT, 0x00000000}, + {AUD_DEEMPH1_G0, 0x00004000}, + {AUD_DEEMPH1_A0, 0x00000000}, + {AUD_DEEMPH1_B0, 0x00000000}, + {AUD_DEEMPH1_A1, 0x00000000}, + {AUD_DEEMPH1_B1, 0x00000000}, + {AUD_OUT0_SEL, 0x0000003f}, + {AUD_OUT1_SEL, 0x0000003f}, + {AUD_DN1_AFC, 0x00000002}, + {AUD_DCOC_0_SHIFT_IN0, 0x0000000a}, + {AUD_DCOC_0_SHIFT_IN1, 0x00000008}, + {AUD_DCOC_1_SHIFT_IN0, 0x0000000a}, + {AUD_DCOC_1_SHIFT_IN1, 0x00000008}, + {AUD_IIR1_0_SEL, 0x0000001d}, + {AUD_IIR1_2_SEL, 0x0000001e}, + {AUD_IIR2_1_SEL, 0x00000002}, + {AUD_IIR2_2_SEL, 0x00000004}, + {AUD_IIR3_2_SEL, 0x0000000f}, + {AUD_DCOC2_SHIFT, 0x00000001}, + {AUD_IIR3_2_SHIFT, 0x00000001}, + {AUD_DEEMPH0_SRC_SEL, 0x00000014}, + {AUD_CORDIC_SHIFT_1, 0x00000006}, + {AUD_POLY0_DDS_CONSTANT, 0x000e4db2}, + {AUD_DMD_RA_DDS, 0x00f696e6}, + {AUD_IIR2_3_SEL, 0x00000025}, + {AUD_IIR1_4_SEL, 0x00000021}, + {AUD_DN1_FREQ, 0x0000c965}, + {AUD_DCOC_PASS_IN, 0x00000003}, + {AUD_DCOC_0_SRC, 0x0000001a}, + {AUD_DCOC_1_SRC, 0x0000001b}, + {AUD_DCOC1_SHIFT, 0x00000000}, + {AUD_RDSI_SEL, 0x00000009}, + {AUD_RDSQ_SEL, 0x00000009}, + {AUD_RDSI_SHIFT, 0x00000000}, + {AUD_RDSQ_SHIFT, 0x00000000}, + {AUD_POLYPH80SCALEFAC, 0x00000003}, { /* end of list */ }, }; mode |= EN_FMRADIO_EN_RDS; if (sap) { - dprintk("%s SAP (status: unknown)\n",__FUNCTION__); - set_audio_start(core, SEL_SAP); + dprintk("%s SAP (status: unknown)\n", __FUNCTION__); + set_audio_start(core, SEL_SAP); set_audio_registers(core, btsc_sap); set_audio_finish(core, mode); } else { - dprintk("%s (status: known-good)\n",__FUNCTION__); - set_audio_start(core, SEL_BTSC); + dprintk("%s (status: known-good)\n", __FUNCTION__); + set_audio_start(core, SEL_BTSC); set_audio_registers(core, btsc); set_audio_finish(core, mode); } @@ -274,87 +272,87 @@ static void set_audio_standard_BTSC(struct cx88_core *core, unsigned int sap, u3 static void set_audio_standard_NICAM(struct cx88_core *core, u32 mode) { static const struct rlist nicam_l[] = { - { AUD_AFE_12DB_EN, 0x00000001}, - { AUD_RATE_ADJ1, 0x00000060 }, - { AUD_RATE_ADJ2, 0x000000F9 }, - { AUD_RATE_ADJ3, 0x000001CC }, - { AUD_RATE_ADJ4, 0x000002B3 }, - { AUD_RATE_ADJ5, 0x00000726 }, - { AUD_DEEMPHDENOM1_R, 0x0000F3D0 }, - { AUD_DEEMPHDENOM2_R, 0x00000000 }, - { AUD_ERRLOGPERIOD_R, 0x00000064 }, - { AUD_ERRINTRPTTHSHLD1_R, 0x00000FFF }, - { AUD_ERRINTRPTTHSHLD2_R, 0x0000001F }, - { AUD_ERRINTRPTTHSHLD3_R, 0x0000000F }, - { AUD_POLYPH80SCALEFAC, 0x00000003 }, - { AUD_DMD_RA_DDS, 0x00C00000 }, - { AUD_PLL_INT, 0x0000001E }, - { AUD_PLL_DDS, 0x00000000 }, - { AUD_PLL_FRAC, 0x0000E542 }, - { AUD_START_TIMER, 0x00000000 }, - { AUD_DEEMPHNUMER1_R, 0x000353DE }, - { AUD_DEEMPHNUMER2_R, 0x000001B1 }, - { AUD_PDF_DDS_CNST_BYTE2, 0x06 }, - { AUD_PDF_DDS_CNST_BYTE1, 0x82 }, - { AUD_PDF_DDS_CNST_BYTE0, 0x12 }, - { AUD_QAM_MODE, 0x05 }, - { AUD_PHACC_FREQ_8MSB, 0x34 }, - { AUD_PHACC_FREQ_8LSB, 0x4C }, - { AUD_DEEMPHGAIN_R, 0x00006680 }, - { AUD_RATE_THRES_DMD, 0x000000C0 }, - { /* end of list */ }, - } ; + {AUD_AFE_12DB_EN, 0x00000001}, + {AUD_RATE_ADJ1, 0x00000060}, + {AUD_RATE_ADJ2, 0x000000F9}, + {AUD_RATE_ADJ3, 0x000001CC}, + {AUD_RATE_ADJ4, 0x000002B3}, + {AUD_RATE_ADJ5, 0x00000726}, + {AUD_DEEMPHDENOM1_R, 0x0000F3D0}, + {AUD_DEEMPHDENOM2_R, 0x00000000}, + {AUD_ERRLOGPERIOD_R, 0x00000064}, + {AUD_ERRINTRPTTHSHLD1_R, 0x00000FFF}, + {AUD_ERRINTRPTTHSHLD2_R, 0x0000001F}, + {AUD_ERRINTRPTTHSHLD3_R, 0x0000000F}, + {AUD_POLYPH80SCALEFAC, 0x00000003}, + {AUD_DMD_RA_DDS, 0x00C00000}, + {AUD_PLL_INT, 0x0000001E}, + {AUD_PLL_DDS, 0x00000000}, + {AUD_PLL_FRAC, 0x0000E542}, + {AUD_START_TIMER, 0x00000000}, + {AUD_DEEMPHNUMER1_R, 0x000353DE}, + {AUD_DEEMPHNUMER2_R, 0x000001B1}, + {AUD_PDF_DDS_CNST_BYTE2, 0x06}, + {AUD_PDF_DDS_CNST_BYTE1, 0x82}, + {AUD_PDF_DDS_CNST_BYTE0, 0x12}, + {AUD_QAM_MODE, 0x05}, + {AUD_PHACC_FREQ_8MSB, 0x34}, + {AUD_PHACC_FREQ_8LSB, 0x4C}, + {AUD_DEEMPHGAIN_R, 0x00006680}, + {AUD_RATE_THRES_DMD, 0x000000C0}, + { /* end of list */ }, + }; static const struct rlist nicam_bgdki_common[] = { - { AUD_AFE_12DB_EN, 0x00000001}, - { AUD_RATE_ADJ1, 0x00000010 }, - { AUD_RATE_ADJ2, 0x00000040 }, - { AUD_RATE_ADJ3, 0x00000100 }, - { AUD_RATE_ADJ4, 0x00000400 }, - { AUD_RATE_ADJ5, 0x00001000 }, - //{ AUD_DMD_RA_DDS, 0x00c0d5ce }, - { AUD_ERRLOGPERIOD_R, 0x00000fff}, - { AUD_ERRINTRPTTHSHLD1_R, 0x000003ff}, - { AUD_ERRINTRPTTHSHLD2_R, 0x000000ff}, - { AUD_ERRINTRPTTHSHLD3_R, 0x0000003f}, - { AUD_POLYPH80SCALEFAC, 0x00000003}, - { AUD_DEEMPHGAIN_R, 0x000023c2}, - { AUD_DEEMPHNUMER1_R, 0x0002a7bc}, - { AUD_DEEMPHNUMER2_R, 0x0003023e}, - { AUD_DEEMPHDENOM1_R, 0x0000f3d0}, - { AUD_DEEMPHDENOM2_R, 0x00000000}, - { AUD_PDF_DDS_CNST_BYTE1, 0x82 }, - { AUD_PDF_DDS_CNST_BYTE0, 0x16 }, - { AUD_QAM_MODE, 0x05 }, - { /* end of list */ }, + {AUD_AFE_12DB_EN, 0x00000001}, + {AUD_RATE_ADJ1, 0x00000010}, + {AUD_RATE_ADJ2, 0x00000040}, + {AUD_RATE_ADJ3, 0x00000100}, + {AUD_RATE_ADJ4, 0x00000400}, + {AUD_RATE_ADJ5, 0x00001000}, + //{ AUD_DMD_RA_DDS, 0x00c0d5ce }, + {AUD_ERRLOGPERIOD_R, 0x00000fff}, + {AUD_ERRINTRPTTHSHLD1_R, 0x000003ff}, + {AUD_ERRINTRPTTHSHLD2_R, 0x000000ff}, + {AUD_ERRINTRPTTHSHLD3_R, 0x0000003f}, + {AUD_POLYPH80SCALEFAC, 0x00000003}, + {AUD_DEEMPHGAIN_R, 0x000023c2}, + {AUD_DEEMPHNUMER1_R, 0x0002a7bc}, + {AUD_DEEMPHNUMER2_R, 0x0003023e}, + {AUD_DEEMPHDENOM1_R, 0x0000f3d0}, + {AUD_DEEMPHDENOM2_R, 0x00000000}, + {AUD_PDF_DDS_CNST_BYTE1, 0x82}, + {AUD_PDF_DDS_CNST_BYTE0, 0x16}, + {AUD_QAM_MODE, 0x05}, + { /* end of list */ }, }; static const struct rlist nicam_i[] = { - { AUD_PDF_DDS_CNST_BYTE0, 0x12 }, - { AUD_PHACC_FREQ_8MSB, 0x3a }, - { AUD_PHACC_FREQ_8LSB, 0x93 }, - { /* end of list */ }, + {AUD_PDF_DDS_CNST_BYTE0, 0x12}, + {AUD_PHACC_FREQ_8MSB, 0x3a}, + {AUD_PHACC_FREQ_8LSB, 0x93}, + { /* end of list */ }, }; static const struct rlist nicam_default[] = { - { AUD_PDF_DDS_CNST_BYTE0, 0x16 }, - { AUD_PHACC_FREQ_8MSB, 0x34 }, - { AUD_PHACC_FREQ_8LSB, 0x4c }, - { /* end of list */ }, + {AUD_PDF_DDS_CNST_BYTE0, 0x16}, + {AUD_PHACC_FREQ_8MSB, 0x34}, + {AUD_PHACC_FREQ_8LSB, 0x4c}, + { /* end of list */ }, }; switch (core->tvaudio) { case WW_L: - dprintk("%s SECAM-L NICAM (status: devel)\n",__FUNCTION__); + dprintk("%s SECAM-L NICAM (status: devel)\n", __FUNCTION__); set_audio_registers(core, nicam_l); break; case WW_I: - dprintk("%s PAL-I NICAM (status: devel)\n",__FUNCTION__); + dprintk("%s PAL-I NICAM (status: devel)\n", __FUNCTION__); set_audio_registers(core, nicam_bgdki_common); set_audio_registers(core, nicam_i); break; default: - dprintk("%s PAL-BGDK NICAM (status: unknown)\n",__FUNCTION__); + dprintk("%s PAL-BGDK NICAM (status: unknown)\n", __FUNCTION__); set_audio_registers(core, nicam_bgdki_common); set_audio_registers(core, nicam_default); break; @@ -367,255 +365,255 @@ static void set_audio_standard_NICAM(struct cx88_core *core, u32 mode) static void set_audio_standard_A2(struct cx88_core *core, u32 mode) { static const struct rlist a2_bgdk_common[] = { - {AUD_ERRLOGPERIOD_R, 0x00000064}, - {AUD_ERRINTRPTTHSHLD1_R, 0x00000fff}, - {AUD_ERRINTRPTTHSHLD2_R, 0x0000001f}, - {AUD_ERRINTRPTTHSHLD3_R, 0x0000000f}, - {AUD_PDF_DDS_CNST_BYTE2, 0x06}, - {AUD_PDF_DDS_CNST_BYTE1, 0x82}, - {AUD_PDF_DDS_CNST_BYTE0, 0x12}, - {AUD_QAM_MODE, 0x05}, - {AUD_PHACC_FREQ_8MSB, 0x34}, - {AUD_PHACC_FREQ_8LSB, 0x4c}, - {AUD_RATE_ADJ1, 0x00000100}, - {AUD_RATE_ADJ2, 0x00000200}, - {AUD_RATE_ADJ3, 0x00000300}, - {AUD_RATE_ADJ4, 0x00000400}, - {AUD_RATE_ADJ5, 0x00000500}, - {AUD_THR_FR, 0x00000000}, - {AAGC_HYST, 0x0000001a}, - {AUD_PILOT_BQD_1_K0, 0x0000755b}, - {AUD_PILOT_BQD_1_K1, 0x00551340}, - {AUD_PILOT_BQD_1_K2, 0x006d30be}, - {AUD_PILOT_BQD_1_K3, 0xffd394af}, - {AUD_PILOT_BQD_1_K4, 0x00400000}, - {AUD_PILOT_BQD_2_K0, 0x00040000}, - {AUD_PILOT_BQD_2_K1, 0x002a4841}, - {AUD_PILOT_BQD_2_K2, 0x00400000}, - {AUD_PILOT_BQD_2_K3, 0x00000000}, - {AUD_PILOT_BQD_2_K4, 0x00000000}, - {AUD_MODE_CHG_TIMER, 0x00000040}, - {AUD_AFE_12DB_EN, 0x00000001}, - {AUD_CORDIC_SHIFT_0, 0x00000007}, - {AUD_CORDIC_SHIFT_1, 0x00000007}, - {AUD_DEEMPH0_G0, 0x00000380}, - {AUD_DEEMPH1_G0, 0x00000380}, - {AUD_DCOC_0_SRC, 0x0000001a}, - {AUD_DCOC0_SHIFT, 0x00000000}, - {AUD_DCOC_0_SHIFT_IN0, 0x0000000a}, - {AUD_DCOC_0_SHIFT_IN1, 0x00000008}, - {AUD_DCOC_PASS_IN, 0x00000003}, - {AUD_IIR3_0_SEL, 0x00000021}, - {AUD_DN2_AFC, 0x00000002}, - {AUD_DCOC_1_SRC, 0x0000001b}, - {AUD_DCOC1_SHIFT, 0x00000000}, - {AUD_DCOC_1_SHIFT_IN0, 0x0000000a}, - {AUD_DCOC_1_SHIFT_IN1, 0x00000008}, - {AUD_IIR3_1_SEL, 0x00000023}, - {AUD_RDSI_SEL, 0x00000017}, - {AUD_RDSI_SHIFT, 0x00000000}, - {AUD_RDSQ_SEL, 0x00000017}, - {AUD_RDSQ_SHIFT, 0x00000000}, - {AUD_PLL_INT, 0x0000001e}, - {AUD_PLL_DDS, 0x00000000}, - {AUD_PLL_FRAC, 0x0000e542}, - {AUD_POLYPH80SCALEFAC, 0x00000001}, - {AUD_START_TIMER, 0x00000000}, - { /* end of list */ }, + {AUD_ERRLOGPERIOD_R, 0x00000064}, + {AUD_ERRINTRPTTHSHLD1_R, 0x00000fff}, + {AUD_ERRINTRPTTHSHLD2_R, 0x0000001f}, + {AUD_ERRINTRPTTHSHLD3_R, 0x0000000f}, + {AUD_PDF_DDS_CNST_BYTE2, 0x06}, + {AUD_PDF_DDS_CNST_BYTE1, 0x82}, + {AUD_PDF_DDS_CNST_BYTE0, 0x12}, + {AUD_QAM_MODE, 0x05}, + {AUD_PHACC_FREQ_8MSB, 0x34}, + {AUD_PHACC_FREQ_8LSB, 0x4c}, + {AUD_RATE_ADJ1, 0x00000100}, + {AUD_RATE_ADJ2, 0x00000200}, + {AUD_RATE_ADJ3, 0x00000300}, + {AUD_RATE_ADJ4, 0x00000400}, + {AUD_RATE_ADJ5, 0x00000500}, + {AUD_THR_FR, 0x00000000}, + {AAGC_HYST, 0x0000001a}, + {AUD_PILOT_BQD_1_K0, 0x0000755b}, + {AUD_PILOT_BQD_1_K1, 0x00551340}, + {AUD_PILOT_BQD_1_K2, 0x006d30be}, + {AUD_PILOT_BQD_1_K3, 0xffd394af}, + {AUD_PILOT_BQD_1_K4, 0x00400000}, + {AUD_PILOT_BQD_2_K0, 0x00040000}, + {AUD_PILOT_BQD_2_K1, 0x002a4841}, + {AUD_PILOT_BQD_2_K2, 0x00400000}, + {AUD_PILOT_BQD_2_K3, 0x00000000}, + {AUD_PILOT_BQD_2_K4, 0x00000000}, + {AUD_MODE_CHG_TIMER, 0x00000040}, + {AUD_AFE_12DB_EN, 0x00000001}, + {AUD_CORDIC_SHIFT_0, 0x00000007}, + {AUD_CORDIC_SHIFT_1, 0x00000007}, + {AUD_DEEMPH0_G0, 0x00000380}, + {AUD_DEEMPH1_G0, 0x00000380}, + {AUD_DCOC_0_SRC, 0x0000001a}, + {AUD_DCOC0_SHIFT, 0x00000000}, + {AUD_DCOC_0_SHIFT_IN0, 0x0000000a}, + {AUD_DCOC_0_SHIFT_IN1, 0x00000008}, + {AUD_DCOC_PASS_IN, 0x00000003}, + {AUD_IIR3_0_SEL, 0x00000021}, + {AUD_DN2_AFC, 0x00000002}, + {AUD_DCOC_1_SRC, 0x0000001b}, + {AUD_DCOC1_SHIFT, 0x00000000}, + {AUD_DCOC_1_SHIFT_IN0, 0x0000000a}, + {AUD_DCOC_1_SHIFT_IN1, 0x00000008}, + {AUD_IIR3_1_SEL, 0x00000023}, + {AUD_RDSI_SEL, 0x00000017}, + {AUD_RDSI_SHIFT, 0x00000000}, + {AUD_RDSQ_SEL, 0x00000017}, + {AUD_RDSQ_SHIFT, 0x00000000}, + {AUD_PLL_INT, 0x0000001e}, + {AUD_PLL_DDS, 0x00000000}, + {AUD_PLL_FRAC, 0x0000e542}, + {AUD_POLYPH80SCALEFAC, 0x00000001}, + {AUD_START_TIMER, 0x00000000}, + { /* end of list */ }, }; static const struct rlist a2_bg[] = { - {AUD_DMD_RA_DDS, 0x002a4f2f}, - {AUD_C1_UP_THR, 0x00007000}, - {AUD_C1_LO_THR, 0x00005400}, - {AUD_C2_UP_THR, 0x00005400}, - {AUD_C2_LO_THR, 0x00003000}, - { /* end of list */ }, + {AUD_DMD_RA_DDS, 0x002a4f2f}, + {AUD_C1_UP_THR, 0x00007000}, + {AUD_C1_LO_THR, 0x00005400}, + {AUD_C2_UP_THR, 0x00005400}, + {AUD_C2_LO_THR, 0x00003000}, + { /* end of list */ }, }; static const struct rlist a2_dk[] = { - {AUD_DMD_RA_DDS, 0x002a4f2f}, - {AUD_C1_UP_THR, 0x00007000}, - {AUD_C1_LO_THR, 0x00005400}, - {AUD_C2_UP_THR, 0x00005400}, - {AUD_C2_LO_THR, 0x00003000}, - {AUD_DN0_FREQ, 0x00003a1c}, - {AUD_DN2_FREQ, 0x0000d2e0}, - { /* end of list */ }, + {AUD_DMD_RA_DDS, 0x002a4f2f}, + {AUD_C1_UP_THR, 0x00007000}, + {AUD_C1_LO_THR, 0x00005400}, + {AUD_C2_UP_THR, 0x00005400}, + {AUD_C2_LO_THR, 0x00003000}, + {AUD_DN0_FREQ, 0x00003a1c}, + {AUD_DN2_FREQ, 0x0000d2e0}, + { /* end of list */ }, }; static const struct rlist a1_i[] = { - {AUD_ERRLOGPERIOD_R, 0x00000064}, - {AUD_ERRINTRPTTHSHLD1_R, 0x00000fff}, - {AUD_ERRINTRPTTHSHLD2_R, 0x0000001f}, - {AUD_ERRINTRPTTHSHLD3_R, 0x0000000f}, - {AUD_PDF_DDS_CNST_BYTE2, 0x06}, - {AUD_PDF_DDS_CNST_BYTE1, 0x82}, - {AUD_PDF_DDS_CNST_BYTE0, 0x12}, - {AUD_QAM_MODE, 0x05}, - {AUD_PHACC_FREQ_8MSB, 0x3a}, - {AUD_PHACC_FREQ_8LSB, 0x93}, - {AUD_DMD_RA_DDS, 0x002a4f2f}, - {AUD_PLL_INT, 0x0000001e}, - {AUD_PLL_DDS, 0x00000004}, - {AUD_PLL_FRAC, 0x0000e542}, - {AUD_RATE_ADJ1, 0x00000100}, - {AUD_RATE_ADJ2, 0x00000200}, - {AUD_RATE_ADJ3, 0x00000300}, - {AUD_RATE_ADJ4, 0x00000400}, - {AUD_RATE_ADJ5, 0x00000500}, - {AUD_THR_FR, 0x00000000}, - {AUD_PILOT_BQD_1_K0, 0x0000755b}, - {AUD_PILOT_BQD_1_K1, 0x00551340}, - {AUD_PILOT_BQD_1_K2, 0x006d30be}, - {AUD_PILOT_BQD_1_K3, 0xffd394af}, - {AUD_PILOT_BQD_1_K4, 0x00400000}, - {AUD_PILOT_BQD_2_K0, 0x00040000}, - {AUD_PILOT_BQD_2_K1, 0x002a4841}, - {AUD_PILOT_BQD_2_K2, 0x00400000}, - {AUD_PILOT_BQD_2_K3, 0x00000000}, - {AUD_PILOT_BQD_2_K4, 0x00000000}, - {AUD_MODE_CHG_TIMER, 0x00000060}, - {AUD_AFE_12DB_EN, 0x00000001}, - {AAGC_HYST, 0x0000000a}, - {AUD_CORDIC_SHIFT_0, 0x00000007}, - {AUD_CORDIC_SHIFT_1, 0x00000007}, - {AUD_C1_UP_THR, 0x00007000}, - {AUD_C1_LO_THR, 0x00005400}, - {AUD_C2_UP_THR, 0x00005400}, - {AUD_C2_LO_THR, 0x00003000}, - {AUD_DCOC_0_SRC, 0x0000001a}, - {AUD_DCOC0_SHIFT, 0x00000000}, - {AUD_DCOC_0_SHIFT_IN0, 0x0000000a}, - {AUD_DCOC_0_SHIFT_IN1, 0x00000008}, - {AUD_DCOC_PASS_IN, 0x00000003}, - {AUD_IIR3_0_SEL, 0x00000021}, - {AUD_DN2_AFC, 0x00000002}, - {AUD_DCOC_1_SRC, 0x0000001b}, - {AUD_DCOC1_SHIFT, 0x00000000}, - {AUD_DCOC_1_SHIFT_IN0, 0x0000000a}, - {AUD_DCOC_1_SHIFT_IN1, 0x00000008}, - {AUD_IIR3_1_SEL, 0x00000023}, - {AUD_DN0_FREQ, 0x000035a3}, - {AUD_DN2_FREQ, 0x000029c7}, - {AUD_CRDC0_SRC_SEL, 0x00000511}, - {AUD_IIR1_0_SEL, 0x00000001}, - {AUD_IIR1_1_SEL, 0x00000000}, - {AUD_IIR3_2_SEL, 0x00000003}, - {AUD_IIR3_2_SHIFT, 0x00000000}, - {AUD_IIR3_0_SEL, 0x00000002}, - {AUD_IIR2_0_SEL, 0x00000021}, - {AUD_IIR2_0_SHIFT, 0x00000002}, - {AUD_DEEMPH0_SRC_SEL, 0x0000000b}, - {AUD_DEEMPH1_SRC_SEL, 0x0000000b}, - {AUD_POLYPH80SCALEFAC, 0x00000001}, - {AUD_START_TIMER, 0x00000000}, - { /* end of list */ }, + {AUD_ERRLOGPERIOD_R, 0x00000064}, + {AUD_ERRINTRPTTHSHLD1_R, 0x00000fff}, + {AUD_ERRINTRPTTHSHLD2_R, 0x0000001f}, + {AUD_ERRINTRPTTHSHLD3_R, 0x0000000f}, + {AUD_PDF_DDS_CNST_BYTE2, 0x06}, + {AUD_PDF_DDS_CNST_BYTE1, 0x82}, + {AUD_PDF_DDS_CNST_BYTE0, 0x12}, + {AUD_QAM_MODE, 0x05}, + {AUD_PHACC_FREQ_8MSB, 0x3a}, + {AUD_PHACC_FREQ_8LSB, 0x93}, + {AUD_DMD_RA_DDS, 0x002a4f2f}, + {AUD_PLL_INT, 0x0000001e}, + {AUD_PLL_DDS, 0x00000004}, + {AUD_PLL_FRAC, 0x0000e542}, + {AUD_RATE_ADJ1, 0x00000100}, + {AUD_RATE_ADJ2, 0x00000200}, + {AUD_RATE_ADJ3, 0x00000300}, + {AUD_RATE_ADJ4, 0x00000400}, + {AUD_RATE_ADJ5, 0x00000500}, + {AUD_THR_FR, 0x00000000}, + {AUD_PILOT_BQD_1_K0, 0x0000755b}, + {AUD_PILOT_BQD_1_K1, 0x00551340}, + {AUD_PILOT_BQD_1_K2, 0x006d30be}, + {AUD_PILOT_BQD_1_K3, 0xffd394af}, + {AUD_PILOT_BQD_1_K4, 0x00400000}, + {AUD_PILOT_BQD_2_K0, 0x00040000}, + {AUD_PILOT_BQD_2_K1, 0x002a4841}, + {AUD_PILOT_BQD_2_K2, 0x00400000}, + {AUD_PILOT_BQD_2_K3, 0x00000000}, + {AUD_PILOT_BQD_2_K4, 0x00000000}, + {AUD_MODE_CHG_TIMER, 0x00000060}, + {AUD_AFE_12DB_EN, 0x00000001}, + {AAGC_HYST, 0x0000000a}, + {AUD_CORDIC_SHIFT_0, 0x00000007}, + {AUD_CORDIC_SHIFT_1, 0x00000007}, + {AUD_C1_UP_THR, 0x00007000}, + {AUD_C1_LO_THR, 0x00005400}, + {AUD_C2_UP_THR, 0x00005400}, + {AUD_C2_LO_THR, 0x00003000}, + {AUD_DCOC_0_SRC, 0x0000001a}, + {AUD_DCOC0_SHIFT, 0x00000000}, + {AUD_DCOC_0_SHIFT_IN0, 0x0000000a}, + {AUD_DCOC_0_SHIFT_IN1, 0x00000008}, + {AUD_DCOC_PASS_IN, 0x00000003}, + {AUD_IIR3_0_SEL, 0x00000021}, + {AUD_DN2_AFC, 0x00000002}, + {AUD_DCOC_1_SRC, 0x0000001b}, + {AUD_DCOC1_SHIFT, 0x00000000}, + {AUD_DCOC_1_SHIFT_IN0, 0x0000000a}, + {AUD_DCOC_1_SHIFT_IN1, 0x00000008}, + {AUD_IIR3_1_SEL, 0x00000023}, + {AUD_DN0_FREQ, 0x000035a3}, + {AUD_DN2_FREQ, 0x000029c7}, + {AUD_CRDC0_SRC_SEL, 0x00000511}, + {AUD_IIR1_0_SEL, 0x00000001}, + {AUD_IIR1_1_SEL, 0x00000000}, + {AUD_IIR3_2_SEL, 0x00000003}, + {AUD_IIR3_2_SHIFT, 0x00000000}, + {AUD_IIR3_0_SEL, 0x00000002}, + {AUD_IIR2_0_SEL, 0x00000021}, + {AUD_IIR2_0_SHIFT, 0x00000002}, + {AUD_DEEMPH0_SRC_SEL, 0x0000000b}, + {AUD_DEEMPH1_SRC_SEL, 0x0000000b}, + {AUD_POLYPH80SCALEFAC, 0x00000001}, + {AUD_START_TIMER, 0x00000000}, + { /* end of list */ }, }; static const struct rlist am_l[] = { - {AUD_ERRLOGPERIOD_R, 0x00000064}, - {AUD_ERRINTRPTTHSHLD1_R, 0x00000FFF}, - {AUD_ERRINTRPTTHSHLD2_R, 0x0000001F}, - {AUD_ERRINTRPTTHSHLD3_R, 0x0000000F}, - {AUD_PDF_DDS_CNST_BYTE2, 0x48}, - {AUD_PDF_DDS_CNST_BYTE1, 0x3D}, - {AUD_QAM_MODE, 0x00}, - {AUD_PDF_DDS_CNST_BYTE0, 0xf5}, - {AUD_PHACC_FREQ_8MSB, 0x3a}, - {AUD_PHACC_FREQ_8LSB, 0x4a}, - {AUD_DEEMPHGAIN_R, 0x00006680}, - {AUD_DEEMPHNUMER1_R, 0x000353DE}, - {AUD_DEEMPHNUMER2_R, 0x000001B1}, - {AUD_DEEMPHDENOM1_R, 0x0000F3D0}, - {AUD_DEEMPHDENOM2_R, 0x00000000}, - {AUD_FM_MODE_ENABLE, 0x00000007}, - {AUD_POLYPH80SCALEFAC, 0x00000003}, - {AUD_AFE_12DB_EN, 0x00000001}, - {AAGC_GAIN, 0x00000000}, - {AAGC_HYST, 0x00000018}, - {AAGC_DEF, 0x00000020}, - {AUD_DN0_FREQ, 0x00000000}, - {AUD_POLY0_DDS_CONSTANT, 0x000E4DB2}, - {AUD_DCOC_0_SRC, 0x00000021}, - {AUD_IIR1_0_SEL, 0x00000000}, - {AUD_IIR1_0_SHIFT, 0x00000007}, - {AUD_IIR1_1_SEL, 0x00000002}, - {AUD_IIR1_1_SHIFT, 0x00000000}, - {AUD_DCOC_1_SRC, 0x00000003}, - {AUD_DCOC1_SHIFT, 0x00000000}, - {AUD_DCOC_PASS_IN, 0x00000000}, - {AUD_IIR1_2_SEL, 0x00000023}, - {AUD_IIR1_2_SHIFT, 0x00000000}, - {AUD_IIR1_3_SEL, 0x00000004}, - {AUD_IIR1_3_SHIFT, 0x00000007}, - {AUD_IIR1_4_SEL, 0x00000005}, - {AUD_IIR1_4_SHIFT, 0x00000007}, - {AUD_IIR3_0_SEL, 0x00000007}, - {AUD_IIR3_0_SHIFT, 0x00000000}, - {AUD_DEEMPH0_SRC_SEL, 0x00000011}, - {AUD_DEEMPH0_SHIFT, 0x00000000}, - {AUD_DEEMPH0_G0, 0x00007000}, - {AUD_DEEMPH0_A0, 0x00000000}, - {AUD_DEEMPH0_B0, 0x00000000}, - {AUD_DEEMPH0_A1, 0x00000000}, - {AUD_DEEMPH0_B1, 0x00000000}, - {AUD_DEEMPH1_SRC_SEL, 0x00000011}, - {AUD_DEEMPH1_SHIFT, 0x00000000}, - {AUD_DEEMPH1_G0, 0x00007000}, - {AUD_DEEMPH1_A0, 0x00000000}, - {AUD_DEEMPH1_B0, 0x00000000}, - {AUD_DEEMPH1_A1, 0x00000000}, - {AUD_DEEMPH1_B1, 0x00000000}, - {AUD_OUT0_SEL, 0x0000003F}, - {AUD_OUT1_SEL, 0x0000003F}, - {AUD_DMD_RA_DDS, 0x00F5C285}, - {AUD_PLL_INT, 0x0000001E}, - {AUD_PLL_DDS, 0x00000000}, - {AUD_PLL_FRAC, 0x0000E542}, - {AUD_RATE_ADJ1, 0x00000100}, - {AUD_RATE_ADJ2, 0x00000200}, - {AUD_RATE_ADJ3, 0x00000300}, - {AUD_RATE_ADJ4, 0x00000400}, - {AUD_RATE_ADJ5, 0x00000500}, - {AUD_RATE_THRES_DMD, 0x000000C0}, - {/* end of list */ }, + {AUD_ERRLOGPERIOD_R, 0x00000064}, + {AUD_ERRINTRPTTHSHLD1_R, 0x00000FFF}, + {AUD_ERRINTRPTTHSHLD2_R, 0x0000001F}, + {AUD_ERRINTRPTTHSHLD3_R, 0x0000000F}, + {AUD_PDF_DDS_CNST_BYTE2, 0x48}, + {AUD_PDF_DDS_CNST_BYTE1, 0x3D}, + {AUD_QAM_MODE, 0x00}, + {AUD_PDF_DDS_CNST_BYTE0, 0xf5}, + {AUD_PHACC_FREQ_8MSB, 0x3a}, + {AUD_PHACC_FREQ_8LSB, 0x4a}, + {AUD_DEEMPHGAIN_R, 0x00006680}, + {AUD_DEEMPHNUMER1_R, 0x000353DE}, + {AUD_DEEMPHNUMER2_R, 0x000001B1}, + {AUD_DEEMPHDENOM1_R, 0x0000F3D0}, + {AUD_DEEMPHDENOM2_R, 0x00000000}, + {AUD_FM_MODE_ENABLE, 0x00000007}, + {AUD_POLYPH80SCALEFAC, 0x00000003}, + {AUD_AFE_12DB_EN, 0x00000001}, + {AAGC_GAIN, 0x00000000}, + {AAGC_HYST, 0x00000018}, + {AAGC_DEF, 0x00000020}, + {AUD_DN0_FREQ, 0x00000000}, + {AUD_POLY0_DDS_CONSTANT, 0x000E4DB2}, + {AUD_DCOC_0_SRC, 0x00000021}, + {AUD_IIR1_0_SEL, 0x00000000}, + {AUD_IIR1_0_SHIFT, 0x00000007}, + {AUD_IIR1_1_SEL, 0x00000002}, + {AUD_IIR1_1_SHIFT, 0x00000000}, + {AUD_DCOC_1_SRC, 0x00000003}, + {AUD_DCOC1_SHIFT, 0x00000000}, + {AUD_DCOC_PASS_IN, 0x00000000}, + {AUD_IIR1_2_SEL, 0x00000023}, + {AUD_IIR1_2_SHIFT, 0x00000000}, + {AUD_IIR1_3_SEL, 0x00000004}, + {AUD_IIR1_3_SHIFT, 0x00000007}, + {AUD_IIR1_4_SEL, 0x00000005}, + {AUD_IIR1_4_SHIFT, 0x00000007}, + {AUD_IIR3_0_SEL, 0x00000007}, + {AUD_IIR3_0_SHIFT, 0x00000000}, + {AUD_DEEMPH0_SRC_SEL, 0x00000011}, + {AUD_DEEMPH0_SHIFT, 0x00000000}, + {AUD_DEEMPH0_G0, 0x00007000}, + {AUD_DEEMPH0_A0, 0x00000000}, + {AUD_DEEMPH0_B0, 0x00000000}, + {AUD_DEEMPH0_A1, 0x00000000}, + {AUD_DEEMPH0_B1, 0x00000000}, + {AUD_DEEMPH1_SRC_SEL, 0x00000011}, + {AUD_DEEMPH1_SHIFT, 0x00000000}, + {AUD_DEEMPH1_G0, 0x00007000}, + {AUD_DEEMPH1_A0, 0x00000000}, + {AUD_DEEMPH1_B0, 0x00000000}, + {AUD_DEEMPH1_A1, 0x00000000}, + {AUD_DEEMPH1_B1, 0x00000000}, + {AUD_OUT0_SEL, 0x0000003F}, + {AUD_OUT1_SEL, 0x0000003F}, + {AUD_DMD_RA_DDS, 0x00F5C285}, + {AUD_PLL_INT, 0x0000001E}, + {AUD_PLL_DDS, 0x00000000}, + {AUD_PLL_FRAC, 0x0000E542}, + {AUD_RATE_ADJ1, 0x00000100}, + {AUD_RATE_ADJ2, 0x00000200}, + {AUD_RATE_ADJ3, 0x00000300}, + {AUD_RATE_ADJ4, 0x00000400}, + {AUD_RATE_ADJ5, 0x00000500}, + {AUD_RATE_THRES_DMD, 0x000000C0}, + { /* end of list */ }, }; static const struct rlist a2_deemph50[] = { - {AUD_DEEMPH0_G0, 0x00000380}, - {AUD_DEEMPH1_G0, 0x00000380}, - {AUD_DEEMPHGAIN_R, 0x000011e1}, - {AUD_DEEMPHNUMER1_R, 0x0002a7bc}, - {AUD_DEEMPHNUMER2_R, 0x0003023c}, - { /* end of list */ }, + {AUD_DEEMPH0_G0, 0x00000380}, + {AUD_DEEMPH1_G0, 0x00000380}, + {AUD_DEEMPHGAIN_R, 0x000011e1}, + {AUD_DEEMPHNUMER1_R, 0x0002a7bc}, + {AUD_DEEMPHNUMER2_R, 0x0003023c}, + { /* end of list */ }, }; set_audio_start(core, SEL_A2); switch (core->tvaudio) { case WW_BG: - dprintk("%s PAL-BG A1/2 (status: known-good)\n",__FUNCTION__); + dprintk("%s PAL-BG A1/2 (status: known-good)\n", __FUNCTION__); set_audio_registers(core, a2_bgdk_common); set_audio_registers(core, a2_bg); set_audio_registers(core, a2_deemph50); break; case WW_DK: - dprintk("%s PAL-DK A1/2 (status: known-good)\n",__FUNCTION__); + dprintk("%s PAL-DK A1/2 (status: known-good)\n", __FUNCTION__); set_audio_registers(core, a2_bgdk_common); set_audio_registers(core, a2_dk); set_audio_registers(core, a2_deemph50); break; case WW_I: - dprintk("%s PAL-I A1 (status: known-good)\n",__FUNCTION__); + dprintk("%s PAL-I A1 (status: known-good)\n", __FUNCTION__); set_audio_registers(core, a1_i); set_audio_registers(core, a2_deemph50); break; case WW_L: - dprintk("%s AM-L (status: devel)\n",__FUNCTION__); + dprintk("%s AM-L (status: devel)\n", __FUNCTION__); set_audio_registers(core, am_l); break; default: - dprintk("%s Warning: wrong value\n",__FUNCTION__); + dprintk("%s Warning: wrong value\n", __FUNCTION__); return; break; }; @@ -631,71 +629,71 @@ static void set_audio_standard_EIAJ(struct cx88_core *core) { /* end of list */ }, }; - dprintk("%s (status: unknown)\n",__FUNCTION__); + dprintk("%s (status: unknown)\n", __FUNCTION__); set_audio_start(core, SEL_EIAJ); set_audio_registers(core, eiaj); set_audio_finish(core, EN_EIAJ_AUTO_STEREO); } -static void set_audio_standard_FM(struct cx88_core *core, enum cx88_deemph_type deemph) +static void set_audio_standard_FM(struct cx88_core *core, + enum cx88_deemph_type deemph) { static const struct rlist fm_deemph_50[] = { - { AUD_DEEMPH0_G0, 0x0C45 }, - { AUD_DEEMPH0_A0, 0x6262 }, - { AUD_DEEMPH0_B0, 0x1C29 }, - { AUD_DEEMPH0_A1, 0x3FC66}, - { AUD_DEEMPH0_B1, 0x399A }, - - { AUD_DEEMPH1_G0, 0x0D80 }, - { AUD_DEEMPH1_A0, 0x6262 }, - { AUD_DEEMPH1_B0, 0x1C29 }, - { AUD_DEEMPH1_A1, 0x3FC66}, - { AUD_DEEMPH1_B1, 0x399A}, - - { AUD_POLYPH80SCALEFAC, 0x0003}, + {AUD_DEEMPH0_G0, 0x0C45}, + {AUD_DEEMPH0_A0, 0x6262}, + {AUD_DEEMPH0_B0, 0x1C29}, + {AUD_DEEMPH0_A1, 0x3FC66}, + {AUD_DEEMPH0_B1, 0x399A}, + + {AUD_DEEMPH1_G0, 0x0D80}, + {AUD_DEEMPH1_A0, 0x6262}, + {AUD_DEEMPH1_B0, 0x1C29}, + {AUD_DEEMPH1_A1, 0x3FC66}, + {AUD_DEEMPH1_B1, 0x399A}, + + {AUD_POLYPH80SCALEFAC, 0x0003}, { /* end of list */ }, }; static const struct rlist fm_deemph_75[] = { - { AUD_DEEMPH0_G0, 0x091B }, - { AUD_DEEMPH0_A0, 0x6B68 }, - { AUD_DEEMPH0_B0, 0x11EC }, - { AUD_DEEMPH0_A1, 0x3FC66}, - { AUD_DEEMPH0_B1, 0x399A }, - - { AUD_DEEMPH1_G0, 0x0AA0 }, - { AUD_DEEMPH1_A0, 0x6B68 }, - { AUD_DEEMPH1_B0, 0x11EC }, - { AUD_DEEMPH1_A1, 0x3FC66}, - { AUD_DEEMPH1_B1, 0x399A}, - - { AUD_POLYPH80SCALEFAC, 0x0003}, + {AUD_DEEMPH0_G0, 0x091B}, + {AUD_DEEMPH0_A0, 0x6B68}, + {AUD_DEEMPH0_B0, 0x11EC}, + {AUD_DEEMPH0_A1, 0x3FC66}, + {AUD_DEEMPH0_B1, 0x399A}, + + {AUD_DEEMPH1_G0, 0x0AA0}, + {AUD_DEEMPH1_A0, 0x6B68}, + {AUD_DEEMPH1_B0, 0x11EC}, + {AUD_DEEMPH1_A1, 0x3FC66}, + {AUD_DEEMPH1_B1, 0x399A}, + + {AUD_POLYPH80SCALEFAC, 0x0003}, { /* end of list */ }, }; /* It is enough to leave default values? */ static const struct rlist fm_no_deemph[] = { - { AUD_POLYPH80SCALEFAC, 0x0003}, + {AUD_POLYPH80SCALEFAC, 0x0003}, { /* end of list */ }, }; - dprintk("%s (status: unknown)\n",__FUNCTION__); + dprintk("%s (status: unknown)\n", __FUNCTION__); set_audio_start(core, SEL_FMRADIO); - switch (deemph) - { - case FM_NO_DEEMPH: - set_audio_registers(core, fm_no_deemph); - break; + switch (deemph) { + case FM_NO_DEEMPH: + set_audio_registers(core, fm_no_deemph); + break; - case FM_DEEMPH_50: - set_audio_registers(core, fm_deemph_50); - break; + case FM_DEEMPH_50: + set_audio_registers(core, fm_deemph_50); + break; - case FM_DEEMPH_75: - set_audio_registers(core, fm_deemph_75); - break; + case FM_DEEMPH_75: + set_audio_registers(core, fm_deemph_75); + break; } set_audio_finish(core, EN_FMRADIO_AUTO_STEREO); @@ -705,22 +703,22 @@ static void set_audio_standard_FM(struct cx88_core *core, enum cx88_deemph_type int cx88_detect_nicam(struct cx88_core *core) { - int i, j=0; + int i, j = 0; dprintk("start nicam autodetect.\n"); - for(i=0; i<6; i++) { - /* if bit1=1 then nicam is detected */ - j+= ((cx_read(AUD_NICAM_STATUS2) & 0x02) >> 1); + for (i = 0; i < 6; i++) { + /* if bit1=1 then nicam is detected */ + j += ((cx_read(AUD_NICAM_STATUS2) & 0x02) >> 1); /* 3x detected: absolutly sure now */ - if(j==3) { + if (j == 3) { dprintk("nicam is detected.\n"); return 1; } /* wait a little bit for next reading status */ - msleep (10); + msleep(10); } dprintk("nicam is not detected.\n"); @@ -743,24 +741,24 @@ void cx88_set_tvaudio(struct cx88_core *core) /* set nicam mode - otherwise AUD_NICAM_STATUS2 contains wrong values */ set_audio_standard_NICAM(core, EN_NICAM_FORCE_MONO1); - if(0 == cx88_detect_nicam(core)) { + if (0 == cx88_detect_nicam(core)) { /* fall back to fm / am mono */ set_audio_standard_A2(core, EN_A2_FORCE_MONO1); core->use_nicam = 0; - } else { + } else { core->use_nicam = 1; - } + } break; case WW_EIAJ: set_audio_standard_EIAJ(core); break; case WW_FM: - set_audio_standard_FM(core,FM_NO_DEEMPH); + set_audio_standard_FM(core, FM_NO_DEEMPH); break; case WW_NONE: default: printk("%s/0: unknown tv audio mode [%d]\n", - core->name, core->tvaudio); + core->name, core->tvaudio); break; } return; @@ -773,12 +771,12 @@ void cx88_newstation(struct cx88_core *core) void cx88_get_stereo(struct cx88_core *core, struct v4l2_tuner *t) { - static char *m[] = {"stereo", "dual mono", "mono", "sap"}; - static char *p[] = {"no pilot", "pilot c1", "pilot c2", "?"}; - u32 reg,mode,pilot; + static char *m[] = { "stereo", "dual mono", "mono", "sap" }; + static char *p[] = { "no pilot", "pilot c1", "pilot c2", "?" }; + u32 reg, mode, pilot; - reg = cx_read(AUD_STATUS); - mode = reg & 0x03; + reg = cx_read(AUD_STATUS); + mode = reg & 0x03; pilot = (reg >> 2) & 0x03; if (core->astat != reg) @@ -795,14 +793,13 @@ void cx88_get_stereo(struct cx88_core *core, struct v4l2_tuner *t) # if 0 t->capability = V4L2_TUNER_CAP_STEREO | V4L2_TUNER_CAP_SAP | - V4L2_TUNER_CAP_LANG1 | V4L2_TUNER_CAP_LANG2; + V4L2_TUNER_CAP_LANG1 | V4L2_TUNER_CAP_LANG2; t->rxsubchans = V4L2_TUNER_SUB_MONO; - t->audmode = V4L2_TUNER_MODE_MONO; + t->audmode = V4L2_TUNER_MODE_MONO; switch (core->tvaudio) { case WW_BTSC: - t->capability = V4L2_TUNER_CAP_STEREO | - V4L2_TUNER_CAP_SAP; + t->capability = V4L2_TUNER_CAP_STEREO | V4L2_TUNER_CAP_SAP; t->rxsubchans = V4L2_TUNER_SUB_STEREO; if (1 == pilot) { /* SAP */ @@ -814,13 +811,15 @@ void cx88_get_stereo(struct cx88_core *core, struct v4l2_tuner *t) case WW_A2_M: if (1 == pilot) { /* stereo */ - t->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO; + t->rxsubchans = + V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO; if (0 == mode) t->audmode = V4L2_TUNER_MODE_STEREO; } if (2 == pilot) { /* dual language -- FIXME */ - t->rxsubchans = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2; + t->rxsubchans = + V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2; t->audmode = V4L2_TUNER_MODE_LANG1; } break; @@ -835,7 +834,7 @@ void cx88_get_stereo(struct cx88_core *core, struct v4l2_tuner *t) t->audmode = V4L2_TUNER_MODE_STEREO; t->rxsubchans |= V4L2_TUNER_SUB_STEREO; } - break ; + break; default: /* nothing */ break; @@ -846,7 +845,7 @@ void cx88_get_stereo(struct cx88_core *core, struct v4l2_tuner *t) void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual) { - u32 ctl = UNSET; + u32 ctl = UNSET; u32 mask = UNSET; if (manual) { @@ -878,21 +877,24 @@ void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual) case WW_DK: case WW_I: case WW_L: - if(1 == core->use_nicam) { + if (1 == core->use_nicam) { switch (mode) { case V4L2_TUNER_MODE_MONO: case V4L2_TUNER_MODE_LANG1: - set_audio_standard_NICAM(core, EN_NICAM_FORCE_MONO1); + set_audio_standard_NICAM(core, + EN_NICAM_FORCE_MONO1); break; case V4L2_TUNER_MODE_LANG2: - set_audio_standard_NICAM(core, EN_NICAM_FORCE_MONO2); + set_audio_standard_NICAM(core, + EN_NICAM_FORCE_MONO2); break; case V4L2_TUNER_MODE_STEREO: - set_audio_standard_NICAM(core, EN_NICAM_FORCE_STEREO); + set_audio_standard_NICAM(core, + EN_NICAM_FORCE_STEREO); break; } } else { - if ( (core->tvaudio == WW_I) || (core->tvaudio == WW_L) ) { + if ((core->tvaudio == WW_I) || (core->tvaudio == WW_L)) { /* fall back to fm / am mono */ set_audio_standard_A2(core, EN_A2_FORCE_MONO1); } else { @@ -900,13 +902,16 @@ void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual) switch (mode) { case V4L2_TUNER_MODE_MONO: case V4L2_TUNER_MODE_LANG1: - set_audio_standard_A2(core, EN_A2_FORCE_MONO1); + set_audio_standard_A2(core, + EN_A2_FORCE_MONO1); break; case V4L2_TUNER_MODE_LANG2: - set_audio_standard_A2(core, EN_A2_FORCE_MONO2); + set_audio_standard_A2(core, + EN_A2_FORCE_MONO2); break; case V4L2_TUNER_MODE_STEREO: - set_audio_standard_A2(core, EN_A2_FORCE_STEREO); + set_audio_standard_A2(core, + EN_A2_FORCE_STEREO); break; } } @@ -915,11 +920,11 @@ void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual) case WW_FM: switch (mode) { case V4L2_TUNER_MODE_MONO: - ctl = EN_FMRADIO_FORCE_MONO; + ctl = EN_FMRADIO_FORCE_MONO; mask = 0x3f; break; case V4L2_TUNER_MODE_STEREO: - ctl = EN_FMRADIO_AUTO_STEREO; + ctl = EN_FMRADIO_AUTO_STEREO; mask = 0x3f; break; } @@ -949,8 +954,8 @@ int cx88_audio_thread(void *data) break; /* just monitor the audio status for now ... */ - memset(&t,0,sizeof(t)); - cx88_get_stereo(core,&t); + memset(&t, 0, sizeof(t)); + cx88_get_stereo(core, &t); if (UNSET != core->audiomode_manual) /* manually set, don't do anything. */ -- cgit v1.2.2 From dc2286cfce214c0de00571f3219a50488c58dd6b Mon Sep 17 00:00:00 2001 From: "James R. Webb" Date: Tue, 8 Nov 2005 21:37:00 -0800 Subject: [PATCH] v4l: 707: remote for kworld terminator - Remote for KWorld Terminator. Signed-off-by: James R. Webb Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/saa7134/saa7134-cards.c | 1 + drivers/media/video/saa7134/saa7134-input.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index c59f4d775521..7278150fb58e 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c @@ -2848,6 +2848,7 @@ int saa7134_board_init1(struct saa7134_dev *dev) case SAA7134_BOARD_BEHOLD_409FM: case SAA7134_BOARD_AVACSSMARTTV: case SAA7134_BOARD_GOTVIEW_7135: + case SAA7134_BOARD_KWORLD_TERMINATOR: dev->has_remote = 1; break; case SAA7134_BOARD_MD5044: diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index 8d211ba22316..9dc41c1427a8 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -557,6 +557,12 @@ int saa7134_input_init1(struct saa7134_dev *dev) saa_setb(SAA7134_GPIO_GPMODE0, 0x4); saa_setb(SAA7134_GPIO_GPSTATUS0, 0x4); break; + case SAA7134_BOARD_KWORLD_TERMINATOR: + ir_codes = avacssmart_codes; + mask_keycode = 0x00001f; + mask_keyup = 0x000060; + polling = 50; // ms + break; case SAA7134_BOARD_MANLI_MTV001: case SAA7134_BOARD_MANLI_MTV002: case SAA7134_BOARD_BEHOLD_409FM: -- cgit v1.2.2 From 1eaad5b113811db7fdb6d02e1c8d9ff7c8ba6919 Mon Sep 17 00:00:00 2001 From: "Nickolay V. Shmyrev" Date: Tue, 8 Nov 2005 21:37:01 -0800 Subject: [PATCH] v4l: 708: full mute of saa7134 on mute command - Full mute of saa7134 on mute command. Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/saa7134/saa7134-tvaudio.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/saa7134/saa7134-tvaudio.c b/drivers/media/video/saa7134/saa7134-tvaudio.c index 61a2d6b50eef..fdca6c563b96 100644 --- a/drivers/media/video/saa7134/saa7134-tvaudio.c +++ b/drivers/media/video/saa7134/saa7134-tvaudio.c @@ -207,6 +207,10 @@ static void tvaudio_setcarrier(struct saa7134_dev *dev, saa_writel(SAA7134_CARRIER2_FREQ0 >> 2, tvaudio_carr2reg(secondary)); } +#define SAA7134_MUTE_MASK 0xbb +#define SAA7134_MUTE_ANALOG 0x04 +#define SAA7134_MUTE_I2S 0x40 + static void mute_input_7134(struct saa7134_dev *dev) { unsigned int mute; @@ -241,7 +245,11 @@ static void mute_input_7134(struct saa7134_dev *dev) if (PCI_DEVICE_ID_PHILIPS_SAA7134 == dev->pci->device) /* 7134 mute */ - saa_writeb(SAA7134_AUDIO_MUTE_CTRL, mute ? 0xbf : 0xbb); + saa_writeb(SAA7134_AUDIO_MUTE_CTRL, mute ? + SAA7134_MUTE_MASK | + SAA7134_MUTE_ANALOG | + SAA7134_MUTE_I2S : + SAA7134_MUTE_MASK); /* switch internal audio mux */ switch (in->amux) { -- cgit v1.2.2 From f718e6e7a2c402195f3d2944605ef4b01e8e3347 Mon Sep 17 00:00:00 2001 From: Kenth Andersson Date: Tue, 8 Nov 2005 21:37:02 -0800 Subject: [PATCH] v4l: 709: added osprey 440 card - Added Osprey 440 card. Signed-off-by: Kenth Andersson Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/bttv-cards.c | 19 ++++++++++++++++++- drivers/media/video/bttv.h | 1 + 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bttv-cards.c index adccbbf63dc0..85f19426892b 100644 --- a/drivers/media/video/bttv-cards.c +++ b/drivers/media/video/bttv-cards.c @@ -153,6 +153,7 @@ static struct CARD { { 0xff020070, BTTV_BOARD_OSPREY500, "Osprey-500" }, { 0xff030070, BTTV_BOARD_OSPREY2000, "Osprey-2000" }, { 0xff040070, BTTV_BOARD_OSPREY540, "Osprey-540" }, + { 0xff070070, BTTV_BOARD_OSPREY440, "Osprey-440" }, { 0x00011002, BTTV_BOARD_ATI_TVWONDER, "ATI TV Wonder" }, { 0x00031002, BTTV_BOARD_ATI_TVWONDERVE,"ATI TV Wonder/VE" }, @@ -2763,7 +2764,23 @@ struct tvcard bttv_tvcards[] = { .radio_addr = ADDR_UNSET, .has_radio = 1, .has_remote = 1, - } + }, + /* ---- card 0x8c ---------------------------------- */ + [BTTV_BOARD_OSPREY440] = { + .name = "Osprey 440", + .video_inputs = 1, + .audio_inputs = 1, + .tuner = -1, + .svhs = 1, + .muxsel = { 2 }, + .pll = PLL_28, + .tuner_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .no_msp34xx = 1, + .no_tda9875 = 1, + .no_tda7432 = 1, + }, }; static const unsigned int bttv_num_tvcards = ARRAY_SIZE(bttv_tvcards); diff --git a/drivers/media/video/bttv.h b/drivers/media/video/bttv.h index a4194e1ea905..75d08a33b107 100644 --- a/drivers/media/video/bttv.h +++ b/drivers/media/video/bttv.h @@ -160,6 +160,7 @@ #define BTTV_BOARD_CONCEPTRONIC_CTVFMI2 0x89 #define BTTV_BOARD_PV_BT878P_2E 0x8a #define BTTV_BOARD_PV_M4900 0x8b +#define BTTV_BOARD_OSPREY440 0x8c /* i2c address list */ #define I2C_TSA5522 0xc2 -- cgit v1.2.2 From cf583ac40d06825bc850dc4f47627d7661aaa4f8 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 8 Nov 2005 21:37:03 -0800 Subject: [PATCH] v4l: 711: changed pll 1 to pll pll 28 - Changed { .pll = 1, } to { .pll = PLL_28, } Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/video4linux/CARDLIST.bttv | 1 + Documentation/video4linux/CARDLIST.cx88 | 1 + drivers/media/video/bttv-cards.c | 4 +- drivers/media/video/bttv.h | 280 ++++++++++++++++---------------- 4 files changed, 144 insertions(+), 142 deletions(-) diff --git a/Documentation/video4linux/CARDLIST.bttv b/Documentation/video4linux/CARDLIST.bttv index 1fde0d70da1d..ba98ff4a79af 100644 --- a/Documentation/video4linux/CARDLIST.bttv +++ b/Documentation/video4linux/CARDLIST.bttv @@ -138,3 +138,4 @@ 137 -> Conceptronic CTVFMi v2 138 -> Prolink Pixelview PV-BT878P+ (Rev.2E) 139 -> Prolink PixelView PlayTV MPEG2 PV-M4900 +140 -> Osprey 440 [0070:ff07] diff --git a/Documentation/video4linux/CARDLIST.cx88 b/Documentation/video4linux/CARDLIST.cx88 index f0b3b49a4fdf..8a14e3f44ca2 100644 --- a/Documentation/video4linux/CARDLIST.cx88 +++ b/Documentation/video4linux/CARDLIST.cx88 @@ -31,3 +31,4 @@ 30 -> TerraTec Cinergy 1400 DVB-T [153b:1166] 31 -> DViCO FusionHDTV 5 Gold [18ac:d500] 32 -> AverMedia UltraTV Media Center PCI 550 [1461:8011] + 33 -> Kworld V-Stream Xpert DVD diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bttv-cards.c index 85f19426892b..1f33764bf050 100644 --- a/drivers/media/video/bttv-cards.c +++ b/drivers/media/video/bttv-cards.c @@ -1982,7 +1982,7 @@ struct tvcard bttv_tvcards[] = { .tuner_type = 5, .tuner_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET, - .pll = 1, + .pll = PLL_28, }, [BTTV_BOARD_EURESYS_PICOLO] = { .name = "Euresys Picolo", @@ -2765,7 +2765,7 @@ struct tvcard bttv_tvcards[] = { .has_radio = 1, .has_remote = 1, }, - /* ---- card 0x8c ---------------------------------- */ + /* ---- card 0x8c ---------------------------------- */ [BTTV_BOARD_OSPREY440] = { .name = "Osprey 440", .video_inputs = 1, diff --git a/drivers/media/video/bttv.h b/drivers/media/video/bttv.h index 75d08a33b107..ffece3b91360 100644 --- a/drivers/media/video/bttv.h +++ b/drivers/media/video/bttv.h @@ -20,147 +20,147 @@ /* ---------------------------------------------------------- */ /* exported by bttv-cards.c */ -#define BTTV_BOARD_UNKNOWN 0x00 -#define BTTV_BOARD_MIRO 0x01 -#define BTTV_BOARD_HAUPPAUGE 0x02 -#define BTTV_BOARD_STB 0x03 -#define BTTV_BOARD_INTEL 0x04 -#define BTTV_BOARD_DIAMOND 0x05 -#define BTTV_BOARD_AVERMEDIA 0x06 -#define BTTV_BOARD_MATRIX_VISION 0x07 -#define BTTV_BOARD_FLYVIDEO 0x08 -#define BTTV_BOARD_TURBOTV 0x09 -#define BTTV_BOARD_HAUPPAUGE878 0x0a -#define BTTV_BOARD_MIROPRO 0x0b -#define BTTV_BOARD_ADSTECH_TV 0x0c -#define BTTV_BOARD_AVERMEDIA98 0x0d -#define BTTV_BOARD_VHX 0x0e -#define BTTV_BOARD_ZOLTRIX 0x0f -#define BTTV_BOARD_PIXVIEWPLAYTV 0x10 -#define BTTV_BOARD_WINVIEW_601 0x11 -#define BTTV_BOARD_AVEC_INTERCAP 0x12 -#define BTTV_BOARD_LIFE_FLYKIT 0x13 -#define BTTV_BOARD_CEI_RAFFLES 0x14 -#define BTTV_BOARD_CONFERENCETV 0x15 -#define BTTV_BOARD_PHOEBE_TVMAS 0x16 -#define BTTV_BOARD_MODTEC_205 0x17 -#define BTTV_BOARD_MAGICTVIEW061 0x18 -#define BTTV_BOARD_VOBIS_BOOSTAR 0x19 -#define BTTV_BOARD_HAUPPAUG_WCAM 0x1a -#define BTTV_BOARD_MAXI 0x1b -#define BTTV_BOARD_TERRATV 0x1c -#define BTTV_BOARD_PXC200 0x1d -#define BTTV_BOARD_FLYVIDEO_98 0x1e -#define BTTV_BOARD_IPROTV 0x1f -#define BTTV_BOARD_INTEL_C_S_PCI 0x20 -#define BTTV_BOARD_TERRATVALUE 0x21 -#define BTTV_BOARD_WINFAST2000 0x22 -#define BTTV_BOARD_CHRONOS_VS2 0x23 -#define BTTV_BOARD_TYPHOON_TVIEW 0x24 -#define BTTV_BOARD_PXELVWPLTVPRO 0x25 -#define BTTV_BOARD_MAGICTVIEW063 0x26 -#define BTTV_BOARD_PINNACLE 0x27 -#define BTTV_BOARD_STB2 0x28 -#define BTTV_BOARD_AVPHONE98 0x29 -#define BTTV_BOARD_PV951 0x2a -#define BTTV_BOARD_ONAIR_TV 0x2b -#define BTTV_BOARD_SIGMA_TVII_FM 0x2c -#define BTTV_BOARD_MATRIX_VISION2 0x2d -#define BTTV_BOARD_ZOLTRIX_GENIE 0x2e -#define BTTV_BOARD_TERRATVRADIO 0x2f -#define BTTV_BOARD_DYNALINK 0x30 -#define BTTV_BOARD_GVBCTV3PCI 0x31 -#define BTTV_BOARD_PXELVWPLTVPAK 0x32 -#define BTTV_BOARD_EAGLE 0x33 -#define BTTV_BOARD_PINNACLEPRO 0x34 -#define BTTV_BOARD_TVIEW_RDS_FM 0x35 -#define BTTV_BOARD_LIFETEC_9415 0x36 -#define BTTV_BOARD_BESTBUY_EASYTV 0x37 -#define BTTV_BOARD_FLYVIDEO_98FM 0x38 -#define BTTV_BOARD_GRANDTEC 0x39 -#define BTTV_BOARD_ASKEY_CPH060 0x3a -#define BTTV_BOARD_ASKEY_CPH03X 0x3b -#define BTTV_BOARD_MM100PCTV 0x3c -#define BTTV_BOARD_GMV1 0x3d -#define BTTV_BOARD_BESTBUY_EASYTV2 0x3e -#define BTTV_BOARD_ATI_TVWONDER 0x3f -#define BTTV_BOARD_ATI_TVWONDERVE 0x40 -#define BTTV_BOARD_FLYVIDEO2000 0x41 -#define BTTV_BOARD_TERRATVALUER 0x42 -#define BTTV_BOARD_GVBCTV4PCI 0x43 -#define BTTV_BOARD_VOODOOTV_FM 0x44 -#define BTTV_BOARD_AIMMS 0x45 -#define BTTV_BOARD_PV_BT878P_PLUS 0x46 -#define BTTV_BOARD_FLYVIDEO98EZ 0x47 -#define BTTV_BOARD_PV_BT878P_9B 0x48 -#define BTTV_BOARD_SENSORAY311 0x49 -#define BTTV_BOARD_RV605 0x4a -#define BTTV_BOARD_POWERCLR_MTV878 0x4b -#define BTTV_BOARD_WINDVR 0x4c -#define BTTV_BOARD_GRANDTEC_MULTI 0x4d -#define BTTV_BOARD_KWORLD 0x4e -#define BTTV_BOARD_DSP_TCVIDEO 0x4f -#define BTTV_BOARD_HAUPPAUGEPVR 0x50 -#define BTTV_BOARD_GVBCTV5PCI 0x51 -#define BTTV_BOARD_OSPREY1x0 0x52 -#define BTTV_BOARD_OSPREY1x0_848 0x53 -#define BTTV_BOARD_OSPREY101_848 0x54 -#define BTTV_BOARD_OSPREY1x1 0x55 -#define BTTV_BOARD_OSPREY1x1_SVID 0x56 -#define BTTV_BOARD_OSPREY2xx 0x57 -#define BTTV_BOARD_OSPREY2x0_SVID 0x58 -#define BTTV_BOARD_OSPREY2x0 0x59 -#define BTTV_BOARD_OSPREY500 0x5a -#define BTTV_BOARD_OSPREY540 0x5b -#define BTTV_BOARD_OSPREY2000 0x5c -#define BTTV_BOARD_IDS_EAGLE 0x5d -#define BTTV_BOARD_PINNACLESAT 0x5e -#define BTTV_BOARD_FORMAC_PROTV 0x5f -#define BTTV_BOARD_MACHTV 0x60 -#define BTTV_BOARD_EURESYS_PICOLO 0x61 -#define BTTV_BOARD_PV150 0x62 -#define BTTV_BOARD_AD_TVK503 0x63 -#define BTTV_BOARD_HERCULES_SM_TV 0x64 -#define BTTV_BOARD_PACETV 0x65 -#define BTTV_BOARD_IVC200 0x66 -#define BTTV_BOARD_XGUARD 0x67 -#define BTTV_BOARD_NEBULA_DIGITV 0x68 -#define BTTV_BOARD_PV143 0x69 -#define BTTV_BOARD_VD009X1_MINIDIN 0x6a -#define BTTV_BOARD_VD009X1_COMBI 0x6b -#define BTTV_BOARD_VD009_MINIDIN 0x6c -#define BTTV_BOARD_VD009_COMBI 0x6d -#define BTTV_BOARD_IVC100 0x6e -#define BTTV_BOARD_IVC120 0x6f -#define BTTV_BOARD_PC_HDTV 0x70 -#define BTTV_BOARD_TWINHAN_DST 0x71 -#define BTTV_BOARD_WINFASTVC100 0x72 -#define BTTV_BOARD_TEV560 0x73 -#define BTTV_BOARD_SIMUS_GVC1100 0x74 -#define BTTV_BOARD_NGSTV_PLUS 0x75 -#define BTTV_BOARD_LMLBT4 0x76 -#define BTTV_BOARD_TEKRAM_M205 0x77 -#define BTTV_BOARD_CONTVFMI 0x78 -#define BTTV_BOARD_PICOLO_TETRA_CHIP 0x79 -#define BTTV_BOARD_SPIRIT_TV 0x7a -#define BTTV_BOARD_AVDVBT_771 0x7b -#define BTTV_BOARD_AVDVBT_761 0x7c -#define BTTV_BOARD_MATRIX_VISIONSQ 0x7d -#define BTTV_BOARD_MATRIX_VISIONSLC 0x7e -#define BTTV_BOARD_APAC_VIEWCOMP 0x7f -#define BTTV_BOARD_DVICO_DVBT_LITE 0x80 -#define BTTV_BOARD_VGEAR_MYVCD 0x81 -#define BTTV_BOARD_SUPER_TV 0x82 -#define BTTV_BOARD_TIBET_CS16 0x83 -#define BTTV_BOARD_KODICOM_4400R 0x84 -#define BTTV_BOARD_KODICOM_4400R_SL 0x85 -#define BTTV_BOARD_ADLINK_RTV24 0x86 +#define BTTV_BOARD_UNKNOWN 0x00 +#define BTTV_BOARD_MIRO 0x01 +#define BTTV_BOARD_HAUPPAUGE 0x02 +#define BTTV_BOARD_STB 0x03 +#define BTTV_BOARD_INTEL 0x04 +#define BTTV_BOARD_DIAMOND 0x05 +#define BTTV_BOARD_AVERMEDIA 0x06 +#define BTTV_BOARD_MATRIX_VISION 0x07 +#define BTTV_BOARD_FLYVIDEO 0x08 +#define BTTV_BOARD_TURBOTV 0x09 +#define BTTV_BOARD_HAUPPAUGE878 0x0a +#define BTTV_BOARD_MIROPRO 0x0b +#define BTTV_BOARD_ADSTECH_TV 0x0c +#define BTTV_BOARD_AVERMEDIA98 0x0d +#define BTTV_BOARD_VHX 0x0e +#define BTTV_BOARD_ZOLTRIX 0x0f +#define BTTV_BOARD_PIXVIEWPLAYTV 0x10 +#define BTTV_BOARD_WINVIEW_601 0x11 +#define BTTV_BOARD_AVEC_INTERCAP 0x12 +#define BTTV_BOARD_LIFE_FLYKIT 0x13 +#define BTTV_BOARD_CEI_RAFFLES 0x14 +#define BTTV_BOARD_CONFERENCETV 0x15 +#define BTTV_BOARD_PHOEBE_TVMAS 0x16 +#define BTTV_BOARD_MODTEC_205 0x17 +#define BTTV_BOARD_MAGICTVIEW061 0x18 +#define BTTV_BOARD_VOBIS_BOOSTAR 0x19 +#define BTTV_BOARD_HAUPPAUG_WCAM 0x1a +#define BTTV_BOARD_MAXI 0x1b +#define BTTV_BOARD_TERRATV 0x1c +#define BTTV_BOARD_PXC200 0x1d +#define BTTV_BOARD_FLYVIDEO_98 0x1e +#define BTTV_BOARD_IPROTV 0x1f +#define BTTV_BOARD_INTEL_C_S_PCI 0x20 +#define BTTV_BOARD_TERRATVALUE 0x21 +#define BTTV_BOARD_WINFAST2000 0x22 +#define BTTV_BOARD_CHRONOS_VS2 0x23 +#define BTTV_BOARD_TYPHOON_TVIEW 0x24 +#define BTTV_BOARD_PXELVWPLTVPRO 0x25 +#define BTTV_BOARD_MAGICTVIEW063 0x26 +#define BTTV_BOARD_PINNACLE 0x27 +#define BTTV_BOARD_STB2 0x28 +#define BTTV_BOARD_AVPHONE98 0x29 +#define BTTV_BOARD_PV951 0x2a +#define BTTV_BOARD_ONAIR_TV 0x2b +#define BTTV_BOARD_SIGMA_TVII_FM 0x2c +#define BTTV_BOARD_MATRIX_VISION2 0x2d +#define BTTV_BOARD_ZOLTRIX_GENIE 0x2e +#define BTTV_BOARD_TERRATVRADIO 0x2f +#define BTTV_BOARD_DYNALINK 0x30 +#define BTTV_BOARD_GVBCTV3PCI 0x31 +#define BTTV_BOARD_PXELVWPLTVPAK 0x32 +#define BTTV_BOARD_EAGLE 0x33 +#define BTTV_BOARD_PINNACLEPRO 0x34 +#define BTTV_BOARD_TVIEW_RDS_FM 0x35 +#define BTTV_BOARD_LIFETEC_9415 0x36 +#define BTTV_BOARD_BESTBUY_EASYTV 0x37 +#define BTTV_BOARD_FLYVIDEO_98FM 0x38 +#define BTTV_BOARD_GRANDTEC 0x39 +#define BTTV_BOARD_ASKEY_CPH060 0x3a +#define BTTV_BOARD_ASKEY_CPH03X 0x3b +#define BTTV_BOARD_MM100PCTV 0x3c +#define BTTV_BOARD_GMV1 0x3d +#define BTTV_BOARD_BESTBUY_EASYTV2 0x3e +#define BTTV_BOARD_ATI_TVWONDER 0x3f +#define BTTV_BOARD_ATI_TVWONDERVE 0x40 +#define BTTV_BOARD_FLYVIDEO2000 0x41 +#define BTTV_BOARD_TERRATVALUER 0x42 +#define BTTV_BOARD_GVBCTV4PCI 0x43 +#define BTTV_BOARD_VOODOOTV_FM 0x44 +#define BTTV_BOARD_AIMMS 0x45 +#define BTTV_BOARD_PV_BT878P_PLUS 0x46 +#define BTTV_BOARD_FLYVIDEO98EZ 0x47 +#define BTTV_BOARD_PV_BT878P_9B 0x48 +#define BTTV_BOARD_SENSORAY311 0x49 +#define BTTV_BOARD_RV605 0x4a +#define BTTV_BOARD_POWERCLR_MTV878 0x4b +#define BTTV_BOARD_WINDVR 0x4c +#define BTTV_BOARD_GRANDTEC_MULTI 0x4d +#define BTTV_BOARD_KWORLD 0x4e +#define BTTV_BOARD_DSP_TCVIDEO 0x4f +#define BTTV_BOARD_HAUPPAUGEPVR 0x50 +#define BTTV_BOARD_GVBCTV5PCI 0x51 +#define BTTV_BOARD_OSPREY1x0 0x52 +#define BTTV_BOARD_OSPREY1x0_848 0x53 +#define BTTV_BOARD_OSPREY101_848 0x54 +#define BTTV_BOARD_OSPREY1x1 0x55 +#define BTTV_BOARD_OSPREY1x1_SVID 0x56 +#define BTTV_BOARD_OSPREY2xx 0x57 +#define BTTV_BOARD_OSPREY2x0_SVID 0x58 +#define BTTV_BOARD_OSPREY2x0 0x59 +#define BTTV_BOARD_OSPREY500 0x5a +#define BTTV_BOARD_OSPREY540 0x5b +#define BTTV_BOARD_OSPREY2000 0x5c +#define BTTV_BOARD_IDS_EAGLE 0x5d +#define BTTV_BOARD_PINNACLESAT 0x5e +#define BTTV_BOARD_FORMAC_PROTV 0x5f +#define BTTV_BOARD_MACHTV 0x60 +#define BTTV_BOARD_EURESYS_PICOLO 0x61 +#define BTTV_BOARD_PV150 0x62 +#define BTTV_BOARD_AD_TVK503 0x63 +#define BTTV_BOARD_HERCULES_SM_TV 0x64 +#define BTTV_BOARD_PACETV 0x65 +#define BTTV_BOARD_IVC200 0x66 +#define BTTV_BOARD_XGUARD 0x67 +#define BTTV_BOARD_NEBULA_DIGITV 0x68 +#define BTTV_BOARD_PV143 0x69 +#define BTTV_BOARD_VD009X1_MINIDIN 0x6a +#define BTTV_BOARD_VD009X1_COMBI 0x6b +#define BTTV_BOARD_VD009_MINIDIN 0x6c +#define BTTV_BOARD_VD009_COMBI 0x6d +#define BTTV_BOARD_IVC100 0x6e +#define BTTV_BOARD_IVC120 0x6f +#define BTTV_BOARD_PC_HDTV 0x70 +#define BTTV_BOARD_TWINHAN_DST 0x71 +#define BTTV_BOARD_WINFASTVC100 0x72 +#define BTTV_BOARD_TEV560 0x73 +#define BTTV_BOARD_SIMUS_GVC1100 0x74 +#define BTTV_BOARD_NGSTV_PLUS 0x75 +#define BTTV_BOARD_LMLBT4 0x76 +#define BTTV_BOARD_TEKRAM_M205 0x77 +#define BTTV_BOARD_CONTVFMI 0x78 +#define BTTV_BOARD_PICOLO_TETRA_CHIP 0x79 +#define BTTV_BOARD_SPIRIT_TV 0x7a +#define BTTV_BOARD_AVDVBT_771 0x7b +#define BTTV_BOARD_AVDVBT_761 0x7c +#define BTTV_BOARD_MATRIX_VISIONSQ 0x7d +#define BTTV_BOARD_MATRIX_VISIONSLC 0x7e +#define BTTV_BOARD_APAC_VIEWCOMP 0x7f +#define BTTV_BOARD_DVICO_DVBT_LITE 0x80 +#define BTTV_BOARD_VGEAR_MYVCD 0x81 +#define BTTV_BOARD_SUPER_TV 0x82 +#define BTTV_BOARD_TIBET_CS16 0x83 +#define BTTV_BOARD_KODICOM_4400R 0x84 +#define BTTV_BOARD_KODICOM_4400R_SL 0x85 +#define BTTV_BOARD_ADLINK_RTV24 0x86 #define BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE 0x87 -#define BTTV_BOARD_ACORP_Y878F 0x88 -#define BTTV_BOARD_CONCEPTRONIC_CTVFMI2 0x89 -#define BTTV_BOARD_PV_BT878P_2E 0x8a -#define BTTV_BOARD_PV_M4900 0x8b -#define BTTV_BOARD_OSPREY440 0x8c +#define BTTV_BOARD_ACORP_Y878F 0x88 +#define BTTV_BOARD_CONCEPTRONIC_CTVFMI2 0x89 +#define BTTV_BOARD_PV_BT878P_2E 0x8a +#define BTTV_BOARD_PV_M4900 0x8b +#define BTTV_BOARD_OSPREY440 0x8c /* i2c address list */ #define I2C_TSA5522 0xc2 -- cgit v1.2.2 From e976f93725ce16b4a493d40a6dd3bccbd74b9a8a Mon Sep 17 00:00:00 2001 From: Kirk Lapray Date: Tue, 8 Nov 2005 21:37:04 -0800 Subject: [PATCH] v4l: 712: added analog support for ati hdtv wonder - Added analog support for ATI HDTV Wonder Signed-off-by: Kirk Lapray Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/video4linux/CARDLIST.cx88 | 1 + Documentation/video4linux/CARDLIST.tuner | 1 + drivers/media/video/cx88/cx88-cards.c | 49 ++++++++++++++++++++++++++++++++ drivers/media/video/cx88/cx88.h | 1 + drivers/media/video/tuner-simple.c | 15 +++++++++- include/media/tuner.h | 2 ++ 6 files changed, 68 insertions(+), 1 deletion(-) diff --git a/Documentation/video4linux/CARDLIST.cx88 b/Documentation/video4linux/CARDLIST.cx88 index 8a14e3f44ca2..ca46fbf489d5 100644 --- a/Documentation/video4linux/CARDLIST.cx88 +++ b/Documentation/video4linux/CARDLIST.cx88 @@ -32,3 +32,4 @@ 31 -> DViCO FusionHDTV 5 Gold [18ac:d500] 32 -> AverMedia UltraTV Media Center PCI 550 [1461:8011] 33 -> Kworld V-Stream Xpert DVD + 34 -> ATI HDTV Wonder [1002:a101] diff --git a/Documentation/video4linux/CARDLIST.tuner b/Documentation/video4linux/CARDLIST.tuner index 0e2ea497ad7f..ec840ca6f455 100644 --- a/Documentation/video4linux/CARDLIST.tuner +++ b/Documentation/video4linux/CARDLIST.tuner @@ -66,3 +66,4 @@ tuner=64 - LG TDVS-H062F/TUA6034 tuner=65 - Ymec TVF66T5-B/DFF tuner=66 - LG NTSC (TALN mini series) tuner=67 - Philips TD1316 Hybrid Tuner +tuner=68 - Philips TUV1236D ATSC/NTSC dual in diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c index 888d25d48416..388440789dfb 100644 --- a/drivers/media/video/cx88/cx88-cards.c +++ b/drivers/media/video/cx88/cx88-cards.c @@ -823,6 +823,35 @@ struct cx88_board cx88_boards[] = { .gpio3 = 0x00100000, }}, }, + [CX88_BOARD_ATI_HDTVWONDER] = { + .name = "ATI HDTV Wonder", + .tuner_type = TUNER_PHILIPS_TUV1236D, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .input = {{ + .type = CX88_VMUX_TELEVISION, + .vmux = 0, + .gpio0 = 0x00000ff7, + .gpio1 = 0x000000ff, + .gpio2 = 0x00000001, + .gpio3 = 0x00000000, + },{ + .type = CX88_VMUX_COMPOSITE1, + .vmux = 1, + .gpio0 = 0x00000ffe, + .gpio1 = 0x000000ff, + .gpio2 = 0x00000001, + .gpio3 = 0x00000000, + },{ + .type = CX88_VMUX_SVIDEO, + .vmux = 2, + .gpio0 = 0x00000ffe, + .gpio1 = 0x000000ff, + .gpio2 = 0x00000001, + .gpio3 = 0x00000000, + }}, + }, }; const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards); @@ -958,6 +987,10 @@ struct cx88_subid cx88_subids[] = { .subvendor = 0x1461, .subdevice = 0x8011, .card = CX88_BOARD_AVERMEDIA_ULTRATV_MC_550, + },{ + .subvendor = PCI_VENDOR_ID_ATI, + .subdevice = 0xa101, + .card = CX88_BOARD_ATI_HDTVWONDER, }, }; const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids); @@ -1159,6 +1192,22 @@ void cx88_card_setup(struct cx88_core *core) cx_clear(MO_GP0_IO, 0x00000007); cx_set(MO_GP2_IO, 0x00000101); break; + case CX88_BOARD_ATI_HDTVWONDER: + if (0 == core->i2c_rc) { + /* enable tuner */ + int i; + u8 buffer[12]; + core->i2c_client.addr = 0x0a; + buffer[0] = 0x10; buffer[1] = 0x12; buffer[2] = 0x13; buffer[3] = 0x04; + buffer[4] = 0x16; buffer[5] = 0x00; buffer[6] = 0x14; buffer[7] = 0x04; + buffer[8] = 0x14; buffer[9] = 0x00; buffer[10] = 0x17; buffer[11] = 0x00; + + for (i = 0; i < 6; i++) + if (2 != i2c_master_send(&core->i2c_client,&buffer[i*2],2)) + printk(KERN_WARNING "%s: Unable to enable tuner(%i).\n", + core->name, i); + } + break; } if (cx88_boards[core->board].radio.type == CX88_RADIO) core->has_radio = 1; diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h index 9b629221e799..cc2197a85d01 100644 --- a/drivers/media/video/cx88/cx88.h +++ b/drivers/media/video/cx88/cx88.h @@ -176,6 +176,7 @@ extern struct sram_channel cx88_sram_channels[]; #define CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD 31 #define CX88_BOARD_AVERMEDIA_ULTRATV_MC_550 32 #define CX88_BOARD_KWORLD_VSTREAM_EXPERT_DVD 33 +#define CX88_BOARD_ATI_HDTVWONDER 34 enum cx88_itype { CX88_VMUX_COMPOSITE1 = 1, diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c index b75ad2d4488a..e67d9e77c755 100644 --- a/drivers/media/video/tuner-simple.c +++ b/drivers/media/video/tuner-simple.c @@ -233,7 +233,7 @@ static struct tunertype tuners[] = { { "Ymec TVision TVF-5533MF", Philips, NTSC, 16*160.00,16*454.00,0x01,0x02,0x04,0x8e,732}, - /* 60-67 */ + /* 60-68 */ { "Thomson DDT 7611 (ATSC/NTSC)", THOMSON, ATSC, 16*157.25,16*454.00,0x39,0x3a,0x3c,0x8e,732}, { "Tena TNF9533-D/IF/TNF9533-B/DF", Philips, PAL, @@ -250,6 +250,8 @@ static struct tunertype tuners[] = { 16*137.25,16*373.25,0x01,0x02,0x08,0x8e,732 }, { "Philips TD1316 Hybrid Tuner", Philips, PAL, 16*160.00,16*442.00,0xa1,0xa2,0xa4,0xc8,623 }, + { "Philips TUV1236D ATSC/NTSC dual in", Philips, ATSC, + 16*157.25,16*454.00,0x01,0x02,0x03,0xce,732 }, }; unsigned const int tuner_count = ARRAY_SIZE(tuners); @@ -375,6 +377,17 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq) /* Set the charge pump for fast tuning */ tun->config |= TUNER_CHARGE_PUMP; break; + + case TUNER_PHILIPS_TUV1236D: + /* 0x40 -> ATSC antenna input 1 */ + /* 0x48 -> ATSC antenna input 2 */ + /* 0x00 -> NTSC antenna input 1 */ + /* 0x08 -> NTSC antenna input 2 */ + config &= ~0x40; + if (t->std & V4L2_STD_ATSC) + config |= 0x40; + /* FIXME: input */ + break; } /* diff --git a/include/media/tuner.h b/include/media/tuner.h index 97e16bddf651..7cc74b1bb6ea 100644 --- a/include/media/tuner.h +++ b/include/media/tuner.h @@ -112,6 +112,8 @@ #define TUNER_LG_NTSC_TALN_MINI 66 #define TUNER_PHILIPS_TD1316 67 +#define TUNER_PHILIPS_TUV1236D 68 /* ATI HDTV Wonder */ + #define NOTUNER 0 #define PAL 1 /* PAL_BG */ #define PAL_I 2 -- cgit v1.2.2 From 5f7591c04f3797694e331a31d00317ae4acb9af0 Mon Sep 17 00:00:00 2001 From: "Nickolay V. Shmyrev" Date: Tue, 8 Nov 2005 21:37:04 -0800 Subject: [PATCH] v4l: 713: add alsa support to saa7134 driver Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/saa7134/saa7134-alsa.c | 543 +++++++++++++++++++++++++++++ drivers/media/video/tda9887.c | 5 +- 2 files changed, 546 insertions(+), 2 deletions(-) create mode 100644 drivers/media/video/saa7134/saa7134-alsa.c diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c new file mode 100644 index 000000000000..d09e01f7fc3b --- /dev/null +++ b/drivers/media/video/saa7134/saa7134-alsa.c @@ -0,0 +1,543 @@ +/* + * + * Support for audio capture + * PCI function #1 of the saa7134 + * + * (c) 2005 Mauro Carvalho Chehab + * (c) 2004 Gerd Knorr + * (c) 2003 Clemens Ladisch + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "saa7134.h" +#include "saa7134-reg.h" + +#define dprintk(level,fmt, arg...) if (debug >= level) \ + printk(KERN_DEBUG "%s/1: " fmt, chip->core->name , ## arg) + + +/**************************************************************************** + Data type declarations - Can be moded to a header file later + ****************************************************************************/ + +#define ANALOG_CLOCK 1792000 +#define CLOCK_DIV_MIN 4 +#define CLOCK_DIV_MAX 15 +#define MAX_PCM_DEVICES 4 +#define MAX_PCM_SUBSTREAMS 16 + +enum { DEVICE_DIGITAL, DEVICE_ANALOG }; + +/* These can be replaced after done */ +#define MIXER_ADDR_LAST MAX_saa7134_INPUT + +struct saa7134_audio_dev { + struct saa7134_core *core; + struct saa7134_buffer *buf; + struct saa7134_dmaqueue q; + + /* pci i/o */ + struct pci_dev *pci; + unsigned char pci_rev,pci_lat; + + /* audio controls */ + int irq; + int dig_rate; /* Digital sampling rate */ + + snd_card_t *card; + + spinlock_t reg_lock; + + unsigned int dma_size; + unsigned int period_size; + + int mixer_volume[MIXER_ADDR_LAST+1][2]; + int capture_source[MIXER_ADDR_LAST+1][2]; + + long opened; + snd_pcm_substream_t *substream; +}; +typedef struct saa7134_audio_dev snd_saa7134_card_t; + +/**************************************************************************** + Module global static vars + ****************************************************************************/ + +static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ +static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ +static int enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 1}; + +module_param_array(enable, bool, NULL, 0444); +MODULE_PARM_DESC(enable, "Enable saa7134x soundcard. default enabled."); + +/**************************************************************************** + Module macros + ****************************************************************************/ + +MODULE_DESCRIPTION("ALSA driver module for saa7134 based TV cards"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); +MODULE_LICENSE("GPL"); +MODULE_SUPPORTED_DEVICE("{{Philips, saa7131E}," + "{{Philips, saa7134}," + "{{Philips, saa7133}"); +static unsigned int debug = 0; +module_param(debug,int,0644); +MODULE_PARM_DESC(debug,"enable debug messages"); + +/**************************************************************************** + Module specific funtions + ****************************************************************************/ + +/* + * BOARD Specific: Sets audio DMA + */ + +int saa7134_start_audio_dma(snd_saa7134_card_t *chip) +{ + struct saa7134_core *core = chip->core; + + return 0; +} + +/* + * BOARD Specific: Resets audio DMA + */ +int saa7134_stop_audio_dma(snd_saa7134_card_t *chip) +{ + struct saa7134_core *core=chip->core; + return 0; +} + +#define MAX_IRQ_LOOP 10 + +static void saa713401_timeout(unsigned long data) +{ + snd_saa7134_card_t *chip = (snd_saa7134_card_t *)data; +} + +/* FIXME: Wrong values*/ +static char *saa7134_aud_irqs[32] = { + "y_risci1", "u_risci1", "v_risci1", "vbi_risc1", + "y_risci2", "u_risci2", "v_risci2", "vbi_risc2", + "y_oflow", "u_oflow", "v_oflow", "vbi_oflow", + "y_sync", "u_sync", "v_sync", "vbi_sync", + "opc_err", "par_err", "rip_err", "pci_abort", +}; + + +static void saa713401_aud_irq(snd_saa7134_card_t *chip) +{ + struct saa7134_core *core = chip->core; +} + +static irqreturn_t saa7134_irq(int irq, void *dev_id, struct pt_regs *regs) +{ + snd_saa7134_card_t *chip = dev_id; + struct saa7134_core *core = chip->core; +} + +/**************************************************************************** + ALSA PCM Interface + ****************************************************************************/ + +/* + * Digital hardware definition + */ +static snd_pcm_hardware_t snd_saa7134_digital_hw = { + .info = SNDRV_PCM_INFO_MMAP | + SNDRV_PCM_INFO_INTERLEAVED | + SNDRV_PCM_INFO_BLOCK_TRANSFER | + SNDRV_PCM_INFO_MMAP_VALID, + .formats = SNDRV_PCM_FMTBIT_S16_LE, + .rates = 0, /* set at runtime */ + .channels_min = 2, + .channels_max = 2, + .buffer_bytes_max = 255 * 4092, + .period_bytes_min = 32, + .period_bytes_max = 4092, + .periods_min = 2, + .periods_max = 255, +}; + +/* + * Sets board to provide digital audio + */ +static int snd_saa7134_set_digital_hw(snd_saa7134_card_t *chip, snd_pcm_runtime_t *runtime) +{ + return 0; +} + +/* + * audio open callback + */ +static int snd_saa7134_pcm_open(snd_pcm_substream_t *substream) +{ + snd_saa7134_card_t *chip = snd_pcm_substream_chip(substream); + snd_pcm_runtime_t *runtime = substream->runtime; + int err; + + if (test_and_set_bit(0, &chip->opened)) + return -EBUSY; + + err = snd_saa7134_set_digital_hw(chip, runtime); + + if (err < 0) + goto _error; + + err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS); + if (err < 0) + goto _error; + + chip->substream = substream; + return 0; + +_error: + clear_bit(0, &chip->opened); + smp_mb__after_clear_bit(); + return err; +} + +/* + * audio close callback + */ +static int snd_saa7134_close(snd_pcm_substream_t *substream) +{ + snd_saa7134_card_t *chip = snd_pcm_substream_chip(substream); + + chip->substream = NULL; + clear_bit(0, &chip->opened); + smp_mb__after_clear_bit(); + return 0; +} + +/* + * hw_params callback + */ +static int snd_saa7134_hw_params(snd_pcm_substream_t * substream, + snd_pcm_hw_params_t * hw_params) +{ + return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); +} + +/* + * hw free callback + */ +static int snd_saa7134_hw_free(snd_pcm_substream_t * substream) +{ + return snd_pcm_lib_free_pages(substream); +} + +/* + * prepare callback + */ +static int snd_saa7134_prepare(snd_pcm_substream_t *substream) +{ + snd_saa7134_card_t *chip = snd_pcm_substream_chip(substream); + return 0; +} + + +/* + * trigger callback + */ +static int snd_saa7134_card_trigger(snd_pcm_substream_t *substream, int cmd) +{ + snd_saa7134_card_t *chip = snd_pcm_substream_chip(substream); + + switch (cmd) { + case SNDRV_PCM_TRIGGER_START: + return snd_saa7134_start(chip); + case SNDRV_PCM_TRIGGER_STOP: + return snd_saa7134_stop(chip); + default: + return -EINVAL; + } +} + +/* + * pointer callback + */ +static snd_pcm_uframes_t snd_saa7134_pointer(snd_pcm_substream_t *substream) +{ +// snd_saa7134_card_t *chip = snd_pcm_substream_chip(substream); +// snd_pcm_runtime_t *runtime = substream->runtime; + +// return (snd_pcm_uframes_t)bytes_to_frames(runtime, chip->current_line * chip->line_bytes); +} + +/* + * operators + */ +static snd_pcm_ops_t snd_saa7134_pcm_ops = { + .open = snd_saa7134_pcm_open, + .close = snd_saa7134_close, + .ioctl = snd_pcm_lib_ioctl, + .hw_params = snd_saa7134_hw_params, + .hw_free = snd_saa7134_hw_free, + .prepare = snd_saa7134_prepare, + .trigger = snd_saa7134_card_trigger, + .pointer = snd_saa7134_pointer, + .page = snd_pcm_sgbuf_ops_page, +}; + +/* + * create a PCM device + */ +static int __devinit snd_saa7134_pcm(snd_saa7134_card_t *chip, int device, char *name) +{ + int err; + snd_pcm_t *pcm; + + err = snd_pcm_new(chip->card, name, device, 0, 1, &pcm); + if (err < 0) + return err; + pcm->private_data = chip; + strcpy(pcm->name, name); + snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_saa7134_pcm_ops); + return snd_pcm_lib_preallocate_pages_for_all(pcm, + SNDRV_DMA_TYPE_DEV_SG, + snd_dma_pci_data(chip->pci), + 128 * 1024, + (255 * 4092 + 1023) & ~1023); +} + +/**************************************************************************** + CONTROL INTERFACE + ****************************************************************************/ +static int snd_saa7134_capture_volume_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *info) +{ + info->type = SNDRV_CTL_ELEM_TYPE_INTEGER; + info->count = 1; + info->value.integer.min = 0; + info->value.integer.max = 0x3f; + + return 0; +} + +/* OK - TODO: test it */ +static int snd_saa7134_capture_volume_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *value) +{ + snd_saa7134_card_t *chip = snd_kcontrol_chip(kcontrol); + struct saa7134_core *core=chip->core; + + return 0; +} + +/* OK - TODO: test it */ +static int snd_saa7134_capture_volume_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *value) +{ + snd_saa7134_card_t *chip = snd_kcontrol_chip(kcontrol); + struct saa7134_core *core=chip->core; + + return 0; +} + +static snd_kcontrol_new_t snd_saa7134_capture_volume = { + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .name = "Capture Volume", + .info = snd_saa7134_capture_volume_info, + .get = snd_saa7134_capture_volume_get, + .put = snd_saa7134_capture_volume_put, +}; + +/* + *************************************** + */ + +/**************************************************************************** + Basic Flow for Sound Devices + ****************************************************************************/ + +/* + * PCI ID Table - 14f1:8801 and 14f1:8811 means function 1: Audio + * Only boards with eeprom and byte 1 at eeprom=1 have it + */ + +struct pci_device_id saa7134_audio_pci_tbl[] = { + {0x14f1,0x8801,PCI_ANY_ID,PCI_ANY_ID,0,0,0}, + {0x14f1,0x8811,PCI_ANY_ID,PCI_ANY_ID,0,0,0}, + {0, } +}; +MODULE_DEVICE_TABLE(pci, saa7134_audio_pci_tbl); + +/* + * Chip-specific destructor + */ + +static int snd_saa7134_free(snd_saa7134_card_t *chip) +{ + if (chip->irq >= 0) + free_irq(chip->irq, chip); + + /* free memory */ + saa7134_core_put(chip->core,chip->pci); + + pci_release_regions(chip->pci); + pci_disable_device(chip->pci); + + kfree(chip); + return 0; +} + +/* + * Component Destructor + */ +static int snd_saa7134_dev_free(snd_device_t *device) +{ + snd_saa7134_card_t *chip = device->device_data; + return snd_saa7134_free(chip); +} + + +/* + * Alsa Constructor - Component probe + */ + +static int devno=0; +static int __devinit snd_saa7134_create(snd_card_t *card, struct pci_dev *pci, + snd_saa7134_card_t **rchip) +{ + snd_saa7134_card_t *chip; + struct saa7134_core *core; + return 0; +} + +static int __devinit saa7134_audio_initdev(struct pci_dev *pci, + const struct pci_device_id *pci_id) +{ + snd_card_t *card; + snd_saa7134_card_t *chip; + int err; + + if (devno >= SNDRV_CARDS) + return (-ENODEV); + + if (!enable[devno]) { + ++devno; + return (-ENOENT); + } + + card = snd_card_new(index[devno], id[devno], THIS_MODULE, 0); + if (!card) + return (-ENOMEM); + + err = snd_saa7134_create(card, pci, &chip); + if (err < 0) + return (err); + +/* + err = snd_saa7134_pcm(chip, DEVICE_DIGITAL, "saa7134 Digital"); + if (err < 0) + goto fail_free; +*/ + err = snd_ctl_add(card, snd_ctl_new1(&snd_saa7134_capture_volume, chip)); + if (err < 0) { + snd_card_free(card); + return (err); + } + + strcpy (card->driver, "saa7134_ALSA"); + sprintf(card->shortname, "Saa7134 %x", pci->device); + sprintf(card->longname, "%s at %#lx", + card->shortname, pci_resource_start(pci, 0)); + strcpy (card->mixername, "saa7134"); + + dprintk (0, "%s/%i: Alsa support for saa7134x boards\n", + card->driver,devno); + + err = snd_card_register(card); + if (err < 0) { + snd_card_free(card); + return (err); + } + + pci_set_drvdata(pci,card); + + devno++; + return 0; +} +/* + * ALSA destructor + */ +static void __devexit saa7134_audio_finidev(struct pci_dev *pci) +{ + snd_card_free(pci_get_drvdata(pci)); + pci_set_drvdata(pci, NULL); + + devno--; +} + +/* + * PCI driver definition + */ + +static struct pci_driver saa7134_audio_pci_driver = { + .name = "saa7134_audio", + .id_table = saa7134_audio_pci_tbl, + .probe = saa7134_audio_initdev, + .remove = saa7134_audio_finidev, + SND_PCI_PM_CALLBACKS +}; + +/**************************************************************************** + LINUX MODULE INIT + ****************************************************************************/ + +/* + * module init + */ +static int saa7134_audio_init(void) +{ + printk(KERN_INFO "saa7134x alsa driver version %d.%d.%d loaded\n", + (saa7134_VERSION_CODE >> 16) & 0xff, + (saa7134_VERSION_CODE >> 8) & 0xff, + saa7134_VERSION_CODE & 0xff); +#ifdef SNAPSHOT + printk(KERN_INFO "saa7134x: snapshot date %04d-%02d-%02d\n", + SNAPSHOT/10000, (SNAPSHOT/100)%100, SNAPSHOT%100); +#endif + return pci_module_init(&saa7134_audio_pci_driver); +} + +/* + * module remove + */ +static void saa7134_audio_fini(void) +{ + pci_unregister_driver(&saa7134_audio_pci_driver); +} + +module_init(saa7134_audio_init); +module_exit(saa7134_audio_fini); + +/* ----------------------------------------------------------- */ +/* + * Local variables: + * c-basic-offset: 8 + * End: + */ diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c index 94053f149ddf..10f14bc23ed4 100644 --- a/drivers/media/video/tda9887.c +++ b/drivers/media/video/tda9887.c @@ -180,7 +180,8 @@ static struct tvnorm tvnorms[] = { .name = "SECAM-L", .b = ( cPositiveAmTV | cQSS ), - .e = ( cAudioIF_6_5 | + .e = ( cGaiting_36 | + cAudioIF_6_5 | cVideoIF_38_90 ), },{ .std = V4L2_STD_SECAM_DK, @@ -329,7 +330,7 @@ static void dump_write_message(unsigned char *buf) printk(PREFIX "write: byte E 0x%02x\n",buf[3]); printk(" E0-1 sound carrier : %s\n", carrier[(buf[3] & 0x03)]); - printk(" E6 l pll ganting : %s\n", + printk(" E6 l pll gaiting : %s\n", (buf[3] & 0x40) ? "36" : "13"); if (buf[1] & 0x08) { -- cgit v1.2.2 From 3375c39844b58ad8a5d9f454fa908d722a94a5a4 Mon Sep 17 00:00:00 2001 From: "Nickolay V. Shmyrev" Date: Tue, 8 Nov 2005 21:37:05 -0800 Subject: [PATCH] v4l: 714: fix typo - Fix typo. Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/tda9887.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c index 10f14bc23ed4..ba22f12e8b32 100644 --- a/drivers/media/video/tda9887.c +++ b/drivers/media/video/tda9887.c @@ -180,7 +180,7 @@ static struct tvnorm tvnorms[] = { .name = "SECAM-L", .b = ( cPositiveAmTV | cQSS ), - .e = ( cGaiting_36 | + .e = ( cGating_36 | cAudioIF_6_5 | cVideoIF_38_90 ), },{ @@ -330,7 +330,7 @@ static void dump_write_message(unsigned char *buf) printk(PREFIX "write: byte E 0x%02x\n",buf[3]); printk(" E0-1 sound carrier : %s\n", carrier[(buf[3] & 0x03)]); - printk(" E6 l pll gaiting : %s\n", + printk(" E6 l pll gating : %s\n", (buf[3] & 0x40) ? "36" : "13"); if (buf[1] & 0x08) { -- cgit v1.2.2 From 4b017415fc9ab63f7c0e49aced5e403c18d55659 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 8 Nov 2005 21:37:06 -0800 Subject: [PATCH] v4l: 715: enable s video input on dvico fusionhdtv5 lite - Enable S-Video input on DViCO FusionHDTV5 Lite Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/bttv-cards.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bttv-cards.c index 1f33764bf050..77f0ff8a4e4c 100644 --- a/drivers/media/video/bttv-cards.c +++ b/drivers/media/video/bttv-cards.c @@ -2679,10 +2679,10 @@ struct tvcard bttv_tvcards[] = { .tuner_type = TUNER_LG_TDVS_H062F, .tuner_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET, - .video_inputs = 2, + .video_inputs = 3, .audio_inputs = 1, .svhs = 2, - .muxsel = { 2, 3 }, + .muxsel = { 2, 3, 1 }, .gpiomask = 0x00e00007, .audiomux = { 0x00400005, 0, 0x00000001, 0, 0x00c00007, 0 }, .no_msp34xx = 1, -- cgit v1.2.2 From a6c2ba283565dbc9f055dcb2ecba1971460bb535 Mon Sep 17 00:00:00 2001 From: "akpm@osdl.org" Date: Tue, 8 Nov 2005 21:37:07 -0800 Subject: [PATCH] v4l: 716: support for em28xx board family - Added support for em28xx board family Signed-off-by: Ludovico Cavedon Signed-off-by: Markus Rechberger Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/em28xx/em28xx-cards.c | 168 +++ drivers/media/video/em28xx/em28xx-core.c | 807 +++++++++++++ drivers/media/video/em28xx/em28xx-i2c.c | 443 +++++++ drivers/media/video/em28xx/em28xx-video.c | 1815 +++++++++++++++++++++++++++++ drivers/media/video/em28xx/em28xx.h | 479 ++++++++ drivers/media/video/tvp5150.c | 337 ++++-- 6 files changed, 3938 insertions(+), 111 deletions(-) create mode 100644 drivers/media/video/em28xx/em28xx-cards.c create mode 100644 drivers/media/video/em28xx/em28xx-core.c create mode 100644 drivers/media/video/em28xx/em28xx-i2c.c create mode 100644 drivers/media/video/em28xx/em28xx-video.c create mode 100644 drivers/media/video/em28xx/em28xx.h diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c new file mode 100644 index 000000000000..b6d89decfbd8 --- /dev/null +++ b/drivers/media/video/em28xx/em28xx-cards.c @@ -0,0 +1,168 @@ +/* + em2820-cards.c - driver for Empia EM2820/2840 USB video capture devices + + Copyright (C) 2005 Markus Rechberger + Ludovico Cavedon + Mauro Carvalho Chehab + + Based on the em2800 driver from Sascha Sommer + + 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 +#include +#include +#include +#include +#include +#include +#include "audiochip.h" +#include "tveeprom.h" +#include "msp3400.h" + +#include "em2820.h" + +enum em2820_board_entry { + EM2820_BOARD_TERRATEC_CINERGY_250, + EM2820_BOARD_PINNACLE_USB_2, + EM2820_BOARD_HAUPPAUGE_WINTV_USB_2, + EM2820_BOARD_MSI_VOX_USB_2 +}; + +struct em2820_board em2820_boards[] = { + [EM2820_BOARD_TERRATEC_CINERGY_250] = { + .name = "Terratec Cinergy 250 USB", + .vchannels = 3, + .norm = VIDEO_MODE_PAL, + .tuner_type = TUNER_LG_PAL_NEW_TAPC, + .tda9887_conf = TDA9887_PRESENT, + .has_tuner = 1, + .decoder = EM2820_SAA7113, + .input = {{ + .type = EM2820_VMUX_TELEVISION, + .vmux = 2, + .amux = 0, + },{ + .type = EM2820_VMUX_COMPOSITE1, + .vmux = 0, + .amux = 1, + },{ + .type = EM2820_VMUX_SVIDEO, + .vmux = 9, + .amux = 1, + }}, + }, + [EM2820_BOARD_PINNACLE_USB_2] = { + .name = "Pinnacle PCTV USB 2", + .vchannels = 3, + .norm = VIDEO_MODE_PAL, + .tuner_type = TUNER_LG_PAL_NEW_TAPC, + .tda9887_conf = TDA9887_PRESENT, + .has_tuner = 1, + .decoder = EM2820_SAA7113, + .input = {{ + .type = EM2820_VMUX_TELEVISION, + .vmux = 2, + .amux = 0, + },{ + .type = EM2820_VMUX_COMPOSITE1, + .vmux = 0, + .amux = 1, + },{ + .type = EM2820_VMUX_SVIDEO, + .vmux = 9, + .amux = 1, + }}, + }, + [EM2820_BOARD_HAUPPAUGE_WINTV_USB_2] = { + .name = "Hauppauge WinTV USB 2", + .vchannels = 3, + .norm = VIDEO_MODE_NTSC, + .tuner_type = TUNER_PHILIPS_FM1236_MK3, + .tda9887_conf = TDA9887_PRESENT|TDA9887_PORT1_ACTIVE|TDA9887_PORT2_ACTIVE, + .has_tuner = 1, + .decoder = EM2820_TVP5150, + .has_msp34xx = 1, + /*FIXME: S-Video not tested */ + .input = {{ + .type = EM2820_VMUX_TELEVISION, + .vmux = 0, + .amux = 0, + },{ + .type = EM2820_VMUX_SVIDEO, + .vmux = 2, + .amux = 1, + }}, + }, + [EM2820_BOARD_MSI_VOX_USB_2] = { + .name = "MSI VOX USB 2.0", + .vchannels = 3, + .norm = VIDEO_MODE_PAL, + .tuner_type = TUNER_PHILIPS_PAL, + .tda9887_conf = TDA9887_PRESENT|TDA9887_PORT1_ACTIVE|TDA9887_PORT2_ACTIVE, + .has_tuner = 1, + .decoder = EM2820_SAA7114, + .input = {{ + .type = EM2820_VMUX_TELEVISION, + .vmux = 2, + .amux = 0, + },{ + .type = EM2820_VMUX_COMPOSITE1, + .vmux = 0, + .amux = 1, + },{ + .type = EM2820_VMUX_SVIDEO, + .vmux = 9, + .amux = 1, + }}, + }, + { } /* Terminating entry */ +}; + +/* table of devices that work with this driver */ +struct usb_device_id em2820_id_table [] = { + /* Terratec Cinerhy 200 USB: em2800 nor supported, at the moment */ + /* { USB_DEVICE(0xeb1a, 0x2800), .driver_info = EM2800_BOARD_TERRATEC_CINERGY_200 }, */ + { USB_DEVICE(0x0ccd, 0x0036), .driver_info = EM2820_BOARD_TERRATEC_CINERGY_250 }, + { USB_DEVICE(0x2304, 0x0208), .driver_info = EM2820_BOARD_PINNACLE_USB_2 }, + { USB_DEVICE(0x2040, 0x4200), .driver_info = EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 }, + { USB_DEVICE(0xeb1a, 0x2820), .driver_info = EM2820_BOARD_MSI_VOX_USB_2 }, + { }, +}; + +void em2820_card_setup(struct em2820 *dev) +{ + /* request some modules */ + if (dev->model == EM2820_BOARD_HAUPPAUGE_WINTV_USB_2) { + struct tveeprom tv; +#ifdef CONFIG_MODULES + request_module("tveeprom"); +#endif + /* Call first TVeeprom */ + + tveeprom_hauppauge_analog(&dev->i2c_client, &tv, dev->eedata); + + dev->tuner_type= tv.tuner_type; + if (tv.audio_processor == AUDIO_CHIP_MSP34XX) { + dev->has_msp34xx=1; + } else dev->has_msp34xx=0; + } +} + +EXPORT_SYMBOL(em2820_boards); +EXPORT_SYMBOL(em2820_id_table); + +MODULE_DEVICE_TABLE (usb, em2820_id_table); diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c new file mode 100644 index 000000000000..a75a91da70e9 --- /dev/null +++ b/drivers/media/video/em28xx/em28xx-core.c @@ -0,0 +1,807 @@ +/* + em2820-core.c - driver for Empia EM2820/2840 USB video capture devices + + Copyright (C) 2005 Markus Rechberger + Ludovico Cavedon + Mauro Carvalho Chehab + + Based on the em2800 driver from Sascha Sommer + + 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 +#include +#include +#include +#include +#include +#include + +#include "em2820.h" + +/* #define ENABLE_DEBUG_ISOC_FRAMES */ + +unsigned int core_debug = 0; +module_param(core_debug,int,0644); +MODULE_PARM_DESC(core_debug,"enable debug messages [core]"); + +#define em2820_coredbg(fmt, arg...) do {\ + if (core_debug) \ + printk(KERN_INFO "%s %s :"fmt, \ + dev->name, __FUNCTION__ , ##arg); } while (0) + +unsigned int reg_debug = 0; +module_param(reg_debug,int,0644); +MODULE_PARM_DESC(reg_debug,"enable debug messages [URB reg]"); + +#define em2820_regdbg(fmt, arg...) do {\ + if (reg_debug) \ + printk(KERN_INFO "%s %s :"fmt, \ + dev->name, __FUNCTION__ , ##arg); } while (0) + +unsigned int isoc_debug = 0; +module_param(isoc_debug,int,0644); +MODULE_PARM_DESC(core_debug,"enable debug messages [isoc transfers]"); + +#define em2820_isocdbg(fmt, arg...) do {\ + if (isoc_debug) \ + printk(KERN_INFO "%s %s :"fmt, \ + dev->name, __FUNCTION__ , ##arg); } while (0) + +static int alt = EM2820_PINOUT; +module_param(alt, int, 0644); +MODULE_PARM_DESC(alt, "alternate setting to use for video endpoint"); + +/* ------------------------------------------------------------------ */ +/* debug help functions */ + +static const char *v4l1_ioctls[] = { + "0", "CGAP", "GCHAN", "SCHAN", "GTUNER", "STUNER", "GPICT", "SPICT", + "CCAPTURE", "GWIN", "SWIN", "GFBUF", "SFBUF", "KEY", "GFREQ", + "SFREQ", "GAUDIO", "SAUDIO", "SYNC", "MCAPTURE", "GMBUF", "GUNIT", + "GCAPTURE", "SCAPTURE", "SPLAYMODE", "SWRITEMODE", "GPLAYINFO", + "SMICROCODE", "GVBIFMT", "SVBIFMT" }; +#define V4L1_IOCTLS ARRAY_SIZE(v4l1_ioctls) + +static const char *v4l2_ioctls[] = { + "QUERYCAP", "1", "ENUM_PIXFMT", "ENUM_FBUFFMT", "G_FMT", "S_FMT", + "G_COMP", "S_COMP", "REQBUFS", "QUERYBUF", "G_FBUF", "S_FBUF", + "G_WIN", "S_WIN", "PREVIEW", "QBUF", "16", "DQBUF", "STREAMON", + "STREAMOFF", "G_PERF", "G_PARM", "S_PARM", "G_STD", "S_STD", + "ENUMSTD", "ENUMINPUT", "G_CTRL", "S_CTRL", "G_TUNER", "S_TUNER", + "G_FREQ", "S_FREQ", "G_AUDIO", "S_AUDIO", "35", "QUERYCTRL", + "QUERYMENU", "G_INPUT", "S_INPUT", "ENUMCVT", "41", "42", "43", + "44", "45", "G_OUTPUT", "S_OUTPUT", "ENUMOUTPUT", "G_AUDOUT", + "S_AUDOUT", "ENUMFX", "G_EFFECT", "S_EFFECT", "G_MODULATOR", + "S_MODULATOR" +}; +#define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls) + +void em2820_print_ioctl(char *name, unsigned int cmd) +{ + char *dir; + + switch (_IOC_DIR(cmd)) { + case _IOC_NONE: dir = "--"; break; + case _IOC_READ: dir = "r-"; break; + case _IOC_WRITE: dir = "-w"; break; + case _IOC_READ | _IOC_WRITE: dir = "rw"; break; + default: dir = "??"; break; + } + switch (_IOC_TYPE(cmd)) { + case 'v': + printk(KERN_DEBUG "%s: ioctl 0x%08x (v4l1, %s, VIDIOC%s)\n", + name, cmd, dir, (_IOC_NR(cmd) < V4L1_IOCTLS) ? + v4l1_ioctls[_IOC_NR(cmd)] : "???"); + break; + case 'V': + printk(KERN_DEBUG "%s: ioctl 0x%08x (v4l2, %s, VIDIOC_%s)\n", + name, cmd, dir, (_IOC_NR(cmd) < V4L2_IOCTLS) ? + v4l2_ioctls[_IOC_NR(cmd)] : "???"); + break; + default: + printk(KERN_DEBUG "%s: ioctl 0x%08x (???, %s, #%d)\n", + name, cmd, dir, _IOC_NR(cmd)); + } +} + +static void *rvmalloc(size_t size) +{ + void *mem; + unsigned long adr; + + size = PAGE_ALIGN(size); + + mem = vmalloc_32((unsigned long)size); + if (!mem) + return NULL; + + memset(mem, 0, size); + + adr = (unsigned long)mem; + while (size > 0) { + SetPageReserved(vmalloc_to_page((void *)adr)); + adr += PAGE_SIZE; + size -= PAGE_SIZE; + } + + return mem; +} + +static void rvfree(void *mem, size_t size) +{ + unsigned long adr; + + if (!mem) + return; + + size = PAGE_ALIGN(size); + + adr = (unsigned long)mem; + while (size > 0) { + ClearPageReserved(vmalloc_to_page((void *)adr)); + adr += PAGE_SIZE; + size -= PAGE_SIZE; + } + + vfree(mem); +} + +/* + * em2820_request_buffers() + * allocate a number of buffers + */ +u32 em2820_request_buffers(struct em2820 *dev, u32 count) +{ + const size_t imagesize = PAGE_ALIGN(dev->frame_size); /*needs to be page aligned cause the buffers can be mapped individually! */ + void *buff = NULL; + u32 i; + em2820_coredbg("requested %i buffers with size %i", count, imagesize); + if (count > EM2820_NUM_FRAMES) + count = EM2820_NUM_FRAMES; + + dev->num_frames = count; + while (dev->num_frames > 0) { + if ((buff = rvmalloc(dev->num_frames * imagesize))) + break; + dev->num_frames--; + } + + for (i = 0; i < dev->num_frames; i++) { + dev->frame[i].bufmem = buff + i * imagesize; + dev->frame[i].buf.index = i; + dev->frame[i].buf.m.offset = i * imagesize; + dev->frame[i].buf.length = dev->frame_size; + dev->frame[i].buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + dev->frame[i].buf.sequence = 0; + dev->frame[i].buf.field = V4L2_FIELD_NONE; + dev->frame[i].buf.memory = V4L2_MEMORY_MMAP; + dev->frame[i].buf.flags = 0; + } + return dev->num_frames; +} + +/* + * em2820_queue_unusedframes() + * add all frames that are not currently in use to the inbuffer queue + */ +void em2820_queue_unusedframes(struct em2820 *dev) +{ + unsigned long lock_flags; + u32 i; + + for (i = 0; i < dev->num_frames; i++) + if (dev->frame[i].state == F_UNUSED) { + dev->frame[i].state = F_QUEUED; + spin_lock_irqsave(&dev->queue_lock, lock_flags); + list_add_tail(&dev->frame[i].frame, &dev->inqueue); + spin_unlock_irqrestore(&dev->queue_lock, lock_flags); + } +} + +/* + * em2820_release_buffers() + * free frame buffers + */ +void em2820_release_buffers(struct em2820 *dev) +{ + if (dev->num_frames) { + rvfree(dev->frame[0].bufmem, + dev->num_frames * PAGE_ALIGN(dev->frame[0].buf.length)); + dev->num_frames = 0; + } +} + +/* + * em2820_read_reg_req() + * reads data from the usb device specifying bRequest + */ +int em2820_read_reg_req_len(struct em2820 *dev, u8 req, u16 reg, + char *buf, int len) +{ + int ret, byte; + + em2820_regdbg("req=%02x, reg=%02x ", req, reg); + + ret = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), req, + USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + 0x0000, reg, buf, len, HZ); + + if (reg_debug){ + printk(ret < 0 ? " failed!\n" : "%02x values: ", ret); + for (byte = 0; byte < len; byte++) { + printk(" %02x", buf[byte]); + } + printk("\n"); + } + + return ret; +} + +/* + * em2820_read_reg_req() + * reads data from the usb device specifying bRequest + */ +int em2820_read_reg_req(struct em2820 *dev, u8 req, u16 reg) +{ + u8 val; + int ret; + + em2820_regdbg("req=%02x, reg=%02x:", req, reg); + + ret = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), req, + USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + 0x0000, reg, &val, 1, HZ); + + if (reg_debug) + printk(ret < 0 ? " failed!\n" : "%02x\n", val); + + if (ret < 0) + return ret; + + return val; +} + +int em2820_read_reg(struct em2820 *dev, u16 reg) +{ + return em2820_read_reg_req(dev, USB_REQ_GET_STATUS, reg); +} + +/* + * em2820_write_regs_req() + * sends data to the usb device, specifying bRequest + */ +int em2820_write_regs_req(struct em2820 *dev, u8 req, u16 reg, char *buf, + int len) +{ + int ret; + + /*usb_control_msg seems to expect a kmalloced buffer */ + unsigned char *bufs = kmalloc(len, GFP_KERNEL); + + em2820_regdbg("req=%02x reg=%02x:", req, reg); + + if (reg_debug) { + int i; + for (i = 0; i < len; ++i) + printk (" %02x", (unsigned char)buf[i]); + printk ("\n"); + } + + if (!bufs) + return -ENOMEM; + memcpy(bufs, buf, len); + ret = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), req, + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + 0x0000, reg, bufs, len, HZ); + mdelay(5); /* FIXME: magic number */ + kfree(bufs); + return ret; +} + +int em2820_write_regs(struct em2820 *dev, u16 reg, char *buf, int len) +{ + return em2820_write_regs_req(dev, USB_REQ_GET_STATUS, reg, buf, len); +} + +/* + * em2820_write_reg_bits() + * sets only some bits (specified by bitmask) of a register, by first reading + * the actual value + */ +int em2820_write_reg_bits(struct em2820 *dev, u16 reg, u8 val, + u8 bitmask) +{ + int oldval; + u8 newval; + if ((oldval = em2820_read_reg(dev, reg)) < 0) + return oldval; + newval = (((u8) oldval) & ~bitmask) | (val & bitmask); + return em2820_write_regs(dev, reg, &newval, 1); +} + +/* + * em2820_write_ac97() + * write a 16 bit value to the specified AC97 address (LSB first!) + */ +int em2820_write_ac97(struct em2820 *dev, u8 reg, u8 * val) +{ + int ret; + u8 addr = reg & 0x7f; + if ((ret = em2820_write_regs(dev, AC97LSB_REG, val, 2)) < 0) + return ret; + if ((ret = em2820_write_regs(dev, AC97ADDR_REG, &addr, 1)) < 0) + return ret; + if ((ret = em2820_read_reg(dev, AC97BUSY_REG)) < 0) + return ret; + else if (((u8) ret) & 0x01) { + em2820_warn ("AC97 command still being exectuted: not handled properly!\n"); + } + return 0; +} + +int em2820_audio_analog_set(struct em2820 *dev) +{ + char s[2] = { 0x00, 0x00 }; + s[0] |= 0x1f - dev->volume; + s[1] |= 0x1f - dev->volume; + if (dev->mute) + s[1] |= 0x80; + return em2820_write_ac97(dev, MASTER_AC97, s); +} + + +int em2820_colorlevels_set_default(struct em2820 *dev) +{ + em2820_write_regs(dev, YGAIN_REG, "\x10", 1); /* contrast */ + em2820_write_regs(dev, YOFFSET_REG, "\x00", 1); /* brightness */ + em2820_write_regs(dev, UVGAIN_REG, "\x10", 1); /* saturation */ + em2820_write_regs(dev, UOFFSET_REG, "\x00", 1); + em2820_write_regs(dev, VOFFSET_REG, "\x00", 1); + em2820_write_regs(dev, SHARPNESS_REG, "\x00", 1); + + em2820_write_regs(dev, GAMMA_REG, "\x20", 1); + em2820_write_regs(dev, RGAIN_REG, "\x20", 1); + em2820_write_regs(dev, GGAIN_REG, "\x20", 1); + em2820_write_regs(dev, BGAIN_REG, "\x20", 1); + em2820_write_regs(dev, ROFFSET_REG, "\x00", 1); + em2820_write_regs(dev, GOFFSET_REG, "\x00", 1); + return em2820_write_regs(dev, BOFFSET_REG, "\x00", 1); +} + +int em2820_capture_start(struct em2820 *dev, int start) +{ + int ret; + /* FIXME: which is the best order? */ + /* video registers are sampled by VREF */ + if ((ret = em2820_write_reg_bits(dev, USBSUSP_REG, start ? 0x10 : 0x00, + 0x10)) < 0) + return ret; + /* enable video capture */ + return em2820_write_regs(dev, VINENABLE_REG, start ? "\x67" : "\x27", 1); +} + +int em2820_outfmt_set_yuv422(struct em2820 *dev) +{ + em2820_write_regs(dev, OUTFMT_REG, "\x34", 1); + em2820_write_regs(dev, VINMODE_REG, "\x10", 1); + return em2820_write_regs(dev, VINCTRL_REG, "\x11", 1); +} + +int em2820_accumulator_set(struct em2820 *dev, u8 xmin, u8 xmax, u8 ymin, + u8 ymax) +{ + em2820_coredbg("em2820 Scale: (%d,%d)-(%d,%d)\n", xmin, ymin, xmax, ymax); + + em2820_write_regs(dev, XMIN_REG, &xmin, 1); + em2820_write_regs(dev, XMAX_REG, &xmax, 1); + em2820_write_regs(dev, YMIN_REG, &ymin, 1); + return em2820_write_regs(dev, YMAX_REG, &ymax, 1); +} + +int em2820_capture_area_set(struct em2820 *dev, u8 hstart, u8 vstart, + u16 width, u16 height) +{ + u8 cwidth = width; + u8 cheight = height; + u8 overflow = (height >> 7 & 0x02) | (width >> 8 & 0x01); + + em2820_coredbg("em2820 Area Set: (%d,%d)\n", (width | (overflow & 2) << 7), + (height | (overflow & 1) << 8)); + + em2820_write_regs(dev, HSTART_REG, &hstart, 1); + em2820_write_regs(dev, VSTART_REG, &vstart, 1); + em2820_write_regs(dev, CWIDTH_REG, &cwidth, 1); + em2820_write_regs(dev, CHEIGHT_REG, &cheight, 1); + return em2820_write_regs(dev, OFLOW_REG, &overflow, 1); +} + +int em2820_scaler_set(struct em2820 *dev, u16 h, u16 v) +{ + u8 buf[2]; + buf[0] = h; + buf[1] = h >> 8; + em2820_write_regs(dev, HSCALELOW_REG, (char *)buf, 2); + buf[0] = v; + buf[1] = v >> 8; + em2820_write_regs(dev, VSCALELOW_REG, (char *)buf, 2); + /* when H and V mixershould be used? */ + /* return em2820_write_reg_bits(dev, COMPR_REG, (h ? 0x20 : 0x00) | (v ? 0x10 : 0x00), 0x30); */ + /* it seems that both H and V scalers must be active to work correctly */ + return em2820_write_reg_bits(dev, COMPR_REG, h + || v ? 0x30 : 0x00, 0x30); +} + +/* FIXME: this only function read values from dev */ +int em2820_resolution_set(struct em2820 *dev) +{ + int width, height; + width = norm_maxw(dev); + height = norm_maxh(dev) >> 1; + + em2820_outfmt_set_yuv422(dev); + em2820_accumulator_set(dev, 1, (width - 4) >> 2, 1, (height - 4) >> 2); + em2820_capture_area_set(dev, 0, 0, width >> 2, height >> 2); + return em2820_scaler_set(dev, dev->hscale, dev->vscale); +} + + +/******************* isoc transfer handling ****************************/ + +#ifdef ENABLE_DEBUG_ISOC_FRAMES +static void em2820_isoc_dump(struct urb *urb, struct pt_regs *regs) +{ + int len = 0; + int ntrans = 0; + int i; + + printk(KERN_DEBUG "isocIrq: sf=%d np=%d ec=%x\n", + urb->start_frame, urb->number_of_packets, + urb->error_count); + for (i = 0; i < urb->number_of_packets; i++) { + unsigned char *buf = + urb->transfer_buffer + + urb->iso_frame_desc[i].offset; + int alen = urb->iso_frame_desc[i].actual_length; + if (alen > 0) { + if (buf[0] == 0x88) { + ntrans++; + len += alen; + } else if (buf[0] == 0x22) { + printk(KERN_DEBUG + "= l=%d nt=%d bpp=%d\n", + len - 4 * ntrans, ntrans, + ntrans == 0 ? 0 : len / ntrans); + ntrans = 1; + len = alen; + } else + printk(KERN_DEBUG "!\n"); + } + printk(KERN_DEBUG " n=%d s=%d al=%d %x\n", i, + urb->iso_frame_desc[i].status, + urb->iso_frame_desc[i].actual_length, + (unsigned int) + *((unsigned char *)(urb->transfer_buffer + + urb->iso_frame_desc[i]. + offset))); + } +} +#endif + +static inline int em2820_isoc_video(struct em2820 *dev,struct em2820_frame_t **f, + unsigned long *lock_flags, unsigned char buf) +{ + if (!(buf & 0x01)) { + if ((*f)->state == F_GRABBING) { + /*previous frame is incomplete */ + if ((*f)->fieldbytesused < dev->field_size) { + (*f)->state = F_ERROR; + em2820_isocdbg ("dropping incomplete bottom field (%i missing bytes)", + dev->field_size-(*f)->fieldbytesused); + } else { + (*f)->state = F_DONE; + (*f)->buf.bytesused = dev->frame_size; + } + } + if ((*f)->state == F_DONE || (*f)->state == F_ERROR) { + /* move current frame to outqueue and get next free buffer from inqueue */ + spin_lock_irqsave(&dev-> queue_lock, *lock_flags); + list_move_tail(&(*f)->frame, &dev->outqueue); + if (!list_empty(&dev->inqueue)) + (*f) = list_entry(dev-> inqueue.next, + struct em2820_frame_t,frame); + else + (*f) = NULL; + spin_unlock_irqrestore(&dev->queue_lock,*lock_flags); + } + if (!(*f)) { + em2820_isocdbg ("new frame but no buffer is free"); + return -1; + } + do_gettimeofday(&(*f)->buf.timestamp); + (*f)->buf.sequence = ++dev->frame_count; + (*f)->buf.field = V4L2_FIELD_INTERLACED; + (*f)->state = F_GRABBING; + (*f)->buf.bytesused = 0; + (*f)->top_field = 1; + (*f)->fieldbytesused = 0; + } else { + /* acquiring bottom field */ + if ((*f)->state == F_GRABBING) { + if (!(*f)->top_field) { + (*f)->state = F_ERROR; + em2820_isocdbg ("unexpected begin of bottom field; discarding it"); + } else if ((*f)-> fieldbytesused < dev->field_size - 172) { + (*f)->state = F_ERROR; + em2820_isocdbg ("dropping incomplete top field (%i missing bytes)", + dev->field_size-(*f)->fieldbytesused); + } else { + (*f)->top_field = 0; + (*f)->fieldbytesused = 0; + } + } + } + return (0); +} + +static inline void em2820_isoc_video_copy(struct em2820 *dev, + struct em2820_frame_t **f, unsigned char *buf, int len) +{ + void *fieldstart, *startwrite, *startread; + int linesdone, currlinedone, offset, lencopy,remain; + + if ((*f)->fieldbytesused + len > dev->field_size) + len =dev->field_size - (*f)->fieldbytesused; + remain = len; + startread = buf + 4; + if ((*f)->top_field) + fieldstart = (*f)->bufmem; + else + fieldstart = (*f)->bufmem + dev->bytesperline; + + linesdone = (*f)->fieldbytesused / dev->bytesperline; + currlinedone = (*f)->fieldbytesused % dev->bytesperline; + offset = linesdone * dev->bytesperline * 2 + currlinedone; + startwrite = fieldstart + offset; + lencopy = dev->bytesperline - currlinedone; + lencopy = lencopy > remain ? remain : lencopy; + + memcpy(startwrite, startread, lencopy); + remain -= lencopy; + + while (remain > 0) { + startwrite += lencopy + dev->bytesperline; + startread += lencopy; + if (dev->bytesperline > remain) + lencopy = remain; + else + lencopy = dev->bytesperline; + + memcpy(startwrite, startread, lencopy); + remain -= lencopy; + } + + (*f)->fieldbytesused += len; +} + +/* + * em2820_isoIrq() + * handles the incoming isoc urbs and fills the frames from our inqueue + */ +void em2820_isocIrq(struct urb *urb, struct pt_regs *regs) +{ + struct em2820 *dev = urb->context; + int i, status; + struct em2820_frame_t **f; + unsigned long lock_flags; + + if (!dev) + return; +#ifdef ENABLE_DEBUG_ISOC_FRAMES + if (isoc_debug>1) + em2820_isoc_dump(urb, regs); +#endif + + if (urb->status == -ENOENT) + return; + + f = &dev->frame_current; + + if (dev->stream == STREAM_INTERRUPT) { + dev->stream = STREAM_OFF; + if ((*f)) + (*f)->state = F_QUEUED; + em2820_isocdbg("stream interrupted"); + wake_up_interruptible(&dev->wait_stream); + } + + if ((dev->state & DEV_DISCONNECTED) || (dev->state & DEV_MISCONFIGURED)) + return; + + if (dev->stream == STREAM_ON && !list_empty(&dev->inqueue)) { + if (!(*f)) + (*f) = list_entry(dev->inqueue.next, + struct em2820_frame_t, frame); + + for (i = 0; i < urb->number_of_packets; i++) { + unsigned char *buf = urb->transfer_buffer + + urb->iso_frame_desc[i].offset; + int len = urb->iso_frame_desc[i].actual_length - 4; + + if (urb->iso_frame_desc[i].status) { + em2820_isocdbg("data error: [%d] len=%d, status=%d", i, + urb->iso_frame_desc[i].actual_length, + urb->iso_frame_desc[i].status); + continue; + } + if (urb->iso_frame_desc[i].actual_length <= 0) { + em2820_isocdbg("packet %d is empty",i); + continue; + } + if (urb->iso_frame_desc[i].actual_length > + dev->max_pkt_size) { + em2820_isocdbg("packet bigger than packet size"); + continue; + } + /*new frame */ + if (buf[0] == 0x22 && buf[1] == 0x5a) { + em2820_isocdbg("Video frame, length=%i!",len); + + if (em2820_isoc_video(dev,f,&lock_flags,buf[2])) + break; + } else if (buf[0]==0x33 && buf[1]==0x95 && buf[2]==0x00) { + em2820_isocdbg("VBI HEADER!!!"); + } + + /* actual copying */ + if ((*f)->state == F_GRABBING) { + em2820_isoc_video_copy(dev,f,buf, len); + } + } + } + + for (i = 0; i < urb->number_of_packets; i++) { + urb->iso_frame_desc[i].status = 0; + urb->iso_frame_desc[i].actual_length = 0; + } + + urb->status = 0; + if ((status = usb_submit_urb(urb, GFP_ATOMIC))) { + em2820_errdev("resubmit of urb failed (error=%i)\n", status); + dev->state |= DEV_MISCONFIGURED; + } + wake_up_interruptible(&dev->wait_frame); + return; +} + +/* + * em2820_uninit_isoc() + * deallocates the buffers and urbs allocated during em2820_init_iosc() + */ +void em2820_uninit_isoc(struct em2820 *dev) +{ + int i; + + for (i = 0; i < EM2820_NUM_BUFS; i++) { + if (dev->urb[i]) { + usb_kill_urb(dev->urb[i]); + usb_free_urb(dev->urb[i]); + } + dev->urb[i] = NULL; + if (dev->transfer_buffer[i]) + kfree(dev->transfer_buffer[i]); + dev->transfer_buffer[i] = NULL; + } + em2820_capture_start(dev, 0); +} + +/* + * em2820_init_isoc() + * allocates transfer buffers and submits the urbs for isoc transfer + */ +int em2820_init_isoc(struct em2820 *dev) +{ + /* change interface to 3 which allowes the biggest packet sizes */ + int i, errCode; + const int sb_size = EM2820_NUM_PACKETS * dev->max_pkt_size; + + /* reset streaming vars */ + dev->frame_current = NULL; + dev->frame_count = 0; + + /* allocate urbs */ + for (i = 0; i < EM2820_NUM_BUFS; i++) { + struct urb *urb; + int j, k; + /* allocate transfer buffer */ + dev->transfer_buffer[i] = kmalloc(sb_size, GFP_KERNEL); + if (!dev->transfer_buffer[i]) { + em2820_errdev + ("unable to allocate %i bytes for transfer buffer %i\n", + sb_size, i); + em2820_uninit_isoc(dev); + return -ENOMEM; + } + memset(dev->transfer_buffer[i], 0, sb_size); + urb = usb_alloc_urb(EM2820_NUM_PACKETS, GFP_KERNEL); + if (urb) { + urb->dev = dev->udev; + urb->context = dev; + urb->pipe = usb_rcvisocpipe(dev->udev, 0x82); + urb->transfer_flags = URB_ISO_ASAP; + urb->interval = 1; + urb->transfer_buffer = dev->transfer_buffer[i]; + urb->complete = em2820_isocIrq; + urb->number_of_packets = EM2820_NUM_PACKETS; + urb->transfer_buffer_length = sb_size; + for (j = k = 0; j < EM2820_NUM_PACKETS; + j++, k += dev->max_pkt_size) { + urb->iso_frame_desc[j].offset = k; + urb->iso_frame_desc[j].length = + dev->max_pkt_size; + } + dev->urb[i] = urb; + } else { + em2820_errdev("cannot alloc urb %i\n", i); + em2820_uninit_isoc(dev); + return -ENOMEM; + } + } + + /* submit urbs */ + for (i = 0; i < EM2820_NUM_BUFS; i++) { + errCode = usb_submit_urb(dev->urb[i], GFP_KERNEL); + if (errCode) { + em2820_errdev("submit of urb %i failed (error=%i)\n", i, + errCode); + em2820_uninit_isoc(dev); + return errCode; + } + } + + return 0; +} + +int em2820_set_alternate(struct em2820 *dev) +{ + int errCode, prev_alt = dev->alt; + dev->alt = alt; + if (dev->alt == 0) { + int i; + unsigned int min_pkt_size = dev->field_size / 137; /* FIXME: empiric magic number */ + em2820_coredbg("minimum isoc packet size: %u", min_pkt_size); + dev->alt = 7; + for (i = 1; i < EM2820_MAX_ALT; i += 2) /* FIXME: skip even alternate: why do they not work? */ + if (dev->alt_max_pkt_size[i] >= min_pkt_size) { + dev->alt = i; + break; + } + } + + if (dev->alt != prev_alt) { + dev->max_pkt_size = dev->alt_max_pkt_size[dev->alt]; + em2820_coredbg("setting alternate %d with wMaxPacketSize=%u", dev->alt, + dev->max_pkt_size); + errCode = usb_set_interface(dev->udev, 0, dev->alt); + if (errCode < 0) { + em2820_errdev + ("cannot change alternate number to %d (error=%i)\n", + dev->alt, errCode); + return errCode; + } + } + return 0; +} diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c new file mode 100644 index 000000000000..95f80a7615bd --- /dev/null +++ b/drivers/media/video/em28xx/em28xx-i2c.c @@ -0,0 +1,443 @@ +/* + em2820-i2c.c - driver for Empia EM2820/2840 USB video capture devices + + Copyright (C) 2005 Markus Rechberger + Ludovico Cavedon + Mauro Carvalho Chehab + + Based on the em2800 driver from Sascha Sommer + + 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 +#include +#include +#include +#include +#include +#include + +/* To be moved to compat.h */ +#if !defined(I2C_HW_B_EM2820) +#define I2C_HW_B_EM2820 I2C_HW_B_BT848 +#endif + +#include "em2820.h" + +/* ----------------------------------------------------------- */ + +static unsigned int i2c_scan = 0; +module_param(i2c_scan, int, 0444); +MODULE_PARM_DESC(i2c_scan, "scan i2c bus at insmod time"); + +static unsigned int i2c_debug = 0; +module_param(i2c_debug, int, 0644); +MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]"); + +#define dprintk(fmt, args...) if (i2c_debug) do {\ + printk(KERN_DEBUG "%s: %s: " fmt "\n",\ + dev->name, __FUNCTION__ , ##args); } while (0) +#define dprintk1(fmt, args...) if (i2c_debug) do{ \ + printk(KERN_DEBUG "%s: %s: " fmt, \ + dev->name, __FUNCTION__ , ##args); } while (0) +#define dprintk2(fmt, args...) if (i2c_debug) do {\ + printk(fmt , ##args); } while (0) + +/* + * i2c_send_bytes() + * untested for more than 4 bytes + */ +static int i2c_send_bytes(void *data, unsigned char addr, char *buf, short len, + int stop) +{ + int wrcount = 0; + struct em2820 *dev = (struct em2820 *)data; + + wrcount = dev->em2820_write_regs_req(dev, stop ? 2 : 3, addr, buf, len); + + return wrcount; +} + +/* + * i2c_recv_byte() + * read a byte from the i2c device + */ +static int i2c_recv_bytes(struct em2820 *dev, unsigned char addr, char *buf, + int len) +{ + int ret; + ret = dev->em2820_read_reg_req_len(dev, 2, addr, buf, len); + if (ret < 0) { + em2820_warn("reading i2c device failed (error=%i)\n", ret); + return ret; + } + if (dev->em2820_read_reg(dev, 0x5) != 0) + return -ENODEV; + return ret; +} + +/* + * i2c_check_for_device() + * check if there is a i2c_device at the supplied address + */ +static int i2c_check_for_device(struct em2820 *dev, unsigned char addr) +{ + char msg; + int ret; + msg = addr; + + ret = dev->em2820_read_reg_req(dev, 2, addr); + if (ret < 0) { + em2820_warn("reading from i2c device failed (error=%i)\n", ret); + return ret; + } + if (dev->em2820_read_reg(dev, 0x5) != 0) + return -ENODEV; + return 0; +} + +/* + * em2820_i2c_xfer() + * the main i2c transfer function + */ +static int em2820_i2c_xfer(struct i2c_adapter *i2c_adap, + struct i2c_msg msgs[], int num) +{ + struct em2820 *dev = i2c_adap->algo_data; + int addr, rc, i, byte; + + if (num <= 0) + return 0; + for (i = 0; i < num; i++) { + addr = msgs[i].addr << 1; + dprintk1("%s %s addr=%x len=%d:", + (msgs[i].flags & I2C_M_RD) ? "read" : "write", + i == num - 1 ? "stop" : "nonstop", addr, msgs[i].len); + if (!msgs[i].len) { /* no len: check only for device presence */ + rc = i2c_check_for_device(dev, addr); + if (rc < 0) { + dprintk2(" no device\n"); + return rc; + } + + } + if (msgs[i].flags & I2C_M_RD) { + /* read bytes */ + + rc = i2c_recv_bytes(dev, addr, msgs[i].buf, + msgs[i].len); + if (i2c_debug) { + for (byte = 0; byte < msgs[i].len; byte++) { + printk(" %02x", msgs[i].buf[byte]); + } + } + } else { + /* write bytes */ + if (i2c_debug) { + for (byte = 0; byte < msgs[i].len; byte++) + printk(" %02x", msgs[i].buf[byte]); + } + rc = i2c_send_bytes(dev, addr, msgs[i].buf, msgs[i].len, + i == num - 1); + if (rc < 0) + goto err; + } + if (i2c_debug) + printk("\n"); + } + + return num; + err: + dprintk2(" ERROR: %i\n", rc); + return rc; +} + +static int em2820_i2c_eeprom(struct em2820 *dev, unsigned char *eedata, int len) +{ + unsigned char buf, *p = eedata; + struct em2820_eeprom *em_eeprom = (void *)eedata; + int i, err, size = len, block; + + dev->i2c_client.addr = 0xa0 >> 1; + buf = 0; + if (1 != (err = i2c_master_send(&dev->i2c_client, &buf, 1))) { + printk(KERN_INFO "%s: Huh, no eeprom present (err=%d)?\n", + dev->name, err); + return -1; + } + while (size > 0) { + if (size > 16) + block = 16; + else + block = size; + + if (block != + (err = i2c_master_recv(&dev->i2c_client, p, block))) { + printk(KERN_WARNING + "%s: i2c eeprom read error (err=%d)\n", + dev->name, err); + return -1; + } + size -= block; + p += block; + } + for (i = 0; i < len; i++) { + if (0 == (i % 16)) + printk(KERN_INFO "%s: i2c eeprom %02x:", dev->name, i); + printk(" %02x", eedata[i]); + if (15 == (i % 16)) + printk("\n"); + } + + printk(KERN_INFO "EEPROM ID= 0x%08x\n", em_eeprom->id); + printk(KERN_INFO "Vendor/Product ID= %04x:%04x\n", em_eeprom->vendor_ID, + em_eeprom->product_ID); + + switch (em_eeprom->chip_conf >> 4 & 0x3) { + case 0: + printk(KERN_INFO "No audio on board.\n"); + break; + case 1: + printk(KERN_INFO "AC97 audio (5 sample rates)\n"); + break; + case 2: + printk(KERN_INFO "I2S audio, sample rate=32k\n"); + break; + case 3: + printk(KERN_INFO "I2S audio, 3 sample rates\n"); + break; + } + + if (em_eeprom->chip_conf & 1 << 3) + printk(KERN_INFO "USB Remote wakeup capable\n"); + + if (em_eeprom->chip_conf & 1 << 2) + printk(KERN_INFO "USB Self power capable\n"); + + switch (em_eeprom->chip_conf & 0x3) { + case 0: + printk(KERN_INFO "500mA max power\n"); + break; + case 1: + printk(KERN_INFO "400mA max power\n"); + break; + case 2: + printk(KERN_INFO "300mA max power\n"); + break; + case 3: + printk(KERN_INFO "200mA max power\n"); + break; + } + + return 0; +} + +/* ----------------------------------------------------------- */ + +/* + * algo_control() + */ +static int algo_control(struct i2c_adapter *adapter, + unsigned int cmd, unsigned long arg) +{ + return 0; +} + +/* + * functionality() + */ +static u32 functionality(struct i2c_adapter *adap) +{ + return I2C_FUNC_SMBUS_EMUL; +} + +#ifndef I2C_PEC +static void inc_use(struct i2c_adapter *adap) +{ + MOD_INC_USE_COUNT; +} + +static void dec_use(struct i2c_adapter *adap) +{ + MOD_DEC_USE_COUNT; +} +#endif + +static int em2820_set_tuner(int check_eeprom, struct i2c_client *client) +{ + struct em2820 *dev = client->adapter->algo_data; + + struct tuner_setup tun_setup; + + /* tuner */ + if (dev->has_tuner) { + tun_setup.mode_mask = T_ANALOG_TV | T_RADIO; + tun_setup.type = dev->tuner_type; + tun_setup.addr = dev->tuner_addr; + + em2820_i2c_call_clients(dev, TUNER_SET_TYPE_ADDR, &tun_setup); + } + return (0); +} + +/* + * attach_inform() + * gets called when a device attaches to the i2c bus + * does some basic configuration + */ +static int attach_inform(struct i2c_client *client) +{ + struct em2820 *dev = client->adapter->algo_data; + + dprintk("address %x", client->addr << 1); + switch (client->addr << 1) { + case 0x68: + em2820_i2c_call_clients(dev, TDA9887_SET_CONFIG, &dev->tda9887_conf); + break; + case 0x4a: + dprintk1("attach_inform: saa7113 detected.\n"); + break; + case 0xa0: + dprintk1("attach_inform: eeprom detected.\n"); + break; + case 0x80: + case 0x88: + dprintk1("attach_inform: msp34xx detected.\n"); + break; + case 0xb8: + case 0xba: + dprintk1("attach_inform: tvp5150 detected.\n"); + break; + default: + dev->tuner_addr = client->addr; + em2820_set_tuner(-1, client); + } + + return 0; +} + +static struct i2c_algorithm em2820_algo = { + .name = "em2820", + .id = I2C_HW_B_EM2820, + .master_xfer = em2820_i2c_xfer, + .algo_control = algo_control, + .functionality = functionality, +}; + +static struct i2c_adapter em2820_adap_template = { +#ifdef I2C_PEC + .owner = THIS_MODULE, +#else + .inc_use = inc_use, + .dec_use = dec_use, +#endif +#ifdef I2C_CLASS_TV_ANALOG + .class = I2C_CLASS_TV_ANALOG, +#endif + .name = "em2820", + .id = I2C_HW_B_EM2820, + .algo = &em2820_algo, + .client_register = attach_inform, +}; + +static struct i2c_client em2820_client_template = { + .name = "em2820 internal", + .flags = I2C_CLIENT_ALLOW_USE, +}; + +/* ----------------------------------------------------------- */ + +/* + * i2c_devs + * incomplete list of known devices + */ +static char *i2c_devs[128] = { + [0x4a >> 1] = "saa7113h", + [0x60 >> 1] = "remote IR sensor", + [0x86 >> 1] = "tda9887", + [0x80 >> 1] = "msp34xx", + [0x88 >> 1] = "msp34xx", + [0xa0 >> 1] = "eeprom", + [0xb8 >> 1] = "tvp5150a", + [0xba >> 1] = "tvp5150a", + [0xc0 >> 1] = "tuner (analog)", + [0xc2 >> 1] = "tuner (analog)", + [0xc4 >> 1] = "tuner (analog)", + [0xc6 >> 1] = "tuner (analog)", +}; + +/* + * do_i2c_scan() + * check i2c address range for devices + */ +static void do_i2c_scan(char *name, struct i2c_client *c) +{ + unsigned char buf; + int i, rc; + + for (i = 0; i < 128; i++) { + c->addr = i; + rc = i2c_master_recv(c, &buf, 0); + if (rc < 0) + continue; + printk(KERN_INFO "%s: found device @ 0x%x [%s]", name, + i << 1, i2c_devs[i] ? i2c_devs[i] : "???"); + } +} + +/* + * em2820_i2c_call_clients() + * send commands to all attached i2c devices + */ +void em2820_i2c_call_clients(struct em2820 *dev, unsigned int cmd, void *arg) +{ + BUG_ON(NULL == dev->i2c_adap.algo_data); + i2c_clients_command(&dev->i2c_adap, cmd, arg); +} + +/* + * em2820_i2c_register() + * register i2c bus + */ +int em2820_i2c_register(struct em2820 *dev) +{ + BUG_ON(!dev->em2820_write_regs || !dev->em2820_read_reg); + BUG_ON(!dev->em2820_write_regs_req || !dev->em2820_read_reg_req); + dev->i2c_adap = em2820_adap_template; + dev->i2c_adap.dev.parent = &dev->udev->dev; + strcpy(dev->i2c_adap.name, dev->name); + dev->i2c_adap.algo_data = dev; + i2c_add_adapter(&dev->i2c_adap); + + dev->i2c_client = em2820_client_template; + dev->i2c_client.adapter = &dev->i2c_adap; + + em2820_i2c_eeprom(dev, dev->eedata, sizeof(dev->eedata)); + + if (i2c_scan) + do_i2c_scan(dev->name, &dev->i2c_client); + return 0; +} + +/* + * em2820_i2c_unregister() + * unregister i2c_bus + */ +int em2820_i2c_unregister(struct em2820 *dev) +{ + i2c_del_adapter(&dev->i2c_adap); + return 0; +} diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c new file mode 100644 index 000000000000..a000131a8f5d --- /dev/null +++ b/drivers/media/video/em28xx/em28xx-video.c @@ -0,0 +1,1815 @@ +/* + em2820-video.c - driver for Empia EM2820/2840 USB video capture devices + + Copyright (C) 2005 Markus Rechberger + Ludovico Cavedon + Mauro Carvalho Chehab + + Based on the em2800 driver from Sascha Sommer + + 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 +#include +#include +#include +#include +#include +#include +#include +#include + +#include "em2820.h" + +#define DRIVER_AUTHOR "Markus Rechberger , " \ + "Ludovico Cavedon , " \ + "Mauro Carvalho Chehab " + +#define DRIVER_NAME "em2820" +#define DRIVER_DESC "Empia em2820 based USB video device driver" +#define EM2820_VERSION_CODE KERNEL_VERSION(0, 0, 1) + +#define em2820_videodbg(fmt, arg...) do {\ + if (video_debug) \ + printk(KERN_INFO "%s %s :"fmt, \ + dev->name, __FUNCTION__ , ##arg); } while (0) + +MODULE_AUTHOR(DRIVER_AUTHOR); +MODULE_DESCRIPTION(DRIVER_DESC); +MODULE_LICENSE("GPL"); + +static int tuner = -1; +module_param(tuner, int, 0444); +MODULE_PARM_DESC(tuner, "tuner type"); + +static unsigned int video_debug = 0; +module_param(video_debug,int,0644); +MODULE_PARM_DESC(video_debug,"enable debug messages [video]"); + +/* supported tv norms */ +static struct em2820_tvnorm tvnorms[] = { + { + .name = "PAL", + .id = V4L2_STD_PAL, + .mode = VIDEO_MODE_PAL, + }, { + .name = "NTSC", + .id = V4L2_STD_NTSC, + .mode = VIDEO_MODE_NTSC, + }, { + .name = "SECAM", + .id = V4L2_STD_SECAM, + .mode = VIDEO_MODE_SECAM, + }, { + .name = "PAL-M", + .id = V4L2_STD_PAL_M, + .mode = VIDEO_MODE_PAL, + } +}; + +#define TVNORMS ARRAY_SIZE(tvnorms) + +/* supported controls */ +static struct v4l2_queryctrl em2820_qctrl[] = { + { + .id = V4L2_CID_BRIGHTNESS, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Brightness", + .minimum = -128, + .maximum = 127, + .step = 1, + .default_value = 0, + .flags = 0, + },{ + .id = V4L2_CID_CONTRAST, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Contrast", + .minimum = 0x0, + .maximum = 0x1f, + .step = 0x1, + .default_value = 0x10, + .flags = 0, + },{ + .id = V4L2_CID_SATURATION, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Saturation", + .minimum = 0x0, + .maximum = 0x1f, + .step = 0x1, + .default_value = 0x10, + .flags = 0, + },{ + .id = V4L2_CID_AUDIO_VOLUME, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Volume", + .minimum = 0x0, + .maximum = 0x1f, + .step = 0x1, + .default_value = 0x1f, + .flags = 0, + },{ + .id = V4L2_CID_AUDIO_MUTE, + .type = V4L2_CTRL_TYPE_BOOLEAN, + .name = "Mute", + .minimum = 0, + .maximum = 1, + .step = 1, + .default_value = 1, + .flags = 0, + },{ + .id = V4L2_CID_RED_BALANCE, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Red chroma balance", + .minimum = -128, + .maximum = 127, + .step = 1, + .default_value = 0, + .flags = 0, + },{ + .id = V4L2_CID_BLUE_BALANCE, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Blue chroma balance", + .minimum = -128, + .maximum = 127, + .step = 1, + .default_value = 0, + .flags = 0, + },{ + .id = V4L2_CID_GAMMA, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Gamma", + .minimum = 0x0, + .maximum = 0x3f, + .step = 0x1, + .default_value = 0x20, + .flags = 0, + } +}; + +static struct usb_driver em2820_usb_driver; + +static DECLARE_MUTEX(em2820_sysfs_lock); +static DECLARE_RWSEM(em2820_disconnect); + +/********************* v4l2 interface ******************************************/ + +static inline unsigned long kvirt_to_pa(unsigned long adr) +{ + unsigned long kva, ret; + + kva = (unsigned long)page_address(vmalloc_to_page((void *)adr)); + kva |= adr & (PAGE_SIZE - 1); + ret = __pa(kva); + return ret; +} + +/* + * em2820_config() + * inits registers with sane defaults + */ +static int em2820_config(struct em2820 *dev) +{ + + /* Sets I2C speed to 100 KHz */ + em2820_write_regs_req(dev, 0x00, 0x06, "\x40", 1); + + /* enable vbi capturing */ + em2820_audio_usb_mute(dev, 1); + dev->mute = 1; /* maybe not the right place... */ + dev->volume = 0x1f; + em2820_audio_analog_set(dev); + em2820_audio_analog_setup(dev); + em2820_outfmt_set_yuv422(dev); + em2820_colorlevels_set_default(dev); + em2820_compression_disable(dev); + + return 0; +} + +/* + * em2820_config_i2c() + * configure i2c attached devices + */ +void em2820_config_i2c(struct em2820 *dev) +{ + struct v4l2_frequency f; + struct video_decoder_init em2820_vdi = {.data = NULL }; + + + /* configure decoder */ + em2820_i2c_call_clients(dev, DECODER_INIT, &em2820_vdi); + em2820_i2c_call_clients(dev, DECODER_SET_INPUT, &dev->ctl_input); +/* em2820_i2c_call_clients(dev,DECODER_SET_PICTURE, &dev->vpic); */ +/* em2820_i2c_call_clients(dev,DECODER_SET_NORM,&dev->tvnorm->id); */ +/* em2820_i2c_call_clients(dev,DECODER_ENABLE_OUTPUT,&output); */ +/* em2820_i2c_call_clients(dev,DECODER_DUMP, NULL); */ + + /* configure tuner */ + f.tuner = 0; + f.type = V4L2_TUNER_ANALOG_TV; + f.frequency = 9076; /* FIXME:remove magic number */ + dev->ctl_freq = f.frequency; + em2820_i2c_call_clients(dev, VIDIOC_S_FREQUENCY, &f); + + /* configure tda9887 */ + + em2820_i2c_call_clients(dev, TDA9887_SET_CONFIG, &dev->tda9887_conf); + +/* em2820_i2c_call_clients(dev,VIDIOC_S_STD,&dev->tvnorm->id); */ +} + +/* + * em2820_empty_framequeues() + * prepare queues for incoming and outgoing frames + */ +static void em2820_empty_framequeues(struct em2820 *dev) +{ + u32 i; + + INIT_LIST_HEAD(&dev->inqueue); + INIT_LIST_HEAD(&dev->outqueue); + + for (i = 0; i < EM2820_NUM_FRAMES; i++) { + dev->frame[i].state = F_UNUSED; + dev->frame[i].buf.bytesused = 0; + } +} + +/* + * em2820_v4l2_open() + * inits the device and starts isoc transfer + */ +static int em2820_v4l2_open(struct inode *inode, struct file *filp) +{ + struct video_device *vdev = video_devdata(filp); + int minor = iminor(inode); + struct em2820 *dev = (struct em2820 *)video_get_drvdata(vdev); + int errCode = 0; + + em2820_videodbg("users=%d", dev->users); + + if (!down_read_trylock(&em2820_disconnect)) + return -ERESTARTSYS; + + if (dev->users) { + em2820_warn("this driver can be opened only once\n"); + up_read(&em2820_disconnect); + return -EBUSY; + } + +/* if(dev->vbi_dev->minor == minor){ + dev->type=V4L2_BUF_TYPE_VBI_CAPTURE; + }*/ + if (dev->vdev->minor == minor) { + dev->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + } + + init_MUTEX(&dev->fileop_lock); /* to 1 == available */ + spin_lock_init(&dev->queue_lock); + init_waitqueue_head(&dev->wait_frame); + init_waitqueue_head(&dev->wait_stream); + + down(&dev->lock); + + em2820_set_alternate(dev); + + dev->width = norm_maxw(dev); + dev->height = norm_maxh(dev); + dev->frame_size = dev->width * dev->height * 2; + dev->field_size = dev->frame_size >> 1; /*both_fileds ? dev->frame_size>>1 : dev->frame_size; */ + dev->bytesperline = dev->width * 2; + dev->hscale = 0; + dev->vscale = 0; + + em2820_capture_start(dev, 1); + em2820_resolution_set(dev); + + /* start the transfer */ + errCode = em2820_init_isoc(dev); + if (errCode) + goto err; + + dev->users++; + filp->private_data = dev; + dev->io = IO_NONE; + dev->stream = STREAM_OFF; + dev->num_frames = 0; + + /* prepare queues */ + em2820_empty_framequeues(dev); + + dev->state |= DEV_INITIALIZED; + + err: + up(&dev->lock); + up_read(&em2820_disconnect); + return errCode; +} + +/* + * em2820_realease_resources() + * unregisters the v4l2,i2c and usb devices + * called when the device gets disconected or at module unload +*/ +static void em2820_release_resources(struct em2820 *dev) +{ + down(&em2820_sysfs_lock); + + em2820_info("V4L2 device /dev/video%d deregistered\n", + dev->vdev->minor); + video_set_drvdata(dev->vdev, NULL); + video_unregister_device(dev->vdev); +/* video_unregister_device(dev->vbi_dev); */ + em2820_i2c_unregister(dev); + usb_put_dev(dev->udev); + up(&em2820_sysfs_lock); +} + +/* + * em2820_v4l2_close() + * stops streaming and deallocates all resources allocated by the v4l2 calls and ioctls + */ +static int em2820_v4l2_close(struct inode *inode, struct file *file) +{ + struct video_device *vdev = video_devdata(file); + struct em2820 *dev = (struct em2820 *)video_get_drvdata(vdev); + int errCode; + + em2820_videodbg("users=%d", dev->users); + + down(&dev->lock); + + em2820_uninit_isoc(dev); + + em2820_release_buffers(dev); + + /* the device is already disconnect, free the remaining resources */ + if (dev->state & DEV_DISCONNECTED) { + em2820_release_resources(dev); + up(&dev->lock); + kfree(dev); + return 0; + } + + /* set alternate 0 */ + dev->alt = 0; + em2820_videodbg("setting alternate 0"); + errCode = usb_set_interface(dev->udev, 0, 0); + if (errCode < 0) { + em2820_errdev ("cannot change alternate number to 0 (error=%i)\n", + errCode); + } + + dev->users--; + wake_up_interruptible_nr(&dev->open, 1); + up(&dev->lock); + return 0; +} + +/* + * em2820_v4l2_read() + * will allocate buffers when called for the first time + */ +static ssize_t +em2820_v4l2_read(struct file *filp, char __user * buf, size_t count, + loff_t * f_pos) +{ + struct em2820 *dev = video_get_drvdata(video_devdata(filp)); + struct em2820_frame_t *f, *i; + unsigned long lock_flags; + int ret = 0; + + if (down_interruptible(&dev->fileop_lock)) + return -ERESTARTSYS; + + if (dev->state & DEV_DISCONNECTED) { + em2820_videodbg("device not present"); + up(&dev->fileop_lock); + return -ENODEV; + } + + if (dev->state & DEV_MISCONFIGURED) { + em2820_videodbg("device misconfigured; close and open it again"); + up(&dev->fileop_lock); + return -EIO; + } + + if (dev->io == IO_MMAP) { + em2820_videodbg ("IO method is set to mmap; close and open" + " the device again to choose the read method"); + up(&dev->fileop_lock); + return -EINVAL; + } + + if (dev->io == IO_NONE) { + if (!em2820_request_buffers(dev, EM2820_NUM_READ_FRAMES)) { + em2820_errdev("read failed, not enough memory\n"); + up(&dev->fileop_lock); + return -ENOMEM; + } + dev->io = IO_READ; + dev->stream = STREAM_ON; + em2820_queue_unusedframes(dev); + } + + if (!count) { + up(&dev->fileop_lock); + return 0; + } + + if (list_empty(&dev->outqueue)) { + if (filp->f_flags & O_NONBLOCK) { + up(&dev->fileop_lock); + return -EAGAIN; + } + ret = wait_event_interruptible + (dev->wait_frame, + (!list_empty(&dev->outqueue)) || + (dev->state & DEV_DISCONNECTED)); + if (ret) { + up(&dev->fileop_lock); + return ret; + } + if (dev->state & DEV_DISCONNECTED) { + up(&dev->fileop_lock); + return -ENODEV; + } + } + + f = list_entry(dev->outqueue.prev, struct em2820_frame_t, frame); + + spin_lock_irqsave(&dev->queue_lock, lock_flags); + list_for_each_entry(i, &dev->outqueue, frame) + i->state = F_UNUSED; + INIT_LIST_HEAD(&dev->outqueue); + spin_unlock_irqrestore(&dev->queue_lock, lock_flags); + + em2820_queue_unusedframes(dev); + + if (count > f->buf.length) + count = f->buf.length; + + if (copy_to_user(buf, f->bufmem, count)) { + up(&dev->fileop_lock); + return -EFAULT; + } + *f_pos += count; + + up(&dev->fileop_lock); + + return count; +} + +/* + * em2820_v4l2_poll() + * will allocate buffers when called for the first time + */ +static unsigned int em2820_v4l2_poll(struct file *filp, poll_table * wait) +{ + struct em2820 *dev = video_get_drvdata(video_devdata(filp)); + unsigned int mask = 0; + + if (down_interruptible(&dev->fileop_lock)) + return POLLERR; + + if (dev->state & DEV_DISCONNECTED) { + em2820_videodbg("device not present"); + } else if (dev->state & DEV_MISCONFIGURED) { + em2820_videodbg("device is misconfigured; close and open it again"); + } else { + if (dev->io == IO_NONE) { + if (!em2820_request_buffers + (dev, EM2820_NUM_READ_FRAMES)) { + em2820_warn + ("poll() failed, not enough memory\n"); + } else { + dev->io = IO_READ; + dev->stream = STREAM_ON; + } + } + + if (dev->io == IO_READ) { + em2820_queue_unusedframes(dev); + poll_wait(filp, &dev->wait_frame, wait); + + if (!list_empty(&dev->outqueue)) + mask |= POLLIN | POLLRDNORM; + + up(&dev->fileop_lock); + + return mask; + } + } + + up(&dev->fileop_lock); + return POLLERR; +} + +/* + * em2820_vm_open() + */ +static void em2820_vm_open(struct vm_area_struct *vma) +{ + struct em2820_frame_t *f = vma->vm_private_data; + f->vma_use_count++; +} + +/* + * em2820_vm_close() + */ +static void em2820_vm_close(struct vm_area_struct *vma) +{ + /* NOTE: buffers are not freed here */ + struct em2820_frame_t *f = vma->vm_private_data; + f->vma_use_count--; +} + +static struct vm_operations_struct em2820_vm_ops = { + .open = em2820_vm_open, + .close = em2820_vm_close, +}; + +/* + * em2820_v4l2_mmap() + */ +static int em2820_v4l2_mmap(struct file *filp, struct vm_area_struct *vma) +{ + struct em2820 *dev = video_get_drvdata(video_devdata(filp)); + unsigned long size = vma->vm_end - vma->vm_start, + start = vma->vm_start, pos, page; + u32 i; + if (down_interruptible(&dev->fileop_lock)) + return -ERESTARTSYS; + + if (dev->state & DEV_DISCONNECTED) { + em2820_videodbg("mmap: device not present"); + up(&dev->fileop_lock); + return -ENODEV; + } + + if (dev->state & DEV_MISCONFIGURED) { + em2820_videodbg ("mmap: Device is misconfigured; close and " + "open it again"); + up(&dev->fileop_lock); + return -EIO; + } + + if (dev->io != IO_MMAP || !(vma->vm_flags & VM_WRITE) || + size != PAGE_ALIGN(dev->frame[0].buf.length)) { + up(&dev->fileop_lock); + return -EINVAL; + } + + for (i = 0; i < dev->num_frames; i++) { + if ((dev->frame[i].buf.m.offset >> PAGE_SHIFT) == vma->vm_pgoff) + break; + } + if (i == dev->num_frames) { + em2820_videodbg("mmap: user supplied mapping address is out of range"); + up(&dev->fileop_lock); + return -EINVAL; + } + + /* VM_IO is eventually going to replace PageReserved altogether */ + vma->vm_flags |= VM_IO; + vma->vm_flags |= VM_RESERVED; /* avoid to swap out this VMA */ + + pos = (unsigned long)dev->frame[i].bufmem; + while (size > 0) { /* size is page-aligned */ + page = vmalloc_to_pfn((void *)pos); + if (remap_pfn_range(vma, start, page, PAGE_SIZE, + vma->vm_page_prot)) { + em2820_videodbg("mmap: rename page map failed"); + up(&dev->fileop_lock); + return -EAGAIN; + } + start += PAGE_SIZE; + pos += PAGE_SIZE; + size -= PAGE_SIZE; + } + + vma->vm_ops = &em2820_vm_ops; + vma->vm_private_data = &dev->frame[i]; + + em2820_vm_open(vma); + up(&dev->fileop_lock); + return 0; +} + +/* + * em2820_get_ctrl() + * return the current saturation, brightness or contrast, mute state + */ +static int em2820_get_ctrl(struct em2820 *dev, struct v4l2_control *ctrl) +{ + s32 tmp; + switch (ctrl->id) { + case V4L2_CID_AUDIO_MUTE: + ctrl->value = dev->mute; + return 0; + case V4L2_CID_AUDIO_VOLUME: + ctrl->value = dev->volume; + return 0; + case V4L2_CID_BRIGHTNESS: + if ((tmp = em2820_brightness_get(dev)) < 0) + return -EIO; + ctrl->value = (s32) ((s8) tmp); /* FIXME: clenaer way to extend sign? */ + return 0; + case V4L2_CID_CONTRAST: + if ((ctrl->value = em2820_contrast_get(dev)) < 0) + return -EIO; + return 0; + case V4L2_CID_SATURATION: + if ((ctrl->value = em2820_saturation_get(dev)) < 0) + return -EIO; + return 0; + case V4L2_CID_RED_BALANCE: + if ((tmp = em2820_v_balance_get(dev)) < 0) + return -EIO; + ctrl->value = (s32) ((s8) tmp); /* FIXME: clenaer way to extend sign? */ + return 0; + case V4L2_CID_BLUE_BALANCE: + if ((tmp = em2820_u_balance_get(dev)) < 0) + return -EIO; + ctrl->value = (s32) ((s8) tmp); /* FIXME: clenaer way to extend sign? */ + return 0; + case V4L2_CID_GAMMA: + if ((ctrl->value = em2820_gamma_get(dev)) < 0) + return -EIO; + return 0; + default: + return -EINVAL; + } +} + +/* + * em2820_set_ctrl() + * mute or set new saturation, brightness or contrast + */ +static int em2820_set_ctrl(struct em2820 *dev, const struct v4l2_control *ctrl) +{ + switch (ctrl->id) { + case V4L2_CID_AUDIO_MUTE: + if (ctrl->value != dev->mute) { + dev->mute = ctrl->value; + em2820_audio_usb_mute(dev, ctrl->value); + return em2820_audio_analog_set(dev); + } + return 0; + case V4L2_CID_AUDIO_VOLUME: + dev->volume = ctrl->value; + return em2820_audio_analog_set(dev); + case V4L2_CID_BRIGHTNESS: + return em2820_brightness_set(dev, ctrl->value); + case V4L2_CID_CONTRAST: + return em2820_contrast_set(dev, ctrl->value); + case V4L2_CID_SATURATION: + return em2820_saturation_set(dev, ctrl->value); + case V4L2_CID_RED_BALANCE: + return em2820_v_balance_set(dev, ctrl->value); + case V4L2_CID_BLUE_BALANCE: + return em2820_u_balance_set(dev, ctrl->value); + case V4L2_CID_GAMMA: + return em2820_gamma_set(dev, ctrl->value); + default: + return -EINVAL; + } +} + +/* + * em2820_stream_interrupt() + * stops streaming + */ +static int em2820_stream_interrupt(struct em2820 *dev) +{ + int ret = 0; + + /* stop reading from the device */ + + dev->stream = STREAM_INTERRUPT; + ret = wait_event_timeout(dev->wait_stream, + (dev->stream == STREAM_OFF) || + (dev->state & DEV_DISCONNECTED), + EM2820_URB_TIMEOUT); + if (dev->state & DEV_DISCONNECTED) + return -ENODEV; + else if (ret) { + dev->state |= DEV_MISCONFIGURED; + em2820_videodbg("device is misconfigured; close and " + "open /dev/video%d again", dev->vdev->minor); + return ret; + } + + return 0; +} + +static int em2820_set_norm(struct em2820 *dev, int width, int height) +{ + unsigned int hscale, vscale; + unsigned int maxh, maxw; + + maxw = norm_maxw(dev); + maxh = norm_maxh(dev); + + /* width must even because of the YUYV format */ + /* height must be even because of interlacing */ + height &= 0xfffe; + width &= 0xfffe; + + if (height < 32) + height = 32; + if (height > maxh) + height = maxh; + if (width < 48) + width = 48; + if (width > maxw) + width = maxw; + + if ((hscale = (((unsigned long)maxw) << 12) / width - 4096L) >= 0x4000) + hscale = 0x3fff; + width = (((unsigned long)maxw) << 12) / (hscale + 4096L); + + if ((vscale = (((unsigned long)maxh) << 12) / height - 4096L) >= 0x4000) + vscale = 0x3fff; + height = (((unsigned long)maxh) << 12) / (vscale + 4096L); + + /* set new image size */ + dev->width = width; + dev->height = height; + dev->frame_size = dev->width * dev->height * 2; + dev->field_size = dev->frame_size >> 1; /*both_fileds ? dev->frame_size>>1 : dev->frame_size; */ + dev->bytesperline = dev->width * 2; + dev->hscale = hscale; + dev->vscale = vscale; + + em2820_resolution_set(dev); + + return 0; +} + +static void video_mux(struct em2820 *dev, int index) +{ + int input, ainput; + + input = INPUT(index)->vmux; + dev->ctl_input = index; + + em2820_i2c_call_clients(dev, DECODER_SET_INPUT, &input); + + dev->ctl_ainput = INPUT(index)->amux; + + switch (dev->ctl_ainput) { + case 0: + ainput = EM2820_AUDIO_SRC_TUNER; + break; + default: + ainput = EM2820_AUDIO_SRC_LINE; + } + + em2820_audio_source(dev, ainput); +} + +/* + * em2820_v4l2_do_ioctl() + * This function is _not_ called directly, but from + * em2820_v4l2_ioctl. Userspace + * copying is done already, arg is a kernel pointer. + */ +static int em2820_do_ioctl(struct inode *inode, struct file *filp, + struct em2820 *dev, unsigned int cmd, void *arg, + v4l2_kioctl driver_ioctl) +{ + int ret; + + switch (cmd) { + /* ---------- tv norms ---------- */ + case VIDIOC_ENUMSTD: + { + struct v4l2_standard *e = arg; + unsigned int i; + + i = e->index; + if (i >= TVNORMS) + return -EINVAL; + ret = v4l2_video_std_construct(e, tvnorms[e->index].id, + tvnorms[e->index].name); + e->index = i; + if (ret < 0) + return ret; + return 0; + } + case VIDIOC_G_STD: + { + v4l2_std_id *id = arg; + + *id = dev->tvnorm->id; + return 0; + } + case VIDIOC_S_STD: + { + v4l2_std_id *id = arg; + unsigned int i; + + for (i = 0; i < TVNORMS; i++) + if (*id == tvnorms[i].id) + break; + if (i == TVNORMS) + for (i = 0; i < TVNORMS; i++) + if (*id & tvnorms[i].id) + break; + if (i == TVNORMS) + return -EINVAL; + + down(&dev->lock); + dev->tvnorm = &tvnorms[i]; + + em2820_set_norm(dev, dev->width, dev->height); + +/* + dev->width=norm_maxw(dev); + dev->height=norm_maxh(dev); + dev->frame_size=dev->width*dev->height*2; + dev->field_size=dev->frame_size>>1; + dev->bytesperline=dev->width*2; + dev->hscale=0; + dev->vscale=0; + + em2820_resolution_set(dev); +*/ +/* + em2820_uninit_isoc(dev); + em2820_set_alternate(dev); + em2820_capture_start(dev, 1); + em2820_resolution_set(dev); + em2820_init_isoc(dev); +*/ + em2820_i2c_call_clients(dev, DECODER_SET_NORM, + &tvnorms[i].mode); + em2820_i2c_call_clients(dev, VIDIOC_S_STD, + &dev->tvnorm->id); + + up(&dev->lock); + + return 0; + } + + /* ------ input switching ---------- */ + case VIDIOC_ENUMINPUT: + { + struct v4l2_input *i = arg; + unsigned int n; + static const char *iname[] = { + [EM2820_VMUX_COMPOSITE1] = "Composite1", + [EM2820_VMUX_COMPOSITE2] = "Composite2", + [EM2820_VMUX_COMPOSITE3] = "Composite3", + [EM2820_VMUX_COMPOSITE4] = "Composite4", + [EM2820_VMUX_SVIDEO] = "S-Video", + [EM2820_VMUX_TELEVISION] = "Television", + [EM2820_VMUX_CABLE] = "Cable TV", + [EM2820_VMUX_DVB] = "DVB", + [EM2820_VMUX_DEBUG] = "for debug only", + }; + + n = i->index; + if (n >= MAX_EM2820_INPUT) + return -EINVAL; + if (0 == INPUT(n)->type) + return -EINVAL; + memset(i, 0, sizeof(*i)); + i->index = n; + i->type = V4L2_INPUT_TYPE_CAMERA; + strcpy(i->name, iname[INPUT(n)->type]); + if ((EM2820_VMUX_TELEVISION == INPUT(n)->type) || + (EM2820_VMUX_CABLE == INPUT(n)->type)) + i->type = V4L2_INPUT_TYPE_TUNER; + for (n = 0; n < ARRAY_SIZE(tvnorms); n++) + i->std |= tvnorms[n].id; + return 0; + } + + case VIDIOC_G_INPUT: + { + int *i = arg; + *i = dev->ctl_input; + + return 0; + } + + case VIDIOC_S_INPUT: + { + int *index = arg; + + if (*index >= MAX_EM2820_INPUT) + return -EINVAL; + if (0 == INPUT(*index)->type) + return -EINVAL; + + down(&dev->lock); + video_mux(dev, *index); + up(&dev->lock); + + return 0; + } + + case VIDIOC_G_AUDIO: + { + struct v4l2_audio *a = arg; + unsigned int index = a->index; + + if (a->index > 1) + return -EINVAL; + memset(a, 0, sizeof(*a)); + index = dev->ctl_ainput; + + if (index == 0) { + strcpy(a->name, "Television"); + } else { + strcpy(a->name, "Line In"); + } + a->capability = V4L2_AUDCAP_STEREO; + a->index = index; + return 0; + } + + case VIDIOC_S_AUDIO: + { + struct v4l2_audio *a = arg; + if (a->index != dev->ctl_ainput) + return -EINVAL; + + return 0; + } + + /* --- controls ---------------------------------------------- */ + case VIDIOC_QUERYCTRL: + { + struct v4l2_queryctrl *qc = arg; + u8 i, n; + n = sizeof(em2820_qctrl) / sizeof(em2820_qctrl[0]); + for (i = 0; i < n; i++) + if (qc->id && qc->id == em2820_qctrl[i].id) { + memcpy(qc, &(em2820_qctrl[i]), + sizeof(*qc)); + return 0; + } + + return -EINVAL; + } + + case VIDIOC_G_CTRL: + { + struct v4l2_control *ctrl = arg; + + + return em2820_get_ctrl(dev, ctrl); + } + + case VIDIOC_S_CTRL_OLD: /* ??? */ + case VIDIOC_S_CTRL: + { + struct v4l2_control *ctrl = arg; + u8 i, n; + + + n = sizeof(em2820_qctrl) / sizeof(em2820_qctrl[0]); + for (i = 0; i < n; i++) + if (ctrl->id == em2820_qctrl[i].id) { + if (ctrl->value < + em2820_qctrl[i].minimum + || ctrl->value > + em2820_qctrl[i].maximum) + return -ERANGE; + + return em2820_set_ctrl(dev, ctrl); + } + return -EINVAL; + } + + /* --- tuner ioctls ------------------------------------------ */ + case VIDIOC_G_TUNER: + { + struct v4l2_tuner *t = arg; + int status = 0; + + if (0 != t->index) + return -EINVAL; + + memset(t, 0, sizeof(*t)); + strcpy(t->name, "Tuner"); + t->type = V4L2_TUNER_ANALOG_TV; + t->capability = V4L2_TUNER_CAP_NORM; + t->rangehigh = 0xffffffffUL; /* FIXME: set correct range */ +/* t->signal = 0xffff;*/ +/* em2820_i2c_call_clients(dev,VIDIOC_G_TUNER,t);*/ + /* No way to get signal strength? */ + down(&dev->lock); + em2820_i2c_call_clients(dev, DECODER_GET_STATUS, + &status); + up(&dev->lock); + t->signal = + (status & DECODER_STATUS_GOOD) != 0 ? 0xffff : 0; + + em2820_videodbg("VIDIO_G_TUNER: signal=%x, afc=%x", t->signal, + t->afc); + return 0; + } + case VIDIOC_S_TUNER: + { + struct v4l2_tuner *t = arg; + int status = 0; + + if (0 != t->index) + return -EINVAL; + memset(t, 0, sizeof(*t)); + strcpy(t->name, "Tuner"); + t->type = V4L2_TUNER_ANALOG_TV; + t->capability = V4L2_TUNER_CAP_NORM; + t->rangehigh = 0xffffffffUL; /* FIXME: set correct range */ +/* t->signal = 0xffff; */ + /* No way to get signal strength? */ + down(&dev->lock); + em2820_i2c_call_clients(dev, DECODER_GET_STATUS, + &status); + up(&dev->lock); + t->signal = + (status & DECODER_STATUS_GOOD) != 0 ? 0xffff : 0; + + em2820_videodbg("VIDIO_S_TUNER: signal=%x, afc=%x\n", + t->signal, t->afc); + return 0; + } + case VIDIOC_G_FREQUENCY: + { + struct v4l2_frequency *f = arg; + + memset(f, 0, sizeof(*f)); + f->type = V4L2_TUNER_ANALOG_TV; + f->frequency = dev->ctl_freq; + + return 0; + } + case VIDIOC_S_FREQUENCY: + { + struct v4l2_frequency *f = arg; + + if (0 != f->tuner) + return -EINVAL; + + if (V4L2_TUNER_ANALOG_TV != f->type) + return -EINVAL; + + down(&dev->lock); + dev->ctl_freq = f->frequency; + em2820_i2c_call_clients(dev, VIDIOC_S_FREQUENCY, f); + up(&dev->lock); + return 0; + } + + case VIDIOC_CROPCAP: + { + struct v4l2_cropcap *cc = arg; + + if (cc->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + return EINVAL; + cc->bounds.left = 0; + cc->bounds.top = 0; + cc->bounds.width = dev->width; + cc->bounds.height = dev->height; + cc->defrect = cc->bounds; + cc->pixelaspect.numerator = 54; /* 4:3 FIXME: remove magic numbers */ + cc->pixelaspect.denominator = 59; + return 0; + } + case VIDIOC_STREAMON: + { + int *type = arg; + + if (*type != V4L2_BUF_TYPE_VIDEO_CAPTURE + || dev->io != IO_MMAP) + return -EINVAL; + + if (list_empty(&dev->inqueue)) + return -EINVAL; + + dev->stream = STREAM_ON; /* FIXME: Start video capture here? */ + + em2820_videodbg("VIDIOC_STREAMON: starting stream"); + + return 0; + } + case VIDIOC_STREAMOFF: + { + int *type = arg; + int ret; + + if (*type != V4L2_BUF_TYPE_VIDEO_CAPTURE + || dev->io != IO_MMAP) + return -EINVAL; + + if (dev->stream == STREAM_ON) { + em2820_videodbg ("VIDIOC_STREAMOFF: interrupting stream"); + if ((ret = em2820_stream_interrupt(dev))) + return ret; + } + em2820_empty_framequeues(dev); + + return 0; + } + default: + return v4l_compat_translate_ioctl(inode, filp, cmd, arg, + driver_ioctl); + } + return 0; +} + +/* + * em2820_v4l2_do_ioctl() + * This function is _not_ called directly, but from + * em2820_v4l2_ioctl. Userspace + * copying is done already, arg is a kernel pointer. + */ +static int em2820_video_do_ioctl(struct inode *inode, struct file *filp, + unsigned int cmd, void *arg) +{ + struct em2820 *dev = filp->private_data; + + if (!dev) + return -ENODEV; + + if (video_debug > 1) + em2820_print_ioctl(dev->name,cmd); + + switch (cmd) { + + /* --- capabilities ------------------------------------------ */ + case VIDIOC_QUERYCAP: + { + struct v4l2_capability *cap = arg; + + memset(cap, 0, sizeof(*cap)); + strlcpy(cap->driver, "em2820", sizeof(cap->driver)); + strlcpy(cap->card, em2820_boards[dev->model].name, + sizeof(cap->card)); + strlcpy(cap->bus_info, dev->udev->dev.bus_id, + sizeof(cap->bus_info)); + cap->version = EM2820_VERSION_CODE; + cap->capabilities = + V4L2_CAP_VIDEO_CAPTURE | + V4L2_CAP_AUDIO | + V4L2_CAP_READWRITE | V4L2_CAP_STREAMING; + if (dev->has_tuner) + cap->capabilities |= V4L2_CAP_TUNER; + return 0; + } + + /* --- capture ioctls ---------------------------------------- */ + case VIDIOC_ENUM_FMT: + { + struct v4l2_fmtdesc *fmtd = arg; + + if (fmtd->index != 0) + return -EINVAL; + memset(fmtd, 0, sizeof(*fmtd)); + fmtd->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + strcpy(fmtd->description, "Packed YUY2"); + fmtd->pixelformat = V4L2_PIX_FMT_YUYV; + memset(fmtd->reserved, 0, sizeof(fmtd->reserved)); + return 0; + } + + case VIDIOC_G_FMT: + { + struct v4l2_format *format = arg; + + em2820_videodbg("VIDIOC_G_FMT: type=%s", + format->type == + V4L2_BUF_TYPE_VIDEO_CAPTURE ? + "V4L2_BUF_TYPE_VIDEO_CAPTURE" : format->type == + V4L2_BUF_TYPE_VBI_CAPTURE ? + "V4L2_BUF_TYPE_VBI_CAPTURE " : + "not supported"); + + if (format->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + + format->fmt.pix.width = dev->width; + format->fmt.pix.height = dev->height; + format->fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV; + format->fmt.pix.bytesperline = dev->bytesperline; + format->fmt.pix.sizeimage = dev->frame_size; + format->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; + format->fmt.pix.field = dev->interlaced ? V4L2_FIELD_INTERLACED : V4L2_FIELD_TOP; /* FIXME: TOP? NONE? BOTTOM? ALTENATE? */ + + em2820_videodbg("VIDIOC_G_FMT: %dx%d", dev->width, + dev->height); + return 0; + } + + case VIDIOC_TRY_FMT: + case VIDIOC_S_FMT: + { + struct v4l2_format *format = arg; + u32 i; + int ret = 0; + int width = format->fmt.pix.width; + int height = format->fmt.pix.height; + unsigned int hscale, vscale; + unsigned int maxh, maxw; + + maxw = norm_maxw(dev); + maxh = norm_maxh(dev); + +/* int both_fields; */ + + em2820_videodbg("%s: type=%s", + cmd == + VIDIOC_TRY_FMT ? "VIDIOC_TRY_FMT" : + "VIDIOC_S_FMT", + format->type == + V4L2_BUF_TYPE_VIDEO_CAPTURE ? + "V4L2_BUF_TYPE_VIDEO_CAPTURE" : format->type == + V4L2_BUF_TYPE_VBI_CAPTURE ? + "V4L2_BUF_TYPE_VBI_CAPTURE " : + "not supported"); + + if (format->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + + em2820_videodbg("%s: requested %dx%d", + cmd == + VIDIOC_TRY_FMT ? "VIDIOC_TRY_FMT" : + "VIDIOC_S_FMT", format->fmt.pix.width, + format->fmt.pix.height); + + /* FIXME: Move some code away from here */ + /* width must even because of the YUYV format */ + /* height must be even because of interlacing */ + height &= 0xfffe; + width &= 0xfffe; + + if (height < 32) + height = 32; + if (height > maxh) + height = maxh; + if (width < 48) + width = 48; + if (width > maxw) + width = maxw; + + if ((hscale = + (((unsigned long)maxw) << 12) / width - 4096L) >= + 0x4000) + hscale = 0x3fff; + width = + (((unsigned long)maxw) << 12) / (hscale + 4096L); + + if ((vscale = + (((unsigned long)maxh) << 12) / height - 4096L) >= + 0x4000) + vscale = 0x3fff; + height = + (((unsigned long)maxh) << 12) / (vscale + 4096L); + + format->fmt.pix.width = width; + format->fmt.pix.height = height; + format->fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV; + format->fmt.pix.bytesperline = width * 2; + format->fmt.pix.sizeimage = width * 2 * height; + format->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; + format->fmt.pix.field = V4L2_FIELD_INTERLACED; + + em2820_videodbg("%s: returned %dx%d (%d, %d)", + cmd == + VIDIOC_TRY_FMT ? "VIDIOC_TRY_FMT" : + "VIDIOC_S_FMT", format->fmt.pix.width, + format->fmt.pix.height, hscale, vscale); + + if (cmd == VIDIOC_TRY_FMT) + return 0; + + for (i = 0; i < dev->num_frames; i++) + if (dev->frame[i].vma_use_count) { + em2820_videodbg("VIDIOC_S_FMT failed. " + "Unmap the buffers first."); + return -EINVAL; + } + + /* stop io in case it is already in progress */ + if (dev->stream == STREAM_ON) { + em2820_videodbg("VIDIOC_SET_FMT: interupting stream"); + if ((ret = em2820_stream_interrupt(dev))) + return ret; + } + + em2820_release_buffers(dev); + dev->io = IO_NONE; + + /* set new image size */ + dev->width = width; + dev->height = height; + dev->frame_size = dev->width * dev->height * 2; + dev->field_size = dev->frame_size >> 1; /*both_fileds ? dev->frame_size>>1 : dev->frame_size; */ + dev->bytesperline = dev->width * 2; + dev->hscale = hscale; + dev->vscale = vscale; +/* dev->both_fileds = both_fileds; */ + em2820_uninit_isoc(dev); + em2820_set_alternate(dev); + em2820_capture_start(dev, 1); + em2820_resolution_set(dev); + em2820_init_isoc(dev); + + return 0; + } + + /* --- streaming capture ------------------------------------- */ + case VIDIOC_REQBUFS: + { + struct v4l2_requestbuffers *rb = arg; + u32 i; + int ret; + + if (rb->type != V4L2_BUF_TYPE_VIDEO_CAPTURE || + rb->memory != V4L2_MEMORY_MMAP) + return -EINVAL; + + if (dev->io == IO_READ) { + em2820_videodbg ("method is set to read;" + " close and open the device again to" + " choose the mmap I/O method"); + return -EINVAL; + } + + for (i = 0; i < dev->num_frames; i++) + if (dev->frame[i].vma_use_count) { + em2820_videodbg ("VIDIOC_REQBUFS failed; previous buffers are still mapped"); + return -EINVAL; + } + + if (dev->stream == STREAM_ON) { + em2820_videodbg("VIDIOC_REQBUFS: interrupting stream"); + if ((ret = em2820_stream_interrupt(dev))) + return ret; + } + + em2820_empty_framequeues(dev); + + em2820_release_buffers(dev); + if (rb->count) + rb->count = + em2820_request_buffers(dev, rb->count); + + dev->frame_current = NULL; + + em2820_videodbg ("VIDIOC_REQBUFS: setting io method to mmap: num bufs %i", + rb->count); + dev->io = rb->count ? IO_MMAP : IO_NONE; + return 0; + } + + case VIDIOC_QUERYBUF: + { + struct v4l2_buffer *b = arg; + + if (b->type != V4L2_BUF_TYPE_VIDEO_CAPTURE || + b->index >= dev->num_frames || dev->io != IO_MMAP) + return -EINVAL; + + memcpy(b, &dev->frame[b->index].buf, sizeof(*b)); + + if (dev->frame[b->index].vma_use_count) { + b->flags |= V4L2_BUF_FLAG_MAPPED; + } + if (dev->frame[b->index].state == F_DONE) + b->flags |= V4L2_BUF_FLAG_DONE; + else if (dev->frame[b->index].state != F_UNUSED) + b->flags |= V4L2_BUF_FLAG_QUEUED; + return 0; + } + case VIDIOC_QBUF: + { + struct v4l2_buffer *b = arg; + unsigned long lock_flags; + + if (b->type != V4L2_BUF_TYPE_VIDEO_CAPTURE || + b->index >= dev->num_frames || dev->io != IO_MMAP) { + return -EINVAL; + } + + if (dev->frame[b->index].state != F_UNUSED) { + return -EAGAIN; + } + dev->frame[b->index].state = F_QUEUED; + + /* add frame to fifo */ + spin_lock_irqsave(&dev->queue_lock, lock_flags); + list_add_tail(&dev->frame[b->index].frame, + &dev->inqueue); + spin_unlock_irqrestore(&dev->queue_lock, lock_flags); + + return 0; + } + case VIDIOC_DQBUF: + { + struct v4l2_buffer *b = arg; + struct em2820_frame_t *f; + unsigned long lock_flags; + int ret = 0; + + if (b->type != V4L2_BUF_TYPE_VIDEO_CAPTURE + || dev->io != IO_MMAP) + return -EINVAL; + + if (list_empty(&dev->outqueue)) { + if (dev->stream == STREAM_OFF) + return -EINVAL; + if (filp->f_flags & O_NONBLOCK) + return -EAGAIN; + ret = wait_event_interruptible + (dev->wait_frame, + (!list_empty(&dev->outqueue)) || + (dev->state & DEV_DISCONNECTED)); + if (ret) + return ret; + if (dev->state & DEV_DISCONNECTED) + return -ENODEV; + } + + spin_lock_irqsave(&dev->queue_lock, lock_flags); + f = list_entry(dev->outqueue.next, + struct em2820_frame_t, frame); + list_del(dev->outqueue.next); + spin_unlock_irqrestore(&dev->queue_lock, lock_flags); + + f->state = F_UNUSED; + memcpy(b, &f->buf, sizeof(*b)); + + if (f->vma_use_count) + b->flags |= V4L2_BUF_FLAG_MAPPED; + + return 0; + } + default: + return em2820_do_ioctl(inode, filp, dev, cmd, arg, + em2820_video_do_ioctl); + } + return 0; +} + +/* + * em2820_v4l2_ioctl() + * handle v4l2 ioctl the main action happens in em2820_v4l2_do_ioctl() + */ +static int em2820_v4l2_ioctl(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + struct em2820 *dev = video_get_drvdata(video_devdata(filp)); + int ret = 0; + + if (down_interruptible(&dev->fileop_lock)) + return -ERESTARTSYS; + + if (dev->state & DEV_DISCONNECTED) { + em2820_errdev("v4l2 ioctl: device not present\n"); + up(&dev->fileop_lock); + return -ENODEV; + } + + if (dev->state & DEV_MISCONFIGURED) { + em2820_errdev + ("v4l2 ioctl: device is misconfigured; close and open it again\n"); + up(&dev->fileop_lock); + return -EIO; + } + + ret = video_usercopy(inode, filp, cmd, arg, em2820_video_do_ioctl); + + up(&dev->fileop_lock); + + return ret; +} + +static struct file_operations em2820_v4l_fops = { + .owner = THIS_MODULE, + .open = em2820_v4l2_open, + .release = em2820_v4l2_close, + .ioctl = em2820_v4l2_ioctl, + .read = em2820_v4l2_read, + .poll = em2820_v4l2_poll, + .mmap = em2820_v4l2_mmap, + .llseek = no_llseek, +}; + +/******************************** usb interface *****************************************/ + +/* + * em2820_init_dev() + * allocates and inits the device structs, registers i2c bus and v4l device + */ +static int em2820_init_dev(struct em2820 **devhandle, struct usb_device *udev, + int minor, int model) +{ + struct em2820 *dev; + int retval = -ENOMEM; + int errCode, i; + unsigned int maxh, maxw; + struct usb_interface *uif; + + /* allocate memory for our device state and initialize it */ + dev = kmalloc(sizeof(*dev), GFP_KERNEL); + if (dev == NULL) { + em2820_err(DRIVER_NAME ": out of memory!\n"); + return -ENOMEM; + } + memset(dev, 0x00, sizeof(*dev)); + + snprintf(dev->name, 29, "em2820 #%d", minor); + dev->udev = udev; + dev->model = model; + init_MUTEX(&dev->lock); + init_waitqueue_head(&dev->open); + + dev->em2820_write_regs = em2820_write_regs; + dev->em2820_read_reg = em2820_read_reg; + dev->em2820_read_reg_req_len = em2820_read_reg_req_len; + dev->em2820_write_regs_req = em2820_write_regs_req; + dev->em2820_read_reg_req = em2820_read_reg_req; + dev->has_tuner = em2820_boards[model].has_tuner; + dev->has_msp34xx = em2820_boards[model].has_msp34xx; + dev->tda9887_conf = em2820_boards[model].tda9887_conf; + dev->decoder = em2820_boards[model].decoder; + + if (tuner >= 0) + dev->tuner_type = tuner; + else + dev->tuner_type = em2820_boards[model].tuner_type; + + dev->video_inputs = em2820_boards[model].vchannels; + + for (i = 0; i < TVNORMS; i++) + if (em2820_boards[model].norm == tvnorms[i].mode) + break; + if (i == TVNORMS) + i = 0; + + dev->tvnorm = &tvnorms[i]; /* set default norm */ + + em2820_videodbg("tvnorm=%s\n", dev->tvnorm->name); + + maxw = norm_maxw(dev); + maxh = norm_maxh(dev); + + /* set default image size */ + dev->width = maxw; + dev->height = maxh; + dev->interlaced = EM2820_INTERLACED_DEFAULT; + dev->field_size = dev->width * dev->height; + dev->frame_size = + dev->interlaced ? dev->field_size << 1 : dev->field_size; + dev->bytesperline = dev->width * 2; + dev->hscale = 0; + dev->vscale = 0; + dev->ctl_input = 2; + + /* setup video picture settings for saa7113h */ + memset(&dev->vpic, 0, sizeof(dev->vpic)); + dev->vpic.colour = 128 << 8; + dev->vpic.hue = 128 << 8; + dev->vpic.brightness = 128 << 8; + dev->vpic.contrast = 192 << 8; + dev->vpic.whiteness = 128 << 8; /* This one isn't used */ + dev->vpic.depth = 16; + dev->vpic.palette = VIDEO_PALETTE_YUV422; + + /* compute alternate max packet sizes */ + uif = dev->udev->actconfig->interface[0]; + dev->alt_max_pkt_size[0] = 0; + for (i = 1; i <= EM2820_MAX_ALT; i++) { + u16 tmp = + le16_to_cpu(uif->altsetting[i].endpoint[1].desc. + wMaxPacketSize); + dev->alt_max_pkt_size[i] = + (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1); + } + +#ifdef CONFIG_MODULES + /* request some modules */ + if (dev->decoder == EM2820_SAA7113) + request_module("saa7113"); + if (dev->decoder == EM2820_SAA7114) + request_module("saa7114"); + if (dev->decoder == EM2820_TVP5150) + request_module("tvp5150"); + if (dev->has_tuner) + request_module("tuner"); + if (dev->tda9887_conf) + request_module("tda9887"); +#endif + errCode = em2820_config(dev); + if (errCode) { + em2820_errdev("error configuring device\n"); + kfree(dev); + return -ENOMEM; + } + + down(&dev->lock); + /* register i2c bus */ + em2820_i2c_register(dev); + + /* Do board specific init and eeprom reading */ + em2820_card_setup(dev); + + /* configure the device */ + em2820_config_i2c(dev); + + up(&dev->lock); + + errCode = em2820_config(dev); + +#ifdef CONFIG_MODULES + if (dev->has_msp34xx) + request_module("msp3400"); +#endif + /* allocate and fill v4l2 device struct */ + dev->vdev = video_device_alloc(); + if (NULL == dev->vdev) { + em2820_errdev("cannot allocate video_device.\n"); + kfree(dev); + return -ENOMEM; + } + + dev->vdev->owner = THIS_MODULE; + dev->vdev->type = VID_TYPE_CAPTURE; + if (dev->has_tuner) + dev->vdev->type |= VID_TYPE_TUNER; + dev->vdev->hardware = 0; + dev->vdev->fops = &em2820_v4l_fops; + dev->vdev->minor = -1; + dev->vdev->dev = &dev->udev->dev; + dev->vdev->release = video_device_release; + snprintf(dev->vdev->name, sizeof(dev->vdev->name), "%s", + "em2820 video"); + video_set_drvdata(dev->vdev, dev); + + /* register v4l2 device */ + down(&dev->lock); + if ((retval = video_register_device(dev->vdev, VFL_TYPE_GRABBER, -1))) { + em2820_errdev("unable to register video device (error=%i).\n", + retval); + up(&dev->lock); + video_set_drvdata(dev->vdev, NULL); + video_device_release(dev->vdev); + kfree(dev); + return -ENODEV; + } + if (dev->has_msp34xx) { + /* Send a reset to other chips via gpio */ + em2820_write_regs_req(dev, 0x00, 0x08, "\xf7", 1); + udelay(2500); + em2820_write_regs_req(dev, 0x00, 0x08, "\xff", 1); + udelay(2500); + + } + video_mux(dev, 0); + + up(&dev->lock); + + em2820_info("V4L2 device registered as /dev/video%d\n", + dev->vdev->minor); + + *devhandle = dev; + return 0; +} + +/* + * em2820_usb_probe() + * checks for supported devices + */ +static int em2820_usb_probe(struct usb_interface *interface, + const struct usb_device_id *id) +{ + const struct usb_endpoint_descriptor *endpoint; + struct usb_device *udev; + struct em2820 *dev = NULL; + int retval = -ENODEV; + + udev = usb_get_dev(interface_to_usbdev(interface)); + endpoint = &interface->cur_altsetting->endpoint[1].desc; + + /* check if the the device has the iso in endpoint at the correct place */ + if ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != + USB_ENDPOINT_XFER_ISOC) { +/* em2820_err(DRIVER_NAME " probing error: endpoint is non-ISO endpoint!\n"); */ + return -ENODEV; + } + if ((endpoint->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT) { +/* em2820_err(DRIVER_NAME " probing error: endpoint is ISO OUT endpoint!\n"); */ + return -ENODEV; + } + + /* allocate device struct */ + retval = em2820_init_dev(&dev, udev, interface->minor, id->driver_info); + if (retval) + return retval; + + em2820_info("Found %s\n", em2820_boards[id->driver_info].name); + + /* save our data pointer in this interface device */ + usb_set_intfdata(interface, dev); + return 0; +} + +/* + * em2820_usb_disconnect() + * called when the device gets diconencted + * video device will be unregistered on v4l2_close in case it is still open + */ +static void em2820_usb_disconnect(struct usb_interface *interface) +{ + struct em2820 *dev = usb_get_intfdata(interface); + usb_set_intfdata(interface, NULL); + + if (!dev) + return; + + down_write(&em2820_disconnect); + + down(&dev->lock); + + em2820_info("disconnecting %s\n", dev->vdev->name); + + wake_up_interruptible_all(&dev->open); + + if (dev->users) { + em2820_warn + ("device /dev/video%d is open! Deregistration and memory " + "deallocation are deferred on close.\n", dev->vdev->minor); + dev->state |= DEV_MISCONFIGURED; + em2820_uninit_isoc(dev); + dev->state |= DEV_DISCONNECTED; + wake_up_interruptible(&dev->wait_frame); + wake_up_interruptible(&dev->wait_stream); + } else { + dev->state |= DEV_DISCONNECTED; + em2820_release_resources(dev); + } + + up(&dev->lock); + + if (!dev->users) + kfree(dev); + + up_write(&em2820_disconnect); + +} + +static struct usb_driver em2820_usb_driver = { + .owner = THIS_MODULE, + .name = "em2820", + .probe = em2820_usb_probe, + .disconnect = em2820_usb_disconnect, + .id_table = em2820_id_table, +}; + +static int __init em2820_module_init(void) +{ + int result; + + printk(KERN_INFO DRIVER_NAME " v4l2 driver version %d.%d.%d loaded\n", + (EM2820_VERSION_CODE >> 16) & 0xff, + (EM2820_VERSION_CODE >> 8) & 0xff, EM2820_VERSION_CODE & 0xff); +#ifdef SNAPSHOT + printk(KERN_INFO DRIVER_NAME " snapshot date %04d-%02d-%02d\n", + SNAPSHOT / 10000, (SNAPSHOT / 100) % 100, SNAPSHOT % 100); +#endif + + /* register this driver with the USB subsystem */ + result = usb_register(&em2820_usb_driver); + if (result) + em2820_err(DRIVER_NAME + " usb_register failed. Error number %d.\n", result); + + return result; +} + +static void __exit em2820_module_exit(void) +{ + /* deregister this driver with the USB subsystem */ + usb_deregister(&em2820_usb_driver); +} + +module_init(em2820_module_init); +module_exit(em2820_module_exit); diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h new file mode 100644 index 000000000000..7779121a3dea --- /dev/null +++ b/drivers/media/video/em28xx/em28xx.h @@ -0,0 +1,479 @@ +/* + em2820-cards.c - driver for Empia EM2820/2840 USB video capture devices + + Copyright (C) 2005 Markus Rechberger + Ludovico Cavedon + Mauro Carvalho Chehab + + Based on the em2800 driver from Sascha Sommer + + 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. + */ + +#ifndef _EM2820_H +#define _EM2820_H + +#include +#include + +/* maximum number of frames that can be queued */ +#define EM2820_NUM_FRAMES 5 +/* number of frames that get used for v4l2_read() */ +#define EM2820_NUM_READ_FRAMES 2 + +/* number of buffers for isoc transfers */ +#define EM2820_NUM_BUFS 5 + +/* number of packets for each buffer */ +// windows requests only 40 packets .. so we better do the same +// this is what I found out for all alternate numbers there! + +#define EM2820_NUM_PACKETS 40 + +/* packet size for each packet */ +/* no longer needed: read from endpoint descriptor */ +//#define EM2820_MAX_PACKET_SIZE 3072 //7 +//#define EM2820_MAX_PACKET_SIZE 2892 //6 +//#define EM2820_MAX_PACKET_SIZE 2580 //5 +//#define EM2820_MAX_PACKET_SIZE 1448 //2 + +/* default alternate; 0 means choose the best */ +#define EM2820_PINOUT 0 +#define EM2820_MAX_ALT 7 + +#define EM2820_INTERLACED_DEFAULT 1 + +/* +#define (use usbview if you want to get the other alternate number infos) +#define +#define alternate number 2 +#define Endpoint Address: 82 + Direction: in + Attribute: 1 + Type: Isoc + Max Packet Size: 1448 + Interval: 125us + + alternate number 7 + + Endpoint Address: 82 + Direction: in + Attribute: 1 + Type: Isoc + Max Packet Size: 3072 + Interval: 125us +*/ + +/* time to wait when stopping the isoc transfer */ +#define EM2820_URB_TIMEOUT msecs_to_jiffies(EM2820_NUM_BUFS * EM2820_NUM_PACKETS) + +/* the various frame states */ +enum em2820_frame_state { + F_UNUSED = 0, + F_QUEUED, + F_GRABBING, + F_DONE, + F_ERROR, +}; + +/* stream states */ +enum em2820_stream_state { + STREAM_OFF, + STREAM_INTERRUPT, + STREAM_ON, +}; + +/* frames */ +struct em2820_frame_t { + void *bufmem; + struct v4l2_buffer buf; + enum em2820_frame_state state; + struct list_head frame; + unsigned long vma_use_count; + int top_field; + int fieldbytesused; +}; + +/* io methods */ +enum em2820_io_method { + IO_NONE, + IO_READ, + IO_MMAP, +}; + +/* inputs */ + +#define MAX_EM2820_INPUT 4 +enum enum2820_itype { + EM2820_VMUX_COMPOSITE1 = 1, + EM2820_VMUX_COMPOSITE2, + EM2820_VMUX_COMPOSITE3, + EM2820_VMUX_COMPOSITE4, + EM2820_VMUX_SVIDEO, + EM2820_VMUX_TELEVISION, + EM2820_VMUX_CABLE, + EM2820_VMUX_DVB, + EM2820_VMUX_DEBUG, + EM2820_RADIO, +}; + +struct em2820_input { + enum enum2820_itype type; + unsigned int vmux; + unsigned int amux; +}; + +#define INPUT(nr) (&em2820_boards[dev->model].input[nr]) + +enum em2820_decoder { + EM2820_TVP5150, + EM2820_SAA7113, + EM2820_SAA7114 +}; + +struct em2820_board { + char *name; + + int vchannels; + int norm; + int tuner_type; + + /* i2c flags */ + unsigned int tda9887_conf; + + unsigned int has_tuner:1; + unsigned int has_msp34xx:1; + + enum em2820_decoder decoder; + + struct em2820_input input[MAX_EM2820_INPUT]; +}; + +struct em2820_eeprom { + u32 id; /* 0x9567eb1a */ + u16 vendor_ID; + u16 product_ID; + + u16 chip_conf; + + u16 board_conf; + + u16 string1, string2, string3; + + u8 string_idx_table; +}; + +/* device states */ +enum em2820_dev_state { + DEV_INITIALIZED = 0x01, + DEV_DISCONNECTED = 0x02, + DEV_MISCONFIGURED = 0x04, +}; + +/* tvnorms */ +struct em2820_tvnorm { + char *name; + v4l2_std_id id; + /* mode for saa7113h */ + int mode; +}; + +/* main device struct */ +struct em2820 { + /* generic device properties */ + char name[30]; /* name (including minor) of the device */ + int model; /* index in the device_data struct */ + int video_inputs; /* number of video inputs */ + unsigned int has_tuner:1; + unsigned int has_msp34xx:1; + unsigned int has_tda9887:1; + + enum em2820_decoder decoder; + + int tuner_type; /* type of the tuner */ + int tuner_addr; /* tuner address */ + int tda9887_conf; + /* i2c i/o */ + struct i2c_adapter i2c_adap; + struct i2c_client i2c_client; + /* video for linux */ + int users; /* user count for exclusive use */ + struct video_device *vdev; /* video for linux device struct */ + struct video_picture vpic; /* picture settings only used to init saa7113h */ + struct em2820_tvnorm *tvnorm; /* selected tv norm */ + int ctl_freq; /* selected frequency */ + unsigned int ctl_input; /* selected input */ + unsigned int ctl_ainput; /* slected audio input */ + int mute; + int volume; + /* frame properties */ + struct em2820_frame_t frame[EM2820_NUM_FRAMES]; /* list of frames */ + int num_frames; /* number of frames currently in use */ + unsigned int frame_count; /* total number of transfered frames */ + struct em2820_frame_t *frame_current; /* the frame that is being filled */ + int width; /* current frame width */ + int height; /* current frame height */ + int frame_size; /* current frame size */ + int field_size; /* current field size */ + int bytesperline; + int hscale; /* horizontal scale factor (see datasheet) */ + int vscale; /* vertical scale factor (see datasheet) */ + int interlaced; /* 1=interlace fileds, 0=just top fileds */ + int type; + + /* states */ + enum em2820_dev_state state; + enum em2820_stream_state stream; + enum em2820_io_method io; + /* locks */ + struct semaphore lock, fileop_lock; + spinlock_t queue_lock; + struct list_head inqueue, outqueue; + wait_queue_head_t open, wait_frame, wait_stream; + struct video_device *vbi_dev; + + unsigned char eedata[256]; + + /* usb transfer */ + struct usb_device *udev; /* the usb device */ + int alt; /* alternate */ + int max_pkt_size; /* max packet size of isoc transaction */ + unsigned int alt_max_pkt_size[EM2820_MAX_ALT + 1]; /* array of wMaxPacketSize */ + struct urb *urb[EM2820_NUM_BUFS]; /* urb for isoc transfers */ + char *transfer_buffer[EM2820_NUM_BUFS]; /* transfer buffers for isoc transfer */ + /* helper funcs that call usb_control_msg */ + int (*em2820_write_regs) (struct em2820 * dev, u16 reg, char *buf, + int len); + int (*em2820_read_reg) (struct em2820 * dev, u16 reg); + int (*em2820_read_reg_req_len) (struct em2820 * dev, u8 req, u16 reg, + char *buf, int len); + int (*em2820_write_regs_req) (struct em2820 * dev, u8 req, u16 reg, + char *buf, int len); + int (*em2820_read_reg_req) (struct em2820 * dev, u8 req, u16 reg); +}; + +/* Provided by em2820-i2c.c */ + +void em2820_i2c_call_clients(struct em2820 *dev, unsigned int cmd, void *arg); +int em2820_i2c_register(struct em2820 *dev); +int em2820_i2c_unregister(struct em2820 *dev); + +/* Provided by em2820-core.c */ + +void em2820_print_ioctl(char *name, unsigned int cmd); + +u32 em2820_request_buffers(struct em2820 *dev, u32 count); +void em2820_queue_unusedframes(struct em2820 *dev); +void em2820_release_buffers(struct em2820 *dev); + +int em2820_read_reg_req_len(struct em2820 *dev, u8 req, u16 reg, + char *buf, int len); +int em2820_read_reg_req(struct em2820 *dev, u8 req, u16 reg); +int em2820_read_reg(struct em2820 *dev, u16 reg); +int em2820_write_regs_req(struct em2820 *dev, u8 req, u16 reg, char *buf, + int len); +int em2820_write_regs(struct em2820 *dev, u16 reg, char *buf, int len); +int em2820_write_reg_bits(struct em2820 *dev, u16 reg, u8 val, + u8 bitmask); +int em2820_write_ac97(struct em2820 *dev, u8 reg, u8 * val); +int em2820_audio_analog_set(struct em2820 *dev); +int em2820_colorlevels_set_default(struct em2820 *dev); +int em2820_capture_start(struct em2820 *dev, int start); +int em2820_outfmt_set_yuv422(struct em2820 *dev); +int em2820_accumulator_set(struct em2820 *dev, u8 xmin, u8 xmax, u8 ymin, + u8 ymax); +int em2820_capture_area_set(struct em2820 *dev, u8 hstart, u8 vstart, + u16 width, u16 height); +int em2820_scaler_set(struct em2820 *dev, u16 h, u16 v); +int em2820_resolution_set(struct em2820 *dev); +void em2820_isocIrq(struct urb *urb, struct pt_regs *regs); +int em2820_init_isoc(struct em2820 *dev); +void em2820_uninit_isoc(struct em2820 *dev); +int em2820_set_alternate(struct em2820 *dev); + +/* Provided by em2820-cards.c */ +extern void em2820_card_setup(struct em2820 *dev); +extern struct em2820_board em2820_boards[]; +extern struct usb_device_id em2820_id_table[]; + +/* em2820 registers */ +#define USBSUSP_REG 0x0c /* */ + +#define AUDIOSRC_REG 0x0e +#define XCLK_REG 0x0f + +#define VINMODE_REG 0x10 +#define VINCTRL_REG 0x11 +#define VINENABLE_REG 0x12 /* */ + +#define GAMMA_REG 0x14 +#define RGAIN_REG 0x15 +#define GGAIN_REG 0x16 +#define BGAIN_REG 0x17 +#define ROFFSET_REG 0x18 +#define GOFFSET_REG 0x19 +#define BOFFSET_REG 0x1a + +#define OFLOW_REG 0x1b +#define HSTART_REG 0x1c +#define VSTART_REG 0x1d +#define CWIDTH_REG 0x1e +#define CHEIGHT_REG 0x1f + +#define YGAIN_REG 0x20 +#define YOFFSET_REG 0x21 +#define UVGAIN_REG 0x22 +#define UOFFSET_REG 0x23 +#define VOFFSET_REG 0x24 +#define SHARPNESS_REG 0x25 + +#define COMPR_REG 0x26 +#define OUTFMT_REG 0x27 + +#define XMIN_REG 0x28 +#define XMAX_REG 0x29 +#define YMIN_REG 0x2a +#define YMAX_REG 0x2b + +#define HSCALELOW_REG 0x30 +#define HSCALEHIGH_REG 0x31 +#define VSCALELOW_REG 0x32 +#define VSCALEHIGH_REG 0x33 + +#define AC97LSB_REG 0x40 +#define AC97MSB_REG 0x41 +#define AC97ADDR_REG 0x42 +#define AC97BUSY_REG 0x43 + +/* em202 registers */ +#define MASTER_AC97 0x02 +#define VIDEO_AC97 0x14 + +/* register settings */ +#define EM2820_AUDIO_SRC_TUNER 0xc0 +#define EM2820_AUDIO_SRC_LINE 0x80 + +/* printk macros */ + +#define em2820_err(fmt, arg...) do {\ + printk(KERN_ERR fmt , ##arg); } while (0) + +#define em2820_errdev(fmt, arg...) do {\ + printk(KERN_ERR "%s: "fmt,\ + dev->name , ##arg); } while (0) + +#define em2820_info(fmt, arg...) do {\ + printk(KERN_INFO "%s: "fmt,\ + dev->name , ##arg); } while (0) +#define em2820_warn(fmt, arg...) do {\ + printk(KERN_WARNING "%s: "fmt,\ + dev->name , ##arg); } while (0) + +inline static int em2820_audio_source(struct em2820 *dev, int input) +{ + return em2820_write_reg_bits(dev, AUDIOSRC_REG, input, 0xc0); +} + +inline static int em2820_audio_usb_mute(struct em2820 *dev, int mute) +{ + return em2820_write_reg_bits(dev, XCLK_REG, mute ? 0x00 : 0x80, 0x80); +} + +inline static int em2820_audio_analog_setup(struct em2820 *dev) +{ + /* unmute video mixer with default volume level */ + return em2820_write_ac97(dev, VIDEO_AC97, "\x08\x08"); +} + +inline static int em2820_compression_disable(struct em2820 *dev) +{ + /* side effect of disabling scaler and mixer */ + return em2820_write_regs(dev, COMPR_REG, "\x00", 1); +} + +inline static int em2820_contrast_get(struct em2820 *dev) +{ + return em2820_read_reg(dev, YGAIN_REG) & 0x1f; +} + +inline static int em2820_brightness_get(struct em2820 *dev) +{ + return em2820_read_reg(dev, YOFFSET_REG); +} + +inline static int em2820_saturation_get(struct em2820 *dev) +{ + return em2820_read_reg(dev, UVGAIN_REG) & 0x1f; +} + +inline static int em2820_u_balance_get(struct em2820 *dev) +{ + return em2820_read_reg(dev, UOFFSET_REG); +} + +inline static int em2820_v_balance_get(struct em2820 *dev) +{ + return em2820_read_reg(dev, VOFFSET_REG); +} + +inline static int em2820_gamma_get(struct em2820 *dev) +{ + return em2820_read_reg(dev, GAMMA_REG) & 0x3f; +} + +inline static int em2820_contrast_set(struct em2820 *dev, s32 val) +{ + u8 tmp = (u8) val; + return em2820_write_regs(dev, YGAIN_REG, &tmp, 1); +} + +inline static int em2820_brightness_set(struct em2820 *dev, s32 val) +{ + u8 tmp = (u8) val; + return em2820_write_regs(dev, YOFFSET_REG, &tmp, 1); +} + +inline static int em2820_saturation_set(struct em2820 *dev, s32 val) +{ + u8 tmp = (u8) val; + return em2820_write_regs(dev, UVGAIN_REG, &tmp, 1); +} + +inline static int em2820_u_balance_set(struct em2820 *dev, s32 val) +{ + u8 tmp = (u8) val; + return em2820_write_regs(dev, UOFFSET_REG, &tmp, 1); +} + +inline static int em2820_v_balance_set(struct em2820 *dev, s32 val) +{ + u8 tmp = (u8) val; + return em2820_write_regs(dev, VOFFSET_REG, &tmp, 1); +} + +inline static int em2820_gamma_set(struct em2820 *dev, s32 val) +{ + u8 tmp = (u8) val; + return em2820_write_regs(dev, GAMMA_REG, &tmp, 1); +} + +/*FIXME: maxw should be dependent of alt mode */ +#define norm_maxw(dev) 720 +inline static unsigned int norm_maxh(struct em2820 *dev) +{ + return (dev->tvnorm->id & V4L2_STD_625_50) ? 576 : 480; +} + +#endif diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c index 6e3ba23104d2..03f360b45fdf 100644 --- a/drivers/media/video/tvp5150.c +++ b/drivers/media/video/tvp5150.c @@ -35,6 +35,47 @@ MODULE_PARM_DESC(debug, "Debug level (0-1)"); printk(format , ##args); \ } while (0) +/* supported controls */ +static struct v4l2_queryctrl tvp5150_qctrl[] = { + { + .id = V4L2_CID_BRIGHTNESS, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Brightness", + .minimum = 0, + .maximum = 255, + .step = 1, + .default_value = 0, + .flags = 0, + }, { + .id = V4L2_CID_CONTRAST, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Contrast", + .minimum = 0, + .maximum = 255, + .step = 0x1, + .default_value = 0x10, + .flags = 0, + }, { + .id = V4L2_CID_SATURATION, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Saturation", + .minimum = 0, + .maximum = 255, + .step = 0x1, + .default_value = 0x10, + .flags = 0, + }, { + .id = V4L2_CID_HUE, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Hue", + .minimum = -128, + .maximum = 127, + .step = 0x1, + .default_value = 0x10, + .flags = 0, + } +}; + struct tvp5150 { struct i2c_client *client; @@ -73,7 +114,7 @@ static inline void tvp5150_write(struct i2c_client *c, unsigned char addr, buffer[0] = addr; buffer[1] = value; - dprintk(1,"tvp5150: writing 0x%02x 0x%02x\n",buffer[0],buffer[1]); + dprintk(1, "tvp5150: writing 0x%02x 0x%02x\n", buffer[0], buffer[1]); if (2 != (rc = i2c_master_send(c, buffer, 2))) dprintk(0, "i2c i/o error: rc == %d (should be 2)\n", rc); } @@ -398,28 +439,11 @@ static inline void tvp5150_selmux(struct i2c_client *c, enum tvp5150_input input) { struct tvp5150 *decoder = i2c_get_clientdata(c); - int tvp_input; - - /* FIXME: It is dependent of basic driver */ - switch (input) - { - case 2: - tvp_input=TVP5150_ANALOG_CH0; - break; - case 0: - tvp_input=TVP5150_ANALOG_CH1; - break; - case 1: - tvp_input=TVP5150_SVIDEO; - break; - default: - tvp_input=TVP5150_BLACK_SCREEN; - } if (!decoder->enable) - tvp_input|=TVP5150_BLACK_SCREEN; + input |= TVP5150_BLACK_SCREEN; - tvp5150_write(c, TVP5150_VD_IN_SRC_SEL_1, tvp_input); + tvp5150_write(c, TVP5150_VD_IN_SRC_SEL_1, input); }; static inline void tvp5150_reset(struct i2c_client *c) @@ -432,7 +456,7 @@ static inline void tvp5150_reset(struct i2c_client *c) tvp5150_write(c, TVP5150_ANAL_CHL_CTL, 0x15); /* Normal Operation */ -// tvp5150_write(c, TVP5150_OP_MODE_CTL, 0x00); +// tvp5150_write(c, TVP5150_OP_MODE_CTL, 0x00); /* Activate YCrCb output 0x9 or 0xd ? */ tvp5150_write(c, TVP5150_MISC_CTL, 0x6f); @@ -458,6 +482,50 @@ static inline void tvp5150_reset(struct i2c_client *c) tvp5150_write(c, TVP5150_HUE_CTL, (decoder->hue - 32768) >> 8); }; +static int tvp5150_get_ctrl(struct i2c_client *c, struct v4l2_control *ctrl) +{ +/* struct tvp5150 *decoder = i2c_get_clientdata(c); */ + + switch (ctrl->id) { + case V4L2_CID_BRIGHTNESS: + ctrl->value = tvp5150_read(c, TVP5150_BRIGHT_CTL); + return 0; + case V4L2_CID_CONTRAST: + ctrl->value = tvp5150_read(c, TVP5150_CONTRAST_CTL); + return 0; + case V4L2_CID_SATURATION: + ctrl->value = tvp5150_read(c, TVP5150_SATURATION_CTL); + return 0; + case V4L2_CID_HUE: + ctrl->value = tvp5150_read(c, TVP5150_HUE_CTL); + return 0; + default: + return -EINVAL; + } +} + +static int tvp5150_set_ctrl(struct i2c_client *c, struct v4l2_control *ctrl) +{ +/* struct tvp5150 *decoder = i2c_get_clientdata(c); */ + + switch (ctrl->id) { + case V4L2_CID_BRIGHTNESS: + tvp5150_write(c, TVP5150_BRIGHT_CTL, ctrl->value); + return 0; + case V4L2_CID_CONTRAST: + tvp5150_write(c, TVP5150_CONTRAST_CTL, ctrl->value); + return 0; + case V4L2_CID_SATURATION: + tvp5150_write(c, TVP5150_SATURATION_CTL, ctrl->value); + return 0; + case V4L2_CID_HUE: + tvp5150_write(c, TVP5150_HUE_CTL, ctrl->value); + return 0; + default: + return -EINVAL; + } +} + /**************************************************************************** I2C Command ****************************************************************************/ @@ -478,21 +546,21 @@ static int tvp5150_command(struct i2c_client *client, break; case DECODER_GET_CAPABILITIES: - { - struct video_decoder_capability *cap = arg; - - cap->flags = VIDEO_DECODER_PAL | - VIDEO_DECODER_NTSC | - VIDEO_DECODER_SECAM | - VIDEO_DECODER_AUTO | VIDEO_DECODER_CCIR; - cap->inputs = 3; - cap->outputs = 1; - break; - } + { + struct video_decoder_capability *cap = arg; + + cap->flags = VIDEO_DECODER_PAL | + VIDEO_DECODER_NTSC | + VIDEO_DECODER_SECAM | + VIDEO_DECODER_AUTO | VIDEO_DECODER_CCIR; + cap->inputs = 3; + cap->outputs = 1; + break; + } case DECODER_GET_STATUS: - { - break; - } + { + break; + } case DECODER_SET_GPIO: break; @@ -501,87 +569,138 @@ static int tvp5150_command(struct i2c_client *client, break; case DECODER_SET_NORM: - { - int *iarg = arg; + { + int *iarg = arg; - switch (*iarg) { + switch (*iarg) { - case VIDEO_MODE_NTSC: - break; + case VIDEO_MODE_NTSC: + break; - case VIDEO_MODE_PAL: - break; + case VIDEO_MODE_PAL: + break; - case VIDEO_MODE_SECAM: - break; + case VIDEO_MODE_SECAM: + break; - case VIDEO_MODE_AUTO: - break; + case VIDEO_MODE_AUTO: + break; - default: - return -EINVAL; + default: + return -EINVAL; + } + decoder->norm = *iarg; + break; } - decoder->norm = *iarg; - break; - } case DECODER_SET_INPUT: - { - int *iarg = arg; - if (*iarg < 0 || *iarg > 3) { - return -EINVAL; - } + { + int *iarg = arg; + if (*iarg < 0 || *iarg > 3) { + return -EINVAL; + } - decoder->input=*iarg; - tvp5150_selmux(client, decoder->input); + decoder->input = *iarg; + tvp5150_selmux(client, decoder->input); - break; - } + break; + } case DECODER_SET_OUTPUT: - { - int *iarg = arg; + { + int *iarg = arg; - /* not much choice of outputs */ - if (*iarg != 0) { - return -EINVAL; + /* not much choice of outputs */ + if (*iarg != 0) { + return -EINVAL; + } + break; } - break; - } case DECODER_ENABLE_OUTPUT: - { - int *iarg = arg; + { + int *iarg = arg; - decoder->enable = (*iarg != 0); + decoder->enable = (*iarg != 0); - tvp5150_selmux(client, decoder->input); + tvp5150_selmux(client, decoder->input); - break; - } - case DECODER_SET_PICTURE: - { - struct video_picture *pic = arg; - if (decoder->bright != pic->brightness) { - /* We want 0 to 255 we get 0-65535 */ - decoder->bright = pic->brightness; - tvp5150_write(client, TVP5150_BRIGHT_CTL, decoder->bright >> 8); + break; } - if (decoder->contrast != pic->contrast) { - /* We want 0 to 255 we get 0-65535 */ - decoder->contrast = pic->contrast; - tvp5150_write(client, TVP5150_CONTRAST_CTL, decoder->contrast >> 8); + case VIDIOC_QUERYCTRL: + { + struct v4l2_queryctrl *qc = arg; + u8 i, n; + + dprintk(1, KERN_DEBUG "VIDIOC_QUERYCTRL"); + + n = sizeof(tvp5150_qctrl) / sizeof(tvp5150_qctrl[0]); + for (i = 0; i < n; i++) + if (qc->id && qc->id == tvp5150_qctrl[i].id) { + memcpy(qc, &(tvp5150_qctrl[i]), + sizeof(*qc)); + return 0; + } + + return -EINVAL; } - if (decoder->sat != pic->colour) { - /* We want 0 to 255 we get 0-65535 */ - decoder->sat = pic->colour; - tvp5150_write(client, TVP5150_SATURATION_CTL, decoder->contrast >> 8); + case VIDIOC_G_CTRL: + { + struct v4l2_control *ctrl = arg; + dprintk(1, KERN_DEBUG "VIDIOC_G_CTRL"); + + return tvp5150_get_ctrl(client, ctrl); } - if (decoder->hue != pic->hue) { - /* We want -128 to 127 we get 0-65535 */ - decoder->hue = pic->hue; - tvp5150_write(client, TVP5150_HUE_CTL, (decoder->hue - 32768) >> 8); + case VIDIOC_S_CTRL_OLD: /* ??? */ + case VIDIOC_S_CTRL: + { + struct v4l2_control *ctrl = arg; + u8 i, n; + dprintk(1, KERN_DEBUG "VIDIOC_S_CTRL"); + n = sizeof(tvp5150_qctrl) / sizeof(tvp5150_qctrl[0]); + for (i = 0; i < n; i++) + if (ctrl->id == tvp5150_qctrl[i].id) { + if (ctrl->value < + tvp5150_qctrl[i].minimum + || ctrl->value > + tvp5150_qctrl[i].maximum) + return -ERANGE; + dprintk(1, + KERN_DEBUG + "VIDIOC_S_CTRL: id=%d, value=%d", + ctrl->id, ctrl->value); + return tvp5150_set_ctrl(client, ctrl); + } + return -EINVAL; + } + + case DECODER_SET_PICTURE: + { + struct video_picture *pic = arg; + if (decoder->bright != pic->brightness) { + /* We want 0 to 255 we get 0-65535 */ + decoder->bright = pic->brightness; + tvp5150_write(client, TVP5150_BRIGHT_CTL, + decoder->bright >> 8); + } + if (decoder->contrast != pic->contrast) { + /* We want 0 to 255 we get 0-65535 */ + decoder->contrast = pic->contrast; + tvp5150_write(client, TVP5150_CONTRAST_CTL, + decoder->contrast >> 8); + } + if (decoder->sat != pic->colour) { + /* We want 0 to 255 we get 0-65535 */ + decoder->sat = pic->colour; + tvp5150_write(client, TVP5150_SATURATION_CTL, + decoder->contrast >> 8); + } + if (decoder->hue != pic->hue) { + /* We want -128 to 127 we get 0-65535 */ + decoder->hue = pic->hue; + tvp5150_write(client, TVP5150_HUE_CTL, + (decoder->hue - 32768) >> 8); + } + break; } - break; - } default: return -EINVAL; } @@ -594,15 +713,14 @@ static int tvp5150_command(struct i2c_client *client, ****************************************************************************/ static struct i2c_driver driver; -static struct i2c_client client_template = -{ - .name = "(unset)", - .flags = I2C_CLIENT_ALLOW_USE, - .driver = &driver, +static struct i2c_client client_template = { + .name = "(unset)", + .flags = I2C_CLIENT_ALLOW_USE, + .driver = &driver, }; -static int tvp5150_detect_client (struct i2c_adapter *adapter, - int address, int kind) +static int tvp5150_detect_client(struct i2c_adapter *adapter, + int address, int kind) { struct i2c_client *client; struct tvp5150 *core; @@ -625,7 +743,7 @@ static int tvp5150_detect_client (struct i2c_adapter *adapter, client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); if (client == 0) return -ENOMEM; - memcpy(client,&client_template,sizeof(struct i2c_client)); + memcpy(client, &client_template, sizeof(struct i2c_client)); core = kmalloc(sizeof(struct tvp5150), GFP_KERNEL); if (core == 0) { @@ -651,13 +769,13 @@ static int tvp5150_detect_client (struct i2c_adapter *adapter, return rv; } - dump_reg (client); + if (debug > 1) + dump_reg(client); return 0; } -static int -tvp5150_attach_adapter (struct i2c_adapter *adapter) +static int tvp5150_attach_adapter(struct i2c_adapter *adapter) { dprintk(1, KERN_INFO @@ -666,8 +784,7 @@ tvp5150_attach_adapter (struct i2c_adapter *adapter) return i2c_probe(adapter, &addr_data, &tvp5150_detect_client); } -static int -tvp5150_detach_client (struct i2c_client *client) +static int tvp5150_detach_client(struct i2c_client *client) { struct tvp5150 *decoder = i2c_get_clientdata(client); int err; @@ -699,14 +816,12 @@ static struct i2c_driver driver = { .command = tvp5150_command, }; -static int __init -tvp5150_init (void) +static int __init tvp5150_init(void) { return i2c_add_driver(&driver); } -static void __exit -tvp5150_exit (void) +static void __exit tvp5150_exit(void) { i2c_del_driver(&driver); } -- cgit v1.2.2 From 3c1904a997153b17861bd331c9075017ba34b901 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:37:08 -0800 Subject: [PATCH] v4l: 717: added scripts and cardlist for em2820 - Added scripts and CARDLIST for em2820. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/video4linux/CARDLIST.em28xx | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 Documentation/video4linux/CARDLIST.em28xx diff --git a/Documentation/video4linux/CARDLIST.em28xx b/Documentation/video4linux/CARDLIST.em28xx new file mode 100644 index 000000000000..a33ddea0b6f5 --- /dev/null +++ b/Documentation/video4linux/CARDLIST.em28xx @@ -0,0 +1,4 @@ + 0 -> Terratec Cinergy 250 USB [0ccd:0036] + 1 -> Pinnacle PCTV USB 2 [2304:0208] + 2 -> Hauppauge WinTV USB 2 [2040:4200] + 3 -> MSI VOX USB 2.0 [eb1a:2820] -- cgit v1.2.2 From fd35a6b454818e01f761622e9ac5824ce2d7baf5 Mon Sep 17 00:00:00 2001 From: "Nickolay V. Shmyrev" Date: Tue, 8 Nov 2005 21:37:09 -0800 Subject: [PATCH] v4l: 718: fixed build - Fixed build. Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/em28xx/em28xx-i2c.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c index 95f80a7615bd..f1493c48656b 100644 --- a/drivers/media/video/em28xx/em28xx-i2c.c +++ b/drivers/media/video/em28xx/em28xx-i2c.c @@ -279,10 +279,8 @@ static void dec_use(struct i2c_adapter *adap) static int em2820_set_tuner(int check_eeprom, struct i2c_client *client) { struct em2820 *dev = client->adapter->algo_data; - struct tuner_setup tun_setup; - /* tuner */ if (dev->has_tuner) { tun_setup.mode_mask = T_ANALOG_TV | T_RADIO; tun_setup.type = dev->tuner_type; @@ -290,6 +288,7 @@ static int em2820_set_tuner(int check_eeprom, struct i2c_client *client) em2820_i2c_call_clients(dev, TUNER_SET_TYPE_ADDR, &tun_setup); } + return (0); } -- cgit v1.2.2 From 2f8d4f5139fe7817f43202d8ee2f4b68ac53e58f Mon Sep 17 00:00:00 2001 From: "Robert W. Boone" Date: Tue, 8 Nov 2005 21:37:10 -0800 Subject: [PATCH] v4l: 719: implement some differences in video output port - Implement some differences in video output port Signed-off-by: Robert W. Boone Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/saa7134/saa7134-cards.c | 4 ++ drivers/media/video/saa7134/saa7134-video.c | 58 +++++++++++++++++++++++++++-- drivers/media/video/saa7134/saa7134.h | 9 +++++ 3 files changed, 68 insertions(+), 3 deletions(-) diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index 7278150fb58e..3a4c59e7ca07 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c @@ -2285,6 +2285,10 @@ struct saa7134_board saa7134_boards[] = { }}, .mpeg = SAA7134_MPEG_EMPRESS, .video_out = CCIR656, + .vid_port_opts = ( SET_T_CODE_POLARITY_NON_INVERTED | + SET_CLOCK_NOT_DELAYED | + SET_CLOCK_INVERTED | + SET_VSYNC_OFF ), }, [SAA7134_BOARD_RTD_VFG7330] = { .name = "RTD Embedded Technologies VFG7330", diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index cd1f70fffdec..cd5545b2d60b 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c @@ -47,6 +47,43 @@ MODULE_PARM_DESC(noninterlaced,"video input is noninterlaced"); #define dprintk(fmt, arg...) if (video_debug) \ printk(KERN_DEBUG "%s/video: " fmt, dev->name , ## arg) +/* ------------------------------------------------------------------ */ +/* Defines for Video Output Port Register at address 0x191 */ + +/* Bit 0: VIP code T bit polarity */ + +#define VP_T_CODE_P_NON_INVERTED 0x00 +#define VP_T_CODE_P_INVERTED 0x01 + +/* ------------------------------------------------------------------ */ +/* Defines for Video Output Port Register at address 0x195 */ + +/* Bit 2: Video output clock delay control */ + +#define VP_CLK_CTRL2_NOT_DELAYED 0x00 +#define VP_CLK_CTRL2_DELAYED 0x04 + +/* Bit 1: Video output clock invert control */ + +#define VP_CLK_CTRL1_NON_INVERTED 0x00 +#define VP_CLK_CTRL1_INVERTED 0x02 + +/* ------------------------------------------------------------------ */ +/* Defines for Video Output Port Register at address 0x196 */ + +/* Bits 2 to 0: VSYNC pin video vertical sync type */ + +#define VP_VS_TYPE_MASK 0x07 + +#define VP_VS_TYPE_OFF 0x00 +#define VP_VS_TYPE_V123 0x01 +#define VP_VS_TYPE_V_ITU 0x02 +#define VP_VS_TYPE_VGATE_L 0x03 +#define VP_VS_TYPE_RESERVED1 0x04 +#define VP_VS_TYPE_RESERVED2 0x05 +#define VP_VS_TYPE_F_ITU 0x06 +#define VP_VS_TYPE_SC_FID 0x07 + /* ------------------------------------------------------------------ */ /* data structs for video */ @@ -2294,13 +2331,28 @@ int saa7134_video_init1(struct saa7134_dev *dev) if (saa7134_boards[dev->board].video_out) { /* enable video output */ int vo = saa7134_boards[dev->board].video_out; + int video_reg; + unsigned int vid_port_opts = saa7134_boards[dev->board].vid_port_opts; saa_writeb(SAA7134_VIDEO_PORT_CTRL0, video_out[vo][0]); - saa_writeb(SAA7134_VIDEO_PORT_CTRL1, video_out[vo][1]); + video_reg = video_out[vo][1]; + if (vid_port_opts & SET_T_CODE_POLARITY_NON_INVERTED) + video_reg &= ~VP_T_CODE_P_INVERTED; + saa_writeb(SAA7134_VIDEO_PORT_CTRL1, video_reg); saa_writeb(SAA7134_VIDEO_PORT_CTRL2, video_out[vo][2]); saa_writeb(SAA7134_VIDEO_PORT_CTRL3, video_out[vo][3]); saa_writeb(SAA7134_VIDEO_PORT_CTRL4, video_out[vo][4]); - saa_writeb(SAA7134_VIDEO_PORT_CTRL5, video_out[vo][5]); - saa_writeb(SAA7134_VIDEO_PORT_CTRL6, video_out[vo][6]); + video_reg = video_out[vo][5]; + if (vid_port_opts & SET_CLOCK_NOT_DELAYED) + video_reg &= ~VP_CLK_CTRL2_DELAYED; + if (vid_port_opts & SET_CLOCK_INVERTED) + video_reg |= VP_CLK_CTRL1_INVERTED; + saa_writeb(SAA7134_VIDEO_PORT_CTRL5, video_reg); + video_reg = video_out[vo][6]; + if (vid_port_opts & SET_VSYNC_OFF) { + video_reg &= ~VP_VS_TYPE_MASK; + video_reg |= VP_VS_TYPE_OFF; + } + saa_writeb(SAA7134_VIDEO_PORT_CTRL6, video_reg); saa_writeb(SAA7134_VIDEO_PORT_CTRL7, video_out[vo][7]); saa_writeb(SAA7134_VIDEO_PORT_CTRL8, video_out[vo][8]); } diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index e907d86da7b5..9dfd45bed92b 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h @@ -199,6 +199,14 @@ struct saa7134_format { #define SAA7134_MAXBOARDS 8 #define SAA7134_INPUT_MAX 8 +/* ----------------------------------------------------------- */ +/* Video Output Port Register Initialization Options */ + +#define SET_T_CODE_POLARITY_NON_INVERTED (1 << 0) +#define SET_CLOCK_NOT_DELAYED (1 << 1) +#define SET_CLOCK_INVERTED (1 << 2) +#define SET_VSYNC_OFF (1 << 3) + struct saa7134_input { char *name; unsigned int vmux; @@ -234,6 +242,7 @@ struct saa7134_board { /* peripheral I/O */ enum saa7134_video_out video_out; enum saa7134_mpeg_type mpeg; + unsigned int vid_port_opts; }; #define card_has_radio(dev) (NULL != saa7134_boards[dev->board].radio.name) -- cgit v1.2.2 From bd15eba3a0f2b175bd80c21d5fc86c02ed4c56f6 Mon Sep 17 00:00:00 2001 From: Ricardo Cerqueira Date: Tue, 8 Nov 2005 21:37:11 -0800 Subject: [PATCH] v4l: 720: alsa support for saa7134 that should work wonderful - Alsa support for saa7134 that should work. Signed-off-by: Ricardo Cerqueira Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/saa7134/saa7134-alsa.c | 1076 +++++++++++++++++----------- drivers/media/video/saa7134/saa7134-core.c | 23 +- drivers/media/video/saa7134/saa7134-oss.c | 5 +- drivers/media/video/saa7134/saa7134-reg.h | 8 + drivers/media/video/saa7134/saa7134.h | 10 + 5 files changed, 718 insertions(+), 404 deletions(-) diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c index d09e01f7fc3b..84eeeba21d74 100644 --- a/drivers/media/video/saa7134/saa7134-alsa.c +++ b/drivers/media/video/saa7134/saa7134-alsa.c @@ -1,543 +1,821 @@ /* + * SAA713x ALSA support for V4L + * Ricardo Cerqueira * - * Support for audio capture - * PCI function #1 of the saa7134 * - * (c) 2005 Mauro Carvalho Chehab - * (c) 2004 Gerd Knorr - * (c) 2003 Clemens Ladisch + * Caveats: + * I still haven't got the mixer settings right. * - * 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. + * - Volume doesn't work (it's always at max) + * - There's no "memory" of the capture channel. It can be changed, + * but alsamixer doesn't show it after a module restart (rmmod/insmod) * - * 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. + * Hotswapping DOES NOT work yet! Please remove the module before + * inserting cardbus cards. pcmcia-cs or pccardd should load it + * properly after insertion, and things will work + * + * 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, version 2 + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * 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 -#include -#include -#include -#include #include +#include +#include +#include +#include +#include +#include #include -#include -#include #include +#include +#include #include #include "saa7134.h" #include "saa7134-reg.h" -#define dprintk(level,fmt, arg...) if (debug >= level) \ - printk(KERN_DEBUG "%s/1: " fmt, chip->core->name , ## arg) - - -/**************************************************************************** - Data type declarations - Can be moded to a header file later - ****************************************************************************/ - -#define ANALOG_CLOCK 1792000 -#define CLOCK_DIV_MIN 4 -#define CLOCK_DIV_MAX 15 -#define MAX_PCM_DEVICES 4 -#define MAX_PCM_SUBSTREAMS 16 +static unsigned int alsa_debug = 0; +module_param(alsa_debug, int, 0644); +MODULE_PARM_DESC(alsa_debug,"enable debug messages [alsa]"); + +#define MAX_PCM_DEVICES 1 +#define MAX_PCM_SUBSTREAMS 1 + +/* defaults */ +#define MAX_BUFFER_SIZE (256*1024) +#define USE_FORMATS SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S16_BE | SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_U16_LE | SNDRV_PCM_FMTBIT_U16_BE +#define USE_RATE SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_48000 +#define USE_RATE_MIN 32000 +#define USE_RATE_MAX 48000 +#define USE_CHANNELS_MIN 1 +#define USE_CHANNELS_MAX 2 +#ifndef USE_PERIODS_MIN +#define USE_PERIODS_MIN 2 +#endif +#ifndef USE_PERIODS_MAX +#define USE_PERIODS_MAX 1024 +#endif -enum { DEVICE_DIGITAL, DEVICE_ANALOG }; -/* These can be replaced after done */ -#define MIXER_ADDR_LAST MAX_saa7134_INPUT +#define dprintk(fmt, arg...) if (alsa_debug) \ + printk(KERN_DEBUG "%s/alsa: " fmt, dev->name , ## arg) -struct saa7134_audio_dev { - struct saa7134_core *core; - struct saa7134_buffer *buf; - struct saa7134_dmaqueue q; - /* pci i/o */ - struct pci_dev *pci; - unsigned char pci_rev,pci_lat; +static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ +static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ +static int enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 0}; + +#define MIXER_ADDR_TVTUNER 0 +#define MIXER_ADDR_LINE1 1 +#define MIXER_ADDR_LINE2 2 +#define MIXER_ADDR_LAST 2 + +typedef struct snd_card_saa7134 { + snd_card_t *card; + spinlock_t mixer_lock; + int mixer_volume[MIXER_ADDR_LAST+1][2]; + int capture_source[MIXER_ADDR_LAST+1][2]; + struct pci_dev *pci; + struct saa7134_dev *saadev; + + unsigned long iobase; + int irq; + + spinlock_t lock; +} snd_card_saa7134_t; + +typedef struct snd_card_saa7134_pcm { + struct saa7134_dev *saadev; + + spinlock_t lock; + unsigned int pcm_size; /* buffer size */ + unsigned int pcm_count; /* bytes per period */ + unsigned int pcm_bps; /* bytes per second */ + snd_pcm_substream_t *substream; +} snd_card_saa7134_pcm_t; - /* audio controls */ - int irq; - int dig_rate; /* Digital sampling rate */ +static snd_card_t *snd_saa7134_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; - snd_card_t *card; +static void saa7134_dma_stop(struct saa7134_dev *dev) +{ + dev->oss.dma_blk = -1; + dev->oss.dma_running = 0; + saa7134_set_dmabits(dev); +} - spinlock_t reg_lock; +static void saa7134_dma_start(struct saa7134_dev *dev) +{ + dev->oss.dma_blk = 0; + dev->oss.dma_running = 1; + saa7134_set_dmabits(dev); +} - unsigned int dma_size; - unsigned int period_size; +void saa7134_irq_alsa_done(struct saa7134_dev *dev, unsigned long status) +{ + int next_blk, reg = 0; - int mixer_volume[MIXER_ADDR_LAST+1][2]; - int capture_source[MIXER_ADDR_LAST+1][2]; + spin_lock(&dev->slock); + if (UNSET == dev->oss.dma_blk) { + dprintk("irq: recording stopped\n"); + goto done; + } + if (0 != (status & 0x0f000000)) + dprintk("irq: lost %ld\n", (status >> 24) & 0x0f); + if (0 == (status & 0x10000000)) { + /* odd */ + if (0 == (dev->oss.dma_blk & 0x01)) + reg = SAA7134_RS_BA1(6); + } else { + /* even */ + if (1 == (dev->oss.dma_blk & 0x01)) + reg = SAA7134_RS_BA2(6); + } + if (0 == reg) { + dprintk("irq: field oops [%s]\n", + (status & 0x10000000) ? "even" : "odd"); + goto done; + } - long opened; - snd_pcm_substream_t *substream; -}; -typedef struct saa7134_audio_dev snd_saa7134_card_t; + if (dev->oss.read_count >= dev->oss.blksize * (dev->oss.blocks-2)) { + dprintk("irq: overrun [full=%d/%d] - Blocks in %d\n",dev->oss.read_count, + dev->oss.bufsize, dev->oss.blocks); + saa7134_dma_stop(dev); + goto done; + } -/**************************************************************************** - Module global static vars - ****************************************************************************/ + /* next block addr */ + next_blk = (dev->oss.dma_blk + 2) % dev->oss.blocks; + saa_writel(reg,next_blk * dev->oss.blksize); + if (alsa_debug > 2) + dprintk("irq: ok, %s, next_blk=%d, addr=%x, blocks=%u, size=%u, read=%u\n", + (status & 0x10000000) ? "even" : "odd ", next_blk, + next_blk * dev->oss.blksize, dev->oss.blocks, dev->oss.blksize, dev->oss.read_count); -static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ -static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 1}; -module_param_array(enable, bool, NULL, 0444); -MODULE_PARM_DESC(enable, "Enable saa7134x soundcard. default enabled."); + /* update status & wake waiting readers */ + dev->oss.dma_blk = (dev->oss.dma_blk + 1) % dev->oss.blocks; + dev->oss.read_count += dev->oss.blksize; -/**************************************************************************** - Module macros - ****************************************************************************/ + dev->oss.recording_on = reg; -MODULE_DESCRIPTION("ALSA driver module for saa7134 based TV cards"); -MODULE_AUTHOR("Mauro Carvalho Chehab "); -MODULE_LICENSE("GPL"); -MODULE_SUPPORTED_DEVICE("{{Philips, saa7131E}," - "{{Philips, saa7134}," - "{{Philips, saa7133}"); -static unsigned int debug = 0; -module_param(debug,int,0644); -MODULE_PARM_DESC(debug,"enable debug messages"); + if (dev->oss.read_count >= snd_pcm_lib_period_bytes(dev->oss.substream)) { + spin_unlock(&dev->slock); + snd_pcm_period_elapsed(dev->oss.substream); + spin_lock(&dev->slock); + } + done: + spin_unlock(&dev->slock); -/**************************************************************************** - Module specific funtions - ****************************************************************************/ +} -/* - * BOARD Specific: Sets audio DMA - */ -int saa7134_start_audio_dma(snd_saa7134_card_t *chip) +static int snd_card_saa7134_capture_trigger(snd_pcm_substream_t * substream, + int cmd) { - struct saa7134_core *core = chip->core; - return 0; } -/* - * BOARD Specific: Resets audio DMA - */ -int saa7134_stop_audio_dma(snd_saa7134_card_t *chip) +static int dsp_buffer_conf(struct saa7134_dev *dev, int blksize, int blocks) { - struct saa7134_core *core=chip->core; - return 0; + if (blksize < 0x100) + blksize = 0x100; + if (blksize > 0x10000) + blksize = 0x10000; + + if (blocks < 2) + blocks = 2; + if ((blksize * blocks) > 1024*1024) + blocks = 1024*1024 / blksize; + + dev->oss.blocks = blocks; + dev->oss.blksize = blksize; + dev->oss.bufsize = blksize * blocks; + + dprintk("buffer config: %d blocks / %d bytes, %d kB total\n", + blocks,blksize,blksize * blocks / 1024); + return 0; } -#define MAX_IRQ_LOOP 10 - -static void saa713401_timeout(unsigned long data) +static int dsp_buffer_init(struct saa7134_dev *dev) { - snd_saa7134_card_t *chip = (snd_saa7134_card_t *)data; + int err; + + if (!dev->oss.bufsize) + BUG(); + videobuf_dma_init(&dev->oss.dma); + err = videobuf_dma_init_kernel(&dev->oss.dma, PCI_DMA_FROMDEVICE, + (dev->oss.bufsize + PAGE_SIZE) >> PAGE_SHIFT); + if (0 != err) + return err; + return 0; } -/* FIXME: Wrong values*/ -static char *saa7134_aud_irqs[32] = { - "y_risci1", "u_risci1", "v_risci1", "vbi_risc1", - "y_risci2", "u_risci2", "v_risci2", "vbi_risc2", - "y_oflow", "u_oflow", "v_oflow", "vbi_oflow", - "y_sync", "u_sync", "v_sync", "vbi_sync", - "opc_err", "par_err", "rip_err", "pci_abort", -}; - -static void saa713401_aud_irq(snd_saa7134_card_t *chip) +static int snd_card_saa7134_pcm_prepare(snd_pcm_substream_t * substream) { - struct saa7134_core *core = chip->core; -} + snd_pcm_runtime_t *runtime = substream->runtime; + int err, bswap, sign; + u32 fmt, control; + unsigned long flags; + snd_card_saa7134_t *saa7134 = snd_pcm_substream_chip(substream); + struct saa7134_dev *dev; + snd_card_saa7134_pcm_t *saapcm = runtime->private_data; + unsigned int bps; + unsigned long size; + unsigned count; + + size = snd_pcm_lib_buffer_bytes(substream); + count = snd_pcm_lib_period_bytes(substream); + + saapcm->saadev->oss.substream = substream; + bps = runtime->rate * runtime->channels; + bps *= snd_pcm_format_width(runtime->format); + bps /= 8; + if (bps <= 0) + return -EINVAL; + saapcm->pcm_bps = bps; + saapcm->pcm_size = snd_pcm_lib_buffer_bytes(substream); + saapcm->pcm_count = snd_pcm_lib_period_bytes(substream); + + + dev=saa7134->saadev; + + dsp_buffer_conf(dev,saapcm->pcm_count,(saapcm->pcm_size/saapcm->pcm_count)); + + err = dsp_buffer_init(dev); + if (0 != err) + goto fail2; + + /* prepare buffer */ + if (0 != (err = videobuf_dma_pci_map(dev->pci,&dev->oss.dma))) + return err; + if (0 != (err = saa7134_pgtable_alloc(dev->pci,&dev->oss.pt))) + goto fail1; + if (0 != (err = saa7134_pgtable_build(dev->pci,&dev->oss.pt, + dev->oss.dma.sglist, + dev->oss.dma.sglen, + 0))) + goto fail2; + + + + switch (runtime->format) { + case SNDRV_PCM_FORMAT_U8: + case SNDRV_PCM_FORMAT_S8: + fmt = 0x00; + break; + case SNDRV_PCM_FORMAT_U16_LE: + case SNDRV_PCM_FORMAT_U16_BE: + case SNDRV_PCM_FORMAT_S16_LE: + case SNDRV_PCM_FORMAT_S16_BE: + fmt = 0x01; + break; + default: + err = -EINVAL; + return 1; + } + + switch (runtime->format) { + case SNDRV_PCM_FORMAT_S8: + case SNDRV_PCM_FORMAT_S16_LE: + case SNDRV_PCM_FORMAT_S16_BE: + sign = 1; + break; + default: + sign = 0; + break; + } + + switch (runtime->format) { + case SNDRV_PCM_FORMAT_U16_BE: + case SNDRV_PCM_FORMAT_S16_BE: + bswap = 1; break; + default: + bswap = 0; break; + } + + switch (dev->pci->device) { + case PCI_DEVICE_ID_PHILIPS_SAA7134: + if (1 == runtime->channels) + fmt |= (1 << 3); + if (2 == runtime->channels) + fmt |= (3 << 3); + if (sign) + fmt |= 0x04; + + fmt |= (MIXER_ADDR_TVTUNER == dev->oss.input) ? 0xc0 : 0x80; + saa_writeb(SAA7134_NUM_SAMPLES0, ((dev->oss.blksize - 1) & 0x0000ff)); + saa_writeb(SAA7134_NUM_SAMPLES1, ((dev->oss.blksize - 1) & 0x00ff00) >> 8); + saa_writeb(SAA7134_NUM_SAMPLES2, ((dev->oss.blksize - 1) & 0xff0000) >> 16); + saa_writeb(SAA7134_AUDIO_FORMAT_CTRL, fmt); + + break; + case PCI_DEVICE_ID_PHILIPS_SAA7133: + case PCI_DEVICE_ID_PHILIPS_SAA7135: + if (1 == runtime->channels) + fmt |= (1 << 4); + if (2 == runtime->channels) + fmt |= (2 << 4); + if (!sign) + fmt |= 0x04; + //saa_writel(SAA7133_NUM_SAMPLES, dev->oss.blksize -1); + saa_writel(SAA7133_NUM_SAMPLES, dev->oss.blksize -1); + saa_writel(SAA7133_AUDIO_CHANNEL, 0x543210 | (fmt << 24)); + //saa_writel(SAA7133_AUDIO_CHANNEL, 0x543210); + break; + } + + dprintk("rec_start: afmt=%d ch=%d => fmt=0x%x swap=%c\n", + runtime->format, runtime->channels, fmt, + bswap ? 'b' : '-'); + /* dma: setup channel 6 (= AUDIO) */ + control = SAA7134_RS_CONTROL_BURST_16 | + SAA7134_RS_CONTROL_ME | + (dev->oss.pt.dma >> 12); + if (bswap) + control |= SAA7134_RS_CONTROL_BSWAP; + + runtime->dma_area = dev->oss.dma.vmalloc; + saa_writel(SAA7134_RS_BA1(6),0); + saa_writel(SAA7134_RS_BA2(6),dev->oss.blksize); + saa_writel(SAA7134_RS_PITCH(6),0); + saa_writel(SAA7134_RS_CONTROL(6),control); + + dev->oss.rate = runtime->rate; + /* start dma */ + spin_lock_irqsave(&dev->slock,flags); + saa7134_dma_start(dev); + spin_unlock_irqrestore(&dev->slock,flags); -static irqreturn_t saa7134_irq(int irq, void *dev_id, struct pt_regs *regs) -{ - snd_saa7134_card_t *chip = dev_id; - struct saa7134_core *core = chip->core; -} + return 0; + fail2: + saa7134_pgtable_free(dev->pci,&dev->oss.pt); + fail1: + videobuf_dma_pci_unmap(dev->pci,&dev->oss.dma); + return err; -/**************************************************************************** - ALSA PCM Interface - ****************************************************************************/ -/* - * Digital hardware definition - */ -static snd_pcm_hardware_t snd_saa7134_digital_hw = { - .info = SNDRV_PCM_INFO_MMAP | - SNDRV_PCM_INFO_INTERLEAVED | - SNDRV_PCM_INFO_BLOCK_TRANSFER | - SNDRV_PCM_INFO_MMAP_VALID, - .formats = SNDRV_PCM_FMTBIT_S16_LE, - .rates = 0, /* set at runtime */ - .channels_min = 2, - .channels_max = 2, - .buffer_bytes_max = 255 * 4092, - .period_bytes_min = 32, - .period_bytes_max = 4092, - .periods_min = 2, - .periods_max = 255, -}; +} -/* - * Sets board to provide digital audio - */ -static int snd_saa7134_set_digital_hw(snd_saa7134_card_t *chip, snd_pcm_runtime_t *runtime) +static int snd_card_saa7134_capture_prepare(snd_pcm_substream_t * substream) { - return 0; + return snd_card_saa7134_pcm_prepare(substream); } -/* - * audio open callback - */ -static int snd_saa7134_pcm_open(snd_pcm_substream_t *substream) +static snd_pcm_uframes_t snd_card_saa7134_pointer(snd_pcm_substream_t * substream) { - snd_saa7134_card_t *chip = snd_pcm_substream_chip(substream); snd_pcm_runtime_t *runtime = substream->runtime; - int err; + snd_card_saa7134_pcm_t *saapcm = runtime->private_data; + struct saa7134_dev *dev=saapcm->saadev; - if (test_and_set_bit(0, &chip->opened)) - return -EBUSY; - err = snd_saa7134_set_digital_hw(chip, runtime); - if (err < 0) - goto _error; + if (dev->oss.read_count) { + dev->oss.read_count -= snd_pcm_lib_period_bytes(substream); + dev->oss.read_offset += snd_pcm_lib_period_bytes(substream); + if (dev->oss.read_offset == dev->oss.bufsize) + dev->oss.read_offset = 0; + } - err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS); - if (err < 0) - goto _error; + //return bytes_to_frames(runtime, saa_readl(dev->oss.recording_on)); + return bytes_to_frames(runtime, dev->oss.read_offset); +} - chip->substream = substream; - return 0; -_error: - clear_bit(0, &chip->opened); - smp_mb__after_clear_bit(); - return err; +static snd_pcm_uframes_t snd_card_saa7134_capture_pointer(snd_pcm_substream_t * substream) +{ + return snd_card_saa7134_pointer(substream); } -/* - * audio close callback - */ -static int snd_saa7134_close(snd_pcm_substream_t *substream) +static snd_pcm_hardware_t snd_card_saa7134_capture = { - snd_saa7134_card_t *chip = snd_pcm_substream_chip(substream); + .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | + SNDRV_PCM_INFO_BLOCK_TRANSFER | + SNDRV_PCM_INFO_MMAP_VALID), + .formats = USE_FORMATS, + .rates = USE_RATE, + .rate_min = USE_RATE_MIN, + .rate_max = USE_RATE_MAX, + .channels_min = USE_CHANNELS_MIN, + .channels_max = USE_CHANNELS_MAX, + .buffer_bytes_max = MAX_BUFFER_SIZE, + .period_bytes_min = 64, + .period_bytes_max = MAX_BUFFER_SIZE, + .periods_min = USE_PERIODS_MIN, + .periods_max = USE_PERIODS_MAX, + .fifo_size = 0x08070503, +}; - chip->substream = NULL; - clear_bit(0, &chip->opened); - smp_mb__after_clear_bit(); - return 0; +static void snd_card_saa7134_runtime_free(snd_pcm_runtime_t *runtime) +{ + snd_card_saa7134_pcm_t *saapcm = runtime->private_data; + + kfree(saapcm); } -/* - * hw_params callback - */ -static int snd_saa7134_hw_params(snd_pcm_substream_t * substream, - snd_pcm_hw_params_t * hw_params) + +static int snd_card_saa7134_hw_params(snd_pcm_substream_t * substream, + snd_pcm_hw_params_t * hw_params) { + return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); + + } -/* - * hw free callback - */ -static int snd_saa7134_hw_free(snd_pcm_substream_t * substream) +static int snd_card_saa7134_hw_free(snd_pcm_substream_t * substream) { return snd_pcm_lib_free_pages(substream); } -/* - * prepare callback - */ -static int snd_saa7134_prepare(snd_pcm_substream_t *substream) +static int dsp_buffer_free(struct saa7134_dev *dev) { - snd_saa7134_card_t *chip = snd_pcm_substream_chip(substream); - return 0; -} + if (!dev->oss.blksize) + BUG(); + videobuf_dma_free(&dev->oss.dma); -/* - * trigger callback - */ -static int snd_saa7134_card_trigger(snd_pcm_substream_t *substream, int cmd) -{ - snd_saa7134_card_t *chip = snd_pcm_substream_chip(substream); - - switch (cmd) { - case SNDRV_PCM_TRIGGER_START: - return snd_saa7134_start(chip); - case SNDRV_PCM_TRIGGER_STOP: - return snd_saa7134_stop(chip); - default: - return -EINVAL; - } + dev->oss.blocks = 0; + dev->oss.blksize = 0; + dev->oss.bufsize = 0; + + return 0; } -/* - * pointer callback - */ -static snd_pcm_uframes_t snd_saa7134_pointer(snd_pcm_substream_t *substream) + +static int saa7134_cap_close(struct saa7134_dev *dev) { -// snd_saa7134_card_t *chip = snd_pcm_substream_chip(substream); -// snd_pcm_runtime_t *runtime = substream->runtime; + unsigned long flags; + + /* stop dma */ + spin_lock_irqsave(&dev->slock,flags); + saa7134_dma_stop(dev); + spin_unlock_irqrestore(&dev->slock,flags); + + /* unlock buffer */ + saa7134_pgtable_free(dev->pci,&dev->oss.pt); + videobuf_dma_pci_unmap(dev->pci,&dev->oss.dma); -// return (snd_pcm_uframes_t)bytes_to_frames(runtime, chip->current_line * chip->line_bytes); + dsp_buffer_free(dev); + return 0; } -/* - * operators - */ -static snd_pcm_ops_t snd_saa7134_pcm_ops = { - .open = snd_saa7134_pcm_open, - .close = snd_saa7134_close, - .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_saa7134_hw_params, - .hw_free = snd_saa7134_hw_free, - .prepare = snd_saa7134_prepare, - .trigger = snd_saa7134_card_trigger, - .pointer = snd_saa7134_pointer, - .page = snd_pcm_sgbuf_ops_page, -}; -/* - * create a PCM device - */ -static int __devinit snd_saa7134_pcm(snd_saa7134_card_t *chip, int device, char *name) -{ - int err; - snd_pcm_t *pcm; +static int saa7134_cap_open(struct saa7134_dev *dev) { - err = snd_pcm_new(chip->card, name, device, 0, 1, &pcm); - if (err < 0) - return err; - pcm->private_data = chip; - strcpy(pcm->name, name); - snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_saa7134_pcm_ops); - return snd_pcm_lib_preallocate_pages_for_all(pcm, - SNDRV_DMA_TYPE_DEV_SG, - snd_dma_pci_data(chip->pci), - 128 * 1024, - (255 * 4092 + 1023) & ~1023); -} + down(&dev->oss.lock); -/**************************************************************************** - CONTROL INTERFACE - ****************************************************************************/ -static int snd_saa7134_capture_volume_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *info) -{ - info->type = SNDRV_CTL_ELEM_TYPE_INTEGER; - info->count = 1; - info->value.integer.min = 0; - info->value.integer.max = 0x3f; + dev->oss.afmt = SNDRV_PCM_FORMAT_U8; + dev->oss.channels = 2; + dev->oss.read_count = 0; + dev->oss.read_offset = 0; + + up(&dev->oss.lock); return 0; } -/* OK - TODO: test it */ -static int snd_saa7134_capture_volume_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *value) +static int snd_card_saa7134_capture_open(snd_pcm_substream_t * substream) { - snd_saa7134_card_t *chip = snd_kcontrol_chip(kcontrol); - struct saa7134_core *core=chip->core; + snd_pcm_runtime_t *runtime = substream->runtime; + snd_card_saa7134_pcm_t *saapcm; + snd_card_saa7134_t *saa7134 = snd_pcm_substream_chip(substream); + int err; + + saa7134_cap_open(saa7134->saadev); + + saapcm = kcalloc(1, sizeof(*saapcm), GFP_KERNEL); + if (saapcm == NULL) + return -ENOMEM; + saapcm->saadev=saa7134->saadev; + + spin_lock_init(&saapcm->lock); + + saapcm->substream = substream; + runtime->private_data = saapcm; + runtime->private_free = snd_card_saa7134_runtime_free; + runtime->hw = snd_card_saa7134_capture; + + if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) + return err; return 0; } -/* OK - TODO: test it */ -static int snd_saa7134_capture_volume_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *value) +static int snd_card_saa7134_capture_close(snd_pcm_substream_t * substream) { - snd_saa7134_card_t *chip = snd_kcontrol_chip(kcontrol); - struct saa7134_core *core=chip->core; + snd_card_saa7134_t *chip = snd_pcm_substream_chip(substream); + saa7134_cap_close(chip->saadev); return 0; } -static snd_kcontrol_new_t snd_saa7134_capture_volume = { - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .name = "Capture Volume", - .info = snd_saa7134_capture_volume_info, - .get = snd_saa7134_capture_volume_get, - .put = snd_saa7134_capture_volume_put, +static snd_pcm_ops_t snd_card_saa7134_capture_ops = { + .open = snd_card_saa7134_capture_open, + .close = snd_card_saa7134_capture_close, + .ioctl = snd_pcm_lib_ioctl, + .hw_params = snd_card_saa7134_hw_params, + .hw_free = snd_card_saa7134_hw_free, + .prepare = snd_card_saa7134_capture_prepare, + .trigger = snd_card_saa7134_capture_trigger, + .pointer = snd_card_saa7134_capture_pointer, }; -/* - *************************************** - */ +static int __init snd_card_saa7134_pcm(snd_card_saa7134_t *saa7134, int device) +{ + snd_pcm_t *pcm; + int err; -/**************************************************************************** - Basic Flow for Sound Devices - ****************************************************************************/ + if ((err = snd_pcm_new(saa7134->card, "SAA7134 PCM", device, 0, 1, &pcm)) < 0) + return err; + snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_card_saa7134_capture_ops); + pcm->private_data = saa7134; + pcm->info_flags = 0; + strcpy(pcm->name, "SAA7134 PCM"); + snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, + snd_dma_pci_data(saa7134->pci), + 128*1024, 256*1024); + return 0; +} -/* - * PCI ID Table - 14f1:8801 and 14f1:8811 means function 1: Audio - * Only boards with eeprom and byte 1 at eeprom=1 have it - */ +#define SAA713x_VOLUME(xname, xindex, addr) \ +{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ + .info = snd_saa7134_volume_info, \ + .get = snd_saa7134_volume_get, .put = snd_saa7134_volume_put, \ + .private_value = addr } -struct pci_device_id saa7134_audio_pci_tbl[] = { - {0x14f1,0x8801,PCI_ANY_ID,PCI_ANY_ID,0,0,0}, - {0x14f1,0x8811,PCI_ANY_ID,PCI_ANY_ID,0,0,0}, - {0, } -}; -MODULE_DEVICE_TABLE(pci, saa7134_audio_pci_tbl); +static int snd_saa7134_volume_info(snd_kcontrol_t * kcontrol, snd_ctl_elem_info_t * uinfo) +{ + uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; + uinfo->count = 2; + uinfo->value.integer.min = 0; + uinfo->value.integer.max = 20; + return 0; +} -/* - * Chip-specific destructor - */ +static int snd_saa7134_volume_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) +{ + snd_card_saa7134_t *chip = snd_kcontrol_chip(kcontrol); + unsigned long flags; + int addr = kcontrol->private_value; + + spin_lock_irqsave(&chip->mixer_lock, flags); + ucontrol->value.integer.value[0] = chip->mixer_volume[addr][0]; + ucontrol->value.integer.value[1] = chip->mixer_volume[addr][1]; + spin_unlock_irqrestore(&chip->mixer_lock, flags); + return 0; +} -static int snd_saa7134_free(snd_saa7134_card_t *chip) +static int snd_saa7134_volume_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) { - if (chip->irq >= 0) - free_irq(chip->irq, chip); + snd_card_saa7134_t *chip = snd_kcontrol_chip(kcontrol); + unsigned long flags; + int change, addr = kcontrol->private_value; + int left, right; + + left = ucontrol->value.integer.value[0]; + if (left < 0) + left = 0; + if (left > 20) + left = 20; + right = ucontrol->value.integer.value[1]; + if (right < 0) + right = 0; + if (right > 20) + right = 20; + spin_lock_irqsave(&chip->mixer_lock, flags); + change = chip->mixer_volume[addr][0] != left || + chip->mixer_volume[addr][1] != right; + chip->mixer_volume[addr][0] = left; + chip->mixer_volume[addr][1] = right; + spin_unlock_irqrestore(&chip->mixer_lock, flags); + return change; +} - /* free memory */ - saa7134_core_put(chip->core,chip->pci); +#define SAA713x_CAPSRC(xname, xindex, addr) \ +{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ + .info = snd_saa7134_capsrc_info, \ + .get = snd_saa7134_capsrc_get, .put = snd_saa7134_capsrc_put, \ + .private_value = addr } - pci_release_regions(chip->pci); - pci_disable_device(chip->pci); +static int snd_saa7134_capsrc_info(snd_kcontrol_t * kcontrol, snd_ctl_elem_info_t * uinfo) +{ + uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; + uinfo->count = 1; + uinfo->value.integer.min = 0; + uinfo->value.integer.max = 1; + return 0; +} - kfree(chip); +static int snd_saa7134_capsrc_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) +{ + snd_card_saa7134_t *chip = snd_kcontrol_chip(kcontrol); + unsigned long flags; + int addr = kcontrol->private_value; + + spin_lock_irqsave(&chip->mixer_lock, flags); + ucontrol->value.integer.value[0] = chip->capture_source[addr][0]; + ucontrol->value.integer.value[1] = chip->capture_source[addr][1]; + spin_unlock_irqrestore(&chip->mixer_lock, flags); return 0; } -/* - * Component Destructor - */ -static int snd_saa7134_dev_free(snd_device_t *device) +static int snd_saa7134_capsrc_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) { - snd_saa7134_card_t *chip = device->device_data; - return snd_saa7134_free(chip); + snd_card_saa7134_t *chip = snd_kcontrol_chip(kcontrol); + unsigned long flags; + int change, addr = kcontrol->private_value; + int left, right; + u32 anabar, xbarin; + int analog_io, rate; + struct saa7134_dev *dev; + + dev = chip->saadev; + + left = ucontrol->value.integer.value[0] & 1; + right = ucontrol->value.integer.value[1] & 1; + spin_lock_irqsave(&chip->mixer_lock, flags); + + change = chip->capture_source[addr][0] != left && + chip->capture_source[addr][1] != right; + chip->capture_source[addr][0] = left; + chip->capture_source[addr][1] = right; + dev->oss.input=addr; + spin_unlock_irqrestore(&chip->mixer_lock, flags); + + + switch (dev->pci->device) { + + case PCI_DEVICE_ID_PHILIPS_SAA7134: + switch (addr) { + case MIXER_ADDR_TVTUNER: + saa_andorb(SAA7134_AUDIO_FORMAT_CTRL, 0xc0, 0xc0); + saa_andorb(SAA7134_SIF_SAMPLE_FREQ, 0x03, 0x00); + break; + case MIXER_ADDR_LINE1: + case MIXER_ADDR_LINE2: + analog_io = (MIXER_ADDR_LINE1 == addr) ? 0x00 : 0x08; + rate = (32000 == dev->oss.rate) ? 0x01 : 0x03; + saa_andorb(SAA7134_ANALOG_IO_SELECT, 0x08, analog_io); + saa_andorb(SAA7134_AUDIO_FORMAT_CTRL, 0xc0, 0x80); + saa_andorb(SAA7134_SIF_SAMPLE_FREQ, 0x03, rate); + break; + } + + case PCI_DEVICE_ID_PHILIPS_SAA7133: + case PCI_DEVICE_ID_PHILIPS_SAA7135: + xbarin = 0x03; // adc + anabar = 0; + switch (addr) { + case MIXER_ADDR_TVTUNER: + xbarin = 0; // Demodulator + anabar = 2; // DACs + break; + case MIXER_ADDR_LINE1: + anabar = 0; // aux1, aux1 + break; + case MIXER_ADDR_LINE2: + anabar = 9; // aux2, aux2 + break; + } + + /* output xbar always main channel */ + saa_dsp_writel(dev, SAA7133_DIGITAL_OUTPUT_SEL1, 0xbbbb10); + + if (left || right) { // We've got data, turn the input on + //saa_dsp_writel(dev, SAA7133_DIGITAL_OUTPUT_SEL2, 0x101010); + saa_dsp_writel(dev, SAA7133_DIGITAL_INPUT_XBAR1, xbarin); + saa_writel(SAA7133_ANALOG_IO_SELECT, anabar); + } else { + //saa_dsp_writel(dev, SAA7133_DIGITAL_OUTPUT_SEL2, 0x101010); + saa_dsp_writel(dev, SAA7133_DIGITAL_INPUT_XBAR1, 0); + saa_writel(SAA7133_ANALOG_IO_SELECT, 0); + } + } + + return change; } +static snd_kcontrol_new_t snd_saa7134_controls[] = { +SAA713x_VOLUME("Video Volume", 0, MIXER_ADDR_TVTUNER), +SAA713x_CAPSRC("Video Capture Switch", 0, MIXER_ADDR_TVTUNER), +SAA713x_VOLUME("Line Volume", 1, MIXER_ADDR_LINE1), +SAA713x_CAPSRC("Line Capture Switch", 1, MIXER_ADDR_LINE1), +SAA713x_VOLUME("Line Volume", 2, MIXER_ADDR_LINE2), +SAA713x_CAPSRC("Line Capture Switch", 2, MIXER_ADDR_LINE2), +}; -/* - * Alsa Constructor - Component probe - */ +static int __init snd_card_saa7134_new_mixer(snd_card_saa7134_t * chip) +{ + snd_card_t *card = chip->card; + unsigned int idx; + int err; + + snd_assert(chip != NULL, return -EINVAL); + strcpy(card->mixername, "SAA7134 Mixer"); -static int devno=0; -static int __devinit snd_saa7134_create(snd_card_t *card, struct pci_dev *pci, - snd_saa7134_card_t **rchip) + for (idx = 0; idx < ARRAY_SIZE(snd_saa7134_controls); idx++) { + if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_saa7134_controls[idx], chip))) < 0) + return err; + } + return 0; +} + +static int snd_saa7134_free(snd_card_saa7134_t *chip) { - snd_saa7134_card_t *chip; - struct saa7134_core *core; return 0; } -static int __devinit saa7134_audio_initdev(struct pci_dev *pci, - const struct pci_device_id *pci_id) +static int snd_saa7134_dev_free(snd_device_t *device) { - snd_card_t *card; - snd_saa7134_card_t *chip; - int err; + snd_card_saa7134_t *chip = device->device_data; + return snd_saa7134_free(chip); +} - if (devno >= SNDRV_CARDS) - return (-ENODEV); +int alsa_card_saa7134_create(struct saa7134_dev *saadev) +{ + static int dev; + snd_card_t *card; + struct snd_card_saa7134 *chip; + int err; + static snd_device_ops_t ops = { + .dev_free = snd_saa7134_dev_free, + }; - if (!enable[devno]) { - ++devno; - return (-ENOENT); - } + if (dev >= SNDRV_CARDS) + return -ENODEV; + if (!enable[dev]) + return -ENODEV; + card = snd_card_new(index[dev], id[dev], THIS_MODULE, + sizeof(struct snd_card_saa7134)); + if (card == NULL) + return -ENOMEM; - card = snd_card_new(index[devno], id[devno], THIS_MODULE, 0); - if (!card) - return (-ENOMEM); + strcpy(card->driver, "SAA7134"); - err = snd_saa7134_create(card, pci, &chip); - if (err < 0) - return (err); + /* Card "creation" */ + chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); + if (chip == NULL) { + return -ENOMEM; + } -/* - err = snd_saa7134_pcm(chip, DEVICE_DIGITAL, "saa7134 Digital"); - if (err < 0) - goto fail_free; -*/ - err = snd_ctl_add(card, snd_ctl_new1(&snd_saa7134_capture_volume, chip)); - if (err < 0) { - snd_card_free(card); - return (err); - } + spin_lock_init(&chip->lock); - strcpy (card->driver, "saa7134_ALSA"); - sprintf(card->shortname, "Saa7134 %x", pci->device); - sprintf(card->longname, "%s at %#lx", - card->shortname, pci_resource_start(pci, 0)); - strcpy (card->mixername, "saa7134"); + chip->saadev = saadev; - dprintk (0, "%s/%i: Alsa support for saa7134x boards\n", - card->driver,devno); + chip->card = card; + chip->pci = saadev->pci; + chip->irq = saadev->pci->irq; + chip->iobase = pci_resource_start(saadev->pci, 0); - err = snd_card_register(card); - if (err < 0) { - snd_card_free(card); - return (err); - } + if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { + snd_saa7134_free(chip); + return err; + } - pci_set_drvdata(pci,card); - devno++; - return 0; -} -/* - * ALSA destructor - */ -static void __devexit saa7134_audio_finidev(struct pci_dev *pci) -{ - snd_card_free(pci_get_drvdata(pci)); - pci_set_drvdata(pci, NULL); + if ((err = snd_card_saa7134_new_mixer(chip)) < 0) + goto __nodev; - devno--; -} + if ((err = snd_card_saa7134_pcm(chip, 0)) < 0) + goto __nodev; + spin_lock_init(&chip->mixer_lock); -/* - * PCI driver definition - */ + snd_card_set_dev(card, &chip->pci->dev); -static struct pci_driver saa7134_audio_pci_driver = { - .name = "saa7134_audio", - .id_table = saa7134_audio_pci_tbl, - .probe = saa7134_audio_initdev, - .remove = saa7134_audio_finidev, - SND_PCI_PM_CALLBACKS -}; + /* End of "creation" */ -/**************************************************************************** - LINUX MODULE INIT - ****************************************************************************/ + strcpy(card->shortname, "SAA7134"); + sprintf(card->longname, "%s at 0x%lx irq %d", + card->shortname, chip->iobase, chip->irq); -/* - * module init - */ -static int saa7134_audio_init(void) -{ - printk(KERN_INFO "saa7134x alsa driver version %d.%d.%d loaded\n", - (saa7134_VERSION_CODE >> 16) & 0xff, - (saa7134_VERSION_CODE >> 8) & 0xff, - saa7134_VERSION_CODE & 0xff); -#ifdef SNAPSHOT - printk(KERN_INFO "saa7134x: snapshot date %04d-%02d-%02d\n", - SNAPSHOT/10000, (SNAPSHOT/100)%100, SNAPSHOT%100); -#endif - return pci_module_init(&saa7134_audio_pci_driver); + + if ((err = snd_card_register(card)) == 0) { + snd_saa7134_cards[dev] = card; + return 0; + } + +__nodev: + snd_card_free(card); + kfree(card); + return err; } -/* - * module remove - */ -static void saa7134_audio_fini(void) +void alsa_card_saa7134_exit(void) { - pci_unregister_driver(&saa7134_audio_pci_driver); + int idx; + for (idx = 0; idx < SNDRV_CARDS; idx++) { + snd_card_free(snd_saa7134_cards[idx]); + } } - -module_init(saa7134_audio_init); -module_exit(saa7134_audio_fini); - -/* ----------------------------------------------------------- */ -/* - * Local variables: - * c-basic-offset: 8 - * End: - */ diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index 109c815c5e6c..538c9ce2f2bb 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c @@ -57,6 +57,10 @@ static unsigned int oss = 0; module_param(oss, int, 0444); MODULE_PARM_DESC(oss,"register oss devices (default: no)"); +static unsigned int alsa = 0; +module_param(alsa, int, 0444); +MODULE_PARM_DESC(alsa,"register alsa devices (default: no)"); + static unsigned int latency = UNSET; module_param(latency, int, 0444); MODULE_PARM_DESC(latency,"pci latency timer"); @@ -591,13 +595,19 @@ static irqreturn_t saa7134_irq(int irq, void *dev_id, struct pt_regs *regs) card_has_mpeg(dev)) saa7134_irq_ts_done(dev,status); - if ((report & SAA7134_IRQ_REPORT_DONE_RA3)) - saa7134_irq_oss_done(dev,status); + if ((report & SAA7134_IRQ_REPORT_DONE_RA3)) { + if (oss) { + saa7134_irq_oss_done(dev,status); + } else if (alsa) { + saa7134_irq_alsa_done(dev,status); + } + } if ((report & (SAA7134_IRQ_REPORT_GPIO16 | SAA7134_IRQ_REPORT_GPIO18)) && dev->remote) saa7134_input_irq(dev); + } if (10 == loop) { @@ -1016,6 +1026,10 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, goto fail5; printk(KERN_INFO "%s: registered device mixer%d\n", dev->name,dev->oss.minor_mixer >> 4); + } else if (alsa) { + alsa_card_saa7134_create(dev); + printk(KERN_INFO "%s: registered ALSA devices\n", + dev->name); } break; } @@ -1043,6 +1057,8 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, case PCI_DEVICE_ID_PHILIPS_SAA7135: if (oss) unregister_sound_dsp(dev->oss.minor_dsp); + else if (alsa) + alsa_card_saa7134_exit(); break; } fail4: @@ -1102,7 +1118,8 @@ static void __devexit saa7134_finidev(struct pci_dev *pci_dev) if (oss) { unregister_sound_mixer(dev->oss.minor_mixer); unregister_sound_dsp(dev->oss.minor_dsp); - } + } else if (alsa) + alsa_card_saa7134_exit(); break; } saa7134_unregister_video(dev); diff --git a/drivers/media/video/saa7134/saa7134-oss.c b/drivers/media/video/saa7134/saa7134-oss.c index c20630c82f1c..b1dcb4d10788 100644 --- a/drivers/media/video/saa7134/saa7134-oss.c +++ b/drivers/media/video/saa7134/saa7134-oss.c @@ -44,6 +44,7 @@ MODULE_PARM_DESC(oss_rate,"sample rate (valid are: 32000,48000)"); #define dprintk(fmt, arg...) if (oss_debug) \ printk(KERN_DEBUG "%s/oss: " fmt, dev->name , ## arg) + /* ------------------------------------------------------------------ */ static int dsp_buffer_conf(struct saa7134_dev *dev, int blksize, int blocks) @@ -173,8 +174,8 @@ static int dsp_rec_start(struct saa7134_dev *dev) fmt |= (2 << 4); if (!sign) fmt |= 0x04; - saa_writel(0x588 >> 2, dev->oss.blksize -4); - saa_writel(0x58c >> 2, 0x543210 | (fmt << 24)); + saa_writel(SAA7133_NUM_SAMPLES, dev->oss.blksize -4); + saa_writel(SAA7133_AUDIO_CHANNEL, 0x543210 | (fmt << 24)); break; } dprintk("rec_start: afmt=%d ch=%d => fmt=0x%x swap=%c\n", diff --git a/drivers/media/video/saa7134/saa7134-reg.h b/drivers/media/video/saa7134/saa7134-reg.h index fce4f185ef92..58c521fade85 100644 --- a/drivers/media/video/saa7134/saa7134-reg.h +++ b/drivers/media/video/saa7134/saa7134-reg.h @@ -43,6 +43,14 @@ #define SAA7134_FIFO_SIZE (0x2a0 >> 2) #define SAA7134_THRESHOULD (0x2a4 >> 2) +#define SAA7133_NUM_SAMPLES (0x588 >> 2) +#define SAA7133_AUDIO_CHANNEL (0x58c >> 2) +#define SAA7133_AUDIO_FORMAT (0x58f >> 2) +#define SAA7133_DIGITAL_OUTPUT_SEL1 (0x46c >> 2) +#define SAA7133_DIGITAL_OUTPUT_SEL2 (0x470 >> 2) +#define SAA7133_DIGITAL_INPUT_XBAR1 (0x464 >> 2) +#define SAA7133_ANALOG_IO_SELECT (0x594 >> 2) + /* main control */ #define SAA7134_MAIN_CTRL (0x2a8 >> 2) #define SAA7134_MAIN_CTRL_VPLLE (1 << 15) diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index 9dfd45bed92b..7a35ef8fecb7 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h @@ -45,6 +45,10 @@ #endif #define UNSET (-1U) +#include +#include +#include + /* ----------------------------------------------------------- */ /* enums */ @@ -364,6 +368,7 @@ struct saa7134_oss { unsigned int dma_blk; unsigned int read_offset; unsigned int read_count; + snd_pcm_substream_t *substream; }; /* IR input */ @@ -644,6 +649,11 @@ int saa7134_input_init1(struct saa7134_dev *dev); void saa7134_input_fini(struct saa7134_dev *dev); void saa7134_input_irq(struct saa7134_dev *dev); +int alsa_card_saa7134_create(struct saa7134_dev *saadev); +void alsa_card_saa7134_exit(void); +void saa7134_irq_alsa_done(struct saa7134_dev *dev, unsigned long status); + + /* * Local variables: * c-basic-offset: 8 -- cgit v1.2.2 From 4d63cb45a2ee5cbf2e6d568fb2c4007a52e21bcf Mon Sep 17 00:00:00 2001 From: Alexey Dobriyan Date: Tue, 8 Nov 2005 21:37:12 -0800 Subject: [PATCH] v4l: 721: check kthread correctly - Check ->kthread correctly Signed-off-by: Alexey Dobriyan Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/msp3400.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/video/msp3400.c b/drivers/media/video/msp3400.c index 6e2b0775a74e..88cc793c0bc9 100644 --- a/drivers/media/video/msp3400.c +++ b/drivers/media/video/msp3400.c @@ -1566,7 +1566,7 @@ static int msp_detach(struct i2c_client *client) struct msp3400c *msp = i2c_get_clientdata(client); /* shutdown control thread */ - if (msp->kthread >= 0) { + if (msp->kthread) { msp->restart = 1; kthread_stop(msp->kthread); } -- cgit v1.2.2 From c06f57f55a0e499ec38fbb62812ad3fe08ad246e Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 8 Nov 2005 21:37:13 -0800 Subject: [PATCH] v4l: 723: fix build for 2.6.14 - Fix build for 2.6.14 Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/em28xx/em28xx-i2c.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c index f1493c48656b..d6ae2e397c5e 100644 --- a/drivers/media/video/em28xx/em28xx-i2c.c +++ b/drivers/media/video/em28xx/em28xx-i2c.c @@ -329,8 +329,6 @@ static int attach_inform(struct i2c_client *client) } static struct i2c_algorithm em2820_algo = { - .name = "em2820", - .id = I2C_HW_B_EM2820, .master_xfer = em2820_i2c_xfer, .algo_control = algo_control, .functionality = functionality, -- cgit v1.2.2 From b2c15ea9b23c216bb49303c076bbdcef7e7ba278 Mon Sep 17 00:00:00 2001 From: Ricardo Cerqueira Date: Tue, 8 Nov 2005 21:37:14 -0800 Subject: [PATCH] v4l: 725: fixed kernel oops when hotswapping pc cards - Fixed kernel oops when hotswapping PC Cards Signed-off-by: Ricardo Cerqueira Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/saa7134/saa7134-alsa.c | 270 ++++++++++++++++++++++------- 1 file changed, 210 insertions(+), 60 deletions(-) diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c index 84eeeba21d74..cf4ee6d6ef64 100644 --- a/drivers/media/video/saa7134/saa7134-alsa.c +++ b/drivers/media/video/saa7134/saa7134-alsa.c @@ -4,15 +4,7 @@ * * * Caveats: - * I still haven't got the mixer settings right. - * * - Volume doesn't work (it's always at max) - * - There's no "memory" of the capture channel. It can be changed, - * but alsamixer doesn't show it after a module restart (rmmod/insmod) - * - * Hotswapping DOES NOT work yet! Please remove the module before - * inserting cardbus cards. pcmcia-cs or pccardd should load it - * properly after insertion, and things will work * * 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 @@ -49,6 +41,10 @@ static unsigned int alsa_debug = 0; module_param(alsa_debug, int, 0644); MODULE_PARM_DESC(alsa_debug,"enable debug messages [alsa]"); +/* + * Configuration macros + */ + #define MAX_PCM_DEVICES 1 #define MAX_PCM_SUBSTREAMS 1 @@ -67,20 +63,21 @@ MODULE_PARM_DESC(alsa_debug,"enable debug messages [alsa]"); #define USE_PERIODS_MAX 1024 #endif - -#define dprintk(fmt, arg...) if (alsa_debug) \ - printk(KERN_DEBUG "%s/alsa: " fmt, dev->name , ## arg) - +#define MIXER_ADDR_TVTUNER 0 +#define MIXER_ADDR_LINE1 1 +#define MIXER_ADDR_LINE2 2 +#define MIXER_ADDR_LAST 2 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ static int enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 0}; -#define MIXER_ADDR_TVTUNER 0 -#define MIXER_ADDR_LINE1 1 -#define MIXER_ADDR_LINE2 2 -#define MIXER_ADDR_LAST 2 +#define dprintk(fmt, arg...) if (alsa_debug) \ + printk(KERN_DEBUG "%s/alsa: " fmt, dev->name , ## arg) +/* + * Main chip structure + */ typedef struct snd_card_saa7134 { snd_card_t *card; spinlock_t mixer_lock; @@ -95,6 +92,10 @@ typedef struct snd_card_saa7134 { spinlock_t lock; } snd_card_saa7134_t; +/* + * PCM structure + */ + typedef struct snd_card_saa7134_pcm { struct saa7134_dev *saadev; @@ -107,13 +108,34 @@ typedef struct snd_card_saa7134_pcm { static snd_card_t *snd_saa7134_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; +/* + * saa7134 DMA audio stop + * + * Called when the capture device is released or the buffer overflows + * + * - Copied verbatim from saa7134-oss's dsp_dma_stop. Can be dropped + * if we just share dsp_dma_stop and use it here + * + */ + static void saa7134_dma_stop(struct saa7134_dev *dev) + { dev->oss.dma_blk = -1; dev->oss.dma_running = 0; saa7134_set_dmabits(dev); } +/* + * saa7134 DMA audio start + * + * Called when preparing the capture device for use + * + * - Copied verbatim from saa7134-oss's dsp_dma_start. Can be dropped + * if we just share dsp_dma_start and use it here + * + */ + static void saa7134_dma_start(struct saa7134_dev *dev) { dev->oss.dma_blk = 0; @@ -121,6 +143,17 @@ static void saa7134_dma_start(struct saa7134_dev *dev) saa7134_set_dmabits(dev); } +/* + * saa7134 audio DMA IRQ handler + * + * Called whenever we get an SAA7134_IRQ_REPORT_DONE_RA3 interrupt + * Handles shifting between the 2 buffers, manages the read counters, + * and notifies ALSA when periods elapse + * + * - Mostly copied from saa7134-oss's saa7134_irq_oss_done. + * + */ + void saa7134_irq_alsa_done(struct saa7134_dev *dev, unsigned long status) { int next_blk, reg = 0; @@ -179,6 +212,15 @@ void saa7134_irq_alsa_done(struct saa7134_dev *dev, unsigned long status) } +/* + * ALSA capture trigger + * + * - One of the ALSA capture callbacks. + * + * Called whenever a capture is started or stopped. Must be defined, + * but there's nothing we want to do here + * + */ static int snd_card_saa7134_capture_trigger(snd_pcm_substream_t * substream, int cmd) @@ -186,6 +228,18 @@ static int snd_card_saa7134_capture_trigger(snd_pcm_substream_t * substream, return 0; } +/* + * DMA buffer config + * + * Sets the values that will later be used as the size of the buffer, + * size of the fragments, and total number of fragments. + * Must be called during the preparation stage, before memory is + * allocated + * + * - Copied verbatim from saa7134-oss. Can be dropped + * if we just share dsp_buffer_conf from OSS. + */ + static int dsp_buffer_conf(struct saa7134_dev *dev, int blksize, int blocks) { if (blksize < 0x100) @@ -207,6 +261,17 @@ static int dsp_buffer_conf(struct saa7134_dev *dev, int blksize, int blocks) return 0; } +/* + * DMA buffer initialization + * + * Uses V4L functions to initialize the DMA. Shouldn't be necessary in + * ALSA, but I was unable to use ALSA's own DMA, and had to force the + * usage of V4L's + * + * - Copied verbatim from saa7134-oss. Can be dropped + * if we just share dsp_buffer_init from OSS. + */ + static int dsp_buffer_init(struct saa7134_dev *dev) { int err; @@ -221,8 +286,19 @@ static int dsp_buffer_init(struct saa7134_dev *dev) return 0; } +/* + * ALSA PCM preparation + * + * - One of the ALSA capture callbacks. + * + * Called right after the capture device is opened, this function configures + * the buffer using the previously defined functions, allocates the memory, + * sets up the hardware registers, and then starts the DMA. When this function + * returns, the audio should be flowing. + * + */ -static int snd_card_saa7134_pcm_prepare(snd_pcm_substream_t * substream) +static int snd_card_saa7134_capture_prepare(snd_pcm_substream_t * substream) { snd_pcm_runtime_t *runtime = substream->runtime; int err, bswap, sign; @@ -329,7 +405,6 @@ static int snd_card_saa7134_pcm_prepare(snd_pcm_substream_t * substream) fmt |= (2 << 4); if (!sign) fmt |= 0x04; - //saa_writel(SAA7133_NUM_SAMPLES, dev->oss.blksize -1); saa_writel(SAA7133_NUM_SAMPLES, dev->oss.blksize -1); saa_writel(SAA7133_AUDIO_CHANNEL, 0x543210 | (fmt << 24)); //saa_writel(SAA7133_AUDIO_CHANNEL, 0x543210); @@ -346,7 +421,12 @@ static int snd_card_saa7134_pcm_prepare(snd_pcm_substream_t * substream) if (bswap) control |= SAA7134_RS_CONTROL_BSWAP; + /* I should be able to use runtime->dma_addr in the control + byte, but it doesn't work. So I allocate the DMA using the + V4L functions, and force ALSA to use that as the DMA area */ + runtime->dma_area = dev->oss.dma.vmalloc; + saa_writel(SAA7134_RS_BA1(6),0); saa_writel(SAA7134_RS_BA2(6),dev->oss.blksize); saa_writel(SAA7134_RS_PITCH(6),0); @@ -368,12 +448,18 @@ static int snd_card_saa7134_pcm_prepare(snd_pcm_substream_t * substream) } -static int snd_card_saa7134_capture_prepare(snd_pcm_substream_t * substream) -{ - return snd_card_saa7134_pcm_prepare(substream); -} +/* + * ALSA pointer fetching + * + * - One of the ALSA capture callbacks. + * + * Called whenever a period elapses, it must return the current hardware + * position of the buffer. + * Also resets the read counter used to prevent overruns + * + */ -static snd_pcm_uframes_t snd_card_saa7134_pointer(snd_pcm_substream_t * substream) +static snd_pcm_uframes_t snd_card_saa7134_capture_pointer(snd_pcm_substream_t * substream) { snd_pcm_runtime_t *runtime = substream->runtime; snd_card_saa7134_pcm_t *saapcm = runtime->private_data; @@ -388,15 +474,12 @@ static snd_pcm_uframes_t snd_card_saa7134_pointer(snd_pcm_substream_t * substrea dev->oss.read_offset = 0; } - //return bytes_to_frames(runtime, saa_readl(dev->oss.recording_on)); return bytes_to_frames(runtime, dev->oss.read_offset); } - -static snd_pcm_uframes_t snd_card_saa7134_capture_pointer(snd_pcm_substream_t * substream) -{ - return snd_card_saa7134_pointer(substream); -} +/* + * ALSA hardware capabilities definition + */ static snd_pcm_hardware_t snd_card_saa7134_capture = { @@ -425,6 +508,17 @@ static void snd_card_saa7134_runtime_free(snd_pcm_runtime_t *runtime) } +/* + * ALSA hardware params + * + * - One of the ALSA capture callbacks. + * + * Called on initialization, right before the PCM preparation + * Usually used in ALSA to allocate the DMA, but since we don't use the + * ALSA DMA I'm almost sure this isn't necessary. + * + */ + static int snd_card_saa7134_hw_params(snd_pcm_substream_t * substream, snd_pcm_hw_params_t * hw_params) { @@ -434,11 +528,29 @@ static int snd_card_saa7134_hw_params(snd_pcm_substream_t * substream, } +/* + * ALSA hardware release + * + * - One of the ALSA capture callbacks. + * + * Called after closing the device, but before snd_card_saa7134_capture_close + * Usually used in ALSA to free the DMA, but since we don't use the + * ALSA DMA I'm almost sure this isn't necessary. + * + */ + static int snd_card_saa7134_hw_free(snd_pcm_substream_t * substream) { return snd_pcm_lib_free_pages(substream); } +/* + * DMA buffer release + * + * Called after closing the device, during snd_card_saa7134_capture_close + * + */ + static int dsp_buffer_free(struct saa7134_dev *dev) { if (!dev->oss.blksize) @@ -453,9 +565,20 @@ static int dsp_buffer_free(struct saa7134_dev *dev) return 0; } +/* + * ALSA capture finish + * + * - One of the ALSA capture callbacks. + * + * Called after closing the device. It stops the DMA audio and releases + * the buffers + * + */ -static int saa7134_cap_close(struct saa7134_dev *dev) +static int snd_card_saa7134_capture_close(snd_pcm_substream_t * substream) { + snd_card_saa7134_t *chip = snd_pcm_substream_chip(substream); + struct saa7134_dev *dev = chip->saadev; unsigned long flags; /* stop dma */ @@ -471,8 +594,23 @@ static int saa7134_cap_close(struct saa7134_dev *dev) return 0; } +/* + * ALSA capture start + * + * - One of the ALSA capture callbacks. + * + * Called when opening the device. It creates and populates the PCM + * structure + * + */ -static int saa7134_cap_open(struct saa7134_dev *dev) { +static int snd_card_saa7134_capture_open(snd_pcm_substream_t * substream) +{ + snd_pcm_runtime_t *runtime = substream->runtime; + snd_card_saa7134_pcm_t *saapcm; + snd_card_saa7134_t *saa7134 = snd_pcm_substream_chip(substream); + struct saa7134_dev *dev = saa7134->saadev; + int err; down(&dev->oss.lock); @@ -483,18 +621,6 @@ static int saa7134_cap_open(struct saa7134_dev *dev) { up(&dev->oss.lock); - return 0; -} - -static int snd_card_saa7134_capture_open(snd_pcm_substream_t * substream) -{ - snd_pcm_runtime_t *runtime = substream->runtime; - snd_card_saa7134_pcm_t *saapcm; - snd_card_saa7134_t *saa7134 = snd_pcm_substream_chip(substream); - int err; - - saa7134_cap_open(saa7134->saadev); - saapcm = kcalloc(1, sizeof(*saapcm), GFP_KERNEL); if (saapcm == NULL) return -ENOMEM; @@ -513,13 +639,9 @@ static int snd_card_saa7134_capture_open(snd_pcm_substream_t * substream) return 0; } -static int snd_card_saa7134_capture_close(snd_pcm_substream_t * substream) -{ - snd_card_saa7134_t *chip = snd_pcm_substream_chip(substream); - - saa7134_cap_close(chip->saadev); - return 0; -} +/* + * ALSA capture callbacks definition + */ static snd_pcm_ops_t snd_card_saa7134_capture_ops = { .open = snd_card_saa7134_capture_open, @@ -532,7 +654,15 @@ static snd_pcm_ops_t snd_card_saa7134_capture_ops = { .pointer = snd_card_saa7134_capture_pointer, }; -static int __init snd_card_saa7134_pcm(snd_card_saa7134_t *saa7134, int device) +/* + * ALSA PCM setup + * + * Called when initializing the board. Sets up the name and hooks up + * the callbacks + * + */ + +static int snd_card_saa7134_pcm(snd_card_saa7134_t *saa7134, int device) { snd_pcm_t *pcm; int err; @@ -612,7 +742,7 @@ static int snd_saa7134_volume_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_ static int snd_saa7134_capsrc_info(snd_kcontrol_t * kcontrol, snd_ctl_elem_info_t * uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; - uinfo->count = 1; + uinfo->count = 2; uinfo->value.integer.min = 0; uinfo->value.integer.max = 1; return 0; @@ -647,7 +777,7 @@ static int snd_saa7134_capsrc_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_ right = ucontrol->value.integer.value[1] & 1; spin_lock_irqsave(&chip->mixer_lock, flags); - change = chip->capture_source[addr][0] != left && + change = chip->capture_source[addr][0] != left || chip->capture_source[addr][1] != right; chip->capture_source[addr][0] = left; chip->capture_source[addr][1] = right; @@ -655,7 +785,8 @@ static int snd_saa7134_capsrc_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_ spin_unlock_irqrestore(&chip->mixer_lock, flags); - switch (dev->pci->device) { + if (change) { + switch (dev->pci->device) { case PCI_DEVICE_ID_PHILIPS_SAA7134: switch (addr) { @@ -702,7 +833,8 @@ static int snd_saa7134_capsrc_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_ saa_dsp_writel(dev, SAA7133_DIGITAL_INPUT_XBAR1, 0); saa_writel(SAA7133_ANALOG_IO_SELECT, 0); } - } + } + } return change; } @@ -716,7 +848,15 @@ SAA713x_VOLUME("Line Volume", 2, MIXER_ADDR_LINE2), SAA713x_CAPSRC("Line Capture Switch", 2, MIXER_ADDR_LINE2), }; -static int __init snd_card_saa7134_new_mixer(snd_card_saa7134_t * chip) +/* + * ALSA mixer setup + * + * Called when initializing the board. Sets up the name and hooks up + * the callbacks + * + */ + +static int snd_card_saa7134_new_mixer(snd_card_saa7134_t * chip) { snd_card_t *card = chip->card; unsigned int idx; @@ -743,11 +883,19 @@ static int snd_saa7134_dev_free(snd_device_t *device) return snd_saa7134_free(chip); } +/* + * ALSA initialization + * + * Called by saa7134-core, it creates the basic structures and registers + * the ALSA devices + * + */ + int alsa_card_saa7134_create(struct saa7134_dev *saadev) { static int dev; snd_card_t *card; - struct snd_card_saa7134 *chip; + snd_card_saa7134_t *chip; int err; static snd_device_ops_t ops = { .dev_free = snd_saa7134_dev_free, @@ -757,14 +905,16 @@ int alsa_card_saa7134_create(struct saa7134_dev *saadev) return -ENODEV; if (!enable[dev]) return -ENODEV; + card = snd_card_new(index[dev], id[dev], THIS_MODULE, - sizeof(struct snd_card_saa7134)); + 0); if (card == NULL) return -ENOMEM; strcpy(card->driver, "SAA7134"); /* Card "creation" */ + chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); if (chip == NULL) { return -ENOMEM; @@ -775,6 +925,7 @@ int alsa_card_saa7134_create(struct saa7134_dev *saadev) chip->saadev = saadev; chip->card = card; + chip->pci = saadev->pci; chip->irq = saadev->pci->irq; chip->iobase = pci_resource_start(saadev->pci, 0); @@ -784,12 +935,12 @@ int alsa_card_saa7134_create(struct saa7134_dev *saadev) return err; } - if ((err = snd_card_saa7134_new_mixer(chip)) < 0) goto __nodev; if ((err = snd_card_saa7134_pcm(chip, 0)) < 0) goto __nodev; + spin_lock_init(&chip->mixer_lock); snd_card_set_dev(card, &chip->pci->dev); @@ -800,7 +951,6 @@ int alsa_card_saa7134_create(struct saa7134_dev *saadev) sprintf(card->longname, "%s at 0x%lx irq %d", card->shortname, chip->iobase, chip->irq); - if ((err = snd_card_register(card)) == 0) { snd_saa7134_cards[dev] = card; return 0; -- cgit v1.2.2 From a866623cdc94a3a800167568db24bc55b6860ef0 Mon Sep 17 00:00:00 2001 From: Ricardo Cerqueira Date: Tue, 8 Nov 2005 21:37:14 -0800 Subject: [PATCH] v4l: 727: fixed a bug that caused some saa7133 code to run on saa7134 boards - Fixed a bug that caused some saa7133 code to run on saa7134 boards Signed-off-by: Ricardo Cerqueira Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/saa7134/saa7134-alsa.c | 16 +++++++++------- drivers/media/video/saa7134/saa7134-core.c | 2 +- drivers/media/video/saa7134/saa7134.h | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c index cf4ee6d6ef64..465beac941d7 100644 --- a/drivers/media/video/saa7134/saa7134-alsa.c +++ b/drivers/media/video/saa7134/saa7134-alsa.c @@ -45,9 +45,6 @@ MODULE_PARM_DESC(alsa_debug,"enable debug messages [alsa]"); * Configuration macros */ -#define MAX_PCM_DEVICES 1 -#define MAX_PCM_SUBSTREAMS 1 - /* defaults */ #define MAX_BUFFER_SIZE (256*1024) #define USE_FORMATS SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S16_BE | SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_U16_LE | SNDRV_PCM_FMTBIT_U16_BE @@ -804,6 +801,7 @@ static int snd_saa7134_capsrc_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_ break; } + break; case PCI_DEVICE_ID_PHILIPS_SAA7133: case PCI_DEVICE_ID_PHILIPS_SAA7135: xbarin = 0x03; // adc @@ -833,6 +831,7 @@ static int snd_saa7134_capsrc_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_ saa_dsp_writel(dev, SAA7133_DIGITAL_INPUT_XBAR1, 0); saa_writel(SAA7133_ANALOG_IO_SELECT, 0); } + break; } } @@ -891,7 +890,7 @@ static int snd_saa7134_dev_free(snd_device_t *device) * */ -int alsa_card_saa7134_create(struct saa7134_dev *saadev) +int alsa_card_saa7134_create(struct saa7134_dev *saadev, unsigned int devicenum) { static int dev; snd_card_t *card; @@ -906,8 +905,11 @@ int alsa_card_saa7134_create(struct saa7134_dev *saadev) if (!enable[dev]) return -ENODEV; - card = snd_card_new(index[dev], id[dev], THIS_MODULE, - 0); + if (devicenum) { + card = snd_card_new(devicenum, id[dev], THIS_MODULE, 0); + } else { + card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); + } if (card == NULL) return -ENOMEM; @@ -949,7 +951,7 @@ int alsa_card_saa7134_create(struct saa7134_dev *saadev) strcpy(card->shortname, "SAA7134"); sprintf(card->longname, "%s at 0x%lx irq %d", - card->shortname, chip->iobase, chip->irq); + chip->saadev->name, chip->iobase, chip->irq); if ((err = snd_card_register(card)) == 0) { snd_saa7134_cards[dev] = card; diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index 538c9ce2f2bb..907dbd4de7c9 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c @@ -1027,7 +1027,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, printk(KERN_INFO "%s: registered device mixer%d\n", dev->name,dev->oss.minor_mixer >> 4); } else if (alsa) { - alsa_card_saa7134_create(dev); + alsa_card_saa7134_create(dev,dsp_nr[dev->nr]); printk(KERN_INFO "%s: registered ALSA devices\n", dev->name); } diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index 7a35ef8fecb7..52fc4425b711 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h @@ -649,7 +649,7 @@ int saa7134_input_init1(struct saa7134_dev *dev); void saa7134_input_fini(struct saa7134_dev *dev); void saa7134_input_irq(struct saa7134_dev *dev); -int alsa_card_saa7134_create(struct saa7134_dev *saadev); +int alsa_card_saa7134_create(struct saa7134_dev *saadev, unsigned int devnum); void alsa_card_saa7134_exit(void); void saa7134_irq_alsa_done(struct saa7134_dev *dev, unsigned long status); -- cgit v1.2.2 From 376f269e4731a90db41683cb72717e217d3774f5 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Tue, 8 Nov 2005 21:37:15 -0800 Subject: [PATCH] v4l: 728: vidiocsfreq and vidiocgfreq expect an unsigned long as argument - VIDIOCSFREQ and VIDIOCGFREQ expect an unsigned long as argument. Signed-off-by: Hans Verkuil Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/v4l1-compat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/video/v4l1-compat.c b/drivers/media/video/v4l1-compat.c index d679ca23ded7..88beb5a3be15 100644 --- a/drivers/media/video/v4l1-compat.c +++ b/drivers/media/video/v4l1-compat.c @@ -708,7 +708,7 @@ v4l_compat_translate_ioctl(struct inode *inode, } case VIDIOCGFREQ: /* get frequency */ { - int *freq = arg; + unsigned long *freq = arg; freq2.tuner = 0; err = drv(inode, file, VIDIOC_G_FREQUENCY, &freq2); @@ -720,7 +720,7 @@ v4l_compat_translate_ioctl(struct inode *inode, } case VIDIOCSFREQ: /* set frequency */ { - int *freq = arg; + unsigned long *freq = arg; freq2.tuner = 0; drv(inode, file, VIDIOC_G_FREQUENCY, &freq2); -- cgit v1.2.2 From 1f6173ed9b48709383631e2c43eed770f15d05d1 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:37:16 -0800 Subject: [PATCH] v4l: 729: fixed include when compiling at kernel tree - Fixed include when compiling at kernel tree Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/em28xx/em28xx-cards.c | 4 ++-- drivers/media/video/em28xx/em28xx-core.c | 2 +- drivers/media/video/em28xx/em28xx-video.c | 2 +- drivers/media/video/tveeprom.c | 2 +- drivers/media/video/tvp5150.c | 1 - 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index b6d89decfbd8..7333bbad8871 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c @@ -29,8 +29,8 @@ #include #include #include -#include "audiochip.h" -#include "tveeprom.h" +#include +#include #include "msp3400.h" #include "em2820.h" diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index a75a91da70e9..7913740e6724 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c @@ -26,9 +26,9 @@ #include #include #include -#include #include #include +#include #include "em2820.h" diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index a000131a8f5d..3fc58c67e6cf 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c @@ -27,8 +27,8 @@ #include #include #include -#include #include +#include #include #include diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c index a9bad89b4d69..ee605712bf19 100644 --- a/drivers/media/video/tveeprom.c +++ b/drivers/media/video/tveeprom.c @@ -40,7 +40,7 @@ #include #include -#include "audiochip.h" +#include MODULE_DESCRIPTION("i2c Hauppauge eeprom decoder driver"); MODULE_AUTHOR("John Klar"); diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c index 03f360b45fdf..81e6d4494e7d 100644 --- a/drivers/media/video/tvp5150.c +++ b/drivers/media/video/tvp5150.c @@ -5,7 +5,6 @@ * This code is placed under the terms of the GNU General Public License */ -#include #include #include #include -- cgit v1.2.2 From 98f30ed06a0feade6250438b0bd6cc472f26b12a Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:37:17 -0800 Subject: [PATCH] v4l: 739: created make changelog to make easier to generate patches - Created make changelog to make easier to generate patches. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/cx88/cx88-core.c | 2 +- drivers/media/video/cx88/cx88.h | 2 +- drivers/media/video/em28xx/em28xx-core.c | 1 - drivers/media/video/em28xx/em28xx-i2c.c | 1 - drivers/media/video/em28xx/em28xx-video.c | 1 - 5 files changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c index 8f1c27fdae6a..d4d39c1751af 100644 --- a/drivers/media/video/cx88/cx88-core.c +++ b/drivers/media/video/cx88/cx88-core.c @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include "cx88.h" diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h index cc2197a85d01..a690569f345d 100644 --- a/drivers/media/video/cx88/cx88.h +++ b/drivers/media/video/cx88/cx88.h @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index 7913740e6724..e187422f6d6d 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c @@ -28,7 +28,6 @@ #include #include #include -#include #include "em2820.h" diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c index d6ae2e397c5e..150c72bb6e48 100644 --- a/drivers/media/video/em28xx/em28xx-i2c.c +++ b/drivers/media/video/em28xx/em28xx-i2c.c @@ -26,7 +26,6 @@ #include #include #include -#include #include #include diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 3fc58c67e6cf..3581fc4c874d 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include -- cgit v1.2.2 From 4eb0c14465a9221f040551a91238b57af301c145 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Tue, 8 Nov 2005 21:37:18 -0800 Subject: [PATCH] v4l: 754: add the adapter address prefix to the tda9887 kernel messages - Add the adapter/address prefix to the tda9887 kernel messages. Signed-off-by: Hans Verkuil Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/tda9887.c | 110 ++++++++++++++++++++++-------------------- 1 file changed, 59 insertions(+), 51 deletions(-) diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c index ba22f12e8b32..3a7babef06f4 100644 --- a/drivers/media/video/tda9887.c +++ b/drivers/media/video/tda9887.c @@ -44,8 +44,13 @@ MODULE_LICENSE("GPL"); /* ---------------------------------------------------------------------- */ #define UNSET (-1U) -#define PREFIX "tda9885/6/7: " -#define dprintk if (debug) printk +#define tda9887_info(fmt, arg...) do {\ + printk(KERN_INFO "%s %d-%04x: " fmt, t->client.name, \ + i2c_adapter_id(t->client.adapter), t->client.addr , ##arg); } while (0) +#define tda9887_dbg(fmt, arg...) do {\ + if (debug) \ + printk(KERN_INFO "%s %d-%04x: " fmt, t->client.name, \ + i2c_adapter_id(t->client.adapter), t->client.addr , ##arg); } while (0) struct tda9887 { struct i2c_client client; @@ -237,7 +242,7 @@ static struct tvnorm radio_mono = { /* ---------------------------------------------------------------------- */ -static void dump_read_message(unsigned char *buf) +static void dump_read_message(struct tda9887 *t, unsigned char *buf) { static char *afc[16] = { "- 12.5 kHz", @@ -257,15 +262,15 @@ static void dump_read_message(unsigned char *buf) "+ 37.5 kHz", "+ 12.5 kHz", }; - printk(PREFIX "read: 0x%2x\n", buf[0]); - printk(" after power on : %s\n", (buf[0] & 0x01) ? "yes" : "no"); - printk(" afc : %s\n", afc[(buf[0] >> 1) & 0x0f]); - printk(" fmif level : %s\n", (buf[0] & 0x20) ? "high" : "low"); - printk(" afc window : %s\n", (buf[0] & 0x40) ? "in" : "out"); - printk(" vfi level : %s\n", (buf[0] & 0x80) ? "high" : "low"); + tda9887_info("read: 0x%2x\n", buf[0]); + tda9887_info(" after power on : %s\n", (buf[0] & 0x01) ? "yes" : "no"); + tda9887_info(" afc : %s\n", afc[(buf[0] >> 1) & 0x0f]); + tda9887_info(" fmif level : %s\n", (buf[0] & 0x20) ? "high" : "low"); + tda9887_info(" afc window : %s\n", (buf[0] & 0x40) ? "in" : "out"); + tda9887_info(" vfi level : %s\n", (buf[0] & 0x80) ? "high" : "low"); } -static void dump_write_message(unsigned char *buf) +static void dump_write_message(struct tda9887 *t, unsigned char *buf) { static char *sound[4] = { "AM/TV", @@ -305,58 +310,58 @@ static void dump_write_message(unsigned char *buf) "44 MHz", }; - printk(PREFIX "write: byte B 0x%02x\n",buf[1]); - printk(" B0 video mode : %s\n", + tda9887_info("write: byte B 0x%02x\n",buf[1]); + tda9887_info(" B0 video mode : %s\n", (buf[1] & 0x01) ? "video trap" : "sound trap"); - printk(" B1 auto mute fm : %s\n", + tda9887_info(" B1 auto mute fm : %s\n", (buf[1] & 0x02) ? "yes" : "no"); - printk(" B2 carrier mode : %s\n", + tda9887_info(" B2 carrier mode : %s\n", (buf[1] & 0x04) ? "QSS" : "Intercarrier"); - printk(" B3-4 tv sound/radio : %s\n", + tda9887_info(" B3-4 tv sound/radio : %s\n", sound[(buf[1] & 0x18) >> 3]); - printk(" B5 force mute audio: %s\n", + tda9887_info(" B5 force mute audio: %s\n", (buf[1] & 0x20) ? "yes" : "no"); - printk(" B6 output port 1 : %s\n", + tda9887_info(" B6 output port 1 : %s\n", (buf[1] & 0x40) ? "high (inactive)" : "low (active)"); - printk(" B7 output port 2 : %s\n", + tda9887_info(" B7 output port 2 : %s\n", (buf[1] & 0x80) ? "high (inactive)" : "low (active)"); - printk(PREFIX "write: byte C 0x%02x\n",buf[2]); - printk(" C0-4 top adjustment : %s dB\n", adjust[buf[2] & 0x1f]); - printk(" C5-6 de-emphasis : %s\n", deemph[(buf[2] & 0x60) >> 5]); - printk(" C7 audio gain : %s\n", + tda9887_info("write: byte C 0x%02x\n",buf[2]); + tda9887_info(" C0-4 top adjustment : %s dB\n", adjust[buf[2] & 0x1f]); + tda9887_info(" C5-6 de-emphasis : %s\n", deemph[(buf[2] & 0x60) >> 5]); + tda9887_info(" C7 audio gain : %s\n", (buf[2] & 0x80) ? "-6" : "0"); - printk(PREFIX "write: byte E 0x%02x\n",buf[3]); - printk(" E0-1 sound carrier : %s\n", + tda9887_info("write: byte E 0x%02x\n",buf[3]); + tda9887_info(" E0-1 sound carrier : %s\n", carrier[(buf[3] & 0x03)]); - printk(" E6 l pll gating : %s\n", + tda9887_info(" E6 l pll gating : %s\n", (buf[3] & 0x40) ? "36" : "13"); if (buf[1] & 0x08) { /* radio */ - printk(" E2-4 video if : %s\n", + tda9887_info(" E2-4 video if : %s\n", rif[(buf[3] & 0x0c) >> 2]); - printk(" E7 vif agc output : %s\n", + tda9887_info(" E7 vif agc output : %s\n", (buf[3] & 0x80) ? ((buf[3] & 0x10) ? "fm-agc radio" : "sif-agc radio") : "fm radio carrier afc"); } else { /* video */ - printk(" E2-4 video if : %s\n", + tda9887_info(" E2-4 video if : %s\n", vif[(buf[3] & 0x1c) >> 2]); - printk(" E5 tuner gain : %s\n", + tda9887_info(" E5 tuner gain : %s\n", (buf[3] & 0x80) ? ((buf[3] & 0x20) ? "external" : "normal") : ((buf[3] & 0x20) ? "minimum" : "normal")); - printk(" E7 vif agc output : %s\n", + tda9887_info(" E7 vif agc output : %s\n", (buf[3] & 0x80) ? ((buf[3] & 0x20) ? "pin3 port, pin22 vif agc out" : "pin22 port, pin3 vif acg ext in") : "pin3+pin22 port"); } - printk("--\n"); + tda9887_info("--\n"); } /* ---------------------------------------------------------------------- */ @@ -380,11 +385,11 @@ static int tda9887_set_tvnorm(struct tda9887 *t, char *buf) } } if (NULL == norm) { - dprintk(PREFIX "Unsupported tvnorm entry - audio muted\n"); + tda9887_dbg("Unsupported tvnorm entry - audio muted\n"); return -1; } - dprintk(PREFIX "configure for: %s\n",norm->name); + tda9887_dbg("configure for: %s\n",norm->name); buf[1] = norm->b; buf[2] = norm->c; buf[3] = norm->e; @@ -506,26 +511,26 @@ static int tda9887_fixup_std(struct tda9887 *t) case 'B': case 'g': case 'G': - dprintk(PREFIX "insmod fixup: PAL => PAL-BG\n"); + tda9887_dbg("insmod fixup: PAL => PAL-BG\n"); t->std = V4L2_STD_PAL_BG; break; case 'i': case 'I': - dprintk(PREFIX "insmod fixup: PAL => PAL-I\n"); + tda9887_dbg("insmod fixup: PAL => PAL-I\n"); t->std = V4L2_STD_PAL_I; break; case 'd': case 'D': case 'k': case 'K': - dprintk(PREFIX "insmod fixup: PAL => PAL-DK\n"); + tda9887_dbg("insmod fixup: PAL => PAL-DK\n"); t->std = V4L2_STD_PAL_DK; break; case '-': /* default parameter, do nothing */ break; default: - printk(PREFIX "pal= argument not recognised\n"); + tda9887_info("pal= argument not recognised\n"); break; } } @@ -535,19 +540,19 @@ static int tda9887_fixup_std(struct tda9887 *t) case 'D': case 'k': case 'K': - dprintk(PREFIX "insmod fixup: SECAM => SECAM-DK\n"); + tda9887_dbg("insmod fixup: SECAM => SECAM-DK\n"); t->std = V4L2_STD_SECAM_DK; break; case 'l': case 'L': - dprintk(PREFIX "insmod fixup: SECAM => SECAM-L\n"); + tda9887_dbg("insmod fixup: SECAM => SECAM-L\n"); t->std = V4L2_STD_SECAM_L; break; case '-': /* default parameter, do nothing */ break; default: - printk(PREFIX "secam= argument not recognised\n"); + tda9887_info("secam= argument not recognised\n"); break; } } @@ -561,8 +566,8 @@ static int tda9887_status(struct tda9887 *t) memset(buf,0,sizeof(buf)); if (1 != (rc = i2c_master_recv(&t->client,buf,1))) - printk(PREFIX "i2c i/o error: rc == %d (should be 1)\n",rc); - dump_read_message(buf); + tda9887_info("i2c i/o error: rc == %d (should be 1)\n",rc); + dump_read_message(t, buf); return 0; } @@ -588,13 +593,13 @@ static int tda9887_configure(struct tda9887 *t) } - dprintk(PREFIX "writing: b=0x%02x c=0x%02x e=0x%02x\n", + tda9887_dbg("writing: b=0x%02x c=0x%02x e=0x%02x\n", buf[1],buf[2],buf[3]); if (debug > 1) - dump_write_message(buf); + dump_write_message(t, buf); if (4 != (rc = i2c_master_send(&t->client,buf,4))) - printk(PREFIX "i2c i/o error: rc == %d (should be 4)\n",rc); + tda9887_info("i2c i/o error: rc == %d (should be 4)\n",rc); if (debug > 2) { msleep_interruptible(1000); @@ -612,8 +617,6 @@ static int tda9887_attach(struct i2c_adapter *adap, int addr, int kind) client_template.adapter = adap; client_template.addr = addr; - printk(PREFIX "chip found @ 0x%x\n", addr<<1); - if (NULL == (t = kmalloc(sizeof(*t), GFP_KERNEL))) return -ENOMEM; memset(t,0,sizeof(*t)); @@ -623,6 +626,8 @@ static int tda9887_attach(struct i2c_adapter *adap, int addr, int kind) t->pinnacle_id = UNSET; t->radio_mode = V4L2_TUNER_MODE_STEREO; + tda9887_info("chip found @ 0x%x (%s)\n", addr<<1, adap->name); + i2c_set_clientdata(&t->client, t); i2c_attach_client(&t->client); @@ -656,10 +661,10 @@ static int tda9887_detach(struct i2c_client *client) } #define SWITCH_V4L2 if (!t->using_v4l2 && debug) \ - printk(PREFIX "switching to v4l2\n"); \ + tda9887_info("switching to v4l2\n"); \ t->using_v4l2 = 1; #define CHECK_V4L2 if (t->using_v4l2) { if (debug) \ - printk(PREFIX "ignore v4l1 call\n"); \ + tda9887_info("ignore v4l1 call\n"); \ return 0; } static int @@ -787,7 +792,10 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg) static int tda9887_suspend(struct device * dev, pm_message_t state) { - dprintk("tda9887: suspend\n"); + struct i2c_client *c = container_of(dev, struct i2c_client, dev); + struct tda9887 *t = i2c_get_clientdata(c); + + tda9887_dbg("suspend\n"); return 0; } @@ -796,7 +804,7 @@ static int tda9887_resume(struct device * dev) struct i2c_client *c = container_of(dev, struct i2c_client, dev); struct tda9887 *t = i2c_get_clientdata(c); - dprintk("tda9887: resume\n"); + tda9887_dbg("resume\n"); tda9887_configure(t); return 0; } -- cgit v1.2.2 From 6df840f20d1ff63fd13ed1bb3e186395ee800794 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:37:18 -0800 Subject: [PATCH] v4l: 758: some improvements at msp3400 c from ivtv code - Some improvements at msp3400.c from ivtv code. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/msp3400.c | 440 +++++++++++++++++++++++------------------- 1 file changed, 245 insertions(+), 195 deletions(-) diff --git a/drivers/media/video/msp3400.c b/drivers/media/video/msp3400.c index 88cc793c0bc9..4689dee882f3 100644 --- a/drivers/media/video/msp3400.c +++ b/drivers/media/video/msp3400.c @@ -73,13 +73,22 @@ static int dolby = 0; static int stereo_threshold = 0x190; /* a2 threshold for stereo/bilingual (msp34xxg only) 0x00a0-0x03c0 */ +#define DFP_COUNT 0x41 +static const int bl_dfp[] = { + 0x00, 0x01, 0x02, 0x03, 0x06, 0x08, 0x09, 0x0a, + 0x0b, 0x0d, 0x0e, 0x10 +}; + +#define IS_MSP34XX_G(msp) ((msp)->opmode==2) struct msp3400c { int rev1,rev2; int opmode; + int nicam; int mode; int norm; + int stereo; int nicam_on; int acb; int main, second; /* sound carrier */ @@ -91,9 +100,12 @@ struct msp3400c { int rxsubchans; int muted; - int volume, balance; + int left, right; /* volume */ int bass, treble; + /* shadow register set */ + int dfp_regs[DFP_COUNT]; + /* thread */ struct task_struct *kthread; wait_queue_head_t wq; @@ -101,6 +113,8 @@ struct msp3400c { int watch_stereo:1; }; +#define MIN(a,b) (((a)>(b))?(b):(a)) +#define MAX(a,b) (((a)>(b))?(a):(b)) #define HAVE_NICAM(msp) (((msp->rev2>>8) & 0xff) != 00) #define HAVE_SIMPLE(msp) ((msp->rev1 & 0xff) >= 'D'-'@') #define HAVE_SIMPLER(msp) ((msp->rev1 & 0xff) >= 'G'-'@') @@ -112,6 +126,7 @@ struct msp3400c { #define dprintk if (debug >= 1) printk #define d2printk if (debug >= 2) printk +#define dprintk_trace if (debug>=16) printk /* read-only */ module_param(opmode, int, 0444); @@ -132,11 +147,6 @@ MODULE_PARM_DESC(standard, "Specify audio standard: 32 = NTSC, 64 = radio, Defau MODULE_PARM_DESC(amsound, "Hardwire AM sound at 6.5Hz (France), FM can autoscan"); MODULE_PARM_DESC(dolby, "Activates Dolby processsing"); - -MODULE_DESCRIPTION("device driver for msp34xx TV sound processor"); -MODULE_AUTHOR("Gerd Knorr"); -MODULE_LICENSE("Dual BSD/GPL"); /* FreeBSD uses this too */ - /* ---------------------------------------------------------------------- */ #define I2C_MSP3400C 0x80 @@ -153,6 +163,10 @@ static unsigned short normal_i2c[] = { }; I2C_CLIENT_INSMOD; +MODULE_DESCRIPTION("device driver for msp34xx TV sound processor"); +MODULE_AUTHOR("Gerd Knorr"); +MODULE_LICENSE("GPL"); + /* ----------------------------------------------------------------------- */ /* functions for talking to the MSP3400C Sound processor */ @@ -172,6 +186,7 @@ static int msp3400c_reset(struct i2c_client *client) { client->addr, I2C_M_RD, 2, read }, }; + dprintk_trace("trace: msp3400c_reset\n"); if ( (1 != i2c_transfer(client->adapter,&reset[0],1)) || (1 != i2c_transfer(client->adapter,&reset[1],1)) || (2 != i2c_transfer(client->adapter,test,2)) ) { @@ -181,10 +196,9 @@ static int msp3400c_reset(struct i2c_client *client) return 0; } -static int -msp3400c_read(struct i2c_client *client, int dev, int addr) +static int msp3400c_read(struct i2c_client *client, int dev, int addr) { - int err; + int err,retval; unsigned char write[3]; unsigned char read[2]; @@ -192,6 +206,7 @@ msp3400c_read(struct i2c_client *client, int dev, int addr) { client->addr, 0, 3, write }, { client->addr, I2C_M_RD, 2, read } }; + write[0] = dev+1; write[1] = addr >> 8; write[2] = addr & 0xff; @@ -200,20 +215,25 @@ msp3400c_read(struct i2c_client *client, int dev, int addr) if (2 == i2c_transfer(client->adapter,msgs,2)) break; err++; - printk(KERN_WARNING "msp34xx: I/O error #%d (read 0x%02x/0x%02x)\n", - err, dev, addr); - msleep(10); + printk(KERN_WARNING + "msp34xx: I/O error #%d (read 0x%02x/0x%02x)\n", err, + dev, addr); + current->state = TASK_INTERRUPTIBLE; + schedule_timeout(msecs_to_jiffies(10)); } if (3 == err) { - printk(KERN_WARNING "msp34xx: giving up, reseting chip. Sound will go off, sorry folks :-|\n"); + printk(KERN_WARNING + "msp34xx: giving up, reseting chip. Sound will go off, sorry folks :-|\n"); msp3400c_reset(client); return -1; } - return read[0] << 8 | read[1]; + retval = read[0] << 8 | read[1]; + dprintk_trace("trace: msp3400c_read(0x%x, 0x%x): 0x%x\n", dev, addr, + retval); + return retval; } -static int -msp3400c_write(struct i2c_client *client, int dev, int addr, int val) +static int msp3400c_write(struct i2c_client *client, int dev, int addr, int val) { int err; unsigned char buffer[5]; @@ -224,16 +244,21 @@ msp3400c_write(struct i2c_client *client, int dev, int addr, int val) buffer[3] = val >> 8; buffer[4] = val & 0xff; + dprintk_trace("trace: msp3400c_write(0x%x, 0x%x, 0x%x)\n", dev, addr, + val); for (err = 0; err < 3;) { if (5 == i2c_master_send(client, buffer, 5)) break; err++; - printk(KERN_WARNING "msp34xx: I/O error #%d (write 0x%02x/0x%02x)\n", - err, dev, addr); - msleep(10); + printk(KERN_WARNING + "msp34xx: I/O error #%d (write 0x%02x/0x%02x)\n", err, + dev, addr); + current->state = TASK_INTERRUPTIBLE; + schedule_timeout(msecs_to_jiffies(10)); } if (3 == err) { - printk(KERN_WARNING "msp34xx: giving up, reseting chip. Sound will go off, sorry folks :-|\n"); + printk(KERN_WARNING + "msp34xx: giving up, reseting chip. Sound will go off, sorry folks :-|\n"); msp3400c_reset(client); return -1; } @@ -266,45 +291,47 @@ static struct MSP_INIT_DATA_DEM { int dfp_src; int dfp_matrix; } msp_init_data[] = { - /* AM (for carrier detect / msp3400) */ - { { 75, 19, 36, 35, 39, 40 }, { 75, 19, 36, 35, 39, 40 }, - MSP_CARRIER(5.5), MSP_CARRIER(5.5), - 0x00d0, 0x0500, 0x0020, 0x3000}, - - /* AM (for carrier detect / msp3410) */ - { { -1, -1, -8, 2, 59, 126 }, { -1, -1, -8, 2, 59, 126 }, - MSP_CARRIER(5.5), MSP_CARRIER(5.5), - 0x00d0, 0x0100, 0x0020, 0x3000}, - - /* FM Radio */ - { { -8, -8, 4, 6, 78, 107 }, { -8, -8, 4, 6, 78, 107 }, - MSP_CARRIER(10.7), MSP_CARRIER(10.7), - 0x00d0, 0x0480, 0x0020, 0x3000 }, - - /* Terrestial FM-mono + FM-stereo */ - { { 3, 18, 27, 48, 66, 72 }, { 3, 18, 27, 48, 66, 72 }, - MSP_CARRIER(5.5), MSP_CARRIER(5.5), - 0x00d0, 0x0480, 0x0030, 0x3000}, - - /* Sat FM-mono */ - { { 1, 9, 14, 24, 33, 37 }, { 3, 18, 27, 48, 66, 72 }, - MSP_CARRIER(6.5), MSP_CARRIER(6.5), - 0x00c6, 0x0480, 0x0000, 0x3000}, - - /* NICAM/FM -- B/G (5.5/5.85), D/K (6.5/5.85) */ - { { -2, -8, -10, 10, 50, 86 }, { 3, 18, 27, 48, 66, 72 }, - MSP_CARRIER(5.5), MSP_CARRIER(5.5), - 0x00d0, 0x0040, 0x0120, 0x3000}, - - /* NICAM/FM -- I (6.0/6.552) */ - { { 2, 4, -6, -4, 40, 94 }, { 3, 18, 27, 48, 66, 72 }, - MSP_CARRIER(6.0), MSP_CARRIER(6.0), - 0x00d0, 0x0040, 0x0120, 0x3000}, - - /* NICAM/AM -- L (6.5/5.85) */ - { { -2, -8, -10, 10, 50, 86 }, { -4, -12, -9, 23, 79, 126 }, - MSP_CARRIER(6.5), MSP_CARRIER(6.5), - 0x00c6, 0x0140, 0x0120, 0x7c03}, + { /* AM (for carrier detect / msp3400) */ + {75, 19, 36, 35, 39, 40}, + {75, 19, 36, 35, 39, 40}, + MSP_CARRIER(5.5), MSP_CARRIER(5.5), + 0x00d0, 0x0500, 0x0020, 0x3000 + },{ /* AM (for carrier detect / msp3410) */ + {-1, -1, -8, 2, 59, 126}, + {-1, -1, -8, 2, 59, 126}, + MSP_CARRIER(5.5), MSP_CARRIER(5.5), + 0x00d0, 0x0100, 0x0020, 0x3000 + },{ /* FM Radio */ + {-8, -8, 4, 6, 78, 107}, + {-8, -8, 4, 6, 78, 107}, + MSP_CARRIER(10.7), MSP_CARRIER(10.7), + 0x00d0, 0x0480, 0x0020, 0x3000 + },{ /* Terrestial FM-mono + FM-stereo */ + {3, 18, 27, 48, 66, 72}, + {3, 18, 27, 48, 66, 72}, + MSP_CARRIER(5.5), MSP_CARRIER(5.5), + 0x00d0, 0x0480, 0x0030, 0x3000 + },{ /* Sat FM-mono */ + { 1, 9, 14, 24, 33, 37}, + { 3, 18, 27, 48, 66, 72}, + MSP_CARRIER(6.5), MSP_CARRIER(6.5), + 0x00c6, 0x0480, 0x0000, 0x3000 + },{ /* NICAM/FM -- B/G (5.5/5.85), D/K (6.5/5.85) */ + {-2, -8, -10, 10, 50, 86}, + {3, 18, 27, 48, 66, 72}, + MSP_CARRIER(5.5), MSP_CARRIER(5.5), + 0x00d0, 0x0040, 0x0120, 0x3000 + },{ /* NICAM/FM -- I (6.0/6.552) */ + {2, 4, -6, -4, 40, 94}, + {3, 18, 27, 48, 66, 72}, + MSP_CARRIER(6.0), MSP_CARRIER(6.0), + 0x00d0, 0x0040, 0x0120, 0x3000 + },{ /* NICAM/AM -- L (6.5/5.85) */ + {-2, -8, -10, 10, 50, 86}, + {-4, -12, -9, 23, 79, 126}, + MSP_CARRIER(6.5), MSP_CARRIER(6.5), + 0x00c6, 0x0140, 0x0120, 0x7c03 + }, }; struct CARRIER_DETECT { @@ -341,26 +368,24 @@ static struct CARRIER_DETECT carrier_detect_65[] = { /* ----------------------------------------------------------------------- */ static int scarts[3][9] = { - /* MASK IN1 IN2 IN1_DA IN2_DA IN3 IN4 MONO MUTE */ - { 0x0320, 0x0000, 0x0200, -1, -1, 0x0300, 0x0020, 0x0100, 0x0320 }, - { 0x0c40, 0x0440, 0x0400, 0x0c00, 0x0040, 0x0000, 0x0840, 0x0800, 0x0c40 }, - { 0x3080, 0x1000, 0x1080, 0x0000, 0x0080, 0x2080, 0x3080, 0x2000, 0x3000 }, + /* MASK IN1 IN2 IN1_DA IN2_DA IN3 IN4 MONO MUTE */ + { 0x0320, 0x0000, 0x0200, -1, -1, 0x0300, 0x0020, 0x0100, 0x0320 }, + { 0x0c40, 0x0440, 0x0400, 0x0c00, 0x0040, 0x0000, 0x0840, 0x0800, 0x0c40 }, + { 0x3080, 0x1000, 0x1080, 0x0000, 0x0080, 0x2080, 0x3080, 0x2000, 0x3000 }, }; static char *scart_names[] = { - "mask", "in1", "in2", "in1 da", "in2 da", "in3", "in4", "mono", "mute" + "mask", "in1", "in2", "in1 da", "in2 da", "in3", "in4", "mono", "mute" }; -static void -msp3400c_set_scart(struct i2c_client *client, int in, int out) +static void msp3400c_set_scart(struct i2c_client *client, int in, int out) { struct msp3400c *msp = i2c_get_clientdata(client); if (-1 == scarts[out][in]) return; - dprintk(KERN_DEBUG - "msp34xx: scart switch: %s => %d\n",scart_names[in],out); + dprintk("msp34xx: scart switch: %s => %d\n", scart_names[in], out); msp->acb &= ~scarts[out][SCART_MASK]; msp->acb |= scarts[out][in]; msp3400c_write(client,I2C_MSP3400C_DFP, 0x0013, msp->acb); @@ -378,34 +403,34 @@ static void msp3400c_setcarrier(struct i2c_client *client, int cdo1, int cdo2) } static void msp3400c_setvolume(struct i2c_client *client, - int muted, int volume, int balance) -{ - int val = 0, bal = 0; + int muted, int left, int right) + { + int vol = 0, val = 0, balance = 0; -muted=0; if (!muted) { /* 0x7f instead if 0x73 here has sound quality issues, * probably due to overmodulation + clipping ... */ - val = (volume * 0x73 / 65535) << 8; + vol = (left > right) ? left : right; + val = (vol * 0x73 / 65535) << 8; } - if (val) { - bal = (balance / 256) - 128; + if (vol > 0) { + balance = ((right - left) * 127) / vol; } - dprintk(KERN_DEBUG - "msp34xx: setvolume: mute=%s %d:%d v=0x%02x b=0x%02x\n", - muted ? "on" : "off", volume, balance, val>>8, bal); + + dprintk("msp34xx: setvolume: mute=%s %d:%d v=0x%02x b=0x%02x\n", + muted ? "on" : "off", left, right, val >> 8, balance); msp3400c_write(client,I2C_MSP3400C_DFP, 0x0000, val); /* loudspeaker */ msp3400c_write(client,I2C_MSP3400C_DFP, 0x0006, val); /* headphones */ msp3400c_write(client,I2C_MSP3400C_DFP, 0x0007, - muted ? 0x01 : (val | 0x01)); - msp3400c_write(client,I2C_MSP3400C_DFP, 0x0001, bal << 8); + muted ? 0x1 : (val | 0x1)); + msp3400c_write(client, I2C_MSP3400C_DFP, 0x0001, balance << 8); } static void msp3400c_setbass(struct i2c_client *client, int bass) { int val = ((bass-32768) * 0x60 / 65535) << 8; - dprintk(KERN_DEBUG "msp34xx: setbass: %d 0x%02x\n",bass, val>>8); + dprintk("msp34xx: setbass: %d 0x%02x\n", bass, val >> 8); msp3400c_write(client,I2C_MSP3400C_DFP, 0x0002, val); /* loudspeaker */ } @@ -413,7 +438,7 @@ static void msp3400c_settreble(struct i2c_client *client, int treble) { int val = ((treble-32768) * 0x60 / 65535) << 8; - dprintk(KERN_DEBUG "msp34xx: settreble: %d 0x%02x\n",treble, val>>8); + dprintk("msp34xx: settreble: %d 0x%02x\n",treble, val>>8); msp3400c_write(client,I2C_MSP3400C_DFP, 0x0003, val); /* loudspeaker */ } @@ -422,7 +447,7 @@ static void msp3400c_setmode(struct i2c_client *client, int type) struct msp3400c *msp = i2c_get_clientdata(client); int i; - dprintk(KERN_DEBUG "msp3400: setmode: %d\n",type); + dprintk("msp3400: setmode: %d\n",type); msp->mode = type; msp->audmode = V4L2_TUNER_MODE_MONO; msp->rxsubchans = V4L2_TUNER_SUB_MONO; @@ -475,7 +500,8 @@ static void msp3400c_setmode(struct i2c_client *client, int type) } } -static int best_audio_mode(int rxsubchans) +/* given a bitmask of VIDEO_SOUND_XXX returns the "best" in the bitmask */ +static int best_video_sound(int rxsubchans) { if (rxsubchans & V4L2_TUNER_SUB_STEREO) return V4L2_TUNER_MODE_STEREO; @@ -487,31 +513,32 @@ static int best_audio_mode(int rxsubchans) } /* turn on/off nicam + stereo */ -static void msp3400c_set_audmode(struct i2c_client *client, int audmode) +static void msp3400c_setstereo(struct i2c_client *client, int mode) { - static char *strmode[16] = { -#if __GNUC__ >= 3 - [ 0 ... 15 ] = "invalid", -#endif - [ V4L2_TUNER_MODE_MONO ] = "mono", - [ V4L2_TUNER_MODE_STEREO ] = "stereo", - [ V4L2_TUNER_MODE_LANG1 ] = "lang1", - [ V4L2_TUNER_MODE_LANG2 ] = "lang2", + static char *strmode[] = { "0", "mono", "stereo", "3", + "lang1", "5", "6", "7", "lang2" }; struct msp3400c *msp = i2c_get_clientdata(client); - int nicam=0; /* channel source: FM/AM or nicam */ - int src=0; + int nicam = 0; /* channel source: FM/AM or nicam */ + int src = 0; - BUG_ON(msp->opmode == OPMODE_SIMPLER); - msp->audmode = audmode; + if (IS_MSP34XX_G(msp)) { + /* this method would break everything, let's make sure + * it's never called + */ + dprintk + ("msp34xxg: DEBUG WARNING setstereo called with mode=%d instead of set_source (ignored)\n", + mode); + return; + } /* switch demodulator */ switch (msp->mode) { case MSP_MODE_FM_TERRA: - dprintk(KERN_DEBUG "msp3400: FM setstereo: %s\n", - strmode[audmode]); + dprintk("msp3400: FM setstereo: %s\n", + strmode[mode]); msp3400c_setcarrier(client,msp->second,msp->main); - switch (audmode) { + switch (mode) { case V4L2_TUNER_MODE_STEREO: msp3400c_write(client,I2C_MSP3400C_DFP, 0x000e, 0x3001); break; @@ -523,9 +550,8 @@ static void msp3400c_set_audmode(struct i2c_client *client, int audmode) } break; case MSP_MODE_FM_SAT: - dprintk(KERN_DEBUG "msp3400: SAT setstereo: %s\n", - strmode[audmode]); - switch (audmode) { + dprintk("msp3400: SAT setstereo: %s\n", strmode[mode]); + switch (mode) { case V4L2_TUNER_MODE_MONO: msp3400c_setcarrier(client, MSP_CARRIER(6.5), MSP_CARRIER(6.5)); break; @@ -543,33 +569,29 @@ static void msp3400c_set_audmode(struct i2c_client *client, int audmode) case MSP_MODE_FM_NICAM1: case MSP_MODE_FM_NICAM2: case MSP_MODE_AM_NICAM: - dprintk(KERN_DEBUG "msp3400: NICAM setstereo: %s\n", - strmode[audmode]); + dprintk("msp3400: NICAM setstereo: %s\n",strmode[mode]); msp3400c_setcarrier(client,msp->second,msp->main); if (msp->nicam_on) nicam=0x0100; break; case MSP_MODE_BTSC: - dprintk(KERN_DEBUG "msp3400: BTSC setstereo: %s\n", - strmode[audmode]); + dprintk("msp3400: BTSC setstereo: %s\n",strmode[mode]); nicam=0x0300; break; case MSP_MODE_EXTERN: - dprintk(KERN_DEBUG "msp3400: extern setstereo: %s\n", - strmode[audmode]); + dprintk("msp3400: extern setstereo: %s\n",strmode[mode]); nicam = 0x0200; break; case MSP_MODE_FM_RADIO: - dprintk(KERN_DEBUG "msp3400: FM-Radio setstereo: %s\n", - strmode[audmode]); + dprintk("msp3400: FM-Radio setstereo: %s\n",strmode[mode]); break; default: - dprintk(KERN_DEBUG "msp3400: mono setstereo\n"); + dprintk("msp3400: mono setstereo\n"); return; } /* switch audio */ - switch (audmode) { + switch (best_video_sound(mode)) { case V4L2_TUNER_MODE_STEREO: src = 0x0020 | nicam; break; @@ -589,8 +611,7 @@ static void msp3400c_set_audmode(struct i2c_client *client, int audmode) src = 0x0010 | nicam; break; } - dprintk(KERN_DEBUG - "msp3400: setstereo final source/matrix = 0x%x\n", src); + dprintk("msp3400: setstereo final source/matrix = 0x%x\n", src); if (dolby) { msp3400c_write(client,I2C_MSP3400C_DFP, 0x0008,0x0520); @@ -609,26 +630,26 @@ static void msp3400c_print_mode(struct msp3400c *msp) { if (msp->main == msp->second) { - printk(KERN_DEBUG "msp3400: mono sound carrier: %d.%03d MHz\n", + dprintk("msp3400: mono sound carrier: %d.%03d MHz\n", msp->main/910000,(msp->main/910)%1000); } else { - printk(KERN_DEBUG "msp3400: main sound carrier: %d.%03d MHz\n", + dprintk("msp3400: main sound carrier: %d.%03d MHz\n", msp->main/910000,(msp->main/910)%1000); } - if (msp->mode == MSP_MODE_FM_NICAM1 || - msp->mode == MSP_MODE_FM_NICAM2) - printk(KERN_DEBUG "msp3400: NICAM/FM carrier : %d.%03d MHz\n", + if (msp->mode == MSP_MODE_FM_NICAM1 || msp->mode == MSP_MODE_FM_NICAM2) + dprintk("msp3400: NICAM/FM carrier : %d.%03d MHz\n", msp->second/910000,(msp->second/910)%1000); if (msp->mode == MSP_MODE_AM_NICAM) - printk(KERN_DEBUG "msp3400: NICAM/AM carrier : %d.%03d MHz\n", + dprintk("msp3400: NICAM/AM carrier : %d.%03d MHz\n", msp->second/910000,(msp->second/910)%1000); if (msp->mode == MSP_MODE_FM_TERRA && msp->main != msp->second) { - printk(KERN_DEBUG "msp3400: FM-stereo carrier : %d.%03d MHz\n", + dprintk("msp3400: FM-stereo carrier : %d.%03d MHz\n", msp->second/910000,(msp->second/910)%1000); } } + /* ----------------------------------------------------------------------- */ struct REGISTER_DUMP { @@ -636,8 +657,15 @@ struct REGISTER_DUMP { char *name; }; -static int -autodetect_stereo(struct i2c_client *client) +struct REGISTER_DUMP d1[] = { + {0x007e, "autodetect"}, + {0x0023, "C_AD_BITS "}, + {0x0038, "ADD_BITS "}, + {0x003e, "CIB_BITS "}, + {0x0057, "ERROR_RATE"}, +}; + +static int autodetect_stereo(struct i2c_client *client) { struct msp3400c *msp = i2c_get_clientdata(client); int val; @@ -650,8 +678,7 @@ autodetect_stereo(struct i2c_client *client) val = msp3400c_read(client, I2C_MSP3400C_DFP, 0x18); if (val > 32767) val -= 65536; - dprintk(KERN_DEBUG - "msp34xx: stereo detect register: %d\n",val); + dprintk("msp34xx: stereo detect register: %d\n",val); if (val > 4096) { rxsubchans = V4L2_TUNER_SUB_STEREO | V4L2_TUNER_SUB_MONO; } else if (val < -4096) { @@ -665,8 +692,7 @@ autodetect_stereo(struct i2c_client *client) case MSP_MODE_FM_NICAM2: case MSP_MODE_AM_NICAM: val = msp3400c_read(client, I2C_MSP3400C_DEM, 0x23); - dprintk(KERN_DEBUG - "msp34xx: nicam sync=%d, mode=%d\n", + dprintk("msp34xx: nicam sync=%d, mode=%d\n", val & 1, (val & 0x1e) >> 1); if (val & 1) { @@ -699,8 +725,7 @@ autodetect_stereo(struct i2c_client *client) break; case MSP_MODE_BTSC: val = msp3400c_read(client, I2C_MSP3400C_DEM, 0x200); - dprintk(KERN_DEBUG - "msp3410: status=0x%x (pri=%s, sec=%s, %s%s%s)\n", + dprintk("msp3410: status=0x%x (pri=%s, sec=%s, %s%s%s)\n", val, (val & 0x0002) ? "no" : "yes", (val & 0x0004) ? "no" : "yes", @@ -714,13 +739,13 @@ autodetect_stereo(struct i2c_client *client) } if (rxsubchans != msp->rxsubchans) { update = 1; - dprintk(KERN_DEBUG "msp34xx: watch: rxsubchans %d => %d\n", + dprintk("msp34xx: watch: rxsubchans %d => %d\n", msp->rxsubchans,rxsubchans); msp->rxsubchans = rxsubchans; } if (newnicam != msp->nicam_on) { update = 1; - dprintk(KERN_DEBUG "msp34xx: watch: nicam %d => %d\n", + dprintk("msp34xx: watch: nicam %d => %d\n", msp->nicam_on,newnicam); msp->nicam_on = newnicam; } @@ -757,8 +782,15 @@ static void watch_stereo(struct i2c_client *client) { struct msp3400c *msp = i2c_get_clientdata(client); - if (autodetect_stereo(client)) - msp3400c_set_audmode(client,best_audio_mode(msp->rxsubchans)); + if (autodetect_stereo(client)) { + if (msp->stereo & V4L2_TUNER_MODE_STEREO) + msp3400c_setstereo(client, V4L2_TUNER_MODE_STEREO); + else if (msp->stereo & VIDEO_SOUND_LANG1) + msp3400c_setstereo(client, V4L2_TUNER_MODE_LANG1); + else + msp3400c_setstereo(client, V4L2_TUNER_MODE_MONO); + } + if (once) msp->watch_stereo = 0; } @@ -786,8 +818,7 @@ static int msp3400c_thread(void *data) MSP_MODE_EXTERN == msp->mode) { /* no carrier scan, just unmute */ printk("msp3400: thread: no carrier scan\n"); - msp3400c_setvolume(client, msp->muted, - msp->volume, msp->balance); + msp3400c_setvolume(client, msp->muted, msp->left, msp->right); continue; } @@ -866,7 +897,7 @@ static int msp3400c_thread(void *data) msp->second = carrier_detect_55[max2].cdo; msp3400c_setmode(client, MSP_MODE_FM_TERRA); msp->nicam_on = 0; - msp3400c_set_audmode(client, V4L2_TUNER_MODE_MONO); + msp3400c_setstereo(client, V4L2_TUNER_MODE_MONO); msp->watch_stereo = 1; } else if (max2 == 1 && HAVE_NICAM(msp)) { /* B/G NICAM */ @@ -893,7 +924,7 @@ static int msp3400c_thread(void *data) msp->second = carrier_detect_65[max2].cdo; msp3400c_setmode(client, MSP_MODE_FM_TERRA); msp->nicam_on = 0; - msp3400c_set_audmode(client, V4L2_TUNER_MODE_MONO); + msp3400c_setstereo(client, V4L2_TUNER_MODE_MONO); msp->watch_stereo = 1; } else if (max2 == 0 && msp->norm == VIDEO_MODE_SECAM) { @@ -901,7 +932,7 @@ static int msp3400c_thread(void *data) msp->second = carrier_detect_65[max2].cdo; msp3400c_setmode(client, MSP_MODE_AM_NICAM); msp->nicam_on = 0; - msp3400c_set_audmode(client, V4L2_TUNER_MODE_MONO); + msp3400c_setstereo(client, V4L2_TUNER_MODE_MONO); msp3400c_setcarrier(client, msp->second, msp->main); /* volume prescale for SCART (AM mono input) */ msp3400c_write(client,I2C_MSP3400C_DFP, 0x000d, 0x1900); @@ -925,13 +956,12 @@ static int msp3400c_thread(void *data) msp->nicam_on = 0; msp3400c_setcarrier(client, msp->second, msp->main); msp->rxsubchans = V4L2_TUNER_SUB_MONO; - msp3400c_set_audmode(client, V4L2_TUNER_MODE_MONO); + msp3400c_setstereo(client, V4L2_TUNER_MODE_MONO); break; } /* unmute */ - msp3400c_setvolume(client, msp->muted, - msp->volume, msp->balance); + msp3400c_setvolume(client, msp->muted, msp->left, msp->right); if (debug) msp3400c_print_mode(msp); @@ -942,7 +972,7 @@ static int msp3400c_thread(void *data) watch_stereo(client); } } - dprintk(KERN_DEBUG "msp3400: thread: exit\n"); + dprintk("msp3400: thread: exit\n"); return 0; } @@ -990,7 +1020,7 @@ static int msp34xx_modus(int norm) { switch (norm) { case VIDEO_MODE_PAL: - dprintk(KERN_DEBUG "msp34xx: video mode selected to PAL\n"); + dprintk("msp34xx: video mode selected to PAL\n"); #if 1 /* experimental: not sure this works with all chip versions */ @@ -1000,16 +1030,16 @@ static int msp34xx_modus(int norm) return 0x1003; #endif case VIDEO_MODE_NTSC: /* BTSC */ - dprintk(KERN_DEBUG "msp34xx: video mode selected to NTSC\n"); + dprintk("msp34xx: video mode selected to NTSC\n"); return 0x2003; case VIDEO_MODE_SECAM: - dprintk(KERN_DEBUG "msp34xx: video mode selected to SECAM\n"); + dprintk("msp34xx: video mode selected to SECAM\n"); return 0x0003; case VIDEO_MODE_RADIO: - dprintk(KERN_DEBUG "msp34xx: video mode selected to Radio\n"); + dprintk("msp34xx: video mode selected to Radio\n"); return 0x0003; case VIDEO_MODE_AUTO: - dprintk(KERN_DEBUG "msp34xx: video mode selected to Auto\n"); + dprintk("msp34xx: video mode selected to Auto\n"); return 0x2003; default: return 0x0003; @@ -1040,9 +1070,9 @@ static int msp3410d_thread(void *data) printk("msp3410: daemon started\n"); for (;;) { - d2printk(KERN_DEBUG "msp3410: thread: sleep\n"); + d2printk("msp3410: thread: sleep\n"); msp34xx_sleep(msp,-1); - d2printk(KERN_DEBUG "msp3410: thread: wakeup\n"); + d2printk("msp3410: thread: wakeup\n"); restart: dprintk("msp3410: thread: restart scan\n"); @@ -1052,9 +1082,8 @@ static int msp3410d_thread(void *data) if (msp->mode == MSP_MODE_EXTERN) { /* no carrier scan needed, just unmute */ - dprintk(KERN_DEBUG "msp3410: thread: no carrier scan\n"); - msp3400c_setvolume(client, msp->muted, - msp->volume, msp->balance); + dprintk("msp3410: thread: no carrier scan\n"); + msp3400c_setvolume(client, msp->muted, msp->left, msp->right); continue; } @@ -1073,7 +1102,7 @@ static int msp3410d_thread(void *data) msp->watch_stereo = 0; if (debug) - printk(KERN_DEBUG "msp3410: setting mode: %s (0x%04x)\n", + dprintk("msp3410: setting mode: %s (0x%04x)\n", msp34xx_standard_mode_name(std) ,std); if (std != 1) { @@ -1089,13 +1118,13 @@ static int msp3410d_thread(void *data) val = msp3400c_read(client, I2C_MSP3400C_DEM, 0x7e); if (val < 0x07ff) break; - dprintk(KERN_DEBUG "msp3410: detection still in progress\n"); + dprintk("msp3410: detection still in progress\n"); } } for (i = 0; modelist[i].name != NULL; i++) if (modelist[i].retval == val) break; - dprintk(KERN_DEBUG "msp3410: current mode: %s (0x%04x)\n", + dprintk("msp3410: current mode: %s (0x%04x)\n", modelist[i].name ? modelist[i].name : "unknown", val); msp->main = modelist[i].main; @@ -1103,7 +1132,7 @@ static int msp3410d_thread(void *data) if (amsound && (msp->norm == VIDEO_MODE_SECAM) && (val != 0x0009)) { /* autodetection has failed, let backup */ - dprintk(KERN_DEBUG "msp3410: autodetection failed," + dprintk("msp3410: autodetection failed," " switching to backup mode: %s (0x%04x)\n", modelist[8].name ? modelist[8].name : "unknown",val); val = 0x0009; @@ -1127,13 +1156,13 @@ static int msp3410d_thread(void *data) msp->rxsubchans = V4L2_TUNER_SUB_STEREO; msp->nicam_on = 1; msp->watch_stereo = 1; - msp3400c_set_audmode(client,V4L2_TUNER_MODE_STEREO); + msp3400c_setstereo(client,V4L2_TUNER_MODE_STEREO); break; case 0x0009: msp->mode = MSP_MODE_AM_NICAM; msp->rxsubchans = V4L2_TUNER_SUB_MONO; msp->nicam_on = 1; - msp3400c_set_audmode(client,V4L2_TUNER_MODE_MONO); + msp3400c_setstereo(client,V4L2_TUNER_MODE_MONO); msp->watch_stereo = 1; break; case 0x0020: /* BTSC */ @@ -1142,7 +1171,7 @@ static int msp3410d_thread(void *data) msp->rxsubchans = V4L2_TUNER_SUB_STEREO; msp->nicam_on = 0; msp->watch_stereo = 1; - msp3400c_set_audmode(client,V4L2_TUNER_MODE_STEREO); + msp3400c_setstereo(client,V4L2_TUNER_MODE_STEREO); break; case 0x0040: /* FM radio */ msp->mode = MSP_MODE_FM_RADIO; @@ -1176,8 +1205,7 @@ static int msp3410d_thread(void *data) /* unmute, restore misc registers */ msp3400c_setbass(client, msp->bass); msp3400c_settreble(client, msp->treble); - msp3400c_setvolume(client, msp->muted, - msp->volume, msp->balance); + msp3400c_setvolume(client, msp->muted, msp->left, msp->right); msp3400c_write(client, I2C_MSP3400C_DFP, 0x0013, msp->acb); /* monitor tv audio mode */ @@ -1187,7 +1215,7 @@ static int msp3410d_thread(void *data) watch_stereo(client); } } - dprintk(KERN_DEBUG "msp3410: thread: exit\n"); + dprintk("msp3410: thread: exit\n"); return 0; } @@ -1264,9 +1292,9 @@ static int msp34xxg_thread(void *data) printk("msp34xxg: daemon started\n"); msp->source = 1; /* default */ for (;;) { - d2printk(KERN_DEBUG "msp34xxg: thread: sleep\n"); + d2printk("msp34xxg: thread: sleep\n"); msp34xx_sleep(msp,-1); - d2printk(KERN_DEBUG "msp34xxg: thread: wakeup\n"); + d2printk("msp34xxg: thread: wakeup\n"); restart: dprintk("msp34xxg: thread: restart scan\n"); @@ -1308,7 +1336,7 @@ static int msp34xxg_thread(void *data) msp3400c_setbass(client, msp->bass); msp3400c_settreble(client, msp->treble); - msp3400c_setvolume(client, msp->muted, msp->volume, msp->balance); + msp3400c_setvolume(client, msp->muted, msp->left, msp->right); /* restore ACB */ if (msp3400c_write(client, @@ -1317,7 +1345,7 @@ static int msp34xxg_thread(void *data) msp->acb)) return -1; } - dprintk(KERN_DEBUG "msp34xxg: thread: exit\n"); + dprintk("msp34xxg: thread: exit\n"); return 0; } @@ -1476,12 +1504,12 @@ static int msp_attach(struct i2c_adapter *adap, int addr, int kind) } memset(msp,0,sizeof(struct msp3400c)); - msp->volume = 58880; /* 0db gain */ - msp->balance = 32768; - msp->bass = 32768; - msp->treble = 32768; - msp->input = -1; - msp->muted = 1; + msp->left = 58880; /* 0db gain */ + msp->right = 58880; /* 0db gain */ + msp->bass = 32768; + msp->treble = 32768; + msp->input = -1; + msp->muted = 0; i2c_set_clientdata(c, msp); init_waitqueue_head(&msp->wq); @@ -1504,7 +1532,7 @@ static int msp_attach(struct i2c_adapter *adap, int addr, int kind) } printk(KERN_INFO "msp34xx: rev1=0x%04x, rev2=0x%04x\n", msp->rev1, msp->rev2); - msp3400c_setvolume(c, msp->muted, msp->volume, msp->balance); + msp3400c_setvolume(c, msp->muted, msp->left, msp->right); snprintf(c->name, sizeof(c->name), "MSP34%02d%c-%c%d", (msp->rev2>>8)&0xff, (msp->rev1&0xff)+'@', @@ -1558,6 +1586,7 @@ static int msp_attach(struct i2c_adapter *adap, int addr, int kind) /* done */ i2c_attach_client(c); + return 0; } @@ -1648,7 +1677,7 @@ static void msp_any_set_audmode(struct i2c_client *client, int audmode) case OPMODE_MANUAL: case OPMODE_SIMPLE: msp->watch_stereo = 0; - msp3400c_set_audmode(client, audmode); + msp3400c_setstereo(client, audmode); break; case OPMODE_SIMPLER: msp34xxg_set_audmode(client, audmode); @@ -1665,7 +1694,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) switch (cmd) { case AUDC_SET_INPUT: - dprintk(KERN_DEBUG "msp34xx: AUDC_SET_INPUT(%d)\n",*sarg); + dprintk("msp34xx: AUDC_SET_INPUT(%d)\n",*sarg); if (*sarg == msp->input) break; msp->input = *sarg; @@ -1699,15 +1728,15 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) msp3400c_set_scart(client,scart,0); msp3400c_write(client,I2C_MSP3400C_DFP,0x000d,0x1900); if (msp->opmode != OPMODE_SIMPLER) - msp3400c_set_audmode(client, msp->audmode); + msp3400c_setstereo(client, msp->audmode); } msp_wake_thread(client); break; case AUDC_SET_RADIO: - dprintk(KERN_DEBUG "msp34xx: AUDC_SET_RADIO\n"); + dprintk("msp34xx: AUDC_SET_RADIO\n"); msp->norm = VIDEO_MODE_RADIO; - dprintk(KERN_DEBUG "msp34xx: switching to radio mode\n"); + dprintk("msp34xx: switching to radio mode\n"); msp->watch_stereo = 0; switch (msp->opmode) { case OPMODE_MANUAL: @@ -1715,8 +1744,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) msp3400c_setmode(client,MSP_MODE_FM_RADIO); msp3400c_setcarrier(client, MSP_CARRIER(10.7), MSP_CARRIER(10.7)); - msp3400c_setvolume(client, msp->muted, - msp->volume, msp->balance); + msp3400c_setvolume(client, msp->muted, msp->left, msp->right); break; case OPMODE_SIMPLE: case OPMODE_SIMPLER: @@ -1733,7 +1761,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) { struct video_audio *va = arg; - dprintk(KERN_DEBUG "msp34xx: VIDIOCGAUDIO\n"); + dprintk("msp34xx: VIDIOCGAUDIO\n"); va->flags |= VIDEO_AUDIO_VOLUME | VIDEO_AUDIO_BASS | VIDEO_AUDIO_TREBLE | @@ -1741,8 +1769,15 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) if (msp->muted) va->flags |= VIDEO_AUDIO_MUTE; - va->volume = msp->volume; - va->balance = (va->volume) ? msp->balance : 32768; + if (msp->muted) + va->flags |= VIDEO_AUDIO_MUTE; + va->volume = MAX(msp->left, msp->right); + va->balance = (32768 * MIN(msp->left, msp->right)) / + (va->volume ? va->volume : 1); + va->balance = (msp->left < msp->right) ? + (65535 - va->balance) : va->balance; + if (0 == va->volume) + va->balance = 32768; va->bass = msp->bass; va->treble = msp->treble; @@ -1754,17 +1789,32 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) { struct video_audio *va = arg; - dprintk(KERN_DEBUG "msp34xx: VIDIOCSAUDIO\n"); + dprintk("msp34xx: VIDIOCSAUDIO\n"); msp->muted = (va->flags & VIDEO_AUDIO_MUTE); - msp->volume = va->volume; - msp->balance = va->balance; + msp->left = (MIN(65536 - va->balance, 32768) * + va->volume) / 32768; + msp->right = (MIN(va->balance, 32768) * va->volume) / 32768; msp->bass = va->bass; msp->treble = va->treble; - - msp3400c_setvolume(client, msp->muted, - msp->volume, msp->balance); - msp3400c_setbass(client,msp->bass); - msp3400c_settreble(client,msp->treble); + dprintk("msp34xx: VIDIOCSAUDIO setting va->volume to %d\n", + va->volume); + dprintk("msp34xx: VIDIOCSAUDIO setting va->balance to %d\n", + va->balance); + dprintk("msp34xx: VIDIOCSAUDIO setting va->flags to %d\n", + va->flags); + dprintk("msp34xx: VIDIOCSAUDIO setting msp->left to %d\n", + msp->left); + dprintk("msp34xx: VIDIOCSAUDIO setting msp->right to %d\n", + msp->right); + dprintk("msp34xx: VIDIOCSAUDIO setting msp->bass to %d\n", + msp->bass); + dprintk("msp34xx: VIDIOCSAUDIO setting msp->treble to %d\n", + msp->treble); + dprintk("msp34xx: VIDIOCSAUDIO setting msp->mode to %d\n", + msp->mode); + msp3400c_setvolume(client, msp->muted, msp->left, msp->right); + msp3400c_setbass(client, msp->bass); + msp3400c_settreble(client, msp->treble); if (va->mode != 0 && msp->norm != VIDEO_MODE_RADIO) msp_any_set_audmode(client,mode_v4l1_to_v4l2(va->mode)); @@ -1775,7 +1825,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) { struct video_channel *vc = arg; - dprintk(KERN_DEBUG "msp34xx: VIDIOCSCHAN (norm=%d)\n",vc->norm); + dprintk("msp34xx: VIDIOCSCHAN (norm=%d)\n",vc->norm); msp->norm = vc->norm; msp_wake_thread(client); break; @@ -1785,7 +1835,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) case VIDIOC_S_FREQUENCY: { /* new channel -- kick audio carrier scan */ - dprintk(KERN_DEBUG "msp34xx: VIDIOCSFREQ\n"); + dprintk("msp34xx: VIDIOCSFREQ\n"); msp_wake_thread(client); break; } @@ -1904,7 +1954,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) { struct msp_matrix *mspm = arg; - dprintk(KERN_DEBUG "msp34xx: MSP_SET_MATRIX\n"); + dprintk("msp34xx: MSP_SET_MATRIX\n"); msp3400c_set_scart(client, mspm->input, mspm->output); break; } -- cgit v1.2.2 From 18f47d10bc8076bb126a1a369b782e29cc91c824 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:37:19 -0800 Subject: [PATCH] v4l: 759: more improvements at msp3400 c from ivtv code - More improvements at msp3400.c from ivtv code. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/msp3400.c | 111 +++++++++++++++++++++++++++++++++++------- 1 file changed, 93 insertions(+), 18 deletions(-) diff --git a/drivers/media/video/msp3400.c b/drivers/media/video/msp3400.c index 4689dee882f3..117d124657d0 100644 --- a/drivers/media/video/msp3400.c +++ b/drivers/media/video/msp3400.c @@ -649,6 +649,30 @@ msp3400c_print_mode(struct msp3400c *msp) } } +#define MSP3400_MAX 4 +static struct i2c_client *msps[MSP3400_MAX]; +static void msp3400c_restore_dfp(struct i2c_client *client) +{ + struct msp3400c *msp = i2c_get_clientdata(client); + int i; + + for (i = 0; i < DFP_COUNT; i++) { + if (-1 == msp->dfp_regs[i]) + continue; + msp3400c_write(client, I2C_MSP3400C_DFP, i, msp->dfp_regs[i]); + } +} + +/* if the dfp_regs is set, set what's in there. Otherwise, set the default value */ +static int msp3400c_write_dfp_with_default(struct i2c_client *client, + int addr, int default_value) +{ + struct msp3400c *msp = i2c_get_clientdata(client); + int value = default_value; + if (addr < DFP_COUNT && -1 != msp->dfp_regs[addr]) + value = msp->dfp_regs[addr]; + return msp3400c_write(client, I2C_MSP3400C_DFP, addr, value); +} /* ----------------------------------------------------------------------- */ @@ -834,7 +858,8 @@ static int msp3400c_thread(void *data) goto restart; /* carrier detect pass #1 -- main carrier */ - cd = carrier_detect_main; count = CARRIER_COUNT(carrier_detect_main); + cd = carrier_detect_main; + count = CARRIER_COUNT(carrier_detect_main); if (amsound && (msp->norm == VIDEO_MODE_SECAM)) { /* autodetect doesn't work well with AM ... */ @@ -868,13 +893,16 @@ static int msp3400c_thread(void *data) case 0: /* 4.5 */ case 2: /* 6.0 */ default: - cd = NULL; count = 0; + cd = NULL; + count = 0; break; } if (amsound && (msp->norm == VIDEO_MODE_SECAM)) { /* autodetect doesn't work well with AM ... */ - cd = NULL; count = 0; max2 = 0; + cd = NULL; + count = 0; + max2 = 0; } for (this = 0; this < count; this++) { msp3400c_setcarrier(client, cd[this].cdo,cd[this].cdo); @@ -962,6 +990,8 @@ static int msp3400c_thread(void *data) /* unmute */ msp3400c_setvolume(client, msp->muted, msp->left, msp->right); + msp3400c_restore_dfp(client); + if (debug) msp3400c_print_mode(msp); @@ -1207,6 +1237,7 @@ static int msp3410d_thread(void *data) msp3400c_settreble(client, msp->treble); msp3400c_setvolume(client, msp->muted, msp->left, msp->right); msp3400c_write(client, I2C_MSP3400C_DFP, 0x0013, msp->acb); + msp3400c_restore_dfp(client); /* monitor tv audio mode */ while (msp->watch_stereo) { @@ -1230,7 +1261,7 @@ static void msp34xxg_set_source(struct i2c_client *client, int source); /* (re-)initialize the msp34xxg, according to the current norm in msp->norm * return 0 if it worked, -1 if it failed */ -static int msp34xxg_init(struct i2c_client *client) +static int msp34xxg_reset(struct i2c_client *client) { struct msp3400c *msp = i2c_get_clientdata(client); int modus,std; @@ -1257,7 +1288,7 @@ static int msp34xxg_init(struct i2c_client *client) return -1; if (msp3400c_write(client, I2C_MSP3400C_DEM, - 0x20/*stanard*/, + 0x20/*standard*/, std)) return -1; @@ -1265,21 +1296,18 @@ static int msp34xxg_init(struct i2c_client *client) standard/audio autodetection right now */ msp34xxg_set_source(client, msp->source); - if (msp3400c_write(client, I2C_MSP3400C_DFP, - 0x0e, /* AM/FM Prescale */ - 0x3000 /* default: [15:8] 75khz deviation */)) + if (msp3400c_write_dfp_with_default(client, 0x0e, /* AM/FM Prescale */ + 0x3000 + /* default: [15:8] 75khz deviation */ + )) return -1; - if (msp3400c_write(client, I2C_MSP3400C_DFP, - 0x10, /* NICAM Prescale */ - 0x5a00 /* default: 9db gain (as recommended) */)) + if (msp3400c_write_dfp_with_default(client, 0x10, /* NICAM Prescale */ + 0x5a00 + /* default: 9db gain (as recommended) */ + )) return -1; - if (msp3400c_write(client, - I2C_MSP3400C_DEM, - 0x20, /* STANDARD SELECT */ - standard /* default: 0x01 for automatic standard select*/)) - return -1; return 0; } @@ -1303,7 +1331,7 @@ static int msp34xxg_thread(void *data) break; /* setup the chip*/ - msp34xxg_init(client); + msp34xxg_reset(client); std = standard; if (std != 0x01) goto unmute; @@ -1486,6 +1514,7 @@ static int msp_attach(struct i2c_adapter *adap, int addr, int kind) struct msp3400c *msp; struct i2c_client *c; int (*thread_func)(void *data) = NULL; + int i; client_template.adapter = adap; client_template.addr = addr; @@ -1504,12 +1533,15 @@ static int msp_attach(struct i2c_adapter *adap, int addr, int kind) } memset(msp,0,sizeof(struct msp3400c)); + msp->norm = VIDEO_MODE_NTSC; msp->left = 58880; /* 0db gain */ msp->right = 58880; /* 0db gain */ msp->bass = 32768; msp->treble = 32768; msp->input = -1; msp->muted = 0; + for (i = 0; i < DFP_COUNT; i++) + msp->dfp_regs[i] = -1; i2c_set_clientdata(c, msp); init_waitqueue_head(&msp->wq); @@ -1579,6 +1611,7 @@ static int msp_attach(struct i2c_adapter *adap, int addr, int kind) /* startup control thread if needed */ if (thread_func) { msp->kthread = kthread_run(thread_func, c, "msp34xx"); + if (NULL == msp->kthread) printk(KERN_WARNING "msp34xx: kernel_thread() failed\n"); msp_wake_thread(c); @@ -1587,21 +1620,39 @@ static int msp_attach(struct i2c_adapter *adap, int addr, int kind) /* done */ i2c_attach_client(c); + /* update our own array */ + for (i = 0; i < MSP3400_MAX; i++) { + if (NULL == msps[i]) { + msps[i] = c; + break; + } + } + return 0; } static int msp_detach(struct i2c_client *client) { struct msp3400c *msp = i2c_get_clientdata(client); + int i; /* shutdown control thread */ if (msp->kthread) { msp->restart = 1; kthread_stop(msp->kthread); } - msp3400c_reset(client); + msp3400c_reset(client); + + /* update our own array */ + for (i = 0; i < MSP3400_MAX; i++) { + if (client == msps[i]) { + msps[i] = NULL; + break; + } + } i2c_detach_client(client); + kfree(msp); kfree(client); return 0; @@ -1753,6 +1804,30 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) break; } break; + /* work-in-progress: hook to control the DFP registers */ + case MSP_SET_DFPREG: + { + struct msp_dfpreg *r = arg; + int i; + + if (r->reg < 0 || r->reg >= DFP_COUNT) + return -EINVAL; + for (i = 0; i < sizeof(bl_dfp) / sizeof(int); i++) + if (r->reg == bl_dfp[i]) + return -EINVAL; + msp->dfp_regs[r->reg] = r->value; + msp3400c_write(client, I2C_MSP3400C_DFP, r->reg, r->value); + return 0; + } + case MSP_GET_DFPREG: + { + struct msp_dfpreg *r = arg; + + if (r->reg < 0 || r->reg >= DFP_COUNT) + return -EINVAL; + r->value = msp3400c_read(client, I2C_MSP3400C_DFP, r->reg); + return 0; + } /* --- v4l ioctls --- */ /* take care: bttv does userspace copying, we'll get a -- cgit v1.2.2 From a9ae9fb17bdcb22ae0c1abc6ebd97704dd80d9d1 Mon Sep 17 00:00:00 2001 From: Markus Rechberger Date: Tue, 8 Nov 2005 21:37:20 -0800 Subject: [PATCH] v4l: 761: fixed registry value in em2820 - Fixed registry value in em2820-i2c.c which corrects a tuner setting (also removed that call from em2820-video.c) Signed-off-by: Markus Rechberger Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/em28xx/em28xx-i2c.c | 40 +++++++++++++++---------------- drivers/media/video/em28xx/em28xx-video.c | 1 - 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c index 150c72bb6e48..8551998dbaec 100644 --- a/drivers/media/video/em28xx/em28xx-i2c.c +++ b/drivers/media/video/em28xx/em28xx-i2c.c @@ -302,26 +302,26 @@ static int attach_inform(struct i2c_client *client) dprintk("address %x", client->addr << 1); switch (client->addr << 1) { - case 0x68: - em2820_i2c_call_clients(dev, TDA9887_SET_CONFIG, &dev->tda9887_conf); - break; - case 0x4a: - dprintk1("attach_inform: saa7113 detected.\n"); - break; - case 0xa0: - dprintk1("attach_inform: eeprom detected.\n"); - break; - case 0x80: - case 0x88: - dprintk1("attach_inform: msp34xx detected.\n"); - break; - case 0xb8: - case 0xba: - dprintk1("attach_inform: tvp5150 detected.\n"); - break; - default: - dev->tuner_addr = client->addr; - em2820_set_tuner(-1, client); + case 0x86: + em2820_i2c_call_clients(dev, TDA9887_SET_CONFIG, &dev->tda9887_conf); + break; + case 0x4a: + dprintk1("attach_inform: saa7113 detected.\n"); + break; + case 0xa0: + dprintk1("attach_inform: eeprom detected.\n"); + break; + case 0x80: + case 0x88: + dprintk1("attach_inform: msp34xx detected.\n"); + break; + case 0xb8: + case 0xba: + dprintk1("attach_inform: tvp5150 detected.\n"); + break; + default: + dev->tuner_addr = client->addr; + em2820_set_tuner(-1, client); } return 0; diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 3581fc4c874d..7e4114ea15f9 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c @@ -225,7 +225,6 @@ void em2820_config_i2c(struct em2820 *dev) /* configure tda9887 */ - em2820_i2c_call_clients(dev, TDA9887_SET_CONFIG, &dev->tda9887_conf); /* em2820_i2c_call_clients(dev,VIDIOC_S_STD,&dev->tvnorm->id); */ } -- cgit v1.2.2 From c365864faf8c68db9d1a64d4356758da9f206ff1 Mon Sep 17 00:00:00 2001 From: Markus Rechberger Date: Tue, 8 Nov 2005 21:37:21 -0800 Subject: [PATCH] v4l: 762: added support for the terratec cinergy 250 usb tv remote - Added support for the terratec cinergy 250 usb tv remote Signed-off-by: Markus Rechberger Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/em28xx/em28xx-i2c.c | 2 +- drivers/media/video/ir-kbd-i2c.c | 45 +++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c index 8551998dbaec..3065ddb4b368 100644 --- a/drivers/media/video/em28xx/em28xx-i2c.c +++ b/drivers/media/video/em28xx/em28xx-i2c.c @@ -31,7 +31,7 @@ /* To be moved to compat.h */ #if !defined(I2C_HW_B_EM2820) -#define I2C_HW_B_EM2820 I2C_HW_B_BT848 +#define I2C_HW_B_EM2820 0x99 #endif #include "em2820.h" diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index 225fee93cfd4..061dda10721b 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c @@ -8,6 +8,8 @@ * Christoph Bartelmus * modified for KNC ONE TV Station/Anubis Typhoon TView Tuner by * Ulrich Mueller + * modified for em2820 based USB TV tuners by + * Markus Rechberger * * 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 @@ -40,6 +42,38 @@ #include #include +static IR_KEYTAB_TYPE ir_codes_em2820[IR_KEYTAB_SIZE] = { + [ 0 ] = KEY_CHANNEL, + [ 1 ] = KEY_SELECT, + [ 2 ] = KEY_MUTE, + [ 3 ] = KEY_POWER, + [ 4 ] = KEY_KP1, + [ 5 ] = KEY_KP2, + [ 6 ] = KEY_KP3, + [ 7 ] = KEY_CHANNELUP, + [ 8 ] = KEY_KP4, + [ 9 ] = KEY_KP5, + [ 10 ] = KEY_KP6, + + [ 11 ] = KEY_CHANNELDOWN, + [ 12 ] = KEY_KP7, + [ 13 ] = KEY_KP8, + [ 14 ] = KEY_KP9, + [ 15 ] = KEY_VOLUMEUP, + [ 16 ] = KEY_KP0, + [ 17 ] = KEY_MENU, + [ 18 ] = KEY_PRINT, + + [ 19 ] = KEY_VOLUMEDOWN, + [ 21 ] = KEY_PAUSE, + [ 23 ] = KEY_RECORD, + [ 24 ] = KEY_REWIND, + [ 25 ] = KEY_PLAY, + [ 27 ] = KEY_BACKSPACE, + [ 29 ] = KEY_STOP, + [ 31 ] = KEY_ZOOM, +}; + /* Mark Phalan */ static IR_KEYTAB_TYPE ir_codes_pv951[IR_KEYTAB_SIZE] = { [ 0 ] = KEY_KP0, @@ -352,6 +386,13 @@ static int ir_attach(struct i2c_adapter *adap, int addr, ir_type = IR_TYPE_RC5; ir_codes = ir_codes_rc5_tv; break; + case 0x60: + name = "em2820"; + ir->get_key = get_key_knc1; + ir->c.addr = addr>>1; + ir_type = IR_TYPE_OTHER; + ir_codes = ir_codes_em2820; + break; case 0x30: name = "KNC One"; ir->get_key = get_key_knc1; @@ -427,6 +468,7 @@ static int ir_probe(struct i2c_adapter *adap) static const int probe_bttv[] = { 0x1a, 0x18, 0x4b, 0x64, 0x30, -1}; static const int probe_saa7134[] = { 0x7a, -1 }; + static const int probe_em2820[] = { 0x60, -1 }; const int *probe = NULL; struct i2c_client c; char buf; int i,rc; @@ -437,6 +479,9 @@ static int ir_probe(struct i2c_adapter *adap) case I2C_HW_SAA7134: probe = probe_saa7134; break; + case I2C_HW_B_EM2820: + probe = probe_em2820; + break; } if (NULL == probe) return 0; -- cgit v1.2.2 From 40c717ff48b2c91091a69de0e28c02a43e9b0c7c Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Tue, 8 Nov 2005 21:37:21 -0800 Subject: [PATCH] v4l: 763: include newer i2c id at linux include media id h - Include newer I2C ID at ../linux/include/media/id.h: Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/media/id.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/include/media/id.h b/include/media/id.h index 6d02c94cdc0d..4f58d73e7029 100644 --- a/include/media/id.h +++ b/include/media/id.h @@ -33,3 +33,18 @@ #ifndef I2C_DRIVERID_SAA6752HS # define I2C_DRIVERID_SAA6752HS I2C_DRIVERID_EXP0+8 #endif +#ifndef I2C_DRIVERID_WM8775 +#define I2C_DRIVERID_WM8775 I2C_DRIVERID_EXP0+9 +#endif +#ifndef I2C_DRIVERID_CS53L32A +#define I2C_DRIVERID_CS53L32A I2C_DRIVERID_EXP0+10 +#endif +#ifndef I2C_DRIVERID_CX25840 +#define I2C_DRIVERID_CX25840 I2C_DRIVERID_EXP0+11 +#endif +#ifndef I2C_DRIVERID_SAA7115 +#define I2C_DRIVERID_SAA7115 I2C_DRIVERID_EXP0+12 +#endif +#ifndef I2C_DRIVERID_SAA7127 +#define I2C_DRIVERID_SAA7127 I2C_DRIVERID_EXP0+13 +#endif -- cgit v1.2.2 From 2b5200a7b19a53969db68c97d379339592ca6a4f Mon Sep 17 00:00:00 2001 From: David Shirley Date: Tue, 8 Nov 2005 21:37:22 -0800 Subject: [PATCH] v4l: 766: add dvb card winfast dtv1000-t - Add DVB card WinFast DTV1000-T Signed-off-by: David Shirley Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/video4linux/CARDLIST.cx88 | 1 + drivers/media/video/cx88/cx88-cards.c | 16 ++++++++++++++++ drivers/media/video/cx88/cx88-dvb.c | 1 + drivers/media/video/cx88/cx88.h | 1 + 4 files changed, 19 insertions(+) diff --git a/Documentation/video4linux/CARDLIST.cx88 b/Documentation/video4linux/CARDLIST.cx88 index ca46fbf489d5..12e9e393868e 100644 --- a/Documentation/video4linux/CARDLIST.cx88 +++ b/Documentation/video4linux/CARDLIST.cx88 @@ -33,3 +33,4 @@ 32 -> AverMedia UltraTV Media Center PCI 550 [1461:8011] 33 -> Kworld V-Stream Xpert DVD 34 -> ATI HDTV Wonder [1002:a101] + 35 -> WinFast DTV1000-T [107d:665f] diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c index 388440789dfb..6a85ba111fb1 100644 --- a/drivers/media/video/cx88/cx88-cards.c +++ b/drivers/media/video/cx88/cx88-cards.c @@ -852,6 +852,18 @@ struct cx88_board cx88_boards[] = { .gpio3 = 0x00000000, }}, }, + [CX88_BOARD_WINFAST_DTV1000] = { + .name = "WinFast DTV1000-T", + .tuner_type = TUNER_ABSENT, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .input = {{ + .type = CX88_VMUX_DVB, + .vmux = 0, + }}, + .dvb = 1, + }, }; const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards); @@ -991,6 +1003,10 @@ struct cx88_subid cx88_subids[] = { .subvendor = PCI_VENDOR_ID_ATI, .subdevice = 0xa101, .card = CX88_BOARD_ATI_HDTVWONDER, + },{ + .subvendor = 0x107d, + .subdevice = 0x665f, + .card = CX88_BOARD_WINFAST_DTV1000, }, }; const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids); diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index 82e686135f60..579de88e3081 100644 --- a/drivers/media/video/cx88/cx88-dvb.c +++ b/drivers/media/video/cx88/cx88-dvb.c @@ -299,6 +299,7 @@ static int dvb_register(struct cx8802_dev *dev) break; case CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1: case CX88_BOARD_CONEXANT_DVB_T1: + case CX88_BOARD_WINFAST_DTV1000: dev->dvb.frontend = cx22702_attach(&connexant_refboard_config, &dev->core->i2c_adap); break; diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h index a690569f345d..ea5c092a779e 100644 --- a/drivers/media/video/cx88/cx88.h +++ b/drivers/media/video/cx88/cx88.h @@ -177,6 +177,7 @@ extern struct sram_channel cx88_sram_channels[]; #define CX88_BOARD_AVERMEDIA_ULTRATV_MC_550 32 #define CX88_BOARD_KWORLD_VSTREAM_EXPERT_DVD 33 #define CX88_BOARD_ATI_HDTVWONDER 34 +#define CX88_BOARD_WINFAST_DTV1000 35 enum cx88_itype { CX88_VMUX_COMPOSITE1 = 1, -- cgit v1.2.2 From 596d92d5128d308b5a79f21c3e72c87f5fc7e58b Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:37:24 -0800 Subject: [PATCH] v4l: 767: included support for em2800 - Included support for em2800. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/video4linux/CARDLIST.em28xx | 13 ++- drivers/media/video/em28xx/em28xx-cards.c | 125 ++++++++++++++++++-- drivers/media/video/em28xx/em28xx-core.c | 13 ++- drivers/media/video/em28xx/em28xx-i2c.c | 182 ++++++++++++++++++++++++++---- drivers/media/video/em28xx/em28xx-video.c | 73 +++++++++--- drivers/media/video/em28xx/em28xx.h | 29 ++++- 6 files changed, 375 insertions(+), 60 deletions(-) diff --git a/Documentation/video4linux/CARDLIST.em28xx b/Documentation/video4linux/CARDLIST.em28xx index a33ddea0b6f5..d86aae09450b 100644 --- a/Documentation/video4linux/CARDLIST.em28xx +++ b/Documentation/video4linux/CARDLIST.em28xx @@ -1,4 +1,9 @@ - 0 -> Terratec Cinergy 250 USB [0ccd:0036] - 1 -> Pinnacle PCTV USB 2 [2304:0208] - 2 -> Hauppauge WinTV USB 2 [2040:4200] - 3 -> MSI VOX USB 2.0 [eb1a:2820] + 0 -> Unknown EM2800 video grabber (em2800) [eb1a:2800] + 1 -> Unknown EM2820/2840 video grabber (em2820/em2840) [eb1a:2820] + 2 -> Terratec Cinergy 250 USB (em2820/em2840) [0ccd:0036] + 3 -> Pinnacle PCTV USB 2 (em2820/em2840) [2304:0208] + 4 -> Hauppauge WinTV USB 2 (em2820/em2840) [2040:4200] + 5 -> MSI VOX USB 2.0 (em2820/em2840) + 6 -> Terratec Cinergy 200 USB (em2800) + 7 -> Leadtek Winfast USB II (em2800) + 8 -> Kworld USB2800 (em2800) diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index 7333bbad8871..91c70ebd0ea4 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c @@ -1,5 +1,5 @@ /* - em2820-cards.c - driver for Empia EM2820/2840 USB video capture devices + em2820-cards.c - driver for Empia EM2800/EM2820/2840 USB video capture devices Copyright (C) 2005 Markus Rechberger Ludovico Cavedon @@ -35,14 +35,43 @@ #include "em2820.h" -enum em2820_board_entry { - EM2820_BOARD_TERRATEC_CINERGY_250, - EM2820_BOARD_PINNACLE_USB_2, - EM2820_BOARD_HAUPPAUGE_WINTV_USB_2, - EM2820_BOARD_MSI_VOX_USB_2 -}; - struct em2820_board em2820_boards[] = { + [EM2800_BOARD_UNKNOWN] = { + .name = "Unknown EM2800 video grabber", + .is_em2800 = 1, + .vchannels = 2, + .norm = VIDEO_MODE_PAL, + .tda9887_conf = TDA9887_PRESENT, + .has_tuner = 1, + .decoder = EM2820_SAA7113, + .input = {{ + .type = EM2820_VMUX_COMPOSITE1, + .vmux = 0, + .amux = 1, + },{ + .type = EM2820_VMUX_SVIDEO, + .vmux = 9, + .amux = 1, + }}, + }, + [EM2820_BOARD_UNKNOWN] = { + .name = "Unknown EM2820/2840 video grabber", + .is_em2800 = 0, + .vchannels = 2, + .norm = VIDEO_MODE_PAL, + .tda9887_conf = TDA9887_PRESENT, + .has_tuner = 1, + .decoder = EM2820_SAA7113, + .input = {{ + .type = EM2820_VMUX_COMPOSITE1, + .vmux = 0, + .amux = 1, + },{ + .type = EM2820_VMUX_SVIDEO, + .vmux = 9, + .amux = 1, + }}, + }, [EM2820_BOARD_TERRATEC_CINERGY_250] = { .name = "Terratec Cinergy 250 USB", .vchannels = 3, @@ -129,17 +158,88 @@ struct em2820_board em2820_boards[] = { .amux = 1, }}, }, - { } /* Terminating entry */ + [EM2800_BOARD_TERRATEC_CINERGY_200] = { + .name = "Terratec Cinergy 200 USB", + .chip_id = 0x4, + .is_em2800 = 1, + .vchannels = 3, + .norm = VIDEO_MODE_PAL, + .tuner_type = TUNER_LG_PAL_NEW_TAPC, + .tda9887_conf = TDA9887_PRESENT, + .has_tuner = 1, + .decoder = EM2820_SAA7113, + .input = {{ + .type = EM2820_VMUX_TELEVISION, + .vmux = 2, + .amux = 0, + },{ + .type = EM2820_VMUX_COMPOSITE1, + .vmux = 0, + .amux = 1, + },{ + .type = EM2820_VMUX_SVIDEO, + .vmux = 9, + .amux = 1, + }}, + }, + [EM2800_BOARD_LEADTEK_WINFAST_USBII] = { + .name = "Leadtek Winfast USB II", + .chip_id = 0x2, + .is_em2800 = 1, + .vchannels = 3, + .norm = VIDEO_MODE_PAL, + .tuner_type = TUNER_LG_PAL_NEW_TAPC, + .tda9887_conf = TDA9887_PRESENT, + .has_tuner = 1, + .decoder = EM2820_SAA7113, + .input = {{ + .type = EM2820_VMUX_TELEVISION, + .vmux = 2, + .amux = 0, + },{ + .type = EM2820_VMUX_COMPOSITE1, + .vmux = 0, + .amux = 1, + },{ + .type = EM2820_VMUX_SVIDEO, + .vmux = 9, + .amux = 1, + }}, + }, + [EM2800_BOARD_KWORLD_USB2800] = { + .name = "Kworld USB2800", + .chip_id = 0x7, + .is_em2800 = 1, + .vchannels = 3, + .norm = VIDEO_MODE_PAL, + .tuner_type = TUNER_PHILIPS_ATSC, + .tda9887_conf = TDA9887_PRESENT, + .has_tuner = 1, + .decoder = EM2820_SAA7113, + .input = {{ + .type = EM2820_VMUX_TELEVISION, + .vmux = 2, + .amux = 0, + },{ + .type = EM2820_VMUX_COMPOSITE1, + .vmux = 0, + .amux = 1, + },{ + .type = EM2820_VMUX_SVIDEO, + .vmux = 9, + .amux = 1, + }}, + }, }; +const unsigned int em2820_bcount = ARRAY_SIZE(em2820_boards); /* table of devices that work with this driver */ struct usb_device_id em2820_id_table [] = { - /* Terratec Cinerhy 200 USB: em2800 nor supported, at the moment */ - /* { USB_DEVICE(0xeb1a, 0x2800), .driver_info = EM2800_BOARD_TERRATEC_CINERGY_200 }, */ + { USB_DEVICE(0xeb1a, 0x2800), .driver_info = EM2800_BOARD_UNKNOWN }, + { USB_DEVICE(0xeb1a, 0x2820), .driver_info = EM2820_BOARD_UNKNOWN }, { USB_DEVICE(0x0ccd, 0x0036), .driver_info = EM2820_BOARD_TERRATEC_CINERGY_250 }, { USB_DEVICE(0x2304, 0x0208), .driver_info = EM2820_BOARD_PINNACLE_USB_2 }, { USB_DEVICE(0x2040, 0x4200), .driver_info = EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 }, - { USB_DEVICE(0xeb1a, 0x2820), .driver_info = EM2820_BOARD_MSI_VOX_USB_2 }, { }, }; @@ -163,6 +263,7 @@ void em2820_card_setup(struct em2820 *dev) } EXPORT_SYMBOL(em2820_boards); +EXPORT_SYMBOL(em2820_bcount); EXPORT_SYMBOL(em2820_id_table); MODULE_DEVICE_TABLE (usb, em2820_id_table); diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index e187422f6d6d..594e6d681ba4 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c @@ -1,5 +1,5 @@ /* - em2820-core.c - driver for Empia EM2820/2840 USB video capture devices + em2820-core.c - driver for Empia EM2800/EM2820/2840 USB video capture devices Copyright (C) 2005 Markus Rechberger Ludovico Cavedon @@ -562,6 +562,11 @@ static inline void em2820_isoc_video_copy(struct em2820 *dev, void *fieldstart, *startwrite, *startread; int linesdone, currlinedone, offset, lencopy,remain; + if(dev->frame_size != (*f)->buf.length){ + em2820_err("frame_size %i and buf.length %i are different!!!\n",dev->frame_size,(*f)->buf.length); + return; + } + if ((*f)->fieldbytesused + len > dev->field_size) len =dev->field_size - (*f)->fieldbytesused; remain = len; @@ -780,6 +785,11 @@ int em2820_set_alternate(struct em2820 *dev) dev->alt = alt; if (dev->alt == 0) { int i; + if(dev->is_em2800){ /* always use the max packet size for em2800 based devices */ + for(i=0;i< EM2820_MAX_ALT; i++) + if(dev->alt_max_pkt_size[i]>dev->alt_max_pkt_size[dev->alt]) + dev->alt=i; + }else{ unsigned int min_pkt_size = dev->field_size / 137; /* FIXME: empiric magic number */ em2820_coredbg("minimum isoc packet size: %u", min_pkt_size); dev->alt = 7; @@ -788,6 +798,7 @@ int em2820_set_alternate(struct em2820 *dev) dev->alt = i; break; } + } } if (dev->alt != prev_alt) { diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c index 3065ddb4b368..b7360d579a8a 100644 --- a/drivers/media/video/em28xx/em28xx-i2c.c +++ b/drivers/media/video/em28xx/em28xx-i2c.c @@ -1,5 +1,5 @@ /* - em2820-i2c.c - driver for Empia EM2820/2840 USB video capture devices + em2820-i2c.c - driver for Empia EM2800/EM2820/2840 USB video capture devices Copyright (C) 2005 Markus Rechberger Ludovico Cavedon @@ -29,11 +29,6 @@ #include #include -/* To be moved to compat.h */ -#if !defined(I2C_HW_B_EM2820) -#define I2C_HW_B_EM2820 0x99 -#endif - #include "em2820.h" /* ----------------------------------------------------------- */ @@ -56,11 +51,132 @@ MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]"); printk(fmt , ##args); } while (0) /* - * i2c_send_bytes() + * em2800_i2c_send_max4() + * send up to 4 bytes to the i2c device + */ +static int em2800_i2c_send_max4(struct em2820 *dev, unsigned char addr, + char *buf, int len) +{ + int ret; + int write_timeout; + unsigned char b2[6]; + BUG_ON(len < 1 || len > 4); + b2[5] = 0x80 + len - 1; + b2[4] = addr; + b2[3] = buf[0]; + if (len > 1) + b2[2] = buf[1]; + if (len > 2) + b2[1] = buf[2]; + if (len > 3) + b2[0] = buf[3]; + + ret = dev->em2820_write_regs(dev, 4 - len, &b2[4 - len], 2 + len); + if (ret != 2 + len) { + em2820_warn("writting to i2c device failed (error=%i)\n", ret); + return -EIO; + } + for (write_timeout = EM2800_I2C_WRITE_TIMEOUT; write_timeout > 0; + write_timeout -= 5) { + ret = dev->em2820_read_reg(dev, 0x05); + if (ret == 0x80 + len - 1) + return len; + mdelay(5); + } + em2820_warn("i2c write timed out\n"); + return -EIO; +} + +/* + * em2800_i2c_send_bytes() + */ +static int em2800_i2c_send_bytes(void *data, unsigned char addr, char *buf, + short len) +{ + char *bufPtr = buf; + int ret; + int wrcount = 0; + int count; + int maxLen = 4; + struct em2820 *dev = (struct em2820 *)data; + while (len > 0) { + count = (len > maxLen) ? maxLen : len; + ret = em2800_i2c_send_max4(dev, addr, bufPtr, count); + if (ret > 0) { + len -= count; + bufPtr += count; + wrcount += count; + } else + return (ret < 0) ? ret : -EFAULT; + } + return wrcount; +} + +/* + * em2800_i2c_check_for_device() + * check if there is a i2c_device at the supplied address + */ +static int em2800_i2c_check_for_device(struct em2820 *dev, unsigned char addr) +{ + char msg; + int ret; + int write_timeout; + msg = addr; + ret = dev->em2820_write_regs(dev, 0x04, &msg, 1); + if (ret < 0) { + em2820_warn("setting i2c device address failed (error=%i)\n", + ret); + return ret; + } + msg = 0x84; + ret = dev->em2820_write_regs(dev, 0x05, &msg, 1); + if (ret < 0) { + em2820_warn("preparing i2c read failed (error=%i)\n", ret); + return ret; + } + for (write_timeout = EM2800_I2C_WRITE_TIMEOUT; write_timeout > 0; + write_timeout -= 5) { + unsigned msg = dev->em2820_read_reg(dev, 0x5); + if (msg == 0x94) + return -ENODEV; + else if (msg == 0x84) + return 0; + mdelay(5); + } + return -ENODEV; +} + +/* + * em2800_i2c_recv_bytes() + * read from the i2c device + */ +static int em2800_i2c_recv_bytes(struct em2820 *dev, unsigned char addr, + char *buf, int len) +{ + int ret; + /* check for the device and set i2c read address */ + ret = em2800_i2c_check_for_device(dev, addr); + if (ret) { + em2820_warn + ("preparing read at i2c address 0x%x failed (error=%i)\n", + addr, ret); + return ret; + } + ret = dev->em2820_read_reg_req_len(dev, 0x0, 0x3, buf, len); + if (ret < 0) { + em2820_warn("reading from i2c device at 0x%x failed (error=%i)", + addr, ret); + return ret; + } + return ret; +} + +/* + * em2820_i2c_send_bytes() * untested for more than 4 bytes */ -static int i2c_send_bytes(void *data, unsigned char addr, char *buf, short len, - int stop) +static int em2820_i2c_send_bytes(void *data, unsigned char addr, char *buf, + short len, int stop) { int wrcount = 0; struct em2820 *dev = (struct em2820 *)data; @@ -71,11 +187,11 @@ static int i2c_send_bytes(void *data, unsigned char addr, char *buf, short len, } /* - * i2c_recv_byte() + * em2820_i2c_recv_bytes() * read a byte from the i2c device */ -static int i2c_recv_bytes(struct em2820 *dev, unsigned char addr, char *buf, - int len) +static int em2820_i2c_recv_bytes(struct em2820 *dev, unsigned char addr, + char *buf, int len) { int ret; ret = dev->em2820_read_reg_req_len(dev, 2, addr, buf, len); @@ -89,10 +205,10 @@ static int i2c_recv_bytes(struct em2820 *dev, unsigned char addr, char *buf, } /* - * i2c_check_for_device() + * em2820_i2c_check_for_device() * check if there is a i2c_device at the supplied address */ -static int i2c_check_for_device(struct em2820 *dev, unsigned char addr) +static int em2820_i2c_check_for_device(struct em2820 *dev, unsigned char addr) { char msg; int ret; @@ -126,18 +242,25 @@ static int em2820_i2c_xfer(struct i2c_adapter *i2c_adap, (msgs[i].flags & I2C_M_RD) ? "read" : "write", i == num - 1 ? "stop" : "nonstop", addr, msgs[i].len); if (!msgs[i].len) { /* no len: check only for device presence */ - rc = i2c_check_for_device(dev, addr); + if (dev->is_em2800) + rc = em2800_i2c_check_for_device(dev, addr); + else + rc = em2820_i2c_check_for_device(dev, addr); if (rc < 0) { dprintk2(" no device\n"); return rc; } - } - if (msgs[i].flags & I2C_M_RD) { + } else if (msgs[i].flags & I2C_M_RD) { /* read bytes */ - - rc = i2c_recv_bytes(dev, addr, msgs[i].buf, - msgs[i].len); + if (dev->is_em2800) + rc = em2800_i2c_recv_bytes(dev, addr, + msgs[i].buf, + msgs[i].len); + else + rc = em2820_i2c_recv_bytes(dev, addr, + msgs[i].buf, + msgs[i].len); if (i2c_debug) { for (byte = 0; byte < msgs[i].len; byte++) { printk(" %02x", msgs[i].buf[byte]); @@ -149,8 +272,15 @@ static int em2820_i2c_xfer(struct i2c_adapter *i2c_adap, for (byte = 0; byte < msgs[i].len; byte++) printk(" %02x", msgs[i].buf[byte]); } - rc = i2c_send_bytes(dev, addr, msgs[i].buf, msgs[i].len, - i == num - 1); + if (dev->is_em2800) + rc = em2800_i2c_send_bytes(dev, addr, + msgs[i].buf, + msgs[i].len); + else + rc = em2820_i2c_send_bytes(dev, addr, + msgs[i].buf, + msgs[i].len, + i == num - 1); if (rc < 0) goto err; } @@ -171,6 +301,12 @@ static int em2820_i2c_eeprom(struct em2820 *dev, unsigned char *eedata, int len) int i, err, size = len, block; dev->i2c_client.addr = 0xa0 >> 1; + + /* Check if board has eeprom */ + err = i2c_master_recv(&dev->i2c_client, &buf, 0); + if (err < 0) + return -1; + buf = 0; if (1 != (err = i2c_master_send(&dev->i2c_client, &buf, 1))) { printk(KERN_INFO "%s: Huh, no eeprom present (err=%d)?\n", @@ -389,7 +525,7 @@ static void do_i2c_scan(char *name, struct i2c_client *c) rc = i2c_master_recv(c, &buf, 0); if (rc < 0) continue; - printk(KERN_INFO "%s: found device @ 0x%x [%s]", name, + printk(KERN_INFO "%s: found i2c device @ 0x%x [%s]\n", name, i << 1, i2c_devs[i] ? i2c_devs[i] : "???"); } } diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 7e4114ea15f9..d3a959b9ee64 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c @@ -1,5 +1,5 @@ /* - em2820-video.c - driver for Empia EM2820/2840 USB video capture devices + em2820-video.c - driver for Empia EM2800/EM2820/2840 USB video capture devices Copyright (C) 2005 Markus Rechberger Ludovico Cavedon @@ -50,6 +50,11 @@ MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); +static unsigned int card[] = {[0 ... (EM2820_MAXBOARDS - 1)] = UNSET }; + +module_param_array(card, int, NULL, 0444); +MODULE_PARM_DESC(card,"card type"); + static int tuner = -1; module_param(tuner, int, 0444); MODULE_PARM_DESC(tuner, "tuner type"); @@ -1081,7 +1086,7 @@ static int em2820_do_ioctl(struct inode *inode, struct file *filp, struct v4l2_cropcap *cc = arg; if (cc->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) - return EINVAL; + return -EINVAL; cc->bounds.left = 0; cc->bounds.top = 0; cc->bounds.width = dev->width; @@ -1520,21 +1525,12 @@ static struct file_operations em2820_v4l_fops = { static int em2820_init_dev(struct em2820 **devhandle, struct usb_device *udev, int minor, int model) { - struct em2820 *dev; + struct em2820 *dev = *devhandle; int retval = -ENOMEM; int errCode, i; unsigned int maxh, maxw; struct usb_interface *uif; - /* allocate memory for our device state and initialize it */ - dev = kmalloc(sizeof(*dev), GFP_KERNEL); - if (dev == NULL) { - em2820_err(DRIVER_NAME ": out of memory!\n"); - return -ENOMEM; - } - memset(dev, 0x00, sizeof(*dev)); - - snprintf(dev->name, 29, "em2820 #%d", minor); dev->udev = udev; dev->model = model; init_MUTEX(&dev->lock); @@ -1545,6 +1541,7 @@ static int em2820_init_dev(struct em2820 **devhandle, struct usb_device *udev, dev->em2820_read_reg_req_len = em2820_read_reg_req_len; dev->em2820_write_regs_req = em2820_write_regs_req; dev->em2820_read_reg_req = em2820_read_reg_req; + dev->is_em2800 = em2820_boards[model].is_em2800; dev->has_tuner = em2820_boards[model].has_tuner; dev->has_msp34xx = em2820_boards[model].has_msp34xx; dev->tda9887_conf = em2820_boards[model].tda9887_conf; @@ -1595,7 +1592,7 @@ static int em2820_init_dev(struct em2820 **devhandle, struct usb_device *udev, /* compute alternate max packet sizes */ uif = dev->udev->actconfig->interface[0]; dev->alt_max_pkt_size[0] = 0; - for (i = 1; i <= EM2820_MAX_ALT; i++) { + for (i = 1; i <= EM2820_MAX_ALT && i < uif->num_altsetting ; i++) { u16 tmp = le16_to_cpu(uif->altsetting[i].endpoint[1].desc. wMaxPacketSize); @@ -1688,7 +1685,6 @@ static int em2820_init_dev(struct em2820 **devhandle, struct usb_device *udev, em2820_info("V4L2 device registered as /dev/video%d\n", dev->vdev->minor); - *devhandle = dev; return 0; } @@ -1703,27 +1699,68 @@ static int em2820_usb_probe(struct usb_interface *interface, struct usb_device *udev; struct em2820 *dev = NULL; int retval = -ENODEV; + int model,i,nr; udev = usb_get_dev(interface_to_usbdev(interface)); endpoint = &interface->cur_altsetting->endpoint[1].desc; + /* Don't register audio interfaces */ + if (interface->altsetting[1].desc.bInterfaceClass == USB_CLASS_AUDIO) + return -ENODEV; + /* check if the the device has the iso in endpoint at the correct place */ if ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_ISOC) { -/* em2820_err(DRIVER_NAME " probing error: endpoint is non-ISO endpoint!\n"); */ + em2820_err(DRIVER_NAME " probing error: endpoint is non-ISO endpoint!\n"); return -ENODEV; } if ((endpoint->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT) { -/* em2820_err(DRIVER_NAME " probing error: endpoint is ISO OUT endpoint!\n"); */ + em2820_err(DRIVER_NAME " probing error: endpoint is ISO OUT endpoint!\n"); return -ENODEV; } + model=id->driver_info; + nr=interface->minor; + + if (nr>EM2820_MAXBOARDS) { + printk ("em2820: Supports only %i em28xx boards.\n",EM2820_MAXBOARDS); + return -ENOMEM; + } + + /* allocate memory for our device state and initialize it */ + dev = kmalloc(sizeof(*dev), GFP_KERNEL); + if (dev == NULL) { + em2820_err(DRIVER_NAME ": out of memory!\n"); + return -ENOMEM; + } + memset(dev, 0, sizeof(*dev)); + + snprintf(dev->name, 29, "em2820 #%d", nr); + + if ((card[nr]>=0)&&(card[nr] insmod option to\n" + "%s: workaround that. Redirect complaints to the vendor of\n" + "%s: the TV card. Best regards,\n" + "%s: -- tux\n", + dev->name,dev->name,dev->name,dev->name,dev->name); + printk("%s: Here is a list of valid choices for the card= insmod option:\n", + dev->name); + for (i = 0; i < em2820_bcount; i++) { + printk("%s: card=%d -> %s\n", + dev->name, i, em2820_boards[i].name); + } + } + /* allocate device struct */ - retval = em2820_init_dev(&dev, udev, interface->minor, id->driver_info); + retval = em2820_init_dev(&dev, udev, nr, model); if (retval) return retval; - em2820_info("Found %s\n", em2820_boards[id->driver_info].name); + em2820_info("Found %s\n", em2820_boards[model].name); /* save our data pointer in this interface device */ usb_set_intfdata(interface, dev); diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h index 7779121a3dea..4115938a1731 100644 --- a/drivers/media/video/em28xx/em28xx.h +++ b/drivers/media/video/em28xx/em28xx.h @@ -1,5 +1,5 @@ /* - em2820-cards.c - driver for Empia EM2820/2840 USB video capture devices + em2820-cards.c - driver for Empia EM2800/EM2820/2840 USB video capture devices Copyright (C) 2005 Markus Rechberger Ludovico Cavedon @@ -28,6 +28,23 @@ #include #include +/* Boards supported by driver */ + +#define EM2800_BOARD_UNKNOWN 0 +#define EM2820_BOARD_UNKNOWN 1 +#define EM2820_BOARD_TERRATEC_CINERGY_250 2 +#define EM2820_BOARD_PINNACLE_USB_2 3 +#define EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 4 +#define EM2820_BOARD_MSI_VOX_USB_2 5 +#define EM2800_BOARD_TERRATEC_CINERGY_200 6 +#define EM2800_BOARD_LEADTEK_WINFAST_USBII 7 +#define EM2800_BOARD_KWORLD_USB2800 8 + +#define UNSET -1 + +/* maximum number of em28xx boards */ +#define EM2820_MAXBOARDS 1 /*FIXME: should be bigger */ + /* maximum number of frames that can be queued */ #define EM2820_NUM_FRAMES 5 /* number of frames that get used for v4l2_read() */ @@ -79,6 +96,9 @@ /* time to wait when stopping the isoc transfer */ #define EM2820_URB_TIMEOUT msecs_to_jiffies(EM2820_NUM_BUFS * EM2820_NUM_PACKETS) +/* time in msecs to wait for i2c writes to finish */ +#define EM2800_I2C_WRITE_TIMEOUT 20 + /* the various frame states */ enum em2820_frame_state { F_UNUSED = 0, @@ -145,12 +165,13 @@ enum em2820_decoder { struct em2820_board { char *name; - + unsigned char chip_id; int vchannels; int norm; int tuner_type; /* i2c flags */ + unsigned int is_em2800; unsigned int tda9887_conf; unsigned int has_tuner:1; @@ -195,6 +216,7 @@ struct em2820 { /* generic device properties */ char name[30]; /* name (including minor) of the device */ int model; /* index in the device_data struct */ + unsigned int is_em2800; int video_inputs; /* number of video inputs */ unsigned int has_tuner:1; unsigned int has_msp34xx:1; @@ -304,11 +326,14 @@ void em2820_uninit_isoc(struct em2820 *dev); int em2820_set_alternate(struct em2820 *dev); /* Provided by em2820-cards.c */ +extern int em2800_variant_detect(struct usb_device* udev,int model); extern void em2820_card_setup(struct em2820 *dev); extern struct em2820_board em2820_boards[]; extern struct usb_device_id em2820_id_table[]; +extern const unsigned int em2820_bcount; /* em2820 registers */ +#define CHIPID_REG 0x0a #define USBSUSP_REG 0x0c /* */ #define AUDIOSRC_REG 0x0e -- cgit v1.2.2 From 2a2d857c005399fdf4e0913cb43cca9beb9941a7 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 8 Nov 2005 21:37:24 -0800 Subject: [PATCH] v4l: 768: don t bother gerd with bttv cards patches - Don't bother Gerd with bttv-cards patches. Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/bttv-cards.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bttv-cards.c index 77f0ff8a4e4c..2b19de386dcf 100644 --- a/drivers/media/video/bttv-cards.c +++ b/drivers/media/video/bttv-cards.c @@ -2824,7 +2824,7 @@ void __devinit bttv_idcard(struct bttv *btv) btv->c.nr, btv->cardid & 0xffff, (btv->cardid >> 16) & 0xffff); printk(KERN_DEBUG "please mail id, board name and " - "the correct card= insmod option to kraxel@bytesex.org\n"); + "the correct card= insmod option to video4linux-list@redhat.com\n"); } } -- cgit v1.2.2 From 0edeea4f917ab6f0b806c496822267cef2218500 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Tue, 8 Nov 2005 21:37:25 -0800 Subject: [PATCH] v4l: 771: the wm8775 is a wolfson microelectronics 24 bit 96khz adc with 4 - Support for Wolfson Microelectronics wm8775 audio processor Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/wm8775.c | 253 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 253 insertions(+) create mode 100644 drivers/media/video/wm8775.c diff --git a/drivers/media/video/wm8775.c b/drivers/media/video/wm8775.c new file mode 100644 index 000000000000..8200f3dad0c6 --- /dev/null +++ b/drivers/media/video/wm8775.c @@ -0,0 +1,253 @@ +/* + * wm8775 - driver version 0.0.1 + * + * Copyright (C) 2004 Ulf Eklund + * + * Based on saa7115 driver + * + * 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 +#include +#include +#include +#include +#include +#include +#include + +MODULE_DESCRIPTION("wm8775 driver"); +MODULE_AUTHOR("Ulf Eklund"); +MODULE_LICENSE("GPL"); + +#define wm8775_err(fmt, arg...) do { \ + printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->name, \ + i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) +#define wm8775_info(fmt, arg...) do { \ + printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->name, \ + i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) + + +static unsigned short normal_i2c[] = { 0x36 >> 1, I2C_CLIENT_END }; + + +I2C_CLIENT_INSMOD; + +/* ----------------------------------------------------------------------- */ + +enum { + R7 = 7, R11 = 11, + R12, R13, R14, R15, R16, R17, R18, R19, R20, R21, R23 = 23, + TOT_REGS +}; + +struct wm8775_state { + u8 input; /* Last selected input (0-0xf) */ + u8 muted; +}; + +static int wm8775_write(struct i2c_client *client, int reg, u16 val) +{ + int i; + + if (reg < 0 || reg >= TOT_REGS) { + wm8775_err("Invalid register R%d\n", reg); + return -1; + } + + for (i = 0; i < 3; i++) { + if (i2c_smbus_write_byte_data(client, (reg << 1) | + (val >> 8), val & 0xff) == 0) { + return 0; + } + } + wm8775_err("I2C: cannot write %03x to register R%d\n", val, reg); + return -1; +} + +static int wm8775_command(struct i2c_client *client, unsigned int cmd, + void *arg) +{ + struct wm8775_state *state = i2c_get_clientdata(client); + int *input = arg; + + switch (cmd) { + case AUDC_SET_INPUT: + wm8775_write(client, R21, 0x0c0); + wm8775_write(client, R14, 0x1d4); + wm8775_write(client, R15, 0x1d4); + + if (*input == AUDIO_RADIO) { + wm8775_write(client, R21, 0x108); + state->input = 8; + state->muted = 0; + break; + } + if (*input == AUDIO_MUTE) { + state->muted = 1; + break; + } + if (*input == AUDIO_UNMUTE) { + wm8775_write(client, R21, 0x100 + state->input); + state->muted = 0; + break; + } + /* All other inputs... */ + wm8775_write(client, R21, 0x102); + state->input = 2; + state->muted = 0; + break; + + + case VIDIOCSFREQ: + /* If I remove this, then it can happen that I have no + sound the first time I tune from static to a valid channel. + It's difficult to reproduce and is almost certainly related + to the zero cross detect circuit. */ + wm8775_write(client, R21, 0x0c0); + wm8775_write(client, R14, 0x1d4); + wm8775_write(client, R15, 0x1d4); + wm8775_write(client, R21, 0x100 + state->input); + break; + + default: + return -EINVAL; + } + return 0; +} + +/* ----------------------------------------------------------------------- */ + +/* i2c implementation */ + +/* + * Generic i2c probe + * concerning the addresses: i2c wants 7 bit (without the r/w bit), so '>>1' + */ + +static struct i2c_driver i2c_driver; + +static int wm8775_attach(struct i2c_adapter *adapter, int address, int kind) +{ + struct i2c_client *client; + struct wm8775_state *state; + + /* Check if the adapter supports the needed features */ + if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) + return 0; + + client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); + if (client == 0) + return -ENOMEM; + + memset(client, 0, sizeof(struct i2c_client)); + client->addr = address; + client->adapter = adapter; + client->driver = &i2c_driver; + client->flags = I2C_CLIENT_ALLOW_USE; + snprintf(client->name, sizeof(client->name) - 1, "wm8775"); + + wm8775_info("chip found @ 0x%x (%s)\n", address << 1, adapter->name); + + state = kmalloc(sizeof(struct wm8775_state), GFP_KERNEL); + if (state == NULL) { + kfree(client); + return -ENOMEM; + } + state->input = 2; + state->muted = 0; + i2c_set_clientdata(client, state); + + /* initialize wm8775 */ + wm8775_write(client, R23, 0x000); /* RESET */ + wm8775_write(client, R7, 0x000); /* Disable zero cross detect timeout */ + wm8775_write(client, R11, 0x021); /* Left justified, 24-bit mode */ + wm8775_write(client, R12, 0x102); /* Master mode, clock ratio 256fs */ + wm8775_write(client, R13, 0x000); /* Powered up */ + wm8775_write(client, R14, 0x1d4); /* ADC gain +2.5dB, enable zero cross */ + wm8775_write(client, R15, 0x1d4); /* ADC gain +2.5dB, enable zero cross */ + wm8775_write(client, R16, 0x1bf); /* ALC Stereo, ALC target level -1dB FS */ + /* max gain +8dB */ + wm8775_write(client, R17, 0x185); /* Enable gain control, use zero cross */ + /* detection, ALC hold time 42.6 ms */ + wm8775_write(client, R18, 0x0a2); /* ALC gain ramp up delay 34 s, */ + /* ALC gain ramp down delay 33 ms */ + wm8775_write(client, R19, 0x005); /* Enable noise gate, threshold -72dBfs */ + wm8775_write(client, R20, 0x07a); /* Transient window 4ms, lower PGA gain */ + /* limit -1dB */ + wm8775_write(client, R21, 0x102); /* LRBOTH = 1, use input 2. */ + i2c_attach_client(client); + + return 0; +} + +static int wm8775_probe(struct i2c_adapter *adapter) +{ +#ifdef I2C_CLASS_TV_ANALOG + if (adapter->class & I2C_CLASS_TV_ANALOG) + return i2c_probe(adapter, &addr_data, wm8775_attach); +#else + switch (adapter->id) { + case I2C_HW_B_BT848: + return i2c_probe(adapter, &addr_data, tda9887_attach); + } +#endif /* I2C_CLASS_TV_ANALOG */ + + return 0; +} + +static int wm8775_detach(struct i2c_client *client) +{ + int err; + + err = i2c_detach_client(client); + if (err) { + return err; + } + kfree(client); + + return 0; +} + +/* ----------------------------------------------------------------------- */ + +/* i2c implementation */ +static struct i2c_driver i2c_driver = { + .name = "wm8775", + + .id = I2C_DRIVERID_WM8775, + .flags = I2C_DF_NOTIFY, + + .attach_adapter = wm8775_probe, + .detach_client = wm8775_detach, + .command = wm8775_command, + .owner = THIS_MODULE, +}; + + +static int __init wm8775_init_module(void) +{ + return i2c_add_driver(&i2c_driver); +} + +static void __exit wm8775_cleanup_module(void) +{ + i2c_del_driver(&i2c_driver); +} + +module_init(wm8775_init_module); +module_exit(wm8775_cleanup_module); -- cgit v1.2.2 From 47028d62f9aef032ed4e9645ea0c9eb451312dd9 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 8 Nov 2005 21:37:26 -0800 Subject: [PATCH] v4l: 773: be sure to enable video buf dvb in kernel build - Be sure to enable video-buf-dvb in kernel build. Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/cx88/Makefile | 3 +++ drivers/media/video/saa7134/Makefile | 3 +++ 2 files changed, 6 insertions(+) diff --git a/drivers/media/video/cx88/Makefile b/drivers/media/video/cx88/Makefile index 107e48645e3a..be1dc66e065f 100644 --- a/drivers/media/video/cx88/Makefile +++ b/drivers/media/video/cx88/Makefile @@ -9,6 +9,9 @@ obj-$(CONFIG_VIDEO_CX88_DVB) += cx88-dvb.o EXTRA_CFLAGS += -I$(src)/.. EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/frontends +ifneq ($(CONFIG_VIDEO_BUF_DVB),n) + EXTRA_CFLAGS += -DHAVE_VIDEO_BUF_DVB=1 +endif ifneq ($(CONFIG_DVB_CX22702),n) EXTRA_CFLAGS += -DHAVE_CX22702=1 endif diff --git a/drivers/media/video/saa7134/Makefile b/drivers/media/video/saa7134/Makefile index b778ffd94e65..1418f9f88d26 100644 --- a/drivers/media/video/saa7134/Makefile +++ b/drivers/media/video/saa7134/Makefile @@ -9,6 +9,9 @@ obj-$(CONFIG_VIDEO_SAA7134_DVB) += saa7134-dvb.o EXTRA_CFLAGS += -I$(src)/.. EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/frontends +ifneq ($(CONFIG_VIDEO_BUF_DVB),n) + EXTRA_CFLAGS += -DHAVE_VIDEO_BUF_DVB=1 +endif ifneq ($(CONFIG_DVB_MT352),n) EXTRA_CFLAGS += -DHAVE_MT352=1 endif -- cgit v1.2.2 From 67081a46116e6d9a47f4621ccd63b2fdcd1f45f1 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 8 Nov 2005 21:37:27 -0800 Subject: [PATCH] v4l: 775: fix build warnings - Fix build warnings Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/saa7134/saa7134.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index 52fc4425b711..93038c32a039 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h @@ -27,6 +27,8 @@ #include #include #include +#include +#include #include -- cgit v1.2.2 From 76bc3a3933de50559fdd4081f26867f1d25cd5a6 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 8 Nov 2005 21:37:27 -0800 Subject: [PATCH] v4l: 776: added card 75 avermedia avertvhd mce a180 - Added card 75 AVerMedia AVerTVHD MCE A180 Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/video4linux/CARDLIST.saa7134 | 1 + drivers/media/video/saa7134/saa7134-cards.c | 24 ++++++++++++++++++++++++ drivers/media/video/saa7134/saa7134.h | 1 + 3 files changed, 26 insertions(+) diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134 index 57439d081570..3bcfd88920df 100644 --- a/Documentation/video4linux/CARDLIST.saa7134 +++ b/Documentation/video4linux/CARDLIST.saa7134 @@ -73,3 +73,4 @@ 72 -> RTD Embedded Technologies VFG7350 [1435:7350] 73 -> RTD Embedded Technologies VFG7330 [1435:7330] 74 -> LifeView FlyTV Platinum Mini2 [14c0:1212] + 75 -> AVerMedia AVerTVHD MCE A180 [1461:1044] diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index 3a4c59e7ca07..e6e50c0a80ce 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c @@ -2350,6 +2350,24 @@ struct saa7134_board saa7134_boards[] = { .amux = LINE2, }}, }, + [SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180] = { + /* FIXME: uses Alps Electric TDHU2, containing ATI NXT2004 ATSC Decoder */ + .name = "AVerMedia AVerTVHD MCE A180", + .audio_clock = 0x00187de7, + .tuner_type = TUNER_ABSENT, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .inputs = {{ + .name = name_comp1, + .vmux = 3, + .amux = LINE2, + },{ + .name = name_svideo, + .vmux = 8, + .amux = LINE2, + }}, + }, }; const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards); @@ -2755,6 +2773,12 @@ struct pci_device_id saa7134_pci_tbl[] = { .subvendor = 0x1435, .subdevice = 0x7330, .driver_data = SAA7134_BOARD_RTD_VFG7330, + },{ + .vendor = PCI_VENDOR_ID_PHILIPS, + .device = PCI_DEVICE_ID_PHILIPS_SAA7133, + .subvendor = 0x1461, + .subdevice = 0x1044, + .driver_data = SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180, },{ /* --- boards without eeprom + subsystem ID --- */ .vendor = PCI_VENDOR_ID_PHILIPS, diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index 93038c32a039..473c5dbb9b5f 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h @@ -201,6 +201,7 @@ struct saa7134_format { #define SAA7134_BOARD_RTD_VFG7350 72 #define SAA7134_BOARD_RTD_VFG7330 73 #define SAA7134_BOARD_FLYTVPLATINUM_MINI2 74 +#define SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180 75 #define SAA7134_MAXBOARDS 8 #define SAA7134_INPUT_MAX 8 -- cgit v1.2.2 From 994914ea7aecea3d8bc30e6283dacea1f157353c Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 8 Nov 2005 21:37:28 -0800 Subject: [PATCH] v4l: 777: updated script to function in new tree layout - Whitespace cleanups Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/video4linux/README.cx88 | 2 +- Documentation/video4linux/README.saa7134 | 2 +- Documentation/video4linux/bttv/Sound-FAQ | 6 +++--- Documentation/video4linux/bttv/Tuners | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Documentation/video4linux/README.cx88 b/Documentation/video4linux/README.cx88 index 897ab834839a..0b93455bbc17 100644 --- a/Documentation/video4linux/README.cx88 +++ b/Documentation/video4linux/README.cx88 @@ -65,5 +65,5 @@ Have fun, Gerd --- +-- Gerd Knorr [SuSE Labs] diff --git a/Documentation/video4linux/README.saa7134 b/Documentation/video4linux/README.saa7134 index 1f788e498eff..b911f0871874 100644 --- a/Documentation/video4linux/README.saa7134 +++ b/Documentation/video4linux/README.saa7134 @@ -78,5 +78,5 @@ Have fun, Gerd --- +-- Gerd Knorr [SuSE Labs] diff --git a/Documentation/video4linux/bttv/Sound-FAQ b/Documentation/video4linux/bttv/Sound-FAQ index b8c9c2605ce2..5c9822492034 100644 --- a/Documentation/video4linux/bttv/Sound-FAQ +++ b/Documentation/video4linux/bttv/Sound-FAQ @@ -129,8 +129,8 @@ tuner_type - same as tuner= insmod option module loaded to work properly. has_radio - whenever this TV card has a radio tuner. no_msp34xx - "1" disables loading of msp3400.o module -no_tda9875 - "1" disables loading of tda9875.o module -needs_tvaudio - set to "1" to load tvaudio.o module +no_tda9875 - "1" disables loading of tda9875.o module +needs_tvaudio - set to "1" to load tvaudio.o module If some config item is specified both from the tvcards array and as insmod option, the insmod option takes precedence. @@ -144,5 +144,5 @@ Good luck, PS: If you have a new working entry, mail it to me. --- +-- Gerd Knorr diff --git a/Documentation/video4linux/bttv/Tuners b/Documentation/video4linux/bttv/Tuners index d18fbc70c0e0..0a371d349542 100644 --- a/Documentation/video4linux/bttv/Tuners +++ b/Documentation/video4linux/bttv/Tuners @@ -21,7 +21,7 @@ SAMSUNG Tuner identification: (e.g. TCPM9091PD27) J= NTSC-Japan L= Secam LL M= BG+I+DK - N= NTSC + N= NTSC Q= BG+I+DK+LL [89]: ? [125]: @@ -96,7 +96,7 @@ LG Innotek Tuner: TADC-H002F: NTSC (L,175/410?; 2-B, C-W+11, W+12-69) TADC-M201D: PAL D/K+B/G+I (L,143/425) (sound control at I2C address 0xc8) TADC-T003F: NTSC Taiwan (L,175/410?; 2-B, C-W+11, W+12-69) - Suffix: + Suffix: P= Standard phono female socket D= IEC female socket F= F-connector -- cgit v1.2.2 From 55b8b2d173adea54a9e8407f26630c19274fa0b6 Mon Sep 17 00:00:00 2001 From: Paul Vriens Date: Tue, 8 Nov 2005 21:37:29 -0800 Subject: [PATCH] v4l: 780: fixed typo in module param description - Fixed typo in module param description Signed-off-by: Paul Vriens Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/em28xx/em28xx-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index 594e6d681ba4..f5e22154a97f 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c @@ -53,7 +53,7 @@ MODULE_PARM_DESC(reg_debug,"enable debug messages [URB reg]"); unsigned int isoc_debug = 0; module_param(isoc_debug,int,0644); -MODULE_PARM_DESC(core_debug,"enable debug messages [isoc transfers]"); +MODULE_PARM_DESC(isoc_debug,"enable debug messages [isoc transfers]"); #define em2820_isocdbg(fmt, arg...) do {\ if (isoc_debug) \ -- cgit v1.2.2 From 2f4710b1b1c62da3050c4eac08a5f08227e0e0f0 Mon Sep 17 00:00:00 2001 From: Markus Rechberger Date: Tue, 8 Nov 2005 21:37:30 -0800 Subject: [PATCH] v4l: 782: ir-kbd-i2c.c updates - fixed probe function - em2820 remote layout - disabled em2820 pinnacle ir support - whitespace cleanups Signed-off-by: Markus Rechberger Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/ir-kbd-i2c.c | 222 ++++++++++++++++++++++----------------- 1 file changed, 126 insertions(+), 96 deletions(-) diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index 061dda10721b..fbb78b659a8b 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c @@ -43,100 +43,100 @@ #include static IR_KEYTAB_TYPE ir_codes_em2820[IR_KEYTAB_SIZE] = { - [ 0 ] = KEY_CHANNEL, - [ 1 ] = KEY_SELECT, - [ 2 ] = KEY_MUTE, - [ 3 ] = KEY_POWER, - [ 4 ] = KEY_KP1, - [ 5 ] = KEY_KP2, - [ 6 ] = KEY_KP3, - [ 7 ] = KEY_CHANNELUP, - [ 8 ] = KEY_KP4, - [ 9 ] = KEY_KP5, - [ 10 ] = KEY_KP6, - - [ 11 ] = KEY_CHANNELDOWN, - [ 12 ] = KEY_KP7, - [ 13 ] = KEY_KP8, - [ 14 ] = KEY_KP9, - [ 15 ] = KEY_VOLUMEUP, - [ 16 ] = KEY_KP0, - [ 17 ] = KEY_MENU, - [ 18 ] = KEY_PRINT, - - [ 19 ] = KEY_VOLUMEDOWN, - [ 21 ] = KEY_PAUSE, - [ 23 ] = KEY_RECORD, - [ 24 ] = KEY_REWIND, - [ 25 ] = KEY_PLAY, - [ 27 ] = KEY_BACKSPACE, - [ 29 ] = KEY_STOP, - [ 31 ] = KEY_ZOOM, + [ 0x00 ] = KEY_CHANNEL, + [ 0x01 ] = KEY_SELECT, + [ 0x02 ] = KEY_MUTE, + [ 0x03 ] = KEY_POWER, + [ 0x04 ] = KEY_KP1, + [ 0x05 ] = KEY_KP2, + [ 0x06 ] = KEY_KP3, + [ 0x07 ] = KEY_CHANNELUP, + [ 0x08 ] = KEY_KP4, + [ 0x09 ] = KEY_KP5, + [ 0x0a ] = KEY_KP6, + + [ 0x0b ] = KEY_CHANNELDOWN, + [ 0x0c ] = KEY_KP7, + [ 0x0d ] = KEY_KP8, + [ 0x0e ] = KEY_KP9, + [ 0x0f ] = KEY_VOLUMEUP, + [ 0x10 ] = KEY_KP0, + [ 0x11 ] = KEY_MENU, + [ 0x12 ] = KEY_PRINT, + + [ 0x13 ] = KEY_VOLUMEDOWN, + [ 0x15 ] = KEY_PAUSE, + [ 0x17 ] = KEY_RECORD, + [ 0x18 ] = KEY_REWIND, + [ 0x19 ] = KEY_PLAY, + [ 0x1b ] = KEY_BACKSPACE, + [ 0x1d ] = KEY_STOP, + [ 0x40 ] = KEY_ZOOM, }; /* Mark Phalan */ static IR_KEYTAB_TYPE ir_codes_pv951[IR_KEYTAB_SIZE] = { - [ 0 ] = KEY_KP0, - [ 1 ] = KEY_KP1, - [ 2 ] = KEY_KP2, - [ 3 ] = KEY_KP3, - [ 4 ] = KEY_KP4, - [ 5 ] = KEY_KP5, - [ 6 ] = KEY_KP6, - [ 7 ] = KEY_KP7, - [ 8 ] = KEY_KP8, - [ 9 ] = KEY_KP9, - - [ 18 ] = KEY_POWER, - [ 16 ] = KEY_MUTE, - [ 31 ] = KEY_VOLUMEDOWN, - [ 27 ] = KEY_VOLUMEUP, - [ 26 ] = KEY_CHANNELUP, - [ 30 ] = KEY_CHANNELDOWN, - [ 14 ] = KEY_PAGEUP, - [ 29 ] = KEY_PAGEDOWN, - [ 19 ] = KEY_SOUND, - - [ 24 ] = KEY_KPPLUSMINUS, /* CH +/- */ - [ 22 ] = KEY_SUBTITLE, /* CC */ - [ 13 ] = KEY_TEXT, /* TTX */ - [ 11 ] = KEY_TV, /* AIR/CBL */ - [ 17 ] = KEY_PC, /* PC/TV */ - [ 23 ] = KEY_OK, /* CH RTN */ - [ 25 ] = KEY_MODE, /* FUNC */ - [ 12 ] = KEY_SEARCH, /* AUTOSCAN */ + [ 0x00 ] = KEY_KP0, + [ 0x01 ] = KEY_KP1, + [ 0x02 ] = KEY_KP2, + [ 0x03 ] = KEY_KP3, + [ 0x04 ] = KEY_KP4, + [ 0x05 ] = KEY_KP5, + [ 0x06 ] = KEY_KP6, + [ 0x07 ] = KEY_KP7, + [ 0x08 ] = KEY_KP8, + [ 0x09 ] = KEY_KP9, + + [ 0x12 ] = KEY_POWER, + [ 0x10 ] = KEY_MUTE, + [ 0x1f ] = KEY_VOLUMEDOWN, + [ 0x1b ] = KEY_VOLUMEUP, + [ 0x1a ] = KEY_CHANNELUP, + [ 0x1e ] = KEY_CHANNELDOWN, + [ 0x0e ] = KEY_PAGEUP, + [ 0x1d ] = KEY_PAGEDOWN, + [ 0x13 ] = KEY_SOUND, + + [ 0x18 ] = KEY_KPPLUSMINUS, /* CH +/- */ + [ 0x16 ] = KEY_SUBTITLE, /* CC */ + [ 0x0d ] = KEY_TEXT, /* TTX */ + [ 0x0b ] = KEY_TV, /* AIR/CBL */ + [ 0x11 ] = KEY_PC, /* PC/TV */ + [ 0x17 ] = KEY_OK, /* CH RTN */ + [ 0x19 ] = KEY_MODE, /* FUNC */ + [ 0x0c ] = KEY_SEARCH, /* AUTOSCAN */ /* Not sure what to do with these ones! */ - [ 15 ] = KEY_SELECT, /* SOURCE */ - [ 10 ] = KEY_KPPLUS, /* +100 */ - [ 20 ] = KEY_KPEQUAL, /* SYNC */ - [ 28 ] = KEY_MEDIA, /* PC/TV */ + [ 0x0f ] = KEY_SELECT, /* SOURCE */ + [ 0x0a ] = KEY_KPPLUS, /* +100 */ + [ 0x14 ] = KEY_KPEQUAL, /* SYNC */ + [ 0x1c ] = KEY_MEDIA, /* PC/TV */ }; static IR_KEYTAB_TYPE ir_codes_purpletv[IR_KEYTAB_SIZE] = { - [ 0x3 ] = KEY_POWER, + [ 0x03 ] = KEY_POWER, [ 0x6f ] = KEY_MUTE, [ 0x10 ] = KEY_BACKSPACE, /* Recall */ [ 0x11 ] = KEY_KP0, - [ 0x4 ] = KEY_KP1, - [ 0x5 ] = KEY_KP2, - [ 0x6 ] = KEY_KP3, - [ 0x8 ] = KEY_KP4, - [ 0x9 ] = KEY_KP5, - [ 0xa ] = KEY_KP6, - [ 0xc ] = KEY_KP7, - [ 0xd ] = KEY_KP8, - [ 0xe ] = KEY_KP9, + [ 0x04 ] = KEY_KP1, + [ 0x05 ] = KEY_KP2, + [ 0x06 ] = KEY_KP3, + [ 0x08 ] = KEY_KP4, + [ 0x09 ] = KEY_KP5, + [ 0x0a ] = KEY_KP6, + [ 0x0c ] = KEY_KP7, + [ 0x0d ] = KEY_KP8, + [ 0x0e ] = KEY_KP9, [ 0x12 ] = KEY_KPDOT, /* 100+ */ - [ 0x7 ] = KEY_VOLUMEUP, - [ 0xb ] = KEY_VOLUMEDOWN, + [ 0x07 ] = KEY_VOLUMEUP, + [ 0x0b ] = KEY_VOLUMEDOWN, [ 0x1a ] = KEY_KPPLUS, [ 0x18 ] = KEY_KPMINUS, [ 0x15 ] = KEY_UP, [ 0x1d ] = KEY_DOWN, - [ 0xf ] = KEY_CHANNELUP, + [ 0x0f ] = KEY_CHANNELUP, [ 0x13 ] = KEY_CHANNELDOWN, [ 0x48 ] = KEY_ZOOM, @@ -174,6 +174,9 @@ module_param(debug, int, 0644); /* debug level (0,1,2) */ #define dprintk(level, fmt, arg...) if (debug >= level) \ printk(KERN_DEBUG DEVNAME ": " fmt , ## arg) +#define IR_PINNACLE_REMOTE 0x01 +#define IR_TERRATEC_REMOTE 0x02 + /* ----------------------------------------------------------------------- */ static int get_key_haup(struct IR *ir, u32 *ir_key, u32 *ir_raw) @@ -287,6 +290,7 @@ static int get_key_purpletv(struct IR *ir, u32 *ir_key, u32 *ir_raw) *ir_raw = b; return 1; } + /* ----------------------------------------------------------------------- */ static void ir_key_poll(struct IR *ir) @@ -386,24 +390,36 @@ static int ir_attach(struct i2c_adapter *adap, int addr, ir_type = IR_TYPE_RC5; ir_codes = ir_codes_rc5_tv; break; - case 0x60: - name = "em2820"; - ir->get_key = get_key_knc1; - ir->c.addr = addr>>1; - ir_type = IR_TYPE_OTHER; - ir_codes = ir_codes_em2820; - break; case 0x30: - name = "KNC One"; - ir->get_key = get_key_knc1; - ir_type = IR_TYPE_OTHER; - ir_codes = ir_codes_empty; + switch(kind){ + case IR_TERRATEC_REMOTE: + name = "Terratec IR"; + ir->get_key = get_key_knc1; + ir_type = IR_TYPE_OTHER; + ir_codes = ir_codes_em2820; + break; + default: + name = "KNC One"; + ir->get_key = get_key_knc1; + ir_type = IR_TYPE_OTHER; + ir_codes = ir_codes_em2820; + } break; + case 0x47: case 0x7a: - name = "Purple TV"; - ir->get_key = get_key_purpletv; - ir_type = IR_TYPE_OTHER; - ir_codes = ir_codes_purpletv; + switch(kind){ + case IR_PINNACLE_REMOTE: + name = "Pinnacle IR Remote"; + ir->get_key = get_key_purpletv; + ir_type = IR_TYPE_OTHER; + ir_codes = ir_codes_em2820; + break; + default: + name = "Purple TV"; + ir->get_key = get_key_purpletv; + ir_type = IR_TYPE_OTHER; + ir_codes = ir_codes_empty; + } break; default: /* shouldn't happen */ @@ -468,9 +484,11 @@ static int ir_probe(struct i2c_adapter *adap) static const int probe_bttv[] = { 0x1a, 0x18, 0x4b, 0x64, 0x30, -1}; static const int probe_saa7134[] = { 0x7a, -1 }; - static const int probe_em2820[] = { 0x60, -1 }; + static const int probe_em2820[] = { 0x47, 0x30, -1 }; const int *probe = NULL; - struct i2c_client c; char buf; int i,rc; + int attached = 0; + + struct i2c_client c; unsigned char buf; int i,rc; switch (adap->id) { case I2C_HW_B_BT848: @@ -488,15 +506,27 @@ static int ir_probe(struct i2c_adapter *adap) memset(&c,0,sizeof(c)); c.adapter = adap; - for (i = 0; -1 != probe[i]; i++) { + for (i = 0; -1 != probe[i] && attached != 1; i++) { c.addr = probe[i]; rc = i2c_master_recv(&c,&buf,1); dprintk(1,"probe 0x%02x @ %s: %s\n", probe[i], adap->name, (1 == rc) ? "yes" : "no"); - if (1 == rc) { - ir_attach(adap,probe[i],0,0); - break; + switch(adap->id){ + case I2C_HW_B_BT848: + case I2C_HW_SAA7134: + if (1 == rc) { + ir_attach(adap,probe[i],0,0); + attached=1; + break; + } + case I2C_HW_B_EM2820: + /* windows logs are needed for fixing the pinnacle device */ + if (1 == rc && 0xff == buf){ + ir_attach(adap,probe[i],0,IR_TERRATEC_REMOTE); + attached=1; + } + break; } } return 0; -- cgit v1.2.2 From da45a2a5b96afd7188c058a55eb2917d6524c0cf Mon Sep 17 00:00:00 2001 From: Markus Rechberger Date: Tue, 8 Nov 2005 21:37:31 -0800 Subject: [PATCH] v4l: 783: fixed bad em2820 remote layout values - Fixed bad em2820 remote layout values - set KNC One and Purple TV layouts back to default - added pinnacle ir remote i2c address to the i2c scanner Signed-off-by: Markus Rechberger Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/em28xx/em28xx-i2c.c | 1 + drivers/media/video/ir-kbd-i2c.c | 61 ++++++++++++++++----------------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c index b7360d579a8a..a7b6f678f979 100644 --- a/drivers/media/video/em28xx/em28xx-i2c.c +++ b/drivers/media/video/em28xx/em28xx-i2c.c @@ -499,6 +499,7 @@ static struct i2c_client em2820_client_template = { static char *i2c_devs[128] = { [0x4a >> 1] = "saa7113h", [0x60 >> 1] = "remote IR sensor", + [0x8e >> 1] = "remote IR sensor", [0x86 >> 1] = "tda9887", [0x80 >> 1] = "msp34xx", [0x88 >> 1] = "msp34xx", diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index fbb78b659a8b..aec710f4effc 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c @@ -43,35 +43,34 @@ #include static IR_KEYTAB_TYPE ir_codes_em2820[IR_KEYTAB_SIZE] = { - [ 0x00 ] = KEY_CHANNEL, - [ 0x01 ] = KEY_SELECT, - [ 0x02 ] = KEY_MUTE, - [ 0x03 ] = KEY_POWER, - [ 0x04 ] = KEY_KP1, - [ 0x05 ] = KEY_KP2, - [ 0x06 ] = KEY_KP3, - [ 0x07 ] = KEY_CHANNELUP, - [ 0x08 ] = KEY_KP4, - [ 0x09 ] = KEY_KP5, - [ 0x0a ] = KEY_KP6, - - [ 0x0b ] = KEY_CHANNELDOWN, - [ 0x0c ] = KEY_KP7, - [ 0x0d ] = KEY_KP8, - [ 0x0e ] = KEY_KP9, - [ 0x0f ] = KEY_VOLUMEUP, - [ 0x10 ] = KEY_KP0, - [ 0x11 ] = KEY_MENU, - [ 0x12 ] = KEY_PRINT, - - [ 0x13 ] = KEY_VOLUMEDOWN, - [ 0x15 ] = KEY_PAUSE, - [ 0x17 ] = KEY_RECORD, - [ 0x18 ] = KEY_REWIND, - [ 0x19 ] = KEY_PLAY, - [ 0x1b ] = KEY_BACKSPACE, - [ 0x1d ] = KEY_STOP, - [ 0x40 ] = KEY_ZOOM, + [ 0x01 ] = KEY_CHANNEL, + [ 0x02 ] = KEY_SELECT, + [ 0x03 ] = KEY_MUTE, + [ 0x04 ] = KEY_POWER, + [ 0x05 ] = KEY_KP1, + [ 0x06 ] = KEY_KP2, + [ 0x07 ] = KEY_KP3, + [ 0x08 ] = KEY_CHANNELUP, + [ 0x09 ] = KEY_KP4, + [ 0x0a ] = KEY_KP5, + [ 0x0b ] = KEY_KP6, + [ 0x0c ] = KEY_CHANNELDOWN, + [ 0x0d ] = KEY_KP7, + [ 0x0e ] = KEY_KP8, + [ 0x0f ] = KEY_KP9, + [ 0x10 ] = KEY_VOLUMEUP, + [ 0x11 ] = KEY_KP0, + [ 0x12 ] = KEY_MENU, + [ 0x13 ] = KEY_PRINT, + [ 0x14 ] = KEY_VOLUMEDOWN, + [ 0x16 ] = KEY_PAUSE, + [ 0x18 ] = KEY_RECORD, + [ 0x19 ] = KEY_REWIND, + [ 0x1a ] = KEY_PLAY, + [ 0x1b ] = KEY_FORWARD, + [ 0x1c ] = KEY_BACKSPACE, + [ 0x1e ] = KEY_STOP, + [ 0x40 ] = KEY_ZOOM, }; /* Mark Phalan */ @@ -402,7 +401,7 @@ static int ir_attach(struct i2c_adapter *adap, int addr, name = "KNC One"; ir->get_key = get_key_knc1; ir_type = IR_TYPE_OTHER; - ir_codes = ir_codes_em2820; + ir_codes = ir_codes_empty; } break; case 0x47: @@ -418,7 +417,7 @@ static int ir_attach(struct i2c_adapter *adap, int addr, name = "Purple TV"; ir->get_key = get_key_purpletv; ir_type = IR_TYPE_OTHER; - ir_codes = ir_codes_empty; + ir_codes = ir_codes_purpletv; } break; default: -- cgit v1.2.2 From d5e5265315770bda46c50ecaa64e2b9790f2064c Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:37:32 -0800 Subject: [PATCH] v4l: 784: several improvement on i2c ir handling for em2820 - Several Improvement on I2C IR handling for em2820: - moved Pinnacle IR table (ir_codes_em2820) to em2820-input.c - IR struct renamed and moved to a header file. - New file to handle em2820-specific IR. - Some cleanups. - attach now detects I2C IR and calls em2820-specific IR code - IR compat code moved to compat.h - New header with struct IR_i2c there, to allow it to be used by board-specific input handlers. - Some improvements at em28xx board detection: - Board detection message improved to show interface and class. - Now it doesn't touch audio interfaces. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/em28xx/em28xx-cards.c | 3 +- drivers/media/video/em28xx/em28xx-i2c.c | 43 +++--- drivers/media/video/em28xx/em28xx-input.c | 150 +++++++++++++++++++ drivers/media/video/em28xx/em28xx-video.c | 15 +- drivers/media/video/em28xx/em28xx.h | 20 ++- drivers/media/video/ir-kbd-i2c.c | 238 +++++++++++------------------- include/media/ir-common.h | 6 +- include/media/ir-kbd-i2c.h | 22 +++ 8 files changed, 307 insertions(+), 190 deletions(-) create mode 100644 drivers/media/video/em28xx/em28xx-input.c create mode 100644 include/media/ir-kbd-i2c.h diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index 91c70ebd0ea4..919520f89975 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c @@ -143,7 +143,7 @@ struct em2820_board em2820_boards[] = { .tuner_type = TUNER_PHILIPS_PAL, .tda9887_conf = TDA9887_PRESENT|TDA9887_PORT1_ACTIVE|TDA9887_PORT2_ACTIVE, .has_tuner = 1, - .decoder = EM2820_SAA7114, + .decoder = EM2820_SAA7114, .input = {{ .type = EM2820_VMUX_TELEVISION, .vmux = 2, @@ -250,6 +250,7 @@ void em2820_card_setup(struct em2820 *dev) struct tveeprom tv; #ifdef CONFIG_MODULES request_module("tveeprom"); + request_module("ir-kbd-i2c"); #endif /* Call first TVeeprom */ diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c index a7b6f678f979..f6bfc038777e 100644 --- a/drivers/media/video/em28xx/em28xx-i2c.c +++ b/drivers/media/video/em28xx/em28xx-i2c.c @@ -26,10 +26,10 @@ #include #include #include -#include #include #include "em2820.h" +#include /* ----------------------------------------------------------- */ @@ -41,14 +41,11 @@ static unsigned int i2c_debug = 0; module_param(i2c_debug, int, 0644); MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]"); -#define dprintk(fmt, args...) if (i2c_debug) do {\ - printk(KERN_DEBUG "%s: %s: " fmt "\n",\ - dev->name, __FUNCTION__ , ##args); } while (0) -#define dprintk1(fmt, args...) if (i2c_debug) do{ \ - printk(KERN_DEBUG "%s: %s: " fmt, \ - dev->name, __FUNCTION__ , ##args); } while (0) -#define dprintk2(fmt, args...) if (i2c_debug) do {\ +#define dprintk1(lvl,fmt, args...) if (i2c_debug>=lvl) do {\ printk(fmt , ##args); } while (0) +#define dprintk2(lvl,fmt, args...) if (i2c_debug>=lvl) do{ \ + printk(KERN_DEBUG "%s at %s: " fmt, \ + dev->name, __FUNCTION__ , ##args); } while (0) /* * em2800_i2c_send_max4() @@ -238,7 +235,7 @@ static int em2820_i2c_xfer(struct i2c_adapter *i2c_adap, return 0; for (i = 0; i < num; i++) { addr = msgs[i].addr << 1; - dprintk1("%s %s addr=%x len=%d:", + dprintk2(2,"%s %s addr=%x len=%d:", (msgs[i].flags & I2C_M_RD) ? "read" : "write", i == num - 1 ? "stop" : "nonstop", addr, msgs[i].len); if (!msgs[i].len) { /* no len: check only for device presence */ @@ -247,7 +244,7 @@ static int em2820_i2c_xfer(struct i2c_adapter *i2c_adap, else rc = em2820_i2c_check_for_device(dev, addr); if (rc < 0) { - dprintk2(" no device\n"); + dprintk2(2," no device\n"); return rc; } @@ -261,14 +258,14 @@ static int em2820_i2c_xfer(struct i2c_adapter *i2c_adap, rc = em2820_i2c_recv_bytes(dev, addr, msgs[i].buf, msgs[i].len); - if (i2c_debug) { + if (i2c_debug>=2) { for (byte = 0; byte < msgs[i].len; byte++) { printk(" %02x", msgs[i].buf[byte]); } } } else { /* write bytes */ - if (i2c_debug) { + if (i2c_debug>=2) { for (byte = 0; byte < msgs[i].len; byte++) printk(" %02x", msgs[i].buf[byte]); } @@ -284,13 +281,13 @@ static int em2820_i2c_xfer(struct i2c_adapter *i2c_adap, if (rc < 0) goto err; } - if (i2c_debug) + if (i2c_debug>=2) printk("\n"); } return num; err: - dprintk2(" ERROR: %i\n", rc); + dprintk2(2," ERROR: %i\n", rc); return rc; } @@ -436,26 +433,34 @@ static int attach_inform(struct i2c_client *client) { struct em2820 *dev = client->adapter->algo_data; - dprintk("address %x", client->addr << 1); switch (client->addr << 1) { case 0x86: em2820_i2c_call_clients(dev, TDA9887_SET_CONFIG, &dev->tda9887_conf); break; case 0x4a: - dprintk1("attach_inform: saa7113 detected.\n"); + dprintk1(1,"attach_inform: saa7113 detected.\n"); break; case 0xa0: - dprintk1("attach_inform: eeprom detected.\n"); + dprintk1(1,"attach_inform: eeprom detected.\n"); + break; + case 0x60: + case 0x8e: + { + struct IR_i2c *ir = i2c_get_clientdata(client); + dprintk1(1,"attach_inform: IR detected (%s).\n",ir->phys); + em2820_set_ir(dev,ir); break; + } case 0x80: case 0x88: - dprintk1("attach_inform: msp34xx detected.\n"); + dprintk1(1,"attach_inform: msp34xx detected.\n"); break; case 0xb8: case 0xba: - dprintk1("attach_inform: tvp5150 detected.\n"); + dprintk1(1,"attach_inform: tvp5150 detected.\n"); break; default: + dprintk1(1,"attach inform: detected I2C address %x\n", client->addr << 1); dev->tuner_addr = client->addr; em2820_set_tuner(-1, client); } diff --git a/drivers/media/video/em28xx/em28xx-input.c b/drivers/media/video/em28xx/em28xx-input.c new file mode 100644 index 000000000000..d6b3e15a0350 --- /dev/null +++ b/drivers/media/video/em28xx/em28xx-input.c @@ -0,0 +1,150 @@ +/* + * + * handle saa7134 IR remotes via linux kernel input layer. + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "em2820.h" + +static unsigned int disable_ir = 0; +module_param(disable_ir, int, 0444); +MODULE_PARM_DESC(disable_ir,"disable infrared remote support"); + +static unsigned int ir_debug = 0; +module_param(ir_debug, int, 0644); +MODULE_PARM_DESC(ir_debug,"enable debug messages [IR]"); + +#define dprintk(fmt, arg...) if (ir_debug) \ + printk(KERN_DEBUG "%s/ir: " fmt, ir->c.name , ## arg) + +/* ---------------------------------------------------------------------- */ + +static IR_KEYTAB_TYPE ir_codes_em_pinnacle[IR_KEYTAB_SIZE] = { + [ 0 ] = KEY_CHANNEL, + [ 1 ] = KEY_SELECT, + [ 2 ] = KEY_MUTE, + [ 3 ] = KEY_POWER, + [ 4 ] = KEY_KP1, + [ 5 ] = KEY_KP2, + [ 6 ] = KEY_KP3, + [ 7 ] = KEY_CHANNELUP, + [ 8 ] = KEY_KP4, + [ 9 ] = KEY_KP5, + [ 10 ] = KEY_KP6, + + [ 11 ] = KEY_CHANNELDOWN, + [ 12 ] = KEY_KP7, + [ 13 ] = KEY_KP8, + [ 14 ] = KEY_KP9, + [ 15 ] = KEY_VOLUMEUP, + [ 16 ] = KEY_KP0, + [ 17 ] = KEY_MENU, + [ 18 ] = KEY_PRINT, + + [ 19 ] = KEY_VOLUMEDOWN, + [ 21 ] = KEY_PAUSE, + [ 23 ] = KEY_RECORD, + [ 24 ] = KEY_REWIND, + [ 25 ] = KEY_PLAY, + [ 27 ] = KEY_BACKSPACE, + [ 29 ] = KEY_STOP, + [ 31 ] = KEY_ZOOM, +}; + +/* ----------------------------------------------------------------------- */ + +static int get_key_em_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) +{ + unsigned char buf[2]; + unsigned char code; + + /* poll IR chip */ + if (2 != i2c_master_recv(&ir->c,buf,2)) + return -EIO; + + /* Does eliminate repeated parity code */ + if (buf[1]==0xff) + return 0; + + /* avoid fast reapeating */ + if (buf[1]==ir->old) + return 0; + ir->old=buf[1]; + + /* Rearranges bits to the right order */ + code= ((buf[0]&0x01)<<5) | /* 0010 0000 */ + ((buf[0]&0x02)<<3) | /* 0001 0000 */ + ((buf[0]&0x04)<<1) | /* 0000 1000 */ + ((buf[0]&0x08)>>1) | /* 0000 0100 */ + ((buf[0]&0x10)>>3) | /* 0000 0010 */ + ((buf[0]&0x20)>>5); /* 0000 0001 */ + + dprintk("ir hauppauge (em2840): code=0x%02x (rcv=0x%02x)\n",code,buf[0]); + + /* return key */ + *ir_key = code; + *ir_raw = code; + return 1; +} + +/* ----------------------------------------------------------------------- */ +void em2820_set_ir(struct em2820 * dev,struct IR_i2c *ir) +{ + if (disable_ir) + return ; + + /* detect & configure */ + switch (dev->model) { + case (EM2800_BOARD_UNKNOWN): + break; + case (EM2820_BOARD_UNKNOWN): + break; + case (EM2820_BOARD_TERRATEC_CINERGY_250): + break; + case (EM2820_BOARD_PINNACLE_USB_2): + ir->ir_codes = ir_codes_em_pinnacle; + break; + case (EM2820_BOARD_HAUPPAUGE_WINTV_USB_2): + ir->ir_codes = ir_codes_hauppauge_new; + ir->get_key = get_key_em_haup; + snprintf(ir->c.name, sizeof(ir->c.name), "i2c IR (EM2840 Hauppage)"); + break; + case (EM2820_BOARD_MSI_VOX_USB_2): + break; + case (EM2800_BOARD_TERRATEC_CINERGY_200): + break; + case (EM2800_BOARD_LEADTEK_WINFAST_USBII): + break; + case (EM2800_BOARD_KWORLD_USB2800): + break; + } +} + +/* ---------------------------------------------------------------------- + * Local variables: + * c-basic-offset: 8 + * End: + */ diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index d3a959b9ee64..f3fc44b352b4 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c @@ -28,10 +28,10 @@ #include #include #include -#include #include #include "em2820.h" +#include #define DRIVER_AUTHOR "Markus Rechberger , " \ "Ludovico Cavedon , " \ @@ -1699,15 +1699,22 @@ static int em2820_usb_probe(struct usb_interface *interface, struct usb_device *udev; struct em2820 *dev = NULL; int retval = -ENODEV; - int model,i,nr; + int model,i,nr,ifnum; udev = usb_get_dev(interface_to_usbdev(interface)); - endpoint = &interface->cur_altsetting->endpoint[1].desc; + ifnum = interface->altsetting[0].desc.bInterfaceNumber; + + em2820_err(DRIVER_NAME " new device (%04x:%04x): interface %i, class %i\n", + udev->descriptor.idVendor,udev->descriptor.idProduct, + ifnum, + interface->altsetting[0].desc.bInterfaceClass); /* Don't register audio interfaces */ - if (interface->altsetting[1].desc.bInterfaceClass == USB_CLASS_AUDIO) + if (interface->altsetting[0].desc.bInterfaceClass == USB_CLASS_AUDIO) return -ENODEV; + endpoint = &interface->cur_altsetting->endpoint[1].desc; + /* check if the the device has the iso in endpoint at the correct place */ if ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_ISOC) { diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h index 4115938a1731..31b23f0db051 100644 --- a/drivers/media/video/em28xx/em28xx.h +++ b/drivers/media/video/em28xx/em28xx.h @@ -27,6 +27,7 @@ #include #include +#include /* Boards supported by driver */ @@ -53,19 +54,12 @@ /* number of buffers for isoc transfers */ #define EM2820_NUM_BUFS 5 -/* number of packets for each buffer */ -// windows requests only 40 packets .. so we better do the same -// this is what I found out for all alternate numbers there! - +/* number of packets for each buffer + windows requests only 40 packets .. so we better do the same + this is what I found out for all alternate numbers there! + */ #define EM2820_NUM_PACKETS 40 -/* packet size for each packet */ -/* no longer needed: read from endpoint descriptor */ -//#define EM2820_MAX_PACKET_SIZE 3072 //7 -//#define EM2820_MAX_PACKET_SIZE 2892 //6 -//#define EM2820_MAX_PACKET_SIZE 2580 //5 -//#define EM2820_MAX_PACKET_SIZE 1448 //2 - /* default alternate; 0 means choose the best */ #define EM2820_PINOUT 0 #define EM2820_MAX_ALT 7 @@ -292,6 +286,10 @@ void em2820_i2c_call_clients(struct em2820 *dev, unsigned int cmd, void *arg); int em2820_i2c_register(struct em2820 *dev); int em2820_i2c_unregister(struct em2820 *dev); +/* Provided by em2820-input.c */ + +void em2820_set_ir(struct em2820 * dev,struct IR_i2c *ir); + /* Provided by em2820-core.c */ void em2820_print_ioctl(char *name, unsigned int cmd); diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index aec710f4effc..8cc3f8ab2f3a 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c @@ -41,101 +41,71 @@ #include #include #include - -static IR_KEYTAB_TYPE ir_codes_em2820[IR_KEYTAB_SIZE] = { - [ 0x01 ] = KEY_CHANNEL, - [ 0x02 ] = KEY_SELECT, - [ 0x03 ] = KEY_MUTE, - [ 0x04 ] = KEY_POWER, - [ 0x05 ] = KEY_KP1, - [ 0x06 ] = KEY_KP2, - [ 0x07 ] = KEY_KP3, - [ 0x08 ] = KEY_CHANNELUP, - [ 0x09 ] = KEY_KP4, - [ 0x0a ] = KEY_KP5, - [ 0x0b ] = KEY_KP6, - [ 0x0c ] = KEY_CHANNELDOWN, - [ 0x0d ] = KEY_KP7, - [ 0x0e ] = KEY_KP8, - [ 0x0f ] = KEY_KP9, - [ 0x10 ] = KEY_VOLUMEUP, - [ 0x11 ] = KEY_KP0, - [ 0x12 ] = KEY_MENU, - [ 0x13 ] = KEY_PRINT, - [ 0x14 ] = KEY_VOLUMEDOWN, - [ 0x16 ] = KEY_PAUSE, - [ 0x18 ] = KEY_RECORD, - [ 0x19 ] = KEY_REWIND, - [ 0x1a ] = KEY_PLAY, - [ 0x1b ] = KEY_FORWARD, - [ 0x1c ] = KEY_BACKSPACE, - [ 0x1e ] = KEY_STOP, - [ 0x40 ] = KEY_ZOOM, -}; +#include /* Mark Phalan */ static IR_KEYTAB_TYPE ir_codes_pv951[IR_KEYTAB_SIZE] = { - [ 0x00 ] = KEY_KP0, - [ 0x01 ] = KEY_KP1, - [ 0x02 ] = KEY_KP2, - [ 0x03 ] = KEY_KP3, - [ 0x04 ] = KEY_KP4, - [ 0x05 ] = KEY_KP5, - [ 0x06 ] = KEY_KP6, - [ 0x07 ] = KEY_KP7, - [ 0x08 ] = KEY_KP8, - [ 0x09 ] = KEY_KP9, - - [ 0x12 ] = KEY_POWER, - [ 0x10 ] = KEY_MUTE, - [ 0x1f ] = KEY_VOLUMEDOWN, - [ 0x1b ] = KEY_VOLUMEUP, - [ 0x1a ] = KEY_CHANNELUP, - [ 0x1e ] = KEY_CHANNELDOWN, - [ 0x0e ] = KEY_PAGEUP, - [ 0x1d ] = KEY_PAGEDOWN, - [ 0x13 ] = KEY_SOUND, - - [ 0x18 ] = KEY_KPPLUSMINUS, /* CH +/- */ - [ 0x16 ] = KEY_SUBTITLE, /* CC */ - [ 0x0d ] = KEY_TEXT, /* TTX */ - [ 0x0b ] = KEY_TV, /* AIR/CBL */ - [ 0x11 ] = KEY_PC, /* PC/TV */ - [ 0x17 ] = KEY_OK, /* CH RTN */ - [ 0x19 ] = KEY_MODE, /* FUNC */ - [ 0x0c ] = KEY_SEARCH, /* AUTOSCAN */ + [ 0 ] = KEY_KP0, + [ 1 ] = KEY_KP1, + [ 2 ] = KEY_KP2, + [ 3 ] = KEY_KP3, + [ 4 ] = KEY_KP4, + [ 5 ] = KEY_KP5, + [ 6 ] = KEY_KP6, + [ 7 ] = KEY_KP7, + [ 8 ] = KEY_KP8, + [ 9 ] = KEY_KP9, + + [ 18 ] = KEY_POWER, + [ 16 ] = KEY_MUTE, + [ 31 ] = KEY_VOLUMEDOWN, + [ 27 ] = KEY_VOLUMEUP, + [ 26 ] = KEY_CHANNELUP, + [ 30 ] = KEY_CHANNELDOWN, + [ 14 ] = KEY_PAGEUP, + [ 29 ] = KEY_PAGEDOWN, + [ 19 ] = KEY_SOUND, + + [ 24 ] = KEY_KPPLUSMINUS, /* CH +/- */ + [ 22 ] = KEY_SUBTITLE, /* CC */ + [ 13 ] = KEY_TEXT, /* TTX */ + [ 11 ] = KEY_TV, /* AIR/CBL */ + [ 17 ] = KEY_PC, /* PC/TV */ + [ 23 ] = KEY_OK, /* CH RTN */ + [ 25 ] = KEY_MODE, /* FUNC */ + [ 12 ] = KEY_SEARCH, /* AUTOSCAN */ /* Not sure what to do with these ones! */ - [ 0x0f ] = KEY_SELECT, /* SOURCE */ - [ 0x0a ] = KEY_KPPLUS, /* +100 */ - [ 0x14 ] = KEY_KPEQUAL, /* SYNC */ - [ 0x1c ] = KEY_MEDIA, /* PC/TV */ + [ 15 ] = KEY_SELECT, /* SOURCE */ + [ 10 ] = KEY_KPPLUS, /* +100 */ + [ 20 ] = KEY_KPEQUAL, /* SYNC */ + [ 28 ] = KEY_MEDIA, /* PC/TV */ }; static IR_KEYTAB_TYPE ir_codes_purpletv[IR_KEYTAB_SIZE] = { - [ 0x03 ] = KEY_POWER, + [ 0x3 ] = KEY_POWER, [ 0x6f ] = KEY_MUTE, [ 0x10 ] = KEY_BACKSPACE, /* Recall */ [ 0x11 ] = KEY_KP0, - [ 0x04 ] = KEY_KP1, - [ 0x05 ] = KEY_KP2, - [ 0x06 ] = KEY_KP3, - [ 0x08 ] = KEY_KP4, - [ 0x09 ] = KEY_KP5, - [ 0x0a ] = KEY_KP6, - [ 0x0c ] = KEY_KP7, - [ 0x0d ] = KEY_KP8, - [ 0x0e ] = KEY_KP9, + [ 0x4 ] = KEY_KP1, + [ 0x5 ] = KEY_KP2, + [ 0x6 ] = KEY_KP3, + [ 0x8 ] = KEY_KP4, + [ 0x9 ] = KEY_KP5, + [ 0xa ] = KEY_KP6, + [ 0xc ] = KEY_KP7, + [ 0xd ] = KEY_KP8, + [ 0xe ] = KEY_KP9, [ 0x12 ] = KEY_KPDOT, /* 100+ */ - [ 0x07 ] = KEY_VOLUMEUP, - [ 0x0b ] = KEY_VOLUMEDOWN, + [ 0x7 ] = KEY_VOLUMEUP, + [ 0xb ] = KEY_VOLUMEDOWN, [ 0x1a ] = KEY_KPPLUS, [ 0x18 ] = KEY_KPMINUS, [ 0x15 ] = KEY_UP, [ 0x1d ] = KEY_DOWN, - [ 0x0f ] = KEY_CHANNELUP, + [ 0xf ] = KEY_CHANNELUP, [ 0x13 ] = KEY_CHANNELDOWN, [ 0x48 ] = KEY_ZOOM, @@ -152,17 +122,6 @@ static IR_KEYTAB_TYPE ir_codes_purpletv[IR_KEYTAB_SIZE] = { }; -struct IR { - struct i2c_client c; - struct input_dev *input; - struct ir_input_state ir; - - struct work_struct work; - struct timer_list timer; - char phys[32]; - int (*get_key)(struct IR*, u32*, u32*); -}; - /* ----------------------------------------------------------------------- */ /* insmod parameters */ @@ -173,12 +132,9 @@ module_param(debug, int, 0644); /* debug level (0,1,2) */ #define dprintk(level, fmt, arg...) if (debug >= level) \ printk(KERN_DEBUG DEVNAME ": " fmt , ## arg) -#define IR_PINNACLE_REMOTE 0x01 -#define IR_TERRATEC_REMOTE 0x02 - /* ----------------------------------------------------------------------- */ -static int get_key_haup(struct IR *ir, u32 *ir_key, u32 *ir_raw) +static int get_key_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) { unsigned char buf[3]; int start, toggle, dev, code; @@ -205,7 +161,7 @@ static int get_key_haup(struct IR *ir, u32 *ir_key, u32 *ir_raw) return 1; } -static int get_key_pixelview(struct IR *ir, u32 *ir_key, u32 *ir_raw) +static int get_key_pixelview(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) { unsigned char b; @@ -219,7 +175,7 @@ static int get_key_pixelview(struct IR *ir, u32 *ir_key, u32 *ir_raw) return 1; } -static int get_key_pv951(struct IR *ir, u32 *ir_key, u32 *ir_raw) +static int get_key_pv951(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) { unsigned char b; @@ -239,7 +195,7 @@ static int get_key_pv951(struct IR *ir, u32 *ir_key, u32 *ir_raw) return 1; } -static int get_key_knc1(struct IR *ir, u32 *ir_key, u32 *ir_raw) +static int get_key_knc1(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) { unsigned char b; @@ -267,7 +223,7 @@ static int get_key_knc1(struct IR *ir, u32 *ir_key, u32 *ir_raw) return 1; } -static int get_key_purpletv(struct IR *ir, u32 *ir_key, u32 *ir_raw) +static int get_key_purpletv(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) { unsigned char b; @@ -289,10 +245,9 @@ static int get_key_purpletv(struct IR *ir, u32 *ir_key, u32 *ir_raw) *ir_raw = b; return 1; } - /* ----------------------------------------------------------------------- */ -static void ir_key_poll(struct IR *ir) +static void ir_key_poll(struct IR_i2c *ir) { static u32 ir_key, ir_raw; int rc; @@ -313,13 +268,13 @@ static void ir_key_poll(struct IR *ir) static void ir_timer(unsigned long data) { - struct IR *ir = (struct IR*)data; + struct IR_i2c *ir = (struct IR_i2c*)data; schedule_work(&ir->work); } static void ir_work(void *data) { - struct IR *ir = data; + struct IR_i2c *ir = data; ir_key_poll(ir); mod_timer(&ir->timer, jiffies+HZ/10); } @@ -351,10 +306,10 @@ static int ir_attach(struct i2c_adapter *adap, int addr, IR_KEYTAB_TYPE *ir_codes = NULL; char *name; int ir_type; - struct IR *ir; + struct IR_i2c *ir; struct input_dev *input_dev; - ir = kzalloc(sizeof(struct IR), GFP_KERNEL); + ir = kzalloc(sizeof(struct IR_i2c), GFP_KERNEL); input_dev = input_allocate_device(); if (!ir || !input_dev) { kfree(ir); @@ -390,36 +345,18 @@ static int ir_attach(struct i2c_adapter *adap, int addr, ir_codes = ir_codes_rc5_tv; break; case 0x30: - switch(kind){ - case IR_TERRATEC_REMOTE: - name = "Terratec IR"; - ir->get_key = get_key_knc1; - ir_type = IR_TYPE_OTHER; - ir_codes = ir_codes_em2820; - break; - default: - name = "KNC One"; - ir->get_key = get_key_knc1; - ir_type = IR_TYPE_OTHER; - ir_codes = ir_codes_empty; - } + name = "KNC One"; + ir->get_key = get_key_knc1; + ir_type = IR_TYPE_OTHER; + ir_codes = ir_codes_empty; break; - case 0x47: case 0x7a: - switch(kind){ - case IR_PINNACLE_REMOTE: - name = "Pinnacle IR Remote"; - ir->get_key = get_key_purpletv; - ir_type = IR_TYPE_OTHER; - ir_codes = ir_codes_em2820; - break; - default: - name = "Purple TV"; - ir->get_key = get_key_purpletv; - ir_type = IR_TYPE_OTHER; - ir_codes = ir_codes_purpletv; - } + name = "Purple TV"; + ir->get_key = get_key_purpletv; + ir_type = IR_TYPE_OTHER; + ir_codes = ir_codes_purpletv; break; + default: /* shouldn't happen */ printk(DEVNAME ": Huh? unknown i2c address (0x%02x)?\n",addr); @@ -427,12 +364,18 @@ static int ir_attach(struct i2c_adapter *adap, int addr, return -1; } - /* register i2c device */ - i2c_attach_client(&ir->c); + /* Sets name and its physical addr */ snprintf(ir->c.name, sizeof(ir->c.name), "i2c IR (%s)", name); snprintf(ir->phys, sizeof(ir->phys), "%s/%s/ir0", ir->c.adapter->dev.bus_id, ir->c.dev.bus_id); + ir->ir_codes=ir_codes; + + /* register i2c device + * At device register, IR codes may be changed to be + * board dependent. + */ + i2c_attach_client(&ir->c); /* init + register input device */ ir_input_init(input_dev, &ir->ir, ir_type, ir_codes); @@ -440,6 +383,7 @@ static int ir_attach(struct i2c_adapter *adap, int addr, input_dev->name = ir->c.name; input_dev->phys = ir->phys; + /* register event device */ input_register_device(ir->input); /* start polling via eventd */ @@ -454,7 +398,7 @@ static int ir_attach(struct i2c_adapter *adap, int addr, static int ir_detach(struct i2c_client *client) { - struct IR *ir = i2c_get_clientdata(client); + struct IR_i2c *ir = i2c_get_clientdata(client); /* kill outstanding polls */ del_timer(&ir->timer); @@ -483,11 +427,9 @@ static int ir_probe(struct i2c_adapter *adap) static const int probe_bttv[] = { 0x1a, 0x18, 0x4b, 0x64, 0x30, -1}; static const int probe_saa7134[] = { 0x7a, -1 }; - static const int probe_em2820[] = { 0x47, 0x30, -1 }; + static const int probe_em2820[] = { 0x30, 0x47, -1 }; const int *probe = NULL; - int attached = 0; - - struct i2c_client c; unsigned char buf; int i,rc; + struct i2c_client c; char buf; int i,rc; switch (adap->id) { case I2C_HW_B_BT848: @@ -505,27 +447,15 @@ static int ir_probe(struct i2c_adapter *adap) memset(&c,0,sizeof(c)); c.adapter = adap; - for (i = 0; -1 != probe[i] && attached != 1; i++) { + for (i = 0; -1 != probe[i]; i++) { c.addr = probe[i]; - rc = i2c_master_recv(&c,&buf,1); + rc = i2c_master_recv(&c,&buf,0); dprintk(1,"probe 0x%02x @ %s: %s\n", probe[i], adap->name, - (1 == rc) ? "yes" : "no"); - switch(adap->id){ - case I2C_HW_B_BT848: - case I2C_HW_SAA7134: - if (1 == rc) { - ir_attach(adap,probe[i],0,0); - attached=1; - break; - } - case I2C_HW_B_EM2820: - /* windows logs are needed for fixing the pinnacle device */ - if (1 == rc && 0xff == buf){ - ir_attach(adap,probe[i],0,IR_TERRATEC_REMOTE); - attached=1; - } - break; + (0 == rc) ? "yes" : "no"); + if (0 == rc) { + ir_attach(adap,probe[i],0,0); + break; } } return 0; diff --git a/include/media/ir-common.h b/include/media/ir-common.h index 01b56822df4d..0f1ba95ec8d6 100644 --- a/include/media/ir-common.h +++ b/include/media/ir-common.h @@ -20,8 +20,10 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include +#ifndef _IR_COMMON +#define _IR_COMMON +#include #define IR_TYPE_RC5 1 #define IR_TYPE_PD 2 /* Pulse distance encoded IR */ @@ -61,6 +63,8 @@ int ir_dump_samples(u32 *samples, int count); int ir_decode_biphase(u32 *samples, int count, int low, int high); int ir_decode_pulsedistance(u32 *samples, int count, int low, int high); +#endif + /* * Local variables: * c-basic-offset: 8 diff --git a/include/media/ir-kbd-i2c.h b/include/media/ir-kbd-i2c.h new file mode 100644 index 000000000000..00fa57eb9fde --- /dev/null +++ b/include/media/ir-kbd-i2c.h @@ -0,0 +1,22 @@ +#ifndef _IR_I2C +#define _IR_I2C + +#include + +struct IR_i2c; + +struct IR_i2c { + IR_KEYTAB_TYPE *ir_codes; + struct i2c_client c; + struct input_dev *input; + struct ir_input_state ir; + + /* Used to avoid fast repeating */ + unsigned char old; + + struct work_struct work; + struct timer_list timer; + char phys[32]; + int (*get_key)(struct IR_i2c*, u32*, u32*); +}; +#endif -- cgit v1.2.2 From 74458e6c1aea9e422e46030e7bc61e9b0984be5b Mon Sep 17 00:00:00 2001 From: Sascha Sommer Date: Tue, 8 Nov 2005 21:37:33 -0800 Subject: [PATCH] v4l: 786: chip id removed since it isn t required anymore - Chip_id removed since it isn't required anymore. Signed-off-by: Sascha Sommer Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/em28xx/em28xx-cards.c | 3 --- drivers/media/video/em28xx/em28xx-core.c | 12 ++++++++++++ drivers/media/video/em28xx/em28xx-video.c | 12 ++++++++++++ drivers/media/video/em28xx/em28xx.h | 1 - 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index 919520f89975..59f8fa0bea60 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c @@ -160,7 +160,6 @@ struct em2820_board em2820_boards[] = { }, [EM2800_BOARD_TERRATEC_CINERGY_200] = { .name = "Terratec Cinergy 200 USB", - .chip_id = 0x4, .is_em2800 = 1, .vchannels = 3, .norm = VIDEO_MODE_PAL, @@ -184,7 +183,6 @@ struct em2820_board em2820_boards[] = { }, [EM2800_BOARD_LEADTEK_WINFAST_USBII] = { .name = "Leadtek Winfast USB II", - .chip_id = 0x2, .is_em2800 = 1, .vchannels = 3, .norm = VIDEO_MODE_PAL, @@ -208,7 +206,6 @@ struct em2820_board em2820_boards[] = { }, [EM2800_BOARD_KWORLD_USB2800] = { .name = "Kworld USB2800", - .chip_id = 0x7, .is_em2800 = 1, .vchannels = 3, .norm = VIDEO_MODE_PAL, diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index f5e22154a97f..f7b8fb035c9e 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c @@ -437,6 +437,18 @@ int em2820_scaler_set(struct em2820 *dev, u16 h, u16 v) buf[0] = v; buf[1] = v >> 8; em2820_write_regs(dev, VSCALELOW_REG, (char *)buf, 2); + if(dev->is_em2800){ + /* FIXME */ + /* random ratio scaling and 720x567 doesn't seem to work */ + /* the maximum we can get is 640x480 with disabled scaler */ + /* and norm_maxw set to 640 */ + if(dev->width == 640 && dev->height == 480) + return em2820_write_regs(dev, COMPR_REG,"\x00",1); + if(dev->height > 288) + return em2820_write_regs(dev, COMPR_REG,"\x10",1); + if(dev->width > 360) + return em2820_write_regs(dev, COMPR_REG,"\x20",1); + } /* when H and V mixershould be used? */ /* return em2820_write_reg_bits(dev, COMPR_REG, (h ? 0x20 : 0x00) | (v ? 0x10 : 0x00), 0x30); */ /* it seems that both H and V scalers must be active to work correctly */ diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index f3fc44b352b4..048ad1d77bab 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c @@ -1272,6 +1272,18 @@ static int em2820_video_do_ioctl(struct inode *inode, struct file *filp, if (width > maxw) width = maxw; + /* FIXME*/ + if(dev->is_em2800){ + /* we only know how to scale to 50% */ + if(height % (maxh / 2)) + height=maxh; + if(width % (maxw / 2)) + width=maxw; + /* larger resoltion don't seem to work either */ + if(width == maxw && height == maxh) + width /= 2; + } + if ((hscale = (((unsigned long)maxw) << 12) / width - 4096L) >= 0x4000) diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h index 31b23f0db051..a11df04a8c3d 100644 --- a/drivers/media/video/em28xx/em28xx.h +++ b/drivers/media/video/em28xx/em28xx.h @@ -159,7 +159,6 @@ enum em2820_decoder { struct em2820_board { char *name; - unsigned char chip_id; int vchannels; int norm; int tuner_type; -- cgit v1.2.2 From 78f82405ace9415e72a87b16c195675f053381f1 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Tue, 8 Nov 2005 21:37:34 -0800 Subject: [PATCH] v4l: 788: log message - This fixes dual language detection on the msp3400. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/msp3400.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/media/video/msp3400.c b/drivers/media/video/msp3400.c index 117d124657d0..5573f68ce457 100644 --- a/drivers/media/video/msp3400.c +++ b/drivers/media/video/msp3400.c @@ -1788,6 +1788,10 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) dprintk("msp34xx: AUDC_SET_RADIO\n"); msp->norm = VIDEO_MODE_RADIO; dprintk("msp34xx: switching to radio mode\n"); + if (IS_MSP34XX_G(msp)) { + msp34xxg_reset(client); + break; + } msp->watch_stereo = 0; switch (msp->opmode) { case OPMODE_MANUAL: @@ -1902,6 +1906,10 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) dprintk("msp34xx: VIDIOCSCHAN (norm=%d)\n",vc->norm); msp->norm = vc->norm; + if (IS_MSP34XX_G(msp)) { + msp34xxg_reset(client); + break; + } msp_wake_thread(client); break; } @@ -1911,6 +1919,10 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) { /* new channel -- kick audio carrier scan */ dprintk("msp34xx: VIDIOCSFREQ\n"); + if (IS_MSP34XX_G(msp)) { + msp34xxg_reset(client); + break; + } msp_wake_thread(client); break; } -- cgit v1.2.2 From 340622c5a9028d70b1238ecafb463125277a30eb Mon Sep 17 00:00:00 2001 From: Dwaine Garden Date: Tue, 8 Nov 2005 21:37:34 -0800 Subject: [PATCH] v4l: 789: added support for saa7113 - Added support for saa7113. Signed-off-by: Dwaine Garden Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/saa711x.c | 597 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 597 insertions(+) create mode 100644 drivers/media/video/saa711x.c diff --git a/drivers/media/video/saa711x.c b/drivers/media/video/saa711x.c new file mode 100644 index 000000000000..37653ee87235 --- /dev/null +++ b/drivers/media/video/saa711x.c @@ -0,0 +1,597 @@ +/* + * saa7111 - Philips SAA7113A video decoder driver version 0.0.3 + * + * Copyright (C) 1998 Dave Perks + * + * Slight changes for video timing and attachment output by + * Wolfgang Scherr + * + * Changes by Ronald Bultje + * - moved over to linux>=2.4.x i2c protocol (1/1/2003) + * + * Changes by Michael Hunold + * - implemented DECODER_SET_GPIO, DECODER_INIT, DECODER_SET_VBI_BYPASS + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +MODULE_DESCRIPTION("Philips SAA7113 video decoder driver"); +MODULE_AUTHOR("Dave Perks, Jose Ignacio Gijon, Joerg Heckenbach, Mark McClelland, Dwaine Garden"); +MODULE_LICENSE("GPL"); + +#include +#include + +#define I2C_NAME(s) (s)->name + +#include + +static int debug = 0; +MODULE_PARM(debug, "i"); +MODULE_PARM_DESC(debug, " Set the default Debug level. Default: 0 (Off) - (0-1)"); + + +#define dprintk(num, format, args...) \ + do { \ + if (debug >= num) \ + printk(format , ##args); \ + } while (0) + +/* ----------------------------------------------------------------------- */ + +struct saa7113 { + unsigned char reg[32]; + + int norm; + int input; + int enable; + int bright; + int contrast; + int hue; + int sat; +}; + +#define I2C_SAA7113 0x4A + +/* ----------------------------------------------------------------------- */ + +static inline int +saa7113_write (struct i2c_client *client, + u8 reg, + u8 value) +{ + struct saa7113 *decoder = i2c_get_clientdata(client); + + decoder->reg[reg] = value; + return i2c_smbus_write_byte_data(client, reg, value); +} + +static int +saa7113_write_block (struct i2c_client *client, + const u8 *data, + unsigned int len) +{ + int ret = -1; + u8 reg; + + /* the saa7113 has an autoincrement function, use it if + * the adapter understands raw I2C */ + if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { + /* do raw I2C, not smbus compatible */ + struct saa7113 *decoder = i2c_get_clientdata(client); + struct i2c_msg msg; + u8 block_data[32]; + + msg.addr = client->addr; + msg.flags = 0; + while (len >= 2) { + msg.buf = (char *) block_data; + msg.len = 0; + block_data[msg.len++] = reg = data[0]; + do { + block_data[msg.len++] = + decoder->reg[reg++] = data[1]; + len -= 2; + data += 2; + } while (len >= 2 && data[0] == reg && + msg.len < 32); + if ((ret = i2c_transfer(client->adapter, + &msg, 1)) < 0) + break; + } + } else { + /* do some slow I2C emulation kind of thing */ + while (len >= 2) { + reg = *data++; + if ((ret = saa7113_write(client, reg, + *data++)) < 0) + break; + len -= 2; + } + } + + return ret; +} + +static int +saa7113_init_decoder (struct i2c_client *client, + struct video_decoder_init *init) +{ + return saa7113_write_block(client, init->data, init->len); +} + +static inline int +saa7113_read (struct i2c_client *client, + u8 reg) +{ + return i2c_smbus_read_byte_data(client, reg); +} + +/* ----------------------------------------------------------------------- */ + +static const unsigned char saa7113_i2c_init[] = { + 0x00, 0x00, /* PH7113_CHIP_VERSION 00 - ID byte */ + 0x01, 0x08, /* PH7113_INCREMENT_DELAY - (1) (1) (1) (1) IDEL3 IDEL2 IDELL1 IDEL0 */ + 0x02, 0xc0, /* PH7113_ANALOG_INPUT_CONTR_1 - FUSE1 FUSE0 GUDL1 GUDL0 MODE3 MODE2 MODE1 MODE0 */ + 0x03, 0x23, /* PH7113_ANALOG_INPUT_CONTR_2 - (1) HLNRS VBSL WPOFF HOLDG GAFIX GAI28 GAI18 */ + 0x04, 0x00, /* PH7113_ANALOG_INPUT_CONTR_3 - GAI17 GAI16 GAI15 GAI14 GAI13 GAI12 GAI11 GAI10 */ + 0x05, 0x00, /* PH7113_ANALOG_INPUT_CONTR_4 - GAI27 GAI26 GAI25 GAI24 GAI23 GAI22 GAI21 GAI20 */ + 0x06, 0xeb, /* PH7113_HORIZONTAL_SYNC_START - HSB7 HSB6 HSB5 HSB4 HSB3 HSB2 HSB1 HSB0 */ + 0x07, 0xe0, /* PH7113_HORIZONTAL_SYNC_STOP - HSS7 HSS6 HSS5 HSS4 HSS3 HSS2 HSS1 HSS0 */ + 0x08, 0x88, /* PH7113_SYNC_CONTROL - AUFD FSEL FOET HTC1 HTC0 HPLL VNOI1 VNOI0 */ + 0x09, 0x00, /* PH7113_LUMINANCE_CONTROL - BYPS PREF BPSS1 BPSS0 VBLB UPTCV APER1 APER0 */ + 0x0a, 0x80, /* PH7113_LUMINANCE_BRIGHTNESS - BRIG7 BRIG6 BRIG5 BRIG4 BRIG3 BRIG2 BRIG1 BRIG0 */ + 0x0b, 0x47, /* PH7113_LUMINANCE_CONTRAST - CONT7 CONT6 CONT5 CONT4 CONT3 CONT2 CONT1 CONT0 */ + 0x0c, 0x40, /* PH7113_CHROMA_SATURATION - SATN7 SATN6 SATN5 SATN4 SATN3 SATN2 SATN1 SATN0 */ + 0x0d, 0x00, /* PH7113_CHROMA_HUE_CONTROL - HUEC7 HUEC6 HUEC5 HUEC4 HUEC3 HUEC2 HUEC1 HUEC0 */ + 0x0e, 0x01, /* PH7113_CHROMA_CONTROL - CDTO CSTD2 CSTD1 CSTD0 DCCF FCTC CHBW1 CHBW0 */ + 0x0f, 0xaa, /* PH7113_CHROMA_GAIN_CONTROL - ACGC CGAIN6 CGAIN5 CGAIN4 CGAIN3 CGAIN2 CGAIN1 CGAIN0 */ + 0x10, 0x00, /* PH7113_FORMAT_DELAY_CONTROL - OFTS1 OFTS0 HDEL1 HDEL0 VRLN YDEL2 YDEL1 YDEL0 */ + 0x11, 0x1C, /* PH7113_OUTPUT_CONTROL_1 - GPSW1 CM99 GPSW0 HLSEL OEYC OERT VIPB COLO */ + 0x12, 0x01, /* PH7113_OUTPUT_CONTROL_2 - RTSE13 RTSE12 RTSE11 RTSE10 RTSE03 RTSE02 RTSE01 RTSE00 */ + 0x13, 0x00, /* PH7113_OUTPUT_CONTROL_3 - ADLSB (1) (1) OLDSB FIDP (1) AOSL1 AOSL0 */ + 0x14, 0x00, /* RESERVED 14 - (1) (1) (1) (1) (1) (1) (1) (1) */ + 0x15, 0x00, /* PH7113_V_GATE1_START - VSTA7 VSTA6 VSTA5 VSTA4 VSTA3 VSTA2 VSTA1 VSTA0 */ + 0x16, 0x00, /* PH7113_V_GATE1_STOP - VSTO7 VSTO6 VSTO5 VSTO4 VSTO3 VSTO2 VSTO1 VSTO0 */ + 0x17, 0x00, /* PH7113_V_GATE1_MSB - (1) (1) (1) (1) (1) (1) VSTO8 VSTA8 */ +}; + +static int +saa7113_command (struct i2c_client *client, + unsigned int cmd, + void *arg) +{ + struct saa7113 *decoder = i2c_get_clientdata(client); + + switch (cmd) { + + case 0: + case DECODER_INIT: + { + struct video_decoder_init *init = arg; + if (NULL != init) + return saa7113_init_decoder(client, init); + else { + struct video_decoder_init vdi; + vdi.data = saa7113_i2c_init; + vdi.len = sizeof(saa7113_i2c_init); + return saa7113_init_decoder(client, &vdi); + } + } + + case DECODER_DUMP: + { + int i; + + for (i = 0; i < 32; i += 16) { + int j; + + printk(KERN_DEBUG "%s: %03x", I2C_NAME(client), i); + for (j = 0; j < 16; ++j) { + printk(" %02x", + saa7113_read(client, i + j)); + } + printk("\n"); + } + } + break; + + case DECODER_GET_CAPABILITIES: + { + struct video_decoder_capability *cap = arg; + + cap->flags = VIDEO_DECODER_PAL | + VIDEO_DECODER_NTSC | + VIDEO_DECODER_SECAM | + VIDEO_DECODER_AUTO | + VIDEO_DECODER_CCIR; + cap->inputs = 8; + cap->outputs = 1; + } + break; + + case DECODER_GET_STATUS: + { + int *iarg = arg; + int status; + int res; + + status = saa7113_read(client, 0x1f); + dprintk(1, KERN_DEBUG "%s status: 0x%02x\n", I2C_NAME(client), + status); + res = 0; + if ((status & (1 << 6)) == 0) { + res |= DECODER_STATUS_GOOD; + } + switch (decoder->norm) { + case VIDEO_MODE_NTSC: + res |= DECODER_STATUS_NTSC; + break; + case VIDEO_MODE_PAL: + res |= DECODER_STATUS_PAL; + break; + case VIDEO_MODE_SECAM: + res |= DECODER_STATUS_SECAM; + break; + default: + case VIDEO_MODE_AUTO: + if ((status & (1 << 5)) != 0) { + res |= DECODER_STATUS_NTSC; + } else { + res |= DECODER_STATUS_PAL; + } + break; + } + if ((status & (1 << 0)) != 0) { + res |= DECODER_STATUS_COLOR; + } + *iarg = res; + } + break; + + case DECODER_SET_GPIO: + { + int *iarg = arg; + if (0 != *iarg) { + saa7113_write(client, 0x11, + (decoder->reg[0x11] | 0x80)); + } else { + saa7113_write(client, 0x11, + (decoder->reg[0x11] & 0x7f)); + } + break; + } + + case DECODER_SET_VBI_BYPASS: + { + int *iarg = arg; + if (0 != *iarg) { + saa7113_write(client, 0x13, + (decoder->reg[0x13] & 0xf0) | 0x0a); + } else { + saa7113_write(client, 0x13, + (decoder->reg[0x13] & 0xf0)); + } + break; + } + + case DECODER_SET_NORM: + { + int *iarg = arg; + + switch (*iarg) { + + case VIDEO_MODE_NTSC: + saa7113_write(client, 0x08, + (decoder->reg[0x08] & 0x3f) | 0x40); + saa7113_write(client, 0x0e, + (decoder->reg[0x0e] & 0x8f)); + break; + + case VIDEO_MODE_PAL: + saa7113_write(client, 0x08, + (decoder->reg[0x08] & 0x3f) | 0x00); + saa7113_write(client, 0x0e, + (decoder->reg[0x0e] & 0x8f)); + break; + + case VIDEO_MODE_SECAM: + saa7113_write(client, 0x08, + (decoder->reg[0x0e] & 0x3f) | 0x00); + saa7113_write(client, 0x0e, + (decoder->reg[0x0e] & 0x8f) | 0x50); + break; + + case VIDEO_MODE_AUTO: + saa7113_write(client, 0x08, + (decoder->reg[0x08] & 0x3f) | 0x80); + saa7113_write(client, 0x0e, + (decoder->reg[0x0e] & 0x8f)); + break; + + default: + return -EINVAL; + + } + decoder->norm = *iarg; + } + break; + + case DECODER_SET_INPUT: + { + int *iarg = arg; + if (*iarg < 0 || *iarg > 9) { + return -EINVAL; + } + if (decoder->input != *iarg) { + decoder->input = *iarg; + /* select mode */ + saa7113_write(client, 0x02, + (decoder->reg[0x02] & 0xf0) | decoder->input); + /* bypass chrominance trap for modes 4..7 */ + saa7113_write(client, 0x09, + (decoder->reg[0x09] & 0x7f) | ((decoder->input > 3) ? 0x80 : 0)); + } + } + break; + + case DECODER_SET_OUTPUT: + { + int *iarg = arg; + + /* not much choice of outputs */ + if (*iarg != 0) { + return -EINVAL; + } + } + break; + + case DECODER_ENABLE_OUTPUT: + { + int *iarg = arg; + int enable = (*iarg != 0); + + if (decoder->enable != enable) { + decoder->enable = enable; + + /* RJ: If output should be disabled (for + * playing videos), we also need a open PLL. + * The input is set to 0 (where no input + * source is connected), although this + * is not necessary. + * + * If output should be enabled, we have to + * reverse the above. + */ + + if (decoder->enable) { + saa7113_write(client, 0x02, + (decoder-> + reg[0x02] & 0xf8) | + decoder->input); + saa7113_write(client, 0x08, + (decoder->reg[0x08] & 0xfb)); + saa7113_write(client, 0x11, + (decoder-> + reg[0x11] & 0xf3) | 0x0c); + } else { + saa7113_write(client, 0x02, + (decoder->reg[0x02] & 0xf8)); + saa7113_write(client, 0x08, + (decoder-> + reg[0x08] & 0xfb) | 0x04); + saa7113_write(client, 0x11, + (decoder->reg[0x11] & 0xf3)); + } + } + } + break; + + case DECODER_SET_PICTURE: + { + struct video_picture *pic = arg; + + if (decoder->bright != pic->brightness) { + /* We want 0 to 255 we get 0-65535 */ + decoder->bright = pic->brightness; + saa7113_write(client, 0x0a, decoder->bright >> 8); + } + if (decoder->contrast != pic->contrast) { + /* We want 0 to 127 we get 0-65535 */ + decoder->contrast = pic->contrast; + saa7113_write(client, 0x0b, + decoder->contrast >> 9); + } + if (decoder->sat != pic->colour) { + /* We want 0 to 127 we get 0-65535 */ + decoder->sat = pic->colour; + saa7113_write(client, 0x0c, decoder->sat >> 9); + } + if (decoder->hue != pic->hue) { + /* We want -128 to 127 we get 0-65535 */ + decoder->hue = pic->hue; + saa7113_write(client, 0x0d, + (decoder->hue - 32768) >> 8); + } + } + break; + + default: + return -EINVAL; + } + + return 0; +} + +/* ----------------------------------------------------------------------- */ + +/* + * Generic i2c probe + * concerning the addresses: i2c wants 7 bit (without the r/w bit), so '>>1' + */ + +/* standard i2c insmod options */ +static unsigned short normal_i2c[] = { + I2C_SAA7113>>1, /* saa7113 */ + I2C_CLIENT_END +}; + +I2C_CLIENT_INSMOD; + + +static struct i2c_driver i2c_driver_saa7113; + +static int +saa7113_detect_client (struct i2c_adapter *adapter, + int address, + int kind) +{ + int i; + struct i2c_client *client; + struct saa7113 *decoder; + struct video_decoder_init vdi; + + dprintk(1, + KERN_INFO + "saa7113.c: detecting saa7113 client on address 0x%x\n", + address << 1); + + /* Check if the adapter supports the needed features */ + if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) + return 0; + + client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); + if (client == 0) + return -ENOMEM; + memset(client, 0, sizeof(struct i2c_client)); + client->addr = address; + client->adapter = adapter; + client->driver = &i2c_driver_saa7113; + client->flags = I2C_CLIENT_ALLOW_USE; + strlcpy(I2C_NAME(client), "saa7113", sizeof(I2C_NAME(client))); + decoder = kmalloc(sizeof(struct saa7113), GFP_KERNEL); + if (decoder == NULL) { + kfree(client); + return -ENOMEM; + } + memset(decoder, 0, sizeof(struct saa7113)); + decoder->norm = VIDEO_MODE_NTSC; + decoder->input = 0; + decoder->enable = 1; + decoder->bright = 32768; + decoder->contrast = 32768; + decoder->hue = 32768; + decoder->sat = 32768; + i2c_set_clientdata(client, decoder); + + i = i2c_attach_client(client); + if (i) { + kfree(client); + kfree(decoder); + return i; + } + + vdi.data = saa7113_i2c_init; + vdi.len = sizeof(saa7113_i2c_init); + i = saa7113_init_decoder(client, &vdi); + if (i < 0) { + dprintk(1, KERN_ERR "%s_attach error: init status %d\n", + I2C_NAME(client), i); + } else { + dprintk(1, + KERN_INFO + "%s_attach: chip version %x at address 0x%x\n", + I2C_NAME(client), saa7113_read(client, 0x00) >> 4, + client->addr << 1); + } + + return 0; +} + +static int +saa7113_attach_adapter (struct i2c_adapter *adapter) +{ + dprintk(1, + KERN_INFO + "saa7113.c: starting probe for adapter %s (0x%x)\n", + I2C_NAME(adapter), adapter->id); + return i2c_probe(adapter, &addr_data, &saa7113_detect_client); +} + +static int +saa7113_detach_client (struct i2c_client *client) +{ + struct saa7113 *decoder = i2c_get_clientdata(client); + int err; + + err = i2c_detach_client(client); + if (err) { + return err; + } + + kfree(decoder); + kfree(client); + + return 0; +} + +/* ----------------------------------------------------------------------- */ + +static struct i2c_driver i2c_driver_saa7113 = { + .owner = THIS_MODULE, + .name = "saa7113", + + .id = I2C_DRIVERID_SAA7113, + .flags = I2C_DF_NOTIFY, + + .attach_adapter = saa7113_attach_adapter, + .detach_client = saa7113_detach_client, + .command = saa7113_command, +}; + +static int __init +saa7113_init (void) +{ + return i2c_add_driver(&i2c_driver_saa7113); +} + +static void __exit +saa7113_exit (void) +{ + i2c_del_driver(&i2c_driver_saa7113); +} + +module_init(saa7113_init); +module_exit(saa7113_exit); -- cgit v1.2.2 From e43f14af143921ac6680aa3ddfff111bef4e034a Mon Sep 17 00:00:00 2001 From: Markus Rechberger Date: Tue, 8 Nov 2005 21:37:35 -0800 Subject: [PATCH] v4l: 790: added support for terratec cinergy 250 usb - Added support for Terratec Cinergy 250 USB Signed-off-by: Markus Rechberger Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/em28xx/em28xx-input.c | 94 ++++++++++++++++++++----------- drivers/media/video/ir-kbd-i2c.c | 2 +- 2 files changed, 63 insertions(+), 33 deletions(-) diff --git a/drivers/media/video/em28xx/em28xx-input.c b/drivers/media/video/em28xx/em28xx-input.c index d6b3e15a0350..3800b99e4b86 100644 --- a/drivers/media/video/em28xx/em28xx-input.c +++ b/drivers/media/video/em28xx/em28xx-input.c @@ -42,40 +42,68 @@ MODULE_PARM_DESC(ir_debug,"enable debug messages [IR]"); /* ---------------------------------------------------------------------- */ -static IR_KEYTAB_TYPE ir_codes_em_pinnacle[IR_KEYTAB_SIZE] = { - [ 0 ] = KEY_CHANNEL, - [ 1 ] = KEY_SELECT, - [ 2 ] = KEY_MUTE, - [ 3 ] = KEY_POWER, - [ 4 ] = KEY_KP1, - [ 5 ] = KEY_KP2, - [ 6 ] = KEY_KP3, - [ 7 ] = KEY_CHANNELUP, - [ 8 ] = KEY_KP4, - [ 9 ] = KEY_KP5, - [ 10 ] = KEY_KP6, - - [ 11 ] = KEY_CHANNELDOWN, - [ 12 ] = KEY_KP7, - [ 13 ] = KEY_KP8, - [ 14 ] = KEY_KP9, - [ 15 ] = KEY_VOLUMEUP, - [ 16 ] = KEY_KP0, - [ 17 ] = KEY_MENU, - [ 18 ] = KEY_PRINT, - - [ 19 ] = KEY_VOLUMEDOWN, - [ 21 ] = KEY_PAUSE, - [ 23 ] = KEY_RECORD, - [ 24 ] = KEY_REWIND, - [ 25 ] = KEY_PLAY, - [ 27 ] = KEY_BACKSPACE, - [ 29 ] = KEY_STOP, - [ 31 ] = KEY_ZOOM, +static IR_KEYTAB_TYPE ir_codes_em_terratec[IR_KEYTAB_SIZE] = { + [ 0x01 ] = KEY_CHANNEL, + [ 0x02 ] = KEY_SELECT, + [ 0x03 ] = KEY_MUTE, + [ 0x04 ] = KEY_POWER, + [ 0x05 ] = KEY_KP1, + [ 0x06 ] = KEY_KP2, + [ 0x07 ] = KEY_KP3, + [ 0x08 ] = KEY_CHANNELUP, + [ 0x09 ] = KEY_KP4, + [ 0x0a ] = KEY_KP5, + [ 0x0b ] = KEY_KP6, + [ 0x0c ] = KEY_CHANNELDOWN, + [ 0x0d ] = KEY_KP7, + [ 0x0e ] = KEY_KP8, + [ 0x0f ] = KEY_KP9, + [ 0x10 ] = KEY_VOLUMEUP, + [ 0x11 ] = KEY_KP0, + [ 0x12 ] = KEY_MENU, + [ 0x13 ] = KEY_PRINT, + [ 0x14 ] = KEY_VOLUMEDOWN, + [ 0x16 ] = KEY_PAUSE, + [ 0x18 ] = KEY_RECORD, + [ 0x19 ] = KEY_REWIND, + [ 0x1a ] = KEY_PLAY, + [ 0x1b ] = KEY_FORWARD, + [ 0x1c ] = KEY_BACKSPACE, + [ 0x1e ] = KEY_STOP, + [ 0x40 ] = KEY_ZOOM, }; /* ----------------------------------------------------------------------- */ +static int get_key_terratec(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) +{ + unsigned char b; + + /* poll IR chip */ + if (1 != i2c_master_recv(&ir->c,&b,1)) { + dprintk("read error\n"); + return -EIO; + } + + /* it seems that 0xFE indicates that a button is still hold + down, while 0xFF indicates that no button is hold + down. 0xFE sequences are sometimes interrupted by 0xFF */ + + dprintk("key %02x\n", b); + + if (b == 0xFF) + return 0; + + if (b == 0xFE) + /* keep old data */ + return 1; + + *ir_key = b; + *ir_raw = b; + return 1; +} + + static int get_key_em_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) { unsigned char buf[2]; @@ -123,14 +151,16 @@ void em2820_set_ir(struct em2820 * dev,struct IR_i2c *ir) case (EM2820_BOARD_UNKNOWN): break; case (EM2820_BOARD_TERRATEC_CINERGY_250): + ir->ir_codes = ir_codes_em_terratec; + ir->get_key = get_key_terratec; + snprintf(ir->c.name, sizeof(ir->c.name), "i2c IR (EM2820 Terratec)"); break; case (EM2820_BOARD_PINNACLE_USB_2): - ir->ir_codes = ir_codes_em_pinnacle; break; case (EM2820_BOARD_HAUPPAUGE_WINTV_USB_2): ir->ir_codes = ir_codes_hauppauge_new; ir->get_key = get_key_em_haup; - snprintf(ir->c.name, sizeof(ir->c.name), "i2c IR (EM2840 Hauppage)"); + snprintf(ir->c.name, sizeof(ir->c.name), "i2c IR (EM2840 Hauppauge)"); break; case (EM2820_BOARD_MSI_VOX_USB_2): break; diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index 8cc3f8ab2f3a..c4701035ca20 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c @@ -429,7 +429,7 @@ static int ir_probe(struct i2c_adapter *adap) static const int probe_saa7134[] = { 0x7a, -1 }; static const int probe_em2820[] = { 0x30, 0x47, -1 }; const int *probe = NULL; - struct i2c_client c; char buf; int i,rc; + struct i2c_client c; unsigned char buf; int i,rc; switch (adap->id) { case I2C_HW_B_BT848: -- cgit v1.2.2 From 4f9c05aa727a3b27e28972f2f3938b29ad81b833 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:37:36 -0800 Subject: [PATCH] v4l: 791: codingstyle fixes - CodingStyle fixes Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Markus Rechberger Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/em28xx/em28xx-input.c | 8 ++++---- drivers/media/video/ir-kbd-i2c.c | 12 +++++++----- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/media/video/em28xx/em28xx-input.c b/drivers/media/video/em28xx/em28xx-input.c index 3800b99e4b86..0576ad6c42b7 100644 --- a/drivers/media/video/em28xx/em28xx-input.c +++ b/drivers/media/video/em28xx/em28xx-input.c @@ -86,15 +86,15 @@ static int get_key_terratec(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) } /* it seems that 0xFE indicates that a button is still hold - down, while 0xFF indicates that no button is hold - down. 0xFE sequences are sometimes interrupted by 0xFF */ + down, while 0xff indicates that no button is hold + down. 0xfe sequences are sometimes interrupted by 0xFF */ dprintk("key %02x\n", b); - if (b == 0xFF) + if (b == 0xff) return 0; - if (b == 0xFE) + if (b == 0xfe) /* keep old data */ return 1; diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index c4701035ca20..b0facaa40b2f 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c @@ -206,15 +206,15 @@ static int get_key_knc1(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) } /* it seems that 0xFE indicates that a button is still hold - down, while 0xFF indicates that no button is hold - down. 0xFE sequences are sometimes interrupted by 0xFF */ + down, while 0xff indicates that no button is hold + down. 0xfe sequences are sometimes interrupted by 0xFF */ dprintk(2,"key %02x\n", b); - if (b == 0xFF) + if (b == 0xff) return 0; - if (b == 0xFE) + if (b == 0xfe) /* keep old data */ return 1; @@ -429,7 +429,9 @@ static int ir_probe(struct i2c_adapter *adap) static const int probe_saa7134[] = { 0x7a, -1 }; static const int probe_em2820[] = { 0x30, 0x47, -1 }; const int *probe = NULL; - struct i2c_client c; unsigned char buf; int i,rc; + struct i2c_client c; + unsigned char buf; + int i,rc; switch (adap->id) { case I2C_HW_B_BT848: -- cgit v1.2.2 From 16f2e6229f6f7b89cb42f4942cb46dc645faae2a Mon Sep 17 00:00:00 2001 From: Sascha Sommer Date: Tue, 8 Nov 2005 21:37:37 -0800 Subject: [PATCH] v4l: 793: remotes for the cinergy 200 usb and cinergy 250 usb are the same - Remotes for the Cinergy 200 USB and Cinergy 250 USB are the same. Signed-off-by: Sascha Sommer Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/em28xx/em28xx-input.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/media/video/em28xx/em28xx-input.c b/drivers/media/video/em28xx/em28xx-input.c index 0576ad6c42b7..ba367a9796e7 100644 --- a/drivers/media/video/em28xx/em28xx-input.c +++ b/drivers/media/video/em28xx/em28xx-input.c @@ -150,6 +150,7 @@ void em2820_set_ir(struct em2820 * dev,struct IR_i2c *ir) break; case (EM2820_BOARD_UNKNOWN): break; + case (EM2800_BOARD_TERRATEC_CINERGY_200): case (EM2820_BOARD_TERRATEC_CINERGY_250): ir->ir_codes = ir_codes_em_terratec; ir->get_key = get_key_terratec; @@ -164,8 +165,6 @@ void em2820_set_ir(struct em2820 * dev,struct IR_i2c *ir) break; case (EM2820_BOARD_MSI_VOX_USB_2): break; - case (EM2800_BOARD_TERRATEC_CINERGY_200): - break; case (EM2800_BOARD_LEADTEK_WINFAST_USBII): break; case (EM2800_BOARD_KWORLD_USB2800): -- cgit v1.2.2 From 71633c05724d85f1afb87629bb96fdf2ef18b41f Mon Sep 17 00:00:00 2001 From: "nshmyrev@yandex.ru" Date: Tue, 8 Nov 2005 21:37:38 -0800 Subject: [PATCH] v4l: 794: added asound skyeye bttv card - Added Asound Skyeye bttv card. Signed-off-by: Nickolay V. Shmyrev <> Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/video4linux/CARDLIST.bttv | 1 + drivers/media/video/bttv-cards.c | 17 +++++++++++++++++ drivers/media/video/bttv.h | 1 + 3 files changed, 19 insertions(+) diff --git a/Documentation/video4linux/CARDLIST.bttv b/Documentation/video4linux/CARDLIST.bttv index ba98ff4a79af..2404099996ac 100644 --- a/Documentation/video4linux/CARDLIST.bttv +++ b/Documentation/video4linux/CARDLIST.bttv @@ -139,3 +139,4 @@ 138 -> Prolink Pixelview PV-BT878P+ (Rev.2E) 139 -> Prolink PixelView PlayTV MPEG2 PV-M4900 140 -> Osprey 440 [0070:ff07] +141 -> Asound Skyeye PCTV diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bttv-cards.c index 2b19de386dcf..8544a8fa2a5c 100644 --- a/drivers/media/video/bttv-cards.c +++ b/drivers/media/video/bttv-cards.c @@ -2781,6 +2781,23 @@ struct tvcard bttv_tvcards[] = { .no_tda9875 = 1, .no_tda7432 = 1, }, + /* ---- card 0x8d ---------------------------------- */ + [BTTV_BOARD_ASOUND_SKYEYE] = { + .name = "Asound Skyeye PCTV", + .video_inputs = 3, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .gpiomask = 15, + .muxsel = { 2, 3, 1, 1}, + .audiomux = {2,0,0,0,1}, + .needs_tvaudio = 1, + .pll = PLL_28, + .tuner_type = 2, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + }, + }; static const unsigned int bttv_num_tvcards = ARRAY_SIZE(bttv_tvcards); diff --git a/drivers/media/video/bttv.h b/drivers/media/video/bttv.h index ffece3b91360..26cd117a6df4 100644 --- a/drivers/media/video/bttv.h +++ b/drivers/media/video/bttv.h @@ -161,6 +161,7 @@ #define BTTV_BOARD_PV_BT878P_2E 0x8a #define BTTV_BOARD_PV_M4900 0x8b #define BTTV_BOARD_OSPREY440 0x8c +#define BTTV_BOARD_ASOUND_SKYEYE 0x8d /* i2c address list */ #define I2C_TSA5522 0xc2 -- cgit v1.2.2 From 3ae1adc6ed93d55a27523f395284940fbe056401 Mon Sep 17 00:00:00 2001 From: "Nickolay V. Shmyrev" Date: Tue, 8 Nov 2005 21:37:39 -0800 Subject: [PATCH] v4l: 795: new config option for tda9887 to specifically set intercarrier - New config option for tda9887 to specifically set intercarrier Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/cx88/cx88-cards.c | 2 +- drivers/media/video/tda9887.c | 2 ++ include/media/tuner.h | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c index 6a85ba111fb1..cf17da836914 100644 --- a/drivers/media/video/cx88/cx88-cards.c +++ b/drivers/media/video/cx88/cx88-cards.c @@ -206,7 +206,7 @@ struct cx88_board cx88_boards[] = { .radio_type = UNSET, .tuner_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET, - .tda9887_conf = TDA9887_PRESENT, + .tda9887_conf = TDA9887_PRESENT | TDA9887_INTERCARRIER_NTSC, .input = {{ .type = CX88_VMUX_TELEVISION, .vmux = 0, diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c index 3a7babef06f4..796110d4ff72 100644 --- a/drivers/media/video/tda9887.c +++ b/drivers/media/video/tda9887.c @@ -464,6 +464,8 @@ static int tda9887_set_config(struct tda9887 *t, char *buf) break; } } + if ((t->config & TDA9887_INTERCARRIER_NTSC) && (t->std & V4L2_STD_NTSC)) + buf[1] &= ~cQSS; return 0; } diff --git a/include/media/tuner.h b/include/media/tuner.h index 7cc74b1bb6ea..81025323267f 100644 --- a/include/media/tuner.h +++ b/include/media/tuner.h @@ -148,6 +148,7 @@ # define TDA9887_INTERCARRIER (1<<4) # define TDA9887_PORT1_ACTIVE (1<<5) # define TDA9887_PORT2_ACTIVE (1<<6) +# define TDA9887_INTERCARRIER_NTSC (1<<7) /* config options */ # define TDA9887_DEEMPHASIS_MASK (3<<16) # define TDA9887_DEEMPHASIS_NONE (1<<16) -- cgit v1.2.2 From cf1c5d1d58793bb9320467226ffc850c75c20902 Mon Sep 17 00:00:00 2001 From: Pieter Palmers Date: Tue, 8 Nov 2005 21:37:40 -0800 Subject: [PATCH] v4l: 796: add sknet monster tv mobile card - Add SKNet Monster TV Mobile card. Signed-off-by: Pieter Palmers Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/video4linux/CARDLIST.saa7134 | 1 + drivers/media/video/saa7134/saa7134-cards.c | 36 +++++++++++++++++++++++++++-- drivers/media/video/saa7134/saa7134.h | 1 + 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134 index 3bcfd88920df..c5ae8a32f756 100644 --- a/Documentation/video4linux/CARDLIST.saa7134 +++ b/Documentation/video4linux/CARDLIST.saa7134 @@ -74,3 +74,4 @@ 73 -> RTD Embedded Technologies VFG7330 [1435:7330] 74 -> LifeView FlyTV Platinum Mini2 [14c0:1212] 75 -> AVerMedia AVerTVHD MCE A180 [1461:1044] + 76 -> SKNet MonsterTV Mobile [1131:4ee9] diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index e6e50c0a80ce..17b0549f2e1b 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c @@ -2368,6 +2368,29 @@ struct saa7134_board saa7134_boards[] = { .amux = LINE2, }}, }, + [SAA7134_BOARD_MONSTERTV_MOBILE] = { + .name = "SKNet MonsterTV Mobile", + .audio_clock = 0x00187de7, + .tuner_type = TUNER_PHILIPS_TDA8290, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + + .inputs = {{ + .name = name_tv, + .vmux = 1, + .amux = TV, + .tv = 1, + },{ + .name = name_comp1, + .vmux = 3, + .amux = LINE1, + },{ + .name = name_svideo, + .vmux = 6, + .amux = LINE1, + }}, + }, }; const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards); @@ -2773,12 +2796,18 @@ struct pci_device_id saa7134_pci_tbl[] = { .subvendor = 0x1435, .subdevice = 0x7330, .driver_data = SAA7134_BOARD_RTD_VFG7330, - },{ + },{ .vendor = PCI_VENDOR_ID_PHILIPS, .device = PCI_DEVICE_ID_PHILIPS_SAA7133, .subvendor = 0x1461, .subdevice = 0x1044, .driver_data = SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180, + },{ + .vendor = PCI_VENDOR_ID_PHILIPS, + .device = PCI_DEVICE_ID_PHILIPS_SAA7133, + .subvendor = 0x1131, + .subdevice = 0x4ee9, + .driver_data = SAA7134_BOARD_MONSTERTV_MOBILE, },{ /* --- boards without eeprom + subsystem ID --- */ .vendor = PCI_VENDOR_ID_PHILIPS, @@ -2889,7 +2918,10 @@ int saa7134_board_init1(struct saa7134_dev *dev) /* power-up tuner chip */ saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x00040000, 0x00040000); saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x00040000, 0x00000000); - msleep(1); + case SAA7134_BOARD_MONSTERTV_MOBILE: + /* power-up tuner chip */ + saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x00040000, 0x00040000); + saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x00040000, 0x00000004); break; case SAA7134_BOARD_FLYDVBTDUO: case SAA7134_BOARD_THYPHOON_DVBT_DUO_CARDBUS: diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index 473c5dbb9b5f..99bbdcf727c3 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h @@ -202,6 +202,7 @@ struct saa7134_format { #define SAA7134_BOARD_RTD_VFG7330 73 #define SAA7134_BOARD_FLYTVPLATINUM_MINI2 74 #define SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180 75 +#define SAA7134_BOARD_MONSTERTV_MOBILE 76 #define SAA7134_MAXBOARDS 8 #define SAA7134_INPUT_MAX 8 -- cgit v1.2.2 From c58c21c7a2ef7d1eb45231d5c1bb24d88a9666b8 Mon Sep 17 00:00:00 2001 From: "nshmyrev@yandex.ru" Date: Tue, 8 Nov 2005 21:37:41 -0800 Subject: [PATCH] v4l: 797: more intellect on clearing in bits on irq lock - More intellect on clearing in bits on irq lock. Signed-off-by: Nickolay V. Shmyrev <> Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/bttv-driver.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c index 504d717b1158..058b923b4b13 100644 --- a/drivers/media/video/bttv-driver.c +++ b/drivers/media/video/bttv-driver.c @@ -3736,10 +3736,22 @@ static irqreturn_t bttv_irq(int irq, void *dev_id, struct pt_regs * regs) count++; if (count > 4) { - btwrite(0, BT848_INT_MASK); - printk(KERN_ERR - "bttv%d: IRQ lockup, cleared int mask [", btv->c.nr); + + if (count > 8 || !(astat & BT848_INT_GPINT)) { + btwrite(0, BT848_INT_MASK); + + printk(KERN_ERR + "bttv%d: IRQ lockup, cleared int mask [", btv->c.nr); + } else { + printk(KERN_ERR + "bttv%d: IRQ lockup, clearing GPINT from int mask [", btv->c.nr); + + btwrite(btread(BT848_INT_MASK) & (-1 ^ BT848_INT_GPINT), + BT848_INT_MASK); + }; + bttv_print_irqbits(stat,astat); + printk("]\n"); } } -- cgit v1.2.2 From 299392bf2040fc53ebfc94363ac0abdd0f0bf619 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Tue, 8 Nov 2005 21:37:42 -0800 Subject: [PATCH] v4l: 798: this patch adds the vidioc log status to videodev2 h and adds - This patch adds the VIDIOC_LOG_STATUS to videodev2.h and adds LOG_STATUS support to tda9887.c and bttv-driver.c. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/bttv-driver.c | 6 ++++++ drivers/media/video/tda9887.c | 29 +++++++++++++++++------------ include/linux/videodev2.h | 1 + 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c index 058b923b4b13..f8307407e320 100644 --- a/drivers/media/video/bttv-driver.c +++ b/drivers/media/video/bttv-driver.c @@ -1851,6 +1851,11 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) up(&btv->lock); return 0; } + case VIDIOC_LOG_STATUS: + { + bttv_call_i2c_clients(btv, VIDIOC_LOG_STATUS, 0); + return 0; + } default: return -ENOIOCTLCMD; @@ -2856,6 +2861,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, case VIDIOC_S_TUNER: case VIDIOC_G_FREQUENCY: case VIDIOC_S_FREQUENCY: + case VIDIOC_LOG_STATUS: return bttv_common_ioctls(btv,cmd,arg); default: diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c index 796110d4ff72..6d2914f738f2 100644 --- a/drivers/media/video/tda9887.c +++ b/drivers/media/video/tda9887.c @@ -60,6 +60,7 @@ struct tda9887 { unsigned int pinnacle_id; unsigned int using_v4l2; unsigned int radio_mode; + unsigned char data[4]; }; struct tvnorm { @@ -575,32 +576,31 @@ static int tda9887_status(struct tda9887 *t) static int tda9887_configure(struct tda9887 *t) { - unsigned char buf[4]; int rc; - memset(buf,0,sizeof(buf)); - tda9887_set_tvnorm(t,buf); + memset(t->data,0,sizeof(t->data)); + tda9887_set_tvnorm(t,t->data); - buf[1] |= cOutputPort1Inactive; - buf[1] |= cOutputPort2Inactive; + t->data[1] |= cOutputPort1Inactive; + t->data[1] |= cOutputPort2Inactive; if (UNSET != t->pinnacle_id) { - tda9887_set_pinnacle(t,buf); + tda9887_set_pinnacle(t,t->data); } - tda9887_set_config(t,buf); - tda9887_set_insmod(t,buf); + tda9887_set_config(t,t->data); + tda9887_set_insmod(t,t->data); if (t->mode == T_STANDBY) { - buf[1] |= cForcedMuteAudioON; + t->data[1] |= cForcedMuteAudioON; } tda9887_dbg("writing: b=0x%02x c=0x%02x e=0x%02x\n", - buf[1],buf[2],buf[3]); + t->data[1],t->data[2],t->data[3]); if (debug > 1) - dump_write_message(t, buf); + dump_write_message(t, t->data); - if (4 != (rc = i2c_master_send(&t->client,buf,4))) + if (4 != (rc = i2c_master_send(&t->client,t->data,4))) tda9887_info("i2c i/o error: rc == %d (should be 4)\n",rc); if (debug > 2) { @@ -785,6 +785,11 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg) } break; } + case VIDIOC_LOG_STATUS: + { + tda9887_info("Data bytes: b=%02x c=%02x e=%02x\n", t->data[1], t->data[2], t->data[3]); + break; + } default: /* nothing */ break; diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 89a055761bed..27979003db44 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -981,6 +981,7 @@ struct v4l2_streamparm #if 1 #define VIDIOC_G_SLICED_VBI_CAP _IOR ('V', 69, struct v4l2_sliced_vbi_cap) #endif +#define VIDIOC_LOG_STATUS _IO ('V', 70) /* for compatibility, will go away some day */ #define VIDIOC_OVERLAY_OLD _IOWR ('V', 14, int) -- cgit v1.2.2 From a8900fc242406f25f315190a6d650f1d54617c2f Mon Sep 17 00:00:00 2001 From: Ray Cole Date: Tue, 8 Nov 2005 21:37:43 -0800 Subject: [PATCH] v4l: 799: don t request gpint on avermedia tv capture 98 - Don't request GPINT on Avermedia TV Capture 98. Signed-off-by: Ray Cole . Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/bttv-cards.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bttv-cards.c index 8544a8fa2a5c..3937da065e4f 100644 --- a/drivers/media/video/bttv-cards.c +++ b/drivers/media/video/bttv-cards.c @@ -521,6 +521,7 @@ struct tvcard bttv_tvcards[] = { .tuner_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET, .audio_hook = avermedia_tv_stereo_audio, + .no_gpioirq = 1, }, [BTTV_BOARD_VHX] = { .name = "Aimslab Video Highway Xtreme (VHX)", -- cgit v1.2.2 From 4ac97914c6c35f6bf132071c718e034d0846b9f5 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:37:43 -0800 Subject: [PATCH] v4l: 800: whitespace cleanups - Whitespace Cleanups. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/video4linux/README.cx88 | 6 +- Documentation/video4linux/bttv/Cards | 18 +- Documentation/video4linux/bttv/README | 6 +- Documentation/video4linux/bttv/Sound-FAQ | 6 +- Documentation/video4linux/lifeview.txt | 58 +-- drivers/media/common/ir-common.c | 4 +- drivers/media/video/bt832.c | 88 ++--- drivers/media/video/bt832.h | 4 +- drivers/media/video/bttv-cards.c | 260 ++++++------- drivers/media/video/bttv-driver.c | 342 ++++++++--------- drivers/media/video/bttv-gpio.c | 2 +- drivers/media/video/bttv-i2c.c | 42 +-- drivers/media/video/bttv-if.c | 4 +- drivers/media/video/bttv-risc.c | 110 +++--- drivers/media/video/bttv.h | 20 +- drivers/media/video/bttvp.h | 14 +- drivers/media/video/cx88/cx88-blackbird.c | 40 +- drivers/media/video/cx88/cx88-cards.c | 340 ++++++++--------- drivers/media/video/cx88/cx88-core.c | 40 +- drivers/media/video/cx88/cx88-dvb.c | 16 +- drivers/media/video/cx88/cx88-i2c.c | 22 +- drivers/media/video/cx88/cx88-input.c | 2 +- drivers/media/video/cx88/cx88-mpeg.c | 18 +- drivers/media/video/cx88/cx88-reg.h | 12 +- drivers/media/video/cx88/cx88-video.c | 22 +- drivers/media/video/cx88/cx88.h | 4 +- drivers/media/video/em28xx/em28xx-cards.c | 4 +- drivers/media/video/em28xx/em28xx-core.c | 28 +- drivers/media/video/em28xx/em28xx-i2c.c | 4 +- drivers/media/video/em28xx/em28xx-input.c | 52 +-- drivers/media/video/em28xx/em28xx-video.c | 10 +- drivers/media/video/em28xx/em28xx.h | 12 +- drivers/media/video/ir-kbd-gpio.c | 4 +- drivers/media/video/ir-kbd-i2c.c | 22 +- drivers/media/video/msp3400.c | 62 ++-- drivers/media/video/mt20xx.c | 204 +++++------ drivers/media/video/saa711x.c | 4 +- drivers/media/video/saa7134/saa6752hs.c | 62 ++-- drivers/media/video/saa7134/saa7134-alsa.c | 504 +++++++++++++------------- drivers/media/video/saa7134/saa7134-cards.c | 314 ++++++++-------- drivers/media/video/saa7134/saa7134-core.c | 38 +- drivers/media/video/saa7134/saa7134-dvb.c | 4 +- drivers/media/video/saa7134/saa7134-empress.c | 6 +- drivers/media/video/saa7134/saa7134-i2c.c | 14 +- drivers/media/video/saa7134/saa7134-input.c | 100 ++--- drivers/media/video/saa7134/saa7134-oss.c | 68 ++-- drivers/media/video/saa7134/saa7134-reg.h | 18 +- drivers/media/video/saa7134/saa7134-ts.c | 4 +- drivers/media/video/saa7134/saa7134-tvaudio.c | 12 +- drivers/media/video/saa7134/saa7134-video.c | 106 +++--- drivers/media/video/saa7134/saa7134.h | 12 +- drivers/media/video/tda7432.c | 16 +- drivers/media/video/tda8290.c | 2 +- drivers/media/video/tda9875.c | 56 +-- drivers/media/video/tda9887.c | 36 +- drivers/media/video/tea5767.c | 8 +- drivers/media/video/tuner-core.c | 30 +- drivers/media/video/tuner-simple.c | 106 +++--- drivers/media/video/tvaudio.c | 20 +- drivers/media/video/tveeprom.c | 20 +- drivers/media/video/tvmixer.c | 54 +-- drivers/media/video/v4l1-compat.c | 2 +- drivers/media/video/video-buf.c | 18 +- drivers/media/video/wm8775.c | 4 +- include/linux/videodev.h | 6 +- include/linux/videodev2.h | 118 +++--- include/media/audiochip.h | 14 +- include/media/tuner.h | 8 +- include/media/video-buf.h | 2 +- 69 files changed, 1844 insertions(+), 1844 deletions(-) diff --git a/Documentation/video4linux/README.cx88 b/Documentation/video4linux/README.cx88 index 0b93455bbc17..06a33a4f52fd 100644 --- a/Documentation/video4linux/README.cx88 +++ b/Documentation/video4linux/README.cx88 @@ -17,9 +17,9 @@ audio - The chip specs for the on-chip TV sound decoder are next to useless :-/ - Neverless the builtin TV sound decoder starts working now, - at least for PAL-BG. Other TV norms need other code ... - FOR ANY REPORTS ON THIS PLEASE MENTION THE TV NORM YOU ARE - USING. + at least for PAL-BG. Other TV norms need other code ... + FOR ANY REPORTS ON THIS PLEASE MENTION THE TV NORM YOU ARE + USING. - Most tuner chips do provide mono sound, which may or may not be useable depending on the board design. With the Hauppauge cards it works, so there is mono sound available as fallback. diff --git a/Documentation/video4linux/bttv/Cards b/Documentation/video4linux/bttv/Cards index 8f1941ede4da..d3389655ad96 100644 --- a/Documentation/video4linux/bttv/Cards +++ b/Documentation/video4linux/bttv/Cards @@ -149,11 +149,11 @@ Lifeview Flyvideo Series: 2) There is a print on the PCB: LR25 = Flyvideo (Zoran ZR36120, SAA7110A) LR26 Rev.N = Flyvideo II (Bt848) - Rev.O = Flyvideo II (Bt878) + Rev.O = Flyvideo II (Bt878) LR37 Rev.C = Flyvideo EZ (Capture only, ZR36120 + SAA7110) LR38 Rev.A1= Flyvideo II EZ (Bt848 capture only) LR50 Rev.Q = Flyvideo 98 (w/eeprom and PCI subsystem ID) - Rev.W = Flyvideo 98 (no eeprom) + Rev.W = Flyvideo 98 (no eeprom) LR51 Rev.E = Flyvideo 98 EZ (capture only) LR90 = Flyvideo 2000 (Bt878) Flyvideo 2000S (Bt878) w/Stereo TV (Package incl. LR91 daughterboard) @@ -163,7 +163,7 @@ Lifeview Flyvideo Series: LR136 = Flyvideo 2100/3100 (Low profile, SAA7130/SAA7134) LR137 = Flyvideo DV2000/DV3000 (SAA7130/SAA7134 + IEEE1394) LR138 Rev.C= Flyvideo 2000 (SAA7130) - or Flyvideo 3000 (SAA7134) w/Stereo TV + or Flyvideo 3000 (SAA7134) w/Stereo TV These exist in variations w/FM and w/Remote sometimes denoted by suffixes "FM" and "R". 3) You have a laptop (miniPCI card): @@ -197,7 +197,7 @@ Typhoon TV card series: 50680 "TV Tuner Pal BG" (blue package)= Pixelview PV-BT878P+ (Rev 9B) 50681 "TV Tuner PCI Pal I" (variant of 50680) 50682 "TView TV/FM Tuner Pal BG" = Flyvideo 98FM (LR50 Rev.Q) - Note: The package has a picture of CPH05x (which would be a real TView) + Note: The package has a picture of CPH05x (which would be a real TView) 50683 "TV Tuner PCI SECAM" (variant of 50680) 50684 "TV Tuner Pal BG" = Pixelview 878TV(Rev.3D) 50686 "TV Tuner" = KNC1 TV Station @@ -418,9 +418,9 @@ Lifetec/Medion/Tevion/Aldi -------------------------- LT9306/MD9306 = CPH061 LT9415/MD9415 = LR90 Rev.F or Rev.G - MD9592 = Avermedia TVphone98 (PCI_ID=1461:0003), PCB-Rev=M168II-B (w/TDA9873H) - MD9717 = KNC One (Rev D4, saa7134, FM1216 MK2 tuner) - MD5044 = KNC One (Rev D4, saa7134, FM1216ME MK3 tuner) + MD9592 = Avermedia TVphone98 (PCI_ID=1461:0003), PCB-Rev=M168II-B (w/TDA9873H) + MD9717 = KNC One (Rev D4, saa7134, FM1216 MK2 tuner) + MD5044 = KNC One (Rev D4, saa7134, FM1216ME MK3 tuner) Modular Technologies (www.modulartech.com) UK --------------------------------------------- @@ -453,10 +453,10 @@ Technisat Discos ADR PC-Karte ISA (no TV!) Discos ADR PC-Karte PCI (probably no TV?) Techni-PC-Sat (Sat. analog) - Rev 1.2 (zr36120, vpx3220, stv0030, saa5246, BSJE3-494A) + Rev 1.2 (zr36120, vpx3220, stv0030, saa5246, BSJE3-494A) Mediafocus I (zr36120/zr36125, drp3510, Sat. analog + ADR Radio) Mediafocus II (saa7146, Sat. analog) - SatADR Rev 2.1 (saa7146a, saa7113h, stv0056a, msp3400c, drp3510a, BSKE3-307A) + SatADR Rev 2.1 (saa7146a, saa7113h, stv0056a, msp3400c, drp3510a, BSKE3-307A) SkyStar 1 DVB (AV7110) = Technotrend Premium SkyStar 2 DVB (B2C2) (=Sky2PC) diff --git a/Documentation/video4linux/bttv/README b/Documentation/video4linux/bttv/README index a72f4c94fb0b..7ca2154c2bf5 100644 --- a/Documentation/video4linux/bttv/README +++ b/Documentation/video4linux/bttv/README @@ -42,9 +42,9 @@ bttv uses the PCI Subsystem ID to autodetect the card type. lspci lists the Subsystem ID in the second line, looks like this: 00:0a.0 Multimedia video controller: Brooktree Corporation Bt878 (rev 02) - Subsystem: Hauppauge computer works Inc. WinTV/GO - Flags: bus master, medium devsel, latency 32, IRQ 5 - Memory at e2000000 (32-bit, prefetchable) [size=4K] + Subsystem: Hauppauge computer works Inc. WinTV/GO + Flags: bus master, medium devsel, latency 32, IRQ 5 + Memory at e2000000 (32-bit, prefetchable) [size=4K] only bt878-based cards can have a subsystem ID (which does not mean that every card really has one). bt848 cards can't have a Subsystem diff --git a/Documentation/video4linux/bttv/Sound-FAQ b/Documentation/video4linux/bttv/Sound-FAQ index 5c9822492034..1e6328f91083 100644 --- a/Documentation/video4linux/bttv/Sound-FAQ +++ b/Documentation/video4linux/bttv/Sound-FAQ @@ -61,8 +61,8 @@ line for your board. The important fields are these two: struct tvcard { [ ... ] - u32 gpiomask; - u32 audiomux[6]; /* Tuner, Radio, external, internal, mute, stereo */ + u32 gpiomask; + u32 audiomux[6]; /* Tuner, Radio, external, internal, mute, stereo */ }; gpiomask specifies which pins are used to control the audio mux chip. @@ -126,7 +126,7 @@ muxsel - video mux, input->registervalue mapping pll - same as pll= insmod option tuner_type - same as tuner= insmod option *_modulename - hint whenever some card needs this or that audio - module loaded to work properly. + module loaded to work properly. has_radio - whenever this TV card has a radio tuner. no_msp34xx - "1" disables loading of msp3400.o module no_tda9875 - "1" disables loading of tda9875.o module diff --git a/Documentation/video4linux/lifeview.txt b/Documentation/video4linux/lifeview.txt index b07ea79c2b7e..f66320bd7b67 100644 --- a/Documentation/video4linux/lifeview.txt +++ b/Documentation/video4linux/lifeview.txt @@ -10,33 +10,33 @@ bt878: ------------------------------------------------------------------------------ saa7134: - /* LifeView FlyTV Platinum FM (LR214WF) */ - /* "Peter Missel */ - .name = "LifeView FlyTV Platinum FM", - /* GP27 MDT2005 PB4 pin 10 */ - /* GP26 MDT2005 PB3 pin 9 */ - /* GP25 MDT2005 PB2 pin 8 */ - /* GP23 MDT2005 PB1 pin 7 */ - /* GP22 MDT2005 PB0 pin 6 */ - /* GP21 MDT2005 PB5 pin 11 */ - /* GP20 MDT2005 PB6 pin 12 */ - /* GP19 MDT2005 PB7 pin 13 */ - /* nc MDT2005 PA3 pin 2 */ - /* Remote MDT2005 PA2 pin 1 */ - /* GP18 MDT2005 PA1 pin 18 */ - /* nc MDT2005 PA0 pin 17 strap low */ + /* LifeView FlyTV Platinum FM (LR214WF) */ + /* "Peter Missel */ + .name = "LifeView FlyTV Platinum FM", + /* GP27 MDT2005 PB4 pin 10 */ + /* GP26 MDT2005 PB3 pin 9 */ + /* GP25 MDT2005 PB2 pin 8 */ + /* GP23 MDT2005 PB1 pin 7 */ + /* GP22 MDT2005 PB0 pin 6 */ + /* GP21 MDT2005 PB5 pin 11 */ + /* GP20 MDT2005 PB6 pin 12 */ + /* GP19 MDT2005 PB7 pin 13 */ + /* nc MDT2005 PA3 pin 2 */ + /* Remote MDT2005 PA2 pin 1 */ + /* GP18 MDT2005 PA1 pin 18 */ + /* nc MDT2005 PA0 pin 17 strap low */ - /* GP17 Strap "GP7"=High */ - /* GP16 Strap "GP6"=High - 0=Radio 1=TV - Drives SA630D ENCH1 and HEF4052 A1 pins - to do FM radio through SIF input */ - /* GP15 nc */ - /* GP14 nc */ - /* GP13 nc */ - /* GP12 Strap "GP5" = High */ - /* GP11 Strap "GP4" = High */ - /* GP10 Strap "GP3" = High */ - /* GP09 Strap "GP2" = Low */ - /* GP08 Strap "GP1" = Low */ - /* GP07.00 nc */ + /* GP17 Strap "GP7"=High */ + /* GP16 Strap "GP6"=High + 0=Radio 1=TV + Drives SA630D ENCH1 and HEF4052 A1 pins + to do FM radio through SIF input */ + /* GP15 nc */ + /* GP14 nc */ + /* GP13 nc */ + /* GP12 Strap "GP5" = High */ + /* GP11 Strap "GP4" = High */ + /* GP10 Strap "GP3" = High */ + /* GP09 Strap "GP2" = Low */ + /* GP08 Strap "GP1" = Low */ + /* GP07.00 nc */ diff --git a/drivers/media/common/ir-common.c b/drivers/media/common/ir-common.c index 31fccb4f05d6..4b71fd6f7aed 100644 --- a/drivers/media/common/ir-common.c +++ b/drivers/media/common/ir-common.c @@ -116,7 +116,7 @@ IR_KEYTAB_TYPE ir_codes_winfast[IR_KEYTAB_SIZE] = { [ 46 ] = KEY_BLUE, [ 24 ] = KEY_KPPLUS, /* fine tune + */ [ 25 ] = KEY_KPMINUS, /* fine tune - */ - [ 33 ] = KEY_KPDOT, + [ 33 ] = KEY_KPDOT, [ 19 ] = KEY_KPENTER, [ 34 ] = KEY_BACK, [ 35 ] = KEY_PLAYPAUSE, @@ -239,7 +239,7 @@ static void ir_input_key_event(struct input_dev *dev, struct ir_input_state *ir) dprintk(1,"%s: key event code=%d down=%d\n", dev->name,ir->keycode,ir->keypressed); input_report_key(dev,ir->keycode,ir->keypressed); - input_sync(dev); + input_sync(dev); } /* -------------------------------------------------------------------------- */ diff --git a/drivers/media/video/bt832.c b/drivers/media/video/bt832.c index 76c1b63ebdf2..3e42493a4e0a 100644 --- a/drivers/media/video/bt832.c +++ b/drivers/media/video/bt832.c @@ -54,36 +54,36 @@ static struct i2c_driver driver; static struct i2c_client client_template; struct bt832 { - struct i2c_client client; + struct i2c_client client; }; int bt832_hexdump(struct i2c_client *i2c_client_s, unsigned char *buf) { int i,rc; buf[0]=0x80; // start at register 0 with auto-increment - if (1 != (rc = i2c_master_send(i2c_client_s,buf,1))) - printk("bt832: i2c i/o error: rc == %d (should be 1)\n",rc); + if (1 != (rc = i2c_master_send(i2c_client_s,buf,1))) + printk("bt832: i2c i/o error: rc == %d (should be 1)\n",rc); - for(i=0;i<65;i++) - buf[i]=0; - if (65 != (rc=i2c_master_recv(i2c_client_s,buf,65))) - printk("bt832: i2c i/o error: rc == %d (should be 65)\n",rc); + for(i=0;i<65;i++) + buf[i]=0; + if (65 != (rc=i2c_master_recv(i2c_client_s,buf,65))) + printk("bt832: i2c i/o error: rc == %d (should be 65)\n",rc); - // Note: On READ the first byte is the current index - // (e.g. 0x80, what we just wrote) + // Note: On READ the first byte is the current index + // (e.g. 0x80, what we just wrote) - if(1) { - int i; - printk("BT832 hexdump:\n"); - for(i=1;i<65;i++) { + if(1) { + int i; + printk("BT832 hexdump:\n"); + for(i=1;i<65;i++) { if(i!=1) { if(((i-1)%8)==0) printk(" "); - if(((i-1)%16)==0) printk("\n"); + if(((i-1)%16)==0) printk("\n"); } - printk(" %02x",buf[i]); - } - printk("\n"); - } + printk(" %02x",buf[i]); + } + printk("\n"); + } return 0; } @@ -102,13 +102,13 @@ int bt832_init(struct i2c_client *i2c_client_s) return 0; } - printk("Write 0 tp VPSTATUS\n"); - buf[0]=BT832_VP_STATUS; // Reg.52 - buf[1]= 0x00; - if (2 != (rc = i2c_master_send(i2c_client_s,buf,2))) - printk("bt832: i2c i/o error VPS: rc == %d (should be 2)\n",rc); + printk("Write 0 tp VPSTATUS\n"); + buf[0]=BT832_VP_STATUS; // Reg.52 + buf[1]= 0x00; + if (2 != (rc = i2c_master_send(i2c_client_s,buf,2))) + printk("bt832: i2c i/o error VPS: rc == %d (should be 2)\n",rc); - bt832_hexdump(i2c_client_s,buf); + bt832_hexdump(i2c_client_s,buf); // Leave low power mode: @@ -116,17 +116,17 @@ int bt832_init(struct i2c_client *i2c_client_s) buf[0]=BT832_CAM_SETUP0; //0x39 57 buf[1]=0x08; if (2 != (rc = i2c_master_send(i2c_client_s,buf,2))) - printk("bt832: i2c i/o error LLPM: rc == %d (should be 2)\n",rc); + printk("bt832: i2c i/o error LLPM: rc == %d (should be 2)\n",rc); - bt832_hexdump(i2c_client_s,buf); + bt832_hexdump(i2c_client_s,buf); printk("Write 0 tp VPSTATUS\n"); - buf[0]=BT832_VP_STATUS; // Reg.52 - buf[1]= 0x00; - if (2 != (rc = i2c_master_send(i2c_client_s,buf,2))) - printk("bt832: i2c i/o error VPS: rc == %d (should be 2)\n",rc); + buf[0]=BT832_VP_STATUS; // Reg.52 + buf[1]= 0x00; + if (2 != (rc = i2c_master_send(i2c_client_s,buf,2))) + printk("bt832: i2c i/o error VPS: rc == %d (should be 2)\n",rc); - bt832_hexdump(i2c_client_s,buf); + bt832_hexdump(i2c_client_s,buf); // Enable Output @@ -134,22 +134,22 @@ int bt832_init(struct i2c_client *i2c_client_s) buf[0]=BT832_VP_CONTROL1; // Reg.40 buf[1]= 0x27 & (~0x01); // Default | !skip if (2 != (rc = i2c_master_send(i2c_client_s,buf,2))) - printk("bt832: i2c i/o error EO: rc == %d (should be 2)\n",rc); + printk("bt832: i2c i/o error EO: rc == %d (should be 2)\n",rc); - bt832_hexdump(i2c_client_s,buf); + bt832_hexdump(i2c_client_s,buf); // for testing (even works when no camera attached) printk("bt832: *** Generate NTSC M Bars *****\n"); buf[0]=BT832_VP_TESTCONTROL0; // Reg. 42 buf[1]=3; // Generate NTSC System M bars, Generate Frame timing internally - if (2 != (rc = i2c_master_send(i2c_client_s,buf,2))) - printk("bt832: i2c i/o error MBAR: rc == %d (should be 2)\n",rc); + if (2 != (rc = i2c_master_send(i2c_client_s,buf,2))) + printk("bt832: i2c i/o error MBAR: rc == %d (should be 2)\n",rc); printk("Bt832: Camera Present: %s\n", (buf[1+BT832_CAM_STATUS] & BT832_56_CAMERA_PRESENT) ? "yes":"no"); - bt832_hexdump(i2c_client_s,buf); + bt832_hexdump(i2c_client_s,buf); kfree(buf); return 1; } @@ -162,17 +162,17 @@ static int bt832_attach(struct i2c_adapter *adap, int addr, int kind) printk("bt832_attach\n"); - client_template.adapter = adap; - client_template.addr = addr; + client_template.adapter = adap; + client_template.addr = addr; - printk("bt832: chip found @ 0x%x\n", addr<<1); + printk("bt832: chip found @ 0x%x\n", addr<<1); - if (NULL == (t = kmalloc(sizeof(*t), GFP_KERNEL))) - return -ENOMEM; + if (NULL == (t = kmalloc(sizeof(*t), GFP_KERNEL))) + return -ENOMEM; memset(t,0,sizeof(*t)); t->client = client_template; - i2c_set_clientdata(&t->client, t); - i2c_attach_client(&t->client); + i2c_set_clientdata(&t->client, t); + i2c_attach_client(&t->client); if(! bt832_init(&t->client)) { bt832_detach(&t->client); @@ -211,7 +211,7 @@ bt832_command(struct i2c_client *client, unsigned int cmd, void *arg) printk("bt832: command %x\n",cmd); - switch (cmd) { + switch (cmd) { case BT832_HEXDUMP: { unsigned char *buf; buf=kmalloc(65,GFP_KERNEL); diff --git a/drivers/media/video/bt832.h b/drivers/media/video/bt832.h index 9b6a8d2c96b5..1ce8fa71f7db 100644 --- a/drivers/media/video/bt832.h +++ b/drivers/media/video/bt832.h @@ -233,8 +233,8 @@ SetInterlaceMode( spec.interlace ); /* from web: Video Sampling Digital video is a sampled form of analog video. The most common sampling schemes in use today are: - Pixel Clock Horiz Horiz Vert - Rate Total Active + Pixel Clock Horiz Horiz Vert + Rate Total Active NTSC square pixel 12.27 MHz 780 640 525 NTSC CCIR-601 13.5 MHz 858 720 525 NTSC 4FSc 14.32 MHz 910 768 525 diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bttv-cards.c index 3937da065e4f..92bb515fbe4d 100644 --- a/drivers/media/video/bttv-cards.c +++ b/drivers/media/video/bttv-cards.c @@ -6,7 +6,7 @@ like the big tvcards array for the most part Copyright (C) 1996,97,98 Ralph Metzler (rjkm@thp.uni-koeln.de) - & Marcus Metzler (mocm@thp.uni-koeln.de) + & Marcus Metzler (mocm@thp.uni-koeln.de) (c) 1999-2001 Gerd Knorr This program is free software; you can redistribute it and/or modify @@ -163,10 +163,10 @@ static struct CARD { { 0x6609107d, BTTV_BOARD_WINFAST2000, "Leadtek TV 2000 XP" }, { 0x263610b4, BTTV_BOARD_STB2, "STB TV PCI FM, Gateway P/N 6000704" }, { 0x264510b4, BTTV_BOARD_STB2, "STB TV PCI FM, Gateway P/N 6000704" }, - { 0x402010fc, BTTV_BOARD_GVBCTV3PCI, "I-O Data Co. GV-BCTV3/PCI" }, + { 0x402010fc, BTTV_BOARD_GVBCTV3PCI, "I-O Data Co. GV-BCTV3/PCI" }, { 0x405010fc, BTTV_BOARD_GVBCTV4PCI, "I-O Data Co. GV-BCTV4/PCI" }, { 0x407010fc, BTTV_BOARD_GVBCTV5PCI, "I-O Data Co. GV-BCTV5/PCI" }, - { 0xd01810fc, BTTV_BOARD_GVBCTV5PCI, "I-O Data Co. GV-BCTV5/PCI" }, + { 0xd01810fc, BTTV_BOARD_GVBCTV5PCI, "I-O Data Co. GV-BCTV5/PCI" }, { 0x001211bd, BTTV_BOARD_PINNACLE, "Pinnacle PCTV" }, /* some cards ship with byteswapped IDs ... */ @@ -277,7 +277,7 @@ static struct CARD { { 0x20007063, BTTV_BOARD_PC_HDTV, "pcHDTV HD-2000 TV"}, { 0x82b2aa6a, BTTV_BOARD_SIMUS_GVC1100, "SIMUS GVC1100" }, { 0x146caa0c, BTTV_BOARD_PV951, "ituner spectra8" }, - { 0x200a1295, BTTV_BOARD_PXC200, "ImageNation PXC200A" }, + { 0x200a1295, BTTV_BOARD_PXC200, "ImageNation PXC200A" }, { 0x40111554, BTTV_BOARD_PV_BT878P_9B, "Prolink Pixelview PV-BT" }, { 0x17de0a01, BTTV_BOARD_KWORLD, "Mecer TV/FM/Video Tuner" }, @@ -1346,17 +1346,17 @@ struct tvcard bttv_tvcards[] = { }, [BTTV_BOARD_GMV1] = { /* Adrian Cox c.type = type; @@ -2929,7 +2929,7 @@ static void flyvideo_gpio(struct bttv *btv) switch(ttype) { case 0x0: tuner=2; /* NTSC, e.g. TPI8NSR11P */ break; - case 0x2: tuner=39;/* LG NTSC (newer TAPC series) TAPC-H701P */ + case 0x2: tuner=39;/* LG NTSC (newer TAPC series) TAPC-H701P */ break; case 0x4: tuner=5; /* Philips PAL TPI8PSB02P, TPI8PSB12P, TPI8PSB12D or FI1216, FM1216 */ break; @@ -2945,7 +2945,7 @@ static void flyvideo_gpio(struct bttv *btv) has_radio = gpio & 0x400000; /* unknown 0x200000; * unknown2 0x100000; */ - is_capture_only = !(gpio & 0x008000); /* GPIO15 */ + is_capture_only = !(gpio & 0x008000); /* GPIO15 */ has_tda9820_tda9821 = !(gpio & 0x004000); is_lr90 = !(gpio & 0x002000); /* else LR26/LR50 (LR38/LR51 f. capture only) */ /* @@ -2982,7 +2982,7 @@ static void miro_pinnacle_gpio(struct bttv *btv) char *info; gpio_inout(0xffffff, 0); - gpio = gpio_read(); + gpio = gpio_read(); id = ((gpio>>10) & 63) -1; msp = bttv_I2CRead(btv, I2C_MSP3400, "MSP34xx"); if (id < 32) { @@ -3093,7 +3093,7 @@ static void eagle_muxsel(struct bttv *btv, unsigned int input) static void gvc1100_muxsel(struct bttv *btv, unsigned int input) { - static const int masks[] = {0x30, 0x01, 0x12, 0x23}; + static const int masks[] = {0x30, 0x01, 0x12, 0x23}; gpio_write(masks[input%4]); } @@ -3161,10 +3161,10 @@ void __devinit bttv_init_card1(struct bttv *btv) switch (btv->c.type) { case BTTV_BOARD_HAUPPAUGE: case BTTV_BOARD_HAUPPAUGE878: - boot_msp34xx(btv,5); + boot_msp34xx(btv,5); break; case BTTV_BOARD_VOODOOTV_FM: - boot_msp34xx(btv,20); + boot_msp34xx(btv,20); break; case BTTV_BOARD_AVERMEDIA98: boot_msp34xx(btv,11); @@ -3192,7 +3192,7 @@ void __devinit bttv_init_card2(struct bttv *btv) int tda9887; int addr=ADDR_UNSET, radio_addr=ADDR_UNSET; - btv->tuner_type = -1; + btv->tuner_type = -1; if (BTTV_BOARD_UNKNOWN == btv->c.type) { bttv_readee(btv,eeprom_data,0xa0); @@ -3225,7 +3225,7 @@ void __devinit bttv_init_card2(struct bttv *btv) case BTTV_BOARD_HAUPPAUGEPVR: /* pick up some config infos from the eeprom */ bttv_readee(btv,eeprom_data,0xa0); - hauppauge_eeprom(btv); + hauppauge_eeprom(btv); break; case BTTV_BOARD_AVERMEDIA98: case BTTV_BOARD_AVPHONE98: @@ -3258,7 +3258,7 @@ void __devinit bttv_init_card2(struct bttv *btv) } break; case BTTV_BOARD_STB2: - if (btv->cardid == 0x3060121a) { + if (btv->cardid == 0x3060121a) { /* Fix up entry for 3DFX VoodooTV 100, which is an OEM STB card variant. */ btv->has_radio=0; @@ -3277,7 +3277,7 @@ void __devinit bttv_init_card2(struct bttv *btv) case BTTV_BOARD_OSPREY540: case BTTV_BOARD_OSPREY2000: bttv_readee(btv,eeprom_data,0xa0); - osprey_eeprom(btv); + osprey_eeprom(btv); break; case BTTV_BOARD_IDS_EAGLE: init_ids_eagle(btv); @@ -3298,7 +3298,7 @@ void __devinit bttv_init_card2(struct bttv *btv) } /* pll configuration */ - if (!(btv->id==848 && btv->revision==0x11)) { + if (!(btv->id==848 && btv->revision==0x11)) { /* defaults from card list */ if (PLL_28 == bttv_tvcards[btv->c.type].pll) { btv->pll.pll_ifreq=28636363; @@ -3309,26 +3309,26 @@ void __devinit bttv_init_card2(struct bttv *btv) btv->pll.pll_crystal=BT848_IFORM_XT1; } /* insmod options can override */ - switch (pll[btv->c.nr]) { - case 0: /* none */ + switch (pll[btv->c.nr]) { + case 0: /* none */ btv->pll.pll_crystal = 0; btv->pll.pll_ifreq = 0; btv->pll.pll_ofreq = 0; - break; - case 1: /* 28 MHz */ + break; + case 1: /* 28 MHz */ case 28: - btv->pll.pll_ifreq = 28636363; + btv->pll.pll_ifreq = 28636363; btv->pll.pll_ofreq = 0; - btv->pll.pll_crystal = BT848_IFORM_XT0; - break; - case 2: /* 35 MHz */ + btv->pll.pll_crystal = BT848_IFORM_XT0; + break; + case 2: /* 35 MHz */ case 35: - btv->pll.pll_ifreq = 35468950; + btv->pll.pll_ifreq = 35468950; btv->pll.pll_ofreq = 0; - btv->pll.pll_crystal = BT848_IFORM_XT1; - break; - } - } + btv->pll.pll_crystal = BT848_IFORM_XT1; + break; + } + } btv->pll.pll_current = -1; /* tuner configuration (from card list / autodetect / insmod option) */ @@ -3340,7 +3340,7 @@ void __devinit bttv_init_card2(struct bttv *btv) if (UNSET != bttv_tvcards[btv->c.type].tuner_type) if(UNSET == btv->tuner_type) - btv->tuner_type = bttv_tvcards[btv->c.type].tuner_type; + btv->tuner_type = bttv_tvcards[btv->c.type].tuner_type; if (UNSET != tuner[btv->c.nr]) btv->tuner_type = tuner[btv->c.nr]; printk("bttv%d: using tuner=%d\n",btv->c.nr,btv->tuner_type); @@ -3348,14 +3348,14 @@ void __devinit bttv_init_card2(struct bttv *btv) bttv_call_i2c_clients(btv, AUDC_CONFIG_PINNACLE, &btv->pinnacle_id); if (btv->tuner_type != UNSET) { - struct tuner_setup tun_setup; + struct tuner_setup tun_setup; - tun_setup.mode_mask = T_ANALOG_TV | T_DIGITAL_TV; + tun_setup.mode_mask = T_ANALOG_TV | T_DIGITAL_TV; tun_setup.type = btv->tuner_type; tun_setup.addr = addr; if (addr == radio_addr) - tun_setup.mode_mask = T_RADIO; + tun_setup.mode_mask = T_RADIO; bttv_call_i2c_clients(btv, TUNER_SET_TYPE_ADDR, &tun_setup); } @@ -3433,11 +3433,11 @@ static void modtec_eeprom(struct bttv *btv) } else if (strncmp(&(eeprom_data[0x1e]),"Alps TSBB5",10) ==0) { btv->tuner_type=TUNER_ALPS_TSBB5_PAL_I; printk("bttv%d: Modtec: Tuner autodetected by eeprom: %s\n", - btv->c.nr,&eeprom_data[0x1e]); - } else if (strncmp(&(eeprom_data[0x1e]),"Philips FM1246",14) ==0) { - btv->tuner_type=TUNER_PHILIPS_NTSC; - printk("bttv%d: Modtec: Tuner autodetected by eeprom: %s\n", - btv->c.nr,&eeprom_data[0x1e]); + btv->c.nr,&eeprom_data[0x1e]); + } else if (strncmp(&(eeprom_data[0x1e]),"Philips FM1246",14) ==0) { + btv->tuner_type=TUNER_PHILIPS_NTSC; + printk("bttv%d: Modtec: Tuner autodetected by eeprom: %s\n", + btv->c.nr,&eeprom_data[0x1e]); } else { printk("bttv%d: Modtec: Unknown TunerString: %s\n", btv->c.nr,&eeprom_data[0x1e]); @@ -3502,7 +3502,7 @@ static int terratec_active_radio_upgrade(struct bttv *btv) static int __devinit pvr_altera_load(struct bttv *btv, u8 *micro, u32 microlen) { u32 n; - u8 bits; + u8 bits; int i; gpio_inout(0xffffff,BTTV_ALT_DATA|BTTV_ALT_DCLK|BTTV_ALT_NCONFIG); @@ -3538,19 +3538,19 @@ static int __devinit pvr_altera_load(struct bttv *btv, u8 *micro, u32 microlen) static int __devinit pvr_boot(struct bttv *btv) { - const struct firmware *fw_entry; + const struct firmware *fw_entry; int rc; rc = request_firmware(&fw_entry, "hcwamc.rbf", &btv->c.pci->dev); if (rc != 0) { printk(KERN_WARNING "bttv%d: no altera firmware [via hotplug]\n", btv->c.nr); - return rc; - } + return rc; + } rc = pvr_altera_load(btv, fw_entry->data, fw_entry->size); printk(KERN_INFO "bttv%d: altera firmware upload %s\n", btv->c.nr, (rc < 0) ? "failed" : "ok"); - release_firmware(fw_entry); + release_firmware(fw_entry); return rc; } @@ -3564,33 +3564,33 @@ static void __devinit osprey_eeprom(struct bttv *btv) unsigned long serial = 0; if (btv->c.type == 0) { - /* this might be an antique... check for MMAC label in eeprom */ - if ((ee[0]=='M') && (ee[1]=='M') && (ee[2]=='A') && (ee[3]=='C')) { - unsigned char checksum = 0; - for (i =0; i<21; i++) + /* this might be an antique... check for MMAC label in eeprom */ + if ((ee[0]=='M') && (ee[1]=='M') && (ee[2]=='A') && (ee[3]=='C')) { + unsigned char checksum = 0; + for (i =0; i<21; i++) checksum += ee[i]; - if (checksum != ee[21]) + if (checksum != ee[21]) return; btv->c.type = BTTV_BOARD_OSPREY1x0_848; for (i = 12; i < 21; i++) serial *= 10, serial += ee[i] - '0'; - } + } } else { unsigned short type; - int offset = 4*16; - - for(; offset < 8*16; offset += 16) { - unsigned short checksum = 0; - /* verify the checksum */ - for(i = 0; i<14; i++) checksum += ee[i+offset]; - checksum = ~checksum; /* no idea why */ - if ((((checksum>>8)&0x0FF) == ee[offset+14]) && - ((checksum & 0x0FF) == ee[offset+15])) { - break; - } - } - - if (offset >= 8*16) + int offset = 4*16; + + for(; offset < 8*16; offset += 16) { + unsigned short checksum = 0; + /* verify the checksum */ + for(i = 0; i<14; i++) checksum += ee[i+offset]; + checksum = ~checksum; /* no idea why */ + if ((((checksum>>8)&0x0FF) == ee[offset+14]) && + ((checksum & 0x0FF) == ee[offset+15])) { + break; + } + } + + if (offset >= 8*16) return; /* found a valid descriptor */ @@ -3606,7 +3606,7 @@ static void __devinit osprey_eeprom(struct bttv *btv) btv->c.type = BTTV_BOARD_OSPREY101_848; break; - /* 878 based */ + /* 878 based */ case 0x0012: case 0x0013: btv->c.type = BTTV_BOARD_OSPREY1x0; @@ -3662,27 +3662,27 @@ static void __devinit osprey_eeprom(struct bttv *btv) /* AVermedia specific stuff, from bktr_card.c */ static int tuner_0_table[] = { - TUNER_PHILIPS_NTSC, TUNER_PHILIPS_PAL /* PAL-BG*/, - TUNER_PHILIPS_PAL, TUNER_PHILIPS_PAL /* PAL-I*/, - TUNER_PHILIPS_PAL, TUNER_PHILIPS_PAL, - TUNER_PHILIPS_SECAM, TUNER_PHILIPS_SECAM, - TUNER_PHILIPS_SECAM, TUNER_PHILIPS_PAL, + TUNER_PHILIPS_NTSC, TUNER_PHILIPS_PAL /* PAL-BG*/, + TUNER_PHILIPS_PAL, TUNER_PHILIPS_PAL /* PAL-I*/, + TUNER_PHILIPS_PAL, TUNER_PHILIPS_PAL, + TUNER_PHILIPS_SECAM, TUNER_PHILIPS_SECAM, + TUNER_PHILIPS_SECAM, TUNER_PHILIPS_PAL, TUNER_PHILIPS_FM1216ME_MK3 }; static int tuner_1_table[] = { - TUNER_TEMIC_NTSC, TUNER_TEMIC_PAL, + TUNER_TEMIC_NTSC, TUNER_TEMIC_PAL, TUNER_TEMIC_PAL, TUNER_TEMIC_PAL, TUNER_TEMIC_PAL, TUNER_TEMIC_PAL, - TUNER_TEMIC_4012FY5, TUNER_TEMIC_4012FY5, /* TUNER_TEMIC_SECAM */ - TUNER_TEMIC_4012FY5, TUNER_TEMIC_PAL}; + TUNER_TEMIC_4012FY5, TUNER_TEMIC_4012FY5, /* TUNER_TEMIC_SECAM */ + TUNER_TEMIC_4012FY5, TUNER_TEMIC_PAL}; static void __devinit avermedia_eeprom(struct bttv *btv) { - int tuner_make,tuner_tv_fm,tuner_format,tuner=0; + int tuner_make,tuner_tv_fm,tuner_format,tuner=0; tuner_make = (eeprom_data[0x41] & 0x7); - tuner_tv_fm = (eeprom_data[0x41] & 0x18) >> 3; - tuner_format = (eeprom_data[0x42] & 0xf0) >> 4; + tuner_tv_fm = (eeprom_data[0x41] & 0x18) >> 3; + tuner_format = (eeprom_data[0x42] & 0xf0) >> 4; btv->has_remote = (eeprom_data[0x42] & 0x01); if (tuner_make == 0 || tuner_make == 2) @@ -3718,8 +3718,8 @@ void bttv_tda9880_setnorm(struct bttv *btv, int norm) dprintk("bttv_tda9880_setnorm to NTSC\n"); } else { - bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].audiomux[0]=0x947fff; - bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].audiomux[4]=0x947fff; + bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].audiomux[0]=0x947fff; + bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].audiomux[4]=0x947fff; dprintk("bttv_tda9880_setnorm to PAL\n"); } /* set GPIO according */ @@ -3741,7 +3741,7 @@ static void __devinit boot_msp34xx(struct bttv *btv, int pin) gpio_inout(mask,mask); gpio_bits(mask,0); - udelay(2500); + udelay(2500); gpio_bits(mask,mask); if (bttv_gpio) @@ -3817,7 +3817,7 @@ static void __devinit init_PXC200(struct bttv *btv) udelay(10); gpio_write(1<<2); - for (i = 0; i < ARRAY_SIZE(vals); i++) { + for (i = 0; i < ARRAY_SIZE(vals); i++) { tmp=bttv_I2CWrite(btv,0x1E,0,vals[i],1); if (tmp != -1) { printk(KERN_INFO @@ -4260,30 +4260,30 @@ avermedia_tv_stereo_audio(struct bttv *btv, struct video_audio *v, int set) static void lt9415_audio(struct bttv *btv, struct video_audio *v, int set) { - int val = 0; + int val = 0; - if (gpio_read() & 0x4000) { + if (gpio_read() & 0x4000) { v->mode = VIDEO_SOUND_MONO; return; } - if (set) { - if (v->mode & VIDEO_SOUND_LANG2) /* A2 SAP */ - val = 0x0080; + if (set) { + if (v->mode & VIDEO_SOUND_LANG2) /* A2 SAP */ + val = 0x0080; if (v->mode & VIDEO_SOUND_STEREO) /* A2 stereo */ - val = 0x0880; - if ((v->mode & VIDEO_SOUND_LANG1) || + val = 0x0880; + if ((v->mode & VIDEO_SOUND_LANG1) || (v->mode & VIDEO_SOUND_MONO)) val = 0; gpio_bits(0x0880, val); - if (bttv_gpio) - bttv_gpio_tracking(btv,"lt9415"); - } else { + if (bttv_gpio) + bttv_gpio_tracking(btv,"lt9415"); + } else { /* autodetect doesn't work with this card :-( */ - v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | + v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; - return; - } + return; + } } /* TDA9821 on TerraTV+ Bt848, Bt878 */ @@ -4406,26 +4406,26 @@ fv2000s_audio(struct bttv *btv, struct video_audio *v, int set) static void windvr_audio(struct bttv *btv, struct video_audio *v, int set) { - unsigned long val = 0; - - if (set) { - if (v->mode & VIDEO_SOUND_MONO) - val = 0x040000; - if (v->mode & VIDEO_SOUND_LANG1) - val = 0; - if (v->mode & VIDEO_SOUND_LANG2) - val = 0x100000; - if (v->mode & VIDEO_SOUND_STEREO) - val = 0; - if (val) { + unsigned long val = 0; + + if (set) { + if (v->mode & VIDEO_SOUND_MONO) + val = 0x040000; + if (v->mode & VIDEO_SOUND_LANG1) + val = 0; + if (v->mode & VIDEO_SOUND_LANG2) + val = 0x100000; + if (v->mode & VIDEO_SOUND_STEREO) + val = 0; + if (val) { gpio_bits(0x140000, val); - if (bttv_gpio) - bttv_gpio_tracking(btv,"windvr"); - } - } else { - v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | - VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; - } + if (bttv_gpio) + bttv_gpio_tracking(btv,"windvr"); + } + } else { + v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | + VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; + } } /* @@ -4668,10 +4668,10 @@ static void kodicom4400r_init(struct bttv *btv) static void xguard_muxsel(struct bttv *btv, unsigned int input) { static const int masks[] = { - ENB0, ENB0|IN00, ENB0|IN10, ENB0|IN00|IN10, - ENA0, ENA0|IN00, ENA0|IN10, ENA0|IN00|IN10, - ENB1, ENB1|IN01, ENB1|IN11, ENB1|IN01|IN11, - ENA1, ENA1|IN01, ENA1|IN11, ENA1|IN01|IN11, + ENB0, ENB0|IN00, ENB0|IN10, ENB0|IN00|IN10, + ENA0, ENA0|IN00, ENA0|IN10, ENA0|IN00|IN10, + ENB1, ENB1|IN01, ENB1|IN11, ENB1|IN01|IN11, + ENA1, ENA1|IN01, ENA1|IN11, ENA1|IN01|IN11, }; gpio_write(masks[input%16]); } @@ -4776,10 +4776,10 @@ static void ivc120_muxsel(struct bttv *btv, unsigned int input) static void PXC200_muxsel(struct bttv *btv, unsigned int input) { - int rc; + int rc; long mux; int bitmask; - unsigned char buf[2]; + unsigned char buf[2]; /* Read PIC config to determine if this is a PXC200F */ /* PX_I2C_CMD_CFG*/ @@ -4809,14 +4809,14 @@ static void PXC200_muxsel(struct bttv *btv, unsigned int input) /* bitmask=0x30f; */ bitmask=0x302; /* check whether we have a PXC200A */ - if (btv->cardid == PX_PXC200A_CARDID) { + if (btv->cardid == PX_PXC200A_CARDID) { bitmask ^= 0x180; /* use 7 and 9, not 8 and 9 */ bitmask |= 7<<4; /* the DAC */ } btwrite(bitmask, BT848_GPIO_OUT_EN); bitmask = btread(BT848_GPIO_DATA); - if (btv->cardid == PX_PXC200A_CARDID) + if (btv->cardid == PX_PXC200A_CARDID) bitmask = (bitmask & ~0x280) | ((mux & 2) << 8) | ((mux & 1) << 7); else /* older device */ bitmask = (bitmask & ~0x300) | ((mux & 3) << 8); @@ -4829,7 +4829,7 @@ static void PXC200_muxsel(struct bttv *btv, unsigned int input) * * needed because bttv-driver sets mux before calling this function */ - if (btv->cardid == PX_PXC200A_CARDID) + if (btv->cardid == PX_PXC200A_CARDID) btaor(2<<5, ~BT848_IFORM_MUXSEL, BT848_IFORM); else /* older device */ btand(~BT848_IFORM_MUXSEL,BT848_IFORM); @@ -4875,7 +4875,7 @@ void __devinit bttv_check_chipset(void) printk(KERN_INFO "bttv: pci latency fixup [%d]\n",latency); while ((dev = pci_get_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82441, dev))) { - unsigned char b; + unsigned char b; pci_read_config_byte(dev, 0x53, &b); if (bttv_debug) printk(KERN_INFO "bttv: Host bridge: 82441FX Natoma, " @@ -4885,7 +4885,7 @@ void __devinit bttv_check_chipset(void) int __devinit bttv_handle_chipset(struct bttv *btv) { - unsigned char command; + unsigned char command; if (!triton1 && !vsfx && UNSET == latency) return 0; @@ -4906,13 +4906,13 @@ int __devinit bttv_handle_chipset(struct bttv *btv) btv->triton1 = BT848_INT_ETBF; } else { /* bt878 has a bit in the pci config space for it */ - pci_read_config_byte(btv->c.pci, BT878_DEVCTRL, &command); + pci_read_config_byte(btv->c.pci, BT878_DEVCTRL, &command); if (triton1) command |= BT878_EN_TBFX; if (vsfx) command |= BT878_EN_VSFX; - pci_write_config_byte(btv->c.pci, BT878_DEVCTRL, command); - } + pci_write_config_byte(btv->c.pci, BT878_DEVCTRL, command); + } if (UNSET != latency) pci_write_config_byte(btv->c.pci, PCI_LATENCY_TIMER, latency); return 0; diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c index f8307407e320..0005741d5514 100644 --- a/drivers/media/video/bttv-driver.c +++ b/drivers/media/video/bttv-driver.c @@ -3,7 +3,7 @@ bttv - Bt848 frame grabber driver Copyright (C) 1996,97,98 Ralph Metzler - & Marcus Metzler + & Marcus Metzler (c) 1999-2002 Gerd Knorr some v4l2 code lines are taken from Justin's bttv2 driver which is @@ -192,8 +192,8 @@ static u8 SRAM_Table[][60] = const struct bttv_tvnorm bttv_tvnorms[] = { /* PAL-BDGHI */ - /* max. active video is actually 922, but 924 is divisible by 4 and 3! */ - /* actually, max active PAL with HSCALE=0 is 948, NTSC is 768 - nil */ + /* max. active video is actually 922, but 924 is divisible by 4 and 3! */ + /* actually, max active PAL with HSCALE=0 is 948, NTSC is 768 - nil */ { .v4l2_id = V4L2_STD_PAL, .name = "PAL", @@ -806,9 +806,9 @@ static void bt848A_set_timing(struct bttv *btv) btv->c.nr,table_idx); /* timing change...reset timing generator address */ - btwrite(0x00, BT848_TGCTRL); - btwrite(0x02, BT848_TGCTRL); - btwrite(0x00, BT848_TGCTRL); + btwrite(0x00, BT848_TGCTRL); + btwrite(0x02, BT848_TGCTRL); + btwrite(0x00, BT848_TGCTRL); len=SRAM_Table[table_idx][0]; for(i = 1; i <= len; i++) @@ -847,7 +847,7 @@ static void bt848_hue(struct bttv *btv, int hue) /* -128 to 127 */ value = (hue >> 8) - 128; - btwrite(value & 0xff, BT848_HUE); + btwrite(value & 0xff, BT848_HUE); } static void bt848_contrast(struct bttv *btv, int cont) @@ -859,9 +859,9 @@ static void bt848_contrast(struct bttv *btv, int cont) /* 0-511 */ value = (cont >> 7); hibit = (value >> 6) & 4; - btwrite(value & 0xff, BT848_CONTRAST_LO); - btaor(hibit, ~4, BT848_E_CONTROL); - btaor(hibit, ~4, BT848_O_CONTROL); + btwrite(value & 0xff, BT848_CONTRAST_LO); + btaor(hibit, ~4, BT848_E_CONTROL); + btaor(hibit, ~4, BT848_O_CONTROL); } static void bt848_sat(struct bttv *btv, int color) @@ -873,12 +873,12 @@ static void bt848_sat(struct bttv *btv, int color) /* 0-511 for the color */ val_u = ((color * btv->opt_uv_ratio) / 50) >> 7; val_v = (((color * (100 - btv->opt_uv_ratio) / 50) >>7)*180L)/254; - hibits = (val_u >> 7) & 2; + hibits = (val_u >> 7) & 2; hibits |= (val_v >> 8) & 1; - btwrite(val_u & 0xff, BT848_SAT_U_LO); - btwrite(val_v & 0xff, BT848_SAT_V_LO); - btaor(hibits, ~3, BT848_E_CONTROL); - btaor(hibits, ~3, BT848_O_CONTROL); + btwrite(val_u & 0xff, BT848_SAT_U_LO); + btwrite(val_v & 0xff, BT848_SAT_V_LO); + btaor(hibits, ~3, BT848_E_CONTROL); + btaor(hibits, ~3, BT848_O_CONTROL); } /* ----------------------------------------------------------------------- */ @@ -891,7 +891,7 @@ video_mux(struct bttv *btv, unsigned int input) if (input >= bttv_tvcards[btv->c.type].video_inputs) return -EINVAL; - /* needed by RemoteVideo MX */ + /* needed by RemoteVideo MX */ mask2 = bttv_tvcards[btv->c.type].gpiomask2; if (mask2) gpio_inout(mask2,mask2); @@ -1055,22 +1055,22 @@ static void init_bt848(struct bttv *btv) btwrite(BT848_COLOR_CTL_GAMMA, BT848_COLOR_CTL); btwrite(BT848_IFORM_XTAUTO | BT848_IFORM_AUTO, BT848_IFORM); - /* set planar and packed mode trigger points and */ - /* set rising edge of inverted GPINTR pin as irq trigger */ - btwrite(BT848_GPIO_DMA_CTL_PKTP_32| - BT848_GPIO_DMA_CTL_PLTP1_16| - BT848_GPIO_DMA_CTL_PLTP23_16| - BT848_GPIO_DMA_CTL_GPINTC| - BT848_GPIO_DMA_CTL_GPINTI, - BT848_GPIO_DMA_CTL); + /* set planar and packed mode trigger points and */ + /* set rising edge of inverted GPINTR pin as irq trigger */ + btwrite(BT848_GPIO_DMA_CTL_PKTP_32| + BT848_GPIO_DMA_CTL_PLTP1_16| + BT848_GPIO_DMA_CTL_PLTP23_16| + BT848_GPIO_DMA_CTL_GPINTC| + BT848_GPIO_DMA_CTL_GPINTI, + BT848_GPIO_DMA_CTL); val = btv->opt_chroma_agc ? BT848_SCLOOP_CAGC : 0; - btwrite(val, BT848_E_SCLOOP); - btwrite(val, BT848_O_SCLOOP); + btwrite(val, BT848_E_SCLOOP); + btwrite(val, BT848_O_SCLOOP); - btwrite(0x20, BT848_E_VSCALE_HI); - btwrite(0x20, BT848_O_VSCALE_HI); - btwrite(BT848_ADC_RESERVED | (btv->opt_adc_crush ? BT848_ADC_CRUSH : 0), + btwrite(0x20, BT848_E_VSCALE_HI); + btwrite(0x20, BT848_O_VSCALE_HI); + btwrite(BT848_ADC_RESERVED | (btv->opt_adc_crush ? BT848_ADC_CRUSH : 0), BT848_ADC); btwrite(whitecrush_upper, BT848_WC_UP); @@ -1089,7 +1089,7 @@ static void init_bt848(struct bttv *btv) bt848_contrast(btv, btv->contrast); bt848_sat(btv, btv->saturation); - /* interrupt */ + /* interrupt */ init_irqreg(btv); } @@ -1105,7 +1105,7 @@ static void bttv_reinit_bt848(struct bttv *btv) spin_unlock_irqrestore(&btv->s_lock,flags); init_bt848(btv); - btv->pll.pll_current = -1; + btv->pll.pll_current = -1; set_input(btv,btv->input); } @@ -1398,7 +1398,7 @@ bttv_switch_overlay(struct bttv *btv, struct bttv_fh *fh, /* video4linux (1) interface */ static int bttv_prepare_buffer(struct bttv *btv, struct bttv_buffer *buf, - const struct bttv_format *fmt, + const struct bttv_format *fmt, unsigned int width, unsigned int height, enum v4l2_field field) { @@ -1521,8 +1521,8 @@ static const char *v4l1_ioctls[] = { static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) { switch (cmd) { - case BTTV_VERSION: - return BTTV_VERSION_CODE; + case BTTV_VERSION: + return BTTV_VERSION_CODE; /* *** v4l1 *** ************************************************ */ case VIDIOCGFREQ: @@ -1576,32 +1576,32 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) return 0; } - case VIDIOCGCHAN: - { - struct video_channel *v = arg; + case VIDIOCGCHAN: + { + struct video_channel *v = arg; unsigned int channel = v->channel; - if (channel >= bttv_tvcards[btv->c.type].video_inputs) - return -EINVAL; - v->tuners=0; - v->flags = VIDEO_VC_AUDIO; - v->type = VIDEO_TYPE_CAMERA; - v->norm = btv->tvnorm; + if (channel >= bttv_tvcards[btv->c.type].video_inputs) + return -EINVAL; + v->tuners=0; + v->flags = VIDEO_VC_AUDIO; + v->type = VIDEO_TYPE_CAMERA; + v->norm = btv->tvnorm; if (channel == bttv_tvcards[btv->c.type].tuner) { - strcpy(v->name,"Television"); - v->flags|=VIDEO_VC_TUNER; - v->type=VIDEO_TYPE_TV; - v->tuners=1; - } else if (channel == btv->svhs) { - strcpy(v->name,"S-Video"); - } else { - sprintf(v->name,"Composite%d",channel); + strcpy(v->name,"Television"); + v->flags|=VIDEO_VC_TUNER; + v->type=VIDEO_TYPE_TV; + v->tuners=1; + } else if (channel == btv->svhs) { + strcpy(v->name,"S-Video"); + } else { + sprintf(v->name,"Composite%d",channel); } return 0; - } - case VIDIOCSCHAN: - { - struct video_channel *v = arg; + } + case VIDIOCSCHAN: + { + struct video_channel *v = arg; unsigned int channel = v->channel; if (channel >= bttv_tvcards[btv->c.type].video_inputs) @@ -1623,7 +1623,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) return 0; } - case VIDIOCGAUDIO: + case VIDIOCGAUDIO: { struct video_audio *v = arg; @@ -1728,7 +1728,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) } else if (i->index == btv->svhs) { sprintf(i->name, "S-Video"); } else { - sprintf(i->name,"Composite%d",i->index); + sprintf(i->name,"Composite%d",i->index); } if (i->index == btv->input) { __u32 dstatus = btread(BT848_DSTATUS); @@ -2168,7 +2168,7 @@ static int bttv_s_fmt(struct bttv_fh *fh, struct bttv *btv, if (0 != retval) return retval; if (locked_btres(fh->btv, RESOURCE_VBI)) - return -EBUSY; + return -EBUSY; bttv_vbi_try_fmt(fh,f); bttv_vbi_setlines(fh,btv,f->fmt.vbi.count[0]); bttv_vbi_get_fmt(fh,f); @@ -2206,9 +2206,9 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, bttv_reinit_bt848(btv); switch (cmd) { - case VIDIOCSFREQ: - case VIDIOCSTUNER: - case VIDIOCSCHAN: + case VIDIOCSFREQ: + case VIDIOCSTUNER: + case VIDIOCSCHAN: case VIDIOC_S_CTRL: case VIDIOC_S_STD: case VIDIOC_S_INPUT: @@ -2224,10 +2224,10 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, /* *** v4l1 *** ************************************************ */ case VIDIOCGCAP: { - struct video_capability *cap = arg; + struct video_capability *cap = arg; memset(cap,0,sizeof(*cap)); - strcpy(cap->name,btv->video_dev->name); + strcpy(cap->name,btv->video_dev->name); if (V4L2_BUF_TYPE_VBI_CAPTURE == fh->type) { /* vbi */ cap->type = VID_TYPE_TUNER|VID_TYPE_TELETEXT; @@ -2247,7 +2247,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, } cap->channels = bttv_tvcards[btv->c.type].video_inputs; cap->audios = bttv_tvcards[btv->c.type].audio_inputs; - return 0; + return 0; } case VIDIOCGPICT: @@ -2296,7 +2296,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, bt848_hue(btv,pic->hue); bt848_sat(btv,pic->colour); up(&fh->cap.lock); - return 0; + return 0; } case VIDIOCGWIN: @@ -2357,8 +2357,8 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, unsigned long end; if(!capable(CAP_SYS_ADMIN) && - !capable(CAP_SYS_RAWIO)) - return -EPERM; + !capable(CAP_SYS_RAWIO)) + return -EPERM; end = (unsigned long)fbuf->base + fbuf->height * fbuf->bytesperline; down(&fh->cap.lock); @@ -2432,7 +2432,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, } /* switch over */ - retval = bttv_switch_overlay(btv,fh,new); + retval = bttv_switch_overlay(btv,fh,new); up(&fh->cap.lock); return retval; } @@ -2571,13 +2571,13 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, return 0; } - case BTTV_VERSION: - case VIDIOCGFREQ: - case VIDIOCSFREQ: - case VIDIOCGTUNER: - case VIDIOCSTUNER: - case VIDIOCGCHAN: - case VIDIOCSCHAN: + case BTTV_VERSION: + case VIDIOCGFREQ: + case VIDIOCSFREQ: + case VIDIOCGTUNER: + case VIDIOCSTUNER: + case VIDIOCGCHAN: + case VIDIOCSCHAN: case VIDIOCGAUDIO: case VIDIOCSAUDIO: return bttv_common_ioctls(btv,cmd,arg); @@ -2589,8 +2589,8 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, if (0 == v4l2) return -EINVAL; - strcpy(cap->driver,"bttv"); - strlcpy(cap->card,btv->video_dev->name,sizeof(cap->card)); + strcpy(cap->driver,"bttv"); + strlcpy(cap->card,btv->video_dev->name,sizeof(cap->card)); sprintf(cap->bus_info,"PCI:%s",pci_name(btv->c.pci)); cap->version = BTTV_VERSION_CODE; cap->capabilities = @@ -3097,7 +3097,7 @@ static struct video_device bttv_video_template = { .name = "UNSET", .type = VID_TYPE_CAPTURE|VID_TYPE_TUNER| - VID_TYPE_CLIPPING|VID_TYPE_SCALES, + VID_TYPE_CLIPPING|VID_TYPE_SCALES, .hardware = VID_HARDWARE_BT848, .fops = &bttv_fops, .minor = -1, @@ -3143,7 +3143,7 @@ static int radio_open(struct inode *inode, struct file *file) audio_mux(btv,AUDIO_RADIO); up(&btv->lock); - return 0; + return 0; } static int radio_release(struct inode *inode, struct file *file) @@ -3166,34 +3166,34 @@ static int radio_do_ioctl(struct inode *inode, struct file *file, switch (cmd) { case VIDIOCGCAP: { - struct video_capability *cap = arg; + struct video_capability *cap = arg; memset(cap,0,sizeof(*cap)); - strcpy(cap->name,btv->radio_dev->name); - cap->type = VID_TYPE_TUNER; + strcpy(cap->name,btv->radio_dev->name); + cap->type = VID_TYPE_TUNER; cap->channels = 1; cap->audios = 1; - return 0; + return 0; } - case VIDIOCGTUNER: - { - struct video_tuner *v = arg; + case VIDIOCGTUNER: + { + struct video_tuner *v = arg; - if(v->tuner) - return -EINVAL; + if(v->tuner) + return -EINVAL; memset(v,0,sizeof(*v)); - strcpy(v->name, "Radio"); - bttv_call_i2c_clients(btv,cmd,v); - return 0; - } - case VIDIOCSTUNER: + strcpy(v->name, "Radio"); + bttv_call_i2c_clients(btv,cmd,v); + return 0; + } + case VIDIOCSTUNER: /* nothing to do */ return 0; case BTTV_VERSION: - case VIDIOCGFREQ: - case VIDIOCSFREQ: + case VIDIOCGFREQ: + case VIDIOCSFREQ: case VIDIOCGAUDIO: case VIDIOCSAUDIO: return bttv_common_ioctls(btv,cmd,arg); @@ -3699,7 +3699,7 @@ static irqreturn_t bttv_irq(int irq, void *dev_id, struct pt_regs * regs) } if (astat&BT848_INT_VSYNC) - btv->field_count++; + btv->field_count++; if (astat & BT848_INT_GPINT) { wake_up(&btv->gpioq); @@ -3711,13 +3711,13 @@ static irqreturn_t bttv_irq(int irq, void *dev_id, struct pt_regs * regs) wake_up(&btv->i2c_queue); } - if ((astat & BT848_INT_RISCI) && (stat & (4<<28))) + if ((astat & BT848_INT_RISCI) && (stat & (4<<28))) bttv_irq_switch_vbi(btv); - if ((astat & BT848_INT_RISCI) && (stat & (2<<28))) + if ((astat & BT848_INT_RISCI) && (stat & (2<<28))) bttv_irq_wakeup_top(btv); - if ((astat & BT848_INT_RISCI) && (stat & (1<<28))) + if ((astat & BT848_INT_RISCI) && (stat & (1<<28))) bttv_irq_switch_video(btv); if ((astat & BT848_INT_HLOCK) && btv->opt_automute) @@ -3744,7 +3744,7 @@ static irqreturn_t bttv_irq(int irq, void *dev_id, struct pt_regs * regs) if (count > 4) { if (count > 8 || !(astat & BT848_INT_GPINT)) { - btwrite(0, BT848_INT_MASK); + btwrite(0, BT848_INT_MASK); printk(KERN_ERR "bttv%d: IRQ lockup, cleared int mask [", btv->c.nr); @@ -3826,7 +3826,7 @@ static int __devinit bttv_register_video(struct bttv *btv) /* video */ btv->video_dev = vdev_init(btv, &bttv_video_template, "video"); - if (NULL == btv->video_dev) + if (NULL == btv->video_dev) goto err; if (video_register_device(btv->video_dev,VFL_TYPE_GRABBER,video_nr)<0) goto err; @@ -3836,18 +3836,18 @@ static int __devinit bttv_register_video(struct bttv *btv) /* vbi */ btv->vbi_dev = vdev_init(btv, &bttv_vbi_template, "vbi"); - if (NULL == btv->vbi_dev) + if (NULL == btv->vbi_dev) goto err; - if (video_register_device(btv->vbi_dev,VFL_TYPE_VBI,vbi_nr)<0) + if (video_register_device(btv->vbi_dev,VFL_TYPE_VBI,vbi_nr)<0) goto err; printk(KERN_INFO "bttv%d: registered device vbi%d\n", btv->c.nr,btv->vbi_dev->minor & 0x1f); - if (!btv->has_radio) + if (!btv->has_radio) return 0; /* radio */ btv->radio_dev = vdev_init(btv, &radio_template, "radio"); - if (NULL == btv->radio_dev) + if (NULL == btv->radio_dev) goto err; if (video_register_device(btv->radio_dev, VFL_TYPE_RADIO,radio_nr)<0) goto err; @@ -3868,11 +3868,11 @@ static int __devinit bttv_register_video(struct bttv *btv) static void pci_set_command(struct pci_dev *dev) { #if defined(__powerpc__) - unsigned int cmd; + unsigned int cmd; - pci_read_config_dword(dev, PCI_COMMAND, &cmd); - cmd = (cmd | PCI_COMMAND_MEMORY ); - pci_write_config_dword(dev, PCI_COMMAND, cmd); + pci_read_config_dword(dev, PCI_COMMAND, &cmd); + cmd = (cmd | PCI_COMMAND_MEMORY ); + pci_write_config_dword(dev, PCI_COMMAND, cmd); #endif } @@ -3886,21 +3886,21 @@ static int __devinit bttv_probe(struct pci_dev *dev, if (bttv_num == BTTV_MAX) return -ENOMEM; printk(KERN_INFO "bttv: Bt8xx card found (%d).\n", bttv_num); - btv=&bttvs[bttv_num]; + btv=&bttvs[bttv_num]; memset(btv,0,sizeof(*btv)); btv->c.nr = bttv_num; sprintf(btv->c.name,"bttv%d",btv->c.nr); /* initialize structs / fill in defaults */ - init_MUTEX(&btv->lock); - init_MUTEX(&btv->reslock); - spin_lock_init(&btv->s_lock); - spin_lock_init(&btv->gpio_lock); - init_waitqueue_head(&btv->gpioq); - init_waitqueue_head(&btv->i2c_queue); - INIT_LIST_HEAD(&btv->c.subs); - INIT_LIST_HEAD(&btv->capture); - INIT_LIST_HEAD(&btv->vcapture); + init_MUTEX(&btv->lock); + init_MUTEX(&btv->reslock); + spin_lock_init(&btv->s_lock); + spin_lock_init(&btv->gpio_lock); + init_waitqueue_head(&btv->gpioq); + init_waitqueue_head(&btv->i2c_queue); + INIT_LIST_HEAD(&btv->c.subs); + INIT_LIST_HEAD(&btv->capture); + INIT_LIST_HEAD(&btv->vcapture); v4l2_prio_init(&btv->prio); init_timer(&btv->timeout); @@ -3921,27 +3921,27 @@ static int __devinit bttv_probe(struct pci_dev *dev, btv->c.nr); return -EIO; } - if (pci_set_dma_mask(dev, DMA_32BIT_MASK)) { - printk(KERN_WARNING "bttv%d: No suitable DMA available.\n", + if (pci_set_dma_mask(dev, DMA_32BIT_MASK)) { + printk(KERN_WARNING "bttv%d: No suitable DMA available.\n", btv->c.nr); return -EIO; - } + } if (!request_mem_region(pci_resource_start(dev,0), pci_resource_len(dev,0), btv->c.name)) { - printk(KERN_WARNING "bttv%d: can't request iomem (0x%lx).\n", + printk(KERN_WARNING "bttv%d: can't request iomem (0x%lx).\n", btv->c.nr, pci_resource_start(dev,0)); return -EBUSY; } - pci_set_master(dev); + pci_set_master(dev); pci_set_command(dev); pci_set_drvdata(dev,btv); - pci_read_config_byte(dev, PCI_CLASS_REVISION, &btv->revision); - pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lat); - printk(KERN_INFO "bttv%d: Bt%d (rev %d) at %s, ", - bttv_num,btv->id, btv->revision, pci_name(dev)); - printk("irq: %d, latency: %d, mmio: 0x%lx\n", + pci_read_config_byte(dev, PCI_CLASS_REVISION, &btv->revision); + pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lat); + printk(KERN_INFO "bttv%d: Bt%d (rev %d) at %s, ", + bttv_num,btv->id, btv->revision, pci_name(dev)); + printk("irq: %d, latency: %d, mmio: 0x%lx\n", btv->c.pci->irq, lat, pci_resource_start(dev,0)); schedule(); @@ -3952,23 +3952,23 @@ static int __devinit bttv_probe(struct pci_dev *dev, goto fail1; } - /* identify card */ + /* identify card */ bttv_idcard(btv); - /* disable irqs, register irq handler */ + /* disable irqs, register irq handler */ btwrite(0, BT848_INT_MASK); - result = request_irq(btv->c.pci->irq, bttv_irq, - SA_SHIRQ | SA_INTERRUPT,btv->c.name,(void *)btv); - if (result < 0) { - printk(KERN_ERR "bttv%d: can't get IRQ %d\n", + result = request_irq(btv->c.pci->irq, bttv_irq, + SA_SHIRQ | SA_INTERRUPT,btv->c.name,(void *)btv); + if (result < 0) { + printk(KERN_ERR "bttv%d: can't get IRQ %d\n", bttv_num,btv->c.pci->irq); goto fail1; - } + } if (0 != bttv_handle_chipset(btv)) { result = -EIO; goto fail2; - } + } /* init options from insmod args */ btv->opt_combfilter = combfilter; @@ -3994,29 +3994,29 @@ static int __devinit bttv_probe(struct pci_dev *dev, btv->input = 0; /* initialize hardware */ - if (bttv_gpio) - bttv_gpio_tracking(btv,"pre-init"); + if (bttv_gpio) + bttv_gpio_tracking(btv,"pre-init"); bttv_risc_init_main(btv); init_bt848(btv); /* gpio */ - btwrite(0x00, BT848_GPIO_REG_INP); - btwrite(0x00, BT848_GPIO_OUT_EN); - if (bttv_verbose) - bttv_gpio_tracking(btv,"init"); + btwrite(0x00, BT848_GPIO_REG_INP); + btwrite(0x00, BT848_GPIO_OUT_EN); + if (bttv_verbose) + bttv_gpio_tracking(btv,"init"); - /* needs to be done before i2c is registered */ - bttv_init_card1(btv); + /* needs to be done before i2c is registered */ + bttv_init_card1(btv); - /* register i2c + gpio */ - init_bttv_i2c(btv); + /* register i2c + gpio */ + init_bttv_i2c(btv); - /* some card-specific stuff (needs working i2c) */ - bttv_init_card2(btv); + /* some card-specific stuff (needs working i2c) */ + bttv_init_card2(btv); init_irqreg(btv); - /* register video4linux + input */ + /* register video4linux + input */ if (!bttv_tvcards[btv->c.type].no_video) { bttv_register_video(btv); bt848_bright(btv,32768); @@ -4035,10 +4035,10 @@ static int __devinit bttv_probe(struct pci_dev *dev, /* everything is fine */ bttv_num++; - return 0; + return 0; fail2: - free_irq(btv->c.pci->irq,btv); + free_irq(btv->c.pci->irq,btv); fail1: if (btv->bt848_mmio) @@ -4051,12 +4051,12 @@ static int __devinit bttv_probe(struct pci_dev *dev, static void __devexit bttv_remove(struct pci_dev *pci_dev) { - struct bttv *btv = pci_get_drvdata(pci_dev); + struct bttv *btv = pci_get_drvdata(pci_dev); if (bttv_verbose) printk("bttv%d: unloading\n",btv->c.nr); - /* shutdown everything (DMA+IRQs) */ + /* shutdown everything (DMA+IRQs) */ btand(~15, BT848_GPIO_DMA_CTL); btwrite(0, BT848_INT_MASK); btwrite(~0x0, BT848_INT_STAT); @@ -4069,7 +4069,7 @@ static void __devexit bttv_remove(struct pci_dev *pci_dev) wake_up(&btv->gpioq); bttv_sub_del_devices(&btv->c); - /* unregister i2c_bus + input */ + /* unregister i2c_bus + input */ fini_bttv_i2c(btv); /* unregister video4linux */ @@ -4079,18 +4079,18 @@ static void __devexit bttv_remove(struct pci_dev *pci_dev) btcx_riscmem_free(btv->c.pci,&btv->main); /* free ressources */ - free_irq(btv->c.pci->irq,btv); + free_irq(btv->c.pci->irq,btv); iounmap(btv->bt848_mmio); - release_mem_region(pci_resource_start(btv->c.pci,0), - pci_resource_len(btv->c.pci,0)); + release_mem_region(pci_resource_start(btv->c.pci,0), + pci_resource_len(btv->c.pci,0)); pci_set_drvdata(pci_dev, NULL); - return; + return; } static int bttv_suspend(struct pci_dev *pci_dev, pm_message_t state) { - struct bttv *btv = pci_get_drvdata(pci_dev); + struct bttv *btv = pci_get_drvdata(pci_dev); struct bttv_buffer_set idle; unsigned long flags; @@ -4125,7 +4125,7 @@ static int bttv_suspend(struct pci_dev *pci_dev, pm_message_t state) static int bttv_resume(struct pci_dev *pci_dev) { - struct bttv *btv = pci_get_drvdata(pci_dev); + struct bttv *btv = pci_get_drvdata(pci_dev); unsigned long flags; int err; @@ -4170,24 +4170,24 @@ static int bttv_resume(struct pci_dev *pci_dev) } static struct pci_device_id bttv_pci_tbl[] = { - {PCI_VENDOR_ID_BROOKTREE, PCI_DEVICE_ID_BT848, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {PCI_VENDOR_ID_BROOKTREE, PCI_DEVICE_ID_BT848, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {PCI_VENDOR_ID_BROOKTREE, PCI_DEVICE_ID_BT849, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {PCI_VENDOR_ID_BROOKTREE, PCI_DEVICE_ID_BT878, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {PCI_VENDOR_ID_BROOKTREE, PCI_DEVICE_ID_BT879, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - {0,} + PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {0,} }; MODULE_DEVICE_TABLE(pci, bttv_pci_tbl); static struct pci_driver bttv_pci_driver = { - .name = "bttv", - .id_table = bttv_pci_tbl, - .probe = bttv_probe, - .remove = __devexit_p(bttv_remove), + .name = "bttv", + .id_table = bttv_pci_tbl, + .probe = bttv_probe, + .remove = __devexit_p(bttv_remove), .suspend = bttv_suspend, .resume = bttv_resume, }; diff --git a/drivers/media/video/bttv-gpio.c b/drivers/media/video/bttv-gpio.c index 6b280c03e398..575ce8b8e714 100644 --- a/drivers/media/video/bttv-gpio.c +++ b/drivers/media/video/bttv-gpio.c @@ -7,7 +7,7 @@ Copyright (C) 1996,97,98 Ralph Metzler (rjkm@thp.uni-koeln.de) - & Marcus Metzler (mocm@thp.uni-koeln.de) + & Marcus Metzler (mocm@thp.uni-koeln.de) (c) 1999-2003 Gerd Knorr This program is free software; you can redistribute it and/or modify diff --git a/drivers/media/video/bttv-i2c.c b/drivers/media/video/bttv-i2c.c index e684df37eb0e..06c5965b5616 100644 --- a/drivers/media/video/bttv-i2c.c +++ b/drivers/media/video/bttv-i2c.c @@ -5,7 +5,7 @@ bttv - Bt848 frame grabber driver Copyright (C) 1996,97,98 Ralph Metzler (rjkm@thp.uni-koeln.de) - & Marcus Metzler (mocm@thp.uni-koeln.de) + & Marcus Metzler (mocm@thp.uni-koeln.de) (c) 1999-2003 Gerd Knorr This program is free software; you can redistribute it and/or modify @@ -237,7 +237,7 @@ bttv_i2c_readbytes(struct bttv *btv, const struct i2c_msg *msg, int last) err: if (i2c_debug) printk(" ERR: %d\n",retval); - return retval; + return retval; } static int bttv_i2c_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs, int num) @@ -290,7 +290,7 @@ static struct i2c_adapter bttv_i2c_adap_hw_template = { static int attach_inform(struct i2c_client *client) { - struct bttv *btv = i2c_get_adapdata(client->adapter); + struct bttv *btv = i2c_get_adapdata(client->adapter); if (bttv_debug) printk(KERN_DEBUG "bttv%d: %s i2c attach [addr=0x%x,client=%s]\n", @@ -300,9 +300,9 @@ static int attach_inform(struct i2c_client *client) return 0; if (btv->tuner_type != UNSET) { - struct tuner_setup tun_setup; + struct tuner_setup tun_setup; - tun_setup.mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV; + tun_setup.mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV; tun_setup.type = btv->tuner_type; tun_setup.addr = ADDR_UNSET; @@ -312,7 +312,7 @@ static int attach_inform(struct i2c_client *client) if (btv->pinnacle_id != UNSET) client->driver->command(client,AUDC_CONFIG_PINNACLE, &btv->pinnacle_id); - return 0; + return 0; } void bttv_call_i2c_clients(struct bttv *btv, unsigned int cmd, void *arg) @@ -330,43 +330,43 @@ static struct i2c_client bttv_i2c_client_template = { /* read I2C */ int bttv_I2CRead(struct bttv *btv, unsigned char addr, char *probe_for) { - unsigned char buffer = 0; + unsigned char buffer = 0; if (0 != btv->i2c_rc) return -1; if (bttv_verbose && NULL != probe_for) printk(KERN_INFO "bttv%d: i2c: checking for %s @ 0x%02x... ", btv->c.nr,probe_for,addr); - btv->i2c_client.addr = addr >> 1; - if (1 != i2c_master_recv(&btv->i2c_client, &buffer, 1)) { + btv->i2c_client.addr = addr >> 1; + if (1 != i2c_master_recv(&btv->i2c_client, &buffer, 1)) { if (NULL != probe_for) { if (bttv_verbose) printk("not found\n"); } else printk(KERN_WARNING "bttv%d: i2c read 0x%x: error\n", btv->c.nr,addr); - return -1; + return -1; } if (bttv_verbose && NULL != probe_for) printk("found\n"); - return buffer; + return buffer; } /* write I2C */ int bttv_I2CWrite(struct bttv *btv, unsigned char addr, unsigned char b1, - unsigned char b2, int both) + unsigned char b2, int both) { - unsigned char buffer[2]; - int bytes = both ? 2 : 1; + unsigned char buffer[2]; + int bytes = both ? 2 : 1; if (0 != btv->i2c_rc) return -1; - btv->i2c_client.addr = addr >> 1; - buffer[0] = b1; - buffer[1] = b2; - if (bytes != i2c_master_send(&btv->i2c_client, buffer, bytes)) + btv->i2c_client.addr = addr >> 1; + buffer[0] = b1; + buffer[1] = b2; + if (bytes != i2c_master_send(&btv->i2c_client, buffer, bytes)) return -1; - return 0; + return 0; } /* read EEPROM content */ @@ -431,8 +431,8 @@ int __devinit init_bttv_i2c(struct bttv *btv) "bt%d #%d [%s]", btv->id, btv->c.nr, btv->use_i2c_hw ? "hw" : "sw"); - i2c_set_adapdata(&btv->c.i2c_adap, btv); - btv->i2c_client.adapter = &btv->c.i2c_adap; + i2c_set_adapdata(&btv->c.i2c_adap, btv); + btv->i2c_client.adapter = &btv->c.i2c_adap; #ifdef I2C_CLASS_TV_ANALOG if (bttv_tvcards[btv->c.type].no_video) diff --git a/drivers/media/video/bttv-if.c b/drivers/media/video/bttv-if.c index e8aada772b89..19b564ab0e92 100644 --- a/drivers/media/video/bttv-if.c +++ b/drivers/media/video/bttv-if.c @@ -1,13 +1,13 @@ /* bttv-if.c -- old gpio interface to other kernel modules - don't use in new code, will go away in 2.7 + don't use in new code, will go away in 2.7 have a look at bttv-gpio.c instead. bttv - Bt848 frame grabber driver Copyright (C) 1996,97,98 Ralph Metzler (rjkm@thp.uni-koeln.de) - & Marcus Metzler (mocm@thp.uni-koeln.de) + & Marcus Metzler (mocm@thp.uni-koeln.de) (c) 1999-2003 Gerd Knorr This program is free software; you can redistribute it and/or modify diff --git a/drivers/media/video/bttv-risc.c b/drivers/media/video/bttv-risc.c index a5ed99b89445..3028862934dd 100644 --- a/drivers/media/video/bttv-risc.c +++ b/drivers/media/video/bttv-risc.c @@ -74,27 +74,27 @@ bttv_risc_packed(struct bttv *btv, struct btcx_riscmem *risc, } if (bpl <= sg_dma_len(sg)-offset) { /* fits into current chunk */ - *(rp++)=cpu_to_le32(BT848_RISC_WRITE|BT848_RISC_SOL| + *(rp++)=cpu_to_le32(BT848_RISC_WRITE|BT848_RISC_SOL| BT848_RISC_EOL|bpl); - *(rp++)=cpu_to_le32(sg_dma_address(sg)+offset); - offset+=bpl; + *(rp++)=cpu_to_le32(sg_dma_address(sg)+offset); + offset+=bpl; } else { /* scanline needs to be splitted */ - todo = bpl; - *(rp++)=cpu_to_le32(BT848_RISC_WRITE|BT848_RISC_SOL| + todo = bpl; + *(rp++)=cpu_to_le32(BT848_RISC_WRITE|BT848_RISC_SOL| (sg_dma_len(sg)-offset)); - *(rp++)=cpu_to_le32(sg_dma_address(sg)+offset); - todo -= (sg_dma_len(sg)-offset); - offset = 0; - sg++; - while (todo > sg_dma_len(sg)) { - *(rp++)=cpu_to_le32(BT848_RISC_WRITE| + *(rp++)=cpu_to_le32(sg_dma_address(sg)+offset); + todo -= (sg_dma_len(sg)-offset); + offset = 0; + sg++; + while (todo > sg_dma_len(sg)) { + *(rp++)=cpu_to_le32(BT848_RISC_WRITE| sg_dma_len(sg)); - *(rp++)=cpu_to_le32(sg_dma_address(sg)); + *(rp++)=cpu_to_le32(sg_dma_address(sg)); todo -= sg_dma_len(sg); sg++; } - *(rp++)=cpu_to_le32(BT848_RISC_WRITE|BT848_RISC_EOL| + *(rp++)=cpu_to_le32(BT848_RISC_WRITE|BT848_RISC_EOL| todo); *(rp++)=cpu_to_le32(sg_dma_address(sg)); offset += todo; @@ -201,8 +201,8 @@ bttv_risc_planar(struct bttv *btv, struct btcx_riscmem *risc, ri |= BT848_RISC_EOL; /* write risc instruction */ - *(rp++)=cpu_to_le32(ri | ylen); - *(rp++)=cpu_to_le32(((ylen >> hshift) << 16) | + *(rp++)=cpu_to_le32(ri | ylen); + *(rp++)=cpu_to_le32(((ylen >> hshift) << 16) | (ylen >> hshift)); *(rp++)=cpu_to_le32(sg_dma_address(ysg)+yoffset); yoffset += ylen; @@ -319,7 +319,7 @@ bttv_calc_geo(struct bttv *btv, struct bttv_geometry *geo, int width, int height, int interleaved, int norm) { const struct bttv_tvnorm *tvnorm = &bttv_tvnorms[norm]; - u32 xsf, sr; + u32 xsf, sr; int vdelay; int swidth = tvnorm->swidth; @@ -334,52 +334,52 @@ bttv_calc_geo(struct bttv *btv, struct bttv_geometry *geo, vdelay = tvnorm->vdelay; - xsf = (width*scaledtwidth)/swidth; - geo->hscale = ((totalwidth*4096UL)/xsf-4096); - geo->hdelay = tvnorm->hdelayx1; - geo->hdelay = (geo->hdelay*width)/swidth; - geo->hdelay &= 0x3fe; - sr = ((tvnorm->sheight >> (interleaved?0:1))*512)/height - 512; - geo->vscale = (0x10000UL-sr) & 0x1fff; - geo->crop = ((width>>8)&0x03) | ((geo->hdelay>>6)&0x0c) | - ((tvnorm->sheight>>4)&0x30) | ((vdelay>>2)&0xc0); - geo->vscale |= interleaved ? (BT848_VSCALE_INT<<8) : 0; - geo->vdelay = vdelay; - geo->width = width; - geo->sheight = tvnorm->sheight; + xsf = (width*scaledtwidth)/swidth; + geo->hscale = ((totalwidth*4096UL)/xsf-4096); + geo->hdelay = tvnorm->hdelayx1; + geo->hdelay = (geo->hdelay*width)/swidth; + geo->hdelay &= 0x3fe; + sr = ((tvnorm->sheight >> (interleaved?0:1))*512)/height - 512; + geo->vscale = (0x10000UL-sr) & 0x1fff; + geo->crop = ((width>>8)&0x03) | ((geo->hdelay>>6)&0x0c) | + ((tvnorm->sheight>>4)&0x30) | ((vdelay>>2)&0xc0); + geo->vscale |= interleaved ? (BT848_VSCALE_INT<<8) : 0; + geo->vdelay = vdelay; + geo->width = width; + geo->sheight = tvnorm->sheight; geo->vtotal = tvnorm->vtotal; - if (btv->opt_combfilter) { - geo->vtc = (width < 193) ? 2 : ((width < 385) ? 1 : 0); - geo->comb = (width < 769) ? 1 : 0; - } else { - geo->vtc = 0; - geo->comb = 0; - } + if (btv->opt_combfilter) { + geo->vtc = (width < 193) ? 2 : ((width < 385) ? 1 : 0); + geo->comb = (width < 769) ? 1 : 0; + } else { + geo->vtc = 0; + geo->comb = 0; + } } static void bttv_apply_geo(struct bttv *btv, struct bttv_geometry *geo, int odd) { - int off = odd ? 0x80 : 0x00; + int off = odd ? 0x80 : 0x00; if (geo->comb) btor(BT848_VSCALE_COMB, BT848_E_VSCALE_HI+off); else btand(~BT848_VSCALE_COMB, BT848_E_VSCALE_HI+off); - btwrite(geo->vtc, BT848_E_VTC+off); - btwrite(geo->hscale >> 8, BT848_E_HSCALE_HI+off); - btwrite(geo->hscale & 0xff, BT848_E_HSCALE_LO+off); - btaor((geo->vscale>>8), 0xe0, BT848_E_VSCALE_HI+off); - btwrite(geo->vscale & 0xff, BT848_E_VSCALE_LO+off); - btwrite(geo->width & 0xff, BT848_E_HACTIVE_LO+off); - btwrite(geo->hdelay & 0xff, BT848_E_HDELAY_LO+off); - btwrite(geo->sheight & 0xff, BT848_E_VACTIVE_LO+off); - btwrite(geo->vdelay & 0xff, BT848_E_VDELAY_LO+off); - btwrite(geo->crop, BT848_E_CROP+off); + btwrite(geo->vtc, BT848_E_VTC+off); + btwrite(geo->hscale >> 8, BT848_E_HSCALE_HI+off); + btwrite(geo->hscale & 0xff, BT848_E_HSCALE_LO+off); + btaor((geo->vscale>>8), 0xe0, BT848_E_VSCALE_HI+off); + btwrite(geo->vscale & 0xff, BT848_E_VSCALE_LO+off); + btwrite(geo->width & 0xff, BT848_E_HACTIVE_LO+off); + btwrite(geo->hdelay & 0xff, BT848_E_HDELAY_LO+off); + btwrite(geo->sheight & 0xff, BT848_E_VACTIVE_LO+off); + btwrite(geo->vdelay & 0xff, BT848_E_VDELAY_LO+off); + btwrite(geo->crop, BT848_E_CROP+off); btwrite(geo->vtotal>>8, BT848_VTOTAL_HI); - btwrite(geo->vtotal & 0xff, BT848_VTOTAL_LO); + btwrite(geo->vtotal & 0xff, BT848_VTOTAL_LO); } /* ---------------------------------------------------------- */ @@ -420,7 +420,7 @@ bttv_set_dma(struct bttv *btv, int override) } else { del_timer(&btv->timeout); } - btv->main.cpu[RISC_SLOT_LOOP] = cpu_to_le32(cmd); + btv->main.cpu[RISC_SLOT_LOOP] = cpu_to_le32(cmd); btaor(capctl, ~0x0f, BT848_CAP_CTL); if (capctl) { @@ -432,7 +432,7 @@ bttv_set_dma(struct bttv *btv, int override) } else { if (!btv->dma_on) return; - btand(~3, BT848_GPIO_DMA_CTL); + btand(~3, BT848_GPIO_DMA_CTL); btv->dma_on = 0; } return; @@ -460,19 +460,19 @@ bttv_risc_init_main(struct bttv *btv) btv->main.cpu[6] = cpu_to_le32(BT848_RISC_JUMP); btv->main.cpu[7] = cpu_to_le32(btv->main.dma + (8<<2)); - btv->main.cpu[8] = cpu_to_le32(BT848_RISC_SYNC | BT848_RISC_RESYNC | + btv->main.cpu[8] = cpu_to_le32(BT848_RISC_SYNC | BT848_RISC_RESYNC | BT848_FIFO_STATUS_VRO); - btv->main.cpu[9] = cpu_to_le32(0); + btv->main.cpu[9] = cpu_to_le32(0); /* bottom field */ - btv->main.cpu[10] = cpu_to_le32(BT848_RISC_JUMP); + btv->main.cpu[10] = cpu_to_le32(BT848_RISC_JUMP); btv->main.cpu[11] = cpu_to_le32(btv->main.dma + (12<<2)); - btv->main.cpu[12] = cpu_to_le32(BT848_RISC_JUMP); + btv->main.cpu[12] = cpu_to_le32(BT848_RISC_JUMP); btv->main.cpu[13] = cpu_to_le32(btv->main.dma + (14<<2)); /* jump back to top field */ btv->main.cpu[14] = cpu_to_le32(BT848_RISC_JUMP); - btv->main.cpu[15] = cpu_to_le32(btv->main.dma + (0<<2)); + btv->main.cpu[15] = cpu_to_le32(btv->main.dma + (0<<2)); return 0; } diff --git a/drivers/media/video/bttv.h b/drivers/media/video/bttv.h index 26cd117a6df4..124ea41dada4 100644 --- a/drivers/media/video/bttv.h +++ b/drivers/media/video/bttv.h @@ -202,7 +202,7 @@ struct bttv_core { struct list_head subs; /* struct bttv_sub_device */ /* device config */ - unsigned int nr; /* dev nr (for printk("bttv%d: ..."); */ + unsigned int nr; /* dev nr (for printk("bttv%d: ..."); */ unsigned int type; /* card type (pointer into tvcards[]) */ char name[8]; /* dev name */ }; @@ -211,16 +211,16 @@ struct bttv; struct tvcard { - char *name; - unsigned int video_inputs; - unsigned int audio_inputs; - unsigned int tuner; - unsigned int svhs; + char *name; + unsigned int video_inputs; + unsigned int audio_inputs; + unsigned int tuner; + unsigned int svhs; unsigned int digital_mode; // DIGITAL_MODE_CAMERA or DIGITAL_MODE_VIDEO - u32 gpiomask; - u32 muxsel[16]; - u32 audiomux[6]; /* Tuner, Radio, external, internal, mute, stereo */ - u32 gpiomask2; /* GPIO MUX mask */ + u32 gpiomask; + u32 muxsel[16]; + u32 audiomux[6]; /* Tuner, Radio, external, internal, mute, stereo */ + u32 gpiomask2; /* GPIO MUX mask */ /* i2c audio flags */ unsigned int no_msp34xx:1; diff --git a/drivers/media/video/bttvp.h b/drivers/media/video/bttvp.h index e0e7c7a84bc5..386f546f7d11 100644 --- a/drivers/media/video/bttvp.h +++ b/drivers/media/video/bttvp.h @@ -77,14 +77,14 @@ struct bttv_tvnorm { int v4l2_id; char *name; - u32 Fsc; - u16 swidth, sheight; /* scaled standard width, height */ + u32 Fsc; + u16 swidth, sheight; /* scaled standard width, height */ u16 totalwidth; u8 adelay, bdelay, iform; u32 scaledtwidth; u16 hdelayx1, hactivex1; u16 vdelay; - u8 vbipack; + u8 vbipack; u16 vtotal; int sram; }; @@ -267,8 +267,8 @@ struct bttv { /* card configuration info */ unsigned int cardid; /* pci subsystem id (bt878 based ones) */ - unsigned int tuner_type; /* tuner chip type */ - unsigned int pinnacle_id; + unsigned int tuner_type; /* tuner chip type */ + unsigned int pinnacle_id; unsigned int svhs; struct bttv_pll_info pll; int triton1; @@ -301,9 +301,9 @@ struct bttv { /* locking */ spinlock_t s_lock; - struct semaphore lock; + struct semaphore lock; int resources; - struct semaphore reslock; + struct semaphore reslock; #ifdef VIDIOC_G_PRIORITY struct v4l2_prio_state prio; #endif diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c index fac67d98a745..4ae3f78cccf2 100644 --- a/drivers/media/video/cx88/cx88-blackbird.c +++ b/drivers/media/video/cx88/cx88-blackbird.c @@ -436,7 +436,7 @@ static int memory_write(struct cx88_core *core, u32 address, u32 value) static int memory_read(struct cx88_core *core, u32 address, u32 *value) { - int retval; + int retval; u32 val; /* Warning: address is dword address (4 bytes) */ @@ -605,11 +605,11 @@ static int blackbird_load_firmware(struct cx8802_dev *dev) u32 *dataptr; retval = register_write(dev->core, IVTV_REG_VPU, 0xFFFFFFED); - retval |= register_write(dev->core, IVTV_REG_HW_BLOCKS, IVTV_CMD_HW_BLOCKS_RST); - retval |= register_write(dev->core, IVTV_REG_ENC_SDRAM_REFRESH, 0x80000640); - retval |= register_write(dev->core, IVTV_REG_ENC_SDRAM_PRECHARGE, 0x1A); + retval |= register_write(dev->core, IVTV_REG_HW_BLOCKS, IVTV_CMD_HW_BLOCKS_RST); + retval |= register_write(dev->core, IVTV_REG_ENC_SDRAM_REFRESH, 0x80000640); + retval |= register_write(dev->core, IVTV_REG_ENC_SDRAM_PRECHARGE, 0x1A); msleep(1); - retval |= register_write(dev->core, IVTV_REG_APU, 0); + retval |= register_write(dev->core, IVTV_REG_APU, 0); if (retval < 0) dprintk(0, "Error with register_write\n"); @@ -657,13 +657,13 @@ static int blackbird_load_firmware(struct cx8802_dev *dev) release_firmware(firmware); dprintk(0, "Firmware upload successful.\n"); - retval |= register_write(dev->core, IVTV_REG_HW_BLOCKS, IVTV_CMD_HW_BLOCKS_RST); - retval |= register_read(dev->core, IVTV_REG_SPU, &value); - retval |= register_write(dev->core, IVTV_REG_SPU, value & 0xFFFFFFFE); + retval |= register_write(dev->core, IVTV_REG_HW_BLOCKS, IVTV_CMD_HW_BLOCKS_RST); + retval |= register_read(dev->core, IVTV_REG_SPU, &value); + retval |= register_write(dev->core, IVTV_REG_SPU, value & 0xFFFFFFFE); msleep(1); retval |= register_read(dev->core, IVTV_REG_VPU, &value); - retval |= register_write(dev->core, IVTV_REG_VPU, value & 0xFFFFFFE8); + retval |= register_write(dev->core, IVTV_REG_VPU, value & 0xFFFFFFE8); if (retval < 0) dprintk(0, "Error with register_write\n"); @@ -876,7 +876,7 @@ static void blackbird_set_default_params(struct cx8802_dev *dev) au_params |= 0; } else if( params->au_bitrate.target >= - mpeg_audio_bitrates[BITRATES_SIZE-1].layer[layer].rate ) + mpeg_audio_bitrates[BITRATES_SIZE-1].layer[layer].rate ) { /* clamp the bitrate to the max supported by the standard */ params->au_bitrate.target = mpeg_audio_bitrates[BITRATES_SIZE-1].layer[layer].rate; @@ -942,7 +942,7 @@ static void blackbird_set_default_params(struct cx8802_dev *dev) /* TODO: implement the stream ID stuff: ts_pid_pmt, ts_pid_audio, ts_pid_video, ts_pid_pcr, ps_size, au_pesid, vi_pesid - */ + */ } #define CHECK_PARAM( name ) ( dev->params.name != params->name ) #define IF_PARAM( name ) if( CHECK_PARAM( name ) ) @@ -1068,7 +1068,7 @@ void blackbird_set_params(struct cx8802_dev *dev, struct v4l2_mpeg_compression * au_params |= 0; } else if( params->au_bitrate.target >= - mpeg_audio_bitrates[BITRATES_SIZE-1].layer[layer].rate ) + mpeg_audio_bitrates[BITRATES_SIZE-1].layer[layer].rate ) { /* clamp the bitrate to the max supported by the standard */ params->au_bitrate.target = mpeg_audio_bitrates[BITRATES_SIZE-1].layer[layer].rate; @@ -1150,7 +1150,7 @@ void blackbird_set_params(struct cx8802_dev *dev, struct v4l2_mpeg_compression * /* TODO: implement the stream ID stuff: ts_pid_pmt, ts_pid_audio, ts_pid_video, ts_pid_pcr, ps_size, au_pesid, vi_pesid - */ + */ UPDATE_PARAM( ts_pid_pmt ); UPDATE_PARAM( ts_pid_audio ); UPDATE_PARAM( ts_pid_video ); @@ -1712,7 +1712,7 @@ static int __devinit blackbird_probe(struct pci_dev *pci_dev, static void __devexit blackbird_remove(struct pci_dev *pci_dev) { - struct cx8802_dev *dev = pci_get_drvdata(pci_dev); + struct cx8802_dev *dev = pci_get_drvdata(pci_dev); /* blackbird */ blackbird_unregister_video(dev); @@ -1728,8 +1728,8 @@ static struct pci_device_id cx8802_pci_tbl[] = { { .vendor = 0x14f1, .device = 0x8802, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, },{ /* --- end of list --- */ } @@ -1737,10 +1737,10 @@ static struct pci_device_id cx8802_pci_tbl[] = { MODULE_DEVICE_TABLE(pci, cx8802_pci_tbl); static struct pci_driver blackbird_pci_driver = { - .name = "cx88-blackbird", - .id_table = cx8802_pci_tbl, - .probe = blackbird_probe, - .remove = __devexit_p(blackbird_remove), + .name = "cx88-blackbird", + .id_table = cx8802_pci_tbl, + .probe = blackbird_probe, + .remove = __devexit_p(blackbird_remove), .suspend = cx8802_suspend_common, .resume = cx8802_resume_common, }; diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c index cf17da836914..504917768794 100644 --- a/drivers/media/video/cx88/cx88-cards.c +++ b/drivers/media/video/cx88/cx88-cards.c @@ -126,27 +126,27 @@ struct cx88_board cx88_boards[] = { .input = {{ .type = CX88_VMUX_TELEVISION, .vmux = 0, - .gpio0 = 0x03ff, + .gpio0 = 0x03ff, },{ .type = CX88_VMUX_COMPOSITE1, .vmux = 1, - .gpio0 = 0x03fe, + .gpio0 = 0x03fe, },{ .type = CX88_VMUX_SVIDEO, .vmux = 2, - .gpio0 = 0x03fe, + .gpio0 = 0x03fe, }}, }, - [CX88_BOARD_WINFAST2000XP_EXPERT] = { - .name = "Leadtek Winfast 2000XP Expert", - .tuner_type = TUNER_PHILIPS_4IN1, + [CX88_BOARD_WINFAST2000XP_EXPERT] = { + .name = "Leadtek Winfast 2000XP Expert", + .tuner_type = TUNER_PHILIPS_4IN1, .radio_type = UNSET, .tuner_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET, .tda9887_conf = TDA9887_PRESENT, - .input = {{ - .type = CX88_VMUX_TELEVISION, - .vmux = 0, + .input = {{ + .type = CX88_VMUX_TELEVISION, + .vmux = 0, .gpio0 = 0x00F5e700, .gpio1 = 0x00003004, .gpio2 = 0x00F5e700, @@ -165,15 +165,15 @@ struct cx88_board cx88_boards[] = { .gpio1 = 0x00003004, .gpio2 = 0x00F5c700, .gpio3 = 0x02000000, - }}, - .radio = { - .type = CX88_RADIO, + }}, + .radio = { + .type = CX88_RADIO, .gpio0 = 0x00F5d700, .gpio1 = 0x00003004, .gpio2 = 0x00F5d700, .gpio3 = 0x02000000, - }, - }, + }, + }, [CX88_BOARD_AVERTV_303] = { .name = "AverTV Studio 303 (M126)", .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, @@ -214,32 +214,32 @@ struct cx88_board cx88_boards[] = { .gpio1 = 0x000080c0, .gpio2 = 0x0000ff40, },{ - .type = CX88_VMUX_COMPOSITE1, - .vmux = 1, + .type = CX88_VMUX_COMPOSITE1, + .vmux = 1, .gpio0 = 0x000040bf, .gpio1 = 0x000080c0, .gpio2 = 0x0000ff40, },{ - .type = CX88_VMUX_SVIDEO, - .vmux = 2, + .type = CX88_VMUX_SVIDEO, + .vmux = 2, .gpio0 = 0x000040bf, .gpio1 = 0x000080c0, .gpio2 = 0x0000ff40, - }}, - .radio = { + }}, + .radio = { .type = CX88_RADIO, - }, + }, }, [CX88_BOARD_WINFAST_DV2000] = { - .name = "Leadtek Winfast DV2000", - .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, + .name = "Leadtek Winfast DV2000", + .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, .radio_type = UNSET, .tuner_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET, .tda9887_conf = TDA9887_PRESENT, - .input = {{ - .type = CX88_VMUX_TELEVISION, - .vmux = 0, + .input = {{ + .type = CX88_VMUX_TELEVISION, + .vmux = 0, .gpio0 = 0x0035e700, .gpio1 = 0x00003004, .gpio2 = 0x0035e700, @@ -260,14 +260,14 @@ struct cx88_board cx88_boards[] = { .gpio2 = 0x02000000, .gpio3 = 0x02000000, }}, - .radio = { + .radio = { .type = CX88_RADIO, .gpio0 = 0x0035d700, .gpio1 = 0x00007004, .gpio2 = 0x0035d700, .gpio3 = 0x02000000, }, - }, + }, [CX88_BOARD_LEADTEK_PVR2000] = { // gpio values for PAL version from regspy by DScaler .name = "Leadtek PVR 2000", @@ -296,25 +296,25 @@ struct cx88_board cx88_boards[] = { .blackbird = 1, }, [CX88_BOARD_IODATA_GVVCP3PCI] = { - .name = "IODATA GV-VCP3/PCI", + .name = "IODATA GV-VCP3/PCI", .tuner_type = TUNER_ABSENT, - .radio_type = UNSET, + .radio_type = UNSET, .tuner_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET, .input = {{ - .type = CX88_VMUX_COMPOSITE1, - .vmux = 0, - },{ - .type = CX88_VMUX_COMPOSITE2, - .vmux = 1, - },{ - .type = CX88_VMUX_SVIDEO, - .vmux = 2, - }}, - }, + .type = CX88_VMUX_COMPOSITE1, + .vmux = 0, + },{ + .type = CX88_VMUX_COMPOSITE2, + .vmux = 1, + },{ + .type = CX88_VMUX_SVIDEO, + .vmux = 2, + }}, + }, [CX88_BOARD_PROLINK_PLAYTVPVR] = { - .name = "Prolink PlayTV PVR", - .tuner_type = TUNER_PHILIPS_FM1236_MK3, + .name = "Prolink PlayTV PVR", + .tuner_type = TUNER_PHILIPS_FM1236_MK3, .radio_type = UNSET, .tuner_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET, @@ -348,15 +348,15 @@ struct cx88_board cx88_boards[] = { .type = CX88_VMUX_TELEVISION, .vmux = 0, .gpio0 = 0x0000fde6, - },{ + },{ .type = CX88_VMUX_SVIDEO, .vmux = 2, .gpio0 = 0x0000fde6, // 0x0000fda6 L,R RCA audio in? }}, - .radio = { - .type = CX88_RADIO, + .radio = { + .type = CX88_RADIO, .gpio0 = 0x0000fde2, - }, + }, .blackbird = 1, }, [CX88_BOARD_MSI_TVANYWHERE] = { @@ -372,34 +372,34 @@ struct cx88_board cx88_boards[] = { .gpio0 = 0x00000fbf, .gpio2 = 0x0000fc08, },{ - .type = CX88_VMUX_COMPOSITE1, - .vmux = 1, + .type = CX88_VMUX_COMPOSITE1, + .vmux = 1, .gpio0 = 0x00000fbf, .gpio2 = 0x0000fc68, },{ - .type = CX88_VMUX_SVIDEO, - .vmux = 2, + .type = CX88_VMUX_SVIDEO, + .vmux = 2, .gpio0 = 0x00000fbf, .gpio2 = 0x0000fc68, - }}, + }}, }, - [CX88_BOARD_KWORLD_DVB_T] = { - .name = "KWorld/VStream XPert DVB-T", + [CX88_BOARD_KWORLD_DVB_T] = { + .name = "KWorld/VStream XPert DVB-T", .tuner_type = TUNER_ABSENT, .radio_type = UNSET, .tuner_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET, - .input = {{ - .type = CX88_VMUX_COMPOSITE1, - .vmux = 1, + .input = {{ + .type = CX88_VMUX_COMPOSITE1, + .vmux = 1, .gpio0 = 0x0700, .gpio2 = 0x0101, - },{ - .type = CX88_VMUX_SVIDEO, - .vmux = 2, + },{ + .type = CX88_VMUX_SVIDEO, + .vmux = 2, .gpio0 = 0x0700, .gpio2 = 0x0101, - }}, + }}, .dvb = 1, }, [CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1] = { @@ -425,27 +425,27 @@ struct cx88_board cx88_boards[] = { .radio_type = UNSET, .tuner_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET, - .input = {{ - .type = CX88_VMUX_TELEVISION, - .vmux = 0, - .gpio0 = 0x07f8, + .input = {{ + .type = CX88_VMUX_TELEVISION, + .vmux = 0, + .gpio0 = 0x07f8, },{ .type = CX88_VMUX_DEBUG, .vmux = 0, .gpio0 = 0x07f9, // mono from tuner chip - },{ - .type = CX88_VMUX_COMPOSITE1, - .vmux = 1, - .gpio0 = 0x000007fa, - },{ - .type = CX88_VMUX_SVIDEO, - .vmux = 2, - .gpio0 = 0x000007fa, - }}, - .radio = { - .type = CX88_RADIO, - .gpio0 = 0x000007f8, - }, + },{ + .type = CX88_VMUX_COMPOSITE1, + .vmux = 1, + .gpio0 = 0x000007fa, + },{ + .type = CX88_VMUX_SVIDEO, + .vmux = 2, + .gpio0 = 0x000007fa, + }}, + .radio = { + .type = CX88_RADIO, + .gpio0 = 0x000007f8, + }, }, [CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q] = { .name = "DViCO FusionHDTV 3 Gold-Q", @@ -489,28 +489,28 @@ struct cx88_board cx88_boards[] = { }}, .dvb = 1, }, - [CX88_BOARD_HAUPPAUGE_DVB_T1] = { + [CX88_BOARD_HAUPPAUGE_DVB_T1] = { .name = "Hauppauge Nova-T DVB-T", .tuner_type = TUNER_ABSENT, .radio_type = UNSET, .tuner_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET, .input = {{ - .type = CX88_VMUX_DVB, - .vmux = 0, - }}, + .type = CX88_VMUX_DVB, + .vmux = 0, + }}, .dvb = 1, }, - [CX88_BOARD_CONEXANT_DVB_T1] = { + [CX88_BOARD_CONEXANT_DVB_T1] = { .name = "Conexant DVB-T reference design", .tuner_type = TUNER_ABSENT, .radio_type = UNSET, .tuner_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET, - .input = {{ - .type = CX88_VMUX_DVB, - .vmux = 0, - }}, + .input = {{ + .type = CX88_VMUX_DVB, + .vmux = 0, + }}, .dvb = 1, }, [CX88_BOARD_PROVIDEO_PV259] = { @@ -543,12 +543,12 @@ struct cx88_board cx88_boards[] = { .dvb = 1, }, [CX88_BOARD_DNTV_LIVE_DVB_T] = { - .name = "digitalnow DNTV Live! DVB-T", + .name = "digitalnow DNTV Live! DVB-T", .tuner_type = TUNER_ABSENT, .radio_type = UNSET, .tuner_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET, - .input = {{ + .input = {{ .type = CX88_VMUX_COMPOSITE1, .vmux = 1, .gpio0 = 0x00000700, @@ -705,44 +705,44 @@ struct cx88_board cx88_boards[] = { .gpio0 = 0xbf60, }, }, - [CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T] = { + [CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T] = { .name = "DViCO FusionHDTV 3 Gold-T", .tuner_type = TUNER_THOMSON_DTT7611, .radio_type = UNSET, .tuner_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET, .input = {{ - .type = CX88_VMUX_TELEVISION, - .vmux = 0, - .gpio0 = 0x97ed, - },{ - .type = CX88_VMUX_COMPOSITE1, - .vmux = 1, - .gpio0 = 0x97e9, - },{ - .type = CX88_VMUX_SVIDEO, - .vmux = 2, - .gpio0 = 0x97e9, - }}, + .type = CX88_VMUX_TELEVISION, + .vmux = 0, + .gpio0 = 0x97ed, + },{ + .type = CX88_VMUX_COMPOSITE1, + .vmux = 1, + .gpio0 = 0x97e9, + },{ + .type = CX88_VMUX_SVIDEO, + .vmux = 2, + .gpio0 = 0x97e9, + }}, .dvb = 1, - }, - [CX88_BOARD_ADSTECH_DVB_T_PCI] = { - .name = "ADS Tech Instant TV DVB-T PCI", + }, + [CX88_BOARD_ADSTECH_DVB_T_PCI] = { + .name = "ADS Tech Instant TV DVB-T PCI", .tuner_type = TUNER_ABSENT, .radio_type = UNSET, .tuner_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET, .input = {{ - .type = CX88_VMUX_COMPOSITE1, - .vmux = 1, + .type = CX88_VMUX_COMPOSITE1, + .vmux = 1, .gpio0 = 0x0700, .gpio2 = 0x0101, - },{ - .type = CX88_VMUX_SVIDEO, - .vmux = 2, + },{ + .type = CX88_VMUX_SVIDEO, + .vmux = 2, .gpio0 = 0x0700, .gpio2 = 0x0101, - }}, + }}, .dvb = 1, }, [CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1] = { @@ -762,18 +762,18 @@ struct cx88_board cx88_boards[] = { .radio_addr = ADDR_UNSET, .tda9887_conf = TDA9887_PRESENT, .input = {{ - .type = CX88_VMUX_TELEVISION, - .vmux = 0, - .gpio0 = 0x87fd, - },{ - .type = CX88_VMUX_COMPOSITE1, - .vmux = 1, - .gpio0 = 0x87f9, - },{ - .type = CX88_VMUX_SVIDEO, - .vmux = 2, - .gpio0 = 0x87f9, - }}, + .type = CX88_VMUX_TELEVISION, + .vmux = 0, + .gpio0 = 0x87fd, + },{ + .type = CX88_VMUX_COMPOSITE1, + .vmux = 1, + .gpio0 = 0x87f9, + },{ + .type = CX88_VMUX_SVIDEO, + .vmux = 2, + .gpio0 = 0x87f9, + }}, .dvb = 1, }, [CX88_BOARD_AVERMEDIA_ULTRATV_MC_550] = { @@ -805,23 +805,23 @@ struct cx88_board cx88_boards[] = { }, [CX88_BOARD_KWORLD_VSTREAM_EXPERT_DVD] = { /* Alexander Wold */ - .name = "Kworld V-Stream Xpert DVD", - .tuner_type = UNSET, - .input = {{ - .type = CX88_VMUX_COMPOSITE1, - .vmux = 1, - .gpio0 = 0x03000000, - .gpio1 = 0x01000000, - .gpio2 = 0x02000000, - .gpio3 = 0x00100000, - },{ - .type = CX88_VMUX_SVIDEO, - .vmux = 2, - .gpio0 = 0x03000000, + .name = "Kworld V-Stream Xpert DVD", + .tuner_type = UNSET, + .input = {{ + .type = CX88_VMUX_COMPOSITE1, + .vmux = 1, + .gpio0 = 0x03000000, .gpio1 = 0x01000000, .gpio2 = 0x02000000, .gpio3 = 0x00100000, - }}, + },{ + .type = CX88_VMUX_SVIDEO, + .vmux = 2, + .gpio0 = 0x03000000, + .gpio1 = 0x01000000, + .gpio2 = 0x02000000, + .gpio3 = 0x00100000, + }}, }, [CX88_BOARD_ATI_HDTVWONDER] = { .name = "ATI HDTV Wonder", @@ -892,26 +892,26 @@ struct cx88_subid cx88_subids[] = { .subdevice = 0x00f8, .card = CX88_BOARD_ATI_WONDER_PRO, },{ - .subvendor = 0x107d, - .subdevice = 0x6611, - .card = CX88_BOARD_WINFAST2000XP_EXPERT, + .subvendor = 0x107d, + .subdevice = 0x6611, + .card = CX88_BOARD_WINFAST2000XP_EXPERT, + },{ + .subvendor = 0x107d, + .subdevice = 0x6613, /* NTSC */ + .card = CX88_BOARD_WINFAST2000XP_EXPERT, + },{ + .subvendor = 0x107d, + .subdevice = 0x6620, + .card = CX88_BOARD_WINFAST_DV2000, },{ - .subvendor = 0x107d, - .subdevice = 0x6613, /* NTSC */ - .card = CX88_BOARD_WINFAST2000XP_EXPERT, + .subvendor = 0x107d, + .subdevice = 0x663b, + .card = CX88_BOARD_LEADTEK_PVR2000, },{ .subvendor = 0x107d, - .subdevice = 0x6620, - .card = CX88_BOARD_WINFAST_DV2000, - },{ - .subvendor = 0x107d, - .subdevice = 0x663b, - .card = CX88_BOARD_LEADTEK_PVR2000, - },{ - .subvendor = 0x107d, - .subdevice = 0x663C, - .card = CX88_BOARD_LEADTEK_PVR2000, - },{ + .subdevice = 0x663C, + .card = CX88_BOARD_LEADTEK_PVR2000, + },{ .subvendor = 0x1461, .subdevice = 0x000b, .card = CX88_BOARD_AVERTV_303, @@ -920,13 +920,13 @@ struct cx88_subid cx88_subids[] = { .subdevice = 0x8606, .card = CX88_BOARD_MSI_TVANYWHERE_MASTER, },{ - .subvendor = 0x10fc, - .subdevice = 0xd003, - .card = CX88_BOARD_IODATA_GVVCP3PCI, + .subvendor = 0x10fc, + .subdevice = 0xd003, + .card = CX88_BOARD_IODATA_GVVCP3PCI, },{ - .subvendor = 0x1043, - .subdevice = 0x4823, /* with mpeg encoder */ - .card = CX88_BOARD_ASUS_PVR_416, + .subvendor = 0x1043, + .subdevice = 0x4823, /* with mpeg encoder */ + .card = CX88_BOARD_ASUS_PVR_416, },{ .subvendor = 0x17de, .subdevice = 0x08a6, @@ -943,15 +943,15 @@ struct cx88_subid cx88_subids[] = { .subvendor = 0x18ac, .subdevice = 0xdb00, .card = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1, - },{ + },{ .subvendor = 0x0070, .subdevice = 0x9002, .card = CX88_BOARD_HAUPPAUGE_DVB_T1, - },{ + },{ .subvendor = 0x14f1, .subdevice = 0x0187, .card = CX88_BOARD_CONEXANT_DVB_T1, - },{ + },{ .subvendor = 0x1540, .subdevice = 0x2580, .card = CX88_BOARD_PROVIDEO_PV259, @@ -960,9 +960,9 @@ struct cx88_subid cx88_subids[] = { .subdevice = 0xdb10, .card = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS, },{ - .subvendor = 0x1554, - .subdevice = 0x4811, - .card = CX88_BOARD_PIXELVIEW, + .subvendor = 0x1554, + .subdevice = 0x4811, + .card = CX88_BOARD_PIXELVIEW, },{ .subvendor = 0x7063, .subdevice = 0x3000, /* HD-3000 card */ @@ -987,23 +987,23 @@ struct cx88_subid cx88_subids[] = { .subvendor = 0x1421, .subdevice = 0x0334, .card = CX88_BOARD_ADSTECH_DVB_T_PCI, - },{ + },{ .subvendor = 0x153b, .subdevice = 0x1166, .card = CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1, - },{ + },{ .subvendor = 0x18ac, .subdevice = 0xd500, .card = CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD, - },{ + },{ .subvendor = 0x1461, .subdevice = 0x8011, .card = CX88_BOARD_AVERMEDIA_ULTRATV_MC_550, - },{ + },{ .subvendor = PCI_VENDOR_ID_ATI, .subdevice = 0xa101, .card = CX88_BOARD_ATI_HDTVWONDER, - },{ + },{ .subvendor = 0x107d, .subdevice = 0x665f, .card = CX88_BOARD_WINFAST_DTV1000, diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c index d4d39c1751af..f01a631d0c00 100644 --- a/drivers/media/video/cx88/cx88-core.c +++ b/drivers/media/video/cx88/cx88-core.c @@ -153,26 +153,26 @@ static u32* cx88_risc_field(u32 *rp, struct scatterlist *sglist, } if (bpl <= sg_dma_len(sg)-offset) { /* fits into current chunk */ - *(rp++)=cpu_to_le32(RISC_WRITE|RISC_SOL|RISC_EOL|bpl); - *(rp++)=cpu_to_le32(sg_dma_address(sg)+offset); - offset+=bpl; + *(rp++)=cpu_to_le32(RISC_WRITE|RISC_SOL|RISC_EOL|bpl); + *(rp++)=cpu_to_le32(sg_dma_address(sg)+offset); + offset+=bpl; } else { /* scanline needs to be splitted */ - todo = bpl; - *(rp++)=cpu_to_le32(RISC_WRITE|RISC_SOL| + todo = bpl; + *(rp++)=cpu_to_le32(RISC_WRITE|RISC_SOL| (sg_dma_len(sg)-offset)); - *(rp++)=cpu_to_le32(sg_dma_address(sg)+offset); - todo -= (sg_dma_len(sg)-offset); - offset = 0; - sg++; - while (todo > sg_dma_len(sg)) { - *(rp++)=cpu_to_le32(RISC_WRITE| + *(rp++)=cpu_to_le32(sg_dma_address(sg)+offset); + todo -= (sg_dma_len(sg)-offset); + offset = 0; + sg++; + while (todo > sg_dma_len(sg)) { + *(rp++)=cpu_to_le32(RISC_WRITE| sg_dma_len(sg)); - *(rp++)=cpu_to_le32(sg_dma_address(sg)); + *(rp++)=cpu_to_le32(sg_dma_address(sg)); todo -= sg_dma_len(sg); sg++; } - *(rp++)=cpu_to_le32(RISC_WRITE|RISC_EOL|todo); + *(rp++)=cpu_to_le32(RISC_WRITE|RISC_EOL|todo); *(rp++)=cpu_to_le32(sg_dma_address(sg)); offset += todo; } @@ -309,7 +309,7 @@ struct sram_channel cx88_sram_channels[] = { .name = "video y / packed", .cmds_start = 0x180040, .ctrl_start = 0x180400, - .cdt = 0x180400 + 64, + .cdt = 0x180400 + 64, .fifo_start = 0x180c00, .fifo_size = 0x002800, .ptr1_reg = MO_DMA21_PTR1, @@ -321,7 +321,7 @@ struct sram_channel cx88_sram_channels[] = { .name = "video u", .cmds_start = 0x180080, .ctrl_start = 0x1804a0, - .cdt = 0x1804a0 + 64, + .cdt = 0x1804a0 + 64, .fifo_start = 0x183400, .fifo_size = 0x000800, .ptr1_reg = MO_DMA22_PTR1, @@ -333,7 +333,7 @@ struct sram_channel cx88_sram_channels[] = { .name = "video v", .cmds_start = 0x1800c0, .ctrl_start = 0x180540, - .cdt = 0x180540 + 64, + .cdt = 0x180540 + 64, .fifo_start = 0x183c00, .fifo_size = 0x000800, .ptr1_reg = MO_DMA23_PTR1, @@ -345,7 +345,7 @@ struct sram_channel cx88_sram_channels[] = { .name = "vbi", .cmds_start = 0x180100, .ctrl_start = 0x1805e0, - .cdt = 0x1805e0 + 64, + .cdt = 0x1805e0 + 64, .fifo_start = 0x184400, .fifo_size = 0x001000, .ptr1_reg = MO_DMA24_PTR1, @@ -357,7 +357,7 @@ struct sram_channel cx88_sram_channels[] = { .name = "audio from", .cmds_start = 0x180140, .ctrl_start = 0x180680, - .cdt = 0x180680 + 64, + .cdt = 0x180680 + 64, .fifo_start = 0x185400, .fifo_size = 0x000200, .ptr1_reg = MO_DMA25_PTR1, @@ -369,7 +369,7 @@ struct sram_channel cx88_sram_channels[] = { .name = "audio to", .cmds_start = 0x180180, .ctrl_start = 0x180720, - .cdt = 0x180680 + 64, /* same as audio IN */ + .cdt = 0x180680 + 64, /* same as audio IN */ .fifo_start = 0x185400, /* same as audio IN */ .fifo_size = 0x000200, /* same as audio IN */ .ptr1_reg = MO_DMA26_PTR1, @@ -1137,7 +1137,7 @@ struct cx88_core* cx88_core_get(struct pci_dev *pci) if (!core->radio_addr) core->radio_addr = cx88_boards[core->board].radio_addr; - printk(KERN_INFO "TV tuner %d at 0x%02x, Radio tuner %d at 0x%02x\n", + printk(KERN_INFO "TV tuner %d at 0x%02x, Radio tuner %d at 0x%02x\n", core->tuner_type, core->tuner_addr<<1, core->radio_type, core->radio_addr<<1); diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index 579de88e3081..3be601cfc99b 100644 --- a/drivers/media/video/cx88/cx88-dvb.c +++ b/drivers/media/video/cx88/cx88-dvb.c @@ -128,7 +128,7 @@ static int dntv_live_dvbt_demod_init(struct dvb_frontend* fe) static u8 reset [] = { 0x50, 0x80 }; static u8 adc_ctl_1_cfg [] = { 0x8E, 0x40 }; static u8 agc_cfg [] = { 0x67, 0x10, 0x23, 0x00, 0xFF, 0xFF, - 0x00, 0xFF, 0x00, 0x40, 0x40 }; + 0x00, 0xFF, 0x00, 0x40, 0x40 }; static u8 dntv_extra[] = { 0xB5, 0x7A }; static u8 capt_range_cfg[] = { 0x75, 0x32 }; @@ -464,7 +464,7 @@ static int __devinit dvb_probe(struct pci_dev *pci_dev, static void __devexit dvb_remove(struct pci_dev *pci_dev) { - struct cx8802_dev *dev = pci_get_drvdata(pci_dev); + struct cx8802_dev *dev = pci_get_drvdata(pci_dev); /* dvb */ videobuf_dvb_unregister(&dev->dvb); @@ -479,8 +479,8 @@ static struct pci_device_id cx8802_pci_tbl[] = { { .vendor = 0x14f1, .device = 0x8802, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, },{ /* --- end of list --- */ } @@ -488,10 +488,10 @@ static struct pci_device_id cx8802_pci_tbl[] = { MODULE_DEVICE_TABLE(pci, cx8802_pci_tbl); static struct pci_driver dvb_pci_driver = { - .name = "cx88-dvb", - .id_table = cx8802_pci_tbl, - .probe = dvb_probe, - .remove = __devexit_p(dvb_remove), + .name = "cx88-dvb", + .id_table = cx8802_pci_tbl, + .probe = dvb_probe, + .remove = __devexit_p(dvb_remove), .suspend = cx8802_suspend_common, .resume = cx8802_resume_common, }; diff --git a/drivers/media/video/cx88/cx88-i2c.c b/drivers/media/video/cx88/cx88-i2c.c index 761cebd40dbd..9790d412f192 100644 --- a/drivers/media/video/cx88/cx88-i2c.c +++ b/drivers/media/video/cx88/cx88-i2c.c @@ -3,7 +3,7 @@ cx88-i2c.c -- all the i2c code is here Copyright (C) 1996,97,98 Ralph Metzler (rjkm@thp.uni-koeln.de) - & Marcus Metzler (mocm@thp.uni-koeln.de) + & Marcus Metzler (mocm@thp.uni-koeln.de) (c) 2002 Yurij Sysoev (c) 1999-2003 Gerd Knorr @@ -90,7 +90,7 @@ static int cx8800_bit_getsda(void *data) static int attach_inform(struct i2c_client *client) { - struct tuner_setup tun_setup; + struct tuner_setup tun_setup; struct cx88_core *core = i2c_get_adapdata(client->adapter); dprintk(1, "%s i2c attach [addr=0x%x,client=%s]\n", @@ -98,7 +98,7 @@ static int attach_inform(struct i2c_client *client) if (!client->driver->command) return 0; - if (core->radio_type != UNSET) { + if (core->radio_type != UNSET) { if ((core->radio_addr==ADDR_UNSET)||(core->radio_addr==client->addr)) { tun_setup.mode_mask = T_RADIO; tun_setup.type = core->radio_type; @@ -106,8 +106,8 @@ static int attach_inform(struct i2c_client *client) client->driver->command (client, TUNER_SET_TYPE_ADDR, &tun_setup); } - } - if (core->tuner_type != UNSET) { + } + if (core->tuner_type != UNSET) { if ((core->tuner_addr==ADDR_UNSET)||(core->tuner_addr==client->addr)) { tun_setup.mode_mask = T_ANALOG_TV; @@ -116,7 +116,7 @@ static int attach_inform(struct i2c_client *client) client->driver->command (client,TUNER_SET_TYPE_ADDR, &tun_setup); } - } + } if (core->tda9887_conf) client->driver->command(client, TDA9887_SET_CONFIG, &core->tda9887_conf); @@ -159,7 +159,7 @@ static struct i2c_adapter cx8800_i2c_adap_template = { }; static struct i2c_client cx8800_i2c_client_template = { - .name = "cx88xx internal", + .name = "cx88xx internal", }; static char *i2c_devs[128] = { @@ -202,10 +202,10 @@ int cx88_i2c_init(struct cx88_core *core, struct pci_dev *pci) core->i2c_adap.dev.parent = &pci->dev; strlcpy(core->i2c_adap.name,core->name,sizeof(core->i2c_adap.name)); - core->i2c_algo.data = core; - i2c_set_adapdata(&core->i2c_adap,core); - core->i2c_adap.algo_data = &core->i2c_algo; - core->i2c_client.adapter = &core->i2c_adap; + core->i2c_algo.data = core; + i2c_set_adapdata(&core->i2c_adap,core); + core->i2c_adap.algo_data = &core->i2c_algo; + core->i2c_client.adapter = &core->i2c_adap; cx8800_bit_setscl(core,1); cx8800_bit_setsda(core,1); diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c index c27fe4c36f69..38b12ebaa49e 100644 --- a/drivers/media/video/cx88/cx88-input.c +++ b/drivers/media/video/cx88/cx88-input.c @@ -553,7 +553,7 @@ void cx88_ir_irq(struct cx88_core *core) if ((ircode & 0xffff) != 0xeb04) { /* wrong address */ ir_dprintk("pulse distance decoded wrong address\n"); - break; + break; } if (((~ircode >> 24) & 0xff) != ((ircode >> 16) & 0xff)) { /* wrong checksum */ diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c index 2c4fbe9258d9..35e6d0c2b872 100644 --- a/drivers/media/video/cx88/cx88-mpeg.c +++ b/drivers/media/video/cx88/cx88-mpeg.c @@ -316,14 +316,14 @@ static void cx8802_mpeg_irq(struct cx8802_dev *dev) spin_unlock(&dev->slock); } - /* other general errors */ - if (status & 0x1f0100) { + /* other general errors */ + if (status & 0x1f0100) { dprintk( 0, "general errors: 0x%08x\n", status & 0x1f0100 ); - spin_lock(&dev->slock); + spin_lock(&dev->slock); cx8802_stop_dma(dev); - cx8802_restart_queue(dev,&dev->mpegq); - spin_unlock(&dev->slock); - } + cx8802_restart_queue(dev,&dev->mpegq); + spin_unlock(&dev->slock); + } } #define MAX_IRQ_LOOP 10 @@ -379,8 +379,8 @@ int cx8802_init_common(struct cx8802_dev *dev) } pci_read_config_byte(dev->pci, PCI_CLASS_REVISION, &dev->pci_rev); - pci_read_config_byte(dev->pci, PCI_LATENCY_TIMER, &dev->pci_lat); - printk(KERN_INFO "%s/2: found at %s, rev: %d, irq: %d, " + 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%lx\n", dev->core->name, pci_name(dev->pci), dev->pci_rev, dev->pci->irq, dev->pci_lat,pci_resource_start(dev->pci,0)); @@ -430,7 +430,7 @@ void cx8802_fini_common(struct cx8802_dev *dev) int cx8802_suspend_common(struct pci_dev *pci_dev, pm_message_t state) { - struct cx8802_dev *dev = pci_get_drvdata(pci_dev); + struct cx8802_dev *dev = pci_get_drvdata(pci_dev); struct cx88_core *core = dev->core; /* stop mpeg dma */ diff --git a/drivers/media/video/cx88/cx88-reg.h b/drivers/media/video/cx88/cx88-reg.h index 0a3a62fc9bbb..d3bf5b17b1d4 100644 --- a/drivers/media/video/cx88/cx88-reg.h +++ b/drivers/media/video/cx88/cx88-reg.h @@ -3,9 +3,9 @@ cx88x-hw.h - CX2388x register offsets Copyright (C) 1996,97,98 Ralph Metzler (rjkm@thp.uni-koeln.de) - 2001 Michael Eskin - 2002 Yurij Sysoev - 2003 Gerd Knorr + 2001 Michael Eskin + 2002 Yurij Sysoev + 2003 Gerd Knorr 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 @@ -728,13 +728,13 @@ #define ColorFormatGamma 0x1000 #define Interlaced 0x1 -#define NonInterlaced 0x0 +#define NonInterlaced 0x0 #define FieldEven 0x1 #define FieldOdd 0x0 -#define TGReadWriteMode 0x0 -#define TGEnableMode 0x1 +#define TGReadWriteMode 0x0 +#define TGEnableMode 0x1 #define DV_CbAlign 0x0 #define DV_Y0Align 0x1 diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index 4c99fc39bb2a..f22ccb65de1c 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c @@ -100,7 +100,7 @@ static struct cx88_tvnorm tvnorms[] = { .id = V4L2_STD_PAL_I, .cxiformat = VideoFormatPAL, .cxoformat = 0x181f0008, - },{ + },{ .name = "PAL-M", .id = V4L2_STD_PAL_M, .cxiformat = VideoFormatPALM, @@ -470,7 +470,7 @@ static int restart_video_queue(struct cx8800_dev *dev, struct list_head *item; if (!list_empty(&q->active)) { - buf = list_entry(q->active.next, struct cx88_buffer, vb.queue); + buf = list_entry(q->active.next, struct cx88_buffer, vb.queue); dprintk(2,"restart_queue [%p/%d]: restart dma\n", buf, buf->vb.i); start_video_dma(dev, q, buf); @@ -486,7 +486,7 @@ static int restart_video_queue(struct cx8800_dev *dev, for (;;) { if (list_empty(&q->queued)) return 0; - buf = list_entry(q->queued.next, struct cx88_buffer, vb.queue); + buf = list_entry(q->queued.next, struct cx88_buffer, vb.queue); if (NULL == prev) { list_del(&buf->vb.queue); list_add_tail(&buf->vb.queue,&q->active); @@ -783,7 +783,7 @@ static int video_open(struct inode *inode, struct file *file) cx88_call_i2c_clients(core,AUDC_SET_RADIO,NULL); } - return 0; + return 0; } static ssize_t @@ -922,7 +922,7 @@ static int set_control(struct cx88_core *core, struct v4l2_control *ctl) { /* struct cx88_core *core = dev->core; */ struct cx88_ctrl *c = NULL; - u32 v_sat_value; + u32 v_sat_value; u32 value; int i; @@ -1252,7 +1252,7 @@ static int video_do_ioctl(struct inode *inode, struct file *file, } int cx88_do_ioctl(struct inode *inode, struct file *file, int radio, - struct cx88_core *core, unsigned int cmd, void *arg, v4l2_kioctl driver_ioctl) + struct cx88_core *core, unsigned int cmd, void *arg, v4l2_kioctl driver_ioctl) { int err; @@ -1399,7 +1399,7 @@ int cx88_do_ioctl(struct inode *inode, struct file *file, int radio, cx88_get_stereo(core ,t); reg = cx_read(MO_DEVICE_STATUS); - t->signal = (reg & (1<<5)) ? 0xffff : 0x0000; + t->signal = (reg & (1<<5)) ? 0xffff : 0x0000; return 0; } case VIDIOC_S_TUNER: @@ -1486,7 +1486,7 @@ static int radio_do_ioctl(struct inode *inode, struct file *file, struct v4l2_capability *cap = arg; memset(cap,0,sizeof(*cap)); - strcpy(cap->driver, "cx8800"); + strcpy(cap->driver, "cx8800"); strlcpy(cap->card, cx88_boards[core->board].name, sizeof(cap->card)); sprintf(cap->bus_info,"PCI:%s", pci_name(dev->pci)); @@ -1827,8 +1827,8 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev, /* print pci info */ pci_read_config_byte(pci_dev, PCI_CLASS_REVISION, &dev->pci_rev); - pci_read_config_byte(pci_dev, PCI_LATENCY_TIMER, &dev->pci_lat); - printk(KERN_INFO "%s/0: found at %s, rev: %d, irq: %d, " + pci_read_config_byte(pci_dev, PCI_LATENCY_TIMER, &dev->pci_lat); + printk(KERN_INFO "%s/0: found at %s, rev: %d, irq: %d, " "latency: %d, mmio: 0x%lx\n", core->name, pci_name(pci_dev), dev->pci_rev, pci_dev->irq, dev->pci_lat,pci_resource_start(pci_dev,0)); @@ -1944,7 +1944,7 @@ fail_free: static void __devexit cx8800_finidev(struct pci_dev *pci_dev) { - struct cx8800_dev *dev = pci_get_drvdata(pci_dev); + struct cx8800_dev *dev = pci_get_drvdata(pci_dev); struct cx88_core *core = dev->core; /* stop thread */ diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h index ea5c092a779e..baeae1ac992c 100644 --- a/drivers/media/video/cx88/cx88.h +++ b/drivers/media/video/cx88/cx88.h @@ -259,8 +259,8 @@ struct cx88_core { /* pci stuff */ int pci_bus; int pci_slot; - u32 __iomem *lmmio; - u8 __iomem *bmmio; + u32 __iomem *lmmio; + u8 __iomem *bmmio; u32 shadow[SHADOW_MAX]; int pci_irqmask; diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index 59f8fa0bea60..f0860532575a 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c @@ -2,8 +2,8 @@ em2820-cards.c - driver for Empia EM2800/EM2820/2840 USB video capture devices Copyright (C) 2005 Markus Rechberger - Ludovico Cavedon - Mauro Carvalho Chehab + Ludovico Cavedon + Mauro Carvalho Chehab Based on the em2800 driver from Sascha Sommer diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index f7b8fb035c9e..227a47d6e4bd 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c @@ -2,8 +2,8 @@ em2820-core.c - driver for Empia EM2800/EM2820/2840 USB video capture devices Copyright (C) 2005 Markus Rechberger - Ludovico Cavedon - Mauro Carvalho Chehab + Ludovico Cavedon + Mauro Carvalho Chehab Based on the em2800 driver from Sascha Sommer @@ -33,32 +33,32 @@ /* #define ENABLE_DEBUG_ISOC_FRAMES */ -unsigned int core_debug = 0; +unsigned int core_debug; module_param(core_debug,int,0644); MODULE_PARM_DESC(core_debug,"enable debug messages [core]"); #define em2820_coredbg(fmt, arg...) do {\ - if (core_debug) \ - printk(KERN_INFO "%s %s :"fmt, \ - dev->name, __FUNCTION__ , ##arg); } while (0) + if (core_debug) \ + printk(KERN_INFO "%s %s :"fmt, \ + dev->name, __FUNCTION__ , ##arg); } while (0) -unsigned int reg_debug = 0; +unsigned int reg_debug; module_param(reg_debug,int,0644); MODULE_PARM_DESC(reg_debug,"enable debug messages [URB reg]"); #define em2820_regdbg(fmt, arg...) do {\ - if (reg_debug) \ - printk(KERN_INFO "%s %s :"fmt, \ - dev->name, __FUNCTION__ , ##arg); } while (0) + if (reg_debug) \ + printk(KERN_INFO "%s %s :"fmt, \ + dev->name, __FUNCTION__ , ##arg); } while (0) -unsigned int isoc_debug = 0; +unsigned int isoc_debug; module_param(isoc_debug,int,0644); MODULE_PARM_DESC(isoc_debug,"enable debug messages [isoc transfers]"); #define em2820_isocdbg(fmt, arg...) do {\ - if (isoc_debug) \ - printk(KERN_INFO "%s %s :"fmt, \ - dev->name, __FUNCTION__ , ##arg); } while (0) + if (isoc_debug) \ + printk(KERN_INFO "%s %s :"fmt, \ + dev->name, __FUNCTION__ , ##arg); } while (0) static int alt = EM2820_PINOUT; module_param(alt, int, 0644); diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c index f6bfc038777e..bfe0d8795b6d 100644 --- a/drivers/media/video/em28xx/em28xx-i2c.c +++ b/drivers/media/video/em28xx/em28xx-i2c.c @@ -2,8 +2,8 @@ em2820-i2c.c - driver for Empia EM2800/EM2820/2840 USB video capture devices Copyright (C) 2005 Markus Rechberger - Ludovico Cavedon - Mauro Carvalho Chehab + Ludovico Cavedon + Mauro Carvalho Chehab Based on the em2800 driver from Sascha Sommer diff --git a/drivers/media/video/em28xx/em28xx-input.c b/drivers/media/video/em28xx/em28xx-input.c index ba367a9796e7..8681a793a0bf 100644 --- a/drivers/media/video/em28xx/em28xx-input.c +++ b/drivers/media/video/em28xx/em28xx-input.c @@ -43,34 +43,34 @@ MODULE_PARM_DESC(ir_debug,"enable debug messages [IR]"); /* ---------------------------------------------------------------------- */ static IR_KEYTAB_TYPE ir_codes_em_terratec[IR_KEYTAB_SIZE] = { - [ 0x01 ] = KEY_CHANNEL, - [ 0x02 ] = KEY_SELECT, - [ 0x03 ] = KEY_MUTE, - [ 0x04 ] = KEY_POWER, - [ 0x05 ] = KEY_KP1, - [ 0x06 ] = KEY_KP2, - [ 0x07 ] = KEY_KP3, - [ 0x08 ] = KEY_CHANNELUP, - [ 0x09 ] = KEY_KP4, - [ 0x0a ] = KEY_KP5, - [ 0x0b ] = KEY_KP6, - [ 0x0c ] = KEY_CHANNELDOWN, - [ 0x0d ] = KEY_KP7, - [ 0x0e ] = KEY_KP8, - [ 0x0f ] = KEY_KP9, - [ 0x10 ] = KEY_VOLUMEUP, - [ 0x11 ] = KEY_KP0, - [ 0x12 ] = KEY_MENU, - [ 0x13 ] = KEY_PRINT, - [ 0x14 ] = KEY_VOLUMEDOWN, - [ 0x16 ] = KEY_PAUSE, - [ 0x18 ] = KEY_RECORD, - [ 0x19 ] = KEY_REWIND, - [ 0x1a ] = KEY_PLAY, + [ 0x01 ] = KEY_CHANNEL, + [ 0x02 ] = KEY_SELECT, + [ 0x03 ] = KEY_MUTE, + [ 0x04 ] = KEY_POWER, + [ 0x05 ] = KEY_KP1, + [ 0x06 ] = KEY_KP2, + [ 0x07 ] = KEY_KP3, + [ 0x08 ] = KEY_CHANNELUP, + [ 0x09 ] = KEY_KP4, + [ 0x0a ] = KEY_KP5, + [ 0x0b ] = KEY_KP6, + [ 0x0c ] = KEY_CHANNELDOWN, + [ 0x0d ] = KEY_KP7, + [ 0x0e ] = KEY_KP8, + [ 0x0f ] = KEY_KP9, + [ 0x10 ] = KEY_VOLUMEUP, + [ 0x11 ] = KEY_KP0, + [ 0x12 ] = KEY_MENU, + [ 0x13 ] = KEY_PRINT, + [ 0x14 ] = KEY_VOLUMEDOWN, + [ 0x16 ] = KEY_PAUSE, + [ 0x18 ] = KEY_RECORD, + [ 0x19 ] = KEY_REWIND, + [ 0x1a ] = KEY_PLAY, [ 0x1b ] = KEY_FORWARD, [ 0x1c ] = KEY_BACKSPACE, - [ 0x1e ] = KEY_STOP, - [ 0x40 ] = KEY_ZOOM, + [ 0x1e ] = KEY_STOP, + [ 0x40 ] = KEY_ZOOM, }; /* ----------------------------------------------------------------------- */ diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 048ad1d77bab..e5066d05697e 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c @@ -2,8 +2,8 @@ em2820-video.c - driver for Empia EM2800/EM2820/2840 USB video capture devices Copyright (C) 2005 Markus Rechberger - Ludovico Cavedon - Mauro Carvalho Chehab + Ludovico Cavedon + Mauro Carvalho Chehab Based on the em2800 driver from Sascha Sommer @@ -42,9 +42,9 @@ #define EM2820_VERSION_CODE KERNEL_VERSION(0, 0, 1) #define em2820_videodbg(fmt, arg...) do {\ - if (video_debug) \ - printk(KERN_INFO "%s %s :"fmt, \ - dev->name, __FUNCTION__ , ##arg); } while (0) + if (video_debug) \ + printk(KERN_INFO "%s %s :"fmt, \ + dev->name, __FUNCTION__ , ##arg); } while (0) MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h index a11df04a8c3d..c48354062eb6 100644 --- a/drivers/media/video/em28xx/em28xx.h +++ b/drivers/media/video/em28xx/em28xx.h @@ -2,8 +2,8 @@ em2820-cards.c - driver for Empia EM2800/EM2820/2840 USB video capture devices Copyright (C) 2005 Markus Rechberger - Ludovico Cavedon - Mauro Carvalho Chehab + Ludovico Cavedon + Mauro Carvalho Chehab Based on the em2800 driver from Sascha Sommer @@ -390,17 +390,17 @@ extern const unsigned int em2820_bcount; /* printk macros */ #define em2820_err(fmt, arg...) do {\ - printk(KERN_ERR fmt , ##arg); } while (0) + printk(KERN_ERR fmt , ##arg); } while (0) #define em2820_errdev(fmt, arg...) do {\ - printk(KERN_ERR "%s: "fmt,\ + printk(KERN_ERR "%s: "fmt,\ dev->name , ##arg); } while (0) #define em2820_info(fmt, arg...) do {\ - printk(KERN_INFO "%s: "fmt,\ + printk(KERN_INFO "%s: "fmt,\ dev->name , ##arg); } while (0) #define em2820_warn(fmt, arg...) do {\ - printk(KERN_WARNING "%s: "fmt,\ + printk(KERN_WARNING "%s: "fmt,\ dev->name , ##arg); } while (0) inline static int em2820_audio_source(struct em2820 *dev, int input) diff --git a/drivers/media/video/ir-kbd-gpio.c b/drivers/media/video/ir-kbd-gpio.c index cc5973950c05..ed81934ef3cd 100644 --- a/drivers/media/video/ir-kbd-gpio.c +++ b/drivers/media/video/ir-kbd-gpio.c @@ -369,14 +369,14 @@ static int ir_probe(struct device *dev) ir->mask_keycode = 0x003e00; ir->mask_keyup = 0x010000; ir->polling = 50; // ms - break; + break; case BTTV_BOARD_PV_BT878P_9B: case BTTV_BOARD_PV_BT878P_PLUS: ir_codes = ir_codes_pixelview; ir->mask_keycode = 0x001f00; ir->mask_keyup = 0x008000; ir->polling = 50; // ms - break; + break; case BTTV_BOARD_WINFAST2000: ir_codes = ir_codes_winfast; diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index b0facaa40b2f..12f1053137da 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c @@ -163,7 +163,7 @@ static int get_key_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) static int get_key_pixelview(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) { - unsigned char b; + unsigned char b; /* poll IR chip */ if (1 != i2c_master_recv(&ir->c,&b,1)) { @@ -177,7 +177,7 @@ static int get_key_pixelview(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) static int get_key_pv951(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) { - unsigned char b; + unsigned char b; /* poll IR chip */ if (1 != i2c_master_recv(&ir->c,&b,1)) { @@ -225,7 +225,7 @@ static int get_key_knc1(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) static int get_key_purpletv(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) { - unsigned char b; + unsigned char b; /* poll IR chip */ if (1 != i2c_master_recv(&ir->c,&b,1)) { @@ -287,17 +287,17 @@ static int ir_detach(struct i2c_client *client); static int ir_probe(struct i2c_adapter *adap); static struct i2c_driver driver = { - .name = "ir remote kbd driver", - .id = I2C_DRIVERID_EXP3, /* FIXME */ - .flags = I2C_DF_NOTIFY, - .attach_adapter = ir_probe, - .detach_client = ir_detach, + .name = "ir remote kbd driver", + .id = I2C_DRIVERID_EXP3, /* FIXME */ + .flags = I2C_DF_NOTIFY, + .attach_adapter = ir_probe, + .detach_client = ir_detach, }; static struct i2c_client client_template = { - .name = "unset", - .driver = &driver + .name = "unset", + .driver = &driver }; static int ir_attach(struct i2c_adapter *adap, int addr, @@ -398,7 +398,7 @@ static int ir_attach(struct i2c_adapter *adap, int addr, static int ir_detach(struct i2c_client *client) { - struct IR_i2c *ir = i2c_get_clientdata(client); + struct IR_i2c *ir = i2c_get_clientdata(client); /* kill outstanding polls */ del_timer(&ir->timer); diff --git a/drivers/media/video/msp3400.c b/drivers/media/video/msp3400.c index 5573f68ce457..699cea2cc648 100644 --- a/drivers/media/video/msp3400.c +++ b/drivers/media/video/msp3400.c @@ -192,7 +192,7 @@ static int msp3400c_reset(struct i2c_client *client) (2 != i2c_transfer(client->adapter,test,2)) ) { printk(KERN_ERR "msp3400: chip reset failed\n"); return -1; - } + } return 0; } @@ -200,16 +200,16 @@ static int msp3400c_read(struct i2c_client *client, int dev, int addr) { int err,retval; - unsigned char write[3]; - unsigned char read[2]; - struct i2c_msg msgs[2] = { - { client->addr, 0, 3, write }, - { client->addr, I2C_M_RD, 2, read } - }; + unsigned char write[3]; + unsigned char read[2]; + struct i2c_msg msgs[2] = { + { client->addr, 0, 3, write }, + { client->addr, I2C_M_RD, 2, read } + }; - write[0] = dev+1; - write[1] = addr >> 8; - write[2] = addr & 0xff; + write[0] = dev+1; + write[1] = addr >> 8; + write[2] = addr & 0xff; for (err = 0; err < 3;) { if (2 == i2c_transfer(client->adapter,msgs,2)) @@ -236,13 +236,13 @@ static int msp3400c_read(struct i2c_client *client, int dev, int addr) static int msp3400c_write(struct i2c_client *client, int dev, int addr, int val) { int err; - unsigned char buffer[5]; + unsigned char buffer[5]; - buffer[0] = dev; - buffer[1] = addr >> 8; - buffer[2] = addr & 0xff; - buffer[3] = val >> 8; - buffer[4] = val & 0xff; + buffer[0] = dev; + buffer[1] = addr >> 8; + buffer[2] = addr & 0xff; + buffer[3] = val >> 8; + buffer[4] = val & 0xff; dprintk_trace("trace: msp3400c_write(0x%x, 0x%x, 0x%x)\n", dev, addr, val); @@ -812,7 +812,7 @@ static void watch_stereo(struct i2c_client *client) else if (msp->stereo & VIDEO_SOUND_LANG1) msp3400c_setstereo(client, V4L2_TUNER_MODE_LANG1); else - msp3400c_setstereo(client, V4L2_TUNER_MODE_MONO); + msp3400c_setstereo(client, V4L2_TUNER_MODE_MONO); } if (once) @@ -1512,21 +1512,21 @@ static struct i2c_client client_template = static int msp_attach(struct i2c_adapter *adap, int addr, int kind) { struct msp3400c *msp; - struct i2c_client *c; + struct i2c_client *c; int (*thread_func)(void *data) = NULL; int i; - client_template.adapter = adap; - client_template.addr = addr; + client_template.adapter = adap; + client_template.addr = addr; - if (-1 == msp3400c_reset(&client_template)) { - dprintk("msp34xx: no chip found\n"); - return -1; - } + if (-1 == msp3400c_reset(&client_template)) { + dprintk("msp34xx: no chip found\n"); + return -1; + } - if (NULL == (c = kmalloc(sizeof(struct i2c_client),GFP_KERNEL))) - return -ENOMEM; - memcpy(c,&client_template,sizeof(struct i2c_client)); + if (NULL == (c = kmalloc(sizeof(struct i2c_client),GFP_KERNEL))) + return -ENOMEM; + memcpy(c,&client_template,sizeof(struct i2c_client)); if (NULL == (msp = kmalloc(sizeof(struct msp3400c),GFP_KERNEL))) { kfree(c); return -ENOMEM; @@ -1618,7 +1618,7 @@ static int msp_attach(struct i2c_adapter *adap, int addr, int kind) } /* done */ - i2c_attach_client(c); + i2c_attach_client(c); /* update our own array */ for (i = 0; i < MSP3400_MAX; i++) { @@ -1739,7 +1739,7 @@ static void msp_any_set_audmode(struct i2c_client *client, int audmode) static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) { struct msp3400c *msp = i2c_get_clientdata(client); - __u16 *sarg = arg; + __u16 *sarg = arg; int scart = 0; switch (cmd) { @@ -1969,7 +1969,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) } msp_any_detect_stereo(client); - if (msp->audmode == V4L2_TUNER_MODE_STEREO) { + if (msp->audmode == V4L2_TUNER_MODE_STEREO) { a->capability=V4L2_AUDCAP_STEREO; } @@ -2005,7 +2005,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) msp3400c_set_scart(client,scart,0); msp3400c_write(client,I2C_MSP3400C_DFP,0x000d,0x1900); } - if (sarg->capability==V4L2_AUDCAP_STEREO) { + if (sarg->capability==V4L2_AUDCAP_STEREO) { msp->audmode = V4L2_TUNER_MODE_STEREO; } else { msp->audmode &= ~V4L2_TUNER_MODE_STEREO; diff --git a/drivers/media/video/mt20xx.c b/drivers/media/video/mt20xx.c index 972aa5e0aeef..13b61c4dcbf8 100644 --- a/drivers/media/video/mt20xx.c +++ b/drivers/media/video/mt20xx.c @@ -76,17 +76,17 @@ static int mt2032_compute_freq(struct i2c_client *c, unsigned int xogc) //all in Hz { struct tuner *t = i2c_get_clientdata(c); - unsigned int fref,lo1,lo1n,lo1a,s,sel,lo1freq, desired_lo1, + unsigned int fref,lo1,lo1n,lo1a,s,sel,lo1freq, desired_lo1, desired_lo2,lo2,lo2n,lo2a,lo2num,lo2freq; - fref= 5250 *1000; //5.25MHz + fref= 5250 *1000; //5.25MHz desired_lo1=rfin+if1; lo1=(2*(desired_lo1/1000)+(fref/1000)) / (2*fref/1000); - lo1n=lo1/8; - lo1a=lo1-(lo1n*8); + lo1n=lo1/8; + lo1a=lo1-(lo1n*8); - s=rfin/1000/1000+1090; + s=rfin/1000/1000+1090; if(optimize_vco) { if(s>1890) sel=0; @@ -96,34 +96,34 @@ static int mt2032_compute_freq(struct i2c_client *c, else sel=4; // >1090 } else { - if(s>1790) sel=0; // <1958 - else if(s>1617) sel=1; - else if(s>1449) sel=2; - else if(s>1291) sel=3; - else sel=4; // >1090 + if(s>1790) sel=0; // <1958 + else if(s>1617) sel=1; + else if(s>1449) sel=2; + else if(s>1291) sel=3; + else sel=4; // >1090 } *ret_sel=sel; - lo1freq=(lo1a+8*lo1n)*fref; + lo1freq=(lo1a+8*lo1n)*fref; tuner_dbg("mt2032: rfin=%d lo1=%d lo1n=%d lo1a=%d sel=%d, lo1freq=%d\n", rfin,lo1,lo1n,lo1a,sel,lo1freq); - desired_lo2=lo1freq-rfin-if2; - lo2=(desired_lo2)/fref; - lo2n=lo2/8; - lo2a=lo2-(lo2n*8); - lo2num=((desired_lo2/1000)%(fref/1000))* 3780/(fref/1000); //scale to fit in 32bit arith - lo2freq=(lo2a+8*lo2n)*fref + lo2num*(fref/1000)/3780*1000; + desired_lo2=lo1freq-rfin-if2; + lo2=(desired_lo2)/fref; + lo2n=lo2/8; + lo2a=lo2-(lo2n*8); + lo2num=((desired_lo2/1000)%(fref/1000))* 3780/(fref/1000); //scale to fit in 32bit arith + lo2freq=(lo2a+8*lo2n)*fref + lo2num*(fref/1000)/3780*1000; tuner_dbg("mt2032: rfin=%d lo2=%d lo2n=%d lo2a=%d num=%d lo2freq=%d\n", rfin,lo2,lo2n,lo2a,lo2num,lo2freq); - if(lo1a<0 || lo1a>7 || lo1n<17 ||lo1n>48 || lo2a<0 ||lo2a >7 ||lo2n<17 || lo2n>30) { + if(lo1a<0 || lo1a>7 || lo1n<17 ||lo1n>48 || lo2a<0 ||lo2a >7 ||lo2n<17 || lo2n>30) { tuner_info("mt2032: frequency parameters out of range: %d %d %d %d\n", lo1a, lo1n, lo2a,lo2n); - return(-1); - } + return(-1); + } mt2032_spurcheck(c, lo1freq, desired_lo2, spectrum_from, spectrum_to); // should recalculate lo1 (one step up/down) @@ -135,10 +135,10 @@ static int mt2032_compute_freq(struct i2c_client *c, buf[3]=0x0f; //reserved buf[4]=0x1f; buf[5]=(lo2n-1) | (lo2a<<5); - if(rfin >400*1000*1000) - buf[6]=0xe4; - else - buf[6]=0xf4; // set PKEN per rev 1.2 + if(rfin >400*1000*1000) + buf[6]=0xe4; + else + buf[6]=0xf4; // set PKEN per rev 1.2 buf[7]=8+xogc; buf[8]=0xc3; //reserved buf[9]=0x4e; //reserved @@ -168,7 +168,7 @@ static int mt2032_check_lo_lock(struct i2c_client *c) tuner_dbg("mt2032: pll wait 1ms for lock (0x%2x)\n",buf[0]); udelay(1000); } - return lock; + return lock; } static int mt2032_optimize_vco(struct i2c_client *c,int sel,int lock) @@ -202,7 +202,7 @@ static int mt2032_optimize_vco(struct i2c_client *c,int sel,int lock) buf[0]=0x0f; buf[1]=sel; - i2c_master_send(c,buf,2); + i2c_master_send(c,buf,2); lock=mt2032_check_lo_lock(c); return lock; } @@ -219,23 +219,23 @@ static void mt2032_set_if_freq(struct i2c_client *c, unsigned int rfin, tuner_dbg("mt2032_set_if_freq rfin=%d if1=%d if2=%d from=%d to=%d\n", rfin,if1,if2,from,to); - buf[0]=0; - ret=i2c_master_send(c,buf,1); - i2c_master_recv(c,buf,21); + buf[0]=0; + ret=i2c_master_send(c,buf,1); + i2c_master_recv(c,buf,21); buf[0]=0; ret=mt2032_compute_freq(c,rfin,if1,if2,from,to,&buf[1],&sel,t->xogc); if (ret<0) return; - // send only the relevant registers per Rev. 1.2 - buf[0]=0; - ret=i2c_master_send(c,buf,4); - buf[5]=5; - ret=i2c_master_send(c,buf+5,4); - buf[11]=11; - ret=i2c_master_send(c,buf+11,3); - if(ret!=3) + // send only the relevant registers per Rev. 1.2 + buf[0]=0; + ret=i2c_master_send(c,buf,4); + buf[5]=5; + ret=i2c_master_send(c,buf+5,4); + buf[11]=11; + ret=i2c_master_send(c,buf+11,3); + if(ret!=3) tuner_warn("i2c i/o error: rc == %d (should be 3)\n",ret); // wait for PLLs to lock (per manual), retry LINT if not. @@ -253,7 +253,7 @@ static void mt2032_set_if_freq(struct i2c_client *c, unsigned int rfin, mdelay(10); buf[1]=8+t->xogc; i2c_master_send(c,buf,2); - } + } if (lock!=6) tuner_warn("MT2032 Fatal Error: PLLs didn't lock.\n"); @@ -284,7 +284,7 @@ static void mt2032_set_tv_freq(struct i2c_client *c, unsigned int freq) if2 = 38900*1000; } - mt2032_set_if_freq(c, freq*62500 /* freq*1000*1000/16 */, + mt2032_set_if_freq(c, freq*62500 /* freq*1000*1000/16 */, 1090*1000*1000, if2, from, to); } @@ -294,7 +294,7 @@ static void mt2032_set_radio_freq(struct i2c_client *c, unsigned int freq) int if2 = t->radio_if2; // per Manual for FM tuning: first if center freq. 1085 MHz - mt2032_set_if_freq(c, freq * 1000 / 16, + mt2032_set_if_freq(c, freq * 1000 / 16, 1085*1000*1000,if2,if2,if2); } @@ -302,57 +302,57 @@ static void mt2032_set_radio_freq(struct i2c_client *c, unsigned int freq) static int mt2032_init(struct i2c_client *c) { struct tuner *t = i2c_get_clientdata(c); - unsigned char buf[21]; - int ret,xogc,xok=0; + unsigned char buf[21]; + int ret,xogc,xok=0; // Initialize Registers per spec. - buf[1]=2; // Index to register 2 - buf[2]=0xff; - buf[3]=0x0f; - buf[4]=0x1f; - ret=i2c_master_send(c,buf+1,4); - - buf[5]=6; // Index register 6 - buf[6]=0xe4; - buf[7]=0x8f; - buf[8]=0xc3; - buf[9]=0x4e; - buf[10]=0xec; - ret=i2c_master_send(c,buf+5,6); - - buf[12]=13; // Index register 13 - buf[13]=0x32; - ret=i2c_master_send(c,buf+12,2); - - // Adjust XOGC (register 7), wait for XOK - xogc=7; - do { + buf[1]=2; // Index to register 2 + buf[2]=0xff; + buf[3]=0x0f; + buf[4]=0x1f; + ret=i2c_master_send(c,buf+1,4); + + buf[5]=6; // Index register 6 + buf[6]=0xe4; + buf[7]=0x8f; + buf[8]=0xc3; + buf[9]=0x4e; + buf[10]=0xec; + ret=i2c_master_send(c,buf+5,6); + + buf[12]=13; // Index register 13 + buf[13]=0x32; + ret=i2c_master_send(c,buf+12,2); + + // Adjust XOGC (register 7), wait for XOK + xogc=7; + do { + tuner_dbg("mt2032: xogc = 0x%02x\n",xogc&0x07); + mdelay(10); + buf[0]=0x0e; + i2c_master_send(c,buf,1); + i2c_master_recv(c,buf,1); + xok=buf[0]&0x01; + tuner_dbg("mt2032: xok = 0x%02x\n",xok); + if (xok == 1) break; + + xogc--; tuner_dbg("mt2032: xogc = 0x%02x\n",xogc&0x07); - mdelay(10); - buf[0]=0x0e; - i2c_master_send(c,buf,1); - i2c_master_recv(c,buf,1); - xok=buf[0]&0x01; - tuner_dbg("mt2032: xok = 0x%02x\n",xok); - if (xok == 1) break; - - xogc--; - tuner_dbg("mt2032: xogc = 0x%02x\n",xogc&0x07); - if (xogc == 3) { - xogc=4; // min. 4 per spec - break; - } - buf[0]=0x07; - buf[1]=0x88 + xogc; - ret=i2c_master_send(c,buf,2); - if (ret!=2) + if (xogc == 3) { + xogc=4; // min. 4 per spec + break; + } + buf[0]=0x07; + buf[1]=0x88 + xogc; + ret=i2c_master_send(c,buf,2); + if (ret!=2) tuner_warn("i2c i/o error: rc == %d (should be 2)\n",ret); - } while (xok != 1 ); + } while (xok != 1 ); t->xogc=xogc; t->tv_freq = mt2032_set_tv_freq; t->radio_freq = mt2032_set_radio_freq; - return(1); + return(1); } static void mt2050_set_antenna(struct i2c_client *c, unsigned char antenna) @@ -426,7 +426,7 @@ static void mt2050_set_if_freq(struct i2c_client *c,unsigned int freq, unsigned } ret=i2c_master_send(c,buf,6); - if (ret!=6) + if (ret!=6) tuner_warn("i2c i/o error: rc == %d (should be 6)\n",ret); } @@ -437,11 +437,11 @@ static void mt2050_set_tv_freq(struct i2c_client *c, unsigned int freq) if (t->std & V4L2_STD_525_60) { // NTSC - if2 = 45750*1000; - } else { - // PAL - if2 = 38900*1000; - } + if2 = 45750*1000; + } else { + // PAL + if2 = 38900*1000; + } if (V4L2_TUNER_DIGITAL_TV == t->mode) { // DVB (pinnacle 300i) if2 = 36150*1000; @@ -487,7 +487,7 @@ int microtune_init(struct i2c_client *c) { struct tuner *t = i2c_get_clientdata(c); char *name; - unsigned char buf[21]; + unsigned char buf[21]; int company_code; memset(buf,0,sizeof(buf)); @@ -496,17 +496,17 @@ int microtune_init(struct i2c_client *c) t->standby = NULL; name = "unknown"; - i2c_master_send(c,buf,1); - i2c_master_recv(c,buf,21); - if (tuner_debug) { - int i; + i2c_master_send(c,buf,1); + i2c_master_recv(c,buf,21); + if (tuner_debug) { + int i; tuner_dbg("MT20xx hexdump:"); - for(i=0;i<21;i++) { - printk(" %02x",buf[i]); - if(((i+1)%8)==0) printk(" "); - } - printk("\n"); - } + for(i=0;i<21;i++) { + printk(" %02x",buf[i]); + if(((i+1)%8)==0) printk(" "); + } + printk("\n"); + } company_code = buf[0x11] << 8 | buf[0x12]; tuner_info("microtune: companycode=%04x part=%02x rev=%02x\n", company_code,buf[0x13],buf[0x14]); @@ -525,8 +525,8 @@ int microtune_init(struct i2c_client *c) default: tuner_info("microtune %s found, not (yet?) supported, sorry :-/\n", name); - return 0; - } + return 0; + } strlcpy(c->name, name, sizeof(c->name)); tuner_info("microtune %s found, OK\n",name); diff --git a/drivers/media/video/saa711x.c b/drivers/media/video/saa711x.c index 37653ee87235..ed16282fca51 100644 --- a/drivers/media/video/saa711x.c +++ b/drivers/media/video/saa711x.c @@ -464,8 +464,8 @@ saa7113_command (struct i2c_client *client, /* standard i2c insmod options */ static unsigned short normal_i2c[] = { - I2C_SAA7113>>1, /* saa7113 */ - I2C_CLIENT_END + I2C_SAA7113>>1, /* saa7113 */ + I2C_CLIENT_END }; I2C_CLIENT_INSMOD; diff --git a/drivers/media/video/saa7134/saa6752hs.c b/drivers/media/video/saa7134/saa6752hs.c index dac720ea3b06..2bf5cf79eec1 100644 --- a/drivers/media/video/saa7134/saa6752hs.c +++ b/drivers/media/video/saa7134/saa6752hs.c @@ -169,31 +169,31 @@ static int saa6752hs_chip_command(struct i2c_client* client, /* execute the command */ switch(command) { - case SAA6752HS_COMMAND_RESET: - buf[0] = 0x00; + case SAA6752HS_COMMAND_RESET: + buf[0] = 0x00; break; case SAA6752HS_COMMAND_STOP: - buf[0] = 0x03; + buf[0] = 0x03; break; case SAA6752HS_COMMAND_START: - buf[0] = 0x02; + buf[0] = 0x02; break; case SAA6752HS_COMMAND_PAUSE: - buf[0] = 0x04; + buf[0] = 0x04; break; case SAA6752HS_COMMAND_RECONFIGURE: buf[0] = 0x05; break; - case SAA6752HS_COMMAND_SLEEP: - buf[0] = 0x06; + case SAA6752HS_COMMAND_SLEEP: + buf[0] = 0x06; break; - case SAA6752HS_COMMAND_RECONFIGURE_FORCE: + case SAA6752HS_COMMAND_RECONFIGURE_FORCE: buf[0] = 0x07; break; @@ -201,13 +201,13 @@ static int saa6752hs_chip_command(struct i2c_client* client, return -EINVAL; } - /* set it and wait for it to be so */ + /* set it and wait for it to be so */ i2c_master_send(client, buf, 1); timeout = jiffies + HZ * 3; for (;;) { /* get the current status */ buf[0] = 0x10; - i2c_master_send(client, buf, 1); + i2c_master_send(client, buf, 1); i2c_master_recv(client, buf, 1); if (!(buf[0] & 0x20)) @@ -223,14 +223,14 @@ static int saa6752hs_chip_command(struct i2c_client* client, /* delay a bit to let encoder settle */ msleep(50); - return status; + return status; } static int saa6752hs_set_bitrate(struct i2c_client* client, struct v4l2_mpeg_compression* params) { - u8 buf[3]; + u8 buf[3]; /* set the bitrate mode */ buf[0] = 0x71; @@ -242,31 +242,31 @@ static int saa6752hs_set_bitrate(struct i2c_client* client, /* set the target bitrate */ buf[0] = 0x80; buf[1] = params->vi_bitrate.target >> 8; - buf[2] = params->vi_bitrate.target & 0xff; + buf[2] = params->vi_bitrate.target & 0xff; i2c_master_send(client, buf, 3); /* set the max bitrate */ buf[0] = 0x81; buf[1] = params->vi_bitrate.max >> 8; - buf[2] = params->vi_bitrate.max & 0xff; + buf[2] = params->vi_bitrate.max & 0xff; i2c_master_send(client, buf, 3); } else { /* set the target bitrate (no max bitrate for CBR) */ - buf[0] = 0x81; + buf[0] = 0x81; buf[1] = params->vi_bitrate.target >> 8; - buf[2] = params->vi_bitrate.target & 0xff; + buf[2] = params->vi_bitrate.target & 0xff; i2c_master_send(client, buf, 3); } /* set the audio bitrate */ - buf[0] = 0x94; + buf[0] = 0x94; buf[1] = (256 == params->au_bitrate.target) ? 0 : 1; i2c_master_send(client, buf, 2); /* set the total bitrate */ buf[0] = 0xb1; - buf[1] = params->st_bitrate.target >> 8; - buf[2] = params->st_bitrate.target & 0xff; + buf[1] = params->st_bitrate.target >> 8; + buf[2] = params->st_bitrate.target & 0xff; i2c_master_send(client, buf, 3); return 0; @@ -386,8 +386,8 @@ static int saa6752hs_init(struct i2c_client* client) buf[1] = 0x01; i2c_master_send(client, buf, 2); - /* set bitrate */ - saa6752hs_set_bitrate(client, &h->params); + /* set bitrate */ + saa6752hs_set_bitrate(client, &h->params); /* Set GOP structure {3, 13} */ buf[0] = 0x72; @@ -426,9 +426,9 @@ static int saa6752hs_init(struct i2c_client* client) localPAT[sizeof(PAT) - 1] = crc & 0xFF; /* compute PMT */ - memcpy(localPMT, PMT, sizeof(PMT)); - localPMT[3] = 0x40 | ((h->params.ts_pid_pmt >> 8) & 0x0f); - localPMT[4] = h->params.ts_pid_pmt & 0xff; + memcpy(localPMT, PMT, sizeof(PMT)); + localPMT[3] = 0x40 | ((h->params.ts_pid_pmt >> 8) & 0x0f); + localPMT[4] = h->params.ts_pid_pmt & 0xff; localPMT[15] = 0xE0 | ((h->params.ts_pid_pcr >> 8) & 0x0F); localPMT[16] = h->params.ts_pid_pcr & 0xFF; localPMT[20] = 0xE0 | ((h->params.ts_pid_video >> 8) & 0x0F); @@ -453,7 +453,7 @@ static int saa6752hs_init(struct i2c_client* client) buf[2] = h->params.ts_pid_video & 0xFF; i2c_master_send(client,buf,3); - /* Set PCR PID */ + /* Set PCR PID */ buf[0] = 0xC4; buf[1] = (h->params.ts_pid_pcr >> 8) & 0xFF; buf[2] = h->params.ts_pid_pcr & 0xFF; @@ -467,7 +467,7 @@ static int saa6752hs_init(struct i2c_client* client) buf[0] = 0xa4; buf[1] = 1; i2c_master_send(client, buf, 2); - buf[1] = 0; + buf[1] = 0; i2c_master_send(client, buf, 2); /* start it going */ @@ -510,10 +510,10 @@ static int saa6752hs_attach(struct i2c_adapter *adap, int addr, int kind) { struct saa6752hs_state *h; - printk("saa6752hs: chip found @ 0x%x\n", addr<<1); + printk("saa6752hs: chip found @ 0x%x\n", addr<<1); - if (NULL == (h = kmalloc(sizeof(*h), GFP_KERNEL))) - return -ENOMEM; + if (NULL == (h = kmalloc(sizeof(*h), GFP_KERNEL))) + return -ENOMEM; memset(h,0,sizeof(*h)); h->client = client_template; h->params = param_defaults; @@ -552,7 +552,7 @@ saa6752hs_command(struct i2c_client *client, unsigned int cmd, void *arg) struct v4l2_mpeg_compression *params = arg; int err = 0; - switch (cmd) { + switch (cmd) { case VIDIOC_S_MPEGCOMP: if (NULL == params) { /* apply settings and start encoder */ @@ -566,7 +566,7 @@ saa6752hs_command(struct i2c_client *client, unsigned int cmd, void *arg) break; case VIDIOC_G_FMT: { - struct v4l2_format *f = arg; + struct v4l2_format *f = arg; if (h->video_format == SAA6752HS_VF_UNKNOWN) h->video_format = SAA6752HS_VF_D1; diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c index 465beac941d7..e9ffe8f144ac 100644 --- a/drivers/media/video/saa7134/saa7134-alsa.c +++ b/drivers/media/video/saa7134/saa7134-alsa.c @@ -80,11 +80,11 @@ typedef struct snd_card_saa7134 { spinlock_t mixer_lock; int mixer_volume[MIXER_ADDR_LAST+1][2]; int capture_source[MIXER_ADDR_LAST+1][2]; - struct pci_dev *pci; - struct saa7134_dev *saadev; + struct pci_dev *pci; + struct saa7134_dev *saadev; - unsigned long iobase; - int irq; + unsigned long iobase; + int irq; spinlock_t lock; } snd_card_saa7134_t; @@ -94,7 +94,7 @@ typedef struct snd_card_saa7134 { */ typedef struct snd_card_saa7134_pcm { - struct saa7134_dev *saadev; + struct saa7134_dev *saadev; spinlock_t lock; unsigned int pcm_size; /* buffer size */ @@ -118,9 +118,9 @@ static snd_card_t *snd_saa7134_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; static void saa7134_dma_stop(struct saa7134_dev *dev) { - dev->oss.dma_blk = -1; - dev->oss.dma_running = 0; - saa7134_set_dmabits(dev); + dev->oss.dma_blk = -1; + dev->oss.dma_running = 0; + saa7134_set_dmabits(dev); } /* @@ -135,9 +135,9 @@ static void saa7134_dma_stop(struct saa7134_dev *dev) static void saa7134_dma_start(struct saa7134_dev *dev) { - dev->oss.dma_blk = 0; - dev->oss.dma_running = 1; - saa7134_set_dmabits(dev); + dev->oss.dma_blk = 0; + dev->oss.dma_running = 1; + saa7134_set_dmabits(dev); } /* @@ -184,28 +184,28 @@ void saa7134_irq_alsa_done(struct saa7134_dev *dev, unsigned long status) goto done; } - /* next block addr */ - next_blk = (dev->oss.dma_blk + 2) % dev->oss.blocks; - saa_writel(reg,next_blk * dev->oss.blksize); - if (alsa_debug > 2) - dprintk("irq: ok, %s, next_blk=%d, addr=%x, blocks=%u, size=%u, read=%u\n", - (status & 0x10000000) ? "even" : "odd ", next_blk, - next_blk * dev->oss.blksize, dev->oss.blocks, dev->oss.blksize, dev->oss.read_count); + /* next block addr */ + next_blk = (dev->oss.dma_blk + 2) % dev->oss.blocks; + saa_writel(reg,next_blk * dev->oss.blksize); + if (alsa_debug > 2) + dprintk("irq: ok, %s, next_blk=%d, addr=%x, blocks=%u, size=%u, read=%u\n", + (status & 0x10000000) ? "even" : "odd ", next_blk, + next_blk * dev->oss.blksize, dev->oss.blocks, dev->oss.blksize, dev->oss.read_count); - /* update status & wake waiting readers */ - dev->oss.dma_blk = (dev->oss.dma_blk + 1) % dev->oss.blocks; - dev->oss.read_count += dev->oss.blksize; + /* update status & wake waiting readers */ + dev->oss.dma_blk = (dev->oss.dma_blk + 1) % dev->oss.blocks; + dev->oss.read_count += dev->oss.blksize; - dev->oss.recording_on = reg; + dev->oss.recording_on = reg; if (dev->oss.read_count >= snd_pcm_lib_period_bytes(dev->oss.substream)) { - spin_unlock(&dev->slock); - snd_pcm_period_elapsed(dev->oss.substream); - spin_lock(&dev->slock); + spin_unlock(&dev->slock); + snd_pcm_period_elapsed(dev->oss.substream); + spin_lock(&dev->slock); } done: - spin_unlock(&dev->slock); + spin_unlock(&dev->slock); } @@ -239,23 +239,23 @@ static int snd_card_saa7134_capture_trigger(snd_pcm_substream_t * substream, static int dsp_buffer_conf(struct saa7134_dev *dev, int blksize, int blocks) { - if (blksize < 0x100) - blksize = 0x100; - if (blksize > 0x10000) - blksize = 0x10000; - - if (blocks < 2) - blocks = 2; - if ((blksize * blocks) > 1024*1024) - blocks = 1024*1024 / blksize; - - dev->oss.blocks = blocks; - dev->oss.blksize = blksize; - dev->oss.bufsize = blksize * blocks; - - dprintk("buffer config: %d blocks / %d bytes, %d kB total\n", - blocks,blksize,blksize * blocks / 1024); - return 0; + if (blksize < 0x100) + blksize = 0x100; + if (blksize > 0x10000) + blksize = 0x10000; + + if (blocks < 2) + blocks = 2; + if ((blksize * blocks) > 1024*1024) + blocks = 1024*1024 / blksize; + + dev->oss.blocks = blocks; + dev->oss.blksize = blksize; + dev->oss.bufsize = blksize * blocks; + + dprintk("buffer config: %d blocks / %d bytes, %d kB total\n", + blocks,blksize,blksize * blocks / 1024); + return 0; } /* @@ -271,16 +271,16 @@ static int dsp_buffer_conf(struct saa7134_dev *dev, int blksize, int blocks) static int dsp_buffer_init(struct saa7134_dev *dev) { - int err; - - if (!dev->oss.bufsize) - BUG(); - videobuf_dma_init(&dev->oss.dma); - err = videobuf_dma_init_kernel(&dev->oss.dma, PCI_DMA_FROMDEVICE, - (dev->oss.bufsize + PAGE_SIZE) >> PAGE_SHIFT); - if (0 != err) - return err; - return 0; + int err; + + if (!dev->oss.bufsize) + BUG(); + videobuf_dma_init(&dev->oss.dma); + err = videobuf_dma_init_kernel(&dev->oss.dma, PCI_DMA_FROMDEVICE, + (dev->oss.bufsize + PAGE_SIZE) >> PAGE_SHIFT); + if (0 != err) + return err; + return 0; } /* @@ -298,18 +298,18 @@ static int dsp_buffer_init(struct saa7134_dev *dev) static int snd_card_saa7134_capture_prepare(snd_pcm_substream_t * substream) { snd_pcm_runtime_t *runtime = substream->runtime; - int err, bswap, sign; - u32 fmt, control; - unsigned long flags; + int err, bswap, sign; + u32 fmt, control; + unsigned long flags; snd_card_saa7134_t *saa7134 = snd_pcm_substream_chip(substream); - struct saa7134_dev *dev; + struct saa7134_dev *dev; snd_card_saa7134_pcm_t *saapcm = runtime->private_data; unsigned int bps; - unsigned long size; - unsigned count; + unsigned long size; + unsigned count; - size = snd_pcm_lib_buffer_bytes(substream); - count = snd_pcm_lib_period_bytes(substream); + size = snd_pcm_lib_buffer_bytes(substream); + count = snd_pcm_lib_period_bytes(substream); saapcm->saadev->oss.substream = substream; bps = runtime->rate * runtime->channels; @@ -324,123 +324,123 @@ static int snd_card_saa7134_capture_prepare(snd_pcm_substream_t * substream) dev=saa7134->saadev; - dsp_buffer_conf(dev,saapcm->pcm_count,(saapcm->pcm_size/saapcm->pcm_count)); + dsp_buffer_conf(dev,saapcm->pcm_count,(saapcm->pcm_size/saapcm->pcm_count)); - err = dsp_buffer_init(dev); - if (0 != err) - goto fail2; + err = dsp_buffer_init(dev); + if (0 != err) + goto fail2; - /* prepare buffer */ - if (0 != (err = videobuf_dma_pci_map(dev->pci,&dev->oss.dma))) - return err; - if (0 != (err = saa7134_pgtable_alloc(dev->pci,&dev->oss.pt))) - goto fail1; - if (0 != (err = saa7134_pgtable_build(dev->pci,&dev->oss.pt, - dev->oss.dma.sglist, - dev->oss.dma.sglen, - 0))) - goto fail2; + /* prepare buffer */ + if (0 != (err = videobuf_dma_pci_map(dev->pci,&dev->oss.dma))) + return err; + if (0 != (err = saa7134_pgtable_alloc(dev->pci,&dev->oss.pt))) + goto fail1; + if (0 != (err = saa7134_pgtable_build(dev->pci,&dev->oss.pt, + dev->oss.dma.sglist, + dev->oss.dma.sglen, + 0))) + goto fail2; - switch (runtime->format) { - case SNDRV_PCM_FORMAT_U8: - case SNDRV_PCM_FORMAT_S8: + switch (runtime->format) { + case SNDRV_PCM_FORMAT_U8: + case SNDRV_PCM_FORMAT_S8: fmt = 0x00; break; - case SNDRV_PCM_FORMAT_U16_LE: - case SNDRV_PCM_FORMAT_U16_BE: - case SNDRV_PCM_FORMAT_S16_LE: - case SNDRV_PCM_FORMAT_S16_BE: + case SNDRV_PCM_FORMAT_U16_LE: + case SNDRV_PCM_FORMAT_U16_BE: + case SNDRV_PCM_FORMAT_S16_LE: + case SNDRV_PCM_FORMAT_S16_BE: fmt = 0x01; break; - default: - err = -EINVAL; - return 1; - } - - switch (runtime->format) { - case SNDRV_PCM_FORMAT_S8: - case SNDRV_PCM_FORMAT_S16_LE: - case SNDRV_PCM_FORMAT_S16_BE: + default: + err = -EINVAL; + return 1; + } + + switch (runtime->format) { + case SNDRV_PCM_FORMAT_S8: + case SNDRV_PCM_FORMAT_S16_LE: + case SNDRV_PCM_FORMAT_S16_BE: sign = 1; break; - default: + default: sign = 0; break; - } + } - switch (runtime->format) { - case SNDRV_PCM_FORMAT_U16_BE: - case SNDRV_PCM_FORMAT_S16_BE: + switch (runtime->format) { + case SNDRV_PCM_FORMAT_U16_BE: + case SNDRV_PCM_FORMAT_S16_BE: bswap = 1; break; - default: + default: bswap = 0; break; - } - - switch (dev->pci->device) { - case PCI_DEVICE_ID_PHILIPS_SAA7134: - if (1 == runtime->channels) - fmt |= (1 << 3); - if (2 == runtime->channels) - fmt |= (3 << 3); - if (sign) - fmt |= 0x04; - - fmt |= (MIXER_ADDR_TVTUNER == dev->oss.input) ? 0xc0 : 0x80; - saa_writeb(SAA7134_NUM_SAMPLES0, ((dev->oss.blksize - 1) & 0x0000ff)); - saa_writeb(SAA7134_NUM_SAMPLES1, ((dev->oss.blksize - 1) & 0x00ff00) >> 8); - saa_writeb(SAA7134_NUM_SAMPLES2, ((dev->oss.blksize - 1) & 0xff0000) >> 16); - saa_writeb(SAA7134_AUDIO_FORMAT_CTRL, fmt); - - break; - case PCI_DEVICE_ID_PHILIPS_SAA7133: - case PCI_DEVICE_ID_PHILIPS_SAA7135: - if (1 == runtime->channels) - fmt |= (1 << 4); - if (2 == runtime->channels) - fmt |= (2 << 4); - if (!sign) - fmt |= 0x04; - saa_writel(SAA7133_NUM_SAMPLES, dev->oss.blksize -1); - saa_writel(SAA7133_AUDIO_CHANNEL, 0x543210 | (fmt << 24)); - //saa_writel(SAA7133_AUDIO_CHANNEL, 0x543210); - break; - } - - dprintk("rec_start: afmt=%d ch=%d => fmt=0x%x swap=%c\n", - runtime->format, runtime->channels, fmt, - bswap ? 'b' : '-'); - /* dma: setup channel 6 (= AUDIO) */ - control = SAA7134_RS_CONTROL_BURST_16 | - SAA7134_RS_CONTROL_ME | - (dev->oss.pt.dma >> 12); - if (bswap) - control |= SAA7134_RS_CONTROL_BSWAP; + } + + switch (dev->pci->device) { + case PCI_DEVICE_ID_PHILIPS_SAA7134: + if (1 == runtime->channels) + fmt |= (1 << 3); + if (2 == runtime->channels) + fmt |= (3 << 3); + if (sign) + fmt |= 0x04; + + fmt |= (MIXER_ADDR_TVTUNER == dev->oss.input) ? 0xc0 : 0x80; + saa_writeb(SAA7134_NUM_SAMPLES0, ((dev->oss.blksize - 1) & 0x0000ff)); + saa_writeb(SAA7134_NUM_SAMPLES1, ((dev->oss.blksize - 1) & 0x00ff00) >> 8); + saa_writeb(SAA7134_NUM_SAMPLES2, ((dev->oss.blksize - 1) & 0xff0000) >> 16); + saa_writeb(SAA7134_AUDIO_FORMAT_CTRL, fmt); + + break; + case PCI_DEVICE_ID_PHILIPS_SAA7133: + case PCI_DEVICE_ID_PHILIPS_SAA7135: + if (1 == runtime->channels) + fmt |= (1 << 4); + if (2 == runtime->channels) + fmt |= (2 << 4); + if (!sign) + fmt |= 0x04; + saa_writel(SAA7133_NUM_SAMPLES, dev->oss.blksize -1); + saa_writel(SAA7133_AUDIO_CHANNEL, 0x543210 | (fmt << 24)); + //saa_writel(SAA7133_AUDIO_CHANNEL, 0x543210); + break; + } + + dprintk("rec_start: afmt=%d ch=%d => fmt=0x%x swap=%c\n", + runtime->format, runtime->channels, fmt, + bswap ? 'b' : '-'); + /* dma: setup channel 6 (= AUDIO) */ + control = SAA7134_RS_CONTROL_BURST_16 | + SAA7134_RS_CONTROL_ME | + (dev->oss.pt.dma >> 12); + if (bswap) + control |= SAA7134_RS_CONTROL_BSWAP; /* I should be able to use runtime->dma_addr in the control - byte, but it doesn't work. So I allocate the DMA using the - V4L functions, and force ALSA to use that as the DMA area */ + byte, but it doesn't work. So I allocate the DMA using the + V4L functions, and force ALSA to use that as the DMA area */ runtime->dma_area = dev->oss.dma.vmalloc; - saa_writel(SAA7134_RS_BA1(6),0); - saa_writel(SAA7134_RS_BA2(6),dev->oss.blksize); - saa_writel(SAA7134_RS_PITCH(6),0); - saa_writel(SAA7134_RS_CONTROL(6),control); + saa_writel(SAA7134_RS_BA1(6),0); + saa_writel(SAA7134_RS_BA2(6),dev->oss.blksize); + saa_writel(SAA7134_RS_PITCH(6),0); + saa_writel(SAA7134_RS_CONTROL(6),control); dev->oss.rate = runtime->rate; - /* start dma */ - spin_lock_irqsave(&dev->slock,flags); - saa7134_dma_start(dev); - spin_unlock_irqrestore(&dev->slock,flags); + /* start dma */ + spin_lock_irqsave(&dev->slock,flags); + saa7134_dma_start(dev); + spin_unlock_irqrestore(&dev->slock,flags); return 0; fail2: - saa7134_pgtable_free(dev->pci,&dev->oss.pt); + saa7134_pgtable_free(dev->pci,&dev->oss.pt); fail1: - videobuf_dma_pci_unmap(dev->pci,&dev->oss.dma); - return err; + videobuf_dma_pci_unmap(dev->pci,&dev->oss.dma); + return err; } @@ -465,10 +465,10 @@ static snd_pcm_uframes_t snd_card_saa7134_capture_pointer(snd_pcm_substream_t * if (dev->oss.read_count) { - dev->oss.read_count -= snd_pcm_lib_period_bytes(substream); - dev->oss.read_offset += snd_pcm_lib_period_bytes(substream); - if (dev->oss.read_offset == dev->oss.bufsize) - dev->oss.read_offset = 0; + dev->oss.read_count -= snd_pcm_lib_period_bytes(substream); + dev->oss.read_offset += snd_pcm_lib_period_bytes(substream); + if (dev->oss.read_offset == dev->oss.bufsize) + dev->oss.read_offset = 0; } return bytes_to_frames(runtime, dev->oss.read_offset); @@ -480,9 +480,9 @@ static snd_pcm_uframes_t snd_card_saa7134_capture_pointer(snd_pcm_substream_t * static snd_pcm_hardware_t snd_card_saa7134_capture = { - .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | - SNDRV_PCM_INFO_BLOCK_TRANSFER | - SNDRV_PCM_INFO_MMAP_VALID), + .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | + SNDRV_PCM_INFO_BLOCK_TRANSFER | + SNDRV_PCM_INFO_MMAP_VALID), .formats = USE_FORMATS, .rates = USE_RATE, .rate_min = USE_RATE_MIN, @@ -550,16 +550,16 @@ static int snd_card_saa7134_hw_free(snd_pcm_substream_t * substream) static int dsp_buffer_free(struct saa7134_dev *dev) { - if (!dev->oss.blksize) - BUG(); + if (!dev->oss.blksize) + BUG(); - videobuf_dma_free(&dev->oss.dma); + videobuf_dma_free(&dev->oss.dma); - dev->oss.blocks = 0; - dev->oss.blksize = 0; - dev->oss.bufsize = 0; + dev->oss.blocks = 0; + dev->oss.blksize = 0; + dev->oss.bufsize = 0; - return 0; + return 0; } /* @@ -574,21 +574,21 @@ static int dsp_buffer_free(struct saa7134_dev *dev) static int snd_card_saa7134_capture_close(snd_pcm_substream_t * substream) { - snd_card_saa7134_t *chip = snd_pcm_substream_chip(substream); + snd_card_saa7134_t *chip = snd_pcm_substream_chip(substream); struct saa7134_dev *dev = chip->saadev; - unsigned long flags; + unsigned long flags; - /* stop dma */ - spin_lock_irqsave(&dev->slock,flags); - saa7134_dma_stop(dev); - spin_unlock_irqrestore(&dev->slock,flags); + /* stop dma */ + spin_lock_irqsave(&dev->slock,flags); + saa7134_dma_stop(dev); + spin_unlock_irqrestore(&dev->slock,flags); - /* unlock buffer */ - saa7134_pgtable_free(dev->pci,&dev->oss.pt); - videobuf_dma_pci_unmap(dev->pci,&dev->oss.dma); + /* unlock buffer */ + saa7134_pgtable_free(dev->pci,&dev->oss.pt); + videobuf_dma_pci_unmap(dev->pci,&dev->oss.dma); - dsp_buffer_free(dev); - return 0; + dsp_buffer_free(dev); + return 0; } /* @@ -605,18 +605,18 @@ static int snd_card_saa7134_capture_open(snd_pcm_substream_t * substream) { snd_pcm_runtime_t *runtime = substream->runtime; snd_card_saa7134_pcm_t *saapcm; - snd_card_saa7134_t *saa7134 = snd_pcm_substream_chip(substream); - struct saa7134_dev *dev = saa7134->saadev; + snd_card_saa7134_t *saa7134 = snd_pcm_substream_chip(substream); + struct saa7134_dev *dev = saa7134->saadev; int err; down(&dev->oss.lock); - dev->oss.afmt = SNDRV_PCM_FORMAT_U8; - dev->oss.channels = 2; - dev->oss.read_count = 0; - dev->oss.read_offset = 0; + dev->oss.afmt = SNDRV_PCM_FORMAT_U8; + dev->oss.channels = 2; + dev->oss.read_count = 0; + dev->oss.read_offset = 0; - up(&dev->oss.lock); + up(&dev->oss.lock); saapcm = kcalloc(1, sizeof(*saapcm), GFP_KERNEL); if (saapcm == NULL) @@ -630,8 +630,8 @@ static int snd_card_saa7134_capture_open(snd_pcm_substream_t * substream) runtime->private_free = snd_card_saa7134_runtime_free; runtime->hw = snd_card_saa7134_capture; - if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) - return err; + if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) + return err; return 0; } @@ -723,7 +723,7 @@ static int snd_saa7134_volume_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_ right = 20; spin_lock_irqsave(&chip->mixer_lock, flags); change = chip->mixer_volume[addr][0] != left || - chip->mixer_volume[addr][1] != right; + chip->mixer_volume[addr][1] != right; chip->mixer_volume[addr][0] = left; chip->mixer_volume[addr][1] = right; spin_unlock_irqrestore(&chip->mixer_lock, flags); @@ -764,7 +764,7 @@ static int snd_saa7134_capsrc_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_ unsigned long flags; int change, addr = kcontrol->private_value; int left, right; - u32 anabar, xbarin; + u32 anabar, xbarin; int analog_io, rate; struct saa7134_dev *dev; @@ -775,7 +775,7 @@ static int snd_saa7134_capsrc_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_ spin_lock_irqsave(&chip->mixer_lock, flags); change = chip->capture_source[addr][0] != left || - chip->capture_source[addr][1] != right; + chip->capture_source[addr][1] != right; chip->capture_source[addr][0] = left; chip->capture_source[addr][1] = right; dev->oss.input=addr; @@ -783,57 +783,57 @@ static int snd_saa7134_capsrc_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_ if (change) { - switch (dev->pci->device) { + switch (dev->pci->device) { case PCI_DEVICE_ID_PHILIPS_SAA7134: - switch (addr) { - case MIXER_ADDR_TVTUNER: - saa_andorb(SAA7134_AUDIO_FORMAT_CTRL, 0xc0, 0xc0); - saa_andorb(SAA7134_SIF_SAMPLE_FREQ, 0x03, 0x00); - break; - case MIXER_ADDR_LINE1: - case MIXER_ADDR_LINE2: - analog_io = (MIXER_ADDR_LINE1 == addr) ? 0x00 : 0x08; - rate = (32000 == dev->oss.rate) ? 0x01 : 0x03; - saa_andorb(SAA7134_ANALOG_IO_SELECT, 0x08, analog_io); - saa_andorb(SAA7134_AUDIO_FORMAT_CTRL, 0xc0, 0x80); - saa_andorb(SAA7134_SIF_SAMPLE_FREQ, 0x03, rate); - break; - } - - break; + switch (addr) { + case MIXER_ADDR_TVTUNER: + saa_andorb(SAA7134_AUDIO_FORMAT_CTRL, 0xc0, 0xc0); + saa_andorb(SAA7134_SIF_SAMPLE_FREQ, 0x03, 0x00); + break; + case MIXER_ADDR_LINE1: + case MIXER_ADDR_LINE2: + analog_io = (MIXER_ADDR_LINE1 == addr) ? 0x00 : 0x08; + rate = (32000 == dev->oss.rate) ? 0x01 : 0x03; + saa_andorb(SAA7134_ANALOG_IO_SELECT, 0x08, analog_io); + saa_andorb(SAA7134_AUDIO_FORMAT_CTRL, 0xc0, 0x80); + saa_andorb(SAA7134_SIF_SAMPLE_FREQ, 0x03, rate); + break; + } + + break; case PCI_DEVICE_ID_PHILIPS_SAA7133: case PCI_DEVICE_ID_PHILIPS_SAA7135: - xbarin = 0x03; // adc + xbarin = 0x03; // adc anabar = 0; - switch (addr) { - case MIXER_ADDR_TVTUNER: - xbarin = 0; // Demodulator - anabar = 2; // DACs - break; - case MIXER_ADDR_LINE1: - anabar = 0; // aux1, aux1 - break; - case MIXER_ADDR_LINE2: - anabar = 9; // aux2, aux2 - break; - } + switch (addr) { + case MIXER_ADDR_TVTUNER: + xbarin = 0; // Demodulator + anabar = 2; // DACs + break; + case MIXER_ADDR_LINE1: + anabar = 0; // aux1, aux1 + break; + case MIXER_ADDR_LINE2: + anabar = 9; // aux2, aux2 + break; + } /* output xbar always main channel */ - saa_dsp_writel(dev, SAA7133_DIGITAL_OUTPUT_SEL1, 0xbbbb10); + saa_dsp_writel(dev, SAA7133_DIGITAL_OUTPUT_SEL1, 0xbbbb10); if (left || right) { // We've got data, turn the input on - //saa_dsp_writel(dev, SAA7133_DIGITAL_OUTPUT_SEL2, 0x101010); - saa_dsp_writel(dev, SAA7133_DIGITAL_INPUT_XBAR1, xbarin); - saa_writel(SAA7133_ANALOG_IO_SELECT, anabar); + //saa_dsp_writel(dev, SAA7133_DIGITAL_OUTPUT_SEL2, 0x101010); + saa_dsp_writel(dev, SAA7133_DIGITAL_INPUT_XBAR1, xbarin); + saa_writel(SAA7133_ANALOG_IO_SELECT, anabar); } else { - //saa_dsp_writel(dev, SAA7133_DIGITAL_OUTPUT_SEL2, 0x101010); - saa_dsp_writel(dev, SAA7133_DIGITAL_INPUT_XBAR1, 0); - saa_writel(SAA7133_ANALOG_IO_SELECT, 0); + //saa_dsp_writel(dev, SAA7133_DIGITAL_OUTPUT_SEL2, 0x101010); + saa_dsp_writel(dev, SAA7133_DIGITAL_INPUT_XBAR1, 0); + saa_writel(SAA7133_ANALOG_IO_SELECT, 0); } break; } - } + } return change; } @@ -878,8 +878,8 @@ static int snd_saa7134_free(snd_card_saa7134_t *chip) static int snd_saa7134_dev_free(snd_device_t *device) { - snd_card_saa7134_t *chip = device->device_data; - return snd_saa7134_free(chip); + snd_card_saa7134_t *chip = device->device_data; + return snd_saa7134_free(chip); } /* @@ -896,12 +896,12 @@ int alsa_card_saa7134_create(struct saa7134_dev *saadev, unsigned int devicenum) snd_card_t *card; snd_card_saa7134_t *chip; int err; - static snd_device_ops_t ops = { - .dev_free = snd_saa7134_dev_free, - }; + static snd_device_ops_t ops = { + .dev_free = snd_saa7134_dev_free, + }; - if (dev >= SNDRV_CARDS) - return -ENODEV; + if (dev >= SNDRV_CARDS) + return -ENODEV; if (!enable[dev]) return -ENODEV; @@ -918,24 +918,24 @@ int alsa_card_saa7134_create(struct saa7134_dev *saadev, unsigned int devicenum) /* Card "creation" */ chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); - if (chip == NULL) { - return -ENOMEM; - } + if (chip == NULL) { + return -ENOMEM; + } - spin_lock_init(&chip->lock); + spin_lock_init(&chip->lock); - chip->saadev = saadev; + chip->saadev = saadev; - chip->card = card; + chip->card = card; - chip->pci = saadev->pci; - chip->irq = saadev->pci->irq; - chip->iobase = pci_resource_start(saadev->pci, 0); + chip->pci = saadev->pci; + chip->irq = saadev->pci->irq; + chip->iobase = pci_resource_start(saadev->pci, 0); - if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { - snd_saa7134_free(chip); - return err; - } + if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { + snd_saa7134_free(chip); + return err; + } if ((err = snd_card_saa7134_new_mixer(chip)) < 0) goto __nodev; @@ -943,15 +943,15 @@ int alsa_card_saa7134_create(struct saa7134_dev *saadev, unsigned int devicenum) if ((err = snd_card_saa7134_pcm(chip, 0)) < 0) goto __nodev; - spin_lock_init(&chip->mixer_lock); + spin_lock_init(&chip->mixer_lock); snd_card_set_dev(card, &chip->pci->dev); /* End of "creation" */ strcpy(card->shortname, "SAA7134"); - sprintf(card->longname, "%s at 0x%lx irq %d", - chip->saadev->name, chip->iobase, chip->irq); + sprintf(card->longname, "%s at 0x%lx irq %d", + chip->saadev->name, chip->iobase, chip->irq); if ((err = snd_card_register(card)) == 0) { snd_saa7134_cards[dev] = card; @@ -966,8 +966,8 @@ __nodev: void alsa_card_saa7134_exit(void) { - int idx; - for (idx = 0; idx < SNDRV_CARDS; idx++) { - snd_card_free(snd_saa7134_cards[idx]); + int idx; + for (idx = 0; idx < SNDRV_CARDS; idx++) { + snd_card_free(snd_saa7134_cards[idx]); } } diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index 17b0549f2e1b..a60d49af341d 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c @@ -2114,16 +2114,16 @@ struct saa7134_board saa7134_boards[] = { }, }, [SAA7134_BOARD_BEHOLD_409FM] = { - /* , Sergey */ - .name = "Beholder BeholdTV 409 FM", - .audio_clock = 0x00187de7, - .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, - .radio_type = UNSET, - .tuner_addr = ADDR_UNSET, - .radio_addr = ADDR_UNSET, - .tda9887_conf = TDA9887_PRESENT, - .inputs = {{ - .name = name_tv, + /* , Sergey */ + .name = "Beholder BeholdTV 409 FM", + .audio_clock = 0x00187de7, + .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .tda9887_conf = TDA9887_PRESENT, + .inputs = {{ + .name = name_tv, .vmux = 3, .amux = TV, .tv = 1, @@ -2131,60 +2131,60 @@ struct saa7134_board saa7134_boards[] = { .name = name_comp1, .vmux = 1, .amux = LINE1, - },{ - .name = name_svideo, + },{ + .name = name_svideo, .vmux = 8, .amux = LINE1, - }}, - .radio = { - .name = name_radio, + }}, + .radio = { + .name = name_radio, .amux = LINE2, - }, - }, - [SAA7134_BOARD_GOTVIEW_7135] = { + }, + }, + [SAA7134_BOARD_GOTVIEW_7135] = { /* Mike Baikov */ /* Andrey Cvetcov */ - .name = "GoTView 7135 PCI", - .audio_clock = 0x00187de7, - .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, - .radio_type = UNSET, - .tuner_addr = ADDR_UNSET, - .radio_addr = ADDR_UNSET, - .tda9887_conf = TDA9887_PRESENT, - .gpiomask = 0x00200003, - .inputs = {{ - .name = name_tv, - .vmux = 1, - .amux = TV, - .tv = 1, - .gpio = 0x00200003, - },{ - .name = name_tv_mono, - .vmux = 1, - .amux = LINE2, - .gpio = 0x00200003, - },{ - .name = name_comp1, - .vmux = 3, - .amux = LINE1, - .gpio = 0x00200003, - },{ - .name = name_svideo, - .vmux = 8, - .amux = LINE1, - .gpio = 0x00200003, - }}, - .radio = { - .name = name_radio, - .amux = LINE2, - .gpio = 0x00200003, - }, - .mute = { - .name = name_mute, - .amux = TV, - .gpio = 0x00200003, - }, - }, + .name = "GoTView 7135 PCI", + .audio_clock = 0x00187de7, + .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .tda9887_conf = TDA9887_PRESENT, + .gpiomask = 0x00200003, + .inputs = {{ + .name = name_tv, + .vmux = 1, + .amux = TV, + .tv = 1, + .gpio = 0x00200003, + },{ + .name = name_tv_mono, + .vmux = 1, + .amux = LINE2, + .gpio = 0x00200003, + },{ + .name = name_comp1, + .vmux = 3, + .amux = LINE1, + .gpio = 0x00200003, + },{ + .name = name_svideo, + .vmux = 8, + .amux = LINE1, + .gpio = 0x00200003, + }}, + .radio = { + .name = name_radio, + .amux = LINE2, + .gpio = 0x00200003, + }, + .mute = { + .name = name_mute, + .amux = TV, + .gpio = 0x00200003, + }, + }, [SAA7134_BOARD_PHILIPS_EUROPA] = { .name = "Philips EUROPA V3 reference design", .audio_clock = 0x00187de7, @@ -2251,78 +2251,78 @@ struct saa7134_board saa7134_boards[] = { .amux = LINE1, }}, }, - [SAA7134_BOARD_RTD_VFG7350] = { - .name = "RTD Embedded Technologies VFG7350", - .audio_clock = 0x00200000, - .tuner_type = TUNER_ABSENT, - .radio_type = UNSET, - .tuner_addr = ADDR_UNSET, - .radio_addr = ADDR_UNSET, - .inputs = {{ - .name = "Composite 0", - .vmux = 0, - .amux = LINE1, - },{ - .name = "Composite 1", - .vmux = 1, - .amux = LINE2, - },{ - .name = "Composite 2", - .vmux = 2, - .amux = LINE1, - },{ - .name = "Composite 3", - .vmux = 3, - .amux = LINE2, - },{ - .name = "S-Video 0", - .vmux = 8, - .amux = LINE1, - },{ - .name = "S-Video 1", - .vmux = 9, - .amux = LINE2, - }}, - .mpeg = SAA7134_MPEG_EMPRESS, - .video_out = CCIR656, + [SAA7134_BOARD_RTD_VFG7350] = { + .name = "RTD Embedded Technologies VFG7350", + .audio_clock = 0x00200000, + .tuner_type = TUNER_ABSENT, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .inputs = {{ + .name = "Composite 0", + .vmux = 0, + .amux = LINE1, + },{ + .name = "Composite 1", + .vmux = 1, + .amux = LINE2, + },{ + .name = "Composite 2", + .vmux = 2, + .amux = LINE1, + },{ + .name = "Composite 3", + .vmux = 3, + .amux = LINE2, + },{ + .name = "S-Video 0", + .vmux = 8, + .amux = LINE1, + },{ + .name = "S-Video 1", + .vmux = 9, + .amux = LINE2, + }}, + .mpeg = SAA7134_MPEG_EMPRESS, + .video_out = CCIR656, .vid_port_opts = ( SET_T_CODE_POLARITY_NON_INVERTED | SET_CLOCK_NOT_DELAYED | SET_CLOCK_INVERTED | SET_VSYNC_OFF ), - }, - [SAA7134_BOARD_RTD_VFG7330] = { - .name = "RTD Embedded Technologies VFG7330", - .audio_clock = 0x00200000, - .tuner_type = TUNER_ABSENT, - .radio_type = UNSET, - .tuner_addr = ADDR_UNSET, - .radio_addr = ADDR_UNSET, - .inputs = {{ - .name = "Composite 0", - .vmux = 0, - .amux = LINE1, - },{ - .name = "Composite 1", - .vmux = 1, - .amux = LINE2, - },{ - .name = "Composite 2", - .vmux = 2, - .amux = LINE1, - },{ - .name = "Composite 3", - .vmux = 3, - .amux = LINE2, - },{ - .name = "S-Video 0", - .vmux = 8, - .amux = LINE1, - },{ - .name = "S-Video 1", - .vmux = 9, - .amux = LINE2, - }}, - }, + }, + [SAA7134_BOARD_RTD_VFG7330] = { + .name = "RTD Embedded Technologies VFG7330", + .audio_clock = 0x00200000, + .tuner_type = TUNER_ABSENT, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .inputs = {{ + .name = "Composite 0", + .vmux = 0, + .amux = LINE1, + },{ + .name = "Composite 1", + .vmux = 1, + .amux = LINE2, + },{ + .name = "Composite 2", + .vmux = 2, + .amux = LINE1, + },{ + .name = "Composite 3", + .vmux = 3, + .amux = LINE2, + },{ + .name = "S-Video 0", + .vmux = 8, + .amux = LINE1, + },{ + .name = "S-Video 1", + .vmux = 9, + .amux = LINE2, + }}, + }, [SAA7134_BOARD_FLYTVPLATINUM_MINI2] = { .name = "LifeView FlyTV Platinum Mini2", .audio_clock = 0x00200000, @@ -2760,55 +2760,55 @@ struct pci_device_id saa7134_pci_tbl[] = { .subvendor = 0x0000, /* It shouldn't break anything, since subdevice id seems unique */ .subdevice = 0x4091, .driver_data = SAA7134_BOARD_BEHOLD_409FM, - },{ - .vendor = PCI_VENDOR_ID_PHILIPS, - .device = PCI_DEVICE_ID_PHILIPS_SAA7133, - .subvendor = 0x5456, /* GoTView */ - .subdevice = 0x7135, - .driver_data = SAA7134_BOARD_GOTVIEW_7135, - },{ + },{ + .vendor = PCI_VENDOR_ID_PHILIPS, + .device = PCI_DEVICE_ID_PHILIPS_SAA7133, + .subvendor = 0x5456, /* GoTView */ + .subdevice = 0x7135, + .driver_data = SAA7134_BOARD_GOTVIEW_7135, + },{ .vendor = PCI_VENDOR_ID_PHILIPS, .device = PCI_DEVICE_ID_PHILIPS_SAA7134, .subvendor = PCI_VENDOR_ID_PHILIPS, .subdevice = 0x2004, .driver_data = SAA7134_BOARD_PHILIPS_EUROPA, - },{ + },{ .vendor = PCI_VENDOR_ID_PHILIPS, .device = PCI_DEVICE_ID_PHILIPS_SAA7134, .subvendor = 0x185b, .subdevice = 0xc900, .driver_data = SAA7134_BOARD_VIDEOMATE_DVBT_300, - },{ + },{ .vendor = PCI_VENDOR_ID_PHILIPS, .device = PCI_DEVICE_ID_PHILIPS_SAA7130, .subvendor = 0x185b, .subdevice = 0xc901, .driver_data = SAA7134_BOARD_VIDEOMATE_DVBT_200, },{ - .vendor = PCI_VENDOR_ID_PHILIPS, - .device = PCI_DEVICE_ID_PHILIPS_SAA7133, - .subvendor = 0x1435, - .subdevice = 0x7350, - .driver_data = SAA7134_BOARD_RTD_VFG7350, - },{ - .vendor = PCI_VENDOR_ID_PHILIPS, - .device = PCI_DEVICE_ID_PHILIPS_SAA7133, - .subvendor = 0x1435, - .subdevice = 0x7330, - .driver_data = SAA7134_BOARD_RTD_VFG7330, - },{ - .vendor = PCI_VENDOR_ID_PHILIPS, - .device = PCI_DEVICE_ID_PHILIPS_SAA7133, - .subvendor = 0x1461, - .subdevice = 0x1044, - .driver_data = SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180, - },{ + .vendor = PCI_VENDOR_ID_PHILIPS, + .device = PCI_DEVICE_ID_PHILIPS_SAA7133, + .subvendor = 0x1435, + .subdevice = 0x7350, + .driver_data = SAA7134_BOARD_RTD_VFG7350, + },{ + .vendor = PCI_VENDOR_ID_PHILIPS, + .device = PCI_DEVICE_ID_PHILIPS_SAA7133, + .subvendor = 0x1435, + .subdevice = 0x7330, + .driver_data = SAA7134_BOARD_RTD_VFG7330, + },{ + .vendor = PCI_VENDOR_ID_PHILIPS, + .device = PCI_DEVICE_ID_PHILIPS_SAA7133, + .subvendor = 0x1461, + .subdevice = 0x1044, + .driver_data = SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180, + },{ .vendor = PCI_VENDOR_ID_PHILIPS, .device = PCI_DEVICE_ID_PHILIPS_SAA7133, .subvendor = 0x1131, .subdevice = 0x4ee9, .driver_data = SAA7134_BOARD_MONSTERTV_MOBILE, - },{ + },{ /* --- boards without eeprom + subsystem ID --- */ .vendor = PCI_VENDOR_ID_PHILIPS, .device = PCI_DEVICE_ID_PHILIPS_SAA7134, @@ -3051,7 +3051,7 @@ int saa7134_board_init2(struct saa7134_dev *dev) case SAA7134_BOARD_VIDEOMATE_DVBT_300: /* The Philips EUROPA based hybrid boards have the tuner connected through * the channel decoder. We have to make it transparent to find it - */ + */ { struct tuner_setup tun_setup; u8 data[] = { 0x07, 0x02}; @@ -3063,7 +3063,7 @@ int saa7134_board_init2(struct saa7134_dev *dev) tun_setup.addr = dev->tuner_addr; saa7134_i2c_call_clients (dev, TUNER_SET_TYPE_ADDR,&tun_setup); - } + } break; } return 0; diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index 907dbd4de7c9..afa0cfce6578 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c @@ -201,10 +201,10 @@ static int pending_call(struct notifier_block *self, unsigned long state, if (module != THIS_MODULE || state != MODULE_STATE_LIVE) return NOTIFY_DONE; - if (need_empress) - request_module("saa7134-empress"); - if (need_dvb) - request_module("saa7134-dvb"); + if (need_empress) + request_module("saa7134-empress"); + if (need_dvb) + request_module("saa7134-dvb"); return NOTIFY_DONE; } @@ -279,8 +279,8 @@ unsigned long saa7134_buffer_base(struct saa7134_buf *buf) int saa7134_pgtable_alloc(struct pci_dev *pci, struct saa7134_pgtable *pt) { - __le32 *cpu; - dma_addr_t dma_addr; + __le32 *cpu; + dma_addr_t dma_addr; cpu = pci_alloc_consistent(pci, SAA7134_PGTABLE_SIZE, &dma_addr); if (NULL == cpu) @@ -440,7 +440,7 @@ int saa7134_set_dmabits(struct saa7134_dev *dev) ctrl |= SAA7134_MAIN_CTRL_TE0; irq |= SAA7134_IRQ1_INTE_RA0_1 | SAA7134_IRQ1_INTE_RA0_0; - cap = dev->video_q.curr->vb.field; + cap = dev->video_q.curr->vb.field; } /* video capture -- dma 1+2 (planar modes) */ @@ -646,7 +646,7 @@ static int saa7134_hwinit1(struct saa7134_dev *dev) saa_writel(SAA7134_IRQ1, 0); saa_writel(SAA7134_IRQ2, 0); - init_MUTEX(&dev->lock); + init_MUTEX(&dev->lock); spin_lock_init(&dev->slock); saa7134_track_gpio(dev,"pre-init"); @@ -704,7 +704,7 @@ static int saa7134_hwinit2(struct saa7134_dev *dev) saa7134_tvaudio_init2(dev); /* enable IRQ's */ - irq2_mask = + irq2_mask = SAA7134_IRQ2_INTE_DEC3 | SAA7134_IRQ2_INTE_DEC2 | SAA7134_IRQ2_INTE_DEC1 | @@ -889,8 +889,8 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, /* print pci info */ pci_read_config_byte(pci_dev, PCI_CLASS_REVISION, &dev->pci_rev); - pci_read_config_byte(pci_dev, PCI_LATENCY_TIMER, &dev->pci_lat); - printk(KERN_INFO "%s: found at %s, rev: %d, irq: %d, " + pci_read_config_byte(pci_dev, PCI_LATENCY_TIMER, &dev->pci_lat); + printk(KERN_INFO "%s: found at %s, rev: %d, irq: %d, " "latency: %d, mmio: 0x%lx\n", dev->name, pci_name(pci_dev), dev->pci_rev, pci_dev->irq, dev->pci_lat,pci_resource_start(pci_dev,0)); @@ -914,7 +914,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, dev->tda9887_conf = saa7134_boards[dev->board].tda9887_conf; if (UNSET != tuner[dev->nr]) dev->tuner_type = tuner[dev->nr]; - printk(KERN_INFO "%s: subsystem: %04x:%04x, board: %s [card=%d,%s]\n", + printk(KERN_INFO "%s: subsystem: %04x:%04x, board: %s [card=%d,%s]\n", dev->name,pci_dev->subsystem_vendor, pci_dev->subsystem_device,saa7134_boards[dev->board].name, dev->board, card[dev->nr] == dev->board ? @@ -964,12 +964,12 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, request_module("tuner"); if (dev->tda9887_conf) request_module("tda9887"); - if (card_is_empress(dev)) { + if (card_is_empress(dev)) { request_module("saa6752hs"); request_module_depend("saa7134-empress",&need_empress); } - if (card_is_dvb(dev)) + if (card_is_dvb(dev)) request_module_depend("saa7134-dvb",&need_dvb); v4l2_prio_init(&dev->prio); @@ -1078,7 +1078,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, static void __devexit saa7134_finidev(struct pci_dev *pci_dev) { - struct saa7134_dev *dev = pci_get_drvdata(pci_dev); + struct saa7134_dev *dev = pci_get_drvdata(pci_dev); struct list_head *item; struct saa7134_mpeg_ops *mops; @@ -1173,10 +1173,10 @@ EXPORT_SYMBOL(saa7134_ts_unregister); /* ----------------------------------------------------------- */ static struct pci_driver saa7134_pci_driver = { - .name = "saa7134", - .id_table = saa7134_pci_tbl, - .probe = saa7134_initdev, - .remove = __devexit_p(saa7134_finidev), + .name = "saa7134", + .id_table = saa7134_pci_tbl, + .probe = saa7134_initdev, + .remove = __devexit_p(saa7134_finidev), }; static int saa7134_init(void) diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c index 87641f7e4322..5aadd44c2fa2 100644 --- a/drivers/media/video/saa7134/saa7134-dvb.c +++ b/drivers/media/video/saa7134/saa7134-dvb.c @@ -547,7 +547,7 @@ static int philips_tda827x_pll_set(struct dvb_frontend *fe, struct dvb_frontend_ u8 tuner_buf[14]; struct i2c_msg tuner_msg = {.addr = 0x60,.flags = 0,.buf = tuner_buf, - .len = sizeof(tuner_buf) }; + .len = sizeof(tuner_buf) }; int i, tuner_freq, if_freq; u32 N; switch (params->u.ofdm.bandwidth) { @@ -606,7 +606,7 @@ static void philips_tda827x_pll_sleep(struct dvb_frontend *fe) struct saa7134_dev *dev = fe->dvb->priv; static u8 tda827x_sleep[] = { 0x30, 0xd0}; struct i2c_msg tuner_msg = {.addr = 0x60,.flags = 0,.buf = tda827x_sleep, - .len = sizeof(tda827x_sleep) }; + .len = sizeof(tda827x_sleep) }; i2c_transfer(&dev->i2c_adap, &tuner_msg, 1); } diff --git a/drivers/media/video/saa7134/saa7134-empress.c b/drivers/media/video/saa7134/saa7134-empress.c index 77b627eb6483..e9ec69efb4c9 100644 --- a/drivers/media/video/saa7134/saa7134-empress.c +++ b/drivers/media/video/saa7134/saa7134-empress.c @@ -55,7 +55,7 @@ static void ts_reset_encoder(struct saa7134_dev* dev) saa_writeb(SAA7134_SPECIAL_MODE, 0x00); msleep(10); - saa_writeb(SAA7134_SPECIAL_MODE, 0x01); + saa_writeb(SAA7134_SPECIAL_MODE, 0x01); msleep(100); dev->empress_started = 0; } @@ -65,7 +65,7 @@ static int ts_init_encoder(struct saa7134_dev* dev) ts_reset_encoder(dev); saa7134_i2c_call_clients(dev, VIDIOC_S_MPEGCOMP, NULL); dev->empress_started = 1; - return 0; + return 0; } /* ------------------------------------------------------------------ */ @@ -169,7 +169,7 @@ static int ts_do_ioctl(struct inode *inode, struct file *file, struct v4l2_capability *cap = arg; memset(cap,0,sizeof(*cap)); - strcpy(cap->driver, "saa7134"); + strcpy(cap->driver, "saa7134"); strlcpy(cap->card, saa7134_boards[dev->board].name, sizeof(cap->card)); sprintf(cap->bus_info,"PCI:%s",pci_name(dev->pci)); diff --git a/drivers/media/video/saa7134/saa7134-i2c.c b/drivers/media/video/saa7134/saa7134-i2c.c index 711aa8e85fac..2577d03485b8 100644 --- a/drivers/media/video/saa7134/saa7134-i2c.c +++ b/drivers/media/video/saa7134/saa7134-i2c.c @@ -239,7 +239,7 @@ static int saa7134_i2c_xfer(struct i2c_adapter *i2c_adap, unsigned char data; int addr,rc,i,byte; - status = i2c_get_status(dev); + status = i2c_get_status(dev); if (!i2c_is_idle(status)) if (!i2c_reset(dev)) return -EIO; @@ -296,7 +296,7 @@ static int saa7134_i2c_xfer(struct i2c_adapter *i2c_adap, rc = -EIO; if (!i2c_is_busy_wait(dev)) goto err; - status = i2c_get_status(dev); + status = i2c_get_status(dev); if (i2c_is_error(status)) goto err; /* ensure that the bus is idle for at least one bit slot */ @@ -348,12 +348,12 @@ static int attach_inform(struct i2c_client *client) client->driver->command(client, TUNER_SET_TYPE_ADDR, &tun_setup); } - } + } if (tuner != UNSET) { - tun_setup.type = tuner; - tun_setup.addr = saa7134_boards[dev->board].tuner_addr; + tun_setup.type = tuner; + tun_setup.addr = saa7134_boards[dev->board].tuner_addr; if ((tun_setup.addr == ADDR_UNSET)||(tun_setup.addr == client->addr)) { @@ -361,11 +361,11 @@ static int attach_inform(struct i2c_client *client) client->driver->command(client,TUNER_SET_TYPE_ADDR, &tun_setup); } - } + } client->driver->command(client, TDA9887_SET_CONFIG, &conf); - return 0; + return 0; } static struct i2c_algorithm saa7134_algo = { diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index 9dc41c1427a8..7ce0459989b5 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -114,24 +114,24 @@ static IR_KEYTAB_TYPE cinergy_codes[IR_KEYTAB_SIZE] = { /* Alfons Geser * updates from Job D. R. Borges */ static IR_KEYTAB_TYPE eztv_codes[IR_KEYTAB_SIZE] = { - [ 18 ] = KEY_POWER, - [ 1 ] = KEY_TV, // DVR - [ 21 ] = KEY_DVD, // DVD - [ 23 ] = KEY_AUDIO, // music - // DVR mode / DVD mode / music mode - - [ 27 ] = KEY_MUTE, // mute - [ 2 ] = KEY_LANGUAGE, // MTS/SAP / audio / autoseek - [ 30 ] = KEY_SUBTITLE, // closed captioning / subtitle / seek - [ 22 ] = KEY_ZOOM, // full screen - [ 28 ] = KEY_VIDEO, // video source / eject / delall - [ 29 ] = KEY_RESTART, // playback / angle / del - [ 47 ] = KEY_SEARCH, // scan / menu / playlist - [ 48 ] = KEY_CHANNEL, // CH surfing / bookmark / memo - - [ 49 ] = KEY_HELP, // help - [ 50 ] = KEY_MODE, // num/memo - [ 51 ] = KEY_ESC, // cancel + [ 18 ] = KEY_POWER, + [ 1 ] = KEY_TV, // DVR + [ 21 ] = KEY_DVD, // DVD + [ 23 ] = KEY_AUDIO, // music + // DVR mode / DVD mode / music mode + + [ 27 ] = KEY_MUTE, // mute + [ 2 ] = KEY_LANGUAGE, // MTS/SAP / audio / autoseek + [ 30 ] = KEY_SUBTITLE, // closed captioning / subtitle / seek + [ 22 ] = KEY_ZOOM, // full screen + [ 28 ] = KEY_VIDEO, // video source / eject / delall + [ 29 ] = KEY_RESTART, // playback / angle / del + [ 47 ] = KEY_SEARCH, // scan / menu / playlist + [ 48 ] = KEY_CHANNEL, // CH surfing / bookmark / memo + + [ 49 ] = KEY_HELP, // help + [ 50 ] = KEY_MODE, // num/memo + [ 51 ] = KEY_ESC, // cancel [ 12 ] = KEY_UP, // up [ 16 ] = KEY_DOWN, // down @@ -148,24 +148,24 @@ static IR_KEYTAB_TYPE eztv_codes[IR_KEYTAB_SIZE] = { [ 45 ] = KEY_PLAY, // play [ 46 ] = KEY_SHUFFLE, // snapshot / shuffle - [ 0 ] = KEY_KP0, - [ 5 ] = KEY_KP1, - [ 6 ] = KEY_KP2, - [ 7 ] = KEY_KP3, - [ 9 ] = KEY_KP4, - [ 10 ] = KEY_KP5, - [ 11 ] = KEY_KP6, - [ 13 ] = KEY_KP7, - [ 14 ] = KEY_KP8, - [ 15 ] = KEY_KP9, - - [ 42 ] = KEY_VOLUMEUP, - [ 17 ] = KEY_VOLUMEDOWN, - [ 24 ] = KEY_CHANNELUP, // CH.tracking up - [ 25 ] = KEY_CHANNELDOWN, // CH.tracking down - - [ 19 ] = KEY_KPENTER, // enter - [ 33 ] = KEY_KPDOT, // . (decimal dot) + [ 0 ] = KEY_KP0, + [ 5 ] = KEY_KP1, + [ 6 ] = KEY_KP2, + [ 7 ] = KEY_KP3, + [ 9 ] = KEY_KP4, + [ 10 ] = KEY_KP5, + [ 11 ] = KEY_KP6, + [ 13 ] = KEY_KP7, + [ 14 ] = KEY_KP8, + [ 15 ] = KEY_KP9, + + [ 42 ] = KEY_VOLUMEUP, + [ 17 ] = KEY_VOLUMEDOWN, + [ 24 ] = KEY_CHANNELUP, // CH.tracking up + [ 25 ] = KEY_CHANNELDOWN, // CH.tracking down + + [ 19 ] = KEY_KPENTER, // enter + [ 33 ] = KEY_KPDOT, // . (decimal dot) }; static IR_KEYTAB_TYPE avacssmart_codes[IR_KEYTAB_SIZE] = { @@ -455,13 +455,13 @@ static int build_key(struct saa7134_dev *dev) saa_setb(SAA7134_GPIO_GPMODE3,SAA7134_GPIO_GPRESCAN); gpio = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2); - if (ir->polling) { - if (ir->last_gpio == gpio) - return 0; - ir->last_gpio = gpio; - } + if (ir->polling) { + if (ir->last_gpio == gpio) + return 0; + ir->last_gpio = gpio; + } - data = ir_extract_bits(gpio, ir->mask_keycode); + data = ir_extract_bits(gpio, ir->mask_keycode); dprintk("build_key gpio=0x%x mask=0x%x data=%d\n", gpio, ir->mask_keycode, data); @@ -478,9 +478,9 @@ static int build_key(struct saa7134_dev *dev) void saa7134_input_irq(struct saa7134_dev *dev) { - struct saa7134_ir *ir = dev->remote; + struct saa7134_ir *ir = dev->remote; - if (!ir->polling) + if (!ir->polling) build_key(dev); } @@ -515,7 +515,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) switch (dev->board) { case SAA7134_BOARD_FLYVIDEO2000: case SAA7134_BOARD_FLYVIDEO3000: - case SAA7134_BOARD_FLYTVPLATINUM_FM: + case SAA7134_BOARD_FLYTVPLATINUM_FM: case SAA7134_BOARD_FLYTVPLATINUM_MINI2: ir_codes = flyvideo_codes; mask_keycode = 0xEC00000; @@ -557,7 +557,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) saa_setb(SAA7134_GPIO_GPMODE0, 0x4); saa_setb(SAA7134_GPIO_GPSTATUS0, 0x4); break; - case SAA7134_BOARD_KWORLD_TERMINATOR: + case SAA7134_BOARD_KWORLD_TERMINATOR: ir_codes = avacssmart_codes; mask_keycode = 0x00001f; mask_keyup = 0x000060; @@ -571,7 +571,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) mask_keyup = 0x004000; polling = 50; // ms break; - case SAA7134_BOARD_GOTVIEW_7135: + case SAA7134_BOARD_GOTVIEW_7135: ir_codes = gotview7135_codes; mask_keycode = 0x0003EC; mask_keyup = 0x008000; @@ -585,8 +585,8 @@ int saa7134_input_init1(struct saa7134_dev *dev) mask_keyup = 0x400000; polling = 50; // ms break; - case SAA7134_BOARD_VIDEOMATE_DVBT_300: - case SAA7134_BOARD_VIDEOMATE_DVBT_200: + case SAA7134_BOARD_VIDEOMATE_DVBT_300: + case SAA7134_BOARD_VIDEOMATE_DVBT_200: ir_codes = videomate_tv_pvr_codes; mask_keycode = 0x003F00; mask_keyup = 0x040000; @@ -610,7 +610,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) ir->mask_keycode = mask_keycode; ir->mask_keydown = mask_keydown; ir->mask_keyup = mask_keyup; - ir->polling = polling; + ir->polling = polling; /* init input device */ snprintf(ir->name, sizeof(ir->name), "saa7134 IR (%s)", diff --git a/drivers/media/video/saa7134/saa7134-oss.c b/drivers/media/video/saa7134/saa7134-oss.c index b1dcb4d10788..f1b0e0d93d7b 100644 --- a/drivers/media/video/saa7134/saa7134-oss.c +++ b/drivers/media/video/saa7134/saa7134-oss.c @@ -64,7 +64,7 @@ static int dsp_buffer_conf(struct saa7134_dev *dev, int blksize, int blocks) dev->oss.bufsize = blksize * blocks; dprintk("buffer config: %d blocks / %d bytes, %d kB total\n", - blocks,blksize,blksize * blocks / 1024); + blocks,blksize,blksize * blocks / 1024); return 0; } @@ -371,20 +371,20 @@ static int dsp_ioctl(struct inode *inode, struct file *file, if (oss_debug > 1) saa7134_print_ioctl(dev->name,cmd); - switch (cmd) { - case OSS_GETVERSION: - return put_user(SOUND_VERSION, p); - case SNDCTL_DSP_GETCAPS: + switch (cmd) { + case OSS_GETVERSION: + return put_user(SOUND_VERSION, p); + case SNDCTL_DSP_GETCAPS: return 0; - case SNDCTL_DSP_SPEED: + case SNDCTL_DSP_SPEED: if (get_user(val, p)) return -EFAULT; /* fall through */ - case SOUND_PCM_READ_RATE: + case SOUND_PCM_READ_RATE: return put_user(dev->oss.rate, p); - case SNDCTL_DSP_STEREO: + case SNDCTL_DSP_STEREO: if (get_user(val, p)) return -EFAULT; down(&dev->oss.lock); @@ -396,7 +396,7 @@ static int dsp_ioctl(struct inode *inode, struct file *file, up(&dev->oss.lock); return put_user(dev->oss.channels-1, p); - case SNDCTL_DSP_CHANNELS: + case SNDCTL_DSP_CHANNELS: if (get_user(val, p)) return -EFAULT; if (val != 1 && val != 2) @@ -409,15 +409,15 @@ static int dsp_ioctl(struct inode *inode, struct file *file, } up(&dev->oss.lock); /* fall through */ - case SOUND_PCM_READ_CHANNELS: + case SOUND_PCM_READ_CHANNELS: return put_user(dev->oss.channels, p); - case SNDCTL_DSP_GETFMTS: /* Returns a mask */ + case SNDCTL_DSP_GETFMTS: /* Returns a mask */ return put_user(AFMT_U8 | AFMT_S8 | AFMT_U16_LE | AFMT_U16_BE | AFMT_S16_LE | AFMT_S16_BE, p); - case SNDCTL_DSP_SETFMT: /* Selects ONE fmt */ + case SNDCTL_DSP_SETFMT: /* Selects ONE fmt */ if (get_user(val, p)) return -EFAULT; switch (val) { @@ -442,7 +442,7 @@ static int dsp_ioctl(struct inode *inode, struct file *file, return -EINVAL; } - case SOUND_PCM_READ_BITS: + case SOUND_PCM_READ_BITS: switch (dev->oss.afmt) { case AFMT_U8: case AFMT_S8: @@ -456,20 +456,20 @@ static int dsp_ioctl(struct inode *inode, struct file *file, return -EINVAL; } - case SNDCTL_DSP_NONBLOCK: - file->f_flags |= O_NONBLOCK; - return 0; + case SNDCTL_DSP_NONBLOCK: + file->f_flags |= O_NONBLOCK; + return 0; - case SNDCTL_DSP_RESET: + case SNDCTL_DSP_RESET: down(&dev->oss.lock); if (dev->oss.recording_on) dsp_rec_stop(dev); up(&dev->oss.lock); return 0; - case SNDCTL_DSP_GETBLKSIZE: + case SNDCTL_DSP_GETBLKSIZE: return put_user(dev->oss.blksize, p); - case SNDCTL_DSP_SETFRAGMENT: + case SNDCTL_DSP_SETFRAGMENT: if (get_user(val, p)) return -EFAULT; if (dev->oss.recording_on) @@ -480,7 +480,7 @@ static int dsp_ioctl(struct inode *inode, struct file *file, dsp_buffer_init(dev); return 0; - case SNDCTL_DSP_SYNC: + case SNDCTL_DSP_SYNC: /* NOP */ return 0; @@ -563,7 +563,7 @@ mixer_recsrc_7133(struct saa7134_dev *dev) switch (dev->oss.input) { case TV: xbarin = 0; // Demodulator - anabar = 2; // DACs + anabar = 2; // DACs break; case LINE1: anabar = 0; // aux1, aux1 @@ -667,28 +667,28 @@ static int mixer_ioctl(struct inode *inode, struct file *file, if (oss_debug > 1) saa7134_print_ioctl(dev->name,cmd); - switch (cmd) { - case OSS_GETVERSION: - return put_user(SOUND_VERSION, p); + switch (cmd) { + case OSS_GETVERSION: + return put_user(SOUND_VERSION, p); case SOUND_MIXER_INFO: { mixer_info info; memset(&info,0,sizeof(info)); - strlcpy(info.id, "TV audio", sizeof(info.id)); - strlcpy(info.name, dev->name, sizeof(info.name)); - info.modify_counter = dev->oss.count; - if (copy_to_user(argp, &info, sizeof(info))) - return -EFAULT; + strlcpy(info.id, "TV audio", sizeof(info.id)); + strlcpy(info.name, dev->name, sizeof(info.name)); + info.modify_counter = dev->oss.count; + if (copy_to_user(argp, &info, sizeof(info))) + return -EFAULT; return 0; } case SOUND_OLD_MIXER_INFO: { _old_mixer_info info; memset(&info,0,sizeof(info)); - strlcpy(info.id, "TV audio", sizeof(info.id)); - strlcpy(info.name, dev->name, sizeof(info.name)); - if (copy_to_user(argp, &info, sizeof(info))) - return -EFAULT; + strlcpy(info.id, "TV audio", sizeof(info.id)); + strlcpy(info.name, dev->name, sizeof(info.name)); + if (copy_to_user(argp, &info, sizeof(info))) + return -EFAULT; return 0; } case MIXER_READ(SOUND_MIXER_CAPS): @@ -771,7 +771,7 @@ struct file_operations saa7134_mixer_fops = { int saa7134_oss_init1(struct saa7134_dev *dev) { /* general */ - init_MUTEX(&dev->oss.lock); + init_MUTEX(&dev->oss.lock); init_waitqueue_head(&dev->oss.wq); switch (dev->pci->device) { diff --git a/drivers/media/video/saa7134/saa7134-reg.h b/drivers/media/video/saa7134/saa7134-reg.h index 58c521fade85..ac6431ba4fc3 100644 --- a/drivers/media/video/saa7134/saa7134-reg.h +++ b/drivers/media/video/saa7134/saa7134-reg.h @@ -27,7 +27,7 @@ /* DMA channels, n = 0 ... 6 */ #define SAA7134_RS_BA1(n) ((0x200 >> 2) + 4*n) -#define SAA7134_RS_BA2(n) ((0x204 >> 2) + 4*n) +#define SAA7134_RS_BA2(n) ((0x204 >> 2) + 4*n) #define SAA7134_RS_PITCH(n) ((0x208 >> 2) + 4*n) #define SAA7134_RS_CONTROL(n) ((0x20c >> 2) + 4*n) #define SAA7134_RS_CONTROL_WSWAP (0x01 << 25) @@ -53,14 +53,14 @@ /* main control */ #define SAA7134_MAIN_CTRL (0x2a8 >> 2) -#define SAA7134_MAIN_CTRL_VPLLE (1 << 15) -#define SAA7134_MAIN_CTRL_APLLE (1 << 14) -#define SAA7134_MAIN_CTRL_EXOSC (1 << 13) -#define SAA7134_MAIN_CTRL_EVFE1 (1 << 12) -#define SAA7134_MAIN_CTRL_EVFE2 (1 << 11) -#define SAA7134_MAIN_CTRL_ESFE (1 << 10) -#define SAA7134_MAIN_CTRL_EBADC (1 << 9) -#define SAA7134_MAIN_CTRL_EBDAC (1 << 8) +#define SAA7134_MAIN_CTRL_VPLLE (1 << 15) +#define SAA7134_MAIN_CTRL_APLLE (1 << 14) +#define SAA7134_MAIN_CTRL_EXOSC (1 << 13) +#define SAA7134_MAIN_CTRL_EVFE1 (1 << 12) +#define SAA7134_MAIN_CTRL_EVFE2 (1 << 11) +#define SAA7134_MAIN_CTRL_ESFE (1 << 10) +#define SAA7134_MAIN_CTRL_EBADC (1 << 9) +#define SAA7134_MAIN_CTRL_EBDAC (1 << 8) #define SAA7134_MAIN_CTRL_TE6 (1 << 6) #define SAA7134_MAIN_CTRL_TE5 (1 << 5) #define SAA7134_MAIN_CTRL_TE4 (1 << 4) diff --git a/drivers/media/video/saa7134/saa7134-ts.c b/drivers/media/video/saa7134/saa7134-ts.c index cdfd69873ba9..470903e2f5e5 100644 --- a/drivers/media/video/saa7134/saa7134-ts.c +++ b/drivers/media/video/saa7134/saa7134-ts.c @@ -111,8 +111,8 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, /* dma: setup channel 5 (= TS) */ control = SAA7134_RS_CONTROL_BURST_16 | - SAA7134_RS_CONTROL_ME | - (buf->pt->dma >> 12); + SAA7134_RS_CONTROL_ME | + (buf->pt->dma >> 12); saa_writeb(SAA7134_TS_DMA0, ((lines-1)&0xff)); saa_writeb(SAA7134_TS_DMA1, (((lines-1)>>8)&0xff)); diff --git a/drivers/media/video/saa7134/saa7134-tvaudio.c b/drivers/media/video/saa7134/saa7134-tvaudio.c index fdca6c563b96..3daf1b597958 100644 --- a/drivers/media/video/saa7134/saa7134-tvaudio.c +++ b/drivers/media/video/saa7134/saa7134-tvaudio.c @@ -246,7 +246,7 @@ static void mute_input_7134(struct saa7134_dev *dev) if (PCI_DEVICE_ID_PHILIPS_SAA7134 == dev->pci->device) /* 7134 mute */ saa_writeb(SAA7134_AUDIO_MUTE_CTRL, mute ? - SAA7134_MUTE_MASK | + SAA7134_MUTE_MASK | SAA7134_MUTE_ANALOG | SAA7134_MUTE_I2S : SAA7134_MUTE_MASK); @@ -761,17 +761,17 @@ static int mute_input_7133(struct saa7134_dev *dev) /* switch gpio-connected external audio mux */ - if (0 != card(dev).gpiomask) { - mask = card(dev).gpiomask; + if (0 != card(dev).gpiomask) { + mask = card(dev).gpiomask; if (card(dev).mute.name && dev->ctl_mute) in = &card(dev).mute; else in = dev->input; - saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, mask, mask); - saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, mask, in->gpio); - saa7134_track_gpio(dev,in->name); + saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, mask, mask); + saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, mask, in->gpio); + saa7134_track_gpio(dev,in->name); } return 0; diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index cd5545b2d60b..86db7fb96efd 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c @@ -310,12 +310,12 @@ static struct saa7134_tvnorm tvnorms[] = { .h_start = 0, .h_stop = 719, - .video_v_start = 23, - .video_v_stop = 262, - .vbi_v_start_0 = 10, - .vbi_v_stop_0 = 21, - .vbi_v_start_1 = 273, - .src_timing = 7, + .video_v_start = 23, + .video_v_stop = 262, + .vbi_v_start_0 = 10, + .vbi_v_stop_0 = 21, + .vbi_v_start_1 = 273, + .src_timing = 7, .sync_control = 0x18, .luma_control = 0x40, @@ -659,7 +659,7 @@ static void set_size(struct saa7134_dev *dev, int task, prescale = 1; xscale = 1024 * dev->crop_current.width / prescale / width; yscale = 512 * div * dev->crop_current.height / height; - dprintk("prescale=%d xscale=%d yscale=%d\n",prescale,xscale,yscale); + dprintk("prescale=%d xscale=%d yscale=%d\n",prescale,xscale,yscale); set_h_prescale(dev,task,prescale); saa_writeb(SAA7134_H_SCALE_INC1(task), xscale & 0xff); saa_writeb(SAA7134_H_SCALE_INC2(task), xscale >> 8); @@ -789,20 +789,20 @@ static int verify_preview(struct saa7134_dev *dev, struct v4l2_window *win) maxh = dev->crop_current.height; if (V4L2_FIELD_ANY == field) { - field = (win->w.height > maxh/2) - ? V4L2_FIELD_INTERLACED - : V4L2_FIELD_TOP; - } - switch (field) { - case V4L2_FIELD_TOP: - case V4L2_FIELD_BOTTOM: - maxh = maxh / 2; - break; - case V4L2_FIELD_INTERLACED: - break; - default: - return -EINVAL; - } + field = (win->w.height > maxh/2) + ? V4L2_FIELD_INTERLACED + : V4L2_FIELD_TOP; + } + switch (field) { + case V4L2_FIELD_TOP: + case V4L2_FIELD_BOTTOM: + maxh = maxh / 2; + break; + case V4L2_FIELD_INTERLACED: + break; + default: + return -EINVAL; + } win->field = field; if (win->w.width > maxw) @@ -1343,13 +1343,13 @@ video_poll(struct file *file, struct poll_table_struct *wait) if (res_locked(fh->dev,RESOURCE_VIDEO)) { up(&fh->cap.lock); return POLLERR; - } - if (0 != fh->cap.ops->buf_prepare(&fh->cap,fh->cap.read_buf,fh->cap.field)) { - up(&fh->cap.lock); - return POLLERR; - } - fh->cap.ops->buf_queue(&fh->cap,fh->cap.read_buf); - fh->cap.read_off = 0; + } + if (0 != fh->cap.ops->buf_prepare(&fh->cap,fh->cap.read_buf,fh->cap.field)) { + up(&fh->cap.lock); + return POLLERR; + } + fh->cap.ops->buf_queue(&fh->cap,fh->cap.read_buf); + fh->cap.read_off = 0; } up(&fh->cap.lock); buf = fh->cap.read_buf; @@ -1706,7 +1706,7 @@ static int video_do_ioctl(struct inode *inode, struct file *file, unsigned int tuner_type = dev->tuner_type; memset(cap,0,sizeof(*cap)); - strcpy(cap->driver, "saa7134"); + strcpy(cap->driver, "saa7134"); strlcpy(cap->card, saa7134_boards[dev->board].name, sizeof(cap->card)); sprintf(cap->bus_info,"PCI:%s",pci_name(dev->pci)); @@ -1934,26 +1934,26 @@ static int video_do_ioctl(struct inode *inode, struct file *file, } case VIDIOC_S_AUDIO: return 0; - case VIDIOC_G_PARM: - { - struct v4l2_captureparm *parm = arg; - memset(parm,0,sizeof(*parm)); - return 0; - } - - case VIDIOC_G_PRIORITY: - { - enum v4l2_priority *p = arg; - - *p = v4l2_prio_max(&dev->prio); - return 0; - } - case VIDIOC_S_PRIORITY: - { - enum v4l2_priority *prio = arg; - - return v4l2_prio_change(&dev->prio, &fh->prio, *prio); - } + case VIDIOC_G_PARM: + { + struct v4l2_captureparm *parm = arg; + memset(parm,0,sizeof(*parm)); + return 0; + } + + case VIDIOC_G_PRIORITY: + { + enum v4l2_priority *p = arg; + + *p = v4l2_prio_max(&dev->prio); + return 0; + } + case VIDIOC_S_PRIORITY: + { + enum v4l2_priority *prio = arg; + + return v4l2_prio_change(&dev->prio, &fh->prio, *prio); + } /* --- preview ioctls ---------------------------------------- */ case VIDIOC_ENUM_FMT: @@ -2102,7 +2102,7 @@ static int video_do_ioctl(struct inode *inode, struct file *file, { int res = saa7134_resource(fh); - if (!res_get(dev,fh,res)) + if (!res_get(dev,fh,res)) return -EBUSY; return videobuf_streamon(saa7134_queue(fh)); } @@ -2144,7 +2144,7 @@ static int radio_do_ioctl(struct inode *inode, struct file *file, struct v4l2_capability *cap = arg; memset(cap,0,sizeof(*cap)); - strcpy(cap->driver, "saa7134"); + strcpy(cap->driver, "saa7134"); strlcpy(cap->card, saa7134_boards[dev->board].name, sizeof(cap->card)); sprintf(cap->bus_info,"PCI:%s",pci_name(dev->pci)); @@ -2275,7 +2275,7 @@ struct video_device saa7134_video_template = { .name = "saa7134-video", .type = VID_TYPE_CAPTURE|VID_TYPE_TUNER|VID_TYPE_OVERLAY| - VID_TYPE_CLIPPING|VID_TYPE_SCALES, + VID_TYPE_CLIPPING|VID_TYPE_SCALES, .hardware = 0, .fops = &video_fops, .minor = -1, @@ -2322,7 +2322,7 @@ int saa7134_video_init1(struct saa7134_dev *dev) dev->tda9887_conf |= TDA9887_AUTOMUTE; dev->automute = 0; - INIT_LIST_HEAD(&dev->video_q.queue); + INIT_LIST_HEAD(&dev->video_q.queue); init_timer(&dev->video_q.timeout); dev->video_q.timeout.function = saa7134_buffer_timeout; dev->video_q.timeout.data = (unsigned long)(&dev->video_q); diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index 99bbdcf727c3..064c2f7a8c12 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h @@ -346,7 +346,7 @@ struct saa7134_fh { /* oss dsp status */ struct saa7134_oss { - struct semaphore lock; + struct semaphore lock; int minor_mixer; int minor_dsp; unsigned int users_dsp; @@ -384,9 +384,9 @@ struct saa7134_ir { u32 mask_keycode; u32 mask_keydown; u32 mask_keyup; - int polling; - u32 last_gpio; - struct timer_list timer; + int polling; + u32 last_gpio; + struct timer_list timer; }; /* ts/mpeg status */ @@ -409,8 +409,8 @@ struct saa7134_mpeg_ops { /* global device status */ struct saa7134_dev { struct list_head devlist; - struct semaphore lock; - spinlock_t slock; + struct semaphore lock; + spinlock_t slock; #ifdef VIDIOC_G_PRIORITY struct v4l2_prio_state prio; #endif diff --git a/drivers/media/video/tda7432.c b/drivers/media/video/tda7432.c index 255b6088ebf9..14cf1d357c3b 100644 --- a/drivers/media/video/tda7432.c +++ b/drivers/media/video/tda7432.c @@ -310,9 +310,9 @@ static int tda7432_attach(struct i2c_adapter *adap, int addr, int kind) memset(t,0,sizeof *t); client = &t->c; - memcpy(client,&client_template,sizeof(struct i2c_client)); - client->adapter = adap; - client->addr = addr; + memcpy(client,&client_template,sizeof(struct i2c_client)); + client->adapter = adap; + client->addr = addr; i2c_set_clientdata(client, t); do_tda7432_init(client); @@ -472,7 +472,7 @@ static int tda7432_command(struct i2c_client *client, } } - t->muted=(va->flags & VIDEO_AUDIO_MUTE); + t->muted=(va->flags & VIDEO_AUDIO_MUTE); if (t->muted) { /* Mute & update balance*/ @@ -503,12 +503,12 @@ static int tda7432_command(struct i2c_client *client, static struct i2c_driver driver = { .owner = THIS_MODULE, - .name = "i2c tda7432 driver", + .name = "i2c tda7432 driver", .id = I2C_DRIVERID_TDA7432, - .flags = I2C_DF_NOTIFY, + .flags = I2C_DF_NOTIFY, .attach_adapter = tda7432_probe, - .detach_client = tda7432_detach, - .command = tda7432_command, + .detach_client = tda7432_detach, + .command = tda7432_command, }; static struct i2c_client client_template = diff --git a/drivers/media/video/tda8290.c b/drivers/media/video/tda8290.c index 1e2acc4abbe6..e2027dada5d1 100644 --- a/drivers/media/video/tda8290.c +++ b/drivers/media/video/tda8290.c @@ -48,7 +48,7 @@ static struct freq_entry div_table[] = { { 0x1C34, 3 }, { 0x0D34, 2 }, { 0x067B, 1 }, - { 0x0000, 0 }, + { 0x0000, 0 }, }; static struct freq_entry agc_table[] = { diff --git a/drivers/media/video/tda9875.c b/drivers/media/video/tda9875.c index 7e3dcdb262b0..5a9faefc3640 100644 --- a/drivers/media/video/tda9875.c +++ b/drivers/media/video/tda9875.c @@ -126,20 +126,20 @@ static int tda9875_write(struct i2c_client *client, int subaddr, unsigned char v static int i2c_read_register(struct i2c_adapter *adap, int addr, int reg) { - unsigned char write[1]; - unsigned char read[1]; - struct i2c_msg msgs[2] = { - { addr, 0, 1, write }, - { addr, I2C_M_RD, 1, read } - }; - write[0] = reg; - - if (2 != i2c_transfer(adap,msgs,2)) { - printk(KERN_WARNING "tda9875: I/O error (read2)\n"); - return -1; - } - dprintk("tda9875: chip_read2: reg%d=0x%x\n",reg,read[0]); - return read[0]; + unsigned char write[1]; + unsigned char read[1]; + struct i2c_msg msgs[2] = { + { addr, 0, 1, write }, + { addr, I2C_M_RD, 1, read } + }; + write[0] = reg; + + if (2 != i2c_transfer(adap,msgs,2)) { + printk(KERN_WARNING "tda9875: I/O error (read2)\n"); + return -1; + } + dprintk("tda9875: chip_read2: reg%d=0x%x\n",reg,read[0]); + return read[0]; } static void tda9875_set(struct i2c_client *client) @@ -184,7 +184,7 @@ static void do_tda9875_init(struct i2c_client *client) tda9875_write(client, TDA9875_DACOS, 0x02 ); /* sig DAC i/o(in:nicam)*/ tda9875_write(client, TDA9875_ADCIS, 0x6f ); /* sig ADC input(in:mono)*/ tda9875_write(client, TDA9875_LOSR, 0x00 ); /* line out (in:mono)*/ - tda9875_write(client, TDA9875_AER, 0x00 ); /*06 Effect (AVL+PSEUDO) */ + tda9875_write(client, TDA9875_AER, 0x00 ); /*06 Effect (AVL+PSEUDO) */ tda9875_write(client, TDA9875_MCS, 0x44 ); /* Main ch select (DAC) */ tda9875_write(client, TDA9875_MVL, 0x03 ); /* Vol Main left 10dB */ tda9875_write(client, TDA9875_MVR, 0x03 ); /* Vol Main right 10dB*/ @@ -200,7 +200,7 @@ static void do_tda9875_init(struct i2c_client *client) t->mode=AUDIO_UNMUTE; t->lvol=t->rvol =0; /* 0dB */ - t->bass=0; /* 0dB */ + t->bass=0; /* 0dB */ t->treble=0; /* 0dB */ tda9875_set(client); @@ -239,9 +239,9 @@ static int tda9875_attach(struct i2c_adapter *adap, int addr, int kind) memset(t,0,sizeof *t); client = &t->c; - memcpy(client,&client_template,sizeof(struct i2c_client)); - client->adapter = adap; - client->addr = addr; + memcpy(client,&client_template,sizeof(struct i2c_client)); + client->adapter = adap; + client->addr = addr; i2c_set_clientdata(client, t); if(!tda9875_checkit(adap,addr)) { @@ -287,7 +287,7 @@ static int tda9875_command(struct i2c_client *client, dprintk("In tda9875_command...\n"); switch (cmd) { - /* --- v4l ioctls --- */ + /* --- v4l ioctls --- */ /* take care: bttv does userspace copying, we'll get a kernel pointer here... */ case VIDIOCGAUDIO: @@ -355,7 +355,7 @@ static int tda9875_command(struct i2c_client *client, //printk("tda9875 bal:%04x vol:%04x bass:%04x treble:%04x\n",va->balance,va->volume,va->bass,va->treble); - tda9875_set(client); + tda9875_set(client); break; @@ -374,18 +374,18 @@ static int tda9875_command(struct i2c_client *client, static struct i2c_driver driver = { .owner = THIS_MODULE, - .name = "i2c tda9875 driver", - .id = I2C_DRIVERID_TDA9875, - .flags = I2C_DF_NOTIFY, + .name = "i2c tda9875 driver", + .id = I2C_DRIVERID_TDA9875, + .flags = I2C_DF_NOTIFY, .attach_adapter = tda9875_probe, - .detach_client = tda9875_detach, - .command = tda9875_command, + .detach_client = tda9875_detach, + .command = tda9875_command, }; static struct i2c_client client_template = { - .name = "tda9875", - .driver = &driver, + .name = "tda9875", + .driver = &driver, }; static int __init tda9875_init(void) diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c index 6d2914f738f2..9d6b6f57abcd 100644 --- a/drivers/media/video/tda9887.c +++ b/drivers/media/video/tda9887.c @@ -46,11 +46,11 @@ MODULE_LICENSE("GPL"); #define UNSET (-1U) #define tda9887_info(fmt, arg...) do {\ printk(KERN_INFO "%s %d-%04x: " fmt, t->client.name, \ - i2c_adapter_id(t->client.adapter), t->client.addr , ##arg); } while (0) + i2c_adapter_id(t->client.adapter), t->client.addr , ##arg); } while (0) #define tda9887_dbg(fmt, arg...) do {\ if (debug) \ - printk(KERN_INFO "%s %d-%04x: " fmt, t->client.name, \ - i2c_adapter_id(t->client.adapter), t->client.addr , ##arg); } while (0) + printk(KERN_INFO "%s %d-%04x: " fmt, t->client.name, \ + i2c_adapter_id(t->client.adapter), t->client.addr , ##arg); } while (0) struct tda9887 { struct i2c_client client; @@ -484,11 +484,11 @@ static int tda9887_set_pinnacle(struct tda9887 *t, char *buf) } } if (t->std & V4L2_STD_525_60) { - if ((5 == t->pinnacle_id) || (6 == t->pinnacle_id)) { + if ((5 == t->pinnacle_id) || (6 == t->pinnacle_id)) { bCarrierMode = cIntercarrier; } else { bCarrierMode = cQSS; - } + } } if (bCarrierMode != UNSET) { @@ -568,8 +568,8 @@ static int tda9887_status(struct tda9887 *t) int rc; memset(buf,0,sizeof(buf)); - if (1 != (rc = i2c_master_recv(&t->client,buf,1))) - tda9887_info("i2c i/o error: rc == %d (should be 1)\n",rc); + if (1 != (rc = i2c_master_recv(&t->client,buf,1))) + tda9887_info("i2c i/o error: rc == %d (should be 1)\n",rc); dump_read_message(t, buf); return 0; } @@ -600,8 +600,8 @@ static int tda9887_configure(struct tda9887 *t) if (debug > 1) dump_write_message(t, t->data); - if (4 != (rc = i2c_master_send(&t->client,t->data,4))) - tda9887_info("i2c i/o error: rc == %d (should be 4)\n",rc); + if (4 != (rc = i2c_master_send(&t->client,t->data,4))) + tda9887_info("i2c i/o error: rc == %d (should be 4)\n",rc); if (debug > 2) { msleep_interruptible(1000); @@ -616,11 +616,11 @@ static int tda9887_attach(struct i2c_adapter *adap, int addr, int kind) { struct tda9887 *t; - client_template.adapter = adap; - client_template.addr = addr; + client_template.adapter = adap; + client_template.addr = addr; - if (NULL == (t = kmalloc(sizeof(*t), GFP_KERNEL))) - return -ENOMEM; + if (NULL == (t = kmalloc(sizeof(*t), GFP_KERNEL))) + return -ENOMEM; memset(t,0,sizeof(*t)); t->client = client_template; @@ -628,7 +628,7 @@ static int tda9887_attach(struct i2c_adapter *adap, int addr, int kind) t->pinnacle_id = UNSET; t->radio_mode = V4L2_TUNER_MODE_STEREO; - tda9887_info("chip found @ 0x%x (%s)\n", addr<<1, adap->name); + tda9887_info("chip found @ 0x%x (%s)\n", addr<<1, adap->name); i2c_set_clientdata(&t->client, t); i2c_attach_client(&t->client); @@ -663,18 +663,18 @@ static int tda9887_detach(struct i2c_client *client) } #define SWITCH_V4L2 if (!t->using_v4l2 && debug) \ - tda9887_info("switching to v4l2\n"); \ - t->using_v4l2 = 1; + tda9887_info("switching to v4l2\n"); \ + t->using_v4l2 = 1; #define CHECK_V4L2 if (t->using_v4l2) { if (debug) \ tda9887_info("ignore v4l1 call\n"); \ - return 0; } + return 0; } static int tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg) { struct tda9887 *t = i2c_get_clientdata(client); - switch (cmd) { + switch (cmd) { /* --- configuration --- */ case AUDC_SET_RADIO: diff --git a/drivers/media/video/tea5767.c b/drivers/media/video/tea5767.c index 38bf50943798..a9375ef05de1 100644 --- a/drivers/media/video/tea5767.c +++ b/drivers/media/video/tea5767.c @@ -117,10 +117,10 @@ #define TEA5767_RESERVED_MASK 0xff enum tea5767_xtal_freq { - TEA5767_LOW_LO_32768 = 0, - TEA5767_HIGH_LO_32768 = 1, - TEA5767_LOW_LO_13MHz = 2, - TEA5767_HIGH_LO_13MHz = 3, + TEA5767_LOW_LO_32768 = 0, + TEA5767_HIGH_LO_32768 = 1, + TEA5767_LOW_LO_13MHz = 2, + TEA5767_HIGH_LO_13MHz = 3, }; diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index 44fa1423c1a9..e677869afcf3 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c @@ -432,23 +432,23 @@ static int tuner_detach(struct i2c_client *client) static inline int set_mode(struct i2c_client *client, struct tuner *t, int mode, char *cmd) { - if (mode == t->mode) - return 0; - - t->mode = mode; - - if (check_mode(t, cmd) == EINVAL) { - t->mode = T_STANDBY; - if (t->standby) - t->standby (client); - return EINVAL; - } - return 0; + if (mode == t->mode) + return 0; + + t->mode = mode; + + if (check_mode(t, cmd) == EINVAL) { + t->mode = T_STANDBY; + if (t->standby) + t->standby (client); + return EINVAL; + } + return 0; } #define switch_v4l2() if (!t->using_v4l2) \ - tuner_dbg("switching to v4l2\n"); \ - t->using_v4l2 = 1; + tuner_dbg("switching to v4l2\n"); \ + t->using_v4l2 = 1; static inline int check_v4l2(struct tuner *t) { @@ -623,7 +623,7 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) switch_v4l2(); if (V4L2_TUNER_RADIO == f->type && V4L2_TUNER_RADIO != t->mode) { - if (set_mode (client, t, f->type, "VIDIOC_S_FREQUENCY") + if (set_mode (client, t, f->type, "VIDIOC_S_FREQUENCY") == EINVAL) return 0; } diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c index e67d9e77c755..84338f1e3038 100644 --- a/drivers/media/video/tuner-simple.c +++ b/drivers/media/video/tuner-simple.c @@ -102,7 +102,7 @@ struct tunertype */ static struct tunertype tuners[] = { /* 0-9 */ - { "Temic PAL (4002 FH5)", TEMIC, PAL, + { "Temic PAL (4002 FH5)", TEMIC, PAL, 16*140.25,16*463.25,0x02,0x04,0x01,0x8e,623}, { "Philips PAL_I (FI1246 and compatibles)", Philips, PAL_I, 16*140.25,16*463.25,0xa0,0x90,0x30,0x8e,623}, @@ -118,41 +118,41 @@ static struct tunertype tuners[] = { 16*157.25,16*463.25,0x02,0x04,0x01,0x8e,732}, { "Temic PAL_I (4062 FY5)", TEMIC, PAL_I, 16*170.00,16*450.00,0x02,0x04,0x01,0x8e,623}, - { "Temic NTSC (4036 FY5)", TEMIC, NTSC, + { "Temic NTSC (4036 FY5)", TEMIC, NTSC, 16*157.25,16*463.25,0xa0,0x90,0x30,0x8e,732}, - { "Alps HSBH1", TEMIC, NTSC, + { "Alps HSBH1", TEMIC, NTSC, 16*137.25,16*385.25,0x01,0x02,0x08,0x8e,732}, /* 10-19 */ - { "Alps TSBE1", TEMIC, PAL, + { "Alps TSBE1", TEMIC, PAL, 16*137.25,16*385.25,0x01,0x02,0x08,0x8e,732}, - { "Alps TSBB5", Alps, PAL_I, /* tested (UK UHF) with Modulartech MM205 */ + { "Alps TSBB5", Alps, PAL_I, /* tested (UK UHF) with Modulartech MM205 */ 16*133.25,16*351.25,0x01,0x02,0x08,0x8e,632}, - { "Alps TSBE5", Alps, PAL, /* untested - data sheet guess. Only IF differs. */ + { "Alps TSBE5", Alps, PAL, /* untested - data sheet guess. Only IF differs. */ 16*133.25,16*351.25,0x01,0x02,0x08,0x8e,622}, - { "Alps TSBC5", Alps, PAL, /* untested - data sheet guess. Only IF differs. */ + { "Alps TSBC5", Alps, PAL, /* untested - data sheet guess. Only IF differs. */ 16*133.25,16*351.25,0x01,0x02,0x08,0x8e,608}, { "Temic PAL_BG (4006FH5)", TEMIC, PAL, 16*170.00,16*450.00,0xa0,0x90,0x30,0x8e,623}, - { "Alps TSCH6", Alps, NTSC, - 16*137.25,16*385.25,0x14,0x12,0x11,0x8e,732}, - { "Temic PAL_DK (4016 FY5)", TEMIC, PAL, - 16*168.25,16*456.25,0xa0,0x90,0x30,0x8e,623}, - { "Philips NTSC_M (MK2)", Philips, NTSC, - 16*160.00,16*454.00,0xa0,0x90,0x30,0x8e,732}, - { "Temic PAL_I (4066 FY5)", TEMIC, PAL_I, - 16*169.00, 16*454.00, 0xa0,0x90,0x30,0x8e,623}, - { "Temic PAL* auto (4006 FN5)", TEMIC, PAL, - 16*169.00, 16*454.00, 0xa0,0x90,0x30,0x8e,623}, + { "Alps TSCH6", Alps, NTSC, + 16*137.25,16*385.25,0x14,0x12,0x11,0x8e,732}, + { "Temic PAL_DK (4016 FY5)", TEMIC, PAL, + 16*168.25,16*456.25,0xa0,0x90,0x30,0x8e,623}, + { "Philips NTSC_M (MK2)", Philips, NTSC, + 16*160.00,16*454.00,0xa0,0x90,0x30,0x8e,732}, + { "Temic PAL_I (4066 FY5)", TEMIC, PAL_I, + 16*169.00, 16*454.00, 0xa0,0x90,0x30,0x8e,623}, + { "Temic PAL* auto (4006 FN5)", TEMIC, PAL, + 16*169.00, 16*454.00, 0xa0,0x90,0x30,0x8e,623}, /* 20-29 */ - { "Temic PAL_BG (4009 FR5) or PAL_I (4069 FR5)", TEMIC, PAL, - 16*141.00, 16*464.00, 0xa0,0x90,0x30,0x8e,623}, - { "Temic NTSC (4039 FR5)", TEMIC, NTSC, - 16*158.00, 16*453.00, 0xa0,0x90,0x30,0x8e,732}, - { "Temic PAL/SECAM multi (4046 FM5)", TEMIC, PAL, - 16*169.00, 16*454.00, 0xa0,0x90,0x30,0x8e,623}, - { "Philips PAL_DK (FI1256 and compatibles)", Philips, PAL, + { "Temic PAL_BG (4009 FR5) or PAL_I (4069 FR5)", TEMIC, PAL, + 16*141.00, 16*464.00, 0xa0,0x90,0x30,0x8e,623}, + { "Temic NTSC (4039 FR5)", TEMIC, NTSC, + 16*158.00, 16*453.00, 0xa0,0x90,0x30,0x8e,732}, + { "Temic PAL/SECAM multi (4046 FM5)", TEMIC, PAL, + 16*169.00, 16*454.00, 0xa0,0x90,0x30,0x8e,623}, + { "Philips PAL_DK (FI1256 and compatibles)", Philips, PAL, 16*170.00,16*450.00,0xa0,0x90,0x30,0x8e,623}, { "Philips PAL/SECAM multi (FQ1216ME)", Philips, PAL, 16*170.00,16*450.00,0xa0,0x90,0x30,0x8e,623}, @@ -173,21 +173,21 @@ static struct tunertype tuners[] = { { "SHARP NTSC_JP (2U5JF5540)", SHARP, NTSC, /* 940=16*58.75 NTSC@Japan */ 16*137.25,16*317.25,0x01,0x02,0x08,0x8e,940 }, { "Samsung PAL TCPM9091PD27", Samsung, PAL, /* from sourceforge v3tv */ - 16*169,16*464,0xA0,0x90,0x30,0x8e,623}, + 16*169,16*464,0xA0,0x90,0x30,0x8e,623}, { "MT20xx universal", Microtune, PAL|NTSC, /* see mt20xx.c for details */ }, { "Temic PAL_BG (4106 FH5)", TEMIC, PAL, - 16*141.00, 16*464.00, 0xa0,0x90,0x30,0x8e,623}, + 16*141.00, 16*464.00, 0xa0,0x90,0x30,0x8e,623}, { "Temic PAL_DK/SECAM_L (4012 FY5)", TEMIC, PAL, - 16*140.25, 16*463.25, 0x02,0x04,0x01,0x8e,623}, + 16*140.25, 16*463.25, 0x02,0x04,0x01,0x8e,623}, { "Temic NTSC (4136 FY5)", TEMIC, NTSC, - 16*158.00, 16*453.00, 0xa0,0x90,0x30,0x8e,732}, - { "LG PAL (newer TAPC series)", LGINNOTEK, PAL, - 16*170.00, 16*450.00, 0x01,0x02,0x08,0x8e,623}, + 16*158.00, 16*453.00, 0xa0,0x90,0x30,0x8e,732}, + { "LG PAL (newer TAPC series)", LGINNOTEK, PAL, + 16*170.00, 16*450.00, 0x01,0x02,0x08,0x8e,623}, { "Philips PAL/SECAM multi (FM1216ME MK3)", Philips, PAL, 16*158.00,16*442.00,0x01,0x02,0x04,0x8e,623 }, { "LG NTSC (newer TAPC series)", LGINNOTEK, NTSC, - 16*170.00, 16*450.00, 0x01,0x02,0x08,0x8e,732}, + 16*170.00, 16*450.00, 0x01,0x02,0x08,0x8e,732}, /* 40-49 */ { "HITACHI V7-J180AT", HITACHI, NTSC, @@ -196,24 +196,24 @@ static struct tunertype tuners[] = { 16*140.25,16*463.25,0x01,0xc2,0xcf,0x8e,623}, { "Philips 1236D ATSC/NTSC daul in", Philips, ATSC, 16*157.25,16*454.00,0xa0,0x90,0x30,0x8e,732}, - { "Philips NTSC MK3 (FM1236MK3 or FM1236/F)", Philips, NTSC, - 16*160.00,16*442.00,0x01,0x02,0x04,0x8e,732}, - { "Philips 4 in 1 (ATI TV Wonder Pro/Conexant)", Philips, NTSC, - 16*160.00,16*442.00,0x01,0x02,0x04,0x8e,732}, + { "Philips NTSC MK3 (FM1236MK3 or FM1236/F)", Philips, NTSC, + 16*160.00,16*442.00,0x01,0x02,0x04,0x8e,732}, + { "Philips 4 in 1 (ATI TV Wonder Pro/Conexant)", Philips, NTSC, + 16*160.00,16*442.00,0x01,0x02,0x04,0x8e,732}, { "Microtune 4049 FM5", Microtune, PAL, 16*141.00,16*464.00,0xa0,0x90,0x30,0x8e,623}, { "Panasonic VP27s/ENGE4324D", Panasonic, NTSC, 16*160.00,16*454.00,0x01,0x02,0x08,0xce,940}, - { "LG NTSC (TAPE series)", LGINNOTEK, NTSC, - 16*160.00,16*442.00,0x01,0x02,0x04,0x8e,732 }, - { "Tenna TNF 8831 BGFF)", Philips, PAL, - 16*161.25,16*463.25,0xa0,0x90,0x30,0x8e,623}, + { "LG NTSC (TAPE series)", LGINNOTEK, NTSC, + 16*160.00,16*442.00,0x01,0x02,0x04,0x8e,732 }, + { "Tenna TNF 8831 BGFF)", Philips, PAL, + 16*161.25,16*463.25,0xa0,0x90,0x30,0x8e,623}, { "Microtune 4042 FI5 ATSC/NTSC dual in", Microtune, NTSC, 16*162.00,16*457.00,0xa2,0x94,0x31,0x8e,732}, /* 50-59 */ - { "TCL 2002N", TCL, NTSC, - 16*172.00,16*448.00,0x01,0x02,0x08,0x8e,732}, + { "TCL 2002N", TCL, NTSC, + 16*172.00,16*448.00,0x01,0x02,0x08,0x8e,732}, { "Philips PAL/SECAM_D (FM 1256 I-H3)", Philips, PAL, 16*160.00,16*442.00,0x01,0x02,0x04,0x8e,623 }, { "Thomson DDT 7610 (ATSC/NTSC)", THOMSON, ATSC, @@ -223,7 +223,7 @@ static struct tunertype tuners[] = { { "tda8290+75", Philips, PAL|NTSC, /* see tda8290.c for details */ }, { "TCL 2002MB", TCL, PAL, - 16*170.00, 16*450.00, 0x01,0x02,0x08,0xce,623}, + 16*170.00, 16*450.00, 0x01,0x02,0x08,0xce,623}, { "Philips PAL/SECAM multi (FQ1216AME MK4)", Philips, PAL, 16*160.00,16*442.00,0x01,0x02,0x04,0xce,623 }, { "Philips FQ1236A MK4", Philips, NTSC, @@ -237,16 +237,16 @@ static struct tunertype tuners[] = { { "Thomson DDT 7611 (ATSC/NTSC)", THOMSON, ATSC, 16*157.25,16*454.00,0x39,0x3a,0x3c,0x8e,732}, { "Tena TNF9533-D/IF/TNF9533-B/DF", Philips, PAL, - 16*160.25,16*464.25,0x01,0x02,0x04,0x8e,623}, + 16*160.25,16*464.25,0x01,0x02,0x04,0x8e,623}, { "Philips TEA5767HN FM Radio", Philips, RADIO, - /* see tea5767.c for details */}, + /* see tea5767.c for details */}, { "Philips FMD1216ME MK3 Hybrid Tuner", Philips, PAL, 16*160.00,16*442.00,0x51,0x52,0x54,0x86,623 }, { "LG TDVS-H062F/TUA6034", LGINNOTEK, ATSC, 16*160.00,16*455.00,0x01,0x02,0x04,0x8e,732}, { "Ymec TVF66T5-B/DFF", Philips, PAL, - 16*160.25,16*464.25,0x01,0x02,0x08,0x8e,623}, - { "LG NTSC (TALN mini series)", LGINNOTEK, NTSC, + 16*160.25,16*464.25,0x01,0x02,0x08,0x8e,623}, + { "LG NTSC (TALN mini series)", LGINNOTEK, NTSC, 16*137.25,16*373.25,0x01,0x02,0x08,0x8e,732 }, { "Philips TD1316 Hybrid Tuner", Philips, PAL, 16*160.00,16*442.00,0xa1,0xa2,0xa4,0xc8,623 }, @@ -281,7 +281,7 @@ static int tuner_stereo(struct i2c_client *c) status = tuner_getstatus (c); switch (t->type) { - case TUNER_PHILIPS_FM1216ME_MK3: + case TUNER_PHILIPS_FM1216ME_MK3: case TUNER_PHILIPS_FM1236_MK3: case TUNER_PHILIPS_FM1256_IH3: stereo = ((status & TUNER_SIGNAL) == TUNER_STEREO_MK3); @@ -302,7 +302,7 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq) u8 config; u16 div; struct tunertype *tun; - unsigned char buffer[4]; + unsigned char buffer[4]; int rc; tun = &tuners[t->type]; @@ -419,7 +419,7 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq) tuner_dbg("tv 0x%02x 0x%02x 0x%02x 0x%02x\n", buffer[0],buffer[1],buffer[2],buffer[3]); - if (4 != (rc = i2c_master_send(c,buffer,4))) + if (4 != (rc = i2c_master_send(c,buffer,4))) tuner_warn("i2c i/o error: rc == %d (should be 4)\n",rc); if (t->type == TUNER_MICROTUNE_4042FI5) { @@ -458,7 +458,7 @@ static void default_set_radio_freq(struct i2c_client *c, unsigned int freq) { struct tunertype *tun; struct tuner *t = i2c_get_clientdata(c); - unsigned char buffer[4]; + unsigned char buffer[4]; unsigned div; int rc; @@ -491,13 +491,13 @@ static void default_set_radio_freq(struct i2c_client *c, unsigned int freq) buffer[3] = 0xa4; break; } - buffer[0] = (div>>8) & 0x7f; - buffer[1] = div & 0xff; + buffer[0] = (div>>8) & 0x7f; + buffer[1] = div & 0xff; tuner_dbg("radio 0x%02x 0x%02x 0x%02x 0x%02x\n", buffer[0],buffer[1],buffer[2],buffer[3]); - if (4 != (rc = i2c_master_send(c,buffer,4))) + if (4 != (rc = i2c_master_send(c,buffer,4))) tuner_warn("i2c i/o error: rc == %d (should be 4)\n",rc); } diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c index 1c31ef52f863..e1639a24f77f 100644 --- a/drivers/media/video/tvaudio.c +++ b/drivers/media/video/tvaudio.c @@ -458,8 +458,8 @@ static void tda9840_setmode(struct CHIPSTATE *chip, int mode) #define TDA9855_LOUD 1<<5 /* Loudness, 1==off */ #define TDA9855_SUR 1<<3 /* Surround / Subwoofer 1==.5(L-R) 0==.5(L+R) */ /* Bits 0 to 3 select various combinations - * of line in and line out, only the - * interesting ones are defined */ + * of line in and line out, only the + * interesting ones are defined */ #define TDA9855_EXT 1<<2 /* Selects inputs LIR and LIL. Pins 41 & 12 */ #define TDA9855_INT 0 /* Selects inputs LOR and LOL. (internal) */ @@ -1028,7 +1028,7 @@ static int tda9874a_initialize(struct CHIPSTATE *chip) #define TEA6300_TR 0x03 /* treble */ #define TEA6300_FA 0x04 /* fader control */ #define TEA6300_S 0x05 /* switch register */ - /* values for those registers: */ + /* values for those registers: */ #define TEA6300_S_SA 0x01 /* stereo A input */ #define TEA6300_S_SB 0x02 /* stereo B */ #define TEA6300_S_SC 0x04 /* stereo C */ @@ -1042,7 +1042,7 @@ static int tda9874a_initialize(struct CHIPSTATE *chip) #define TEA6320_BA 0x05 /* bass (0-4) */ #define TEA6320_TR 0x06 /* treble (0-4) */ #define TEA6320_S 0x07 /* switch register */ - /* values for those registers: */ + /* values for those registers: */ #define TEA6320_S_SA 0x07 /* stereo A input */ #define TEA6320_S_SB 0x06 /* stereo B */ #define TEA6320_S_SC 0x05 /* stereo C */ @@ -1082,7 +1082,7 @@ static int tea6320_initialize(struct CHIPSTATE * chip) #define TDA8425_BA 0x02 /* bass */ #define TDA8425_TR 0x03 /* treble */ #define TDA8425_S1 0x08 /* switch functions */ - /* values for those registers: */ + /* values for those registers: */ #define TDA8425_S1_OFF 0xEE /* audio off (mute on) */ #define TDA8425_S1_CH1 0xCE /* audio channel 1 (mute off) - "linear stereo" mode */ #define TDA8425_S1_CH2 0xCF /* audio channel 2 (mute off) - "linear stereo" mode */ @@ -1148,7 +1148,7 @@ static void tda8425_setmode(struct CHIPSTATE *chip, int mode) /* bit definition of the RESET register, I2C data. */ #define PIC16C54_MISC_RESET_REMOTE_CTL 0x01 /* bit 0, Reset to receive the key */ - /* code of remote controller */ + /* code of remote controller */ #define PIC16C54_MISC_MTS_MAIN 0x02 /* bit 1 */ #define PIC16C54_MISC_MTS_SAP 0x04 /* bit 2 */ #define PIC16C54_MISC_MTS_BOTH 0x08 /* bit 3 */ @@ -1281,7 +1281,7 @@ static struct CHIPDESC chiplist[] = { .setmode = tda9840_setmode, .checkmode = generic_checkmode, - .init = { 2, { TDA9840_TEST, TDA9840_TEST_INT1SN + .init = { 2, { TDA9840_TEST, TDA9840_TEST_INT1SN /* ,TDA9840_SW, TDA9840_MONO */} } }, { @@ -1467,7 +1467,7 @@ static struct CHIPDESC chiplist[] = { .setmode = ta8874z_setmode, .checkmode = generic_checkmode, - .init = {2, { TA8874Z_MONO_SET, TA8874Z_SEPARATION_DEFAULT}}, + .init = {2, { TA8874Z_MONO_SET, TA8874Z_SEPARATION_DEFAULT}}, }, { .name = NULL } /* EOF */ }; @@ -1486,8 +1486,8 @@ static int chip_attach(struct i2c_adapter *adap, int addr, int kind) return -ENOMEM; memset(chip,0,sizeof(*chip)); memcpy(&chip->c,&client_template,sizeof(struct i2c_client)); - chip->c.adapter = adap; - chip->c.addr = addr; + chip->c.adapter = adap; + chip->c.addr = addr; i2c_set_clientdata(&chip->c, chip); /* find description for the chip */ diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c index ee605712bf19..68128e04dacc 100644 --- a/drivers/media/video/tveeprom.c +++ b/drivers/media/video/tveeprom.c @@ -6,12 +6,12 @@ * which are: Copyright (C) 1996,97,98 Ralph Metzler (rjkm@thp.uni-koeln.de) - & Marcus Metzler (mocm@thp.uni-koeln.de) + & Marcus Metzler (mocm@thp.uni-koeln.de) (c) 1999-2001 Gerd Knorr * Adjustments to fit a more general model and all bugs: - Copyright (C) 2003 John Klar + Copyright (C) 2003 John Klar * 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 @@ -54,14 +54,14 @@ MODULE_PARM_DESC(debug, "Debug level (0-1)"); #define tveeprom_info(fmt, arg...) do {\ printk(KERN_INFO "tveeprom %d-%04x: " fmt, \ - c->adapter->nr, c->addr , ##arg); } while (0) + c->adapter->nr, c->addr , ##arg); } while (0) #define tveeprom_warn(fmt, arg...) do {\ printk(KERN_WARNING "tveeprom %d-%04x: " fmt, \ - c->adapter->nr, c->addr , ##arg); } while (0) + c->adapter->nr, c->addr , ##arg); } while (0) #define tveeprom_dbg(fmt, arg...) do {\ if (debug) \ - printk(KERN_INFO "tveeprom %d-%04x: " fmt, \ - c->adapter->nr, c->addr , ##arg); } while (0) + printk(KERN_INFO "tveeprom %d-%04x: " fmt, \ + c->adapter->nr, c->addr , ##arg); } while (0) /* ----------------------------------------------------------------------- */ @@ -294,7 +294,7 @@ static const char *decoderIC[] = { static int hasRadioTuner(int tunerType) { - switch (tunerType) { + switch (tunerType) { case 18: //PNPEnv_TUNER_FR1236_MK2: case 23: //PNPEnv_TUNER_FM1236: case 38: //PNPEnv_TUNER_FMR1236: @@ -326,12 +326,12 @@ static int hasRadioTuner(int tunerType) case 89: //PNPEnv_TUNER_TCL_MFPE05_2: case 92: //PNPEnv_TUNER_PHILIPS_FQ1236A_MK4: return 1; - } - return 0; + } + return 0; } void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, - unsigned char *eeprom_data) + unsigned char *eeprom_data) { /* ---------------------------------------------- ** The hauppauge eeprom format is tagged diff --git a/drivers/media/video/tvmixer.c b/drivers/media/video/tvmixer.c index d86e08ebddfc..8318bd1aad00 100644 --- a/drivers/media/video/tvmixer.c +++ b/drivers/media/video/tvmixer.c @@ -79,7 +79,7 @@ static int tvmixer_ioctl(struct inode *inode, struct file *file, unsigned int cm { struct video_audio va; int left,right,ret,val = 0; - struct TVMIXER *mix = file->private_data; + struct TVMIXER *mix = file->private_data; struct i2c_client *client = mix->dev; void __user *argp = (void __user *)arg; int __user *p = argp; @@ -87,25 +87,25 @@ static int tvmixer_ioctl(struct inode *inode, struct file *file, unsigned int cm if (NULL == client) return -ENODEV; - if (cmd == SOUND_MIXER_INFO) { - mixer_info info; - strlcpy(info.id, "tv card", sizeof(info.id)); - strlcpy(info.name, client->name, sizeof(info.name)); - info.modify_counter = 42 /* FIXME */; - if (copy_to_user(argp, &info, sizeof(info))) - return -EFAULT; - return 0; - } - if (cmd == SOUND_OLD_MIXER_INFO) { - _old_mixer_info info; - strlcpy(info.id, "tv card", sizeof(info.id)); - strlcpy(info.name, client->name, sizeof(info.name)); - if (copy_to_user(argp, &info, sizeof(info))) - return -EFAULT; - return 0; - } - if (cmd == OSS_GETVERSION) - return put_user(SOUND_VERSION, p); + if (cmd == SOUND_MIXER_INFO) { + mixer_info info; + strlcpy(info.id, "tv card", sizeof(info.id)); + strlcpy(info.name, client->name, sizeof(info.name)); + info.modify_counter = 42 /* FIXME */; + if (copy_to_user(argp, &info, sizeof(info))) + return -EFAULT; + return 0; + } + if (cmd == SOUND_OLD_MIXER_INFO) { + _old_mixer_info info; + strlcpy(info.id, "tv card", sizeof(info.id)); + strlcpy(info.name, client->name, sizeof(info.name)); + if (copy_to_user(argp, &info, sizeof(info))) + return -EFAULT; + return 0; + } + if (cmd == OSS_GETVERSION) + return put_user(SOUND_VERSION, p); if (_SIOC_DIR(cmd) & _SIOC_WRITE) if (get_user(val, p)) @@ -181,8 +181,8 @@ static int tvmixer_ioctl(struct inode *inode, struct file *file, unsigned int cm static int tvmixer_open(struct inode *inode, struct file *file) { - int i, minor = iminor(inode); - struct TVMIXER *mix = NULL; + int i, minor = iminor(inode); + struct TVMIXER *mix = NULL; struct i2c_client *client = NULL; for (i = 0; i < DEV_MAX; i++) { @@ -204,7 +204,7 @@ static int tvmixer_open(struct inode *inode, struct file *file) #endif if (client->adapter->owner) try_module_get(client->adapter->owner); - return 0; + return 0; } static int tvmixer_release(struct inode *inode, struct file *file) @@ -231,15 +231,15 @@ static struct i2c_driver driver = { .owner = THIS_MODULE, #endif .name = "tv card mixer driver", - .id = I2C_DRIVERID_TVMIXER, + .id = I2C_DRIVERID_TVMIXER, #ifdef I2C_DF_DUMMY .flags = I2C_DF_DUMMY, #else .flags = I2C_DF_NOTIFY, - .detach_adapter = tvmixer_adapters, + .detach_adapter = tvmixer_adapters, #endif - .attach_adapter = tvmixer_adapters, - .detach_client = tvmixer_clients, + .attach_adapter = tvmixer_adapters, + .detach_client = tvmixer_clients, }; static struct file_operations tvmixer_fops = { diff --git a/drivers/media/video/v4l1-compat.c b/drivers/media/video/v4l1-compat.c index 88beb5a3be15..4134549d11a8 100644 --- a/drivers/media/video/v4l1-compat.c +++ b/drivers/media/video/v4l1-compat.c @@ -960,7 +960,7 @@ v4l_compat_translate_ioctl(struct inode *inode, fmt->start[1] = fmt2->fmt.vbi.start[1]; fmt->count[1] = fmt2->fmt.vbi.count[1]; fmt->flags = fmt2->fmt.vbi.flags & 0x03; - break; + break; } case VIDIOCSVBIFMT: { diff --git a/drivers/media/video/video-buf.c b/drivers/media/video/video-buf.c index 574b8e36f3c6..acfd3a103f35 100644 --- a/drivers/media/video/video-buf.c +++ b/drivers/media/video/video-buf.c @@ -147,7 +147,7 @@ int videobuf_dma_init_user(struct videobuf_dmabuf *dma, int direction, data,size,dma->nr_pages); down_read(¤t->mm->mmap_sem); - err = get_user_pages(current,current->mm, + err = get_user_pages(current,current->mm, data & PAGE_MASK, dma->nr_pages, rw == READ, 1, /* force */ dma->pages, NULL); @@ -750,9 +750,9 @@ videobuf_read_zerocopy(struct videobuf_queue *q, char __user *data, { enum v4l2_field field; unsigned long flags; - int retval; + int retval; - /* setup stuff */ + /* setup stuff */ retval = -ENOMEM; q->read_buf = videobuf_alloc(q->msize); if (NULL == q->read_buf) @@ -760,18 +760,18 @@ videobuf_read_zerocopy(struct videobuf_queue *q, char __user *data, q->read_buf->memory = V4L2_MEMORY_USERPTR; q->read_buf->baddr = (unsigned long)data; - q->read_buf->bsize = count; + q->read_buf->bsize = count; field = videobuf_next_field(q); retval = q->ops->buf_prepare(q,q->read_buf,field); if (0 != retval) goto done; - /* start capture & wait */ + /* start capture & wait */ spin_lock_irqsave(q->irqlock,flags); q->ops->buf_queue(q,q->read_buf); spin_unlock_irqrestore(q->irqlock,flags); - retval = videobuf_waiton(q->read_buf,0,0); - if (0 == retval) { + retval = videobuf_waiton(q->read_buf,0,0); + if (0 == retval) { videobuf_dma_pci_sync(q->pci,&q->read_buf->dma); if (STATE_ERROR == q->read_buf->state) retval = -EIO; @@ -828,7 +828,7 @@ ssize_t videobuf_read_one(struct videobuf_queue *q, } /* wait until capture is done */ - retval = videobuf_waiton(q->read_buf, nonblocking, 1); + retval = videobuf_waiton(q->read_buf, nonblocking, 1); if (0 != retval) goto done; videobuf_dma_pci_sync(q->pci,&q->read_buf->dma); @@ -1096,7 +1096,7 @@ videobuf_vm_nopage(struct vm_area_struct *vma, unsigned long vaddr, dprintk(3,"nopage: fault @ %08lx [vma %08lx-%08lx]\n", vaddr,vma->vm_start,vma->vm_end); - if (vaddr > vma->vm_end) + if (vaddr > vma->vm_end) return NOPAGE_SIGBUS; page = alloc_page(GFP_USER); if (!page) diff --git a/drivers/media/video/wm8775.c b/drivers/media/video/wm8775.c index 8200f3dad0c6..5bd592673b94 100644 --- a/drivers/media/video/wm8775.c +++ b/drivers/media/video/wm8775.c @@ -36,10 +36,10 @@ MODULE_LICENSE("GPL"); #define wm8775_err(fmt, arg...) do { \ printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->name, \ - i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) + i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) #define wm8775_info(fmt, arg...) do { \ printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->name, \ - i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) + i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) static unsigned short normal_i2c[] = { 0x36 >> 1, I2C_CLIENT_END }; diff --git a/include/linux/videodev.h b/include/linux/videodev.h index 1cc8c31b7988..22e6e4bad7b8 100644 --- a/include/linux/videodev.h +++ b/include/linux/videodev.h @@ -202,9 +202,9 @@ struct video_audio #define VIDEO_SOUND_STEREO 2 #define VIDEO_SOUND_LANG1 4 #define VIDEO_SOUND_LANG2 8 - __u16 mode; - __u16 balance; /* Stereo balance */ - __u16 step; /* Step actual volume uses */ + __u16 mode; + __u16 balance; /* Stereo balance */ + __u16 step; /* Step actual volume uses */ }; struct video_clip diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 27979003db44..a9a0999be702 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -24,7 +24,7 @@ /* Four-character-code (FOURCC) */ #define v4l2_fourcc(a,b,c,d)\ - (((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)(d)<<24)) + (((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)(d)<<24)) /* * E N U M S @@ -154,20 +154,20 @@ struct v4l2_capability }; /* Values for 'capabilities' field */ -#define V4L2_CAP_VIDEO_CAPTURE 0x00000001 /* Is a video capture device */ -#define V4L2_CAP_VIDEO_OUTPUT 0x00000002 /* Is a video output device */ -#define V4L2_CAP_VIDEO_OVERLAY 0x00000004 /* Can do video overlay */ -#define V4L2_CAP_VBI_CAPTURE 0x00000010 /* Is a raw VBI capture device */ -#define V4L2_CAP_VBI_OUTPUT 0x00000020 /* Is a raw VBI output device */ +#define V4L2_CAP_VIDEO_CAPTURE 0x00000001 /* Is a video capture device */ +#define V4L2_CAP_VIDEO_OUTPUT 0x00000002 /* Is a video output device */ +#define V4L2_CAP_VIDEO_OVERLAY 0x00000004 /* Can do video overlay */ +#define V4L2_CAP_VBI_CAPTURE 0x00000010 /* Is a raw VBI capture device */ +#define V4L2_CAP_VBI_OUTPUT 0x00000020 /* Is a raw VBI output device */ #if 1 #define V4L2_CAP_SLICED_VBI_CAPTURE 0x00000040 /* Is a sliced VBI capture device */ #define V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080 /* Is a sliced VBI output device */ #endif -#define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */ +#define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */ -#define V4L2_CAP_TUNER 0x00010000 /* has a tuner */ -#define V4L2_CAP_AUDIO 0x00020000 /* has audio support */ -#define V4L2_CAP_RADIO 0x00040000 /* is a radio device */ +#define V4L2_CAP_TUNER 0x00010000 /* has a tuner */ +#define V4L2_CAP_AUDIO 0x00020000 /* has audio support */ +#define V4L2_CAP_RADIO 0x00040000 /* is a radio device */ #define V4L2_CAP_READWRITE 0x01000000 /* read/write systemcalls */ #define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */ @@ -179,13 +179,13 @@ struct v4l2_capability struct v4l2_pix_format { - __u32 width; - __u32 height; - __u32 pixelformat; + __u32 width; + __u32 height; + __u32 pixelformat; enum v4l2_field field; __u32 bytesperline; /* for padding, zero if unused */ - __u32 sizeimage; - enum v4l2_colorspace colorspace; + __u32 sizeimage; + enum v4l2_colorspace colorspace; __u32 priv; /* private data, depends on pixelformat */ }; @@ -238,12 +238,12 @@ struct v4l2_pix_format */ struct v4l2_fmtdesc { - __u32 index; /* Format number */ + __u32 index; /* Format number */ enum v4l2_buf_type type; /* buffer type */ __u32 flags; - __u8 description[32]; /* Description string */ - __u32 pixelformat; /* Format fourcc */ - __u32 reserved[4]; + __u8 description[32]; /* Description string */ + __u32 pixelformat; /* Format fourcc */ + __u32 reserved[4]; }; #define V4L2_FMT_FLAG_COMPRESSED 0x0001 @@ -393,7 +393,7 @@ struct v4l2_jpegcompression #define V4L2_JPEG_MARKER_DRI (1<<5) /* Define Restart Interval */ #define V4L2_JPEG_MARKER_COM (1<<6) /* Comment segment */ #define V4L2_JPEG_MARKER_APP (1<<7) /* App segment, driver will - * allways use APP0 */ + * allways use APP0 */ }; @@ -402,10 +402,10 @@ struct v4l2_jpegcompression */ struct v4l2_requestbuffers { - __u32 count; + __u32 count; enum v4l2_buf_type type; enum v4l2_memory memory; - __u32 reserved[2]; + __u32 reserved[2]; }; struct v4l2_buffer @@ -511,9 +511,9 @@ struct v4l2_outputparm struct v4l2_cropcap { enum v4l2_buf_type type; - struct v4l2_rect bounds; - struct v4l2_rect defrect; - struct v4l2_fract pixelaspect; + struct v4l2_rect bounds; + struct v4l2_rect defrect; + struct v4l2_fract pixelaspect; }; struct v4l2_crop { @@ -587,7 +587,7 @@ typedef __u64 v4l2_std_id; V4L2_STD_PAL_Nc |\ V4L2_STD_SECAM) #define V4L2_STD_ATSC (V4L2_STD_ATSC_8_VSB |\ - V4L2_STD_ATSC_16_VSB) + V4L2_STD_ATSC_16_VSB) #define V4L2_STD_UNKNOWN 0 #define V4L2_STD_ALL (V4L2_STD_525_60 |\ @@ -595,7 +595,7 @@ typedef __u64 v4l2_std_id; struct v4l2_standard { - __u32 index; + __u32 index; v4l2_std_id id; __u8 name[24]; struct v4l2_fract frameperiod; /* Frames, not fields */ @@ -610,9 +610,9 @@ struct v4l2_standard struct v4l2_input { __u32 index; /* Which input */ - __u8 name[32]; /* Label */ + __u8 name[32]; /* Label */ __u32 type; /* Type of input */ - __u32 audioset; /* Associated audios (bitfield) */ + __u32 audioset; /* Associated audios (bitfield) */ __u32 tuner; /* Associated tuner */ v4l2_std_id std; __u32 status; @@ -647,9 +647,9 @@ struct v4l2_input struct v4l2_output { __u32 index; /* Which output */ - __u8 name[32]; /* Label */ + __u8 name[32]; /* Label */ __u32 type; /* Type of output */ - __u32 audioset; /* Associated audios (bitfield) */ + __u32 audioset; /* Associated audios (bitfield) */ __u32 modulator; /* Associated modulator */ v4l2_std_id std; __u32 reserved[4]; @@ -671,12 +671,12 @@ struct v4l2_control /* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */ struct v4l2_queryctrl { - __u32 id; + __u32 id; enum v4l2_ctrl_type type; __u8 name[32]; /* Whatever */ __s32 minimum; /* Note signedness */ __s32 maximum; - __s32 step; + __s32 step; __s32 default_value; __u32 flags; __u32 reserved[2]; @@ -779,10 +779,10 @@ struct v4l2_modulator struct v4l2_frequency { - __u32 tuner; + __u32 tuner; enum v4l2_tuner_type type; - __u32 frequency; - __u32 reserved[8]; + __u32 frequency; + __u32 reserved[8]; }; /* @@ -846,14 +846,14 @@ struct v4l2_vbi_format struct v4l2_sliced_vbi_format { - __u16 service_set; - /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field - service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field - (equals frame lines 313-336 for 625 line video - standards, 263-286 for 525 line standards) */ - __u16 service_lines[2][24]; - __u32 io_size; - __u32 reserved[2]; /* must be zero */ + __u16 service_set; + /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field + service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field + (equals frame lines 313-336 for 625 line video + standards, 263-286 for 525 line standards) */ + __u16 service_lines[2][24]; + __u32 io_size; + __u32 reserved[2]; /* must be zero */ }; #define V4L2_SLICED_TELETEXT_B (0x0001) @@ -866,22 +866,22 @@ struct v4l2_sliced_vbi_format struct v4l2_sliced_vbi_cap { - __u16 service_set; - /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field - service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field - (equals frame lines 313-336 for 625 line video - standards, 263-286 for 525 line standards) */ - __u16 service_lines[2][24]; - __u32 reserved[4]; /* must be 0 */ + __u16 service_set; + /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field + service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field + (equals frame lines 313-336 for 625 line video + standards, 263-286 for 525 line standards) */ + __u16 service_lines[2][24]; + __u32 reserved[4]; /* must be 0 */ }; struct v4l2_sliced_vbi_data { - __u32 id; - __u32 field; /* 0: first field, 1: second field */ - __u32 line; /* 1-23 */ - __u32 reserved; /* must be 0 */ - __u8 data[48]; + __u32 id; + __u32 field; /* 0: first field, 1: second field */ + __u32 line; /* 1-23 */ + __u32 reserved; /* must be 0 */ + __u8 data[48]; }; #endif @@ -896,9 +896,9 @@ struct v4l2_format enum v4l2_buf_type type; union { - struct v4l2_pix_format pix; // V4L2_BUF_TYPE_VIDEO_CAPTURE - struct v4l2_window win; // V4L2_BUF_TYPE_VIDEO_OVERLAY - struct v4l2_vbi_format vbi; // V4L2_BUF_TYPE_VBI_CAPTURE + struct v4l2_pix_format pix; // V4L2_BUF_TYPE_VIDEO_CAPTURE + struct v4l2_window win; // V4L2_BUF_TYPE_VIDEO_OVERLAY + struct v4l2_vbi_format vbi; // V4L2_BUF_TYPE_VBI_CAPTURE #if 1 struct v4l2_sliced_vbi_format sliced; // V4L2_BUF_TYPE_SLICED_VBI_CAPTURE #endif diff --git a/include/media/audiochip.h b/include/media/audiochip.h index dd1e484e86d3..b7d4b0930408 100644 --- a/include/media/audiochip.h +++ b/include/media/audiochip.h @@ -10,13 +10,13 @@ enum audiochip { /* Provided by video chip */ AUDIO_CHIP_INTERNAL, /* Provided by tvaudio.c */ - AUDIO_CHIP_TDA8425, - AUDIO_CHIP_TEA6300, - AUDIO_CHIP_TEA6420, - AUDIO_CHIP_TDA9840, - AUDIO_CHIP_TDA985X, - AUDIO_CHIP_TDA9874, - AUDIO_CHIP_PIC16C54, + AUDIO_CHIP_TDA8425, + AUDIO_CHIP_TEA6300, + AUDIO_CHIP_TEA6420, + AUDIO_CHIP_TDA9840, + AUDIO_CHIP_TDA985X, + AUDIO_CHIP_TDA9874, + AUDIO_CHIP_PIC16C54, /* Provided by msp3400.c */ AUDIO_CHIP_MSP34XX }; diff --git a/include/media/tuner.h b/include/media/tuner.h index 81025323267f..94a9511479a1 100644 --- a/include/media/tuner.h +++ b/include/media/tuner.h @@ -215,14 +215,14 @@ extern int tea5767_autodetection(struct i2c_client *c); #define tuner_warn(fmt, arg...) do {\ printk(KERN_WARNING "%s %d-%04x: " fmt, t->i2c.driver->name, \ - t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0) + t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0) #define tuner_info(fmt, arg...) do {\ printk(KERN_INFO "%s %d-%04x: " fmt, t->i2c.driver->name, \ - t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0) + t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0) #define tuner_dbg(fmt, arg...) do {\ if (tuner_debug) \ - printk(KERN_DEBUG "%s %d-%04x: " fmt, t->i2c.driver->name, \ - t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0) + printk(KERN_DEBUG "%s %d-%04x: " fmt, t->i2c.driver->name, \ + t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0) #endif /* __KERNEL__ */ diff --git a/include/media/video-buf.h b/include/media/video-buf.h index ae8d7a000440..ee8eb15c0ea6 100644 --- a/include/media/video-buf.h +++ b/include/media/video-buf.h @@ -177,7 +177,7 @@ struct videobuf_queue_ops { }; struct videobuf_queue { - struct semaphore lock; + struct semaphore lock; spinlock_t *irqlock; struct pci_dev *pci; -- cgit v1.2.2 From f2421ca3383ed35bc634aa29416a3229dc603fa4 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:37:45 -0800 Subject: [PATCH] v4l: 801: whitespaces cleanups - Whitespaces Cleanups. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/video4linux/lifeview.txt | 6 +++--- drivers/media/video/bttv-cards.c | 4 ++-- drivers/media/video/bttv-risc.c | 4 ++-- drivers/media/video/cx88/cx88-core.c | 4 ++-- drivers/media/video/cx88/cx88-dvb.c | 2 +- drivers/media/video/saa7134/saa7134-alsa.c | 12 ++++++------ drivers/media/video/saa7134/saa7134-dvb.c | 4 ++-- drivers/media/video/saa7134/saa7134-input.c | 2 +- drivers/media/video/saa7134/saa7134-video.c | 4 ++-- drivers/media/video/tvaudio.c | 8 ++++---- drivers/media/video/tveeprom.c | 2 +- include/linux/videodev2.h | 10 +++++----- 12 files changed, 31 insertions(+), 31 deletions(-) diff --git a/Documentation/video4linux/lifeview.txt b/Documentation/video4linux/lifeview.txt index f66320bd7b67..05f9eb57aac9 100644 --- a/Documentation/video4linux/lifeview.txt +++ b/Documentation/video4linux/lifeview.txt @@ -28,9 +28,9 @@ saa7134: /* GP17 Strap "GP7"=High */ /* GP16 Strap "GP6"=High - 0=Radio 1=TV - Drives SA630D ENCH1 and HEF4052 A1 pins - to do FM radio through SIF input */ + 0=Radio 1=TV + Drives SA630D ENCH1 and HEF4052 A1 pins + to do FM radio through SIF input */ /* GP15 nc */ /* GP14 nc */ /* GP13 nc */ diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bttv-cards.c index 92bb515fbe4d..695a67e9edd7 100644 --- a/drivers/media/video/bttv-cards.c +++ b/drivers/media/video/bttv-cards.c @@ -3585,7 +3585,7 @@ static void __devinit osprey_eeprom(struct bttv *btv) for(i = 0; i<14; i++) checksum += ee[i+offset]; checksum = ~checksum; /* no idea why */ if ((((checksum>>8)&0x0FF) == ee[offset+14]) && - ((checksum & 0x0FF) == ee[offset+15])) { + ((checksum & 0x0FF) == ee[offset+15])) { break; } } @@ -4420,7 +4420,7 @@ windvr_audio(struct bttv *btv, struct video_audio *v, int set) if (val) { gpio_bits(0x140000, val); if (bttv_gpio) - bttv_gpio_tracking(btv,"windvr"); + bttv_gpio_tracking(btv,"windvr"); } } else { v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | diff --git a/drivers/media/video/bttv-risc.c b/drivers/media/video/bttv-risc.c index 3028862934dd..b40e9734bf08 100644 --- a/drivers/media/video/bttv-risc.c +++ b/drivers/media/video/bttv-risc.c @@ -88,9 +88,9 @@ bttv_risc_packed(struct bttv *btv, struct btcx_riscmem *risc, offset = 0; sg++; while (todo > sg_dma_len(sg)) { - *(rp++)=cpu_to_le32(BT848_RISC_WRITE| + *(rp++)=cpu_to_le32(BT848_RISC_WRITE| sg_dma_len(sg)); - *(rp++)=cpu_to_le32(sg_dma_address(sg)); + *(rp++)=cpu_to_le32(sg_dma_address(sg)); todo -= sg_dma_len(sg); sg++; } diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c index f01a631d0c00..eb806af17182 100644 --- a/drivers/media/video/cx88/cx88-core.c +++ b/drivers/media/video/cx88/cx88-core.c @@ -166,9 +166,9 @@ static u32* cx88_risc_field(u32 *rp, struct scatterlist *sglist, offset = 0; sg++; while (todo > sg_dma_len(sg)) { - *(rp++)=cpu_to_le32(RISC_WRITE| + *(rp++)=cpu_to_le32(RISC_WRITE| sg_dma_len(sg)); - *(rp++)=cpu_to_le32(sg_dma_address(sg)); + *(rp++)=cpu_to_le32(sg_dma_address(sg)); todo -= sg_dma_len(sg); sg++; } diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index 3be601cfc99b..a7a077196fc9 100644 --- a/drivers/media/video/cx88/cx88-dvb.c +++ b/drivers/media/video/cx88/cx88-dvb.c @@ -128,7 +128,7 @@ static int dntv_live_dvbt_demod_init(struct dvb_frontend* fe) static u8 reset [] = { 0x50, 0x80 }; static u8 adc_ctl_1_cfg [] = { 0x8E, 0x40 }; static u8 agc_cfg [] = { 0x67, 0x10, 0x23, 0x00, 0xFF, 0xFF, - 0x00, 0xFF, 0x00, 0x40, 0x40 }; + 0x00, 0xFF, 0x00, 0x40, 0x40 }; static u8 dntv_extra[] = { 0xB5, 0x7A }; static u8 capt_range_cfg[] = { 0x75, 0x32 }; diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c index e9ffe8f144ac..e7c3691fc500 100644 --- a/drivers/media/video/saa7134/saa7134-alsa.c +++ b/drivers/media/video/saa7134/saa7134-alsa.c @@ -277,7 +277,7 @@ static int dsp_buffer_init(struct saa7134_dev *dev) BUG(); videobuf_dma_init(&dev->oss.dma); err = videobuf_dma_init_kernel(&dev->oss.dma, PCI_DMA_FROMDEVICE, - (dev->oss.bufsize + PAGE_SIZE) >> PAGE_SHIFT); + (dev->oss.bufsize + PAGE_SIZE) >> PAGE_SHIFT); if (0 != err) return err; return 0; @@ -336,9 +336,9 @@ static int snd_card_saa7134_capture_prepare(snd_pcm_substream_t * substream) if (0 != (err = saa7134_pgtable_alloc(dev->pci,&dev->oss.pt))) goto fail1; if (0 != (err = saa7134_pgtable_build(dev->pci,&dev->oss.pt, - dev->oss.dma.sglist, - dev->oss.dma.sglen, - 0))) + dev->oss.dma.sglist, + dev->oss.dma.sglen, + 0))) goto fail2; @@ -481,8 +481,8 @@ static snd_pcm_uframes_t snd_card_saa7134_capture_pointer(snd_pcm_substream_t * static snd_pcm_hardware_t snd_card_saa7134_capture = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | - SNDRV_PCM_INFO_BLOCK_TRANSFER | - SNDRV_PCM_INFO_MMAP_VALID), + SNDRV_PCM_INFO_BLOCK_TRANSFER | + SNDRV_PCM_INFO_MMAP_VALID), .formats = USE_FORMATS, .rates = USE_RATE, .rate_min = USE_RATE_MIN, diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c index 5aadd44c2fa2..342891d431a8 100644 --- a/drivers/media/video/saa7134/saa7134-dvb.c +++ b/drivers/media/video/saa7134/saa7134-dvb.c @@ -547,7 +547,7 @@ static int philips_tda827x_pll_set(struct dvb_frontend *fe, struct dvb_frontend_ u8 tuner_buf[14]; struct i2c_msg tuner_msg = {.addr = 0x60,.flags = 0,.buf = tuner_buf, - .len = sizeof(tuner_buf) }; + .len = sizeof(tuner_buf) }; int i, tuner_freq, if_freq; u32 N; switch (params->u.ofdm.bandwidth) { @@ -606,7 +606,7 @@ static void philips_tda827x_pll_sleep(struct dvb_frontend *fe) struct saa7134_dev *dev = fe->dvb->priv; static u8 tda827x_sleep[] = { 0x30, 0xd0}; struct i2c_msg tuner_msg = {.addr = 0x60,.flags = 0,.buf = tda827x_sleep, - .len = sizeof(tda827x_sleep) }; + .len = sizeof(tda827x_sleep) }; i2c_transfer(&dev->i2c_adap, &tuner_msg, 1); } diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index 7ce0459989b5..f99dbb729555 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -118,7 +118,7 @@ static IR_KEYTAB_TYPE eztv_codes[IR_KEYTAB_SIZE] = { [ 1 ] = KEY_TV, // DVR [ 21 ] = KEY_DVD, // DVD [ 23 ] = KEY_AUDIO, // music - // DVR mode / DVD mode / music mode + // DVR mode / DVD mode / music mode [ 27 ] = KEY_MUTE, // mute [ 2 ] = KEY_LANGUAGE, // MTS/SAP / audio / autoseek diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index 86db7fb96efd..caeb47c68b8b 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c @@ -1345,8 +1345,8 @@ video_poll(struct file *file, struct poll_table_struct *wait) return POLLERR; } if (0 != fh->cap.ops->buf_prepare(&fh->cap,fh->cap.read_buf,fh->cap.field)) { - up(&fh->cap.lock); - return POLLERR; + up(&fh->cap.lock); + return POLLERR; } fh->cap.ops->buf_queue(&fh->cap,fh->cap.read_buf); fh->cap.read_off = 0; diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c index e1639a24f77f..75901b030730 100644 --- a/drivers/media/video/tvaudio.c +++ b/drivers/media/video/tvaudio.c @@ -1028,7 +1028,7 @@ static int tda9874a_initialize(struct CHIPSTATE *chip) #define TEA6300_TR 0x03 /* treble */ #define TEA6300_FA 0x04 /* fader control */ #define TEA6300_S 0x05 /* switch register */ - /* values for those registers: */ + /* values for those registers: */ #define TEA6300_S_SA 0x01 /* stereo A input */ #define TEA6300_S_SB 0x02 /* stereo B */ #define TEA6300_S_SC 0x04 /* stereo C */ @@ -1042,7 +1042,7 @@ static int tda9874a_initialize(struct CHIPSTATE *chip) #define TEA6320_BA 0x05 /* bass (0-4) */ #define TEA6320_TR 0x06 /* treble (0-4) */ #define TEA6320_S 0x07 /* switch register */ - /* values for those registers: */ + /* values for those registers: */ #define TEA6320_S_SA 0x07 /* stereo A input */ #define TEA6320_S_SB 0x06 /* stereo B */ #define TEA6320_S_SC 0x05 /* stereo C */ @@ -1082,7 +1082,7 @@ static int tea6320_initialize(struct CHIPSTATE * chip) #define TDA8425_BA 0x02 /* bass */ #define TDA8425_TR 0x03 /* treble */ #define TDA8425_S1 0x08 /* switch functions */ - /* values for those registers: */ + /* values for those registers: */ #define TDA8425_S1_OFF 0xEE /* audio off (mute on) */ #define TDA8425_S1_CH1 0xCE /* audio channel 1 (mute off) - "linear stereo" mode */ #define TDA8425_S1_CH2 0xCF /* audio channel 2 (mute off) - "linear stereo" mode */ @@ -1148,7 +1148,7 @@ static void tda8425_setmode(struct CHIPSTATE *chip, int mode) /* bit definition of the RESET register, I2C data. */ #define PIC16C54_MISC_RESET_REMOTE_CTL 0x01 /* bit 0, Reset to receive the key */ - /* code of remote controller */ + /* code of remote controller */ #define PIC16C54_MISC_MTS_MAIN 0x02 /* bit 1 */ #define PIC16C54_MISC_MTS_SAP 0x04 /* bit 2 */ #define PIC16C54_MISC_MTS_BOTH 0x08 /* bit 3 */ diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c index 68128e04dacc..d83a33618119 100644 --- a/drivers/media/video/tveeprom.c +++ b/drivers/media/video/tveeprom.c @@ -331,7 +331,7 @@ static int hasRadioTuner(int tunerType) } void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, - unsigned char *eeprom_data) + unsigned char *eeprom_data) { /* ---------------------------------------------- ** The hauppauge eeprom format is tagged diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index a9a0999be702..090091560c36 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -393,7 +393,7 @@ struct v4l2_jpegcompression #define V4L2_JPEG_MARKER_DRI (1<<5) /* Define Restart Interval */ #define V4L2_JPEG_MARKER_COM (1<<6) /* Comment segment */ #define V4L2_JPEG_MARKER_APP (1<<7) /* App segment, driver will - * allways use APP0 */ + * allways use APP0 */ }; @@ -849,8 +849,8 @@ struct v4l2_sliced_vbi_format __u16 service_set; /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field - (equals frame lines 313-336 for 625 line video - standards, 263-286 for 525 line standards) */ + (equals frame lines 313-336 for 625 line video + standards, 263-286 for 525 line standards) */ __u16 service_lines[2][24]; __u32 io_size; __u32 reserved[2]; /* must be zero */ @@ -869,8 +869,8 @@ struct v4l2_sliced_vbi_cap __u16 service_set; /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field - (equals frame lines 313-336 for 625 line video - standards, 263-286 for 525 line standards) */ + (equals frame lines 313-336 for 625 line video + standards, 263-286 for 525 line standards) */ __u16 service_lines[2][24]; __u32 reserved[4]; /* must be 0 */ }; -- cgit v1.2.2 From 02f7427333c5784a937314a305132ed31cc6b9d1 Mon Sep 17 00:00:00 2001 From: Markus Rechberger Date: Tue, 8 Nov 2005 21:37:46 -0800 Subject: [PATCH] v4l: 802: replaced kmalloc kfree with usb buffer alloc usb buffer free to get - Replaced kmalloc/kfree with usb_buffer_alloc/usb_buffer_free to get Signed-off-by: Markus Rechberger Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/em28xx/em28xx-core.c | 50 ++++++++++++++++---------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index 227a47d6e4bd..ba2d986c6dfc 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c @@ -714,11 +714,12 @@ void em2820_uninit_isoc(struct em2820 *dev) for (i = 0; i < EM2820_NUM_BUFS; i++) { if (dev->urb[i]) { usb_kill_urb(dev->urb[i]); + if (dev->transfer_buffer[i]){ + usb_buffer_free(dev->udev,(EM2820_NUM_PACKETS*dev->max_pkt_size),dev->transfer_buffer[i],dev->urb[i]->transfer_dma); + } usb_free_urb(dev->urb[i]); } dev->urb[i] = NULL; - if (dev->transfer_buffer[i]) - kfree(dev->transfer_buffer[i]); dev->transfer_buffer[i] = NULL; } em2820_capture_start(dev, 0); @@ -743,7 +744,13 @@ int em2820_init_isoc(struct em2820 *dev) struct urb *urb; int j, k; /* allocate transfer buffer */ - dev->transfer_buffer[i] = kmalloc(sb_size, GFP_KERNEL); + urb = usb_alloc_urb(EM2820_NUM_PACKETS, GFP_KERNEL); + if (!urb){ + em2820_errdev("cannot alloc urb %i\n", i); + em2820_uninit_isoc(dev); + return -ENOMEM; + } + dev->transfer_buffer[i] = usb_buffer_alloc(dev->udev, sb_size, GFP_KERNEL,&urb->transfer_dma); if (!dev->transfer_buffer[i]) { em2820_errdev ("unable to allocate %i bytes for transfer buffer %i\n", @@ -752,29 +759,22 @@ int em2820_init_isoc(struct em2820 *dev) return -ENOMEM; } memset(dev->transfer_buffer[i], 0, sb_size); - urb = usb_alloc_urb(EM2820_NUM_PACKETS, GFP_KERNEL); - if (urb) { - urb->dev = dev->udev; - urb->context = dev; - urb->pipe = usb_rcvisocpipe(dev->udev, 0x82); - urb->transfer_flags = URB_ISO_ASAP; - urb->interval = 1; - urb->transfer_buffer = dev->transfer_buffer[i]; - urb->complete = em2820_isocIrq; - urb->number_of_packets = EM2820_NUM_PACKETS; - urb->transfer_buffer_length = sb_size; - for (j = k = 0; j < EM2820_NUM_PACKETS; - j++, k += dev->max_pkt_size) { - urb->iso_frame_desc[j].offset = k; - urb->iso_frame_desc[j].length = - dev->max_pkt_size; - } - dev->urb[i] = urb; - } else { - em2820_errdev("cannot alloc urb %i\n", i); - em2820_uninit_isoc(dev); - return -ENOMEM; + urb->dev = dev->udev; + urb->context = dev; + urb->pipe = usb_rcvisocpipe(dev->udev, 0x82); + urb->transfer_flags = URB_ISO_ASAP; + urb->interval = 1; + urb->transfer_buffer = dev->transfer_buffer[i]; + urb->complete = em2820_isocIrq; + urb->number_of_packets = EM2820_NUM_PACKETS; + urb->transfer_buffer_length = sb_size; + for (j = k = 0; j < EM2820_NUM_PACKETS; + j++, k += dev->max_pkt_size) { + urb->iso_frame_desc[j].offset = k; + urb->iso_frame_desc[j].length = + dev->max_pkt_size; } + dev->urb[i] = urb; } /* submit urbs */ -- cgit v1.2.2 From 4c0772a9e1fdd5972751993c58d0ac2a427ceb24 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:37:47 -0800 Subject: [PATCH] v4l: 803: after msp34xxg reset msp wake thread should be called - After msp34xxg_reset, msp_wake_thread should be called to wake again. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/msp3400.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/media/video/msp3400.c b/drivers/media/video/msp3400.c index 699cea2cc648..ba2c95842fba 100644 --- a/drivers/media/video/msp3400.c +++ b/drivers/media/video/msp3400.c @@ -1788,10 +1788,9 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) dprintk("msp34xx: AUDC_SET_RADIO\n"); msp->norm = VIDEO_MODE_RADIO; dprintk("msp34xx: switching to radio mode\n"); - if (IS_MSP34XX_G(msp)) { + if (IS_MSP34XX_G(msp)) msp34xxg_reset(client); - break; - } + msp->watch_stereo = 0; switch (msp->opmode) { case OPMODE_MANUAL: @@ -1906,10 +1905,9 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) dprintk("msp34xx: VIDIOCSCHAN (norm=%d)\n",vc->norm); msp->norm = vc->norm; - if (IS_MSP34XX_G(msp)) { + if (IS_MSP34XX_G(msp)) msp34xxg_reset(client); - break; - } + msp_wake_thread(client); break; } @@ -1919,10 +1917,9 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) { /* new channel -- kick audio carrier scan */ dprintk("msp34xx: VIDIOCSFREQ\n"); - if (IS_MSP34XX_G(msp)) { + if (IS_MSP34XX_G(msp)) msp34xxg_reset(client); - break; - } + msp_wake_thread(client); break; } -- cgit v1.2.2 From de48eebce8b63dbae7272ee80f4fe0eaddb61278 Mon Sep 17 00:00:00 2001 From: Hartmut Hackmann Date: Tue, 8 Nov 2005 21:37:48 -0800 Subject: [PATCH] v4l: 806: add support for tda8275a - Add support for tda8275a Signed-off-by: Hartmut Hackmann Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/tda8290.c | 638 +++++++++++++++++++++++++++++---------- drivers/media/video/tuner-core.c | 2 +- include/media/tuner.h | 8 +- 3 files changed, 484 insertions(+), 164 deletions(-) diff --git a/drivers/media/video/tda8290.c b/drivers/media/video/tda8290.c index e2027dada5d1..47d3d2ce9770 100644 --- a/drivers/media/video/tda8290.c +++ b/drivers/media/video/tda8290.c @@ -1,177 +1,402 @@ /* - * - * i2c tv tuner chip device driver - * controls the philips tda8290+75 tuner chip combo. - */ + + i2c tv tuner chip device driver + controls the philips tda8290+75 tuner chip combo. + + 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 #include #include #include -#define I2C_ADDR_TDA8290 0x4b -#define I2C_ADDR_TDA8275 0x61 - /* ---------------------------------------------------------------------- */ -struct freq_entry { - u16 freq; - u8 value; +struct tda827x_data { + u32 lomax; + u8 spd; + u8 bs; + u8 bp; + u8 cp; + u8 gc3; + u8 div1p5; }; -static struct freq_entry band_table[] = { - { 0x2DF4, 0x1C }, - { 0x2574, 0x14 }, - { 0x22B4, 0x0C }, - { 0x20D4, 0x0B }, - { 0x1E74, 0x3B }, - { 0x1C34, 0x33 }, - { 0x16F4, 0x5B }, - { 0x1454, 0x53 }, - { 0x12D4, 0x52 }, - { 0x1034, 0x4A }, - { 0x0EE4, 0x7A }, - { 0x0D34, 0x72 }, - { 0x0B54, 0x9A }, - { 0x0914, 0x91 }, - { 0x07F4, 0x89 }, - { 0x0774, 0xB9 }, - { 0x067B, 0xB1 }, - { 0x0634, 0xD9 }, - { 0x05A4, 0xD8 }, // FM radio - { 0x0494, 0xD0 }, - { 0x03BC, 0xC8 }, - { 0x0394, 0xF8 }, // 57250000 Hz - { 0x0000, 0xF0 }, // 0 + /* Note lomax entry is lo / 62500 */ + +static struct tda827x_data tda827x_analog[] = { + { .lomax = 992, .spd = 3, .bs = 2, .bp = 0, .cp = 0, .gc3 = 3, .div1p5 = 1}, /* 62 MHz */ + { .lomax = 1056, .spd = 3, .bs = 3, .bp = 0, .cp = 0, .gc3 = 3, .div1p5 = 1}, /* 66 MHz */ + { .lomax = 1216, .spd = 3, .bs = 1, .bp = 0, .cp = 0, .gc3 = 3, .div1p5 = 0}, /* 76 MHz */ + { .lomax = 1344, .spd = 3, .bs = 2, .bp = 0, .cp = 0, .gc3 = 3, .div1p5 = 0}, /* 84 MHz */ + { .lomax = 1488, .spd = 3, .bs = 2, .bp = 0, .cp = 0, .gc3 = 1, .div1p5 = 0}, /* 93 MHz */ + { .lomax = 1568, .spd = 3, .bs = 3, .bp = 0, .cp = 0, .gc3 = 1, .div1p5 = 0}, /* 98 MHz */ + { .lomax = 1744, .spd = 3, .bs = 3, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 0}, /* 109 MHz */ + { .lomax = 1968, .spd = 2, .bs = 2, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 1}, /* 123 MHz */ + { .lomax = 2128, .spd = 2, .bs = 3, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 1}, /* 133 MHz */ + { .lomax = 2416, .spd = 2, .bs = 1, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 0}, /* 151 MHz */ + { .lomax = 2464, .spd = 2, .bs = 2, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 0}, /* 154 MHz */ + { .lomax = 2896, .spd = 2, .bs = 2, .bp = 1, .cp = 0, .gc3 = 0, .div1p5 = 0}, /* 181 MHz */ + { .lomax = 2960, .spd = 2, .bs = 2, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 0}, /* 185 MHz */ + { .lomax = 3472, .spd = 2, .bs = 3, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 0}, /* 217 MHz */ + { .lomax = 3904, .spd = 1, .bs = 2, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 1}, /* 244 MHz */ + { .lomax = 4240, .spd = 1, .bs = 3, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 1}, /* 265 MHz */ + { .lomax = 4832, .spd = 1, .bs = 1, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 0}, /* 302 MHz */ + { .lomax = 5184, .spd = 1, .bs = 2, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 0}, /* 324 MHz */ + { .lomax = 5920, .spd = 1, .bs = 2, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 0}, /* 370 MHz */ + { .lomax = 7264, .spd = 1, .bs = 3, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 0}, /* 454 MHz */ + { .lomax = 7888, .spd = 0, .bs = 2, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 1}, /* 493 MHz */ + { .lomax = 8480, .spd = 0, .bs = 3, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 1}, /* 530 MHz */ + { .lomax = 8864, .spd = 0, .bs = 1, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 0}, /* 554 MHz */ + { .lomax = 9664, .spd = 0, .bs = 1, .bp = 4, .cp = 0, .gc3 = 0, .div1p5 = 0}, /* 604 MHz */ + { .lomax = 11088, .spd = 0, .bs = 2, .bp = 4, .cp = 0, .gc3 = 0, .div1p5 = 0}, /* 696 MHz */ + { .lomax = 11840, .spd = 0, .bs = 2, .bp = 4, .cp = 1, .gc3 = 0, .div1p5 = 0}, /* 740 MHz */ + { .lomax = 13120, .spd = 0, .bs = 3, .bp = 4, .cp = 0, .gc3 = 0, .div1p5 = 0}, /* 820 MHz */ + { .lomax = 13840, .spd = 0, .bs = 3, .bp = 4, .cp = 1, .gc3 = 0, .div1p5 = 0}, /* 865 MHz */ + { .lomax = 0, .spd = 0, .bs = 0, .bp = 0, .cp = 0, .gc3 = 0, .div1p5 = 0} /* End */ }; -static struct freq_entry div_table[] = { - { 0x1C34, 3 }, - { 0x0D34, 2 }, - { 0x067B, 1 }, - { 0x0000, 0 }, -}; +static void tda827x_tune(struct i2c_client *c, u16 ifc, unsigned int freq) +{ + unsigned char tuner_reg[8]; + unsigned char reg2[2]; + u32 N; + int i; + struct tuner *t = i2c_get_clientdata(c); + struct i2c_msg msg = {.addr = t->tda827x_addr, .flags = 0}; -static struct freq_entry agc_table[] = { - { 0x22B4, 0x8F }, - { 0x0B54, 0x9F }, - { 0x09A4, 0x8F }, - { 0x0554, 0x9F }, - { 0x0000, 0xBF }, -}; + if (t->mode == V4L2_TUNER_RADIO) + freq = freq / 1000; + + N = freq + ifc; + i = 0; + while (tda827x_analog[i].lomax < N) { + if(tda827x_analog[i + 1].lomax == 0) + break; + i++; + } + + N = N << tda827x_analog[i].spd; + + tuner_reg[0] = 0; + tuner_reg[1] = (unsigned char)(N>>8); + tuner_reg[2] = (unsigned char) N; + tuner_reg[3] = 0x40; + tuner_reg[4] = 0x52 + (t->tda827x_lpsel << 5); + tuner_reg[5] = (tda827x_analog[i].spd << 6) + (tda827x_analog[i].div1p5 <<5) + + (tda827x_analog[i].bs <<3) + tda827x_analog[i].bp; + tuner_reg[6] = 0x8f + (tda827x_analog[i].gc3 << 4); + tuner_reg[7] = 0x8f; + + msg.buf = tuner_reg; + msg.len = 8; + i2c_transfer(c->adapter, &msg, 1); + + msg.buf= reg2; + msg.len = 2; + reg2[0] = 0x80; + reg2[1] = 0; + i2c_transfer(c->adapter, &msg, 1); + + reg2[0] = 0x60; + reg2[1] = 0xbf; + i2c_transfer(c->adapter, &msg, 1); + + reg2[0] = 0x30; + reg2[1] = tuner_reg[4] + 0x80; + i2c_transfer(c->adapter, &msg, 1); + + msleep(1); + reg2[0] = 0x30; + reg2[1] = tuner_reg[4] + 4; + i2c_transfer(c->adapter, &msg, 1); + + msleep(1); + reg2[0] = 0x30; + reg2[1] = tuner_reg[4]; + i2c_transfer(c->adapter, &msg, 1); + + msleep(550); + reg2[0] = 0x30; + reg2[1] = (tuner_reg[4] & 0xfc) + tda827x_analog[i].cp ; + i2c_transfer(c->adapter, &msg, 1); -static __u8 get_freq_entry( struct freq_entry* table, __u16 freq) + reg2[0] = 0x60; + reg2[1] = 0x7f; + i2c_transfer(c->adapter, &msg, 1); + + reg2[0] = 0x80; + reg2[1] = 0x08; // Vsync en + i2c_transfer(c->adapter, &msg, 1); +} + +static void tda827x_agcf(struct i2c_client *c) { - while(table->freq && table->freq > freq) - table++; - return table->value; + struct tuner *t = i2c_get_clientdata(c); + unsigned char data[] = {0x80, 0x0c}; + struct i2c_msg msg = {.addr = t->tda827x_addr, .buf = data, + .flags = 0, .len = 2}; + i2c_transfer(c->adapter, &msg, 1); } /* ---------------------------------------------------------------------- */ -static unsigned char i2c_enable_bridge[2] = { 0x21, 0xC0 }; -static unsigned char i2c_disable_bridge[2] = { 0x21, 0x80 }; -static unsigned char i2c_init_tda8275[14] = { 0x00, 0x00, 0x00, 0x00, - 0xfC, 0x04, 0xA3, 0x3F, - 0x2A, 0x04, 0xFF, 0x00, - 0x00, 0x40 }; -static unsigned char i2c_set_VS[2] = { 0x30, 0x6F }; -static unsigned char i2c_set_GP01_CF[2] = { 0x20, 0x0B }; -static unsigned char i2c_tda8290_reset[2] = { 0x00, 0x00 }; -static unsigned char i2c_tda8290_standby[2] = { 0x00, 0x02 }; -static unsigned char i2c_gainset_off[2] = { 0x28, 0x14 }; -static unsigned char i2c_gainset_on[2] = { 0x28, 0x54 }; -static unsigned char i2c_agc3_00[2] = { 0x80, 0x00 }; -static unsigned char i2c_agc2_BF[2] = { 0x60, 0xBF }; -static unsigned char i2c_cb1_D0[2] = { 0x30, 0xD0 }; -static unsigned char i2c_cb1_D2[2] = { 0x30, 0xD2 }; -static unsigned char i2c_cb1_56[2] = { 0x30, 0x56 }; -static unsigned char i2c_cb1_52[2] = { 0x30, 0x52 }; -static unsigned char i2c_cb1_50[2] = { 0x30, 0x50 }; -static unsigned char i2c_agc2_7F[2] = { 0x60, 0x7F }; -static unsigned char i2c_agc3_08[2] = { 0x80, 0x08 }; - -/* FIXME: European PAL/SECAM should select 9MHz Lowpass Filter, while - NTSC/M and PAL/M should be using 7MHz filter, by selecting CB3 */ -static unsigned char i2c_cb3_9MHz[2] = { 0xc0, 0x39 }; -static unsigned char i2c_cb3_7MHz[2] = { 0xc0, 0x3B }; - -static struct i2c_msg i2c_msg_init[] = { - { I2C_ADDR_TDA8275, 0, ARRAY_SIZE(i2c_init_tda8275), i2c_init_tda8275 }, - { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_disable_bridge), i2c_disable_bridge }, - { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_set_VS), i2c_set_VS }, - { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_set_GP01_CF), i2c_set_GP01_CF }, +struct tda827xa_data { + u32 lomax; + u8 svco; + u8 spd; + u8 scr; + u8 sbs; + u8 gc3; }; -static struct i2c_msg i2c_msg_prolog[] = { -// { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_easy_mode), i2c_easy_mode }, - { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_gainset_off), i2c_gainset_off }, - { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_tda8290_reset), i2c_tda8290_reset }, - { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_enable_bridge), i2c_enable_bridge }, +static struct tda827xa_data tda827xa_analog[] = { + { .lomax = 910, .svco = 3, .spd = 4, .scr = 0, .sbs = 0, .gc3 = 3}, /* 56.875 MHz */ + { .lomax = 1076, .svco = 0, .spd = 3, .scr = 0, .sbs = 0, .gc3 = 3}, /* 67.25 MHz */ + { .lomax = 1300, .svco = 1, .spd = 3, .scr = 0, .sbs = 0, .gc3 = 3}, /* 81.25 MHz */ + { .lomax = 1560, .svco = 2, .spd = 3, .scr = 0, .sbs = 0, .gc3 = 3}, /* 97.5 MHz */ + { .lomax = 1820, .svco = 3, .spd = 3, .scr = 0, .sbs = 1, .gc3 = 1}, /* 113.75 MHz */ + { .lomax = 2152, .svco = 0, .spd = 2, .scr = 0, .sbs = 1, .gc3 = 1}, /* 134.5 MHz */ + { .lomax = 2464, .svco = 1, .spd = 2, .scr = 0, .sbs = 1, .gc3 = 1}, /* 154 MHz */ + { .lomax = 2600, .svco = 1, .spd = 2, .scr = 0, .sbs = 1, .gc3 = 1}, /* 162.5 MHz */ + { .lomax = 2928, .svco = 2, .spd = 2, .scr = 0, .sbs = 1, .gc3 = 1}, /* 183 MHz */ + { .lomax = 3120, .svco = 2, .spd = 2, .scr = 0, .sbs = 2, .gc3 = 1}, /* 195 MHz */ + { .lomax = 3640, .svco = 3, .spd = 2, .scr = 0, .sbs = 2, .gc3 = 3}, /* 227.5 MHz */ + { .lomax = 4304, .svco = 0, .spd = 1, .scr = 0, .sbs = 2, .gc3 = 3}, /* 269 MHz */ + { .lomax = 5200, .svco = 1, .spd = 1, .scr = 0, .sbs = 2, .gc3 = 1}, /* 325 MHz */ + { .lomax = 6240, .svco = 2, .spd = 1, .scr = 0, .sbs = 3, .gc3 = 3}, /* 390 MHz */ + { .lomax = 7280, .svco = 3, .spd = 1, .scr = 0, .sbs = 3, .gc3 = 3}, /* 455 MHz */ + { .lomax = 8320, .svco = 0, .spd = 0, .scr = 0, .sbs = 3, .gc3 = 1}, /* 520 MHz */ + { .lomax = 8608, .svco = 0, .spd = 0, .scr = 1, .sbs = 3, .gc3 = 1}, /* 538 MHz */ + { .lomax = 8864, .svco = 1, .spd = 0, .scr = 0, .sbs = 3, .gc3 = 1}, /* 554 MHz */ + { .lomax = 9920, .svco = 1, .spd = 0, .scr = 0, .sbs = 4, .gc3 = 0}, /* 620 MHz */ + { .lomax = 10400, .svco = 1, .spd = 0, .scr = 1, .sbs = 4, .gc3 = 0}, /* 650 MHz */ + { .lomax = 11200, .svco = 2, .spd = 0, .scr = 0, .sbs = 4, .gc3 = 0}, /* 700 MHz */ + { .lomax = 12480, .svco = 2, .spd = 0, .scr = 1, .sbs = 4, .gc3 = 0}, /* 780 MHz */ + { .lomax = 13120, .svco = 3, .spd = 0, .scr = 0, .sbs = 4, .gc3 = 0}, /* 820 MHz */ + { .lomax = 13920, .svco = 3, .spd = 0, .scr = 1, .sbs = 4, .gc3 = 0}, /* 870 MHz */ + { .lomax = 14576, .svco = 3, .spd = 0, .scr = 2, .sbs = 4, .gc3 = 0}, /* 911 MHz */ + { .lomax = 0, .svco = 0, .spd = 0, .scr = 0, .sbs = 0, .gc3 = 0} /* End */ }; -static struct i2c_msg i2c_msg_config[] = { -// { I2C_ADDR_TDA8275, 0, ARRAY_SIZE(i2c_set_freq), i2c_set_freq }, - { I2C_ADDR_TDA8275, 0, ARRAY_SIZE(i2c_agc3_00), i2c_agc3_00 }, - { I2C_ADDR_TDA8275, 0, ARRAY_SIZE(i2c_agc2_BF), i2c_agc2_BF }, - { I2C_ADDR_TDA8275, 0, ARRAY_SIZE(i2c_cb1_D2), i2c_cb1_D2 }, - { I2C_ADDR_TDA8275, 0, ARRAY_SIZE(i2c_cb1_56), i2c_cb1_56 }, - { I2C_ADDR_TDA8275, 0, ARRAY_SIZE(i2c_cb1_52), i2c_cb1_52 }, -}; +static void tda827xa_tune(struct i2c_client *c, u16 ifc, unsigned int freq) +{ + unsigned char tuner_reg[14]; + unsigned char reg2[2]; + u32 N; + int i; + struct tuner *t = i2c_get_clientdata(c); + struct i2c_msg msg = {.addr = t->tda827x_addr, .flags = 0}; -static struct i2c_msg i2c_msg_epilog[] = { - { I2C_ADDR_TDA8275, 0, ARRAY_SIZE(i2c_cb1_50), i2c_cb1_50 }, - { I2C_ADDR_TDA8275, 0, ARRAY_SIZE(i2c_agc2_7F), i2c_agc2_7F }, - { I2C_ADDR_TDA8275, 0, ARRAY_SIZE(i2c_agc3_08), i2c_agc3_08 }, - { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_disable_bridge), i2c_disable_bridge }, - { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_gainset_on), i2c_gainset_on }, -}; + if (t->mode == V4L2_TUNER_RADIO) + freq = freq / 1000; -static struct i2c_msg i2c_msg_standby[] = { - { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_enable_bridge), i2c_enable_bridge }, - { I2C_ADDR_TDA8275, 0, ARRAY_SIZE(i2c_cb1_D0), i2c_cb1_D0 }, - { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_disable_bridge), i2c_disable_bridge }, - { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_tda8290_standby), i2c_tda8290_standby }, -}; + N = freq + ifc; + i = 0; + while (tda827xa_analog[i].lomax < N) { + if(tda827xa_analog[i + 1].lomax == 0) + break; + i++; + } + + N = N << tda827xa_analog[i].spd; + + tuner_reg[0] = 0; + tuner_reg[1] = (unsigned char)(N>>8); + tuner_reg[2] = (unsigned char) N; + tuner_reg[3] = 0; + tuner_reg[4] = 0x16; + tuner_reg[5] = (tda827xa_analog[i].spd << 5) + (tda827xa_analog[i].svco << 3) + + tda827xa_analog[i].sbs; + tuner_reg[6] = 0x8b + (tda827xa_analog[i].gc3 << 4); + tuner_reg[7] = 0x0c; + tuner_reg[8] = 4; + tuner_reg[9] = 0x20; + tuner_reg[10] = 0xff; + tuner_reg[11] = 0xe0; + tuner_reg[12] = 0; + tuner_reg[13] = 0x39 + (t->tda827x_lpsel << 1); + + msg.buf = tuner_reg; + msg.len = 14; + i2c_transfer(c->adapter, &msg, 1); + + msg.buf= reg2; + msg.len = 2; + reg2[0] = 0x60; + reg2[1] = 0x3c; + i2c_transfer(c->adapter, &msg, 1); + + reg2[0] = 0xa0; + reg2[1] = 0xc0; + i2c_transfer(c->adapter, &msg, 1); + + msleep(2); + reg2[0] = 0x30; + reg2[1] = 0x10 + tda827xa_analog[i].scr; + i2c_transfer(c->adapter, &msg, 1); + + msleep(550); + reg2[0] = 0x50; + reg2[1] = 0x8f + (tda827xa_analog[i].gc3 << 4); + i2c_transfer(c->adapter, &msg, 1); + + reg2[0] = 0x80; + reg2[1] = 0x28; + i2c_transfer(c->adapter, &msg, 1); + + reg2[0] = 0xb0; + reg2[1] = 0x01; + i2c_transfer(c->adapter, &msg, 1); -static int tda8290_tune(struct i2c_client *c) + reg2[0] = 0xc0; + reg2[1] = 0x19 + (t->tda827x_lpsel << 1); + i2c_transfer(c->adapter, &msg, 1); +} + +static void tda827xa_agcf(struct i2c_client *c) { struct tuner *t = i2c_get_clientdata(c); - struct i2c_msg easy_mode = - { I2C_ADDR_TDA8290, 0, 2, t->i2c_easy_mode }; - struct i2c_msg set_freq = - { I2C_ADDR_TDA8275, 0, 8, t->i2c_set_freq }; - - i2c_transfer(c->adapter, &easy_mode, 1); - i2c_transfer(c->adapter, i2c_msg_prolog, ARRAY_SIZE(i2c_msg_prolog)); + unsigned char data[] = {0x80, 0x2c}; + struct i2c_msg msg = {.addr = t->tda827x_addr, .buf = data, + .flags = 0, .len = 2}; + i2c_transfer(c->adapter, &msg, 1); +} - i2c_transfer(c->adapter, &set_freq, 1); - i2c_transfer(c->adapter, i2c_msg_config, ARRAY_SIZE(i2c_msg_config)); +/*---------------------------------------------------------------------*/ - msleep(550); - i2c_transfer(c->adapter, i2c_msg_epilog, ARRAY_SIZE(i2c_msg_epilog)); - return 0; +static void tda8290_i2c_bridge(struct i2c_client *c, int close) +{ + unsigned char enable[2] = { 0x21, 0xC0 }; + unsigned char disable[2] = { 0x21, 0x80 }; + unsigned char *msg; + if(close) { + msg = enable; + i2c_master_send(c, msg, 2); + /* let the bridge stabilize */ + msleep(20); + } else { + msg = disable; + i2c_master_send(c, msg, 2); + } } -static void set_frequency(struct tuner *t, u16 ifc, unsigned int freq) +/*---------------------------------------------------------------------*/ + +static int tda8290_tune(struct i2c_client *c, u16 ifc, unsigned int freq) { - u32 N; + struct tuner *t = i2c_get_clientdata(c); + unsigned char soft_reset[] = { 0x00, 0x00 }; + unsigned char easy_mode[] = { 0x01, t->tda8290_easy_mode }; + unsigned char expert_mode[] = { 0x01, 0x80 }; + unsigned char gainset_off[] = { 0x28, 0x14 }; + unsigned char if_agc_spd[] = { 0x0f, 0x88 }; + unsigned char adc_head_6[] = { 0x05, 0x04 }; + unsigned char adc_head_9[] = { 0x05, 0x02 }; + unsigned char adc_head_12[] = { 0x05, 0x01 }; + unsigned char pll_bw_nom[] = { 0x0d, 0x47 }; + unsigned char pll_bw_low[] = { 0x0d, 0x27 }; + unsigned char gainset_2[] = { 0x28, 0x64 }; + unsigned char agc_rst_on[] = { 0x0e, 0x0b }; + unsigned char agc_rst_off[] = { 0x0e, 0x09 }; + unsigned char if_agc_set[] = { 0x0f, 0x81 }; + unsigned char addr_adc_sat = 0x1a; + unsigned char addr_agc_stat = 0x1d; + unsigned char addr_pll_stat = 0x1b; + unsigned char adc_sat, agc_stat, + pll_stat; + + i2c_master_send(c, easy_mode, 2); + i2c_master_send(c, soft_reset, 2); + msleep(1); + + i2c_master_send(c, expert_mode, 2); + i2c_master_send(c, gainset_off, 2); + i2c_master_send(c, if_agc_spd, 2); + if (t->tda8290_easy_mode & 0x60) + i2c_master_send(c, adc_head_9, 2); + else + i2c_master_send(c, adc_head_6, 2); + i2c_master_send(c, pll_bw_nom, 2); + + tda8290_i2c_bridge(c, 1); + if (t->tda827x_ver != 0) + tda827xa_tune(c, ifc, freq); + else + tda827x_tune(c, ifc, freq); + /* adjust headroom resp. gain */ + i2c_master_send(c, &addr_adc_sat, 1); + i2c_master_recv(c, &adc_sat, 1); + i2c_master_send(c, &addr_agc_stat, 1); + i2c_master_recv(c, &agc_stat, 1); + i2c_master_send(c, &addr_pll_stat, 1); + i2c_master_recv(c, &pll_stat, 1); + if (pll_stat & 0x80) + tuner_dbg("tda8290 is locked, AGC: %d\n", agc_stat); + else + tuner_dbg("tda8290 not locked, no signal?\n"); + if ((agc_stat > 115) || (!(pll_stat & 0x80) && (adc_sat <20))) { + tuner_dbg("adjust gain, step 1. Agc: %d\n", agc_stat); + i2c_master_send(c, gainset_2, 2); + msleep(100); + i2c_master_send(c, &addr_agc_stat, 1); + i2c_master_recv(c, &agc_stat, 1); + i2c_master_send(c, &addr_pll_stat, 1); + i2c_master_recv(c, &pll_stat, 1); + if ((agc_stat > 115) || !(pll_stat & 0x80)) { + tuner_dbg("adjust gain, step 2. Agc: %d\n", agc_stat); + if (t->tda827x_ver != 0) + tda827xa_agcf(c); + else + tda827x_agcf(c); + msleep(100); + i2c_master_send(c, &addr_agc_stat, 1); + i2c_master_recv(c, &agc_stat, 1); + i2c_master_send(c, &addr_pll_stat, 1); + i2c_master_recv(c, &pll_stat, 1); + if((agc_stat > 115) || !(pll_stat & 0x80)) { + tuner_dbg("adjust gain, step 3. Agc: %d\n", agc_stat); + i2c_master_send(c, adc_head_12, 2); + i2c_master_send(c, pll_bw_low, 2); + msleep(100); + } + } + } - if (t->mode == V4L2_TUNER_RADIO) - freq = freq / 1000; + /* l/ l' deadlock? */ + if(t->tda8290_easy_mode & 0x60) { + i2c_master_send(c, &addr_adc_sat, 1); + i2c_master_recv(c, &adc_sat, 1); + i2c_master_send(c, &addr_pll_stat, 1); + i2c_master_recv(c, &pll_stat, 1); + if ((adc_sat > 20) || !(pll_stat & 0x80)) { + i2c_master_send(c, agc_rst_on, 2); + msleep(40); + i2c_master_send(c, agc_rst_off, 2); + } + } - N = (((freq<<3)+ifc)&0x3fffc); - - N = N >> get_freq_entry(div_table, freq); - t->i2c_set_freq[0] = 0; - t->i2c_set_freq[1] = (unsigned char)(N>>8); - t->i2c_set_freq[2] = (unsigned char) N; - t->i2c_set_freq[3] = 0x40; - t->i2c_set_freq[4] = 0x52; - t->i2c_set_freq[5] = get_freq_entry(band_table, freq); - t->i2c_set_freq[6] = get_freq_entry(agc_table, freq); - t->i2c_set_freq[7] = 0x8f; + tda8290_i2c_bridge(c, 0); + i2c_master_send(c, if_agc_set, 2); + return 0; } + +/*---------------------------------------------------------------------*/ + #define V4L2_STD_MN (V4L2_STD_PAL_M|V4L2_STD_PAL_N|V4L2_STD_PAL_Nc|V4L2_STD_NTSC) #define V4L2_STD_B (V4L2_STD_PAL_B|V4L2_STD_PAL_B1|V4L2_STD_SECAM_B) #define V4L2_STD_GH (V4L2_STD_PAL_G|V4L2_STD_PAL_H|V4L2_STD_SECAM_G|V4L2_STD_SECAM_H) @@ -179,26 +404,27 @@ static void set_frequency(struct tuner *t, u16 ifc, unsigned int freq) static void set_audio(struct tuner *t) { - t->i2c_easy_mode[0] = 0x01; + t->tda827x_lpsel = 0; if (t->std & V4L2_STD_MN) { - t->sgIF = 736; - t->i2c_easy_mode[1] = 0x01; + t->sgIF = 92; + t->tda8290_easy_mode = 0x01; + t->tda827x_lpsel = 1; } else if (t->std & V4L2_STD_B) { - t->sgIF = 864; - t->i2c_easy_mode[1] = 0x02; + t->sgIF = 108; + t->tda8290_easy_mode = 0x02; } else if (t->std & V4L2_STD_GH) { - t->sgIF = 992; - t->i2c_easy_mode[1] = 0x04; + t->sgIF = 124; + t->tda8290_easy_mode = 0x04; } else if (t->std & V4L2_STD_PAL_I) { - t->sgIF = 992; - t->i2c_easy_mode[1] = 0x08; + t->sgIF = 124; + t->tda8290_easy_mode = 0x08; } else if (t->std & V4L2_STD_DK) { - t->sgIF = 992; - t->i2c_easy_mode[1] = 0x10; + t->sgIF = 124; + t->tda8290_easy_mode = 0x10; } else if (t->std & V4L2_STD_SECAM_L) { - t->sgIF = 992; - t->i2c_easy_mode[1] = 0x20; + t->sgIF = 124; + t->tda8290_easy_mode = 0x20; } } @@ -207,15 +433,13 @@ static void set_tv_freq(struct i2c_client *c, unsigned int freq) struct tuner *t = i2c_get_clientdata(c); set_audio(t); - set_frequency(t, t->sgIF, freq); - tda8290_tune(c); + tda8290_tune(c, t->sgIF, freq); } static void set_radio_freq(struct i2c_client *c, unsigned int freq) { - struct tuner *t = i2c_get_clientdata(c); - set_frequency(t, 704, freq); - tda8290_tune(c); + /* if frequency is 5.5 MHz */ + tda8290_tune(c, 88, freq); } static int has_signal(struct i2c_client *c) @@ -228,24 +452,118 @@ static int has_signal(struct i2c_client *c) return (afc & 0x80)? 65535:0; } +/*---------------------------------------------------------------------*/ + static void standby(struct i2c_client *c) { - i2c_transfer(c->adapter, i2c_msg_standby, ARRAY_SIZE(i2c_msg_standby)); + struct tuner *t = i2c_get_clientdata(c); + unsigned char cb1[] = { 0x30, 0xD0 }; + unsigned char tda8290_standby[] = { 0x00, 0x02 }; + struct i2c_msg msg = {.addr = t->tda827x_addr, .flags=0, .buf=cb1, .len = 2}; + + tda8290_i2c_bridge(c, 1); + if (t->tda827x_ver != 0) + cb1[1] = 0x90; + i2c_transfer(c->adapter, &msg, 1); + tda8290_i2c_bridge(c, 0); + i2c_master_send(c, tda8290_standby, 2); } -int tda8290_init(struct i2c_client *c) + +static void tda8290_init_if(struct i2c_client *c) +{ + unsigned char set_VS[] = { 0x30, 0x6F }; + unsigned char set_GP01_CF[] = { 0x20, 0x0B }; + + i2c_master_send(c, set_VS, 2); + i2c_master_send(c, set_GP01_CF, 2); +} + +static void tda8290_init_tuner(struct i2c_client *c) { struct tuner *t = i2c_get_clientdata(c); + unsigned char tda8275_init[] = { 0x00, 0x00, 0x00, 0x40, 0xdC, 0x04, 0xAf, + 0x3F, 0x2A, 0x04, 0xFF, 0x00, 0x00, 0x40 }; + unsigned char tda8275a_init[] = { 0x00, 0x00, 0x00, 0x00, 0xdC, 0x05, 0x8b, + 0x0c, 0x04, 0x20, 0xFF, 0x00, 0x00, 0x4b }; + struct i2c_msg msg = {.addr = t->tda827x_addr, .flags=0, + .buf=tda8275_init, .len = 14}; + if (t->tda827x_ver != 0) + msg.buf = tda8275a_init; + + tda8290_i2c_bridge(c, 1); + i2c_transfer(c->adapter, &msg, 1); + tda8290_i2c_bridge(c, 0); +} + +/*---------------------------------------------------------------------*/ - strlcpy(c->name, "tda8290+75", sizeof(c->name)); +int tda8290_init(struct i2c_client *c) +{ + struct tuner *t = i2c_get_clientdata(c); + u8 data; + int i, ret, tuners_found; + u32 tuner_addrs; + struct i2c_msg msg = {.flags=I2C_M_RD, .buf=&data, .len = 1}; + + tda8290_i2c_bridge(c, 1); + /* probe for tuner chip */ + tuners_found = 0; + tuner_addrs = 0; + for (i=0x60; i<= 0x63; i++) { + msg.addr = i; + ret = i2c_transfer(c->adapter, &msg, 1); + if (ret == 1) { + tuners_found++; + tuner_addrs = (tuner_addrs << 8) + i; + } + } + /* if there is more than one tuner, we expect the right one is + behind the bridge and we choose the highest address that doesn't + give a response now + */ + tda8290_i2c_bridge(c, 0); + if(tuners_found > 1) + for (i = 0; i < tuners_found; i++) { + msg.addr = tuner_addrs & 0xff; + ret = i2c_transfer(c->adapter, &msg, 1); + if(ret == 1) + tuner_addrs = tuner_addrs >> 8; + else + break; + } + if (tuner_addrs == 0) { + tuner_addrs = 0x61; + tuner_info ("could not clearly identify tuner address, defaulting to %x\n", + tuner_addrs); + } else { + tuner_addrs = tuner_addrs & 0xff; + tuner_info ("setting tuner address to %x\n", tuner_addrs); + } + t->tda827x_addr = tuner_addrs; + msg.addr = tuner_addrs; + + tda8290_i2c_bridge(c, 1); + ret = i2c_transfer(c->adapter, &msg, 1); + if( ret != 1) + tuner_warn ("TDA827x access failed!\n"); + if ((data & 0x3c) == 0) { + strlcpy(c->name, "tda8290+75", sizeof(c->name)); + t->tda827x_ver = 0; + } else { + strlcpy(c->name, "tda8290+75a", sizeof(c->name)); + t->tda827x_ver = 2; + } tuner_info("tuner: type set to %s\n", c->name); + t->tv_freq = set_tv_freq; t->radio_freq = set_radio_freq; t->has_signal = has_signal; t->standby = standby; + t->tda827x_lpsel = 0; - i2c_master_send(c, i2c_enable_bridge, ARRAY_SIZE(i2c_enable_bridge)); - i2c_transfer(c->adapter, i2c_msg_init, ARRAY_SIZE(i2c_msg_init)); + tda8290_init_tuner(c); + tda8290_init_if(c); return 0; } diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index e677869afcf3..b9f1acf30caf 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c @@ -28,7 +28,7 @@ /* standard i2c insmod options */ static unsigned short normal_i2c[] = { - 0x4b, /* tda8290 */ + 0x42, 0x43, 0x4a, 0x4b, /* tda8290 */ 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, I2C_CLIENT_END diff --git a/include/media/tuner.h b/include/media/tuner.h index 94a9511479a1..8058be63ad0e 100644 --- a/include/media/tuner.h +++ b/include/media/tuner.h @@ -192,9 +192,11 @@ struct tuner { unsigned int radio_if2; /* used by tda8290 */ - unsigned char i2c_easy_mode[2]; - unsigned char i2c_set_freq[8]; - unsigned int sgIF; + unsigned char tda8290_easy_mode; + unsigned char tda827x_lpsel; + unsigned char tda827x_addr; + unsigned char tda827x_ver; + unsigned int sgIF; /* function ptrs */ void (*tv_freq)(struct i2c_client *c, unsigned int freq); -- cgit v1.2.2 From 79436633dbced18aa348f8669ef507109f851303 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:37:49 -0800 Subject: [PATCH] v4l: 809: some changes to allow compiling cx88 and saa7134 - Some changes to allow compiling cx88 and saa7134 without V4L1 support. - This patch will help obsoleting V4L1 API. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/cx88/cx88-video.c | 9 +++- drivers/media/video/saa7134/saa7134-video.c | 6 ++- drivers/media/video/saa7134/saa7134.h | 2 +- include/linux/videodev.h | 74 +--------------------------- include/linux/videodev2.h | 76 +++++++++++++++++++++++++++++ include/media/video-buf.h | 2 +- 6 files changed, 92 insertions(+), 77 deletions(-) diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index f22ccb65de1c..cedd1d79ac13 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c @@ -34,6 +34,9 @@ #include "cx88.h" +/* Include V4L1 specific functions. Should be removed soon */ +#include + MODULE_DESCRIPTION("v4l2 driver module for cx2388x based TV cards"); MODULE_AUTHOR("Gerd Knorr [SuSE Labs]"); MODULE_LICENSE("GPL"); @@ -1187,7 +1190,7 @@ static int video_do_ioctl(struct inode *inode, struct file *file, struct v4l2_format *f = arg; return cx8800_try_fmt(dev,fh,f); } - +#ifdef HAVE_V4L1 /* --- streaming capture ------------------------------------- */ case VIDIOCGMBUF: { @@ -1213,6 +1216,7 @@ static int video_do_ioctl(struct inode *inode, struct file *file, } return 0; } +#endif case VIDIOC_REQBUFS: return videobuf_reqbufs(get_queue(fh), arg); @@ -1244,7 +1248,6 @@ static int video_do_ioctl(struct inode *inode, struct file *file, res_free(dev,fh,res); return 0; } - default: return cx88_do_ioctl( inode, file, fh->radio, core, cmd, arg, video_do_ioctl ); } @@ -1537,6 +1540,7 @@ static int radio_do_ioctl(struct inode *inode, struct file *file, *id = 0; return 0; } +#ifdef HAVE_V4L1 case VIDIOCSTUNER: { struct video_tuner *v = arg; @@ -1547,6 +1551,7 @@ static int radio_do_ioctl(struct inode *inode, struct file *file, cx88_call_i2c_clients(core,VIDIOCSTUNER,v); return 0; } +#endif case VIDIOC_S_TUNER: { struct v4l2_tuner *t = arg; diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index caeb47c68b8b..632ebe8724ec 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c @@ -30,6 +30,9 @@ #include "saa7134-reg.h" #include "saa7134.h" +/* Include V4L1 specific functions. Should be removed soon */ +#include + /* ------------------------------------------------------------------ */ static unsigned int video_debug = 0; @@ -2060,7 +2063,7 @@ static int video_do_ioctl(struct inode *inode, struct file *file, struct v4l2_format *f = arg; return saa7134_try_fmt(dev,fh,f); } - +#ifdef HAVE_V4L1 case VIDIOCGMBUF: { struct video_mbuf *mbuf = arg; @@ -2085,6 +2088,7 @@ static int video_do_ioctl(struct inode *inode, struct file *file, } return 0; } +#endif case VIDIOC_REQBUFS: return videobuf_reqbufs(saa7134_queue(fh),arg); diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index 064c2f7a8c12..cd28a6a7b972 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include #include diff --git a/include/linux/videodev.h b/include/linux/videodev.h index 22e6e4bad7b8..23276cede540 100644 --- a/include/linux/videodev.h +++ b/include/linux/videodev.h @@ -1,57 +1,16 @@ #ifndef __LINUX_VIDEODEV_H #define __LINUX_VIDEODEV_H -#include #include -#define HAVE_V4L2 1 +#define HAVE_V4L1 1 + #include #ifdef __KERNEL__ -#include #include -#include - -struct video_device -{ - /* device info */ - struct device *dev; - char name[32]; - int type; /* v4l1 */ - int type2; /* v4l2 */ - int hardware; - int minor; - - /* device ops + callbacks */ - struct file_operations *fops; - void (*release)(struct video_device *vfd); - - - /* obsolete -- fops->owner is used instead */ - struct module *owner; - /* dev->driver_data will be used instead some day. - * Use the video_{get|set}_drvdata() helper functions, - * so the switch over will be transparent for you. - * Or use {pci|usb}_{get|set}_drvdata() directly. */ - void *priv; - - /* for videodev.c intenal usage -- please don't touch */ - int users; /* video_exclusive_{open|close} ... */ - struct semaphore lock; /* ... helper function uses these */ - char devfs_name[64]; /* devfs */ - struct class_device class_dev; /* sysfs */ -}; - -#define VIDEO_MAJOR 81 - -#define VFL_TYPE_GRABBER 0 -#define VFL_TYPE_VBI 1 -#define VFL_TYPE_RADIO 2 -#define VFL_TYPE_VTX 3 -extern int video_register_device(struct video_device *, int type, int nr); -extern void video_unregister_device(struct video_device *); extern struct video_device* video_devdata(struct file*); #define to_video_device(cd) container_of(cd, struct video_device, class_dev) @@ -68,11 +27,6 @@ video_device_remove_file(struct video_device *vfd, class_device_remove_file(&vfd->class_dev, attr); } -/* helper functions to alloc / release struct video_device, the - later can be used for video_device->release() */ -struct video_device *video_device_alloc(void); -void video_device_release(struct video_device *vfd); - /* helper functions to access driver private data. */ static inline void *video_get_drvdata(struct video_device *dev) { @@ -86,27 +40,8 @@ static inline void video_set_drvdata(struct video_device *dev, void *data) extern int video_exclusive_open(struct inode *inode, struct file *file); extern int video_exclusive_release(struct inode *inode, struct file *file); -extern int video_usercopy(struct inode *inode, struct file *file, - unsigned int cmd, unsigned long arg, - int (*func)(struct inode *inode, struct file *file, - unsigned int cmd, void *arg)); #endif /* __KERNEL__ */ -#define VID_TYPE_CAPTURE 1 /* Can capture */ -#define VID_TYPE_TUNER 2 /* Can tune */ -#define VID_TYPE_TELETEXT 4 /* Does teletext */ -#define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */ -#define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */ -#define VID_TYPE_CLIPPING 32 /* Can clip */ -#define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */ -#define VID_TYPE_SCALES 128 /* Scalable */ -#define VID_TYPE_MONOCHROME 256 /* Monochrome only */ -#define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */ -#define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */ -#define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */ -#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */ -#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */ - struct video_capability { char name[32]; @@ -260,9 +195,6 @@ struct video_key __u32 flags; }; - -#define VIDEO_MAX_FRAME 32 - struct video_mbuf { int size; /* Total memory to map */ @@ -270,10 +202,8 @@ struct video_mbuf int offsets[VIDEO_MAX_FRAME]; }; - #define VIDEO_NO_UNIT (-1) - struct video_unit { int video; /* Video minor */ diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 090091560c36..df0f9a24944a 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -18,6 +18,82 @@ #endif #include /* need __user */ +#include +#include + +#define HAVE_V4L2 1 + +/* + * Common stuff for both V4L1 and V4L2 + * Moved from videodev.h + */ + +#define VIDEO_MAX_FRAME 32 + +#define VFL_TYPE_GRABBER 0 +#define VFL_TYPE_VBI 1 +#define VFL_TYPE_RADIO 2 +#define VFL_TYPE_VTX 3 + +struct video_device +{ + /* device info */ + struct device *dev; + char name[32]; + int type; /* v4l1 */ + int type2; /* v4l2 */ + int hardware; + int minor; + + /* device ops + callbacks */ + struct file_operations *fops; + void (*release)(struct video_device *vfd); + + + /* obsolete -- fops->owner is used instead */ + struct module *owner; + /* dev->driver_data will be used instead some day. + * Use the video_{get|set}_drvdata() helper functions, + * so the switch over will be transparent for you. + * Or use {pci|usb}_{get|set}_drvdata() directly. */ + void *priv; + + /* for videodev.c intenal usage -- please don't touch */ + int users; /* video_exclusive_{open|close} ... */ + struct semaphore lock; /* ... helper function uses these */ + char devfs_name[64]; /* devfs */ + struct class_device class_dev; /* sysfs */ +}; + +#define VIDEO_MAJOR 81 + +#define VID_TYPE_CAPTURE 1 /* Can capture */ +#define VID_TYPE_TUNER 2 /* Can tune */ +#define VID_TYPE_TELETEXT 4 /* Does teletext */ +#define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */ +#define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */ +#define VID_TYPE_CLIPPING 32 /* Can clip */ +#define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */ +#define VID_TYPE_SCALES 128 /* Scalable */ +#define VID_TYPE_MONOCHROME 256 /* Monochrome only */ +#define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */ +#define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */ +#define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */ +#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */ +#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */ + +extern int video_register_device(struct video_device *, int type, int nr); +extern void video_unregister_device(struct video_device *); +extern int video_usercopy(struct inode *inode, struct file *file, + unsigned int cmd, unsigned long arg, + int (*func)(struct inode *inode, struct file *file, + unsigned int cmd, void *arg)); + +/* helper functions to alloc / release struct video_device, the + later can be used for video_device->release() */ +struct video_device *video_device_alloc(void); +void video_device_release(struct video_device *vfd); + /* * M I S C E L L A N E O U S */ diff --git a/include/media/video-buf.h b/include/media/video-buf.h index ee8eb15c0ea6..8ecfd78e0027 100644 --- a/include/media/video-buf.h +++ b/include/media/video-buf.h @@ -17,7 +17,7 @@ * (at your option) any later version. */ -#include +#include #define UNSET (-1U) -- cgit v1.2.2 From bf7e26ee5fce3eb1074ba3e1c8f265cb37c8451c Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Tue, 8 Nov 2005 21:37:50 -0800 Subject: [PATCH] v4l: 810: vidioc log status is added to videodev2.h - VIDIOC_LOG_STATUS is added to videodev2.h this can be enabled again in wm8775.c. Also use the v4l2 VIDIOC_S_FREQUENCY instead of VIDIOCSFREQ. Signed-off-by: Hans Verkuil Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/wm8775.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/wm8775.c b/drivers/media/video/wm8775.c index 5bd592673b94..7d90ae5a99bc 100644 --- a/drivers/media/video/wm8775.c +++ b/drivers/media/video/wm8775.c @@ -112,8 +112,13 @@ static int wm8775_command(struct i2c_client *client, unsigned int cmd, state->muted = 0; break; + case VIDIOC_LOG_STATUS: + wm8775_info("Input: %s%s\n", + state->input == 8 ? "radio" : "default", + state->muted ? " (muted)" : ""); + break; - case VIDIOCSFREQ: + case VIDIOC_S_FREQUENCY: /* If I remove this, then it can happen that I have no sound the first time I tune from static to a valid channel. It's difficult to reproduce and is almost certainly related -- cgit v1.2.2 From 9a741ec9b87ac13f13a1dfcb05979d7c785d0755 Mon Sep 17 00:00:00 2001 From: "Nickolay V. Shmyrev" Date: Tue, 8 Nov 2005 21:37:50 -0800 Subject: [PATCH] v4l: 811: strip trailing whitespaces - Strip trailing whitespaces. Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/tda8290.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/media/video/tda8290.c b/drivers/media/video/tda8290.c index 47d3d2ce9770..8f9d7d1fd3f4 100644 --- a/drivers/media/video/tda8290.c +++ b/drivers/media/video/tda8290.c @@ -97,7 +97,7 @@ static void tda827x_tune(struct i2c_client *c, u16 ifc, unsigned int freq) tuner_reg[3] = 0x40; tuner_reg[4] = 0x52 + (t->tda827x_lpsel << 5); tuner_reg[5] = (tda827x_analog[i].spd << 6) + (tda827x_analog[i].div1p5 <<5) + - (tda827x_analog[i].bs <<3) + tda827x_analog[i].bp; + (tda827x_analog[i].bs <<3) + tda827x_analog[i].bp; tuner_reg[6] = 0x8f + (tda827x_analog[i].gc3 << 4); tuner_reg[7] = 0x8f; @@ -220,7 +220,7 @@ static void tda827xa_tune(struct i2c_client *c, u16 ifc, unsigned int freq) tuner_reg[3] = 0; tuner_reg[4] = 0x16; tuner_reg[5] = (tda827xa_analog[i].spd << 5) + (tda827xa_analog[i].svco << 3) + - tda827xa_analog[i].sbs; + tda827xa_analog[i].sbs; tuner_reg[6] = 0x8b + (tda827xa_analog[i].gc3 << 4); tuner_reg[7] = 0x0c; tuner_reg[8] = 4; @@ -317,7 +317,7 @@ static int tda8290_tune(struct i2c_client *c, u16 ifc, unsigned int freq) unsigned char addr_agc_stat = 0x1d; unsigned char addr_pll_stat = 0x1b; unsigned char adc_sat, agc_stat, - pll_stat; + pll_stat; i2c_master_send(c, easy_mode, 2); i2c_master_send(c, soft_reset, 2); @@ -483,11 +483,11 @@ static void tda8290_init_tuner(struct i2c_client *c) { struct tuner *t = i2c_get_clientdata(c); unsigned char tda8275_init[] = { 0x00, 0x00, 0x00, 0x40, 0xdC, 0x04, 0xAf, - 0x3F, 0x2A, 0x04, 0xFF, 0x00, 0x00, 0x40 }; + 0x3F, 0x2A, 0x04, 0xFF, 0x00, 0x00, 0x40 }; unsigned char tda8275a_init[] = { 0x00, 0x00, 0x00, 0x00, 0xdC, 0x05, 0x8b, - 0x0c, 0x04, 0x20, 0xFF, 0x00, 0x00, 0x4b }; + 0x0c, 0x04, 0x20, 0xFF, 0x00, 0x00, 0x4b }; struct i2c_msg msg = {.addr = t->tda827x_addr, .flags=0, - .buf=tda8275_init, .len = 14}; + .buf=tda8275_init, .len = 14}; if (t->tda827x_ver != 0) msg.buf = tda8275a_init; @@ -535,7 +535,7 @@ int tda8290_init(struct i2c_client *c) if (tuner_addrs == 0) { tuner_addrs = 0x61; tuner_info ("could not clearly identify tuner address, defaulting to %x\n", - tuner_addrs); + tuner_addrs); } else { tuner_addrs = tuner_addrs & 0xff; tuner_info ("setting tuner address to %x\n", tuner_addrs); -- cgit v1.2.2 From c2f6f9d866d3ea25eebe32c6c51e47e5141669cf Mon Sep 17 00:00:00 2001 From: Ricardo Cerqueira Date: Tue, 8 Nov 2005 21:37:51 -0800 Subject: [PATCH] v4l: 812: supports the pinnacle pctv 110i board video inputs and remote - Supports the Pinnacle PCTV 110i board, video inputs, and remote. Signed-off-by: Ricardo Cerqueira Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/video4linux/CARDLIST.saa7134 | 1 + drivers/media/video/ir-kbd-i2c.c | 118 +++++++++++++++++++++++++++- drivers/media/video/saa7134/saa7134-cards.c | 33 ++++++++ drivers/media/video/saa7134/saa7134.h | 1 + drivers/media/video/tda8290.c | 2 +- 5 files changed, 153 insertions(+), 2 deletions(-) diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134 index c5ae8a32f756..9b3ef0031ef6 100644 --- a/Documentation/video4linux/CARDLIST.saa7134 +++ b/Documentation/video4linux/CARDLIST.saa7134 @@ -75,3 +75,4 @@ 74 -> LifeView FlyTV Platinum Mini2 [14c0:1212] 75 -> AVerMedia AVerTVHD MCE A180 [1461:1044] 76 -> SKNet MonsterTV Mobile [1131:4ee9] + 77 -> Pinnacle PCTV 110i (saa7133) [11bd:002e] diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index 12f1053137da..0cd1fc89b2d0 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c @@ -122,6 +122,64 @@ static IR_KEYTAB_TYPE ir_codes_purpletv[IR_KEYTAB_SIZE] = { }; +static IR_KEYTAB_TYPE ir_codes_pinnacle[IR_KEYTAB_SIZE] = { + [ 0x59 ] = KEY_MUTE, + [ 0x4a ] = KEY_POWER, + + [ 0x18 ] = KEY_TEXT, + [ 0x26 ] = KEY_TV, + [ 0x3d ] = KEY_PRINT, + + [ 0x48 ] = KEY_RED, + [ 0x04 ] = KEY_GREEN, + [ 0x11 ] = KEY_YELLOW, + [ 0x00 ] = KEY_BLUE, + + [ 0x2d ] = KEY_VOLUMEUP, + [ 0x1e ] = KEY_VOLUMEDOWN, + + [ 0x49 ] = KEY_MENU, + + [ 0x16 ] = KEY_CHANNELUP, + [ 0x17 ] = KEY_CHANNELDOWN, + + [ 0x20 ] = KEY_UP, + [ 0x21 ] = KEY_DOWN, + [ 0x22 ] = KEY_LEFT, + [ 0x23 ] = KEY_RIGHT, + [ 0x0d ] = KEY_SELECT, + + + + [ 0x08 ] = KEY_BACK, + [ 0x07 ] = KEY_REFRESH, + + [ 0x2f ] = KEY_ZOOM, + [ 0x29 ] = KEY_RECORD, + + [ 0x4b ] = KEY_PAUSE, + [ 0x4d ] = KEY_REWIND, + [ 0x2e ] = KEY_PLAY, + [ 0x4e ] = KEY_FORWARD, + [ 0x53 ] = KEY_PREVIOUS, + [ 0x4c ] = KEY_STOP, + [ 0x54 ] = KEY_NEXT, + + [ 0x69 ] = KEY_KP0, + [ 0x6a ] = KEY_KP1, + [ 0x6b ] = KEY_KP2, + [ 0x6c ] = KEY_KP3, + [ 0x6d ] = KEY_KP4, + [ 0x6e ] = KEY_KP5, + [ 0x6f ] = KEY_KP6, + [ 0x70 ] = KEY_KP7, + [ 0x71 ] = KEY_KP8, + [ 0x72 ] = KEY_KP9, + + [ 0x74 ] = KEY_CHANNEL, + [ 0x0a ] = KEY_BACKSPACE, +}; + /* ----------------------------------------------------------------------- */ /* insmod parameters */ @@ -245,6 +303,58 @@ static int get_key_purpletv(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) *ir_raw = b; return 1; } + +/* The new pinnacle PCTV remote (with the colored buttons) + * + * Ricardo Cerqueira + */ + +static int get_key_pinnacle(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) +{ + unsigned char b[4]; + unsigned int start = 0,parity = 0,code = 0; + + /* poll IR chip */ + if (4 != i2c_master_recv(&ir->c,b,4)) { + dprintk(1,"read error\n"); + return -EIO; + } + + for (start = 0; start<4; start++) { + if (b[start] == 0x80) { + code=b[(start+3)%4]; + parity=b[(start+2)%4]; + } + } + + /* Empty Request */ + if (parity==0) + return 0; + + /* Repeating... */ + if (ir->old == parity) + return 0; + + + ir->old = parity; + + /* Reduce code value to fit inside IR_KEYTAB_SIZE + * + * this is the only value that results in 42 unique + * codes < 128 + */ + + code %= 0x88; + + *ir_raw = code; + *ir_key = code; + + dprintk(1,"Pinnacle PCTV key %02x\n", code); + + return 1; +} + + /* ----------------------------------------------------------------------- */ static void ir_key_poll(struct IR_i2c *ir) @@ -350,6 +460,12 @@ static int ir_attach(struct i2c_adapter *adap, int addr, ir_type = IR_TYPE_OTHER; ir_codes = ir_codes_empty; break; + case 0x47: + name = "Pinnacle PCTV"; + ir->get_key = get_key_pinnacle; + ir_type = IR_TYPE_OTHER; + ir_codes = ir_codes_pinnacle; + break; case 0x7a: name = "Purple TV"; ir->get_key = get_key_purpletv; @@ -426,7 +542,7 @@ static int ir_probe(struct i2c_adapter *adap) */ static const int probe_bttv[] = { 0x1a, 0x18, 0x4b, 0x64, 0x30, -1}; - static const int probe_saa7134[] = { 0x7a, -1 }; + static const int probe_saa7134[] = { 0x7a, 0x47, -1 }; static const int probe_em2820[] = { 0x30, 0x47, -1 }; const int *probe = NULL; struct i2c_client c; diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index a60d49af341d..0147d8342f8d 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c @@ -2391,6 +2391,33 @@ struct saa7134_board saa7134_boards[] = { .amux = LINE1, }}, }, + [SAA7134_BOARD_PINNACLE_PCTV_110i] = { + .name = "Pinnacle PCTV 110i (saa7133)", + .audio_clock = 0x00187de7, + .tuner_type = TUNER_PHILIPS_TDA8290, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .gpiomask = 0x080200000, + .inputs = {{ + .name = name_tv, + .vmux = 4, + .amux = TV, + .tv = 1, + },{ + .name = name_comp1, + .vmux = 1, + .amux = LINE2, + },{ + .name = name_svideo, + .vmux = 8, + .amux = LINE2, + }}, + .radio = { + .name = name_radio, + .amux = LINE1, + }, + }, }; const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards); @@ -2808,6 +2835,12 @@ struct pci_device_id saa7134_pci_tbl[] = { .subvendor = 0x1131, .subdevice = 0x4ee9, .driver_data = SAA7134_BOARD_MONSTERTV_MOBILE, + },{ + .vendor = PCI_VENDOR_ID_PHILIPS, + .device = PCI_DEVICE_ID_PHILIPS_SAA7133, + .subvendor = 0x11bd, + .subdevice = 0x002e, + .driver_data = SAA7134_BOARD_PINNACLE_PCTV_110i, },{ /* --- boards without eeprom + subsystem ID --- */ .vendor = PCI_VENDOR_ID_PHILIPS, diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index cd28a6a7b972..d497fea5425f 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h @@ -203,6 +203,7 @@ struct saa7134_format { #define SAA7134_BOARD_FLYTVPLATINUM_MINI2 74 #define SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180 75 #define SAA7134_BOARD_MONSTERTV_MOBILE 76 +#define SAA7134_BOARD_PINNACLE_PCTV_110i 77 #define SAA7134_MAXBOARDS 8 #define SAA7134_INPUT_MAX 8 diff --git a/drivers/media/video/tda8290.c b/drivers/media/video/tda8290.c index 8f9d7d1fd3f4..fa9b4b898f68 100644 --- a/drivers/media/video/tda8290.c +++ b/drivers/media/video/tda8290.c @@ -487,7 +487,7 @@ static void tda8290_init_tuner(struct i2c_client *c) unsigned char tda8275a_init[] = { 0x00, 0x00, 0x00, 0x00, 0xdC, 0x05, 0x8b, 0x0c, 0x04, 0x20, 0xFF, 0x00, 0x00, 0x4b }; struct i2c_msg msg = {.addr = t->tda827x_addr, .flags=0, - .buf=tda8275_init, .len = 14}; + .buf=tda8275_init, .len = 14}; if (t->tda827x_ver != 0) msg.buf = tda8275a_init; -- cgit v1.2.2 From 9c75541fc97252e605b7bc8f9b09f816483e22fb Mon Sep 17 00:00:00 2001 From: Markus Rechberger Date: Tue, 8 Nov 2005 21:37:52 -0800 Subject: [PATCH] v4l: 813: replaced obsolete video get drvdata and video set drvdata - Replaced obsolete video_get_drvdata and video_set_drvdata Signed-off-by: Markus Rechberger Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/em28xx/em28xx-video.c | 45 +++++++++++++++++++++++-------- drivers/media/video/em28xx/em28xx.h | 1 + 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index e5066d05697e..daa4387a2296 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c @@ -50,6 +50,8 @@ MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); +static LIST_HEAD(em2820_devlist); + static unsigned int card[] = {[0 ... (EM2820_MAXBOARDS - 1)] = UNSET }; module_param_array(card, int, NULL, 0444); @@ -257,10 +259,20 @@ static void em2820_empty_framequeues(struct em2820 *dev) */ static int em2820_v4l2_open(struct inode *inode, struct file *filp) { - struct video_device *vdev = video_devdata(filp); int minor = iminor(inode); - struct em2820 *dev = (struct em2820 *)video_get_drvdata(vdev); int errCode = 0; + struct em2820 *h,*dev = NULL; + struct list_head *list; + + list_for_each(list,&em2820_devlist) { + h = list_entry(list, struct em2820, devlist); + if (h->vdev->minor == minor) { + dev = h; + } + } + + filp->private_data=dev; + em2820_videodbg("users=%d", dev->users); @@ -333,7 +345,7 @@ static void em2820_release_resources(struct em2820 *dev) em2820_info("V4L2 device /dev/video%d deregistered\n", dev->vdev->minor); - video_set_drvdata(dev->vdev, NULL); + list_del(&dev->devlist); video_unregister_device(dev->vdev); /* video_unregister_device(dev->vbi_dev); */ em2820_i2c_unregister(dev); @@ -347,9 +359,18 @@ static void em2820_release_resources(struct em2820 *dev) */ static int em2820_v4l2_close(struct inode *inode, struct file *file) { - struct video_device *vdev = video_devdata(file); - struct em2820 *dev = (struct em2820 *)video_get_drvdata(vdev); int errCode; + int minor = iminor(inode); + struct em2820 *h,*dev = NULL; + struct list_head *list; + + list_for_each(list,&em2820_devlist) { + h = list_entry(list, struct em2820, devlist); + if (h->vdev->minor == minor) { + dev = h; + } + } + em2820_videodbg("users=%d", dev->users); @@ -390,10 +411,10 @@ static ssize_t em2820_v4l2_read(struct file *filp, char __user * buf, size_t count, loff_t * f_pos) { - struct em2820 *dev = video_get_drvdata(video_devdata(filp)); struct em2820_frame_t *f, *i; unsigned long lock_flags; int ret = 0; + struct em2820 *dev = filp->private_data; if (down_interruptible(&dev->fileop_lock)) return -ERESTARTSYS; @@ -482,8 +503,8 @@ em2820_v4l2_read(struct file *filp, char __user * buf, size_t count, */ static unsigned int em2820_v4l2_poll(struct file *filp, poll_table * wait) { - struct em2820 *dev = video_get_drvdata(video_devdata(filp)); unsigned int mask = 0; + struct em2820 *dev = filp->private_data; if (down_interruptible(&dev->fileop_lock)) return POLLERR; @@ -550,10 +571,12 @@ static struct vm_operations_struct em2820_vm_ops = { */ static int em2820_v4l2_mmap(struct file *filp, struct vm_area_struct *vma) { - struct em2820 *dev = video_get_drvdata(video_devdata(filp)); unsigned long size = vma->vm_end - vma->vm_start, start = vma->vm_start, pos, page; u32 i; + + struct em2820 *dev = filp->private_data; + if (down_interruptible(&dev->fileop_lock)) return -ERESTARTSYS; @@ -1491,8 +1514,8 @@ static int em2820_video_do_ioctl(struct inode *inode, struct file *filp, static int em2820_v4l2_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { - struct em2820 *dev = video_get_drvdata(video_devdata(filp)); int ret = 0; + struct em2820 *dev = filp->private_data; if (down_interruptible(&dev->fileop_lock)) return -ERESTARTSYS; @@ -1669,7 +1692,7 @@ static int em2820_init_dev(struct em2820 **devhandle, struct usb_device *udev, dev->vdev->release = video_device_release; snprintf(dev->vdev->name, sizeof(dev->vdev->name), "%s", "em2820 video"); - video_set_drvdata(dev->vdev, dev); + list_add_tail(&dev->devlist,&em2820_devlist); /* register v4l2 device */ down(&dev->lock); @@ -1677,7 +1700,7 @@ static int em2820_init_dev(struct em2820 **devhandle, struct usb_device *udev, em2820_errdev("unable to register video device (error=%i).\n", retval); up(&dev->lock); - video_set_drvdata(dev->vdev, NULL); + list_del(&dev->devlist); video_device_release(dev->vdev); kfree(dev); return -ENODEV; diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h index c48354062eb6..5ff308261a7e 100644 --- a/drivers/media/video/em28xx/em28xx.h +++ b/drivers/media/video/em28xx/em28xx.h @@ -211,6 +211,7 @@ struct em2820 { int model; /* index in the device_data struct */ unsigned int is_em2800; int video_inputs; /* number of video inputs */ + struct list_head devlist; unsigned int has_tuner:1; unsigned int has_msp34xx:1; unsigned int has_tda9887:1; -- cgit v1.2.2 From 86bb4a215d152111f20daeb2a530f064afee8542 Mon Sep 17 00:00:00 2001 From: Markus Rechberger Date: Tue, 8 Nov 2005 21:37:53 -0800 Subject: [PATCH] v4l: 814: cleanup dev assignment - Cleanup dev assignment Signed-off-by: Markus Rechberger Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/em28xx/em28xx-video.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index daa4387a2296..16a6d2da7391 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c @@ -357,20 +357,10 @@ static void em2820_release_resources(struct em2820 *dev) * em2820_v4l2_close() * stops streaming and deallocates all resources allocated by the v4l2 calls and ioctls */ -static int em2820_v4l2_close(struct inode *inode, struct file *file) +static int em2820_v4l2_close(struct inode *inode, struct file *filp) { int errCode; - int minor = iminor(inode); - struct em2820 *h,*dev = NULL; - struct list_head *list; - - list_for_each(list,&em2820_devlist) { - h = list_entry(list, struct em2820, devlist); - if (h->vdev->minor == minor) { - dev = h; - } - } - + struct em2820 *dev=filp->private_data; em2820_videodbg("users=%d", dev->users); -- cgit v1.2.2 From 1a9ca74d22065355d61bb6395590378040e7366d Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:37:54 -0800 Subject: [PATCH] v4l: 815: commented obsoleted stuff at videodev headers - Commented obsoleted stuff at videodev headers. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/em28xx/em28xx-video.c | 1 - include/linux/videodev.h | 10 ---------- include/linux/videodev2.h | 7 ------- 3 files changed, 18 deletions(-) diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 16a6d2da7391..06644e230b47 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c @@ -1671,7 +1671,6 @@ static int em2820_init_dev(struct em2820 **devhandle, struct usb_device *udev, return -ENOMEM; } - dev->vdev->owner = THIS_MODULE; dev->vdev->type = VID_TYPE_CAPTURE; if (dev->has_tuner) dev->vdev->type |= VID_TYPE_TUNER; diff --git a/include/linux/videodev.h b/include/linux/videodev.h index 23276cede540..392592a040c5 100644 --- a/include/linux/videodev.h +++ b/include/linux/videodev.h @@ -27,16 +27,6 @@ video_device_remove_file(struct video_device *vfd, class_device_remove_file(&vfd->class_dev, attr); } -/* helper functions to access driver private data. */ -static inline void *video_get_drvdata(struct video_device *dev) -{ - return dev->priv; -} - -static inline void video_set_drvdata(struct video_device *dev, void *data) -{ - dev->priv = data; -} extern int video_exclusive_open(struct inode *inode, struct file *file); extern int video_exclusive_release(struct inode *inode, struct file *file); diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index df0f9a24944a..65829a510aca 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -50,13 +50,6 @@ struct video_device void (*release)(struct video_device *vfd); - /* obsolete -- fops->owner is used instead */ - struct module *owner; - /* dev->driver_data will be used instead some day. - * Use the video_{get|set}_drvdata() helper functions, - * so the switch over will be transparent for you. - * Or use {pci|usb}_{get|set}_drvdata() directly. */ - void *priv; /* for videodev.c intenal usage -- please don't touch */ int users; /* video_exclusive_{open|close} ... */ -- cgit v1.2.2 From f4067fd46aa330d6df0a79b9dd0eb9555809c440 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Tue, 8 Nov 2005 21:37:55 -0800 Subject: [PATCH] v4l: 816: added driver for cirrus logic low voltage stereo a-d converter - Added driver for Cirrus Logic Low Voltage Stereo A/D Converter. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/cs53l32a.c | 234 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 234 insertions(+) create mode 100644 drivers/media/video/cs53l32a.c diff --git a/drivers/media/video/cs53l32a.c b/drivers/media/video/cs53l32a.c new file mode 100644 index 000000000000..7434e5e66d59 --- /dev/null +++ b/drivers/media/video/cs53l32a.c @@ -0,0 +1,234 @@ +/* + * cs53l32a (Adaptec AVC-2010 and AVC-2410) i2c ivtv driver. + * Copyright (C) 2005 Martin Vaughan + * + * Audio source switching for Adaptec AVC-2410 added by Trev Jackson + * + * 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 +#include +#include +#include +#include +#include +#include +#include + +MODULE_DESCRIPTION("i2c device driver for cs53l32a Audio ADC"); +MODULE_AUTHOR("Martin Vaughan"); +MODULE_LICENSE("GPL"); + +static int debug = 0; + +module_param(debug, bool, 0644); + +MODULE_PARM_DESC(debug, "Debugging messages\n\t\t\t0=Off (default), 1=On"); + +#define cs53l32a_dbg(fmt, arg...) \ + do { \ + if (debug) \ + printk(KERN_INFO "%s debug %d-%04x: " fmt, client->driver->name, \ + i2c_adapter_id(client->adapter), client->addr , ## arg); \ + } while (0) + +#define cs53l32a_err(fmt, arg...) do { \ + printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->name, \ + i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) +#define cs53l32a_info(fmt, arg...) do { \ + printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->name, \ + i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) + +static unsigned short normal_i2c[] = { 0x22 >> 1, I2C_CLIENT_END }; + + +I2C_CLIENT_INSMOD; + +/* ----------------------------------------------------------------------- */ + +static int cs53l32a_write(struct i2c_client *client, u8 reg, u8 value) +{ + return i2c_smbus_write_byte_data(client, reg, value); +} + +static int cs53l32a_read(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_byte_data(client, reg); +} + +static int cs53l32a_command(struct i2c_client *client, unsigned int cmd, + void *arg) +{ + int *input = arg; + + switch (cmd) { + case AUDC_SET_INPUT: + switch (*input) { + case AUDIO_TUNER: + cs53l32a_write(client, 0x01, 0x01); + break; + case AUDIO_EXTERN: + cs53l32a_write(client, 0x01, 0x21); + break; + case AUDIO_MUTE: + cs53l32a_write(client, 0x03, 0xF0); + break; + case AUDIO_UNMUTE: + cs53l32a_write(client, 0x03, 0x30); + break; + default: + cs53l32a_err("Invalid input %d.\n", *input); + return -EINVAL; + } + break; + + case VIDIOC_S_CTRL: + { + struct v4l2_control *ctrl = arg; + + if (ctrl->id != V4L2_CID_AUDIO_VOLUME) + return -EINVAL; + if (ctrl->value > 12 || ctrl->value < -90) + return -EINVAL; + cs53l32a_write(client, 0x04, (u8) ctrl->value); + cs53l32a_write(client, 0x05, (u8) ctrl->value); + break; + } + + case VIDIOC_LOG_STATUS: + { + u8 v = cs53l32a_read(client, 0x01); + u8 m = cs53l32a_read(client, 0x03); + + cs53l32a_info("Input: %s%s\n", + v == 0x21 ? "external line in" : "tuner", + (m & 0xC0) ? " (muted)" : ""); + break; + } + + default: + return -EINVAL; + } + return 0; +} + +/* ----------------------------------------------------------------------- */ + +/* i2c implementation */ + +/* + * Generic i2c probe + * concerning the addresses: i2c wants 7 bit (without the r/w bit), so '>>1' + */ + +static struct i2c_driver i2c_driver; + +static int cs53l32a_attach(struct i2c_adapter *adapter, int address, int kind) +{ + struct i2c_client *client; + int i; + + /* Check if the adapter supports the needed features */ + if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) + return 0; + + client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); + if (client == 0) + return -ENOMEM; + + memset(client, 0, sizeof(struct i2c_client)); + client->addr = address; + client->adapter = adapter; + client->driver = &i2c_driver; + client->flags = I2C_CLIENT_ALLOW_USE; + snprintf(client->name, sizeof(client->name) - 1, "cs53l32a"); + + cs53l32a_info("chip found @ 0x%x (%s)\n", address << 1, adapter->name); + + for (i = 1; i <= 7; i++) { + u8 v = cs53l32a_read(client, i); + + cs53l32a_dbg("Read Reg %d %02x\n", i, v); + } + + /* Set cs53l32a internal register for Adaptec 2010/2410 setup */ + + cs53l32a_write(client, 0x01, (u8) 0x21); + cs53l32a_write(client, 0x02, (u8) 0x29); + cs53l32a_write(client, 0x03, (u8) 0x30); + cs53l32a_write(client, 0x04, (u8) 0x00); + cs53l32a_write(client, 0x05, (u8) 0x00); + cs53l32a_write(client, 0x06, (u8) 0x00); + cs53l32a_write(client, 0x07, (u8) 0x00); + + /* Display results, should be 0x21,0x29,0x30,0x00,0x00,0x00,0x00 */ + + for (i = 1; i <= 7; i++) { + u8 v = cs53l32a_read(client, i); + + cs53l32a_dbg("Read Reg %d %02x\n", i, v); + } + + i2c_attach_client(client); + + return 0; +} + +static int cs53l32a_probe(struct i2c_adapter *adapter) +{ + return i2c_probe(adapter, &addr_data, cs53l32a_attach); +} + +static int cs53l32a_detach(struct i2c_client *client) +{ + int err; + + err = i2c_detach_client(client); + if (err) { + return err; + } + kfree(client); + + return 0; +} + +/* ----------------------------------------------------------------------- */ + +/* i2c implementation */ +static struct i2c_driver i2c_driver = { + .name = "cs53l32a", + .id = I2C_DRIVERID_CS53L32A, + .flags = I2C_DF_NOTIFY, + .attach_adapter = cs53l32a_probe, + .detach_client = cs53l32a_detach, + .command = cs53l32a_command, + .owner = THIS_MODULE, +}; + + +static int __init cs53l32a_init_module(void) +{ + return i2c_add_driver(&i2c_driver); +} + +static void __exit cs53l32a_cleanup_module(void) +{ + i2c_del_driver(&i2c_driver); +} + +module_init(cs53l32a_init_module); +module_exit(cs53l32a_cleanup_module); -- cgit v1.2.2 From ac9cd97640a8bcad75dc7305761365c3e339bbc5 Mon Sep 17 00:00:00 2001 From: Ricardo Cerqueira Date: Tue, 8 Nov 2005 21:37:56 -0800 Subject: [PATCH] v4l: 817: saa713x keymaps and key builders were moved from ir kbd i2c c - SAA713x keymaps and key builders were moved from ir-kbd-i2c.c Signed-off-by: Ricardo Cerqueira Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/em28xx/em28xx-input.c | 4 +- drivers/media/video/ir-kbd-i2c.c | 202 +++------------------------- drivers/media/video/saa7134/saa7134-i2c.c | 14 ++ drivers/media/video/saa7134/saa7134-input.c | 202 +++++++++++++++++++++++++++- drivers/media/video/saa7134/saa7134.h | 5 + 5 files changed, 238 insertions(+), 189 deletions(-) diff --git a/drivers/media/video/em28xx/em28xx-input.c b/drivers/media/video/em28xx/em28xx-input.c index 8681a793a0bf..e13585898f58 100644 --- a/drivers/media/video/em28xx/em28xx-input.c +++ b/drivers/media/video/em28xx/em28xx-input.c @@ -141,8 +141,10 @@ static int get_key_em_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) /* ----------------------------------------------------------------------- */ void em2820_set_ir(struct em2820 * dev,struct IR_i2c *ir) { - if (disable_ir) + if (disable_ir) { + ir->get_key=NULL; return ; + } /* detect & configure */ switch (dev->model) { diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index 0cd1fc89b2d0..bdb3ba551360 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c @@ -82,104 +82,6 @@ static IR_KEYTAB_TYPE ir_codes_pv951[IR_KEYTAB_SIZE] = { [ 28 ] = KEY_MEDIA, /* PC/TV */ }; -static IR_KEYTAB_TYPE ir_codes_purpletv[IR_KEYTAB_SIZE] = { - [ 0x3 ] = KEY_POWER, - [ 0x6f ] = KEY_MUTE, - [ 0x10 ] = KEY_BACKSPACE, /* Recall */ - - [ 0x11 ] = KEY_KP0, - [ 0x4 ] = KEY_KP1, - [ 0x5 ] = KEY_KP2, - [ 0x6 ] = KEY_KP3, - [ 0x8 ] = KEY_KP4, - [ 0x9 ] = KEY_KP5, - [ 0xa ] = KEY_KP6, - [ 0xc ] = KEY_KP7, - [ 0xd ] = KEY_KP8, - [ 0xe ] = KEY_KP9, - [ 0x12 ] = KEY_KPDOT, /* 100+ */ - - [ 0x7 ] = KEY_VOLUMEUP, - [ 0xb ] = KEY_VOLUMEDOWN, - [ 0x1a ] = KEY_KPPLUS, - [ 0x18 ] = KEY_KPMINUS, - [ 0x15 ] = KEY_UP, - [ 0x1d ] = KEY_DOWN, - [ 0xf ] = KEY_CHANNELUP, - [ 0x13 ] = KEY_CHANNELDOWN, - [ 0x48 ] = KEY_ZOOM, - - [ 0x1b ] = KEY_VIDEO, /* Video source */ - [ 0x49 ] = KEY_LANGUAGE, /* MTS Select */ - [ 0x19 ] = KEY_SEARCH, /* Auto Scan */ - - [ 0x4b ] = KEY_RECORD, - [ 0x46 ] = KEY_PLAY, - [ 0x45 ] = KEY_PAUSE, /* Pause */ - [ 0x44 ] = KEY_STOP, - [ 0x40 ] = KEY_FORWARD, /* Forward ? */ - [ 0x42 ] = KEY_REWIND, /* Backward ? */ - -}; - -static IR_KEYTAB_TYPE ir_codes_pinnacle[IR_KEYTAB_SIZE] = { - [ 0x59 ] = KEY_MUTE, - [ 0x4a ] = KEY_POWER, - - [ 0x18 ] = KEY_TEXT, - [ 0x26 ] = KEY_TV, - [ 0x3d ] = KEY_PRINT, - - [ 0x48 ] = KEY_RED, - [ 0x04 ] = KEY_GREEN, - [ 0x11 ] = KEY_YELLOW, - [ 0x00 ] = KEY_BLUE, - - [ 0x2d ] = KEY_VOLUMEUP, - [ 0x1e ] = KEY_VOLUMEDOWN, - - [ 0x49 ] = KEY_MENU, - - [ 0x16 ] = KEY_CHANNELUP, - [ 0x17 ] = KEY_CHANNELDOWN, - - [ 0x20 ] = KEY_UP, - [ 0x21 ] = KEY_DOWN, - [ 0x22 ] = KEY_LEFT, - [ 0x23 ] = KEY_RIGHT, - [ 0x0d ] = KEY_SELECT, - - - - [ 0x08 ] = KEY_BACK, - [ 0x07 ] = KEY_REFRESH, - - [ 0x2f ] = KEY_ZOOM, - [ 0x29 ] = KEY_RECORD, - - [ 0x4b ] = KEY_PAUSE, - [ 0x4d ] = KEY_REWIND, - [ 0x2e ] = KEY_PLAY, - [ 0x4e ] = KEY_FORWARD, - [ 0x53 ] = KEY_PREVIOUS, - [ 0x4c ] = KEY_STOP, - [ 0x54 ] = KEY_NEXT, - - [ 0x69 ] = KEY_KP0, - [ 0x6a ] = KEY_KP1, - [ 0x6b ] = KEY_KP2, - [ 0x6c ] = KEY_KP3, - [ 0x6d ] = KEY_KP4, - [ 0x6e ] = KEY_KP5, - [ 0x6f ] = KEY_KP6, - [ 0x70 ] = KEY_KP7, - [ 0x71 ] = KEY_KP8, - [ 0x72 ] = KEY_KP9, - - [ 0x74 ] = KEY_CHANNEL, - [ 0x0a ] = KEY_BACKSPACE, -}; - /* ----------------------------------------------------------------------- */ /* insmod parameters */ @@ -281,80 +183,6 @@ static int get_key_knc1(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) return 1; } -static int get_key_purpletv(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) -{ - unsigned char b; - - /* poll IR chip */ - if (1 != i2c_master_recv(&ir->c,&b,1)) { - dprintk(1,"read error\n"); - return -EIO; - } - - /* no button press */ - if (b==0) - return 0; - - /* repeating */ - if (b & 0x80) - return 1; - - *ir_key = b; - *ir_raw = b; - return 1; -} - -/* The new pinnacle PCTV remote (with the colored buttons) - * - * Ricardo Cerqueira - */ - -static int get_key_pinnacle(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) -{ - unsigned char b[4]; - unsigned int start = 0,parity = 0,code = 0; - - /* poll IR chip */ - if (4 != i2c_master_recv(&ir->c,b,4)) { - dprintk(1,"read error\n"); - return -EIO; - } - - for (start = 0; start<4; start++) { - if (b[start] == 0x80) { - code=b[(start+3)%4]; - parity=b[(start+2)%4]; - } - } - - /* Empty Request */ - if (parity==0) - return 0; - - /* Repeating... */ - if (ir->old == parity) - return 0; - - - ir->old = parity; - - /* Reduce code value to fit inside IR_KEYTAB_SIZE - * - * this is the only value that results in 42 unique - * codes < 128 - */ - - code %= 0x88; - - *ir_raw = code; - *ir_key = code; - - dprintk(1,"Pinnacle PCTV key %02x\n", code); - - return 1; -} - - /* ----------------------------------------------------------------------- */ static void ir_key_poll(struct IR_i2c *ir) @@ -460,19 +288,12 @@ static int ir_attach(struct i2c_adapter *adap, int addr, ir_type = IR_TYPE_OTHER; ir_codes = ir_codes_empty; break; - case 0x47: - name = "Pinnacle PCTV"; - ir->get_key = get_key_pinnacle; - ir_type = IR_TYPE_OTHER; - ir_codes = ir_codes_pinnacle; - break; case 0x7a: - name = "Purple TV"; - ir->get_key = get_key_purpletv; + case 0x47: + /* Handled by saa7134-input */ + name = "SAA713x remote"; ir_type = IR_TYPE_OTHER; - ir_codes = ir_codes_purpletv; break; - default: /* shouldn't happen */ printk(DEVNAME ": Huh? unknown i2c address (0x%02x)?\n",addr); @@ -480,11 +301,8 @@ static int ir_attach(struct i2c_adapter *adap, int addr, return -1; } - /* Sets name and its physical addr */ + /* Sets name */ snprintf(ir->c.name, sizeof(ir->c.name), "i2c IR (%s)", name); - snprintf(ir->phys, sizeof(ir->phys), "%s/%s/ir0", - ir->c.adapter->dev.bus_id, - ir->c.dev.bus_id); ir->ir_codes=ir_codes; /* register i2c device @@ -493,6 +311,18 @@ static int ir_attach(struct i2c_adapter *adap, int addr, */ i2c_attach_client(&ir->c); + /* If IR not supported or disabled, unregisters driver */ + if (ir->get_key == NULL) { + i2c_detach_client(&ir->c); + kfree(ir); + return -1; + } + + /* Phys addr can only be set after attaching (for ir->c.dev.bus_id) */ + snprintf(ir->phys, sizeof(ir->phys), "%s/%s/ir0", + ir->c.adapter->dev.bus_id, + ir->c.dev.bus_id); + /* init + register input device */ ir_input_init(input_dev, &ir->ir, ir_type, ir_codes); input_dev->id.bustype = BUS_I2C; diff --git a/drivers/media/video/saa7134/saa7134-i2c.c b/drivers/media/video/saa7134/saa7134-i2c.c index 2577d03485b8..7575043f0874 100644 --- a/drivers/media/video/saa7134/saa7134-i2c.c +++ b/drivers/media/video/saa7134/saa7134-i2c.c @@ -335,6 +335,20 @@ static int attach_inform(struct i2c_client *client) d1printk( "%s i2c attach [addr=0x%x,client=%s]\n", client->driver->name, client->addr, client->name); + /* Am I an i2c remote control? */ + + switch (client->addr) { + case 0x7a: + case 0x47: + { + struct IR_i2c *ir = i2c_get_clientdata(client); + d1printk("%s i2c IR detected (%s).\n", + client->driver->name,ir->phys); + saa7134_set_i2c_ir(dev,ir); + break; + } + } + if (!client->driver->command) return 0; diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index f99dbb729555..6413a6e09873 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -39,6 +39,8 @@ MODULE_PARM_DESC(ir_debug,"enable debug messages [IR]"); #define dprintk(fmt, arg...) if (ir_debug) \ printk(KERN_DEBUG "%s/ir: " fmt, dev->name , ## arg) +#define i2cdprintk(fmt, arg...) if (ir_debug) \ + printk(KERN_DEBUG "%s/ir: " fmt, ir->c.name , ## arg) /* ---------------------------------------------------------------------- */ @@ -443,7 +445,105 @@ static IR_KEYTAB_TYPE gotview7135_codes[IR_KEYTAB_SIZE] = { [ 112] = KEY_F24, /* NORMAL TIMESHIFT */ }; -/* ---------------------------------------------------------------------- */ +static IR_KEYTAB_TYPE ir_codes_purpletv[IR_KEYTAB_SIZE] = { + [ 0x3 ] = KEY_POWER, + [ 0x6f ] = KEY_MUTE, + [ 0x10 ] = KEY_BACKSPACE, /* Recall */ + + [ 0x11 ] = KEY_KP0, + [ 0x4 ] = KEY_KP1, + [ 0x5 ] = KEY_KP2, + [ 0x6 ] = KEY_KP3, + [ 0x8 ] = KEY_KP4, + [ 0x9 ] = KEY_KP5, + [ 0xa ] = KEY_KP6, + [ 0xc ] = KEY_KP7, + [ 0xd ] = KEY_KP8, + [ 0xe ] = KEY_KP9, + [ 0x12 ] = KEY_KPDOT, /* 100+ */ + + [ 0x7 ] = KEY_VOLUMEUP, + [ 0xb ] = KEY_VOLUMEDOWN, + [ 0x1a ] = KEY_KPPLUS, + [ 0x18 ] = KEY_KPMINUS, + [ 0x15 ] = KEY_UP, + [ 0x1d ] = KEY_DOWN, + [ 0xf ] = KEY_CHANNELUP, + [ 0x13 ] = KEY_CHANNELDOWN, + [ 0x48 ] = KEY_ZOOM, + + [ 0x1b ] = KEY_VIDEO, /* Video source */ + [ 0x49 ] = KEY_LANGUAGE, /* MTS Select */ + [ 0x19 ] = KEY_SEARCH, /* Auto Scan */ + + [ 0x4b ] = KEY_RECORD, + [ 0x46 ] = KEY_PLAY, + [ 0x45 ] = KEY_PAUSE, /* Pause */ + [ 0x44 ] = KEY_STOP, + [ 0x40 ] = KEY_FORWARD, /* Forward ? */ + [ 0x42 ] = KEY_REWIND, /* Backward ? */ + +}; + +static IR_KEYTAB_TYPE ir_codes_pinnacle[IR_KEYTAB_SIZE] = { + [ 0x59 ] = KEY_MUTE, + [ 0x4a ] = KEY_POWER, + + [ 0x18 ] = KEY_TEXT, + [ 0x26 ] = KEY_TV, + [ 0x3d ] = KEY_PRINT, + + [ 0x48 ] = KEY_RED, + [ 0x04 ] = KEY_GREEN, + [ 0x11 ] = KEY_YELLOW, + [ 0x00 ] = KEY_BLUE, + + [ 0x2d ] = KEY_VOLUMEUP, + [ 0x1e ] = KEY_VOLUMEDOWN, + + [ 0x49 ] = KEY_MENU, + + [ 0x16 ] = KEY_CHANNELUP, + [ 0x17 ] = KEY_CHANNELDOWN, + + [ 0x20 ] = KEY_UP, + [ 0x21 ] = KEY_DOWN, + [ 0x22 ] = KEY_LEFT, + [ 0x23 ] = KEY_RIGHT, + [ 0x0d ] = KEY_SELECT, + + + + [ 0x08 ] = KEY_BACK, + [ 0x07 ] = KEY_REFRESH, + + [ 0x2f ] = KEY_ZOOM, + [ 0x29 ] = KEY_RECORD, + + [ 0x4b ] = KEY_PAUSE, + [ 0x4d ] = KEY_REWIND, + [ 0x2e ] = KEY_PLAY, + [ 0x4e ] = KEY_FORWARD, + [ 0x53 ] = KEY_PREVIOUS, + [ 0x4c ] = KEY_STOP, + [ 0x54 ] = KEY_NEXT, + + [ 0x69 ] = KEY_KP0, + [ 0x6a ] = KEY_KP1, + [ 0x6b ] = KEY_KP2, + [ 0x6c ] = KEY_KP3, + [ 0x6d ] = KEY_KP4, + [ 0x6e ] = KEY_KP5, + [ 0x6f ] = KEY_KP6, + [ 0x70 ] = KEY_KP7, + [ 0x71 ] = KEY_KP8, + [ 0x72 ] = KEY_KP9, + + [ 0x74 ] = KEY_CHANNEL, + [ 0x0a ] = KEY_BACKSPACE, +}; + +/* -------------------- GPIO generic keycode builder -------------------- */ static int build_key(struct saa7134_dev *dev) { @@ -474,7 +574,81 @@ static int build_key(struct saa7134_dev *dev) return 0; } -/* ---------------------------------------------------------------------- */ +/* --------------------- Chip specific I2C key builders ----------------- */ + +static int get_key_purpletv(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) +{ + unsigned char b; + + /* poll IR chip */ + if (1 != i2c_master_recv(&ir->c,&b,1)) { + i2cdprintk("read error\n"); + return -EIO; + } + + /* no button press */ + if (b==0) + return 0; + + /* repeating */ + if (b & 0x80) + return 1; + + *ir_key = b; + *ir_raw = b; + return 1; +} + +/* The new pinnacle PCTV remote (with the colored buttons) + * + * Ricardo Cerqueira + */ + +static int get_key_pinnacle(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) +{ + unsigned char b[4]; + unsigned int start = 0,parity = 0,code = 0; + + /* poll IR chip */ + if (4 != i2c_master_recv(&ir->c,b,4)) { + i2cdprintk("read error\n"); + return -EIO; + } + + for (start = 0; start<4; start++) { + if (b[start] == 0x80) { + code=b[(start+3)%4]; + parity=b[(start+2)%4]; + } + } + + /* Empty Request */ + if (parity==0) + return 0; + + /* Repeating... */ + if (ir->old == parity) + return 0; + + + ir->old = parity; + + /* Reduce code value to fit inside IR_KEYTAB_SIZE + * + * this is the only value that results in 42 unique + * codes < 128 + */ + + code %= 0x88; + + *ir_raw = code; + *ir_key = code; + + i2cdprintk("Pinnacle PCTV key %02x\n", code); + + return 1; +} + void saa7134_input_irq(struct saa7134_dev *dev) { @@ -658,6 +832,30 @@ void saa7134_input_fini(struct saa7134_dev *dev) dev->remote = NULL; } +void saa7134_set_i2c_ir(struct saa7134_dev *dev, struct IR_i2c *ir) +{ + if (disable_ir) { + ir->get_key=NULL; + return; + } + + switch (dev->board) { + case SAA7134_BOARD_PINNACLE_PCTV_110i: + snprintf(ir->c.name, sizeof(ir->c.name), "Pinnacle PCTV"); + ir->get_key = get_key_pinnacle; + ir->ir_codes = ir_codes_pinnacle; + break; + case SAA7134_BOARD_UPMOST_PURPLE_TV: + snprintf(ir->c.name, sizeof(ir->c.name), "Purple TV"); + ir->get_key = get_key_purpletv; + ir->ir_codes = ir_codes_purpletv; + break; + default: + dprintk("Shouldn't get here: Unknown board %x for I2C IR?\n",dev->board); + break; + } + +} /* ---------------------------------------------------------------------- * Local variables: * c-basic-offset: 8 diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index d497fea5425f..99d000be095e 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -653,6 +654,10 @@ void saa7134_irq_oss_done(struct saa7134_dev *dev, unsigned long status); int saa7134_input_init1(struct saa7134_dev *dev); void saa7134_input_fini(struct saa7134_dev *dev); void saa7134_input_irq(struct saa7134_dev *dev); +void saa7134_set_i2c_ir(struct saa7134_dev *dev, struct IR_i2c *ir); + +/* ----------------------------------------------------------- */ +/* saa7134-alsa.c */ int alsa_card_saa7134_create(struct saa7134_dev *saadev, unsigned int devnum); void alsa_card_saa7134_exit(void); -- cgit v1.2.2 From e8b23c0238887e1987d82ec0014a7a1fe010e724 Mon Sep 17 00:00:00 2001 From: Ricardo Cerqueira Date: Tue, 8 Nov 2005 21:37:56 -0800 Subject: [PATCH] v4l: 818: cleanup some unnecessary alsa memory (de/)allocations - Cleanup some unnecessary ALSA memory (de/)allocations Signed-off-by: Ricardo Cerqueira Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/saa7134/saa7134-alsa.c | 9 +++------ drivers/media/video/saa7134/saa7134-input.c | 4 ++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c index e7c3691fc500..fb6334a7ee86 100644 --- a/drivers/media/video/saa7134/saa7134-alsa.c +++ b/drivers/media/video/saa7134/saa7134-alsa.c @@ -512,7 +512,7 @@ static void snd_card_saa7134_runtime_free(snd_pcm_runtime_t *runtime) * * Called on initialization, right before the PCM preparation * Usually used in ALSA to allocate the DMA, but since we don't use the - * ALSA DMA I'm almost sure this isn't necessary. + * ALSA DMA it does nothing * */ @@ -520,7 +520,7 @@ static int snd_card_saa7134_hw_params(snd_pcm_substream_t * substream, snd_pcm_hw_params_t * hw_params) { - return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); + return 0; } @@ -538,7 +538,7 @@ static int snd_card_saa7134_hw_params(snd_pcm_substream_t * substream, static int snd_card_saa7134_hw_free(snd_pcm_substream_t * substream) { - return snd_pcm_lib_free_pages(substream); + return 0; } /* @@ -670,9 +670,6 @@ static int snd_card_saa7134_pcm(snd_card_saa7134_t *saa7134, int device) pcm->private_data = saa7134; pcm->info_flags = 0; strcpy(pcm->name, "SAA7134 PCM"); - snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, - snd_dma_pci_data(saa7134->pci), - 128*1024, 256*1024); return 0; } diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index 6413a6e09873..0c74c2f5edaa 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -617,8 +617,8 @@ static int get_key_pinnacle(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) for (start = 0; start<4; start++) { if (b[start] == 0x80) { - code=b[(start+3)%4]; - parity=b[(start+2)%4]; + code=b[(start+3)%4]; + parity=b[(start+2)%4]; } } -- cgit v1.2.2 From 13dd38d0814f36fce3a7ec9cb29a5ce6b0fc2522 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:37:57 -0800 Subject: [PATCH] v4l: 819: added autodetection code to tda8290 to avoid conflicts - Added autodetection code to tda8290, to avoid conflicts with tda9887. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/tda8290.c | 4 ++-- drivers/media/video/tuner-core.c | 13 ++++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/media/video/tda8290.c b/drivers/media/video/tda8290.c index fa9b4b898f68..abad3d5b04f6 100644 --- a/drivers/media/video/tda8290.c +++ b/drivers/media/video/tda8290.c @@ -534,8 +534,8 @@ int tda8290_init(struct i2c_client *c) } if (tuner_addrs == 0) { tuner_addrs = 0x61; - tuner_info ("could not clearly identify tuner address, defaulting to %x\n", - tuner_addrs); + tuner_info ("Could not clearly identify tda8290/8275 tuner address.\n"); + return -1; } else { tuner_addrs = tuner_addrs & 0xff; tuner_info ("setting tuner address to %x\n", tuner_addrs); diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index b9f1acf30caf..d4786b331467 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c @@ -364,7 +364,8 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind) } /* TEA5767 autodetection code - only for addr = 0xc0 */ if (!no_autodetect) { - if (addr == 0x60) { + switch (addr) { + case 0x60: if (tea5767_autodetection(&t->i2c) != EINVAL) { t->type = TUNER_TEA5767; t->mode_mask = T_RADIO; @@ -376,7 +377,17 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind) set_type(&t->i2c,t->type, t->mode_mask); return 0; } + case 0x42: + case 0x43: + case 0x4a: + case 0x44: + if (tda8290_init(&t->i2c)<0) { + kfree(t); + return 0; + } + } + } /* Initializes only the first adapter found */ -- cgit v1.2.2 From f59ab27b7a6fd760268f695078c739f3036b4edf Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:37:58 -0800 Subject: [PATCH] v4l: 820: fixed log for tveeprom on em28xx cards - Fixed log for tveeprom on em28xx cards. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/em28xx/em28xx-cards.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index f0860532575a..e6dd6eaa8d68 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c @@ -251,6 +251,7 @@ void em2820_card_setup(struct em2820 *dev) #endif /* Call first TVeeprom */ + dev->i2c_client.addr = 0xa0 >> 1; tveeprom_hauppauge_analog(&dev->i2c_client, &tv, dev->eedata); dev->tuner_type= tv.tuner_type; -- cgit v1.2.2 From 48c425965ecbd3472133adb857c2fe0608c053a0 Mon Sep 17 00:00:00 2001 From: Elad Lahav Date: Tue, 8 Nov 2005 21:37:59 -0800 Subject: [PATCH] v4l: 821: set tuner type in vidioc_g_tuner - Set tuner type in VIDIOC_G_TUNER. Signed-off-by: Elad Lahav Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/cx88/cx88-video.c | 1 + drivers/media/video/saa7134/saa7134-video.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index cedd1d79ac13..24a48f8a48c1 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c @@ -1506,6 +1506,7 @@ static int radio_do_ioctl(struct inode *inode, struct file *file, memset(t,0,sizeof(*t)); strcpy(t->name, "Radio"); + t->type = V4L2_TUNER_RADIO; cx88_call_i2c_clients(core,VIDIOC_G_TUNER,t); return 0; diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index 632ebe8724ec..45c852df13ed 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c @@ -1862,6 +1862,7 @@ static int video_do_ioctl(struct inode *inode, struct file *file, break; if (NULL != card_in(dev,n).name) { strcpy(t->name, "Television"); + t->type = V4L2_TUNER_ANALOG_TV; t->capability = V4L2_TUNER_CAP_NORM | V4L2_TUNER_CAP_STEREO | V4L2_TUNER_CAP_LANG1 | @@ -2165,6 +2166,7 @@ static int radio_do_ioctl(struct inode *inode, struct file *file, memset(t,0,sizeof(*t)); strcpy(t->name, "Radio"); + t->type = V4L2_TUNER_RADIO; saa7134_i2c_call_clients(dev, VIDIOC_G_TUNER, t); -- cgit v1.2.2 From 95736034df751631657140aebe677e67d7522867 Mon Sep 17 00:00:00 2001 From: Hartmut Hackmann Date: Tue, 8 Nov 2005 21:38:00 -0800 Subject: [PATCH] v4l: 823: corrected probing code for tda8290 - Corrected probing code for tda8290 Signed-off-by: Hartmut Hackmann Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/tda8290.c | 30 +++++++++++++++++++++++++++--- drivers/media/video/tuner-core.c | 4 ++-- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/drivers/media/video/tda8290.c b/drivers/media/video/tda8290.c index abad3d5b04f6..2aeae864edc7 100644 --- a/drivers/media/video/tda8290.c +++ b/drivers/media/video/tda8290.c @@ -135,7 +135,7 @@ static void tda827x_tune(struct i2c_client *c, u16 ifc, unsigned int freq) i2c_transfer(c->adapter, &msg, 1); reg2[0] = 0x60; - reg2[1] = 0x7f; + reg2[1] = 0x3f; i2c_transfer(c->adapter, &msg, 1); reg2[0] = 0x80; @@ -534,8 +534,8 @@ int tda8290_init(struct i2c_client *c) } if (tuner_addrs == 0) { tuner_addrs = 0x61; - tuner_info ("Could not clearly identify tda8290/8275 tuner address.\n"); - return -1; + tuner_info ("could not clearly identify tuner address, defaulting to %x\n", + tuner_addrs); } else { tuner_addrs = tuner_addrs & 0xff; tuner_info ("setting tuner address to %x\n", tuner_addrs); @@ -567,6 +567,30 @@ int tda8290_init(struct i2c_client *c) return 0; } +int tda8290_probe(struct i2c_client *c) +{ + unsigned char soft_reset[] = { 0x00, 0x00 }; + unsigned char easy_mode_b[] = { 0x01, 0x02 }; + unsigned char easy_mode_g[] = { 0x01, 0x04 }; + unsigned char addr_dto_lsb = 0x07; + unsigned char data; + + i2c_master_send(c, easy_mode_b, 2); + i2c_master_send(c, soft_reset, 2); + i2c_master_send(c, &addr_dto_lsb, 1); + i2c_master_recv(c, &data, 1); + if (data == 0) { + i2c_master_send(c, easy_mode_g, 2); + i2c_master_send(c, soft_reset, 2); + i2c_master_send(c, &addr_dto_lsb, 1); + i2c_master_recv(c, &data, 1); + if (data == 0x7b) { + return 0; + } + } + return -1; +} + /* * Overrides for Emacs so that we follow Linus's tabbing style. * --------------------------------------------------------------------------- diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index d4786b331467..ee83deb389d7 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c @@ -380,8 +380,8 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind) case 0x42: case 0x43: case 0x4a: - case 0x44: - if (tda8290_init(&t->i2c)<0) { + case 0x4b: + if (tda8290_probe(&t->i2c) != 0) { kfree(t); return 0; } -- cgit v1.2.2 From 01cb9633e1b294c604c2dfa01dcac95daf775213 Mon Sep 17 00:00:00 2001 From: "Nickolay V. Shmyrev" Date: Tue, 8 Nov 2005 21:38:00 -0800 Subject: [PATCH] v4l: 826: unify whitespaces - Unify whitespaces. Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/tda8290.c | 2 +- include/media/tuner.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/tda8290.c b/drivers/media/video/tda8290.c index 2aeae864edc7..0dde6af251dd 100644 --- a/drivers/media/video/tda8290.c +++ b/drivers/media/video/tda8290.c @@ -535,7 +535,7 @@ int tda8290_init(struct i2c_client *c) if (tuner_addrs == 0) { tuner_addrs = 0x61; tuner_info ("could not clearly identify tuner address, defaulting to %x\n", - tuner_addrs); + tuner_addrs); } else { tuner_addrs = tuner_addrs & 0xff; tuner_info ("setting tuner address to %x\n", tuner_addrs); diff --git a/include/media/tuner.h b/include/media/tuner.h index 8058be63ad0e..5196d9eac442 100644 --- a/include/media/tuner.h +++ b/include/media/tuner.h @@ -214,6 +214,7 @@ extern int tda8290_init(struct i2c_client *c); extern int tea5767_tuner_init(struct i2c_client *c); extern int default_tuner_init(struct i2c_client *c); extern int tea5767_autodetection(struct i2c_client *c); +extern int tda8290_probe(struct i2c_client *c); #define tuner_warn(fmt, arg...) do {\ printk(KERN_WARNING "%s %d-%04x: " fmt, t->i2c.driver->name, \ -- cgit v1.2.2 From f958b68d40b870f5a0d1582f094bc93a53af7cd7 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:38:01 -0800 Subject: [PATCH] v4l: 829: fixed user mode compiling - Fixed user mode compiling. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/videodev.h | 12 ++++++++++++ include/linux/videodev2.h | 18 ++++++++++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/include/linux/videodev.h b/include/linux/videodev.h index 392592a040c5..91140091ced2 100644 --- a/include/linux/videodev.h +++ b/include/linux/videodev.h @@ -27,6 +27,18 @@ video_device_remove_file(struct video_device *vfd, class_device_remove_file(&vfd->class_dev, attr); } +#if OBSOLETE_OWNER /* to be removed in 2.6.15 */ +/* helper functions to access driver private data. */ +static inline void *video_get_drvdata(struct video_device *dev) +{ + return dev->priv; +} + +static inline void video_set_drvdata(struct video_device *dev, void *data) +{ + dev->priv = data; +} +#endif extern int video_exclusive_open(struct inode *inode, struct file *file); extern int video_exclusive_release(struct inode *inode, struct file *file); diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 65829a510aca..cbe15edbe668 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -15,12 +15,13 @@ */ #ifdef __KERNEL__ #include /* need struct timeval */ +#include +#include #endif #include /* need __user */ -#include -#include +#define OBSOLETE_OWNER 1 /* It will be removed for 2.6.15 */ #define HAVE_V4L2 1 /* @@ -30,6 +31,8 @@ #define VIDEO_MAX_FRAME 32 +#ifdef __KERNEL__ + #define VFL_TYPE_GRABBER 0 #define VFL_TYPE_VBI 1 #define VFL_TYPE_RADIO 2 @@ -50,6 +53,15 @@ struct video_device void (*release)(struct video_device *vfd); +#if OBSOLETE_OWNER /* to be removed in 2.6.15 */ + /* obsolete -- fops->owner is used instead */ + struct module *owner; + /* dev->driver_data will be used instead some day. + * Use the video_{get|set}_drvdata() helper functions, + * so the switch over will be transparent for you. + * Or use {pci|usb}_{get|set}_drvdata() directly. */ + void *priv; +#endif /* for videodev.c intenal usage -- please don't touch */ int users; /* video_exclusive_{open|close} ... */ @@ -87,6 +99,8 @@ extern int video_usercopy(struct inode *inode, struct file *file, struct video_device *video_device_alloc(void); void video_device_release(struct video_device *vfd); +#endif + /* * M I S C E L L A N E O U S */ -- cgit v1.2.2 From 67678360c8b8b15b05d730eb8f1b02411891417f Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:38:02 -0800 Subject: [PATCH] v4l: 830: rearranged print order to present a correct answer - Rearranged print order to present a correct answer. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/tuner-core.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index ee83deb389d7..6fd59be19182 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c @@ -348,16 +348,13 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind) t->audmode = V4L2_TUNER_MODE_STEREO; t->mode_mask = T_UNINITIALIZED; - - tuner_info("chip found @ 0x%x (%s)\n", addr << 1, adap->name); - if (show_i2c) { unsigned char buffer[16]; int i,rc; memset(buffer, 0, sizeof(buffer)); rc = i2c_master_recv(&t->i2c, buffer, sizeof(buffer)); - printk("tuner-%04x I2C RECV = ",addr); + tuner_info("I2C RECV = "); for (i=0;ifreq = 87.5 * 16; /* Sets freq to FM range */ default_mode_mask &= ~T_RADIO; - i2c_attach_client (&t->i2c); - set_type(&t->i2c,t->type, t->mode_mask); - return 0; + goto register_client; } case 0x42: case 0x43: case 0x4a: case 0x4b: + /* If chip is not tda8290, don't register. + since it can be tda9887*/ if (tda8290_probe(&t->i2c) != 0) { kfree(t); return 0; @@ -399,6 +396,8 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind) } /* Should be just before return */ +register_client: + tuner_info("chip found @ 0x%x (%s)\n", addr << 1, adap->name); i2c_attach_client (&t->i2c); set_type (&t->i2c,t->type, t->mode_mask); return 0; -- cgit v1.2.2 From 28f0224170c4d8115383f56985575a42ed8b4dc1 Mon Sep 17 00:00:00 2001 From: Hermann Pitton Date: Tue, 8 Nov 2005 21:38:03 -0800 Subject: [PATCH] v4l: 833: analog support for asus p7131 dual tda8275a - Analog support for Asus P7131 Dual - TDA8275A Signed-off-by: Hermann Pitton Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/video4linux/CARDLIST.saa7134 | 1 + drivers/media/video/saa7134/saa7134-cards.c | 34 +++++++++++++++++++++++++++++ drivers/media/video/saa7134/saa7134.h | 1 + 3 files changed, 36 insertions(+) diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134 index 9b3ef0031ef6..d476f8e15bae 100644 --- a/Documentation/video4linux/CARDLIST.saa7134 +++ b/Documentation/video4linux/CARDLIST.saa7134 @@ -76,3 +76,4 @@ 75 -> AVerMedia AVerTVHD MCE A180 [1461:1044] 76 -> SKNet MonsterTV Mobile [1131:4ee9] 77 -> Pinnacle PCTV 110i (saa7133) [11bd:002e] + 78 -> ASUSTeK P7131 Dual [1043:4862] diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index 0147d8342f8d..155a66b3a2d2 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c @@ -2418,6 +2418,34 @@ struct saa7134_board saa7134_boards[] = { .amux = LINE1, }, }, + [SAA7134_BOARD_ASUSTeK_P7131_DUAL] = { + .name = "ASUSTeK P7131 Dual", + .audio_clock = 0x00187de7, + .tuner_type = TUNER_PHILIPS_TDA8290, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .gpiomask = 1 << 21, + .inputs = {{ + .name = name_tv, + .vmux = 1, + .amux = TV, + .tv = 1, + },{ + .name = name_comp1, + .vmux = 3, + .amux = LINE2, + },{ + .name = name_svideo, + .vmux = 8, + .amux = LINE2, + }}, + .radio = { + .name = name_radio, + .amux = TV, + .gpio = 0x0200000, + }, + }, }; const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards); @@ -2841,6 +2869,12 @@ struct pci_device_id saa7134_pci_tbl[] = { .subvendor = 0x11bd, .subdevice = 0x002e, .driver_data = SAA7134_BOARD_PINNACLE_PCTV_110i, + },{ + .vendor = PCI_VENDOR_ID_PHILIPS, + .device = PCI_DEVICE_ID_PHILIPS_SAA7133, + .subvendor = 0x1043, + .subdevice = 0x4862, + .driver_data = SAA7134_BOARD_ASUSTeK_P7131_DUAL, },{ /* --- boards without eeprom + subsystem ID --- */ .vendor = PCI_VENDOR_ID_PHILIPS, diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index 99d000be095e..ae89a3368ffe 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h @@ -205,6 +205,7 @@ struct saa7134_format { #define SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180 75 #define SAA7134_BOARD_MONSTERTV_MOBILE 76 #define SAA7134_BOARD_PINNACLE_PCTV_110i 77 +#define SAA7134_BOARD_ASUSTeK_P7131_DUAL 78 #define SAA7134_MAXBOARDS 8 #define SAA7134_INPUT_MAX 8 -- cgit v1.2.2 From fe2e36c8cdc81bea8edf7d0408a1f49da01e16ee Mon Sep 17 00:00:00 2001 From: Paul T Zalac Date: Tue, 8 Nov 2005 21:38:04 -0800 Subject: [PATCH] v4l: 834: add card pctv cardbus tv radio ito25 rev 2b - Add card: PCTV Cardbus TV/Radio (ITO25 Rev:2B) Signed-off-by: Paul T Zalac Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/video4linux/CARDLIST.saa7134 | 1 + drivers/media/video/saa7134/saa7134-cards.c | 16 ++++++++++++++++ drivers/media/video/saa7134/saa7134.h | 1 + 3 files changed, 18 insertions(+) diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134 index d476f8e15bae..d2688c71c657 100644 --- a/Documentation/video4linux/CARDLIST.saa7134 +++ b/Documentation/video4linux/CARDLIST.saa7134 @@ -77,3 +77,4 @@ 76 -> SKNet MonsterTV Mobile [1131:4ee9] 77 -> Pinnacle PCTV 110i (saa7133) [11bd:002e] 78 -> ASUSTeK P7131 Dual [1043:4862] + 79 -> PCTV Cardbus TV/Radio (ITO25 Rev:2B) diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index 155a66b3a2d2..d16d7c4cd851 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c @@ -2446,6 +2446,21 @@ struct saa7134_board saa7134_boards[] = { .gpio = 0x0200000, }, }, + [SAA7134_BOARD_PCTV_CARDBUS] = { + /* Paul Tom Zalac */ + /* tda8275a tuner doesnt work yet */ + .name = "PCTV Cardbus TV/Radio (ITO25 Rev:2B)", + .audio_clock = 0x00187de7, + .tuner_type = TUNER_ABSENT, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .inputs = {{ + .name = name_comp1, + .vmux = 1, + .amux = LINE2, + }}, + }, }; const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards); @@ -2973,6 +2988,7 @@ int saa7134_board_init1(struct saa7134_dev *dev) case SAA7134_BOARD_AVACSSMARTTV: case SAA7134_BOARD_GOTVIEW_7135: case SAA7134_BOARD_KWORLD_TERMINATOR: + case SAA7134_BOARD_PCTV_CARDBUS: dev->has_remote = 1; break; case SAA7134_BOARD_MD5044: diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index ae89a3368ffe..768370041067 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h @@ -206,6 +206,7 @@ struct saa7134_format { #define SAA7134_BOARD_MONSTERTV_MOBILE 76 #define SAA7134_BOARD_PINNACLE_PCTV_110i 77 #define SAA7134_BOARD_ASUSTeK_P7131_DUAL 78 +#define SAA7134_BOARD_PCTV_CARDBUS 79 #define SAA7134_MAXBOARDS 8 #define SAA7134_INPUT_MAX 8 -- cgit v1.2.2 From 08eca13dc407c389f04ce295144bb3fcd996a10d Mon Sep 17 00:00:00 2001 From: Markus Rechberger Date: Tue, 8 Nov 2005 21:38:05 -0800 Subject: [PATCH] v4l: 838: modified settings for msi vox usb 2.0 - Modified settings for MSI VOX USB 2.0 Signed-off-by: Markus Rechberger Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/video4linux/CARDLIST.em28xx | 4 ++-- drivers/media/video/em28xx/em28xx-cards.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Documentation/video4linux/CARDLIST.em28xx b/Documentation/video4linux/CARDLIST.em28xx index d86aae09450b..4fa58de4b860 100644 --- a/Documentation/video4linux/CARDLIST.em28xx +++ b/Documentation/video4linux/CARDLIST.em28xx @@ -1,9 +1,9 @@ 0 -> Unknown EM2800 video grabber (em2800) [eb1a:2800] - 1 -> Unknown EM2820/2840 video grabber (em2820/em2840) [eb1a:2820] + 1 -> Unknown EM2820/2840 video grabber (em2820/em2840) 2 -> Terratec Cinergy 250 USB (em2820/em2840) [0ccd:0036] 3 -> Pinnacle PCTV USB 2 (em2820/em2840) [2304:0208] 4 -> Hauppauge WinTV USB 2 (em2820/em2840) [2040:4200] - 5 -> MSI VOX USB 2.0 (em2820/em2840) + 5 -> MSI VOX USB 2.0 (em2820/em2840) [eb1a:2820] 6 -> Terratec Cinergy 200 USB (em2800) 7 -> Leadtek Winfast USB II (em2800) 8 -> Kworld USB2800 (em2800) diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index e6dd6eaa8d68..27db6d956c3f 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c @@ -140,7 +140,7 @@ struct em2820_board em2820_boards[] = { .name = "MSI VOX USB 2.0", .vchannels = 3, .norm = VIDEO_MODE_PAL, - .tuner_type = TUNER_PHILIPS_PAL, + .tuner_type = TUNER_LG_PAL_NEW_TAPC, .tda9887_conf = TDA9887_PRESENT|TDA9887_PORT1_ACTIVE|TDA9887_PORT2_ACTIVE, .has_tuner = 1, .decoder = EM2820_SAA7114, @@ -233,7 +233,7 @@ const unsigned int em2820_bcount = ARRAY_SIZE(em2820_boards); /* table of devices that work with this driver */ struct usb_device_id em2820_id_table [] = { { USB_DEVICE(0xeb1a, 0x2800), .driver_info = EM2800_BOARD_UNKNOWN }, - { USB_DEVICE(0xeb1a, 0x2820), .driver_info = EM2820_BOARD_UNKNOWN }, + { USB_DEVICE(0xeb1a, 0x2820), .driver_info = EM2820_BOARD_MSI_VOX_USB_2 }, { USB_DEVICE(0x0ccd, 0x0036), .driver_info = EM2820_BOARD_TERRATEC_CINERGY_250 }, { USB_DEVICE(0x2304, 0x0208), .driver_info = EM2820_BOARD_PINNACLE_USB_2 }, { USB_DEVICE(0x2040, 0x4200), .driver_info = EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 }, -- cgit v1.2.2 From 30556b23f31973ca311341277c4e4b128c0528bb Mon Sep 17 00:00:00 2001 From: Markus Rechberger Date: Tue, 8 Nov 2005 21:38:05 -0800 Subject: [PATCH] v4l: 840: fixed settings for msi vox usb 2.0 saa7114 is missing atm - Fixed settings for MSI Vox USB 2.0 (saa7114 is missing atm) Signed-off-by: Markus Rechberger Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/em28xx/em28xx-cards.c | 2 +- drivers/media/video/em28xx/em28xx-i2c.c | 3 +++ drivers/media/video/em28xx/em28xx.h | 14 ++++++++++++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index 27db6d956c3f..4ab30476807d 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c @@ -146,7 +146,7 @@ struct em2820_board em2820_boards[] = { .decoder = EM2820_SAA7114, .input = {{ .type = EM2820_VMUX_TELEVISION, - .vmux = 2, + .vmux = 4, .amux = 0, },{ .type = EM2820_VMUX_COMPOSITE1, diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c index bfe0d8795b6d..20728882e333 100644 --- a/drivers/media/video/em28xx/em28xx-i2c.c +++ b/drivers/media/video/em28xx/em28xx-i2c.c @@ -437,6 +437,9 @@ static int attach_inform(struct i2c_client *client) case 0x86: em2820_i2c_call_clients(dev, TDA9887_SET_CONFIG, &dev->tda9887_conf); break; + case 0x42: + dprintk1(1,"attach_inform: saa7114 detected.\n"); + break; case 0x4a: dprintk1(1,"attach_inform: saa7113 detected.\n"); break; diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h index 5ff308261a7e..15760d3d753d 100644 --- a/drivers/media/video/em28xx/em28xx.h +++ b/drivers/media/video/em28xx/em28xx.h @@ -493,10 +493,20 @@ inline static int em2820_gamma_set(struct em2820 *dev, s32 val) } /*FIXME: maxw should be dependent of alt mode */ -#define norm_maxw(dev) 720 +inline static unsigned int norm_maxw(struct em2820 *dev) +{ + switch(dev->model){ + case (EM2820_BOARD_MSI_VOX_USB_2): return(640); + default: return(720); + } +} + inline static unsigned int norm_maxh(struct em2820 *dev) { - return (dev->tvnorm->id & V4L2_STD_625_50) ? 576 : 480; + switch(dev->model){ + case (EM2820_BOARD_MSI_VOX_USB_2): return(480); + default: return (dev->tvnorm->id & V4L2_STD_625_50) ? 576 : 480; + } } #endif -- cgit v1.2.2 From a38a7d4ff8539817691a335149cac903be4250f8 Mon Sep 17 00:00:00 2001 From: Markus Rechberger Date: Tue, 8 Nov 2005 21:38:06 -0800 Subject: [PATCH] v4l: 841: added saa7114 initcode for msi vox usb 2.0 - Added saa7114 initcode for MSI Vox USB 2.0 Signed-off-by: Markus Rechberger Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/em28xx/em28xx-video.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 06644e230b47..9f79c39349fb 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c @@ -86,6 +86,23 @@ static struct em2820_tvnorm tvnorms[] = { } }; +static const unsigned char saa7114_i2c_init[] = { + 0x00,0x00,0x01,0x08,0x02,0xc4,0x03,0x30,0x04,0x90,0x05,0x90,0x06,0xeb,0x07,0xe0, + 0x08,0x88,0x09,0x40,0x0a,0x80,0x0b,0x44,0x0c,0x40,0x0d,0x00,0x0e,0x81,0x0f,0x2a, + 0x10,0x06,0x11,0x00,0x12,0xc8,0x13,0x80,0x14,0x00,0x15,0x11,0x16,0x01,0x17,0x42, + 0x18,0x40,0x19,0x80,0x40,0x00,0x41,0xff,0x42,0xff,0x43,0xff,0x44,0xff,0x45,0xff, + 0x46,0xff,0x47,0xff,0x48,0xff,0x49,0xff,0x4a,0xff,0x4b,0xff,0x4c,0xff,0x4d,0xff, + 0x4e,0xff,0x4f,0xff,0x50,0xff,0x51,0xff,0x52,0xff,0x53,0xff,0x54,0x5f,0x55,0xff, + 0x56,0xff,0x57,0xff,0x58,0x00,0x59,0x47,0x5a,0x03,0x5b,0x03,0x5d,0x3e,0x5e,0x00, + 0x80,0x1c,0x83,0x01,0x84,0xa5,0x85,0x10,0x86,0x45,0x87,0x41,0x88,0xf0,0x88,0x00, + 0x88,0xf0,0x90,0x00,0x91,0x08,0x92,0x00,0x93,0x80,0x94,0x08,0x95,0x00,0x96,0xc0, + 0x97,0x02,0x98,0x13,0x99,0x00,0x9a,0x38,0x9b,0x01,0x9c,0x80,0x9d,0x02,0x9e,0x06, + 0x9f,0x01,0xa0,0x01,0xa1,0x00,0xa2,0x00,0xa4,0x80,0xa5,0x36,0xa6,0x36,0xa8,0x67, + 0xa9,0x04,0xaa,0x00,0xac,0x33,0xad,0x02,0xae,0x00,0xb0,0xcd,0xb1,0x04,0xb2,0xcd, + 0xb3,0x04,0xb4,0x01,0xb8,0x00,0xb9,0x00,0xba,0x00,0xbb,0x00,0xbc,0x00,0xbd,0x00, + 0xbe,0x00,0xbf,0x00 +}; + #define TVNORMS ARRAY_SIZE(tvnorms) /* supported controls */ @@ -216,6 +233,12 @@ void em2820_config_i2c(struct em2820 *dev) /* configure decoder */ + if(dev->model == EM2820_BOARD_MSI_VOX_USB_2){ + em2820_vdi.data=saa7114_i2c_init; + em2820_vdi.len=sizeof(saa7114_i2c_init); + } + + em2820_i2c_call_clients(dev, DECODER_INIT, &em2820_vdi); em2820_i2c_call_clients(dev, DECODER_SET_INPUT, &dev->ctl_input); /* em2820_i2c_call_clients(dev,DECODER_SET_PICTURE, &dev->vpic); */ @@ -1627,10 +1650,8 @@ static int em2820_init_dev(struct em2820 **devhandle, struct usb_device *udev, #ifdef CONFIG_MODULES /* request some modules */ - if (dev->decoder == EM2820_SAA7113) + if (dev->decoder == EM2820_SAA7113 || dev->decoder == EM2820_SAA7114) request_module("saa7113"); - if (dev->decoder == EM2820_SAA7114) - request_module("saa7114"); if (dev->decoder == EM2820_TVP5150) request_module("tvp5150"); if (dev->has_tuner) -- cgit v1.2.2 From f6d6e6dbdfcfc9d56550744068c2a9918798b773 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 8 Nov 2005 21:38:07 -0800 Subject: [PATCH] v4l: 842: create kconfig files for cx88 and saa7134 directories - Create Kconfig files for cx88 and saa7134 directories. Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/cx88/Kconfig | 81 +++++++++++++++++++++++++++++++++++++ drivers/media/video/saa7134/Kconfig | 58 ++++++++++++++++++++++++++ 2 files changed, 139 insertions(+) create mode 100644 drivers/media/video/cx88/Kconfig create mode 100644 drivers/media/video/saa7134/Kconfig diff --git a/drivers/media/video/cx88/Kconfig b/drivers/media/video/cx88/Kconfig new file mode 100644 index 000000000000..3c912152121b --- /dev/null +++ b/drivers/media/video/cx88/Kconfig @@ -0,0 +1,81 @@ +config VIDEO_CX88 + tristate "Conexant 2388x (bt878 successor) support" + depends on VIDEO_DEV && PCI && I2C && EXPERIMENTAL + select I2C_ALGOBIT + select FW_LOADER + select VIDEO_BTCX + select VIDEO_BUF + select VIDEO_TUNER + select VIDEO_TVEEPROM + select VIDEO_IR + ---help--- + This is a video4linux driver for Conexant 2388x based + TV cards. + + To compile this driver as a module, choose M here: the + module will be called cx8800 + +config VIDEO_CX88_DVB + tristate "DVB/ATSC Support for cx2388x based TV cards" + depends on VIDEO_CX88 && DVB_CORE + select VIDEO_BUF_DVB + ---help--- + This adds support for DVB/ATSC cards based on the + Connexant 2388x chip. + + To compile this driver as a module, choose M here: the + module will be called cx88-dvb. + + You must also select one or more DVB/ATSC demodulators. + If you are unsure which you need, choose all of them. + +config VIDEO_CX88_DVB_ALL_FRONTENDS + bool "Build all supported frontends for cx2388x based TV cards" + default y + depends on VIDEO_CX88_DVB + select DVB_MT352 + select DVB_OR51132 + select DVB_CX22702 + select DVB_LGDT330X + ---help--- + This builds cx88-dvb with all currently supported frontend + demodulators. If you wish to tweak your configuration, and + only include support for the hardware that you need, choose N here. + + If you are unsure, choose Y. + +config VIDEO_CX88_DVB_MT352 + tristate "Zarlink MT352 DVB-T Support" + default m + depends on VIDEO_CX88_DVB && !VIDEO_CX88_DVB_ALL_FRONTENDS + select DVB_MT352 + ---help--- + This adds DVB-T support for cards based on the + Connexant 2388x chip and the MT352 demodulator. + +config VIDEO_CX88_DVB_OR51132 + tristate "OR51132 ATSC Support" + default m + depends on VIDEO_CX88_DVB && !VIDEO_CX88_DVB_ALL_FRONTENDS + select DVB_OR51132 + ---help--- + This adds ATSC 8VSB and QAM64/256 support for cards based on the + Connexant 2388x chip and the OR51132 demodulator. + +config VIDEO_CX88_DVB_CX22702 + tristate "Conexant CX22702 DVB-T Support" + default m + depends on VIDEO_CX88_DVB && !VIDEO_CX88_DVB_ALL_FRONTENDS + select DVB_CX22702 + ---help--- + This adds DVB-T support for cards based on the + Connexant 2388x chip and the CX22702 demodulator. + +config VIDEO_CX88_DVB_LGDT330X + tristate "LG Electronics DT3302/DT3303 ATSC Support" + default m + depends on VIDEO_CX88_DVB && !VIDEO_CX88_DVB_ALL_FRONTENDS + select DVB_LGDT330X + ---help--- + This adds ATSC 8VSB and QAM64/256 support for cards based on the + Connexant 2388x chip and the LGDT3302/LGDT3303 demodulator. diff --git a/drivers/media/video/saa7134/Kconfig b/drivers/media/video/saa7134/Kconfig new file mode 100644 index 000000000000..e8c89b4828ff --- /dev/null +++ b/drivers/media/video/saa7134/Kconfig @@ -0,0 +1,58 @@ +config VIDEO_SAA7134 + tristate "Philips SAA7134 support" + depends on VIDEO_DEV && PCI && I2C && SOUND + select VIDEO_BUF + select VIDEO_IR + select VIDEO_TUNER + select CRC32 + ---help--- + This is a video4linux driver for Philips SAA713x based + TV cards. + + To compile this driver as a module, choose M here: the + module will be called saa7134. + +config VIDEO_SAA7134_DVB + tristate "DVB Support for saa7134 based TV cards" + depends on VIDEO_SAA7134 && DVB_CORE + select VIDEO_BUF_DVB + ---help--- + This adds support for DVB cards based on the + Philips saa7134 chip. + + To compile this driver as a module, choose M here: the + module will be called saa7134-dvb. + + You must also select one or more DVB demodulators. + If you are unsure which you need, choose all of them. + +config VIDEO_SAA7134_DVB_ALL_FRONTENDS + bool "Build all supported frontends for saa7134 based TV cards" + default y + depends on VIDEO_SAA7134_DVB + select DVB_MT352 + select DVB_TDA1004X + ---help--- + This builds saa7134-dvb with all currently supported frontend + demodulators. If you wish to tweak your configuration, and + only include support for the hardware that you need, choose N here. + + If you are unsure, choose Y. + +config VIDEO_SAA7134_DVB_MT352 + tristate "Zarlink MT352 DVB-T Support" + default m + depends on VIDEO_SAA7134_DVB && !VIDEO_SAA7134_DVB_ALL_FRONTENDS + select DVB_MT352 + ---help--- + This adds DVB-T support for cards based on the + Philips saa7134 chip and the MT352 demodulator. + +config VIDEO_SAA7134_DVB_TDA1004X + tristate "Phillips TDA10045H/TDA10046H DVB-T Support" + default m + depends on VIDEO_SAA7134_DVB && !VIDEO_SAA7134_DVB_ALL_FRONTENDS + select DVB_TDA1004X + ---help--- + This adds DVB-T support for cards based on the + Philips saa7134 chip and the TDA10045H/TDA10046H demodulator. -- cgit v1.2.2 From 791b403f5f8b2bb9ecaefc6dacfd4b96cb282274 Mon Sep 17 00:00:00 2001 From: Markus Rechberger Date: Tue, 8 Nov 2005 21:38:08 -0800 Subject: [PATCH] v4l: 843: added saa7114 support on i2c address 0x42 - Added saa7114 support on i2c address 0x42 Signed-off-by: Markus Rechberger Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/saa711x.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/video/saa711x.c b/drivers/media/video/saa711x.c index ed16282fca51..85f3403f7404 100644 --- a/drivers/media/video/saa711x.c +++ b/drivers/media/video/saa711x.c @@ -84,6 +84,7 @@ struct saa7113 { }; #define I2C_SAA7113 0x4A +#define I2C_SAA7114 0x42 /* ----------------------------------------------------------------------- */ @@ -465,6 +466,7 @@ saa7113_command (struct i2c_client *client, /* standard i2c insmod options */ static unsigned short normal_i2c[] = { I2C_SAA7113>>1, /* saa7113 */ + I2C_SAA7114>>1, /* saa7114 */ I2C_CLIENT_END }; -- cgit v1.2.2 From 5d5c9904e56ae39ff71b86dc5046e24601bff00f Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 8 Nov 2005 21:38:08 -0800 Subject: [PATCH] v4l: 847: fix bug 5484 asus digimatrix card doesnt work with pal tuner - Fix bug 5484: ASUS digimatrix card doesnt work with PAL tuner Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/video4linux/CARDLIST.saa7134 | 3 ++- drivers/media/video/saa7134/saa7134-cards.c | 26 +++++++++++++++++++++++++- drivers/media/video/saa7134/saa7134.h | 1 + 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134 index d2688c71c657..51252ff034e6 100644 --- a/Documentation/video4linux/CARDLIST.saa7134 +++ b/Documentation/video4linux/CARDLIST.saa7134 @@ -62,7 +62,7 @@ 61 -> Philips TOUGH DVB-T reference design [1131:2004] 62 -> Compro VideoMate TV Gold+II 63 -> Kworld Xpert TV PVR7134 - 64 -> FlyTV mini Asus Digimatrix [1043:0210,1043:0210] + 64 -> FlyTV mini Asus Digimatrix [1043:0210] 65 -> V-Stream Studio TV Terminator 66 -> Yuan TUN-900 (saa7135) 67 -> Beholder BeholdTV 409 FM [0000:4091] @@ -78,3 +78,4 @@ 77 -> Pinnacle PCTV 110i (saa7133) [11bd:002e] 78 -> ASUSTeK P7131 Dual [1043:4862] 79 -> PCTV Cardbus TV/Radio (ITO25 Rev:2B) + 80 -> ASUS Digimatrix TV [1043:0210] diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index d16d7c4cd851..6650efa44ca7 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c @@ -2461,6 +2461,30 @@ struct saa7134_board saa7134_boards[] = { .amux = LINE2, }}, }, + [SAA7134_BOARD_ASUSTEK_DIGIMATRIX_TV] = { + /* "Cyril Lacoux (Yack)" */ + .name = "ASUS Digimatrix TV", + .audio_clock = 0x00200000, + .tuner_type = TUNER_PHILIPS_FQ1216ME, + .tda9887_conf = TDA9887_PRESENT, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .inputs = {{ + .name = name_tv, + .vmux = 1, + .amux = TV, + .tv = 1, + },{ + .name = name_comp1, + .vmux = 3, + .amux = LINE1, + },{ + .name = name_svideo, + .vmux = 8, + .amux = LINE1, + }}, + }, }; const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards); @@ -2822,7 +2846,7 @@ struct pci_device_id saa7134_pci_tbl[] = { .device = PCI_DEVICE_ID_PHILIPS_SAA7134, .subvendor = 0x1043, .subdevice = 0x0210, /* mini pci PAL/SECAM version */ - .driver_data = SAA7134_BOARD_FLYTV_DIGIMATRIX, + .driver_data = SAA7134_BOARD_ASUSTEK_DIGIMATRIX_TV, },{ .vendor = PCI_VENDOR_ID_PHILIPS, diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index 768370041067..1365f1f32fee 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h @@ -207,6 +207,7 @@ struct saa7134_format { #define SAA7134_BOARD_PINNACLE_PCTV_110i 77 #define SAA7134_BOARD_ASUSTeK_P7131_DUAL 78 #define SAA7134_BOARD_PCTV_CARDBUS 79 +#define SAA7134_BOARD_ASUSTEK_DIGIMATRIX_TV 80 #define SAA7134_MAXBOARDS 8 #define SAA7134_INPUT_MAX 8 -- cgit v1.2.2 From 07345f5d6a92bc1184ca8b05069ec1cd3514fe11 Mon Sep 17 00:00:00 2001 From: Hartmut Hackmann Date: Tue, 8 Nov 2005 21:38:09 -0800 Subject: [PATCH] v4l: 848: fixed tda8290 autodetection - Fixed tda8290 autodetection Signed-off-by: Hartmut Hackmann Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/tuner-core.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index 6fd59be19182..77d25cc9cdbe 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c @@ -362,16 +362,6 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind) /* TEA5767 autodetection code - only for addr = 0xc0 */ if (!no_autodetect) { switch (addr) { - case 0x60: - if (tea5767_autodetection(&t->i2c) != EINVAL) { - t->type = TUNER_TEA5767; - t->mode_mask = T_RADIO; - t->mode = T_STANDBY; - t->freq = 87.5 * 16; /* Sets freq to FM range */ - default_mode_mask &= ~T_RADIO; - - goto register_client; - } case 0x42: case 0x43: case 0x4a: @@ -379,12 +369,23 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind) /* If chip is not tda8290, don't register. since it can be tda9887*/ if (tda8290_probe(&t->i2c) != 0) { + tuner_dbg("chip at addr %x is not a tda8290\n", addr); kfree(t); return 0; } + break; + case 0x60: + if (tea5767_autodetection(&t->i2c) != EINVAL) { + t->type = TUNER_TEA5767; + t->mode_mask = T_RADIO; + t->mode = T_STANDBY; + t->freq = 87.5 * 16; /* Sets freq to FM range */ + default_mode_mask &= ~T_RADIO; + goto register_client; + } + break; } - } /* Initializes only the first adapter found */ -- cgit v1.2.2 From 52c02fcd00cf6fb6f5b2c8beae3b283c63cf1210 Mon Sep 17 00:00:00 2001 From: Sascha Sommer Date: Tue, 8 Nov 2005 21:38:10 -0800 Subject: [PATCH] v4l: 850: update em2800 scaler code and comments based on info from empiatech - Update em2800 scaler code and comments based on info from empiatech Signed-off-by: Sascha Sommer Signed-off-by: Markus Rechberger Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/em28xx/em28xx-core.c | 38 ++++++++++++------------------- drivers/media/video/em28xx/em28xx-video.c | 10 +++++--- drivers/media/video/tuner-core.c | 2 +- 3 files changed, 23 insertions(+), 27 deletions(-) diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index ba2d986c6dfc..263b6c91adb5 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c @@ -430,30 +430,22 @@ int em2820_capture_area_set(struct em2820 *dev, u8 hstart, u8 vstart, int em2820_scaler_set(struct em2820 *dev, u16 h, u16 v) { - u8 buf[2]; - buf[0] = h; - buf[1] = h >> 8; - em2820_write_regs(dev, HSCALELOW_REG, (char *)buf, 2); - buf[0] = v; - buf[1] = v >> 8; - em2820_write_regs(dev, VSCALELOW_REG, (char *)buf, 2); - if(dev->is_em2800){ - /* FIXME */ - /* random ratio scaling and 720x567 doesn't seem to work */ - /* the maximum we can get is 640x480 with disabled scaler */ - /* and norm_maxw set to 640 */ - if(dev->width == 640 && dev->height == 480) - return em2820_write_regs(dev, COMPR_REG,"\x00",1); - if(dev->height > 288) - return em2820_write_regs(dev, COMPR_REG,"\x10",1); - if(dev->width > 360) - return em2820_write_regs(dev, COMPR_REG,"\x20",1); + u8 mode; + /* the em2800 scaler only supports scaling down to 50% */ + if(dev->is_em2800) + mode = (v ? 0x20 : 0x00) | (h ? 0x10 : 0x00); + else { + u8 buf[2]; + buf[0] = h; + buf[1] = h >> 8; + em2820_write_regs(dev, HSCALELOW_REG, (char *)buf, 2); + buf[0] = v; + buf[1] = v >> 8; + em2820_write_regs(dev, VSCALELOW_REG, (char *)buf, 2); + /* it seems that both H and V scalers must be active to work correctly */ + mode = (h || v)? 0x30: 0x00; } - /* when H and V mixershould be used? */ - /* return em2820_write_reg_bits(dev, COMPR_REG, (h ? 0x20 : 0x00) | (v ? 0x10 : 0x00), 0x30); */ - /* it seems that both H and V scalers must be active to work correctly */ - return em2820_write_reg_bits(dev, COMPR_REG, h - || v ? 0x30 : 0x00, 0x30); + return em2820_write_reg_bits(dev, COMPR_REG, mode, 0x30); } /* FIXME: this only function read values from dev */ diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 9f79c39349fb..a569be3e2f29 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c @@ -1308,14 +1308,18 @@ static int em2820_video_do_ioctl(struct inode *inode, struct file *filp, if (width > maxw) width = maxw; - /* FIXME*/ if(dev->is_em2800){ - /* we only know how to scale to 50% */ + /* the em2800 can only scale down to 50% */ if(height % (maxh / 2)) height=maxh; if(width % (maxw / 2)) width=maxw; - /* larger resoltion don't seem to work either */ + /* according to empiatech support */ + /* the MaxPacketSize is to small to support */ + /* framesizes larger than 640x480 @ 30 fps */ + /* or 640x576 @ 25 fps. As this would cut */ + /* of a part of the image we prefer */ + /* 360x576 or 360x480 for now */ if(width == maxw && height == maxh) width /= 2; } diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index 77d25cc9cdbe..fce18638134a 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c @@ -369,7 +369,7 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind) /* If chip is not tda8290, don't register. since it can be tda9887*/ if (tda8290_probe(&t->i2c) != 0) { - tuner_dbg("chip at addr %x is not a tda8290\n", addr); + tuner_dbg("chip at addr %x is not a tda8290\n", addr); kfree(t); return 0; } -- cgit v1.2.2 From b228ede44c1cded7f3dadbb8bfaeaec97f7885e8 Mon Sep 17 00:00:00 2001 From: "Nickolay V. Shmyrev" Date: Tue, 8 Nov 2005 21:38:11 -0800 Subject: [PATCH] v4l: 851: fixed broken api link and indentation - Fixed broken API link and indentation. Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/video4linux/API.html | 2 +- drivers/media/video/tuner-core.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/video4linux/API.html b/Documentation/video4linux/API.html index 441407b12a9f..afbe9ae7ee96 100644 --- a/Documentation/video4linux/API.html +++ b/Documentation/video4linux/API.html @@ -8,7 +8,7 @@ V4L original API Obsoleted by V4L2 API - + V4L2 API Should be used for new projects diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index fce18638134a..735b62b3c08e 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c @@ -369,7 +369,7 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind) /* If chip is not tda8290, don't register. since it can be tda9887*/ if (tda8290_probe(&t->i2c) != 0) { - tuner_dbg("chip at addr %x is not a tda8290\n", addr); + tuner_dbg("chip at addr %x is not a tda8290\n", addr); kfree(t); return 0; } -- cgit v1.2.2 From d5f69daf91edda79e97fbb702e6a15cdf3e496a1 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 8 Nov 2005 21:38:12 -0800 Subject: [PATCH] v4l: 854: move cx88 and saa7134 configuration - Move cx88 and saa7134 configuration out of drivers/media/video/Kconfig and instead, use new Kconfig files in each respective directory. Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/Kconfig | 53 ++------------------------------------------- 1 file changed, 2 insertions(+), 51 deletions(-) diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index bbb989df4cf0..882791b14ef8 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig @@ -243,29 +243,7 @@ config VIDEO_MEYE To compile this driver as a module, choose M here: the module will be called meye. -config VIDEO_SAA7134 - tristate "Philips SAA7134 support" - depends on VIDEO_DEV && PCI && I2C && SOUND - select VIDEO_BUF - select VIDEO_IR - select VIDEO_TUNER - select CRC32 - ---help--- - This is a video4linux driver for Philips SAA7130/7134 based - TV cards. - - To compile this driver as a module, choose M here: the - module will be called saa7134. - -config VIDEO_SAA7134_DVB - tristate "DVB Support for saa7134 based TV cards" - depends on VIDEO_SAA7134 && DVB_CORE - select VIDEO_BUF_DVB - select DVB_MT352 - select DVB_TDA1004X - ---help--- - This adds support for DVB cards based on the - Philips saa7134 chip. +source "drivers/media/video/saa7134/Kconfig" config VIDEO_MXB tristate "Siemens-Nixdorf 'Multimedia eXtension Board'" @@ -316,34 +294,7 @@ config VIDEO_HEXIUM_GEMINI To compile this driver as a module, choose M here: the module will be called hexium_gemini. -config VIDEO_CX88 - tristate "Conexant 2388x (bt878 successor) support" - depends on VIDEO_DEV && PCI && I2C && EXPERIMENTAL - select I2C_ALGOBIT - select FW_LOADER - select VIDEO_BTCX - select VIDEO_BUF - select VIDEO_TUNER - select VIDEO_TVEEPROM - select VIDEO_IR - ---help--- - This is a video4linux driver for Conexant 2388x based - TV cards. - - To compile this driver as a module, choose M here: the - module will be called cx8800 - -config VIDEO_CX88_DVB - tristate "DVB Support for cx2388x based TV cards" - depends on VIDEO_CX88 && DVB_CORE - select VIDEO_BUF_DVB - select DVB_MT352 - select DVB_OR51132 - select DVB_CX22702 - select DVB_LGDT330X - ---help--- - This adds support for DVB/ATSC cards based on the - Connexant 2388x chip. +source "drivers/media/video/cx88/Kconfig" config VIDEO_OVCAMCHIP tristate "OmniVision Camera Chip support" -- cgit v1.2.2 From 141a877949ffc22f33dc467dc256259c547ad52e Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 8 Nov 2005 21:38:13 -0800 Subject: [PATCH] v4l: 855: improve kconfig user friendliness for hybrid dvb v4l boards - Improve Kconfig user-friendliness for hybrid dvb/v4l boards. Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/Kconfig | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 882791b14ef8..f3b077ec0c35 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig @@ -25,6 +25,16 @@ config VIDEO_BT848 To compile this driver as a module, choose M here: the module will be called bttv. +config VIDEO_BT848_DVB + tristate "DVB/ATSC Support for bt878 based TV cards" + depends on VIDEO_BT848 && DVB_CORE + select DVB_BT8XX + ---help--- + This adds support for DVB/ATSC cards based on the BT878 chip. + + To compile this driver as a module, choose M here: the + module will be called dvb-bt8xx. + config VIDEO_SAA6588 tristate "SAA6588 Radio Chip RDS decoder support on BT848 cards" depends on VIDEO_DEV && I2C && VIDEO_BT848 -- cgit v1.2.2 From 91cad0f2bda7cd254efcbbff0e53f86941ca7764 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:38:13 -0800 Subject: [PATCH] v4l: 856: some module rename and small fixes - Some module rename and small fixes Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/em28xx/em28xx-i2c.c | 3 +++ drivers/media/video/em28xx/em28xx-video.c | 18 ++++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c index 20728882e333..f0b386b4eb84 100644 --- a/drivers/media/video/em28xx/em28xx-i2c.c +++ b/drivers/media/video/em28xx/em28xx-i2c.c @@ -373,6 +373,9 @@ static int em2820_i2c_eeprom(struct em2820 *dev, unsigned char *eedata, int len) printk(KERN_INFO "200mA max power\n"); break; } + printk(KERN_INFO "Table at 0x%02x, strings=0x%04x, 0x%04x, 0x%04x\n", + em_eeprom->string_idx_table,em_eeprom->string1, + em_eeprom->string2,em_eeprom->string3); return 0; } diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index a569be3e2f29..d385149edd48 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c @@ -1655,7 +1655,7 @@ static int em2820_init_dev(struct em2820 **devhandle, struct usb_device *udev, #ifdef CONFIG_MODULES /* request some modules */ if (dev->decoder == EM2820_SAA7113 || dev->decoder == EM2820_SAA7114) - request_module("saa7113"); + request_module("saa711x"); if (dev->decoder == EM2820_TVP5150) request_module("tvp5150"); if (dev->has_tuner) @@ -1753,14 +1753,20 @@ static int em2820_usb_probe(struct usb_interface *interface, udev = usb_get_dev(interface_to_usbdev(interface)); ifnum = interface->altsetting[0].desc.bInterfaceNumber; - em2820_err(DRIVER_NAME " new device (%04x:%04x): interface %i, class %i\n", - udev->descriptor.idVendor,udev->descriptor.idProduct, - ifnum, - interface->altsetting[0].desc.bInterfaceClass); /* Don't register audio interfaces */ - if (interface->altsetting[0].desc.bInterfaceClass == USB_CLASS_AUDIO) + if (interface->altsetting[0].desc.bInterfaceClass == USB_CLASS_AUDIO) { + em2820_err(DRIVER_NAME " audio device (%04x:%04x): interface %i, class %i\n", + udev->descriptor.idVendor,udev->descriptor.idProduct, + ifnum, + interface->altsetting[0].desc.bInterfaceClass); return -ENODEV; + } + + em2820_err(DRIVER_NAME " new video device (%04x:%04x): interface %i, class %i\n", + udev->descriptor.idVendor,udev->descriptor.idProduct, + ifnum, + interface->altsetting[0].desc.bInterfaceClass); endpoint = &interface->cur_altsetting->endpoint[1].desc; -- cgit v1.2.2 From 07eef6ce1558b21ebed9c95ad9c2b4879decf2a8 Mon Sep 17 00:00:00 2001 From: "Nickolay V. Shmyrev" Date: Tue, 8 Nov 2005 21:38:14 -0800 Subject: [PATCH] v4l: 859: fix compilation with 2.6.8 - Fix compilation with 2.6.8. Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/saa7134/saa7134-alsa.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c index fb6334a7ee86..bf454437b771 100644 --- a/drivers/media/video/saa7134/saa7134-alsa.c +++ b/drivers/media/video/saa7134/saa7134-alsa.c @@ -89,6 +89,8 @@ typedef struct snd_card_saa7134 { spinlock_t lock; } snd_card_saa7134_t; + + /* * PCM structure */ -- cgit v1.2.2 From 45632c4f835e74f937d8632f7ba2dd49aa39c476 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:38:15 -0800 Subject: [PATCH] v4l: 863: added pinnacle dazzle dvc 90 - Added Pinnacle Dazzle DVC 90 Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/video4linux/CARDLIST.em28xx | 1 + drivers/media/video/em28xx/em28xx-cards.c | 20 ++++++++++++++++++++ drivers/media/video/em28xx/em28xx.h | 1 + 3 files changed, 22 insertions(+) diff --git a/Documentation/video4linux/CARDLIST.em28xx b/Documentation/video4linux/CARDLIST.em28xx index 4fa58de4b860..a0c7cad20971 100644 --- a/Documentation/video4linux/CARDLIST.em28xx +++ b/Documentation/video4linux/CARDLIST.em28xx @@ -7,3 +7,4 @@ 6 -> Terratec Cinergy 200 USB (em2800) 7 -> Leadtek Winfast USB II (em2800) 8 -> Kworld USB2800 (em2800) + 9 -> Pinnacle Dazzle DVC 90 (em2820/em2840) [2304:0207] diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index 4ab30476807d..32c2c7fdad2c 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c @@ -227,6 +227,22 @@ struct em2820_board em2820_boards[] = { .amux = 1, }}, }, + [EM2820_BOARD_PINNACLE_DVC_90] = { + .name = "Pinnacle Dazzle DVC 90", + .vchannels = 3, + .norm = VIDEO_MODE_PAL, + .has_tuner = 0, + .decoder = EM2820_SAA7113, + .input = {{ + .type = EM2820_VMUX_COMPOSITE1, + .vmux = 0, + .amux = 1, + },{ + .type = EM2820_VMUX_SVIDEO, + .vmux = 9, + .amux = 1, + }}, + }, }; const unsigned int em2820_bcount = ARRAY_SIZE(em2820_boards); @@ -237,6 +253,7 @@ struct usb_device_id em2820_id_table [] = { { USB_DEVICE(0x0ccd, 0x0036), .driver_info = EM2820_BOARD_TERRATEC_CINERGY_250 }, { USB_DEVICE(0x2304, 0x0208), .driver_info = EM2820_BOARD_PINNACLE_USB_2 }, { USB_DEVICE(0x2040, 0x4200), .driver_info = EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 }, + { USB_DEVICE(0x2304, 0x0207), .driver_info = EM2820_BOARD_PINNACLE_DVC_90 }, { }, }; @@ -258,6 +275,9 @@ void em2820_card_setup(struct em2820 *dev) if (tv.audio_processor == AUDIO_CHIP_MSP34XX) { dev->has_msp34xx=1; } else dev->has_msp34xx=0; + em2820_write_regs_req(dev,0x06,0x00,"\x40",1);// Serial Bus Frequency Select Register + em2820_write_regs_req(dev,0x0f,0x00,"\x87",1);// XCLK Frequency Select Register + em2820_write_regs_req(dev,0x88,0x0d,"\xd0",1); } } diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h index 15760d3d753d..8c58c5b5fa36 100644 --- a/drivers/media/video/em28xx/em28xx.h +++ b/drivers/media/video/em28xx/em28xx.h @@ -40,6 +40,7 @@ #define EM2800_BOARD_TERRATEC_CINERGY_200 6 #define EM2800_BOARD_LEADTEK_WINFAST_USBII 7 #define EM2800_BOARD_KWORLD_USB2800 8 +#define EM2820_BOARD_PINNACLE_DVC_90 9 #define UNSET -1 -- cgit v1.2.2 From feff0485ebcf05b5af8a3c82aa5c361d9f8b6e75 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:38:16 -0800 Subject: [PATCH] v4l: 864: improved isoc error detection - Improved isoc error detection. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/em28xx/em28xx-core.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index 263b6c91adb5..442d50d7f320 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c @@ -573,8 +573,16 @@ static inline void em2820_isoc_video_copy(struct em2820 *dev, if ((*f)->fieldbytesused + len > dev->field_size) len =dev->field_size - (*f)->fieldbytesused; + + if (buf[0] != 0x88 && buf[0] != 0x22) { + em2820_isocdbg("frame is not complete\n"); + startread = buf; + len+=4; + } else + startread = buf + 4; + remain = len; - startread = buf + 4; + if ((*f)->top_field) fieldstart = (*f)->bufmem; else @@ -653,7 +661,8 @@ void em2820_isocIrq(struct urb *urb, struct pt_regs *regs) em2820_isocdbg("data error: [%d] len=%d, status=%d", i, urb->iso_frame_desc[i].actual_length, urb->iso_frame_desc[i].status); - continue; + if (urb->iso_frame_desc[i].status != -EPROTO) + continue; } if (urb->iso_frame_desc[i].actual_length <= 0) { em2820_isocdbg("packet %d is empty",i); -- cgit v1.2.2 From aa8d5e72c3b2dbd18e494564345e84a0b890dd7b Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:38:16 -0800 Subject: [PATCH] v4l: 865: fixed bttv to accept radio devices like tea5767 - Fixed bttv to accept radio devices like tea5767. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/bttv-i2c.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/bttv-i2c.c b/drivers/media/video/bttv-i2c.c index 06c5965b5616..d6cccce48041 100644 --- a/drivers/media/video/bttv-i2c.c +++ b/drivers/media/video/bttv-i2c.c @@ -291,6 +291,10 @@ static struct i2c_adapter bttv_i2c_adap_hw_template = { static int attach_inform(struct i2c_client *client) { struct bttv *btv = i2c_get_adapdata(client->adapter); + int radio_addr=ADDR_UNSET; + + if (ADDR_UNSET != bttv_tvcards[btv->c.type].radio_addr) + radio_addr = bttv_tvcards[btv->c.type].radio_addr; if (bttv_debug) printk(KERN_DEBUG "bttv%d: %s i2c attach [addr=0x%x,client=%s]\n", @@ -302,10 +306,13 @@ static int attach_inform(struct i2c_client *client) if (btv->tuner_type != UNSET) { struct tuner_setup tun_setup; - tun_setup.mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV; + tun_setup.mode_mask = T_ANALOG_TV | T_DIGITAL_TV; tun_setup.type = btv->tuner_type; tun_setup.addr = ADDR_UNSET; + if (client->addr == radio_addr) + tun_setup.mode_mask = T_RADIO; + client->driver->command (client, TUNER_SET_TYPE_ADDR, &tun_setup); } -- cgit v1.2.2 From e9d096dc52493228ce1ae0fbed1d2fe0271fbe16 Mon Sep 17 00:00:00 2001 From: "Nickolay V. Shmyrev" Date: Tue, 8 Nov 2005 21:38:17 -0800 Subject: [PATCH] v4l: 866: fix bug with setting mt2050 radio frequency - Fix bug with setting mt2050 radio frequency Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/mt20xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/video/mt20xx.c b/drivers/media/video/mt20xx.c index 13b61c4dcbf8..2180018f06de 100644 --- a/drivers/media/video/mt20xx.c +++ b/drivers/media/video/mt20xx.c @@ -455,7 +455,7 @@ static void mt2050_set_radio_freq(struct i2c_client *c, unsigned int freq) struct tuner *t = i2c_get_clientdata(c); int if2 = t->radio_if2; - mt2050_set_if_freq(c, freq*62500, if2); + mt2050_set_if_freq(c, freq * 1000 / 16, if2); mt2050_set_antenna(c, radio_antenna); } -- cgit v1.2.2 From 85a2eb07e1a83a9569cdaddcef2db8d70e4fbea9 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:38:18 -0800 Subject: [PATCH] v4l: 867: correcting fixes to accept radio devices like tea5767 - Correcting fixes to accept radio devices like tea5767. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/bttv-i2c.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/drivers/media/video/bttv-i2c.c b/drivers/media/video/bttv-i2c.c index d6cccce48041..e509ed91a290 100644 --- a/drivers/media/video/bttv-i2c.c +++ b/drivers/media/video/bttv-i2c.c @@ -291,11 +291,14 @@ static struct i2c_adapter bttv_i2c_adap_hw_template = { static int attach_inform(struct i2c_client *client) { struct bttv *btv = i2c_get_adapdata(client->adapter); - int radio_addr=ADDR_UNSET; + int radio_addr=ADDR_UNSET, addr=ADDR_UNSET; if (ADDR_UNSET != bttv_tvcards[btv->c.type].radio_addr) radio_addr = bttv_tvcards[btv->c.type].radio_addr; + if (ADDR_UNSET != bttv_tvcards[btv->c.type].tuner_addr) + addr = bttv_tvcards[btv->c.type].tuner_addr; + if (bttv_debug) printk(KERN_DEBUG "bttv%d: %s i2c attach [addr=0x%x,client=%s]\n", btv->c.nr,client->driver->name,client->addr, @@ -306,14 +309,20 @@ static int attach_inform(struct i2c_client *client) if (btv->tuner_type != UNSET) { struct tuner_setup tun_setup; - tun_setup.mode_mask = T_ANALOG_TV | T_DIGITAL_TV; - tun_setup.type = btv->tuner_type; - tun_setup.addr = ADDR_UNSET; + if ((addr==ADDR_UNSET)||(addr==client->addr)) { + tun_setup.mode_mask = T_ANALOG_TV | T_DIGITAL_TV; + tun_setup.type = btv->tuner_type; + tun_setup.addr = ADDR_UNSET; - if (client->addr == radio_addr) - tun_setup.mode_mask = T_RADIO; + client->driver->command (client, TUNER_SET_TYPE_ADDR, &tun_setup); + } + if ((radio_addr==ADDR_UNSET)||(radio_addr==client->addr)) { + tun_setup.mode_mask = T_RADIO; + tun_setup.type = btv->tuner_type; + tun_setup.addr = ADDR_UNSET; - client->driver->command (client, TUNER_SET_TYPE_ADDR, &tun_setup); + client->driver->command (client, TUNER_SET_TYPE_ADDR, &tun_setup); + } } if (btv->pinnacle_id != UNSET) -- cgit v1.2.2 From fde6d31e19addca8be17dee7f47ad0a7fcaa79ca Mon Sep 17 00:00:00 2001 From: Kirk Lapray Date: Tue, 8 Nov 2005 21:38:18 -0800 Subject: [PATCH] v4l: 868: added support for nxt200x based cards ati hdtv wonder - Added support for NXT200X based cards (ATI HDTV Wonder) Signed-off-by: Kirk Lapray Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/cx88/Kconfig | 10 ++++++++++ drivers/media/video/cx88/Makefile | 3 +++ drivers/media/video/cx88/cx88-cards.c | 8 +++----- drivers/media/video/cx88/cx88-dvb.c | 26 ++++++++++++++++++++++++++ drivers/media/video/tuner-simple.c | 19 +++++++++++++++++-- 5 files changed, 59 insertions(+), 7 deletions(-) diff --git a/drivers/media/video/cx88/Kconfig b/drivers/media/video/cx88/Kconfig index 3c912152121b..1c9009589d11 100644 --- a/drivers/media/video/cx88/Kconfig +++ b/drivers/media/video/cx88/Kconfig @@ -37,6 +37,7 @@ config VIDEO_CX88_DVB_ALL_FRONTENDS select DVB_OR51132 select DVB_CX22702 select DVB_LGDT330X + select DVB_NXT200X ---help--- This builds cx88-dvb with all currently supported frontend demodulators. If you wish to tweak your configuration, and @@ -79,3 +80,12 @@ config VIDEO_CX88_DVB_LGDT330X ---help--- This adds ATSC 8VSB and QAM64/256 support for cards based on the Connexant 2388x chip and the LGDT3302/LGDT3303 demodulator. + +config VIDEO_CX88_DVB_NXT200X + tristate "NXT2002/NXT2004 ATSC Support" + default m + depends on VIDEO_CX88_DVB && !VIDEO_CX88_DVB_ALL_FRONTENDS + select DVB_NXT200X + ---help--- + This adds ATSC 8VSB and QAM64/256 support for cards based on the + Connexant 2388x chip and the NXT2002/NXT2004 demodulator. diff --git a/drivers/media/video/cx88/Makefile b/drivers/media/video/cx88/Makefile index be1dc66e065f..0df40b773454 100644 --- a/drivers/media/video/cx88/Makefile +++ b/drivers/media/video/cx88/Makefile @@ -24,3 +24,6 @@ endif ifneq ($(CONFIG_DVB_MT352),n) EXTRA_CFLAGS += -DHAVE_MT352=1 endif +ifneq ($(CONFIG_DVB_NXT200X),n) + EXTRA_CFLAGS += -DHAVE_NXT200X=1 +endif diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c index 504917768794..f20984eb5538 100644 --- a/drivers/media/video/cx88/cx88-cards.c +++ b/drivers/media/video/cx88/cx88-cards.c @@ -851,6 +851,7 @@ struct cx88_board cx88_boards[] = { .gpio2 = 0x00000001, .gpio3 = 0x00000000, }}, + .dvb = 1, }, [CX88_BOARD_WINFAST_DTV1000] = { .name = "WinFast DTV1000-T", @@ -1212,13 +1213,10 @@ void cx88_card_setup(struct cx88_core *core) if (0 == core->i2c_rc) { /* enable tuner */ int i; - u8 buffer[12]; + u8 buffer [] = { 0x10,0x12,0x13,0x04,0x16,0x00,0x14,0x04,0x017,0x00 }; core->i2c_client.addr = 0x0a; - buffer[0] = 0x10; buffer[1] = 0x12; buffer[2] = 0x13; buffer[3] = 0x04; - buffer[4] = 0x16; buffer[5] = 0x00; buffer[6] = 0x14; buffer[7] = 0x04; - buffer[8] = 0x14; buffer[9] = 0x00; buffer[10] = 0x17; buffer[11] = 0x00; - for (i = 0; i < 6; i++) + for (i = 0; i < 5; i++) if (2 != i2c_master_send(&core->i2c_client,&buffer[i*2],2)) printk(KERN_WARNING "%s: Unable to enable tuner(%i).\n", core->name, i); diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index a7a077196fc9..1236cb11d83a 100644 --- a/drivers/media/video/cx88/cx88-dvb.c +++ b/drivers/media/video/cx88/cx88-dvb.c @@ -45,6 +45,9 @@ #ifdef HAVE_LGDT330X # include "lgdt330x.h" #endif +#ifdef HAVE_NXT200X +# include "nxt200x.h" +#endif MODULE_DESCRIPTION("driver for cx2388x based DVB cards"); MODULE_AUTHOR("Chris Pascoe "); @@ -284,6 +287,23 @@ static struct lgdt330x_config fusionhdtv_5_gold = { }; #endif +#ifdef HAVE_NXT200X +static int nxt200x_set_ts_param(struct dvb_frontend* fe, + int is_punctured) +{ + struct cx8802_dev *dev= fe->dvb->priv; + dev->ts_gen_cntrl = is_punctured ? 0x04 : 0x00; + return 0; +} + +static struct nxt200x_config ati_hdtvwonder = { + .demod_address = 0x0a, + .pll_address = 0x61, + .pll_desc = &dvb_pll_tuv1236d, + .set_ts_params = nxt200x_set_ts_param, +}; +#endif + static int dvb_register(struct cx8802_dev *dev) { /* init struct videobuf_dvb */ @@ -384,6 +404,12 @@ static int dvb_register(struct cx8802_dev *dev) &dev->core->i2c_adap); } break; +#endif +#ifdef HAVE_NXT200X + case CX88_BOARD_ATI_HDTVWONDER: + dev->dvb.frontend = nxt200x_attach(&ati_hdtvwonder, + &dev->core->i2c_adap); + break; #endif default: printk("%s: The frontend of your DVB/ATSC card isn't supported yet\n", diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c index 84338f1e3038..34ba6d13b586 100644 --- a/drivers/media/video/tuner-simple.c +++ b/drivers/media/video/tuner-simple.c @@ -251,7 +251,7 @@ static struct tunertype tuners[] = { { "Philips TD1316 Hybrid Tuner", Philips, PAL, 16*160.00,16*442.00,0xa1,0xa2,0xa4,0xc8,623 }, { "Philips TUV1236D ATSC/NTSC dual in", Philips, ATSC, - 16*157.25,16*454.00,0x01,0x02,0x03,0xce,732 }, + 16*157.25,16*454.00,0x01,0x02,0x04,0xce,732 }, }; unsigned const int tuner_count = ARRAY_SIZE(tuners); @@ -383,9 +383,24 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq) /* 0x48 -> ATSC antenna input 2 */ /* 0x00 -> NTSC antenna input 1 */ /* 0x08 -> NTSC antenna input 2 */ + buffer[0] = 0x14; + buffer[1] = 0x00; + buffer[2] = 0x17; + buffer[3] = 0x00; config &= ~0x40; - if (t->std & V4L2_STD_ATSC) + if (t->std & V4L2_STD_ATSC) { config |= 0x40; + buffer[1] = 0x04; + } + /* set to the correct mode (analog or digital) */ + u8 tuneraddr; + tuneraddr = c->addr; + c->addr = 0x0a; + if (2 != (rc = i2c_master_send(c,&buffer[0],2))) + tuner_warn("i2c i/o error: rc == %d (should be 2)\n",rc); + if (2 != (rc = i2c_master_send(c,&buffer[2],2))) + tuner_warn("i2c i/o error: rc == %d (should be 2)\n",rc); + c->addr = tuneraddr; /* FIXME: input */ break; } -- cgit v1.2.2 From f4372beb84874ab33f2b06bd6a66ff6d07427081 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 8 Nov 2005 21:38:19 -0800 Subject: [PATCH] v4l: 869: iso c90 forbids mixed declarations and code - ISO C90 forbids mixed declarations and code Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/tuner-simple.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c index 34ba6d13b586..d832205818f2 100644 --- a/drivers/media/video/tuner-simple.c +++ b/drivers/media/video/tuner-simple.c @@ -299,7 +299,7 @@ static int tuner_stereo(struct i2c_client *c) static void default_set_tv_freq(struct i2c_client *c, unsigned int freq) { struct tuner *t = i2c_get_clientdata(c); - u8 config; + u8 config, tuneraddr; u16 div; struct tunertype *tun; unsigned char buffer[4]; @@ -393,7 +393,6 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq) buffer[1] = 0x04; } /* set to the correct mode (analog or digital) */ - u8 tuneraddr; tuneraddr = c->addr; c->addr = 0x0a; if (2 != (rc = i2c_master_send(c,&buffer[0],2))) -- cgit v1.2.2 From 3b64e8e238217ebd3d847ca19ead631124a2ed14 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 8 Nov 2005 21:38:20 -0800 Subject: [PATCH] v4l: 870: added dvb support for avermedia avertvhd mce a180 - Added DVB support for AVerMedia AVerTVHD MCE A180 Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/saa7134/Kconfig | 12 +++++++++++- drivers/media/video/saa7134/Makefile | 3 +++ drivers/media/video/saa7134/saa7134-cards.c | 1 + drivers/media/video/saa7134/saa7134-dvb.c | 17 +++++++++++++++++ 4 files changed, 32 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/saa7134/Kconfig b/drivers/media/video/saa7134/Kconfig index e8c89b4828ff..624e8808a517 100644 --- a/drivers/media/video/saa7134/Kconfig +++ b/drivers/media/video/saa7134/Kconfig @@ -13,7 +13,7 @@ config VIDEO_SAA7134 module will be called saa7134. config VIDEO_SAA7134_DVB - tristate "DVB Support for saa7134 based TV cards" + tristate "DVB/ATSC Support for saa7134 based TV cards" depends on VIDEO_SAA7134 && DVB_CORE select VIDEO_BUF_DVB ---help--- @@ -32,6 +32,7 @@ config VIDEO_SAA7134_DVB_ALL_FRONTENDS depends on VIDEO_SAA7134_DVB select DVB_MT352 select DVB_TDA1004X + select DVB_NXT200X ---help--- This builds saa7134-dvb with all currently supported frontend demodulators. If you wish to tweak your configuration, and @@ -56,3 +57,12 @@ config VIDEO_SAA7134_DVB_TDA1004X ---help--- This adds DVB-T support for cards based on the Philips saa7134 chip and the TDA10045H/TDA10046H demodulator. + +config VIDEO_SAA7134_DVB_NXT200X + tristate "NXT2002/NXT2004 ATSC Support" + default m + depends on VIDEO_SAA7134_DVB && !VIDEO_SAA7134_DVB_ALL_FRONTENDS + select DVB_NXT200X + ---help--- + This adds ATSC 8VSB and QAM64/256 support for cards based on the + Philips saa7134 chip and the NXT2002/NXT2004 demodulator. diff --git a/drivers/media/video/saa7134/Makefile b/drivers/media/video/saa7134/Makefile index 1418f9f88d26..937dff8d561c 100644 --- a/drivers/media/video/saa7134/Makefile +++ b/drivers/media/video/saa7134/Makefile @@ -18,3 +18,6 @@ endif ifneq ($(CONFIG_DVB_TDA1004X),n) EXTRA_CFLAGS += -DHAVE_TDA1004X=1 endif +ifneq ($(CONFIG_DVB_NXT200X),n) + EXTRA_CFLAGS += -DHAVE_NXT200X=1 +endif diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index 6650efa44ca7..2f2015202450 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c @@ -2358,6 +2358,7 @@ struct saa7134_board saa7134_boards[] = { .radio_type = UNSET, .tuner_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET, + .mpeg = SAA7134_MPEG_DVB, .inputs = {{ .name = name_comp1, .vmux = 3, diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c index 342891d431a8..aaac12e8adbf 100644 --- a/drivers/media/video/saa7134/saa7134-dvb.c +++ b/drivers/media/video/saa7134/saa7134-dvb.c @@ -39,6 +39,10 @@ #ifdef HAVE_TDA1004X # include "tda1004x.h" #endif +#ifdef HAVE_NXT200X +# include "nxt200x.h" +# include "dvb-pll.h" +#endif MODULE_AUTHOR("Gerd Knorr [SuSE Labs]"); MODULE_LICENSE("GPL"); @@ -624,6 +628,14 @@ static struct tda1004x_config tda827x_lifeview_config = { }; #endif +#ifdef HAVE_NXT200X +static struct nxt200x_config avertvhda180 = { + .demod_address = 0x0a, + .pll_address = 0x61, + .pll_desc = &dvb_pll_tdhu2, +}; +#endif + /* ------------------------------------------------------------------ */ static int dvb_init(struct saa7134_dev *dev) @@ -676,6 +688,11 @@ static int dvb_init(struct saa7134_dev *dev) dev->dvb.frontend = tda10046_attach(&philips_tu1216_61_config, &dev->i2c_adap); break; +#endif +#ifdef HAVE_NXT200X + case SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180: + dev->dvb.frontend = nxt200x_attach(&avertvhda180, &dev->i2c_adap); + break; #endif default: printk("%s: Huh? unknown DVB card?\n",dev->name); -- cgit v1.2.2 From 24d412289d5508f033d11154f981b478f8831c0d Mon Sep 17 00:00:00 2001 From: Ricardo Cerqueira Date: Tue, 8 Nov 2005 21:38:21 -0800 Subject: [PATCH] v4l: 871: fixed bttv to accept radio devices like tea5767 - Fixed bttv to accept radio devices like tea5767 Signed-off-by: Ricardo Cerqueira Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/bttv-cards.c | 4 +--- drivers/media/video/bttv-i2c.c | 11 ++++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bttv-cards.c index 695a67e9edd7..89aa5cbb8b9e 100644 --- a/drivers/media/video/bttv-cards.c +++ b/drivers/media/video/bttv-cards.c @@ -2721,13 +2721,11 @@ struct tvcard bttv_tvcards[] = { .audiomux = { 0, 1, 2, 2, 3 }, .needs_tvaudio = 0, .pll = PLL_28, - .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, + .tuner_type = TUNER_TENA_9533_DI, .tuner_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET, .has_remote = 1, - #if 0 .has_radio = 1, - #endif }, /* ---- card 0x8a ---------------------------------- */ [BTTV_BOARD_PV_BT878P_2E] = { diff --git a/drivers/media/video/bttv-i2c.c b/drivers/media/video/bttv-i2c.c index e509ed91a290..5ad335705e1f 100644 --- a/drivers/media/video/bttv-i2c.c +++ b/drivers/media/video/bttv-i2c.c @@ -308,21 +308,22 @@ static int attach_inform(struct i2c_client *client) if (btv->tuner_type != UNSET) { struct tuner_setup tun_setup; + struct tuner *t = i2c_get_clientdata(client); if ((addr==ADDR_UNSET)||(addr==client->addr)) { tun_setup.mode_mask = T_ANALOG_TV | T_DIGITAL_TV; tun_setup.type = btv->tuner_type; tun_setup.addr = ADDR_UNSET; - client->driver->command (client, TUNER_SET_TYPE_ADDR, &tun_setup); } - if ((radio_addr==ADDR_UNSET)||(radio_addr==client->addr)) { + + if (t->type != UNSET && t->mode_mask == T_RADIO) { + tun_setup.type = t->type; tun_setup.mode_mask = T_RADIO; - tun_setup.type = btv->tuner_type; tun_setup.addr = ADDR_UNSET; - - client->driver->command (client, TUNER_SET_TYPE_ADDR, &tun_setup); } + + client->driver->command (client, TUNER_SET_TYPE_ADDR, &tun_setup); } if (btv->pinnacle_id != UNSET) -- cgit v1.2.2 From ac113d15a9d1a85f57969244301850379b5f17dd Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 8 Nov 2005 21:38:21 -0800 Subject: [PATCH] v4l: 873: updated comments for avertvhd a180 - Updated comments for AVerTVHD A180 Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/saa7134/saa7134-cards.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index 2f2015202450..9e1c51c08f21 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c @@ -2351,7 +2351,11 @@ struct saa7134_board saa7134_boards[] = { }}, }, [SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180] = { - /* FIXME: uses Alps Electric TDHU2, containing ATI NXT2004 ATSC Decoder */ + /* Michael Krufky + * Uses Alps Electric TDHU2, containing NXT2004 ATSC Decoder + * AFAIK, there is no analog demod, thus, + * no support for analog television. + */ .name = "AVerMedia AVerTVHD MCE A180", .audio_clock = 0x00187de7, .tuner_type = TUNER_ABSENT, -- cgit v1.2.2 From 50c8640725453f2487da9267844a962108c8418e Mon Sep 17 00:00:00 2001 From: "Nickolay V. Shmyrev" Date: Tue, 8 Nov 2005 21:38:22 -0800 Subject: [PATCH] v4l: 874: quick and dirty fix for audc config pinnacle - Quick and dirty fix for AUDC_CONFIG_PINNACLE. Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/tuner-core.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index 735b62b3c08e..3fde4f90425a 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c @@ -497,8 +497,6 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) break; } case AUDC_CONFIG_PINNACLE: - if (check_mode(t, "AUDC_CONFIG_PINNACLE") == EINVAL) - return 0; switch (*iarg) { case 2: tuner_dbg("pinnacle pal\n"); -- cgit v1.2.2 From f3b512fd42b4ed6ff47a8afb4f42ac3cc325ddad Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:38:23 -0800 Subject: [PATCH] v4l: 875: some cleanups at i2c stuff and fixing when tuner addr is set - Some cleanups at I2C stuff and fixing when tuner addr is set. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/bttv-cards.c | 19 ++++++++----------- drivers/media/video/bttv-i2c.c | 20 +++----------------- 2 files changed, 11 insertions(+), 28 deletions(-) diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bttv-cards.c index 89aa5cbb8b9e..d81672acdaad 100644 --- a/drivers/media/video/bttv-cards.c +++ b/drivers/media/video/bttv-cards.c @@ -3188,7 +3188,7 @@ void __devinit bttv_init_card1(struct bttv *btv) void __devinit bttv_init_card2(struct bttv *btv) { int tda9887; - int addr=ADDR_UNSET, radio_addr=ADDR_UNSET; + int addr=ADDR_UNSET; btv->tuner_type = -1; @@ -3333,31 +3333,28 @@ void __devinit bttv_init_card2(struct bttv *btv) if (ADDR_UNSET != bttv_tvcards[btv->c.type].tuner_addr) addr = bttv_tvcards[btv->c.type].tuner_addr; - if (ADDR_UNSET != bttv_tvcards[btv->c.type].radio_addr) - radio_addr = bttv_tvcards[btv->c.type].radio_addr; - if (UNSET != bttv_tvcards[btv->c.type].tuner_type) if(UNSET == btv->tuner_type) btv->tuner_type = bttv_tvcards[btv->c.type].tuner_type; if (UNSET != tuner[btv->c.nr]) btv->tuner_type = tuner[btv->c.nr]; printk("bttv%d: using tuner=%d\n",btv->c.nr,btv->tuner_type); - if (btv->pinnacle_id != UNSET) - bttv_call_i2c_clients(btv, AUDC_CONFIG_PINNACLE, - &btv->pinnacle_id); + if (btv->tuner_type != UNSET) { struct tuner_setup tun_setup; - tun_setup.mode_mask = T_ANALOG_TV | T_DIGITAL_TV; + tun_setup.mode_mask = T_ANALOG_TV | T_DIGITAL_TV; tun_setup.type = btv->tuner_type; tun_setup.addr = addr; - if (addr == radio_addr) - tun_setup.mode_mask = T_RADIO; - bttv_call_i2c_clients(btv, TUNER_SET_TYPE_ADDR, &tun_setup); } + if (btv->pinnacle_id != UNSET) { + bttv_call_i2c_clients(btv, AUDC_CONFIG_PINNACLE, + &btv->pinnacle_id); + } + btv->svhs = bttv_tvcards[btv->c.type].svhs; if (svhs[btv->c.nr] != UNSET) btv->svhs = svhs[btv->c.nr]; diff --git a/drivers/media/video/bttv-i2c.c b/drivers/media/video/bttv-i2c.c index 5ad335705e1f..aaabef26105a 100644 --- a/drivers/media/video/bttv-i2c.c +++ b/drivers/media/video/bttv-i2c.c @@ -291,14 +291,11 @@ static struct i2c_adapter bttv_i2c_adap_hw_template = { static int attach_inform(struct i2c_client *client) { struct bttv *btv = i2c_get_adapdata(client->adapter); - int radio_addr=ADDR_UNSET, addr=ADDR_UNSET; + int radio_addr=ADDR_UNSET; if (ADDR_UNSET != bttv_tvcards[btv->c.type].radio_addr) radio_addr = bttv_tvcards[btv->c.type].radio_addr; - if (ADDR_UNSET != bttv_tvcards[btv->c.type].tuner_addr) - addr = bttv_tvcards[btv->c.type].tuner_addr; - if (bttv_debug) printk(KERN_DEBUG "bttv%d: %s i2c attach [addr=0x%x,client=%s]\n", btv->c.nr,client->driver->name,client->addr, @@ -310,25 +307,14 @@ static int attach_inform(struct i2c_client *client) struct tuner_setup tun_setup; struct tuner *t = i2c_get_clientdata(client); - if ((addr==ADDR_UNSET)||(addr==client->addr)) { - tun_setup.mode_mask = T_ANALOG_TV | T_DIGITAL_TV; - tun_setup.type = btv->tuner_type; - tun_setup.addr = ADDR_UNSET; - - } - if (t->type != UNSET && t->mode_mask == T_RADIO) { tun_setup.type = t->type; tun_setup.mode_mask = T_RADIO; - tun_setup.addr = ADDR_UNSET; + tun_setup.addr = radio_addr; + client->driver->command (client, TUNER_SET_TYPE_ADDR, &tun_setup); } - - client->driver->command (client, TUNER_SET_TYPE_ADDR, &tun_setup); } - if (btv->pinnacle_id != UNSET) - client->driver->command(client,AUDC_CONFIG_PINNACLE, - &btv->pinnacle_id); return 0; } -- cgit v1.2.2 From c12097fd9adb07810fb28f70df5462c0603463cc Mon Sep 17 00:00:00 2001 From: Michael Schimek Date: Tue, 8 Nov 2005 21:38:24 -0800 Subject: [PATCH] v4l: 876: moved some user defines to be out of kernel define - Moved some user defines to be out of __KERNEL__ define. Signed-off-by: Michael Schimek Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/videodev2.h | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index cbe15edbe668..e8a0d22df54f 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -31,6 +31,21 @@ #define VIDEO_MAX_FRAME 32 +#define VID_TYPE_CAPTURE 1 /* Can capture */ +#define VID_TYPE_TUNER 2 /* Can tune */ +#define VID_TYPE_TELETEXT 4 /* Does teletext */ +#define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */ +#define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */ +#define VID_TYPE_CLIPPING 32 /* Can clip */ +#define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */ +#define VID_TYPE_SCALES 128 /* Scalable */ +#define VID_TYPE_MONOCHROME 256 /* Monochrome only */ +#define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */ +#define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */ +#define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */ +#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */ +#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */ + #ifdef __KERNEL__ #define VFL_TYPE_GRABBER 0 @@ -72,21 +87,6 @@ struct video_device #define VIDEO_MAJOR 81 -#define VID_TYPE_CAPTURE 1 /* Can capture */ -#define VID_TYPE_TUNER 2 /* Can tune */ -#define VID_TYPE_TELETEXT 4 /* Does teletext */ -#define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */ -#define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */ -#define VID_TYPE_CLIPPING 32 /* Can clip */ -#define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */ -#define VID_TYPE_SCALES 128 /* Scalable */ -#define VID_TYPE_MONOCHROME 256 /* Monochrome only */ -#define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */ -#define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */ -#define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */ -#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */ -#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */ - extern int video_register_device(struct video_device *, int type, int nr); extern void video_unregister_device(struct video_device *); extern int video_usercopy(struct inode *inode, struct file *file, -- cgit v1.2.2 From f7abcd385cc8a5a2f75b07c8325067ea2785ba1e Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:38:25 -0800 Subject: [PATCH] v4l: 877: module em2820 renamed to em28xx and moved to v4l dir - Module em2820 renamed to em28xx and moved to V4L dir. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/em28xx/em28xx-cards.c | 11 ++++----- drivers/media/video/em28xx/em28xx-core.c | 9 ++++--- drivers/media/video/em28xx/em28xx-i2c.c | 11 ++++----- drivers/media/video/em28xx/em28xx-input.c | 39 +++++++++++++++++-------------- drivers/media/video/em28xx/em28xx-video.c | 22 ++++++++--------- 5 files changed, 46 insertions(+), 46 deletions(-) diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index 32c2c7fdad2c..ecfc8a3374db 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c @@ -1,11 +1,10 @@ /* - em2820-cards.c - driver for Empia EM2800/EM2820/2840 USB video capture devices + em28xx-cards.c - driver for Empia EM2800/EM2820/2840 USB video capture devices - Copyright (C) 2005 Markus Rechberger - Ludovico Cavedon + Copyright (C) 2005 Ludovico Cavedon + Markus Rechberger Mauro Carvalho Chehab - - Based on the em2800 driver from Sascha Sommer + Sascha Sommer 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 @@ -33,7 +32,7 @@ #include #include "msp3400.h" -#include "em2820.h" +#include "em28xx.h" struct em2820_board em2820_boards[] = { [EM2800_BOARD_UNKNOWN] = { diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index 442d50d7f320..e5aae4fa818a 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c @@ -1,11 +1,10 @@ /* em2820-core.c - driver for Empia EM2800/EM2820/2840 USB video capture devices - Copyright (C) 2005 Markus Rechberger - Ludovico Cavedon + Copyright (C) 2005 Ludovico Cavedon + Markus Rechberger Mauro Carvalho Chehab - - Based on the em2800 driver from Sascha Sommer + Sascha Sommer 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 @@ -29,7 +28,7 @@ #include #include -#include "em2820.h" +#include "em28xx.h" /* #define ENABLE_DEBUG_ISOC_FRAMES */ diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c index f0b386b4eb84..a62e66bd65f9 100644 --- a/drivers/media/video/em28xx/em28xx-i2c.c +++ b/drivers/media/video/em28xx/em28xx-i2c.c @@ -1,11 +1,10 @@ /* - em2820-i2c.c - driver for Empia EM2800/EM2820/2840 USB video capture devices + em28xx-i2c.c - driver for Empia EM2800/EM2820/2840 USB video capture devices - Copyright (C) 2005 Markus Rechberger - Ludovico Cavedon + Copyright (C) 2005 Ludovico Cavedon + Markus Rechberger Mauro Carvalho Chehab - - Based on the em2800 driver from Sascha Sommer + Sascha Sommer 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 @@ -28,7 +27,7 @@ #include #include -#include "em2820.h" +#include "em28xx.h" #include /* ----------------------------------------------------------- */ diff --git a/drivers/media/video/em28xx/em28xx-input.c b/drivers/media/video/em28xx/em28xx-input.c index e13585898f58..be7ba9b24d0d 100644 --- a/drivers/media/video/em28xx/em28xx-input.c +++ b/drivers/media/video/em28xx/em28xx-input.c @@ -1,21 +1,24 @@ /* - * - * handle saa7134 IR remotes via linux kernel input layer. - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * + handle em28xx IR remotes via linux kernel input layer. + + Copyright (C) 2005 Ludovico Cavedon + Markus Rechberger + Mauro Carvalho Chehab + Sascha Sommer + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include @@ -27,7 +30,7 @@ #include #include -#include "em2820.h" +#include "em28xx.h" static unsigned int disable_ir = 0; module_param(disable_ir, int, 0444); diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index d385149edd48..5ae896a1dcf6 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c @@ -1,11 +1,10 @@ /* - em2820-video.c - driver for Empia EM2800/EM2820/2840 USB video capture devices + em28xx-video.c - driver for Empia EM2800/EM2820/2840 USB video capture devices - Copyright (C) 2005 Markus Rechberger - Ludovico Cavedon + Copyright (C) 2005 Ludovico Cavedon + Markus Rechberger Mauro Carvalho Chehab - - Based on the em2800 driver from Sascha Sommer + Sascha Sommer 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 @@ -30,15 +29,16 @@ #include #include -#include "em2820.h" +#include "em28xx.h" #include -#define DRIVER_AUTHOR "Markus Rechberger , " \ - "Ludovico Cavedon , " \ - "Mauro Carvalho Chehab " +#define DRIVER_AUTHOR "Ludovico Cavedon , " \ + "Markus Rechberger , " \ + "Mauro Carvalho Chehab , " \ + "Sascha Sommer " -#define DRIVER_NAME "em2820" -#define DRIVER_DESC "Empia em2820 based USB video device driver" +#define DRIVER_NAME "em28xx" +#define DRIVER_DESC "Empia em28xx based USB video device driver" #define EM2820_VERSION_CODE KERNEL_VERSION(0, 0, 1) #define em2820_videodbg(fmt, arg...) do {\ -- cgit v1.2.2 From 710a72589a6727973405fd3580d7c724ba709296 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 8 Nov 2005 21:38:25 -0800 Subject: [PATCH] v4l: 881: video cx88 need not depend on experimental - VIDEO_CX88 need not depend on EXPERIMENTAL Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/cx88/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/video/cx88/Kconfig b/drivers/media/video/cx88/Kconfig index 1c9009589d11..41818b6205b3 100644 --- a/drivers/media/video/cx88/Kconfig +++ b/drivers/media/video/cx88/Kconfig @@ -1,6 +1,6 @@ config VIDEO_CX88 tristate "Conexant 2388x (bt878 successor) support" - depends on VIDEO_DEV && PCI && I2C && EXPERIMENTAL + depends on VIDEO_DEV && PCI && I2C select I2C_ALGOBIT select FW_LOADER select VIDEO_BTCX -- cgit v1.2.2 From e0ec29b7e5aa1f4f1ff73ebd3003336dbe83e174 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 8 Nov 2005 21:38:26 -0800 Subject: [PATCH] v4l: 885: second round of i2c ids redefinition cleanup - Second round of i2c IDs redefinition cleanup. Signed-off-by: Jean Delvare Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/bt832.c | 1 - drivers/media/video/msp3400.c | 1 - drivers/media/video/saa6588.c | 1 - drivers/media/video/saa7134/saa6752hs.c | 1 - drivers/media/video/saa7134/saa7134.h | 1 - drivers/media/video/tda7432.c | 1 - drivers/media/video/tda9875.c | 1 - drivers/media/video/tda9887.c | 1 - drivers/media/video/tvaudio.c | 3 +-- drivers/media/video/tveeprom.c | 4 ---- include/linux/i2c-id.h | 11 +++++++---- 11 files changed, 8 insertions(+), 18 deletions(-) diff --git a/drivers/media/video/bt832.c b/drivers/media/video/bt832.c index 3e42493a4e0a..e4063950ae57 100644 --- a/drivers/media/video/bt832.c +++ b/drivers/media/video/bt832.c @@ -32,7 +32,6 @@ #include #include -#include #include "bttv.h" #include "bt832.h" diff --git a/drivers/media/video/msp3400.c b/drivers/media/video/msp3400.c index ba2c95842fba..d603229c9f2f 100644 --- a/drivers/media/video/msp3400.c +++ b/drivers/media/video/msp3400.c @@ -54,7 +54,6 @@ #include #include -#include #include "msp3400.h" #define OPMODE_AUTO -1 diff --git a/drivers/media/video/saa6588.c b/drivers/media/video/saa6588.c index 5252a4ca3fd1..23ea548a71e0 100644 --- a/drivers/media/video/saa6588.c +++ b/drivers/media/video/saa6588.c @@ -31,7 +31,6 @@ #include #include -#include #include "rds.h" diff --git a/drivers/media/video/saa7134/saa6752hs.c b/drivers/media/video/saa7134/saa6752hs.c index 2bf5cf79eec1..cdd1ed9c8065 100644 --- a/drivers/media/video/saa7134/saa6752hs.c +++ b/drivers/media/video/saa7134/saa6752hs.c @@ -13,7 +13,6 @@ #include #include -#include #define MPEG_VIDEO_TARGET_BITRATE_MAX 27000 #define MPEG_VIDEO_MAX_BITRATE_MAX 27000 diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index 1365f1f32fee..4273ded9d174 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h @@ -34,7 +34,6 @@ #include #include -#include #include #include #include diff --git a/drivers/media/video/tda7432.c b/drivers/media/video/tda7432.c index 14cf1d357c3b..d32737dd2142 100644 --- a/drivers/media/video/tda7432.c +++ b/drivers/media/video/tda7432.c @@ -50,7 +50,6 @@ #include "bttv.h" #include -#include #ifndef VIDEO_AUDIO_BALANCE # define VIDEO_AUDIO_BALANCE 32 diff --git a/drivers/media/video/tda9875.c b/drivers/media/video/tda9875.c index 5a9faefc3640..a5e37dc91f39 100644 --- a/drivers/media/video/tda9875.c +++ b/drivers/media/video/tda9875.c @@ -32,7 +32,6 @@ #include "bttv.h" #include -#include static int debug; /* insmod parameter */ module_param(debug, int, S_IRUGO | S_IWUSR); diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c index 9d6b6f57abcd..4249127c0a1d 100644 --- a/drivers/media/video/tda9887.c +++ b/drivers/media/video/tda9887.c @@ -11,7 +11,6 @@ #include #include -#include /* Chips: TDA9885 (PAL, NTSC) diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c index 75901b030730..c31bf28b73fe 100644 --- a/drivers/media/video/tvaudio.c +++ b/drivers/media/video/tvaudio.c @@ -31,7 +31,6 @@ #include #include -#include #include "tvaudio.h" @@ -1438,7 +1437,7 @@ static struct CHIPDESC chiplist[] = { }, { .name = "pic16c54 (PV951)", - .id = I2C_DRIVERID_PIC16C54_PV951, + .id = I2C_DRIVERID_PIC16C54_PV9, .insmodopt = &pic16c54, .addr_lo = I2C_PIC16C54 >> 1, .addr_hi = I2C_PIC16C54>> 1, diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c index d83a33618119..72e8741e8b59 100644 --- a/drivers/media/video/tveeprom.c +++ b/drivers/media/video/tveeprom.c @@ -658,10 +658,6 @@ EXPORT_SYMBOL(tveeprom_read); /* run, just call the exported tveeprom_* directly, there is no point in */ /* using the indirect way via i2c_driver->command() */ -#ifndef I2C_DRIVERID_TVEEPROM -# define I2C_DRIVERID_TVEEPROM I2C_DRIVERID_EXP2 -#endif - static unsigned short normal_i2c[] = { 0xa0 >> 1, I2C_CLIENT_END, diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h index 1ce4b54caa21..815675f1e349 100644 --- a/include/linux/i2c-id.h +++ b/include/linux/i2c-id.h @@ -27,10 +27,10 @@ * ---- Driver types ----------------------------------------------------- * device id name + number function description, i2c address(es) * - * Range 1000-1999 range is defined in sensors/sensors.h - * Range 0x100 - 0x1ff is for V4L2 Common Components + * Range 1000-1999 range is defined in sensors/sensors.h + * Range 0x100 - 0x1ff is for V4L2 Common Components * Range 0xf000 - 0xffff is reserved for local experimentation, and should - * never be used in official drivers + * never be used in official drivers */ #define I2C_DRIVERID_MSP3400 1 @@ -99,6 +99,9 @@ #define I2C_DRIVERID_MAX6900 63 /* MAX6900 real-time clock */ #define I2C_DRIVERID_SAA7114H 64 /* video decoder */ #define I2C_DRIVERID_DS1374 65 /* DS1374 real time clock */ +#define I2C_DRIVERID_TDA9874 66 /* TV sound decoder */ +#define I2C_DRIVERID_SAA6752HS 67 /* MPEG2 encoder */ +#define I2C_DRIVERID_TVEEPROM 68 /* TV EEPROM */ #define I2C_DRIVERID_EXP0 0xF0 /* experimental use id's */ @@ -111,7 +114,7 @@ #define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */ #define I2C_DRIVERID_ALERT 903 /* SMBus Alert Responder Client */ -/* IDs -- Use DRIVERIDs 1000-1999 for sensors. +/* IDs -- Use DRIVERIDs 1000-1999 for sensors. These were originally in sensors.h in the lm_sensors package */ #define I2C_DRIVERID_LM78 1002 #define I2C_DRIVERID_LM75 1003 -- cgit v1.2.2 From 3acf28095009509c9ca1e283de821b5be9ddede6 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:38:27 -0800 Subject: [PATCH] v4l: 886: renamed common structures to em28xx - Renamed common structures to em28xx Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/em28xx/em28xx-cards.c | 94 ++--- drivers/media/video/em28xx/em28xx-core.c | 274 +++++++------- drivers/media/video/em28xx/em28xx-i2c.c | 128 +++---- drivers/media/video/em28xx/em28xx-input.c | 4 +- drivers/media/video/em28xx/em28xx-video.c | 601 +++++++++++++++--------------- drivers/media/video/em28xx/em28xx.h | 270 +++++++------- 6 files changed, 686 insertions(+), 685 deletions(-) diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index ecfc8a3374db..49107fd0c0d3 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c @@ -34,7 +34,7 @@ #include "em28xx.h" -struct em2820_board em2820_boards[] = { +struct em28xx_board em28xx_boards[] = { [EM2800_BOARD_UNKNOWN] = { .name = "Unknown EM2800 video grabber", .is_em2800 = 1, @@ -42,13 +42,13 @@ struct em2820_board em2820_boards[] = { .norm = VIDEO_MODE_PAL, .tda9887_conf = TDA9887_PRESENT, .has_tuner = 1, - .decoder = EM2820_SAA7113, + .decoder = EM28XX_SAA7113, .input = {{ - .type = EM2820_VMUX_COMPOSITE1, + .type = EM28XX_VMUX_COMPOSITE1, .vmux = 0, .amux = 1, },{ - .type = EM2820_VMUX_SVIDEO, + .type = EM28XX_VMUX_SVIDEO, .vmux = 9, .amux = 1, }}, @@ -60,13 +60,13 @@ struct em2820_board em2820_boards[] = { .norm = VIDEO_MODE_PAL, .tda9887_conf = TDA9887_PRESENT, .has_tuner = 1, - .decoder = EM2820_SAA7113, + .decoder = EM28XX_SAA7113, .input = {{ - .type = EM2820_VMUX_COMPOSITE1, + .type = EM28XX_VMUX_COMPOSITE1, .vmux = 0, .amux = 1, },{ - .type = EM2820_VMUX_SVIDEO, + .type = EM28XX_VMUX_SVIDEO, .vmux = 9, .amux = 1, }}, @@ -78,17 +78,17 @@ struct em2820_board em2820_boards[] = { .tuner_type = TUNER_LG_PAL_NEW_TAPC, .tda9887_conf = TDA9887_PRESENT, .has_tuner = 1, - .decoder = EM2820_SAA7113, + .decoder = EM28XX_SAA7113, .input = {{ - .type = EM2820_VMUX_TELEVISION, + .type = EM28XX_VMUX_TELEVISION, .vmux = 2, .amux = 0, },{ - .type = EM2820_VMUX_COMPOSITE1, + .type = EM28XX_VMUX_COMPOSITE1, .vmux = 0, .amux = 1, },{ - .type = EM2820_VMUX_SVIDEO, + .type = EM28XX_VMUX_SVIDEO, .vmux = 9, .amux = 1, }}, @@ -100,17 +100,17 @@ struct em2820_board em2820_boards[] = { .tuner_type = TUNER_LG_PAL_NEW_TAPC, .tda9887_conf = TDA9887_PRESENT, .has_tuner = 1, - .decoder = EM2820_SAA7113, + .decoder = EM28XX_SAA7113, .input = {{ - .type = EM2820_VMUX_TELEVISION, + .type = EM28XX_VMUX_TELEVISION, .vmux = 2, .amux = 0, },{ - .type = EM2820_VMUX_COMPOSITE1, + .type = EM28XX_VMUX_COMPOSITE1, .vmux = 0, .amux = 1, },{ - .type = EM2820_VMUX_SVIDEO, + .type = EM28XX_VMUX_SVIDEO, .vmux = 9, .amux = 1, }}, @@ -122,15 +122,15 @@ struct em2820_board em2820_boards[] = { .tuner_type = TUNER_PHILIPS_FM1236_MK3, .tda9887_conf = TDA9887_PRESENT|TDA9887_PORT1_ACTIVE|TDA9887_PORT2_ACTIVE, .has_tuner = 1, - .decoder = EM2820_TVP5150, + .decoder = EM28XX_TVP5150, .has_msp34xx = 1, /*FIXME: S-Video not tested */ .input = {{ - .type = EM2820_VMUX_TELEVISION, + .type = EM28XX_VMUX_TELEVISION, .vmux = 0, .amux = 0, },{ - .type = EM2820_VMUX_SVIDEO, + .type = EM28XX_VMUX_SVIDEO, .vmux = 2, .amux = 1, }}, @@ -142,17 +142,17 @@ struct em2820_board em2820_boards[] = { .tuner_type = TUNER_LG_PAL_NEW_TAPC, .tda9887_conf = TDA9887_PRESENT|TDA9887_PORT1_ACTIVE|TDA9887_PORT2_ACTIVE, .has_tuner = 1, - .decoder = EM2820_SAA7114, + .decoder = EM28XX_SAA7114, .input = {{ - .type = EM2820_VMUX_TELEVISION, + .type = EM28XX_VMUX_TELEVISION, .vmux = 4, .amux = 0, },{ - .type = EM2820_VMUX_COMPOSITE1, + .type = EM28XX_VMUX_COMPOSITE1, .vmux = 0, .amux = 1, },{ - .type = EM2820_VMUX_SVIDEO, + .type = EM28XX_VMUX_SVIDEO, .vmux = 9, .amux = 1, }}, @@ -165,17 +165,17 @@ struct em2820_board em2820_boards[] = { .tuner_type = TUNER_LG_PAL_NEW_TAPC, .tda9887_conf = TDA9887_PRESENT, .has_tuner = 1, - .decoder = EM2820_SAA7113, + .decoder = EM28XX_SAA7113, .input = {{ - .type = EM2820_VMUX_TELEVISION, + .type = EM28XX_VMUX_TELEVISION, .vmux = 2, .amux = 0, },{ - .type = EM2820_VMUX_COMPOSITE1, + .type = EM28XX_VMUX_COMPOSITE1, .vmux = 0, .amux = 1, },{ - .type = EM2820_VMUX_SVIDEO, + .type = EM28XX_VMUX_SVIDEO, .vmux = 9, .amux = 1, }}, @@ -188,17 +188,17 @@ struct em2820_board em2820_boards[] = { .tuner_type = TUNER_LG_PAL_NEW_TAPC, .tda9887_conf = TDA9887_PRESENT, .has_tuner = 1, - .decoder = EM2820_SAA7113, + .decoder = EM28XX_SAA7113, .input = {{ - .type = EM2820_VMUX_TELEVISION, + .type = EM28XX_VMUX_TELEVISION, .vmux = 2, .amux = 0, },{ - .type = EM2820_VMUX_COMPOSITE1, + .type = EM28XX_VMUX_COMPOSITE1, .vmux = 0, .amux = 1, },{ - .type = EM2820_VMUX_SVIDEO, + .type = EM28XX_VMUX_SVIDEO, .vmux = 9, .amux = 1, }}, @@ -211,17 +211,17 @@ struct em2820_board em2820_boards[] = { .tuner_type = TUNER_PHILIPS_ATSC, .tda9887_conf = TDA9887_PRESENT, .has_tuner = 1, - .decoder = EM2820_SAA7113, + .decoder = EM28XX_SAA7113, .input = {{ - .type = EM2820_VMUX_TELEVISION, + .type = EM28XX_VMUX_TELEVISION, .vmux = 2, .amux = 0, },{ - .type = EM2820_VMUX_COMPOSITE1, + .type = EM28XX_VMUX_COMPOSITE1, .vmux = 0, .amux = 1, },{ - .type = EM2820_VMUX_SVIDEO, + .type = EM28XX_VMUX_SVIDEO, .vmux = 9, .amux = 1, }}, @@ -231,22 +231,22 @@ struct em2820_board em2820_boards[] = { .vchannels = 3, .norm = VIDEO_MODE_PAL, .has_tuner = 0, - .decoder = EM2820_SAA7113, + .decoder = EM28XX_SAA7113, .input = {{ - .type = EM2820_VMUX_COMPOSITE1, + .type = EM28XX_VMUX_COMPOSITE1, .vmux = 0, .amux = 1, },{ - .type = EM2820_VMUX_SVIDEO, + .type = EM28XX_VMUX_SVIDEO, .vmux = 9, .amux = 1, }}, }, }; -const unsigned int em2820_bcount = ARRAY_SIZE(em2820_boards); +const unsigned int em28xx_bcount = ARRAY_SIZE(em28xx_boards); /* table of devices that work with this driver */ -struct usb_device_id em2820_id_table [] = { +struct usb_device_id em28xx_id_table [] = { { USB_DEVICE(0xeb1a, 0x2800), .driver_info = EM2800_BOARD_UNKNOWN }, { USB_DEVICE(0xeb1a, 0x2820), .driver_info = EM2820_BOARD_MSI_VOX_USB_2 }, { USB_DEVICE(0x0ccd, 0x0036), .driver_info = EM2820_BOARD_TERRATEC_CINERGY_250 }, @@ -256,7 +256,7 @@ struct usb_device_id em2820_id_table [] = { { }, }; -void em2820_card_setup(struct em2820 *dev) +void em28xx_card_setup(struct em28xx *dev) { /* request some modules */ if (dev->model == EM2820_BOARD_HAUPPAUGE_WINTV_USB_2) { @@ -274,14 +274,14 @@ void em2820_card_setup(struct em2820 *dev) if (tv.audio_processor == AUDIO_CHIP_MSP34XX) { dev->has_msp34xx=1; } else dev->has_msp34xx=0; - em2820_write_regs_req(dev,0x06,0x00,"\x40",1);// Serial Bus Frequency Select Register - em2820_write_regs_req(dev,0x0f,0x00,"\x87",1);// XCLK Frequency Select Register - em2820_write_regs_req(dev,0x88,0x0d,"\xd0",1); + em28xx_write_regs_req(dev,0x06,0x00,"\x40",1);// Serial Bus Frequency Select Register + em28xx_write_regs_req(dev,0x0f,0x00,"\x87",1);// XCLK Frequency Select Register + em28xx_write_regs_req(dev,0x88,0x0d,"\xd0",1); } } -EXPORT_SYMBOL(em2820_boards); -EXPORT_SYMBOL(em2820_bcount); -EXPORT_SYMBOL(em2820_id_table); +EXPORT_SYMBOL(em28xx_boards); +EXPORT_SYMBOL(em28xx_bcount); +EXPORT_SYMBOL(em28xx_id_table); -MODULE_DEVICE_TABLE (usb, em2820_id_table); +MODULE_DEVICE_TABLE (usb, em28xx_id_table); diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index e5aae4fa818a..045547e17656 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c @@ -1,5 +1,5 @@ /* - em2820-core.c - driver for Empia EM2800/EM2820/2840 USB video capture devices + em28xx-core.c - driver for Empia EM2800/EM2820/2840 USB video capture devices Copyright (C) 2005 Ludovico Cavedon Markus Rechberger @@ -36,7 +36,7 @@ unsigned int core_debug; module_param(core_debug,int,0644); MODULE_PARM_DESC(core_debug,"enable debug messages [core]"); -#define em2820_coredbg(fmt, arg...) do {\ +#define em28xx_coredbg(fmt, arg...) do {\ if (core_debug) \ printk(KERN_INFO "%s %s :"fmt, \ dev->name, __FUNCTION__ , ##arg); } while (0) @@ -45,7 +45,7 @@ unsigned int reg_debug; module_param(reg_debug,int,0644); MODULE_PARM_DESC(reg_debug,"enable debug messages [URB reg]"); -#define em2820_regdbg(fmt, arg...) do {\ +#define em28xx_regdbg(fmt, arg...) do {\ if (reg_debug) \ printk(KERN_INFO "%s %s :"fmt, \ dev->name, __FUNCTION__ , ##arg); } while (0) @@ -54,12 +54,12 @@ unsigned int isoc_debug; module_param(isoc_debug,int,0644); MODULE_PARM_DESC(isoc_debug,"enable debug messages [isoc transfers]"); -#define em2820_isocdbg(fmt, arg...) do {\ +#define em28xx_isocdbg(fmt, arg...) do {\ if (isoc_debug) \ printk(KERN_INFO "%s %s :"fmt, \ dev->name, __FUNCTION__ , ##arg); } while (0) -static int alt = EM2820_PINOUT; +static int alt = EM28XX_PINOUT; module_param(alt, int, 0644); MODULE_PARM_DESC(alt, "alternate setting to use for video endpoint"); @@ -88,7 +88,7 @@ static const char *v4l2_ioctls[] = { }; #define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls) -void em2820_print_ioctl(char *name, unsigned int cmd) +void em28xx_print_ioctl(char *name, unsigned int cmd) { char *dir; @@ -159,17 +159,17 @@ static void rvfree(void *mem, size_t size) } /* - * em2820_request_buffers() + * em28xx_request_buffers() * allocate a number of buffers */ -u32 em2820_request_buffers(struct em2820 *dev, u32 count) +u32 em28xx_request_buffers(struct em28xx *dev, u32 count) { const size_t imagesize = PAGE_ALIGN(dev->frame_size); /*needs to be page aligned cause the buffers can be mapped individually! */ void *buff = NULL; u32 i; - em2820_coredbg("requested %i buffers with size %i", count, imagesize); - if (count > EM2820_NUM_FRAMES) - count = EM2820_NUM_FRAMES; + em28xx_coredbg("requested %i buffers with size %i", count, imagesize); + if (count > EM28XX_NUM_FRAMES) + count = EM28XX_NUM_FRAMES; dev->num_frames = count; while (dev->num_frames > 0) { @@ -193,10 +193,10 @@ u32 em2820_request_buffers(struct em2820 *dev, u32 count) } /* - * em2820_queue_unusedframes() + * em28xx_queue_unusedframes() * add all frames that are not currently in use to the inbuffer queue */ -void em2820_queue_unusedframes(struct em2820 *dev) +void em28xx_queue_unusedframes(struct em28xx *dev) { unsigned long lock_flags; u32 i; @@ -211,10 +211,10 @@ void em2820_queue_unusedframes(struct em2820 *dev) } /* - * em2820_release_buffers() + * em28xx_release_buffers() * free frame buffers */ -void em2820_release_buffers(struct em2820 *dev) +void em28xx_release_buffers(struct em28xx *dev) { if (dev->num_frames) { rvfree(dev->frame[0].bufmem, @@ -224,15 +224,15 @@ void em2820_release_buffers(struct em2820 *dev) } /* - * em2820_read_reg_req() + * em28xx_read_reg_req() * reads data from the usb device specifying bRequest */ -int em2820_read_reg_req_len(struct em2820 *dev, u8 req, u16 reg, +int em28xx_read_reg_req_len(struct em28xx *dev, u8 req, u16 reg, char *buf, int len) { int ret, byte; - em2820_regdbg("req=%02x, reg=%02x ", req, reg); + em28xx_regdbg("req=%02x, reg=%02x ", req, reg); ret = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), req, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, @@ -250,15 +250,15 @@ int em2820_read_reg_req_len(struct em2820 *dev, u8 req, u16 reg, } /* - * em2820_read_reg_req() + * em28xx_read_reg_req() * reads data from the usb device specifying bRequest */ -int em2820_read_reg_req(struct em2820 *dev, u8 req, u16 reg) +int em28xx_read_reg_req(struct em28xx *dev, u8 req, u16 reg) { u8 val; int ret; - em2820_regdbg("req=%02x, reg=%02x:", req, reg); + em28xx_regdbg("req=%02x, reg=%02x:", req, reg); ret = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), req, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, @@ -273,16 +273,16 @@ int em2820_read_reg_req(struct em2820 *dev, u8 req, u16 reg) return val; } -int em2820_read_reg(struct em2820 *dev, u16 reg) +int em28xx_read_reg(struct em28xx *dev, u16 reg) { - return em2820_read_reg_req(dev, USB_REQ_GET_STATUS, reg); + return em28xx_read_reg_req(dev, USB_REQ_GET_STATUS, reg); } /* - * em2820_write_regs_req() + * em28xx_write_regs_req() * sends data to the usb device, specifying bRequest */ -int em2820_write_regs_req(struct em2820 *dev, u8 req, u16 reg, char *buf, +int em28xx_write_regs_req(struct em28xx *dev, u8 req, u16 reg, char *buf, int len) { int ret; @@ -290,7 +290,7 @@ int em2820_write_regs_req(struct em2820 *dev, u8 req, u16 reg, char *buf, /*usb_control_msg seems to expect a kmalloced buffer */ unsigned char *bufs = kmalloc(len, GFP_KERNEL); - em2820_regdbg("req=%02x reg=%02x:", req, reg); + em28xx_regdbg("req=%02x reg=%02x:", req, reg); if (reg_debug) { int i; @@ -310,124 +310,124 @@ int em2820_write_regs_req(struct em2820 *dev, u8 req, u16 reg, char *buf, return ret; } -int em2820_write_regs(struct em2820 *dev, u16 reg, char *buf, int len) +int em28xx_write_regs(struct em28xx *dev, u16 reg, char *buf, int len) { - return em2820_write_regs_req(dev, USB_REQ_GET_STATUS, reg, buf, len); + return em28xx_write_regs_req(dev, USB_REQ_GET_STATUS, reg, buf, len); } /* - * em2820_write_reg_bits() + * em28xx_write_reg_bits() * sets only some bits (specified by bitmask) of a register, by first reading * the actual value */ -int em2820_write_reg_bits(struct em2820 *dev, u16 reg, u8 val, +int em28xx_write_reg_bits(struct em28xx *dev, u16 reg, u8 val, u8 bitmask) { int oldval; u8 newval; - if ((oldval = em2820_read_reg(dev, reg)) < 0) + if ((oldval = em28xx_read_reg(dev, reg)) < 0) return oldval; newval = (((u8) oldval) & ~bitmask) | (val & bitmask); - return em2820_write_regs(dev, reg, &newval, 1); + return em28xx_write_regs(dev, reg, &newval, 1); } /* - * em2820_write_ac97() + * em28xx_write_ac97() * write a 16 bit value to the specified AC97 address (LSB first!) */ -int em2820_write_ac97(struct em2820 *dev, u8 reg, u8 * val) +int em28xx_write_ac97(struct em28xx *dev, u8 reg, u8 * val) { int ret; u8 addr = reg & 0x7f; - if ((ret = em2820_write_regs(dev, AC97LSB_REG, val, 2)) < 0) + if ((ret = em28xx_write_regs(dev, AC97LSB_REG, val, 2)) < 0) return ret; - if ((ret = em2820_write_regs(dev, AC97ADDR_REG, &addr, 1)) < 0) + if ((ret = em28xx_write_regs(dev, AC97ADDR_REG, &addr, 1)) < 0) return ret; - if ((ret = em2820_read_reg(dev, AC97BUSY_REG)) < 0) + if ((ret = em28xx_read_reg(dev, AC97BUSY_REG)) < 0) return ret; else if (((u8) ret) & 0x01) { - em2820_warn ("AC97 command still being exectuted: not handled properly!\n"); + em28xx_warn ("AC97 command still being exectuted: not handled properly!\n"); } return 0; } -int em2820_audio_analog_set(struct em2820 *dev) +int em28xx_audio_analog_set(struct em28xx *dev) { char s[2] = { 0x00, 0x00 }; s[0] |= 0x1f - dev->volume; s[1] |= 0x1f - dev->volume; if (dev->mute) s[1] |= 0x80; - return em2820_write_ac97(dev, MASTER_AC97, s); + return em28xx_write_ac97(dev, MASTER_AC97, s); } -int em2820_colorlevels_set_default(struct em2820 *dev) +int em28xx_colorlevels_set_default(struct em28xx *dev) { - em2820_write_regs(dev, YGAIN_REG, "\x10", 1); /* contrast */ - em2820_write_regs(dev, YOFFSET_REG, "\x00", 1); /* brightness */ - em2820_write_regs(dev, UVGAIN_REG, "\x10", 1); /* saturation */ - em2820_write_regs(dev, UOFFSET_REG, "\x00", 1); - em2820_write_regs(dev, VOFFSET_REG, "\x00", 1); - em2820_write_regs(dev, SHARPNESS_REG, "\x00", 1); - - em2820_write_regs(dev, GAMMA_REG, "\x20", 1); - em2820_write_regs(dev, RGAIN_REG, "\x20", 1); - em2820_write_regs(dev, GGAIN_REG, "\x20", 1); - em2820_write_regs(dev, BGAIN_REG, "\x20", 1); - em2820_write_regs(dev, ROFFSET_REG, "\x00", 1); - em2820_write_regs(dev, GOFFSET_REG, "\x00", 1); - return em2820_write_regs(dev, BOFFSET_REG, "\x00", 1); + em28xx_write_regs(dev, YGAIN_REG, "\x10", 1); /* contrast */ + em28xx_write_regs(dev, YOFFSET_REG, "\x00", 1); /* brightness */ + em28xx_write_regs(dev, UVGAIN_REG, "\x10", 1); /* saturation */ + em28xx_write_regs(dev, UOFFSET_REG, "\x00", 1); + em28xx_write_regs(dev, VOFFSET_REG, "\x00", 1); + em28xx_write_regs(dev, SHARPNESS_REG, "\x00", 1); + + em28xx_write_regs(dev, GAMMA_REG, "\x20", 1); + em28xx_write_regs(dev, RGAIN_REG, "\x20", 1); + em28xx_write_regs(dev, GGAIN_REG, "\x20", 1); + em28xx_write_regs(dev, BGAIN_REG, "\x20", 1); + em28xx_write_regs(dev, ROFFSET_REG, "\x00", 1); + em28xx_write_regs(dev, GOFFSET_REG, "\x00", 1); + return em28xx_write_regs(dev, BOFFSET_REG, "\x00", 1); } -int em2820_capture_start(struct em2820 *dev, int start) +int em28xx_capture_start(struct em28xx *dev, int start) { int ret; /* FIXME: which is the best order? */ /* video registers are sampled by VREF */ - if ((ret = em2820_write_reg_bits(dev, USBSUSP_REG, start ? 0x10 : 0x00, + if ((ret = em28xx_write_reg_bits(dev, USBSUSP_REG, start ? 0x10 : 0x00, 0x10)) < 0) return ret; /* enable video capture */ - return em2820_write_regs(dev, VINENABLE_REG, start ? "\x67" : "\x27", 1); + return em28xx_write_regs(dev, VINENABLE_REG, start ? "\x67" : "\x27", 1); } -int em2820_outfmt_set_yuv422(struct em2820 *dev) +int em28xx_outfmt_set_yuv422(struct em28xx *dev) { - em2820_write_regs(dev, OUTFMT_REG, "\x34", 1); - em2820_write_regs(dev, VINMODE_REG, "\x10", 1); - return em2820_write_regs(dev, VINCTRL_REG, "\x11", 1); + em28xx_write_regs(dev, OUTFMT_REG, "\x34", 1); + em28xx_write_regs(dev, VINMODE_REG, "\x10", 1); + return em28xx_write_regs(dev, VINCTRL_REG, "\x11", 1); } -int em2820_accumulator_set(struct em2820 *dev, u8 xmin, u8 xmax, u8 ymin, +int em28xx_accumulator_set(struct em28xx *dev, u8 xmin, u8 xmax, u8 ymin, u8 ymax) { - em2820_coredbg("em2820 Scale: (%d,%d)-(%d,%d)\n", xmin, ymin, xmax, ymax); + em28xx_coredbg("em28xx Scale: (%d,%d)-(%d,%d)\n", xmin, ymin, xmax, ymax); - em2820_write_regs(dev, XMIN_REG, &xmin, 1); - em2820_write_regs(dev, XMAX_REG, &xmax, 1); - em2820_write_regs(dev, YMIN_REG, &ymin, 1); - return em2820_write_regs(dev, YMAX_REG, &ymax, 1); + em28xx_write_regs(dev, XMIN_REG, &xmin, 1); + em28xx_write_regs(dev, XMAX_REG, &xmax, 1); + em28xx_write_regs(dev, YMIN_REG, &ymin, 1); + return em28xx_write_regs(dev, YMAX_REG, &ymax, 1); } -int em2820_capture_area_set(struct em2820 *dev, u8 hstart, u8 vstart, +int em28xx_capture_area_set(struct em28xx *dev, u8 hstart, u8 vstart, u16 width, u16 height) { u8 cwidth = width; u8 cheight = height; u8 overflow = (height >> 7 & 0x02) | (width >> 8 & 0x01); - em2820_coredbg("em2820 Area Set: (%d,%d)\n", (width | (overflow & 2) << 7), + em28xx_coredbg("em28xx Area Set: (%d,%d)\n", (width | (overflow & 2) << 7), (height | (overflow & 1) << 8)); - em2820_write_regs(dev, HSTART_REG, &hstart, 1); - em2820_write_regs(dev, VSTART_REG, &vstart, 1); - em2820_write_regs(dev, CWIDTH_REG, &cwidth, 1); - em2820_write_regs(dev, CHEIGHT_REG, &cheight, 1); - return em2820_write_regs(dev, OFLOW_REG, &overflow, 1); + em28xx_write_regs(dev, HSTART_REG, &hstart, 1); + em28xx_write_regs(dev, VSTART_REG, &vstart, 1); + em28xx_write_regs(dev, CWIDTH_REG, &cwidth, 1); + em28xx_write_regs(dev, CHEIGHT_REG, &cheight, 1); + return em28xx_write_regs(dev, OFLOW_REG, &overflow, 1); } -int em2820_scaler_set(struct em2820 *dev, u16 h, u16 v) +int em28xx_scaler_set(struct em28xx *dev, u16 h, u16 v) { u8 mode; /* the em2800 scaler only supports scaling down to 50% */ @@ -437,34 +437,34 @@ int em2820_scaler_set(struct em2820 *dev, u16 h, u16 v) u8 buf[2]; buf[0] = h; buf[1] = h >> 8; - em2820_write_regs(dev, HSCALELOW_REG, (char *)buf, 2); + em28xx_write_regs(dev, HSCALELOW_REG, (char *)buf, 2); buf[0] = v; buf[1] = v >> 8; - em2820_write_regs(dev, VSCALELOW_REG, (char *)buf, 2); + em28xx_write_regs(dev, VSCALELOW_REG, (char *)buf, 2); /* it seems that both H and V scalers must be active to work correctly */ mode = (h || v)? 0x30: 0x00; } - return em2820_write_reg_bits(dev, COMPR_REG, mode, 0x30); + return em28xx_write_reg_bits(dev, COMPR_REG, mode, 0x30); } /* FIXME: this only function read values from dev */ -int em2820_resolution_set(struct em2820 *dev) +int em28xx_resolution_set(struct em28xx *dev) { int width, height; width = norm_maxw(dev); height = norm_maxh(dev) >> 1; - em2820_outfmt_set_yuv422(dev); - em2820_accumulator_set(dev, 1, (width - 4) >> 2, 1, (height - 4) >> 2); - em2820_capture_area_set(dev, 0, 0, width >> 2, height >> 2); - return em2820_scaler_set(dev, dev->hscale, dev->vscale); + em28xx_outfmt_set_yuv422(dev); + em28xx_accumulator_set(dev, 1, (width - 4) >> 2, 1, (height - 4) >> 2); + em28xx_capture_area_set(dev, 0, 0, width >> 2, height >> 2); + return em28xx_scaler_set(dev, dev->hscale, dev->vscale); } /******************* isoc transfer handling ****************************/ #ifdef ENABLE_DEBUG_ISOC_FRAMES -static void em2820_isoc_dump(struct urb *urb, struct pt_regs *regs) +static void em28xx_isoc_dump(struct urb *urb, struct pt_regs *regs) { int len = 0; int ntrans = 0; @@ -503,7 +503,7 @@ static void em2820_isoc_dump(struct urb *urb, struct pt_regs *regs) } #endif -static inline int em2820_isoc_video(struct em2820 *dev,struct em2820_frame_t **f, +static inline int em28xx_isoc_video(struct em28xx *dev,struct em28xx_frame_t **f, unsigned long *lock_flags, unsigned char buf) { if (!(buf & 0x01)) { @@ -511,7 +511,7 @@ static inline int em2820_isoc_video(struct em2820 *dev,struct em2820_frame_t **f /*previous frame is incomplete */ if ((*f)->fieldbytesused < dev->field_size) { (*f)->state = F_ERROR; - em2820_isocdbg ("dropping incomplete bottom field (%i missing bytes)", + em28xx_isocdbg ("dropping incomplete bottom field (%i missing bytes)", dev->field_size-(*f)->fieldbytesused); } else { (*f)->state = F_DONE; @@ -524,13 +524,13 @@ static inline int em2820_isoc_video(struct em2820 *dev,struct em2820_frame_t **f list_move_tail(&(*f)->frame, &dev->outqueue); if (!list_empty(&dev->inqueue)) (*f) = list_entry(dev-> inqueue.next, - struct em2820_frame_t,frame); + struct em28xx_frame_t,frame); else (*f) = NULL; spin_unlock_irqrestore(&dev->queue_lock,*lock_flags); } if (!(*f)) { - em2820_isocdbg ("new frame but no buffer is free"); + em28xx_isocdbg ("new frame but no buffer is free"); return -1; } do_gettimeofday(&(*f)->buf.timestamp); @@ -545,10 +545,10 @@ static inline int em2820_isoc_video(struct em2820 *dev,struct em2820_frame_t **f if ((*f)->state == F_GRABBING) { if (!(*f)->top_field) { (*f)->state = F_ERROR; - em2820_isocdbg ("unexpected begin of bottom field; discarding it"); + em28xx_isocdbg ("unexpected begin of bottom field; discarding it"); } else if ((*f)-> fieldbytesused < dev->field_size - 172) { (*f)->state = F_ERROR; - em2820_isocdbg ("dropping incomplete top field (%i missing bytes)", + em28xx_isocdbg ("dropping incomplete top field (%i missing bytes)", dev->field_size-(*f)->fieldbytesused); } else { (*f)->top_field = 0; @@ -559,14 +559,14 @@ static inline int em2820_isoc_video(struct em2820 *dev,struct em2820_frame_t **f return (0); } -static inline void em2820_isoc_video_copy(struct em2820 *dev, - struct em2820_frame_t **f, unsigned char *buf, int len) +static inline void em28xx_isoc_video_copy(struct em28xx *dev, + struct em28xx_frame_t **f, unsigned char *buf, int len) { void *fieldstart, *startwrite, *startread; int linesdone, currlinedone, offset, lencopy,remain; if(dev->frame_size != (*f)->buf.length){ - em2820_err("frame_size %i and buf.length %i are different!!!\n",dev->frame_size,(*f)->buf.length); + em28xx_err("frame_size %i and buf.length %i are different!!!\n",dev->frame_size,(*f)->buf.length); return; } @@ -574,7 +574,7 @@ static inline void em2820_isoc_video_copy(struct em2820 *dev, len =dev->field_size - (*f)->fieldbytesused; if (buf[0] != 0x88 && buf[0] != 0x22) { - em2820_isocdbg("frame is not complete\n"); + em28xx_isocdbg("frame is not complete\n"); startread = buf; len+=4; } else @@ -613,21 +613,21 @@ static inline void em2820_isoc_video_copy(struct em2820 *dev, } /* - * em2820_isoIrq() + * em28xx_isoIrq() * handles the incoming isoc urbs and fills the frames from our inqueue */ -void em2820_isocIrq(struct urb *urb, struct pt_regs *regs) +void em28xx_isocIrq(struct urb *urb, struct pt_regs *regs) { - struct em2820 *dev = urb->context; + struct em28xx *dev = urb->context; int i, status; - struct em2820_frame_t **f; + struct em28xx_frame_t **f; unsigned long lock_flags; if (!dev) return; #ifdef ENABLE_DEBUG_ISOC_FRAMES if (isoc_debug>1) - em2820_isoc_dump(urb, regs); + em28xx_isoc_dump(urb, regs); #endif if (urb->status == -ENOENT) @@ -639,7 +639,7 @@ void em2820_isocIrq(struct urb *urb, struct pt_regs *regs) dev->stream = STREAM_OFF; if ((*f)) (*f)->state = F_QUEUED; - em2820_isocdbg("stream interrupted"); + em28xx_isocdbg("stream interrupted"); wake_up_interruptible(&dev->wait_stream); } @@ -649,7 +649,7 @@ void em2820_isocIrq(struct urb *urb, struct pt_regs *regs) if (dev->stream == STREAM_ON && !list_empty(&dev->inqueue)) { if (!(*f)) (*f) = list_entry(dev->inqueue.next, - struct em2820_frame_t, frame); + struct em28xx_frame_t, frame); for (i = 0; i < urb->number_of_packets; i++) { unsigned char *buf = urb->transfer_buffer + @@ -657,34 +657,34 @@ void em2820_isocIrq(struct urb *urb, struct pt_regs *regs) int len = urb->iso_frame_desc[i].actual_length - 4; if (urb->iso_frame_desc[i].status) { - em2820_isocdbg("data error: [%d] len=%d, status=%d", i, + em28xx_isocdbg("data error: [%d] len=%d, status=%d", i, urb->iso_frame_desc[i].actual_length, urb->iso_frame_desc[i].status); if (urb->iso_frame_desc[i].status != -EPROTO) continue; } if (urb->iso_frame_desc[i].actual_length <= 0) { - em2820_isocdbg("packet %d is empty",i); + em28xx_isocdbg("packet %d is empty",i); continue; } if (urb->iso_frame_desc[i].actual_length > dev->max_pkt_size) { - em2820_isocdbg("packet bigger than packet size"); + em28xx_isocdbg("packet bigger than packet size"); continue; } /*new frame */ if (buf[0] == 0x22 && buf[1] == 0x5a) { - em2820_isocdbg("Video frame, length=%i!",len); + em28xx_isocdbg("Video frame, length=%i!",len); - if (em2820_isoc_video(dev,f,&lock_flags,buf[2])) + if (em28xx_isoc_video(dev,f,&lock_flags,buf[2])) break; } else if (buf[0]==0x33 && buf[1]==0x95 && buf[2]==0x00) { - em2820_isocdbg("VBI HEADER!!!"); + em28xx_isocdbg("VBI HEADER!!!"); } /* actual copying */ if ((*f)->state == F_GRABBING) { - em2820_isoc_video_copy(dev,f,buf, len); + em28xx_isoc_video_copy(dev,f,buf, len); } } } @@ -696,7 +696,7 @@ void em2820_isocIrq(struct urb *urb, struct pt_regs *regs) urb->status = 0; if ((status = usb_submit_urb(urb, GFP_ATOMIC))) { - em2820_errdev("resubmit of urb failed (error=%i)\n", status); + em28xx_errdev("resubmit of urb failed (error=%i)\n", status); dev->state |= DEV_MISCONFIGURED; } wake_up_interruptible(&dev->wait_frame); @@ -704,58 +704,58 @@ void em2820_isocIrq(struct urb *urb, struct pt_regs *regs) } /* - * em2820_uninit_isoc() - * deallocates the buffers and urbs allocated during em2820_init_iosc() + * em28xx_uninit_isoc() + * deallocates the buffers and urbs allocated during em28xx_init_iosc() */ -void em2820_uninit_isoc(struct em2820 *dev) +void em28xx_uninit_isoc(struct em28xx *dev) { int i; - for (i = 0; i < EM2820_NUM_BUFS; i++) { + for (i = 0; i < EM28XX_NUM_BUFS; i++) { if (dev->urb[i]) { usb_kill_urb(dev->urb[i]); if (dev->transfer_buffer[i]){ - usb_buffer_free(dev->udev,(EM2820_NUM_PACKETS*dev->max_pkt_size),dev->transfer_buffer[i],dev->urb[i]->transfer_dma); + usb_buffer_free(dev->udev,(EM28XX_NUM_PACKETS*dev->max_pkt_size),dev->transfer_buffer[i],dev->urb[i]->transfer_dma); } usb_free_urb(dev->urb[i]); } dev->urb[i] = NULL; dev->transfer_buffer[i] = NULL; } - em2820_capture_start(dev, 0); + em28xx_capture_start(dev, 0); } /* - * em2820_init_isoc() + * em28xx_init_isoc() * allocates transfer buffers and submits the urbs for isoc transfer */ -int em2820_init_isoc(struct em2820 *dev) +int em28xx_init_isoc(struct em28xx *dev) { /* change interface to 3 which allowes the biggest packet sizes */ int i, errCode; - const int sb_size = EM2820_NUM_PACKETS * dev->max_pkt_size; + const int sb_size = EM28XX_NUM_PACKETS * dev->max_pkt_size; /* reset streaming vars */ dev->frame_current = NULL; dev->frame_count = 0; /* allocate urbs */ - for (i = 0; i < EM2820_NUM_BUFS; i++) { + for (i = 0; i < EM28XX_NUM_BUFS; i++) { struct urb *urb; int j, k; /* allocate transfer buffer */ - urb = usb_alloc_urb(EM2820_NUM_PACKETS, GFP_KERNEL); + urb = usb_alloc_urb(EM28XX_NUM_PACKETS, GFP_KERNEL); if (!urb){ - em2820_errdev("cannot alloc urb %i\n", i); - em2820_uninit_isoc(dev); + em28xx_errdev("cannot alloc urb %i\n", i); + em28xx_uninit_isoc(dev); return -ENOMEM; } dev->transfer_buffer[i] = usb_buffer_alloc(dev->udev, sb_size, GFP_KERNEL,&urb->transfer_dma); if (!dev->transfer_buffer[i]) { - em2820_errdev + em28xx_errdev ("unable to allocate %i bytes for transfer buffer %i\n", sb_size, i); - em2820_uninit_isoc(dev); + em28xx_uninit_isoc(dev); return -ENOMEM; } memset(dev->transfer_buffer[i], 0, sb_size); @@ -765,10 +765,10 @@ int em2820_init_isoc(struct em2820 *dev) urb->transfer_flags = URB_ISO_ASAP; urb->interval = 1; urb->transfer_buffer = dev->transfer_buffer[i]; - urb->complete = em2820_isocIrq; - urb->number_of_packets = EM2820_NUM_PACKETS; + urb->complete = em28xx_isocIrq; + urb->number_of_packets = EM28XX_NUM_PACKETS; urb->transfer_buffer_length = sb_size; - for (j = k = 0; j < EM2820_NUM_PACKETS; + for (j = k = 0; j < EM28XX_NUM_PACKETS; j++, k += dev->max_pkt_size) { urb->iso_frame_desc[j].offset = k; urb->iso_frame_desc[j].length = @@ -778,12 +778,12 @@ int em2820_init_isoc(struct em2820 *dev) } /* submit urbs */ - for (i = 0; i < EM2820_NUM_BUFS; i++) { + for (i = 0; i < EM28XX_NUM_BUFS; i++) { errCode = usb_submit_urb(dev->urb[i], GFP_KERNEL); if (errCode) { - em2820_errdev("submit of urb %i failed (error=%i)\n", i, + em28xx_errdev("submit of urb %i failed (error=%i)\n", i, errCode); - em2820_uninit_isoc(dev); + em28xx_uninit_isoc(dev); return errCode; } } @@ -791,21 +791,21 @@ int em2820_init_isoc(struct em2820 *dev) return 0; } -int em2820_set_alternate(struct em2820 *dev) +int em28xx_set_alternate(struct em28xx *dev) { int errCode, prev_alt = dev->alt; dev->alt = alt; if (dev->alt == 0) { int i; if(dev->is_em2800){ /* always use the max packet size for em2800 based devices */ - for(i=0;i< EM2820_MAX_ALT; i++) + for(i=0;i< EM28XX_MAX_ALT; i++) if(dev->alt_max_pkt_size[i]>dev->alt_max_pkt_size[dev->alt]) dev->alt=i; }else{ unsigned int min_pkt_size = dev->field_size / 137; /* FIXME: empiric magic number */ - em2820_coredbg("minimum isoc packet size: %u", min_pkt_size); + em28xx_coredbg("minimum isoc packet size: %u", min_pkt_size); dev->alt = 7; - for (i = 1; i < EM2820_MAX_ALT; i += 2) /* FIXME: skip even alternate: why do they not work? */ + for (i = 1; i < EM28XX_MAX_ALT; i += 2) /* FIXME: skip even alternate: why do they not work? */ if (dev->alt_max_pkt_size[i] >= min_pkt_size) { dev->alt = i; break; @@ -815,11 +815,11 @@ int em2820_set_alternate(struct em2820 *dev) if (dev->alt != prev_alt) { dev->max_pkt_size = dev->alt_max_pkt_size[dev->alt]; - em2820_coredbg("setting alternate %d with wMaxPacketSize=%u", dev->alt, + em28xx_coredbg("setting alternate %d with wMaxPacketSize=%u", dev->alt, dev->max_pkt_size); errCode = usb_set_interface(dev->udev, 0, dev->alt); if (errCode < 0) { - em2820_errdev + em28xx_errdev ("cannot change alternate number to %d (error=%i)\n", dev->alt, errCode); return errCode; diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c index a62e66bd65f9..b32d9852f34c 100644 --- a/drivers/media/video/em28xx/em28xx-i2c.c +++ b/drivers/media/video/em28xx/em28xx-i2c.c @@ -50,7 +50,7 @@ MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]"); * em2800_i2c_send_max4() * send up to 4 bytes to the i2c device */ -static int em2800_i2c_send_max4(struct em2820 *dev, unsigned char addr, +static int em2800_i2c_send_max4(struct em28xx *dev, unsigned char addr, char *buf, int len) { int ret; @@ -67,19 +67,19 @@ static int em2800_i2c_send_max4(struct em2820 *dev, unsigned char addr, if (len > 3) b2[0] = buf[3]; - ret = dev->em2820_write_regs(dev, 4 - len, &b2[4 - len], 2 + len); + ret = dev->em28xx_write_regs(dev, 4 - len, &b2[4 - len], 2 + len); if (ret != 2 + len) { - em2820_warn("writting to i2c device failed (error=%i)\n", ret); + em28xx_warn("writting to i2c device failed (error=%i)\n", ret); return -EIO; } for (write_timeout = EM2800_I2C_WRITE_TIMEOUT; write_timeout > 0; write_timeout -= 5) { - ret = dev->em2820_read_reg(dev, 0x05); + ret = dev->em28xx_read_reg(dev, 0x05); if (ret == 0x80 + len - 1) return len; mdelay(5); } - em2820_warn("i2c write timed out\n"); + em28xx_warn("i2c write timed out\n"); return -EIO; } @@ -94,7 +94,7 @@ static int em2800_i2c_send_bytes(void *data, unsigned char addr, char *buf, int wrcount = 0; int count; int maxLen = 4; - struct em2820 *dev = (struct em2820 *)data; + struct em28xx *dev = (struct em28xx *)data; while (len > 0) { count = (len > maxLen) ? maxLen : len; ret = em2800_i2c_send_max4(dev, addr, bufPtr, count); @@ -112,27 +112,27 @@ static int em2800_i2c_send_bytes(void *data, unsigned char addr, char *buf, * em2800_i2c_check_for_device() * check if there is a i2c_device at the supplied address */ -static int em2800_i2c_check_for_device(struct em2820 *dev, unsigned char addr) +static int em2800_i2c_check_for_device(struct em28xx *dev, unsigned char addr) { char msg; int ret; int write_timeout; msg = addr; - ret = dev->em2820_write_regs(dev, 0x04, &msg, 1); + ret = dev->em28xx_write_regs(dev, 0x04, &msg, 1); if (ret < 0) { - em2820_warn("setting i2c device address failed (error=%i)\n", + em28xx_warn("setting i2c device address failed (error=%i)\n", ret); return ret; } msg = 0x84; - ret = dev->em2820_write_regs(dev, 0x05, &msg, 1); + ret = dev->em28xx_write_regs(dev, 0x05, &msg, 1); if (ret < 0) { - em2820_warn("preparing i2c read failed (error=%i)\n", ret); + em28xx_warn("preparing i2c read failed (error=%i)\n", ret); return ret; } for (write_timeout = EM2800_I2C_WRITE_TIMEOUT; write_timeout > 0; write_timeout -= 5) { - unsigned msg = dev->em2820_read_reg(dev, 0x5); + unsigned msg = dev->em28xx_read_reg(dev, 0x5); if (msg == 0x94) return -ENODEV; else if (msg == 0x84) @@ -146,21 +146,21 @@ static int em2800_i2c_check_for_device(struct em2820 *dev, unsigned char addr) * em2800_i2c_recv_bytes() * read from the i2c device */ -static int em2800_i2c_recv_bytes(struct em2820 *dev, unsigned char addr, +static int em2800_i2c_recv_bytes(struct em28xx *dev, unsigned char addr, char *buf, int len) { int ret; /* check for the device and set i2c read address */ ret = em2800_i2c_check_for_device(dev, addr); if (ret) { - em2820_warn + em28xx_warn ("preparing read at i2c address 0x%x failed (error=%i)\n", addr, ret); return ret; } - ret = dev->em2820_read_reg_req_len(dev, 0x0, 0x3, buf, len); + ret = dev->em28xx_read_reg_req_len(dev, 0x0, 0x3, buf, len); if (ret < 0) { - em2820_warn("reading from i2c device at 0x%x failed (error=%i)", + em28xx_warn("reading from i2c device at 0x%x failed (error=%i)", addr, ret); return ret; } @@ -168,66 +168,66 @@ static int em2800_i2c_recv_bytes(struct em2820 *dev, unsigned char addr, } /* - * em2820_i2c_send_bytes() + * em28xx_i2c_send_bytes() * untested for more than 4 bytes */ -static int em2820_i2c_send_bytes(void *data, unsigned char addr, char *buf, +static int em28xx_i2c_send_bytes(void *data, unsigned char addr, char *buf, short len, int stop) { int wrcount = 0; - struct em2820 *dev = (struct em2820 *)data; + struct em28xx *dev = (struct em28xx *)data; - wrcount = dev->em2820_write_regs_req(dev, stop ? 2 : 3, addr, buf, len); + wrcount = dev->em28xx_write_regs_req(dev, stop ? 2 : 3, addr, buf, len); return wrcount; } /* - * em2820_i2c_recv_bytes() + * em28xx_i2c_recv_bytes() * read a byte from the i2c device */ -static int em2820_i2c_recv_bytes(struct em2820 *dev, unsigned char addr, +static int em28xx_i2c_recv_bytes(struct em28xx *dev, unsigned char addr, char *buf, int len) { int ret; - ret = dev->em2820_read_reg_req_len(dev, 2, addr, buf, len); + ret = dev->em28xx_read_reg_req_len(dev, 2, addr, buf, len); if (ret < 0) { - em2820_warn("reading i2c device failed (error=%i)\n", ret); + em28xx_warn("reading i2c device failed (error=%i)\n", ret); return ret; } - if (dev->em2820_read_reg(dev, 0x5) != 0) + if (dev->em28xx_read_reg(dev, 0x5) != 0) return -ENODEV; return ret; } /* - * em2820_i2c_check_for_device() + * em28xx_i2c_check_for_device() * check if there is a i2c_device at the supplied address */ -static int em2820_i2c_check_for_device(struct em2820 *dev, unsigned char addr) +static int em28xx_i2c_check_for_device(struct em28xx *dev, unsigned char addr) { char msg; int ret; msg = addr; - ret = dev->em2820_read_reg_req(dev, 2, addr); + ret = dev->em28xx_read_reg_req(dev, 2, addr); if (ret < 0) { - em2820_warn("reading from i2c device failed (error=%i)\n", ret); + em28xx_warn("reading from i2c device failed (error=%i)\n", ret); return ret; } - if (dev->em2820_read_reg(dev, 0x5) != 0) + if (dev->em28xx_read_reg(dev, 0x5) != 0) return -ENODEV; return 0; } /* - * em2820_i2c_xfer() + * em28xx_i2c_xfer() * the main i2c transfer function */ -static int em2820_i2c_xfer(struct i2c_adapter *i2c_adap, +static int em28xx_i2c_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msgs[], int num) { - struct em2820 *dev = i2c_adap->algo_data; + struct em28xx *dev = i2c_adap->algo_data; int addr, rc, i, byte; if (num <= 0) @@ -241,7 +241,7 @@ static int em2820_i2c_xfer(struct i2c_adapter *i2c_adap, if (dev->is_em2800) rc = em2800_i2c_check_for_device(dev, addr); else - rc = em2820_i2c_check_for_device(dev, addr); + rc = em28xx_i2c_check_for_device(dev, addr); if (rc < 0) { dprintk2(2," no device\n"); return rc; @@ -254,7 +254,7 @@ static int em2820_i2c_xfer(struct i2c_adapter *i2c_adap, msgs[i].buf, msgs[i].len); else - rc = em2820_i2c_recv_bytes(dev, addr, + rc = em28xx_i2c_recv_bytes(dev, addr, msgs[i].buf, msgs[i].len); if (i2c_debug>=2) { @@ -273,7 +273,7 @@ static int em2820_i2c_xfer(struct i2c_adapter *i2c_adap, msgs[i].buf, msgs[i].len); else - rc = em2820_i2c_send_bytes(dev, addr, + rc = em28xx_i2c_send_bytes(dev, addr, msgs[i].buf, msgs[i].len, i == num - 1); @@ -290,10 +290,10 @@ static int em2820_i2c_xfer(struct i2c_adapter *i2c_adap, return rc; } -static int em2820_i2c_eeprom(struct em2820 *dev, unsigned char *eedata, int len) +static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned char *eedata, int len) { unsigned char buf, *p = eedata; - struct em2820_eeprom *em_eeprom = (void *)eedata; + struct em28xx_eeprom *em_eeprom = (void *)eedata; int i, err, size = len, block; dev->i2c_client.addr = 0xa0 >> 1; @@ -410,9 +410,9 @@ static void dec_use(struct i2c_adapter *adap) } #endif -static int em2820_set_tuner(int check_eeprom, struct i2c_client *client) +static int em28xx_set_tuner(int check_eeprom, struct i2c_client *client) { - struct em2820 *dev = client->adapter->algo_data; + struct em28xx *dev = client->adapter->algo_data; struct tuner_setup tun_setup; if (dev->has_tuner) { @@ -420,7 +420,7 @@ static int em2820_set_tuner(int check_eeprom, struct i2c_client *client) tun_setup.type = dev->tuner_type; tun_setup.addr = dev->tuner_addr; - em2820_i2c_call_clients(dev, TUNER_SET_TYPE_ADDR, &tun_setup); + em28xx_i2c_call_clients(dev, TUNER_SET_TYPE_ADDR, &tun_setup); } return (0); @@ -433,11 +433,11 @@ static int em2820_set_tuner(int check_eeprom, struct i2c_client *client) */ static int attach_inform(struct i2c_client *client) { - struct em2820 *dev = client->adapter->algo_data; + struct em28xx *dev = client->adapter->algo_data; switch (client->addr << 1) { case 0x86: - em2820_i2c_call_clients(dev, TDA9887_SET_CONFIG, &dev->tda9887_conf); + em28xx_i2c_call_clients(dev, TDA9887_SET_CONFIG, &dev->tda9887_conf); break; case 0x42: dprintk1(1,"attach_inform: saa7114 detected.\n"); @@ -453,7 +453,7 @@ static int attach_inform(struct i2c_client *client) { struct IR_i2c *ir = i2c_get_clientdata(client); dprintk1(1,"attach_inform: IR detected (%s).\n",ir->phys); - em2820_set_ir(dev,ir); + em28xx_set_ir(dev,ir); break; } case 0x80: @@ -467,19 +467,19 @@ static int attach_inform(struct i2c_client *client) default: dprintk1(1,"attach inform: detected I2C address %x\n", client->addr << 1); dev->tuner_addr = client->addr; - em2820_set_tuner(-1, client); + em28xx_set_tuner(-1, client); } return 0; } -static struct i2c_algorithm em2820_algo = { - .master_xfer = em2820_i2c_xfer, +static struct i2c_algorithm em28xx_algo = { + .master_xfer = em28xx_i2c_xfer, .algo_control = algo_control, .functionality = functionality, }; -static struct i2c_adapter em2820_adap_template = { +static struct i2c_adapter em28xx_adap_template = { #ifdef I2C_PEC .owner = THIS_MODULE, #else @@ -489,14 +489,14 @@ static struct i2c_adapter em2820_adap_template = { #ifdef I2C_CLASS_TV_ANALOG .class = I2C_CLASS_TV_ANALOG, #endif - .name = "em2820", - .id = I2C_HW_B_EM2820, - .algo = &em2820_algo, + .name = "em28xx", + .id = I2C_HW_B_EM28XX, + .algo = &em28xx_algo, .client_register = attach_inform, }; -static struct i2c_client em2820_client_template = { - .name = "em2820 internal", +static struct i2c_client em28xx_client_template = { + .name = "em28xx internal", .flags = I2C_CLIENT_ALLOW_USE, }; @@ -542,33 +542,33 @@ static void do_i2c_scan(char *name, struct i2c_client *c) } /* - * em2820_i2c_call_clients() + * em28xx_i2c_call_clients() * send commands to all attached i2c devices */ -void em2820_i2c_call_clients(struct em2820 *dev, unsigned int cmd, void *arg) +void em28xx_i2c_call_clients(struct em28xx *dev, unsigned int cmd, void *arg) { BUG_ON(NULL == dev->i2c_adap.algo_data); i2c_clients_command(&dev->i2c_adap, cmd, arg); } /* - * em2820_i2c_register() + * em28xx_i2c_register() * register i2c bus */ -int em2820_i2c_register(struct em2820 *dev) +int em28xx_i2c_register(struct em28xx *dev) { - BUG_ON(!dev->em2820_write_regs || !dev->em2820_read_reg); - BUG_ON(!dev->em2820_write_regs_req || !dev->em2820_read_reg_req); - dev->i2c_adap = em2820_adap_template; + BUG_ON(!dev->em28xx_write_regs || !dev->em28xx_read_reg); + BUG_ON(!dev->em28xx_write_regs_req || !dev->em28xx_read_reg_req); + dev->i2c_adap = em28xx_adap_template; dev->i2c_adap.dev.parent = &dev->udev->dev; strcpy(dev->i2c_adap.name, dev->name); dev->i2c_adap.algo_data = dev; i2c_add_adapter(&dev->i2c_adap); - dev->i2c_client = em2820_client_template; + dev->i2c_client = em28xx_client_template; dev->i2c_client.adapter = &dev->i2c_adap; - em2820_i2c_eeprom(dev, dev->eedata, sizeof(dev->eedata)); + em28xx_i2c_eeprom(dev, dev->eedata, sizeof(dev->eedata)); if (i2c_scan) do_i2c_scan(dev->name, &dev->i2c_client); @@ -576,10 +576,10 @@ int em2820_i2c_register(struct em2820 *dev) } /* - * em2820_i2c_unregister() + * em28xx_i2c_unregister() * unregister i2c_bus */ -int em2820_i2c_unregister(struct em2820 *dev) +int em28xx_i2c_unregister(struct em28xx *dev) { i2c_del_adapter(&dev->i2c_adap); return 0; diff --git a/drivers/media/video/em28xx/em28xx-input.c b/drivers/media/video/em28xx/em28xx-input.c index be7ba9b24d0d..32c49df58adc 100644 --- a/drivers/media/video/em28xx/em28xx-input.c +++ b/drivers/media/video/em28xx/em28xx-input.c @@ -142,7 +142,7 @@ static int get_key_em_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) } /* ----------------------------------------------------------------------- */ -void em2820_set_ir(struct em2820 * dev,struct IR_i2c *ir) +void em28xx_set_ir(struct em28xx * dev,struct IR_i2c *ir) { if (disable_ir) { ir->get_key=NULL; @@ -159,7 +159,7 @@ void em2820_set_ir(struct em2820 * dev,struct IR_i2c *ir) case (EM2820_BOARD_TERRATEC_CINERGY_250): ir->ir_codes = ir_codes_em_terratec; ir->get_key = get_key_terratec; - snprintf(ir->c.name, sizeof(ir->c.name), "i2c IR (EM2820 Terratec)"); + snprintf(ir->c.name, sizeof(ir->c.name), "i2c IR (EM28XX Terratec)"); break; case (EM2820_BOARD_PINNACLE_USB_2): break; diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 5ae896a1dcf6..f6acce820791 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c @@ -28,6 +28,7 @@ #include #include #include +#include #include "em28xx.h" #include @@ -39,9 +40,9 @@ #define DRIVER_NAME "em28xx" #define DRIVER_DESC "Empia em28xx based USB video device driver" -#define EM2820_VERSION_CODE KERNEL_VERSION(0, 0, 1) +#define EM28XX_VERSION_CODE KERNEL_VERSION(0, 0, 1) -#define em2820_videodbg(fmt, arg...) do {\ +#define em28xx_videodbg(fmt, arg...) do {\ if (video_debug) \ printk(KERN_INFO "%s %s :"fmt, \ dev->name, __FUNCTION__ , ##arg); } while (0) @@ -50,9 +51,9 @@ MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); -static LIST_HEAD(em2820_devlist); +static LIST_HEAD(em28xx_devlist); -static unsigned int card[] = {[0 ... (EM2820_MAXBOARDS - 1)] = UNSET }; +static unsigned int card[] = {[0 ... (EM28XX_MAXBOARDS - 1)] = UNSET }; module_param_array(card, int, NULL, 0444); MODULE_PARM_DESC(card,"card type"); @@ -66,7 +67,7 @@ module_param(video_debug,int,0644); MODULE_PARM_DESC(video_debug,"enable debug messages [video]"); /* supported tv norms */ -static struct em2820_tvnorm tvnorms[] = { +static struct em28xx_tvnorm tvnorms[] = { { .name = "PAL", .id = V4L2_STD_PAL, @@ -106,7 +107,7 @@ static const unsigned char saa7114_i2c_init[] = { #define TVNORMS ARRAY_SIZE(tvnorms) /* supported controls */ -static struct v4l2_queryctrl em2820_qctrl[] = { +static struct v4l2_queryctrl em28xx_qctrl[] = { { .id = V4L2_CID_BRIGHTNESS, .type = V4L2_CTRL_TYPE_INTEGER, @@ -182,10 +183,10 @@ static struct v4l2_queryctrl em2820_qctrl[] = { } }; -static struct usb_driver em2820_usb_driver; +static struct usb_driver em28xx_usb_driver; -static DECLARE_MUTEX(em2820_sysfs_lock); -static DECLARE_RWSEM(em2820_disconnect); +static DECLARE_MUTEX(em28xx_sysfs_lock); +static DECLARE_RWSEM(em28xx_disconnect); /********************* v4l2 interface ******************************************/ @@ -200,95 +201,95 @@ static inline unsigned long kvirt_to_pa(unsigned long adr) } /* - * em2820_config() + * em28xx_config() * inits registers with sane defaults */ -static int em2820_config(struct em2820 *dev) +static int em28xx_config(struct em28xx *dev) { /* Sets I2C speed to 100 KHz */ - em2820_write_regs_req(dev, 0x00, 0x06, "\x40", 1); + em28xx_write_regs_req(dev, 0x00, 0x06, "\x40", 1); /* enable vbi capturing */ - em2820_audio_usb_mute(dev, 1); + em28xx_audio_usb_mute(dev, 1); dev->mute = 1; /* maybe not the right place... */ dev->volume = 0x1f; - em2820_audio_analog_set(dev); - em2820_audio_analog_setup(dev); - em2820_outfmt_set_yuv422(dev); - em2820_colorlevels_set_default(dev); - em2820_compression_disable(dev); + em28xx_audio_analog_set(dev); + em28xx_audio_analog_setup(dev); + em28xx_outfmt_set_yuv422(dev); + em28xx_colorlevels_set_default(dev); + em28xx_compression_disable(dev); return 0; } /* - * em2820_config_i2c() + * em28xx_config_i2c() * configure i2c attached devices */ -void em2820_config_i2c(struct em2820 *dev) +void em28xx_config_i2c(struct em28xx *dev) { struct v4l2_frequency f; - struct video_decoder_init em2820_vdi = {.data = NULL }; + struct video_decoder_init em28xx_vdi = {.data = NULL }; /* configure decoder */ if(dev->model == EM2820_BOARD_MSI_VOX_USB_2){ - em2820_vdi.data=saa7114_i2c_init; - em2820_vdi.len=sizeof(saa7114_i2c_init); + em28xx_vdi.data=saa7114_i2c_init; + em28xx_vdi.len=sizeof(saa7114_i2c_init); } - em2820_i2c_call_clients(dev, DECODER_INIT, &em2820_vdi); - em2820_i2c_call_clients(dev, DECODER_SET_INPUT, &dev->ctl_input); -/* em2820_i2c_call_clients(dev,DECODER_SET_PICTURE, &dev->vpic); */ -/* em2820_i2c_call_clients(dev,DECODER_SET_NORM,&dev->tvnorm->id); */ -/* em2820_i2c_call_clients(dev,DECODER_ENABLE_OUTPUT,&output); */ -/* em2820_i2c_call_clients(dev,DECODER_DUMP, NULL); */ + em28xx_i2c_call_clients(dev, DECODER_INIT, &em28xx_vdi); + em28xx_i2c_call_clients(dev, DECODER_SET_INPUT, &dev->ctl_input); +/* em28xx_i2c_call_clients(dev,DECODER_SET_PICTURE, &dev->vpic); */ +/* em28xx_i2c_call_clients(dev,DECODER_SET_NORM,&dev->tvnorm->id); */ +/* em28xx_i2c_call_clients(dev,DECODER_ENABLE_OUTPUT,&output); */ +/* em28xx_i2c_call_clients(dev,DECODER_DUMP, NULL); */ /* configure tuner */ f.tuner = 0; f.type = V4L2_TUNER_ANALOG_TV; f.frequency = 9076; /* FIXME:remove magic number */ dev->ctl_freq = f.frequency; - em2820_i2c_call_clients(dev, VIDIOC_S_FREQUENCY, &f); + em28xx_i2c_call_clients(dev, VIDIOC_S_FREQUENCY, &f); /* configure tda9887 */ -/* em2820_i2c_call_clients(dev,VIDIOC_S_STD,&dev->tvnorm->id); */ +/* em28xx_i2c_call_clients(dev,VIDIOC_S_STD,&dev->tvnorm->id); */ } /* - * em2820_empty_framequeues() + * em28xx_empty_framequeues() * prepare queues for incoming and outgoing frames */ -static void em2820_empty_framequeues(struct em2820 *dev) +static void em28xx_empty_framequeues(struct em28xx *dev) { u32 i; INIT_LIST_HEAD(&dev->inqueue); INIT_LIST_HEAD(&dev->outqueue); - for (i = 0; i < EM2820_NUM_FRAMES; i++) { + for (i = 0; i < EM28XX_NUM_FRAMES; i++) { dev->frame[i].state = F_UNUSED; dev->frame[i].buf.bytesused = 0; } } /* - * em2820_v4l2_open() + * em28xx_v4l2_open() * inits the device and starts isoc transfer */ -static int em2820_v4l2_open(struct inode *inode, struct file *filp) +static int em28xx_v4l2_open(struct inode *inode, struct file *filp) { int minor = iminor(inode); int errCode = 0; - struct em2820 *h,*dev = NULL; + struct em28xx *h,*dev = NULL; struct list_head *list; - list_for_each(list,&em2820_devlist) { - h = list_entry(list, struct em2820, devlist); + list_for_each(list,&em28xx_devlist) { + h = list_entry(list, struct em28xx, devlist); if (h->vdev->minor == minor) { dev = h; } @@ -297,14 +298,14 @@ static int em2820_v4l2_open(struct inode *inode, struct file *filp) filp->private_data=dev; - em2820_videodbg("users=%d", dev->users); + em28xx_videodbg("users=%d", dev->users); - if (!down_read_trylock(&em2820_disconnect)) + if (!down_read_trylock(&em28xx_disconnect)) return -ERESTARTSYS; if (dev->users) { - em2820_warn("this driver can be opened only once\n"); - up_read(&em2820_disconnect); + em28xx_warn("this driver can be opened only once\n"); + up_read(&em28xx_disconnect); return -EBUSY; } @@ -322,7 +323,7 @@ static int em2820_v4l2_open(struct inode *inode, struct file *filp) down(&dev->lock); - em2820_set_alternate(dev); + em28xx_set_alternate(dev); dev->width = norm_maxw(dev); dev->height = norm_maxh(dev); @@ -332,11 +333,11 @@ static int em2820_v4l2_open(struct inode *inode, struct file *filp) dev->hscale = 0; dev->vscale = 0; - em2820_capture_start(dev, 1); - em2820_resolution_set(dev); + em28xx_capture_start(dev, 1); + em28xx_resolution_set(dev); /* start the transfer */ - errCode = em2820_init_isoc(dev); + errCode = em28xx_init_isoc(dev); if (errCode) goto err; @@ -347,55 +348,55 @@ static int em2820_v4l2_open(struct inode *inode, struct file *filp) dev->num_frames = 0; /* prepare queues */ - em2820_empty_framequeues(dev); + em28xx_empty_framequeues(dev); dev->state |= DEV_INITIALIZED; err: up(&dev->lock); - up_read(&em2820_disconnect); + up_read(&em28xx_disconnect); return errCode; } /* - * em2820_realease_resources() + * em28xx_realease_resources() * unregisters the v4l2,i2c and usb devices * called when the device gets disconected or at module unload */ -static void em2820_release_resources(struct em2820 *dev) +static void em28xx_release_resources(struct em28xx *dev) { - down(&em2820_sysfs_lock); + down(&em28xx_sysfs_lock); - em2820_info("V4L2 device /dev/video%d deregistered\n", + em28xx_info("V4L2 device /dev/video%d deregistered\n", dev->vdev->minor); list_del(&dev->devlist); video_unregister_device(dev->vdev); /* video_unregister_device(dev->vbi_dev); */ - em2820_i2c_unregister(dev); + em28xx_i2c_unregister(dev); usb_put_dev(dev->udev); - up(&em2820_sysfs_lock); + up(&em28xx_sysfs_lock); } /* - * em2820_v4l2_close() + * em28xx_v4l2_close() * stops streaming and deallocates all resources allocated by the v4l2 calls and ioctls */ -static int em2820_v4l2_close(struct inode *inode, struct file *filp) +static int em28xx_v4l2_close(struct inode *inode, struct file *filp) { int errCode; - struct em2820 *dev=filp->private_data; + struct em28xx *dev=filp->private_data; - em2820_videodbg("users=%d", dev->users); + em28xx_videodbg("users=%d", dev->users); down(&dev->lock); - em2820_uninit_isoc(dev); + em28xx_uninit_isoc(dev); - em2820_release_buffers(dev); + em28xx_release_buffers(dev); /* the device is already disconnect, free the remaining resources */ if (dev->state & DEV_DISCONNECTED) { - em2820_release_resources(dev); + em28xx_release_resources(dev); up(&dev->lock); kfree(dev); return 0; @@ -403,10 +404,10 @@ static int em2820_v4l2_close(struct inode *inode, struct file *filp) /* set alternate 0 */ dev->alt = 0; - em2820_videodbg("setting alternate 0"); + em28xx_videodbg("setting alternate 0"); errCode = usb_set_interface(dev->udev, 0, 0); if (errCode < 0) { - em2820_errdev ("cannot change alternate number to 0 (error=%i)\n", + em28xx_errdev ("cannot change alternate number to 0 (error=%i)\n", errCode); } @@ -417,49 +418,49 @@ static int em2820_v4l2_close(struct inode *inode, struct file *filp) } /* - * em2820_v4l2_read() + * em28xx_v4l2_read() * will allocate buffers when called for the first time */ static ssize_t -em2820_v4l2_read(struct file *filp, char __user * buf, size_t count, +em28xx_v4l2_read(struct file *filp, char __user * buf, size_t count, loff_t * f_pos) { - struct em2820_frame_t *f, *i; + struct em28xx_frame_t *f, *i; unsigned long lock_flags; int ret = 0; - struct em2820 *dev = filp->private_data; + struct em28xx *dev = filp->private_data; if (down_interruptible(&dev->fileop_lock)) return -ERESTARTSYS; if (dev->state & DEV_DISCONNECTED) { - em2820_videodbg("device not present"); + em28xx_videodbg("device not present"); up(&dev->fileop_lock); return -ENODEV; } if (dev->state & DEV_MISCONFIGURED) { - em2820_videodbg("device misconfigured; close and open it again"); + em28xx_videodbg("device misconfigured; close and open it again"); up(&dev->fileop_lock); return -EIO; } if (dev->io == IO_MMAP) { - em2820_videodbg ("IO method is set to mmap; close and open" + em28xx_videodbg ("IO method is set to mmap; close and open" " the device again to choose the read method"); up(&dev->fileop_lock); return -EINVAL; } if (dev->io == IO_NONE) { - if (!em2820_request_buffers(dev, EM2820_NUM_READ_FRAMES)) { - em2820_errdev("read failed, not enough memory\n"); + if (!em28xx_request_buffers(dev, EM28XX_NUM_READ_FRAMES)) { + em28xx_errdev("read failed, not enough memory\n"); up(&dev->fileop_lock); return -ENOMEM; } dev->io = IO_READ; dev->stream = STREAM_ON; - em2820_queue_unusedframes(dev); + em28xx_queue_unusedframes(dev); } if (!count) { @@ -486,7 +487,7 @@ em2820_v4l2_read(struct file *filp, char __user * buf, size_t count, } } - f = list_entry(dev->outqueue.prev, struct em2820_frame_t, frame); + f = list_entry(dev->outqueue.prev, struct em28xx_frame_t, frame); spin_lock_irqsave(&dev->queue_lock, lock_flags); list_for_each_entry(i, &dev->outqueue, frame) @@ -494,7 +495,7 @@ em2820_v4l2_read(struct file *filp, char __user * buf, size_t count, INIT_LIST_HEAD(&dev->outqueue); spin_unlock_irqrestore(&dev->queue_lock, lock_flags); - em2820_queue_unusedframes(dev); + em28xx_queue_unusedframes(dev); if (count > f->buf.length) count = f->buf.length; @@ -511,26 +512,26 @@ em2820_v4l2_read(struct file *filp, char __user * buf, size_t count, } /* - * em2820_v4l2_poll() + * em28xx_v4l2_poll() * will allocate buffers when called for the first time */ -static unsigned int em2820_v4l2_poll(struct file *filp, poll_table * wait) +static unsigned int em28xx_v4l2_poll(struct file *filp, poll_table * wait) { unsigned int mask = 0; - struct em2820 *dev = filp->private_data; + struct em28xx *dev = filp->private_data; if (down_interruptible(&dev->fileop_lock)) return POLLERR; if (dev->state & DEV_DISCONNECTED) { - em2820_videodbg("device not present"); + em28xx_videodbg("device not present"); } else if (dev->state & DEV_MISCONFIGURED) { - em2820_videodbg("device is misconfigured; close and open it again"); + em28xx_videodbg("device is misconfigured; close and open it again"); } else { if (dev->io == IO_NONE) { - if (!em2820_request_buffers - (dev, EM2820_NUM_READ_FRAMES)) { - em2820_warn + if (!em28xx_request_buffers + (dev, EM28XX_NUM_READ_FRAMES)) { + em28xx_warn ("poll() failed, not enough memory\n"); } else { dev->io = IO_READ; @@ -539,7 +540,7 @@ static unsigned int em2820_v4l2_poll(struct file *filp, poll_table * wait) } if (dev->io == IO_READ) { - em2820_queue_unusedframes(dev); + em28xx_queue_unusedframes(dev); poll_wait(filp, &dev->wait_frame, wait); if (!list_empty(&dev->outqueue)) @@ -556,51 +557,51 @@ static unsigned int em2820_v4l2_poll(struct file *filp, poll_table * wait) } /* - * em2820_vm_open() + * em28xx_vm_open() */ -static void em2820_vm_open(struct vm_area_struct *vma) +static void em28xx_vm_open(struct vm_area_struct *vma) { - struct em2820_frame_t *f = vma->vm_private_data; + struct em28xx_frame_t *f = vma->vm_private_data; f->vma_use_count++; } /* - * em2820_vm_close() + * em28xx_vm_close() */ -static void em2820_vm_close(struct vm_area_struct *vma) +static void em28xx_vm_close(struct vm_area_struct *vma) { /* NOTE: buffers are not freed here */ - struct em2820_frame_t *f = vma->vm_private_data; + struct em28xx_frame_t *f = vma->vm_private_data; f->vma_use_count--; } -static struct vm_operations_struct em2820_vm_ops = { - .open = em2820_vm_open, - .close = em2820_vm_close, +static struct vm_operations_struct em28xx_vm_ops = { + .open = em28xx_vm_open, + .close = em28xx_vm_close, }; /* - * em2820_v4l2_mmap() + * em28xx_v4l2_mmap() */ -static int em2820_v4l2_mmap(struct file *filp, struct vm_area_struct *vma) +static int em28xx_v4l2_mmap(struct file *filp, struct vm_area_struct *vma) { unsigned long size = vma->vm_end - vma->vm_start, start = vma->vm_start, pos, page; u32 i; - struct em2820 *dev = filp->private_data; + struct em28xx *dev = filp->private_data; if (down_interruptible(&dev->fileop_lock)) return -ERESTARTSYS; if (dev->state & DEV_DISCONNECTED) { - em2820_videodbg("mmap: device not present"); + em28xx_videodbg("mmap: device not present"); up(&dev->fileop_lock); return -ENODEV; } if (dev->state & DEV_MISCONFIGURED) { - em2820_videodbg ("mmap: Device is misconfigured; close and " + em28xx_videodbg ("mmap: Device is misconfigured; close and " "open it again"); up(&dev->fileop_lock); return -EIO; @@ -617,7 +618,7 @@ static int em2820_v4l2_mmap(struct file *filp, struct vm_area_struct *vma) break; } if (i == dev->num_frames) { - em2820_videodbg("mmap: user supplied mapping address is out of range"); + em28xx_videodbg("mmap: user supplied mapping address is out of range"); up(&dev->fileop_lock); return -EINVAL; } @@ -631,7 +632,7 @@ static int em2820_v4l2_mmap(struct file *filp, struct vm_area_struct *vma) page = vmalloc_to_pfn((void *)pos); if (remap_pfn_range(vma, start, page, PAGE_SIZE, vma->vm_page_prot)) { - em2820_videodbg("mmap: rename page map failed"); + em28xx_videodbg("mmap: rename page map failed"); up(&dev->fileop_lock); return -EAGAIN; } @@ -640,19 +641,19 @@ static int em2820_v4l2_mmap(struct file *filp, struct vm_area_struct *vma) size -= PAGE_SIZE; } - vma->vm_ops = &em2820_vm_ops; + vma->vm_ops = &em28xx_vm_ops; vma->vm_private_data = &dev->frame[i]; - em2820_vm_open(vma); + em28xx_vm_open(vma); up(&dev->fileop_lock); return 0; } /* - * em2820_get_ctrl() + * em28xx_get_ctrl() * return the current saturation, brightness or contrast, mute state */ -static int em2820_get_ctrl(struct em2820 *dev, struct v4l2_control *ctrl) +static int em28xx_get_ctrl(struct em28xx *dev, struct v4l2_control *ctrl) { s32 tmp; switch (ctrl->id) { @@ -663,30 +664,30 @@ static int em2820_get_ctrl(struct em2820 *dev, struct v4l2_control *ctrl) ctrl->value = dev->volume; return 0; case V4L2_CID_BRIGHTNESS: - if ((tmp = em2820_brightness_get(dev)) < 0) + if ((tmp = em28xx_brightness_get(dev)) < 0) return -EIO; ctrl->value = (s32) ((s8) tmp); /* FIXME: clenaer way to extend sign? */ return 0; case V4L2_CID_CONTRAST: - if ((ctrl->value = em2820_contrast_get(dev)) < 0) + if ((ctrl->value = em28xx_contrast_get(dev)) < 0) return -EIO; return 0; case V4L2_CID_SATURATION: - if ((ctrl->value = em2820_saturation_get(dev)) < 0) + if ((ctrl->value = em28xx_saturation_get(dev)) < 0) return -EIO; return 0; case V4L2_CID_RED_BALANCE: - if ((tmp = em2820_v_balance_get(dev)) < 0) + if ((tmp = em28xx_v_balance_get(dev)) < 0) return -EIO; ctrl->value = (s32) ((s8) tmp); /* FIXME: clenaer way to extend sign? */ return 0; case V4L2_CID_BLUE_BALANCE: - if ((tmp = em2820_u_balance_get(dev)) < 0) + if ((tmp = em28xx_u_balance_get(dev)) < 0) return -EIO; ctrl->value = (s32) ((s8) tmp); /* FIXME: clenaer way to extend sign? */ return 0; case V4L2_CID_GAMMA: - if ((ctrl->value = em2820_gamma_get(dev)) < 0) + if ((ctrl->value = em28xx_gamma_get(dev)) < 0) return -EIO; return 0; default: @@ -695,44 +696,44 @@ static int em2820_get_ctrl(struct em2820 *dev, struct v4l2_control *ctrl) } /* - * em2820_set_ctrl() + * em28xx_set_ctrl() * mute or set new saturation, brightness or contrast */ -static int em2820_set_ctrl(struct em2820 *dev, const struct v4l2_control *ctrl) +static int em28xx_set_ctrl(struct em28xx *dev, const struct v4l2_control *ctrl) { switch (ctrl->id) { case V4L2_CID_AUDIO_MUTE: if (ctrl->value != dev->mute) { dev->mute = ctrl->value; - em2820_audio_usb_mute(dev, ctrl->value); - return em2820_audio_analog_set(dev); + em28xx_audio_usb_mute(dev, ctrl->value); + return em28xx_audio_analog_set(dev); } return 0; case V4L2_CID_AUDIO_VOLUME: dev->volume = ctrl->value; - return em2820_audio_analog_set(dev); + return em28xx_audio_analog_set(dev); case V4L2_CID_BRIGHTNESS: - return em2820_brightness_set(dev, ctrl->value); + return em28xx_brightness_set(dev, ctrl->value); case V4L2_CID_CONTRAST: - return em2820_contrast_set(dev, ctrl->value); + return em28xx_contrast_set(dev, ctrl->value); case V4L2_CID_SATURATION: - return em2820_saturation_set(dev, ctrl->value); + return em28xx_saturation_set(dev, ctrl->value); case V4L2_CID_RED_BALANCE: - return em2820_v_balance_set(dev, ctrl->value); + return em28xx_v_balance_set(dev, ctrl->value); case V4L2_CID_BLUE_BALANCE: - return em2820_u_balance_set(dev, ctrl->value); + return em28xx_u_balance_set(dev, ctrl->value); case V4L2_CID_GAMMA: - return em2820_gamma_set(dev, ctrl->value); + return em28xx_gamma_set(dev, ctrl->value); default: return -EINVAL; } } /* - * em2820_stream_interrupt() + * em28xx_stream_interrupt() * stops streaming */ -static int em2820_stream_interrupt(struct em2820 *dev) +static int em28xx_stream_interrupt(struct em28xx *dev) { int ret = 0; @@ -742,12 +743,12 @@ static int em2820_stream_interrupt(struct em2820 *dev) ret = wait_event_timeout(dev->wait_stream, (dev->stream == STREAM_OFF) || (dev->state & DEV_DISCONNECTED), - EM2820_URB_TIMEOUT); + EM28XX_URB_TIMEOUT); if (dev->state & DEV_DISCONNECTED) return -ENODEV; else if (ret) { dev->state |= DEV_MISCONFIGURED; - em2820_videodbg("device is misconfigured; close and " + em28xx_videodbg("device is misconfigured; close and " "open /dev/video%d again", dev->vdev->minor); return ret; } @@ -755,7 +756,7 @@ static int em2820_stream_interrupt(struct em2820 *dev) return 0; } -static int em2820_set_norm(struct em2820 *dev, int width, int height) +static int em28xx_set_norm(struct em28xx *dev, int width, int height) { unsigned int hscale, vscale; unsigned int maxh, maxw; @@ -794,41 +795,41 @@ static int em2820_set_norm(struct em2820 *dev, int width, int height) dev->hscale = hscale; dev->vscale = vscale; - em2820_resolution_set(dev); + em28xx_resolution_set(dev); return 0; } -static void video_mux(struct em2820 *dev, int index) +static void video_mux(struct em28xx *dev, int index) { int input, ainput; input = INPUT(index)->vmux; dev->ctl_input = index; - em2820_i2c_call_clients(dev, DECODER_SET_INPUT, &input); + em28xx_i2c_call_clients(dev, DECODER_SET_INPUT, &input); dev->ctl_ainput = INPUT(index)->amux; switch (dev->ctl_ainput) { case 0: - ainput = EM2820_AUDIO_SRC_TUNER; + ainput = EM28XX_AUDIO_SRC_TUNER; break; default: - ainput = EM2820_AUDIO_SRC_LINE; + ainput = EM28XX_AUDIO_SRC_LINE; } - em2820_audio_source(dev, ainput); + em28xx_audio_source(dev, ainput); } /* - * em2820_v4l2_do_ioctl() + * em28xx_v4l2_do_ioctl() * This function is _not_ called directly, but from - * em2820_v4l2_ioctl. Userspace + * em28xx_v4l2_ioctl. Userspace * copying is done already, arg is a kernel pointer. */ -static int em2820_do_ioctl(struct inode *inode, struct file *filp, - struct em2820 *dev, unsigned int cmd, void *arg, +static int em28xx_do_ioctl(struct inode *inode, struct file *filp, + struct em28xx *dev, unsigned int cmd, void *arg, v4l2_kioctl driver_ioctl) { int ret; @@ -875,7 +876,7 @@ static int em2820_do_ioctl(struct inode *inode, struct file *filp, down(&dev->lock); dev->tvnorm = &tvnorms[i]; - em2820_set_norm(dev, dev->width, dev->height); + em28xx_set_norm(dev, dev->width, dev->height); /* dev->width=norm_maxw(dev); @@ -886,18 +887,18 @@ static int em2820_do_ioctl(struct inode *inode, struct file *filp, dev->hscale=0; dev->vscale=0; - em2820_resolution_set(dev); + em28xx_resolution_set(dev); */ /* - em2820_uninit_isoc(dev); - em2820_set_alternate(dev); - em2820_capture_start(dev, 1); - em2820_resolution_set(dev); - em2820_init_isoc(dev); + em28xx_uninit_isoc(dev); + em28xx_set_alternate(dev); + em28xx_capture_start(dev, 1); + em28xx_resolution_set(dev); + em28xx_init_isoc(dev); */ - em2820_i2c_call_clients(dev, DECODER_SET_NORM, + em28xx_i2c_call_clients(dev, DECODER_SET_NORM, &tvnorms[i].mode); - em2820_i2c_call_clients(dev, VIDIOC_S_STD, + em28xx_i2c_call_clients(dev, VIDIOC_S_STD, &dev->tvnorm->id); up(&dev->lock); @@ -911,19 +912,19 @@ static int em2820_do_ioctl(struct inode *inode, struct file *filp, struct v4l2_input *i = arg; unsigned int n; static const char *iname[] = { - [EM2820_VMUX_COMPOSITE1] = "Composite1", - [EM2820_VMUX_COMPOSITE2] = "Composite2", - [EM2820_VMUX_COMPOSITE3] = "Composite3", - [EM2820_VMUX_COMPOSITE4] = "Composite4", - [EM2820_VMUX_SVIDEO] = "S-Video", - [EM2820_VMUX_TELEVISION] = "Television", - [EM2820_VMUX_CABLE] = "Cable TV", - [EM2820_VMUX_DVB] = "DVB", - [EM2820_VMUX_DEBUG] = "for debug only", + [EM28XX_VMUX_COMPOSITE1] = "Composite1", + [EM28XX_VMUX_COMPOSITE2] = "Composite2", + [EM28XX_VMUX_COMPOSITE3] = "Composite3", + [EM28XX_VMUX_COMPOSITE4] = "Composite4", + [EM28XX_VMUX_SVIDEO] = "S-Video", + [EM28XX_VMUX_TELEVISION] = "Television", + [EM28XX_VMUX_CABLE] = "Cable TV", + [EM28XX_VMUX_DVB] = "DVB", + [EM28XX_VMUX_DEBUG] = "for debug only", }; n = i->index; - if (n >= MAX_EM2820_INPUT) + if (n >= MAX_EM28XX_INPUT) return -EINVAL; if (0 == INPUT(n)->type) return -EINVAL; @@ -931,8 +932,8 @@ static int em2820_do_ioctl(struct inode *inode, struct file *filp, i->index = n; i->type = V4L2_INPUT_TYPE_CAMERA; strcpy(i->name, iname[INPUT(n)->type]); - if ((EM2820_VMUX_TELEVISION == INPUT(n)->type) || - (EM2820_VMUX_CABLE == INPUT(n)->type)) + if ((EM28XX_VMUX_TELEVISION == INPUT(n)->type) || + (EM28XX_VMUX_CABLE == INPUT(n)->type)) i->type = V4L2_INPUT_TYPE_TUNER; for (n = 0; n < ARRAY_SIZE(tvnorms); n++) i->std |= tvnorms[n].id; @@ -951,7 +952,7 @@ static int em2820_do_ioctl(struct inode *inode, struct file *filp, { int *index = arg; - if (*index >= MAX_EM2820_INPUT) + if (*index >= MAX_EM28XX_INPUT) return -EINVAL; if (0 == INPUT(*index)->type) return -EINVAL; @@ -997,10 +998,10 @@ static int em2820_do_ioctl(struct inode *inode, struct file *filp, { struct v4l2_queryctrl *qc = arg; u8 i, n; - n = sizeof(em2820_qctrl) / sizeof(em2820_qctrl[0]); + n = sizeof(em28xx_qctrl) / sizeof(em28xx_qctrl[0]); for (i = 0; i < n; i++) - if (qc->id && qc->id == em2820_qctrl[i].id) { - memcpy(qc, &(em2820_qctrl[i]), + if (qc->id && qc->id == em28xx_qctrl[i].id) { + memcpy(qc, &(em28xx_qctrl[i]), sizeof(*qc)); return 0; } @@ -1013,7 +1014,7 @@ static int em2820_do_ioctl(struct inode *inode, struct file *filp, struct v4l2_control *ctrl = arg; - return em2820_get_ctrl(dev, ctrl); + return em28xx_get_ctrl(dev, ctrl); } case VIDIOC_S_CTRL_OLD: /* ??? */ @@ -1023,16 +1024,16 @@ static int em2820_do_ioctl(struct inode *inode, struct file *filp, u8 i, n; - n = sizeof(em2820_qctrl) / sizeof(em2820_qctrl[0]); + n = sizeof(em28xx_qctrl) / sizeof(em28xx_qctrl[0]); for (i = 0; i < n; i++) - if (ctrl->id == em2820_qctrl[i].id) { + if (ctrl->id == em28xx_qctrl[i].id) { if (ctrl->value < - em2820_qctrl[i].minimum + em28xx_qctrl[i].minimum || ctrl->value > - em2820_qctrl[i].maximum) + em28xx_qctrl[i].maximum) return -ERANGE; - return em2820_set_ctrl(dev, ctrl); + return em28xx_set_ctrl(dev, ctrl); } return -EINVAL; } @@ -1052,16 +1053,16 @@ static int em2820_do_ioctl(struct inode *inode, struct file *filp, t->capability = V4L2_TUNER_CAP_NORM; t->rangehigh = 0xffffffffUL; /* FIXME: set correct range */ /* t->signal = 0xffff;*/ -/* em2820_i2c_call_clients(dev,VIDIOC_G_TUNER,t);*/ +/* em28xx_i2c_call_clients(dev,VIDIOC_G_TUNER,t);*/ /* No way to get signal strength? */ down(&dev->lock); - em2820_i2c_call_clients(dev, DECODER_GET_STATUS, + em28xx_i2c_call_clients(dev, DECODER_GET_STATUS, &status); up(&dev->lock); t->signal = (status & DECODER_STATUS_GOOD) != 0 ? 0xffff : 0; - em2820_videodbg("VIDIO_G_TUNER: signal=%x, afc=%x", t->signal, + em28xx_videodbg("VIDIO_G_TUNER: signal=%x, afc=%x", t->signal, t->afc); return 0; } @@ -1080,13 +1081,13 @@ static int em2820_do_ioctl(struct inode *inode, struct file *filp, /* t->signal = 0xffff; */ /* No way to get signal strength? */ down(&dev->lock); - em2820_i2c_call_clients(dev, DECODER_GET_STATUS, + em28xx_i2c_call_clients(dev, DECODER_GET_STATUS, &status); up(&dev->lock); t->signal = (status & DECODER_STATUS_GOOD) != 0 ? 0xffff : 0; - em2820_videodbg("VIDIO_S_TUNER: signal=%x, afc=%x\n", + em28xx_videodbg("VIDIO_S_TUNER: signal=%x, afc=%x\n", t->signal, t->afc); return 0; } @@ -1112,7 +1113,7 @@ static int em2820_do_ioctl(struct inode *inode, struct file *filp, down(&dev->lock); dev->ctl_freq = f->frequency; - em2820_i2c_call_clients(dev, VIDIOC_S_FREQUENCY, f); + em28xx_i2c_call_clients(dev, VIDIOC_S_FREQUENCY, f); up(&dev->lock); return 0; } @@ -1145,7 +1146,7 @@ static int em2820_do_ioctl(struct inode *inode, struct file *filp, dev->stream = STREAM_ON; /* FIXME: Start video capture here? */ - em2820_videodbg("VIDIOC_STREAMON: starting stream"); + em28xx_videodbg("VIDIOC_STREAMON: starting stream"); return 0; } @@ -1159,11 +1160,11 @@ static int em2820_do_ioctl(struct inode *inode, struct file *filp, return -EINVAL; if (dev->stream == STREAM_ON) { - em2820_videodbg ("VIDIOC_STREAMOFF: interrupting stream"); - if ((ret = em2820_stream_interrupt(dev))) + em28xx_videodbg ("VIDIOC_STREAMOFF: interrupting stream"); + if ((ret = em28xx_stream_interrupt(dev))) return ret; } - em2820_empty_framequeues(dev); + em28xx_empty_framequeues(dev); return 0; } @@ -1175,21 +1176,21 @@ static int em2820_do_ioctl(struct inode *inode, struct file *filp, } /* - * em2820_v4l2_do_ioctl() + * em28xx_v4l2_do_ioctl() * This function is _not_ called directly, but from - * em2820_v4l2_ioctl. Userspace + * em28xx_v4l2_ioctl. Userspace * copying is done already, arg is a kernel pointer. */ -static int em2820_video_do_ioctl(struct inode *inode, struct file *filp, +static int em28xx_video_do_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, void *arg) { - struct em2820 *dev = filp->private_data; + struct em28xx *dev = filp->private_data; if (!dev) return -ENODEV; if (video_debug > 1) - em2820_print_ioctl(dev->name,cmd); + em28xx_print_ioctl(dev->name,cmd); switch (cmd) { @@ -1199,12 +1200,12 @@ static int em2820_video_do_ioctl(struct inode *inode, struct file *filp, struct v4l2_capability *cap = arg; memset(cap, 0, sizeof(*cap)); - strlcpy(cap->driver, "em2820", sizeof(cap->driver)); - strlcpy(cap->card, em2820_boards[dev->model].name, + strlcpy(cap->driver, "em28xx", sizeof(cap->driver)); + strlcpy(cap->card, em28xx_boards[dev->model].name, sizeof(cap->card)); strlcpy(cap->bus_info, dev->udev->dev.bus_id, sizeof(cap->bus_info)); - cap->version = EM2820_VERSION_CODE; + cap->version = EM28XX_VERSION_CODE; cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_AUDIO | @@ -1233,7 +1234,7 @@ static int em2820_video_do_ioctl(struct inode *inode, struct file *filp, { struct v4l2_format *format = arg; - em2820_videodbg("VIDIOC_G_FMT: type=%s", + em28xx_videodbg("VIDIOC_G_FMT: type=%s", format->type == V4L2_BUF_TYPE_VIDEO_CAPTURE ? "V4L2_BUF_TYPE_VIDEO_CAPTURE" : format->type == @@ -1252,7 +1253,7 @@ static int em2820_video_do_ioctl(struct inode *inode, struct file *filp, format->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; format->fmt.pix.field = dev->interlaced ? V4L2_FIELD_INTERLACED : V4L2_FIELD_TOP; /* FIXME: TOP? NONE? BOTTOM? ALTENATE? */ - em2820_videodbg("VIDIOC_G_FMT: %dx%d", dev->width, + em28xx_videodbg("VIDIOC_G_FMT: %dx%d", dev->width, dev->height); return 0; } @@ -1273,7 +1274,7 @@ static int em2820_video_do_ioctl(struct inode *inode, struct file *filp, /* int both_fields; */ - em2820_videodbg("%s: type=%s", + em28xx_videodbg("%s: type=%s", cmd == VIDIOC_TRY_FMT ? "VIDIOC_TRY_FMT" : "VIDIOC_S_FMT", @@ -1287,7 +1288,7 @@ static int em2820_video_do_ioctl(struct inode *inode, struct file *filp, if (format->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; - em2820_videodbg("%s: requested %dx%d", + em28xx_videodbg("%s: requested %dx%d", cmd == VIDIOC_TRY_FMT ? "VIDIOC_TRY_FMT" : "VIDIOC_S_FMT", format->fmt.pix.width, @@ -1346,7 +1347,7 @@ static int em2820_video_do_ioctl(struct inode *inode, struct file *filp, format->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; format->fmt.pix.field = V4L2_FIELD_INTERLACED; - em2820_videodbg("%s: returned %dx%d (%d, %d)", + em28xx_videodbg("%s: returned %dx%d (%d, %d)", cmd == VIDIOC_TRY_FMT ? "VIDIOC_TRY_FMT" : "VIDIOC_S_FMT", format->fmt.pix.width, @@ -1357,19 +1358,19 @@ static int em2820_video_do_ioctl(struct inode *inode, struct file *filp, for (i = 0; i < dev->num_frames; i++) if (dev->frame[i].vma_use_count) { - em2820_videodbg("VIDIOC_S_FMT failed. " + em28xx_videodbg("VIDIOC_S_FMT failed. " "Unmap the buffers first."); return -EINVAL; } /* stop io in case it is already in progress */ if (dev->stream == STREAM_ON) { - em2820_videodbg("VIDIOC_SET_FMT: interupting stream"); - if ((ret = em2820_stream_interrupt(dev))) + em28xx_videodbg("VIDIOC_SET_FMT: interupting stream"); + if ((ret = em28xx_stream_interrupt(dev))) return ret; } - em2820_release_buffers(dev); + em28xx_release_buffers(dev); dev->io = IO_NONE; /* set new image size */ @@ -1381,11 +1382,11 @@ static int em2820_video_do_ioctl(struct inode *inode, struct file *filp, dev->hscale = hscale; dev->vscale = vscale; /* dev->both_fileds = both_fileds; */ - em2820_uninit_isoc(dev); - em2820_set_alternate(dev); - em2820_capture_start(dev, 1); - em2820_resolution_set(dev); - em2820_init_isoc(dev); + em28xx_uninit_isoc(dev); + em28xx_set_alternate(dev); + em28xx_capture_start(dev, 1); + em28xx_resolution_set(dev); + em28xx_init_isoc(dev); return 0; } @@ -1402,7 +1403,7 @@ static int em2820_video_do_ioctl(struct inode *inode, struct file *filp, return -EINVAL; if (dev->io == IO_READ) { - em2820_videodbg ("method is set to read;" + em28xx_videodbg ("method is set to read;" " close and open the device again to" " choose the mmap I/O method"); return -EINVAL; @@ -1410,26 +1411,26 @@ static int em2820_video_do_ioctl(struct inode *inode, struct file *filp, for (i = 0; i < dev->num_frames; i++) if (dev->frame[i].vma_use_count) { - em2820_videodbg ("VIDIOC_REQBUFS failed; previous buffers are still mapped"); + em28xx_videodbg ("VIDIOC_REQBUFS failed; previous buffers are still mapped"); return -EINVAL; } if (dev->stream == STREAM_ON) { - em2820_videodbg("VIDIOC_REQBUFS: interrupting stream"); - if ((ret = em2820_stream_interrupt(dev))) + em28xx_videodbg("VIDIOC_REQBUFS: interrupting stream"); + if ((ret = em28xx_stream_interrupt(dev))) return ret; } - em2820_empty_framequeues(dev); + em28xx_empty_framequeues(dev); - em2820_release_buffers(dev); + em28xx_release_buffers(dev); if (rb->count) rb->count = - em2820_request_buffers(dev, rb->count); + em28xx_request_buffers(dev, rb->count); dev->frame_current = NULL; - em2820_videodbg ("VIDIOC_REQBUFS: setting io method to mmap: num bufs %i", + em28xx_videodbg ("VIDIOC_REQBUFS: setting io method to mmap: num bufs %i", rb->count); dev->io = rb->count ? IO_MMAP : IO_NONE; return 0; @@ -1480,7 +1481,7 @@ static int em2820_video_do_ioctl(struct inode *inode, struct file *filp, case VIDIOC_DQBUF: { struct v4l2_buffer *b = arg; - struct em2820_frame_t *f; + struct em28xx_frame_t *f; unsigned long lock_flags; int ret = 0; @@ -1505,7 +1506,7 @@ static int em2820_video_do_ioctl(struct inode *inode, struct file *filp, spin_lock_irqsave(&dev->queue_lock, lock_flags); f = list_entry(dev->outqueue.next, - struct em2820_frame_t, frame); + struct em28xx_frame_t, frame); list_del(dev->outqueue.next); spin_unlock_irqrestore(&dev->queue_lock, lock_flags); @@ -1518,66 +1519,66 @@ static int em2820_video_do_ioctl(struct inode *inode, struct file *filp, return 0; } default: - return em2820_do_ioctl(inode, filp, dev, cmd, arg, - em2820_video_do_ioctl); + return em28xx_do_ioctl(inode, filp, dev, cmd, arg, + em28xx_video_do_ioctl); } return 0; } /* - * em2820_v4l2_ioctl() - * handle v4l2 ioctl the main action happens in em2820_v4l2_do_ioctl() + * em28xx_v4l2_ioctl() + * handle v4l2 ioctl the main action happens in em28xx_v4l2_do_ioctl() */ -static int em2820_v4l2_ioctl(struct inode *inode, struct file *filp, +static int em28xx_v4l2_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { int ret = 0; - struct em2820 *dev = filp->private_data; + struct em28xx *dev = filp->private_data; if (down_interruptible(&dev->fileop_lock)) return -ERESTARTSYS; if (dev->state & DEV_DISCONNECTED) { - em2820_errdev("v4l2 ioctl: device not present\n"); + em28xx_errdev("v4l2 ioctl: device not present\n"); up(&dev->fileop_lock); return -ENODEV; } if (dev->state & DEV_MISCONFIGURED) { - em2820_errdev + em28xx_errdev ("v4l2 ioctl: device is misconfigured; close and open it again\n"); up(&dev->fileop_lock); return -EIO; } - ret = video_usercopy(inode, filp, cmd, arg, em2820_video_do_ioctl); + ret = video_usercopy(inode, filp, cmd, arg, em28xx_video_do_ioctl); up(&dev->fileop_lock); return ret; } -static struct file_operations em2820_v4l_fops = { +static struct file_operations em28xx_v4l_fops = { .owner = THIS_MODULE, - .open = em2820_v4l2_open, - .release = em2820_v4l2_close, - .ioctl = em2820_v4l2_ioctl, - .read = em2820_v4l2_read, - .poll = em2820_v4l2_poll, - .mmap = em2820_v4l2_mmap, + .open = em28xx_v4l2_open, + .release = em28xx_v4l2_close, + .ioctl = em28xx_v4l2_ioctl, + .read = em28xx_v4l2_read, + .poll = em28xx_v4l2_poll, + .mmap = em28xx_v4l2_mmap, .llseek = no_llseek, }; /******************************** usb interface *****************************************/ /* - * em2820_init_dev() + * em28xx_init_dev() * allocates and inits the device structs, registers i2c bus and v4l device */ -static int em2820_init_dev(struct em2820 **devhandle, struct usb_device *udev, +static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, int minor, int model) { - struct em2820 *dev = *devhandle; + struct em28xx *dev = *devhandle; int retval = -ENOMEM; int errCode, i; unsigned int maxh, maxw; @@ -1588,33 +1589,33 @@ static int em2820_init_dev(struct em2820 **devhandle, struct usb_device *udev, init_MUTEX(&dev->lock); init_waitqueue_head(&dev->open); - dev->em2820_write_regs = em2820_write_regs; - dev->em2820_read_reg = em2820_read_reg; - dev->em2820_read_reg_req_len = em2820_read_reg_req_len; - dev->em2820_write_regs_req = em2820_write_regs_req; - dev->em2820_read_reg_req = em2820_read_reg_req; - dev->is_em2800 = em2820_boards[model].is_em2800; - dev->has_tuner = em2820_boards[model].has_tuner; - dev->has_msp34xx = em2820_boards[model].has_msp34xx; - dev->tda9887_conf = em2820_boards[model].tda9887_conf; - dev->decoder = em2820_boards[model].decoder; + dev->em28xx_write_regs = em28xx_write_regs; + dev->em28xx_read_reg = em28xx_read_reg; + dev->em28xx_read_reg_req_len = em28xx_read_reg_req_len; + dev->em28xx_write_regs_req = em28xx_write_regs_req; + dev->em28xx_read_reg_req = em28xx_read_reg_req; + dev->is_em2800 = em28xx_boards[model].is_em2800; + dev->has_tuner = em28xx_boards[model].has_tuner; + dev->has_msp34xx = em28xx_boards[model].has_msp34xx; + dev->tda9887_conf = em28xx_boards[model].tda9887_conf; + dev->decoder = em28xx_boards[model].decoder; if (tuner >= 0) dev->tuner_type = tuner; else - dev->tuner_type = em2820_boards[model].tuner_type; + dev->tuner_type = em28xx_boards[model].tuner_type; - dev->video_inputs = em2820_boards[model].vchannels; + dev->video_inputs = em28xx_boards[model].vchannels; for (i = 0; i < TVNORMS; i++) - if (em2820_boards[model].norm == tvnorms[i].mode) + if (em28xx_boards[model].norm == tvnorms[i].mode) break; if (i == TVNORMS) i = 0; dev->tvnorm = &tvnorms[i]; /* set default norm */ - em2820_videodbg("tvnorm=%s\n", dev->tvnorm->name); + em28xx_videodbg("tvnorm=%s\n", dev->tvnorm->name); maxw = norm_maxw(dev); maxh = norm_maxh(dev); @@ -1622,7 +1623,7 @@ static int em2820_init_dev(struct em2820 **devhandle, struct usb_device *udev, /* set default image size */ dev->width = maxw; dev->height = maxh; - dev->interlaced = EM2820_INTERLACED_DEFAULT; + dev->interlaced = EM28XX_INTERLACED_DEFAULT; dev->field_size = dev->width * dev->height; dev->frame_size = dev->interlaced ? dev->field_size << 1 : dev->field_size; @@ -1644,7 +1645,7 @@ static int em2820_init_dev(struct em2820 **devhandle, struct usb_device *udev, /* compute alternate max packet sizes */ uif = dev->udev->actconfig->interface[0]; dev->alt_max_pkt_size[0] = 0; - for (i = 1; i <= EM2820_MAX_ALT && i < uif->num_altsetting ; i++) { + for (i = 1; i <= EM28XX_MAX_ALT && i < uif->num_altsetting ; i++) { u16 tmp = le16_to_cpu(uif->altsetting[i].endpoint[1].desc. wMaxPacketSize); @@ -1654,35 +1655,35 @@ static int em2820_init_dev(struct em2820 **devhandle, struct usb_device *udev, #ifdef CONFIG_MODULES /* request some modules */ - if (dev->decoder == EM2820_SAA7113 || dev->decoder == EM2820_SAA7114) + if (dev->decoder == EM28XX_SAA7113 || dev->decoder == EM28XX_SAA7114) request_module("saa711x"); - if (dev->decoder == EM2820_TVP5150) + if (dev->decoder == EM28XX_TVP5150) request_module("tvp5150"); if (dev->has_tuner) request_module("tuner"); if (dev->tda9887_conf) request_module("tda9887"); #endif - errCode = em2820_config(dev); + errCode = em28xx_config(dev); if (errCode) { - em2820_errdev("error configuring device\n"); + em28xx_errdev("error configuring device\n"); kfree(dev); return -ENOMEM; } down(&dev->lock); /* register i2c bus */ - em2820_i2c_register(dev); + em28xx_i2c_register(dev); /* Do board specific init and eeprom reading */ - em2820_card_setup(dev); + em28xx_card_setup(dev); /* configure the device */ - em2820_config_i2c(dev); + em28xx_config_i2c(dev); up(&dev->lock); - errCode = em2820_config(dev); + errCode = em28xx_config(dev); #ifdef CONFIG_MODULES if (dev->has_msp34xx) @@ -1691,7 +1692,7 @@ static int em2820_init_dev(struct em2820 **devhandle, struct usb_device *udev, /* allocate and fill v4l2 device struct */ dev->vdev = video_device_alloc(); if (NULL == dev->vdev) { - em2820_errdev("cannot allocate video_device.\n"); + em28xx_errdev("cannot allocate video_device.\n"); kfree(dev); return -ENOMEM; } @@ -1700,18 +1701,18 @@ static int em2820_init_dev(struct em2820 **devhandle, struct usb_device *udev, if (dev->has_tuner) dev->vdev->type |= VID_TYPE_TUNER; dev->vdev->hardware = 0; - dev->vdev->fops = &em2820_v4l_fops; + dev->vdev->fops = &em28xx_v4l_fops; dev->vdev->minor = -1; dev->vdev->dev = &dev->udev->dev; dev->vdev->release = video_device_release; snprintf(dev->vdev->name, sizeof(dev->vdev->name), "%s", - "em2820 video"); - list_add_tail(&dev->devlist,&em2820_devlist); + "em28xx video"); + list_add_tail(&dev->devlist,&em28xx_devlist); /* register v4l2 device */ down(&dev->lock); if ((retval = video_register_device(dev->vdev, VFL_TYPE_GRABBER, -1))) { - em2820_errdev("unable to register video device (error=%i).\n", + em28xx_errdev("unable to register video device (error=%i).\n", retval); up(&dev->lock); list_del(&dev->devlist); @@ -1721,9 +1722,9 @@ static int em2820_init_dev(struct em2820 **devhandle, struct usb_device *udev, } if (dev->has_msp34xx) { /* Send a reset to other chips via gpio */ - em2820_write_regs_req(dev, 0x00, 0x08, "\xf7", 1); + em28xx_write_regs_req(dev, 0x00, 0x08, "\xf7", 1); udelay(2500); - em2820_write_regs_req(dev, 0x00, 0x08, "\xff", 1); + em28xx_write_regs_req(dev, 0x00, 0x08, "\xff", 1); udelay(2500); } @@ -1731,22 +1732,22 @@ static int em2820_init_dev(struct em2820 **devhandle, struct usb_device *udev, up(&dev->lock); - em2820_info("V4L2 device registered as /dev/video%d\n", + em28xx_info("V4L2 device registered as /dev/video%d\n", dev->vdev->minor); return 0; } /* - * em2820_usb_probe() + * em28xx_usb_probe() * checks for supported devices */ -static int em2820_usb_probe(struct usb_interface *interface, +static int em28xx_usb_probe(struct usb_interface *interface, const struct usb_device_id *id) { const struct usb_endpoint_descriptor *endpoint; struct usb_device *udev; - struct em2820 *dev = NULL; + struct em28xx *dev = NULL; int retval = -ENODEV; int model,i,nr,ifnum; @@ -1756,14 +1757,14 @@ static int em2820_usb_probe(struct usb_interface *interface, /* Don't register audio interfaces */ if (interface->altsetting[0].desc.bInterfaceClass == USB_CLASS_AUDIO) { - em2820_err(DRIVER_NAME " audio device (%04x:%04x): interface %i, class %i\n", + em28xx_err(DRIVER_NAME " audio device (%04x:%04x): interface %i, class %i\n", udev->descriptor.idVendor,udev->descriptor.idProduct, ifnum, interface->altsetting[0].desc.bInterfaceClass); return -ENODEV; } - em2820_err(DRIVER_NAME " new video device (%04x:%04x): interface %i, class %i\n", + em28xx_err(DRIVER_NAME " new video device (%04x:%04x): interface %i, class %i\n", udev->descriptor.idVendor,udev->descriptor.idProduct, ifnum, interface->altsetting[0].desc.bInterfaceClass); @@ -1773,33 +1774,33 @@ static int em2820_usb_probe(struct usb_interface *interface, /* check if the the device has the iso in endpoint at the correct place */ if ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_ISOC) { - em2820_err(DRIVER_NAME " probing error: endpoint is non-ISO endpoint!\n"); + em28xx_err(DRIVER_NAME " probing error: endpoint is non-ISO endpoint!\n"); return -ENODEV; } if ((endpoint->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT) { - em2820_err(DRIVER_NAME " probing error: endpoint is ISO OUT endpoint!\n"); + em28xx_err(DRIVER_NAME " probing error: endpoint is ISO OUT endpoint!\n"); return -ENODEV; } model=id->driver_info; nr=interface->minor; - if (nr>EM2820_MAXBOARDS) { - printk ("em2820: Supports only %i em28xx boards.\n",EM2820_MAXBOARDS); + if (nr>EM28XX_MAXBOARDS) { + printk ("em28xx: Supports only %i em28xx boards.\n",EM28XX_MAXBOARDS); return -ENOMEM; } /* allocate memory for our device state and initialize it */ dev = kmalloc(sizeof(*dev), GFP_KERNEL); if (dev == NULL) { - em2820_err(DRIVER_NAME ": out of memory!\n"); + em28xx_err(DRIVER_NAME ": out of memory!\n"); return -ENOMEM; } memset(dev, 0, sizeof(*dev)); - snprintf(dev->name, 29, "em2820 #%d", nr); + snprintf(dev->name, 29, "em28xx #%d", nr); - if ((card[nr]>=0)&&(card[nr]=0)&&(card[nr]name,dev->name,dev->name,dev->name,dev->name); printk("%s: Here is a list of valid choices for the card= insmod option:\n", dev->name); - for (i = 0; i < em2820_bcount; i++) { + for (i = 0; i < em28xx_bcount; i++) { printk("%s: card=%d -> %s\n", - dev->name, i, em2820_boards[i].name); + dev->name, i, em28xx_boards[i].name); } } /* allocate device struct */ - retval = em2820_init_dev(&dev, udev, nr, model); + retval = em28xx_init_dev(&dev, udev, nr, model); if (retval) return retval; - em2820_info("Found %s\n", em2820_boards[model].name); + em28xx_info("Found %s\n", em28xx_boards[model].name); /* save our data pointer in this interface device */ usb_set_intfdata(interface, dev); @@ -1830,38 +1831,38 @@ static int em2820_usb_probe(struct usb_interface *interface, } /* - * em2820_usb_disconnect() + * em28xx_usb_disconnect() * called when the device gets diconencted * video device will be unregistered on v4l2_close in case it is still open */ -static void em2820_usb_disconnect(struct usb_interface *interface) +static void em28xx_usb_disconnect(struct usb_interface *interface) { - struct em2820 *dev = usb_get_intfdata(interface); + struct em28xx *dev = usb_get_intfdata(interface); usb_set_intfdata(interface, NULL); if (!dev) return; - down_write(&em2820_disconnect); + down_write(&em28xx_disconnect); down(&dev->lock); - em2820_info("disconnecting %s\n", dev->vdev->name); + em28xx_info("disconnecting %s\n", dev->vdev->name); wake_up_interruptible_all(&dev->open); if (dev->users) { - em2820_warn + em28xx_warn ("device /dev/video%d is open! Deregistration and memory " "deallocation are deferred on close.\n", dev->vdev->minor); dev->state |= DEV_MISCONFIGURED; - em2820_uninit_isoc(dev); + em28xx_uninit_isoc(dev); dev->state |= DEV_DISCONNECTED; wake_up_interruptible(&dev->wait_frame); wake_up_interruptible(&dev->wait_stream); } else { dev->state |= DEV_DISCONNECTED; - em2820_release_resources(dev); + em28xx_release_resources(dev); } up(&dev->lock); @@ -1869,44 +1870,44 @@ static void em2820_usb_disconnect(struct usb_interface *interface) if (!dev->users) kfree(dev); - up_write(&em2820_disconnect); + up_write(&em28xx_disconnect); } -static struct usb_driver em2820_usb_driver = { +static struct usb_driver em28xx_usb_driver = { .owner = THIS_MODULE, - .name = "em2820", - .probe = em2820_usb_probe, - .disconnect = em2820_usb_disconnect, - .id_table = em2820_id_table, + .name = "em28xx", + .probe = em28xx_usb_probe, + .disconnect = em28xx_usb_disconnect, + .id_table = em28xx_id_table, }; -static int __init em2820_module_init(void) +static int __init em28xx_module_init(void) { int result; printk(KERN_INFO DRIVER_NAME " v4l2 driver version %d.%d.%d loaded\n", - (EM2820_VERSION_CODE >> 16) & 0xff, - (EM2820_VERSION_CODE >> 8) & 0xff, EM2820_VERSION_CODE & 0xff); + (EM28XX_VERSION_CODE >> 16) & 0xff, + (EM28XX_VERSION_CODE >> 8) & 0xff, EM28XX_VERSION_CODE & 0xff); #ifdef SNAPSHOT printk(KERN_INFO DRIVER_NAME " snapshot date %04d-%02d-%02d\n", SNAPSHOT / 10000, (SNAPSHOT / 100) % 100, SNAPSHOT % 100); #endif /* register this driver with the USB subsystem */ - result = usb_register(&em2820_usb_driver); + result = usb_register(&em28xx_usb_driver); if (result) - em2820_err(DRIVER_NAME + em28xx_err(DRIVER_NAME " usb_register failed. Error number %d.\n", result); return result; } -static void __exit em2820_module_exit(void) +static void __exit em28xx_module_exit(void) { /* deregister this driver with the USB subsystem */ - usb_deregister(&em2820_usb_driver); + usb_deregister(&em28xx_usb_driver); } -module_init(em2820_module_init); -module_exit(em2820_module_exit); +module_init(em28xx_module_init); +module_exit(em28xx_module_exit); diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h index 8c58c5b5fa36..d51f8c63bcf9 100644 --- a/drivers/media/video/em28xx/em28xx.h +++ b/drivers/media/video/em28xx/em28xx.h @@ -1,5 +1,5 @@ /* - em2820-cards.c - driver for Empia EM2800/EM2820/2840 USB video capture devices + em28xx-cards.c - driver for Empia EM2800/EM2820/2840 USB video capture devices Copyright (C) 2005 Markus Rechberger Ludovico Cavedon @@ -22,8 +22,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef _EM2820_H -#define _EM2820_H +#ifndef _EM28XX_H +#define _EM28XX_H #include #include @@ -45,27 +45,27 @@ #define UNSET -1 /* maximum number of em28xx boards */ -#define EM2820_MAXBOARDS 1 /*FIXME: should be bigger */ +#define EM28XX_MAXBOARDS 1 /*FIXME: should be bigger */ /* maximum number of frames that can be queued */ -#define EM2820_NUM_FRAMES 5 +#define EM28XX_NUM_FRAMES 5 /* number of frames that get used for v4l2_read() */ -#define EM2820_NUM_READ_FRAMES 2 +#define EM28XX_NUM_READ_FRAMES 2 /* number of buffers for isoc transfers */ -#define EM2820_NUM_BUFS 5 +#define EM28XX_NUM_BUFS 5 /* number of packets for each buffer windows requests only 40 packets .. so we better do the same this is what I found out for all alternate numbers there! */ -#define EM2820_NUM_PACKETS 40 +#define EM28XX_NUM_PACKETS 40 /* default alternate; 0 means choose the best */ -#define EM2820_PINOUT 0 -#define EM2820_MAX_ALT 7 +#define EM28XX_PINOUT 0 +#define EM28XX_MAX_ALT 7 -#define EM2820_INTERLACED_DEFAULT 1 +#define EM28XX_INTERLACED_DEFAULT 1 /* #define (use usbview if you want to get the other alternate number infos) @@ -89,13 +89,13 @@ */ /* time to wait when stopping the isoc transfer */ -#define EM2820_URB_TIMEOUT msecs_to_jiffies(EM2820_NUM_BUFS * EM2820_NUM_PACKETS) +#define EM28XX_URB_TIMEOUT msecs_to_jiffies(EM28XX_NUM_BUFS * EM28XX_NUM_PACKETS) /* time in msecs to wait for i2c writes to finish */ #define EM2800_I2C_WRITE_TIMEOUT 20 /* the various frame states */ -enum em2820_frame_state { +enum em28xx_frame_state { F_UNUSED = 0, F_QUEUED, F_GRABBING, @@ -104,17 +104,17 @@ enum em2820_frame_state { }; /* stream states */ -enum em2820_stream_state { +enum em28xx_stream_state { STREAM_OFF, STREAM_INTERRUPT, STREAM_ON, }; /* frames */ -struct em2820_frame_t { +struct em28xx_frame_t { void *bufmem; struct v4l2_buffer buf; - enum em2820_frame_state state; + enum em28xx_frame_state state; struct list_head frame; unsigned long vma_use_count; int top_field; @@ -122,7 +122,7 @@ struct em2820_frame_t { }; /* io methods */ -enum em2820_io_method { +enum em28xx_io_method { IO_NONE, IO_READ, IO_MMAP, @@ -130,35 +130,35 @@ enum em2820_io_method { /* inputs */ -#define MAX_EM2820_INPUT 4 -enum enum2820_itype { - EM2820_VMUX_COMPOSITE1 = 1, - EM2820_VMUX_COMPOSITE2, - EM2820_VMUX_COMPOSITE3, - EM2820_VMUX_COMPOSITE4, - EM2820_VMUX_SVIDEO, - EM2820_VMUX_TELEVISION, - EM2820_VMUX_CABLE, - EM2820_VMUX_DVB, - EM2820_VMUX_DEBUG, - EM2820_RADIO, +#define MAX_EM28XX_INPUT 4 +enum enum28xx_itype { + EM28XX_VMUX_COMPOSITE1 = 1, + EM28XX_VMUX_COMPOSITE2, + EM28XX_VMUX_COMPOSITE3, + EM28XX_VMUX_COMPOSITE4, + EM28XX_VMUX_SVIDEO, + EM28XX_VMUX_TELEVISION, + EM28XX_VMUX_CABLE, + EM28XX_VMUX_DVB, + EM28XX_VMUX_DEBUG, + EM28XX_RADIO, }; -struct em2820_input { - enum enum2820_itype type; +struct em28xx_input { + enum enum28xx_itype type; unsigned int vmux; unsigned int amux; }; -#define INPUT(nr) (&em2820_boards[dev->model].input[nr]) +#define INPUT(nr) (&em28xx_boards[dev->model].input[nr]) -enum em2820_decoder { - EM2820_TVP5150, - EM2820_SAA7113, - EM2820_SAA7114 +enum em28xx_decoder { + EM28XX_TVP5150, + EM28XX_SAA7113, + EM28XX_SAA7114 }; -struct em2820_board { +struct em28xx_board { char *name; int vchannels; int norm; @@ -171,12 +171,12 @@ struct em2820_board { unsigned int has_tuner:1; unsigned int has_msp34xx:1; - enum em2820_decoder decoder; + enum em28xx_decoder decoder; - struct em2820_input input[MAX_EM2820_INPUT]; + struct em28xx_input input[MAX_EM28XX_INPUT]; }; -struct em2820_eeprom { +struct em28xx_eeprom { u32 id; /* 0x9567eb1a */ u16 vendor_ID; u16 product_ID; @@ -191,14 +191,14 @@ struct em2820_eeprom { }; /* device states */ -enum em2820_dev_state { +enum em28xx_dev_state { DEV_INITIALIZED = 0x01, DEV_DISCONNECTED = 0x02, DEV_MISCONFIGURED = 0x04, }; /* tvnorms */ -struct em2820_tvnorm { +struct em28xx_tvnorm { char *name; v4l2_std_id id; /* mode for saa7113h */ @@ -206,7 +206,7 @@ struct em2820_tvnorm { }; /* main device struct */ -struct em2820 { +struct em28xx { /* generic device properties */ char name[30]; /* name (including minor) of the device */ int model; /* index in the device_data struct */ @@ -217,7 +217,7 @@ struct em2820 { unsigned int has_msp34xx:1; unsigned int has_tda9887:1; - enum em2820_decoder decoder; + enum em28xx_decoder decoder; int tuner_type; /* type of the tuner */ int tuner_addr; /* tuner address */ @@ -229,17 +229,17 @@ struct em2820 { int users; /* user count for exclusive use */ struct video_device *vdev; /* video for linux device struct */ struct video_picture vpic; /* picture settings only used to init saa7113h */ - struct em2820_tvnorm *tvnorm; /* selected tv norm */ + struct em28xx_tvnorm *tvnorm; /* selected tv norm */ int ctl_freq; /* selected frequency */ unsigned int ctl_input; /* selected input */ unsigned int ctl_ainput; /* slected audio input */ int mute; int volume; /* frame properties */ - struct em2820_frame_t frame[EM2820_NUM_FRAMES]; /* list of frames */ + struct em28xx_frame_t frame[EM28XX_NUM_FRAMES]; /* list of frames */ int num_frames; /* number of frames currently in use */ unsigned int frame_count; /* total number of transfered frames */ - struct em2820_frame_t *frame_current; /* the frame that is being filled */ + struct em28xx_frame_t *frame_current; /* the frame that is being filled */ int width; /* current frame width */ int height; /* current frame height */ int frame_size; /* current frame size */ @@ -251,9 +251,9 @@ struct em2820 { int type; /* states */ - enum em2820_dev_state state; - enum em2820_stream_state stream; - enum em2820_io_method io; + enum em28xx_dev_state state; + enum em28xx_stream_state stream; + enum em28xx_io_method io; /* locks */ struct semaphore lock, fileop_lock; spinlock_t queue_lock; @@ -267,71 +267,71 @@ struct em2820 { struct usb_device *udev; /* the usb device */ int alt; /* alternate */ int max_pkt_size; /* max packet size of isoc transaction */ - unsigned int alt_max_pkt_size[EM2820_MAX_ALT + 1]; /* array of wMaxPacketSize */ - struct urb *urb[EM2820_NUM_BUFS]; /* urb for isoc transfers */ - char *transfer_buffer[EM2820_NUM_BUFS]; /* transfer buffers for isoc transfer */ + unsigned int alt_max_pkt_size[EM28XX_MAX_ALT + 1]; /* array of wMaxPacketSize */ + struct urb *urb[EM28XX_NUM_BUFS]; /* urb for isoc transfers */ + char *transfer_buffer[EM28XX_NUM_BUFS]; /* transfer buffers for isoc transfer */ /* helper funcs that call usb_control_msg */ - int (*em2820_write_regs) (struct em2820 * dev, u16 reg, char *buf, + int (*em28xx_write_regs) (struct em28xx * dev, u16 reg, char *buf, int len); - int (*em2820_read_reg) (struct em2820 * dev, u16 reg); - int (*em2820_read_reg_req_len) (struct em2820 * dev, u8 req, u16 reg, + int (*em28xx_read_reg) (struct em28xx * dev, u16 reg); + int (*em28xx_read_reg_req_len) (struct em28xx * dev, u8 req, u16 reg, char *buf, int len); - int (*em2820_write_regs_req) (struct em2820 * dev, u8 req, u16 reg, + int (*em28xx_write_regs_req) (struct em28xx * dev, u8 req, u16 reg, char *buf, int len); - int (*em2820_read_reg_req) (struct em2820 * dev, u8 req, u16 reg); + int (*em28xx_read_reg_req) (struct em28xx * dev, u8 req, u16 reg); }; -/* Provided by em2820-i2c.c */ +/* Provided by em28xx-i2c.c */ -void em2820_i2c_call_clients(struct em2820 *dev, unsigned int cmd, void *arg); -int em2820_i2c_register(struct em2820 *dev); -int em2820_i2c_unregister(struct em2820 *dev); +void em28xx_i2c_call_clients(struct em28xx *dev, unsigned int cmd, void *arg); +int em28xx_i2c_register(struct em28xx *dev); +int em28xx_i2c_unregister(struct em28xx *dev); -/* Provided by em2820-input.c */ +/* Provided by em28xx-input.c */ -void em2820_set_ir(struct em2820 * dev,struct IR_i2c *ir); +void em28xx_set_ir(struct em28xx * dev,struct IR_i2c *ir); -/* Provided by em2820-core.c */ +/* Provided by em28xx-core.c */ -void em2820_print_ioctl(char *name, unsigned int cmd); +void em28xx_print_ioctl(char *name, unsigned int cmd); -u32 em2820_request_buffers(struct em2820 *dev, u32 count); -void em2820_queue_unusedframes(struct em2820 *dev); -void em2820_release_buffers(struct em2820 *dev); +u32 em28xx_request_buffers(struct em28xx *dev, u32 count); +void em28xx_queue_unusedframes(struct em28xx *dev); +void em28xx_release_buffers(struct em28xx *dev); -int em2820_read_reg_req_len(struct em2820 *dev, u8 req, u16 reg, +int em28xx_read_reg_req_len(struct em28xx *dev, u8 req, u16 reg, char *buf, int len); -int em2820_read_reg_req(struct em2820 *dev, u8 req, u16 reg); -int em2820_read_reg(struct em2820 *dev, u16 reg); -int em2820_write_regs_req(struct em2820 *dev, u8 req, u16 reg, char *buf, +int em28xx_read_reg_req(struct em28xx *dev, u8 req, u16 reg); +int em28xx_read_reg(struct em28xx *dev, u16 reg); +int em28xx_write_regs_req(struct em28xx *dev, u8 req, u16 reg, char *buf, int len); -int em2820_write_regs(struct em2820 *dev, u16 reg, char *buf, int len); -int em2820_write_reg_bits(struct em2820 *dev, u16 reg, u8 val, +int em28xx_write_regs(struct em28xx *dev, u16 reg, char *buf, int len); +int em28xx_write_reg_bits(struct em28xx *dev, u16 reg, u8 val, u8 bitmask); -int em2820_write_ac97(struct em2820 *dev, u8 reg, u8 * val); -int em2820_audio_analog_set(struct em2820 *dev); -int em2820_colorlevels_set_default(struct em2820 *dev); -int em2820_capture_start(struct em2820 *dev, int start); -int em2820_outfmt_set_yuv422(struct em2820 *dev); -int em2820_accumulator_set(struct em2820 *dev, u8 xmin, u8 xmax, u8 ymin, +int em28xx_write_ac97(struct em28xx *dev, u8 reg, u8 * val); +int em28xx_audio_analog_set(struct em28xx *dev); +int em28xx_colorlevels_set_default(struct em28xx *dev); +int em28xx_capture_start(struct em28xx *dev, int start); +int em28xx_outfmt_set_yuv422(struct em28xx *dev); +int em28xx_accumulator_set(struct em28xx *dev, u8 xmin, u8 xmax, u8 ymin, u8 ymax); -int em2820_capture_area_set(struct em2820 *dev, u8 hstart, u8 vstart, +int em28xx_capture_area_set(struct em28xx *dev, u8 hstart, u8 vstart, u16 width, u16 height); -int em2820_scaler_set(struct em2820 *dev, u16 h, u16 v); -int em2820_resolution_set(struct em2820 *dev); -void em2820_isocIrq(struct urb *urb, struct pt_regs *regs); -int em2820_init_isoc(struct em2820 *dev); -void em2820_uninit_isoc(struct em2820 *dev); -int em2820_set_alternate(struct em2820 *dev); - -/* Provided by em2820-cards.c */ +int em28xx_scaler_set(struct em28xx *dev, u16 h, u16 v); +int em28xx_resolution_set(struct em28xx *dev); +void em28xx_isocIrq(struct urb *urb, struct pt_regs *regs); +int em28xx_init_isoc(struct em28xx *dev); +void em28xx_uninit_isoc(struct em28xx *dev); +int em28xx_set_alternate(struct em28xx *dev); + +/* Provided by em28xx-cards.c */ extern int em2800_variant_detect(struct usb_device* udev,int model); -extern void em2820_card_setup(struct em2820 *dev); -extern struct em2820_board em2820_boards[]; -extern struct usb_device_id em2820_id_table[]; -extern const unsigned int em2820_bcount; +extern void em28xx_card_setup(struct em28xx *dev); +extern struct em28xx_board em28xx_boards[]; +extern struct usb_device_id em28xx_id_table[]; +extern const unsigned int em28xx_bcount; -/* em2820 registers */ +/* em28xx registers */ #define CHIPID_REG 0x0a #define USBSUSP_REG 0x0c /* */ @@ -386,115 +386,115 @@ extern const unsigned int em2820_bcount; #define VIDEO_AC97 0x14 /* register settings */ -#define EM2820_AUDIO_SRC_TUNER 0xc0 -#define EM2820_AUDIO_SRC_LINE 0x80 +#define EM28XX_AUDIO_SRC_TUNER 0xc0 +#define EM28XX_AUDIO_SRC_LINE 0x80 /* printk macros */ -#define em2820_err(fmt, arg...) do {\ +#define em28xx_err(fmt, arg...) do {\ printk(KERN_ERR fmt , ##arg); } while (0) -#define em2820_errdev(fmt, arg...) do {\ +#define em28xx_errdev(fmt, arg...) do {\ printk(KERN_ERR "%s: "fmt,\ dev->name , ##arg); } while (0) -#define em2820_info(fmt, arg...) do {\ +#define em28xx_info(fmt, arg...) do {\ printk(KERN_INFO "%s: "fmt,\ dev->name , ##arg); } while (0) -#define em2820_warn(fmt, arg...) do {\ +#define em28xx_warn(fmt, arg...) do {\ printk(KERN_WARNING "%s: "fmt,\ dev->name , ##arg); } while (0) -inline static int em2820_audio_source(struct em2820 *dev, int input) +inline static int em28xx_audio_source(struct em28xx *dev, int input) { - return em2820_write_reg_bits(dev, AUDIOSRC_REG, input, 0xc0); + return em28xx_write_reg_bits(dev, AUDIOSRC_REG, input, 0xc0); } -inline static int em2820_audio_usb_mute(struct em2820 *dev, int mute) +inline static int em28xx_audio_usb_mute(struct em28xx *dev, int mute) { - return em2820_write_reg_bits(dev, XCLK_REG, mute ? 0x00 : 0x80, 0x80); + return em28xx_write_reg_bits(dev, XCLK_REG, mute ? 0x00 : 0x80, 0x80); } -inline static int em2820_audio_analog_setup(struct em2820 *dev) +inline static int em28xx_audio_analog_setup(struct em28xx *dev) { /* unmute video mixer with default volume level */ - return em2820_write_ac97(dev, VIDEO_AC97, "\x08\x08"); + return em28xx_write_ac97(dev, VIDEO_AC97, "\x08\x08"); } -inline static int em2820_compression_disable(struct em2820 *dev) +inline static int em28xx_compression_disable(struct em28xx *dev) { /* side effect of disabling scaler and mixer */ - return em2820_write_regs(dev, COMPR_REG, "\x00", 1); + return em28xx_write_regs(dev, COMPR_REG, "\x00", 1); } -inline static int em2820_contrast_get(struct em2820 *dev) +inline static int em28xx_contrast_get(struct em28xx *dev) { - return em2820_read_reg(dev, YGAIN_REG) & 0x1f; + return em28xx_read_reg(dev, YGAIN_REG) & 0x1f; } -inline static int em2820_brightness_get(struct em2820 *dev) +inline static int em28xx_brightness_get(struct em28xx *dev) { - return em2820_read_reg(dev, YOFFSET_REG); + return em28xx_read_reg(dev, YOFFSET_REG); } -inline static int em2820_saturation_get(struct em2820 *dev) +inline static int em28xx_saturation_get(struct em28xx *dev) { - return em2820_read_reg(dev, UVGAIN_REG) & 0x1f; + return em28xx_read_reg(dev, UVGAIN_REG) & 0x1f; } -inline static int em2820_u_balance_get(struct em2820 *dev) +inline static int em28xx_u_balance_get(struct em28xx *dev) { - return em2820_read_reg(dev, UOFFSET_REG); + return em28xx_read_reg(dev, UOFFSET_REG); } -inline static int em2820_v_balance_get(struct em2820 *dev) +inline static int em28xx_v_balance_get(struct em28xx *dev) { - return em2820_read_reg(dev, VOFFSET_REG); + return em28xx_read_reg(dev, VOFFSET_REG); } -inline static int em2820_gamma_get(struct em2820 *dev) +inline static int em28xx_gamma_get(struct em28xx *dev) { - return em2820_read_reg(dev, GAMMA_REG) & 0x3f; + return em28xx_read_reg(dev, GAMMA_REG) & 0x3f; } -inline static int em2820_contrast_set(struct em2820 *dev, s32 val) +inline static int em28xx_contrast_set(struct em28xx *dev, s32 val) { u8 tmp = (u8) val; - return em2820_write_regs(dev, YGAIN_REG, &tmp, 1); + return em28xx_write_regs(dev, YGAIN_REG, &tmp, 1); } -inline static int em2820_brightness_set(struct em2820 *dev, s32 val) +inline static int em28xx_brightness_set(struct em28xx *dev, s32 val) { u8 tmp = (u8) val; - return em2820_write_regs(dev, YOFFSET_REG, &tmp, 1); + return em28xx_write_regs(dev, YOFFSET_REG, &tmp, 1); } -inline static int em2820_saturation_set(struct em2820 *dev, s32 val) +inline static int em28xx_saturation_set(struct em28xx *dev, s32 val) { u8 tmp = (u8) val; - return em2820_write_regs(dev, UVGAIN_REG, &tmp, 1); + return em28xx_write_regs(dev, UVGAIN_REG, &tmp, 1); } -inline static int em2820_u_balance_set(struct em2820 *dev, s32 val) +inline static int em28xx_u_balance_set(struct em28xx *dev, s32 val) { u8 tmp = (u8) val; - return em2820_write_regs(dev, UOFFSET_REG, &tmp, 1); + return em28xx_write_regs(dev, UOFFSET_REG, &tmp, 1); } -inline static int em2820_v_balance_set(struct em2820 *dev, s32 val) +inline static int em28xx_v_balance_set(struct em28xx *dev, s32 val) { u8 tmp = (u8) val; - return em2820_write_regs(dev, VOFFSET_REG, &tmp, 1); + return em28xx_write_regs(dev, VOFFSET_REG, &tmp, 1); } -inline static int em2820_gamma_set(struct em2820 *dev, s32 val) +inline static int em28xx_gamma_set(struct em28xx *dev, s32 val) { u8 tmp = (u8) val; - return em2820_write_regs(dev, GAMMA_REG, &tmp, 1); + return em28xx_write_regs(dev, GAMMA_REG, &tmp, 1); } /*FIXME: maxw should be dependent of alt mode */ -inline static unsigned int norm_maxw(struct em2820 *dev) +inline static unsigned int norm_maxw(struct em28xx *dev) { switch(dev->model){ case (EM2820_BOARD_MSI_VOX_USB_2): return(640); @@ -502,7 +502,7 @@ inline static unsigned int norm_maxw(struct em2820 *dev) } } -inline static unsigned int norm_maxh(struct em2820 *dev) +inline static unsigned int norm_maxh(struct em28xx *dev) { switch(dev->model){ case (EM2820_BOARD_MSI_VOX_USB_2): return(480); -- cgit v1.2.2 From c3b3924ea0843d6956e5f87c3a4be09f460fe923 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:38:29 -0800 Subject: [PATCH] v4l: 887: i2c id h updated to reflect the newer drivers - I2c-id.h Updated to reflect the newer drivers. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/i2c-id.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h index 815675f1e349..74abaecdb572 100644 --- a/include/linux/i2c-id.h +++ b/include/linux/i2c-id.h @@ -102,7 +102,11 @@ #define I2C_DRIVERID_TDA9874 66 /* TV sound decoder */ #define I2C_DRIVERID_SAA6752HS 67 /* MPEG2 encoder */ #define I2C_DRIVERID_TVEEPROM 68 /* TV EEPROM */ - +#define I2C_DRIVERID_WM8775 69 /* wm8775 audio processor */ +#define I2C_DRIVERID_CS53L32A 70 /* cs53l32a audio processor */ +#define I2C_DRIVERID_CX25840 71 /* cx2584x video encoder */ +#define I2C_DRIVERID_SAA7127 72 /* saa7124 video encoder */ +#define I2C_DRIVERID_SAA711X 73 /* saa711x video encoders */ #define I2C_DRIVERID_EXP0 0xF0 /* experimental use id's */ #define I2C_DRIVERID_EXP1 0xF1 @@ -193,6 +197,7 @@ #define I2C_HW_B_NVIDIA 0x01001c /* nvidia framebuffer driver */ #define I2C_HW_B_SAVAGE 0x01001d /* savage framebuffer driver */ #define I2C_HW_B_RADEON 0x01001e /* radeon framebuffer driver */ +#define I2C_HW_B_EM28XX 0x01001f /* em28xx video capture cards */ /* --- PCF 8584 based algorithms */ #define I2C_HW_P_LP 0x020000 /* Parallel port interface */ -- cgit v1.2.2 From 404b32fb3d93c17f994ad4b1d852ce4ca682ff8b Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:38:29 -0800 Subject: [PATCH] v4l: 888: saa7113 renamed to saa711x - Saa7113 renamed to saa711x Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/saa711x.c | 206 ++++++++++++++++++++---------------------- 1 file changed, 100 insertions(+), 106 deletions(-) diff --git a/drivers/media/video/saa711x.c b/drivers/media/video/saa711x.c index 85f3403f7404..9aa8827de2c3 100644 --- a/drivers/media/video/saa711x.c +++ b/drivers/media/video/saa711x.c @@ -1,16 +1,10 @@ /* - * saa7111 - Philips SAA7113A video decoder driver version 0.0.3 + * saa711x - Philips SAA711x video decoder driver version 0.0.1 * - * Copyright (C) 1998 Dave Perks + * To do: Now, it handles only saa7113/7114. Should be improved to + * handle all Philips saa711x devices. * - * Slight changes for video timing and attachment output by - * Wolfgang Scherr - * - * Changes by Ronald Bultje - * - moved over to linux>=2.4.x i2c protocol (1/1/2003) - * - * Changes by Michael Hunold - * - implemented DECODER_SET_GPIO, DECODER_INIT, DECODER_SET_VBI_BYPASS + * Based on saa7113 driver from Dave Perks * * 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 @@ -47,7 +41,7 @@ #include #include -MODULE_DESCRIPTION("Philips SAA7113 video decoder driver"); +MODULE_DESCRIPTION("Philips SAA711x video decoder driver"); MODULE_AUTHOR("Dave Perks, Jose Ignacio Gijon, Joerg Heckenbach, Mark McClelland, Dwaine Garden"); MODULE_LICENSE("GPL"); @@ -71,7 +65,7 @@ MODULE_PARM_DESC(debug, " Set the default Debug level. Default: 0 (Off) - (0-1) /* ----------------------------------------------------------------------- */ -struct saa7113 { +struct saa711x { unsigned char reg[32]; int norm; @@ -89,29 +83,29 @@ struct saa7113 { /* ----------------------------------------------------------------------- */ static inline int -saa7113_write (struct i2c_client *client, +saa711x_write (struct i2c_client *client, u8 reg, u8 value) { - struct saa7113 *decoder = i2c_get_clientdata(client); + struct saa711x *decoder = i2c_get_clientdata(client); decoder->reg[reg] = value; return i2c_smbus_write_byte_data(client, reg, value); } static int -saa7113_write_block (struct i2c_client *client, +saa711x_write_block (struct i2c_client *client, const u8 *data, unsigned int len) { int ret = -1; u8 reg; - /* the saa7113 has an autoincrement function, use it if + /* the saa711x has an autoincrement function, use it if * the adapter understands raw I2C */ if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { /* do raw I2C, not smbus compatible */ - struct saa7113 *decoder = i2c_get_clientdata(client); + struct saa711x *decoder = i2c_get_clientdata(client); struct i2c_msg msg; u8 block_data[32]; @@ -136,7 +130,7 @@ saa7113_write_block (struct i2c_client *client, /* do some slow I2C emulation kind of thing */ while (len >= 2) { reg = *data++; - if ((ret = saa7113_write(client, reg, + if ((ret = saa711x_write(client, reg, *data++)) < 0) break; len -= 2; @@ -147,14 +141,14 @@ saa7113_write_block (struct i2c_client *client, } static int -saa7113_init_decoder (struct i2c_client *client, +saa711x_init_decoder (struct i2c_client *client, struct video_decoder_init *init) { - return saa7113_write_block(client, init->data, init->len); + return saa711x_write_block(client, init->data, init->len); } static inline int -saa7113_read (struct i2c_client *client, +saa711x_read (struct i2c_client *client, u8 reg) { return i2c_smbus_read_byte_data(client, reg); @@ -162,39 +156,39 @@ saa7113_read (struct i2c_client *client, /* ----------------------------------------------------------------------- */ -static const unsigned char saa7113_i2c_init[] = { - 0x00, 0x00, /* PH7113_CHIP_VERSION 00 - ID byte */ - 0x01, 0x08, /* PH7113_INCREMENT_DELAY - (1) (1) (1) (1) IDEL3 IDEL2 IDELL1 IDEL0 */ - 0x02, 0xc0, /* PH7113_ANALOG_INPUT_CONTR_1 - FUSE1 FUSE0 GUDL1 GUDL0 MODE3 MODE2 MODE1 MODE0 */ - 0x03, 0x23, /* PH7113_ANALOG_INPUT_CONTR_2 - (1) HLNRS VBSL WPOFF HOLDG GAFIX GAI28 GAI18 */ - 0x04, 0x00, /* PH7113_ANALOG_INPUT_CONTR_3 - GAI17 GAI16 GAI15 GAI14 GAI13 GAI12 GAI11 GAI10 */ - 0x05, 0x00, /* PH7113_ANALOG_INPUT_CONTR_4 - GAI27 GAI26 GAI25 GAI24 GAI23 GAI22 GAI21 GAI20 */ - 0x06, 0xeb, /* PH7113_HORIZONTAL_SYNC_START - HSB7 HSB6 HSB5 HSB4 HSB3 HSB2 HSB1 HSB0 */ - 0x07, 0xe0, /* PH7113_HORIZONTAL_SYNC_STOP - HSS7 HSS6 HSS5 HSS4 HSS3 HSS2 HSS1 HSS0 */ - 0x08, 0x88, /* PH7113_SYNC_CONTROL - AUFD FSEL FOET HTC1 HTC0 HPLL VNOI1 VNOI0 */ - 0x09, 0x00, /* PH7113_LUMINANCE_CONTROL - BYPS PREF BPSS1 BPSS0 VBLB UPTCV APER1 APER0 */ - 0x0a, 0x80, /* PH7113_LUMINANCE_BRIGHTNESS - BRIG7 BRIG6 BRIG5 BRIG4 BRIG3 BRIG2 BRIG1 BRIG0 */ - 0x0b, 0x47, /* PH7113_LUMINANCE_CONTRAST - CONT7 CONT6 CONT5 CONT4 CONT3 CONT2 CONT1 CONT0 */ - 0x0c, 0x40, /* PH7113_CHROMA_SATURATION - SATN7 SATN6 SATN5 SATN4 SATN3 SATN2 SATN1 SATN0 */ - 0x0d, 0x00, /* PH7113_CHROMA_HUE_CONTROL - HUEC7 HUEC6 HUEC5 HUEC4 HUEC3 HUEC2 HUEC1 HUEC0 */ - 0x0e, 0x01, /* PH7113_CHROMA_CONTROL - CDTO CSTD2 CSTD1 CSTD0 DCCF FCTC CHBW1 CHBW0 */ - 0x0f, 0xaa, /* PH7113_CHROMA_GAIN_CONTROL - ACGC CGAIN6 CGAIN5 CGAIN4 CGAIN3 CGAIN2 CGAIN1 CGAIN0 */ - 0x10, 0x00, /* PH7113_FORMAT_DELAY_CONTROL - OFTS1 OFTS0 HDEL1 HDEL0 VRLN YDEL2 YDEL1 YDEL0 */ - 0x11, 0x1C, /* PH7113_OUTPUT_CONTROL_1 - GPSW1 CM99 GPSW0 HLSEL OEYC OERT VIPB COLO */ - 0x12, 0x01, /* PH7113_OUTPUT_CONTROL_2 - RTSE13 RTSE12 RTSE11 RTSE10 RTSE03 RTSE02 RTSE01 RTSE00 */ - 0x13, 0x00, /* PH7113_OUTPUT_CONTROL_3 - ADLSB (1) (1) OLDSB FIDP (1) AOSL1 AOSL0 */ +static const unsigned char saa711x_i2c_init[] = { + 0x00, 0x00, /* PH711x_CHIP_VERSION 00 - ID byte */ + 0x01, 0x08, /* PH711x_INCREMENT_DELAY - (1) (1) (1) (1) IDEL3 IDEL2 IDELL1 IDEL0 */ + 0x02, 0xc0, /* PH711x_ANALOG_INPUT_CONTR_1 - FUSE1 FUSE0 GUDL1 GUDL0 MODE3 MODE2 MODE1 MODE0 */ + 0x03, 0x23, /* PH711x_ANALOG_INPUT_CONTR_2 - (1) HLNRS VBSL WPOFF HOLDG GAFIX GAI28 GAI18 */ + 0x04, 0x00, /* PH711x_ANALOG_INPUT_CONTR_3 - GAI17 GAI16 GAI15 GAI14 GAI13 GAI12 GAI11 GAI10 */ + 0x05, 0x00, /* PH711x_ANALOG_INPUT_CONTR_4 - GAI27 GAI26 GAI25 GAI24 GAI23 GAI22 GAI21 GAI20 */ + 0x06, 0xeb, /* PH711x_HORIZONTAL_SYNC_START - HSB7 HSB6 HSB5 HSB4 HSB3 HSB2 HSB1 HSB0 */ + 0x07, 0xe0, /* PH711x_HORIZONTAL_SYNC_STOP - HSS7 HSS6 HSS5 HSS4 HSS3 HSS2 HSS1 HSS0 */ + 0x08, 0x88, /* PH711x_SYNC_CONTROL - AUFD FSEL FOET HTC1 HTC0 HPLL VNOI1 VNOI0 */ + 0x09, 0x00, /* PH711x_LUMINANCE_CONTROL - BYPS PREF BPSS1 BPSS0 VBLB UPTCV APER1 APER0 */ + 0x0a, 0x80, /* PH711x_LUMINANCE_BRIGHTNESS - BRIG7 BRIG6 BRIG5 BRIG4 BRIG3 BRIG2 BRIG1 BRIG0 */ + 0x0b, 0x47, /* PH711x_LUMINANCE_CONTRAST - CONT7 CONT6 CONT5 CONT4 CONT3 CONT2 CONT1 CONT0 */ + 0x0c, 0x40, /* PH711x_CHROMA_SATURATION - SATN7 SATN6 SATN5 SATN4 SATN3 SATN2 SATN1 SATN0 */ + 0x0d, 0x00, /* PH711x_CHROMA_HUE_CONTROL - HUEC7 HUEC6 HUEC5 HUEC4 HUEC3 HUEC2 HUEC1 HUEC0 */ + 0x0e, 0x01, /* PH711x_CHROMA_CONTROL - CDTO CSTD2 CSTD1 CSTD0 DCCF FCTC CHBW1 CHBW0 */ + 0x0f, 0xaa, /* PH711x_CHROMA_GAIN_CONTROL - ACGC CGAIN6 CGAIN5 CGAIN4 CGAIN3 CGAIN2 CGAIN1 CGAIN0 */ + 0x10, 0x00, /* PH711x_FORMAT_DELAY_CONTROL - OFTS1 OFTS0 HDEL1 HDEL0 VRLN YDEL2 YDEL1 YDEL0 */ + 0x11, 0x1C, /* PH711x_OUTPUT_CONTROL_1 - GPSW1 CM99 GPSW0 HLSEL OEYC OERT VIPB COLO */ + 0x12, 0x01, /* PH711x_OUTPUT_CONTROL_2 - RTSE13 RTSE12 RTSE11 RTSE10 RTSE03 RTSE02 RTSE01 RTSE00 */ + 0x13, 0x00, /* PH711x_OUTPUT_CONTROL_3 - ADLSB (1) (1) OLDSB FIDP (1) AOSL1 AOSL0 */ 0x14, 0x00, /* RESERVED 14 - (1) (1) (1) (1) (1) (1) (1) (1) */ - 0x15, 0x00, /* PH7113_V_GATE1_START - VSTA7 VSTA6 VSTA5 VSTA4 VSTA3 VSTA2 VSTA1 VSTA0 */ - 0x16, 0x00, /* PH7113_V_GATE1_STOP - VSTO7 VSTO6 VSTO5 VSTO4 VSTO3 VSTO2 VSTO1 VSTO0 */ - 0x17, 0x00, /* PH7113_V_GATE1_MSB - (1) (1) (1) (1) (1) (1) VSTO8 VSTA8 */ + 0x15, 0x00, /* PH711x_V_GATE1_START - VSTA7 VSTA6 VSTA5 VSTA4 VSTA3 VSTA2 VSTA1 VSTA0 */ + 0x16, 0x00, /* PH711x_V_GATE1_STOP - VSTO7 VSTO6 VSTO5 VSTO4 VSTO3 VSTO2 VSTO1 VSTO0 */ + 0x17, 0x00, /* PH711x_V_GATE1_MSB - (1) (1) (1) (1) (1) (1) VSTO8 VSTA8 */ }; static int -saa7113_command (struct i2c_client *client, +saa711x_command (struct i2c_client *client, unsigned int cmd, void *arg) { - struct saa7113 *decoder = i2c_get_clientdata(client); + struct saa711x *decoder = i2c_get_clientdata(client); switch (cmd) { @@ -203,12 +197,12 @@ saa7113_command (struct i2c_client *client, { struct video_decoder_init *init = arg; if (NULL != init) - return saa7113_init_decoder(client, init); + return saa711x_init_decoder(client, init); else { struct video_decoder_init vdi; - vdi.data = saa7113_i2c_init; - vdi.len = sizeof(saa7113_i2c_init); - return saa7113_init_decoder(client, &vdi); + vdi.data = saa711x_i2c_init; + vdi.len = sizeof(saa711x_i2c_init); + return saa711x_init_decoder(client, &vdi); } } @@ -222,7 +216,7 @@ saa7113_command (struct i2c_client *client, printk(KERN_DEBUG "%s: %03x", I2C_NAME(client), i); for (j = 0; j < 16; ++j) { printk(" %02x", - saa7113_read(client, i + j)); + saa711x_read(client, i + j)); } printk("\n"); } @@ -249,7 +243,7 @@ saa7113_command (struct i2c_client *client, int status; int res; - status = saa7113_read(client, 0x1f); + status = saa711x_read(client, 0x1f); dprintk(1, KERN_DEBUG "%s status: 0x%02x\n", I2C_NAME(client), status); res = 0; @@ -286,10 +280,10 @@ saa7113_command (struct i2c_client *client, { int *iarg = arg; if (0 != *iarg) { - saa7113_write(client, 0x11, + saa711x_write(client, 0x11, (decoder->reg[0x11] | 0x80)); } else { - saa7113_write(client, 0x11, + saa711x_write(client, 0x11, (decoder->reg[0x11] & 0x7f)); } break; @@ -299,10 +293,10 @@ saa7113_command (struct i2c_client *client, { int *iarg = arg; if (0 != *iarg) { - saa7113_write(client, 0x13, + saa711x_write(client, 0x13, (decoder->reg[0x13] & 0xf0) | 0x0a); } else { - saa7113_write(client, 0x13, + saa711x_write(client, 0x13, (decoder->reg[0x13] & 0xf0)); } break; @@ -315,30 +309,30 @@ saa7113_command (struct i2c_client *client, switch (*iarg) { case VIDEO_MODE_NTSC: - saa7113_write(client, 0x08, + saa711x_write(client, 0x08, (decoder->reg[0x08] & 0x3f) | 0x40); - saa7113_write(client, 0x0e, + saa711x_write(client, 0x0e, (decoder->reg[0x0e] & 0x8f)); break; case VIDEO_MODE_PAL: - saa7113_write(client, 0x08, + saa711x_write(client, 0x08, (decoder->reg[0x08] & 0x3f) | 0x00); - saa7113_write(client, 0x0e, + saa711x_write(client, 0x0e, (decoder->reg[0x0e] & 0x8f)); break; case VIDEO_MODE_SECAM: - saa7113_write(client, 0x08, + saa711x_write(client, 0x08, (decoder->reg[0x0e] & 0x3f) | 0x00); - saa7113_write(client, 0x0e, + saa711x_write(client, 0x0e, (decoder->reg[0x0e] & 0x8f) | 0x50); break; case VIDEO_MODE_AUTO: - saa7113_write(client, 0x08, + saa711x_write(client, 0x08, (decoder->reg[0x08] & 0x3f) | 0x80); - saa7113_write(client, 0x0e, + saa711x_write(client, 0x0e, (decoder->reg[0x0e] & 0x8f)); break; @@ -359,10 +353,10 @@ saa7113_command (struct i2c_client *client, if (decoder->input != *iarg) { decoder->input = *iarg; /* select mode */ - saa7113_write(client, 0x02, + saa711x_write(client, 0x02, (decoder->reg[0x02] & 0xf0) | decoder->input); /* bypass chrominance trap for modes 4..7 */ - saa7113_write(client, 0x09, + saa711x_write(client, 0x09, (decoder->reg[0x09] & 0x7f) | ((decoder->input > 3) ? 0x80 : 0)); } } @@ -398,22 +392,22 @@ saa7113_command (struct i2c_client *client, */ if (decoder->enable) { - saa7113_write(client, 0x02, + saa711x_write(client, 0x02, (decoder-> reg[0x02] & 0xf8) | decoder->input); - saa7113_write(client, 0x08, + saa711x_write(client, 0x08, (decoder->reg[0x08] & 0xfb)); - saa7113_write(client, 0x11, + saa711x_write(client, 0x11, (decoder-> reg[0x11] & 0xf3) | 0x0c); } else { - saa7113_write(client, 0x02, + saa711x_write(client, 0x02, (decoder->reg[0x02] & 0xf8)); - saa7113_write(client, 0x08, + saa711x_write(client, 0x08, (decoder-> reg[0x08] & 0xfb) | 0x04); - saa7113_write(client, 0x11, + saa711x_write(client, 0x11, (decoder->reg[0x11] & 0xf3)); } } @@ -427,23 +421,23 @@ saa7113_command (struct i2c_client *client, if (decoder->bright != pic->brightness) { /* We want 0 to 255 we get 0-65535 */ decoder->bright = pic->brightness; - saa7113_write(client, 0x0a, decoder->bright >> 8); + saa711x_write(client, 0x0a, decoder->bright >> 8); } if (decoder->contrast != pic->contrast) { /* We want 0 to 127 we get 0-65535 */ decoder->contrast = pic->contrast; - saa7113_write(client, 0x0b, + saa711x_write(client, 0x0b, decoder->contrast >> 9); } if (decoder->sat != pic->colour) { /* We want 0 to 127 we get 0-65535 */ decoder->sat = pic->colour; - saa7113_write(client, 0x0c, decoder->sat >> 9); + saa711x_write(client, 0x0c, decoder->sat >> 9); } if (decoder->hue != pic->hue) { /* We want -128 to 127 we get 0-65535 */ decoder->hue = pic->hue; - saa7113_write(client, 0x0d, + saa711x_write(client, 0x0d, (decoder->hue - 32768) >> 8); } } @@ -473,21 +467,21 @@ static unsigned short normal_i2c[] = { I2C_CLIENT_INSMOD; -static struct i2c_driver i2c_driver_saa7113; +static struct i2c_driver i2c_driver_saa711x; static int -saa7113_detect_client (struct i2c_adapter *adapter, +saa711x_detect_client (struct i2c_adapter *adapter, int address, int kind) { int i; struct i2c_client *client; - struct saa7113 *decoder; + struct saa711x *decoder; struct video_decoder_init vdi; dprintk(1, KERN_INFO - "saa7113.c: detecting saa7113 client on address 0x%x\n", + "saa711x.c: detecting saa711x client on address 0x%x\n", address << 1); /* Check if the adapter supports the needed features */ @@ -500,15 +494,15 @@ saa7113_detect_client (struct i2c_adapter *adapter, memset(client, 0, sizeof(struct i2c_client)); client->addr = address; client->adapter = adapter; - client->driver = &i2c_driver_saa7113; + client->driver = &i2c_driver_saa711x; client->flags = I2C_CLIENT_ALLOW_USE; - strlcpy(I2C_NAME(client), "saa7113", sizeof(I2C_NAME(client))); - decoder = kmalloc(sizeof(struct saa7113), GFP_KERNEL); + strlcpy(I2C_NAME(client), "saa711x", sizeof(I2C_NAME(client))); + decoder = kmalloc(sizeof(struct saa711x), GFP_KERNEL); if (decoder == NULL) { kfree(client); return -ENOMEM; } - memset(decoder, 0, sizeof(struct saa7113)); + memset(decoder, 0, sizeof(struct saa711x)); decoder->norm = VIDEO_MODE_NTSC; decoder->input = 0; decoder->enable = 1; @@ -525,9 +519,9 @@ saa7113_detect_client (struct i2c_adapter *adapter, return i; } - vdi.data = saa7113_i2c_init; - vdi.len = sizeof(saa7113_i2c_init); - i = saa7113_init_decoder(client, &vdi); + vdi.data = saa711x_i2c_init; + vdi.len = sizeof(saa711x_i2c_init); + i = saa711x_init_decoder(client, &vdi); if (i < 0) { dprintk(1, KERN_ERR "%s_attach error: init status %d\n", I2C_NAME(client), i); @@ -535,7 +529,7 @@ saa7113_detect_client (struct i2c_adapter *adapter, dprintk(1, KERN_INFO "%s_attach: chip version %x at address 0x%x\n", - I2C_NAME(client), saa7113_read(client, 0x00) >> 4, + I2C_NAME(client), saa711x_read(client, 0x00) >> 4, client->addr << 1); } @@ -543,19 +537,19 @@ saa7113_detect_client (struct i2c_adapter *adapter, } static int -saa7113_attach_adapter (struct i2c_adapter *adapter) +saa711x_attach_adapter (struct i2c_adapter *adapter) { dprintk(1, KERN_INFO - "saa7113.c: starting probe for adapter %s (0x%x)\n", + "saa711x.c: starting probe for adapter %s (0x%x)\n", I2C_NAME(adapter), adapter->id); - return i2c_probe(adapter, &addr_data, &saa7113_detect_client); + return i2c_probe(adapter, &addr_data, &saa711x_detect_client); } static int -saa7113_detach_client (struct i2c_client *client) +saa711x_detach_client (struct i2c_client *client) { - struct saa7113 *decoder = i2c_get_clientdata(client); + struct saa711x *decoder = i2c_get_clientdata(client); int err; err = i2c_detach_client(client); @@ -571,29 +565,29 @@ saa7113_detach_client (struct i2c_client *client) /* ----------------------------------------------------------------------- */ -static struct i2c_driver i2c_driver_saa7113 = { +static struct i2c_driver i2c_driver_saa711x = { .owner = THIS_MODULE, - .name = "saa7113", + .name = "saa711x", - .id = I2C_DRIVERID_SAA7113, + .id = I2C_DRIVERID_SAA711X, .flags = I2C_DF_NOTIFY, - .attach_adapter = saa7113_attach_adapter, - .detach_client = saa7113_detach_client, - .command = saa7113_command, + .attach_adapter = saa711x_attach_adapter, + .detach_client = saa711x_detach_client, + .command = saa711x_command, }; static int __init -saa7113_init (void) +saa711x_init (void) { - return i2c_add_driver(&i2c_driver_saa7113); + return i2c_add_driver(&i2c_driver_saa711x); } static void __exit -saa7113_exit (void) +saa711x_exit (void) { - i2c_del_driver(&i2c_driver_saa7113); + i2c_del_driver(&i2c_driver_saa711x); } -module_init(saa7113_init); -module_exit(saa7113_exit); +module_init(saa711x_init); +module_exit(saa711x_exit); -- cgit v1.2.2 From 15871a2905b84d6dba9013dbcbd9c79ace694ffb Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 8 Nov 2005 21:38:30 -0800 Subject: [PATCH] v4l: 889: add em28xx to kernel build - Add em28xx to kernel build. Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/Kconfig | 2 ++ drivers/media/video/Makefile | 1 + drivers/media/video/em28xx/Kconfig | 12 ++++++++++++ drivers/media/video/em28xx/Makefile | 7 +++++++ 4 files changed, 22 insertions(+) create mode 100644 drivers/media/video/em28xx/Kconfig create mode 100644 drivers/media/video/em28xx/Makefile diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index f3b077ec0c35..199b01188858 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig @@ -306,6 +306,8 @@ config VIDEO_HEXIUM_GEMINI source "drivers/media/video/cx88/Kconfig" +source "drivers/media/video/em28xx/Kconfig" + config VIDEO_OVCAMCHIP tristate "OmniVision Camera Chip support" depends on VIDEO_DEV && I2C diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index 046b82de9285..123c0a6ed203 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile @@ -39,6 +39,7 @@ obj-$(CONFIG_VIDEO_CPIA_USB) += cpia_usb.o obj-$(CONFIG_VIDEO_MEYE) += meye.o obj-$(CONFIG_VIDEO_SAA7134) += saa7134/ obj-$(CONFIG_VIDEO_CX88) += cx88/ +obj-$(CONFIG_VIDEO_EM28XX) += em28xx/ obj-$(CONFIG_VIDEO_OVCAMCHIP) += ovcamchip/ obj-$(CONFIG_VIDEO_MXB) += saa7111.o tuner.o tda9840.o tea6415c.o tea6420.o mxb.o obj-$(CONFIG_VIDEO_HEXIUM_ORION) += hexium_orion.o diff --git a/drivers/media/video/em28xx/Kconfig b/drivers/media/video/em28xx/Kconfig new file mode 100644 index 000000000000..46763be711f7 --- /dev/null +++ b/drivers/media/video/em28xx/Kconfig @@ -0,0 +1,12 @@ +config VIDEO_EM28XX + tristate "Empia EM2800/EM2820/2840 USB video capture support" + depends on VIDEO_DEV && USB && I2C + select VIDEO_BUF + select VIDEO_TUNER + select VIDEO_TVEEPROM + select VIDEO_IR + ---help--- + This is a video4linux driver for Empia 28xx based TV cards. + + To compile this driver as a module, choose M here: the + module will be called em28xx diff --git a/drivers/media/video/em28xx/Makefile b/drivers/media/video/em28xx/Makefile new file mode 100644 index 000000000000..573d2b878445 --- /dev/null +++ b/drivers/media/video/em28xx/Makefile @@ -0,0 +1,7 @@ +em28xx-objs := em28xx-video.o em28xx-i2c.o em28xx-cards.o em28xx-core.o \ + em28xx-input.o + +obj-$(CONFIG_EM28XX) += em28xx.o +obj-$(CONFIG_EM28XX) += saa711x.o tvp5150.o + +EXTRA_CFLAGS += -I$(src)/.. -- cgit v1.2.2 From c2e0b62e050374ddbf3221e7b78e1d0f26e148cb Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 8 Nov 2005 21:38:31 -0800 Subject: [PATCH] v4l: 890: fixed typo - Fixed typo. Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/em28xx/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/video/em28xx/Kconfig b/drivers/media/video/em28xx/Kconfig index 46763be711f7..885fd0170086 100644 --- a/drivers/media/video/em28xx/Kconfig +++ b/drivers/media/video/em28xx/Kconfig @@ -1,5 +1,5 @@ config VIDEO_EM28XX - tristate "Empia EM2800/EM2820/2840 USB video capture support" + tristate "Empia EM2800/2820/2840 USB video capture support" depends on VIDEO_DEV && USB && I2C select VIDEO_BUF select VIDEO_TUNER -- cgit v1.2.2 From 2ea55ad3897d8abac07435190c851f804433801f Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 8 Nov 2005 21:38:31 -0800 Subject: [PATCH] v4l: 891: change config em28xx to config video em28xx - Change CONFIG_EM28XX to CONFIG_VIDEO_EM28XX Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/em28xx/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/video/em28xx/Makefile b/drivers/media/video/em28xx/Makefile index 573d2b878445..a5ea678b8c29 100644 --- a/drivers/media/video/em28xx/Makefile +++ b/drivers/media/video/em28xx/Makefile @@ -1,7 +1,7 @@ em28xx-objs := em28xx-video.o em28xx-i2c.o em28xx-cards.o em28xx-core.o \ em28xx-input.o -obj-$(CONFIG_EM28XX) += em28xx.o -obj-$(CONFIG_EM28XX) += saa711x.o tvp5150.o +obj-$(CONFIG_VIDEO_EM28XX) += em28xx.o +obj-$(CONFIG_VIDEO_EM28XX) += saa711x.o tvp5150.o EXTRA_CFLAGS += -I$(src)/.. -- cgit v1.2.2 From d0fcdd7815e26f2e4a4ad239e2b464402a185f66 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 8 Nov 2005 21:38:32 -0800 Subject: [PATCH] v4l: 892: correct nicam audio settings to match dscaler - Correct nicam audio settings to match dscaler Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/cx88/cx88-tvaudio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/video/cx88/cx88-tvaudio.c b/drivers/media/video/cx88/cx88-tvaudio.c index 4ca1128bc76c..7815f332062d 100644 --- a/drivers/media/video/cx88/cx88-tvaudio.c +++ b/drivers/media/video/cx88/cx88-tvaudio.c @@ -321,8 +321,8 @@ static void set_audio_standard_NICAM(struct cx88_core *core, u32 mode) {AUD_DEEMPHNUMER2_R, 0x0003023e}, {AUD_DEEMPHDENOM1_R, 0x0000f3d0}, {AUD_DEEMPHDENOM2_R, 0x00000000}, + {AUD_PDF_DDS_CNST_BYTE2, 0x06}, {AUD_PDF_DDS_CNST_BYTE1, 0x82}, - {AUD_PDF_DDS_CNST_BYTE0, 0x16}, {AUD_QAM_MODE, 0x05}, { /* end of list */ }, }; -- cgit v1.2.2 From 291d1d7356a2cf1da4934a06c4a4e3bca440fbc6 Mon Sep 17 00:00:00 2001 From: Ricardo Cerqueira Date: Tue, 8 Nov 2005 21:38:33 -0800 Subject: [PATCH] v4l: 893: rollback recent i2c change to solve tuner detection breakage - Rollback recent i2c change to solve tuner detection breakage Signed-off-by: Ricardo Cerqueira Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/bttv-i2c.c | 22 +++++++++++++--------- drivers/media/video/tuner-core.c | 4 ++-- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/drivers/media/video/bttv-i2c.c b/drivers/media/video/bttv-i2c.c index aaabef26105a..1b3e0a769518 100644 --- a/drivers/media/video/bttv-i2c.c +++ b/drivers/media/video/bttv-i2c.c @@ -291,10 +291,12 @@ static struct i2c_adapter bttv_i2c_adap_hw_template = { static int attach_inform(struct i2c_client *client) { struct bttv *btv = i2c_get_adapdata(client->adapter); - int radio_addr=ADDR_UNSET; + int addr=ADDR_UNSET; + + + if (ADDR_UNSET != bttv_tvcards[btv->c.type].tuner_addr) + addr = bttv_tvcards[btv->c.type].tuner_addr; - if (ADDR_UNSET != bttv_tvcards[btv->c.type].radio_addr) - radio_addr = bttv_tvcards[btv->c.type].radio_addr; if (bttv_debug) printk(KERN_DEBUG "bttv%d: %s i2c attach [addr=0x%x,client=%s]\n", @@ -305,14 +307,16 @@ static int attach_inform(struct i2c_client *client) if (btv->tuner_type != UNSET) { struct tuner_setup tun_setup; - struct tuner *t = i2c_get_clientdata(client); - if (t->type != UNSET && t->mode_mask == T_RADIO) { - tun_setup.type = t->type; - tun_setup.mode_mask = T_RADIO; - tun_setup.addr = radio_addr; - client->driver->command (client, TUNER_SET_TYPE_ADDR, &tun_setup); + if ((addr==ADDR_UNSET) || + (addr==client->addr)) { + + tun_setup.mode_mask = T_ANALOG_TV | T_DIGITAL_TV | T_RADIO; + tun_setup.type = btv->tuner_type; + tun_setup.addr = addr; + bttv_call_i2c_clients(btv, TUNER_SET_TYPE_ADDR, &tun_setup); } + } return 0; diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index 3fde4f90425a..73c4041c35d7 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c @@ -222,9 +222,9 @@ static void set_addr(struct i2c_client *c, struct tuner_setup *tun_setup) { struct tuner *t = i2c_get_clientdata(c); - if ((tun_setup->addr == ADDR_UNSET && + if ( t->type == UNSET && ((tun_setup->addr == ADDR_UNSET && (t->mode_mask & tun_setup->mode_mask)) || - tun_setup->addr == c->addr) { + tun_setup->addr == c->addr)) { set_type(c, tun_setup->type, tun_setup->mode_mask); } } -- cgit v1.2.2 From 6e45f5d8d27cb619cf7e94c78a67fb61a4f3dd5e Mon Sep 17 00:00:00 2001 From: Ricardo Cerqueira Date: Tue, 8 Nov 2005 21:38:34 -0800 Subject: [PATCH] v4l: 894: work around to allow hybrid dvb card to autoload the tda9887 - Work-around to allow hybrid DVB card to autoload the tda9887 Signed-off-by: Ricardo Cerqueira Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/bttv-cards.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bttv-cards.c index d81672acdaad..3413bace443a 100644 --- a/drivers/media/video/bttv-cards.c +++ b/drivers/media/video/bttv-cards.c @@ -3407,6 +3407,9 @@ void __devinit bttv_init_card2(struct bttv *btv) if (0 == tda9887 && 0 == bttv_tvcards[btv->c.type].has_dvb && bttv_I2CRead(btv, I2C_TDA9887, "TDA9887") >=0) tda9887 = 1; + /* Hybrid DVB card, DOES have a tda9887 */ + if (btv->c.type == BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE) + tda9887 = 1; if((btv->tuner_type == TUNER_PHILIPS_FM1216ME_MK3) || (btv->tuner_type == TUNER_PHILIPS_FM1236_MK3) || (btv->tuner_type == TUNER_PHILIPS_FM1256_IH3) || -- cgit v1.2.2 From 7418f3462aedf6fb962a44c8fa7259dd94530ff5 Mon Sep 17 00:00:00 2001 From: Lubomir Bulej Date: Tue, 8 Nov 2005 21:38:34 -0800 Subject: [PATCH] v4l: 895: new avermedia 303 card without radio - New Avermedia 303 card (without radio). Signed-off-by: Lubomir Bulej Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/video4linux/CARDLIST.cx88 | 1 + drivers/media/video/bttv-i2c.c | 10 ++++----- drivers/media/video/cx88/cx88-cards.c | 38 +++++++++++++++++++++++++++++++-- drivers/media/video/cx88/cx88.h | 3 ++- 4 files changed, 44 insertions(+), 8 deletions(-) diff --git a/Documentation/video4linux/CARDLIST.cx88 b/Documentation/video4linux/CARDLIST.cx88 index 12e9e393868e..a1017d1a85d4 100644 --- a/Documentation/video4linux/CARDLIST.cx88 +++ b/Documentation/video4linux/CARDLIST.cx88 @@ -34,3 +34,4 @@ 33 -> Kworld V-Stream Xpert DVD 34 -> ATI HDTV Wonder [1002:a101] 35 -> WinFast DTV1000-T [107d:665f] + 36 -> AVerTV 303 (M126) [1461:000a] diff --git a/drivers/media/video/bttv-i2c.c b/drivers/media/video/bttv-i2c.c index 1b3e0a769518..77619eb131f6 100644 --- a/drivers/media/video/bttv-i2c.c +++ b/drivers/media/video/bttv-i2c.c @@ -294,8 +294,8 @@ static int attach_inform(struct i2c_client *client) int addr=ADDR_UNSET; - if (ADDR_UNSET != bttv_tvcards[btv->c.type].tuner_addr) - addr = bttv_tvcards[btv->c.type].tuner_addr; + if (ADDR_UNSET != bttv_tvcards[btv->c.type].tuner_addr) + addr = bttv_tvcards[btv->c.type].tuner_addr; if (bttv_debug) @@ -311,10 +311,10 @@ static int attach_inform(struct i2c_client *client) if ((addr==ADDR_UNSET) || (addr==client->addr)) { - tun_setup.mode_mask = T_ANALOG_TV | T_DIGITAL_TV | T_RADIO; - tun_setup.type = btv->tuner_type; + tun_setup.mode_mask = T_ANALOG_TV | T_DIGITAL_TV | T_RADIO; + tun_setup.type = btv->tuner_type; tun_setup.addr = addr; - bttv_call_i2c_clients(btv, TUNER_SET_TYPE_ADDR, &tun_setup); + bttv_call_i2c_clients(btv, TUNER_SET_TYPE_ADDR, &tun_setup); } } diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c index f20984eb5538..f2268631b7c0 100644 --- a/drivers/media/video/cx88/cx88-cards.c +++ b/drivers/media/video/cx88/cx88-cards.c @@ -174,7 +174,7 @@ struct cx88_board cx88_boards[] = { .gpio3 = 0x02000000, }, }, - [CX88_BOARD_AVERTV_303] = { + [CX88_BOARD_AVERTV_STUDIO_303] = { .name = "AverTV Studio 303 (M126)", .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, .radio_type = UNSET, @@ -865,6 +865,36 @@ struct cx88_board cx88_boards[] = { }}, .dvb = 1, }, + [CX88_BOARD_AVERTV_303] = { + .name = "AVerTV 303 (M126)", + .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .tda9887_conf = TDA9887_PRESENT, + .input = {{ + .type = CX88_VMUX_TELEVISION, + .vmux = 0, + .gpio0 = 0x00ff, + .gpio1 = 0xe09f, + .gpio2 = 0x0010, + .gpio3 = 0x0000, + },{ + .type = CX88_VMUX_COMPOSITE1, + .vmux = 1, + .gpio0 = 0x00ff, + .gpio1 = 0xe05f, + .gpio2 = 0x0010, + .gpio3 = 0x0000, + },{ + .type = CX88_VMUX_SVIDEO, + .vmux = 2, + .gpio0 = 0x00ff, + .gpio1 = 0xe05f, + .gpio2 = 0x0010, + .gpio3 = 0x0000, + }}, + }, }; const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards); @@ -915,7 +945,7 @@ struct cx88_subid cx88_subids[] = { },{ .subvendor = 0x1461, .subdevice = 0x000b, - .card = CX88_BOARD_AVERTV_303, + .card = CX88_BOARD_AVERTV_STUDIO_303, },{ .subvendor = 0x1462, .subdevice = 0x8606, @@ -1008,6 +1038,10 @@ struct cx88_subid cx88_subids[] = { .subvendor = 0x107d, .subdevice = 0x665f, .card = CX88_BOARD_WINFAST_DTV1000, + },{ + .subvendor = 0x1461, + .subdevice = 0x000a, + .card = CX88_BOARD_AVERTV_303, }, }; const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids); diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h index baeae1ac992c..b19d3a9e2298 100644 --- a/drivers/media/video/cx88/cx88.h +++ b/drivers/media/video/cx88/cx88.h @@ -148,7 +148,7 @@ extern struct sram_channel cx88_sram_channels[]; #define CX88_BOARD_PIXELVIEW 3 #define CX88_BOARD_ATI_WONDER_PRO 4 #define CX88_BOARD_WINFAST2000XP_EXPERT 5 -#define CX88_BOARD_AVERTV_303 6 +#define CX88_BOARD_AVERTV_STUDIO_303 6 #define CX88_BOARD_MSI_TVANYWHERE_MASTER 7 #define CX88_BOARD_WINFAST_DV2000 8 #define CX88_BOARD_LEADTEK_PVR2000 9 @@ -178,6 +178,7 @@ extern struct sram_channel cx88_sram_channels[]; #define CX88_BOARD_KWORLD_VSTREAM_EXPERT_DVD 33 #define CX88_BOARD_ATI_HDTVWONDER 34 #define CX88_BOARD_WINFAST_DTV1000 35 +#define CX88_BOARD_AVERTV_303 36 enum cx88_itype { CX88_VMUX_COMPOSITE1 = 1, -- cgit v1.2.2 From 6cffcc23d2837295604033d884d1ad259d0aed57 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 8 Nov 2005 21:38:36 -0800 Subject: [PATCH] v4l: 896: rename BTTV_FOO --> BTTV_BOARD_FOO Adapt to changes in v4l tree: rename BTTV_FOO --> BTTV_BOARD_FOO Signed-off-by: Michael Krufky Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/dvb/bt8xx/dvb-bt8xx.c | 48 ++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/drivers/media/dvb/bt8xx/dvb-bt8xx.c b/drivers/media/dvb/bt8xx/dvb-bt8xx.c index 05554e3949db..2e398090cf63 100644 --- a/drivers/media/dvb/bt8xx/dvb-bt8xx.c +++ b/drivers/media/dvb/bt8xx/dvb-bt8xx.c @@ -600,8 +600,8 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type) struct dst_state* state = NULL; switch(type) { -#ifdef BTTV_DVICO_DVBT_LITE - case BTTV_DVICO_DVBT_LITE: +#ifdef BTTV_BOARD_DVICO_DVBT_LITE + case BTTV_BOARD_DVICO_DVBT_LITE: card->fe = mt352_attach(&thomson_dtt7579_config, card->i2c_adapter); if (card->fe != NULL) { card->fe->ops->info.frequency_min = 174000000; @@ -610,8 +610,8 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type) break; #endif -#ifdef BTTV_DVICO_FUSIONHDTV_5_LITE - case BTTV_DVICO_FUSIONHDTV_5_LITE: +#ifdef BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE + case BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE: lgdt330x_reset(card); card->fe = lgdt330x_attach(&tdvs_tua6034_config, card->i2c_adapter); if (card->fe != NULL) @@ -619,10 +619,10 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type) break; #endif -#ifdef BTTV_TWINHAN_VP3021 - case BTTV_TWINHAN_VP3021: +#ifdef BTTV_BOARD_TWINHAN_VP3021 + case BTTV_BOARD_TWINHAN_VP3021: #else - case BTTV_NEBULA_DIGITV: + case BTTV_BOARD_NEBULA_DIGITV: #endif /* * It is possible to determine the correct frontend using the I2C bus (see the Nebula SDK); @@ -645,11 +645,11 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type) dprintk ("dvb_bt8xx: an mt352 was detected on your digitv card\n"); break; - case BTTV_AVDVBT_761: + case BTTV_BOARD_AVDVBT_761: card->fe = sp887x_attach(µtune_mt7202dtf_config, card->i2c_adapter); break; - case BTTV_AVDVBT_771: + case BTTV_BOARD_AVDVBT_771: card->fe = mt352_attach(&advbt771_samsung_tdtc9251dh0_config, card->i2c_adapter); if (card->fe != NULL) { card->fe->ops->info.frequency_min = 174000000; @@ -657,7 +657,7 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type) } break; - case BTTV_TWINHAN_DST: + case BTTV_BOARD_TWINHAN_DST: /* DST is not a frontend driver !!! */ state = (struct dst_state *) kmalloc(sizeof (struct dst_state), GFP_KERNEL); /* Setup the Card */ @@ -678,11 +678,11 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type) ret = dst_ca_attach(state, &card->dvb_adapter); break; - case BTTV_PINNACLESAT: + case BTTV_BOARD_PINNACLESAT: card->fe = cx24110_attach(&pctvsat_config, card->i2c_adapter); break; - case BTTV_PC_HDTV: + case BTTV_BOARD_PC_HDTV: card->fe = or51211_attach(&or51211_config, card->i2c_adapter); break; } @@ -804,7 +804,7 @@ static int dvb_bt8xx_probe(struct device *dev) card->i2c_adapter = &sub->core->i2c_adap; switch(sub->core->type) { - case BTTV_PINNACLESAT: + case BTTV_BOARD_PINNACLESAT: card->gpio_mode = 0x0400c060; /* should be: BT878_A_GAIN=0,BT878_A_PWRDN,BT878_DA_DPM,BT878_DA_SBR, BT878_DA_IOM=1,BT878_DA_APP to enable serial highspeed mode. */ @@ -812,8 +812,8 @@ static int dvb_bt8xx_probe(struct device *dev) card->irq_err_ignore = 0; break; -#ifdef BTTV_DVICO_DVBT_LITE - case BTTV_DVICO_DVBT_LITE: +#ifdef BTTV_BOARD_DVICO_DVBT_LITE + case BTTV_BOARD_DVICO_DVBT_LITE: #endif card->gpio_mode = 0x0400C060; card->op_sync_orin = 0; @@ -823,34 +823,34 @@ static int dvb_bt8xx_probe(struct device *dev) * DA_APP(parallel) */ break; -#ifdef BTTV_DVICO_FUSIONHDTV_5_LITE - case BTTV_DVICO_FUSIONHDTV_5_LITE: +#ifdef BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE + case BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE: #endif card->gpio_mode = 0x0400c060; card->op_sync_orin = BT878_RISC_SYNC_MASK; card->irq_err_ignore = BT878_AFBUS | BT878_AFDSR; break; -#ifdef BTTV_TWINHAN_VP3021 - case BTTV_TWINHAN_VP3021: +#ifdef BTTV_BOARD_TWINHAN_VP3021 + case BTTV_BOARD_TWINHAN_VP3021: #else - case BTTV_NEBULA_DIGITV: + case BTTV_BOARD_NEBULA_DIGITV: #endif - case BTTV_AVDVBT_761: + case BTTV_BOARD_AVDVBT_761: card->gpio_mode = (1 << 26) | (1 << 14) | (1 << 5); card->op_sync_orin = 0; card->irq_err_ignore = 0; /* A_PWRDN DA_SBR DA_APP (high speed serial) */ break; - case BTTV_AVDVBT_771: //case 0x07711461: + case BTTV_BOARD_AVDVBT_771: //case 0x07711461: card->gpio_mode = 0x0400402B; card->op_sync_orin = BT878_RISC_SYNC_MASK; card->irq_err_ignore = 0; /* A_PWRDN DA_SBR DA_APP[0] PKTP=10 RISC_ENABLE FIFO_ENABLE*/ break; - case BTTV_TWINHAN_DST: + case BTTV_BOARD_TWINHAN_DST: card->gpio_mode = 0x2204f2c; card->op_sync_orin = BT878_RISC_SYNC_MASK; card->irq_err_ignore = BT878_APABORT | BT878_ARIPERR | @@ -868,7 +868,7 @@ static int dvb_bt8xx_probe(struct device *dev) * RISC+FIFO ENABLE */ break; - case BTTV_PC_HDTV: + case BTTV_BOARD_PC_HDTV: card->gpio_mode = 0x0100EC7B; card->op_sync_orin = 0; card->irq_err_ignore = 0; -- cgit v1.2.2 From ad07d93ae7884a72a293eb4efb61a872f109ebd5 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:38:36 -0800 Subject: [PATCH] v4l: 897: saa7146 fix - Fixing headers to compile cleanly. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/em28xx/em28xx-video.c | 1 - include/media/saa7146_vv.h | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index f6acce820791..5b09f52dd669 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c @@ -28,7 +28,6 @@ #include #include #include -#include #include "em28xx.h" #include diff --git a/include/media/saa7146_vv.h b/include/media/saa7146_vv.h index f3aa24f8131c..64691753721e 100644 --- a/include/media/saa7146_vv.h +++ b/include/media/saa7146_vv.h @@ -1,7 +1,7 @@ #ifndef __SAA7146_VV__ #define __SAA7146_VV__ -#include +#include #include #include -- cgit v1.2.2 From b296fc6017e0ec6bc6cd0f40275f268035eb6b8b Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:38:37 -0800 Subject: [PATCH] v4l: 898: em2820 i2c fix - Miscelaneous fixes for em28xx - I2C hardware named changed to wright value. - utsname included to em28xx-video.c - Makefile fixes. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/Makefile | 1 + drivers/media/video/em28xx/Makefile | 1 - drivers/media/video/em28xx/em28xx-video.c | 1 + drivers/media/video/ir-kbd-i2c.c | 6 +++--- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index 123c0a6ed203..351ce5be2ad4 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile @@ -40,6 +40,7 @@ obj-$(CONFIG_VIDEO_MEYE) += meye.o obj-$(CONFIG_VIDEO_SAA7134) += saa7134/ obj-$(CONFIG_VIDEO_CX88) += cx88/ obj-$(CONFIG_VIDEO_EM28XX) += em28xx/ +obj-$(CONFIG_VIDEO_EM28XX) += saa711x.o tvp5150.o obj-$(CONFIG_VIDEO_OVCAMCHIP) += ovcamchip/ obj-$(CONFIG_VIDEO_MXB) += saa7111.o tuner.o tda9840.o tea6415c.o tea6420.o mxb.o obj-$(CONFIG_VIDEO_HEXIUM_ORION) += hexium_orion.o diff --git a/drivers/media/video/em28xx/Makefile b/drivers/media/video/em28xx/Makefile index a5ea678b8c29..da457a05b0dd 100644 --- a/drivers/media/video/em28xx/Makefile +++ b/drivers/media/video/em28xx/Makefile @@ -2,6 +2,5 @@ em28xx-objs := em28xx-video.o em28xx-i2c.o em28xx-cards.o em28xx-core.o \ em28xx-input.o obj-$(CONFIG_VIDEO_EM28XX) += em28xx.o -obj-$(CONFIG_VIDEO_EM28XX) += saa711x.o tvp5150.o EXTRA_CFLAGS += -I$(src)/.. diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 5b09f52dd669..54f21242ccbf 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include "em28xx.h" diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index bdb3ba551360..0085567a1421 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c @@ -373,7 +373,7 @@ static int ir_probe(struct i2c_adapter *adap) static const int probe_bttv[] = { 0x1a, 0x18, 0x4b, 0x64, 0x30, -1}; static const int probe_saa7134[] = { 0x7a, 0x47, -1 }; - static const int probe_em2820[] = { 0x30, 0x47, -1 }; + static const int probe_em28XX[] = { 0x30, 0x47, -1 }; const int *probe = NULL; struct i2c_client c; unsigned char buf; @@ -386,8 +386,8 @@ static int ir_probe(struct i2c_adapter *adap) case I2C_HW_SAA7134: probe = probe_saa7134; break; - case I2C_HW_B_EM2820: - probe = probe_em2820; + case I2C_HW_B_EM28XX: + probe = probe_em28XX; break; } if (NULL == probe) -- cgit v1.2.2 From 22ae2550f65bc322e6bdeff9d3948bbb5e0a9b67 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:38:38 -0800 Subject: [PATCH] v4l: 899: remove media id.h - Removed media id.h file Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/media/id.h | 50 -------------------------------------------------- 1 file changed, 50 deletions(-) delete mode 100644 include/media/id.h diff --git a/include/media/id.h b/include/media/id.h deleted file mode 100644 index 4f58d73e7029..000000000000 --- a/include/media/id.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - */ - -/* FIXME: this temporarely, until these are included in linux/i2c-id.h */ - -/* drivers */ -#ifndef I2C_DRIVERID_TVMIXER -# define I2C_DRIVERID_TVMIXER I2C_DRIVERID_EXP0 -#endif -#ifndef I2C_DRIVERID_TVAUDIO -# define I2C_DRIVERID_TVAUDIO I2C_DRIVERID_EXP1 -#endif - -/* chips */ -#ifndef I2C_DRIVERID_DPL3518 -# define I2C_DRIVERID_DPL3518 I2C_DRIVERID_EXP2 -#endif -#ifndef I2C_DRIVERID_TDA9873 -# define I2C_DRIVERID_TDA9873 I2C_DRIVERID_EXP3 -#endif -#ifndef I2C_DRIVERID_TDA9875 -# define I2C_DRIVERID_TDA9875 I2C_DRIVERID_EXP0+4 -#endif -#ifndef I2C_DRIVERID_PIC16C54_PV951 -# define I2C_DRIVERID_PIC16C54_PV951 I2C_DRIVERID_EXP0+5 -#endif -#ifndef I2C_DRIVERID_TDA7432 -# define I2C_DRIVERID_TDA7432 I2C_DRIVERID_EXP0+6 -#endif -#ifndef I2C_DRIVERID_TDA9874 -# define I2C_DRIVERID_TDA9874 I2C_DRIVERID_EXP0+7 -#endif -#ifndef I2C_DRIVERID_SAA6752HS -# define I2C_DRIVERID_SAA6752HS I2C_DRIVERID_EXP0+8 -#endif -#ifndef I2C_DRIVERID_WM8775 -#define I2C_DRIVERID_WM8775 I2C_DRIVERID_EXP0+9 -#endif -#ifndef I2C_DRIVERID_CS53L32A -#define I2C_DRIVERID_CS53L32A I2C_DRIVERID_EXP0+10 -#endif -#ifndef I2C_DRIVERID_CX25840 -#define I2C_DRIVERID_CX25840 I2C_DRIVERID_EXP0+11 -#endif -#ifndef I2C_DRIVERID_SAA7115 -#define I2C_DRIVERID_SAA7115 I2C_DRIVERID_EXP0+12 -#endif -#ifndef I2C_DRIVERID_SAA7127 -#define I2C_DRIVERID_SAA7127 I2C_DRIVERID_EXP0+13 -#endif -- cgit v1.2.2 From 4ac95af9a0bdc33f18e6a7532ac5319b2d4ab8c2 Mon Sep 17 00:00:00 2001 From: Hartmut Hackmann Date: Tue, 8 Nov 2005 21:38:38 -0800 Subject: [PATCH] V4L: 896: fixed tda8290 secam l Fixed tda8290 SECAM-L Signed-off-by: Hartmut Hackmann Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/tda8290.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/drivers/media/video/tda8290.c b/drivers/media/video/tda8290.c index 0dde6af251dd..b2dfe07e9f9d 100644 --- a/drivers/media/video/tda8290.c +++ b/drivers/media/video/tda8290.c @@ -323,6 +323,7 @@ static int tda8290_tune(struct i2c_client *c, u16 ifc, unsigned int freq) i2c_master_send(c, soft_reset, 2); msleep(1); + expert_mode[1] = t->tda8290_easy_mode + 0x80; i2c_master_send(c, expert_mode, 2); i2c_master_send(c, gainset_off, 2); i2c_master_send(c, if_agc_spd, 2); @@ -348,8 +349,9 @@ static int tda8290_tune(struct i2c_client *c, u16 ifc, unsigned int freq) tuner_dbg("tda8290 is locked, AGC: %d\n", agc_stat); else tuner_dbg("tda8290 not locked, no signal?\n"); - if ((agc_stat > 115) || (!(pll_stat & 0x80) && (adc_sat <20))) { - tuner_dbg("adjust gain, step 1. Agc: %d\n", agc_stat); + if ((agc_stat > 115) || (!(pll_stat & 0x80) && (adc_sat < 20))) { + tuner_dbg("adjust gain, step 1. Agc: %d, ADC stat: %d, lock: %d\n", + agc_stat, adc_sat, pll_stat & 0x80); i2c_master_send(c, gainset_2, 2); msleep(100); i2c_master_send(c, &addr_agc_stat, 1); @@ -357,7 +359,8 @@ static int tda8290_tune(struct i2c_client *c, u16 ifc, unsigned int freq) i2c_master_send(c, &addr_pll_stat, 1); i2c_master_recv(c, &pll_stat, 1); if ((agc_stat > 115) || !(pll_stat & 0x80)) { - tuner_dbg("adjust gain, step 2. Agc: %d\n", agc_stat); + tuner_dbg("adjust gain, step 2. Agc: %d, lock: %d\n", + agc_stat, pll_stat & 0x80); if (t->tda827x_ver != 0) tda827xa_agcf(c); else @@ -383,6 +386,7 @@ static int tda8290_tune(struct i2c_client *c, u16 ifc, unsigned int freq) i2c_master_send(c, &addr_pll_stat, 1); i2c_master_recv(c, &pll_stat, 1); if ((adc_sat > 20) || !(pll_stat & 0x80)) { + tuner_dbg("trying to resolve SECAM L deadlock\n"); i2c_master_send(c, agc_rst_on, 2); msleep(40); i2c_master_send(c, agc_rst_off, 2); @@ -404,28 +408,37 @@ static int tda8290_tune(struct i2c_client *c, u16 ifc, unsigned int freq) static void set_audio(struct tuner *t) { - t->tda827x_lpsel = 0; + char* mode; + t->tda827x_lpsel = 0; + mode = "xx"; if (t->std & V4L2_STD_MN) { t->sgIF = 92; t->tda8290_easy_mode = 0x01; t->tda827x_lpsel = 1; + mode = "MN"; } else if (t->std & V4L2_STD_B) { t->sgIF = 108; t->tda8290_easy_mode = 0x02; + mode = "B"; } else if (t->std & V4L2_STD_GH) { t->sgIF = 124; t->tda8290_easy_mode = 0x04; + mode = "GH"; } else if (t->std & V4L2_STD_PAL_I) { t->sgIF = 124; t->tda8290_easy_mode = 0x08; + mode = "I"; } else if (t->std & V4L2_STD_DK) { t->sgIF = 124; t->tda8290_easy_mode = 0x10; + mode = "DK"; } else if (t->std & V4L2_STD_SECAM_L) { t->sgIF = 124; t->tda8290_easy_mode = 0x20; + mode = "L"; } + tuner_dbg("setting tda8290 to system %s\n", mode); } static void set_tv_freq(struct i2c_client *c, unsigned int freq) -- cgit v1.2.2 From 6c3d67abdb79ff3e22cd19476c05294274434143 Mon Sep 17 00:00:00 2001 From: "Hans J. Koch" Date: Tue, 8 Nov 2005 21:38:39 -0800 Subject: [PATCH] V4L: 899: fix rds raw data buffer handling bug which caused Fix RDS raw data buffer handling bug, which caused decoding delays and sometimes wrong data. Signed-off-by: Hans J. Koch Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/saa6588.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/video/saa6588.c b/drivers/media/video/saa6588.c index 23ea548a71e0..dca3ddfd510f 100644 --- a/drivers/media/video/saa6588.c +++ b/drivers/media/video/saa6588.c @@ -245,7 +245,7 @@ static void block_to_buf(struct saa6588 *s, unsigned char *blockbuf) s->wr_index = 0; if (s->wr_index == s->rd_index) { - s->rd_index++; + s->rd_index += 3; if (s->rd_index >= s->buf_size) s->rd_index = 0; } else -- cgit v1.2.2 From d4c34aa024aef2be3f3deca751c335f72c3e32b6 Mon Sep 17 00:00:00 2001 From: Kirk Lapray Date: Tue, 8 Nov 2005 21:38:40 -0800 Subject: [PATCH] V4L: 901: added function for nxt200x to change pll input Added function for nxt200x to change pll input Signed-off-by: Kirk Lapray Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/cx88/cx88-dvb.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index 1236cb11d83a..9cce91ec334b 100644 --- a/drivers/media/video/cx88/cx88-dvb.c +++ b/drivers/media/video/cx88/cx88-dvb.c @@ -296,10 +296,20 @@ static int nxt200x_set_ts_param(struct dvb_frontend* fe, return 0; } +static int nxt200x_set_pll_input(u8* buf, int input) +{ + if (input) + buf[3] |= 0x08; + else + buf[3] &= ~0x08; + return 0; +} + static struct nxt200x_config ati_hdtvwonder = { .demod_address = 0x0a, .pll_address = 0x61, .pll_desc = &dvb_pll_tuv1236d, + .set_pll_input = nxt200x_set_pll_input, .set_ts_params = nxt200x_set_ts_param, }; #endif -- cgit v1.2.2 From 12b0e1df5c10a094a4475439a484307478c4c607 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 8 Nov 2005 21:38:41 -0800 Subject: [PATCH] V4L: 902: saa6588.c should build saa6588.ko rather than rds.ko Saa6588.c should build saa6588.ko, rather than rds.ko Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index 351ce5be2ad4..3ac465992400 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile @@ -5,7 +5,6 @@ bttv-objs := bttv-driver.o bttv-cards.o bttv-if.o \ bttv-risc.o bttv-vbi.o bttv-i2c.o bttv-gpio.o zoran-objs := zr36120.o zr36120_i2c.o zr36120_mem.o -rds-objs := saa6588.o zr36067-objs := zoran_procfs.o zoran_device.o \ zoran_driver.o zoran_card.o tuner-objs := tuner-core.o tuner-simple.o mt20xx.o tda8290.o tea5767.o @@ -16,7 +15,7 @@ obj-$(CONFIG_VIDEO_BT848) += bttv.o msp3400.o tvaudio.o \ obj-$(CONFIG_SOUND_TVMIXER) += tvmixer.o obj-$(CONFIG_VIDEO_ZR36120) += zoran.o -obj-$(CONFIG_VIDEO_SAA6588) += rds.o +obj-$(CONFIG_VIDEO_SAA6588) += saa6588.o obj-$(CONFIG_VIDEO_SAA5246A) += saa5246a.o obj-$(CONFIG_VIDEO_SAA5249) += saa5249.o obj-$(CONFIG_VIDEO_CQCAM) += c-qcam.o -- cgit v1.2.2 From 90e9df7f186876584b938e01fcf7f40a50c950b9 Mon Sep 17 00:00:00 2001 From: Hartmut Hackmann Date: Tue, 8 Nov 2005 21:38:42 -0800 Subject: [PATCH] V4L: 904: added dvb support for tda8275a philips tiger reference design Added dvb support for tda8275a (Philips Tiger reference design) Signed-off-by: Hartmut Hackmann Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/saa7134/saa7134-cards.c | 37 ++++++ drivers/media/video/saa7134/saa7134-dvb.c | 192 ++++++++++++++++++++++++++++ drivers/media/video/saa7134/saa7134.h | 1 + include/media/tuner.h | 2 +- 4 files changed, 231 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index 9e1c51c08f21..d9b3fb0f3eff 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c @@ -2490,6 +2490,29 @@ struct saa7134_board saa7134_boards[] = { .amux = LINE1, }}, }, + [SAA7134_BOARD_PHILIPS_TIGER] = { + .name = "Philips Tiger reference design", + .audio_clock = 0x00187de7, + .tuner_type = TUNER_PHILIPS_TDA8290, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .mpeg = SAA7134_MPEG_DVB, + .inputs = {{ + .name = name_tv, + .vmux = 1, + .amux = TV, + .tv = 1, + },{ + .name = name_comp1, + .vmux = 3, + .amux = LINE1, + },{ + .name = name_svideo, + .vmux = 8, + .amux = LINE1, + }}, + }, }; const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards); @@ -2919,6 +2942,12 @@ struct pci_device_id saa7134_pci_tbl[] = { .subvendor = 0x1043, .subdevice = 0x4862, .driver_data = SAA7134_BOARD_ASUSTeK_P7131_DUAL, + },{ + .vendor = PCI_VENDOR_ID_PHILIPS, + .device = PCI_DEVICE_ID_PHILIPS_SAA7133, + .subvendor = PCI_VENDOR_ID_PHILIPS, + .subdevice = 0x2018, + .driver_data = SAA7134_BOARD_PHILIPS_TIGER, },{ /* --- boards without eeprom + subsystem ID --- */ .vendor = PCI_VENDOR_ID_PHILIPS, @@ -3177,6 +3206,14 @@ int saa7134_board_init2(struct saa7134_dev *dev) saa7134_i2c_call_clients (dev, TUNER_SET_TYPE_ADDR,&tun_setup); } break; + case SAA7134_BOARD_PHILIPS_TIGER: + /* this is a hybrid board, initialize to analog mode */ + { + u8 data[] = { 0x3c, 0x33, 0x68}; + struct i2c_msg msg = {.addr=0x08, .flags=0, .buf=data, .len = sizeof(data)}; + i2c_transfer(&dev->i2c_adap, &msg, 1); + } + break; } return 0; } diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c index aaac12e8adbf..d1d1abc55718 100644 --- a/drivers/media/video/saa7134/saa7134-dvb.c +++ b/drivers/media/video/saa7134/saa7134-dvb.c @@ -626,8 +626,196 @@ static struct tda1004x_config tda827x_lifeview_config = { .pll_sleep = philips_tda827x_pll_sleep, .request_firmware = NULL, }; + +/* ------------------------------------------------------------------ */ + +struct tda827xa_data { + u32 lomax; + u8 svco; + u8 spd; + u8 scr; + u8 sbs; + u8 gc3; +}; + +static struct tda827xa_data tda827xa_dvbt[] = { + { .lomax = 56875000, .svco = 3, .spd = 4, .scr = 0, .sbs = 0, .gc3 = 1}, + { .lomax = 67250000, .svco = 0, .spd = 3, .scr = 0, .sbs = 0, .gc3 = 1}, + { .lomax = 81250000, .svco = 1, .spd = 3, .scr = 0, .sbs = 0, .gc3 = 1}, + { .lomax = 97500000, .svco = 2, .spd = 3, .scr = 0, .sbs = 0, .gc3 = 1}, + { .lomax = 113750000, .svco = 3, .spd = 3, .scr = 0, .sbs = 1, .gc3 = 1}, + { .lomax = 134500000, .svco = 0, .spd = 2, .scr = 0, .sbs = 1, .gc3 = 1}, + { .lomax = 154000000, .svco = 1, .spd = 2, .scr = 0, .sbs = 1, .gc3 = 1}, + { .lomax = 162500000, .svco = 1, .spd = 2, .scr = 0, .sbs = 1, .gc3 = 1}, + { .lomax = 183000000, .svco = 2, .spd = 2, .scr = 0, .sbs = 1, .gc3 = 1}, + { .lomax = 195000000, .svco = 2, .spd = 2, .scr = 0, .sbs = 2, .gc3 = 1}, + { .lomax = 227500000, .svco = 3, .spd = 2, .scr = 0, .sbs = 2, .gc3 = 1}, + { .lomax = 269000000, .svco = 0, .spd = 1, .scr = 0, .sbs = 2, .gc3 = 1}, + { .lomax = 290000000, .svco = 1, .spd = 1, .scr = 0, .sbs = 2, .gc3 = 1}, + { .lomax = 325000000, .svco = 1, .spd = 1, .scr = 0, .sbs = 3, .gc3 = 1}, + { .lomax = 390000000, .svco = 2, .spd = 1, .scr = 0, .sbs = 3, .gc3 = 1}, + { .lomax = 455000000, .svco = 3, .spd = 1, .scr = 0, .sbs = 3, .gc3 = 1}, + { .lomax = 520000000, .svco = 0, .spd = 0, .scr = 0, .sbs = 3, .gc3 = 1}, + { .lomax = 538000000, .svco = 0, .spd = 0, .scr = 1, .sbs = 3, .gc3 = 1}, + { .lomax = 550000000, .svco = 1, .spd = 0, .scr = 0, .sbs = 3, .gc3 = 1}, + { .lomax = 620000000, .svco = 1, .spd = 0, .scr = 0, .sbs = 4, .gc3 = 0}, + { .lomax = 650000000, .svco = 1, .spd = 0, .scr = 1, .sbs = 4, .gc3 = 0}, + { .lomax = 700000000, .svco = 2, .spd = 0, .scr = 0, .sbs = 4, .gc3 = 0}, + { .lomax = 780000000, .svco = 2, .spd = 0, .scr = 1, .sbs = 4, .gc3 = 0}, + { .lomax = 820000000, .svco = 3, .spd = 0, .scr = 0, .sbs = 4, .gc3 = 0}, + { .lomax = 870000000, .svco = 3, .spd = 0, .scr = 1, .sbs = 4, .gc3 = 0}, + { .lomax = 911000000, .svco = 3, .spd = 0, .scr = 2, .sbs = 4, .gc3 = 0}, + { .lomax = 0, .svco = 0, .spd = 0, .scr = 0, .sbs = 0, .gc3 = 0}}; + + +static int philips_tda827xa_pll_set(u8 addr, struct dvb_frontend *fe, struct dvb_frontend_parameters *params) +{ + struct saa7134_dev *dev = fe->dvb->priv; + u8 tuner_buf[14]; + unsigned char reg2[2]; + + struct i2c_msg msg = {.addr = addr,.flags = 0,.buf = tuner_buf}; + int i, tuner_freq, if_freq; + u32 N; + + switch (params->u.ofdm.bandwidth) { + case BANDWIDTH_6_MHZ: + if_freq = 4000000; + break; + case BANDWIDTH_7_MHZ: + if_freq = 4500000; + break; + default: /* 8 MHz or Auto */ + if_freq = 5000000; + break; + } + tuner_freq = params->frequency + if_freq; + + i = 0; + while (tda827xa_dvbt[i].lomax < tuner_freq) { + if(tda827xa_dvbt[i + 1].lomax == 0) + break; + i++; + } + + N = ((tuner_freq + 31250) / 62500) << tda827xa_dvbt[i].spd; + tuner_buf[0] = 0; // subaddress + tuner_buf[1] = N >> 8; + tuner_buf[2] = N & 0xff; + tuner_buf[3] = 0; + tuner_buf[4] = 0x16; + tuner_buf[5] = (tda827xa_dvbt[i].spd << 5) + (tda827xa_dvbt[i].svco << 3) + + tda827xa_dvbt[i].sbs; + tuner_buf[6] = 0x4b + (tda827xa_dvbt[i].gc3 << 4); + tuner_buf[7] = 0x0c; + tuner_buf[8] = 0x06; + tuner_buf[9] = 0x24; + tuner_buf[10] = 0xff; + tuner_buf[11] = 0x60; + tuner_buf[12] = 0x00; + tuner_buf[13] = 0x39; // lpsel + msg.len = 14; + if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1) + return -EIO; + + msg.buf= reg2; + msg.len = 2; + reg2[0] = 0x60; + reg2[1] = 0x3c; + i2c_transfer(&dev->i2c_adap, &msg, 1); + + reg2[0] = 0xa0; + reg2[1] = 0x40; + i2c_transfer(&dev->i2c_adap, &msg, 1); + + msleep(2); + /* correct CP value */ + reg2[0] = 0x30; + reg2[1] = 0x10 + tda827xa_dvbt[i].scr; + msg.len = 2; + i2c_transfer(&dev->i2c_adap, &msg, 1); + + msleep(550); + reg2[0] = 0x50; + reg2[1] = 0x4f + (tda827xa_dvbt[i].gc3 << 4); + i2c_transfer(&dev->i2c_adap, &msg, 1); + + return 0; + +} + +static void philips_tda827xa_pll_sleep(u8 addr, struct dvb_frontend *fe) +{ + struct saa7134_dev *dev = fe->dvb->priv; + static u8 tda827xa_sleep[] = { 0x30, 0x90}; + struct i2c_msg tuner_msg = {.addr = addr,.flags = 0,.buf = tda827xa_sleep, + .len = sizeof(tda827xa_sleep) }; + i2c_transfer(&dev->i2c_adap, &tuner_msg, 1); + +} + +/* ------------------------------------------------------------------ */ + +static int philips_tiger_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) +{ + int ret; + struct saa7134_dev *dev = fe->dvb->priv; + static u8 tda8290_close[] = { 0x21, 0xc0}; + static u8 tda8290_open[] = { 0x21, 0x80}; + struct i2c_msg tda8290_msg = {.addr = 0x4b,.flags = 0, .len = 2}; + /* close tda8290 i2c bridge */ + tda8290_msg.buf = tda8290_close; + ret = i2c_transfer(&dev->i2c_adap, &tda8290_msg, 1); + if (ret != 1) + return -EIO; + msleep(20); + ret = philips_tda827xa_pll_set(0x61, fe, params); + if (ret != 0) + return ret; + /* open tda8290 i2c bridge */ + tda8290_msg.buf = tda8290_open; + i2c_transfer(&dev->i2c_adap, &tda8290_msg, 1); + return ret; +}; + +static int philips_tiger_dvb_mode(struct dvb_frontend *fe) +{ + struct saa7134_dev *dev = fe->dvb->priv; + static u8 data[] = { 0x3c, 0x33, 0x6a}; + struct i2c_msg msg = {.addr=0x08, .flags=0, .buf=data, .len = sizeof(data)}; + + if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1) + return -EIO; + return 0; +} + +static void philips_tiger_analog_mode(struct dvb_frontend *fe) +{ + struct saa7134_dev *dev = fe->dvb->priv; + static u8 data[] = { 0x3c, 0x33, 0x68}; + struct i2c_msg msg = {.addr=0x08, .flags=0, .buf=data, .len = sizeof(data)}; + + i2c_transfer(&dev->i2c_adap, &msg, 1); + philips_tda827xa_pll_sleep( 0x61, fe); +} + +static struct tda1004x_config philips_tiger_config = { + .demod_address = 0x08, + .invert = 1, + .invert_oclk = 0, + .xtal_freq = TDA10046_XTAL_16M, + .agc_config = TDA10046_AGC_TDA827X, + .if_freq = TDA10046_FREQ_045, + .pll_init = philips_tiger_dvb_mode, + .pll_set = philips_tiger_pll_set, + .pll_sleep = philips_tiger_analog_mode, + .request_firmware = NULL, +}; + #endif +/* ------------------------------------------------------------------ */ + #ifdef HAVE_NXT200X static struct nxt200x_config avertvhda180 = { .demod_address = 0x0a, @@ -688,6 +876,10 @@ static int dvb_init(struct saa7134_dev *dev) dev->dvb.frontend = tda10046_attach(&philips_tu1216_61_config, &dev->i2c_adap); break; + case SAA7134_BOARD_PHILIPS_TIGER: + dev->dvb.frontend = tda10046_attach(&philips_tiger_config, + &dev->i2c_adap); + break; #endif #ifdef HAVE_NXT200X case SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180: diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index 4273ded9d174..a82468a07676 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h @@ -207,6 +207,7 @@ struct saa7134_format { #define SAA7134_BOARD_ASUSTeK_P7131_DUAL 78 #define SAA7134_BOARD_PCTV_CARDBUS 79 #define SAA7134_BOARD_ASUSTEK_DIGIMATRIX_TV 80 +#define SAA7134_BOARD_PHILIPS_TIGER 81 #define SAA7134_MAXBOARDS 8 #define SAA7134_INPUT_MAX 8 diff --git a/include/media/tuner.h b/include/media/tuner.h index 5196d9eac442..9184e534b7ef 100644 --- a/include/media/tuner.h +++ b/include/media/tuner.h @@ -211,10 +211,10 @@ extern unsigned const int tuner_count; extern int microtune_init(struct i2c_client *c); extern int tda8290_init(struct i2c_client *c); +extern int tda8290_probe(struct i2c_client *c); extern int tea5767_tuner_init(struct i2c_client *c); extern int default_tuner_init(struct i2c_client *c); extern int tea5767_autodetection(struct i2c_client *c); -extern int tda8290_probe(struct i2c_client *c); #define tuner_warn(fmt, arg...) do {\ printk(KERN_WARNING "%s %d-%04x: " fmt, t->i2c.driver->name, \ -- cgit v1.2.2 From c3d931929f1d11f9d198567850247ae1754dfc06 Mon Sep 17 00:00:00 2001 From: Pavel Mihaylov Date: Tue, 8 Nov 2005 21:38:43 -0800 Subject: [PATCH] V4L: 906: remote and more info for pctv cardbus whitespace cleanup Remote and more info for PCTV Cardbus. Whitespace cleanup. Signed-off-by: Pavel Mihaylov Signed-off-by: Nickolay V. Shmyrev Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/video4linux/CARDLIST.saa7134 | 1 + drivers/media/video/saa7134/saa7134-cards.c | 23 +++++++++++++--- drivers/media/video/saa7134/saa7134-dvb.c | 2 +- drivers/media/video/saa7134/saa7134-input.c | 42 +++++++++++++++++++++++++++++ 4 files changed, 63 insertions(+), 5 deletions(-) diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134 index 51252ff034e6..997a57db257c 100644 --- a/Documentation/video4linux/CARDLIST.saa7134 +++ b/Documentation/video4linux/CARDLIST.saa7134 @@ -79,3 +79,4 @@ 78 -> ASUSTeK P7131 Dual [1043:4862] 79 -> PCTV Cardbus TV/Radio (ITO25 Rev:2B) 80 -> ASUS Digimatrix TV [1043:0210] + 81 -> Philips Tiger reference design [1131:2018] diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index d9b3fb0f3eff..e3fe15a14aee 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c @@ -2453,18 +2453,33 @@ struct saa7134_board saa7134_boards[] = { }, [SAA7134_BOARD_PCTV_CARDBUS] = { /* Paul Tom Zalac */ - /* tda8275a tuner doesnt work yet */ + /* Pavel Mihaylov */ .name = "PCTV Cardbus TV/Radio (ITO25 Rev:2B)", + /* Sedna Cardbus TV Tuner */ .audio_clock = 0x00187de7, - .tuner_type = TUNER_ABSENT, + .tuner_type = TUNER_PHILIPS_TDA8290, .radio_type = UNSET, .tuner_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET, + .gpiomask = 0xe880c0, .inputs = {{ + .name = name_tv, + .vmux = 3, + .amux = TV, + .tv = 1, + },{ .name = name_comp1, .vmux = 1, - .amux = LINE2, + .amux = LINE1, + },{ + .name = name_svideo, + .vmux = 6, + .amux = LINE1, }}, + .radio = { + .name = name_radio, + .amux = LINE2, + }, }, [SAA7134_BOARD_ASUSTEK_DIGIMATRIX_TV] = { /* "Cyril Lacoux (Yack)" */ @@ -2942,7 +2957,7 @@ struct pci_device_id saa7134_pci_tbl[] = { .subvendor = 0x1043, .subdevice = 0x4862, .driver_data = SAA7134_BOARD_ASUSTeK_P7131_DUAL, - },{ + },{ .vendor = PCI_VENDOR_ID_PHILIPS, .device = PCI_DEVICE_ID_PHILIPS_SAA7133, .subvendor = PCI_VENDOR_ID_PHILIPS, diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c index d1d1abc55718..c0337cf91956 100644 --- a/drivers/media/video/saa7134/saa7134-dvb.c +++ b/drivers/media/video/saa7134/saa7134-dvb.c @@ -749,7 +749,7 @@ static void philips_tda827xa_pll_sleep(u8 addr, struct dvb_frontend *fe) struct saa7134_dev *dev = fe->dvb->priv; static u8 tda827xa_sleep[] = { 0x30, 0x90}; struct i2c_msg tuner_msg = {.addr = addr,.flags = 0,.buf = tda827xa_sleep, - .len = sizeof(tda827xa_sleep) }; + .len = sizeof(tda827xa_sleep) }; i2c_transfer(&dev->i2c_adap, &tuner_msg, 1); } diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index 0c74c2f5edaa..2aba72de55d6 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -543,6 +543,42 @@ static IR_KEYTAB_TYPE ir_codes_pinnacle[IR_KEYTAB_SIZE] = { [ 0x0a ] = KEY_BACKSPACE, }; +/* Mapping for the 28 key remote control as seen at + http://www.sednacomputer.com/photo/cardbus-tv.jpg + Pavel Mihaylov */ +static IR_KEYTAB_TYPE pctv_cardbus_codes[IR_KEYTAB_SIZE] = { + [ 0 ] = KEY_KP0, + [ 1 ] = KEY_KP1, + [ 2 ] = KEY_KP2, + [ 3 ] = KEY_KP3, + [ 4 ] = KEY_KP4, + [ 5 ] = KEY_KP5, + [ 6 ] = KEY_KP6, + [ 7 ] = KEY_KP7, + [ 8 ] = KEY_KP8, + [ 9 ] = KEY_KP9, + + [ 0x0a ] = KEY_AGAIN, /* Recall */ + [ 0x0b ] = KEY_CHANNELUP, + [ 0x0c ] = KEY_VOLUMEUP, + [ 0x0d ] = KEY_MODE, /* Stereo */ + [ 0x0e ] = KEY_STOP, + [ 0x0f ] = KEY_PREVIOUSSONG, + [ 0x10 ] = KEY_ZOOM, + [ 0x11 ] = KEY_TUNER, /* Source */ + [ 0x12 ] = KEY_POWER, + [ 0x13 ] = KEY_MUTE, + [ 0x15 ] = KEY_CHANNELDOWN, + [ 0x18 ] = KEY_VOLUMEDOWN, + [ 0x19 ] = KEY_SHUFFLE, /* Snapshot */ + [ 0x1a ] = KEY_NEXTSONG, + [ 0x1b ] = KEY_TEXT, /* Time Shift */ + [ 0x1c ] = KEY_RADIO, /* FM Radio */ + [ 0x1d ] = KEY_RECORD, + [ 0x1e ] = KEY_PAUSE, +}; + + /* -------------------- GPIO generic keycode builder -------------------- */ static int build_key(struct saa7134_dev *dev) @@ -745,6 +781,12 @@ int saa7134_input_init1(struct saa7134_dev *dev) mask_keyup = 0x004000; polling = 50; // ms break; + case SAA7134_BOARD_PCTV_CARDBUS: + ir_codes = pctv_cardbus_codes; + mask_keycode = 0x001f00; + mask_keyup = 0x004000; + polling = 50; // ms + break; case SAA7134_BOARD_GOTVIEW_7135: ir_codes = gotview7135_codes; mask_keycode = 0x0003EC; -- cgit v1.2.2 From eac94356c8f9f7d3854ed0290a406b13bfe8df4c Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:38:43 -0800 Subject: [PATCH] V4L: 907: em28xx cleanups and fixes - Em28xx cleanups and fixes. - Some cleanups and audio amux adjust. - em28xx will allways try, by default, the biggest size alt. - Fixes audio mux code. - Fixes some logs. - Adds support for digital output for WinTV USB2 board. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/em28xx/em28xx-cards.c | 15 ++-- drivers/media/video/em28xx/em28xx-core.c | 17 +--- drivers/media/video/em28xx/em28xx-video.c | 107 +++++++++++----------- drivers/media/video/msp3400.c | 142 +++++++++++++++++++++++++++--- include/linux/videodev2.h | 1 + 5 files changed, 201 insertions(+), 81 deletions(-) diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index 49107fd0c0d3..57779e63f35d 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c @@ -128,7 +128,7 @@ struct em28xx_board em28xx_boards[] = { .input = {{ .type = EM28XX_VMUX_TELEVISION, .vmux = 0, - .amux = 0, + .amux = 6, },{ .type = EM28XX_VMUX_SVIDEO, .vmux = 2, @@ -261,9 +261,11 @@ void em28xx_card_setup(struct em28xx *dev) /* request some modules */ if (dev->model == EM2820_BOARD_HAUPPAUGE_WINTV_USB_2) { struct tveeprom tv; + struct v4l2_audioout ao; #ifdef CONFIG_MODULES request_module("tveeprom"); request_module("ir-kbd-i2c"); + request_module("msp3400"); #endif /* Call first TVeeprom */ @@ -273,10 +275,13 @@ void em28xx_card_setup(struct em28xx *dev) dev->tuner_type= tv.tuner_type; if (tv.audio_processor == AUDIO_CHIP_MSP34XX) { dev->has_msp34xx=1; - } else dev->has_msp34xx=0; - em28xx_write_regs_req(dev,0x06,0x00,"\x40",1);// Serial Bus Frequency Select Register - em28xx_write_regs_req(dev,0x0f,0x00,"\x87",1);// XCLK Frequency Select Register - em28xx_write_regs_req(dev,0x88,0x0d,"\xd0",1); + memset (&ao,0,sizeof(ao)); + + ao.index=2; + ao.mode=V4L2_AUDMODE_32BITS; + em28xx_i2c_call_clients(dev, VIDIOC_S_AUDOUT, &ao); + } else + dev->has_msp34xx=0; } } diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index 045547e17656..5cc850666fd7 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c @@ -797,20 +797,9 @@ int em28xx_set_alternate(struct em28xx *dev) dev->alt = alt; if (dev->alt == 0) { int i; - if(dev->is_em2800){ /* always use the max packet size for em2800 based devices */ - for(i=0;i< EM28XX_MAX_ALT; i++) - if(dev->alt_max_pkt_size[i]>dev->alt_max_pkt_size[dev->alt]) - dev->alt=i; - }else{ - unsigned int min_pkt_size = dev->field_size / 137; /* FIXME: empiric magic number */ - em28xx_coredbg("minimum isoc packet size: %u", min_pkt_size); - dev->alt = 7; - for (i = 1; i < EM28XX_MAX_ALT; i += 2) /* FIXME: skip even alternate: why do they not work? */ - if (dev->alt_max_pkt_size[i] >= min_pkt_size) { - dev->alt = i; - break; - } - } + for(i=0;i< EM28XX_MAX_ALT; i++) + if(dev->alt_max_pkt_size[i]>dev->alt_max_pkt_size[dev->alt]) + dev->alt=i; } if (dev->alt != prev_alt) { diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 54f21242ccbf..0bbfce03172d 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c @@ -277,6 +277,35 @@ static void em28xx_empty_framequeues(struct em28xx *dev) } } +static void video_mux(struct em28xx *dev, int index) +{ + int input, ainput; + + input = INPUT(index)->vmux; + dev->ctl_input = index; + dev->ctl_ainput = INPUT(index)->amux; + + em28xx_i2c_call_clients(dev, DECODER_SET_INPUT, &input); + + + em28xx_videodbg("Setting input index=%d, vmux=%d, amux=%d\n",index,input,dev->ctl_ainput); + + if (dev->has_msp34xx) { + em28xx_i2c_call_clients(dev, VIDIOC_S_AUDIO, &dev->ctl_ainput); + ainput = EM28XX_AUDIO_SRC_TUNER; + em28xx_audio_source(dev, ainput); + } else { + switch (dev->ctl_ainput) { + case 0: + ainput = EM28XX_AUDIO_SRC_TUNER; + break; + default: + ainput = EM28XX_AUDIO_SRC_LINE; + } + em28xx_audio_source(dev, ainput); + } +} + /* * em28xx_v4l2_open() * inits the device and starts isoc transfer @@ -298,7 +327,7 @@ static int em28xx_v4l2_open(struct inode *inode, struct file *filp) filp->private_data=dev; - em28xx_videodbg("users=%d", dev->users); + em28xx_videodbg("users=%d\n", dev->users); if (!down_read_trylock(&em28xx_disconnect)) return -ERESTARTSYS; @@ -352,6 +381,8 @@ static int em28xx_v4l2_open(struct inode *inode, struct file *filp) dev->state |= DEV_INITIALIZED; + video_mux(dev, 0); + err: up(&dev->lock); up_read(&em28xx_disconnect); @@ -386,7 +417,7 @@ static int em28xx_v4l2_close(struct inode *inode, struct file *filp) int errCode; struct em28xx *dev=filp->private_data; - em28xx_videodbg("users=%d", dev->users); + em28xx_videodbg("users=%d\n", dev->users); down(&dev->lock); @@ -404,7 +435,7 @@ static int em28xx_v4l2_close(struct inode *inode, struct file *filp) /* set alternate 0 */ dev->alt = 0; - em28xx_videodbg("setting alternate 0"); + em28xx_videodbg("setting alternate 0\n"); errCode = usb_set_interface(dev->udev, 0, 0); if (errCode < 0) { em28xx_errdev ("cannot change alternate number to 0 (error=%i)\n", @@ -434,20 +465,20 @@ em28xx_v4l2_read(struct file *filp, char __user * buf, size_t count, return -ERESTARTSYS; if (dev->state & DEV_DISCONNECTED) { - em28xx_videodbg("device not present"); + em28xx_videodbg("device not present\n"); up(&dev->fileop_lock); return -ENODEV; } if (dev->state & DEV_MISCONFIGURED) { - em28xx_videodbg("device misconfigured; close and open it again"); + em28xx_videodbg("device misconfigured; close and open it again\n"); up(&dev->fileop_lock); return -EIO; } if (dev->io == IO_MMAP) { em28xx_videodbg ("IO method is set to mmap; close and open" - " the device again to choose the read method"); + " the device again to choose the read method\n"); up(&dev->fileop_lock); return -EINVAL; } @@ -524,9 +555,9 @@ static unsigned int em28xx_v4l2_poll(struct file *filp, poll_table * wait) return POLLERR; if (dev->state & DEV_DISCONNECTED) { - em28xx_videodbg("device not present"); + em28xx_videodbg("device not present\n"); } else if (dev->state & DEV_MISCONFIGURED) { - em28xx_videodbg("device is misconfigured; close and open it again"); + em28xx_videodbg("device is misconfigured; close and open it again\n"); } else { if (dev->io == IO_NONE) { if (!em28xx_request_buffers @@ -595,14 +626,14 @@ static int em28xx_v4l2_mmap(struct file *filp, struct vm_area_struct *vma) return -ERESTARTSYS; if (dev->state & DEV_DISCONNECTED) { - em28xx_videodbg("mmap: device not present"); + em28xx_videodbg("mmap: device not present\n"); up(&dev->fileop_lock); return -ENODEV; } if (dev->state & DEV_MISCONFIGURED) { em28xx_videodbg ("mmap: Device is misconfigured; close and " - "open it again"); + "open it again\n"); up(&dev->fileop_lock); return -EIO; } @@ -618,7 +649,7 @@ static int em28xx_v4l2_mmap(struct file *filp, struct vm_area_struct *vma) break; } if (i == dev->num_frames) { - em28xx_videodbg("mmap: user supplied mapping address is out of range"); + em28xx_videodbg("mmap: user supplied mapping address is out of range\n"); up(&dev->fileop_lock); return -EINVAL; } @@ -632,7 +663,7 @@ static int em28xx_v4l2_mmap(struct file *filp, struct vm_area_struct *vma) page = vmalloc_to_pfn((void *)pos); if (remap_pfn_range(vma, start, page, PAGE_SIZE, vma->vm_page_prot)) { - em28xx_videodbg("mmap: rename page map failed"); + em28xx_videodbg("mmap: rename page map failed\n"); up(&dev->fileop_lock); return -EAGAIN; } @@ -749,7 +780,7 @@ static int em28xx_stream_interrupt(struct em28xx *dev) else if (ret) { dev->state |= DEV_MISCONFIGURED; em28xx_videodbg("device is misconfigured; close and " - "open /dev/video%d again", dev->vdev->minor); + "open /dev/video%d again\n", dev->vdev->minor); return ret; } @@ -800,28 +831,6 @@ static int em28xx_set_norm(struct em28xx *dev, int width, int height) return 0; } -static void video_mux(struct em28xx *dev, int index) -{ - int input, ainput; - - input = INPUT(index)->vmux; - dev->ctl_input = index; - - em28xx_i2c_call_clients(dev, DECODER_SET_INPUT, &input); - - dev->ctl_ainput = INPUT(index)->amux; - - switch (dev->ctl_ainput) { - case 0: - ainput = EM28XX_AUDIO_SRC_TUNER; - break; - default: - ainput = EM28XX_AUDIO_SRC_LINE; - } - - em28xx_audio_source(dev, ainput); -} - /* * em28xx_v4l2_do_ioctl() * This function is _not_ called directly, but from @@ -1062,7 +1071,7 @@ static int em28xx_do_ioctl(struct inode *inode, struct file *filp, t->signal = (status & DECODER_STATUS_GOOD) != 0 ? 0xffff : 0; - em28xx_videodbg("VIDIO_G_TUNER: signal=%x, afc=%x", t->signal, + em28xx_videodbg("VIDIO_G_TUNER: signal=%x, afc=%x\n", t->signal, t->afc); return 0; } @@ -1146,7 +1155,7 @@ static int em28xx_do_ioctl(struct inode *inode, struct file *filp, dev->stream = STREAM_ON; /* FIXME: Start video capture here? */ - em28xx_videodbg("VIDIOC_STREAMON: starting stream"); + em28xx_videodbg("VIDIOC_STREAMON: starting stream\n"); return 0; } @@ -1160,7 +1169,7 @@ static int em28xx_do_ioctl(struct inode *inode, struct file *filp, return -EINVAL; if (dev->stream == STREAM_ON) { - em28xx_videodbg ("VIDIOC_STREAMOFF: interrupting stream"); + em28xx_videodbg ("VIDIOC_STREAMOFF: interrupting stream\n"); if ((ret = em28xx_stream_interrupt(dev))) return ret; } @@ -1234,7 +1243,7 @@ static int em28xx_video_do_ioctl(struct inode *inode, struct file *filp, { struct v4l2_format *format = arg; - em28xx_videodbg("VIDIOC_G_FMT: type=%s", + em28xx_videodbg("VIDIOC_G_FMT: type=%s\n", format->type == V4L2_BUF_TYPE_VIDEO_CAPTURE ? "V4L2_BUF_TYPE_VIDEO_CAPTURE" : format->type == @@ -1253,7 +1262,7 @@ static int em28xx_video_do_ioctl(struct inode *inode, struct file *filp, format->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; format->fmt.pix.field = dev->interlaced ? V4L2_FIELD_INTERLACED : V4L2_FIELD_TOP; /* FIXME: TOP? NONE? BOTTOM? ALTENATE? */ - em28xx_videodbg("VIDIOC_G_FMT: %dx%d", dev->width, + em28xx_videodbg("VIDIOC_G_FMT: %dx%d\n", dev->width, dev->height); return 0; } @@ -1274,7 +1283,7 @@ static int em28xx_video_do_ioctl(struct inode *inode, struct file *filp, /* int both_fields; */ - em28xx_videodbg("%s: type=%s", + em28xx_videodbg("%s: type=%s\n", cmd == VIDIOC_TRY_FMT ? "VIDIOC_TRY_FMT" : "VIDIOC_S_FMT", @@ -1288,7 +1297,7 @@ static int em28xx_video_do_ioctl(struct inode *inode, struct file *filp, if (format->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; - em28xx_videodbg("%s: requested %dx%d", + em28xx_videodbg("%s: requested %dx%d\n", cmd == VIDIOC_TRY_FMT ? "VIDIOC_TRY_FMT" : "VIDIOC_S_FMT", format->fmt.pix.width, @@ -1347,7 +1356,7 @@ static int em28xx_video_do_ioctl(struct inode *inode, struct file *filp, format->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; format->fmt.pix.field = V4L2_FIELD_INTERLACED; - em28xx_videodbg("%s: returned %dx%d (%d, %d)", + em28xx_videodbg("%s: returned %dx%d (%d, %d)\n", cmd == VIDIOC_TRY_FMT ? "VIDIOC_TRY_FMT" : "VIDIOC_S_FMT", format->fmt.pix.width, @@ -1359,13 +1368,13 @@ static int em28xx_video_do_ioctl(struct inode *inode, struct file *filp, for (i = 0; i < dev->num_frames; i++) if (dev->frame[i].vma_use_count) { em28xx_videodbg("VIDIOC_S_FMT failed. " - "Unmap the buffers first."); + "Unmap the buffers first.\n"); return -EINVAL; } /* stop io in case it is already in progress */ if (dev->stream == STREAM_ON) { - em28xx_videodbg("VIDIOC_SET_FMT: interupting stream"); + em28xx_videodbg("VIDIOC_SET_FMT: interupting stream\n"); if ((ret = em28xx_stream_interrupt(dev))) return ret; } @@ -1405,18 +1414,18 @@ static int em28xx_video_do_ioctl(struct inode *inode, struct file *filp, if (dev->io == IO_READ) { em28xx_videodbg ("method is set to read;" " close and open the device again to" - " choose the mmap I/O method"); + " choose the mmap I/O method\n"); return -EINVAL; } for (i = 0; i < dev->num_frames; i++) if (dev->frame[i].vma_use_count) { - em28xx_videodbg ("VIDIOC_REQBUFS failed; previous buffers are still mapped"); + em28xx_videodbg ("VIDIOC_REQBUFS failed; previous buffers are still mapped\n"); return -EINVAL; } if (dev->stream == STREAM_ON) { - em28xx_videodbg("VIDIOC_REQBUFS: interrupting stream"); + em28xx_videodbg("VIDIOC_REQBUFS: interrupting stream\n"); if ((ret = em28xx_stream_interrupt(dev))) return ret; } @@ -1430,7 +1439,7 @@ static int em28xx_video_do_ioctl(struct inode *inode, struct file *filp, dev->frame_current = NULL; - em28xx_videodbg ("VIDIOC_REQBUFS: setting io method to mmap: num bufs %i", + em28xx_videodbg ("VIDIOC_REQBUFS: setting io method to mmap: num bufs %i\n", rb->count); dev->io = rb->count ? IO_MMAP : IO_NONE; return 0; diff --git a/drivers/media/video/msp3400.c b/drivers/media/video/msp3400.c index d603229c9f2f..b599f0554fb7 100644 --- a/drivers/media/video/msp3400.c +++ b/drivers/media/video/msp3400.c @@ -90,6 +90,8 @@ struct msp3400c { int stereo; int nicam_on; int acb; + int in_scart; + int i2s_mode; int main, second; /* sound carrier */ int input; int source; /* see msp34xxg_set_source */ @@ -364,12 +366,40 @@ static struct CARRIER_DETECT carrier_detect_65[] = { #define CARRIER_COUNT(x) (sizeof(x)/sizeof(struct CARRIER_DETECT)) -/* ----------------------------------------------------------------------- */ +/* ----------------------------------------------------------------------- * + * bits 9 8 5 - SCART DSP input Select: + * 0 0 0 - SCART 1 to DSP input (reset position) + * 0 1 0 - MONO to DSP input + * 1 0 0 - SCART 2 to DSP input + * 1 1 1 - Mute DSP input + * + * bits 11 10 6 - SCART 1 Output Select: + * 0 0 0 - undefined (reset position) + * 0 1 0 - SCART 2 Input to SCART 1 Output (for devices with 2 SCARTS) + * 1 0 0 - MONO input to SCART 1 Output + * 1 1 0 - SCART 1 DA to SCART 1 Output + * 0 0 1 - SCART 2 DA to SCART 1 Output + * 0 1 1 - SCART 1 Input to SCART 1 Output + * 1 1 1 - Mute SCART 1 Output + * + * bits 13 12 7 - SCART 2 Output Select (for devices with 2 Output SCART): + * 0 0 0 - SCART 1 DA to SCART 2 Output (reset position) + * 0 1 0 - SCART 1 Input to SCART 2 Output + * 1 0 0 - MONO input to SCART 2 Output + * 0 0 1 - SCART 2 DA to SCART 2 Output + * 0 1 1 - SCART 2 Input to SCART 2 Output + * 1 1 0 - Mute SCART 2 Output + * + * Bits 4 to 0 should be zero. + * ----------------------------------------------------------------------- */ static int scarts[3][9] = { /* MASK IN1 IN2 IN1_DA IN2_DA IN3 IN4 MONO MUTE */ + /* SCART DSP Input select */ { 0x0320, 0x0000, 0x0200, -1, -1, 0x0300, 0x0020, 0x0100, 0x0320 }, + /* SCART1 Output select */ { 0x0c40, 0x0440, 0x0400, 0x0c00, 0x0040, 0x0000, 0x0840, 0x0800, 0x0c40 }, + /* SCART2 Output select */ { 0x3080, 0x1000, 0x1080, 0x0000, 0x0080, 0x2080, 0x3080, 0x2000, 0x3000 }, }; @@ -381,13 +411,23 @@ static void msp3400c_set_scart(struct i2c_client *client, int in, int out) { struct msp3400c *msp = i2c_get_clientdata(client); - if (-1 == scarts[out][in]) - return; + msp->in_scart=in; + + if (in<=2) { + if (-1 == scarts[out][in]) + return; + + msp->acb &= ~scarts[out][SCART_MASK]; + msp->acb |= scarts[out][in]; + } else + msp->acb = 0xf60; /* Mute Input and SCART 1 Output */ + + dprintk("msp34xx: scart switch: %s => %d (ACB=0x%04x)\n", + scart_names[in], out, msp->acb); + msp3400c_write(client,I2C_MSP3400C_DFP, 0x13, msp->acb); - dprintk("msp34xx: scart switch: %s => %d\n", scart_names[in], out); - msp->acb &= ~scarts[out][SCART_MASK]; - msp->acb |= scarts[out][in]; - msp3400c_write(client,I2C_MSP3400C_DFP, 0x0013, msp->acb); + /* Sets I2S speed 0 = 1.024 Mbps, 1 = 2.048 Mbps */ + msp3400c_write(client,I2C_MSP3400C_DEM, 0x40, msp->i2s_mode); } /* ------------------------------------------------------------------------ */ @@ -1235,7 +1275,8 @@ static int msp3410d_thread(void *data) msp3400c_setbass(client, msp->bass); msp3400c_settreble(client, msp->treble); msp3400c_setvolume(client, msp->muted, msp->left, msp->right); - msp3400c_write(client, I2C_MSP3400C_DFP, 0x0013, msp->acb); + msp3400c_write(client, I2C_MSP3400C_DFP, 0x13, msp->acb); + msp3400c_write(client,I2C_MSP3400C_DEM, 0x40, msp->i2s_mode); msp3400c_restore_dfp(client); /* monitor tv audio mode */ @@ -1275,6 +1316,8 @@ static int msp34xxg_reset(struct i2c_client *client) 0x0f20 /* mute DSP input, mute SCART 1 */)) return -1; + msp3400c_write(client,I2C_MSP3400C_DEM, 0x40, msp->i2s_mode); + /* step-by-step initialisation, as described in the manual */ modus = msp34xx_modus(msp->norm); std = msp34xx_standard(msp->norm); @@ -1371,6 +1414,8 @@ static int msp34xxg_thread(void *data) 0x13, /* ACB */ msp->acb)) return -1; + + msp3400c_write(client,I2C_MSP3400C_DEM, 0x40, msp->i2s_mode); } dprintk("msp34xxg: thread: exit\n"); return 0; @@ -1539,6 +1584,7 @@ static int msp_attach(struct i2c_adapter *adap, int addr, int kind) msp->treble = 32768; msp->input = -1; msp->muted = 0; + msp->i2s_mode = 0; for (i = 0; i < DFP_COUNT; i++) msp->dfp_regs[i] = -1; @@ -1735,6 +1781,7 @@ static void msp_any_set_audmode(struct i2c_client *client, int audmode) } } + static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) { struct msp3400c *msp = i2c_get_clientdata(client); @@ -1745,6 +1792,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) case AUDC_SET_INPUT: dprintk("msp34xx: AUDC_SET_INPUT(%d)\n",*sarg); + if (*sarg == msp->input) break; msp->input = *sarg; @@ -1923,6 +1971,16 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) break; } + /* msp34xx specific */ + case MSP_SET_MATRIX: + { + struct msp_matrix *mspm = arg; + + dprintk("msp34xx: MSP_SET_MATRIX\n"); + msp3400c_set_scart(client, mspm->input, mspm->output); + break; + } + /* --- v4l2 ioctls --- */ case VIDIOC_S_STD: { @@ -1941,6 +1999,33 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) return 0; } + case VIDIOC_ENUMINPUT: + { + struct v4l2_input *i = arg; + + if (i->index != 0) + return -EINVAL; + + i->type = V4L2_INPUT_TYPE_TUNER; + switch (i->index) { + case AUDIO_RADIO: + strcpy(i->name,"Radio"); + break; + case AUDIO_EXTERN_1: + strcpy(i->name,"Extern 1"); + break; + case AUDIO_EXTERN_2: + strcpy(i->name,"Extern 2"); + break; + case AUDIO_TUNER: + strcpy(i->name,"Television"); + break; + default: + return -EINVAL; + } + return 0; + } + case VIDIOC_G_AUDIO: { struct v4l2_audio *a = arg; @@ -2032,13 +2117,44 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) break; } - /* msp34xx specific */ - case MSP_SET_MATRIX: + case VIDIOC_G_AUDOUT: { - struct msp_matrix *mspm = arg; + struct v4l2_audioout *a=(struct v4l2_audioout *)arg; + + memset(a,0,sizeof(*a)); + + switch (a->index) { + case 0: + strcpy(a->name,"Scart1 Out"); + break; + case 1: + strcpy(a->name,"Scart2 Out"); + break; + case 2: + strcpy(a->name,"I2S Out"); + break; + default: + return -EINVAL; + } + break; + + } + case VIDIOC_S_AUDOUT: + { + struct v4l2_audioout *a=(struct v4l2_audioout *)arg; + + if (a->index<0||a->index>2) + return -EINVAL; + + if (a->index==2) { + if (a->mode == V4L2_AUDMODE_32BITS) + msp->i2s_mode=1; + else + msp->i2s_mode=0; + } +printk("Setting audio out on msp34xx to input %i, mode %i\n",a->index,msp->i2s_mode); + msp3400c_set_scart(client,msp->in_scart,a->index); - dprintk("msp34xx: MSP_SET_MATRIX\n"); - msp3400c_set_scart(client, mspm->input, mspm->output); break; } diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index e8a0d22df54f..67c61b4bf2e7 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -885,6 +885,7 @@ struct v4l2_audio /* Flags for the 'mode' field */ #define V4L2_AUDMODE_AVL 0x00001 +#define V4L2_AUDMODE_32BITS 0x00002 struct v4l2_audioout { -- cgit v1.2.2 From d4b0aba47d48a339572744cb23ba925f04e3cda9 Mon Sep 17 00:00:00 2001 From: Hartmut Hackmann Date: Tue, 8 Nov 2005 21:38:44 -0800 Subject: [PATCH] V4L: 908: added dvb-t support for asus p7134 dual - Added dvb-t support for Asus P7134 Dual - added pci id for ADS Tech Instant TV cardbus variant Signed-off-by: Hartmut Hackmann Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/saa7134/saa7134-cards.c | 9 ++++++++- drivers/media/video/saa7134/saa7134-dvb.c | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index e3fe15a14aee..ac361858901a 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c @@ -2431,6 +2431,7 @@ struct saa7134_board saa7134_boards[] = { .tuner_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET, .gpiomask = 1 << 21, + .mpeg = SAA7134_MPEG_DVB, .inputs = {{ .name = name_tv, .vmux = 1, @@ -2864,13 +2865,18 @@ struct pci_device_id saa7134_pci_tbl[] = { .subvendor = 0x1421, .subdevice = 0x0350, /* PCI version */ .driver_data = SAA7134_BOARD_ADS_INSTANT_TV, - },{ .vendor = PCI_VENDOR_ID_PHILIPS, .device = PCI_DEVICE_ID_PHILIPS_SAA7133, .subvendor = 0x1421, .subdevice = 0x0370, /* cardbus version */ .driver_data = SAA7134_BOARD_ADS_INSTANT_TV, + },{ + .vendor = PCI_VENDOR_ID_PHILIPS, + .device = PCI_DEVICE_ID_PHILIPS_SAA7133, + .subvendor = 0x1421, + .subdevice = 0x1370, /* cardbus version */ + .driver_data = SAA7134_BOARD_ADS_INSTANT_TV, },{ /* Typhoon DVB-T Duo Digital/Analog Cardbus */ .vendor = PCI_VENDOR_ID_PHILIPS, @@ -3222,6 +3228,7 @@ int saa7134_board_init2(struct saa7134_dev *dev) } break; case SAA7134_BOARD_PHILIPS_TIGER: + case SAA7134_BOARD_ASUSTeK_P7131_DUAL: /* this is a hybrid board, initialize to analog mode */ { u8 data[] = { 0x3c, 0x33, 0x68}; diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c index c0337cf91956..8545d30d9f70 100644 --- a/drivers/media/video/saa7134/saa7134-dvb.c +++ b/drivers/media/video/saa7134/saa7134-dvb.c @@ -880,6 +880,10 @@ static int dvb_init(struct saa7134_dev *dev) dev->dvb.frontend = tda10046_attach(&philips_tiger_config, &dev->i2c_adap); break; + case SAA7134_BOARD_ASUSTeK_P7131_DUAL: + dev->dvb.frontend = tda10046_attach(&philips_tiger_config, + &dev->i2c_adap); + break; #endif #ifdef HAVE_NXT200X case SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180: -- cgit v1.2.2 From 247b661f83ad9be317da2e3b0c254ba283f874ef Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Tue, 8 Nov 2005 21:38:45 -0800 Subject: [PATCH] V4L: 909: updated cardlist and strip trailing whitespace Updated CARDLIST and strip trailing whitespace. Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/video4linux/CARDLIST.saa7134 | 2 +- drivers/media/video/saa7134/saa7134-dvb.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134 index 997a57db257c..62076d2976ae 100644 --- a/Documentation/video4linux/CARDLIST.saa7134 +++ b/Documentation/video4linux/CARDLIST.saa7134 @@ -56,7 +56,7 @@ 55 -> LifeView FlyDVB-T DUO [5168:0502,5168:0306] 56 -> Avermedia AVerTV 307 [1461:a70a] 57 -> Avermedia AVerTV GO 007 FM [1461:f31f] - 58 -> ADS Tech Instant TV (saa7135) [1421:0350,1421:0370] + 58 -> ADS Tech Instant TV (saa7135) [1421:0350,1421:0370,1421:1370] 59 -> Kworld/Tevion V-Stream Xpert TV PVR7134 60 -> Typhoon DVB-T Duo Digital/Analog Cardbus [4e42:0502] 61 -> Philips TOUGH DVB-T reference design [1131:2004] diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c index 8545d30d9f70..4cd3db492456 100644 --- a/drivers/media/video/saa7134/saa7134-dvb.c +++ b/drivers/media/video/saa7134/saa7134-dvb.c @@ -749,7 +749,7 @@ static void philips_tda827xa_pll_sleep(u8 addr, struct dvb_frontend *fe) struct saa7134_dev *dev = fe->dvb->priv; static u8 tda827xa_sleep[] = { 0x30, 0x90}; struct i2c_msg tuner_msg = {.addr = addr,.flags = 0,.buf = tda827xa_sleep, - .len = sizeof(tda827xa_sleep) }; + .len = sizeof(tda827xa_sleep) }; i2c_transfer(&dev->i2c_adap, &tuner_msg, 1); } -- cgit v1.2.2 From f1bcef8874ab33b1e517b79a9b9df7309a996877 Mon Sep 17 00:00:00 2001 From: Tyler Trafford Date: Tue, 8 Nov 2005 21:38:46 -0800 Subject: [PATCH] V4L: 911: added support for ntsc 4.43 video standard Added support for NTSC 4.43 video standard. Signed-off-by: Tyler Trafford Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/saa7134/saa7134-dvb.c | 2 +- include/linux/videodev2.h | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c index 4cd3db492456..e016480c3468 100644 --- a/drivers/media/video/saa7134/saa7134-dvb.c +++ b/drivers/media/video/saa7134/saa7134-dvb.c @@ -749,7 +749,7 @@ static void philips_tda827xa_pll_sleep(u8 addr, struct dvb_frontend *fe) struct saa7134_dev *dev = fe->dvb->priv; static u8 tda827xa_sleep[] = { 0x30, 0x90}; struct i2c_msg tuner_msg = {.addr = addr,.flags = 0,.buf = tda827xa_sleep, - .len = sizeof(tda827xa_sleep) }; + .len = sizeof(tda827xa_sleep) }; i2c_transfer(&dev->i2c_adap, &tuner_msg, 1); } diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 67c61b4bf2e7..a114fff6568b 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -627,6 +627,7 @@ typedef __u64 v4l2_std_id; #define V4L2_STD_NTSC_M ((v4l2_std_id)0x00001000) #define V4L2_STD_NTSC_M_JP ((v4l2_std_id)0x00002000) +#define V4L2_STD_NTSC_443 ((v4l2_std_id)0x00004000) #define V4L2_STD_SECAM_B ((v4l2_std_id)0x00010000) #define V4L2_STD_SECAM_D ((v4l2_std_id)0x00020000) @@ -664,7 +665,8 @@ typedef __u64 v4l2_std_id; #define V4L2_STD_525_60 (V4L2_STD_PAL_M |\ V4L2_STD_PAL_60 |\ - V4L2_STD_NTSC) + V4L2_STD_NTSC |\ + V4L2_STD_NTSC_443) #define V4L2_STD_625_50 (V4L2_STD_PAL |\ V4L2_STD_PAL_N |\ V4L2_STD_PAL_Nc |\ -- cgit v1.2.2 From cb2444dfa203b5b5c76d63c0ce8593e4e0385719 Mon Sep 17 00:00:00 2001 From: Ricardo Cerqueira Date: Tue, 8 Nov 2005 21:38:47 -0800 Subject: [PATCH] V4L: 913: saa713x cards with i2c remotes now autoload ir-kbd-i2c SAA713x cards with i2c remotes now autoload ir-kbd-i2c (disable_ir works, as it does for GPIO remotes) Signed-off-by: Ricardo Cerqueira Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/saa7134/saa7134-cards.c | 9 +++++++-- drivers/media/video/saa7134/saa7134-core.c | 4 +++- drivers/media/video/saa7134/saa7134-input.c | 3 ++- drivers/media/video/saa7134/saa7134.h | 6 ++++++ 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index ac361858901a..135fd59a6b20 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c @@ -3038,7 +3038,7 @@ int saa7134_board_init1(struct saa7134_dev *dev) switch (dev->board) { case SAA7134_BOARD_FLYVIDEO2000: case SAA7134_BOARD_FLYVIDEO3000: - dev->has_remote = 1; + dev->has_remote = SAA7134_REMOTE_GPIO; board_flyvideo(dev); break; case SAA7134_BOARD_FLYTVPLATINUM_MINI2: @@ -3068,7 +3068,7 @@ int saa7134_board_init1(struct saa7134_dev *dev) case SAA7134_BOARD_GOTVIEW_7135: case SAA7134_BOARD_KWORLD_TERMINATOR: case SAA7134_BOARD_PCTV_CARDBUS: - dev->has_remote = 1; + dev->has_remote = SAA7134_REMOTE_GPIO; break; case SAA7134_BOARD_MD5044: printk("%s: seems there are two different versions of the MD5044\n" @@ -3108,6 +3108,11 @@ int saa7134_board_init1(struct saa7134_dev *dev) saa_writeb (SAA7134_PRODUCTION_TEST_MODE, 0x00); break; + /* i2c remotes */ + case SAA7134_BOARD_PINNACLE_PCTV_110i: + case SAA7134_BOARD_UPMOST_PURPLE_TV: + dev->has_remote = SAA7134_REMOTE_I2C; + break; } return 0; } diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index afa0cfce6578..454b8a86c830 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c @@ -712,10 +712,12 @@ static int saa7134_hwinit2(struct saa7134_dev *dev) SAA7134_IRQ2_INTE_PE | SAA7134_IRQ2_INTE_AR; - if (dev->has_remote) + if (dev->has_remote == SAA7134_REMOTE_GPIO) irq2_mask |= (SAA7134_IRQ2_INTE_GPIO18 | SAA7134_IRQ2_INTE_GPIO18A | SAA7134_IRQ2_INTE_GPIO16 ); + else if (dev->has_remote == SAA7134_REMOTE_I2C) + request_module("ir-kbd-i2c"); saa_writel(SAA7134_IRQ1, 0); saa_writel(SAA7134_IRQ2, irq2_mask); diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index 2aba72de55d6..b792401712ba 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -716,7 +716,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) int polling = 0; int ir_type = IR_TYPE_OTHER; - if (!dev->has_remote) + if (dev->has_remote != SAA7134_REMOTE_GPIO) return -ENODEV; if (disable_ir) return -ENODEV; @@ -877,6 +877,7 @@ void saa7134_input_fini(struct saa7134_dev *dev) void saa7134_set_i2c_ir(struct saa7134_dev *dev, struct IR_i2c *ir) { if (disable_ir) { + dprintk("Found supported i2c remote, but IR has been disabled\n"); ir->get_key=NULL; return; } diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index a82468a07676..14a83b82ab23 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h @@ -212,6 +212,12 @@ struct saa7134_format { #define SAA7134_MAXBOARDS 8 #define SAA7134_INPUT_MAX 8 +/* ----------------------------------------------------------- */ +/* Since we support 2 remote types, lets tell them apart */ + +#define SAA7134_REMOTE_GPIO 1 +#define SAA7134_REMOTE_I2C 2 + /* ----------------------------------------------------------- */ /* Video Output Port Register Initialization Options */ -- cgit v1.2.2 From 17ce1ff9cfd90ab3ecffaa5ebfb4abbf8216f2cc Mon Sep 17 00:00:00 2001 From: Ricardo Cerqueira Date: Tue, 8 Nov 2005 21:38:47 -0800 Subject: [PATCH] V4L: 914: use less generic name for saa7134 card 79 Use less-generic name for saa7134 card #79 Signed-off-by: Ricardo Cerqueira Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/saa7134/saa7134-cards.c | 8 ++++---- drivers/media/video/saa7134/saa7134-input.c | 6 +++--- drivers/media/video/saa7134/saa7134.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index 135fd59a6b20..663d03e5bc67 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c @@ -2452,11 +2452,11 @@ struct saa7134_board saa7134_boards[] = { .gpio = 0x0200000, }, }, - [SAA7134_BOARD_PCTV_CARDBUS] = { + [SAA7134_BOARD_SEDNA_PC_TV_CARDBUS] = { /* Paul Tom Zalac */ /* Pavel Mihaylov */ - .name = "PCTV Cardbus TV/Radio (ITO25 Rev:2B)", - /* Sedna Cardbus TV Tuner */ + .name = "Sedna/MuchTV PC TV Cardbus TV/Radio (ITO25 Rev:2B)", + /* Sedna/MuchTV (OEM) Cardbus TV Tuner */ .audio_clock = 0x00187de7, .tuner_type = TUNER_PHILIPS_TDA8290, .radio_type = UNSET, @@ -3067,7 +3067,7 @@ int saa7134_board_init1(struct saa7134_dev *dev) case SAA7134_BOARD_AVACSSMARTTV: case SAA7134_BOARD_GOTVIEW_7135: case SAA7134_BOARD_KWORLD_TERMINATOR: - case SAA7134_BOARD_PCTV_CARDBUS: + case SAA7134_BOARD_SEDNA_PC_TV_CARDBUS: dev->has_remote = SAA7134_REMOTE_GPIO; break; case SAA7134_BOARD_MD5044: diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index b792401712ba..329accda6d45 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -546,7 +546,7 @@ static IR_KEYTAB_TYPE ir_codes_pinnacle[IR_KEYTAB_SIZE] = { /* Mapping for the 28 key remote control as seen at http://www.sednacomputer.com/photo/cardbus-tv.jpg Pavel Mihaylov */ -static IR_KEYTAB_TYPE pctv_cardbus_codes[IR_KEYTAB_SIZE] = { +static IR_KEYTAB_TYPE pctv_sedna_codes[IR_KEYTAB_SIZE] = { [ 0 ] = KEY_KP0, [ 1 ] = KEY_KP1, [ 2 ] = KEY_KP2, @@ -781,8 +781,8 @@ int saa7134_input_init1(struct saa7134_dev *dev) mask_keyup = 0x004000; polling = 50; // ms break; - case SAA7134_BOARD_PCTV_CARDBUS: - ir_codes = pctv_cardbus_codes; + case SAA7134_BOARD_SEDNA_PC_TV_CARDBUS: + ir_codes = pctv_sedna_codes; mask_keycode = 0x001f00; mask_keyup = 0x004000; polling = 50; // ms diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index 14a83b82ab23..d993344d37e4 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h @@ -205,7 +205,7 @@ struct saa7134_format { #define SAA7134_BOARD_MONSTERTV_MOBILE 76 #define SAA7134_BOARD_PINNACLE_PCTV_110i 77 #define SAA7134_BOARD_ASUSTeK_P7131_DUAL 78 -#define SAA7134_BOARD_PCTV_CARDBUS 79 +#define SAA7134_BOARD_SEDNA_PC_TV_CARDBUS 79 #define SAA7134_BOARD_ASUSTEK_DIGIMATRIX_TV 80 #define SAA7134_BOARD_PHILIPS_TIGER 81 -- cgit v1.2.2 From d6242f209984795644fb08b5410f405406c7104a Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:38:48 -0800 Subject: [PATCH] V4L: SAA7134 alsa build fix Fixes saa7134-alsa build inside saa7134 driver. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/saa7134/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/saa7134/Makefile b/drivers/media/video/saa7134/Makefile index 937dff8d561c..e0b28f0533af 100644 --- a/drivers/media/video/saa7134/Makefile +++ b/drivers/media/video/saa7134/Makefile @@ -3,7 +3,8 @@ saa7134-objs := saa7134-cards.o saa7134-core.o saa7134-i2c.o \ saa7134-oss.o saa7134-ts.o saa7134-tvaudio.o \ saa7134-vbi.o saa7134-video.o saa7134-input.o -obj-$(CONFIG_VIDEO_SAA7134) += saa7134.o saa7134-empress.o saa6752hs.o +obj-$(CONFIG_VIDEO_SAA7134) += saa7134.o saa7134-empress.o \ + saa6752hs.o saa7134-alsa.o obj-$(CONFIG_VIDEO_SAA7134_DVB) += saa7134-dvb.o EXTRA_CFLAGS += -I$(src)/.. -- cgit v1.2.2 From e2998e10a9ed47cb70a5be6207aa34b2f2f22c17 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Tue, 8 Nov 2005 21:38:49 -0800 Subject: [PATCH] V4L: 915: fixes compilation problems due removal of media/id.h and i2c-algo-bit Fixes compilation problems due removal of media/id.h and I2C_ALGO_BIT Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/video4linux/CARDLIST.saa7134 | 2 +- drivers/media/video/cs53l32a.c | 10 ++++++++-- drivers/media/video/wm8775.c | 12 ++++-------- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134 index 62076d2976ae..57c9d631db56 100644 --- a/Documentation/video4linux/CARDLIST.saa7134 +++ b/Documentation/video4linux/CARDLIST.saa7134 @@ -77,6 +77,6 @@ 76 -> SKNet MonsterTV Mobile [1131:4ee9] 77 -> Pinnacle PCTV 110i (saa7133) [11bd:002e] 78 -> ASUSTeK P7131 Dual [1043:4862] - 79 -> PCTV Cardbus TV/Radio (ITO25 Rev:2B) + 79 -> Sedna/MuchTV PC TV Cardbus TV/Radio (ITO25 Rev:2B) 80 -> ASUS Digimatrix TV [1043:0210] 81 -> Philips Tiger reference design [1131:2018] diff --git a/drivers/media/video/cs53l32a.c b/drivers/media/video/cs53l32a.c index 7434e5e66d59..780b352ec119 100644 --- a/drivers/media/video/cs53l32a.c +++ b/drivers/media/video/cs53l32a.c @@ -25,9 +25,9 @@ #include #include #include +#include #include #include -#include MODULE_DESCRIPTION("i2c device driver for cs53l32a Audio ADC"); MODULE_AUTHOR("Martin Vaughan"); @@ -190,7 +190,13 @@ static int cs53l32a_attach(struct i2c_adapter *adapter, int address, int kind) static int cs53l32a_probe(struct i2c_adapter *adapter) { - return i2c_probe(adapter, &addr_data, cs53l32a_attach); +#ifdef I2C_CLASS_TV_ANALOG + if (adapter->class & I2C_CLASS_TV_ANALOG) +#else + if (adapter->id == I2C_HW_B_BT848) +#endif + return i2c_probe(adapter, &addr_data, cs53l32a_attach); + return 0; } static int cs53l32a_detach(struct i2c_client *client) diff --git a/drivers/media/video/wm8775.c b/drivers/media/video/wm8775.c index 7d90ae5a99bc..22f286222004 100644 --- a/drivers/media/video/wm8775.c +++ b/drivers/media/video/wm8775.c @@ -26,9 +26,9 @@ #include #include #include +#include #include #include -#include MODULE_DESCRIPTION("wm8775 driver"); MODULE_AUTHOR("Ulf Eklund"); @@ -204,14 +204,10 @@ static int wm8775_probe(struct i2c_adapter *adapter) { #ifdef I2C_CLASS_TV_ANALOG if (adapter->class & I2C_CLASS_TV_ANALOG) - return i2c_probe(adapter, &addr_data, wm8775_attach); #else - switch (adapter->id) { - case I2C_HW_B_BT848: - return i2c_probe(adapter, &addr_data, tda9887_attach); - } -#endif /* I2C_CLASS_TV_ANALOG */ - + if (adapter->id == I2C_HW_B_BT848) +#endif + return i2c_probe(adapter, &addr_data, wm8775_attach); return 0; } -- cgit v1.2.2 From c5d4a70ff82aab638b871debc9c8b27216cf1ecd Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:38:50 -0800 Subject: [PATCH] V4L: 916: fixes set scart parameter definitions and audout ioctl Fixes set_scart parameter definitions and AUDOUT ioctl Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/msp3400.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/media/video/msp3400.c b/drivers/media/video/msp3400.c index b599f0554fb7..035dee4ce3f5 100644 --- a/drivers/media/video/msp3400.c +++ b/drivers/media/video/msp3400.c @@ -413,7 +413,7 @@ static void msp3400c_set_scart(struct i2c_client *client, int in, int out) msp->in_scart=in; - if (in<=2) { + if (in >= 1 && in <= 8 && out >= 0 && out <= 2) { if (-1 == scarts[out][in]) return; @@ -2120,10 +2120,11 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) case VIDIOC_G_AUDOUT: { struct v4l2_audioout *a=(struct v4l2_audioout *)arg; + int idx=a->index; memset(a,0,sizeof(*a)); - switch (a->index) { + switch (idx) { case 0: strcpy(a->name,"Scart1 Out"); break; @@ -2152,8 +2153,8 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) else msp->i2s_mode=0; } -printk("Setting audio out on msp34xx to input %i, mode %i\n",a->index,msp->i2s_mode); - msp3400c_set_scart(client,msp->in_scart,a->index); + dprintk("Setting audio out on msp34xx to input %i, mode %i\n",a->index,msp->i2s_mode); + msp3400c_set_scart(client,msp->in_scart,a->index+1); break; } -- cgit v1.2.2 From 7bde80769ddf76a2c2e3672f2a932cfc029a1d35 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Tue, 8 Nov 2005 21:38:50 -0800 Subject: [PATCH] V4L: 917: fixes some bugs in msp3400 - Adds missing msp34xxg_reset to VIDIOC_S_STD (just like VIDIOCSCHAN). - Improves msp3400 debug messages. Now, all kernel message in msp3400.c use the same prefix and include the I2C bus to differentiate between multiple msp3400 I2C chips. - Correctly prints the chip identifier for the msp44xx chips. - msp34xxg cleanups. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/msp3400.c | 301 ++++++++++++++++++++++-------------------- 1 file changed, 159 insertions(+), 142 deletions(-) diff --git a/drivers/media/video/msp3400.c b/drivers/media/video/msp3400.c index 035dee4ce3f5..a23fb0338986 100644 --- a/drivers/media/video/msp3400.c +++ b/drivers/media/video/msp3400.c @@ -56,6 +56,39 @@ #include #include "msp3400.h" +#define msp3400_dbg(fmt, arg...) \ + do { \ + if (debug) \ + printk(KERN_INFO "%s debug %d-%04x: " fmt, client->driver->name, \ + i2c_adapter_id(client->adapter), client->addr , ## arg); \ + } while (0) + +/* Medium volume debug. */ +#define msp3400_dbg_mediumvol(fmt, arg...) \ + do { \ + if (debug >= 2) \ + printk(KERN_INFO "%s debug %d-%04x: " fmt, client->driver->name, \ + i2c_adapter_id(client->adapter), client->addr , ## arg); \ + } while (0) + +/* High volume debug. Use with care. */ +#define msp3400_dbg_highvol(fmt, arg...) \ + do { \ + if (debug >= 16) \ + printk(KERN_INFO "%s debug %d-%04x: " fmt, client->driver->name, \ + i2c_adapter_id(client->adapter), client->addr , ## arg); \ + } while (0) + +#define msp3400_err(fmt, arg...) do { \ + printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->name, \ + i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) +#define msp3400_warn(fmt, arg...) do { \ + printk(KERN_WARNING "%s %d-%04x: " fmt, client->driver->name, \ + i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) +#define msp3400_info(fmt, arg...) do { \ + printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->name, \ + i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) + #define OPMODE_AUTO -1 #define OPMODE_MANUAL 0 #define OPMODE_SIMPLE 1 /* use short programming (>= msp3410 only) */ @@ -125,10 +158,6 @@ struct msp3400c { /* ---------------------------------------------------------------------- */ -#define dprintk if (debug >= 1) printk -#define d2printk if (debug >= 2) printk -#define dprintk_trace if (debug>=16) printk - /* read-only */ module_param(opmode, int, 0444); @@ -187,11 +216,11 @@ static int msp3400c_reset(struct i2c_client *client) { client->addr, I2C_M_RD, 2, read }, }; - dprintk_trace("trace: msp3400c_reset\n"); + msp3400_dbg_highvol("msp3400c_reset\n"); if ( (1 != i2c_transfer(client->adapter,&reset[0],1)) || (1 != i2c_transfer(client->adapter,&reset[1],1)) || (2 != i2c_transfer(client->adapter,test,2)) ) { - printk(KERN_ERR "msp3400: chip reset failed\n"); + msp3400_err("chip reset failed\n"); return -1; } return 0; @@ -216,21 +245,18 @@ static int msp3400c_read(struct i2c_client *client, int dev, int addr) if (2 == i2c_transfer(client->adapter,msgs,2)) break; err++; - printk(KERN_WARNING - "msp34xx: I/O error #%d (read 0x%02x/0x%02x)\n", err, + msp3400_warn("I/O error #%d (read 0x%02x/0x%02x)\n", err, dev, addr); current->state = TASK_INTERRUPTIBLE; schedule_timeout(msecs_to_jiffies(10)); } if (3 == err) { - printk(KERN_WARNING - "msp34xx: giving up, reseting chip. Sound will go off, sorry folks :-|\n"); + msp3400_warn("giving up, resetting chip. Sound will go off, sorry folks :-|\n"); msp3400c_reset(client); return -1; } retval = read[0] << 8 | read[1]; - dprintk_trace("trace: msp3400c_read(0x%x, 0x%x): 0x%x\n", dev, addr, - retval); + msp3400_dbg_highvol("msp3400c_read(0x%x, 0x%x): 0x%x\n", dev, addr, retval); return retval; } @@ -245,21 +271,18 @@ static int msp3400c_write(struct i2c_client *client, int dev, int addr, int val) buffer[3] = val >> 8; buffer[4] = val & 0xff; - dprintk_trace("trace: msp3400c_write(0x%x, 0x%x, 0x%x)\n", dev, addr, - val); + msp3400_dbg_highvol("msp3400c_write(0x%x, 0x%x, 0x%x)\n", dev, addr, val); for (err = 0; err < 3;) { if (5 == i2c_master_send(client, buffer, 5)) break; err++; - printk(KERN_WARNING - "msp34xx: I/O error #%d (write 0x%02x/0x%02x)\n", err, + msp3400_warn("I/O error #%d (write 0x%02x/0x%02x)\n", err, dev, addr); current->state = TASK_INTERRUPTIBLE; schedule_timeout(msecs_to_jiffies(10)); } if (3 == err) { - printk(KERN_WARNING - "msp34xx: giving up, reseting chip. Sound will go off, sorry folks :-|\n"); + msp3400_warn("giving up, reseting chip. Sound will go off, sorry folks :-|\n"); msp3400c_reset(client); return -1; } @@ -422,7 +445,7 @@ static void msp3400c_set_scart(struct i2c_client *client, int in, int out) } else msp->acb = 0xf60; /* Mute Input and SCART 1 Output */ - dprintk("msp34xx: scart switch: %s => %d (ACB=0x%04x)\n", + msp3400_dbg("scart switch: %s => %d (ACB=0x%04x)\n", scart_names[in], out, msp->acb); msp3400c_write(client,I2C_MSP3400C_DFP, 0x13, msp->acb); @@ -456,7 +479,7 @@ static void msp3400c_setvolume(struct i2c_client *client, balance = ((right - left) * 127) / vol; } - dprintk("msp34xx: setvolume: mute=%s %d:%d v=0x%02x b=0x%02x\n", + msp3400_dbg("setvolume: mute=%s %d:%d v=0x%02x b=0x%02x\n", muted ? "on" : "off", left, right, val >> 8, balance); msp3400c_write(client,I2C_MSP3400C_DFP, 0x0000, val); /* loudspeaker */ msp3400c_write(client,I2C_MSP3400C_DFP, 0x0006, val); /* headphones */ @@ -469,7 +492,7 @@ static void msp3400c_setbass(struct i2c_client *client, int bass) { int val = ((bass-32768) * 0x60 / 65535) << 8; - dprintk("msp34xx: setbass: %d 0x%02x\n", bass, val >> 8); + msp3400_dbg("setbass: %d 0x%02x\n", bass, val >> 8); msp3400c_write(client,I2C_MSP3400C_DFP, 0x0002, val); /* loudspeaker */ } @@ -477,7 +500,7 @@ static void msp3400c_settreble(struct i2c_client *client, int treble) { int val = ((treble-32768) * 0x60 / 65535) << 8; - dprintk("msp34xx: settreble: %d 0x%02x\n",treble, val>>8); + msp3400_dbg("settreble: %d 0x%02x\n",treble, val>>8); msp3400c_write(client,I2C_MSP3400C_DFP, 0x0003, val); /* loudspeaker */ } @@ -486,7 +509,7 @@ static void msp3400c_setmode(struct i2c_client *client, int type) struct msp3400c *msp = i2c_get_clientdata(client); int i; - dprintk("msp3400: setmode: %d\n",type); + msp3400_dbg("setmode: %d\n",type); msp->mode = type; msp->audmode = V4L2_TUNER_MODE_MONO; msp->rxsubchans = V4L2_TUNER_SUB_MONO; @@ -565,8 +588,8 @@ static void msp3400c_setstereo(struct i2c_client *client, int mode) /* this method would break everything, let's make sure * it's never called */ - dprintk - ("msp34xxg: DEBUG WARNING setstereo called with mode=%d instead of set_source (ignored)\n", + msp3400_dbg + ("DEBUG WARNING setstereo called with mode=%d instead of set_source (ignored)\n", mode); return; } @@ -574,8 +597,7 @@ static void msp3400c_setstereo(struct i2c_client *client, int mode) /* switch demodulator */ switch (msp->mode) { case MSP_MODE_FM_TERRA: - dprintk("msp3400: FM setstereo: %s\n", - strmode[mode]); + msp3400_dbg("FM setstereo: %s\n", strmode[mode]); msp3400c_setcarrier(client,msp->second,msp->main); switch (mode) { case V4L2_TUNER_MODE_STEREO: @@ -589,7 +611,7 @@ static void msp3400c_setstereo(struct i2c_client *client, int mode) } break; case MSP_MODE_FM_SAT: - dprintk("msp3400: SAT setstereo: %s\n", strmode[mode]); + msp3400_dbg("SAT setstereo: %s\n", strmode[mode]); switch (mode) { case V4L2_TUNER_MODE_MONO: msp3400c_setcarrier(client, MSP_CARRIER(6.5), MSP_CARRIER(6.5)); @@ -608,24 +630,24 @@ static void msp3400c_setstereo(struct i2c_client *client, int mode) case MSP_MODE_FM_NICAM1: case MSP_MODE_FM_NICAM2: case MSP_MODE_AM_NICAM: - dprintk("msp3400: NICAM setstereo: %s\n",strmode[mode]); + msp3400_dbg("NICAM setstereo: %s\n",strmode[mode]); msp3400c_setcarrier(client,msp->second,msp->main); if (msp->nicam_on) nicam=0x0100; break; case MSP_MODE_BTSC: - dprintk("msp3400: BTSC setstereo: %s\n",strmode[mode]); + msp3400_dbg("BTSC setstereo: %s\n",strmode[mode]); nicam=0x0300; break; case MSP_MODE_EXTERN: - dprintk("msp3400: extern setstereo: %s\n",strmode[mode]); + msp3400_dbg("extern setstereo: %s\n",strmode[mode]); nicam = 0x0200; break; case MSP_MODE_FM_RADIO: - dprintk("msp3400: FM-Radio setstereo: %s\n",strmode[mode]); + msp3400_dbg("FM-Radio setstereo: %s\n",strmode[mode]); break; default: - dprintk("msp3400: mono setstereo\n"); + msp3400_dbg("mono setstereo\n"); return; } @@ -636,7 +658,7 @@ static void msp3400c_setstereo(struct i2c_client *client, int mode) break; case V4L2_TUNER_MODE_MONO: if (msp->mode == MSP_MODE_AM_NICAM) { - dprintk("msp3400: switching to AM mono\n"); + msp3400_dbg("switching to AM mono\n"); /* AM mono decoding is handled by tuner, not MSP chip */ /* SCART switching control register */ msp3400c_set_scart(client,SCART_MONO,0); @@ -650,7 +672,7 @@ static void msp3400c_setstereo(struct i2c_client *client, int mode) src = 0x0010 | nicam; break; } - dprintk("msp3400: setstereo final source/matrix = 0x%x\n", src); + msp3400_dbg("setstereo final source/matrix = 0x%x\n", src); if (dolby) { msp3400c_write(client,I2C_MSP3400C_DFP, 0x0008,0x0520); @@ -666,24 +688,26 @@ static void msp3400c_setstereo(struct i2c_client *client, int mode) } static void -msp3400c_print_mode(struct msp3400c *msp) +msp3400c_print_mode(struct i2c_client *client) { + struct msp3400c *msp = i2c_get_clientdata(client); + if (msp->main == msp->second) { - dprintk("msp3400: mono sound carrier: %d.%03d MHz\n", + msp3400_dbg("mono sound carrier: %d.%03d MHz\n", msp->main/910000,(msp->main/910)%1000); } else { - dprintk("msp3400: main sound carrier: %d.%03d MHz\n", + msp3400_dbg("main sound carrier: %d.%03d MHz\n", msp->main/910000,(msp->main/910)%1000); } if (msp->mode == MSP_MODE_FM_NICAM1 || msp->mode == MSP_MODE_FM_NICAM2) - dprintk("msp3400: NICAM/FM carrier : %d.%03d MHz\n", + msp3400_dbg("NICAM/FM carrier : %d.%03d MHz\n", msp->second/910000,(msp->second/910)%1000); if (msp->mode == MSP_MODE_AM_NICAM) - dprintk("msp3400: NICAM/AM carrier : %d.%03d MHz\n", + msp3400_dbg("NICAM/AM carrier : %d.%03d MHz\n", msp->second/910000,(msp->second/910)%1000); if (msp->mode == MSP_MODE_FM_TERRA && msp->main != msp->second) { - dprintk("msp3400: FM-stereo carrier : %d.%03d MHz\n", + msp3400_dbg("FM-stereo carrier : %d.%03d MHz\n", msp->second/910000,(msp->second/910)%1000); } } @@ -741,7 +765,7 @@ static int autodetect_stereo(struct i2c_client *client) val = msp3400c_read(client, I2C_MSP3400C_DFP, 0x18); if (val > 32767) val -= 65536; - dprintk("msp34xx: stereo detect register: %d\n",val); + msp3400_dbg("stereo detect register: %d\n",val); if (val > 4096) { rxsubchans = V4L2_TUNER_SUB_STEREO | V4L2_TUNER_SUB_MONO; } else if (val < -4096) { @@ -755,7 +779,7 @@ static int autodetect_stereo(struct i2c_client *client) case MSP_MODE_FM_NICAM2: case MSP_MODE_AM_NICAM: val = msp3400c_read(client, I2C_MSP3400C_DEM, 0x23); - dprintk("msp34xx: nicam sync=%d, mode=%d\n", + msp3400_dbg("nicam sync=%d, mode=%d\n", val & 1, (val & 0x1e) >> 1); if (val & 1) { @@ -788,7 +812,7 @@ static int autodetect_stereo(struct i2c_client *client) break; case MSP_MODE_BTSC: val = msp3400c_read(client, I2C_MSP3400C_DEM, 0x200); - dprintk("msp3410: status=0x%x (pri=%s, sec=%s, %s%s%s)\n", + msp3400_dbg("status=0x%x (pri=%s, sec=%s, %s%s%s)\n", val, (val & 0x0002) ? "no" : "yes", (val & 0x0004) ? "no" : "yes", @@ -802,13 +826,13 @@ static int autodetect_stereo(struct i2c_client *client) } if (rxsubchans != msp->rxsubchans) { update = 1; - dprintk("msp34xx: watch: rxsubchans %d => %d\n", + msp3400_dbg("watch: rxsubchans %d => %d\n", msp->rxsubchans,rxsubchans); msp->rxsubchans = rxsubchans; } if (newnicam != msp->nicam_on) { update = 1; - dprintk("msp34xx: watch: nicam %d => %d\n", + msp3400_dbg("watch: nicam %d => %d\n", msp->nicam_on,newnicam); msp->nicam_on = newnicam; } @@ -865,14 +889,14 @@ static int msp3400c_thread(void *data) struct CARRIER_DETECT *cd; int count, max1,max2,val1,val2, val,this; - printk("msp3400: kthread started\n"); + msp3400_info("msp3400 daemon started\n"); for (;;) { - d2printk("msp3400: thread: sleep\n"); + msp3400_dbg_mediumvol("msp3400 thread: sleep\n"); msp34xx_sleep(msp,-1); - d2printk("msp3400: thread: wakeup\n"); + msp3400_dbg_mediumvol("msp3400 thread: wakeup\n"); restart: - dprintk("msp3410: thread: restart scan\n"); + msp3400_dbg("thread: restart scan\n"); msp->restart = 0; if (kthread_should_stop()) break; @@ -880,7 +904,7 @@ static int msp3400c_thread(void *data) if (VIDEO_MODE_RADIO == msp->norm || MSP_MODE_EXTERN == msp->mode) { /* no carrier scan, just unmute */ - printk("msp3400: thread: no carrier scan\n"); + msp3400_info("thread: no carrier scan\n"); msp3400c_setvolume(client, msp->muted, msp->left, msp->right); continue; } @@ -904,7 +928,7 @@ static int msp3400c_thread(void *data) /* autodetect doesn't work well with AM ... */ max1 = 3; count = 0; - dprintk("msp3400: AM sound override\n"); + msp3400_dbg("AM sound override\n"); } for (this = 0; this < count; this++) { @@ -916,7 +940,7 @@ static int msp3400c_thread(void *data) val -= 65536; if (val1 < val) val1 = val, max1 = this; - dprintk("msp3400: carrier1 val: %5d / %s\n", val,cd[this].name); + msp3400_dbg("carrier1 val: %5d / %s\n", val,cd[this].name); } /* carrier detect pass #2 -- second (stereo) carrier */ @@ -952,7 +976,7 @@ static int msp3400c_thread(void *data) val -= 65536; if (val2 < val) val2 = val, max2 = this; - dprintk("msp3400: carrier2 val: %5d / %s\n", val,cd[this].name); + msp3400_dbg("carrier2 val: %5d / %s\n", val,cd[this].name); } /* programm the msp3400 according to the results */ @@ -1032,7 +1056,7 @@ static int msp3400c_thread(void *data) msp3400c_restore_dfp(client); if (debug) - msp3400c_print_mode(msp); + msp3400c_print_mode(client); /* monitor tv audio mode */ while (msp->watch_stereo) { @@ -1041,7 +1065,7 @@ static int msp3400c_thread(void *data) watch_stereo(client); } } - dprintk("msp3400: thread: exit\n"); + msp3400_dbg("thread: exit\n"); return 0; } @@ -1085,11 +1109,11 @@ static inline const char *msp34xx_standard_mode_name(int mode) return "unknown"; } -static int msp34xx_modus(int norm) +static int msp34xx_modus(struct i2c_client *client, int norm) { switch (norm) { case VIDEO_MODE_PAL: - dprintk("msp34xx: video mode selected to PAL\n"); + msp3400_dbg("video mode selected to PAL\n"); #if 1 /* experimental: not sure this works with all chip versions */ @@ -1099,16 +1123,16 @@ static int msp34xx_modus(int norm) return 0x1003; #endif case VIDEO_MODE_NTSC: /* BTSC */ - dprintk("msp34xx: video mode selected to NTSC\n"); + msp3400_dbg("video mode selected to NTSC\n"); return 0x2003; case VIDEO_MODE_SECAM: - dprintk("msp34xx: video mode selected to SECAM\n"); + msp3400_dbg("video mode selected to SECAM\n"); return 0x0003; case VIDEO_MODE_RADIO: - dprintk("msp34xx: video mode selected to Radio\n"); + msp3400_dbg("video mode selected to Radio\n"); return 0x0003; case VIDEO_MODE_AUTO: - dprintk("msp34xx: video mode selected to Auto\n"); + msp3400_dbg("video mode selected to Auto\n"); return 0x2003; default: return 0x0003; @@ -1137,21 +1161,21 @@ static int msp3410d_thread(void *data) struct msp3400c *msp = i2c_get_clientdata(client); int mode,val,i,std; - printk("msp3410: daemon started\n"); + msp3400_info("msp3410 daemon started\n"); for (;;) { - d2printk("msp3410: thread: sleep\n"); + msp3400_dbg_mediumvol("msp3410 thread: sleep\n"); msp34xx_sleep(msp,-1); - d2printk("msp3410: thread: wakeup\n"); + msp3400_dbg_mediumvol("msp3410 thread: wakeup\n"); restart: - dprintk("msp3410: thread: restart scan\n"); + msp3400_dbg("thread: restart scan\n"); msp->restart = 0; if (kthread_should_stop()) break; if (msp->mode == MSP_MODE_EXTERN) { /* no carrier scan needed, just unmute */ - dprintk("msp3410: thread: no carrier scan\n"); + msp3400_dbg("thread: no carrier scan\n"); msp3400c_setvolume(client, msp->muted, msp->left, msp->right); continue; } @@ -1164,14 +1188,14 @@ static int msp3410d_thread(void *data) goto restart; /* start autodetect */ - mode = msp34xx_modus(msp->norm); + mode = msp34xx_modus(client, msp->norm); std = msp34xx_standard(msp->norm); msp3400c_write(client, I2C_MSP3400C_DEM, 0x30, mode); msp3400c_write(client, I2C_MSP3400C_DEM, 0x20, std); msp->watch_stereo = 0; if (debug) - dprintk("msp3410: setting mode: %s (0x%04x)\n", + msp3400_dbg("setting mode: %s (0x%04x)\n", msp34xx_standard_mode_name(std) ,std); if (std != 1) { @@ -1187,13 +1211,13 @@ static int msp3410d_thread(void *data) val = msp3400c_read(client, I2C_MSP3400C_DEM, 0x7e); if (val < 0x07ff) break; - dprintk("msp3410: detection still in progress\n"); + msp3400_dbg("detection still in progress\n"); } } for (i = 0; modelist[i].name != NULL; i++) if (modelist[i].retval == val) break; - dprintk("msp3410: current mode: %s (0x%04x)\n", + msp3400_dbg("current mode: %s (0x%04x)\n", modelist[i].name ? modelist[i].name : "unknown", val); msp->main = modelist[i].main; @@ -1201,7 +1225,7 @@ static int msp3410d_thread(void *data) if (amsound && (msp->norm == VIDEO_MODE_SECAM) && (val != 0x0009)) { /* autodetection has failed, let backup */ - dprintk("msp3410: autodetection failed," + msp3400_dbg("autodetection failed," " switching to backup mode: %s (0x%04x)\n", modelist[8].name ? modelist[8].name : "unknown",val); val = 0x0009; @@ -1286,7 +1310,7 @@ static int msp3410d_thread(void *data) watch_stereo(client); } } - dprintk("msp3410: thread: exit\n"); + msp3400_dbg("thread: exit\n"); return 0; } @@ -1319,7 +1343,7 @@ static int msp34xxg_reset(struct i2c_client *client) msp3400c_write(client,I2C_MSP3400C_DEM, 0x40, msp->i2s_mode); /* step-by-step initialisation, as described in the manual */ - modus = msp34xx_modus(msp->norm); + modus = msp34xx_modus(client, msp->norm); std = msp34xx_standard(msp->norm); modus &= ~0x03; /* STATUS_CHANGE=0 */ modus |= 0x01; /* AUTOMATIC_SOUND_DETECTION=1 */ @@ -1359,15 +1383,15 @@ static int msp34xxg_thread(void *data) struct msp3400c *msp = i2c_get_clientdata(client); int val, std, i; - printk("msp34xxg: daemon started\n"); + msp3400_info("msp34xxg daemon started\n"); msp->source = 1; /* default */ for (;;) { - d2printk("msp34xxg: thread: sleep\n"); + msp3400_dbg_mediumvol("msp34xxg thread: sleep\n"); msp34xx_sleep(msp,-1); - d2printk("msp34xxg: thread: wakeup\n"); + msp3400_dbg_mediumvol("msp34xxg thread: wakeup\n"); restart: - dprintk("msp34xxg: thread: restart scan\n"); + msp3400_dbg("thread: restart scan\n"); msp->restart = 0; if (kthread_should_stop()) break; @@ -1379,7 +1403,7 @@ static int msp34xxg_thread(void *data) goto unmute; /* watch autodetect */ - dprintk("msp34xxg: triggered autodetect, waiting for result\n"); + msp3400_dbg("triggered autodetect, waiting for result\n"); for (i = 0; i < 10; i++) { if (msp34xx_sleep(msp,100)) goto restart; @@ -1390,19 +1414,19 @@ static int msp34xxg_thread(void *data) std = val; break; } - dprintk("msp34xxg: detection still in progress\n"); + msp3400_dbg("detection still in progress\n"); } if (0x01 == std) { - dprintk("msp34xxg: detection still in progress after 10 tries. giving up.\n"); + msp3400_dbg("detection still in progress after 10 tries. giving up.\n"); continue; } unmute: - dprintk("msp34xxg: current mode: %s (0x%04x)\n", + msp3400_dbg("current mode: %s (0x%04x)\n", msp34xx_standard_mode_name(std), std); /* unmute: dispatch sound to scart output, set scart volume */ - dprintk("msp34xxg: unmute\n"); + msp3400_dbg("unmute\n"); msp3400c_setbass(client, msp->bass); msp3400c_settreble(client, msp->treble); @@ -1417,7 +1441,7 @@ static int msp34xxg_thread(void *data) msp3400c_write(client,I2C_MSP3400C_DEM, 0x40, msp->i2s_mode); } - dprintk("msp34xxg: thread: exit\n"); + msp3400_dbg("thread: exit\n"); return 0; } @@ -1436,7 +1460,7 @@ static void msp34xxg_set_source(struct i2c_client *client, int source) * for MONO (source==0) downmixing set bit[7:0] to 0x30 */ int value = (source&0x07)<<8|(source==0 ? 0x30:0x20); - dprintk("msp34xxg: set source to %d (0x%x)\n", source, value); + msp3400_dbg("set source to %d (0x%x)\n", source, value); msp3400c_write(client, I2C_MSP3400C_DFP, 0x08, /* Loudspeaker Output */ @@ -1487,7 +1511,7 @@ static void msp34xxg_detect_stereo(struct i2c_client *client) * this is a problem, I'll handle SAP just like lang1/lang2. */ } - dprintk("msp34xxg: status=0x%x, stereo=%d, bilingual=%d -> rxsubchans=%d\n", + msp3400_dbg("status=0x%x, stereo=%d, bilingual=%d -> rxsubchans=%d\n", status, is_stereo, is_bilingual, msp->rxsubchans); } @@ -1534,7 +1558,7 @@ static void msp_wake_thread(struct i2c_client *client); static struct i2c_driver driver = { .owner = THIS_MODULE, - .name = "i2c msp3400 driver", + .name = "msp3400", .id = I2C_DRIVERID_MSP3400, .flags = I2C_DF_NOTIFY, .attach_adapter = msp_probe, @@ -1556,7 +1580,7 @@ static struct i2c_client client_template = static int msp_attach(struct i2c_adapter *adap, int addr, int kind) { struct msp3400c *msp; - struct i2c_client *c; + struct i2c_client *client = &client_template; int (*thread_func)(void *data) = NULL; int i; @@ -1564,15 +1588,15 @@ static int msp_attach(struct i2c_adapter *adap, int addr, int kind) client_template.addr = addr; if (-1 == msp3400c_reset(&client_template)) { - dprintk("msp34xx: no chip found\n"); + msp3400_dbg("no chip found\n"); return -1; } - if (NULL == (c = kmalloc(sizeof(struct i2c_client),GFP_KERNEL))) + if (NULL == (client = kmalloc(sizeof(struct i2c_client),GFP_KERNEL))) return -ENOMEM; - memcpy(c,&client_template,sizeof(struct i2c_client)); + memcpy(client,&client_template,sizeof(struct i2c_client)); if (NULL == (msp = kmalloc(sizeof(struct msp3400c),GFP_KERNEL))) { - kfree(c); + kfree(client); return -ENOMEM; } @@ -1588,31 +1612,32 @@ static int msp_attach(struct i2c_adapter *adap, int addr, int kind) for (i = 0; i < DFP_COUNT; i++) msp->dfp_regs[i] = -1; - i2c_set_clientdata(c, msp); + i2c_set_clientdata(client, msp); init_waitqueue_head(&msp->wq); - if (-1 == msp3400c_reset(c)) { + if (-1 == msp3400c_reset(client)) { kfree(msp); - kfree(c); - dprintk("msp34xx: no chip found\n"); + kfree(client); + msp3400_dbg("no chip found\n"); return -1; } - msp->rev1 = msp3400c_read(c, I2C_MSP3400C_DFP, 0x1e); + msp->rev1 = msp3400c_read(client, I2C_MSP3400C_DFP, 0x1e); if (-1 != msp->rev1) - msp->rev2 = msp3400c_read(c, I2C_MSP3400C_DFP, 0x1f); + msp->rev2 = msp3400c_read(client, I2C_MSP3400C_DFP, 0x1f); if ((-1 == msp->rev1) || (0 == msp->rev1 && 0 == msp->rev2)) { kfree(msp); - kfree(c); - dprintk("msp34xx: error while reading chip version\n"); + kfree(client); + msp3400_dbg("error while reading chip version\n"); return -1; } - printk(KERN_INFO "msp34xx: rev1=0x%04x, rev2=0x%04x\n", msp->rev1, msp->rev2); + msp3400_dbg("rev1=0x%04x, rev2=0x%04x\n", msp->rev1, msp->rev2); - msp3400c_setvolume(c, msp->muted, msp->left, msp->right); + msp3400c_setvolume(client, msp->muted, msp->left, msp->right); - snprintf(c->name, sizeof(c->name), "MSP34%02d%c-%c%d", - (msp->rev2>>8)&0xff, (msp->rev1&0xff)+'@', + snprintf(client->name, sizeof(client->name), "MSP%c4%02d%c-%c%d", + ((msp->rev1>>4)&0x0f) + '3', + (msp->rev2>>8)&0xff, (msp->rev1&0x0f)+'@', ((msp->rev1>>8)&0xff)+'@', msp->rev2&0x1f); msp->opmode = opmode; @@ -1626,7 +1651,7 @@ static int msp_attach(struct i2c_adapter *adap, int addr, int kind) } /* hello world :-) */ - printk(KERN_INFO "msp34xx: init: chip=%s", c->name); + msp3400_info("chip=%s", client->name); if (HAVE_NICAM(msp)) printk(" +nicam"); if (HAVE_SIMPLE(msp)) @@ -1655,20 +1680,20 @@ static int msp_attach(struct i2c_adapter *adap, int addr, int kind) /* startup control thread if needed */ if (thread_func) { - msp->kthread = kthread_run(thread_func, c, "msp34xx"); + msp->kthread = kthread_run(thread_func, client, "msp34xx"); if (NULL == msp->kthread) - printk(KERN_WARNING "msp34xx: kernel_thread() failed\n"); - msp_wake_thread(c); + msp3400_warn("kernel_thread() failed\n"); + msp_wake_thread(client); } /* done */ - i2c_attach_client(c); + i2c_attach_client(client); /* update our own array */ for (i = 0; i < MSP3400_MAX; i++) { if (NULL == msps[i]) { - msps[i] = c; + msps[i] = client; break; } } @@ -1791,7 +1816,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) switch (cmd) { case AUDC_SET_INPUT: - dprintk("msp34xx: AUDC_SET_INPUT(%d)\n",*sarg); + msp3400_dbg("AUDC_SET_INPUT(%d)\n",*sarg); if (*sarg == msp->input) break; @@ -1832,12 +1857,9 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) break; case AUDC_SET_RADIO: - dprintk("msp34xx: AUDC_SET_RADIO\n"); + msp3400_dbg("AUDC_SET_RADIO\n"); msp->norm = VIDEO_MODE_RADIO; - dprintk("msp34xx: switching to radio mode\n"); - if (IS_MSP34XX_G(msp)) - msp34xxg_reset(client); - + msp3400_dbg("switching to radio mode\n"); msp->watch_stereo = 0; switch (msp->opmode) { case OPMODE_MANUAL: @@ -1886,7 +1908,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) { struct video_audio *va = arg; - dprintk("msp34xx: VIDIOCGAUDIO\n"); + msp3400_dbg("VIDIOCGAUDIO\n"); va->flags |= VIDEO_AUDIO_VOLUME | VIDEO_AUDIO_BASS | VIDEO_AUDIO_TREBLE | @@ -1914,28 +1936,28 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) { struct video_audio *va = arg; - dprintk("msp34xx: VIDIOCSAUDIO\n"); + msp3400_dbg("VIDIOCSAUDIO\n"); msp->muted = (va->flags & VIDEO_AUDIO_MUTE); msp->left = (MIN(65536 - va->balance, 32768) * va->volume) / 32768; msp->right = (MIN(va->balance, 32768) * va->volume) / 32768; msp->bass = va->bass; msp->treble = va->treble; - dprintk("msp34xx: VIDIOCSAUDIO setting va->volume to %d\n", + msp3400_dbg("VIDIOCSAUDIO setting va->volume to %d\n", va->volume); - dprintk("msp34xx: VIDIOCSAUDIO setting va->balance to %d\n", + msp3400_dbg("VIDIOCSAUDIO setting va->balance to %d\n", va->balance); - dprintk("msp34xx: VIDIOCSAUDIO setting va->flags to %d\n", + msp3400_dbg("VIDIOCSAUDIO setting va->flags to %d\n", va->flags); - dprintk("msp34xx: VIDIOCSAUDIO setting msp->left to %d\n", + msp3400_dbg("VIDIOCSAUDIO setting msp->left to %d\n", msp->left); - dprintk("msp34xx: VIDIOCSAUDIO setting msp->right to %d\n", + msp3400_dbg("VIDIOCSAUDIO setting msp->right to %d\n", msp->right); - dprintk("msp34xx: VIDIOCSAUDIO setting msp->bass to %d\n", + msp3400_dbg("VIDIOCSAUDIO setting msp->bass to %d\n", msp->bass); - dprintk("msp34xx: VIDIOCSAUDIO setting msp->treble to %d\n", + msp3400_dbg("VIDIOCSAUDIO setting msp->treble to %d\n", msp->treble); - dprintk("msp34xx: VIDIOCSAUDIO setting msp->mode to %d\n", + msp3400_dbg("VIDIOCSAUDIO setting msp->mode to %d\n", msp->mode); msp3400c_setvolume(client, msp->muted, msp->left, msp->right); msp3400c_setbass(client, msp->bass); @@ -1950,11 +1972,8 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) { struct video_channel *vc = arg; - dprintk("msp34xx: VIDIOCSCHAN (norm=%d)\n",vc->norm); + msp3400_dbg("VIDIOCSCHAN (norm=%d)\n",vc->norm); msp->norm = vc->norm; - if (IS_MSP34XX_G(msp)) - msp34xxg_reset(client); - msp_wake_thread(client); break; } @@ -1963,10 +1982,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) case VIDIOC_S_FREQUENCY: { /* new channel -- kick audio carrier scan */ - dprintk("msp34xx: VIDIOCSFREQ\n"); - if (IS_MSP34XX_G(msp)) - msp34xxg_reset(client); - + msp3400_dbg("VIDIOCSFREQ\n"); msp_wake_thread(client); break; } @@ -1976,7 +1992,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) { struct msp_matrix *mspm = arg; - dprintk("msp34xx: MSP_SET_MATRIX\n"); + msp3400_dbg("MSP_SET_MATRIX\n"); msp3400c_set_scart(client, mspm->input, mspm->output); break; } @@ -2153,7 +2169,8 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) else msp->i2s_mode=0; } - dprintk("Setting audio out on msp34xx to input %i, mode %i\n",a->index,msp->i2s_mode); + msp3400_dbg("Setting audio out on msp34xx to input %i, mode %i\n", + a->index,msp->i2s_mode); msp3400c_set_scart(client,msp->in_scart,a->index+1); break; @@ -2168,19 +2185,19 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) static int msp_suspend(struct device * dev, pm_message_t state) { - struct i2c_client *c = container_of(dev, struct i2c_client, dev); + struct i2c_client *client = container_of(dev, struct i2c_client, dev); - dprintk("msp34xx: suspend\n"); - msp3400c_reset(c); + msp3400_dbg("msp34xx: suspend\n"); + msp3400c_reset(client); return 0; } static int msp_resume(struct device * dev) { - struct i2c_client *c = container_of(dev, struct i2c_client, dev); + struct i2c_client *client = container_of(dev, struct i2c_client, dev); - dprintk("msp34xx: resume\n"); - msp_wake_thread(c); + msp3400_dbg("msp34xx: resume\n"); + msp_wake_thread(client); return 0; } -- cgit v1.2.2 From 7f7e846ca552c4cf2e04b4666cea18dc26b36b59 Mon Sep 17 00:00:00 2001 From: Torsten Seeboth Date: Tue, 8 Nov 2005 21:38:51 -0800 Subject: [PATCH] V4L: 919: improves the audio handling for nicam on cx88-audio Improves the audio handling for NICAM on cx88 audio. Signed-off-by: Torsten Seeboth Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/cx88/cx88-tvaudio.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/media/video/cx88/cx88-tvaudio.c b/drivers/media/video/cx88/cx88-tvaudio.c index 7815f332062d..6d9bec1c583b 100644 --- a/drivers/media/video/cx88/cx88-tvaudio.c +++ b/drivers/media/video/cx88/cx88-tvaudio.c @@ -123,7 +123,9 @@ static void set_audio_start(struct cx88_core *core, u32 mode) cx_write(AUD_VOL_CTL, (1 << 6)); // start programming - cx_write(AUD_CTL, 0x0000); + cx_write(MO_AUD_DMACNTRL, 0x0000); + msleep(100); + //cx_write(AUD_CTL, 0x0000); cx_write(AUD_INIT, mode); cx_write(AUD_INIT_LD, 0x0001); cx_write(AUD_SOFT_RESET, 0x0001); @@ -151,6 +153,7 @@ static void set_audio_finish(struct cx88_core *core, u32 ctl) /* finish programming */ cx_write(AUD_SOFT_RESET, 0x0000); + cx_write(MO_AUD_DMACNTRL, 0x0003); /* unmute */ volume = cx_sread(SHADOW_AUD_VOL_CTL); @@ -341,6 +344,7 @@ static void set_audio_standard_NICAM(struct cx88_core *core, u32 mode) { /* end of list */ }, }; + set_audio_start(core,SEL_NICAM); switch (core->tvaudio) { case WW_L: dprintk("%s SECAM-L NICAM (status: devel)\n", __FUNCTION__); @@ -740,7 +744,7 @@ void cx88_set_tvaudio(struct cx88_core *core) /* set nicam mode - otherwise AUD_NICAM_STATUS2 contains wrong values */ - set_audio_standard_NICAM(core, EN_NICAM_FORCE_MONO1); + set_audio_standard_NICAM(core, EN_NICAM_AUTO_STEREO); if (0 == cx88_detect_nicam(core)) { /* fall back to fm / am mono */ set_audio_standard_A2(core, EN_A2_FORCE_MONO1); -- cgit v1.2.2 From 9d4d9c05c807ab8a49ac0024987b223bb32c022d Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:38:52 -0800 Subject: [PATCH] V4L: 920: fixed autodetection of max size by if alternate setting - Fixed autodetection of max size by if alternate setting - Fixed some debug messages Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/em28xx/em28xx-core.c | 9 +++---- drivers/media/video/em28xx/em28xx-video.c | 45 +++++++++++++++++++------------ drivers/media/video/em28xx/em28xx.h | 4 +-- 3 files changed, 34 insertions(+), 24 deletions(-) diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index 5cc850666fd7..d54bc0127484 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c @@ -797,20 +797,19 @@ int em28xx_set_alternate(struct em28xx *dev) dev->alt = alt; if (dev->alt == 0) { int i; - for(i=0;i< EM28XX_MAX_ALT; i++) + for(i=0;i< dev->num_alt; i++) if(dev->alt_max_pkt_size[i]>dev->alt_max_pkt_size[dev->alt]) dev->alt=i; } if (dev->alt != prev_alt) { dev->max_pkt_size = dev->alt_max_pkt_size[dev->alt]; - em28xx_coredbg("setting alternate %d with wMaxPacketSize=%u", dev->alt, + em28xx_coredbg("setting alternate %d with wMaxPacketSize=%u\n", dev->alt, dev->max_pkt_size); errCode = usb_set_interface(dev->udev, 0, dev->alt); if (errCode < 0) { - em28xx_errdev - ("cannot change alternate number to %d (error=%i)\n", - dev->alt, errCode); + em28xx_errdev ("cannot change alternate number to %d (error=%i)\n", + dev->alt, errCode); return errCode; } } diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 0bbfce03172d..57c1826b928e 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c @@ -53,8 +53,7 @@ MODULE_LICENSE("GPL"); static LIST_HEAD(em28xx_devlist); -static unsigned int card[] = {[0 ... (EM28XX_MAXBOARDS - 1)] = UNSET }; - +static unsigned int card[] = {[0 ... (EM28XX_MAXBOARDS - 1)] = UNSET }; module_param_array(card, int, NULL, 0444); MODULE_PARM_DESC(card,"card type"); @@ -1591,7 +1590,6 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, int retval = -ENOMEM; int errCode, i; unsigned int maxh, maxw; - struct usb_interface *uif; dev->udev = udev; dev->model = model; @@ -1651,17 +1649,6 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, dev->vpic.depth = 16; dev->vpic.palette = VIDEO_PALETTE_YUV422; - /* compute alternate max packet sizes */ - uif = dev->udev->actconfig->interface[0]; - dev->alt_max_pkt_size[0] = 0; - for (i = 1; i <= EM28XX_MAX_ALT && i < uif->num_altsetting ; i++) { - u16 tmp = - le16_to_cpu(uif->altsetting[i].endpoint[1].desc. - wMaxPacketSize); - dev->alt_max_pkt_size[i] = - (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1); - } - #ifdef CONFIG_MODULES /* request some modules */ if (dev->decoder == EM28XX_SAA7113 || dev->decoder == EM28XX_SAA7114) @@ -1756,6 +1743,7 @@ static int em28xx_usb_probe(struct usb_interface *interface, { const struct usb_endpoint_descriptor *endpoint; struct usb_device *udev; + struct usb_interface *uif; struct em28xx *dev = NULL; int retval = -ENODEV; int model,i,nr,ifnum; @@ -1795,7 +1783,7 @@ static int em28xx_usb_probe(struct usb_interface *interface, nr=interface->minor; if (nr>EM28XX_MAXBOARDS) { - printk ("em28xx: Supports only %i em28xx boards.\n",EM28XX_MAXBOARDS); + printk (DRIVER_NAME ": Supports only %i em28xx boards.\n",EM28XX_MAXBOARDS); return -ENOMEM; } @@ -1807,6 +1795,28 @@ static int em28xx_usb_probe(struct usb_interface *interface, } memset(dev, 0, sizeof(*dev)); + /* compute alternate max packet sizes */ + uif = udev->actconfig->interface[0]; + + dev->num_alt=uif->num_altsetting; + printk(DRIVER_NAME ": Alternate settings: %i\n",dev->num_alt); +// dev->alt_max_pkt_size = kmalloc(sizeof(*dev->alt_max_pkt_size)* + dev->alt_max_pkt_size = kmalloc(32* + dev->num_alt,GFP_KERNEL); + if (dev->alt_max_pkt_size == NULL) { + em28xx_err(DRIVER_NAME ": out of memory!\n"); + return -ENOMEM; + } + + for (i = 0; i < dev->num_alt ; i++) { + u16 tmp = le16_to_cpu(uif->altsetting[i].endpoint[1].desc. + wMaxPacketSize); + dev->alt_max_pkt_size[i] = + (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1); + printk(DRIVER_NAME ": Alternate setting %i, max size= %i\n",i, + dev->alt_max_pkt_size[i]); + } + snprintf(dev->name, 29, "em28xx #%d", nr); if ((card[nr]>=0)&&(card[nr]lock); - if (!dev->users) + if (!dev->users) { + kfree(dev->alt_max_pkt_size); kfree(dev); + } up_write(&em28xx_disconnect); - } static struct usb_driver em28xx_usb_driver = { diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h index d51f8c63bcf9..5c7a41ce69f3 100644 --- a/drivers/media/video/em28xx/em28xx.h +++ b/drivers/media/video/em28xx/em28xx.h @@ -63,7 +63,6 @@ /* default alternate; 0 means choose the best */ #define EM28XX_PINOUT 0 -#define EM28XX_MAX_ALT 7 #define EM28XX_INTERLACED_DEFAULT 1 @@ -267,7 +266,8 @@ struct em28xx { struct usb_device *udev; /* the usb device */ int alt; /* alternate */ int max_pkt_size; /* max packet size of isoc transaction */ - unsigned int alt_max_pkt_size[EM28XX_MAX_ALT + 1]; /* array of wMaxPacketSize */ + int num_alt; /* Number of alternative settings */ + unsigned int *alt_max_pkt_size; /* array of wMaxPacketSize */ struct urb *urb[EM28XX_NUM_BUFS]; /* urb for isoc transfers */ char *transfer_buffer[EM28XX_NUM_BUFS]; /* transfer buffers for isoc transfer */ /* helper funcs that call usb_control_msg */ -- cgit v1.2.2 From 875c296b8ef42a796dc8db57a40b5e2228240c33 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Nov 2005 21:38:53 -0800 Subject: [PATCH] V4L: removal schedule for V4L1 API States a date for removing V4L1 API Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/feature-removal-schedule.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index 66e4ca28fc0a..429db4bf98ec 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt @@ -67,6 +67,21 @@ Who: Jody McIntyre --------------------------- +What: Video4Linux API 1 ioctls and video_decoder.h from Video devices. +When: July 2006 +Why: V4L1 AP1 was replaced by V4L2 API. during migration from 2.4 to 2.6 + series. The old API have lots of drawbacks and don't provide enough + means to work with all video and audio standards. The newer API is + already available on the main drivers and should be used instead. + Newer drivers should use v4l_compat_translate_ioctl function to handle + old calls, replacing to newer ones. + Decoder iocts are using internally to allow video drivers to + communicate with video decoders. This should also be improved to allow + V4L2 calls being translated into compatible internal ioctls. +Who: Mauro Carvalho Chehab + +--------------------------- + What: i2c sysfs name change: in1_ref, vid deprecated in favour of cpu0_vid When: November 2005 Files: drivers/i2c/chips/adm1025.c, drivers/i2c/chips/adm1026.c -- cgit v1.2.2 From 79dd0c69f05fccb0396bdcd861ad4686ce888cda Mon Sep 17 00:00:00 2001 From: Ricardo Cerqueira Date: Tue, 8 Nov 2005 21:38:53 -0800 Subject: [PATCH] V4L: 925: saa7134 alsa is now a standalone module Saa7134-alsa is now a standalone module Signed-off-by: Ricardo Cerqueira Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/saa7134/saa7134-alsa.c | 110 +++++++++++++++++++++++--- drivers/media/video/saa7134/saa7134-core.c | 29 ++++--- drivers/media/video/saa7134/saa7134-tvaudio.c | 3 + drivers/media/video/saa7134/saa7134.h | 8 -- 4 files changed, 121 insertions(+), 29 deletions(-) diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c index bf454437b771..7972939cb46c 100644 --- a/drivers/media/video/saa7134/saa7134-alsa.c +++ b/drivers/media/video/saa7134/saa7134-alsa.c @@ -1,6 +1,5 @@ /* * SAA713x ALSA support for V4L - * Ricardo Cerqueira * * * Caveats: @@ -37,9 +36,13 @@ #include "saa7134.h" #include "saa7134-reg.h" -static unsigned int alsa_debug = 0; -module_param(alsa_debug, int, 0644); -MODULE_PARM_DESC(alsa_debug,"enable debug messages [alsa]"); +static unsigned int debug = 0; +module_param(debug, int, 0644); +MODULE_PARM_DESC(debug,"enable debug messages [alsa]"); + +unsigned int dsp_nr = 0; +module_param(dsp_nr, int, 0444); +MODULE_PARM_DESC(dsp_nr, "alsa device number"); /* * Configuration macros @@ -69,7 +72,7 @@ static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ static int enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 0}; -#define dprintk(fmt, arg...) if (alsa_debug) \ +#define dprintk(fmt, arg...) if (debug) \ printk(KERN_DEBUG "%s/alsa: " fmt, dev->name , ## arg) /* @@ -107,6 +110,7 @@ typedef struct snd_card_saa7134_pcm { static snd_card_t *snd_saa7134_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; + /* * saa7134 DMA audio stop * @@ -189,12 +193,11 @@ void saa7134_irq_alsa_done(struct saa7134_dev *dev, unsigned long status) /* next block addr */ next_blk = (dev->oss.dma_blk + 2) % dev->oss.blocks; saa_writel(reg,next_blk * dev->oss.blksize); - if (alsa_debug > 2) + if (debug > 2) dprintk("irq: ok, %s, next_blk=%d, addr=%x, blocks=%u, size=%u, read=%u\n", (status & 0x10000000) ? "even" : "odd ", next_blk, next_blk * dev->oss.blksize, dev->oss.blocks, dev->oss.blksize, dev->oss.read_count); - /* update status & wake waiting readers */ dev->oss.dma_blk = (dev->oss.dma_blk + 1) % dev->oss.blocks; dev->oss.read_count += dev->oss.blksize; @@ -211,6 +214,41 @@ void saa7134_irq_alsa_done(struct saa7134_dev *dev, unsigned long status) } +/* + * IRQ request handler + * + * Runs along with saa7134's IRQ handler, discards anything that isn't + * DMA sound + * + */ + +static irqreturn_t saa7134_alsa_irq(int irq, void *dev_id, struct pt_regs *regs) +{ + struct saa7134_dev *dev = (struct saa7134_dev*) dev_id; + unsigned long report, status; + int loop, handled = 0; + + for (loop = 0; loop < 10; loop++) { + report = saa_readl(SAA7134_IRQ_REPORT); + status = saa_readl(SAA7134_IRQ_STATUS); + + if (report & SAA7134_IRQ_REPORT_DONE_RA3) { + handled = 1; + saa_writel(SAA7134_IRQ_REPORT,report); + saa7134_irq_alsa_done(dev, status); + } else { + goto out; + } + } + + if (loop == 10) { + dprintk("error! looping IRQ!"); + } + +out: + return IRQ_RETVAL(handled); +} + /* * ALSA capture trigger * @@ -822,11 +860,9 @@ static int snd_saa7134_capsrc_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_ saa_dsp_writel(dev, SAA7133_DIGITAL_OUTPUT_SEL1, 0xbbbb10); if (left || right) { // We've got data, turn the input on - //saa_dsp_writel(dev, SAA7133_DIGITAL_OUTPUT_SEL2, 0x101010); saa_dsp_writel(dev, SAA7133_DIGITAL_INPUT_XBAR1, xbarin); saa_writel(SAA7133_ANALOG_IO_SELECT, anabar); } else { - //saa_dsp_writel(dev, SAA7133_DIGITAL_OUTPUT_SEL2, 0x101010); saa_dsp_writel(dev, SAA7133_DIGITAL_INPUT_XBAR1, 0); saa_writel(SAA7133_ANALOG_IO_SELECT, 0); } @@ -889,9 +925,10 @@ static int snd_saa7134_dev_free(snd_device_t *device) * */ -int alsa_card_saa7134_create(struct saa7134_dev *saadev, unsigned int devicenum) +int alsa_card_saa7134_create (struct saa7134_dev *saadev, unsigned int devicenum) { static int dev; + snd_card_t *card; snd_card_saa7134_t *chip; int err; @@ -899,6 +936,7 @@ int alsa_card_saa7134_create(struct saa7134_dev *saadev, unsigned int devicenum) .dev_free = snd_saa7134_dev_free, }; + if (dev >= SNDRV_CARDS) return -ENODEV; if (!enable[dev]) @@ -906,6 +944,7 @@ int alsa_card_saa7134_create(struct saa7134_dev *saadev, unsigned int devicenum) if (devicenum) { card = snd_card_new(devicenum, id[dev], THIS_MODULE, 0); + dsp_nr++; } else { card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); } @@ -931,6 +970,15 @@ int alsa_card_saa7134_create(struct saa7134_dev *saadev, unsigned int devicenum) chip->irq = saadev->pci->irq; chip->iobase = pci_resource_start(saadev->pci, 0); + err = request_irq(chip->pci->irq, saa7134_alsa_irq, + SA_SHIRQ | SA_INTERRUPT, saadev->name, saadev); + + if (err < 0) { + printk(KERN_ERR "%s: can't get IRQ %d for ALSA\n", + saadev->name, saadev->pci->irq); + return err; + } + if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { snd_saa7134_free(chip); return err; @@ -963,10 +1011,48 @@ __nodev: return err; } -void alsa_card_saa7134_exit(void) +/* + * Module initializer + * + * Loops through present saa7134 cards, and assigns an ALSA device + * to each one + * + */ + +static int saa7134_alsa_init(void) +{ + struct saa7134_dev *saadev = NULL; + struct list_head *list; + + printk(KERN_INFO "saa7134 ALSA driver for DMA sound loaded\n"); + + list_for_each(list,&saa7134_devlist) { + saadev = list_entry(list, struct saa7134_dev, devlist); + alsa_card_saa7134_create(saadev,dsp_nr); + } + + if (saadev == NULL) + printk(KERN_INFO "saa7134 ALSA: no saa7134 cards found\n"); + + return 0; + +} + +/* + * Module destructor + */ + +void saa7134_alsa_exit(void) { int idx; - for (idx = 0; idx < SNDRV_CARDS; idx++) { + for (idx = 0; idx < SNDRV_CARDS; idx++) { snd_card_free(snd_saa7134_cards[idx]); } + printk(KERN_INFO "saa7134 ALSA driver for DMA sound unloaded\n"); + return; } + +module_init(saa7134_alsa_init); +module_exit(saa7134_alsa_exit); +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Ricardo Cerqueira"); diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index 454b8a86c830..6c329c440572 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c @@ -574,6 +574,17 @@ static irqreturn_t saa7134_irq(int irq, void *dev_id, struct pt_regs *regs) dev->name); goto out; } + + /* If alsa support is active and we get a sound report, exit + and let the saa7134-alsa module deal with it */ + + if ((report & SAA7134_IRQ_REPORT_DONE_RA3) && alsa) { + if (irq_debug > 1) + printk(KERN_DEBUG "%s/irq: ignoring interrupt for ALSA\n", + dev->name); + goto out; + } + handled = 1; saa_writel(SAA7134_IRQ_REPORT,report); if (irq_debug) @@ -598,8 +609,6 @@ static irqreturn_t saa7134_irq(int irq, void *dev_id, struct pt_regs *regs) if ((report & SAA7134_IRQ_REPORT_DONE_RA3)) { if (oss) { saa7134_irq_oss_done(dev,status); - } else if (alsa) { - saa7134_irq_alsa_done(dev,status); } } @@ -1029,9 +1038,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, printk(KERN_INFO "%s: registered device mixer%d\n", dev->name,dev->oss.minor_mixer >> 4); } else if (alsa) { - alsa_card_saa7134_create(dev,dsp_nr[dev->nr]); - printk(KERN_INFO "%s: registered ALSA devices\n", - dev->name); + request_module("saa7134-alsa"); } break; } @@ -1059,8 +1066,6 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, case PCI_DEVICE_ID_PHILIPS_SAA7135: if (oss) unregister_sound_dsp(dev->oss.minor_dsp); - else if (alsa) - alsa_card_saa7134_exit(); break; } fail4: @@ -1120,8 +1125,7 @@ static void __devexit saa7134_finidev(struct pci_dev *pci_dev) if (oss) { unregister_sound_mixer(dev->oss.minor_mixer); unregister_sound_dsp(dev->oss.minor_dsp); - } else if (alsa) - alsa_card_saa7134_exit(); + } break; } saa7134_unregister_video(dev); @@ -1214,6 +1218,13 @@ EXPORT_SYMBOL(saa7134_i2c_call_clients); EXPORT_SYMBOL(saa7134_devlist); EXPORT_SYMBOL(saa7134_boards); +/* ----------------- For ALSA -------------------------------- */ + +EXPORT_SYMBOL(saa7134_pgtable_free); +EXPORT_SYMBOL(saa7134_pgtable_build); +EXPORT_SYMBOL(saa7134_pgtable_alloc); +EXPORT_SYMBOL(saa7134_set_dmabits); + /* ----------------------------------------------------------- */ /* * Local variables: diff --git a/drivers/media/video/saa7134/saa7134-tvaudio.c b/drivers/media/video/saa7134/saa7134-tvaudio.c index 3daf1b597958..93268427750d 100644 --- a/drivers/media/video/saa7134/saa7134-tvaudio.c +++ b/drivers/media/video/saa7134/saa7134-tvaudio.c @@ -1024,9 +1024,12 @@ int saa7134_tvaudio_do_scan(struct saa7134_dev *dev) return 0; } +EXPORT_SYMBOL(saa_dsp_writel); + /* ----------------------------------------------------------- */ /* * Local variables: * c-basic-offset: 8 * End: */ + diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index d993344d37e4..1fdc9e147f87 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h @@ -665,14 +665,6 @@ void saa7134_input_fini(struct saa7134_dev *dev); void saa7134_input_irq(struct saa7134_dev *dev); void saa7134_set_i2c_ir(struct saa7134_dev *dev, struct IR_i2c *ir); -/* ----------------------------------------------------------- */ -/* saa7134-alsa.c */ - -int alsa_card_saa7134_create(struct saa7134_dev *saadev, unsigned int devnum); -void alsa_card_saa7134_exit(void); -void saa7134_irq_alsa_done(struct saa7134_dev *dev, unsigned long status); - - /* * Local variables: * c-basic-offset: 8 -- cgit v1.2.2 From b54134be53be720da423692665ec215eb14a678b Mon Sep 17 00:00:00 2001 From: Ricardo Cerqueira Date: Tue, 8 Nov 2005 21:38:54 -0800 Subject: [PATCH] V4L: 926: Saa7134 alsa can only be autoloaded after saa7134 is active - Saa7134-alsa can only be autoloaded after saa7134 is active - Applied pertinent changes proposed by the ALSA team - dsp_nr replaced by ALSA's index[] Signed-off-by: Ricardo Cerqueira Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/saa7134/saa7134-alsa.c | 239 +++++++++++----------- drivers/media/video/saa7134/saa7134-core.c | 27 ++- drivers/media/video/saa7134/saa7134-oss.c | 308 ++++++++++++++--------------- drivers/media/video/saa7134/saa7134.h | 6 +- 4 files changed, 288 insertions(+), 292 deletions(-) diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c index 7972939cb46c..4f3c42354329 100644 --- a/drivers/media/video/saa7134/saa7134-alsa.c +++ b/drivers/media/video/saa7134/saa7134-alsa.c @@ -30,7 +30,6 @@ #include #include #include -#include #include #include "saa7134.h" @@ -40,29 +39,11 @@ static unsigned int debug = 0; module_param(debug, int, 0644); MODULE_PARM_DESC(debug,"enable debug messages [alsa]"); -unsigned int dsp_nr = 0; -module_param(dsp_nr, int, 0444); -MODULE_PARM_DESC(dsp_nr, "alsa device number"); - /* * Configuration macros */ /* defaults */ -#define MAX_BUFFER_SIZE (256*1024) -#define USE_FORMATS SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S16_BE | SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_U16_LE | SNDRV_PCM_FMTBIT_U16_BE -#define USE_RATE SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_48000 -#define USE_RATE_MIN 32000 -#define USE_RATE_MAX 48000 -#define USE_CHANNELS_MIN 1 -#define USE_CHANNELS_MAX 2 -#ifndef USE_PERIODS_MIN -#define USE_PERIODS_MIN 2 -#endif -#ifndef USE_PERIODS_MAX -#define USE_PERIODS_MAX 1024 -#endif - #define MIXER_ADDR_TVTUNER 0 #define MIXER_ADDR_LINE1 1 #define MIXER_ADDR_LINE2 2 @@ -72,6 +53,9 @@ static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ static int enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 0}; +module_param_array(index, int, NULL, 0444); +MODULE_PARM_DESC(index, "Index value for SAA7134 capture interface(s)."); + #define dprintk(fmt, arg...) if (debug) \ printk(KERN_DEBUG "%s/alsa: " fmt, dev->name , ## arg) @@ -108,7 +92,7 @@ typedef struct snd_card_saa7134_pcm { snd_pcm_substream_t *substream; } snd_card_saa7134_pcm_t; -static snd_card_t *snd_saa7134_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; +static snd_card_t *snd_saa7134_cards[SNDRV_CARDS]; /* @@ -124,8 +108,8 @@ static snd_card_t *snd_saa7134_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; static void saa7134_dma_stop(struct saa7134_dev *dev) { - dev->oss.dma_blk = -1; - dev->oss.dma_running = 0; + dev->dmasound.dma_blk = -1; + dev->dmasound.dma_running = 0; saa7134_set_dmabits(dev); } @@ -141,8 +125,8 @@ static void saa7134_dma_stop(struct saa7134_dev *dev) static void saa7134_dma_start(struct saa7134_dev *dev) { - dev->oss.dma_blk = 0; - dev->oss.dma_running = 1; + dev->dmasound.dma_blk = 0; + dev->dmasound.dma_running = 1; saa7134_set_dmabits(dev); } @@ -162,7 +146,7 @@ void saa7134_irq_alsa_done(struct saa7134_dev *dev, unsigned long status) int next_blk, reg = 0; spin_lock(&dev->slock); - if (UNSET == dev->oss.dma_blk) { + if (UNSET == dev->dmasound.dma_blk) { dprintk("irq: recording stopped\n"); goto done; } @@ -170,11 +154,11 @@ void saa7134_irq_alsa_done(struct saa7134_dev *dev, unsigned long status) dprintk("irq: lost %ld\n", (status >> 24) & 0x0f); if (0 == (status & 0x10000000)) { /* odd */ - if (0 == (dev->oss.dma_blk & 0x01)) + if (0 == (dev->dmasound.dma_blk & 0x01)) reg = SAA7134_RS_BA1(6); } else { /* even */ - if (1 == (dev->oss.dma_blk & 0x01)) + if (1 == (dev->dmasound.dma_blk & 0x01)) reg = SAA7134_RS_BA2(6); } if (0 == reg) { @@ -183,30 +167,31 @@ void saa7134_irq_alsa_done(struct saa7134_dev *dev, unsigned long status) goto done; } - if (dev->oss.read_count >= dev->oss.blksize * (dev->oss.blocks-2)) { - dprintk("irq: overrun [full=%d/%d] - Blocks in %d\n",dev->oss.read_count, - dev->oss.bufsize, dev->oss.blocks); + if (dev->dmasound.read_count >= dev->dmasound.blksize * (dev->dmasound.blocks-2)) { + dprintk("irq: overrun [full=%d/%d] - Blocks in %d\n",dev->dmasound.read_count, + dev->dmasound.bufsize, dev->dmasound.blocks); + snd_pcm_stop(dev->dmasound.substream,SNDRV_PCM_STATE_XRUN); saa7134_dma_stop(dev); goto done; } /* next block addr */ - next_blk = (dev->oss.dma_blk + 2) % dev->oss.blocks; - saa_writel(reg,next_blk * dev->oss.blksize); + next_blk = (dev->dmasound.dma_blk + 2) % dev->dmasound.blocks; + saa_writel(reg,next_blk * dev->dmasound.blksize); if (debug > 2) dprintk("irq: ok, %s, next_blk=%d, addr=%x, blocks=%u, size=%u, read=%u\n", (status & 0x10000000) ? "even" : "odd ", next_blk, - next_blk * dev->oss.blksize, dev->oss.blocks, dev->oss.blksize, dev->oss.read_count); + next_blk * dev->dmasound.blksize, dev->dmasound.blocks, dev->dmasound.blksize, dev->dmasound.read_count); /* update status & wake waiting readers */ - dev->oss.dma_blk = (dev->oss.dma_blk + 1) % dev->oss.blocks; - dev->oss.read_count += dev->oss.blksize; + dev->dmasound.dma_blk = (dev->dmasound.dma_blk + 1) % dev->dmasound.blocks; + dev->dmasound.read_count += dev->dmasound.blksize; - dev->oss.recording_on = reg; + dev->dmasound.recording_on = reg; - if (dev->oss.read_count >= snd_pcm_lib_period_bytes(dev->oss.substream)) { + if (dev->dmasound.read_count >= snd_pcm_lib_period_bytes(dev->dmasound.substream)) { spin_unlock(&dev->slock); - snd_pcm_period_elapsed(dev->oss.substream); + snd_pcm_period_elapsed(dev->dmasound.substream); spin_lock(&dev->slock); } done: @@ -262,7 +247,24 @@ out: static int snd_card_saa7134_capture_trigger(snd_pcm_substream_t * substream, int cmd) { - return 0; + snd_pcm_runtime_t *runtime = substream->runtime; + snd_card_saa7134_pcm_t *saapcm = runtime->private_data; + struct saa7134_dev *dev=saapcm->saadev; + int err = 0; + + spin_lock_irq(&dev->slock); + if (cmd == SNDRV_PCM_TRIGGER_START) { + /* start dma */ + saa7134_dma_start(dev); + } else if (cmd == SNDRV_PCM_TRIGGER_STOP) { + /* stop dma */ + saa7134_dma_stop(dev); + } else { + err = -EINVAL; + } + spin_unlock_irq(&dev->slock); + + return err; } /* @@ -289,9 +291,9 @@ static int dsp_buffer_conf(struct saa7134_dev *dev, int blksize, int blocks) if ((blksize * blocks) > 1024*1024) blocks = 1024*1024 / blksize; - dev->oss.blocks = blocks; - dev->oss.blksize = blksize; - dev->oss.bufsize = blksize * blocks; + dev->dmasound.blocks = blocks; + dev->dmasound.blksize = blksize; + dev->dmasound.bufsize = blksize * blocks; dprintk("buffer config: %d blocks / %d bytes, %d kB total\n", blocks,blksize,blksize * blocks / 1024); @@ -313,11 +315,11 @@ static int dsp_buffer_init(struct saa7134_dev *dev) { int err; - if (!dev->oss.bufsize) + if (!dev->dmasound.bufsize) BUG(); - videobuf_dma_init(&dev->oss.dma); - err = videobuf_dma_init_kernel(&dev->oss.dma, PCI_DMA_FROMDEVICE, - (dev->oss.bufsize + PAGE_SIZE) >> PAGE_SHIFT); + videobuf_dma_init(&dev->dmasound.dma); + err = videobuf_dma_init_kernel(&dev->dmasound.dma, PCI_DMA_FROMDEVICE, + (dev->dmasound.bufsize + PAGE_SIZE) >> PAGE_SHIFT); if (0 != err) return err; return 0; @@ -340,7 +342,6 @@ static int snd_card_saa7134_capture_prepare(snd_pcm_substream_t * substream) snd_pcm_runtime_t *runtime = substream->runtime; int err, bswap, sign; u32 fmt, control; - unsigned long flags; snd_card_saa7134_t *saa7134 = snd_pcm_substream_chip(substream); struct saa7134_dev *dev; snd_card_saa7134_pcm_t *saapcm = runtime->private_data; @@ -351,7 +352,7 @@ static int snd_card_saa7134_capture_prepare(snd_pcm_substream_t * substream) size = snd_pcm_lib_buffer_bytes(substream); count = snd_pcm_lib_period_bytes(substream); - saapcm->saadev->oss.substream = substream; + saapcm->saadev->dmasound.substream = substream; bps = runtime->rate * runtime->channels; bps *= snd_pcm_format_width(runtime->format); bps /= 8; @@ -371,13 +372,13 @@ static int snd_card_saa7134_capture_prepare(snd_pcm_substream_t * substream) goto fail2; /* prepare buffer */ - if (0 != (err = videobuf_dma_pci_map(dev->pci,&dev->oss.dma))) + if (0 != (err = videobuf_dma_pci_map(dev->pci,&dev->dmasound.dma))) return err; - if (0 != (err = saa7134_pgtable_alloc(dev->pci,&dev->oss.pt))) + if (0 != (err = saa7134_pgtable_alloc(dev->pci,&dev->dmasound.pt))) goto fail1; - if (0 != (err = saa7134_pgtable_build(dev->pci,&dev->oss.pt, - dev->oss.dma.sglist, - dev->oss.dma.sglen, + if (0 != (err = saa7134_pgtable_build(dev->pci,&dev->dmasound.pt, + dev->dmasound.dma.sglist, + dev->dmasound.dma.sglen, 0))) goto fail2; @@ -427,10 +428,10 @@ static int snd_card_saa7134_capture_prepare(snd_pcm_substream_t * substream) if (sign) fmt |= 0x04; - fmt |= (MIXER_ADDR_TVTUNER == dev->oss.input) ? 0xc0 : 0x80; - saa_writeb(SAA7134_NUM_SAMPLES0, ((dev->oss.blksize - 1) & 0x0000ff)); - saa_writeb(SAA7134_NUM_SAMPLES1, ((dev->oss.blksize - 1) & 0x00ff00) >> 8); - saa_writeb(SAA7134_NUM_SAMPLES2, ((dev->oss.blksize - 1) & 0xff0000) >> 16); + fmt |= (MIXER_ADDR_TVTUNER == dev->dmasound.input) ? 0xc0 : 0x80; + saa_writeb(SAA7134_NUM_SAMPLES0, ((dev->dmasound.blksize - 1) & 0x0000ff)); + saa_writeb(SAA7134_NUM_SAMPLES1, ((dev->dmasound.blksize - 1) & 0x00ff00) >> 8); + saa_writeb(SAA7134_NUM_SAMPLES2, ((dev->dmasound.blksize - 1) & 0xff0000) >> 16); saa_writeb(SAA7134_AUDIO_FORMAT_CTRL, fmt); break; @@ -442,7 +443,7 @@ static int snd_card_saa7134_capture_prepare(snd_pcm_substream_t * substream) fmt |= (2 << 4); if (!sign) fmt |= 0x04; - saa_writel(SAA7133_NUM_SAMPLES, dev->oss.blksize -1); + saa_writel(SAA7133_NUM_SAMPLES, dev->dmasound.blksize -1); saa_writel(SAA7133_AUDIO_CHANNEL, 0x543210 | (fmt << 24)); //saa_writel(SAA7133_AUDIO_CHANNEL, 0x543210); break; @@ -454,7 +455,7 @@ static int snd_card_saa7134_capture_prepare(snd_pcm_substream_t * substream) /* dma: setup channel 6 (= AUDIO) */ control = SAA7134_RS_CONTROL_BURST_16 | SAA7134_RS_CONTROL_ME | - (dev->oss.pt.dma >> 12); + (dev->dmasound.pt.dma >> 12); if (bswap) control |= SAA7134_RS_CONTROL_BSWAP; @@ -462,24 +463,20 @@ static int snd_card_saa7134_capture_prepare(snd_pcm_substream_t * substream) byte, but it doesn't work. So I allocate the DMA using the V4L functions, and force ALSA to use that as the DMA area */ - runtime->dma_area = dev->oss.dma.vmalloc; + runtime->dma_area = dev->dmasound.dma.vmalloc; saa_writel(SAA7134_RS_BA1(6),0); - saa_writel(SAA7134_RS_BA2(6),dev->oss.blksize); + saa_writel(SAA7134_RS_BA2(6),dev->dmasound.blksize); saa_writel(SAA7134_RS_PITCH(6),0); saa_writel(SAA7134_RS_CONTROL(6),control); - dev->oss.rate = runtime->rate; - /* start dma */ - spin_lock_irqsave(&dev->slock,flags); - saa7134_dma_start(dev); - spin_unlock_irqrestore(&dev->slock,flags); + dev->dmasound.rate = runtime->rate; return 0; fail2: - saa7134_pgtable_free(dev->pci,&dev->oss.pt); + saa7134_pgtable_free(dev->pci,&dev->dmasound.pt); fail1: - videobuf_dma_pci_unmap(dev->pci,&dev->oss.dma); + videobuf_dma_pci_unmap(dev->pci,&dev->dmasound.dma); return err; @@ -504,14 +501,14 @@ static snd_pcm_uframes_t snd_card_saa7134_capture_pointer(snd_pcm_substream_t * - if (dev->oss.read_count) { - dev->oss.read_count -= snd_pcm_lib_period_bytes(substream); - dev->oss.read_offset += snd_pcm_lib_period_bytes(substream); - if (dev->oss.read_offset == dev->oss.bufsize) - dev->oss.read_offset = 0; + if (dev->dmasound.read_count) { + dev->dmasound.read_count -= snd_pcm_lib_period_bytes(substream); + dev->dmasound.read_offset += snd_pcm_lib_period_bytes(substream); + if (dev->dmasound.read_offset == dev->dmasound.bufsize) + dev->dmasound.read_offset = 0; } - return bytes_to_frames(runtime, dev->oss.read_offset); + return bytes_to_frames(runtime, dev->dmasound.read_offset); } /* @@ -523,18 +520,22 @@ static snd_pcm_hardware_t snd_card_saa7134_capture = .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_MMAP_VALID), - .formats = USE_FORMATS, - .rates = USE_RATE, - .rate_min = USE_RATE_MIN, - .rate_max = USE_RATE_MAX, - .channels_min = USE_CHANNELS_MIN, - .channels_max = USE_CHANNELS_MAX, - .buffer_bytes_max = MAX_BUFFER_SIZE, + .formats = SNDRV_PCM_FMTBIT_S16_LE | \ + SNDRV_PCM_FMTBIT_S16_BE | \ + SNDRV_PCM_FMTBIT_S8 | \ + SNDRV_PCM_FMTBIT_U8 | \ + SNDRV_PCM_FMTBIT_U16_LE | \ + SNDRV_PCM_FMTBIT_U16_BE, + .rates = SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_48000, + .rate_min = 32000, + .rate_max = 48000, + .channels_min = 1, + .channels_max = 2, + .buffer_bytes_max = (256*1024), .period_bytes_min = 64, - .period_bytes_max = MAX_BUFFER_SIZE, - .periods_min = USE_PERIODS_MIN, - .periods_max = USE_PERIODS_MAX, - .fifo_size = 0x08070503, + .period_bytes_max = (256*1024), + .periods_min = 2, + .periods_max = 1024, }; static void snd_card_saa7134_runtime_free(snd_pcm_runtime_t *runtime) @@ -590,14 +591,14 @@ static int snd_card_saa7134_hw_free(snd_pcm_substream_t * substream) static int dsp_buffer_free(struct saa7134_dev *dev) { - if (!dev->oss.blksize) + if (!dev->dmasound.blksize) BUG(); - videobuf_dma_free(&dev->oss.dma); + videobuf_dma_free(&dev->dmasound.dma); - dev->oss.blocks = 0; - dev->oss.blksize = 0; - dev->oss.bufsize = 0; + dev->dmasound.blocks = 0; + dev->dmasound.blksize = 0; + dev->dmasound.bufsize = 0; return 0; } @@ -616,16 +617,10 @@ static int snd_card_saa7134_capture_close(snd_pcm_substream_t * substream) { snd_card_saa7134_t *chip = snd_pcm_substream_chip(substream); struct saa7134_dev *dev = chip->saadev; - unsigned long flags; - - /* stop dma */ - spin_lock_irqsave(&dev->slock,flags); - saa7134_dma_stop(dev); - spin_unlock_irqrestore(&dev->slock,flags); /* unlock buffer */ - saa7134_pgtable_free(dev->pci,&dev->oss.pt); - videobuf_dma_pci_unmap(dev->pci,&dev->oss.dma); + saa7134_pgtable_free(dev->pci,&dev->dmasound.pt); + videobuf_dma_pci_unmap(dev->pci,&dev->dmasound.dma); dsp_buffer_free(dev); return 0; @@ -649,16 +644,16 @@ static int snd_card_saa7134_capture_open(snd_pcm_substream_t * substream) struct saa7134_dev *dev = saa7134->saadev; int err; - down(&dev->oss.lock); + down(&dev->dmasound.lock); - dev->oss.afmt = SNDRV_PCM_FORMAT_U8; - dev->oss.channels = 2; - dev->oss.read_count = 0; - dev->oss.read_offset = 0; + dev->dmasound.afmt = SNDRV_PCM_FORMAT_U8; + dev->dmasound.channels = 2; + dev->dmasound.read_count = 0; + dev->dmasound.read_offset = 0; - up(&dev->oss.lock); + up(&dev->dmasound.lock); - saapcm = kcalloc(1, sizeof(*saapcm), GFP_KERNEL); + saapcm = kzalloc(sizeof(*saapcm), GFP_KERNEL); if (saapcm == NULL) return -ENOMEM; saapcm->saadev=saa7134->saadev; @@ -731,13 +726,10 @@ static int snd_saa7134_volume_info(snd_kcontrol_t * kcontrol, snd_ctl_elem_info_ static int snd_saa7134_volume_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) { snd_card_saa7134_t *chip = snd_kcontrol_chip(kcontrol); - unsigned long flags; int addr = kcontrol->private_value; - spin_lock_irqsave(&chip->mixer_lock, flags); ucontrol->value.integer.value[0] = chip->mixer_volume[addr][0]; ucontrol->value.integer.value[1] = chip->mixer_volume[addr][1]; - spin_unlock_irqrestore(&chip->mixer_lock, flags); return 0; } @@ -815,7 +807,7 @@ static int snd_saa7134_capsrc_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_ chip->capture_source[addr][1] != right; chip->capture_source[addr][0] = left; chip->capture_source[addr][1] = right; - dev->oss.input=addr; + dev->dmasound.input=addr; spin_unlock_irqrestore(&chip->mixer_lock, flags); @@ -831,7 +823,7 @@ static int snd_saa7134_capsrc_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_ case MIXER_ADDR_LINE1: case MIXER_ADDR_LINE2: analog_io = (MIXER_ADDR_LINE1 == addr) ? 0x00 : 0x08; - rate = (32000 == dev->oss.rate) ? 0x01 : 0x03; + rate = (32000 == dev->dmasound.rate) ? 0x01 : 0x03; saa_andorb(SAA7134_ANALOG_IO_SELECT, 0x08, analog_io); saa_andorb(SAA7134_AUDIO_FORMAT_CTRL, 0xc0, 0x80); saa_andorb(SAA7134_SIF_SAMPLE_FREQ, 0x03, rate); @@ -925,7 +917,7 @@ static int snd_saa7134_dev_free(snd_device_t *device) * */ -int alsa_card_saa7134_create (struct saa7134_dev *saadev, unsigned int devicenum) +int alsa_card_saa7134_create (struct saa7134_dev *saadev) { static int dev; @@ -942,12 +934,8 @@ int alsa_card_saa7134_create (struct saa7134_dev *saadev, unsigned int devicenum if (!enable[dev]) return -ENODEV; - if (devicenum) { - card = snd_card_new(devicenum, id[dev], THIS_MODULE, 0); - dsp_nr++; - } else { - card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); - } + card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); + if (card == NULL) return -ENOMEM; @@ -961,6 +949,7 @@ int alsa_card_saa7134_create (struct saa7134_dev *saadev, unsigned int devicenum } spin_lock_init(&chip->lock); + spin_lock_init(&chip->mixer_lock); chip->saadev = saadev; @@ -970,18 +959,17 @@ int alsa_card_saa7134_create (struct saa7134_dev *saadev, unsigned int devicenum chip->irq = saadev->pci->irq; chip->iobase = pci_resource_start(saadev->pci, 0); - err = request_irq(chip->pci->irq, saa7134_alsa_irq, + err = request_irq(saadev->pci->irq, saa7134_alsa_irq, SA_SHIRQ | SA_INTERRUPT, saadev->name, saadev); if (err < 0) { printk(KERN_ERR "%s: can't get IRQ %d for ALSA\n", saadev->name, saadev->pci->irq); - return err; + goto __nodev; } if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { - snd_saa7134_free(chip); - return err; + goto __nodev; } if ((err = snd_card_saa7134_new_mixer(chip)) < 0) @@ -990,8 +978,6 @@ int alsa_card_saa7134_create (struct saa7134_dev *saadev, unsigned int devicenum if ((err = snd_card_saa7134_pcm(chip, 0)) < 0) goto __nodev; - spin_lock_init(&chip->mixer_lock); - snd_card_set_dev(card, &chip->pci->dev); /* End of "creation" */ @@ -1007,7 +993,7 @@ int alsa_card_saa7134_create (struct saa7134_dev *saadev, unsigned int devicenum __nodev: snd_card_free(card); - kfree(card); + kfree(chip); return err; } @@ -1028,7 +1014,7 @@ static int saa7134_alsa_init(void) list_for_each(list,&saa7134_devlist) { saadev = list_entry(list, struct saa7134_dev, devlist); - alsa_card_saa7134_create(saadev,dsp_nr); + alsa_card_saa7134_create(saadev); } if (saadev == NULL) @@ -1045,10 +1031,13 @@ static int saa7134_alsa_init(void) void saa7134_alsa_exit(void) { int idx; + for (idx = 0; idx < SNDRV_CARDS; idx++) { snd_card_free(snd_saa7134_cards[idx]); } + printk(KERN_INFO "saa7134 ALSA driver for DMA sound unloaded\n"); + return; } diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index 6c329c440572..19b88744fb31 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c @@ -194,6 +194,7 @@ void saa7134_track_gpio(struct saa7134_dev *dev, char *msg) static int need_empress; static int need_dvb; +static int need_alsa; static int pending_call(struct notifier_block *self, unsigned long state, void *module) @@ -205,6 +206,8 @@ static int pending_call(struct notifier_block *self, unsigned long state, request_module("saa7134-empress"); if (need_dvb) request_module("saa7134-dvb"); + if (need_alsa) + request_module("saa7134-alsa"); return NOTIFY_DONE; } @@ -469,7 +472,7 @@ int saa7134_set_dmabits(struct saa7134_dev *dev) } /* audio capture -- dma 3 */ - if (dev->oss.dma_running) { + if (dev->dmasound.dma_running) { ctrl |= SAA7134_MAIN_CTRL_TE6; irq |= SAA7134_IRQ1_INTE_RA3_1 | SAA7134_IRQ1_INTE_RA3_0; @@ -983,6 +986,12 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, if (card_is_dvb(dev)) request_module_depend("saa7134-dvb",&need_dvb); + if (!oss && alsa) { + dprintk("Requesting ALSA module\n"); + request_module_depend("saa7134-alsa",&need_alsa); + } + + v4l2_prio_init(&dev->prio); /* register v4l devices */ @@ -1021,24 +1030,22 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, case PCI_DEVICE_ID_PHILIPS_SAA7133: case PCI_DEVICE_ID_PHILIPS_SAA7135: if (oss) { - err = dev->oss.minor_dsp = + err = dev->dmasound.minor_dsp = register_sound_dsp(&saa7134_dsp_fops, dsp_nr[dev->nr]); if (err < 0) { goto fail4; } printk(KERN_INFO "%s: registered device dsp%d\n", - dev->name,dev->oss.minor_dsp >> 4); + dev->name,dev->dmasound.minor_dsp >> 4); - err = dev->oss.minor_mixer = + err = dev->dmasound.minor_mixer = register_sound_mixer(&saa7134_mixer_fops, mixer_nr[dev->nr]); if (err < 0) goto fail5; printk(KERN_INFO "%s: registered device mixer%d\n", - dev->name,dev->oss.minor_mixer >> 4); - } else if (alsa) { - request_module("saa7134-alsa"); + dev->name,dev->dmasound.minor_mixer >> 4); } break; } @@ -1065,7 +1072,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, case PCI_DEVICE_ID_PHILIPS_SAA7133: case PCI_DEVICE_ID_PHILIPS_SAA7135: if (oss) - unregister_sound_dsp(dev->oss.minor_dsp); + unregister_sound_dsp(dev->dmasound.minor_dsp); break; } fail4: @@ -1123,8 +1130,8 @@ static void __devexit saa7134_finidev(struct pci_dev *pci_dev) case PCI_DEVICE_ID_PHILIPS_SAA7133: case PCI_DEVICE_ID_PHILIPS_SAA7135: if (oss) { - unregister_sound_mixer(dev->oss.minor_mixer); - unregister_sound_dsp(dev->oss.minor_dsp); + unregister_sound_mixer(dev->dmasound.minor_mixer); + unregister_sound_dsp(dev->dmasound.minor_dsp); } break; } diff --git a/drivers/media/video/saa7134/saa7134-oss.c b/drivers/media/video/saa7134/saa7134-oss.c index f1b0e0d93d7b..fd53dfcc1644 100644 --- a/drivers/media/video/saa7134/saa7134-oss.c +++ b/drivers/media/video/saa7134/saa7134-oss.c @@ -59,9 +59,9 @@ static int dsp_buffer_conf(struct saa7134_dev *dev, int blksize, int blocks) if ((blksize * blocks) > 1024*1024) blocks = 1024*1024 / blksize; - dev->oss.blocks = blocks; - dev->oss.blksize = blksize; - dev->oss.bufsize = blksize * blocks; + dev->dmasound.blocks = blocks; + dev->dmasound.blksize = blksize; + dev->dmasound.bufsize = blksize * blocks; dprintk("buffer config: %d blocks / %d bytes, %d kB total\n", blocks,blksize,blksize * blocks / 1024); @@ -72,11 +72,11 @@ static int dsp_buffer_init(struct saa7134_dev *dev) { int err; - if (!dev->oss.bufsize) + if (!dev->dmasound.bufsize) BUG(); - videobuf_dma_init(&dev->oss.dma); - err = videobuf_dma_init_kernel(&dev->oss.dma, PCI_DMA_FROMDEVICE, - (dev->oss.bufsize + PAGE_SIZE) >> PAGE_SHIFT); + videobuf_dma_init(&dev->dmasound.dma); + err = videobuf_dma_init_kernel(&dev->dmasound.dma, PCI_DMA_FROMDEVICE, + (dev->dmasound.bufsize + PAGE_SIZE) >> PAGE_SHIFT); if (0 != err) return err; return 0; @@ -84,26 +84,26 @@ static int dsp_buffer_init(struct saa7134_dev *dev) static int dsp_buffer_free(struct saa7134_dev *dev) { - if (!dev->oss.blksize) + if (!dev->dmasound.blksize) BUG(); - videobuf_dma_free(&dev->oss.dma); - dev->oss.blocks = 0; - dev->oss.blksize = 0; - dev->oss.bufsize = 0; + videobuf_dma_free(&dev->dmasound.dma); + dev->dmasound.blocks = 0; + dev->dmasound.blksize = 0; + dev->dmasound.bufsize = 0; return 0; } static void dsp_dma_start(struct saa7134_dev *dev) { - dev->oss.dma_blk = 0; - dev->oss.dma_running = 1; + dev->dmasound.dma_blk = 0; + dev->dmasound.dma_running = 1; saa7134_set_dmabits(dev); } static void dsp_dma_stop(struct saa7134_dev *dev) { - dev->oss.dma_blk = -1; - dev->oss.dma_running = 0; + dev->dmasound.dma_blk = -1; + dev->dmasound.dma_running = 0; saa7134_set_dmabits(dev); } @@ -114,18 +114,18 @@ static int dsp_rec_start(struct saa7134_dev *dev) unsigned long flags; /* prepare buffer */ - if (0 != (err = videobuf_dma_pci_map(dev->pci,&dev->oss.dma))) + if (0 != (err = videobuf_dma_pci_map(dev->pci,&dev->dmasound.dma))) return err; - if (0 != (err = saa7134_pgtable_alloc(dev->pci,&dev->oss.pt))) + if (0 != (err = saa7134_pgtable_alloc(dev->pci,&dev->dmasound.pt))) goto fail1; - if (0 != (err = saa7134_pgtable_build(dev->pci,&dev->oss.pt, - dev->oss.dma.sglist, - dev->oss.dma.sglen, + if (0 != (err = saa7134_pgtable_build(dev->pci,&dev->dmasound.pt, + dev->dmasound.dma.sglist, + dev->dmasound.dma.sglen, 0))) goto fail2; /* sample format */ - switch (dev->oss.afmt) { + switch (dev->dmasound.afmt) { case AFMT_U8: case AFMT_S8: fmt = 0x00; break; case AFMT_U16_LE: @@ -137,14 +137,14 @@ static int dsp_rec_start(struct saa7134_dev *dev) goto fail2; } - switch (dev->oss.afmt) { + switch (dev->dmasound.afmt) { case AFMT_S8: case AFMT_S16_LE: case AFMT_S16_BE: sign = 1; break; default: sign = 0; break; } - switch (dev->oss.afmt) { + switch (dev->dmasound.afmt) { case AFMT_U16_BE: case AFMT_S16_BE: bswap = 1; break; default: bswap = 0; break; @@ -152,58 +152,58 @@ static int dsp_rec_start(struct saa7134_dev *dev) switch (dev->pci->device) { case PCI_DEVICE_ID_PHILIPS_SAA7134: - if (1 == dev->oss.channels) + if (1 == dev->dmasound.channels) fmt |= (1 << 3); - if (2 == dev->oss.channels) + if (2 == dev->dmasound.channels) fmt |= (3 << 3); if (sign) fmt |= 0x04; - fmt |= (TV == dev->oss.input) ? 0xc0 : 0x80; + fmt |= (TV == dev->dmasound.input) ? 0xc0 : 0x80; - saa_writeb(SAA7134_NUM_SAMPLES0, ((dev->oss.blksize - 1) & 0x0000ff)); - saa_writeb(SAA7134_NUM_SAMPLES1, ((dev->oss.blksize - 1) & 0x00ff00) >> 8); - saa_writeb(SAA7134_NUM_SAMPLES2, ((dev->oss.blksize - 1) & 0xff0000) >> 16); + saa_writeb(SAA7134_NUM_SAMPLES0, ((dev->dmasound.blksize - 1) & 0x0000ff)); + saa_writeb(SAA7134_NUM_SAMPLES1, ((dev->dmasound.blksize - 1) & 0x00ff00) >> 8); + saa_writeb(SAA7134_NUM_SAMPLES2, ((dev->dmasound.blksize - 1) & 0xff0000) >> 16); saa_writeb(SAA7134_AUDIO_FORMAT_CTRL, fmt); break; case PCI_DEVICE_ID_PHILIPS_SAA7133: case PCI_DEVICE_ID_PHILIPS_SAA7135: - if (1 == dev->oss.channels) + if (1 == dev->dmasound.channels) fmt |= (1 << 4); - if (2 == dev->oss.channels) + if (2 == dev->dmasound.channels) fmt |= (2 << 4); if (!sign) fmt |= 0x04; - saa_writel(SAA7133_NUM_SAMPLES, dev->oss.blksize -4); + saa_writel(SAA7133_NUM_SAMPLES, dev->dmasound.blksize -4); saa_writel(SAA7133_AUDIO_CHANNEL, 0x543210 | (fmt << 24)); break; } dprintk("rec_start: afmt=%d ch=%d => fmt=0x%x swap=%c\n", - dev->oss.afmt, dev->oss.channels, fmt, + dev->dmasound.afmt, dev->dmasound.channels, fmt, bswap ? 'b' : '-'); /* dma: setup channel 6 (= AUDIO) */ control = SAA7134_RS_CONTROL_BURST_16 | SAA7134_RS_CONTROL_ME | - (dev->oss.pt.dma >> 12); + (dev->dmasound.pt.dma >> 12); if (bswap) control |= SAA7134_RS_CONTROL_BSWAP; saa_writel(SAA7134_RS_BA1(6),0); - saa_writel(SAA7134_RS_BA2(6),dev->oss.blksize); + saa_writel(SAA7134_RS_BA2(6),dev->dmasound.blksize); saa_writel(SAA7134_RS_PITCH(6),0); saa_writel(SAA7134_RS_CONTROL(6),control); /* start dma */ - dev->oss.recording_on = 1; + dev->dmasound.recording_on = 1; spin_lock_irqsave(&dev->slock,flags); dsp_dma_start(dev); spin_unlock_irqrestore(&dev->slock,flags); return 0; fail2: - saa7134_pgtable_free(dev->pci,&dev->oss.pt); + saa7134_pgtable_free(dev->pci,&dev->dmasound.pt); fail1: - videobuf_dma_pci_unmap(dev->pci,&dev->oss.dma); + videobuf_dma_pci_unmap(dev->pci,&dev->dmasound.dma); return err; } @@ -211,17 +211,17 @@ static int dsp_rec_stop(struct saa7134_dev *dev) { unsigned long flags; - dprintk("rec_stop dma_blk=%d\n",dev->oss.dma_blk); + dprintk("rec_stop dma_blk=%d\n",dev->dmasound.dma_blk); /* stop dma */ - dev->oss.recording_on = 0; + dev->dmasound.recording_on = 0; spin_lock_irqsave(&dev->slock,flags); dsp_dma_stop(dev); spin_unlock_irqrestore(&dev->slock,flags); /* unlock buffer */ - saa7134_pgtable_free(dev->pci,&dev->oss.pt); - videobuf_dma_pci_unmap(dev->pci,&dev->oss.dma); + saa7134_pgtable_free(dev->pci,&dev->dmasound.pt); + videobuf_dma_pci_unmap(dev->pci,&dev->dmasound.dma); return 0; } @@ -236,35 +236,35 @@ static int dsp_open(struct inode *inode, struct file *file) list_for_each(list,&saa7134_devlist) { h = list_entry(list, struct saa7134_dev, devlist); - if (h->oss.minor_dsp == minor) + if (h->dmasound.minor_dsp == minor) dev = h; } if (NULL == dev) return -ENODEV; - down(&dev->oss.lock); + down(&dev->dmasound.lock); err = -EBUSY; - if (dev->oss.users_dsp) + if (dev->dmasound.users_dsp) goto fail1; - dev->oss.users_dsp++; + dev->dmasound.users_dsp++; file->private_data = dev; - dev->oss.afmt = AFMT_U8; - dev->oss.channels = 1; - dev->oss.read_count = 0; - dev->oss.read_offset = 0; + dev->dmasound.afmt = AFMT_U8; + dev->dmasound.channels = 1; + dev->dmasound.read_count = 0; + dev->dmasound.read_offset = 0; dsp_buffer_conf(dev,PAGE_SIZE,64); err = dsp_buffer_init(dev); if (0 != err) goto fail2; - up(&dev->oss.lock); + up(&dev->dmasound.lock); return 0; fail2: - dev->oss.users_dsp--; + dev->dmasound.users_dsp--; fail1: - up(&dev->oss.lock); + up(&dev->dmasound.lock); return err; } @@ -272,13 +272,13 @@ static int dsp_release(struct inode *inode, struct file *file) { struct saa7134_dev *dev = file->private_data; - down(&dev->oss.lock); - if (dev->oss.recording_on) + down(&dev->dmasound.lock); + if (dev->dmasound.recording_on) dsp_rec_stop(dev); dsp_buffer_free(dev); - dev->oss.users_dsp--; + dev->dmasound.users_dsp--; file->private_data = NULL; - up(&dev->oss.lock); + up(&dev->dmasound.lock); return 0; } @@ -291,12 +291,12 @@ static ssize_t dsp_read(struct file *file, char __user *buffer, unsigned long flags; int err,ret = 0; - add_wait_queue(&dev->oss.wq, &wait); - down(&dev->oss.lock); + add_wait_queue(&dev->dmasound.wq, &wait); + down(&dev->dmasound.lock); while (count > 0) { /* wait for data if needed */ - if (0 == dev->oss.read_count) { - if (!dev->oss.recording_on) { + if (0 == dev->dmasound.read_count) { + if (!dev->dmasound.recording_on) { err = dsp_rec_start(dev); if (err < 0) { if (0 == ret) @@ -304,8 +304,8 @@ static ssize_t dsp_read(struct file *file, char __user *buffer, break; } } - if (dev->oss.recording_on && - !dev->oss.dma_running) { + if (dev->dmasound.recording_on && + !dev->dmasound.dma_running) { /* recover from overruns */ spin_lock_irqsave(&dev->slock,flags); dsp_dma_start(dev); @@ -316,12 +316,12 @@ static ssize_t dsp_read(struct file *file, char __user *buffer, ret = -EAGAIN; break; } - up(&dev->oss.lock); + up(&dev->dmasound.lock); set_current_state(TASK_INTERRUPTIBLE); - if (0 == dev->oss.read_count) + if (0 == dev->dmasound.read_count) schedule(); set_current_state(TASK_RUNNING); - down(&dev->oss.lock); + down(&dev->dmasound.lock); if (signal_pending(current)) { if (0 == ret) ret = -EINTR; @@ -331,12 +331,12 @@ static ssize_t dsp_read(struct file *file, char __user *buffer, /* copy data to userspace */ bytes = count; - if (bytes > dev->oss.read_count) - bytes = dev->oss.read_count; - if (bytes > dev->oss.bufsize - dev->oss.read_offset) - bytes = dev->oss.bufsize - dev->oss.read_offset; + if (bytes > dev->dmasound.read_count) + bytes = dev->dmasound.read_count; + if (bytes > dev->dmasound.bufsize - dev->dmasound.read_offset) + bytes = dev->dmasound.bufsize - dev->dmasound.read_offset; if (copy_to_user(buffer + ret, - dev->oss.dma.vmalloc + dev->oss.read_offset, + dev->dmasound.dma.vmalloc + dev->dmasound.read_offset, bytes)) { if (0 == ret) ret = -EFAULT; @@ -345,13 +345,13 @@ static ssize_t dsp_read(struct file *file, char __user *buffer, ret += bytes; count -= bytes; - dev->oss.read_count -= bytes; - dev->oss.read_offset += bytes; - if (dev->oss.read_offset == dev->oss.bufsize) - dev->oss.read_offset = 0; + dev->dmasound.read_count -= bytes; + dev->dmasound.read_offset += bytes; + if (dev->dmasound.read_offset == dev->dmasound.bufsize) + dev->dmasound.read_offset = 0; } - up(&dev->oss.lock); - remove_wait_queue(&dev->oss.wq, &wait); + up(&dev->dmasound.lock); + remove_wait_queue(&dev->dmasound.wq, &wait); return ret; } @@ -382,35 +382,35 @@ static int dsp_ioctl(struct inode *inode, struct file *file, return -EFAULT; /* fall through */ case SOUND_PCM_READ_RATE: - return put_user(dev->oss.rate, p); + return put_user(dev->dmasound.rate, p); case SNDCTL_DSP_STEREO: if (get_user(val, p)) return -EFAULT; - down(&dev->oss.lock); - dev->oss.channels = val ? 2 : 1; - if (dev->oss.recording_on) { + down(&dev->dmasound.lock); + dev->dmasound.channels = val ? 2 : 1; + if (dev->dmasound.recording_on) { dsp_rec_stop(dev); dsp_rec_start(dev); } - up(&dev->oss.lock); - return put_user(dev->oss.channels-1, p); + up(&dev->dmasound.lock); + return put_user(dev->dmasound.channels-1, p); case SNDCTL_DSP_CHANNELS: if (get_user(val, p)) return -EFAULT; if (val != 1 && val != 2) return -EINVAL; - down(&dev->oss.lock); - dev->oss.channels = val; - if (dev->oss.recording_on) { + down(&dev->dmasound.lock); + dev->dmasound.channels = val; + if (dev->dmasound.recording_on) { dsp_rec_stop(dev); dsp_rec_start(dev); } - up(&dev->oss.lock); + up(&dev->dmasound.lock); /* fall through */ case SOUND_PCM_READ_CHANNELS: - return put_user(dev->oss.channels, p); + return put_user(dev->dmasound.channels, p); case SNDCTL_DSP_GETFMTS: /* Returns a mask */ return put_user(AFMT_U8 | AFMT_S8 | @@ -430,20 +430,20 @@ static int dsp_ioctl(struct inode *inode, struct file *file, case AFMT_U16_BE: case AFMT_S16_LE: case AFMT_S16_BE: - down(&dev->oss.lock); - dev->oss.afmt = val; - if (dev->oss.recording_on) { + down(&dev->dmasound.lock); + dev->dmasound.afmt = val; + if (dev->dmasound.recording_on) { dsp_rec_stop(dev); dsp_rec_start(dev); } - up(&dev->oss.lock); - return put_user(dev->oss.afmt, p); + up(&dev->dmasound.lock); + return put_user(dev->dmasound.afmt, p); default: return -EINVAL; } case SOUND_PCM_READ_BITS: - switch (dev->oss.afmt) { + switch (dev->dmasound.afmt) { case AFMT_U8: case AFMT_S8: return put_user(8, p); @@ -461,18 +461,18 @@ static int dsp_ioctl(struct inode *inode, struct file *file, return 0; case SNDCTL_DSP_RESET: - down(&dev->oss.lock); - if (dev->oss.recording_on) + down(&dev->dmasound.lock); + if (dev->dmasound.recording_on) dsp_rec_stop(dev); - up(&dev->oss.lock); + up(&dev->dmasound.lock); return 0; case SNDCTL_DSP_GETBLKSIZE: - return put_user(dev->oss.blksize, p); + return put_user(dev->dmasound.blksize, p); case SNDCTL_DSP_SETFRAGMENT: if (get_user(val, p)) return -EFAULT; - if (dev->oss.recording_on) + if (dev->dmasound.recording_on) return -EBUSY; dsp_buffer_free(dev); /* used to be arg >> 16 instead of val >> 16; fixed */ @@ -487,9 +487,9 @@ static int dsp_ioctl(struct inode *inode, struct file *file, case SNDCTL_DSP_GETISPACE: { audio_buf_info info; - info.fragsize = dev->oss.blksize; - info.fragstotal = dev->oss.blocks; - info.bytes = dev->oss.read_count; + info.fragsize = dev->dmasound.blksize; + info.fragstotal = dev->dmasound.blocks; + info.bytes = dev->dmasound.read_count; info.fragments = info.bytes / info.fragsize; if (copy_to_user(argp, &info, sizeof(info))) return -EFAULT; @@ -505,13 +505,13 @@ static unsigned int dsp_poll(struct file *file, struct poll_table_struct *wait) struct saa7134_dev *dev = file->private_data; unsigned int mask = 0; - poll_wait(file, &dev->oss.wq, wait); + poll_wait(file, &dev->dmasound.wq, wait); - if (0 == dev->oss.read_count) { - down(&dev->oss.lock); - if (!dev->oss.recording_on) + if (0 == dev->dmasound.read_count) { + down(&dev->dmasound.lock); + if (!dev->dmasound.recording_on) dsp_rec_start(dev); - up(&dev->oss.lock); + up(&dev->dmasound.lock); } else mask |= (POLLIN | POLLRDNORM); return mask; @@ -535,7 +535,7 @@ mixer_recsrc_7134(struct saa7134_dev *dev) { int analog_io,rate; - switch (dev->oss.input) { + switch (dev->dmasound.input) { case TV: saa_andorb(SAA7134_AUDIO_FORMAT_CTRL, 0xc0, 0xc0); saa_andorb(SAA7134_SIF_SAMPLE_FREQ, 0x03, 0x00); @@ -543,8 +543,8 @@ mixer_recsrc_7134(struct saa7134_dev *dev) case LINE1: case LINE2: case LINE2_LEFT: - analog_io = (LINE1 == dev->oss.input) ? 0x00 : 0x08; - rate = (32000 == dev->oss.rate) ? 0x01 : 0x03; + analog_io = (LINE1 == dev->dmasound.input) ? 0x00 : 0x08; + rate = (32000 == dev->dmasound.rate) ? 0x01 : 0x03; saa_andorb(SAA7134_ANALOG_IO_SELECT, 0x08, analog_io); saa_andorb(SAA7134_AUDIO_FORMAT_CTRL, 0xc0, 0x80); saa_andorb(SAA7134_SIF_SAMPLE_FREQ, 0x03, rate); @@ -560,7 +560,7 @@ mixer_recsrc_7133(struct saa7134_dev *dev) xbarin = 0x03; // adc anabar = 0; - switch (dev->oss.input) { + switch (dev->dmasound.input) { case TV: xbarin = 0; // Demodulator anabar = 2; // DACs @@ -586,9 +586,9 @@ mixer_recsrc(struct saa7134_dev *dev, enum saa7134_audio_in src) { static const char *iname[] = { "Oops", "TV", "LINE1", "LINE2" }; - dev->oss.count++; - dev->oss.input = src; - dprintk("mixer input = %s\n",iname[dev->oss.input]); + dev->dmasound.count++; + dev->dmasound.input = src; + dprintk("mixer input = %s\n",iname[dev->dmasound.input]); switch (dev->pci->device) { case PCI_DEVICE_ID_PHILIPS_SAA7134: @@ -640,7 +640,7 @@ static int mixer_open(struct inode *inode, struct file *file) list_for_each(list,&saa7134_devlist) { h = list_entry(list, struct saa7134_dev, devlist); - if (h->oss.minor_mixer == minor) + if (h->dmasound.minor_mixer == minor) dev = h; } if (NULL == dev) @@ -676,7 +676,7 @@ static int mixer_ioctl(struct inode *inode, struct file *file, memset(&info,0,sizeof(info)); strlcpy(info.id, "TV audio", sizeof(info.id)); strlcpy(info.name, dev->name, sizeof(info.name)); - info.modify_counter = dev->oss.count; + info.modify_counter = dev->dmasound.count; if (copy_to_user(argp, &info, sizeof(info))) return -EFAULT; return 0; @@ -698,26 +698,26 @@ static int mixer_ioctl(struct inode *inode, struct file *file, case MIXER_READ(SOUND_MIXER_RECMASK): case MIXER_READ(SOUND_MIXER_DEVMASK): val = SOUND_MASK_LINE1 | SOUND_MASK_LINE2; - if (32000 == dev->oss.rate) + if (32000 == dev->dmasound.rate) val |= SOUND_MASK_VIDEO; return put_user(val, p); case MIXER_WRITE(SOUND_MIXER_RECSRC): if (get_user(val, p)) return -EFAULT; - input = dev->oss.input; - if (32000 == dev->oss.rate && - val & SOUND_MASK_VIDEO && dev->oss.input != TV) + input = dev->dmasound.input; + if (32000 == dev->dmasound.rate && + val & SOUND_MASK_VIDEO && dev->dmasound.input != TV) input = TV; - if (val & SOUND_MASK_LINE1 && dev->oss.input != LINE1) + if (val & SOUND_MASK_LINE1 && dev->dmasound.input != LINE1) input = LINE1; - if (val & SOUND_MASK_LINE2 && dev->oss.input != LINE2) + if (val & SOUND_MASK_LINE2 && dev->dmasound.input != LINE2) input = LINE2; - if (input != dev->oss.input) + if (input != dev->dmasound.input) mixer_recsrc(dev,input); /* fall throuth */ case MIXER_READ(SOUND_MIXER_RECSRC): - switch (dev->oss.input) { + switch (dev->dmasound.input) { case TV: ret = SOUND_MASK_VIDEO; break; case LINE1: ret = SOUND_MASK_LINE1; break; case LINE2: ret = SOUND_MASK_LINE2; break; @@ -727,7 +727,7 @@ static int mixer_ioctl(struct inode *inode, struct file *file, case MIXER_WRITE(SOUND_MIXER_VIDEO): case MIXER_READ(SOUND_MIXER_VIDEO): - if (32000 != dev->oss.rate) + if (32000 != dev->dmasound.rate) return -EINVAL; return put_user(100 | 100 << 8, p); @@ -736,22 +736,22 @@ static int mixer_ioctl(struct inode *inode, struct file *file, return -EFAULT; val &= 0xff; val = (val <= 50) ? 50 : 100; - dev->oss.line1 = val; - mixer_level(dev,LINE1,dev->oss.line1); + dev->dmasound.line1 = val; + mixer_level(dev,LINE1,dev->dmasound.line1); /* fall throuth */ case MIXER_READ(SOUND_MIXER_LINE1): - return put_user(dev->oss.line1 | dev->oss.line1 << 8, p); + return put_user(dev->dmasound.line1 | dev->dmasound.line1 << 8, p); case MIXER_WRITE(SOUND_MIXER_LINE2): if (get_user(val, p)) return -EFAULT; val &= 0xff; val = (val <= 50) ? 50 : 100; - dev->oss.line2 = val; - mixer_level(dev,LINE2,dev->oss.line2); + dev->dmasound.line2 = val; + mixer_level(dev,LINE2,dev->dmasound.line2); /* fall throuth */ case MIXER_READ(SOUND_MIXER_LINE2): - return put_user(dev->oss.line2 | dev->oss.line2 << 8, p); + return put_user(dev->dmasound.line2 | dev->dmasound.line2 << 8, p); default: return -EINVAL; @@ -771,8 +771,8 @@ struct file_operations saa7134_mixer_fops = { int saa7134_oss_init1(struct saa7134_dev *dev) { /* general */ - init_MUTEX(&dev->oss.lock); - init_waitqueue_head(&dev->oss.wq); + init_MUTEX(&dev->dmasound.lock); + init_waitqueue_head(&dev->dmasound.wq); switch (dev->pci->device) { case PCI_DEVICE_ID_PHILIPS_SAA7133: @@ -784,17 +784,17 @@ int saa7134_oss_init1(struct saa7134_dev *dev) } /* dsp */ - dev->oss.rate = 32000; + dev->dmasound.rate = 32000; if (oss_rate) - dev->oss.rate = oss_rate; - dev->oss.rate = (dev->oss.rate > 40000) ? 48000 : 32000; + dev->dmasound.rate = oss_rate; + dev->dmasound.rate = (dev->dmasound.rate > 40000) ? 48000 : 32000; /* mixer */ - dev->oss.line1 = 50; - dev->oss.line2 = 50; - mixer_level(dev,LINE1,dev->oss.line1); - mixer_level(dev,LINE2,dev->oss.line2); - mixer_recsrc(dev, (dev->oss.rate == 32000) ? TV : LINE2); + dev->dmasound.line1 = 50; + dev->dmasound.line2 = 50; + mixer_level(dev,LINE1,dev->dmasound.line1); + mixer_level(dev,LINE2,dev->dmasound.line2); + mixer_recsrc(dev, (dev->dmasound.rate == 32000) ? TV : LINE2); return 0; } @@ -810,7 +810,7 @@ void saa7134_irq_oss_done(struct saa7134_dev *dev, unsigned long status) int next_blk, reg = 0; spin_lock(&dev->slock); - if (UNSET == dev->oss.dma_blk) { + if (UNSET == dev->dmasound.dma_blk) { dprintk("irq: recording stopped\n"); goto done; } @@ -818,11 +818,11 @@ void saa7134_irq_oss_done(struct saa7134_dev *dev, unsigned long status) dprintk("irq: lost %ld\n", (status >> 24) & 0x0f); if (0 == (status & 0x10000000)) { /* odd */ - if (0 == (dev->oss.dma_blk & 0x01)) + if (0 == (dev->dmasound.dma_blk & 0x01)) reg = SAA7134_RS_BA1(6); } else { /* even */ - if (1 == (dev->oss.dma_blk & 0x01)) + if (1 == (dev->dmasound.dma_blk & 0x01)) reg = SAA7134_RS_BA2(6); } if (0 == reg) { @@ -830,25 +830,25 @@ void saa7134_irq_oss_done(struct saa7134_dev *dev, unsigned long status) (status & 0x10000000) ? "even" : "odd"); goto done; } - if (dev->oss.read_count >= dev->oss.blksize * (dev->oss.blocks-2)) { - dprintk("irq: overrun [full=%d/%d]\n",dev->oss.read_count, - dev->oss.bufsize); + if (dev->dmasound.read_count >= dev->dmasound.blksize * (dev->dmasound.blocks-2)) { + dprintk("irq: overrun [full=%d/%d]\n",dev->dmasound.read_count, + dev->dmasound.bufsize); dsp_dma_stop(dev); goto done; } /* next block addr */ - next_blk = (dev->oss.dma_blk + 2) % dev->oss.blocks; - saa_writel(reg,next_blk * dev->oss.blksize); + next_blk = (dev->dmasound.dma_blk + 2) % dev->dmasound.blocks; + saa_writel(reg,next_blk * dev->dmasound.blksize); if (oss_debug > 2) dprintk("irq: ok, %s, next_blk=%d, addr=%x\n", (status & 0x10000000) ? "even" : "odd ", next_blk, - next_blk * dev->oss.blksize); + next_blk * dev->dmasound.blksize); /* update status & wake waiting readers */ - dev->oss.dma_blk = (dev->oss.dma_blk + 1) % dev->oss.blocks; - dev->oss.read_count += dev->oss.blksize; - wake_up(&dev->oss.wq); + dev->dmasound.dma_blk = (dev->dmasound.dma_blk + 1) % dev->dmasound.blocks; + dev->dmasound.read_count += dev->dmasound.blksize; + wake_up(&dev->dmasound.wq); done: spin_unlock(&dev->slock); diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index 1fdc9e147f87..fb9727471661 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h @@ -355,8 +355,8 @@ struct saa7134_fh { struct saa7134_pgtable pt_vbi; }; -/* oss dsp status */ -struct saa7134_oss { +/* dmasound dsp status */ +struct saa7134_dmasound { struct semaphore lock; int minor_mixer; int minor_dsp; @@ -431,7 +431,7 @@ struct saa7134_dev { struct video_device *video_dev; struct video_device *radio_dev; struct video_device *vbi_dev; - struct saa7134_oss oss; + struct saa7134_dmasound dmasound; /* infrared remote */ int has_remote; -- cgit v1.2.2 From b910472dd3b7c1d51af9a594a759f642520c33e1 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Tue, 8 Nov 2005 21:38:55 -0800 Subject: [PATCH] sched: implement nice support across physical cpus on SMP This patch implements 'nice' support across physical cpus on SMP. It introduces an extra runqueue variable prio_bias which is the sum of the (inverted) static priorities of all the tasks on the runqueue. This is then used to bias busy rebalancing between runqueues to obtain good distribution of tasks of different nice values. By biasing the balancing only during busy rebalancing we can avoid having any significant loss of throughput by not affecting the carefully tuned idle balancing already in place. If all tasks are running at the same nice level this code should also have minimal effect. The code is optimised out in the !CONFIG_SMP case. Signed-off-by: Con Kolivas Cc: Ingo Molnar Cc: Nick Piggin Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- kernel/sched.c | 101 +++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 83 insertions(+), 18 deletions(-) diff --git a/kernel/sched.c b/kernel/sched.c index 3ce26954be12..c6827f94e156 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -206,6 +206,7 @@ struct runqueue { */ unsigned long nr_running; #ifdef CONFIG_SMP + unsigned long prio_bias; unsigned long cpu_load[3]; #endif unsigned long long nr_switches; @@ -659,13 +660,45 @@ static int effective_prio(task_t *p) return prio; } +#ifdef CONFIG_SMP +static inline void inc_prio_bias(runqueue_t *rq, int static_prio) +{ + rq->prio_bias += MAX_PRIO - static_prio; +} + +static inline void dec_prio_bias(runqueue_t *rq, int static_prio) +{ + rq->prio_bias -= MAX_PRIO - static_prio; +} +#else +static inline void inc_prio_bias(runqueue_t *rq, int static_prio) +{ +} + +static inline void dec_prio_bias(runqueue_t *rq, int static_prio) +{ +} +#endif + +static inline void inc_nr_running(task_t *p, runqueue_t *rq) +{ + rq->nr_running++; + inc_prio_bias(rq, p->static_prio); +} + +static inline void dec_nr_running(task_t *p, runqueue_t *rq) +{ + rq->nr_running--; + dec_prio_bias(rq, p->static_prio); +} + /* * __activate_task - move a task to the runqueue. */ static inline void __activate_task(task_t *p, runqueue_t *rq) { enqueue_task(p, rq->active); - rq->nr_running++; + inc_nr_running(p, rq); } /* @@ -674,7 +707,7 @@ static inline void __activate_task(task_t *p, runqueue_t *rq) static inline void __activate_idle_task(task_t *p, runqueue_t *rq) { enqueue_task_head(p, rq->active); - rq->nr_running++; + inc_nr_running(p, rq); } static int recalc_task_prio(task_t *p, unsigned long long now) @@ -793,7 +826,7 @@ static void activate_task(task_t *p, runqueue_t *rq, int local) */ static void deactivate_task(struct task_struct *p, runqueue_t *rq) { - rq->nr_running--; + dec_nr_running(p, rq); dequeue_task(p, p->array); p->array = NULL; } @@ -930,27 +963,54 @@ void kick_process(task_t *p) * We want to under-estimate the load of migration sources, to * balance conservatively. */ -static inline unsigned long source_load(int cpu, int type) +static inline unsigned long __source_load(int cpu, int type, enum idle_type idle) { runqueue_t *rq = cpu_rq(cpu); - unsigned long load_now = rq->nr_running * SCHED_LOAD_SCALE; + unsigned long cpu_load = rq->cpu_load[type-1], + load_now = rq->nr_running * SCHED_LOAD_SCALE; + + if (idle == NOT_IDLE) { + /* + * If we are balancing busy runqueues the load is biased by + * priority to create 'nice' support across cpus. + */ + cpu_load *= rq->prio_bias; + load_now *= rq->prio_bias; + } + if (type == 0) return load_now; - return min(rq->cpu_load[type-1], load_now); + return min(cpu_load, load_now); +} + +static inline unsigned long source_load(int cpu, int type) +{ + return __source_load(cpu, type, NOT_IDLE); } /* * Return a high guess at the load of a migration-target cpu */ -static inline unsigned long target_load(int cpu, int type) +static inline unsigned long __target_load(int cpu, int type, enum idle_type idle) { runqueue_t *rq = cpu_rq(cpu); - unsigned long load_now = rq->nr_running * SCHED_LOAD_SCALE; + unsigned long cpu_load = rq->cpu_load[type-1], + load_now = rq->nr_running * SCHED_LOAD_SCALE; + if (type == 0) return load_now; - return max(rq->cpu_load[type-1], load_now); + if (idle == NOT_IDLE) { + cpu_load *= rq->prio_bias; + load_now *= rq->prio_bias; + } + return max(cpu_load, load_now); +} + +static inline unsigned long target_load(int cpu, int type) +{ + return __target_load(cpu, type, NOT_IDLE); } /* @@ -1411,7 +1471,7 @@ void fastcall wake_up_new_task(task_t *p, unsigned long clone_flags) list_add_tail(&p->run_list, ¤t->run_list); p->array = current->array; p->array->nr_active++; - rq->nr_running++; + inc_nr_running(p, rq); } set_need_resched(); } else @@ -1756,9 +1816,9 @@ void pull_task(runqueue_t *src_rq, prio_array_t *src_array, task_t *p, runqueue_t *this_rq, prio_array_t *this_array, int this_cpu) { dequeue_task(p, src_array); - src_rq->nr_running--; + dec_nr_running(p, src_rq); set_task_cpu(p, this_cpu); - this_rq->nr_running++; + inc_nr_running(p, this_rq); enqueue_task(p, this_array); p->timestamp = (p->timestamp - src_rq->timestamp_last_tick) + this_rq->timestamp_last_tick; @@ -1937,9 +1997,9 @@ find_busiest_group(struct sched_domain *sd, int this_cpu, /* Bias balancing toward cpus of our domain */ if (local_group) - load = target_load(i, load_idx); + load = __target_load(i, load_idx, idle); else - load = source_load(i, load_idx); + load = __source_load(i, load_idx, idle); avg_load += load; } @@ -2044,14 +2104,15 @@ out_balanced: /* * find_busiest_queue - find the busiest runqueue among the cpus in group. */ -static runqueue_t *find_busiest_queue(struct sched_group *group) +static runqueue_t *find_busiest_queue(struct sched_group *group, + enum idle_type idle) { unsigned long load, max_load = 0; runqueue_t *busiest = NULL; int i; for_each_cpu_mask(i, group->cpumask) { - load = source_load(i, 0); + load = __source_load(i, 0, idle); if (load > max_load) { max_load = load; @@ -2095,7 +2156,7 @@ static int load_balance(int this_cpu, runqueue_t *this_rq, goto out_balanced; } - busiest = find_busiest_queue(group); + busiest = find_busiest_queue(group, idle); if (!busiest) { schedstat_inc(sd, lb_nobusyq[idle]); goto out_balanced; @@ -2218,7 +2279,7 @@ static int load_balance_newidle(int this_cpu, runqueue_t *this_rq, goto out_balanced; } - busiest = find_busiest_queue(group); + busiest = find_busiest_queue(group, NEWLY_IDLE); if (!busiest) { schedstat_inc(sd, lb_nobusyq[NEWLY_IDLE]); goto out_balanced; @@ -3447,7 +3508,9 @@ void set_user_nice(task_t *p, long nice) * not SCHED_NORMAL: */ if (rt_task(p)) { + dec_prio_bias(rq, p->static_prio); p->static_prio = NICE_TO_PRIO(nice); + inc_prio_bias(rq, p->static_prio); goto out_unlock; } array = p->array; @@ -3457,7 +3520,9 @@ void set_user_nice(task_t *p, long nice) old_prio = p->prio; new_prio = NICE_TO_PRIO(nice); delta = new_prio - old_prio; + dec_prio_bias(rq, p->static_prio); p->static_prio = NICE_TO_PRIO(nice); + inc_prio_bias(rq, p->static_prio); p->prio += delta; if (array) { -- cgit v1.2.2 From 738a2ccbcf8c2c1b039f1e76662dce60b22b694b Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Tue, 8 Nov 2005 21:38:56 -0800 Subject: [PATCH] sched: change prio bias only if queued prio_bias should only be adjusted in set_user_nice if p is actually currently queued. Signed-off-by: Con Kolivas Cc: Ingo Molnar Cc: Nick Piggin Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- kernel/sched.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/kernel/sched.c b/kernel/sched.c index c6827f94e156..e1f57bd5aaa6 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -3508,25 +3508,24 @@ void set_user_nice(task_t *p, long nice) * not SCHED_NORMAL: */ if (rt_task(p)) { - dec_prio_bias(rq, p->static_prio); p->static_prio = NICE_TO_PRIO(nice); - inc_prio_bias(rq, p->static_prio); goto out_unlock; } array = p->array; - if (array) + if (array) { dequeue_task(p, array); + dec_prio_bias(rq, p->static_prio); + } old_prio = p->prio; new_prio = NICE_TO_PRIO(nice); delta = new_prio - old_prio; - dec_prio_bias(rq, p->static_prio); p->static_prio = NICE_TO_PRIO(nice); - inc_prio_bias(rq, p->static_prio); p->prio += delta; if (array) { enqueue_task(p, array); + inc_prio_bias(rq, p->static_prio); /* * If the task increased its priority or is running and * lowered its priority, then reschedule its CPU: -- cgit v1.2.2 From dad1c65c8000f4485d8602e1875ded77e0d72133 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Tue, 8 Nov 2005 21:38:57 -0800 Subject: [PATCH] sched: account rt tasks in prio_bias() Real time tasks' effect on prio_bias should be based on their real time priority level instead of their static_prio which is based on nice. Signed-off-by: Con Kolivas Cc: Ingo Molnar Cc: Nick Piggin Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- kernel/sched.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/kernel/sched.c b/kernel/sched.c index e1f57bd5aaa6..d9dbf8ee6ca4 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -661,21 +661,21 @@ static int effective_prio(task_t *p) } #ifdef CONFIG_SMP -static inline void inc_prio_bias(runqueue_t *rq, int static_prio) +static inline void inc_prio_bias(runqueue_t *rq, int prio) { - rq->prio_bias += MAX_PRIO - static_prio; + rq->prio_bias += MAX_PRIO - prio; } -static inline void dec_prio_bias(runqueue_t *rq, int static_prio) +static inline void dec_prio_bias(runqueue_t *rq, int prio) { - rq->prio_bias -= MAX_PRIO - static_prio; + rq->prio_bias -= MAX_PRIO - prio; } #else -static inline void inc_prio_bias(runqueue_t *rq, int static_prio) +static inline void inc_prio_bias(runqueue_t *rq, int prio) { } -static inline void dec_prio_bias(runqueue_t *rq, int static_prio) +static inline void dec_prio_bias(runqueue_t *rq, int prio) { } #endif @@ -683,13 +683,19 @@ static inline void dec_prio_bias(runqueue_t *rq, int static_prio) static inline void inc_nr_running(task_t *p, runqueue_t *rq) { rq->nr_running++; - inc_prio_bias(rq, p->static_prio); + if (rt_task(p)) + inc_prio_bias(rq, p->prio); + else + inc_prio_bias(rq, p->static_prio); } static inline void dec_nr_running(task_t *p, runqueue_t *rq) { rq->nr_running--; - dec_prio_bias(rq, p->static_prio); + if (rt_task(p)) + dec_prio_bias(rq, p->prio); + else + dec_prio_bias(rq, p->static_prio); } /* -- cgit v1.2.2 From 3b0bd9bc6f3b8a47853d1b1de4520de3878e8941 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Tue, 8 Nov 2005 21:38:58 -0800 Subject: [PATCH] sched: smp nice bias busy queues on idle rebalance To intensify the 'nice' support across physical cpus on SMP we can bias the loads on idle rebalancing. To prevent idle rebalance from trying to pull tasks from queues that appear heavily loaded we only bias the load if there is more than one task running. Add some minor micro-optimisations and have only one return from __source_load and __target_load functions. Fix the fact that target_load was not biased by priority when type == 0. Signed-off-by: Con Kolivas Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- kernel/sched.c | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/kernel/sched.c b/kernel/sched.c index d9dbf8ee6ca4..ec9ea9119b98 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -972,22 +972,26 @@ void kick_process(task_t *p) static inline unsigned long __source_load(int cpu, int type, enum idle_type idle) { runqueue_t *rq = cpu_rq(cpu); - unsigned long cpu_load = rq->cpu_load[type-1], + unsigned long source_load, cpu_load = rq->cpu_load[type-1], load_now = rq->nr_running * SCHED_LOAD_SCALE; - if (idle == NOT_IDLE) { + if (type == 0) + source_load = load_now; + else + source_load = min(cpu_load, load_now); + + if (idle == NOT_IDLE || rq->nr_running > 1) /* - * If we are balancing busy runqueues the load is biased by - * priority to create 'nice' support across cpus. + * If we are busy rebalancing the load is biased by + * priority to create 'nice' support across cpus. When + * idle rebalancing we should only bias the source_load if + * there is more than one task running on that queue to + * prevent idle rebalance from trying to pull tasks from a + * queue with only one running task. */ - cpu_load *= rq->prio_bias; - load_now *= rq->prio_bias; - } + source_load *= rq->prio_bias; - if (type == 0) - return load_now; - - return min(cpu_load, load_now); + return source_load; } static inline unsigned long source_load(int cpu, int type) @@ -1001,17 +1005,18 @@ static inline unsigned long source_load(int cpu, int type) static inline unsigned long __target_load(int cpu, int type, enum idle_type idle) { runqueue_t *rq = cpu_rq(cpu); - unsigned long cpu_load = rq->cpu_load[type-1], + unsigned long target_load, cpu_load = rq->cpu_load[type-1], load_now = rq->nr_running * SCHED_LOAD_SCALE; if (type == 0) - return load_now; + target_load = load_now; + else + target_load = max(cpu_load, load_now); - if (idle == NOT_IDLE) { - cpu_load *= rq->prio_bias; - load_now *= rq->prio_bias; - } - return max(cpu_load, load_now); + if (idle == NOT_IDLE || rq->nr_running > 1) + target_load *= rq->prio_bias; + + return target_load; } static inline unsigned long target_load(int cpu, int type) -- cgit v1.2.2 From 6dd4a85bb3ee0715415892c8b0f2a9bd08d31ca4 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Tue, 8 Nov 2005 21:38:59 -0800 Subject: [PATCH] sched: correct smp_nice_bias The priority biasing was off by mutliplying the total load by the total priority bias and this ruins the ratio of loads between runqueues. This patch should correct the ratios of loads between runqueues to be proportional to overall load. -2nd attempt. From: Dave Kleikamp This patch fixes a divide-by-zero error that I hit on a two-way i386 machine. rq->nr_running is tested to be non-zero, but may change by the time it is used in the division. Saving the value to a local variable ensures that the same value that is checked is used in the division. Signed-off-by: Con Kolivas Signed-off-by: Dave Kleikamp Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- kernel/sched.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/kernel/sched.c b/kernel/sched.c index ec9ea9119b98..502d47c883b6 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -972,15 +972,16 @@ void kick_process(task_t *p) static inline unsigned long __source_load(int cpu, int type, enum idle_type idle) { runqueue_t *rq = cpu_rq(cpu); + unsigned long running = rq->nr_running; unsigned long source_load, cpu_load = rq->cpu_load[type-1], - load_now = rq->nr_running * SCHED_LOAD_SCALE; + load_now = running * SCHED_LOAD_SCALE; if (type == 0) source_load = load_now; else source_load = min(cpu_load, load_now); - if (idle == NOT_IDLE || rq->nr_running > 1) + if (running > 1 || (idle == NOT_IDLE && running)) /* * If we are busy rebalancing the load is biased by * priority to create 'nice' support across cpus. When @@ -989,7 +990,7 @@ static inline unsigned long __source_load(int cpu, int type, enum idle_type idle * prevent idle rebalance from trying to pull tasks from a * queue with only one running task. */ - source_load *= rq->prio_bias; + source_load = source_load * rq->prio_bias / running; return source_load; } @@ -1005,16 +1006,17 @@ static inline unsigned long source_load(int cpu, int type) static inline unsigned long __target_load(int cpu, int type, enum idle_type idle) { runqueue_t *rq = cpu_rq(cpu); + unsigned long running = rq->nr_running; unsigned long target_load, cpu_load = rq->cpu_load[type-1], - load_now = rq->nr_running * SCHED_LOAD_SCALE; + load_now = running * SCHED_LOAD_SCALE; if (type == 0) target_load = load_now; else target_load = max(cpu_load, load_now); - if (idle == NOT_IDLE || rq->nr_running > 1) - target_load *= rq->prio_bias; + if (running > 1 || (idle == NOT_IDLE && running)) + target_load = target_load * rq->prio_bias / running; return target_load; } -- cgit v1.2.2 From ede3d0fba99520f268067917b50858d788bc41da Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Tue, 8 Nov 2005 21:39:00 -0800 Subject: [PATCH] sched: consider migration thread with smp nice The intermittent scheduling of the migration thread at ultra high priority makes the smp nice handling see that runqueue as being heavily loaded. The migration thread itself actually handles the balancing so its influence on priority balancing should be ignored. Signed-off-by: Con Kolivas Cc: Ingo Molnar Cc: Nick Piggin Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- kernel/sched.c | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/kernel/sched.c b/kernel/sched.c index 502d47c883b6..0f2def822296 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -670,6 +670,31 @@ static inline void dec_prio_bias(runqueue_t *rq, int prio) { rq->prio_bias -= MAX_PRIO - prio; } + +static inline void inc_nr_running(task_t *p, runqueue_t *rq) +{ + rq->nr_running++; + if (rt_task(p)) { + if (p != rq->migration_thread) + /* + * The migration thread does the actual balancing. Do + * not bias by its priority as the ultra high priority + * will skew balancing adversely. + */ + inc_prio_bias(rq, p->prio); + } else + inc_prio_bias(rq, p->static_prio); +} + +static inline void dec_nr_running(task_t *p, runqueue_t *rq) +{ + rq->nr_running--; + if (rt_task(p)) { + if (p != rq->migration_thread) + dec_prio_bias(rq, p->prio); + } else + dec_prio_bias(rq, p->static_prio); +} #else static inline void inc_prio_bias(runqueue_t *rq, int prio) { @@ -678,25 +703,17 @@ static inline void inc_prio_bias(runqueue_t *rq, int prio) static inline void dec_prio_bias(runqueue_t *rq, int prio) { } -#endif static inline void inc_nr_running(task_t *p, runqueue_t *rq) { rq->nr_running++; - if (rt_task(p)) - inc_prio_bias(rq, p->prio); - else - inc_prio_bias(rq, p->static_prio); } static inline void dec_nr_running(task_t *p, runqueue_t *rq) { rq->nr_running--; - if (rt_task(p)) - dec_prio_bias(rq, p->prio); - else - dec_prio_bias(rq, p->static_prio); } +#endif /* * __activate_task - move a task to the runqueue. -- cgit v1.2.2 From 5bfb5d690f36d316a5f3b4f7775fda996faa6b12 Mon Sep 17 00:00:00 2001 From: Nick Piggin Date: Tue, 8 Nov 2005 21:39:01 -0800 Subject: [PATCH] sched: disable preempt in idle tasks Run idle threads with preempt disabled. Also corrected a bugs in arm26's cpu_idle (make it actually call schedule()). How did it ever work before? Might fix the CPU hotplugging hang which Nigel Cunningham noted. We think the bug hits if the idle thread is preempted after checking need_resched() and before going to sleep, then the CPU offlined. After calling stop_machine_run, the CPU eventually returns from preemption and into the idle thread and goes to sleep. The CPU will continue executing previous idle and have no chance to call play_dead. By disabling preemption until we are ready to explicitly schedule, this bug is fixed and the idle threads generally become more robust. From: alexs PPC build fix From: Yoichi Yuasa MIPS build fix Signed-off-by: Nick Piggin Signed-off-by: Yoichi Yuasa Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/arm/kernel/process.c | 4 ++-- arch/arm/kernel/smp.c | 5 ++++- arch/arm26/kernel/process.c | 12 +++++------- arch/cris/arch-v32/kernel/smp.c | 1 + arch/cris/kernel/process.c | 2 ++ arch/frv/kernel/process.c | 6 +++++- arch/h8300/kernel/process.c | 28 +++++++++++++++------------- arch/i386/kernel/process.c | 4 +++- arch/i386/kernel/smpboot.c | 1 + arch/ia64/kernel/process.c | 2 ++ arch/ia64/kernel/smpboot.c | 1 + arch/m32r/kernel/process.c | 2 ++ arch/m32r/kernel/smpboot.c | 1 + arch/m68k/kernel/process.c | 2 ++ arch/mips/kernel/process.c | 2 ++ arch/mips/kernel/smp.c | 4 +++- arch/parisc/kernel/process.c | 2 ++ arch/parisc/kernel/smp.c | 1 + arch/powerpc/platforms/iseries/setup.c | 4 ++++ arch/powerpc/platforms/pseries/setup.c | 4 ++++ arch/ppc/kernel/idle.c | 17 ++++++++++++----- arch/ppc/kernel/smp.c | 1 + arch/ppc64/kernel/idle.c | 4 ++++ arch/s390/kernel/process.c | 11 ++++++++--- arch/s390/kernel/smp.c | 1 + arch/sh/kernel/process.c | 2 ++ arch/sh/kernel/smp.c | 5 ++++- arch/sh64/kernel/process.c | 2 ++ arch/sparc/kernel/process.c | 4 ++++ arch/sparc64/kernel/process.c | 4 ++++ arch/sparc64/kernel/smp.c | 3 +++ arch/v850/kernel/process.c | 16 ++++++++++------ arch/x86_64/kernel/process.c | 2 ++ arch/x86_64/kernel/smpboot.c | 1 + arch/xtensa/kernel/process.c | 3 ++- init/main.c | 4 +++- 36 files changed, 125 insertions(+), 43 deletions(-) diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index ba298277becd..93dd92cc12f8 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c @@ -116,13 +116,13 @@ void cpu_idle(void) if (!idle) idle = default_idle; - preempt_disable(); leds_event(led_idle_start); while (!need_resched()) idle(); leds_event(led_idle_end); - preempt_enable(); + preempt_enable_no_resched(); schedule(); + preempt_disable(); } } diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index 77e2e9ca89fa..e55ea952f7aa 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c @@ -256,7 +256,9 @@ void __cpuexit cpu_die(void) asmlinkage void __cpuinit secondary_start_kernel(void) { struct mm_struct *mm = &init_mm; - unsigned int cpu = smp_processor_id(); + unsigned int cpu; + + cpu = smp_processor_id(); printk("CPU%u: Booted secondary processor\n", cpu); @@ -273,6 +275,7 @@ asmlinkage void __cpuinit secondary_start_kernel(void) local_flush_tlb_all(); cpu_init(); + preempt_disable(); /* * Give the platform a chance to do its own initialisation. diff --git a/arch/arm26/kernel/process.c b/arch/arm26/kernel/process.c index 9eb9964d32a7..15833a0057dd 100644 --- a/arch/arm26/kernel/process.c +++ b/arch/arm26/kernel/process.c @@ -74,15 +74,13 @@ __setup("hlt", hlt_setup); void cpu_idle(void) { /* endless idle loop with no priority at all */ - preempt_disable(); while (1) { - while (!need_resched()) { - local_irq_disable(); - if (!need_resched() && !hlt_counter) - local_irq_enable(); - } + while (!need_resched()) + cpu_relax(); + preempt_enable_no_resched(); + schedule(); + preempt_disable(); } - schedule(); } static char reboot_mode = 'h'; diff --git a/arch/cris/arch-v32/kernel/smp.c b/arch/cris/arch-v32/kernel/smp.c index 957f551ba5ce..13867f4fad16 100644 --- a/arch/cris/arch-v32/kernel/smp.c +++ b/arch/cris/arch-v32/kernel/smp.c @@ -161,6 +161,7 @@ void __init smp_callin(void) REG_WR(intr_vect, irq_regs[cpu], rw_mask, vect_mask); unmask_irq(IPI_INTR_VECT); unmask_irq(TIMER_INTR_VECT); + preempt_disable(); local_irq_enable(); cpu_set(cpu, cpu_online_map); diff --git a/arch/cris/kernel/process.c b/arch/cris/kernel/process.c index 949a0e40e03c..7c80afb10460 100644 --- a/arch/cris/kernel/process.c +++ b/arch/cris/kernel/process.c @@ -218,7 +218,9 @@ void cpu_idle (void) idle = default_idle; idle(); } + preempt_enable_no_resched(); schedule(); + preempt_disable(); } } diff --git a/arch/frv/kernel/process.c b/arch/frv/kernel/process.c index 3001b82b1514..54a452136f00 100644 --- a/arch/frv/kernel/process.c +++ b/arch/frv/kernel/process.c @@ -77,16 +77,20 @@ void (*idle)(void) = core_sleep_idle; */ void cpu_idle(void) { + int cpu = smp_processor_id(); + /* endless idle loop with no priority at all */ while (1) { while (!need_resched()) { - irq_stat[smp_processor_id()].idle_timestamp = jiffies; + irq_stat[cpu].idle_timestamp = jiffies; if (!frv_dma_inprogress && idle) idle(); } + preempt_enable_no_resched(); schedule(); + preempt_disable(); } } diff --git a/arch/h8300/kernel/process.c b/arch/h8300/kernel/process.c index 27f1fce64ce4..fe21adf3e75e 100644 --- a/arch/h8300/kernel/process.c +++ b/arch/h8300/kernel/process.c @@ -53,22 +53,18 @@ asmlinkage void ret_from_fork(void); #if !defined(CONFIG_H8300H_SIM) && !defined(CONFIG_H8S_SIM) void default_idle(void) { - while(1) { - if (!need_resched()) { - local_irq_enable(); - __asm__("sleep"); - local_irq_disable(); - } - schedule(); - } + local_irq_disable(); + if (!need_resched()) { + local_irq_enable(); + /* XXX: race here! What if need_resched() gets set now? */ + __asm__("sleep"); + } else + local_irq_enable(); } #else void default_idle(void) { - while(1) { - if (need_resched()) - schedule(); - } + cpu_relax(); } #endif void (*idle)(void) = default_idle; @@ -81,7 +77,13 @@ void (*idle)(void) = default_idle; */ void cpu_idle(void) { - idle(); + while (1) { + while (!need_resched()) + idle(); + preempt_enable_no_resched(); + schedule(); + preempt_disable(); + } } void machine_restart(char * __unused) diff --git a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c index 7a14fdfd3af9..5296e284ea36 100644 --- a/arch/i386/kernel/process.c +++ b/arch/i386/kernel/process.c @@ -179,7 +179,7 @@ static inline void play_dead(void) */ void cpu_idle(void) { - int cpu = raw_smp_processor_id(); + int cpu = smp_processor_id(); /* endless idle loop with no priority at all */ while (1) { @@ -201,7 +201,9 @@ void cpu_idle(void) __get_cpu_var(irq_stat).idle_timestamp = jiffies; idle(); } + preempt_enable_no_resched(); schedule(); + preempt_disable(); } } diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c index 47ec76794d02..bc5a9d97466b 100644 --- a/arch/i386/kernel/smpboot.c +++ b/arch/i386/kernel/smpboot.c @@ -485,6 +485,7 @@ static void __devinit start_secondary(void *unused) * things done here to the most necessary things. */ cpu_init(); + preempt_disable(); smp_callin(); while (!cpu_isset(smp_processor_id(), smp_commenced_mask)) rep_nop(); diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c index 051e050359e4..4c621fc3c3b9 100644 --- a/arch/ia64/kernel/process.c +++ b/arch/ia64/kernel/process.c @@ -292,7 +292,9 @@ cpu_idle (void) #ifdef CONFIG_SMP normal_xtp(); #endif + preempt_enable_no_resched(); schedule(); + preempt_disable(); check_pgt_cache(); if (cpu_is_offline(smp_processor_id())) play_dead(); diff --git a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c index 400a48987124..8f44e7d2df66 100644 --- a/arch/ia64/kernel/smpboot.c +++ b/arch/ia64/kernel/smpboot.c @@ -399,6 +399,7 @@ start_secondary (void *unused) Dprintk("start_secondary: starting CPU 0x%x\n", hard_smp_processor_id()); efi_map_pal_code(); cpu_init(); + preempt_disable(); smp_callin(); cpu_idle(); diff --git a/arch/m32r/kernel/process.c b/arch/m32r/kernel/process.c index ea13a8f4d8b0..cc4b571e5db7 100644 --- a/arch/m32r/kernel/process.c +++ b/arch/m32r/kernel/process.c @@ -104,7 +104,9 @@ void cpu_idle (void) idle(); } + preempt_enable_no_resched(); schedule(); + preempt_disable(); } } diff --git a/arch/m32r/kernel/smpboot.c b/arch/m32r/kernel/smpboot.c index 640d592ea072..b90c54169fa5 100644 --- a/arch/m32r/kernel/smpboot.c +++ b/arch/m32r/kernel/smpboot.c @@ -426,6 +426,7 @@ void __init smp_cpus_done(unsigned int max_cpus) int __init start_secondary(void *unused) { cpu_init(); + preempt_disable(); smp_callin(); while (!cpu_isset(smp_processor_id(), smp_commenced_mask)) cpu_relax(); diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c index 11b1b90ba6ba..13d109328a42 100644 --- a/arch/m68k/kernel/process.c +++ b/arch/m68k/kernel/process.c @@ -102,7 +102,9 @@ void cpu_idle(void) while (1) { while (!need_resched()) idle(); + preempt_enable_no_resched(); schedule(); + preempt_disable(); } } diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c index 4fe3d5715c41..dd725779d91f 100644 --- a/arch/mips/kernel/process.c +++ b/arch/mips/kernel/process.c @@ -52,7 +52,9 @@ ATTRIB_NORET void cpu_idle(void) while (!need_resched()) if (cpu_wait) (*cpu_wait)(); + preempt_enable_no_resched(); schedule(); + preempt_disable(); } } diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c index fcacf1aae98a..25472fcaf715 100644 --- a/arch/mips/kernel/smp.c +++ b/arch/mips/kernel/smp.c @@ -82,7 +82,7 @@ extern ATTRIB_NORET void cpu_idle(void); */ asmlinkage void start_secondary(void) { - unsigned int cpu = smp_processor_id(); + unsigned int cpu; cpu_probe(); cpu_report(); @@ -95,6 +95,8 @@ asmlinkage void start_secondary(void) */ calibrate_delay(); + preempt_disable(); + cpu = smp_processor_id(); cpu_data[cpu].udelay_val = loops_per_jiffy; prom_smp_finish(); diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c index 7fdca87ef647..f482f78de435 100644 --- a/arch/parisc/kernel/process.c +++ b/arch/parisc/kernel/process.c @@ -92,7 +92,9 @@ void cpu_idle(void) while (1) { while (!need_resched()) barrier(); + preempt_enable_no_resched(); schedule(); + preempt_disable(); check_pgt_cache(); } } diff --git a/arch/parisc/kernel/smp.c b/arch/parisc/kernel/smp.c index 5db3be4e2704..a9ecf6465784 100644 --- a/arch/parisc/kernel/smp.c +++ b/arch/parisc/kernel/smp.c @@ -463,6 +463,7 @@ void __init smp_callin(void) #endif smp_cpu_init(slave_id); + preempt_disable(); #if 0 /* NOT WORKING YET - see entry.S */ istack = (void *)__get_free_pages(GFP_KERNEL,ISTACK_ORDER); diff --git a/arch/powerpc/platforms/iseries/setup.c b/arch/powerpc/platforms/iseries/setup.c index d3e4bf756c83..0130f2619dac 100644 --- a/arch/powerpc/platforms/iseries/setup.c +++ b/arch/powerpc/platforms/iseries/setup.c @@ -694,7 +694,9 @@ static void iseries_shared_idle(void) if (hvlpevent_is_pending()) process_iSeries_events(); + preempt_enable_no_resched(); schedule(); + preempt_disable(); } } @@ -726,7 +728,9 @@ static void iseries_dedicated_idle(void) } ppc64_runlatch_on(); + preempt_enable_no_resched(); schedule(); + preempt_disable(); } } diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c index e78c39368841..4854f5eb5c3d 100644 --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c @@ -539,7 +539,9 @@ static void pseries_dedicated_idle(void) lpaca->lppaca.idle = 0; ppc64_runlatch_on(); + preempt_enable_no_resched(); schedule(); + preempt_disable(); if (cpu_is_offline(cpu) && system_state == SYSTEM_RUNNING) cpu_die(); @@ -583,7 +585,9 @@ static void pseries_shared_idle(void) lpaca->lppaca.idle = 0; ppc64_runlatch_on(); + preempt_enable_no_resched(); schedule(); + preempt_disable(); if (cpu_is_offline(cpu) && system_state == SYSTEM_RUNNING) cpu_die(); diff --git a/arch/ppc/kernel/idle.c b/arch/ppc/kernel/idle.c index 11e5b44713f7..a6141f05c919 100644 --- a/arch/ppc/kernel/idle.c +++ b/arch/ppc/kernel/idle.c @@ -53,10 +53,6 @@ void default_idle(void) } #endif } - if (need_resched()) - schedule(); - if (cpu_is_offline(cpu) && system_state == SYSTEM_RUNNING) - cpu_die(); } /* @@ -64,11 +60,22 @@ void default_idle(void) */ void cpu_idle(void) { - for (;;) + int cpu = smp_processor_id(); + + for (;;) { if (ppc_md.idle != NULL) ppc_md.idle(); else default_idle(); + if (cpu_is_offline(cpu) && system_state == SYSTEM_RUNNING) + cpu_die(); + if (need_resched()) { + preempt_enable_no_resched(); + schedule(); + preempt_disable(); + } + + } } #if defined(CONFIG_SYSCTL) && defined(CONFIG_6xx) diff --git a/arch/ppc/kernel/smp.c b/arch/ppc/kernel/smp.c index bc5bf1124836..43b8fc2ca591 100644 --- a/arch/ppc/kernel/smp.c +++ b/arch/ppc/kernel/smp.c @@ -341,6 +341,7 @@ int __devinit start_secondary(void *unused) cpu = smp_processor_id(); smp_store_cpu_info(cpu); set_dec(tb_ticks_per_jiffy); + preempt_disable(); cpu_callin_map[cpu] = 1; printk("CPU %d done callin...\n", cpu); diff --git a/arch/ppc64/kernel/idle.c b/arch/ppc64/kernel/idle.c index 8fec27469802..909ea669af91 100644 --- a/arch/ppc64/kernel/idle.c +++ b/arch/ppc64/kernel/idle.c @@ -61,7 +61,9 @@ void default_idle(void) } ppc64_runlatch_on(); + preempt_enable_no_resched(); schedule(); + preempt_disable(); if (cpu_is_offline(cpu) && system_state == SYSTEM_RUNNING) cpu_die(); } @@ -77,7 +79,9 @@ void native_idle(void) if (need_resched()) { ppc64_runlatch_on(); + preempt_enable_no_resched(); schedule(); + preempt_disable(); } if (cpu_is_offline(smp_processor_id()) && diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c index 9f3dff6c0b72..66ca5757e368 100644 --- a/arch/s390/kernel/process.c +++ b/arch/s390/kernel/process.c @@ -102,7 +102,6 @@ void default_idle(void) local_irq_disable(); if (need_resched()) { local_irq_enable(); - schedule(); return; } @@ -139,8 +138,14 @@ void default_idle(void) void cpu_idle(void) { - for (;;) - default_idle(); + for (;;) { + while (!need_resched()) + default_idle(); + + preempt_enable_no_resched(); + schedule(); + preempt_disable(); + } } void show_regs(struct pt_regs *regs) diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c index e13c87b446b2..5856b3fda6bf 100644 --- a/arch/s390/kernel/smp.c +++ b/arch/s390/kernel/smp.c @@ -533,6 +533,7 @@ int __devinit start_secondary(void *cpuvoid) { /* Setup the cpu */ cpu_init(); + preempt_disable(); /* init per CPU timer */ init_cpu_timer(); #ifdef CONFIG_VIRT_TIMER diff --git a/arch/sh/kernel/process.c b/arch/sh/kernel/process.c index 6dce9d0b81f8..1cbc26b796ad 100644 --- a/arch/sh/kernel/process.c +++ b/arch/sh/kernel/process.c @@ -64,7 +64,9 @@ void default_idle(void) cpu_sleep(); } + preempt_enable_no_resched(); schedule(); + preempt_disable(); } } diff --git a/arch/sh/kernel/smp.c b/arch/sh/kernel/smp.c index 5ecefc02896a..59e49b18252c 100644 --- a/arch/sh/kernel/smp.c +++ b/arch/sh/kernel/smp.c @@ -112,7 +112,9 @@ int __cpu_up(unsigned int cpu) int start_secondary(void *unused) { - unsigned int cpu = smp_processor_id(); + unsigned int cpu; + + cpu = smp_processor_id(); atomic_inc(&init_mm.mm_count); current->active_mm = &init_mm; @@ -120,6 +122,7 @@ int start_secondary(void *unused) smp_store_cpu_info(cpu); __smp_slave_init(cpu); + preempt_disable(); per_cpu_trap_init(); atomic_inc(&cpus_booted); diff --git a/arch/sh64/kernel/process.c b/arch/sh64/kernel/process.c index efde41c0cd66..0c09537449b3 100644 --- a/arch/sh64/kernel/process.c +++ b/arch/sh64/kernel/process.c @@ -334,7 +334,9 @@ void default_idle(void) } local_irq_enable(); } + preempt_enable_no_resched(); schedule(); + preempt_disable(); } } diff --git a/arch/sparc/kernel/process.c b/arch/sparc/kernel/process.c index 29e72b57d4fd..c39f4d01096d 100644 --- a/arch/sparc/kernel/process.c +++ b/arch/sparc/kernel/process.c @@ -120,7 +120,9 @@ void cpu_idle(void) (*pm_idle)(); } + preempt_enable_no_resched(); schedule(); + preempt_disable(); check_pgt_cache(); } } @@ -133,7 +135,9 @@ void cpu_idle(void) /* endless idle loop with no priority at all */ while(1) { if(need_resched()) { + preempt_enable_no_resched(); schedule(); + preempt_disable(); check_pgt_cache(); } barrier(); /* or else gcc optimizes... */ diff --git a/arch/sparc64/kernel/process.c b/arch/sparc64/kernel/process.c index 7d10b0397091..2f89206e008f 100644 --- a/arch/sparc64/kernel/process.c +++ b/arch/sparc64/kernel/process.c @@ -74,7 +74,9 @@ void cpu_idle(void) while (!need_resched()) barrier(); + preempt_enable_no_resched(); schedule(); + preempt_disable(); check_pgt_cache(); } } @@ -93,7 +95,9 @@ void cpu_idle(void) if (need_resched()) { unidle_me(); clear_thread_flag(TIF_POLLING_NRFLAG); + preempt_enable_no_resched(); schedule(); + preempt_disable(); set_thread_flag(TIF_POLLING_NRFLAG); check_pgt_cache(); } diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c index 5d90ee9aebf1..8aca4b1dc04e 100644 --- a/arch/sparc64/kernel/smp.c +++ b/arch/sparc64/kernel/smp.c @@ -168,6 +168,9 @@ void __init smp_callin(void) rmb(); cpu_set(cpuid, cpu_online_map); + + /* idle thread is expected to have preempt disabled */ + preempt_disable(); } void cpu_panic(void) diff --git a/arch/v850/kernel/process.c b/arch/v850/kernel/process.c index 9c708c32c1f0..39cf247cdae4 100644 --- a/arch/v850/kernel/process.c +++ b/arch/v850/kernel/process.c @@ -36,11 +36,8 @@ extern void ret_from_fork (void); /* The idle loop. */ void default_idle (void) { - while (1) { - while (! need_resched ()) - asm ("halt; nop; nop; nop; nop; nop" ::: "cc"); - schedule (); - } + while (! need_resched ()) + asm ("halt; nop; nop; nop; nop; nop" ::: "cc"); } void (*idle)(void) = default_idle; @@ -54,7 +51,14 @@ void (*idle)(void) = default_idle; void cpu_idle (void) { /* endless idle loop with no priority at all */ - (*idle) (); + while (1) { + while (!need_resched()) + (*idle) (); + + preempt_enable_no_resched(); + schedule(); + preempt_disable(); + } } /* diff --git a/arch/x86_64/kernel/process.c b/arch/x86_64/kernel/process.c index b5a89c0bdf59..571f9fe490ce 100644 --- a/arch/x86_64/kernel/process.c +++ b/arch/x86_64/kernel/process.c @@ -204,7 +204,9 @@ void cpu_idle (void) idle(); } + preempt_enable_no_resched(); schedule(); + preempt_disable(); } } diff --git a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c index 4b5b088ec102..c4e59bbdc187 100644 --- a/arch/x86_64/kernel/smpboot.c +++ b/arch/x86_64/kernel/smpboot.c @@ -472,6 +472,7 @@ void __cpuinit start_secondary(void) * things done here to the most necessary things. */ cpu_init(); + preempt_disable(); smp_callin(); /* otherwise gcc will move up the smp_processor_id before the cpu_init */ diff --git a/arch/xtensa/kernel/process.c b/arch/xtensa/kernel/process.c index 08ef6d82ee51..6a44b54ae817 100644 --- a/arch/xtensa/kernel/process.c +++ b/arch/xtensa/kernel/process.c @@ -96,8 +96,9 @@ void cpu_idle(void) while (1) { while (!need_resched()) platform_idle(); - preempt_enable(); + preempt_enable_no_resched(); schedule(); + preempt_disable(); } } diff --git a/init/main.c b/init/main.c index f142d4035341..27f97f9b4636 100644 --- a/init/main.c +++ b/init/main.c @@ -394,14 +394,16 @@ static void noinline rest_init(void) kernel_thread(init, NULL, CLONE_FS | CLONE_SIGHAND); numa_default_policy(); unlock_kernel(); - preempt_enable_no_resched(); /* * The boot idle thread must execute schedule() * at least one to get things moving: */ + preempt_enable_no_resched(); schedule(); + preempt_disable(); + /* Call into cpu_idle with preempt disabled */ cpu_idle(); } -- cgit v1.2.2 From 64c7c8f88559624abdbe12b5da6502e8879f8d28 Mon Sep 17 00:00:00 2001 From: Nick Piggin Date: Tue, 8 Nov 2005 21:39:04 -0800 Subject: [PATCH] sched: resched and cpu_idle rework Make some changes to the NEED_RESCHED and POLLING_NRFLAG to reduce confusion, and make their semantics rigid. Improves efficiency of resched_task and some cpu_idle routines. * In resched_task: - TIF_NEED_RESCHED is only cleared with the task's runqueue lock held, and as we hold it during resched_task, then there is no need for an atomic test and set there. The only other time this should be set is when the task's quantum expires, in the timer interrupt - this is protected against because the rq lock is irq-safe. - If TIF_NEED_RESCHED is set, then we don't need to do anything. It won't get unset until the task get's schedule()d off. - If we are running on the same CPU as the task we resched, then set TIF_NEED_RESCHED and no further action is required. - If we are running on another CPU, and TIF_POLLING_NRFLAG is *not* set after TIF_NEED_RESCHED has been set, then we need to send an IPI. Using these rules, we are able to remove the test and set operation in resched_task, and make clear the previously vague semantics of POLLING_NRFLAG. * In idle routines: - Enter cpu_idle with preempt disabled. When the need_resched() condition becomes true, explicitly call schedule(). This makes things a bit clearer (IMO), but haven't updated all architectures yet. - Many do a test and clear of TIF_NEED_RESCHED for some reason. According to the resched_task rules, this isn't needed (and actually breaks the assumption that TIF_NEED_RESCHED is only cleared with the runqueue lock held). So remove that. Generally one less locked memory op when switching to the idle thread. - Many idle routines clear TIF_POLLING_NRFLAG, and only set it in the inner most polling idle loops. The above resched_task semantics allow it to be set until before the last time need_resched() is checked before going into a halt requiring interrupt wakeup. Many idle routines simply never enter such a halt, and so POLLING_NRFLAG can be always left set, completely eliminating resched IPIs when rescheduling the idle task. POLLING_NRFLAG width can be increased, to reduce the chance of resched IPIs. Signed-off-by: Nick Piggin Cc: Ingo Molnar Cc: Con Kolivas Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/sched-arch.txt | 89 ++++++++++++++++++++++++++++++++++ arch/alpha/kernel/process.c | 10 ++-- arch/arm/kernel/process.c | 14 ++++-- arch/i386/kernel/apm.c | 20 +++++++- arch/i386/kernel/process.c | 64 +++++++++++------------- arch/ia64/kernel/process.c | 32 ++++++------ arch/parisc/kernel/process.c | 2 + arch/powerpc/platforms/iseries/setup.c | 10 +--- arch/powerpc/platforms/pseries/setup.c | 12 ++--- arch/ppc/kernel/idle.c | 20 ++++---- arch/ppc64/kernel/idle.c | 11 +---- arch/s390/kernel/process.c | 13 ++--- arch/sh/kernel/process.c | 12 ++--- arch/sh64/kernel/process.c | 14 ++---- arch/sparc/kernel/process.c | 35 ++++++------- arch/sparc64/kernel/process.c | 20 +++++--- arch/sparc64/kernel/smp.c | 13 +---- arch/x86_64/kernel/process.c | 67 ++++++++++++------------- drivers/acpi/processor_idle.c | 37 ++++++++------ kernel/sched.c | 21 +++++--- 20 files changed, 296 insertions(+), 220 deletions(-) create mode 100644 Documentation/sched-arch.txt diff --git a/Documentation/sched-arch.txt b/Documentation/sched-arch.txt new file mode 100644 index 000000000000..941615a9769b --- /dev/null +++ b/Documentation/sched-arch.txt @@ -0,0 +1,89 @@ + CPU Scheduler implementation hints for architecture specific code + + Nick Piggin, 2005 + +Context switch +============== +1. Runqueue locking +By default, the switch_to arch function is called with the runqueue +locked. This is usually not a problem unless switch_to may need to +take the runqueue lock. This is usually due to a wake up operation in +the context switch. See include/asm-ia64/system.h for an example. + +To request the scheduler call switch_to with the runqueue unlocked, +you must `#define __ARCH_WANT_UNLOCKED_CTXSW` in a header file +(typically the one where switch_to is defined). + +Unlocked context switches introduce only a very minor performance +penalty to the core scheduler implementation in the CONFIG_SMP case. + +2. Interrupt status +By default, the switch_to arch function is called with interrupts +disabled. Interrupts may be enabled over the call if it is likely to +introduce a significant interrupt latency by adding the line +`#define __ARCH_WANT_INTERRUPTS_ON_CTXSW` in the same place as for +unlocked context switches. This define also implies +`__ARCH_WANT_UNLOCKED_CTXSW`. See include/asm-arm/system.h for an +example. + + +CPU idle +======== +Your cpu_idle routines need to obey the following rules: + +1. Preempt should now disabled over idle routines. Should only + be enabled to call schedule() then disabled again. + +2. need_resched/TIF_NEED_RESCHED is only ever set, and will never + be cleared until the running task has called schedule(). Idle + threads need only ever query need_resched, and may never set or + clear it. + +3. When cpu_idle finds (need_resched() == 'true'), it should call + schedule(). It should not call schedule() otherwise. + +4. The only time interrupts need to be disabled when checking + need_resched is if we are about to sleep the processor until + the next interrupt (this doesn't provide any protection of + need_resched, it prevents losing an interrupt). + + 4a. Common problem with this type of sleep appears to be: + local_irq_disable(); + if (!need_resched()) { + local_irq_enable(); + *** resched interrupt arrives here *** + __asm__("sleep until next interrupt"); + } + +5. TIF_POLLING_NRFLAG can be set by idle routines that do not + need an interrupt to wake them up when need_resched goes high. + In other words, they must be periodically polling need_resched, + although it may be reasonable to do some background work or enter + a low CPU priority. + + 5a. If TIF_POLLING_NRFLAG is set, and we do decide to enter + an interrupt sleep, it needs to be cleared then a memory + barrier issued (followed by a test of need_resched with + interrupts disabled, as explained in 3). + +arch/i386/kernel/process.c has examples of both polling and +sleeping idle functions. + + +Possible arch/ problems +======================= + +Possible arch problems I found (and either tried to fix or didn't): + +h8300 - Is such sleeping racy vs interrupts? (See #4a). + The H8/300 manual I found indicates yes, however disabling IRQs + over the sleep mean only NMIs can wake it up, so can't fix easily + without doing spin waiting. + +ia64 - is safe_halt call racy vs interrupts? (does it sleep?) (See #4a) + +sh64 - Is sleeping racy vs interrupts? (See #4a) + +sparc - IRQs on at this point(?), change local_irq_save to _disable. + - TODO: needs secondary CPUs to disable preempt (See #1) + diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c index eb20c3afff58..a8682612abc0 100644 --- a/arch/alpha/kernel/process.c +++ b/arch/alpha/kernel/process.c @@ -43,21 +43,17 @@ #include "proto.h" #include "pci_impl.h" -void default_idle(void) -{ - barrier(); -} - void cpu_idle(void) { + set_thread_flag(TIF_POLLING_NRFLAG); + while (1) { - void (*idle)(void) = default_idle; /* FIXME -- EV6 and LCA45 know how to power down the CPU. */ while (!need_resched()) - idle(); + cpu_relax(); schedule(); } } diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index 93dd92cc12f8..c0f6a119de3b 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c @@ -86,12 +86,16 @@ EXPORT_SYMBOL(pm_power_off); */ void default_idle(void) { - local_irq_disable(); - if (!need_resched() && !hlt_counter) { - timer_dyn_reprogram(); - arch_idle(); + if (hlt_counter) + cpu_relax(); + else { + local_irq_disable(); + if (!need_resched()) { + timer_dyn_reprogram(); + arch_idle(); + } + local_irq_enable(); } - local_irq_enable(); } /* diff --git a/arch/i386/kernel/apm.c b/arch/i386/kernel/apm.c index 86e80c551478..003548b8735f 100644 --- a/arch/i386/kernel/apm.c +++ b/arch/i386/kernel/apm.c @@ -769,8 +769,26 @@ static int set_system_power_state(u_short state) static int apm_do_idle(void) { u32 eax; + u8 ret = 0; + int idled = 0; + int polling; + + polling = test_thread_flag(TIF_POLLING_NRFLAG); + if (polling) { + clear_thread_flag(TIF_POLLING_NRFLAG); + smp_mb__after_clear_bit(); + } + if (!need_resched()) { + idled = 1; + ret = apm_bios_call_simple(APM_FUNC_IDLE, 0, 0, &eax); + } + if (polling) + set_thread_flag(TIF_POLLING_NRFLAG); + + if (!idled) + return 0; - if (apm_bios_call_simple(APM_FUNC_IDLE, 0, 0, &eax)) { + if (ret) { static unsigned long t; /* This always fails on some SMP boards running UP kernels. diff --git a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c index 5296e284ea36..1cb261f225d5 100644 --- a/arch/i386/kernel/process.c +++ b/arch/i386/kernel/process.c @@ -99,14 +99,22 @@ EXPORT_SYMBOL(enable_hlt); */ void default_idle(void) { + local_irq_enable(); + if (!hlt_counter && boot_cpu_data.hlt_works_ok) { - local_irq_disable(); - if (!need_resched()) - safe_halt(); - else - local_irq_enable(); + clear_thread_flag(TIF_POLLING_NRFLAG); + smp_mb__after_clear_bit(); + while (!need_resched()) { + local_irq_disable(); + if (!need_resched()) + safe_halt(); + else + local_irq_enable(); + } + set_thread_flag(TIF_POLLING_NRFLAG); } else { - cpu_relax(); + while (!need_resched()) + cpu_relax(); } } #ifdef CONFIG_APM_MODULE @@ -120,29 +128,14 @@ EXPORT_SYMBOL(default_idle); */ static void poll_idle (void) { - int oldval; - local_irq_enable(); - /* - * Deal with another CPU just having chosen a thread to - * run here: - */ - oldval = test_and_clear_thread_flag(TIF_NEED_RESCHED); - - if (!oldval) { - set_thread_flag(TIF_POLLING_NRFLAG); - asm volatile( - "2:" - "testl %0, %1;" - "rep; nop;" - "je 2b;" - : : "i"(_TIF_NEED_RESCHED), "m" (current_thread_info()->flags)); - - clear_thread_flag(TIF_POLLING_NRFLAG); - } else { - set_need_resched(); - } + asm volatile( + "2:" + "testl %0, %1;" + "rep; nop;" + "je 2b;" + : : "i"(_TIF_NEED_RESCHED), "m" (current_thread_info()->flags)); } #ifdef CONFIG_HOTPLUG_CPU @@ -181,6 +174,8 @@ void cpu_idle(void) { int cpu = smp_processor_id(); + set_thread_flag(TIF_POLLING_NRFLAG); + /* endless idle loop with no priority at all */ while (1) { while (!need_resched()) { @@ -246,15 +241,12 @@ static void mwait_idle(void) { local_irq_enable(); - if (!need_resched()) { - set_thread_flag(TIF_POLLING_NRFLAG); - do { - __monitor((void *)¤t_thread_info()->flags, 0, 0); - if (need_resched()) - break; - __mwait(0, 0); - } while (!need_resched()); - clear_thread_flag(TIF_POLLING_NRFLAG); + while (!need_resched()) { + __monitor((void *)¤t_thread_info()->flags, 0, 0); + smp_mb(); + if (need_resched()) + break; + __mwait(0, 0); } } diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c index 4c621fc3c3b9..640d6908f8ec 100644 --- a/arch/ia64/kernel/process.c +++ b/arch/ia64/kernel/process.c @@ -197,11 +197,15 @@ void default_idle (void) { local_irq_enable(); - while (!need_resched()) - if (can_do_pal_halt) - safe_halt(); - else + while (!need_resched()) { + if (can_do_pal_halt) { + local_irq_disable(); + if (!need_resched()) + safe_halt(); + local_irq_enable(); + } else cpu_relax(); + } } #ifdef CONFIG_HOTPLUG_CPU @@ -263,16 +267,16 @@ void __attribute__((noreturn)) cpu_idle (void) { void (*mark_idle)(int) = ia64_mark_idle; + int cpu = smp_processor_id(); + set_thread_flag(TIF_POLLING_NRFLAG); /* endless idle loop with no priority at all */ while (1) { + if (!need_resched()) { + void (*idle)(void); #ifdef CONFIG_SMP - if (!need_resched()) min_xtp(); #endif - while (!need_resched()) { - void (*idle)(void); - if (__get_cpu_var(cpu_idle_state)) __get_cpu_var(cpu_idle_state) = 0; @@ -284,19 +288,17 @@ cpu_idle (void) if (!idle) idle = default_idle; (*idle)(); - } - - if (mark_idle) - (*mark_idle)(0); - + if (mark_idle) + (*mark_idle)(0); #ifdef CONFIG_SMP - normal_xtp(); + normal_xtp(); #endif + } preempt_enable_no_resched(); schedule(); preempt_disable(); check_pgt_cache(); - if (cpu_is_offline(smp_processor_id())) + if (cpu_is_offline(cpu)) play_dead(); } } diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c index f482f78de435..fee4f1f09adc 100644 --- a/arch/parisc/kernel/process.c +++ b/arch/parisc/kernel/process.c @@ -88,6 +88,8 @@ void default_idle(void) */ void cpu_idle(void) { + set_thread_flag(TIF_POLLING_NRFLAG); + /* endless idle loop with no priority at all */ while (1) { while (!need_resched()) diff --git a/arch/powerpc/platforms/iseries/setup.c b/arch/powerpc/platforms/iseries/setup.c index 0130f2619dac..7f8f0cda6a74 100644 --- a/arch/powerpc/platforms/iseries/setup.c +++ b/arch/powerpc/platforms/iseries/setup.c @@ -703,13 +703,10 @@ static void iseries_shared_idle(void) static void iseries_dedicated_idle(void) { long oldval; + set_thread_flag(TIF_POLLING_NRFLAG); while (1) { - oldval = test_and_clear_thread_flag(TIF_NEED_RESCHED); - - if (!oldval) { - set_thread_flag(TIF_POLLING_NRFLAG); - + if (!need_resched()) { while (!need_resched()) { ppc64_runlatch_off(); HMT_low(); @@ -722,9 +719,6 @@ static void iseries_dedicated_idle(void) } HMT_medium(); - clear_thread_flag(TIF_POLLING_NRFLAG); - } else { - set_need_resched(); } ppc64_runlatch_on(); diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c index 4854f5eb5c3d..a093a0d4dd69 100644 --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c @@ -469,6 +469,7 @@ static inline void dedicated_idle_sleep(unsigned int cpu) * more. */ clear_thread_flag(TIF_POLLING_NRFLAG); + smp_mb__after_clear_bit(); /* * SMT dynamic mode. Cede will result in this thread going @@ -481,6 +482,7 @@ static inline void dedicated_idle_sleep(unsigned int cpu) cede_processor(); else local_irq_enable(); + set_thread_flag(TIF_POLLING_NRFLAG); } else { /* * Give the HV an opportunity at the processor, since we are @@ -492,11 +494,11 @@ static inline void dedicated_idle_sleep(unsigned int cpu) static void pseries_dedicated_idle(void) { - long oldval; struct paca_struct *lpaca = get_paca(); unsigned int cpu = smp_processor_id(); unsigned long start_snooze; unsigned long *smt_snooze_delay = &__get_cpu_var(smt_snooze_delay); + set_thread_flag(TIF_POLLING_NRFLAG); while (1) { /* @@ -505,10 +507,7 @@ static void pseries_dedicated_idle(void) */ lpaca->lppaca.idle = 1; - oldval = test_and_clear_thread_flag(TIF_NEED_RESCHED); - if (!oldval) { - set_thread_flag(TIF_POLLING_NRFLAG); - + if (!need_resched()) { start_snooze = __get_tb() + *smt_snooze_delay * tb_ticks_per_usec; @@ -531,9 +530,6 @@ static void pseries_dedicated_idle(void) } HMT_medium(); - clear_thread_flag(TIF_POLLING_NRFLAG); - } else { - set_need_resched(); } lpaca->lppaca.idle = 0; diff --git a/arch/ppc/kernel/idle.c b/arch/ppc/kernel/idle.c index a6141f05c919..3c4e4cb61074 100644 --- a/arch/ppc/kernel/idle.c +++ b/arch/ppc/kernel/idle.c @@ -63,18 +63,18 @@ void cpu_idle(void) int cpu = smp_processor_id(); for (;;) { - if (ppc_md.idle != NULL) - ppc_md.idle(); - else - default_idle(); - if (cpu_is_offline(cpu) && system_state == SYSTEM_RUNNING) - cpu_die(); - if (need_resched()) { - preempt_enable_no_resched(); - schedule(); - preempt_disable(); + while (need_resched()) { + if (ppc_md.idle != NULL) + ppc_md.idle(); + else + default_idle(); } + if (cpu_is_offline(cpu) && system_state == SYSTEM_RUNNING) + cpu_die(); + preempt_enable_no_resched(); + schedule(); + preempt_disable(); } } diff --git a/arch/ppc64/kernel/idle.c b/arch/ppc64/kernel/idle.c index 909ea669af91..715bc0e71e0f 100644 --- a/arch/ppc64/kernel/idle.c +++ b/arch/ppc64/kernel/idle.c @@ -34,15 +34,11 @@ extern void power4_idle(void); void default_idle(void) { - long oldval; unsigned int cpu = smp_processor_id(); + set_thread_flag(TIF_POLLING_NRFLAG); while (1) { - oldval = test_and_clear_thread_flag(TIF_NEED_RESCHED); - - if (!oldval) { - set_thread_flag(TIF_POLLING_NRFLAG); - + if (!need_resched()) { while (!need_resched() && !cpu_is_offline(cpu)) { ppc64_runlatch_off(); @@ -55,9 +51,6 @@ void default_idle(void) } HMT_medium(); - clear_thread_flag(TIF_POLLING_NRFLAG); - } else { - set_need_resched(); } ppc64_runlatch_on(); diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c index 66ca5757e368..78b64fe5e7c2 100644 --- a/arch/s390/kernel/process.c +++ b/arch/s390/kernel/process.c @@ -99,14 +99,15 @@ void default_idle(void) { int cpu, rc; + /* CPU is going idle. */ + cpu = smp_processor_id(); + local_irq_disable(); - if (need_resched()) { + if (need_resched()) { local_irq_enable(); - return; - } + return; + } - /* CPU is going idle. */ - cpu = smp_processor_id(); rc = notifier_call_chain(&idle_chain, CPU_IDLE, (void *)(long) cpu); if (rc != NOTIFY_OK && rc != NOTIFY_DONE) BUG(); @@ -119,7 +120,7 @@ void default_idle(void) __ctl_set_bit(8, 15); #ifdef CONFIG_HOTPLUG_CPU - if (cpu_is_offline(smp_processor_id())) + if (cpu_is_offline(cpu)) cpu_die(); #endif diff --git a/arch/sh/kernel/process.c b/arch/sh/kernel/process.c index 1cbc26b796ad..fd4f240b833d 100644 --- a/arch/sh/kernel/process.c +++ b/arch/sh/kernel/process.c @@ -51,14 +51,13 @@ void enable_hlt(void) EXPORT_SYMBOL(enable_hlt); -void default_idle(void) +void cpu_idle(void) { /* endless idle loop with no priority at all */ while (1) { if (hlt_counter) { - while (1) - if (need_resched()) - break; + while (!need_resched()) + cpu_relax(); } else { while (!need_resched()) cpu_sleep(); @@ -70,11 +69,6 @@ void default_idle(void) } } -void cpu_idle(void) -{ - default_idle(); -} - void machine_restart(char * __unused) { /* SR.BL=1 and invoke address error to let CPU reset (manual reset) */ diff --git a/arch/sh64/kernel/process.c b/arch/sh64/kernel/process.c index 0c09537449b3..b95d04141855 100644 --- a/arch/sh64/kernel/process.c +++ b/arch/sh64/kernel/process.c @@ -307,23 +307,19 @@ __setup("hlt", hlt_setup); static inline void hlt(void) { - if (hlt_counter) - return; - __asm__ __volatile__ ("sleep" : : : "memory"); } /* * The idle loop on a uniprocessor SH.. */ -void default_idle(void) +void cpu_idle(void) { /* endless idle loop with no priority at all */ while (1) { if (hlt_counter) { - while (1) - if (need_resched()) - break; + while (!need_resched()) + cpu_relax(); } else { local_irq_disable(); while (!need_resched()) { @@ -338,11 +334,7 @@ void default_idle(void) schedule(); preempt_disable(); } -} -void cpu_idle(void) -{ - default_idle(); } void machine_restart(char * __unused) diff --git a/arch/sparc/kernel/process.c b/arch/sparc/kernel/process.c index c39f4d01096d..ea8647411462 100644 --- a/arch/sparc/kernel/process.c +++ b/arch/sparc/kernel/process.c @@ -67,13 +67,6 @@ extern void fpsave(unsigned long *, unsigned long *, void *, unsigned long *); struct task_struct *last_task_used_math = NULL; struct thread_info *current_set[NR_CPUS]; -/* - * default_idle is new in 2.5. XXX Review, currently stolen from sparc64. - */ -void default_idle(void) -{ -} - #ifndef CONFIG_SMP #define SUN4C_FAULT_HIGH 100 @@ -92,12 +85,11 @@ void cpu_idle(void) static unsigned long fps; unsigned long now; unsigned long faults; - unsigned long flags; extern unsigned long sun4c_kernel_faults; extern void sun4c_grow_kernel_ring(void); - local_irq_save(flags); + local_irq_disable(); now = jiffies; count -= (now - last_jiffies); last_jiffies = now; @@ -113,13 +105,16 @@ void cpu_idle(void) sun4c_grow_kernel_ring(); } } - local_irq_restore(flags); + local_irq_enable(); } - while((!need_resched()) && pm_idle) { - (*pm_idle)(); + if (pm_idle) { + while (!need_resched()) + (*pm_idle)(); + } else { + while (!need_resched()) + cpu_relax(); } - preempt_enable_no_resched(); schedule(); preempt_disable(); @@ -132,15 +127,15 @@ void cpu_idle(void) /* This is being executed in task 0 'user space'. */ void cpu_idle(void) { + set_thread_flag(TIF_POLLING_NRFLAG); /* endless idle loop with no priority at all */ while(1) { - if(need_resched()) { - preempt_enable_no_resched(); - schedule(); - preempt_disable(); - check_pgt_cache(); - } - barrier(); /* or else gcc optimizes... */ + while (!need_resched()) + cpu_relax(); + preempt_enable_no_resched(); + schedule(); + preempt_disable(); + check_pgt_cache(); } } diff --git a/arch/sparc64/kernel/process.c b/arch/sparc64/kernel/process.c index 2f89206e008f..02f9dec1d459 100644 --- a/arch/sparc64/kernel/process.c +++ b/arch/sparc64/kernel/process.c @@ -85,23 +85,31 @@ void cpu_idle(void) /* * the idle loop on a UltraMultiPenguin... + * + * TIF_POLLING_NRFLAG is set because we do not sleep the cpu + * inside of the idler task, so an interrupt is not needed + * to get a clean fast response. + * + * XXX Reverify this assumption... -DaveM + * + * Addendum: We do want it to do something for the signal + * delivery case, we detect that by just seeing + * if we are trying to send this to an idler or not. */ -#define idle_me_harder() (cpu_data(smp_processor_id()).idle_volume += 1) -#define unidle_me() (cpu_data(smp_processor_id()).idle_volume = 0) void cpu_idle(void) { + cpuinfo_sparc *cpuinfo = &local_cpu_data(); set_thread_flag(TIF_POLLING_NRFLAG); + while(1) { if (need_resched()) { - unidle_me(); - clear_thread_flag(TIF_POLLING_NRFLAG); + cpuinfo->idle_volume = 0; preempt_enable_no_resched(); schedule(); preempt_disable(); - set_thread_flag(TIF_POLLING_NRFLAG); check_pgt_cache(); } - idle_me_harder(); + cpuinfo->idle_volume++; /* The store ordering is so that IRQ handlers on * other cpus see our increasing idleness for the buddy diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c index 8aca4b1dc04e..797a65493fb8 100644 --- a/arch/sparc64/kernel/smp.c +++ b/arch/sparc64/kernel/smp.c @@ -1152,20 +1152,9 @@ void __init smp_cpus_done(unsigned int max_cpus) (bogosum/(5000/HZ))%100); } -/* This needn't do anything as we do not sleep the cpu - * inside of the idler task, so an interrupt is not needed - * to get a clean fast response. - * - * XXX Reverify this assumption... -DaveM - * - * Addendum: We do want it to do something for the signal - * delivery case, we detect that by just seeing - * if we are trying to send this to an idler or not. - */ void smp_send_reschedule(int cpu) { - if (cpu_data(cpu).idle_volume == 0) - smp_receive_signal(cpu); + smp_receive_signal(cpu); } /* This is a nop because we capture all other cpus diff --git a/arch/x86_64/kernel/process.c b/arch/x86_64/kernel/process.c index 571f9fe490ce..59be85d9a4bc 100644 --- a/arch/x86_64/kernel/process.c +++ b/arch/x86_64/kernel/process.c @@ -86,12 +86,22 @@ EXPORT_SYMBOL(enable_hlt); */ void default_idle(void) { + local_irq_enable(); + if (!atomic_read(&hlt_counter)) { - local_irq_disable(); - if (!need_resched()) - safe_halt(); - else - local_irq_enable(); + clear_thread_flag(TIF_POLLING_NRFLAG); + smp_mb__after_clear_bit(); + while (!need_resched()) { + local_irq_disable(); + if (!need_resched()) + safe_halt(); + else + local_irq_enable(); + } + set_thread_flag(TIF_POLLING_NRFLAG); + } else { + while (!need_resched()) + cpu_relax(); } } @@ -102,30 +112,16 @@ void default_idle(void) */ static void poll_idle (void) { - int oldval; - local_irq_enable(); - /* - * Deal with another CPU just having chosen a thread to - * run here: - */ - oldval = test_and_clear_thread_flag(TIF_NEED_RESCHED); - - if (!oldval) { - set_thread_flag(TIF_POLLING_NRFLAG); - asm volatile( - "2:" - "testl %0,%1;" - "rep; nop;" - "je 2b;" - : : - "i" (_TIF_NEED_RESCHED), - "m" (current_thread_info()->flags)); - clear_thread_flag(TIF_POLLING_NRFLAG); - } else { - set_need_resched(); - } + asm volatile( + "2:" + "testl %0,%1;" + "rep; nop;" + "je 2b;" + : : + "i" (_TIF_NEED_RESCHED), + "m" (current_thread_info()->flags)); } void cpu_idle_wait(void) @@ -187,6 +183,8 @@ static inline void play_dead(void) */ void cpu_idle (void) { + set_thread_flag(TIF_POLLING_NRFLAG); + /* endless idle loop with no priority at all */ while (1) { while (!need_resched()) { @@ -221,15 +219,12 @@ static void mwait_idle(void) { local_irq_enable(); - if (!need_resched()) { - set_thread_flag(TIF_POLLING_NRFLAG); - do { - __monitor((void *)¤t_thread_info()->flags, 0, 0); - if (need_resched()) - break; - __mwait(0, 0); - } while (!need_resched()); - clear_thread_flag(TIF_POLLING_NRFLAG); + while (!need_resched()) { + __monitor((void *)¤t_thread_info()->flags, 0, 0); + smp_mb(); + if (need_resched()) + break; + __mwait(0, 0); } } diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 161db4acfb91..573b6a97bb1f 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -167,6 +167,19 @@ acpi_processor_power_activate(struct acpi_processor *pr, return; } +static void acpi_safe_halt(void) +{ + int polling = test_thread_flag(TIF_POLLING_NRFLAG); + if (polling) { + clear_thread_flag(TIF_POLLING_NRFLAG); + smp_mb__after_clear_bit(); + } + if (!need_resched()) + safe_halt(); + if (polling) + set_thread_flag(TIF_POLLING_NRFLAG); +} + static atomic_t c3_cpu_count; static void acpi_processor_idle(void) @@ -177,7 +190,7 @@ static void acpi_processor_idle(void) int sleep_ticks = 0; u32 t1, t2 = 0; - pr = processors[raw_smp_processor_id()]; + pr = processors[smp_processor_id()]; if (!pr) return; @@ -197,8 +210,13 @@ static void acpi_processor_idle(void) } cx = pr->power.state; - if (!cx) - goto easy_out; + if (!cx) { + if (pm_idle_save) + pm_idle_save(); + else + acpi_safe_halt(); + return; + } /* * Check BM Activity @@ -278,7 +296,8 @@ static void acpi_processor_idle(void) if (pm_idle_save) pm_idle_save(); else - safe_halt(); + acpi_safe_halt(); + /* * TBD: Can't get time duration while in C1, as resumes * go to an ISR rather than here. Need to instrument @@ -414,16 +433,6 @@ static void acpi_processor_idle(void) */ if (next_state != pr->power.state) acpi_processor_power_activate(pr, next_state); - - return; - - easy_out: - /* do C1 instead of busy loop */ - if (pm_idle_save) - pm_idle_save(); - else - safe_halt(); - return; } static int acpi_processor_set_power_policy(struct acpi_processor *pr) diff --git a/kernel/sched.c b/kernel/sched.c index 0f2def822296..ac3f5cc3bb51 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -864,21 +864,28 @@ static void deactivate_task(struct task_struct *p, runqueue_t *rq) #ifdef CONFIG_SMP static void resched_task(task_t *p) { - int need_resched, nrpolling; + int cpu; assert_spin_locked(&task_rq(p)->lock); - /* minimise the chance of sending an interrupt to poll_idle() */ - nrpolling = test_tsk_thread_flag(p,TIF_POLLING_NRFLAG); - need_resched = test_and_set_tsk_thread_flag(p,TIF_NEED_RESCHED); - nrpolling |= test_tsk_thread_flag(p,TIF_POLLING_NRFLAG); + if (unlikely(test_tsk_thread_flag(p, TIF_NEED_RESCHED))) + return; + + set_tsk_thread_flag(p, TIF_NEED_RESCHED); + + cpu = task_cpu(p); + if (cpu == smp_processor_id()) + return; - if (!need_resched && !nrpolling && (task_cpu(p) != smp_processor_id())) - smp_send_reschedule(task_cpu(p)); + /* NEED_RESCHED must be visible before we test POLLING_NRFLAG */ + smp_mb(); + if (!test_tsk_thread_flag(p, TIF_POLLING_NRFLAG)) + smp_send_reschedule(cpu); } #else static inline void resched_task(task_t *p) { + assert_spin_locked(&task_rq(p)->lock); set_tsk_need_resched(p); } #endif -- cgit v1.2.2 From 6d83b0bb8e5efda28ce4a1abc78277f1d03e50e5 Mon Sep 17 00:00:00 2001 From: "Antonino A. Daplas" Date: Tue, 8 Nov 2005 21:39:05 -0800 Subject: [PATCH] savagefb: X-panning fixes The driver unconditionally sets xpanstep to 2. However, a value of 4 empirically works better at bpp = 8, and 2 for 16 and 32. This buglet was exposed by the rotation code. Second fix is the unconditional call to update_start() without verifying if the offsets are correct. Remove this call, it's not necessary and secondly, it causes a crash with invalid values. Signed-off-by: Antonino Daplas Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/video/savage/savagefb_driver.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/video/savage/savagefb_driver.c b/drivers/video/savage/savagefb_driver.c index f0dfb35e3191..09e2f2841901 100644 --- a/drivers/video/savage/savagefb_driver.c +++ b/drivers/video/savage/savagefb_driver.c @@ -1315,10 +1315,14 @@ static void savagefb_set_fix(struct fb_info *info) info->fix.line_length = info->var.xres_virtual * info->var.bits_per_pixel / 8; - if (info->var.bits_per_pixel == 8) + if (info->var.bits_per_pixel == 8) { info->fix.visual = FB_VISUAL_PSEUDOCOLOR; - else + info->fix.xpanstep = 4; + } else { info->fix.visual = FB_VISUAL_TRUECOLOR; + info->fix.xpanstep = 2; + } + } #if defined(CONFIG_FB_SAVAGE_ACCEL) @@ -1363,7 +1367,6 @@ static int savagefb_set_par (struct fb_info *info) par->minClock = 10000; savagefb_set_par_int (par); - savagefb_update_start (par, var); fb_set_cmap (&info->cmap, info); savagefb_set_fix(info); savagefb_set_clip(info); @@ -1873,7 +1876,6 @@ static int __devinit savage_init_fb_info (struct fb_info *info, info->fix.type = FB_TYPE_PACKED_PIXELS; info->fix.type_aux = 0; - info->fix.xpanstep = 2; info->fix.ypanstep = 1; info->fix.ywrapstep = 0; info->fix.accel = id->driver_data; -- cgit v1.2.2 From 1dfcdfae5783fc10d7f8fcc336de838a44e7636c Mon Sep 17 00:00:00 2001 From: Michael Hanselmann Date: Tue, 8 Nov 2005 21:39:06 -0800 Subject: [PATCH] fbdev: Framebuffer mode required for PowerBook Titanium This patch adds the framebuffer mode required for an Apple PowerBook G4 Titanium. Signed-off-by: Michael Hanselmann Signed-off-by: Antonino Daplas Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/video/modedb.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/video/modedb.c b/drivers/video/modedb.c index 1789a52d776a..1da2f84bdc25 100644 --- a/drivers/video/modedb.c +++ b/drivers/video/modedb.c @@ -251,6 +251,10 @@ static const struct fb_videomode modedb[] = { NULL, 60, 1920, 1200, 5177, 128, 336, 1, 38, 208, 3, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED + }, { + /* 1152x768, 60 Hz, PowerBook G4 Titanium I and II */ + NULL, 60, 1152, 768, 15386, 158, 26, 29, 3, 136, 6, + FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED }, }; -- cgit v1.2.2 From e4fc27618b75234b721c4a13d0e0d9d07e75e641 Mon Sep 17 00:00:00 2001 From: "Antonino A. Daplas" Date: Tue, 8 Nov 2005 21:39:09 -0800 Subject: [PATCH] fbcon: Console Rotation - Prepare fbcon for console rotation This patch series implements generic code to rotate the console at 90, 180, and 270 degrees. The implementation is completely done in the framebuffer console level, thus no changes to the framebuffer layer or to the drivers are needed. Console rotation is required by some Sharp-based devices where the natural orientation of the display is not at 0 degrees. Also, users that have displays that can pivot will benefit by having a console in portrait mode if they so desire. The choice to implement the code in the console layer rather than in the framebuffer layer is due to the following reasons: - it's fast - it does not require driver changes - it can coexist with devices that can rotate the display at the hardware level - it complements graphics applications that can do display rotation The changes to core fbcon are minimal-- recognition of the console rotation angle so it can swap directions, origins and axes (xres vs yres, xpanstep vs ypanstep, xoffset vs yoffset, etc) and storage of the rotation angle per display. The bulk of the code that does the actual drawing to the screen are placed in separate files. Each angle of rotation has separate methods (bmove, clear, putcs, cursor, update_start which is derived from update_var, and clear_margins). To mimimize processing time, the fontdata are pre-rotated at each console switch (only if the font or the angle has changed). The option can be compiled out (CONFIG_FRAMEBUFFER_CONSOLE_ROTATION = n) if rotation is not needed. Choosing the rotation angle can be done in several ways: 1. boot option fbcon=rotate:n, where n = 0 - normal n = 1 - 90 degrees (clockwise) n = 2 - 180 degrees (upside down) n = 3 - 270 degrees (counterclockwise) 2. echo n > /sys/class/graphics/fb[num]/con_rotate where n is the same as described above. It sets the angle of rotation of the current console 3 echo n > /sys/class/graphics/fb[num]/con_rotate_all where n is the same as described above. Globally sets the angle of rotation. GOTCHAS: The option, especially at angles of 90 and 270 degrees, will exercise the least used code of drivers. Namely, at these angles, panning is done in the x-axis, so it can reveal bugs in the driver if xpanstep is set incorrectly. A workaround is to set xpanstep = 0. Secondly, at these angles, the framebuffer memory access can be unaligned if (fontheight * bpp) % 32 ~= 0 which can reveal bugs in the drivers imageblit, fillrect and copyarea functions. (I think cfbfillrect may have this buglet). A workaround is to use a standard 8x16 font. Speed: The scrolling speed difference between 0 and 180 degrees is minimal, somewhere areound 1-2%. At 90 or 270 degress, speed drops down to a vicinity of 30-40%. This is understandable because the blit direction is across the framebuffer "direction." Scrolling will be helped at these angles if xpanstep is not equal to zero, use of 8x16 fonts, and setting xres_virtual >= xres * 2. Note: The code is tested on little-endian only, so I don't know if it will work in big-endian. Please let me know, it will take only less than a minute of your time. This patch prepares fbcon for console rotation and contains the following changes: - add rotate field in struct fbcon_ops to keep fbcon's current rotation angle - add con_rotate field in struct display to store per-display rotation angle - create a private copy of the current var to fbcon. This will prevent fbcon from directly manipulating info->var, especially the fields xoffset, yoffset and vmode. - add ability to swap pertinent axes (xres, yres; xpanstep, ypanstep; etc) depending on the rotation angle - change global update_var() (function that sets the screen start address) as an fbcon method update_start. This is required because the axes, start offset, and/or direction can be reversed depending on the rotation angle. - add fbcon method rotate_font() which will rotate each character bitmap to the correct angle of rotation. - add fbcon boot option 'rotate' to select the angle of rotation at bootime. Currently does nothing until all patches are applied. Signed-off-by: Antonino Daplas Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/video/console/Kconfig | 10 ++ drivers/video/console/bitblit.c | 46 +++---- drivers/video/console/fbcon.c | 285 +++++++++++++++++++++++++-------------- drivers/video/console/fbcon.h | 58 +++++++- drivers/video/console/tileblit.c | 13 ++ include/linux/fb.h | 12 +- 6 files changed, 286 insertions(+), 138 deletions(-) diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig index fadf7c5d216e..94c5f1392cce 100644 --- a/drivers/video/console/Kconfig +++ b/drivers/video/console/Kconfig @@ -101,6 +101,16 @@ config FRAMEBUFFER_CONSOLE help Low-level framebuffer-based console driver. +config FRAMEBUFFER_CONSOLE_ROTATION + bool "Framebuffer Console Rotation" + depends on FRAMEBUFFER_CONSOLE + help + Enable display rotation for the framebuffer console. This is done + in software and may be significantly slower than a normally oriented + display. Note that the rotation is done at the console level only + such that other users of the framebuffer will remain normally + oriented. + config STI_CONSOLE tristate "STI text console" depends on PARISC diff --git a/drivers/video/console/bitblit.c b/drivers/video/console/bitblit.c index 67857b3cfc8b..e65fc3ef7630 100644 --- a/drivers/video/console/bitblit.c +++ b/drivers/video/console/bitblit.c @@ -22,35 +22,6 @@ /* * Accelerated handlers. */ -#define FBCON_ATTRIBUTE_UNDERLINE 1 -#define FBCON_ATTRIBUTE_REVERSE 2 -#define FBCON_ATTRIBUTE_BOLD 4 - -static inline int real_y(struct display *p, int ypos) -{ - int rows = p->vrows; - - ypos += p->yscroll; - return ypos < rows ? ypos : ypos - rows; -} - - -static inline int get_attribute(struct fb_info *info, u16 c) -{ - int attribute = 0; - - if (fb_get_color_depth(&info->var, &info->fix) == 1) { - if (attr_underline(c)) - attribute |= FBCON_ATTRIBUTE_UNDERLINE; - if (attr_reverse(c)) - attribute |= FBCON_ATTRIBUTE_REVERSE; - if (attr_bold(c)) - attribute |= FBCON_ATTRIBUTE_BOLD; - } - - return attribute; -} - static inline void update_attr(u8 *dst, u8 *src, int attribute, struct vc_data *vc) { @@ -418,6 +389,18 @@ static void bit_cursor(struct vc_data *vc, struct fb_info *info, ops->cursor_reset = 0; } +static int bit_update_start(struct fb_info *info) +{ + struct fbcon_ops *ops = info->fbcon_par; + int err; + + err = fb_pan_display(info, &ops->var); + ops->var.xoffset = info->var.xoffset; + ops->var.yoffset = info->var.yoffset; + ops->var.vmode = info->var.vmode; + return err; +} + void fbcon_set_bitops(struct fbcon_ops *ops) { ops->bmove = bit_bmove; @@ -425,6 +408,11 @@ void fbcon_set_bitops(struct fbcon_ops *ops) ops->putcs = bit_putcs; ops->clear_margins = bit_clear_margins; ops->cursor = bit_cursor; + ops->update_start = bit_update_start; + ops->rotate_font = NULL; + + if (ops->rotate) + fbcon_set_rotate(ops); } EXPORT_SYMBOL(fbcon_set_bitops); diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c index 3cf1b61ff1f8..b5d678c73252 100644 --- a/drivers/video/console/fbcon.c +++ b/drivers/video/console/fbcon.c @@ -107,6 +107,8 @@ enum { }; struct display fb_display[MAX_NR_CONSOLES]; +EXPORT_SYMBOL(fb_display); + static signed char con2fb_map[MAX_NR_CONSOLES]; static signed char con2fb_map_boot[MAX_NR_CONSOLES]; static int logo_height; @@ -130,6 +132,9 @@ static char fontname[40]; /* current fb_info */ static int info_idx = -1; +/* console rotation */ +static int rotate; + static const struct consw fb_con; #define CM_SOFTBACK (8) @@ -176,7 +181,6 @@ static int fbcon_scrolldelta(struct vc_data *vc, int lines); /* * Internal routines */ -static __inline__ int real_y(struct display *p, int ypos); static __inline__ void ywrap_up(struct vc_data *vc, int count); static __inline__ void ywrap_down(struct vc_data *vc, int count); static __inline__ void ypan_up(struct vc_data *vc, int count); @@ -203,6 +207,13 @@ static irqreturn_t fb_vbl_detect(int irq, void *dummy, struct pt_regs *fp) } #endif +static inline void fbcon_set_rotation(struct fb_info *info, struct display *p) +{ + struct fbcon_ops *ops = info->fbcon_par; + + ops->rotate = FB_ROTATE_UR; +} + static inline int fbcon_is_inactive(struct vc_data *vc, struct fb_info *info) { struct fbcon_ops *ops = info->fbcon_par; @@ -422,6 +433,14 @@ static int __init fb_console_setup(char *this_opt) last_fb_vc = simple_strtoul(options, &options, 10) - 1; fbcon_is_default = 0; } + + if (!strncmp(options, "rotate:", 7)) { + options += 7; + if (*options) + rotate = simple_strtoul(options, &options, 0); + if (rotate > 3) + rotate = 0; + } } return 0; } @@ -558,16 +577,24 @@ static void set_blitting_type(struct vc_data *vc, struct fb_info *info, if ((info->flags & FBINFO_MISC_TILEBLITTING)) fbcon_set_tileops(vc, info, p, ops); - else + else { + struct display *disp; + + disp = (p) ? p : &fb_display[vc->vc_num]; + fbcon_set_rotation(info, disp); fbcon_set_bitops(ops); + } } #else static void set_blitting_type(struct vc_data *vc, struct fb_info *info, struct display *p) { struct fbcon_ops *ops = info->fbcon_par; + struct display *disp; info->flags &= ~FBINFO_MISC_TILEBLITTING; + disp = (p) ? p : &fb_display[vc->vc_num]; + fbcon_set_rotation(info, disp); fbcon_set_bitops(ops); } #endif /* CONFIG_MISC_TILEBLITTING */ @@ -627,6 +654,7 @@ static int con2fb_release_oldinfo(struct vc_data *vc, struct fb_info *oldinfo, fbcon_del_cursor_timer(oldinfo); kfree(ops->cursor_state.mask); kfree(ops->cursor_data); + kfree(ops->fontbuffer); kfree(oldinfo->fbcon_par); oldinfo->fbcon_par = NULL; module_put(oldinfo->fbops->owner); @@ -827,7 +855,9 @@ static const char *fbcon_startup(void) memset(ops, 0, sizeof(struct fbcon_ops)); ops->currcon = -1; ops->graphics = 1; + ops->cur_rotate = -1; info->fbcon_par = ops; + p->con_rotate = rotate; set_blitting_type(vc, info, NULL); if (info->fix.type != FB_TYPE_TEXT) { @@ -866,8 +896,10 @@ static const char *fbcon_startup(void) vc->vc_font.charcount = 256; /* FIXME Need to support more fonts */ } - cols = info->var.xres / vc->vc_font.width; - rows = info->var.yres / vc->vc_font.height; + cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres); + rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); + cols /= vc->vc_font.width; + rows /= vc->vc_font.height; vc_resize(vc, cols, rows); DPRINTK("mode: %s\n", info->fix.id); @@ -953,8 +985,6 @@ static void fbcon_init(struct vc_data *vc, int init) (info->fix.type == FB_TYPE_TEXT)) logo = 0; - info->var.xoffset = info->var.yoffset = p->yscroll = 0; /* reset wrap/pan */ - if (var_to_display(p, &info->var, info)) return; @@ -986,13 +1016,18 @@ static void fbcon_init(struct vc_data *vc, int init) if (!*vc->vc_uni_pagedir_loc) con_copy_unimap(vc, svc); + ops = info->fbcon_par; + p->con_rotate = rotate; + set_blitting_type(vc, info, NULL); + cols = vc->vc_cols; rows = vc->vc_rows; - new_cols = info->var.xres / vc->vc_font.width; - new_rows = info->var.yres / vc->vc_font.height; + new_cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres); + new_rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); + new_cols /= vc->vc_font.width; + new_rows /= vc->vc_font.height; vc_resize(vc, new_cols, new_rows); - ops = info->fbcon_par; /* * We must always set the mode. The mode of the previous console * driver could be in the same resolution but we are using different @@ -1030,6 +1065,12 @@ static void fbcon_init(struct vc_data *vc, int init) if (vc == svc && softback_buf) fbcon_update_softback(vc); + + if (ops->rotate_font && ops->rotate_font(info, vc, p)) { + ops->rotate = FB_ROTATE_UR; + set_blitting_type(vc, info, p); + } + } static void fbcon_deinit(struct vc_data *vc) @@ -1066,15 +1107,6 @@ static void fbcon_deinit(struct vc_data *vc) * restriction is simplicity & efficiency at the moment. */ -static __inline__ int real_y(struct display *p, int ypos) -{ - int rows = p->vrows; - - ypos += p->yscroll; - return ypos < rows ? ypos : ypos - rows; -} - - static void fbcon_clear(struct vc_data *vc, int sy, int sx, int height, int width) { @@ -1162,13 +1194,6 @@ static int scrollback_phys_max = 0; static int scrollback_max = 0; static int scrollback_current = 0; -static int update_var(int con, struct fb_info *info) -{ - if (con == ((struct fbcon_ops *)info->fbcon_par)->currcon) - return fb_pan_display(info, &info->var); - return 0; -} - /* * If no vc is existent yet, just set struct display */ @@ -1178,7 +1203,6 @@ static void fbcon_preset_disp(struct fb_info *info, struct fb_var_screeninfo *va struct display *p = &fb_display[unit]; struct display *t = &fb_display[fg_console]; - var->xoffset = var->yoffset = p->yscroll = 0; if (var_to_display(p, var, info)) return; @@ -1194,9 +1218,9 @@ static void fbcon_set_disp(struct fb_info *info, struct fb_var_screeninfo *var, struct display *p = &fb_display[vc->vc_num], *t; struct vc_data **default_mode = vc->vc_display_fg; struct vc_data *svc = *default_mode; + struct fbcon_ops *ops = info->fbcon_par; int rows, cols, charcnt = 256; - var->xoffset = var->yoffset = p->yscroll = 0; if (var_to_display(p, var, info)) return; t = &fb_display[svc->vc_num]; @@ -1213,9 +1237,10 @@ static void fbcon_set_disp(struct fb_info *info, struct fb_var_screeninfo *var, var->activate = FB_ACTIVATE_NOW; info->var.activate = var->activate; - info->var.yoffset = info->var.xoffset = 0; + var->yoffset = info->var.yoffset; + var->xoffset = info->var.xoffset; fb_set_var(info, var); - + ops->var = info->var; vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; if (charcnt == 256) { @@ -1231,9 +1256,12 @@ static void fbcon_set_disp(struct fb_info *info, struct fb_var_screeninfo *var, if (!*vc->vc_uni_pagedir_loc) con_copy_unimap(vc, svc); - cols = var->xres / vc->vc_font.width; - rows = var->yres / vc->vc_font.height; + cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres); + rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); + cols /= vc->vc_font.width; + rows /= vc->vc_font.height; vc_resize(vc, cols, rows); + if (CON_IS_VISIBLE(vc)) { update_screen(vc); if (softback_buf) @@ -1244,15 +1272,16 @@ static void fbcon_set_disp(struct fb_info *info, struct fb_var_screeninfo *var, static __inline__ void ywrap_up(struct vc_data *vc, int count) { struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; + struct fbcon_ops *ops = info->fbcon_par; struct display *p = &fb_display[vc->vc_num]; p->yscroll += count; if (p->yscroll >= p->vrows) /* Deal with wrap */ p->yscroll -= p->vrows; - info->var.xoffset = 0; - info->var.yoffset = p->yscroll * vc->vc_font.height; - info->var.vmode |= FB_VMODE_YWRAP; - update_var(vc->vc_num, info); + ops->var.xoffset = 0; + ops->var.yoffset = p->yscroll * vc->vc_font.height; + ops->var.vmode |= FB_VMODE_YWRAP; + ops->update_start(info); scrollback_max += count; if (scrollback_max > scrollback_phys_max) scrollback_max = scrollback_phys_max; @@ -1262,15 +1291,16 @@ static __inline__ void ywrap_up(struct vc_data *vc, int count) static __inline__ void ywrap_down(struct vc_data *vc, int count) { struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; + struct fbcon_ops *ops = info->fbcon_par; struct display *p = &fb_display[vc->vc_num]; p->yscroll -= count; if (p->yscroll < 0) /* Deal with wrap */ p->yscroll += p->vrows; - info->var.xoffset = 0; - info->var.yoffset = p->yscroll * vc->vc_font.height; - info->var.vmode |= FB_VMODE_YWRAP; - update_var(vc->vc_num, info); + ops->var.xoffset = 0; + ops->var.yoffset = p->yscroll * vc->vc_font.height; + ops->var.vmode |= FB_VMODE_YWRAP; + ops->update_start(info); scrollback_max -= count; if (scrollback_max < 0) scrollback_max = 0; @@ -1289,10 +1319,11 @@ static __inline__ void ypan_up(struct vc_data *vc, int count) 0, 0, 0, vc->vc_rows, vc->vc_cols); p->yscroll -= p->vrows - vc->vc_rows; } - info->var.xoffset = 0; - info->var.yoffset = p->yscroll * vc->vc_font.height; - info->var.vmode &= ~FB_VMODE_YWRAP; - update_var(vc->vc_num, info); + + ops->var.xoffset = 0; + ops->var.yoffset = p->yscroll * vc->vc_font.height; + ops->var.vmode &= ~FB_VMODE_YWRAP; + ops->update_start(info); fbcon_clear_margins(vc, 1); scrollback_max += count; if (scrollback_max > scrollback_phys_max) @@ -1303,6 +1334,7 @@ static __inline__ void ypan_up(struct vc_data *vc, int count) static __inline__ void ypan_up_redraw(struct vc_data *vc, int t, int count) { struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; + struct fbcon_ops *ops = info->fbcon_par; struct display *p = &fb_display[vc->vc_num]; int redraw = 0; @@ -1312,12 +1344,13 @@ static __inline__ void ypan_up_redraw(struct vc_data *vc, int t, int count) redraw = 1; } - info->var.xoffset = 0; - info->var.yoffset = p->yscroll * vc->vc_font.height; - info->var.vmode &= ~FB_VMODE_YWRAP; if (redraw) fbcon_redraw_move(vc, p, t + count, vc->vc_rows - count, t); - update_var(vc->vc_num, info); + + ops->var.xoffset = 0; + ops->var.yoffset = p->yscroll * vc->vc_font.height; + ops->var.vmode &= ~FB_VMODE_YWRAP; + ops->update_start(info); fbcon_clear_margins(vc, 1); scrollback_max += count; if (scrollback_max > scrollback_phys_max) @@ -1337,10 +1370,11 @@ static __inline__ void ypan_down(struct vc_data *vc, int count) 0, vc->vc_rows, vc->vc_cols); p->yscroll += p->vrows - vc->vc_rows; } - info->var.xoffset = 0; - info->var.yoffset = p->yscroll * vc->vc_font.height; - info->var.vmode &= ~FB_VMODE_YWRAP; - update_var(vc->vc_num, info); + + ops->var.xoffset = 0; + ops->var.yoffset = p->yscroll * vc->vc_font.height; + ops->var.vmode &= ~FB_VMODE_YWRAP; + ops->update_start(info); fbcon_clear_margins(vc, 1); scrollback_max -= count; if (scrollback_max < 0) @@ -1351,6 +1385,7 @@ static __inline__ void ypan_down(struct vc_data *vc, int count) static __inline__ void ypan_down_redraw(struct vc_data *vc, int t, int count) { struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; + struct fbcon_ops *ops = info->fbcon_par; struct display *p = &fb_display[vc->vc_num]; int redraw = 0; @@ -1359,12 +1394,14 @@ static __inline__ void ypan_down_redraw(struct vc_data *vc, int t, int count) p->yscroll += p->vrows - vc->vc_rows; redraw = 1; } - info->var.xoffset = 0; - info->var.yoffset = p->yscroll * vc->vc_font.height; - info->var.vmode &= ~FB_VMODE_YWRAP; + if (redraw) fbcon_redraw_move(vc, p, t, vc->vc_rows - count, t + count); - update_var(vc->vc_num, info); + + ops->var.xoffset = 0; + ops->var.yoffset = p->yscroll * vc->vc_font.height; + ops->var.vmode &= ~FB_VMODE_YWRAP; + ops->update_start(info); fbcon_clear_margins(vc, 1); scrollback_max -= count; if (scrollback_max < 0) @@ -1838,31 +1875,41 @@ static void fbcon_bmove_rec(struct vc_data *vc, struct display *p, int sy, int s height, width); } -static __inline__ void updatescrollmode(struct display *p, struct fb_info *info, +static __inline__ void updatescrollmode(struct display *p, + struct fb_info *info, struct vc_data *vc) { + struct fbcon_ops *ops = info->fbcon_par; int fh = vc->vc_font.height; int cap = info->flags; - int good_pan = (cap & FBINFO_HWACCEL_YPAN) - && divides(info->fix.ypanstep, vc->vc_font.height) - && info->var.yres_virtual > info->var.yres; - int good_wrap = (cap & FBINFO_HWACCEL_YWRAP) - && divides(info->fix.ywrapstep, vc->vc_font.height) - && divides(vc->vc_font.height, info->var.yres_virtual); + u16 t = 0; + int ypan = FBCON_SWAP(ops->rotate, info->fix.ypanstep, + info->fix.xpanstep); + int ywrap = FBCON_SWAP(ops->rotate, info->fix.ywrapstep, t); + int yres = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); + int vyres = FBCON_SWAP(ops->rotate, info->var.yres_virtual, + info->var.xres_virtual); + int good_pan = (cap & FBINFO_HWACCEL_YPAN) && + divides(ypan, vc->vc_font.height) && vyres > yres; + int good_wrap = (cap & FBINFO_HWACCEL_YWRAP) && + divides(ywrap, vc->vc_font.height) && + divides(vc->vc_font.height, vyres); int reading_fast = cap & FBINFO_READS_FAST; - int fast_copyarea = (cap & FBINFO_HWACCEL_COPYAREA) && !(cap & FBINFO_HWACCEL_DISABLED); - int fast_imageblit = (cap & FBINFO_HWACCEL_IMAGEBLIT) && !(cap & FBINFO_HWACCEL_DISABLED); - - p->vrows = info->var.yres_virtual/fh; - if (info->var.yres > (fh * (vc->vc_rows + 1))) - p->vrows -= (info->var.yres - (fh * vc->vc_rows)) / fh; - if ((info->var.yres % fh) && (info->var.yres_virtual % fh < - info->var.yres % fh)) + int fast_copyarea = (cap & FBINFO_HWACCEL_COPYAREA) && + !(cap & FBINFO_HWACCEL_DISABLED); + int fast_imageblit = (cap & FBINFO_HWACCEL_IMAGEBLIT) && + !(cap & FBINFO_HWACCEL_DISABLED); + + p->vrows = vyres/fh; + if (yres > (fh * (vc->vc_rows + 1))) + p->vrows -= (yres - (fh * vc->vc_rows)) / fh; + if ((yres % fh) && (vyres % fh < yres % fh)) p->vrows--; if (good_wrap || good_pan) { if (reading_fast || fast_copyarea) - p->scrollmode = good_wrap ? SCROLL_WRAP_MOVE : SCROLL_PAN_MOVE; + p->scrollmode = good_wrap ? + SCROLL_WRAP_MOVE : SCROLL_PAN_MOVE; else p->scrollmode = good_wrap ? SCROLL_REDRAW : SCROLL_PAN_REDRAW; @@ -1878,17 +1925,23 @@ static int fbcon_resize(struct vc_data *vc, unsigned int width, unsigned int height) { struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; + struct fbcon_ops *ops = info->fbcon_par; struct display *p = &fb_display[vc->vc_num]; struct fb_var_screeninfo var = info->var; - int x_diff, y_diff; - int fw = vc->vc_font.width; - int fh = vc->vc_font.height; - - var.xres = width * fw; - var.yres = height * fh; + int x_diff, y_diff, virt_w, virt_h, virt_fw, virt_fh; + + virt_w = FBCON_SWAP(ops->rotate, width, height); + virt_h = FBCON_SWAP(ops->rotate, height, width); + virt_fw = FBCON_SWAP(ops->rotate, vc->vc_font.width, + vc->vc_font.height); + virt_fh = FBCON_SWAP(ops->rotate, vc->vc_font.height, + vc->vc_font.width); + var.xres = virt_w * virt_fw; + var.yres = virt_h * virt_fh; x_diff = info->var.xres - var.xres; y_diff = info->var.yres - var.yres; - if (x_diff < 0 || x_diff > fw || (y_diff < 0 || y_diff > fh)) { + if (x_diff < 0 || x_diff > virt_fw || + y_diff < 0 || y_diff > virt_fh) { struct fb_videomode *mode; DPRINTK("attempting resize %ix%i\n", var.xres, var.yres); @@ -1898,7 +1951,7 @@ static int fbcon_resize(struct vc_data *vc, unsigned int width, display_to_var(&var, p); fb_videomode_to_var(&var, mode); - if (width > var.xres/fw || height > var.yres/fh) + if (virt_w > var.xres/virt_fw || virt_h > var.yres/virt_fh) return -EINVAL; DPRINTK("resize now %ix%i\n", var.xres, var.yres); @@ -1908,6 +1961,7 @@ static int fbcon_resize(struct vc_data *vc, unsigned int width, fb_set_var(info, &var); } var_to_display(p, &info->var, info); + ops->var = info->var; } updatescrollmode(p, info, vc); return 0; @@ -1916,11 +1970,13 @@ static int fbcon_resize(struct vc_data *vc, unsigned int width, static int fbcon_switch(struct vc_data *vc) { struct fb_info *info, *old_info = NULL; + struct fbcon_ops *ops; struct display *p = &fb_display[vc->vc_num]; struct fb_var_screeninfo var; int i, prev_console; info = registered_fb[con2fb_map[vc->vc_num]]; + ops = info->fbcon_par; if (softback_top) { if (softback_lines) @@ -1939,7 +1995,7 @@ static int fbcon_switch(struct vc_data *vc) logo_shown = FBCON_LOGO_CANSHOW; } - prev_console = ((struct fbcon_ops *)info->fbcon_par)->currcon; + prev_console = ops->currcon; if (prev_console != -1) old_info = registered_fb[con2fb_map[prev_console]]; /* @@ -1952,9 +2008,9 @@ static int fbcon_switch(struct vc_data *vc) */ for (i = 0; i < FB_MAX; i++) { if (registered_fb[i] != NULL && registered_fb[i]->fbcon_par) { - struct fbcon_ops *ops = registered_fb[i]->fbcon_par; + struct fbcon_ops *o = registered_fb[i]->fbcon_par; - ops->currcon = vc->vc_num; + o->currcon = vc->vc_num; } } memset(&var, 0, sizeof(struct fb_var_screeninfo)); @@ -1966,8 +2022,11 @@ static int fbcon_switch(struct vc_data *vc) * in fb_set_var() */ info->var.activate = var.activate; - info->var.yoffset = info->var.xoffset = p->yscroll = 0; + var.yoffset = info->var.yoffset; + var.xoffset = info->var.xoffset; + var.vmode = info->var.vmode; fb_set_var(info, &var); + ops->var = info->var; if (old_info != NULL && old_info != info) { if (info->fbops->fb_set_par) @@ -1977,7 +2036,12 @@ static int fbcon_switch(struct vc_data *vc) } set_blitting_type(vc, info, p); - ((struct fbcon_ops *)info->fbcon_par)->cursor_reset = 1; + ops->cursor_reset = 1; + + if (ops->rotate_font && ops->rotate_font(info, vc, p)) { + ops->rotate = FB_ROTATE_UR; + set_blitting_type(vc, info, p); + } vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; @@ -1997,10 +2061,11 @@ static int fbcon_switch(struct vc_data *vc) scrollback_phys_max = 0; break; } + scrollback_max = 0; scrollback_current = 0; - - update_var(vc->vc_num, info); + ops->var.xoffset = ops->var.yoffset = p->yscroll = 0; + ops->update_start(info); fbcon_set_palette(vc, color_table); fbcon_clear_margins(vc, 0); @@ -2047,6 +2112,7 @@ static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch) var.activate = FB_ACTIVATE_NOW | FB_ACTIVATE_FORCE; fb_set_var(info, &var); ops->graphics = 0; + ops->var = info->var; } } @@ -2135,6 +2201,7 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h, const u8 * data, int userfont) { struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; + struct fbcon_ops *ops = info->fbcon_par; struct display *p = &fb_display[vc->vc_num]; int resize; int cnt; @@ -2214,9 +2281,13 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h, } if (resize) { - /* reset wrap/pan */ - info->var.xoffset = info->var.yoffset = p->yscroll = 0; - vc_resize(vc, info->var.xres / w, info->var.yres / h); + int cols, rows; + + cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres); + rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); + cols /= w; + rows /= h; + vc_resize(vc, cols, rows); if (CON_IS_VISIBLE(vc) && softback_buf) fbcon_update_softback(vc); } else if (CON_IS_VISIBLE(vc) @@ -2444,6 +2515,7 @@ static void fbcon_invert_region(struct vc_data *vc, u16 * p, int cnt) static int fbcon_scrolldelta(struct vc_data *vc, int lines) { struct fb_info *info = registered_fb[con2fb_map[fg_console]]; + struct fbcon_ops *ops = info->fbcon_par; struct display *p = &fb_display[fg_console]; int offset, limit, scrollback_old; @@ -2520,9 +2592,11 @@ static int fbcon_scrolldelta(struct vc_data *vc, int lines) offset += limit; else if (offset >= limit) offset -= limit; - info->var.xoffset = 0; - info->var.yoffset = offset * vc->vc_font.height; - update_var(vc->vc_num, info); + + ops->var.xoffset = 0; + ops->var.yoffset = offset * vc->vc_font.height; + ops->update_start(info); + if (!scrollback_current) fbcon_cursor(vc, CM_DRAW); return 0; @@ -2570,22 +2644,25 @@ static void fbcon_modechanged(struct fb_info *info) if (!ops || ops->currcon < 0) return; vc = vc_cons[ops->currcon].d; - if (vc->vc_mode != KD_TEXT || registered_fb[con2fb_map[ops->currcon]] != info) + if (vc->vc_mode != KD_TEXT || + registered_fb[con2fb_map[ops->currcon]] != info) return; p = &fb_display[vc->vc_num]; - - info->var.xoffset = info->var.yoffset = p->yscroll = 0; + set_blitting_type(vc, info, p); if (CON_IS_VISIBLE(vc)) { var_to_display(p, &info->var, info); - cols = info->var.xres / vc->vc_font.width; - rows = info->var.yres / vc->vc_font.height; + cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres); + rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); + cols /= vc->vc_font.width; + rows /= vc->vc_font.height; vc_resize(vc, cols, rows); updatescrollmode(p, info, vc); scrollback_max = 0; scrollback_current = 0; - update_var(vc->vc_num, info); + ops->var.xoffset = ops->var.yoffset = p->yscroll = 0; + ops->update_start(info); fbcon_set_palette(vc, color_table); update_screen(vc); if (softback_buf) @@ -2610,18 +2687,20 @@ static void fbcon_set_all_vcs(struct fb_info *info) continue; p = &fb_display[vc->vc_num]; - - info->var.xoffset = info->var.yoffset = p->yscroll = 0; + set_blitting_type(vc, info, p); var_to_display(p, &info->var, info); - cols = info->var.xres / vc->vc_font.width; - rows = info->var.yres / vc->vc_font.height; + cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres); + rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); + cols /= vc->vc_font.width; + rows /= vc->vc_font.height; vc_resize(vc, cols, rows); if (CON_IS_VISIBLE(vc)) { updatescrollmode(p, info, vc); scrollback_max = 0; scrollback_current = 0; - update_var(vc->vc_num, info); + ops->var.xoffset = ops->var.yoffset = p->yscroll = 0; + ops->update_start(info); fbcon_set_palette(vc, color_table); update_screen(vc); if (softback_buf) diff --git a/drivers/video/console/fbcon.h b/drivers/video/console/fbcon.h index b68e0e2c2d16..846a5a4e736c 100644 --- a/drivers/video/console/fbcon.h +++ b/drivers/video/console/fbcon.h @@ -27,15 +27,15 @@ */ struct display { - /* Filled in by the frame buffer device */ - u_short inverse; /* != 0 text black on white as default */ /* Filled in by the low-level console driver */ const u_char *fontdata; int userfont; /* != 0 if fontdata kmalloc()ed */ u_short scrollmode; /* Scroll Method */ + u_short inverse; /* != 0 text black on white as default */ short yscroll; /* Hardware scrolling */ int vrows; /* number of virtual rows */ int cursor_shape; + int con_rotate; u32 xres_virtual; u32 yres_virtual; u32 height; @@ -52,6 +52,8 @@ struct display { struct fb_videomode *mode; }; +extern struct display fb_display[]; + struct fbcon_ops { void (*bmove)(struct vc_data *vc, struct fb_info *info, int sy, int sx, int dy, int dx, int height, int width); @@ -63,8 +65,12 @@ struct fbcon_ops { void (*clear_margins)(struct vc_data *vc, struct fb_info *info, int bottom_only); void (*cursor)(struct vc_data *vc, struct fb_info *info, - struct display *p, int mode, int softback_lines, int fg, int bg); - + struct display *p, int mode, int softback_lines, + int fg, int bg); + int (*update_start)(struct fb_info *info); + int (*rotate_font)(struct fb_info *info, struct vc_data *vc, + struct display *p); + struct fb_var_screeninfo var; /* copy of the current fb_var_screeninfo */ struct timer_list cursor_timer; /* Cursor timer */ struct fb_cursor cursor_state; int currcon; /* Current VC. */ @@ -73,7 +79,12 @@ struct fbcon_ops { int blank_state; int graphics; int flags; + int rotate; + int cur_rotate; char *cursor_data; + u8 *fontbuffer; + u8 *fontdata; + u32 fd_size; }; /* * Attribute Decoding @@ -168,4 +179,43 @@ extern void fbcon_set_tileops(struct vc_data *vc, struct fb_info *info, #endif extern void fbcon_set_bitops(struct fbcon_ops *ops); extern int soft_cursor(struct fb_info *info, struct fb_cursor *cursor); + +#define FBCON_ATTRIBUTE_UNDERLINE 1 +#define FBCON_ATTRIBUTE_REVERSE 2 +#define FBCON_ATTRIBUTE_BOLD 4 + +static inline int real_y(struct display *p, int ypos) +{ + int rows = p->vrows; + + ypos += p->yscroll; + return ypos < rows ? ypos : ypos - rows; +} + + +static inline int get_attribute(struct fb_info *info, u16 c) +{ + int attribute = 0; + + if (fb_get_color_depth(&info->var, &info->fix) == 1) { + if (attr_underline(c)) + attribute |= FBCON_ATTRIBUTE_UNDERLINE; + if (attr_reverse(c)) + attribute |= FBCON_ATTRIBUTE_REVERSE; + if (attr_bold(c)) + attribute |= FBCON_ATTRIBUTE_BOLD; + } + + return attribute; +} + +#define FBCON_SWAP(i,r,v) ({ \ + typeof(r) _r = (r); \ + typeof(v) _v = (v); \ + (void) (&_r == &_v); \ + (i == FB_ROTATE_UR || i == FB_ROTATE_UD) ? _r : _v; }) + +#define fbcon_set_rotate(x) do {} while(0) + #endif /* _VIDEO_FBCON_H */ + diff --git a/drivers/video/console/tileblit.c b/drivers/video/console/tileblit.c index 7f76e2c6a4a1..cb25324a5635 100644 --- a/drivers/video/console/tileblit.c +++ b/drivers/video/console/tileblit.c @@ -118,6 +118,18 @@ static void tile_cursor(struct vc_data *vc, struct fb_info *info, info->tileops->fb_tilecursor(info, &cursor); } +static int tile_update_start(struct fb_info *info) +{ + struct fbcon_ops *ops = info->fbcon_par; + int err; + + err = fb_pan_display(info, &ops->var); + ops->var.xoffset = info->var.xoffset; + ops->var.yoffset = info->var.yoffset; + ops->var.vmode = info->var.vmode; + return err; +} + void fbcon_set_tileops(struct vc_data *vc, struct fb_info *info, struct display *p, struct fbcon_ops *ops) { @@ -128,6 +140,7 @@ void fbcon_set_tileops(struct vc_data *vc, struct fb_info *info, ops->putcs = tile_putcs; ops->clear_margins = tile_clear_margins; ops->cursor = tile_cursor; + ops->update_start = tile_update_start; if (p) { map.width = vc->vc_font.width; diff --git a/include/linux/fb.h b/include/linux/fb.h index e7ff98e395f6..51791dc5d4dc 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -201,6 +201,14 @@ struct fb_bitfield { #define FB_VMODE_SMOOTH_XPAN 512 /* smooth xpan possible (internally used) */ #define FB_VMODE_CONUPDATE 512 /* don't update x/yoffset */ +/* + * Display rotation support + */ +#define FB_ROTATE_UR 0 +#define FB_ROTATE_CW 1 +#define FB_ROTATE_UD 2 +#define FB_ROTATE_CCW 3 + #define PICOS2KHZ(a) (1000000000UL/(a)) #define KHZ2PICOS(a) (1000000000UL/(a)) @@ -489,9 +497,9 @@ struct fb_cursor_user { #define FB_EVENT_MODE_DELETE 0x04 /* A driver registered itself */ #define FB_EVENT_FB_REGISTERED 0x05 -/* get console to framebuffer mapping */ +/* CONSOLE-SPECIFIC: get console to framebuffer mapping */ #define FB_EVENT_GET_CONSOLE_MAP 0x06 -/* set console to framebuffer mapping */ +/* CONSOLE-SPECIFIC: set console to framebuffer mapping */ #define FB_EVENT_SET_CONSOLE_MAP 0x07 /* A display blank is requested */ #define FB_EVENT_BLANK 0x08 -- cgit v1.2.2 From 9c44e5f6c211a9b7313ded897f3135ef7d9ad3e2 Mon Sep 17 00:00:00 2001 From: "Antonino A. Daplas" Date: Tue, 8 Nov 2005 21:39:10 -0800 Subject: [PATCH] fbcon: Console Rotation - Add support to rotate the logo Add support for rotating and positioning of the logo. Rotation and position depends on 'int rotate' parameter added to fb_prepare_logo() and fb_show_logo(). Signed-off-by: Antonino Daplas Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/video/console/fbcon.c | 5 +- drivers/video/fbmem.c | 130 +++++++++++++++++++++++++++++++++++++----- include/linux/fb.h | 4 +- 3 files changed, 122 insertions(+), 17 deletions(-) diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c index b5d678c73252..26935e231a1d 100644 --- a/drivers/video/console/fbcon.c +++ b/drivers/video/console/fbcon.c @@ -499,6 +499,7 @@ static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info, int cols, int rows, int new_cols, int new_rows) { /* Need to make room for the logo */ + struct fbcon_ops *ops = info->fbcon_par; int cnt, erase = vc->vc_video_erase_char, step; unsigned short *save = NULL, *r, *q; @@ -508,7 +509,7 @@ static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info, */ if (fb_get_color_depth(&info->var, &info->fix) == 1) erase &= ~0x400; - logo_height = fb_prepare_logo(info); + logo_height = fb_prepare_logo(info, ops->rotate); logo_lines = (logo_height + vc->vc_font.height - 1) / vc->vc_font.height; q = (unsigned short *) (vc->vc_origin + @@ -2073,7 +2074,7 @@ static int fbcon_switch(struct vc_data *vc) logo_shown = fg_console; /* This is protected above by initmem_freed */ - fb_show_logo(info); + fb_show_logo(info, ops->rotate); update_region(vc, vc->vc_origin + vc->vc_size_row * vc->vc_top, vc->vc_size_row * (vc->vc_bottom - diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index e2667ddab3f1..7a2a8fa50b3b 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c @@ -323,9 +323,103 @@ static struct logo_data { const struct linux_logo *logo; } fb_logo; -int fb_prepare_logo(struct fb_info *info) +static void fb_rotate_logo_ud(const u8 *in, u8 *out, u32 width, u32 height) +{ + u32 size = width * height, i; + + out += size - 1; + + for (i = size; i--; ) + *out-- = *in++; +} + +static void fb_rotate_logo_cw(const u8 *in, u8 *out, u32 width, u32 height) +{ + int i, j, w = width - 1; + + for (i = 0; i < height; i++) + for (j = 0; j < width; j++) + out[height * j + w - i] = *in++; +} + +static void fb_rotate_logo_ccw(const u8 *in, u8 *out, u32 width, u32 height) +{ + int i, j, w = width - 1; + + for (i = 0; i < height; i++) + for (j = 0; j < width; j++) + out[height * (w - j) + i] = *in++; +} + +static void fb_rotate_logo(struct fb_info *info, u8 *dst, + struct fb_image *image, int rotate) +{ + u32 tmp; + + if (rotate == FB_ROTATE_UD) { + image->dx = info->var.xres - image->width; + image->dy = info->var.yres - image->height; + fb_rotate_logo_ud(image->data, dst, image->width, + image->height); + } else if (rotate == FB_ROTATE_CW) { + tmp = image->width; + image->width = image->height; + image->height = tmp; + image->dx = info->var.xres - image->height; + fb_rotate_logo_cw(image->data, dst, image->width, + image->height); + } else if (rotate == FB_ROTATE_CCW) { + tmp = image->width; + image->width = image->height; + image->height = tmp; + image->dy = info->var.yres - image->width; + fb_rotate_logo_ccw(image->data, dst, image->width, + image->height); + } + + image->data = dst; +} + +static void fb_do_show_logo(struct fb_info *info, struct fb_image *image, + int rotate) +{ + int x; + + if (rotate == FB_ROTATE_UR) { + for (x = 0; x < num_online_cpus() && + x * (fb_logo.logo->width + 8) <= + info->var.xres - fb_logo.logo->width; x++) { + info->fbops->fb_imageblit(info, image); + image->dx += fb_logo.logo->width + 8; + } + } else if (rotate == FB_ROTATE_UD) { + for (x = 0; x < num_online_cpus() && + x * (fb_logo.logo->width + 8) <= + info->var.xres - fb_logo.logo->width; x++) { + info->fbops->fb_imageblit(info, image); + image->dx -= fb_logo.logo->width + 8; + } + } else if (rotate == FB_ROTATE_CW) { + for (x = 0; x < num_online_cpus() && + x * (fb_logo.logo->width + 8) <= + info->var.yres - fb_logo.logo->width; x++) { + info->fbops->fb_imageblit(info, image); + image->dy += fb_logo.logo->width + 8; + } + } else if (rotate == FB_ROTATE_CCW) { + for (x = 0; x < num_online_cpus() && + x * (fb_logo.logo->width + 8) <= + info->var.yres - fb_logo.logo->width; x++) { + info->fbops->fb_imageblit(info, image); + image->dy -= fb_logo.logo->width + 8; + } + } +} + +int fb_prepare_logo(struct fb_info *info, int rotate) { int depth = fb_get_color_depth(&info->var, &info->fix); + int yres; memset(&fb_logo, 0, sizeof(struct logo_data)); @@ -358,10 +452,16 @@ int fb_prepare_logo(struct fb_info *info) /* Return if no suitable logo was found */ fb_logo.logo = fb_find_logo(depth); - if (!fb_logo.logo || fb_logo.logo->height > info->var.yres) { + if (rotate == FB_ROTATE_UR || rotate == FB_ROTATE_UD) + yres = info->var.yres; + else + yres = info->var.xres; + + if (fb_logo.logo && fb_logo.logo->height > yres) { fb_logo.logo = NULL; return 0; } + /* What depth we asked for might be different from what we get */ if (fb_logo.logo->type == LINUX_LOGO_CLUT224) fb_logo.depth = 8; @@ -372,12 +472,11 @@ int fb_prepare_logo(struct fb_info *info) return fb_logo.logo->height; } -int fb_show_logo(struct fb_info *info) +int fb_show_logo(struct fb_info *info, int rotate) { u32 *palette = NULL, *saved_pseudo_palette = NULL; - unsigned char *logo_new = NULL; + unsigned char *logo_new = NULL, *logo_rotate = NULL; struct fb_image image; - int x; /* Return if the frame buffer is not mapped or suspended */ if (fb_logo.logo == NULL || info->state != FBINFO_STATE_RUNNING) @@ -417,25 +516,30 @@ int fb_show_logo(struct fb_info *info) fb_set_logo(info, fb_logo.logo, logo_new, fb_logo.depth); } + image.dx = 0; + image.dy = 0; image.width = fb_logo.logo->width; image.height = fb_logo.logo->height; - image.dy = 0; - for (x = 0; x < num_online_cpus() * (fb_logo.logo->width + 8) && - x <= info->var.xres-fb_logo.logo->width; x += (fb_logo.logo->width + 8)) { - image.dx = x; - info->fbops->fb_imageblit(info, &image); + if (rotate) { + logo_rotate = kmalloc(fb_logo.logo->width * + fb_logo.logo->height, GFP_KERNEL); + if (logo_rotate) + fb_rotate_logo(info, logo_rotate, &image, rotate); } - + + fb_do_show_logo(info, &image, rotate); + kfree(palette); if (saved_pseudo_palette != NULL) info->pseudo_palette = saved_pseudo_palette; kfree(logo_new); + kfree(logo_rotate); return fb_logo.logo->height; } #else -int fb_prepare_logo(struct fb_info *info) { return 0; } -int fb_show_logo(struct fb_info *info) { return 0; } +int fb_prepare_logo(struct fb_info *info, int rotate) { return 0; } +int fb_show_logo(struct fb_info *info, int rotate) { return 0; } #endif /* CONFIG_LOGO */ static int fbmem_read_proc(char *buf, char **start, off_t offset, diff --git a/include/linux/fb.h b/include/linux/fb.h index 51791dc5d4dc..357dd3a0a01e 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -825,8 +825,8 @@ extern void cfb_imageblit(struct fb_info *info, const struct fb_image *image); /* drivers/video/fbmem.c */ extern int register_framebuffer(struct fb_info *fb_info); extern int unregister_framebuffer(struct fb_info *fb_info); -extern int fb_prepare_logo(struct fb_info *fb_info); -extern int fb_show_logo(struct fb_info *fb_info); +extern int fb_prepare_logo(struct fb_info *fb_info, int rotate); +extern int fb_show_logo(struct fb_info *fb_info, int rotate); extern char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size); extern void fb_pad_unaligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 idx, u32 height, u32 shift_high, u32 shift_low, u32 mod); -- cgit v1.2.2 From 6cc50e1c5b57180fd37a31282000f43859b0fe73 Mon Sep 17 00:00:00 2001 From: "Antonino A. Daplas" Date: Tue, 8 Nov 2005 21:39:11 -0800 Subject: [PATCH] fbcon: Console Rotation - Add support to rotate font bitmap Add support to rotate the font bitmap. To save on processing time, the entire fontdata will be rotated on a console switch, then stored in a buffer private to fbcon. To further save on processing, the fontdata will only be rotated if the font has changed or if the angle of rotation has changed. Only a single copy of the rotated fontdata will be kept. Signed-off-by: Antonino Daplas Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/video/console/Makefile | 3 + drivers/video/console/fbcon.h | 4 ++ drivers/video/console/fbcon_rotate.c | 105 +++++++++++++++++++++++++++++++++++ drivers/video/console/fbcon_rotate.h | 102 ++++++++++++++++++++++++++++++++++ 4 files changed, 214 insertions(+) create mode 100644 drivers/video/console/fbcon_rotate.c create mode 100644 drivers/video/console/fbcon_rotate.h diff --git a/drivers/video/console/Makefile b/drivers/video/console/Makefile index 5222628accce..4532bdfa94fc 100644 --- a/drivers/video/console/Makefile +++ b/drivers/video/console/Makefile @@ -31,6 +31,9 @@ obj-$(CONFIG_FRAMEBUFFER_CONSOLE) += fbcon.o bitblit.o font.o softcursor.o ifeq ($(CONFIG_FB_TILEBLITTING),y) obj-$(CONFIG_FRAMEBUFFER_CONSOLE) += tileblit.o endif +ifeq ($(CONFIG_FRAMEBUFFER_CONSOLE_ROTATION),y) +obj-$(CONFIG_FRAMEBUFFER_CONSOLE) += fbcon_rotate.o +endif obj-$(CONFIG_FB_STI) += sticore.o font.o diff --git a/drivers/video/console/fbcon.h b/drivers/video/console/fbcon.h index 846a5a4e736c..accfd7bd8e93 100644 --- a/drivers/video/console/fbcon.h +++ b/drivers/video/console/fbcon.h @@ -215,7 +215,11 @@ static inline int get_attribute(struct fb_info *info, u16 c) (void) (&_r == &_v); \ (i == FB_ROTATE_UR || i == FB_ROTATE_UD) ? _r : _v; }) +#ifdef CONFIG_FRAMEBUFFER_CONSOLE_ROTATION +extern void fbcon_set_rotate(struct fbcon_ops *ops); +#else #define fbcon_set_rotate(x) do {} while(0) +#endif /* CONFIG_FRAMEBUFFER_CONSOLE_ROTATION */ #endif /* _VIDEO_FBCON_H */ diff --git a/drivers/video/console/fbcon_rotate.c b/drivers/video/console/fbcon_rotate.c new file mode 100644 index 000000000000..6a969318480f --- /dev/null +++ b/drivers/video/console/fbcon_rotate.c @@ -0,0 +1,105 @@ +/* + * linux/drivers/video/console/fbcon_rotate.c -- Software Rotation + * + * Copyright (C) 2005 Antonino Daplas + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file COPYING in the main directory of this archive for + * more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include "fbcon.h" +#include "fbcon_rotate.h" + +static int fbcon_rotate_font(struct fb_info *info, struct vc_data *vc, + struct display *p) +{ + struct fbcon_ops *ops = info->fbcon_par; + int len, err = 0; + int s_cellsize, d_cellsize, i; + const u8 *src; + u8 *dst; + + if (vc->vc_font.data == ops->fontdata && + p->con_rotate == ops->cur_rotate) + goto finished; + + src = ops->fontdata = vc->vc_font.data; + ops->cur_rotate = p->con_rotate; + len = (!p->userfont) ? 256 : FNTCHARCNT(src); + s_cellsize = ((vc->vc_font.width + 7)/8) * + vc->vc_font.height; + d_cellsize = s_cellsize; + + if (ops->rotate == FB_ROTATE_CW || + ops->rotate == FB_ROTATE_CCW) + d_cellsize = ((vc->vc_font.height + 7)/8) * + vc->vc_font.width; + + if (info->fbops->fb_sync) + info->fbops->fb_sync(info); + + if (ops->fd_size < d_cellsize * len) { + dst = kmalloc(d_cellsize * len, GFP_KERNEL); + + if (dst == NULL) { + err = -ENOMEM; + goto finished; + } + + ops->fd_size = d_cellsize * len; + kfree(ops->fontbuffer); + ops->fontbuffer = dst; + } + + dst = ops->fontbuffer; + memset(dst, 0, ops->fd_size); + + switch (ops->rotate) { + case FB_ROTATE_UD: + for (i = len; i--; ) { + rotate_ud(src, dst, vc->vc_font.width, + vc->vc_font.height); + + src += s_cellsize; + dst += d_cellsize; + } + break; + case FB_ROTATE_CW: + for (i = len; i--; ) { + rotate_cw(src, dst, vc->vc_font.width, + vc->vc_font.height); + src += s_cellsize; + dst += d_cellsize; + } + break; + case FB_ROTATE_CCW: + for (i = len; i--; ) { + rotate_ccw(src, dst, vc->vc_font.width, + vc->vc_font.height); + src += s_cellsize; + dst += d_cellsize; + } + break; + } + +finished: + return err; +} + +void fbcon_set_rotate(struct fbcon_ops *ops) +{ + ops->rotate_font = fbcon_rotate_font; +} +EXPORT_SYMBOL(fbcon_set_rotate); + +MODULE_AUTHOR("Antonino Daplas "); +MODULE_DESCRIPTION("Console Rotation Support"); +MODULE_LICENSE("GPL"); diff --git a/drivers/video/console/fbcon_rotate.h b/drivers/video/console/fbcon_rotate.h new file mode 100644 index 000000000000..6cc27d8e5d45 --- /dev/null +++ b/drivers/video/console/fbcon_rotate.h @@ -0,0 +1,102 @@ +/* + * linux/drivers/video/console/fbcon_rotate.h -- Software Display Rotation + * + * Copyright (C) 2005 Antonino Daplas + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file COPYING in the main directory of this archive + * for more details. + */ + +#ifndef _FBCON_ROTATE_H +#define _FBCON_ROTATE_H + +#define FNTCHARCNT(fd) (((int *)(fd))[-3]) + +#define GETVYRES(s,i) ({ \ + (s == SCROLL_REDRAW || s == SCROLL_MOVE) ? \ + (i)->var.yres : (i)->var.yres_virtual; }) + +#define GETVXRES(s,i) ({ \ + (s == SCROLL_REDRAW || s == SCROLL_MOVE || !(i)->fix.xpanstep) ? \ + (i)->var.xres : (i)->var.xres_virtual; }) + +/* + * The bitmap is always big endian + */ +#if defined(__LITTLE_ENDIAN) +#define FBCON_BIT(b) (7 - (b)) +#else +#define FBCON_BIT(b) (b) +#endif + +static inline int pattern_test_bit(u32 x, u32 y, u32 pitch, const char *pat) +{ + u32 tmp = (y * pitch) + x, index = tmp / 8, bit = tmp % 8; + + pat +=index; + return (test_bit(FBCON_BIT(bit), (void *)pat)); +} + +static inline void pattern_set_bit(u32 x, u32 y, u32 pitch, char *pat) +{ + u32 tmp = (y * pitch) + x, index = tmp / 8, bit = tmp % 8; + + pat += index; + set_bit(FBCON_BIT(bit), (void *)pat); +} + +static inline void rotate_ud(const char *in, char *out, u32 width, u32 height) +{ + int i, j; + int shift = width % 8; + + width = (width + 7) & ~7; + + for (i = 0; i < height; i++) { + for (j = 0; j < width; j++) { + if (pattern_test_bit(j, i, width, in)) + pattern_set_bit(width - (1 + j + shift), + height - (1 + i), + width, out); + } + + } +} + +static inline void rotate_cw(const char *in, char *out, u32 width, u32 height) +{ + int i, j, h = height, w = width; + int shift = (8 - (height % 8)) & 7; + + width = (width + 7) & ~7; + height = (height + 7) & ~7; + + for (i = 0; i < h; i++) { + for (j = 0; j < w; j++) { + if (pattern_test_bit(j, i, width, in)) + pattern_set_bit(height - 1 - i - shift, j, + height, out); + + } + } +} + +static inline void rotate_ccw(const char *in, char *out, u32 width, u32 height) +{ + int i, j, h = height, w = width; + int shift = width % 8; + + width = (width + 7) & ~7; + height = (height + 7) & ~7; + + for (i = 0; i < h; i++) { + for (j = 0; j < w; j++) { + if (pattern_test_bit(j, i, width, in)) + pattern_set_bit(i, width - 1 - j - shift, + height, out); + } + } +} + +#endif -- cgit v1.2.2 From dbcbfe1ea41e404d960a06fa2faf7da568909f33 Mon Sep 17 00:00:00 2001 From: "Antonino A. Daplas" Date: Tue, 8 Nov 2005 21:39:12 -0800 Subject: [PATCH] fbcon: Console Rotation - Add support for 90-degree console rotation Add support for 90-degree (clockwise) rotation of the console. To activate, boot with: fbcon=rotate:1 Signed-off-by: Antonino Daplas Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/video/console/Makefile | 2 +- drivers/video/console/fbcon.c | 13 ++ drivers/video/console/fbcon_cw.c | 412 +++++++++++++++++++++++++++++++++++ drivers/video/console/fbcon_rotate.c | 6 + drivers/video/console/fbcon_rotate.h | 1 + 5 files changed, 433 insertions(+), 1 deletion(-) create mode 100644 drivers/video/console/fbcon_cw.c diff --git a/drivers/video/console/Makefile b/drivers/video/console/Makefile index 4532bdfa94fc..984f8cd3cc65 100644 --- a/drivers/video/console/Makefile +++ b/drivers/video/console/Makefile @@ -32,7 +32,7 @@ ifeq ($(CONFIG_FB_TILEBLITTING),y) obj-$(CONFIG_FRAMEBUFFER_CONSOLE) += tileblit.o endif ifeq ($(CONFIG_FRAMEBUFFER_CONSOLE_ROTATION),y) -obj-$(CONFIG_FRAMEBUFFER_CONSOLE) += fbcon_rotate.o +obj-$(CONFIG_FRAMEBUFFER_CONSOLE) += fbcon_rotate.o fbcon_cw.o endif obj-$(CONFIG_FB_STI) += sticore.o font.o diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c index 26935e231a1d..e829ba18e0a5 100644 --- a/drivers/video/console/fbcon.c +++ b/drivers/video/console/fbcon.c @@ -207,12 +207,25 @@ static irqreturn_t fb_vbl_detect(int irq, void *dummy, struct pt_regs *fp) } #endif +#ifdef CONFIG_FRAMEBUFFER_CONSOLE_ROTATION +static inline void fbcon_set_rotation(struct fb_info *info, struct display *p) +{ + struct fbcon_ops *ops = info->fbcon_par; + + if (!(info->flags & FBINFO_MISC_TILEBLITTING) && + p->con_rotate < 4) + ops->rotate = p->con_rotate; + else + ops->rotate = 0; +} +#else static inline void fbcon_set_rotation(struct fb_info *info, struct display *p) { struct fbcon_ops *ops = info->fbcon_par; ops->rotate = FB_ROTATE_UR; } +#endif /* CONFIG_FRAMEBUFFER_CONSOLE_ROTATION */ static inline int fbcon_is_inactive(struct vc_data *vc, struct fb_info *info) { diff --git a/drivers/video/console/fbcon_cw.c b/drivers/video/console/fbcon_cw.c new file mode 100644 index 000000000000..6c6f3b6dd175 --- /dev/null +++ b/drivers/video/console/fbcon_cw.c @@ -0,0 +1,412 @@ +/* + * linux/drivers/video/console/fbcon_ud.c -- Software Rotation - 90 degrees + * + * Copyright (C) 2005 Antonino Daplas + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file COPYING in the main directory of this archive for + * more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include "fbcon.h" +#include "fbcon_rotate.h" + +/* + * Rotation 90 degrees + */ + +static inline void cw_update_attr(u8 *dst, u8 *src, int attribute, + struct vc_data *vc) +{ + int i, j, offset = (vc->vc_font.height < 10) ? 1 : 2; + int width = (vc->vc_font.height + 7) >> 3; + u8 c, t = 0, msk = ~(0xff >> offset); + + for (i = 0; i < vc->vc_font.width; i++) { + for (j = 0; j < width; j++) { + c = *src; + if (attribute & FBCON_ATTRIBUTE_UNDERLINE && !j) + c |= msk; + if (attribute & FBCON_ATTRIBUTE_BOLD && i) + c |= *(src-width); + if (attribute & FBCON_ATTRIBUTE_REVERSE) + c = ~c; + src++; + *dst++ = c; + t = c; + } + } +} + + +static void cw_bmove(struct vc_data *vc, struct fb_info *info, int sy, + int sx, int dy, int dx, int height, int width) +{ + struct display *p = &fb_display[vc->vc_num]; + struct fb_copyarea area; + u32 vxres = GETVXRES(p->scrollmode, info); + + area.sx = vxres - ((sy + height) * vc->vc_font.height); + area.sy = sx * vc->vc_font.width; + area.dx = vxres - ((dy + height) * vc->vc_font.height); + area.dy = dx * vc->vc_font.width; + area.width = height * vc->vc_font.height; + area.height = width * vc->vc_font.width; + + info->fbops->fb_copyarea(info, &area); +} + +static void cw_clear(struct vc_data *vc, struct fb_info *info, int sy, + int sx, int height, int width) +{ + struct display *p = &fb_display[vc->vc_num]; + struct fb_fillrect region; + int bgshift = (vc->vc_hi_font_mask) ? 13 : 12; + u32 vxres = GETVXRES(p->scrollmode, info); + + region.color = attr_bgcol_ec(bgshift,vc); + region.dx = vxres - ((sy + height) * vc->vc_font.height); + region.dy = sx * vc->vc_font.width; + region.height = width * vc->vc_font.width; + region.width = height * vc->vc_font.height; + region.rop = ROP_COPY; + + info->fbops->fb_fillrect(info, ®ion); +} + +static inline void cw_putcs_aligned(struct vc_data *vc, struct fb_info *info, + const u16 *s, u32 attr, u32 cnt, + u32 d_pitch, u32 s_pitch, u32 cellsize, + struct fb_image *image, u8 *buf, u8 *dst) +{ + struct fbcon_ops *ops = info->fbcon_par; + u16 charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; + u32 idx = (vc->vc_font.height + 7) >> 3; + u8 *src; + + while (cnt--) { + src = ops->fontbuffer + (scr_readw(s++) & charmask)*cellsize; + + if (attr) { + cw_update_attr(buf, src, attr, vc); + src = buf; + } + + if (likely(idx == 1)) + __fb_pad_aligned_buffer(dst, d_pitch, src, idx, + vc->vc_font.width); + else + fb_pad_aligned_buffer(dst, d_pitch, src, idx, + vc->vc_font.width); + + dst += d_pitch * vc->vc_font.width; + } + + info->fbops->fb_imageblit(info, image); +} + +static void cw_putcs(struct vc_data *vc, struct fb_info *info, + const unsigned short *s, int count, int yy, int xx, + int fg, int bg) +{ + struct fb_image image; + struct display *p = &fb_display[vc->vc_num]; + struct fbcon_ops *ops = info->fbcon_par; + u32 width = (vc->vc_font.height + 7)/8; + u32 cellsize = width * vc->vc_font.width; + u32 maxcnt = info->pixmap.size/cellsize; + u32 scan_align = info->pixmap.scan_align - 1; + u32 buf_align = info->pixmap.buf_align - 1; + u32 cnt, pitch, size; + u32 attribute = get_attribute(info, scr_readw(s)); + u8 *dst, *buf = NULL; + u32 vxres = GETVXRES(p->scrollmode, info); + + if (!ops->fontbuffer) + return; + + image.fg_color = fg; + image.bg_color = bg; + image.dx = vxres - ((yy + 1) * vc->vc_font.height); + image.dy = xx * vc->vc_font.width; + image.width = vc->vc_font.height; + image.depth = 1; + + if (attribute) { + buf = kmalloc(cellsize, GFP_KERNEL); + if (!buf) + return; + } + + while (count) { + if (count > maxcnt) + cnt = maxcnt; + else + cnt = count; + + image.height = vc->vc_font.width * cnt; + pitch = ((image.width + 7) >> 3) + scan_align; + pitch &= ~scan_align; + size = pitch * image.height + buf_align; + size &= ~buf_align; + dst = fb_get_buffer_offset(info, &info->pixmap, size); + image.data = dst; + cw_putcs_aligned(vc, info, s, attribute, cnt, pitch, + width, cellsize, &image, buf, dst); + image.dy += image.height; + count -= cnt; + s += cnt; + } + + /* buf is always NULL except when in monochrome mode, so in this case + it's a gain to check buf against NULL even though kfree() handles + NULL pointers just fine */ + if (unlikely(buf)) + kfree(buf); + +} + +static void cw_clear_margins(struct vc_data *vc, struct fb_info *info, + int bottom_only) +{ + unsigned int cw = vc->vc_font.width; + unsigned int ch = vc->vc_font.height; + unsigned int rw = info->var.yres - (vc->vc_cols*cw); + unsigned int bh = info->var.xres - (vc->vc_rows*ch); + unsigned int rs = info->var.yres - rw; + struct fb_fillrect region; + int bgshift = (vc->vc_hi_font_mask) ? 13 : 12; + + region.color = attr_bgcol_ec(bgshift,vc); + region.rop = ROP_COPY; + + if (rw && !bottom_only) { + region.dx = 0; + region.dy = info->var.yoffset + rs; + region.height = rw; + region.width = info->var.xres_virtual; + info->fbops->fb_fillrect(info, ®ion); + } + + if (bh) { + region.dx = info->var.xoffset; + region.dy = info->var.yoffset; + region.height = info->var.yres; + region.width = bh; + info->fbops->fb_fillrect(info, ®ion); + } +} + +static void cw_cursor(struct vc_data *vc, struct fb_info *info, + struct display *p, int mode, int softback_lines, + int fg, int bg) +{ + struct fb_cursor cursor; + struct fbcon_ops *ops = (struct fbcon_ops *) info->fbcon_par; + unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; + int w = (vc->vc_font.height + 7) >> 3, c; + int y = real_y(p, vc->vc_y); + int attribute, use_sw = (vc->vc_cursor_type & 0x10); + int err = 1, dx, dy; + char *src; + u32 vxres = GETVXRES(p->scrollmode, info); + + if (!ops->fontbuffer) + return; + + cursor.set = 0; + + if (softback_lines) { + if (y + softback_lines >= vc->vc_rows) { + mode = CM_ERASE; + ops->cursor_flash = 0; + return; + } else + y += softback_lines; + } + + c = scr_readw((u16 *) vc->vc_pos); + attribute = get_attribute(info, c); + src = ops->fontbuffer + ((c & charmask) * (w * vc->vc_font.width)); + + if (ops->cursor_state.image.data != src || + ops->cursor_reset) { + ops->cursor_state.image.data = src; + cursor.set |= FB_CUR_SETIMAGE; + } + + if (attribute) { + u8 *dst; + + dst = kmalloc(w * vc->vc_font.width, GFP_ATOMIC); + if (!dst) + return; + kfree(ops->cursor_data); + ops->cursor_data = dst; + cw_update_attr(dst, src, attribute, vc); + src = dst; + } + + if (ops->cursor_state.image.fg_color != fg || + ops->cursor_state.image.bg_color != bg || + ops->cursor_reset) { + ops->cursor_state.image.fg_color = fg; + ops->cursor_state.image.bg_color = bg; + cursor.set |= FB_CUR_SETCMAP; + } + + if (ops->cursor_state.image.height != vc->vc_font.width || + ops->cursor_state.image.width != vc->vc_font.height || + ops->cursor_reset) { + ops->cursor_state.image.height = vc->vc_font.width; + ops->cursor_state.image.width = vc->vc_font.height; + cursor.set |= FB_CUR_SETSIZE; + } + + dx = vxres - ((y * vc->vc_font.height) + vc->vc_font.height); + dy = vc->vc_x * vc->vc_font.width; + + if (ops->cursor_state.image.dx != dx || + ops->cursor_state.image.dy != dy || + ops->cursor_reset) { + ops->cursor_state.image.dx = dx; + ops->cursor_state.image.dy = dy; + cursor.set |= FB_CUR_SETPOS; + } + + if (ops->cursor_state.hot.x || ops->cursor_state.hot.y || + ops->cursor_reset) { + ops->cursor_state.hot.x = cursor.hot.y = 0; + cursor.set |= FB_CUR_SETHOT; + } + + if (cursor.set & FB_CUR_SETSIZE || + vc->vc_cursor_type != p->cursor_shape || + ops->cursor_state.mask == NULL || + ops->cursor_reset) { + char *tmp, *mask = kmalloc(w*vc->vc_font.width, GFP_ATOMIC); + int cur_height, size, i = 0; + int width = (vc->vc_font.width + 7)/8; + + if (!mask) + return; + + tmp = kmalloc(width * vc->vc_font.height, GFP_ATOMIC); + + if (!tmp) { + kfree(mask); + return; + } + + kfree(ops->cursor_state.mask); + ops->cursor_state.mask = mask; + + p->cursor_shape = vc->vc_cursor_type; + cursor.set |= FB_CUR_SETSHAPE; + + switch (p->cursor_shape & CUR_HWMASK) { + case CUR_NONE: + cur_height = 0; + break; + case CUR_UNDERLINE: + cur_height = (vc->vc_font.height < 10) ? 1 : 2; + break; + case CUR_LOWER_THIRD: + cur_height = vc->vc_font.height/3; + break; + case CUR_LOWER_HALF: + cur_height = vc->vc_font.height >> 1; + break; + case CUR_TWO_THIRDS: + cur_height = (vc->vc_font.height << 1)/3; + break; + case CUR_BLOCK: + default: + cur_height = vc->vc_font.height; + break; + } + + size = (vc->vc_font.height - cur_height) * width; + while (size--) + tmp[i++] = 0; + size = cur_height * width; + while (size--) + tmp[i++] = 0xff; + memset(mask, 0, w * vc->vc_font.width); + rotate_cw(tmp, mask, vc->vc_font.width, vc->vc_font.height); + kfree(tmp); + } + + switch (mode) { + case CM_ERASE: + ops->cursor_state.enable = 0; + break; + case CM_DRAW: + case CM_MOVE: + default: + ops->cursor_state.enable = (use_sw) ? 0 : 1; + break; + } + + cursor.image.data = src; + cursor.image.fg_color = ops->cursor_state.image.fg_color; + cursor.image.bg_color = ops->cursor_state.image.bg_color; + cursor.image.dx = ops->cursor_state.image.dx; + cursor.image.dy = ops->cursor_state.image.dy; + cursor.image.height = ops->cursor_state.image.height; + cursor.image.width = ops->cursor_state.image.width; + cursor.hot.x = ops->cursor_state.hot.x; + cursor.hot.y = ops->cursor_state.hot.y; + cursor.mask = ops->cursor_state.mask; + cursor.enable = ops->cursor_state.enable; + cursor.image.depth = 1; + cursor.rop = ROP_XOR; + + if (info->fbops->fb_cursor) + err = info->fbops->fb_cursor(info, &cursor); + + if (err) + soft_cursor(info, &cursor); + + ops->cursor_reset = 0; +} + +int cw_update_start(struct fb_info *info) +{ + struct fbcon_ops *ops = info->fbcon_par; + struct display *p = &fb_display[ops->currcon]; + u32 vxres = GETVXRES(p->scrollmode, info); + u32 xoffset; + int err; + + xoffset = vxres - (info->var.xres + ops->var.yoffset); + ops->var.yoffset = ops->var.xoffset; + ops->var.xoffset = xoffset; + err = fb_pan_display(info, &ops->var); + ops->var.xoffset = info->var.xoffset; + ops->var.yoffset = info->var.yoffset; + ops->var.vmode = info->var.vmode; + return err; +} + +void fbcon_rotate_cw(struct fbcon_ops *ops) +{ + ops->bmove = cw_bmove; + ops->clear = cw_clear; + ops->putcs = cw_putcs; + ops->clear_margins = cw_clear_margins; + ops->cursor = cw_cursor; + ops->update_start = cw_update_start; +} +EXPORT_SYMBOL(fbcon_rotate_cw); + +MODULE_AUTHOR("Antonino Daplas "); +MODULE_DESCRIPTION("Console Rotation (90 degrees) Support"); +MODULE_LICENSE("GPL"); diff --git a/drivers/video/console/fbcon_rotate.c b/drivers/video/console/fbcon_rotate.c index 6a969318480f..9df009c8ab49 100644 --- a/drivers/video/console/fbcon_rotate.c +++ b/drivers/video/console/fbcon_rotate.c @@ -97,6 +97,12 @@ finished: void fbcon_set_rotate(struct fbcon_ops *ops) { ops->rotate_font = fbcon_rotate_font; + + switch(ops->rotate) { + case FB_ROTATE_CW: + fbcon_rotate_cw(ops); + break; + } } EXPORT_SYMBOL(fbcon_set_rotate); diff --git a/drivers/video/console/fbcon_rotate.h b/drivers/video/console/fbcon_rotate.h index 6cc27d8e5d45..709e6b49eab4 100644 --- a/drivers/video/console/fbcon_rotate.h +++ b/drivers/video/console/fbcon_rotate.h @@ -99,4 +99,5 @@ static inline void rotate_ccw(const char *in, char *out, u32 width, u32 height) } } +extern void fbcon_rotate_cw(struct fbcon_ops *ops); #endif -- cgit v1.2.2 From 33ee82978c4ecf7cbd56064391c9385264185de2 Mon Sep 17 00:00:00 2001 From: "Antonino A. Daplas" Date: Tue, 8 Nov 2005 21:39:13 -0800 Subject: [PATCH] fbcon: Console Rotation - Add support for 180-degree console rotation Add support for 180-degree (upside down) rotation of the console. To activate, boot with: fbcon=rotate:2 Signed-off-by: Antonino Daplas Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/video/console/Makefile | 2 +- drivers/video/console/fbcon_rotate.c | 3 + drivers/video/console/fbcon_rotate.h | 1 + drivers/video/console/fbcon_ud.c | 454 +++++++++++++++++++++++++++++++++++ 4 files changed, 459 insertions(+), 1 deletion(-) create mode 100644 drivers/video/console/fbcon_ud.c diff --git a/drivers/video/console/Makefile b/drivers/video/console/Makefile index 984f8cd3cc65..830ff46e0d1a 100644 --- a/drivers/video/console/Makefile +++ b/drivers/video/console/Makefile @@ -32,7 +32,7 @@ ifeq ($(CONFIG_FB_TILEBLITTING),y) obj-$(CONFIG_FRAMEBUFFER_CONSOLE) += tileblit.o endif ifeq ($(CONFIG_FRAMEBUFFER_CONSOLE_ROTATION),y) -obj-$(CONFIG_FRAMEBUFFER_CONSOLE) += fbcon_rotate.o fbcon_cw.o +obj-$(CONFIG_FRAMEBUFFER_CONSOLE) += fbcon_rotate.o fbcon_cw.o fbcon_ud.o endif obj-$(CONFIG_FB_STI) += sticore.o font.o diff --git a/drivers/video/console/fbcon_rotate.c b/drivers/video/console/fbcon_rotate.c index 9df009c8ab49..3d64ad190ff8 100644 --- a/drivers/video/console/fbcon_rotate.c +++ b/drivers/video/console/fbcon_rotate.c @@ -102,6 +102,9 @@ void fbcon_set_rotate(struct fbcon_ops *ops) case FB_ROTATE_CW: fbcon_rotate_cw(ops); break; + case FB_ROTATE_UD: + fbcon_rotate_ud(ops); + break; } } EXPORT_SYMBOL(fbcon_set_rotate); diff --git a/drivers/video/console/fbcon_rotate.h b/drivers/video/console/fbcon_rotate.h index 709e6b49eab4..f8ddcd6bd89c 100644 --- a/drivers/video/console/fbcon_rotate.h +++ b/drivers/video/console/fbcon_rotate.h @@ -100,4 +100,5 @@ static inline void rotate_ccw(const char *in, char *out, u32 width, u32 height) } extern void fbcon_rotate_cw(struct fbcon_ops *ops); +extern void fbcon_rotate_ud(struct fbcon_ops *ops); #endif diff --git a/drivers/video/console/fbcon_ud.c b/drivers/video/console/fbcon_ud.c new file mode 100644 index 000000000000..2e1d9d4249cd --- /dev/null +++ b/drivers/video/console/fbcon_ud.c @@ -0,0 +1,454 @@ +/* + * linux/drivers/video/console/fbcon_ud.c -- Software Rotation - 180 degrees + * + * Copyright (C) 2005 Antonino Daplas + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file COPYING in the main directory of this archive for + * more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include "fbcon.h" +#include "fbcon_rotate.h" + +/* + * Rotation 180 degrees + */ + +static inline void ud_update_attr(u8 *dst, u8 *src, int attribute, + struct vc_data *vc) +{ + int i, offset = (vc->vc_font.height < 10) ? 1 : 2; + int width = (vc->vc_font.width + 7) >> 3; + unsigned int cellsize = vc->vc_font.height * width; + u8 c; + + offset = offset * width; + + for (i = 0; i < cellsize; i++) { + c = src[i]; + if (attribute & FBCON_ATTRIBUTE_UNDERLINE && i < offset) + c = 0xff; + if (attribute & FBCON_ATTRIBUTE_BOLD) + c |= c << 1; + if (attribute & FBCON_ATTRIBUTE_REVERSE) + c = ~c; + dst[i] = c; + } +} + + +static void ud_bmove(struct vc_data *vc, struct fb_info *info, int sy, + int sx, int dy, int dx, int height, int width) +{ + struct display *p = &fb_display[vc->vc_num]; + struct fb_copyarea area; + u32 vyres = GETVYRES(p->scrollmode, info); + u32 vxres = GETVXRES(p->scrollmode, info); + + area.sy = vyres - ((sy + height) * vc->vc_font.height); + area.sx = vxres - ((sx + width) * vc->vc_font.width); + area.dy = vyres - ((dy + height) * vc->vc_font.height); + area.dx = vxres - ((dx + width) * vc->vc_font.width); + area.height = height * vc->vc_font.height; + area.width = width * vc->vc_font.width; + + info->fbops->fb_copyarea(info, &area); +} + +static void ud_clear(struct vc_data *vc, struct fb_info *info, int sy, + int sx, int height, int width) +{ + struct display *p = &fb_display[vc->vc_num]; + struct fb_fillrect region; + int bgshift = (vc->vc_hi_font_mask) ? 13 : 12; + u32 vyres = GETVYRES(p->scrollmode, info); + u32 vxres = GETVXRES(p->scrollmode, info); + + region.color = attr_bgcol_ec(bgshift,vc); + region.dy = vyres - ((sy + height) * vc->vc_font.height); + region.dx = vxres - ((sx + width) * vc->vc_font.width); + region.width = width * vc->vc_font.width; + region.height = height * vc->vc_font.height; + region.rop = ROP_COPY; + + info->fbops->fb_fillrect(info, ®ion); +} + +static inline void ud_putcs_aligned(struct vc_data *vc, struct fb_info *info, + const u16 *s, u32 attr, u32 cnt, + u32 d_pitch, u32 s_pitch, u32 cellsize, + struct fb_image *image, u8 *buf, u8 *dst) +{ + struct fbcon_ops *ops = info->fbcon_par; + u16 charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; + u32 idx = vc->vc_font.width >> 3; + u8 *src; + + while (cnt--) { + src = ops->fontbuffer + (scr_readw(s--) & charmask)*cellsize; + + if (attr) { + ud_update_attr(buf, src, attr, vc); + src = buf; + } + + if (likely(idx == 1)) + __fb_pad_aligned_buffer(dst, d_pitch, src, idx, + image->height); + else + fb_pad_aligned_buffer(dst, d_pitch, src, idx, + image->height); + + dst += s_pitch; + } + + info->fbops->fb_imageblit(info, image); +} + +static inline void ud_putcs_unaligned(struct vc_data *vc, + struct fb_info *info, const u16 *s, + u32 attr, u32 cnt, u32 d_pitch, + u32 s_pitch, u32 cellsize, + struct fb_image *image, u8 *buf, + u8 *dst) +{ + struct fbcon_ops *ops = info->fbcon_par; + u16 charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; + u32 shift_low = 0, mod = vc->vc_font.width % 8; + u32 shift_high = 8; + u32 idx = vc->vc_font.width >> 3; + u8 *src; + + while (cnt--) { + src = ops->fontbuffer + (scr_readw(s--) & charmask)*cellsize; + + if (attr) { + ud_update_attr(buf, src, attr, vc); + src = buf; + } + + fb_pad_unaligned_buffer(dst, d_pitch, src, idx, + image->height, shift_high, + shift_low, mod); + shift_low += mod; + dst += (shift_low >= 8) ? s_pitch : s_pitch - 1; + shift_low &= 7; + shift_high = 8 - shift_low; + } + + info->fbops->fb_imageblit(info, image); + +} + +static void ud_putcs(struct vc_data *vc, struct fb_info *info, + const unsigned short *s, int count, int yy, int xx, + int fg, int bg) +{ + struct fb_image image; + struct display *p = &fb_display[vc->vc_num]; + struct fbcon_ops *ops = info->fbcon_par; + u32 width = (vc->vc_font.width + 7)/8; + u32 cellsize = width * vc->vc_font.height; + u32 maxcnt = info->pixmap.size/cellsize; + u32 scan_align = info->pixmap.scan_align - 1; + u32 buf_align = info->pixmap.buf_align - 1; + u32 mod = vc->vc_font.width % 8, cnt, pitch, size; + u32 attribute = get_attribute(info, scr_readw(s)); + u8 *dst, *buf = NULL; + u32 vyres = GETVYRES(p->scrollmode, info); + u32 vxres = GETVXRES(p->scrollmode, info); + + if (!ops->fontbuffer) + return; + + image.fg_color = fg; + image.bg_color = bg; + image.dy = vyres - ((yy * vc->vc_font.height) + vc->vc_font.height); + image.dx = vxres - ((xx + count) * vc->vc_font.width); + image.height = vc->vc_font.height; + image.depth = 1; + + if (attribute) { + buf = kmalloc(cellsize, GFP_KERNEL); + if (!buf) + return; + } + + s += count - 1; + + while (count) { + if (count > maxcnt) + cnt = maxcnt; + else + cnt = count; + + image.width = vc->vc_font.width * cnt; + pitch = ((image.width + 7) >> 3) + scan_align; + pitch &= ~scan_align; + size = pitch * image.height + buf_align; + size &= ~buf_align; + dst = fb_get_buffer_offset(info, &info->pixmap, size); + image.data = dst; + + if (!mod) + ud_putcs_aligned(vc, info, s, attribute, cnt, pitch, + width, cellsize, &image, buf, dst); + else + ud_putcs_unaligned(vc, info, s, attribute, cnt, pitch, + width, cellsize, &image, + buf, dst); + + image.dx += image.width; + count -= cnt; + s -= cnt; + xx += cnt; + } + + /* buf is always NULL except when in monochrome mode, so in this case + it's a gain to check buf against NULL even though kfree() handles + NULL pointers just fine */ + if (unlikely(buf)) + kfree(buf); + +} + +static void ud_clear_margins(struct vc_data *vc, struct fb_info *info, + int bottom_only) +{ + unsigned int cw = vc->vc_font.width; + unsigned int ch = vc->vc_font.height; + unsigned int rw = info->var.xres - (vc->vc_cols*cw); + unsigned int bh = info->var.yres - (vc->vc_rows*ch); + struct fb_fillrect region; + int bgshift = (vc->vc_hi_font_mask) ? 13 : 12; + + region.color = attr_bgcol_ec(bgshift,vc); + region.rop = ROP_COPY; + + if (rw && !bottom_only) { + region.dy = 0; + region.dx = info->var.xoffset; + region.width = rw; + region.height = info->var.yres_virtual; + info->fbops->fb_fillrect(info, ®ion); + } + + if (bh) { + region.dy = info->var.yoffset; + region.dx = info->var.xoffset; + region.height = bh; + region.width = info->var.xres; + info->fbops->fb_fillrect(info, ®ion); + } +} + +static void ud_cursor(struct vc_data *vc, struct fb_info *info, + struct display *p, int mode, int softback_lines, + int fg, int bg) +{ + struct fb_cursor cursor; + struct fbcon_ops *ops = (struct fbcon_ops *) info->fbcon_par; + unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; + int w = (vc->vc_font.width + 7) >> 3, c; + int y = real_y(p, vc->vc_y); + int attribute, use_sw = (vc->vc_cursor_type & 0x10); + int err = 1, dx, dy; + char *src; + u32 vyres = GETVYRES(p->scrollmode, info); + u32 vxres = GETVXRES(p->scrollmode, info); + + if (!ops->fontbuffer) + return; + + cursor.set = 0; + + if (softback_lines) { + if (y + softback_lines >= vc->vc_rows) { + mode = CM_ERASE; + ops->cursor_flash = 0; + return; + } else + y += softback_lines; + } + + c = scr_readw((u16 *) vc->vc_pos); + attribute = get_attribute(info, c); + src = ops->fontbuffer + ((c & charmask) * (w * vc->vc_font.height)); + + if (ops->cursor_state.image.data != src || + ops->cursor_reset) { + ops->cursor_state.image.data = src; + cursor.set |= FB_CUR_SETIMAGE; + } + + if (attribute) { + u8 *dst; + + dst = kmalloc(w * vc->vc_font.height, GFP_ATOMIC); + if (!dst) + return; + kfree(ops->cursor_data); + ops->cursor_data = dst; + ud_update_attr(dst, src, attribute, vc); + src = dst; + } + + if (ops->cursor_state.image.fg_color != fg || + ops->cursor_state.image.bg_color != bg || + ops->cursor_reset) { + ops->cursor_state.image.fg_color = fg; + ops->cursor_state.image.bg_color = bg; + cursor.set |= FB_CUR_SETCMAP; + } + + if (ops->cursor_state.image.height != vc->vc_font.height || + ops->cursor_state.image.width != vc->vc_font.width || + ops->cursor_reset) { + ops->cursor_state.image.height = vc->vc_font.height; + ops->cursor_state.image.width = vc->vc_font.width; + cursor.set |= FB_CUR_SETSIZE; + } + + dy = vyres - ((y * vc->vc_font.height) + vc->vc_font.height); + dx = vxres - ((vc->vc_x * vc->vc_font.width) + vc->vc_font.width); + + if (ops->cursor_state.image.dx != dx || + ops->cursor_state.image.dy != dy || + ops->cursor_reset) { + ops->cursor_state.image.dx = dx; + ops->cursor_state.image.dy = dy; + cursor.set |= FB_CUR_SETPOS; + } + + if (ops->cursor_state.hot.x || ops->cursor_state.hot.y || + ops->cursor_reset) { + ops->cursor_state.hot.x = cursor.hot.y = 0; + cursor.set |= FB_CUR_SETHOT; + } + + if (cursor.set & FB_CUR_SETSIZE || + vc->vc_cursor_type != p->cursor_shape || + ops->cursor_state.mask == NULL || + ops->cursor_reset) { + char *mask = kmalloc(w*vc->vc_font.height, GFP_ATOMIC); + int cur_height, size, i = 0; + u8 msk = 0xff; + + if (!mask) + return; + + kfree(ops->cursor_state.mask); + ops->cursor_state.mask = mask; + + p->cursor_shape = vc->vc_cursor_type; + cursor.set |= FB_CUR_SETSHAPE; + + switch (p->cursor_shape & CUR_HWMASK) { + case CUR_NONE: + cur_height = 0; + break; + case CUR_UNDERLINE: + cur_height = (vc->vc_font.height < 10) ? 1 : 2; + break; + case CUR_LOWER_THIRD: + cur_height = vc->vc_font.height/3; + break; + case CUR_LOWER_HALF: + cur_height = vc->vc_font.height >> 1; + break; + case CUR_TWO_THIRDS: + cur_height = (vc->vc_font.height << 1)/3; + break; + case CUR_BLOCK: + default: + cur_height = vc->vc_font.height; + break; + } + + size = cur_height * w; + + while (size--) + mask[i++] = msk; + + size = (vc->vc_font.height - cur_height) * w; + + while (size--) + mask[i++] = ~msk; + } + + switch (mode) { + case CM_ERASE: + ops->cursor_state.enable = 0; + break; + case CM_DRAW: + case CM_MOVE: + default: + ops->cursor_state.enable = (use_sw) ? 0 : 1; + break; + } + + cursor.image.data = src; + cursor.image.fg_color = ops->cursor_state.image.fg_color; + cursor.image.bg_color = ops->cursor_state.image.bg_color; + cursor.image.dx = ops->cursor_state.image.dx; + cursor.image.dy = ops->cursor_state.image.dy; + cursor.image.height = ops->cursor_state.image.height; + cursor.image.width = ops->cursor_state.image.width; + cursor.hot.x = ops->cursor_state.hot.x; + cursor.hot.y = ops->cursor_state.hot.y; + cursor.mask = ops->cursor_state.mask; + cursor.enable = ops->cursor_state.enable; + cursor.image.depth = 1; + cursor.rop = ROP_XOR; + + if (info->fbops->fb_cursor) + err = info->fbops->fb_cursor(info, &cursor); + + if (err) + soft_cursor(info, &cursor); + + ops->cursor_reset = 0; +} + +int ud_update_start(struct fb_info *info) +{ + struct fbcon_ops *ops = info->fbcon_par; + struct display *p = &fb_display[ops->currcon]; + u32 xoffset, yoffset; + u32 vyres = GETVYRES(p->scrollmode, info); + u32 vxres = GETVXRES(p->scrollmode, info); + int err; + + xoffset = (vxres - info->var.xres) - ops->var.xoffset; + yoffset = (vyres - info->var.yres) - ops->var.yoffset; + ops->var.xoffset = xoffset; + ops->var.yoffset = yoffset; + err = fb_pan_display(info, &ops->var); + ops->var.xoffset = info->var.xoffset; + ops->var.yoffset = info->var.yoffset; + ops->var.vmode = info->var.vmode; + return err; +} + +void fbcon_rotate_ud(struct fbcon_ops *ops) +{ + ops->bmove = ud_bmove; + ops->clear = ud_clear; + ops->putcs = ud_putcs; + ops->clear_margins = ud_clear_margins; + ops->cursor = ud_cursor; + ops->update_start = ud_update_start; +} +EXPORT_SYMBOL(fbcon_rotate_ud); + +MODULE_AUTHOR("Antonino Daplas "); +MODULE_DESCRIPTION("Console Rotation (180 degrees) Support"); +MODULE_LICENSE("GPL"); -- cgit v1.2.2 From ed8c0e99f27451a9b980adf0de318d60e6de811f Mon Sep 17 00:00:00 2001 From: "Antonino A. Daplas" Date: Tue, 8 Nov 2005 21:39:14 -0800 Subject: [PATCH] fbcon: Console Rotation - Add support for 270-degree rotation Add support for 270-degree (counterclockwise) rotation of the console. To activate, boot with: fbcon=rotate:3 Signed-off-by: Antonino Daplas Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/video/console/Makefile | 3 +- drivers/video/console/fbcon_ccw.c | 428 +++++++++++++++++++++++++++++++++++ drivers/video/console/fbcon_rotate.c | 3 + drivers/video/console/fbcon_rotate.h | 1 + 4 files changed, 434 insertions(+), 1 deletion(-) create mode 100644 drivers/video/console/fbcon_ccw.c diff --git a/drivers/video/console/Makefile b/drivers/video/console/Makefile index 830ff46e0d1a..fed600c9ca55 100644 --- a/drivers/video/console/Makefile +++ b/drivers/video/console/Makefile @@ -32,7 +32,8 @@ ifeq ($(CONFIG_FB_TILEBLITTING),y) obj-$(CONFIG_FRAMEBUFFER_CONSOLE) += tileblit.o endif ifeq ($(CONFIG_FRAMEBUFFER_CONSOLE_ROTATION),y) -obj-$(CONFIG_FRAMEBUFFER_CONSOLE) += fbcon_rotate.o fbcon_cw.o fbcon_ud.o +obj-$(CONFIG_FRAMEBUFFER_CONSOLE) += fbcon_rotate.o fbcon_cw.o fbcon_ud.o \ + fbcon_ccw.o endif obj-$(CONFIG_FB_STI) += sticore.o font.o diff --git a/drivers/video/console/fbcon_ccw.c b/drivers/video/console/fbcon_ccw.c new file mode 100644 index 000000000000..680aabab73c5 --- /dev/null +++ b/drivers/video/console/fbcon_ccw.c @@ -0,0 +1,428 @@ +/* + * linux/drivers/video/console/fbcon_ccw.c -- Software Rotation - 270 degrees + * + * Copyright (C) 2005 Antonino Daplas + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file COPYING in the main directory of this archive for + * more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include "fbcon.h" +#include "fbcon_rotate.h" + +/* + * Rotation 270 degrees + */ + +static inline void ccw_update_attr(u8 *dst, u8 *src, int attribute, + struct vc_data *vc) +{ + int i, j, offset = (vc->vc_font.height < 10) ? 1 : 2; + int width = (vc->vc_font.height + 7) >> 3; + int mod = vc->vc_font.height % 8; + u8 c, msk = ~(0xff << offset), msk1 = 0; + + if (mod) + msk <<= (8 - mod); + + if (offset > mod) + set_bit(FBCON_BIT(7), (void *)&msk1); + + for (i = 0; i < vc->vc_font.width; i++) { + for (j = 0; j < width; j++) { + c = *src; + + if (attribute & FBCON_ATTRIBUTE_UNDERLINE) { + if (j == width - 1) + c |= msk; + + if (msk1 && j == width - 2) + c |= msk1; + } + + if (attribute & FBCON_ATTRIBUTE_BOLD && i) + *(dst - width) |= c; + + if (attribute & FBCON_ATTRIBUTE_REVERSE) + c = ~c; + src++; + *dst++ = c; + } + } +} + + +static void ccw_bmove(struct vc_data *vc, struct fb_info *info, int sy, + int sx, int dy, int dx, int height, int width) +{ + struct display *p = &fb_display[vc->vc_num]; + struct fb_copyarea area; + u32 vyres = GETVYRES(p->scrollmode, info); + + area.sx = sy * vc->vc_font.height; + area.sy = vyres - ((sx + width) * vc->vc_font.width); + area.dx = dy * vc->vc_font.height; + area.dy = vyres - ((dx + width) * vc->vc_font.width); + area.width = height * vc->vc_font.height; + area.height = width * vc->vc_font.width; + + info->fbops->fb_copyarea(info, &area); +} + +static void ccw_clear(struct vc_data *vc, struct fb_info *info, int sy, + int sx, int height, int width) +{ + struct display *p = &fb_display[vc->vc_num]; + struct fb_fillrect region; + int bgshift = (vc->vc_hi_font_mask) ? 13 : 12; + u32 vyres = GETVYRES(p->scrollmode, info); + + region.color = attr_bgcol_ec(bgshift,vc); + region.dx = sy * vc->vc_font.height; + region.dy = vyres - ((sx + width) * vc->vc_font.width); + region.height = width * vc->vc_font.width; + region.width = height * vc->vc_font.height; + region.rop = ROP_COPY; + + info->fbops->fb_fillrect(info, ®ion); +} + +static inline void ccw_putcs_aligned(struct vc_data *vc, struct fb_info *info, + const u16 *s, u32 attr, u32 cnt, + u32 d_pitch, u32 s_pitch, u32 cellsize, + struct fb_image *image, u8 *buf, u8 *dst) +{ + struct fbcon_ops *ops = info->fbcon_par; + u16 charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; + u32 idx = (vc->vc_font.height + 7) >> 3; + u8 *src; + + while (cnt--) { + src = ops->fontbuffer + (scr_readw(s--) & charmask)*cellsize; + + if (attr) { + ccw_update_attr(buf, src, attr, vc); + src = buf; + } + + if (likely(idx == 1)) + __fb_pad_aligned_buffer(dst, d_pitch, src, idx, + vc->vc_font.width); + else + fb_pad_aligned_buffer(dst, d_pitch, src, idx, + vc->vc_font.width); + + dst += d_pitch * vc->vc_font.width; + } + + info->fbops->fb_imageblit(info, image); +} + +static void ccw_putcs(struct vc_data *vc, struct fb_info *info, + const unsigned short *s, int count, int yy, int xx, + int fg, int bg) +{ + struct fb_image image; + struct display *p = &fb_display[vc->vc_num]; + struct fbcon_ops *ops = info->fbcon_par; + u32 width = (vc->vc_font.height + 7)/8; + u32 cellsize = width * vc->vc_font.width; + u32 maxcnt = info->pixmap.size/cellsize; + u32 scan_align = info->pixmap.scan_align - 1; + u32 buf_align = info->pixmap.buf_align - 1; + u32 cnt, pitch, size; + u32 attribute = get_attribute(info, scr_readw(s)); + u8 *dst, *buf = NULL; + u32 vyres = GETVYRES(p->scrollmode, info); + + if (!ops->fontbuffer) + return; + + image.fg_color = fg; + image.bg_color = bg; + image.dx = yy * vc->vc_font.height; + image.dy = vyres - ((xx + count) * vc->vc_font.width); + image.width = vc->vc_font.height; + image.depth = 1; + + if (attribute) { + buf = kmalloc(cellsize, GFP_KERNEL); + if (!buf) + return; + } + + s += count - 1; + + while (count) { + if (count > maxcnt) + cnt = maxcnt; + else + cnt = count; + + image.height = vc->vc_font.width * cnt; + pitch = ((image.width + 7) >> 3) + scan_align; + pitch &= ~scan_align; + size = pitch * image.height + buf_align; + size &= ~buf_align; + dst = fb_get_buffer_offset(info, &info->pixmap, size); + image.data = dst; + ccw_putcs_aligned(vc, info, s, attribute, cnt, pitch, + width, cellsize, &image, buf, dst); + image.dy += image.height; + count -= cnt; + s -= cnt; + } + + /* buf is always NULL except when in monochrome mode, so in this case + it's a gain to check buf against NULL even though kfree() handles + NULL pointers just fine */ + if (unlikely(buf)) + kfree(buf); + +} + +static void ccw_clear_margins(struct vc_data *vc, struct fb_info *info, + int bottom_only) +{ + unsigned int cw = vc->vc_font.width; + unsigned int ch = vc->vc_font.height; + unsigned int rw = info->var.yres - (vc->vc_cols*cw); + unsigned int bh = info->var.xres - (vc->vc_rows*ch); + unsigned int bs = vc->vc_rows*ch; + struct fb_fillrect region; + int bgshift = (vc->vc_hi_font_mask) ? 13 : 12; + + region.color = attr_bgcol_ec(bgshift,vc); + region.rop = ROP_COPY; + + if (rw && !bottom_only) { + region.dx = 0; + region.dy = info->var.yoffset; + region.height = rw; + region.width = info->var.xres_virtual; + info->fbops->fb_fillrect(info, ®ion); + } + + if (bh) { + region.dx = info->var.xoffset + bs; + region.dy = 0; + region.height = info->var.yres_virtual; + region.width = bh; + info->fbops->fb_fillrect(info, ®ion); + } +} + +static void ccw_cursor(struct vc_data *vc, struct fb_info *info, + struct display *p, int mode, int softback_lines, + int fg, int bg) +{ + struct fb_cursor cursor; + struct fbcon_ops *ops = (struct fbcon_ops *) info->fbcon_par; + unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; + int w = (vc->vc_font.height + 7) >> 3, c; + int y = real_y(p, vc->vc_y); + int attribute, use_sw = (vc->vc_cursor_type & 0x10); + int err = 1, dx, dy; + char *src; + u32 vyres = GETVYRES(p->scrollmode, info); + + if (!ops->fontbuffer) + return; + + cursor.set = 0; + + if (softback_lines) { + if (y + softback_lines >= vc->vc_rows) { + mode = CM_ERASE; + ops->cursor_flash = 0; + return; + } else + y += softback_lines; + } + + c = scr_readw((u16 *) vc->vc_pos); + attribute = get_attribute(info, c); + src = ops->fontbuffer + ((c & charmask) * (w * vc->vc_font.width)); + + if (ops->cursor_state.image.data != src || + ops->cursor_reset) { + ops->cursor_state.image.data = src; + cursor.set |= FB_CUR_SETIMAGE; + } + + if (attribute) { + u8 *dst; + + dst = kmalloc(w * vc->vc_font.width, GFP_ATOMIC); + if (!dst) + return; + kfree(ops->cursor_data); + ops->cursor_data = dst; + ccw_update_attr(dst, src, attribute, vc); + src = dst; + } + + if (ops->cursor_state.image.fg_color != fg || + ops->cursor_state.image.bg_color != bg || + ops->cursor_reset) { + ops->cursor_state.image.fg_color = fg; + ops->cursor_state.image.bg_color = bg; + cursor.set |= FB_CUR_SETCMAP; + } + + if (ops->cursor_state.image.height != vc->vc_font.width || + ops->cursor_state.image.width != vc->vc_font.height || + ops->cursor_reset) { + ops->cursor_state.image.height = vc->vc_font.width; + ops->cursor_state.image.width = vc->vc_font.height; + cursor.set |= FB_CUR_SETSIZE; + } + + dx = y * vc->vc_font.height; + dy = vyres - ((vc->vc_x + 1) * vc->vc_font.width); + + if (ops->cursor_state.image.dx != dx || + ops->cursor_state.image.dy != dy || + ops->cursor_reset) { + ops->cursor_state.image.dx = dx; + ops->cursor_state.image.dy = dy; + cursor.set |= FB_CUR_SETPOS; + } + + if (ops->cursor_state.hot.x || ops->cursor_state.hot.y || + ops->cursor_reset) { + ops->cursor_state.hot.x = cursor.hot.y = 0; + cursor.set |= FB_CUR_SETHOT; + } + + if (cursor.set & FB_CUR_SETSIZE || + vc->vc_cursor_type != p->cursor_shape || + ops->cursor_state.mask == NULL || + ops->cursor_reset) { + char *tmp, *mask = kmalloc(w*vc->vc_font.width, GFP_ATOMIC); + int cur_height, size, i = 0; + int width = (vc->vc_font.width + 7)/8; + + if (!mask) + return; + + tmp = kmalloc(width * vc->vc_font.height, GFP_ATOMIC); + + if (!tmp) { + kfree(mask); + return; + } + + kfree(ops->cursor_state.mask); + ops->cursor_state.mask = mask; + + p->cursor_shape = vc->vc_cursor_type; + cursor.set |= FB_CUR_SETSHAPE; + + switch (p->cursor_shape & CUR_HWMASK) { + case CUR_NONE: + cur_height = 0; + break; + case CUR_UNDERLINE: + cur_height = (vc->vc_font.height < 10) ? 1 : 2; + break; + case CUR_LOWER_THIRD: + cur_height = vc->vc_font.height/3; + break; + case CUR_LOWER_HALF: + cur_height = vc->vc_font.height >> 1; + break; + case CUR_TWO_THIRDS: + cur_height = (vc->vc_font.height << 1)/3; + break; + case CUR_BLOCK: + default: + cur_height = vc->vc_font.height; + break; + } + + size = (vc->vc_font.height - cur_height) * width; + while (size--) + tmp[i++] = 0; + size = cur_height * width; + while (size--) + tmp[i++] = 0xff; + memset(mask, 0, w * vc->vc_font.width); + rotate_ccw(tmp, mask, vc->vc_font.width, vc->vc_font.height); + kfree(tmp); + } + + switch (mode) { + case CM_ERASE: + ops->cursor_state.enable = 0; + break; + case CM_DRAW: + case CM_MOVE: + default: + ops->cursor_state.enable = (use_sw) ? 0 : 1; + break; + } + + cursor.image.data = src; + cursor.image.fg_color = ops->cursor_state.image.fg_color; + cursor.image.bg_color = ops->cursor_state.image.bg_color; + cursor.image.dx = ops->cursor_state.image.dx; + cursor.image.dy = ops->cursor_state.image.dy; + cursor.image.height = ops->cursor_state.image.height; + cursor.image.width = ops->cursor_state.image.width; + cursor.hot.x = ops->cursor_state.hot.x; + cursor.hot.y = ops->cursor_state.hot.y; + cursor.mask = ops->cursor_state.mask; + cursor.enable = ops->cursor_state.enable; + cursor.image.depth = 1; + cursor.rop = ROP_XOR; + + if (info->fbops->fb_cursor) + err = info->fbops->fb_cursor(info, &cursor); + + if (err) + soft_cursor(info, &cursor); + + ops->cursor_reset = 0; +} + +int ccw_update_start(struct fb_info *info) +{ + struct fbcon_ops *ops = info->fbcon_par; + struct display *p = &fb_display[ops->currcon]; + u32 yoffset; + u32 vyres = GETVYRES(p->scrollmode, info); + int err; + + yoffset = (vyres - info->var.yres) - ops->var.xoffset; + ops->var.xoffset = ops->var.yoffset; + ops->var.yoffset = yoffset; + err = fb_pan_display(info, &ops->var); + ops->var.xoffset = info->var.xoffset; + ops->var.yoffset = info->var.yoffset; + ops->var.vmode = info->var.vmode; + return err; +} + +void fbcon_rotate_ccw(struct fbcon_ops *ops) +{ + ops->bmove = ccw_bmove; + ops->clear = ccw_clear; + ops->putcs = ccw_putcs; + ops->clear_margins = ccw_clear_margins; + ops->cursor = ccw_cursor; + ops->update_start = ccw_update_start; +} +EXPORT_SYMBOL(fbcon_rotate_ccw); + +MODULE_AUTHOR("Antonino Daplas "); +MODULE_DESCRIPTION("Console Rotation (270 degrees) Support"); +MODULE_LICENSE("GPL"); diff --git a/drivers/video/console/fbcon_rotate.c b/drivers/video/console/fbcon_rotate.c index 3d64ad190ff8..ec0dd8fe241c 100644 --- a/drivers/video/console/fbcon_rotate.c +++ b/drivers/video/console/fbcon_rotate.c @@ -105,6 +105,9 @@ void fbcon_set_rotate(struct fbcon_ops *ops) case FB_ROTATE_UD: fbcon_rotate_ud(ops); break; + case FB_ROTATE_CCW: + fbcon_rotate_ccw(ops); + break; } } EXPORT_SYMBOL(fbcon_set_rotate); diff --git a/drivers/video/console/fbcon_rotate.h b/drivers/video/console/fbcon_rotate.h index f8ddcd6bd89c..90c672096c2e 100644 --- a/drivers/video/console/fbcon_rotate.h +++ b/drivers/video/console/fbcon_rotate.h @@ -101,4 +101,5 @@ static inline void rotate_ccw(const char *in, char *out, u32 width, u32 height) extern void fbcon_rotate_cw(struct fbcon_ops *ops); extern void fbcon_rotate_ud(struct fbcon_ops *ops); +extern void fbcon_rotate_ccw(struct fbcon_ops *ops); #endif -- cgit v1.2.2 From a812c94b94e3db76d1af68208fb3edef69070401 Mon Sep 17 00:00:00 2001 From: "Antonino A. Daplas" Date: Tue, 8 Nov 2005 21:39:15 -0800 Subject: [PATCH] fbcon: Console Rotation - Add ability to control rotation via sysfs Add ability to set rotation via sysfs. The attributes are located in /sys/class/graphics/fb[n] and accepts 0 - unrotated; 1 - clockwise; 2 - upside down; 3 - counterclockwise. The attributes are: con_rotate (r/w) - set rotation of the active console con_rotate_all (w) - set rotation of all consoles rotate (r/w) - set rotation of the framebuffer, if supported. Currently, none of the drivers support this. This is probably temporary, since con_rotate and con_rotate_all are console-specific and has no business being under the fb device. However, until the console layer acquires it's own sysfs class, these attributes will temporarily reside here. Signed-off-by: Antonino Daplas Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/video/console/fbcon.c | 72 +++++++++++++++++++++++++++++++++++++++++++ drivers/video/fbmem.c | 22 +++++++++++++ drivers/video/fbsysfs.c | 67 ++++++++++++++++++++++++++++++++++++++++ include/linux/fb.h | 7 +++++ 4 files changed, 168 insertions(+) diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c index e829ba18e0a5..e7802ffe549a 100644 --- a/drivers/video/console/fbcon.c +++ b/drivers/video/console/fbcon.c @@ -193,6 +193,8 @@ static void fbcon_preset_disp(struct fb_info *info, struct fb_var_screeninfo *va int unit); static void fbcon_redraw_move(struct vc_data *vc, struct display *p, int line, int count, int dy); +static void fbcon_modechanged(struct fb_info *info); +static void fbcon_set_all_vcs(struct fb_info *info); #ifdef CONFIG_MAC /* @@ -218,6 +220,51 @@ static inline void fbcon_set_rotation(struct fb_info *info, struct display *p) else ops->rotate = 0; } + +static void fbcon_rotate(struct fb_info *info, u32 rotate) +{ + struct fbcon_ops *ops= info->fbcon_par; + struct fb_info *fb_info; + + if (!ops || ops->currcon == -1) + return; + + fb_info = registered_fb[con2fb_map[ops->currcon]]; + + if (info == fb_info) { + struct display *p = &fb_display[ops->currcon]; + + if (rotate < 4) + p->con_rotate = rotate; + else + p->con_rotate = 0; + + fbcon_modechanged(info); + } +} + +static void fbcon_rotate_all(struct fb_info *info, u32 rotate) +{ + struct fbcon_ops *ops = info->fbcon_par; + struct vc_data *vc; + struct display *p; + int i; + + if (!ops || ops->currcon < 0 || rotate > 3) + return; + + for (i = 0; i < MAX_NR_CONSOLES; i++) { + vc = vc_cons[i].d; + if (!vc || vc->vc_mode != KD_TEXT || + registered_fb[con2fb_map[i]] != info) + continue; + + p = &fb_display[vc->vc_num]; + p->con_rotate = rotate; + } + + fbcon_set_all_vcs(info); +} #else static inline void fbcon_set_rotation(struct fb_info *info, struct display *p) { @@ -225,8 +272,25 @@ static inline void fbcon_set_rotation(struct fb_info *info, struct display *p) ops->rotate = FB_ROTATE_UR; } + +static void fbcon_rotate(struct fb_info *info, u32 rotate) +{ + return; +} + +static void fbcon_rotate_all(struct fb_info *info, u32 rotate) +{ + return; +} #endif /* CONFIG_FRAMEBUFFER_CONSOLE_ROTATION */ +static int fbcon_get_rotate(struct fb_info *info) +{ + struct fbcon_ops *ops = info->fbcon_par; + + return (ops) ? ops->rotate : 0; +} + static inline int fbcon_is_inactive(struct vc_data *vc, struct fb_info *info) { struct fbcon_ops *ops = info->fbcon_par; @@ -2864,6 +2928,14 @@ static int fbcon_event_notify(struct notifier_block *self, case FB_EVENT_NEW_MODELIST: fbcon_new_modelist(info); break; + case FB_EVENT_SET_CON_ROTATE: + fbcon_rotate(info, *(int *)event->data); + break; + case FB_EVENT_GET_CON_ROTATE: + ret = fbcon_get_rotate(info); + break; + case FB_EVENT_SET_CON_ROTATE_ALL: + fbcon_rotate_all(info, *(int *)event->data); } return ret; diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index 7a2a8fa50b3b..81b6cd23ea1d 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c @@ -1319,6 +1319,28 @@ int fb_new_modelist(struct fb_info *info) return err; } +/** + * fb_con_duit - user<->fbcon passthrough + * @info: struct fb_info + * @event: notification event to be passed to fbcon + * @data: private data + * + * DESCRIPTION + * This function is an fbcon-user event passing channel + * which bypasses fbdev. This is hopefully temporary + * until a user interface for fbcon is created + */ +int fb_con_duit(struct fb_info *info, int event, void *data) +{ + struct fb_event evnt; + + evnt.info = info; + evnt.data = data; + + return notifier_call_chain(&fb_notifier_list, event, &evnt); +} +EXPORT_SYMBOL(fb_con_duit); + static char *video_options[FB_MAX]; static int ofonly; diff --git a/drivers/video/fbsysfs.c b/drivers/video/fbsysfs.c index 007c8e9b2b39..08dac9580d15 100644 --- a/drivers/video/fbsysfs.c +++ b/drivers/video/fbsysfs.c @@ -213,6 +213,70 @@ static ssize_t show_bpp(struct class_device *class_device, char *buf) return snprintf(buf, PAGE_SIZE, "%d\n", fb_info->var.bits_per_pixel); } +static ssize_t store_rotate(struct class_device *class_device, const char *buf, + size_t count) +{ + struct fb_info *fb_info = class_get_devdata(class_device); + struct fb_var_screeninfo var; + char **last = NULL; + int err; + + var = fb_info->var; + var.rotate = simple_strtoul(buf, last, 0); + + if ((err = activate(fb_info, &var))) + return err; + + return count; +} + + +static ssize_t show_rotate(struct class_device *class_device, char *buf) +{ + struct fb_info *fb_info = class_get_devdata(class_device); + + return snprintf(buf, PAGE_SIZE, "%d\n", fb_info->var.rotate); +} + +static ssize_t store_con_rotate(struct class_device *class_device, + const char *buf, size_t count) +{ + struct fb_info *fb_info = class_get_devdata(class_device); + int rotate; + char **last = NULL; + + acquire_console_sem(); + rotate = simple_strtoul(buf, last, 0); + fb_con_duit(fb_info, FB_EVENT_SET_CON_ROTATE, &rotate); + release_console_sem(); + return count; +} + +static ssize_t store_con_rotate_all(struct class_device *class_device, + const char *buf, size_t count) +{ + struct fb_info *fb_info = class_get_devdata(class_device); + int rotate; + char **last = NULL; + + acquire_console_sem(); + rotate = simple_strtoul(buf, last, 0); + fb_con_duit(fb_info, FB_EVENT_SET_CON_ROTATE_ALL, &rotate); + release_console_sem(); + return count; +} + +static ssize_t show_con_rotate(struct class_device *class_device, char *buf) +{ + struct fb_info *fb_info = class_get_devdata(class_device); + int rotate; + + acquire_console_sem(); + rotate = fb_con_duit(fb_info, FB_EVENT_GET_CON_ROTATE, NULL); + release_console_sem(); + return snprintf(buf, PAGE_SIZE, "%d\n", rotate); +} + static ssize_t store_virtual(struct class_device *class_device, const char * buf, size_t count) { @@ -440,6 +504,9 @@ static struct class_device_attribute class_device_attrs[] = { __ATTR(virtual_size, S_IRUGO|S_IWUSR, show_virtual, store_virtual), __ATTR(name, S_IRUGO, show_name, NULL), __ATTR(stride, S_IRUGO, show_stride, NULL), + __ATTR(rotate, S_IRUGO|S_IWUSR, show_rotate, store_rotate), + __ATTR(con_rotate, S_IRUGO|S_IWUSR, show_con_rotate, store_con_rotate), + __ATTR(con_rotate_all, S_IWUSR, NULL, store_con_rotate_all), }; int fb_init_class_device(struct fb_info *fb_info) diff --git a/include/linux/fb.h b/include/linux/fb.h index 357dd3a0a01e..04a58f33ec53 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -508,6 +508,12 @@ struct fb_cursor_user { /* The resolution of the passed in fb_info about to change and all vc's should be changed */ #define FB_EVENT_MODE_CHANGE_ALL 0x0A +/* CONSOLE-SPECIFIC: set console rotation */ +#define FB_EVENT_SET_CON_ROTATE 0x0B +/* CONSOLE-SPECIFIC: get console rotation */ +#define FB_EVENT_GET_CON_ROTATE 0x0C +/* CONSOLE-SPECIFIC: rotate all consoles */ +#define FB_EVENT_SET_CON_ROTATE_ALL 0x0D struct fb_event { struct fb_info *info; @@ -836,6 +842,7 @@ extern int fb_get_color_depth(struct fb_var_screeninfo *var, struct fb_fix_screeninfo *fix); extern int fb_get_options(char *name, char **option); extern int fb_new_modelist(struct fb_info *info); +extern int fb_con_duit(struct fb_info *info, int event, void *data); extern struct fb_info *registered_fb[FB_MAX]; extern int num_registered_fb; -- cgit v1.2.2 From efb985f6b265faed75426010e84a79de972c640a Mon Sep 17 00:00:00 2001 From: "Antonino A. Daplas" Date: Tue, 8 Nov 2005 21:39:15 -0800 Subject: [PATCH] fbcon: Console Rotation - Add framebuffer console documentation Add documentation as Documentation/fb/fbcon.txt describing the framebuffer console and its boot options. Signed-off-by: Antonino Daplas Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/fb/fbcon.txt | 152 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 Documentation/fb/fbcon.txt diff --git a/Documentation/fb/fbcon.txt b/Documentation/fb/fbcon.txt new file mode 100644 index 000000000000..08dce0f631bf --- /dev/null +++ b/Documentation/fb/fbcon.txt @@ -0,0 +1,152 @@ +The Framebuffer Console +======================= + + The framebuffer console (fbcon), as its name implies, is a text +console running on top of the framebuffer device. It has the functionality of +any standard text console driver, such as the VGA console, with the added +features that can be attributed to the graphical nature of the framebuffer. + + In the x86 architecture, the framebuffer console is optional, and +some even treat it as a toy. For other architectures, it is the only available +display device, text or graphical. + + What are the features of fbcon? The framebuffer console supports +high resolutions, varying font types, display rotation, primitive multihead, +etc. Theoretically, multi-colored fonts, blending, aliasing, and any feature +made available by the underlying graphics card are also possible. + +A. Configuration + + The framebuffer console can be enabled by using your favorite kernel +configuration tool. It is under Device Drivers->Graphics Support->Support for +framebuffer devices->Framebuffer Console Support. Select 'y' to compile +support statically, or 'm' for module support. The module will be fbcon. + + In order for fbcon to activate, at least one framebuffer driver is +required, so choose from any of the numerous drivers available. For x86 +systems, they almost universally have VGA cards, so vga16fb and vesafb will +always be available. However, using a chipset-specific driver will give you +more speed and features, such as the ability to change the video mode +dynamically. + + To display the penguin logo, choose any logo available in Logo +Configuration->Boot up logo. + + Also, you will need to select at least one compiled-in fonts, but if +you don't do anything, the kernel configuration tool will select one for you, +usually an 8x16 font. + +GOTCHA: A common bug report is enabling the framebuffer without enabling the +framebuffer console. Depending on the driver, you may get a blanked or +garbled display, but the system still boots to completion. If you are +fortunate to have a driver that does not alter the graphics chip, then you +will still get a VGA console. + +B. Loading + +Possible scenarios: + +1. Driver and fbcon are compiled statically + + Usually, fbcon will automatically take over your console. The notable + exception is vesafb. It needs to be explicitly activated with the + vga= boot option parameter. + +2. Driver is compiled statically, fbcon is compiled as a module + + Depending on the driver, you either get a standard console, or a + garbled display, as mentioned above. To get a framebuffer console, + do a 'modprobe fbcon'. + +3. Driver is compiled as a module, fbcon is compiled statically + + You get your standard console. Once the driver is loaded with + 'modprobe xxxfb', fbcon automatically takes over the console with + the possible exception of using the fbcon=map:n option. See below. + +4. Driver and fbcon are compiled as a module. + + You can load them in any order. Once both are loaded, fbcon will take + over the console. + +C. Boot options + + The framebuffer console has several, largely unknown, boot options + that can change its behavior. + +1. fbcon=font: + + Select the initial font to use. The value 'name' can be any of the + compiled-in fonts: VGA8x16, 7x14, 10x18, VGA8x8, MINI4x6, RomanLarge, + SUN8x16, SUN12x22, ProFont6x11, Acorn8x8, PEARL8x8. + + Note, not all drivers can handle font with widths not divisible by 8, + such as vga16fb. + +2. fbcon=scrollback:[k] + + The scrollback buffer is memory that is used to preserve display + contents that has already scrolled past your view. This is accessed + by using the Shift-PageUp key combination. The value 'value' is any + integer. It defaults to 32KB. The 'k' suffix is optional, and will + multiply the 'value' by 1024. + +3. fbcon=map:<0123> + + This is an interesting option. It tells which driver gets mapped to + which console. The value '0123' is a sequence that gets repeated until + the total length is 64 which is the number of consoles available. In + the above example, it is expanded to 012301230123... and the mapping + will be: + + tty | 1 2 3 4 5 6 7 8 9 ... + fb | 0 1 2 3 0 1 2 3 0 ... + + ('cat /proc/fb' should tell you what the fb numbers are) + + One side effect that may be useful is using a map value that exceeds + the number of loaded fb drivers. For example, if only one driver is + available, fb0, adding fbcon=map:1 tells fbcon not to take over the + console. + + Later on, when you want to map the console the to the framebuffer + device, you can use the con2fbmap utility. + +4. fbcon=vc:- + + This option tells fbcon to take over only a range of consoles as + specified by the values 'n1' and 'n2'. The rest of the consoles + outside the given range will still be controlled by the standard + console driver. + + NOTE: For x86 machines, the standard console is the VGA console which + is typically located on the same video card. Thus, the consoles that + are controlled by the VGA console will be garbled. + +4. fbcon=rotate: + + This option changes the orientation angle of the console display. The + value 'n' accepts the following: + + 0 - normal orientation (0 degree) + 1 - clockwise orientation (90 degrees) + 2 - upside down orientation (180 degrees) + 3 - counterclockwise orientation (270 degrees) + + The angle can be changed anytime afterwards by 'echoing' the same + numbers to any one of the 2 attributes found in + /sys/class/graphics/fb{x} + + con_rotate - rotate the display of the active console + con_rotate_all - rotate the display of all consoles + + Console rotation will only become available if Console Rotation + Support is compiled in your kernel. + + NOTE: This is purely console rotation. Any other applications that + use the framebuffer will remain at their 'normal'orientation. + Actually, the underlying fb driver is totally ignorant of console + rotation. + +--- +Antonino Daplas -- cgit v1.2.2 From 120ddb41f18c2d41702af561f4acfbcbd8d6fb46 Mon Sep 17 00:00:00 2001 From: "Antonino A. Daplas" Date: Tue, 8 Nov 2005 21:39:16 -0800 Subject: [PATCH] vga16fb: Convert vga16fb as a platform device - Convert vga16fb as a platform device - use framebuffer_alloc() to dynamically allocate resources, and framebuffer_release() to free - remove unneeded casts - trivial whitespace changes Signed-off-by: Antonino Daplas Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/video/vga16fb.c | 169 +++++++++++++++++++++++++++++++----------------- 1 file changed, 110 insertions(+), 59 deletions(-) diff --git a/drivers/video/vga16fb.c b/drivers/video/vga16fb.c index 690bb6fe8281..226ae8a88482 100644 --- a/drivers/video/vga16fb.c +++ b/drivers/video/vga16fb.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include