aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/media/pci/cx88
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/pci/cx88')
-rw-r--r--drivers/media/pci/cx88/cx88-alsa.c304
-rw-r--r--drivers/media/pci/cx88/cx88-blackbird.c292
-rw-r--r--drivers/media/pci/cx88/cx88-cards.c485
-rw-r--r--drivers/media/pci/cx88/cx88-core.c420
-rw-r--r--drivers/media/pci/cx88/cx88-dsp.c136
-rw-r--r--drivers/media/pci/cx88/cx88-dvb.c331
-rw-r--r--drivers/media/pci/cx88/cx88-i2c.c136
-rw-r--r--drivers/media/pci/cx88/cx88-input.c60
-rw-r--r--drivers/media/pci/cx88/cx88-mpeg.c315
-rw-r--r--drivers/media/pci/cx88/cx88-reg.h123
-rw-r--r--drivers/media/pci/cx88/cx88-tvaudio.c169
-rw-r--r--drivers/media/pci/cx88/cx88-vbi.c47
-rw-r--r--drivers/media/pci/cx88/cx88-video.c403
-rw-r--r--drivers/media/pci/cx88/cx88-vp3054-i2c.c60
-rw-r--r--drivers/media/pci/cx88/cx88-vp3054-i2c.h38
-rw-r--r--drivers/media/pci/cx88/cx88.h203
16 files changed, 1766 insertions, 1756 deletions
diff --git a/drivers/media/pci/cx88/cx88-alsa.c b/drivers/media/pci/cx88/cx88-alsa.c
index 723f06462104..c81fe4681d14 100644
--- a/drivers/media/pci/cx88/cx88-alsa.c
+++ b/drivers/media/pci/cx88/cx88-alsa.c
@@ -1,5 +1,4 @@
/*
- *
* Support for audio capture
* PCI function #1 of the cx2388x.
*
@@ -18,14 +17,14 @@
* 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 "cx88.h"
+#include "cx88-reg.h"
+
#include <linux/module.h>
#include <linux/init.h>
+#include <linux/delay.h>
#include <linux/device.h>
#include <linux/interrupt.h>
#include <linux/vmalloc.h>
@@ -33,7 +32,6 @@
#include <linux/pci.h>
#include <linux/slab.h>
-#include <asm/delay.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
@@ -42,22 +40,15 @@
#include <sound/tlv.h>
#include <media/i2c/wm8775.h>
-#include "cx88.h"
-#include "cx88-reg.h"
-
#define dprintk(level, fmt, arg...) do { \
if (debug + 1 > level) \
- printk(KERN_INFO "%s/1: " fmt, chip->core->name , ## arg);\
-} while(0)
-
-#define dprintk_core(level, fmt, arg...) do { \
- if (debug + 1 > level) \
- printk(KERN_DEBUG "%s/1: " fmt, chip->core->name , ## arg);\
-} while(0)
+ printk(KERN_DEBUG pr_fmt("%s: alsa: " fmt), \
+ chip->core->name, ##arg); \
+} while (0)
-/****************************************************************************
- Data type declarations - Can be moded to a header file later
- ****************************************************************************/
+/*
+ * Data type declarations - Can be moded to a header file later
+ */
struct cx88_audio_buffer {
unsigned int bpl;
@@ -91,13 +82,10 @@ struct cx88_audio_dev {
struct snd_pcm_substream *substream;
};
-typedef struct cx88_audio_dev snd_cx88_card_t;
-
-
-/****************************************************************************
- Module global static vars
- ****************************************************************************/
+/*
+ * Module global static vars
+ */
static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
static const char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
@@ -109,10 +97,9 @@ MODULE_PARM_DESC(enable, "Enable cx88x soundcard. default enabled.");
module_param_array(index, int, NULL, 0444);
MODULE_PARM_DESC(index, "Index value for cx88x capture interface(s).");
-
-/****************************************************************************
- Module macros
- ****************************************************************************/
+/*
+ * Module macros
+ */
MODULE_DESCRIPTION("ALSA driver module for cx2388x based TV cards");
MODULE_AUTHOR("Ricardo Cerqueira");
@@ -120,25 +107,23 @@ MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@infradead.org>");
MODULE_LICENSE("GPL");
MODULE_VERSION(CX88_VERSION);
-MODULE_SUPPORTED_DEVICE("{{Conexant,23881},"
- "{{Conexant,23882},"
- "{{Conexant,23883}");
+MODULE_SUPPORTED_DEVICE("{{Conexant,23881},{{Conexant,23882},{{Conexant,23883}");
static unsigned int debug;
-module_param(debug,int,0644);
-MODULE_PARM_DESC(debug,"enable debug messages");
+module_param(debug, int, 0644);
+MODULE_PARM_DESC(debug, "enable debug messages");
-/****************************************************************************
- Module specific funtions
- ****************************************************************************/
+/*
+ * Module specific functions
+ */
/*
* BOARD Specific: Sets audio DMA
*/
-static int _cx88_start_audio_dma(snd_cx88_card_t *chip)
+static int _cx88_start_audio_dma(struct cx88_audio_dev *chip)
{
struct cx88_audio_buffer *buf = chip->buf;
- struct cx88_core *core=chip->core;
+ struct cx88_core *core = chip->core;
const struct sram_channel *audio_ch = &cx88_sram_channels[SRAM_CH25];
/* Make sure RISC/FIFO are off before changing FIFO/RISC settings */
@@ -154,8 +139,9 @@ static int _cx88_start_audio_dma(snd_cx88_card_t *chip)
cx_write(MO_AUDD_GPCNTRL, GP_COUNT_CONTROL_RESET);
atomic_set(&chip->count, 0);
- dprintk(1, "Start audio DMA, %d B/line, %d lines/FIFO, %d periods, %d "
- "byte buffer\n", buf->bpl, cx_read(audio_ch->cmds_start + 8)>>1,
+ dprintk(1,
+ "Start audio DMA, %d B/line, %d lines/FIFO, %d periods, %d byte buffer\n",
+ buf->bpl, cx_read(audio_ch->cmds_start + 8) >> 1,
chip->num_periods, buf->bpl * chip->num_periods);
/* Enables corresponding bits at AUD_INT_STAT */
@@ -169,8 +155,11 @@ static int _cx88_start_audio_dma(snd_cx88_card_t *chip)
cx_set(MO_PCI_INTMSK, chip->core->pci_irqmask | PCI_INT_AUDINT);
/* start dma */
- cx_set(MO_DEV_CNTRL2, (1<<5)); /* Enables Risc Processor */
- cx_set(MO_AUD_DMACNTRL, 0x11); /* audio downstream FIFO and RISC enable */
+
+ /* Enables Risc Processor */
+ cx_set(MO_DEV_CNTRL2, (1 << 5));
+ /* audio downstream FIFO and RISC enable */
+ cx_set(MO_AUD_DMACNTRL, 0x11);
if (debug)
cx88_sram_channel_dump(chip->core, audio_ch);
@@ -181,9 +170,10 @@ static int _cx88_start_audio_dma(snd_cx88_card_t *chip)
/*
* BOARD Specific: Resets audio DMA
*/
-static int _cx88_stop_audio_dma(snd_cx88_card_t *chip)
+static int _cx88_stop_audio_dma(struct cx88_audio_dev *chip)
{
- struct cx88_core *core=chip->core;
+ struct cx88_core *core = chip->core;
+
dprintk(1, "Stopping audio DMA\n");
/* stop dma */
@@ -195,7 +185,8 @@ static int _cx88_stop_audio_dma(snd_cx88_card_t *chip)
AUD_INT_DN_RISCI2 | AUD_INT_DN_RISCI1);
if (debug)
- cx88_sram_channel_dump(chip->core, &cx88_sram_channels[SRAM_CH25]);
+ cx88_sram_channel_dump(chip->core,
+ &cx88_sram_channels[SRAM_CH25]);
return 0;
}
@@ -221,7 +212,7 @@ static const char *cx88_aud_irqs[32] = {
/*
* BOARD Specific: Threats IRQ audio specific calls
*/
-static void cx8801_aud_irq(snd_cx88_card_t *chip)
+static void cx8801_aud_irq(struct cx88_audio_dev *chip)
{
struct cx88_core *core = chip->core;
u32 status, mask;
@@ -232,12 +223,12 @@ static void cx8801_aud_irq(snd_cx88_card_t *chip)
return;
cx_write(MO_AUD_INTSTAT, status);
if (debug > 1 || (status & mask & ~0xff))
- cx88_print_irqbits(core->name, "irq aud",
+ cx88_print_irqbits("irq aud",
cx88_aud_irqs, ARRAY_SIZE(cx88_aud_irqs),
status, mask);
/* risc op code error */
if (status & AUD_INT_OPC_ERR) {
- printk(KERN_WARNING "%s/1: Audio risc op code error\n",core->name);
+ pr_warn("Audio risc op code error\n");
cx_clear(MO_AUD_DMACNTRL, 0x11);
cx88_sram_channel_dump(core, &cx88_sram_channels[SRAM_CH25]);
}
@@ -259,7 +250,7 @@ static void cx8801_aud_irq(snd_cx88_card_t *chip)
*/
static irqreturn_t cx8801_irq(int irq, void *dev_id)
{
- snd_cx88_card_t *chip = dev_id;
+ struct cx88_audio_dev *chip = dev_id;
struct cx88_core *core = chip->core;
u32 status;
int loop, handled = 0;
@@ -267,7 +258,7 @@ static irqreturn_t cx8801_irq(int irq, void *dev_id)
for (loop = 0; loop < MAX_IRQ_LOOP; loop++) {
status = cx_read(MO_PCI_INTSTAT) &
(core->pci_irqmask | PCI_INT_AUDINT);
- if (0 == status)
+ if (status == 0)
goto out;
dprintk(3, "cx8801_irq loop %d/%d, status %x\n",
loop, MAX_IRQ_LOOP, status);
@@ -280,10 +271,8 @@ static irqreturn_t cx8801_irq(int irq, void *dev_id)
cx8801_aud_irq(chip);
}
- if (MAX_IRQ_LOOP == loop) {
- printk(KERN_ERR
- "%s/1: IRQ loop detected, disabling interrupts\n",
- core->name);
+ if (loop == MAX_IRQ_LOOP) {
+ pr_err("IRQ loop detected, disabling interrupts\n");
cx_clear(MO_PCI_INTMSK, PCI_INT_AUDINT);
}
@@ -298,26 +287,25 @@ static int cx88_alsa_dma_init(struct cx88_audio_dev *chip, int nr_pages)
int i;
buf->vaddr = vmalloc_32(nr_pages << PAGE_SHIFT);
- if (NULL == buf->vaddr) {
+ if (!buf->vaddr) {
dprintk(1, "vmalloc_32(%d pages) failed\n", nr_pages);
return -ENOMEM;
}
dprintk(1, "vmalloc is at addr 0x%08lx, size=%d\n",
- (unsigned long)buf->vaddr,
- nr_pages << PAGE_SHIFT);
+ (unsigned long)buf->vaddr, nr_pages << PAGE_SHIFT);
memset(buf->vaddr, 0, nr_pages << PAGE_SHIFT);
buf->nr_pages = nr_pages;
buf->sglist = vzalloc(buf->nr_pages * sizeof(*buf->sglist));
- if (NULL == buf->sglist)
+ if (!buf->sglist)
goto vzalloc_err;
sg_init_table(buf->sglist, buf->nr_pages);
for (i = 0; i < buf->nr_pages; i++) {
pg = vmalloc_to_page(buf->vaddr + i * PAGE_SIZE);
- if (NULL == pg)
+ if (!pg)
goto vmalloc_to_page_err;
sg_set_page(&buf->sglist[i], pg, PAGE_SIZE, 0);
}
@@ -339,7 +327,7 @@ static int cx88_alsa_dma_map(struct cx88_audio_dev *dev)
buf->sglen = dma_map_sg(&dev->pci->dev, buf->sglist,
buf->nr_pages, PCI_DMA_FROMDEVICE);
- if (0 == buf->sglen) {
+ if (buf->sglen == 0) {
pr_warn("%s: cx88_alsa_map_sg failed\n", __func__);
return -ENOMEM;
}
@@ -353,7 +341,8 @@ static int cx88_alsa_dma_unmap(struct cx88_audio_dev *dev)
if (!buf->sglen)
return 0;
- dma_unmap_sg(&dev->pci->dev, buf->sglist, buf->sglen, PCI_DMA_FROMDEVICE);
+ dma_unmap_sg(&dev->pci->dev, buf->sglist, buf->sglen,
+ PCI_DMA_FROMDEVICE);
buf->sglen = 0;
return 0;
}
@@ -367,18 +356,18 @@ static int cx88_alsa_dma_free(struct cx88_audio_buffer *buf)
return 0;
}
-
-static int dsp_buffer_free(snd_cx88_card_t *chip)
+static int dsp_buffer_free(struct cx88_audio_dev *chip)
{
struct cx88_riscmem *risc = &chip->buf->risc;
- BUG_ON(!chip->dma_size);
+ WARN_ON(!chip->dma_size);
- dprintk(2,"Freeing buffer\n");
+ dprintk(2, "Freeing buffer\n");
cx88_alsa_dma_unmap(chip);
cx88_alsa_dma_free(chip->buf);
if (risc->cpu)
- pci_free_consistent(chip->pci, risc->size, risc->cpu, risc->dma);
+ pci_free_consistent(chip->pci, risc->size,
+ risc->cpu, risc->dma);
kfree(chip->buf);
chip->buf = NULL;
@@ -386,9 +375,9 @@ static int dsp_buffer_free(snd_cx88_card_t *chip)
return 0;
}
-/****************************************************************************
- ALSA PCM Interface
- ****************************************************************************/
+/*
+ * ALSA PCM Interface
+ */
/*
* Digital hardware definition
@@ -406,13 +395,15 @@ static const struct snd_pcm_hardware snd_cx88_digital_hw = {
.rate_max = 48000,
.channels_min = 2,
.channels_max = 2,
- /* Analog audio output will be full of clicks and pops if there
- are not exactly four lines in the SRAM FIFO buffer. */
- .period_bytes_min = DEFAULT_FIFO_SIZE/4,
- .period_bytes_max = DEFAULT_FIFO_SIZE/4,
+ /*
+ * Analog audio output will be full of clicks and pops if there
+ * are not exactly four lines in the SRAM FIFO buffer.
+ */
+ .period_bytes_min = DEFAULT_FIFO_SIZE / 4,
+ .period_bytes_max = DEFAULT_FIFO_SIZE / 4,
.periods_min = 1,
.periods_max = 1024,
- .buffer_bytes_max = (1024*1024),
+ .buffer_bytes_max = (1024 * 1024),
};
/*
@@ -420,17 +411,17 @@ static const struct snd_pcm_hardware snd_cx88_digital_hw = {
*/
static int snd_cx88_pcm_open(struct snd_pcm_substream *substream)
{
- snd_cx88_card_t *chip = snd_pcm_substream_chip(substream);
+ struct cx88_audio_dev *chip = snd_pcm_substream_chip(substream);
struct snd_pcm_runtime *runtime = substream->runtime;
int err;
if (!chip) {
- printk(KERN_ERR "BUG: cx88 can't find device struct."
- " Can't proceed with open\n");
+ pr_err("BUG: cx88 can't find device struct. Can't proceed with open\n");
return -ENODEV;
}
- err = snd_pcm_hw_constraint_pow2(runtime, 0, SNDRV_PCM_HW_PARAM_PERIODS);
+ err = snd_pcm_hw_constraint_pow2(runtime, 0,
+ SNDRV_PCM_HW_PARAM_PERIODS);
if (err < 0)
goto _error;
@@ -440,6 +431,7 @@ static int snd_cx88_pcm_open(struct snd_pcm_substream *substream)
if (cx88_sram_channels[SRAM_CH25].fifo_size != DEFAULT_FIFO_SIZE) {
unsigned int bpl = cx88_sram_channels[SRAM_CH25].fifo_size / 4;
+
bpl &= ~7; /* must be multiple of 8 */
runtime->hw.period_bytes_min = bpl;
runtime->hw.period_bytes_max = bpl;
@@ -447,7 +439,7 @@ static int snd_cx88_pcm_open(struct snd_pcm_substream *substream)
return 0;
_error:
- dprintk(1,"Error opening PCM!\n");
+ dprintk(1, "Error opening PCM!\n");
return err;
}
@@ -462,10 +454,10 @@ static int snd_cx88_close(struct snd_pcm_substream *substream)
/*
* hw_params callback
*/
-static int snd_cx88_hw_params(struct snd_pcm_substream * substream,
- struct snd_pcm_hw_params * hw_params)
+static int snd_cx88_hw_params(struct snd_pcm_substream *substream,
+ struct snd_pcm_hw_params *hw_params)
{
- snd_cx88_card_t *chip = snd_pcm_substream_chip(substream);
+ struct cx88_audio_dev *chip = snd_pcm_substream_chip(substream);
struct cx88_audio_buffer *buf;
int ret;
@@ -479,18 +471,18 @@ static int snd_cx88_hw_params(struct snd_pcm_substream * substream,
chip->num_periods = params_periods(hw_params);
chip->dma_size = chip->period_size * params_periods(hw_params);
- BUG_ON(!chip->dma_size);
- BUG_ON(chip->num_periods & (chip->num_periods-1));
+ WARN_ON(!chip->dma_size);
+ WARN_ON(chip->num_periods & (chip->num_periods - 1));
buf = kzalloc(sizeof(*buf), GFP_KERNEL);
- if (NULL == buf)
+ if (!buf)
return -ENOMEM;
chip->buf = buf;
buf->bpl = chip->period_size;
ret = cx88_alsa_dma_init(chip,
- (PAGE_ALIGN(chip->dma_size) >> PAGE_SHIFT));
+ (PAGE_ALIGN(chip->dma_size) >> PAGE_SHIFT));
if (ret < 0)
goto error;
@@ -504,7 +496,7 @@ static int snd_cx88_hw_params(struct snd_pcm_substream * substream,
goto error;
/* Loop back to start of program */
- buf->risc.jmp[0] = cpu_to_le32(RISC_JUMP|RISC_IRQ1|RISC_CNT_INC);
+ buf->risc.jmp[0] = cpu_to_le32(RISC_JUMP | RISC_IRQ1 | RISC_CNT_INC);
buf->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
substream->runtime->dma_area = chip->buf->vaddr;
@@ -520,10 +512,9 @@ error:
/*
* hw free callback
*/
-static int snd_cx88_hw_free(struct snd_pcm_substream * substream)
+static int snd_cx88_hw_free(struct snd_pcm_substream *substream)
{
-
- snd_cx88_card_t *chip = snd_pcm_substream_chip(substream);
+ struct cx88_audio_dev *chip = snd_pcm_substream_chip(substream);
if (substream->runtime->dma_area) {
dsp_buffer_free(chip);
@@ -546,7 +537,7 @@ static int snd_cx88_prepare(struct snd_pcm_substream *substream)
*/
static int snd_cx88_card_trigger(struct snd_pcm_substream *substream, int cmd)
{
- snd_cx88_card_t *chip = snd_pcm_substream_chip(substream);
+ struct cx88_audio_dev *chip = snd_pcm_substream_chip(substream);
int err;
/* Local interrupts are already disabled by ALSA */
@@ -554,13 +545,13 @@ static int snd_cx88_card_trigger(struct snd_pcm_substream *substream, int cmd)
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
- err=_cx88_start_audio_dma(chip);
+ err = _cx88_start_audio_dma(chip);
break;
case SNDRV_PCM_TRIGGER_STOP:
- err=_cx88_stop_audio_dma(chip);
+ err = _cx88_stop_audio_dma(chip);
break;
default:
- err=-EINVAL;
+ err = -EINVAL;
break;
}
@@ -574,7 +565,7 @@ static int snd_cx88_card_trigger(struct snd_pcm_substream *substream, int cmd)
*/
static snd_pcm_uframes_t snd_cx88_pointer(struct snd_pcm_substream *substream)
{
- snd_cx88_card_t *chip = snd_pcm_substream_chip(substream);
+ struct cx88_audio_dev *chip = snd_pcm_substream_chip(substream);
struct snd_pcm_runtime *runtime = substream->runtime;
u16 count;
@@ -583,16 +574,17 @@ static snd_pcm_uframes_t snd_cx88_pointer(struct snd_pcm_substream *substream)
// dprintk(2, "%s - count %d (+%u), period %d, frame %lu\n", __func__,
// count, new, count & (runtime->periods-1),
// runtime->period_size * (count & (runtime->periods-1)));
- return runtime->period_size * (count & (runtime->periods-1));
+ return runtime->period_size * (count & (runtime->periods - 1));
}
/*
* page callback (needed for mmap)
*/
static struct page *snd_cx88_page(struct snd_pcm_substream *substream,
- unsigned long offset)
+ unsigned long offset)
{
void *pageptr = substream->runtime->dma_area + offset;
+
return vmalloc_to_page(pageptr);
}
@@ -614,7 +606,8 @@ static const struct snd_pcm_ops snd_cx88_pcm_ops = {
/*
* create a PCM device
*/
-static int snd_cx88_pcm(snd_cx88_card_t *chip, int device, const char *name)
+static int snd_cx88_pcm(struct cx88_audio_dev *chip, int device,
+ const char *name)
{
int err;
struct snd_pcm *pcm;
@@ -629,9 +622,9 @@ static int snd_cx88_pcm(snd_cx88_card_t *chip, int device, const char *name)
return 0;
}
-/****************************************************************************
- CONTROL INTERFACE
- ****************************************************************************/
+/*
+ * CONTROL INTERFACE
+ */
static int snd_cx88_volume_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *info)
{
@@ -646,8 +639,8 @@ static int snd_cx88_volume_info(struct snd_kcontrol *kcontrol,
static int snd_cx88_volume_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *value)
{
- snd_cx88_card_t *chip = snd_kcontrol_chip(kcontrol);
- struct cx88_core *core=chip->core;
+ struct cx88_audio_dev *chip = snd_kcontrol_chip(kcontrol);
+ struct cx88_core *core = chip->core;
int vol = 0x3f - (cx_read(AUD_VOL_CTL) & 0x3f),
bal = cx_read(AUD_BAL_CTL);
@@ -659,9 +652,9 @@ static int snd_cx88_volume_get(struct snd_kcontrol *kcontrol,
}
static void snd_cx88_wm8775_volume_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *value)
+ struct snd_ctl_elem_value *value)
{
- snd_cx88_card_t *chip = snd_kcontrol_chip(kcontrol);
+ struct cx88_audio_dev *chip = snd_kcontrol_chip(kcontrol);
struct cx88_core *core = chip->core;
int left = value->value.integer.value[0];
int right = value->value.integer.value[1];
@@ -683,8 +676,8 @@ static void snd_cx88_wm8775_volume_put(struct snd_kcontrol *kcontrol,
static int snd_cx88_volume_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *value)
{
- snd_cx88_card_t *chip = snd_kcontrol_chip(kcontrol);
- struct cx88_core *core=chip->core;
+ struct cx88_audio_dev *chip = snd_kcontrol_chip(kcontrol);
+ struct cx88_core *core = chip->core;
int left, right, v, b;
int changed = 0;
u32 old;
@@ -733,7 +726,7 @@ static const struct snd_kcontrol_new snd_cx88_volume = {
static int snd_cx88_switch_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *value)
{
- snd_cx88_card_t *chip = snd_kcontrol_chip(kcontrol);
+ struct cx88_audio_dev *chip = snd_kcontrol_chip(kcontrol);
struct cx88_core *core = chip->core;
u32 bit = kcontrol->private_value;
@@ -742,9 +735,9 @@ static int snd_cx88_switch_get(struct snd_kcontrol *kcontrol,
}
static int snd_cx88_switch_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *value)
+ struct snd_ctl_elem_value *value)
{
- snd_cx88_card_t *chip = snd_kcontrol_chip(kcontrol);
+ struct cx88_audio_dev *chip = snd_kcontrol_chip(kcontrol);
struct cx88_core *core = chip->core;
u32 bit = kcontrol->private_value;
int ret = 0;
@@ -756,8 +749,9 @@ static int snd_cx88_switch_put(struct snd_kcontrol *kcontrol,
vol ^= bit;
cx_swrite(SHADOW_AUD_VOL_CTL, AUD_VOL_CTL, vol);
/* Pass mute onto any WM8775 */
- if (core->sd_wm8775 && ((1<<6) == bit))
- wm8775_s_ctrl(core, V4L2_CID_AUDIO_MUTE, 0 != (vol & bit));
+ if (core->sd_wm8775 && ((1 << 6) == bit))
+ wm8775_s_ctrl(core,
+ V4L2_CID_AUDIO_MUTE, 0 != (vol & bit));
ret = 1;
}
spin_unlock_irq(&chip->reg_lock);
@@ -770,7 +764,7 @@ static const struct snd_kcontrol_new snd_cx88_dac_switch = {
.info = snd_ctl_boolean_mono_info,
.get = snd_cx88_switch_get,
.put = snd_cx88_switch_put,
- .private_value = (1<<8),
+ .private_value = (1 << 8),
};
static const struct snd_kcontrol_new snd_cx88_source_switch = {
@@ -779,13 +773,13 @@ static const struct snd_kcontrol_new snd_cx88_source_switch = {
.info = snd_ctl_boolean_mono_info,
.get = snd_cx88_switch_get,
.put = snd_cx88_switch_put,
- .private_value = (1<<6),
+ .private_value = (1 << 6),
};
static int snd_cx88_alc_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *value)
+ struct snd_ctl_elem_value *value)
{
- snd_cx88_card_t *chip = snd_kcontrol_chip(kcontrol);
+ struct cx88_audio_dev *chip = snd_kcontrol_chip(kcontrol);
struct cx88_core *core = chip->core;
s32 val;
@@ -795,9 +789,9 @@ static int snd_cx88_alc_get(struct snd_kcontrol *kcontrol,
}
static int snd_cx88_alc_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *value)
+ struct snd_ctl_elem_value *value)
{
- snd_cx88_card_t *chip = snd_kcontrol_chip(kcontrol);
+ struct cx88_audio_dev *chip = snd_kcontrol_chip(kcontrol);
struct cx88_core *core = chip->core;
wm8775_s_ctrl(core, V4L2_CID_AUDIO_LOUDNESS,
@@ -813,9 +807,9 @@ static struct snd_kcontrol_new snd_cx88_alc_switch = {
.put = snd_cx88_alc_put,
};
-/****************************************************************************
- Basic Flow for Sound Devices
- ****************************************************************************/
+/*
+ * Basic Flow for Sound Devices
+ */
/*
* PCI ID Table - 14f1:8801 and 14f1:8811 means function 1: Audio
@@ -823,8 +817,8 @@ static struct snd_kcontrol_new snd_cx88_alc_switch = {
*/
static const struct pci_device_id cx88_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},
+ {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, cx88_audio_pci_tbl);
@@ -833,13 +827,12 @@ MODULE_DEVICE_TABLE(pci, cx88_audio_pci_tbl);
* Chip-specific destructor
*/
-static int snd_cx88_free(snd_cx88_card_t *chip)
+static int snd_cx88_free(struct cx88_audio_dev *chip)
{
-
if (chip->irq >= 0)
free_irq(chip->irq, chip);
- cx88_core_put(chip->core,chip->pci);
+ cx88_core_put(chip->core, chip->pci);
pci_disable_device(chip->pci);
return 0;
@@ -848,27 +841,26 @@ static int snd_cx88_free(snd_cx88_card_t *chip)
/*
* Component Destructor
*/
-static void snd_cx88_dev_free(struct snd_card * card)
+static void snd_cx88_dev_free(struct snd_card *card)
{
- snd_cx88_card_t *chip = card->private_data;
+ struct cx88_audio_dev *chip = card->private_data;
snd_cx88_free(chip);
}
-
/*
* Alsa Constructor - Component probe
*/
static int devno;
static int snd_cx88_create(struct snd_card *card, struct pci_dev *pci,
- snd_cx88_card_t **rchip,
+ struct cx88_audio_dev **rchip,
struct cx88_core **core_ptr)
{
- snd_cx88_card_t *chip;
- struct cx88_core *core;
- int err;
- unsigned char pci_lat;
+ struct cx88_audio_dev *chip;
+ struct cx88_core *core;
+ int err;
+ unsigned char pci_lat;
*rchip = NULL;
@@ -881,19 +873,18 @@ static int snd_cx88_create(struct snd_card *card, struct pci_dev *pci,
chip = card->private_data;
core = cx88_core_get(pci);
- if (NULL == core) {
+ if (!core) {
err = -EINVAL;
return err;
}
- err = pci_set_dma_mask(pci,DMA_BIT_MASK(32));
+ err = pci_set_dma_mask(pci, DMA_BIT_MASK(32));
if (err) {
- dprintk(0, "%s/1: Oops: no 32bit PCI DMA ???\n",core->name);
+ dprintk(0, "%s/1: Oops: no 32bit PCI DMA ???\n", core->name);
cx88_core_put(core, pci);
return err;
}
-
/* pci init */
chip->card = card;
chip->pci = pci;
@@ -907,17 +898,18 @@ static int snd_cx88_create(struct snd_card *card, struct pci_dev *pci,
IRQF_SHARED, chip->core->name, chip);
if (err < 0) {
dprintk(0, "%s: can't get IRQ %d\n",
- chip->core->name, chip->pci->irq);
+ chip->core->name, chip->pci->irq);
return err;
}
/* print pci info */
pci_read_config_byte(pci, PCI_LATENCY_TIMER, &pci_lat);
- dprintk(1,"ALSA %s/%i: found at %s, rev: %d, irq: %d, "
- "latency: %d, mmio: 0x%llx\n", core->name, devno,
- pci_name(pci), pci->revision, pci->irq,
- pci_lat, (unsigned long long)pci_resource_start(pci,0));
+ dprintk(1,
+ "ALSA %s/%i: found at %s, rev: %d, irq: %d, latency: %d, mmio: 0x%llx\n",
+ core->name, devno,
+ pci_name(pci), pci->revision, pci->irq,
+ pci_lat, (unsigned long long)pci_resource_start(pci, 0));
chip->irq = pci->irq;
synchronize_irq(chip->irq);
@@ -931,10 +923,10 @@ static int snd_cx88_create(struct snd_card *card, struct pci_dev *pci,
static int cx88_audio_initdev(struct pci_dev *pci,
const struct pci_device_id *pci_id)
{
- struct snd_card *card;
- snd_cx88_card_t *chip;
- struct cx88_core *core = NULL;
- int err;
+ struct snd_card *card;
+ struct cx88_audio_dev *chip;
+ struct cx88_core *core = NULL;
+ int err;
if (devno >= SNDRV_CARDS)
return (-ENODEV);
@@ -945,7 +937,7 @@ static int cx88_audio_initdev(struct pci_dev *pci,
}
err = snd_card_new(&pci->dev, index[devno], id[devno], THIS_MODULE,
- sizeof(snd_cx88_card_t), &card);
+ sizeof(struct cx88_audio_dev), &card);
if (err < 0)
return err;
@@ -973,19 +965,20 @@ static int cx88_audio_initdev(struct pci_dev *pci,
if (core->sd_wm8775)
snd_ctl_add(card, snd_ctl_new1(&snd_cx88_alc_switch, chip));
- strcpy (card->driver, "CX88x");
+ strcpy(card->driver, "CX88x");
sprintf(card->shortname, "Conexant CX%x", pci->device);
sprintf(card->longname, "%s at %#llx",
- card->shortname,(unsigned long long)pci_resource_start(pci, 0));
- strcpy (card->mixername, "CX88");
+ card->shortname,
+ (unsigned long long)pci_resource_start(pci, 0));
+ strcpy(card->mixername, "CX88");
- dprintk (0, "%s/%i: ALSA support for cx2388x boards\n",
- card->driver,devno);
+ dprintk(0, "%s/%i: ALSA support for cx2388x boards\n",
+ card->driver, devno);
err = snd_card_register(card);
if (err < 0)
goto error;
- pci_set_drvdata(pci,card);
+ pci_set_drvdata(pci, card);
devno++;
return 0;
@@ -994,6 +987,7 @@ error:
snd_card_free(card);
return err;
}
+
/*
* ALSA destructor
*/
diff --git a/drivers/media/pci/cx88/cx88-blackbird.c b/drivers/media/pci/cx88/cx88-blackbird.c
index b532e49e8f33..aa49c9597d9c 100644
--- a/drivers/media/pci/cx88/cx88-blackbird.c
+++ b/drivers/media/pci/cx88/cx88-blackbird.c
@@ -1,5 +1,4 @@
/*
- *
* Support for a cx23416 mpeg encoder via cx2388x host port.
* "blackbird" reference design.
*
@@ -20,12 +19,10 @@
* 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 "cx88.h"
+
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
@@ -38,21 +35,20 @@
#include <media/v4l2-event.h>
#include <media/drv-intf/cx2341x.h>
-#include "cx88.h"
-
MODULE_DESCRIPTION("driver for cx2388x/cx23416 based mpeg encoder cards");
MODULE_AUTHOR("Jelle Foks <jelle@foks.us>, Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
MODULE_LICENSE("GPL");
MODULE_VERSION(CX88_VERSION);
static unsigned int debug;
-module_param(debug,int,0644);
-MODULE_PARM_DESC(debug,"enable debug messages [blackbird]");
+module_param(debug, int, 0644);
+MODULE_PARM_DESC(debug, "enable debug messages [blackbird]");
-#define dprintk(level, fmt, arg...) do { \
- if (debug + 1 > level) \
- printk(KERN_DEBUG "%s/2-bb: " fmt, dev->core->name , ## arg); \
-} while(0)
+#define dprintk(level, fmt, arg...) do { \
+ if (debug + 1 > level) \
+ printk(KERN_DEBUG pr_fmt("%s: blackbird:" fmt), \
+ __func__, ##arg); \
+} while (0)
/* ------------------------------------------------------------------ */
@@ -70,6 +66,7 @@ enum blackbird_capture_type {
BLACKBIRD_RAW_CAPTURE,
BLACKBIRD_RAW_PASSTHRU_CAPTURE
};
+
enum blackbird_capture_bits {
BLACKBIRD_RAW_BITS_NONE = 0x00,
BLACKBIRD_RAW_BITS_YUV_CAPTURE = 0x01,
@@ -78,33 +75,40 @@ enum blackbird_capture_bits {
BLACKBIRD_RAW_BITS_PASSTHRU_CAPTURE = 0x08,
BLACKBIRD_RAW_BITS_TO_HOST_CAPTURE = 0x10
};
+
enum blackbird_capture_end {
BLACKBIRD_END_AT_GOP, /* stop at the end of gop, generate irq */
BLACKBIRD_END_NOW, /* stop immediately, no irq */
};
+
enum blackbird_framerate {
BLACKBIRD_FRAMERATE_NTSC_30, /* NTSC: 30fps */
BLACKBIRD_FRAMERATE_PAL_25 /* PAL: 25fps */
};
+
enum blackbird_stream_port {
BLACKBIRD_OUTPUT_PORT_MEMORY,
BLACKBIRD_OUTPUT_PORT_STREAMING,
BLACKBIRD_OUTPUT_PORT_SERIAL
};
+
enum blackbird_data_xfer_status {
BLACKBIRD_MORE_BUFFERS_FOLLOW,
BLACKBIRD_LAST_BUFFER,
};
+
enum blackbird_picture_mask {
BLACKBIRD_PICTURE_MASK_NONE,
BLACKBIRD_PICTURE_MASK_I_FRAMES,
BLACKBIRD_PICTURE_MASK_I_P_FRAMES = 0x3,
BLACKBIRD_PICTURE_MASK_ALL_FRAMES = 0x7,
};
+
enum blackbird_vbi_mode_bits {
BLACKBIRD_VBI_BITS_SLICED,
BLACKBIRD_VBI_BITS_RAW,
};
+
enum blackbird_vbi_insertion_bits {
BLACKBIRD_VBI_BITS_INSERT_IN_XTENSION_USR_DATA,
BLACKBIRD_VBI_BITS_INSERT_IN_PRIVATE_PACKETS = 0x1 << 1,
@@ -112,56 +116,69 @@ enum blackbird_vbi_insertion_bits {
BLACKBIRD_VBI_BITS_SEPARATE_STREAM_USR_DATA = 0x4 << 1,
BLACKBIRD_VBI_BITS_SEPARATE_STREAM_PRV_DATA = 0x5 << 1,
};
+
enum blackbird_dma_unit {
BLACKBIRD_DMA_BYTES,
BLACKBIRD_DMA_FRAMES,
};
+
enum blackbird_dma_transfer_status_bits {
BLACKBIRD_DMA_TRANSFER_BITS_DONE = 0x01,
BLACKBIRD_DMA_TRANSFER_BITS_ERROR = 0x04,
BLACKBIRD_DMA_TRANSFER_BITS_LL_ERROR = 0x10,
};
+
enum blackbird_pause {
BLACKBIRD_PAUSE_ENCODING,
BLACKBIRD_RESUME_ENCODING,
};
+
enum blackbird_copyright {
BLACKBIRD_COPYRIGHT_OFF,
BLACKBIRD_COPYRIGHT_ON,
};
+
enum blackbird_notification_type {
BLACKBIRD_NOTIFICATION_REFRESH,
};
+
enum blackbird_notification_status {
BLACKBIRD_NOTIFICATION_OFF,
BLACKBIRD_NOTIFICATION_ON,
};
+
enum blackbird_notification_mailbox {
BLACKBIRD_NOTIFICATION_NO_MAILBOX = -1,
};
+
enum blackbird_field1_lines {
BLACKBIRD_FIELD1_SAA7114 = 0x00EF, /* 239 */
BLACKBIRD_FIELD1_SAA7115 = 0x00F0, /* 240 */
BLACKBIRD_FIELD1_MICRONAS = 0x0105, /* 261 */
};
+
enum blackbird_field2_lines {
BLACKBIRD_FIELD2_SAA7114 = 0x00EF, /* 239 */
BLACKBIRD_FIELD2_SAA7115 = 0x00F0, /* 240 */
BLACKBIRD_FIELD2_MICRONAS = 0x0106, /* 262 */
};
+
enum blackbird_custom_data_type {
BLACKBIRD_CUSTOM_EXTENSION_USR_DATA,
BLACKBIRD_CUSTOM_PRIVATE_PACKET,
};
+
enum blackbird_mute {
BLACKBIRD_UNMUTE,
BLACKBIRD_MUTE,
};
+
enum blackbird_mute_video_mask {
BLACKBIRD_MUTE_VIDEO_V_MASK = 0x0000FF00,
BLACKBIRD_MUTE_VIDEO_U_MASK = 0x00FF0000,
BLACKBIRD_MUTE_VIDEO_Y_MASK = 0xFF000000,
};
+
enum blackbird_mute_video_shift {
BLACKBIRD_MUTE_VIDEO_V_SHIFT = 8,
BLACKBIRD_MUTE_VIDEO_U_SHIFT = 16,
@@ -215,14 +232,14 @@ static void host_setup(struct cx88_core *core)
static int wait_ready_gpio0_bit1(struct cx88_core *core, u32 state)
{
unsigned long timeout = jiffies + msecs_to_jiffies(1);
- u32 gpio0,need;
+ u32 gpio0, need;
need = state ? 2 : 0;
for (;;) {
gpio0 = cx_read(MO_GP0_IO) & 2;
if (need == gpio0)
return 0;
- if (time_after(jiffies,timeout))
+ if (time_after(jiffies, timeout))
return -1;
udelay(1);
}
@@ -241,7 +258,7 @@ static int memory_write(struct cx88_core *core, u32 address, u32 value)
cx_read(P1_MDATA0);
cx_read(P1_MADDR0);
- return wait_ready_gpio0_bit1(core,1);
+ return wait_ready_gpio0_bit1(core, 1);
}
static int memory_read(struct cx88_core *core, u32 address, u32 *value)
@@ -255,7 +272,7 @@ static int memory_read(struct cx88_core *core, u32 address, u32 *value)
cx_writeb(P1_MADDR0, (unsigned int)address);
cx_read(P1_MADDR0);
- retval = wait_ready_gpio0_bit1(core,1);
+ retval = wait_ready_gpio0_bit1(core, 1);
cx_writeb(P1_MDATA3, 0);
val = (unsigned char)cx_read(P1_MDATA3) << 24;
@@ -282,10 +299,9 @@ static int register_write(struct cx88_core *core, u32 address, u32 value)
cx_read(P1_RDATA0);
cx_read(P1_RADDR0);
- return wait_ready_gpio0_bit1(core,1);
+ return wait_ready_gpio0_bit1(core, 1);
}
-
static int register_read(struct cx88_core *core, u32 address, u32 *value)
{
int retval;
@@ -296,7 +312,7 @@ static int register_read(struct cx88_core *core, u32 address, u32 *value)
cx_writeb(P1_RRDWR, 0);
cx_read(P1_RADDR0);
- retval = wait_ready_gpio0_bit1(core,1);
+ retval = wait_ready_gpio0_bit1(core, 1);
val = (unsigned char)cx_read(P1_RDATA0);
val |= (unsigned char)cx_read(P1_RDATA1) << 8;
val |= (unsigned char)cx_read(P1_RDATA2) << 16;
@@ -308,20 +324,24 @@ static int register_read(struct cx88_core *core, u32 address, u32 *value)
/* ------------------------------------------------------------------ */
-static int blackbird_mbox_func(void *priv, u32 command, int in, int out, u32 data[CX2341X_MBOX_MAX_DATA])
+static int blackbird_mbox_func(void *priv, u32 command, int in,
+ int out, u32 data[CX2341X_MBOX_MAX_DATA])
{
struct cx8802_dev *dev = priv;
unsigned long timeout;
u32 value, flag, retval;
int i;
- dprintk(1,"%s: 0x%X\n", __func__, command);
+ dprintk(1, "%s: 0x%X\n", __func__, command);
- /* this may not be 100% safe if we can't read any memory location
- without side effects */
+ /*
+ * this may not be 100% safe if we can't read any memory location
+ * without side effects
+ */
memory_read(dev->core, dev->mailbox - 4, &value);
if (value != 0x12345678) {
- dprintk(0, "Firmware and/or mailbox pointer not initialized or corrupted\n");
+ dprintk(0,
+ "Firmware and/or mailbox pointer not initialized or corrupted\n");
return -EIO;
}
@@ -336,7 +356,8 @@ static int blackbird_mbox_func(void *priv, u32 command, int in, int out, u32 dat
/* write command + args + fill remaining with zeros */
memory_write(dev->core, dev->mailbox + 1, command); /* command code */
- memory_write(dev->core, dev->mailbox + 3, IVTV_API_STD_TIMEOUT); /* timeout */
+ /* timeout */
+ memory_write(dev->core, dev->mailbox + 3, IVTV_API_STD_TIMEOUT);
for (i = 0; i < in; i++) {
memory_write(dev->core, dev->mailbox + 4 + i, data[i]);
dprintk(1, "API Input %d = %d\n", i, data[i]);
@@ -353,7 +374,7 @@ static int blackbird_mbox_func(void *priv, u32 command, int in, int out, u32 dat
memory_read(dev->core, dev->mailbox, &flag);
if (0 != (flag & 4))
break;
- if (time_after(jiffies,timeout)) {
+ if (time_after(jiffies, timeout)) {
dprintk(0, "ERROR: API Mailbox timeout %x\n", command);
return -EIO;
}
@@ -367,15 +388,19 @@ static int blackbird_mbox_func(void *priv, u32 command, int in, int out, u32 dat
}
memory_read(dev->core, dev->mailbox + 2, &retval);
- dprintk(1, "API result = %d\n",retval);
+ dprintk(1, "API result = %d\n", retval);
flag = 0;
memory_write(dev->core, dev->mailbox, flag);
return retval;
}
+
/* ------------------------------------------------------------------ */
-/* We don't need to call the API often, so using just one mailbox will probably suffice */
+/*
+ * We don't need to call the API often, so using just one mailbox
+ * will probably suffice
+ */
static int blackbird_api_cmd(struct cx8802_dev *dev, u32 command,
u32 inputcnt, u32 outputcnt, ...)
{
@@ -385,9 +410,9 @@ static int blackbird_api_cmd(struct cx8802_dev *dev, u32 command,
va_start(vargs, outputcnt);
- for (i = 0; i < inputcnt; i++) {
+ for (i = 0; i < inputcnt; i++)
data[i] = va_arg(vargs, int);
- }
+
err = blackbird_mbox_func(dev, command, inputcnt, outputcnt, data);
for (i = 0; i < outputcnt; i++) {
int *vptr = va_arg(vargs, int *);
@@ -399,8 +424,8 @@ static int blackbird_api_cmd(struct cx8802_dev *dev, u32 command,
static int blackbird_find_mailbox(struct cx8802_dev *dev)
{
- u32 signature[4]={0x12345678, 0x34567812, 0x56781234, 0x78123456};
- int signaturecnt=0;
+ u32 signature[4] = {0x12345678, 0x34567812, 0x56781234, 0x78123456};
+ int signaturecnt = 0;
u32 value;
int i;
@@ -410,9 +435,9 @@ static int blackbird_find_mailbox(struct cx8802_dev *dev)
signaturecnt++;
else
signaturecnt = 0;
- if (4 == signaturecnt) {
+ if (signaturecnt == 4) {
dprintk(1, "Mailbox signature found\n");
- return i+1;
+ return i + 1;
}
}
dprintk(0, "Mailbox signature values not found!\n");
@@ -431,10 +456,13 @@ static int blackbird_load_firmware(struct cx8802_dev *dev)
__le32 *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);
- msleep(1);
+ 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);
+ usleep_range(10000, 20000);
retval |= register_write(dev->core, IVTV_REG_APU, 0);
if (retval < 0)
@@ -443,29 +471,28 @@ static int blackbird_load_firmware(struct cx8802_dev *dev)
retval = request_firmware(&firmware, CX2341X_FIRM_ENC_FILENAME,
&dev->pci->dev);
-
if (retval != 0) {
pr_err("Hotplug firmware request failed (%s).\n",
- CX2341X_FIRM_ENC_FILENAME);
+ CX2341X_FIRM_ENC_FILENAME);
pr_err("Please fix your hotplug setup, the board will not work without firmware loaded!\n");
return -EIO;
}
if (firmware->size != BLACKBIRD_FIRM_IMAGE_SIZE) {
pr_err("Firmware size mismatch (have %zd, expected %d)\n",
- firmware->size, BLACKBIRD_FIRM_IMAGE_SIZE);
+ firmware->size, BLACKBIRD_FIRM_IMAGE_SIZE);
release_firmware(firmware);
return -EINVAL;
}
- if (0 != memcmp(firmware->data, magic, 8)) {
+ if (memcmp(firmware->data, magic, 8) != 0) {
pr_err("Firmware magic mismatch, wrong file?\n");
release_firmware(firmware);
return -EINVAL;
}
/* transfer to the chip */
- dprintk(1,"Loading firmware ...\n");
+ dprintk(1, "Loading firmware ...\n");
dataptr = (__le32 *)firmware->data;
for (i = 0; i < (firmware->size >> 2); i++) {
value = le32_to_cpu(*dataptr);
@@ -486,10 +513,11 @@ static int blackbird_load_firmware(struct cx8802_dev *dev)
}
dprintk(0, "Firmware upload successful.\n");
- retval |= register_write(dev->core, IVTV_REG_HW_BLOCKS, IVTV_CMD_HW_BLOCKS_RST);
+ 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);
+ usleep_range(10000, 20000);
retval |= register_read(dev->core, IVTV_REG_VPU, &value);
retval |= register_write(dev->core, IVTV_REG_VPU, value & 0xFFFFFFE8);
@@ -499,19 +527,19 @@ static int blackbird_load_firmware(struct cx8802_dev *dev)
return 0;
}
-/**
- Settings used by the windows tv app for PVR2000:
-=================================================================================================================
-Profile | Codec | Resolution | CBR/VBR | Video Qlty | V. Bitrate | Frmrate | Audio Codec | A. Bitrate | A. Mode
------------------------------------------------------------------------------------------------------------------
-MPEG-1 | MPEG1 | 352x288PAL | (CBR) | 1000:Optimal | 2000 Kbps | 25fps | MPG1 Layer2 | 224kbps | Stereo
-MPEG-2 | MPEG2 | 720x576PAL | VBR | 600 :Good | 4000 Kbps | 25fps | MPG1 Layer2 | 224kbps | Stereo
-VCD | MPEG1 | 352x288PAL | (CBR) | 1000:Optimal | 1150 Kbps | 25fps | MPG1 Layer2 | 224kbps | Stereo
-DVD | MPEG2 | 720x576PAL | VBR | 600 :Good | 6000 Kbps | 25fps | MPG1 Layer2 | 224kbps | Stereo
-DB* DVD | MPEG2 | 720x576PAL | CBR | 600 :Good | 6000 Kbps | 25fps | MPG1 Layer2 | 224kbps | Stereo
-=================================================================================================================
-*DB: "DirectBurn"
-*/
+/*
+ * Settings used by the windows tv app for PVR2000:
+ * =================================================================================================================
+ * Profile | Codec | Resolution | CBR/VBR | Video Qlty | V. Bitrate | Frmrate | Audio Codec | A. Bitrate | A. Mode
+ * -----------------------------------------------------------------------------------------------------------------
+ * MPEG-1 | MPEG1 | 352x288PAL | (CBR) | 1000:Optimal | 2000 Kbps | 25fps | MPG1 Layer2 | 224kbps | Stereo
+ * MPEG-2 | MPEG2 | 720x576PAL | VBR | 600 :Good | 4000 Kbps | 25fps | MPG1 Layer2 | 224kbps | Stereo
+ * VCD | MPEG1 | 352x288PAL | (CBR) | 1000:Optimal | 1150 Kbps | 25fps | MPG1 Layer2 | 224kbps | Stereo
+ * DVD | MPEG2 | 720x576PAL | VBR | 600 :Good | 6000 Kbps | 25fps | MPG1 Layer2 | 224kbps | Stereo
+ * DB* DVD | MPEG2 | 720x576PAL | CBR | 600 :Good | 6000 Kbps | 25fps | MPG1 Layer2 | 224kbps | Stereo
+ * =================================================================================================================
+ * [*] DB: "DirectBurn"
+ */
static void blackbird_codec_settings(struct cx8802_dev *dev)
{
@@ -519,11 +547,12 @@ static void blackbird_codec_settings(struct cx8802_dev *dev)
/* assign frame size */
blackbird_api_cmd(dev, CX2341X_ENC_SET_FRAME_SIZE, 2, 0,
- core->height, core->width);
+ core->height, core->width);
dev->cxhdl.width = core->width;
dev->cxhdl.height = core->height;
- cx2341x_handler_set_50hz(&dev->cxhdl, dev->core->tvnorm & V4L2_STD_625_50);
+ cx2341x_handler_set_50hz(&dev->cxhdl,
+ dev->core->tvnorm & V4L2_STD_625_50);
cx2341x_handler_setup(&dev->cxhdl);
}
@@ -533,7 +562,7 @@ static int blackbird_initialize_codec(struct cx8802_dev *dev)
int version;
int retval;
- dprintk(1,"Initialize codec\n");
+ dprintk(1, "Initialize codec\n");
retval = blackbird_api_cmd(dev, CX2341X_ENC_PING_FW, 0, 0); /* ping */
if (retval < 0) {
/* ping was not successful, reset and upload firmware */
@@ -549,15 +578,18 @@ static int blackbird_initialize_codec(struct cx8802_dev *dev)
dev->mailbox = retval;
- retval = blackbird_api_cmd(dev, CX2341X_ENC_PING_FW, 0, 0); /* ping */
+ /* ping */
+ retval = blackbird_api_cmd(dev, CX2341X_ENC_PING_FW, 0, 0);
if (retval < 0) {
dprintk(0, "ERROR: Firmware ping failed!\n");
return -1;
}
- retval = blackbird_api_cmd(dev, CX2341X_ENC_GET_VERSION, 0, 1, &version);
+ retval = blackbird_api_cmd(dev, CX2341X_ENC_GET_VERSION,
+ 0, 1, &version);
if (retval < 0) {
- dprintk(0, "ERROR: Firmware get encoder version failed!\n");
+ dprintk(0,
+ "ERROR: Firmware get encoder version failed!\n");
return -1;
}
dprintk(0, "Firmware version is 0x%08x\n", version);
@@ -571,13 +603,11 @@ static int blackbird_initialize_codec(struct cx8802_dev *dev)
blackbird_codec_settings(dev);
blackbird_api_cmd(dev, CX2341X_ENC_SET_NUM_VSYNC_LINES, 2, 0,
- BLACKBIRD_FIELD1_SAA7115,
- BLACKBIRD_FIELD2_SAA7115
- );
+ BLACKBIRD_FIELD1_SAA7115, BLACKBIRD_FIELD2_SAA7115);
blackbird_api_cmd(dev, CX2341X_ENC_SET_PLACEHOLDER, 12, 0,
- BLACKBIRD_CUSTOM_EXTENSION_USR_DATA,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+ BLACKBIRD_CUSTOM_EXTENSION_USR_DATA,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
return 0;
}
@@ -615,9 +645,7 @@ static int blackbird_start_codec(struct cx8802_dev *dev)
/* start capturing to the host interface */
blackbird_api_cmd(dev, CX2341X_ENC_START_CAPTURE, 2, 0,
- BLACKBIRD_MPEG_CAPTURE,
- BLACKBIRD_RAW_BITS_NONE
- );
+ BLACKBIRD_MPEG_CAPTURE, BLACKBIRD_RAW_BITS_NONE);
return 0;
}
@@ -625,10 +653,9 @@ static int blackbird_start_codec(struct cx8802_dev *dev)
static int blackbird_stop_codec(struct cx8802_dev *dev)
{
blackbird_api_cmd(dev, CX2341X_ENC_STOP_CAPTURE, 3, 0,
- BLACKBIRD_END_NOW,
- BLACKBIRD_MPEG_CAPTURE,
- BLACKBIRD_RAW_BITS_NONE
- );
+ BLACKBIRD_END_NOW,
+ BLACKBIRD_MPEG_CAPTURE,
+ BLACKBIRD_RAW_BITS_NONE);
cx2341x_handler_set_busy(&dev->cxhdl, 0);
@@ -638,8 +665,8 @@ static int blackbird_stop_codec(struct cx8802_dev *dev)
/* ------------------------------------------------------------------ */
static int queue_setup(struct vb2_queue *q,
- unsigned int *num_buffers, unsigned int *num_planes,
- unsigned int sizes[], struct device *alloc_devs[])
+ unsigned int *num_buffers, unsigned int *num_planes,
+ unsigned int sizes[], struct device *alloc_devs[])
{
struct cx8802_dev *dev = q->drv_priv;
@@ -699,7 +726,8 @@ static int start_streaming(struct vb2_queue *q, unsigned int count)
err = drv->request_acquire(drv);
if (err != 0) {
- dprintk(1, "%s: Unable to acquire hardware, %d\n", __func__, err);
+ dprintk(1, "%s: Unable to acquire hardware, %d\n", __func__,
+ err);
goto fail;
}
@@ -770,7 +798,7 @@ static const struct vb2_ops blackbird_qops = {
/* ------------------------------------------------------------------ */
static int vidioc_querycap(struct file *file, void *priv,
- struct v4l2_capability *cap)
+ struct v4l2_capability *cap)
{
struct cx8802_dev *dev = video_drvdata(file);
struct cx88_core *core = dev->core;
@@ -781,8 +809,8 @@ static int vidioc_querycap(struct file *file, void *priv,
return 0;
}
-static int vidioc_enum_fmt_vid_cap (struct file *file, void *priv,
- struct v4l2_fmtdesc *f)
+static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
+ struct v4l2_fmtdesc *f)
{
if (f->index != 0)
return -EINVAL;
@@ -794,7 +822,7 @@ static int vidioc_enum_fmt_vid_cap (struct file *file, void *priv,
}
static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,
- struct v4l2_format *f)
+ struct v4l2_format *f)
{
struct cx8802_dev *dev = video_drvdata(file);
struct cx88_core *core = dev->core;
@@ -810,11 +838,11 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,
}
static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
- struct v4l2_format *f)
+ struct v4l2_format *f)
{
struct cx8802_dev *dev = video_drvdata(file);
struct cx88_core *core = dev->core;
- unsigned maxw, maxh;
+ unsigned int maxw, maxh;
enum v4l2_field field;
f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG;
@@ -850,7 +878,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
}
static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
- struct v4l2_format *f)
+ struct v4l2_format *f)
{
struct cx8802_dev *dev = video_drvdata(file);
struct cx88_core *core = dev->core;
@@ -864,20 +892,21 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
core->width = f->fmt.pix.width;
core->height = f->fmt.pix.height;
core->field = f->fmt.pix.field;
- cx88_set_scale(core, f->fmt.pix.width, f->fmt.pix.height, f->fmt.pix.field);
+ cx88_set_scale(core, f->fmt.pix.width, f->fmt.pix.height,
+ f->fmt.pix.field);
blackbird_api_cmd(dev, CX2341X_ENC_SET_FRAME_SIZE, 2, 0,
- f->fmt.pix.height, f->fmt.pix.width);
+ f->fmt.pix.height, f->fmt.pix.width);
return 0;
}
-static int vidioc_s_frequency (struct file *file, void *priv,
- const struct v4l2_frequency *f)
+static int vidioc_s_frequency(struct file *file, void *priv,
+ const struct v4l2_frequency *f)
{
struct cx8802_dev *dev = video_drvdata(file);
struct cx88_core *core = dev->core;
bool streaming;
- if (unlikely(UNSET == core->board.tuner_type))
+ if (unlikely(core->board.tuner_type == UNSET))
return -EINVAL;
if (unlikely(f->tuner != 0))
return -EINVAL;
@@ -885,16 +914,15 @@ static int vidioc_s_frequency (struct file *file, void *priv,
if (streaming)
blackbird_stop_codec(dev);
- cx88_set_freq (core,f);
+ cx88_set_freq(core, f);
blackbird_initialize_codec(dev);
- cx88_set_scale(core, core->width, core->height,
- core->field);
+ cx88_set_scale(core, core->width, core->height, core->field);
if (streaming)
blackbird_start_codec(dev);
return 0;
}
-static int vidioc_log_status (struct file *file, void *priv)
+static int vidioc_log_status(struct file *file, void *priv)
{
struct cx8802_dev *dev = video_drvdata(file);
struct cx88_core *core = dev->core;
@@ -906,21 +934,22 @@ static int vidioc_log_status (struct file *file, void *priv)
return 0;
}
-static int vidioc_enum_input (struct file *file, void *priv,
- struct v4l2_input *i)
+static int vidioc_enum_input(struct file *file, void *priv,
+ struct v4l2_input *i)
{
struct cx8802_dev *dev = video_drvdata(file);
struct cx88_core *core = dev->core;
- return cx88_enum_input (core,i);
+
+ return cx88_enum_input(core, i);
}
-static int vidioc_g_frequency (struct file *file, void *priv,
- struct v4l2_frequency *f)
+static int vidioc_g_frequency(struct file *file, void *priv,
+ struct v4l2_frequency *f)
{
struct cx8802_dev *dev = video_drvdata(file);
struct cx88_core *core = dev->core;
- if (unlikely(UNSET == core->board.tuner_type))
+ if (unlikely(core->board.tuner_type == UNSET))
return -EINVAL;
if (unlikely(f->tuner != 0))
return -EINVAL;
@@ -931,7 +960,7 @@ static int vidioc_g_frequency (struct file *file, void *priv,
return 0;
}
-static int vidioc_g_input (struct file *file, void *priv, unsigned int *i)
+static int vidioc_g_input(struct file *file, void *priv, unsigned int *i)
{
struct cx8802_dev *dev = video_drvdata(file);
struct cx88_core *core = dev->core;
@@ -940,31 +969,31 @@ static int vidioc_g_input (struct file *file, void *priv, unsigned int *i)
return 0;
}
-static int vidioc_s_input (struct file *file, void *priv, unsigned int i)
+static int vidioc_s_input(struct file *file, void *priv, unsigned int i)
{
struct cx8802_dev *dev = video_drvdata(file);
struct cx88_core *core = dev->core;
if (i >= 4)
return -EINVAL;
- if (0 == INPUT(i).type)
+ if (!INPUT(i).type)
return -EINVAL;
cx88_newstation(core);
- cx88_video_mux(core,i);
+ cx88_video_mux(core, i);
return 0;
}
-static int vidioc_g_tuner (struct file *file, void *priv,
- struct v4l2_tuner *t)
+static int vidioc_g_tuner(struct file *file, void *priv,
+ struct v4l2_tuner *t)
{
struct cx8802_dev *dev = video_drvdata(file);
struct cx88_core *core = dev->core;
u32 reg;
- if (unlikely(UNSET == core->board.tuner_type))
+ if (unlikely(core->board.tuner_type == UNSET))
return -EINVAL;
- if (0 != t->index)
+ if (t->index != 0)
return -EINVAL;
strcpy(t->name, "Television");
@@ -972,21 +1001,21 @@ static int vidioc_g_tuner (struct file *file, void *priv,
t->rangehigh = 0xffffffffUL;
call_all(core, tuner, g_tuner, t);
- cx88_get_stereo(core ,t);
+ 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;
}
-static int vidioc_s_tuner (struct file *file, void *priv,
- const struct v4l2_tuner *t)
+static int vidioc_s_tuner(struct file *file, void *priv,
+ const struct v4l2_tuner *t)
{
struct cx8802_dev *dev = video_drvdata(file);
struct cx88_core *core = dev->core;
- if (UNSET == core->board.tuner_type)
+ if (core->board.tuner_type == UNSET)
return -EINVAL;
- if (0 != t->index)
+ if (t->index != 0)
return -EINVAL;
cx88_set_stereo(core, t->audmode, 1);
@@ -1010,8 +1039,7 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id id)
return cx88_set_tvnorm(core, id);
}
-static const struct v4l2_file_operations mpeg_fops =
-{
+static const struct v4l2_file_operations mpeg_fops = {
.owner = THIS_MODULE,
.open = v4l2_fh_open,
.release = vb2_fop_release,
@@ -1050,7 +1078,7 @@ static const struct v4l2_ioctl_ops mpeg_ioctl_ops = {
static struct video_device cx8802_mpeg_template = {
.name = "cx8802",
.fops = &mpeg_fops,
- .ioctl_ops = &mpeg_ioctl_ops,
+ .ioctl_ops = &mpeg_ioctl_ops,
.tvnorms = CX88_NORMS,
};
@@ -1064,7 +1092,9 @@ static int cx8802_blackbird_advise_acquire(struct cx8802_driver *drv)
switch (core->boardnr) {
case CX88_BOARD_HAUPPAUGE_HVR1300:
- /* By default, core setup will leave the cx22702 out of reset, on the bus.
+ /*
+ * By default, core setup will leave the cx22702 out of reset,
+ * on the bus.
* We left the hardware on power up with the cx22702 active.
* We're being given access to re-arrange the GPIOs.
* Take the bus off the cx22702 and put the cx23416 on it.
@@ -1118,12 +1148,11 @@ static int blackbird_register_video(struct cx8802_dev *dev)
dev->mpeg_dev.queue = &dev->vb2_mpegq;
err = video_register_device(&dev->mpeg_dev, VFL_TYPE_GRABBER, -1);
if (err < 0) {
- printk(KERN_INFO "%s/2: can't register mpeg device\n",
- dev->core->name);
+ pr_info("can't register mpeg device\n");
return err;
}
- printk(KERN_INFO "%s/2: registered device %s [mpeg]\n",
- dev->core->name, video_device_node_name(&dev->mpeg_dev));
+ pr_info("registered device %s [mpeg]\n",
+ video_device_node_name(&dev->mpeg_dev));
return 0;
}
@@ -1136,8 +1165,8 @@ static int cx8802_blackbird_probe(struct cx8802_driver *drv)
struct vb2_queue *q;
int err;
- dprintk( 1, "%s\n", __func__);
- dprintk( 1, " ->being probed by Card=%d Name=%s, PCI %02x:%02x\n",
+ dprintk(1, "%s\n", __func__);
+ dprintk(1, " ->being probed by Card=%d Name=%s, PCI %02x:%02x\n",
core->boardnr,
core->name,
core->pci_bus,
@@ -1158,16 +1187,15 @@ static int cx8802_blackbird_probe(struct cx8802_driver *drv)
v4l2_ctrl_add_handler(&dev->cxhdl.hdl, &core->video_hdl, NULL);
/* blackbird stuff */
- printk("%s/2: cx23416 based mpeg encoder (blackbird reference design)\n",
- core->name);
+ pr_info("cx23416 based mpeg encoder (blackbird reference design)\n");
host_setup(dev->core);
blackbird_initialize_codec(dev);
/* initial device configuration: needed ? */
// init_controls(core);
- cx88_set_tvnorm(core,core->tvnorm);
- cx88_video_mux(core,0);
+ cx88_set_tvnorm(core, core->tvnorm);
+ cx88_video_mux(core, 0);
cx2341x_handler_set_50hz(&dev->cxhdl, core->height == 576);
cx2341x_handler_setup(&dev->cxhdl);
@@ -1219,8 +1247,8 @@ static struct cx8802_driver cx8802_blackbird_driver = {
static int __init blackbird_init(void)
{
- printk(KERN_INFO "cx2388x blackbird driver version %s loaded\n",
- CX88_VERSION);
+ pr_info("cx2388x blackbird driver version %s loaded\n",
+ CX88_VERSION);
return cx8802_register_driver(&cx8802_blackbird_driver);
}
diff --git a/drivers/media/pci/cx88/cx88-cards.c b/drivers/media/pci/cx88/cx88-cards.c
index 8f2556ec3971..cdfbde277b8b 100644
--- a/drivers/media/pci/cx88/cx88-cards.c
+++ b/drivers/media/pci/cx88/cx88-cards.c
@@ -1,5 +1,4 @@
/*
- *
* device driver for Conexant 2388x based TV cards
* card-specific stuff.
*
@@ -14,22 +13,18 @@
* 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 "cx88.h"
+#include "tea5767.h"
+#include "xc4000.h"
+
#include <linux/init.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/delay.h>
#include <linux/slab.h>
-#include "cx88.h"
-#include "tea5767.h"
-#include "xc4000.h"
-
static unsigned int tuner[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET };
static unsigned int radio[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET };
static unsigned int card[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET };
@@ -38,32 +33,23 @@ module_param_array(tuner, int, NULL, 0444);
module_param_array(radio, int, NULL, 0444);
module_param_array(card, int, NULL, 0444);
-MODULE_PARM_DESC(tuner,"tuner type");
-MODULE_PARM_DESC(radio,"radio tuner type");
-MODULE_PARM_DESC(card,"card type");
+MODULE_PARM_DESC(tuner, "tuner type");
+MODULE_PARM_DESC(radio, "radio tuner type");
+MODULE_PARM_DESC(card, "card type");
static unsigned int latency = UNSET;
-module_param(latency,int,0444);
-MODULE_PARM_DESC(latency,"pci latency timer");
+module_param(latency, int, 0444);
+MODULE_PARM_DESC(latency, "pci latency timer");
static int disable_ir;
module_param(disable_ir, int, 0444);
MODULE_PARM_DESC(disable_ir, "Disable IR support");
-#define info_printk(core, fmt, arg...) \
- printk(KERN_INFO "%s: " fmt, core->name , ## arg)
-
-#define warn_printk(core, fmt, arg...) \
- printk(KERN_WARNING "%s: " fmt, core->name , ## arg)
-
-#define err_printk(core, fmt, arg...) \
- printk(KERN_ERR "%s: " fmt, core->name , ## arg)
-
-#define dprintk(level,fmt, arg...) do { \
+#define dprintk(level, fmt, arg...) do { \
if (cx88_core_debug >= level) \
- printk(KERN_DEBUG "%s: " fmt, core->name , ## arg); \
- } while(0)
-
+ printk(KERN_DEBUG pr_fmt("%s: core:" fmt), \
+ __func__, ##arg); \
+} while (0)
/* ------------------------------------------------------------------ */
/* board config info */
@@ -291,7 +277,6 @@ static const struct cx88_board cx88_boards[] = {
.gpio2 = 0x0035e700,
.gpio3 = 0x02000000,
}, {
-
.type = CX88_VMUX_COMPOSITE1,
.vmux = 1,
.gpio0 = 0x0035c700,
@@ -505,22 +490,22 @@ static const struct cx88_board cx88_boards[] = {
.tuner_addr = ADDR_UNSET,
.radio_addr = ADDR_UNSET,
/*
- GPIO[0] resets DT3302 DTV receiver
- 0 - reset asserted
- 1 - normal operation
- GPIO[1] mutes analog audio output connector
- 0 - enable selected source
- 1 - mute
- GPIO[2] selects source for analog audio output connector
- 0 - analog audio input connector on tab
- 1 - analog DAC output from CX23881 chip
- GPIO[3] selects RF input connector on tuner module
- 0 - RF connector labeled CABLE
- 1 - RF connector labeled ANT
- GPIO[4] selects high RF for QAM256 mode
- 0 - normal RF
- 1 - high RF
- */
+ * GPIO[0] resets DT3302 DTV receiver
+ * 0 - reset asserted
+ * 1 - normal operation
+ * GPIO[1] mutes analog audio output connector
+ * 0 - enable selected source
+ * 1 - mute
+ * GPIO[2] selects source for analog audio output connector
+ * 0 - analog audio input connector on tab
+ * 1 - analog DAC output from CX23881 chip
+ * GPIO[3] selects RF input connector on tuner module
+ * 0 - RF connector labeled CABLE
+ * 1 - RF connector labeled ANT
+ * GPIO[4] selects high RF for QAM256 mode
+ * 0 - normal RF
+ * 1 - high RF
+ */
.input = { {
.type = CX88_VMUX_TELEVISION,
.vmux = 0,
@@ -743,7 +728,10 @@ static const struct cx88_board cx88_boards[] = {
.radio_type = UNSET,
.tuner_addr = ADDR_UNSET,
.radio_addr = ADDR_UNSET,
- /* Some variants use a tda9874 and so need the tvaudio module. */
+ /*
+ * Some variants use a tda9874 and so need the
+ * tvaudio module.
+ */
.audio_chip = CX88_AUDIO_TVAUDIO,
.input = { {
.type = CX88_VMUX_TELEVISION,
@@ -1209,8 +1197,10 @@ static const struct cx88_board cx88_boards[] = {
.mpeg = CX88_MPEG_DVB,
},
[CX88_BOARD_KWORLD_MCE200_DELUXE] = {
- /* FIXME: tested TV input only, disabled composite,
- svideo and radio until they can be tested also. */
+ /*
+ * FIXME: tested TV input only, disabled composite,
+ * svideo and radio until they can be tested also.
+ */
.name = "Kworld MCE 200 Deluxe",
.tuner_type = TUNER_TENA_9533_DI,
.radio_type = UNSET,
@@ -1721,16 +1711,24 @@ static const struct cx88_board cx88_boards[] = {
},
},
[CX88_BOARD_POWERCOLOR_REAL_ANGEL] = {
- .name = "PowerColor RA330", /* Long names may confuse LIRC. */
+ /* Long names may confuse LIRC. */
+ .name = "PowerColor RA330",
.tuner_type = TUNER_XC2028,
.tuner_addr = 0x61,
.input = { {
+ /*
+ * Due to the way the cx88 driver is written,
+ * there is no way to deactivate audio pass-
+ * through without this entry. Furthermore, if
+ * the TV mux entry is first, you get audio
+ * from the tuner on boot for a little while.
+ */
.type = CX88_VMUX_DEBUG,
- .vmux = 3, /* Due to the way the cx88 driver is written, */
- .gpio0 = 0x00ff, /* there is no way to deactivate audio pass- */
- .gpio1 = 0xf39d, /* through without this entry. Furthermore, if */
- .gpio3 = 0x0000, /* the TV mux entry is first, you get audio */
- }, { /* from the tuner on boot for a little while. */
+ .vmux = 3,
+ .gpio0 = 0x00ff,
+ .gpio1 = 0xf39d,
+ .gpio3 = 0x0000,
+ }, {
.type = CX88_VMUX_TELEVISION,
.vmux = 0,
.gpio0 = 0x00ff,
@@ -1883,11 +1881,12 @@ static const struct cx88_board cx88_boards[] = {
.gpio2 = 0x0cf7,
},
},
- /* Both radio, analog and ATSC work with this board.
- However, for analog to work, s5h1409 gate should be open,
- otherwise, tuner-xc3028 won't be detected.
- A proper fix require using the newer i2c methods to add
- tuner-xc3028 without doing an i2c probe.
+ /*
+ * Both radio, analog and ATSC work with this board.
+ * However, for analog to work, s5h1409 gate should be open,
+ * otherwise, tuner-xc3028 won't be detected.
+ * A proper fix require using the newer i2c methods to add
+ * tuner-xc3028 without doing an i2c probe.
*/
[CX88_BOARD_KWORLD_ATSC_120] = {
.name = "Kworld PlusTV HD PCI 120 (ATSC 120)",
@@ -2821,15 +2820,15 @@ static const struct cx88_subid cx88_subids[] = {
},
};
-/* ----------------------------------------------------------------------- */
-/* some leadtek specific stuff */
-
+/*
+ * some leadtek specific stuff
+ */
static void leadtek_eeprom(struct cx88_core *core, u8 *eeprom_data)
{
if (eeprom_data[4] != 0x7d ||
eeprom_data[5] != 0x10 ||
eeprom_data[7] != 0x66) {
- warn_printk(core, "Leadtek eeprom invalid.\n");
+ pr_warn("Leadtek eeprom invalid.\n");
return;
}
@@ -2847,9 +2846,8 @@ static void leadtek_eeprom(struct cx88_core *core, u8 *eeprom_data)
break;
}
- info_printk(core, "Leadtek Winfast 2000XP Expert config: "
- "tuner=%d, eeprom[0]=0x%02x\n",
- core->board.tuner_type, eeprom_data[0]);
+ pr_info("Leadtek Winfast 2000XP Expert config: tuner=%d, eeprom[0]=0x%02x\n",
+ core->board.tuner_type, eeprom_data[0]);
}
static void hauppauge_eeprom(struct cx88_core *core, u8 *eeprom_data)
@@ -2863,8 +2861,7 @@ static void hauppauge_eeprom(struct cx88_core *core, u8 *eeprom_data)
core->model = tv.model;
/* Make sure we support the board model */
- switch (tv.model)
- {
+ switch (tv.model) {
case 14009: /* WinTV-HVR3000 (Retail, IR, b/panel video, 3.5mm audio in) */
case 14019: /* WinTV-HVR3000 (Retail, IR Blaster, b/panel video, 3.5mm audio in) */
case 14029: /* WinTV-HVR3000 (Retail, IR, b/panel video, 3.5mm audio in - 880 bridge) */
@@ -2905,50 +2902,50 @@ static void hauppauge_eeprom(struct cx88_core *core, u8 *eeprom_data)
cx_set(MO_GP0_IO, 0x008989FF);
break;
default:
- warn_printk(core, "warning: unknown hauppauge model #%d\n",
- tv.model);
+ pr_warn("warning: unknown hauppauge model #%d\n", tv.model);
break;
}
- info_printk(core, "hauppauge eeprom: model=%d\n", tv.model);
+ pr_info("hauppauge eeprom: model=%d\n", tv.model);
}
-/* ----------------------------------------------------------------------- */
-/* some GDI (was: Modular Technology) specific stuff */
+/*
+ * some GDI (was: Modular Technology) specific stuff
+ */
static const struct {
int id;
int fm;
const char *name;
} gdi_tuner[] = {
- [ 0x01 ] = { .id = UNSET,
- .name = "NTSC_M" },
- [ 0x02 ] = { .id = UNSET,
- .name = "PAL_B" },
- [ 0x03 ] = { .id = UNSET,
- .name = "PAL_I" },
- [ 0x04 ] = { .id = UNSET,
- .name = "PAL_D" },
- [ 0x05 ] = { .id = UNSET,
- .name = "SECAM" },
-
- [ 0x10 ] = { .id = UNSET,
- .fm = 1,
- .name = "TEMIC_4049" },
- [ 0x11 ] = { .id = TUNER_TEMIC_4136FY5,
- .name = "TEMIC_4136" },
- [ 0x12 ] = { .id = UNSET,
- .name = "TEMIC_4146" },
-
- [ 0x20 ] = { .id = TUNER_PHILIPS_FQ1216ME,
- .fm = 1,
- .name = "PHILIPS_FQ1216_MK3" },
- [ 0x21 ] = { .id = UNSET, .fm = 1,
- .name = "PHILIPS_FQ1236_MK3" },
- [ 0x22 ] = { .id = UNSET,
- .name = "PHILIPS_FI1236_MK3" },
- [ 0x23 ] = { .id = UNSET,
- .name = "PHILIPS_FI1216_MK3" },
+ [0x01] = { .id = UNSET,
+ .name = "NTSC_M" },
+ [0x02] = { .id = UNSET,
+ .name = "PAL_B" },
+ [0x03] = { .id = UNSET,
+ .name = "PAL_I" },
+ [0x04] = { .id = UNSET,
+ .name = "PAL_D" },
+ [0x05] = { .id = UNSET,
+ .name = "SECAM" },
+
+ [0x10] = { .id = UNSET,
+ .fm = 1,
+ .name = "TEMIC_4049" },
+ [0x11] = { .id = TUNER_TEMIC_4136FY5,
+ .name = "TEMIC_4136" },
+ [0x12] = { .id = UNSET,
+ .name = "TEMIC_4146" },
+
+ [0x20] = { .id = TUNER_PHILIPS_FQ1216ME,
+ .fm = 1,
+ .name = "PHILIPS_FQ1216_MK3" },
+ [0x21] = { .id = UNSET, .fm = 1,
+ .name = "PHILIPS_FQ1236_MK3" },
+ [0x22] = { .id = UNSET,
+ .name = "PHILIPS_FI1236_MK3" },
+ [0x23] = { .id = UNSET,
+ .name = "PHILIPS_FI1216_MK3" },
};
static void gdi_eeprom(struct cx88_core *core, u8 *eeprom_data)
@@ -2956,16 +2953,17 @@ static void gdi_eeprom(struct cx88_core *core, u8 *eeprom_data)
const char *name = (eeprom_data[0x0d] < ARRAY_SIZE(gdi_tuner))
? gdi_tuner[eeprom_data[0x0d]].name : NULL;
- info_printk(core, "GDI: tuner=%s\n", name ? name : "unknown");
- if (NULL == name)
+ pr_info("GDI: tuner=%s\n", name ? name : "unknown");
+ if (!name)
return;
core->board.tuner_type = gdi_tuner[eeprom_data[0x0d]].id;
core->board.radio.type = gdi_tuner[eeprom_data[0x0d]].fm ?
CX88_RADIO : 0;
}
-/* ------------------------------------------------------------------- */
-/* some Divco specific stuff */
+/*
+ * some Divco specific stuff
+ */
static int cx88_dvico_xc2028_callback(struct cx88_core *core,
int command, int arg)
{
@@ -2994,9 +2992,9 @@ static int cx88_dvico_xc2028_callback(struct cx88_core *core,
return 0;
}
-
-/* ----------------------------------------------------------------------- */
-/* some Geniatech specific stuff */
+/*
+ * some Geniatech specific stuff
+ */
static int cx88_xc3028_geniatech_tuner_callback(struct cx88_core *core,
int command, int mode)
@@ -3059,8 +3057,9 @@ static int cx88_xc4000_winfast2000h_plus_callback(struct cx88_core *core,
return -EINVAL;
}
-/* ------------------------------------------------------------------- */
-/* some Divco specific stuff */
+/*
+ * some Divco specific stuff
+ */
static int cx88_pv_8000gt_callback(struct cx88_core *core,
int command, int arg)
{
@@ -3079,8 +3078,9 @@ static int cx88_pv_8000gt_callback(struct cx88_core *core,
return 0;
}
-/* ----------------------------------------------------------------------- */
-/* some DViCO specific stuff */
+/*
+ * some DViCO specific stuff
+ */
static void dvico_fusionhdtv_hybrid_init(struct cx88_core *core)
{
@@ -3107,8 +3107,8 @@ static void dvico_fusionhdtv_hybrid_init(struct cx88_core *core)
msg.len = (i != 12 ? 5 : 2);
err = i2c_transfer(&core->i2c_adap, &msg, 1);
if (err != 1) {
- warn_printk(core, "dvico_fusionhdtv_hybrid_init buf %d "
- "failed (err = %d)!\n", i, err);
+ pr_warn("dvico_fusionhdtv_hybrid_init buf %d failed (err = %d)!\n",
+ i, err);
return;
}
}
@@ -3176,11 +3176,11 @@ static int cx88_xc4000_tuner_callback(struct cx88_core *core,
return -EINVAL;
}
-/* ----------------------------------------------------------------------- */
-/* Tuner callback function. Currently only needed for the Pinnacle *
- * PCTV HD 800i with an xc5000 sillicon tuner. This is used for both *
- * analog tuner attach (tuner-core.c) and dvb tuner attach (cx88-dvb.c) */
-
+/*
+ * Tuner callback function. Currently only needed for the Pinnacle
+ * PCTV HD 800i with an xc5000 sillicon tuner. This is used for both
+ * analog tuner attach (tuner-core.c) and dvb tuner attach (cx88-dvb.c)
+ */
static int cx88_xc5000_tuner_callback(struct cx88_core *core,
int command, int arg)
{
@@ -3188,38 +3188,38 @@ static int cx88_xc5000_tuner_callback(struct cx88_core *core,
case CX88_BOARD_PINNACLE_PCTV_HD_800i:
if (command == 0) { /* This is the reset command from xc5000 */
- /* djh - According to the engineer at PCTV Systems,
- the xc5000 reset pin is supposed to be on GPIO12.
- However, despite three nights of effort, pulling
- that GPIO low didn't reset the xc5000. While
- pulling MO_SRST_IO low does reset the xc5000, this
- also resets in the s5h1409 being reset as well.
- This causes tuning to always fail since the internal
- state of the s5h1409 does not match the driver's
- state. Given that the only two conditions in which
- the driver performs a reset is during firmware load
- and powering down the chip, I am taking out the
- reset. We know that the chip is being reset
- when the cx88 comes online, and not being able to
- do power management for this board is worse than
- not having any tuning at all. */
+ /*
+ * djh - According to the engineer at PCTV Systems,
+ * the xc5000 reset pin is supposed to be on GPIO12.
+ * However, despite three nights of effort, pulling
+ * that GPIO low didn't reset the xc5000. While
+ * pulling MO_SRST_IO low does reset the xc5000, this
+ * also resets in the s5h1409 being reset as well.
+ * This causes tuning to always fail since the internal
+ * state of the s5h1409 does not match the driver's
+ * state. Given that the only two conditions in which
+ * the driver performs a reset is during firmware load
+ * and powering down the chip, I am taking out the
+ * reset. We know that the chip is being reset
+ * when the cx88 comes online, and not being able to
+ * do power management for this board is worse than
+ * not having any tuning at all.
+ */
return 0;
- } else {
- dprintk(1, "xc5000: unknown tuner callback command.\n");
- return -EINVAL;
}
- break;
+
+ dprintk(1, "xc5000: unknown tuner callback command.\n");
+ return -EINVAL;
case CX88_BOARD_DVICO_FUSIONHDTV_7_GOLD:
if (command == 0) { /* This is the reset command from xc5000 */
cx_clear(MO_GP0_IO, 0x00000010);
- msleep(10);
+ usleep_range(10000, 20000);
cx_set(MO_GP0_IO, 0x00000010);
return 0;
- } else {
- dprintk(1, "xc5000: unknown tuner callback command.\n");
- return -EINVAL;
}
- break;
+
+ dprintk(1, "xc5000: unknown tuner callback command.\n");
+ return -EINVAL;
}
return 0; /* Should never be here */
}
@@ -3230,14 +3230,14 @@ int cx88_tuner_callback(void *priv, int component, int command, int arg)
struct cx88_core *core;
if (!i2c_algo) {
- printk(KERN_ERR "cx88: Error - i2c private data undefined.\n");
+ pr_err("Error - i2c private data undefined.\n");
return -EINVAL;
}
core = i2c_algo->data;
if (!core) {
- printk(KERN_ERR "cx88: Error - device struct undefined.\n");
+ pr_err("Error - device struct undefined.\n");
return -EINVAL;
}
@@ -3245,18 +3245,18 @@ int cx88_tuner_callback(void *priv, int component, int command, int arg)
return -EINVAL;
switch (core->board.tuner_type) {
- case TUNER_XC2028:
- dprintk(1, "Calling XC2028/3028 callback\n");
- return cx88_xc2028_tuner_callback(core, command, arg);
- case TUNER_XC4000:
- dprintk(1, "Calling XC4000 callback\n");
- return cx88_xc4000_tuner_callback(core, command, arg);
- case TUNER_XC5000:
- dprintk(1, "Calling XC5000 callback\n");
- return cx88_xc5000_tuner_callback(core, command, arg);
+ case TUNER_XC2028:
+ dprintk(1, "Calling XC2028/3028 callback\n");
+ return cx88_xc2028_tuner_callback(core, command, arg);
+ case TUNER_XC4000:
+ dprintk(1, "Calling XC4000 callback\n");
+ return cx88_xc4000_tuner_callback(core, command, arg);
+ case TUNER_XC5000:
+ dprintk(1, "Calling XC5000 callback\n");
+ return cx88_xc5000_tuner_callback(core, command, arg);
}
- err_printk(core, "Error: Calling callback for tuner %d\n",
- core->board.tuner_type);
+ pr_err("Error: Calling callback for tuner %d\n",
+ core->board.tuner_type);
return -EINVAL;
}
EXPORT_SYMBOL(cx88_tuner_callback);
@@ -3267,28 +3267,20 @@ static void cx88_card_list(struct cx88_core *core, struct pci_dev *pci)
{
int i;
- if (0 == pci->subsystem_vendor &&
- 0 == pci->subsystem_device) {
- printk(KERN_ERR
- "%s: Your board has no valid PCI Subsystem ID and thus can't\n"
- "%s: be autodetected. Please pass card=<n> insmod option to\n"
- "%s: workaround that. Redirect complaints to the vendor of\n"
- "%s: the TV card. Best regards,\n"
- "%s: -- tux\n",
- core->name,core->name,core->name,core->name,core->name);
+ if (!pci->subsystem_vendor && !pci->subsystem_device) {
+ pr_err("Your board has no valid PCI Subsystem ID and thus can't\n");
+ pr_err("be autodetected. Please pass card=<n> insmod option to\n");
+ pr_err("workaround that. Redirect complaints to the vendor of\n");
+ pr_err("the TV card\n");
} else {
- printk(KERN_ERR
- "%s: Your board isn't known (yet) to the driver. You can\n"
- "%s: try to pick one of the existing card configs via\n"
- "%s: card=<n> insmod option. Updating to the latest\n"
- "%s: version might help as well.\n",
- core->name,core->name,core->name,core->name);
+ pr_err("Your board isn't known (yet) to the driver. You can\n");
+ pr_err("try to pick one of the existing card configs via\n");
+ pr_err("card=<n> insmod option. Updating to the latest\n");
+ pr_err("version might help as well.\n");
}
- err_printk(core, "Here is a list of valid choices for the card=<n> "
- "insmod option:\n");
+ pr_err("Here is a list of valid choices for the card=<n> insmod option:\n");
for (i = 0; i < ARRAY_SIZE(cx88_boards); i++)
- printk(KERN_ERR "%s: card=%d -> %s\n",
- core->name, i, cx88_boards[i].name);
+ pr_err(" card=%d -> %s\n", i, cx88_boards[i].name);
}
static void cx88_card_setup_pre_i2c(struct cx88_core *core)
@@ -3296,7 +3288,9 @@ static void cx88_card_setup_pre_i2c(struct cx88_core *core)
switch (core->boardnr) {
case CX88_BOARD_HAUPPAUGE_HVR1300:
/*
- * Bring the 702 demod up before i2c scanning/attach or devices are hidden
+ * Bring the 702 demod up before i2c scanning/attach or
+ * devices are hidden.
+ *
* We leave here with the 702 on the bus
*
* "reset the IR receiver on GPIO[3]"
@@ -3317,7 +3311,7 @@ static void cx88_card_setup_pre_i2c(struct cx88_core *core)
cx_write(MO_GP2_IO, 0xef5);
mdelay(50);
cx_write(MO_GP2_IO, 0xcf7);
- msleep(10);
+ usleep_range(10000, 20000);
break;
case CX88_BOARD_DVICO_FUSIONHDTV_7_GOLD:
@@ -3353,7 +3347,7 @@ static void cx88_card_setup_pre_i2c(struct cx88_core *core)
case CX88_BOARD_TWINHAN_VP1027_DVBS:
cx_write(MO_GP0_IO, 0x00003230);
cx_write(MO_GP0_IO, 0x00003210);
- msleep(1);
+ usleep_range(10000, 20000);
cx_write(MO_GP0_IO, 0x00001230);
break;
}
@@ -3384,11 +3378,13 @@ void cx88_setup_xc3028(struct cx88_core *core, struct xc2028_ctrl *ctl)
ctl->demod = XC3028_FE_OREN538;
break;
case CX88_BOARD_GENIATECH_X8000_MT:
- /* FIXME: For this board, the xc3028 never recovers after being
- powered down (the reset GPIO probably is not set properly).
- We don't have access to the hardware so we cannot determine
- which GPIO is used for xc3028, so just disable power xc3028
- power management for now */
+ /*
+ * FIXME: For this board, the xc3028 never recovers after being
+ * powered down (the reset GPIO probably is not set properly).
+ * We don't have access to the hardware so we cannot determine
+ * which GPIO is used for xc3028, so just disable power xc3028
+ * power management for now
+ */
ctl->disable_power_mgmt = 1;
break;
case CX88_BOARD_WINFAST_TV2000_XP_GLOBAL:
@@ -3418,7 +3414,7 @@ static void cx88_card_setup(struct cx88_core *core)
memset(&tun_setup, 0, sizeof(tun_setup));
- if (0 == core->i2c_rc) {
+ if (!core->i2c_rc) {
core->i2c_client.addr = 0xa0 >> 1;
tveeprom_read(&core->i2c_client, eeprom, sizeof(eeprom));
}
@@ -3426,17 +3422,17 @@ static void cx88_card_setup(struct cx88_core *core)
switch (core->boardnr) {
case CX88_BOARD_HAUPPAUGE:
case CX88_BOARD_HAUPPAUGE_ROSLYN:
- if (0 == core->i2c_rc)
- hauppauge_eeprom(core, eeprom+8);
+ if (!core->i2c_rc)
+ hauppauge_eeprom(core, eeprom + 8);
break;
case CX88_BOARD_GDI:
- if (0 == core->i2c_rc)
+ if (!core->i2c_rc)
gdi_eeprom(core, eeprom);
break;
case CX88_BOARD_LEADTEK_PVR2000:
case CX88_BOARD_WINFAST_DV2000:
case CX88_BOARD_WINFAST2000XP_EXPERT:
- if (0 == core->i2c_rc)
+ if (!core->i2c_rc)
leadtek_eeprom(core, eeprom);
break;
case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1:
@@ -3449,7 +3445,7 @@ static void cx88_card_setup(struct cx88_core *core)
case CX88_BOARD_HAUPPAUGE_HVR4000:
case CX88_BOARD_HAUPPAUGE_HVR4000LITE:
case CX88_BOARD_HAUPPAUGE_IRONLY:
- if (0 == core->i2c_rc)
+ if (!core->i2c_rc)
hauppauge_eeprom(core, eeprom);
break;
case CX88_BOARD_KWORLD_DVBS_100:
@@ -3460,7 +3456,7 @@ static void cx88_card_setup(struct cx88_core *core)
/* GPIO0:0 is hooked to demod reset */
/* GPIO0:4 is hooked to xc3028 reset */
cx_write(MO_GP0_IO, 0x00111100);
- msleep(1);
+ usleep_range(10000, 20000);
cx_write(MO_GP0_IO, 0x00111111);
break;
case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL:
@@ -3476,9 +3472,9 @@ static void cx88_card_setup(struct cx88_core *core)
/* GPIO0:0 is hooked to mt352 reset pin */
cx_set(MO_GP0_IO, 0x00000101);
cx_clear(MO_GP0_IO, 0x00000001);
- msleep(1);
+ usleep_range(10000, 20000);
cx_set(MO_GP0_IO, 0x00000101);
- if (0 == core->i2c_rc &&
+ if (!core->i2c_rc &&
core->boardnr == CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID)
dvico_fusionhdtv_hybrid_init(core);
break;
@@ -3487,7 +3483,7 @@ static void cx88_card_setup(struct cx88_core *core)
cx_set(MO_GP0_IO, 0x00000707);
cx_set(MO_GP2_IO, 0x00000101);
cx_clear(MO_GP2_IO, 0x00000001);
- msleep(1);
+ usleep_range(10000, 20000);
cx_clear(MO_GP0_IO, 0x00000007);
cx_set(MO_GP2_IO, 0x00000101);
break;
@@ -3495,23 +3491,23 @@ static void cx88_card_setup(struct cx88_core *core)
cx_write(MO_GP0_IO, 0x00080808);
break;
case CX88_BOARD_ATI_HDTVWONDER:
- if (0 == core->i2c_rc) {
+ if (!core->i2c_rc) {
/* enable tuner */
int i;
- static const u8 buffer [][2] = {
- {0x10,0x12},
- {0x13,0x04},
- {0x16,0x00},
- {0x14,0x04},
- {0x17,0x00}
+ static const u8 buffer[][2] = {
+ {0x10, 0x12},
+ {0x13, 0x04},
+ {0x16, 0x00},
+ {0x14, 0x04},
+ {0x17, 0x00}
};
core->i2c_client.addr = 0x0a;
for (i = 0; i < ARRAY_SIZE(buffer); i++)
- if (2 != i2c_master_send(&core->i2c_client,
- buffer[i],2))
- warn_printk(core, "Unable to enable "
- "tuner(%i).\n", i);
+ if (i2c_master_send(&core->i2c_client,
+ buffer[i], 2) != 2)
+ pr_warn("Unable to enable tuner(%i).\n",
+ i);
}
break;
case CX88_BOARD_MSI_TVANYWHERE_MASTER:
@@ -3545,7 +3541,7 @@ static void cx88_card_setup(struct cx88_core *core)
cx_write(MO_GP0_IO, 0x8000);
msleep(100);
cx_write(MO_SRST_IO, 0);
- msleep(10);
+ usleep_range(10000, 20000);
cx_write(MO_GP0_IO, 0x8080);
msleep(100);
cx_write(MO_SRST_IO, 1);
@@ -3553,9 +3549,8 @@ static void cx88_card_setup(struct cx88_core *core)
break;
} /*end switch() */
-
/* Setup tuners */
- if ((core->board.radio_type != UNSET)) {
+ if (core->board.radio_type != UNSET) {
tun_setup.mode_mask = T_RADIO;
tun_setup.type = core->board.radio_type;
tun_setup.addr = core->board.radio_addr;
@@ -3610,35 +3605,30 @@ static int cx88_pci_quirks(const char *name, struct pci_dev *pci)
/* check pci quirks */
if (pci_pci_problems & PCIPCI_TRITON) {
- printk(KERN_INFO "%s: quirk: PCIPCI_TRITON -- set TBFX\n",
- name);
+ pr_info("quirk: PCIPCI_TRITON -- set TBFX\n");
ctrl |= CX88X_EN_TBFX;
}
if (pci_pci_problems & PCIPCI_NATOMA) {
- printk(KERN_INFO "%s: quirk: PCIPCI_NATOMA -- set TBFX\n",
- name);
+ pr_info("quirk: PCIPCI_NATOMA -- set TBFX\n");
ctrl |= CX88X_EN_TBFX;
}
if (pci_pci_problems & PCIPCI_VIAETBF) {
- printk(KERN_INFO "%s: quirk: PCIPCI_VIAETBF -- set TBFX\n",
- name);
+ pr_info("quirk: PCIPCI_VIAETBF -- set TBFX\n");
ctrl |= CX88X_EN_TBFX;
}
if (pci_pci_problems & PCIPCI_VSFX) {
- printk(KERN_INFO "%s: quirk: PCIPCI_VSFX -- set VSFX\n",
- name);
+ pr_info("quirk: PCIPCI_VSFX -- set VSFX\n");
ctrl |= CX88X_EN_VSFX;
}
#ifdef PCIPCI_ALIMAGIK
if (pci_pci_problems & PCIPCI_ALIMAGIK) {
- printk(KERN_INFO "%s: quirk: PCIPCI_ALIMAGIK -- latency fixup\n",
- name);
+ pr_info("quirk: PCIPCI_ALIMAGIK -- latency fixup\n");
lat = 0x0A;
}
#endif
/* check insmod options */
- if (UNSET != latency)
+ if (latency != UNSET)
lat = latency;
/* apply stuff */
@@ -3647,9 +3637,8 @@ static int cx88_pci_quirks(const char *name, struct pci_dev *pci)
value |= ctrl;
pci_write_config_byte(pci, CX88X_DEVCTRL, value);
}
- if (UNSET != lat) {
- printk(KERN_INFO "%s: setting pci latency timer to %d\n",
- name, latency);
+ if (lat != UNSET) {
+ pr_info("setting pci latency timer to %d\n", latency);
pci_write_config_byte(pci, PCI_LATENCY_TIMER, latency);
}
return 0;
@@ -3657,27 +3646,28 @@ static int cx88_pci_quirks(const char *name, struct pci_dev *pci)
int cx88_get_resources(const struct cx88_core *core, struct pci_dev *pci)
{
- if (request_mem_region(pci_resource_start(pci,0),
- pci_resource_len(pci,0),
+ if (request_mem_region(pci_resource_start(pci, 0),
+ pci_resource_len(pci, 0),
core->name))
return 0;
- printk(KERN_ERR
- "%s/%d: Can't get MMIO memory @ 0x%llx, subsystem: %04x:%04x\n",
- core->name, PCI_FUNC(pci->devfn),
+ pr_err("func %d: Can't get MMIO memory @ 0x%llx, subsystem: %04x:%04x\n",
+ PCI_FUNC(pci->devfn),
(unsigned long long)pci_resource_start(pci, 0),
pci->subsystem_vendor, pci->subsystem_device);
return -EBUSY;
}
-/* Allocate and initialize the cx88 core struct. One should hold the
- * devlist mutex before calling this. */
+/*
+ * Allocate and initialize the cx88 core struct. One should hold the
+ * devlist mutex before calling this.
+ */
struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr)
{
struct cx88_core *core;
int i;
core = kzalloc(sizeof(*core), GFP_KERNEL);
- if (core == NULL)
+ if (!core)
return NULL;
atomic_inc(&core->refcount);
@@ -3715,7 +3705,7 @@ struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr)
return NULL;
}
- if (0 != cx88_get_resources(core, pci)) {
+ if (cx88_get_resources(core, pci) != 0) {
v4l2_ctrl_handler_free(&core->video_hdl);
v4l2_ctrl_handler_free(&core->audio_hdl);
v4l2_device_unregister(&core->v4l2_dev);
@@ -3729,9 +3719,9 @@ struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr)
pci_resource_len(pci, 0));
core->bmmio = (u8 __iomem *)core->lmmio;
- if (core->lmmio == NULL) {
+ if (!core->lmmio) {
release_mem_region(pci_resource_start(pci, 0),
- pci_resource_len(pci, 0));
+ pci_resource_len(pci, 0));
v4l2_ctrl_handler_free(&core->video_hdl);
v4l2_ctrl_handler_free(&core->audio_hdl);
v4l2_device_unregister(&core->v4l2_dev);
@@ -3743,11 +3733,11 @@ struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr)
core->boardnr = UNSET;
if (card[core->nr] < ARRAY_SIZE(cx88_boards))
core->boardnr = card[core->nr];
- for (i = 0; UNSET == core->boardnr && i < ARRAY_SIZE(cx88_subids); i++)
+ for (i = 0; core->boardnr == UNSET && i < ARRAY_SIZE(cx88_subids); i++)
if (pci->subsystem_vendor == cx88_subids[i].subvendor &&
pci->subsystem_device == cx88_subids[i].subdevice)
core->boardnr = cx88_subids[i].card;
- if (UNSET == core->boardnr) {
+ if (core->boardnr == UNSET) {
core->boardnr = CX88_BOARD_UNKNOWN;
cx88_card_list(core, pci);
}
@@ -3757,7 +3747,7 @@ struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr)
if (!core->board.num_frontends && (core->board.mpeg & CX88_MPEG_DVB))
core->board.num_frontends = 1;
- info_printk(core, "subsystem: %04x:%04x, board: %s [card=%d,%s], frontend(s): %d\n",
+ pr_info("subsystem: %04x:%04x, board: %s [card=%d,%s], frontend(s): %d\n",
pci->subsystem_vendor, pci->subsystem_device, core->board.name,
core->boardnr, card[core->nr] == core->boardnr ?
"insmod option" : "autodetected",
@@ -3777,10 +3767,12 @@ struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr)
cx88_i2c_init(core, pci);
/* load tuner module, if needed */
- if (UNSET != core->board.tuner_type) {
- /* Ignore 0x6b and 0x6f on cx88 boards.
+ if (core->board.tuner_type != UNSET) {
+ /*
+ * Ignore 0x6b and 0x6f on cx88 boards.
* FusionHDTV5 RT Gold has an ir receiver at 0x6b
- * and an RTC at 0x6f which can get corrupted if probed. */
+ * and an RTC at 0x6f which can get corrupted if probed.
+ */
static const unsigned short tv_addrs[] = {
0x42, 0x43, 0x4a, 0x4b, /* tda8290 */
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
@@ -3789,24 +3781,27 @@ struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr)
};
int has_demod = (core->board.tda9887_conf & TDA9887_PRESENT);
- /* I don't trust the radio_type as is stored in the card
- definitions, so we just probe for it.
- The radio_type is sometimes missing, or set to UNSET but
- later code configures a tea5767.
+ /*
+ * I don't trust the radio_type as is stored in the card
+ * definitions, so we just probe for it.
+ * The radio_type is sometimes missing, or set to UNSET but
+ * later code configures a tea5767.
*/
v4l2_i2c_new_subdev(&core->v4l2_dev, &core->i2c_adap,
- "tuner", 0, v4l2_i2c_tuner_addrs(ADDRS_RADIO));
+ "tuner", 0,
+ v4l2_i2c_tuner_addrs(ADDRS_RADIO));
if (has_demod)
v4l2_i2c_new_subdev(&core->v4l2_dev,
- &core->i2c_adap, "tuner",
+ &core->i2c_adap, "tuner",
0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD));
if (core->board.tuner_addr == ADDR_UNSET) {
v4l2_i2c_new_subdev(&core->v4l2_dev,
- &core->i2c_adap, "tuner",
+ &core->i2c_adap, "tuner",
0, has_demod ? tv_addrs + 4 : tv_addrs);
} else {
v4l2_i2c_new_subdev(&core->v4l2_dev, &core->i2c_adap,
- "tuner", core->board.tuner_addr, NULL);
+ "tuner", core->board.tuner_addr,
+ NULL);
}
}
diff --git a/drivers/media/pci/cx88/cx88-core.c b/drivers/media/pci/cx88/cx88-core.c
index 46fe8c1eb9d4..973a9cd4c635 100644
--- a/drivers/media/pci/cx88/cx88-core.c
+++ b/drivers/media/pci/cx88/cx88-core.c
@@ -1,5 +1,4 @@
/*
- *
* device driver for Conexant 2388x based TV cards
* driver core
*
@@ -19,12 +18,10 @@
* 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 "cx88.h"
+
#include <linux/init.h>
#include <linux/list.h>
#include <linux/module.h>
@@ -38,7 +35,6 @@
#include <linux/videodev2.h>
#include <linux/mutex.h>
-#include "cx88.h"
#include <media/v4l2-common.h>
#include <media/v4l2-ioctl.h>
@@ -53,17 +49,22 @@ module_param_named(core_debug, cx88_core_debug, int, 0644);
MODULE_PARM_DESC(core_debug, "enable debug messages [core]");
static unsigned int nicam;
-module_param(nicam,int,0644);
-MODULE_PARM_DESC(nicam,"tv audio is nicam");
+module_param(nicam, int, 0644);
+MODULE_PARM_DESC(nicam, "tv audio is nicam");
static unsigned int nocomb;
-module_param(nocomb,int,0644);
-MODULE_PARM_DESC(nocomb,"disable comb filter");
+module_param(nocomb, int, 0644);
+MODULE_PARM_DESC(nocomb, "disable comb filter");
+
+#define dprintk0(fmt, arg...) \
+ printk(KERN_DEBUG pr_fmt("%s: core:" fmt), \
+ __func__, ##arg) \
-#define dprintk(level,fmt, arg...) do { \
- if (cx88_core_debug >= level) \
- printk(KERN_DEBUG "%s: " fmt, core->name , ## arg); \
- } while(0)
+#define dprintk(level, fmt, arg...) do { \
+ if (cx88_core_debug >= level) \
+ printk(KERN_DEBUG pr_fmt("%s: core:" fmt), \
+ __func__, ##arg); \
+} while (0)
static unsigned int cx88_devcount;
static LIST_HEAD(cx88_devlist);
@@ -71,15 +72,17 @@ static DEFINE_MUTEX(devlist);
#define NO_SYNC_LINE (-1U)
-/* @lpi: lines per IRQ, or 0 to not generate irqs. Note: IRQ to be
- generated _after_ lpi lines are transferred. */
-static __le32* cx88_risc_field(__le32 *rp, struct scatterlist *sglist,
- unsigned int offset, u32 sync_line,
- unsigned int bpl, unsigned int padding,
- unsigned int lines, unsigned int lpi, bool jump)
+/*
+ * @lpi: lines per IRQ, or 0 to not generate irqs. Note: IRQ to be
+ * generated _after_ lpi lines are transferred.
+ */
+static __le32 *cx88_risc_field(__le32 *rp, struct scatterlist *sglist,
+ unsigned int offset, u32 sync_line,
+ unsigned int bpl, unsigned int padding,
+ unsigned int lines, unsigned int lpi, bool jump)
{
struct scatterlist *sg;
- unsigned int line,todo,sol;
+ unsigned int line, todo, sol;
if (jump) {
(*rp++) = cpu_to_le32(RISC_JUMP);
@@ -97,33 +100,34 @@ static __le32* cx88_risc_field(__le32 *rp, struct scatterlist *sglist,
offset -= sg_dma_len(sg);
sg = sg_next(sg);
}
- if (lpi && line>0 && !(line % lpi))
+ if (lpi && line > 0 && !(line % lpi))
sol = RISC_SOL | RISC_IRQ1 | RISC_CNT_INC;
else
sol = RISC_SOL;
- if (bpl <= sg_dma_len(sg)-offset) {
+ if (bpl <= sg_dma_len(sg) - offset) {
/* fits into current chunk */
- *(rp++)=cpu_to_le32(RISC_WRITE|sol|RISC_EOL|bpl);
- *(rp++)=cpu_to_le32(sg_dma_address(sg)+offset);
- offset+=bpl;
+ *(rp++) = cpu_to_le32(RISC_WRITE | sol |
+ RISC_EOL | bpl);
+ *(rp++) = cpu_to_le32(sg_dma_address(sg) + offset);
+ offset += bpl;
} else {
/* scanline needs to be split */
todo = bpl;
- *(rp++)=cpu_to_le32(RISC_WRITE|sol|
- (sg_dma_len(sg)-offset));
- *(rp++)=cpu_to_le32(sg_dma_address(sg)+offset);
- todo -= (sg_dma_len(sg)-offset);
+ *(rp++) = cpu_to_le32(RISC_WRITE | sol |
+ (sg_dma_len(sg) - offset));
+ *(rp++) = cpu_to_le32(sg_dma_address(sg) + offset);
+ todo -= (sg_dma_len(sg) - offset);
offset = 0;
sg = sg_next(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(RISC_WRITE |
+ sg_dma_len(sg));
+ *(rp++) = cpu_to_le32(sg_dma_address(sg));
todo -= sg_dma_len(sg);
sg = sg_next(sg);
}
- *(rp++)=cpu_to_le32(RISC_WRITE|RISC_EOL|todo);
- *(rp++)=cpu_to_le32(sg_dma_address(sg));
+ *(rp++) = cpu_to_le32(RISC_WRITE | RISC_EOL | todo);
+ *(rp++) = cpu_to_le32(sg_dma_address(sg));
offset += todo;
}
offset += padding;
@@ -137,41 +141,46 @@ int cx88_risc_buffer(struct pci_dev *pci, struct cx88_riscmem *risc,
unsigned int top_offset, unsigned int bottom_offset,
unsigned int bpl, unsigned int padding, unsigned int lines)
{
- u32 instructions,fields;
+ u32 instructions, fields;
__le32 *rp;
fields = 0;
- if (UNSET != top_offset)
+ if (top_offset != UNSET)
fields++;
- if (UNSET != bottom_offset)
+ if (bottom_offset != UNSET)
fields++;
- /* estimate risc mem: worst case is one write per page border +
- one write per scan line + syncs + jump (all 2 dwords). Padding
- can cause next bpl to start close to a page border. First DMA
- region may be smaller than PAGE_SIZE */
- instructions = fields * (1 + ((bpl + padding) * lines) / PAGE_SIZE + lines);
+ /*
+ * estimate risc mem: worst case is one write per page border +
+ * one write per scan line + syncs + jump (all 2 dwords). Padding
+ * can cause next bpl to start close to a page border. First DMA
+ * region may be smaller than PAGE_SIZE
+ */
+ instructions = fields * (1 + ((bpl + padding) * lines) /
+ PAGE_SIZE + lines);
instructions += 4;
risc->size = instructions * 8;
risc->dma = 0;
risc->cpu = pci_zalloc_consistent(pci, risc->size, &risc->dma);
- if (NULL == risc->cpu)
+ if (!risc->cpu)
return -ENOMEM;
/* write risc instructions */
rp = risc->cpu;
- if (UNSET != top_offset)
+ if (top_offset != UNSET)
rp = cx88_risc_field(rp, sglist, top_offset, 0,
bpl, padding, lines, 0, true);
- if (UNSET != bottom_offset)
+ if (bottom_offset != UNSET)
rp = cx88_risc_field(rp, sglist, bottom_offset, 0x200,
- bpl, padding, lines, 0, top_offset == UNSET);
+ bpl, padding, lines, 0,
+ top_offset == UNSET);
/* save pointer to jmp instruction address */
risc->jmp = rp;
- BUG_ON((risc->jmp - risc->cpu + 2) * sizeof (*risc->cpu) > risc->size);
+ WARN_ON((risc->jmp - risc->cpu + 2) * sizeof(*risc->cpu) > risc->size);
return 0;
}
+EXPORT_SYMBOL(cx88_risc_buffer);
int cx88_risc_databuffer(struct pci_dev *pci, struct cx88_riscmem *risc,
struct scatterlist *sglist, unsigned int bpl,
@@ -180,32 +189,38 @@ int cx88_risc_databuffer(struct pci_dev *pci, struct cx88_riscmem *risc,
u32 instructions;
__le32 *rp;
- /* estimate risc mem: worst case is one write per page border +
- one write per scan line + syncs + jump (all 2 dwords). Here
- there is no padding and no sync. First DMA region may be smaller
- than PAGE_SIZE */
+ /*
+ * estimate risc mem: worst case is one write per page border +
+ * one write per scan line + syncs + jump (all 2 dwords). Here
+ * there is no padding and no sync. First DMA region may be smaller
+ * than PAGE_SIZE
+ */
instructions = 1 + (bpl * lines) / PAGE_SIZE + lines;
instructions += 3;
risc->size = instructions * 8;
risc->dma = 0;
risc->cpu = pci_zalloc_consistent(pci, risc->size, &risc->dma);
- if (NULL == risc->cpu)
+ if (!risc->cpu)
return -ENOMEM;
/* write risc instructions */
rp = risc->cpu;
- rp = cx88_risc_field(rp, sglist, 0, NO_SYNC_LINE, bpl, 0, lines, lpi, !lpi);
+ rp = cx88_risc_field(rp, sglist, 0, NO_SYNC_LINE, bpl, 0,
+ lines, lpi, !lpi);
/* save pointer to jmp instruction address */
risc->jmp = rp;
- BUG_ON((risc->jmp - risc->cpu + 2) * sizeof (*risc->cpu) > risc->size);
+ WARN_ON((risc->jmp - risc->cpu + 2) * sizeof(*risc->cpu) > risc->size);
return 0;
}
+EXPORT_SYMBOL(cx88_risc_databuffer);
-/* ------------------------------------------------------------------ */
-/* our SRAM memory layout */
+/*
+ * our SRAM memory layout
+ */
-/* we are going to put all thr risc programs into host memory, so we
+/*
+ * we are going to put all thr risc programs into host memory, so we
* can use the whole SDRAM for the DMA fifos. To simplify things, we
* use a static memory layout. That surely will waste memory in case
* we don't use all DMA channels at the same time (which will be the
@@ -329,12 +344,13 @@ const struct sram_channel cx88_sram_channels[] = {
.cnt2_reg = MO_DMA27_CNT2,
},
};
+EXPORT_SYMBOL(cx88_sram_channels);
int cx88_sram_channel_setup(struct cx88_core *core,
const struct sram_channel *ch,
unsigned int bpl, u32 risc)
{
- unsigned int i,lines;
+ unsigned int i, lines;
u32 cdt;
bpl = (bpl + 7) & ~7; /* alignment */
@@ -342,16 +358,16 @@ int cx88_sram_channel_setup(struct cx88_core *core,
lines = ch->fifo_size / bpl;
if (lines > 6)
lines = 6;
- BUG_ON(lines < 2);
+ WARN_ON(lines < 2);
/* write CDT */
for (i = 0; i < lines; i++)
- cx_write(cdt + 16*i, ch->fifo_start + bpl*i);
+ cx_write(cdt + 16 * i, ch->fifo_start + bpl * i);
/* write CMDS */
cx_write(ch->cmds_start + 0, risc);
cx_write(ch->cmds_start + 4, cdt);
- cx_write(ch->cmds_start + 8, (lines*16) >> 3);
+ cx_write(ch->cmds_start + 8, (lines * 16) >> 3);
cx_write(ch->cmds_start + 12, ch->ctrl_start);
cx_write(ch->cmds_start + 16, 64 >> 2);
for (i = 20; i < 64; i += 4)
@@ -360,12 +376,13 @@ int cx88_sram_channel_setup(struct cx88_core *core,
/* fill registers */
cx_write(ch->ptr1_reg, ch->fifo_start);
cx_write(ch->ptr2_reg, cdt);
- cx_write(ch->cnt1_reg, (bpl >> 3) -1);
- cx_write(ch->cnt2_reg, (lines*16) >> 3);
+ cx_write(ch->cnt1_reg, (bpl >> 3) - 1);
+ cx_write(ch->cnt2_reg, (lines * 16) >> 3);
- dprintk(2,"sram setup %s: bpl=%d lines=%d\n", ch->name, bpl, lines);
+ dprintk(2, "sram setup %s: bpl=%d lines=%d\n", ch->name, bpl, lines);
return 0;
}
+EXPORT_SYMBOL(cx88_sram_channel_setup);
/* ------------------------------------------------------------------ */
/* debug helper code */
@@ -373,23 +390,23 @@ int cx88_sram_channel_setup(struct cx88_core *core,
static int cx88_risc_decode(u32 risc)
{
static const char * const instr[16] = {
- [ RISC_SYNC >> 28 ] = "sync",
- [ RISC_WRITE >> 28 ] = "write",
- [ RISC_WRITEC >> 28 ] = "writec",
- [ RISC_READ >> 28 ] = "read",
- [ RISC_READC >> 28 ] = "readc",
- [ RISC_JUMP >> 28 ] = "jump",
- [ RISC_SKIP >> 28 ] = "skip",
- [ RISC_WRITERM >> 28 ] = "writerm",
- [ RISC_WRITECM >> 28 ] = "writecm",
- [ RISC_WRITECR >> 28 ] = "writecr",
+ [RISC_SYNC >> 28] = "sync",
+ [RISC_WRITE >> 28] = "write",
+ [RISC_WRITEC >> 28] = "writec",
+ [RISC_READ >> 28] = "read",
+ [RISC_READC >> 28] = "readc",
+ [RISC_JUMP >> 28] = "jump",
+ [RISC_SKIP >> 28] = "skip",
+ [RISC_WRITERM >> 28] = "writerm",
+ [RISC_WRITECM >> 28] = "writecm",
+ [RISC_WRITECR >> 28] = "writecr",
};
static int const incr[16] = {
- [ RISC_WRITE >> 28 ] = 2,
- [ RISC_JUMP >> 28 ] = 2,
- [ RISC_WRITERM >> 28 ] = 3,
- [ RISC_WRITECM >> 28 ] = 3,
- [ RISC_WRITECR >> 28 ] = 4,
+ [RISC_WRITE >> 28] = 2,
+ [RISC_JUMP >> 28] = 2,
+ [RISC_WRITERM >> 28] = 3,
+ [RISC_WRITECM >> 28] = 3,
+ [RISC_WRITECR >> 28] = 4,
};
static const char * const bits[] = {
"12", "13", "14", "resync",
@@ -399,16 +416,15 @@ static int cx88_risc_decode(u32 risc)
};
int i;
- printk("0x%08x [ %s", risc,
- instr[risc >> 28] ? instr[risc >> 28] : "INVALID");
- for (i = ARRAY_SIZE(bits)-1; i >= 0; i--)
+ dprintk0("0x%08x [ %s", risc,
+ instr[risc >> 28] ? instr[risc >> 28] : "INVALID");
+ for (i = ARRAY_SIZE(bits) - 1; i >= 0; i--)
if (risc & (1 << (i + 12)))
- printk(" %s",bits[i]);
- printk(" count=%d ]\n", risc & 0xfff);
+ pr_cont(" %s", bits[i]);
+ pr_cont(" count=%d ]\n", risc & 0xfff);
return incr[risc >> 28] ? incr[risc >> 28] : 1;
}
-
void cx88_sram_channel_dump(struct cx88_core *core,
const struct sram_channel *ch)
{
@@ -426,46 +442,41 @@ void cx88_sram_channel_dump(struct cx88_core *core,
"line / byte",
};
u32 risc;
- unsigned int i,j,n;
+ unsigned int i, j, n;
- printk("%s: %s - dma channel status dump\n",
- core->name,ch->name);
+ dprintk0("%s - dma channel status dump\n", ch->name);
for (i = 0; i < ARRAY_SIZE(name); i++)
- printk("%s: cmds: %-12s: 0x%08x\n",
- core->name,name[i],
- cx_read(ch->cmds_start + 4*i));
+ dprintk0(" cmds: %-12s: 0x%08x\n",
+ name[i], cx_read(ch->cmds_start + 4 * i));
for (n = 1, i = 0; i < 4; i++) {
- risc = cx_read(ch->cmds_start + 4 * (i+11));
- printk("%s: risc%d: ", core->name, i);
+ risc = cx_read(ch->cmds_start + 4 * (i + 11));
+ pr_cont(" risc%d: ", i);
if (--n)
- printk("0x%08x [ arg #%d ]\n", risc, n);
+ pr_cont("0x%08x [ arg #%d ]\n", risc, n);
else
n = cx88_risc_decode(risc);
}
for (i = 0; i < 16; i += n) {
risc = cx_read(ch->ctrl_start + 4 * i);
- printk("%s: iq %x: ", core->name, i);
+ dprintk0(" iq %x: ", i);
n = cx88_risc_decode(risc);
for (j = 1; j < n; j++) {
- risc = cx_read(ch->ctrl_start + 4 * (i+j));
- printk("%s: iq %x: 0x%08x [ arg #%d ]\n",
- core->name, i+j, risc, j);
+ risc = cx_read(ch->ctrl_start + 4 * (i + j));
+ pr_cont(" iq %x: 0x%08x [ arg #%d ]\n",
+ i + j, risc, j);
}
}
- printk("%s: fifo: 0x%08x -> 0x%x\n",
- core->name, ch->fifo_start, ch->fifo_start+ch->fifo_size);
- printk("%s: ctrl: 0x%08x -> 0x%x\n",
- core->name, ch->ctrl_start, ch->ctrl_start+6*16);
- printk("%s: ptr1_reg: 0x%08x\n",
- core->name,cx_read(ch->ptr1_reg));
- printk("%s: ptr2_reg: 0x%08x\n",
- core->name,cx_read(ch->ptr2_reg));
- printk("%s: cnt1_reg: 0x%08x\n",
- core->name,cx_read(ch->cnt1_reg));
- printk("%s: cnt2_reg: 0x%08x\n",
- core->name,cx_read(ch->cnt2_reg));
+ dprintk0("fifo: 0x%08x -> 0x%x\n",
+ ch->fifo_start, ch->fifo_start + ch->fifo_size);
+ dprintk0("ctrl: 0x%08x -> 0x%x\n",
+ ch->ctrl_start, ch->ctrl_start + 6 * 16);
+ dprintk0(" ptr1_reg: 0x%08x\n", cx_read(ch->ptr1_reg));
+ dprintk0(" ptr2_reg: 0x%08x\n", cx_read(ch->ptr2_reg));
+ dprintk0(" cnt1_reg: 0x%08x\n", cx_read(ch->cnt1_reg));
+ dprintk0(" cnt2_reg: 0x%08x\n", cx_read(ch->cnt2_reg));
}
+EXPORT_SYMBOL(cx88_sram_channel_dump);
static const char *cx88_pci_irqs[32] = {
"vid", "aud", "ts", "vip", "hst", "5", "6", "tm1",
@@ -474,25 +485,26 @@ static const char *cx88_pci_irqs[32] = {
"i2c", "i2c_rack", "ir_smp", "gpio0", "gpio1"
};
-void cx88_print_irqbits(const char *name, const char *tag, const char *strings[],
+void cx88_print_irqbits(const char *tag, const char *strings[],
int len, u32 bits, u32 mask)
{
unsigned int i;
- printk(KERN_DEBUG "%s: %s [0x%x]", name, tag, bits);
+ dprintk0("%s [0x%x]", tag, bits);
for (i = 0; i < len; i++) {
if (!(bits & (1 << i)))
continue;
if (strings[i])
- printk(" %s", strings[i]);
+ pr_cont(" %s", strings[i]);
else
- printk(" %d", i);
+ pr_cont(" %d", i);
if (!(mask & (1 << i)))
continue;
- printk("*");
+ pr_cont("*");
}
- printk("\n");
+ pr_cont("\n");
}
+EXPORT_SYMBOL(cx88_print_irqbits);
/* ------------------------------------------------------------------ */
@@ -505,11 +517,12 @@ int cx88_core_irq(struct cx88_core *core, u32 status)
handled++;
}
if (!handled)
- cx88_print_irqbits(core->name, "irq pci",
+ cx88_print_irqbits("irq pci",
cx88_pci_irqs, ARRAY_SIZE(cx88_pci_irqs),
status, core->pci_irqmask);
return handled;
}
+EXPORT_SYMBOL(cx88_core_irq);
void cx88_wakeup(struct cx88_core *core,
struct cx88_dmaqueue *q, u32 count)
@@ -524,6 +537,7 @@ void cx88_wakeup(struct cx88_core *core,
list_del(&buf->list);
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
}
+EXPORT_SYMBOL(cx88_wakeup);
void cx88_shutdown(struct cx88_core *core)
{
@@ -548,10 +562,11 @@ void cx88_shutdown(struct cx88_core *core)
/* stop capturing */
cx_write(VID_CAPTURE_CONTROL, 0);
}
+EXPORT_SYMBOL(cx88_shutdown);
int cx88_reset(struct cx88_core *core)
{
- dprintk(1,"%s\n",__func__);
+ dprintk(1, "");
cx88_shutdown(core);
/* clear irq status */
@@ -563,13 +578,15 @@ int cx88_reset(struct cx88_core *core)
msleep(100);
/* init sram */
- cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH21], 720*4, 0);
+ cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH21],
+ 720 * 4, 0);
cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH22], 128, 0);
cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH23], 128, 0);
cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH24], 128, 0);
cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH25], 128, 0);
cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH26], 128, 0);
- cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH28], 188*4, 0);
+ cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH28],
+ 188 * 4, 0);
cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH27], 128, 0);
/* misc init ... */
@@ -597,11 +614,12 @@ int cx88_reset(struct cx88_core *core)
/* Reset on-board parts */
cx_write(MO_SRST_IO, 0);
- msleep(10);
+ usleep_range(10000, 20000);
cx_write(MO_SRST_IO, 1);
return 0;
}
+EXPORT_SYMBOL(cx88_reset);
/* ------------------------------------------------------------------ */
@@ -631,10 +649,11 @@ static inline unsigned int norm_fsc8(v4l2_std_id norm)
if (norm & V4L2_STD_NTSC) // All NTSC/M and variants
return 28636360; // 3.57954545 MHz +/- 10 Hz
- /* SECAM have also different sub carrier for chroma,
- but step_db and step_dr, at cx88_set_tvnorm already handles that.
-
- The same FSC applies to PAL/BGDKIH, PAL/60, NTSC/4.43 and PAL/N
+ /*
+ * SECAM have also different sub carrier for chroma,
+ * but step_db and step_dr, at cx88_set_tvnorm already handles that.
+ *
+ * The same FSC applies to PAL/BGDKIH, PAL/60, NTSC/4.43 and PAL/N
*/
return 35468950; // 4.43361875 MHz +/- 5 Hz
@@ -642,13 +661,12 @@ static inline unsigned int norm_fsc8(v4l2_std_id norm)
static inline unsigned int norm_htotal(v4l2_std_id norm)
{
-
- unsigned int fsc4=norm_fsc8(norm)/2;
+ unsigned int fsc4 = norm_fsc8(norm) / 2;
/* returns 4*FSC / vtotal / frames per seconds */
return (norm & V4L2_STD_625_50) ?
- ((fsc4+312)/625+12)/25 :
- ((fsc4+262)/525*1001+15000)/30000;
+ ((fsc4 + 312) / 625 + 12) / 25 :
+ ((fsc4 + 262) / 525 * 1001 + 15000) / 30000;
}
static inline unsigned int norm_vbipack(v4l2_std_id norm)
@@ -656,14 +674,14 @@ static inline unsigned int norm_vbipack(v4l2_std_id norm)
return (norm & V4L2_STD_625_50) ? 511 : 400;
}
-int cx88_set_scale(struct cx88_core *core, unsigned int width, unsigned int height,
- enum v4l2_field field)
+int cx88_set_scale(struct cx88_core *core, unsigned int width,
+ unsigned int height, enum v4l2_field field)
{
unsigned int swidth = norm_swidth(core->tvnorm);
unsigned int sheight = norm_maxh(core->tvnorm);
u32 value;
- dprintk(1,"set_scale: %dx%d [%s%s,%s]\n", width, height,
+ dprintk(1, "set_scale: %dx%d [%s%s,%s]\n", width, height,
V4L2_FIELD_HAS_TOP(field) ? "T" : "",
V4L2_FIELD_HAS_BOTTOM(field) ? "B" : "",
v4l2_norm_to_name(core->tvnorm));
@@ -675,30 +693,30 @@ int cx88_set_scale(struct cx88_core *core, unsigned int width, unsigned int heig
value &= 0x3fe;
cx_write(MO_HDELAY_EVEN, value);
cx_write(MO_HDELAY_ODD, value);
- dprintk(1,"set_scale: hdelay 0x%04x (width %d)\n", value,swidth);
+ dprintk(1, "set_scale: hdelay 0x%04x (width %d)\n", value, swidth);
value = (swidth * 4096 / width) - 4096;
cx_write(MO_HSCALE_EVEN, value);
cx_write(MO_HSCALE_ODD, value);
- dprintk(1,"set_scale: hscale 0x%04x\n", value);
+ dprintk(1, "set_scale: hscale 0x%04x\n", value);
cx_write(MO_HACTIVE_EVEN, width);
cx_write(MO_HACTIVE_ODD, width);
- dprintk(1,"set_scale: hactive 0x%04x\n", width);
+ dprintk(1, "set_scale: hactive 0x%04x\n", width);
// recalc V scale Register (delay is constant)
cx_write(MO_VDELAY_EVEN, norm_vdelay(core->tvnorm));
cx_write(MO_VDELAY_ODD, norm_vdelay(core->tvnorm));
- dprintk(1,"set_scale: vdelay 0x%04x\n", norm_vdelay(core->tvnorm));
+ dprintk(1, "set_scale: vdelay 0x%04x\n", norm_vdelay(core->tvnorm));
value = (0x10000 - (sheight * 512 / height - 512)) & 0x1fff;
cx_write(MO_VSCALE_EVEN, value);
cx_write(MO_VSCALE_ODD, value);
- dprintk(1,"set_scale: vscale 0x%04x\n", value);
+ dprintk(1, "set_scale: vscale 0x%04x\n", value);
cx_write(MO_VACTIVE_EVEN, sheight);
cx_write(MO_VACTIVE_ODD, sheight);
- dprintk(1,"set_scale: vactive 0x%04x\n", sheight);
+ dprintk(1, "set_scale: vactive 0x%04x\n", sheight);
// setup filters
value = 0;
@@ -709,7 +727,7 @@ int cx88_set_scale(struct cx88_core *core, unsigned int width, unsigned int heig
}
if (INPUT(core->input).type == CX88_VMUX_SVIDEO)
value |= (1 << 13) | (1 << 5);
- if (V4L2_FIELD_INTERLACED == field)
+ if (field == V4L2_FIELD_INTERLACED)
value |= (1 << 3); // VINT (interlaced vertical scaling)
if (width < 385)
value |= (1 << 0); // 3-tap interpolation
@@ -720,10 +738,11 @@ int cx88_set_scale(struct cx88_core *core, unsigned int width, unsigned int heig
cx_andor(MO_FILTER_EVEN, 0x7ffc7f, value); /* preserve PEAKEN, PSEL */
cx_andor(MO_FILTER_ODD, 0x7ffc7f, value);
- dprintk(1,"set_scale: filter 0x%04x\n", value);
+ dprintk(1, "set_scale: filter 0x%04x\n", value);
return 0;
}
+EXPORT_SYMBOL(cx88_set_scale);
static const u32 xtal = 28636363;
@@ -740,36 +759,36 @@ static int set_pll(struct cx88_core *core, int prescale, u32 ofreq)
prescale = 5;
pll = ofreq * 8 * prescale * (u64)(1 << 20);
- do_div(pll,xtal);
+ do_div(pll, xtal);
reg = (pll & 0x3ffffff) | (pre[prescale] << 26);
if (((reg >> 20) & 0x3f) < 14) {
- printk("%s/0: pll out of range\n",core->name);
+ pr_err("pll out of range\n");
return -1;
}
- dprintk(1,"set_pll: MO_PLL_REG 0x%08x [old=0x%08x,freq=%d]\n",
+ dprintk(1, "set_pll: MO_PLL_REG 0x%08x [old=0x%08x,freq=%d]\n",
reg, cx_read(MO_PLL_REG), ofreq);
cx_write(MO_PLL_REG, reg);
for (i = 0; i < 100; i++) {
reg = cx_read(MO_DEVICE_STATUS);
- if (reg & (1<<2)) {
- dprintk(1,"pll locked [pre=%d,ofreq=%d]\n",
- prescale,ofreq);
+ if (reg & (1 << 2)) {
+ dprintk(1, "pll locked [pre=%d,ofreq=%d]\n",
+ prescale, ofreq);
return 0;
}
- dprintk(1,"pll not locked yet, waiting ...\n");
- msleep(10);
+ dprintk(1, "pll not locked yet, waiting ...\n");
+ usleep_range(10000, 20000);
}
- dprintk(1,"pll NOT locked [pre=%d,ofreq=%d]\n",prescale,ofreq);
+ dprintk(1, "pll NOT locked [pre=%d,ofreq=%d]\n", prescale, ofreq);
return -1;
}
int cx88_start_audio_dma(struct cx88_core *core)
{
/* constant 128 made buzz in analog Nicam-stereo for bigger fifo_size */
- int bpl = cx88_sram_channels[SRAM_CH25].fifo_size/4;
+ int bpl = cx88_sram_channels[SRAM_CH25].fifo_size / 4;
- int rds_bpl = cx88_sram_channels[SRAM_CH27].fifo_size/AUD_RDS_LINES;
+ int rds_bpl = cx88_sram_channels[SRAM_CH27].fifo_size / AUD_RDS_LINES;
/* If downstream RISC is enabled, bail out; ALSA is managing DMA */
if (cx_read(MO_AUD_DMACNTRL) & 0x10)
@@ -806,8 +825,8 @@ static int set_tvaudio(struct cx88_core *core)
{
v4l2_std_id norm = core->tvnorm;
- if (CX88_VMUX_TELEVISION != INPUT(core->input).type &&
- CX88_VMUX_CABLE != INPUT(core->input).type)
+ if (INPUT(core->input).type != CX88_VMUX_TELEVISION &&
+ INPUT(core->input).type != CX88_VMUX_CABLE)
return 0;
if (V4L2_STD_PAL_BG & norm) {
@@ -822,7 +841,8 @@ static int set_tvaudio(struct cx88_core *core)
} else if (V4L2_STD_SECAM_L & norm) {
core->tvaudio = WW_L;
- } else if ((V4L2_STD_SECAM_B | V4L2_STD_SECAM_G | V4L2_STD_SECAM_H) & norm) {
+ } else if ((V4L2_STD_SECAM_B | V4L2_STD_SECAM_G | V4L2_STD_SECAM_H) &
+ norm) {
core->tvaudio = WW_BG;
} else if (V4L2_STD_SECAM_DK & norm) {
@@ -836,8 +856,8 @@ static int set_tvaudio(struct cx88_core *core)
core->tvaudio = WW_EIAJ;
} else {
- printk("%s/0: tvaudio support needs work for this tv norm [%s], sorry\n",
- core->name, v4l2_norm_to_name(core->tvnorm));
+ pr_info("tvaudio support needs work for this tv norm [%s], sorry\n",
+ v4l2_norm_to_name(core->tvnorm));
core->tvaudio = WW_NONE;
return 0;
}
@@ -847,23 +867,21 @@ static int set_tvaudio(struct cx88_core *core)
/* cx88_set_stereo(dev,V4L2_TUNER_MODE_STEREO); */
/*
- This should be needed only on cx88-alsa. It seems that some cx88 chips have
- bugs and does require DMA enabled for it to work.
+ * This should be needed only on cx88-alsa. It seems that some cx88 chips have
+ * bugs and does require DMA enabled for it to work.
*/
cx88_start_audio_dma(core);
return 0;
}
-
-
int cx88_set_tvnorm(struct cx88_core *core, v4l2_std_id norm)
{
u32 fsc8;
u32 adc_clock;
u32 vdec_clock;
- u32 step_db,step_dr;
+ u32 step_db, step_dr;
u64 tmp64;
- u32 bdelay,agcdelay,htotal;
+ u32 bdelay, agcdelay, htotal;
u32 cxiformat, cxoformat;
if (norm == core->tvnorm)
@@ -912,62 +930,67 @@ int cx88_set_tvnorm(struct cx88_core *core, v4l2_std_id norm)
cxoformat = 0x181f0008;
}
- dprintk(1,"set_tvnorm: \"%s\" fsc8=%d adc=%d vdec=%d db/dr=%d/%d\n",
+ dprintk(1, "set_tvnorm: \"%s\" fsc8=%d adc=%d vdec=%d db/dr=%d/%d\n",
v4l2_norm_to_name(core->tvnorm), fsc8, adc_clock, vdec_clock,
step_db, step_dr);
- set_pll(core,2,vdec_clock);
+ set_pll(core, 2, vdec_clock);
- dprintk(1,"set_tvnorm: MO_INPUT_FORMAT 0x%08x [old=0x%08x]\n",
+ dprintk(1, "set_tvnorm: MO_INPUT_FORMAT 0x%08x [old=0x%08x]\n",
cxiformat, cx_read(MO_INPUT_FORMAT) & 0x0f);
- /* Chroma AGC must be disabled if SECAM is used, we enable it
- by default on PAL and NTSC */
+ /*
+ * Chroma AGC must be disabled if SECAM is used, we enable it
+ * by default on PAL and NTSC
+ */
cx_andor(MO_INPUT_FORMAT, 0x40f,
norm & V4L2_STD_SECAM ? cxiformat : cxiformat | 0x400);
// FIXME: as-is from DScaler
- dprintk(1,"set_tvnorm: MO_OUTPUT_FORMAT 0x%08x [old=0x%08x]\n",
+ dprintk(1, "set_tvnorm: MO_OUTPUT_FORMAT 0x%08x [old=0x%08x]\n",
cxoformat, cx_read(MO_OUTPUT_FORMAT));
cx_write(MO_OUTPUT_FORMAT, cxoformat);
// MO_SCONV_REG = adc clock / video dec clock * 2^17
tmp64 = adc_clock * (u64)(1 << 17);
do_div(tmp64, vdec_clock);
- dprintk(1,"set_tvnorm: MO_SCONV_REG 0x%08x [old=0x%08x]\n",
+ dprintk(1, "set_tvnorm: MO_SCONV_REG 0x%08x [old=0x%08x]\n",
(u32)tmp64, cx_read(MO_SCONV_REG));
cx_write(MO_SCONV_REG, (u32)tmp64);
// MO_SUB_STEP = 8 * fsc / video dec clock * 2^22
tmp64 = step_db * (u64)(1 << 22);
do_div(tmp64, vdec_clock);
- dprintk(1,"set_tvnorm: MO_SUB_STEP 0x%08x [old=0x%08x]\n",
+ dprintk(1, "set_tvnorm: MO_SUB_STEP 0x%08x [old=0x%08x]\n",
(u32)tmp64, cx_read(MO_SUB_STEP));
cx_write(MO_SUB_STEP, (u32)tmp64);
// MO_SUB_STEP_DR = 8 * 4406250 / video dec clock * 2^22
tmp64 = step_dr * (u64)(1 << 22);
do_div(tmp64, vdec_clock);
- dprintk(1,"set_tvnorm: MO_SUB_STEP_DR 0x%08x [old=0x%08x]\n",
+ dprintk(1, "set_tvnorm: MO_SUB_STEP_DR 0x%08x [old=0x%08x]\n",
(u32)tmp64, cx_read(MO_SUB_STEP_DR));
cx_write(MO_SUB_STEP_DR, (u32)tmp64);
// bdelay + agcdelay
bdelay = vdec_clock * 65 / 20000000 + 21;
agcdelay = vdec_clock * 68 / 20000000 + 15;
- dprintk(1,"set_tvnorm: MO_AGC_BURST 0x%08x [old=0x%08x,bdelay=%d,agcdelay=%d]\n",
- (bdelay << 8) | agcdelay, cx_read(MO_AGC_BURST), bdelay, agcdelay);
+ dprintk(1,
+ "set_tvnorm: MO_AGC_BURST 0x%08x [old=0x%08x,bdelay=%d,agcdelay=%d]\n",
+ (bdelay << 8) | agcdelay, cx_read(MO_AGC_BURST),
+ bdelay, agcdelay);
cx_write(MO_AGC_BURST, (bdelay << 8) | agcdelay);
// htotal
tmp64 = norm_htotal(norm) * (u64)vdec_clock;
do_div(tmp64, fsc8);
htotal = (u32)tmp64;
- dprintk(1,"set_tvnorm: MO_HTOTAL 0x%08x [old=0x%08x,htotal=%d]\n",
+ dprintk(1,
+ "set_tvnorm: MO_HTOTAL 0x%08x [old=0x%08x,htotal=%d]\n",
htotal, cx_read(MO_HTOTAL), (u32)tmp64);
cx_andor(MO_HTOTAL, 0x07ff, htotal);
// vbi stuff, set vbi offset to 10 (for 20 Clk*2 pixels), this makes
// the effective vbi offset ~244 samples, the same as the Bt8x8
- cx_write(MO_VBI_PACKET, (10<<11) | norm_vbipack(norm));
+ cx_write(MO_VBI_PACKET, (10 << 11) | norm_vbipack(norm));
// this is needed as well to set all tvnorm parameter
cx88_set_scale(core, 320, 240, V4L2_FIELD_INTERLACED);
@@ -978,12 +1001,16 @@ int cx88_set_tvnorm(struct cx88_core *core, v4l2_std_id norm)
// tell i2c chips
call_all(core, video, s_std, norm);
- /* The chroma_agc control should be inaccessible if the video format is SECAM */
+ /*
+ * The chroma_agc control should be inaccessible
+ * if the video format is SECAM
+ */
v4l2_ctrl_grab(core->chroma_agc, cxiformat == VideoFormatSECAM);
// done
return 0;
}
+EXPORT_SYMBOL(cx88_set_tvnorm);
/* ------------------------------------------------------------------ */
@@ -1008,8 +1035,9 @@ void cx88_vdev_init(struct cx88_core *core,
snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)",
core->name, type, core->board.name);
}
+EXPORT_SYMBOL(cx88_vdev_init);
-struct cx88_core* cx88_core_get(struct pci_dev *pci)
+struct cx88_core *cx88_core_get(struct pci_dev *pci)
{
struct cx88_core *core;
@@ -1020,7 +1048,7 @@ struct cx88_core* cx88_core_get(struct pci_dev *pci)
if (PCI_SLOT(pci->devfn) != core->pci_slot)
continue;
- if (0 != cx88_get_resources(core, pci)) {
+ if (cx88_get_resources(core, pci) != 0) {
mutex_unlock(&devlist);
return NULL;
}
@@ -1030,7 +1058,7 @@ struct cx88_core* cx88_core_get(struct pci_dev *pci)
}
core = cx88_core_create(pci, cx88_devcount);
- if (NULL != core) {
+ if (core) {
cx88_devcount++;
list_add_tail(&core->devlist, &cx88_devlist);
}
@@ -1038,18 +1066,19 @@ struct cx88_core* cx88_core_get(struct pci_dev *pci)
mutex_unlock(&devlist);
return core;
}
+EXPORT_SYMBOL(cx88_core_get);
void cx88_core_put(struct cx88_core *core, struct pci_dev *pci)
{
- release_mem_region(pci_resource_start(pci,0),
- pci_resource_len(pci,0));
+ release_mem_region(pci_resource_start(pci, 0),
+ pci_resource_len(pci, 0));
if (!atomic_dec_and_test(&core->refcount))
return;
mutex_lock(&devlist);
cx88_ir_fini(core);
- if (0 == core->i2c_rc) {
+ if (core->i2c_rc == 0) {
if (core->i2c_rtc)
i2c_unregister_device(core->i2c_rtc);
i2c_del_adapter(&core->i2c_adap);
@@ -1063,29 +1092,4 @@ void cx88_core_put(struct cx88_core *core, struct pci_dev *pci)
v4l2_device_unregister(&core->v4l2_dev);
kfree(core);
}
-
-/* ------------------------------------------------------------------ */
-
-EXPORT_SYMBOL(cx88_print_irqbits);
-
-EXPORT_SYMBOL(cx88_core_irq);
-EXPORT_SYMBOL(cx88_wakeup);
-EXPORT_SYMBOL(cx88_reset);
-EXPORT_SYMBOL(cx88_shutdown);
-
-EXPORT_SYMBOL(cx88_risc_buffer);
-EXPORT_SYMBOL(cx88_risc_databuffer);
-
-EXPORT_SYMBOL(cx88_sram_channels);
-EXPORT_SYMBOL(cx88_sram_channel_setup);
-EXPORT_SYMBOL(cx88_sram_channel_dump);
-
-EXPORT_SYMBOL(cx88_set_tvnorm);
-EXPORT_SYMBOL(cx88_set_scale);
-
-EXPORT_SYMBOL(cx88_vdev_init);
-EXPORT_SYMBOL(cx88_core_get);
EXPORT_SYMBOL(cx88_core_put);
-
-EXPORT_SYMBOL(cx88_ir_start);
-EXPORT_SYMBOL(cx88_ir_stop);
diff --git a/drivers/media/pci/cx88/cx88-dsp.c b/drivers/media/pci/cx88/cx88-dsp.c
index a9907265ff66..105029088120 100644
--- a/drivers/media/pci/cx88/cx88-dsp.c
+++ b/drivers/media/pci/cx88/cx88-dsp.c
@@ -1,5 +1,4 @@
/*
- *
* Stereo and SAP detection for cx88
*
* Copyright (c) 2009 Marton Balint <cus@fazekas.hu>
@@ -13,41 +12,41 @@
* 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 "cx88.h"
+#include "cx88-reg.h"
+
#include <linux/slab.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/jiffies.h>
#include <asm/div64.h>
-#include "cx88.h"
-#include "cx88-reg.h"
-
#define INT_PI ((s32)(3.141592653589 * 32768.0))
#define compat_remainder(a, b) \
- ((float)(((s32)((a)*100))%((s32)((b)*100)))/100.0)
+ ((float)(((s32)((a) * 100)) % ((s32)((b) * 100))) / 100.0)
#define baseband_freq(carrier, srate, tone) ((s32)( \
(compat_remainder(carrier + tone, srate)) / srate * 2 * INT_PI))
-/* We calculate the baseband frequencies of the carrier and the pilot tones
- * based on the the sampling rate of the audio rds fifo. */
+/*
+ * We calculate the baseband frequencies of the carrier and the pilot tones
+ * based on the the sampling rate of the audio rds fifo.
+ */
#define FREQ_A2_CARRIER baseband_freq(54687.5, 2689.36, 0.0)
#define FREQ_A2_DUAL baseband_freq(54687.5, 2689.36, 274.1)
#define FREQ_A2_STEREO baseband_freq(54687.5, 2689.36, 117.5)
-/* The frequencies below are from the reference driver. They probably need
+/*
+ * The frequencies below are from the reference driver. They probably need
* further adjustments, because they are not tested at all. You may even need
* to play a bit with the registers of the chip to select the proper signal
* for the input of the audio rds fifo, and measure it's sampling rate to
- * calculate the proper baseband frequencies... */
+ * calculate the proper baseband frequencies...
+ */
#define FREQ_A2M_CARRIER ((s32)(2.114516 * 32768.0))
#define FREQ_A2M_DUAL ((s32)(2.754916 * 32768.0))
@@ -71,43 +70,52 @@ static unsigned int dsp_debug;
module_param(dsp_debug, int, 0644);
MODULE_PARM_DESC(dsp_debug, "enable audio dsp debug messages");
-#define dprintk(level, fmt, arg...) if (dsp_debug >= level) \
- printk(KERN_DEBUG "%s/0: " fmt, core->name , ## arg)
+#define dprintk(level, fmt, arg...) do { \
+ if (dsp_debug >= level) \
+ printk(KERN_DEBUG pr_fmt("%s: dsp:" fmt), \
+ __func__, ##arg); \
+} while (0)
static s32 int_cos(u32 x)
{
u32 t2, t4, t6, t8;
s32 ret;
u16 period = x / INT_PI;
+
if (period % 2)
return -int_cos(x - INT_PI);
x = x % INT_PI;
- if (x > INT_PI/2)
- return -int_cos(INT_PI/2 - (x % (INT_PI/2)));
- /* Now x is between 0 and INT_PI/2.
- * To calculate cos(x) we use it's Taylor polinom. */
- t2 = x*x/32768/2;
- t4 = t2*x/32768*x/32768/3/4;
- t6 = t4*x/32768*x/32768/5/6;
- t8 = t6*x/32768*x/32768/7/8;
- ret = 32768-t2+t4-t6+t8;
+ if (x > INT_PI / 2)
+ return -int_cos(INT_PI / 2 - (x % (INT_PI / 2)));
+ /*
+ * Now x is between 0 and INT_PI/2.
+ * To calculate cos(x) we use it's Taylor polinom.
+ */
+ t2 = x * x / 32768 / 2;
+ t4 = t2 * x / 32768 * x / 32768 / 3 / 4;
+ t6 = t4 * x / 32768 * x / 32768 / 5 / 6;
+ t8 = t6 * x / 32768 * x / 32768 / 7 / 8;
+ ret = 32768 - t2 + t4 - t6 + t8;
return ret;
}
static u32 int_goertzel(s16 x[], u32 N, u32 freq)
{
- /* We use the Goertzel algorithm to determine the power of the
- * given frequency in the signal */
+ /*
+ * We use the Goertzel algorithm to determine the power of the
+ * given frequency in the signal
+ */
s32 s_prev = 0;
s32 s_prev2 = 0;
- s32 coeff = 2*int_cos(freq);
+ s32 coeff = 2 * int_cos(freq);
u32 i;
u64 tmp;
u32 divisor;
for (i = 0; i < N; i++) {
- s32 s = x[i] + ((s64)coeff*s_prev/32768) - s_prev2;
+ s32 s = x[i] + ((s64)coeff * s_prev / 32768) - s_prev2;
+
s_prev2 = s_prev;
s_prev = s;
}
@@ -115,17 +123,20 @@ static u32 int_goertzel(s16 x[], u32 N, u32 freq)
tmp = (s64)s_prev2 * s_prev2 + (s64)s_prev * s_prev -
(s64)coeff * s_prev2 * s_prev / 32768;
- /* XXX: N must be low enough so that N*N fits in s32.
- * Else we need two divisions. */
+ /*
+ * XXX: N must be low enough so that N*N fits in s32.
+ * Else we need two divisions.
+ */
divisor = N * N;
do_div(tmp, divisor);
- return (u32) tmp;
+ return (u32)tmp;
}
static u32 freq_magnitude(s16 x[], u32 N, u32 freq)
{
u32 sum = int_goertzel(x, N, freq);
+
return (u32)int_sqrt(sum);
}
@@ -138,7 +149,7 @@ static u32 noise_magnitude(s16 x[], u32 N, u32 freq_start, u32 freq_end)
if (N > 192) {
/* The last 192 samples are enough for noise detection */
- x += (N-192);
+ x += (N - 192);
N = 192;
}
@@ -176,8 +187,8 @@ static s32 detect_a2_a2m_eiaj(struct cx88_core *core, s16 x[], u32 N)
dual_freq = FREQ_EIAJ_DUAL;
break;
default:
- printk(KERN_WARNING "%s/0: unsupported audio mode %d for %s\n",
- core->name, core->tvaudio, __func__);
+ pr_warn("unsupported audio mode %d for %s\n",
+ core->tvaudio, __func__);
return UNSET;
}
@@ -186,8 +197,9 @@ static s32 detect_a2_a2m_eiaj(struct cx88_core *core, s16 x[], u32 N)
dual = freq_magnitude(x, N, dual_freq);
noise = noise_magnitude(x, N, FREQ_NOISE_START, FREQ_NOISE_END);
- dprintk(1, "detect a2/a2m/eiaj: carrier=%d, stereo=%d, dual=%d, "
- "noise=%d\n", carrier, stereo, dual, noise);
+ dprintk(1,
+ "detect a2/a2m/eiaj: carrier=%d, stereo=%d, dual=%d, noise=%d\n",
+ carrier, stereo, dual, noise);
if (stereo > dual)
ret = V4L2_TUNER_SUB_STEREO;
@@ -196,20 +208,22 @@ static s32 detect_a2_a2m_eiaj(struct cx88_core *core, s16 x[], u32 N)
if (core->tvaudio == WW_EIAJ) {
/* EIAJ checks may need adjustments */
- if ((carrier > max(stereo, dual)*2) &&
- (carrier < max(stereo, dual)*6) &&
+ if ((carrier > max(stereo, dual) * 2) &&
+ (carrier < max(stereo, dual) * 6) &&
(carrier > 20 && carrier < 200) &&
(max(stereo, dual) > min(stereo, dual))) {
- /* For EIAJ the carrier is always present,
- so we probably don't need noise detection */
+ /*
+ * For EIAJ the carrier is always present,
+ * so we probably don't need noise detection
+ */
return ret;
}
} else {
- if ((carrier > max(stereo, dual)*2) &&
- (carrier < max(stereo, dual)*8) &&
+ if ((carrier > max(stereo, dual) * 2) &&
+ (carrier < max(stereo, dual) * 8) &&
(carrier > 20 && carrier < 200) &&
(noise < 10) &&
- (max(stereo, dual) > min(stereo, dual)*2)) {
+ (max(stereo, dual) > min(stereo, dual) * 2)) {
return ret;
}
}
@@ -222,8 +236,9 @@ static s32 detect_btsc(struct cx88_core *core, s16 x[], u32 N)
s32 sap = freq_magnitude(x, N, FREQ_BTSC_SAP);
s32 dual_ref = freq_magnitude(x, N, FREQ_BTSC_DUAL_REF);
s32 dual = freq_magnitude(x, N, FREQ_BTSC_DUAL);
- dprintk(1, "detect btsc: dual_ref=%d, dual=%d, sap_ref=%d, sap=%d"
- "\n", dual_ref, dual, sap_ref, sap);
+
+ dprintk(1, "detect btsc: dual_ref=%d, dual=%d, sap_ref=%d, sap=%d\n",
+ dual_ref, dual, sap_ref, sap);
/* FIXME: Currently not supported */
return UNSET;
}
@@ -234,36 +249,31 @@ static s16 *read_rds_samples(struct cx88_core *core, u32 *N)
s16 *samples;
unsigned int i;
- unsigned int bpl = srch->fifo_size/AUD_RDS_LINES;
- unsigned int spl = bpl/4;
- unsigned int sample_count = spl*(AUD_RDS_LINES-1);
+ unsigned int bpl = srch->fifo_size / AUD_RDS_LINES;
+ unsigned int spl = bpl / 4;
+ unsigned int sample_count = spl * (AUD_RDS_LINES - 1);
u32 current_address = cx_read(srch->ptr1_reg);
u32 offset = (current_address - srch->fifo_start + bpl);
- dprintk(1, "read RDS samples: current_address=%08x (offset=%08x), "
- "sample_count=%d, aud_intstat=%08x\n", current_address,
+ dprintk(1,
+ "read RDS samples: current_address=%08x (offset=%08x), sample_count=%d, aud_intstat=%08x\n",
+ current_address,
current_address - srch->fifo_start, sample_count,
cx_read(MO_AUD_INTSTAT));
-
- samples = kmalloc(sizeof(s16)*sample_count, GFP_KERNEL);
+ samples = kmalloc_array(sample_count, sizeof(*samples), GFP_KERNEL);
if (!samples)
return NULL;
*N = sample_count;
for (i = 0; i < sample_count; i++) {
- offset = offset % (AUD_RDS_LINES*bpl);
+ offset = offset % (AUD_RDS_LINES * bpl);
samples[i] = cx_read(srch->fifo_start + offset);
offset += 4;
}
- if (dsp_debug >= 2) {
- dprintk(2, "RDS samples dump: ");
- for (i = 0; i < sample_count; i++)
- printk("%hd ", samples[i]);
- printk(".\n");
- }
+ dprintk(2, "RDS samples dump: %*ph\n", sample_count, samples);
return samples;
}
@@ -310,11 +320,11 @@ s32 cx88_dsp_detect_stereo_sap(struct cx88_core *core)
kfree(samples);
- if (UNSET != ret)
+ if (ret != UNSET)
dprintk(1, "stereo/sap detection result:%s%s%s\n",
- (ret & V4L2_TUNER_SUB_MONO) ? " mono" : "",
- (ret & V4L2_TUNER_SUB_STEREO) ? " stereo" : "",
- (ret & V4L2_TUNER_SUB_LANG2) ? " dual" : "");
+ (ret & V4L2_TUNER_SUB_MONO) ? " mono" : "",
+ (ret & V4L2_TUNER_SUB_STEREO) ? " stereo" : "",
+ (ret & V4L2_TUNER_SUB_LANG2) ? " dual" : "");
return ret;
}
diff --git a/drivers/media/pci/cx88/cx88-dvb.c b/drivers/media/pci/cx88/cx88-dvb.c
index ac2392d8887a..ddf90678df34 100644
--- a/drivers/media/pci/cx88/cx88-dvb.c
+++ b/drivers/media/pci/cx88/cx88-dvb.c
@@ -1,5 +1,4 @@
/*
- *
* device driver for Conexant 2388x based TV cards
* MPEG Transport Stream (DVB) routines
*
@@ -15,12 +14,11 @@
* 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 "cx88.h"
+#include "dvb-pll.h"
+
#include <linux/module.h>
#include <linux/init.h>
#include <linux/device.h>
@@ -29,8 +27,6 @@
#include <linux/file.h>
#include <linux/suspend.h>
-#include "cx88.h"
-#include "dvb-pll.h"
#include <media/v4l2-common.h>
#include "mt352.h"
@@ -69,7 +65,7 @@ MODULE_VERSION(CX88_VERSION);
static unsigned int debug;
module_param(debug, int, 0644);
-MODULE_PARM_DESC(debug,"enable debug messages [dvb]");
+MODULE_PARM_DESC(debug, "enable debug messages [dvb]");
static unsigned int dvb_buf_tscnt = 32;
module_param(dvb_buf_tscnt, int, 0644);
@@ -77,14 +73,17 @@ MODULE_PARM_DESC(dvb_buf_tscnt, "DVB Buffer TS count [dvb]");
DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
-#define dprintk(level,fmt, arg...) if (debug >= level) \
- printk(KERN_DEBUG "%s/2-dvb: " fmt, core->name, ## arg)
+#define dprintk(level, fmt, arg...) do { \
+ if (debug >= level) \
+ printk(KERN_DEBUG pr_fmt("%s: dvb:" fmt), \
+ __func__, ##arg); \
+} while (0)
/* ------------------------------------------------------------------ */
static int queue_setup(struct vb2_queue *q,
- unsigned int *num_buffers, unsigned int *num_planes,
- unsigned int sizes[], struct device *alloc_devs[])
+ unsigned int *num_buffers, unsigned int *num_planes,
+ unsigned int sizes[], struct device *alloc_devs[])
{
struct cx8802_dev *dev = q->drv_priv;
@@ -169,23 +168,23 @@ static const struct vb2_ops dvb_qops = {
/* ------------------------------------------------------------------ */
-static int cx88_dvb_bus_ctrl(struct dvb_frontend* fe, int acquire)
+static int cx88_dvb_bus_ctrl(struct dvb_frontend *fe, int acquire)
{
- struct cx8802_dev *dev= fe->dvb->priv;
+ struct cx8802_dev *dev = fe->dvb->priv;
struct cx8802_driver *drv = NULL;
int ret = 0;
int fe_id;
fe_id = vb2_dvb_find_frontend(&dev->frontends, fe);
if (!fe_id) {
- printk(KERN_ERR "%s() No frontend found\n", __func__);
+ pr_err("%s() No frontend found\n", __func__);
return -EINVAL;
}
mutex_lock(&dev->core->lock);
drv = cx8802_get_driver(dev, CX88_MPEG_DVB);
if (drv) {
- if (acquire){
+ if (acquire) {
dev->frontends.active_fe_id = fe_id;
ret = drv->request_acquire(drv);
} else {
@@ -222,13 +221,13 @@ static void cx88_dvb_gate_ctrl(struct cx88_core *core, int open)
/* ------------------------------------------------------------------ */
-static int dvico_fusionhdtv_demod_init(struct dvb_frontend* fe)
+static int dvico_fusionhdtv_demod_init(struct dvb_frontend *fe)
{
- static const u8 clock_config [] = { CLOCK_CTL, 0x38, 0x39 };
- static const u8 reset [] = { RESET, 0x80 };
- static const u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 };
- static const u8 agc_cfg [] = { AGC_TARGET, 0x24, 0x20 };
- static const u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 };
+ static const u8 clock_config[] = { CLOCK_CTL, 0x38, 0x39 };
+ static const u8 reset[] = { RESET, 0x80 };
+ static const u8 adc_ctl_1_cfg[] = { ADC_CTL_1, 0x40 };
+ static const u8 agc_cfg[] = { AGC_TARGET, 0x24, 0x20 };
+ static const u8 gpp_ctl_cfg[] = { GPP_CTL, 0x33 };
static const u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 };
mt352_write(fe, clock_config, sizeof(clock_config));
@@ -244,11 +243,11 @@ static int dvico_fusionhdtv_demod_init(struct dvb_frontend* fe)
static int dvico_dual_demod_init(struct dvb_frontend *fe)
{
- static const u8 clock_config [] = { CLOCK_CTL, 0x38, 0x38 };
- static const u8 reset [] = { RESET, 0x80 };
- static const u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 };
- static const u8 agc_cfg [] = { AGC_TARGET, 0x28, 0x20 };
- static const u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 };
+ static const u8 clock_config[] = { CLOCK_CTL, 0x38, 0x38 };
+ static const u8 reset[] = { RESET, 0x80 };
+ static const u8 adc_ctl_1_cfg[] = { ADC_CTL_1, 0x40 };
+ static const u8 agc_cfg[] = { AGC_TARGET, 0x28, 0x20 };
+ static const u8 gpp_ctl_cfg[] = { GPP_CTL, 0x33 };
static const u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 };
mt352_write(fe, clock_config, sizeof(clock_config));
@@ -263,12 +262,12 @@ static int dvico_dual_demod_init(struct dvb_frontend *fe)
return 0;
}
-static int dntv_live_dvbt_demod_init(struct dvb_frontend* fe)
+static int dntv_live_dvbt_demod_init(struct dvb_frontend *fe)
{
- static const u8 clock_config [] = { 0x89, 0x38, 0x39 };
- static const u8 reset [] = { 0x50, 0x80 };
- static const u8 adc_ctl_1_cfg [] = { 0x8E, 0x40 };
- static const u8 agc_cfg [] = { 0x67, 0x10, 0x23, 0x00, 0xFF, 0xFF,
+ static const u8 clock_config[] = { 0x89, 0x38, 0x39 };
+ static const u8 reset[] = { 0x50, 0x80 };
+ static const u8 adc_ctl_1_cfg[] = { 0x8E, 0x40 };
+ static const u8 agc_cfg[] = { 0x67, 0x10, 0x23, 0x00, 0xFF, 0xFF,
0x00, 0xFF, 0x00, 0x40, 0x40 };
static const u8 dntv_extra[] = { 0xB5, 0x7A };
static const u8 capt_range_cfg[] = { 0x75, 0x32 };
@@ -312,12 +311,12 @@ static struct mb86a16_config twinhan_vp1027 = {
};
#if IS_ENABLED(CONFIG_VIDEO_CX88_VP3054)
-static int dntv_live_dvbt_pro_demod_init(struct dvb_frontend* fe)
+static int dntv_live_dvbt_pro_demod_init(struct dvb_frontend *fe)
{
- static const u8 clock_config [] = { 0x89, 0x38, 0x38 };
- static const u8 reset [] = { 0x50, 0x80 };
- static const u8 adc_ctl_1_cfg [] = { 0x8E, 0x40 };
- static const u8 agc_cfg [] = { 0x67, 0x10, 0x20, 0x00, 0xFF, 0xFF,
+ static const u8 clock_config[] = { 0x89, 0x38, 0x38 };
+ static const u8 reset[] = { 0x50, 0x80 };
+ static const u8 adc_ctl_1_cfg[] = { 0x8E, 0x40 };
+ static const u8 agc_cfg[] = { 0x67, 0x10, 0x20, 0x00, 0xFF, 0xFF,
0x00, 0xFF, 0x00, 0x40, 0x40 };
static const u8 dntv_extra[] = { 0xB5, 0x7A };
static const u8 capt_range_cfg[] = { 0x75, 0x32 };
@@ -374,9 +373,10 @@ static const struct cx22702_config hauppauge_hvr_config = {
.output_mode = CX22702_SERIAL_OUTPUT,
};
-static int or51132_set_ts_param(struct dvb_frontend* fe, int is_punctured)
+static int or51132_set_ts_param(struct dvb_frontend *fe, int is_punctured)
{
- struct cx8802_dev *dev= fe->dvb->priv;
+ struct cx8802_dev *dev = fe->dvb->priv;
+
dev->ts_gen_cntrl = is_punctured ? 0x04 : 0x00;
return 0;
}
@@ -386,9 +386,9 @@ static const struct or51132_config pchdtv_hd3000 = {
.set_ts_params = or51132_set_ts_param,
};
-static int lgdt330x_pll_rf_set(struct dvb_frontend* fe, int index)
+static int lgdt330x_pll_rf_set(struct dvb_frontend *fe, int index)
{
- struct cx8802_dev *dev= fe->dvb->priv;
+ struct cx8802_dev *dev = fe->dvb->priv;
struct cx88_core *core = dev->core;
dprintk(1, "%s: index = %d\n", __func__, index);
@@ -399,9 +399,10 @@ static int lgdt330x_pll_rf_set(struct dvb_frontend* fe, int index)
return 0;
}
-static int lgdt330x_set_ts_param(struct dvb_frontend* fe, int is_punctured)
+static int lgdt330x_set_ts_param(struct dvb_frontend *fe, int is_punctured)
{
- struct cx8802_dev *dev= fe->dvb->priv;
+ struct cx8802_dev *dev = fe->dvb->priv;
+
if (is_punctured)
dev->ts_gen_cntrl |= 0x04;
else
@@ -430,9 +431,10 @@ static const struct lgdt330x_config pchdtv_hd5500 = {
.set_ts_params = lgdt330x_set_ts_param,
};
-static int nxt200x_set_ts_param(struct dvb_frontend* fe, int is_punctured)
+static int nxt200x_set_ts_param(struct dvb_frontend *fe, int is_punctured)
{
- struct cx8802_dev *dev= fe->dvb->priv;
+ struct cx8802_dev *dev = fe->dvb->priv;
+
dev->ts_gen_cntrl = is_punctured ? 0x04 : 0x00;
return 0;
}
@@ -442,18 +444,19 @@ static const struct nxt200x_config ati_hdtvwonder = {
.set_ts_params = nxt200x_set_ts_param,
};
-static int cx24123_set_ts_param(struct dvb_frontend* fe,
- int is_punctured)
+static int cx24123_set_ts_param(struct dvb_frontend *fe,
+ int is_punctured)
{
- struct cx8802_dev *dev= fe->dvb->priv;
+ struct cx8802_dev *dev = fe->dvb->priv;
+
dev->ts_gen_cntrl = 0x02;
return 0;
}
-static int kworld_dvbs_100_set_voltage(struct dvb_frontend* fe,
+static int kworld_dvbs_100_set_voltage(struct dvb_frontend *fe,
enum fe_sec_voltage voltage)
{
- struct cx8802_dev *dev= fe->dvb->priv;
+ struct cx8802_dev *dev = fe->dvb->priv;
struct cx88_core *core = dev->core;
if (voltage == SEC_VOLTAGE_OFF)
@@ -469,11 +472,11 @@ static int kworld_dvbs_100_set_voltage(struct dvb_frontend* fe,
static int geniatech_dvbs_set_voltage(struct dvb_frontend *fe,
enum fe_sec_voltage voltage)
{
- struct cx8802_dev *dev= fe->dvb->priv;
+ struct cx8802_dev *dev = fe->dvb->priv;
struct cx88_core *core = dev->core;
if (voltage == SEC_VOLTAGE_OFF) {
- dprintk(1,"LNB Voltage OFF\n");
+ dprintk(1, "LNB Voltage OFF\n");
cx_write(MO_GP0_IO, 0x0000efff);
}
@@ -485,7 +488,7 @@ static int geniatech_dvbs_set_voltage(struct dvb_frontend *fe,
static int tevii_dvbs_set_voltage(struct dvb_frontend *fe,
enum fe_sec_voltage voltage)
{
- struct cx8802_dev *dev= fe->dvb->priv;
+ struct cx8802_dev *dev = fe->dvb->priv;
struct cx88_core *core = dev->core;
cx_set(MO_GP0_IO, 0x6040);
@@ -625,9 +628,7 @@ static int attach_xc3028(u8 addr, struct cx8802_dev *dev)
return -EINVAL;
if (!fe0->dvb.frontend) {
- printk(KERN_ERR "%s/2: dvb frontend not attached. "
- "Can't attach xc3028\n",
- dev->core->name);
+ pr_err("dvb frontend not attached. Can't attach xc3028\n");
return -EINVAL;
}
@@ -640,16 +641,14 @@ static int attach_xc3028(u8 addr, struct cx8802_dev *dev)
fe = dvb_attach(xc2028_attach, fe0->dvb.frontend, &cfg);
if (!fe) {
- printk(KERN_ERR "%s/2: xc3028 attach failed\n",
- dev->core->name);
+ pr_err("xc3028 attach failed\n");
dvb_frontend_detach(fe0->dvb.frontend);
dvb_unregister_frontend(fe0->dvb.frontend);
fe0->dvb.frontend = NULL;
return -EINVAL;
}
- printk(KERN_INFO "%s/2: xc3028 attached\n",
- dev->core->name);
+ pr_info("xc3028 attached\n");
return 0;
}
@@ -665,41 +664,40 @@ static int attach_xc4000(struct cx8802_dev *dev, struct xc4000_config *cfg)
return -EINVAL;
if (!fe0->dvb.frontend) {
- printk(KERN_ERR "%s/2: dvb frontend not attached. "
- "Can't attach xc4000\n",
- dev->core->name);
+ pr_err("dvb frontend not attached. Can't attach xc4000\n");
return -EINVAL;
}
fe = dvb_attach(xc4000_attach, fe0->dvb.frontend, &dev->core->i2c_adap,
cfg);
if (!fe) {
- printk(KERN_ERR "%s/2: xc4000 attach failed\n",
- dev->core->name);
+ pr_err("xc4000 attach failed\n");
dvb_frontend_detach(fe0->dvb.frontend);
dvb_unregister_frontend(fe0->dvb.frontend);
fe0->dvb.frontend = NULL;
return -EINVAL;
}
- printk(KERN_INFO "%s/2: xc4000 attached\n", dev->core->name);
+ pr_info("xc4000 attached\n");
return 0;
}
static int cx24116_set_ts_param(struct dvb_frontend *fe,
- int is_punctured)
+ int is_punctured)
{
struct cx8802_dev *dev = fe->dvb->priv;
+
dev->ts_gen_cntrl = 0x2;
return 0;
}
static int stv0900_set_ts_param(struct dvb_frontend *fe,
- int is_punctured)
+ int is_punctured)
{
struct cx8802_dev *dev = fe->dvb->priv;
+
dev->ts_gen_cntrl = 0;
return 0;
@@ -713,10 +711,10 @@ static int cx24116_reset_device(struct dvb_frontend *fe)
/* Reset the part */
/* Put the cx24116 into reset */
cx_write(MO_SRST_IO, 0);
- msleep(10);
+ usleep_range(10000, 20000);
/* Take the cx24116 out of reset */
cx_write(MO_SRST_IO, 1);
- msleep(10);
+ usleep_range(10000, 20000);
return 0;
}
@@ -734,9 +732,10 @@ static const struct cx24116_config tevii_s460_config = {
};
static int ds3000_set_ts_param(struct dvb_frontend *fe,
- int is_punctured)
+ int is_punctured)
{
struct cx8802_dev *dev = fe->dvb->priv;
+
dev->ts_gen_cntrl = 4;
return 0;
@@ -800,12 +799,12 @@ static int cx8802_alloc_frontends(struct cx8802_dev *dev)
if (!core->board.num_frontends)
return -ENODEV;
- printk(KERN_INFO "%s() allocating %d frontend(s)\n", __func__,
- core->board.num_frontends);
+ pr_info("%s: allocating %d frontend(s)\n", __func__,
+ core->board.num_frontends);
for (i = 1; i <= core->board.num_frontends; i++) {
fe = vb2_dvb_alloc_frontend(&dev->frontends, i);
if (!fe) {
- printk(KERN_ERR "%s() failed to alloc\n", __func__);
+ pr_err("%s() failed to alloc\n", __func__);
vb2_dvb_dealloc_frontends(&dev->frontends);
return -ENOMEM;
}
@@ -813,8 +812,6 @@ static int cx8802_alloc_frontends(struct cx8802_dev *dev)
return 0;
}
-
-
static const u8 samsung_smt_7020_inittab[] = {
0x01, 0x15,
0x02, 0x00,
@@ -866,7 +863,6 @@ static const u8 samsung_smt_7020_inittab[] = {
0xff, 0xff,
};
-
static int samsung_smt_7020_tuner_set_params(struct dvb_frontend *fe)
{
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
@@ -899,7 +895,7 @@ static int samsung_smt_7020_tuner_set_params(struct dvb_frontend *fe)
}
static int samsung_smt_7020_set_tone(struct dvb_frontend *fe,
- enum fe_sec_tone_mode tone)
+ enum fe_sec_tone_mode tone)
{
struct cx8802_dev *dev = fe->dvb->priv;
struct cx88_core *core = dev->core;
@@ -954,7 +950,7 @@ static int samsung_smt_7020_set_voltage(struct dvb_frontend *fe,
}
static int samsung_smt_7020_stv0299_set_symbol_rate(struct dvb_frontend *fe,
- u32 srate, u32 ratio)
+ u32 srate, u32 ratio)
{
u8 aclk = 0;
u8 bclk = 0;
@@ -988,7 +984,6 @@ static int samsung_smt_7020_stv0299_set_symbol_rate(struct dvb_frontend *fe,
return 0;
}
-
static const struct stv0299_config samsung_stv0299_config = {
.demod_address = 0x68,
.inittab = samsung_smt_7020_inittab,
@@ -1008,8 +1003,8 @@ static int dvb_register(struct cx8802_dev *dev)
int mfe_shared = 0; /* bus not shared by default */
int res = -EINVAL;
- if (0 != core->i2c_rc) {
- printk(KERN_ERR "%s/2: no i2c-bus available, cannot attach dvb drivers\n", core->name);
+ if (core->i2c_rc != 0) {
+ pr_err("no i2c-bus available, cannot attach dvb drivers\n");
goto frontend_detach;
}
@@ -1030,7 +1025,7 @@ static int dvb_register(struct cx8802_dev *dev)
fe0->dvb.frontend = dvb_attach(cx22702_attach,
&connexant_refboard_config,
&core->i2c_adap);
- if (fe0->dvb.frontend != NULL) {
+ if (fe0->dvb.frontend) {
if (!dvb_attach(dvb_pll_attach, fe0->dvb.frontend,
0x61, &core->i2c_adap,
DVB_PLL_THOMSON_DTT759X))
@@ -1044,7 +1039,7 @@ static int dvb_register(struct cx8802_dev *dev)
fe0->dvb.frontend = dvb_attach(cx22702_attach,
&connexant_refboard_config,
&core->i2c_adap);
- if (fe0->dvb.frontend != NULL) {
+ if (fe0->dvb.frontend) {
if (!dvb_attach(dvb_pll_attach, fe0->dvb.frontend,
0x60, &core->i2c_adap,
DVB_PLL_THOMSON_DTT7579))
@@ -1058,10 +1053,10 @@ static int dvb_register(struct cx8802_dev *dev)
fe0->dvb.frontend = dvb_attach(cx22702_attach,
&hauppauge_hvr_config,
&core->i2c_adap);
- if (fe0->dvb.frontend != NULL) {
+ if (fe0->dvb.frontend) {
if (!dvb_attach(simple_tuner_attach, fe0->dvb.frontend,
- &core->i2c_adap, 0x61,
- TUNER_PHILIPS_FMD1216ME_MK3))
+ &core->i2c_adap, 0x61,
+ TUNER_PHILIPS_FMD1216ME_MK3))
goto frontend_detach;
}
break;
@@ -1069,10 +1064,10 @@ static int dvb_register(struct cx8802_dev *dev)
fe0->dvb.frontend = dvb_attach(cx22702_attach,
&hauppauge_hvr_config,
&core->i2c_adap);
- if (fe0->dvb.frontend != NULL) {
+ if (fe0->dvb.frontend) {
if (!dvb_attach(simple_tuner_attach, fe0->dvb.frontend,
- &core->i2c_adap, 0x61,
- TUNER_PHILIPS_FMD1216MEX_MK3))
+ &core->i2c_adap, 0x61,
+ TUNER_PHILIPS_FMD1216MEX_MK3))
goto frontend_detach;
}
break;
@@ -1082,8 +1077,8 @@ static int dvb_register(struct cx8802_dev *dev)
dev->frontends.gate = 2;
/* DVB-S init */
fe0->dvb.frontend = dvb_attach(cx24123_attach,
- &hauppauge_novas_config,
- &dev->core->i2c_adap);
+ &hauppauge_novas_config,
+ &dev->core->i2c_adap);
if (fe0->dvb.frontend) {
if (!dvb_attach(isl6421_attach,
fe0->dvb.frontend,
@@ -1097,8 +1092,8 @@ static int dvb_register(struct cx8802_dev *dev)
goto frontend_detach;
/* DVB-T init */
fe1->dvb.frontend = dvb_attach(cx22702_attach,
- &hauppauge_hvr_config,
- &dev->core->i2c_adap);
+ &hauppauge_hvr_config,
+ &dev->core->i2c_adap);
if (fe1->dvb.frontend) {
fe1->dvb.frontend->id = 1;
if (!dvb_attach(simple_tuner_attach,
@@ -1112,7 +1107,7 @@ static int dvb_register(struct cx8802_dev *dev)
fe0->dvb.frontend = dvb_attach(mt352_attach,
&dvico_fusionhdtv,
&core->i2c_adap);
- if (fe0->dvb.frontend != NULL) {
+ if (fe0->dvb.frontend) {
if (!dvb_attach(dvb_pll_attach, fe0->dvb.frontend,
0x60, NULL, DVB_PLL_THOMSON_DTT7579))
goto frontend_detach;
@@ -1122,19 +1117,21 @@ static int dvb_register(struct cx8802_dev *dev)
fe0->dvb.frontend = dvb_attach(zl10353_attach,
&dvico_fusionhdtv_plus_v1_1,
&core->i2c_adap);
- if (fe0->dvb.frontend != NULL) {
+ if (fe0->dvb.frontend) {
if (!dvb_attach(dvb_pll_attach, fe0->dvb.frontend,
0x60, NULL, DVB_PLL_THOMSON_DTT7579))
goto frontend_detach;
}
break;
case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL:
- /* The tin box says DEE1601, but it seems to be DTT7579
- * compatible, with a slightly different MT352 AGC gain. */
+ /*
+ * The tin box says DEE1601, but it seems to be DTT7579
+ * compatible, with a slightly different MT352 AGC gain.
+ */
fe0->dvb.frontend = dvb_attach(mt352_attach,
&dvico_fusionhdtv_dual,
&core->i2c_adap);
- if (fe0->dvb.frontend != NULL) {
+ if (fe0->dvb.frontend) {
if (!dvb_attach(dvb_pll_attach, fe0->dvb.frontend,
0x61, NULL, DVB_PLL_THOMSON_DTT7579))
goto frontend_detach;
@@ -1144,7 +1141,7 @@ static int dvb_register(struct cx8802_dev *dev)
fe0->dvb.frontend = dvb_attach(zl10353_attach,
&dvico_fusionhdtv_plus_v1_1,
&core->i2c_adap);
- if (fe0->dvb.frontend != NULL) {
+ if (fe0->dvb.frontend) {
if (!dvb_attach(dvb_pll_attach, fe0->dvb.frontend,
0x61, NULL, DVB_PLL_THOMSON_DTT7579))
goto frontend_detach;
@@ -1154,7 +1151,7 @@ static int dvb_register(struct cx8802_dev *dev)
fe0->dvb.frontend = dvb_attach(mt352_attach,
&dvico_fusionhdtv,
&core->i2c_adap);
- if (fe0->dvb.frontend != NULL) {
+ if (fe0->dvb.frontend) {
if (!dvb_attach(dvb_pll_attach, fe0->dvb.frontend,
0x61, NULL, DVB_PLL_LG_Z201))
goto frontend_detach;
@@ -1166,7 +1163,7 @@ static int dvb_register(struct cx8802_dev *dev)
fe0->dvb.frontend = dvb_attach(mt352_attach,
&dntv_live_dvbt_config,
&core->i2c_adap);
- if (fe0->dvb.frontend != NULL) {
+ if (fe0->dvb.frontend) {
if (!dvb_attach(dvb_pll_attach, fe0->dvb.frontend,
0x61, NULL, DVB_PLL_UNKNOWN_1))
goto frontend_detach;
@@ -1175,27 +1172,27 @@ static int dvb_register(struct cx8802_dev *dev)
case CX88_BOARD_DNTV_LIVE_DVB_T_PRO:
#if IS_ENABLED(CONFIG_VIDEO_CX88_VP3054)
/* MT352 is on a secondary I2C bus made from some GPIO lines */
- fe0->dvb.frontend = dvb_attach(mt352_attach, &dntv_live_dvbt_pro_config,
+ fe0->dvb.frontend = dvb_attach(mt352_attach,
+ &dntv_live_dvbt_pro_config,
&dev->vp3054->adap);
- if (fe0->dvb.frontend != NULL) {
+ if (fe0->dvb.frontend) {
if (!dvb_attach(simple_tuner_attach, fe0->dvb.frontend,
&core->i2c_adap, 0x61,
TUNER_PHILIPS_FMD1216ME_MK3))
goto frontend_detach;
}
#else
- printk(KERN_ERR "%s/2: built without vp3054 support\n",
- core->name);
+ pr_err("built without vp3054 support\n");
#endif
break;
case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID:
fe0->dvb.frontend = dvb_attach(zl10353_attach,
&dvico_fusionhdtv_hybrid,
&core->i2c_adap);
- if (fe0->dvb.frontend != NULL) {
+ if (fe0->dvb.frontend) {
if (!dvb_attach(simple_tuner_attach, fe0->dvb.frontend,
- &core->i2c_adap, 0x61,
- TUNER_THOMSON_FE6600))
+ &core->i2c_adap, 0x61,
+ TUNER_THOMSON_FE6600))
goto frontend_detach;
}
break;
@@ -1203,7 +1200,7 @@ static int dvb_register(struct cx8802_dev *dev)
fe0->dvb.frontend = dvb_attach(zl10353_attach,
&dvico_fusionhdtv_xc3028,
&core->i2c_adap);
- if (fe0->dvb.frontend == NULL)
+ if (!fe0->dvb.frontend)
fe0->dvb.frontend = dvb_attach(mt352_attach,
&dvico_fusionhdtv_mt352_xc3028,
&core->i2c_adap);
@@ -1220,7 +1217,7 @@ static int dvb_register(struct cx8802_dev *dev)
case CX88_BOARD_PCHDTV_HD3000:
fe0->dvb.frontend = dvb_attach(or51132_attach, &pchdtv_hd3000,
&core->i2c_adap);
- if (fe0->dvb.frontend != NULL) {
+ if (fe0->dvb.frontend) {
if (!dvb_attach(simple_tuner_attach, fe0->dvb.frontend,
&core->i2c_adap, 0x61,
TUNER_THOMSON_DTT761X))
@@ -1241,7 +1238,7 @@ static int dvb_register(struct cx8802_dev *dev)
fe0->dvb.frontend = dvb_attach(lgdt330x_attach,
&fusionhdtv_3_gold,
&core->i2c_adap);
- if (fe0->dvb.frontend != NULL) {
+ if (fe0->dvb.frontend) {
if (!dvb_attach(simple_tuner_attach, fe0->dvb.frontend,
&core->i2c_adap, 0x61,
TUNER_MICROTUNE_4042FI5))
@@ -1259,7 +1256,7 @@ static int dvb_register(struct cx8802_dev *dev)
fe0->dvb.frontend = dvb_attach(lgdt330x_attach,
&fusionhdtv_3_gold,
&core->i2c_adap);
- if (fe0->dvb.frontend != NULL) {
+ if (fe0->dvb.frontend) {
if (!dvb_attach(simple_tuner_attach, fe0->dvb.frontend,
&core->i2c_adap, 0x61,
TUNER_THOMSON_DTT761X))
@@ -1277,13 +1274,13 @@ static int dvb_register(struct cx8802_dev *dev)
fe0->dvb.frontend = dvb_attach(lgdt330x_attach,
&fusionhdtv_5_gold,
&core->i2c_adap);
- if (fe0->dvb.frontend != NULL) {
+ if (fe0->dvb.frontend) {
if (!dvb_attach(simple_tuner_attach, fe0->dvb.frontend,
&core->i2c_adap, 0x61,
TUNER_LG_TDVS_H06XF))
goto frontend_detach;
if (!dvb_attach(tda9887_attach, fe0->dvb.frontend,
- &core->i2c_adap, 0x43))
+ &core->i2c_adap, 0x43))
goto frontend_detach;
}
break;
@@ -1298,13 +1295,13 @@ static int dvb_register(struct cx8802_dev *dev)
fe0->dvb.frontend = dvb_attach(lgdt330x_attach,
&pchdtv_hd5500,
&core->i2c_adap);
- if (fe0->dvb.frontend != NULL) {
+ if (fe0->dvb.frontend) {
if (!dvb_attach(simple_tuner_attach, fe0->dvb.frontend,
&core->i2c_adap, 0x61,
TUNER_LG_TDVS_H06XF))
goto frontend_detach;
if (!dvb_attach(tda9887_attach, fe0->dvb.frontend,
- &core->i2c_adap, 0x43))
+ &core->i2c_adap, 0x43))
goto frontend_detach;
}
break;
@@ -1312,7 +1309,7 @@ static int dvb_register(struct cx8802_dev *dev)
fe0->dvb.frontend = dvb_attach(nxt200x_attach,
&ati_hdtvwonder,
&core->i2c_adap);
- if (fe0->dvb.frontend != NULL) {
+ if (fe0->dvb.frontend) {
if (!dvb_attach(simple_tuner_attach, fe0->dvb.frontend,
&core->i2c_adap, 0x61,
TUNER_PHILIPS_TUV1236D))
@@ -1333,8 +1330,8 @@ static int dvb_register(struct cx8802_dev *dev)
override_tone = false;
if (!dvb_attach(isl6421_attach, fe0->dvb.frontend,
- &core->i2c_adap, 0x08, ISL6421_DCL, 0x00,
- override_tone))
+ &core->i2c_adap, 0x08, ISL6421_DCL,
+ 0x00, override_tone))
goto frontend_detach;
}
break;
@@ -1360,7 +1357,7 @@ static int dvb_register(struct cx8802_dev *dev)
fe0->dvb.frontend = dvb_attach(s5h1409_attach,
&pinnacle_pctv_hd_800i_config,
&core->i2c_adap);
- if (fe0->dvb.frontend != NULL) {
+ if (fe0->dvb.frontend) {
if (!dvb_attach(xc5000_attach, fe0->dvb.frontend,
&core->i2c_adap,
&pinnacle_pctv_hd_800i_tuner_config))
@@ -1369,9 +1366,9 @@ static int dvb_register(struct cx8802_dev *dev)
break;
case CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO:
fe0->dvb.frontend = dvb_attach(s5h1409_attach,
- &dvico_hdtv5_pci_nano_config,
- &core->i2c_adap);
- if (fe0->dvb.frontend != NULL) {
+ &dvico_hdtv5_pci_nano_config,
+ &core->i2c_adap);
+ if (fe0->dvb.frontend) {
struct dvb_frontend *fe;
struct xc2028_config cfg = {
.i2c_adap = &core->i2c_adap,
@@ -1385,7 +1382,7 @@ static int dvb_register(struct cx8802_dev *dev)
fe = dvb_attach(xc2028_attach,
fe0->dvb.frontend, &cfg);
- if (fe != NULL && fe->ops.tuner_ops.set_config != NULL)
+ if (fe && fe->ops.tuner_ops.set_config)
fe->ops.tuner_ops.set_config(fe, &ctl);
}
break;
@@ -1427,7 +1424,7 @@ static int dvb_register(struct cx8802_dev *dev)
if (attach_xc3028(0x61, dev) < 0)
goto frontend_detach;
break;
- case CX88_BOARD_KWORLD_ATSC_120:
+ case CX88_BOARD_KWORLD_ATSC_120:
fe0->dvb.frontend = dvb_attach(s5h1409_attach,
&kworld_atsc_120_config,
&core->i2c_adap);
@@ -1438,7 +1435,7 @@ static int dvb_register(struct cx8802_dev *dev)
fe0->dvb.frontend = dvb_attach(s5h1411_attach,
&dvico_fusionhdtv7_config,
&core->i2c_adap);
- if (fe0->dvb.frontend != NULL) {
+ if (fe0->dvb.frontend) {
if (!dvb_attach(xc5000_attach, fe0->dvb.frontend,
&core->i2c_adap,
&dvico_fusionhdtv7_tuner_config))
@@ -1451,8 +1448,8 @@ static int dvb_register(struct cx8802_dev *dev)
dev->frontends.gate = 2;
/* DVB-S/S2 Init */
fe0->dvb.frontend = dvb_attach(cx24116_attach,
- &hauppauge_hvr4000_config,
- &dev->core->i2c_adap);
+ &hauppauge_hvr4000_config,
+ &dev->core->i2c_adap);
if (fe0->dvb.frontend) {
if (!dvb_attach(isl6421_attach,
fe0->dvb.frontend,
@@ -1466,8 +1463,8 @@ static int dvb_register(struct cx8802_dev *dev)
goto frontend_detach;
/* DVB-T Init */
fe1->dvb.frontend = dvb_attach(cx22702_attach,
- &hauppauge_hvr_config,
- &dev->core->i2c_adap);
+ &hauppauge_hvr_config,
+ &dev->core->i2c_adap);
if (fe1->dvb.frontend) {
fe1->dvb.frontend->id = 1;
if (!dvb_attach(simple_tuner_attach,
@@ -1479,8 +1476,8 @@ static int dvb_register(struct cx8802_dev *dev)
break;
case CX88_BOARD_HAUPPAUGE_HVR4000LITE:
fe0->dvb.frontend = dvb_attach(cx24116_attach,
- &hauppauge_hvr4000_config,
- &dev->core->i2c_adap);
+ &hauppauge_hvr4000_config,
+ &dev->core->i2c_adap);
if (fe0->dvb.frontend) {
if (!dvb_attach(isl6421_attach,
fe0->dvb.frontend,
@@ -1495,7 +1492,7 @@ static int dvb_register(struct cx8802_dev *dev)
fe0->dvb.frontend = dvb_attach(stv0299_attach,
&tevii_tuner_sharp_config,
&core->i2c_adap);
- if (fe0->dvb.frontend != NULL) {
+ if (fe0->dvb.frontend) {
if (!dvb_attach(dvb_pll_attach, fe0->dvb.frontend, 0x60,
&core->i2c_adap, DVB_PLL_OPERA1))
goto frontend_detach;
@@ -1506,8 +1503,9 @@ static int dvb_register(struct cx8802_dev *dev)
fe0->dvb.frontend = dvb_attach(stv0288_attach,
&tevii_tuner_earda_config,
&core->i2c_adap);
- if (fe0->dvb.frontend != NULL) {
- if (!dvb_attach(stb6000_attach, fe0->dvb.frontend, 0x61,
+ if (fe0->dvb.frontend) {
+ if (!dvb_attach(stb6000_attach,
+ fe0->dvb.frontend, 0x61,
&core->i2c_adap))
goto frontend_detach;
core->prev_set_voltage = fe0->dvb.frontend->ops.set_voltage;
@@ -1519,16 +1517,16 @@ static int dvb_register(struct cx8802_dev *dev)
fe0->dvb.frontend = dvb_attach(cx24116_attach,
&tevii_s460_config,
&core->i2c_adap);
- if (fe0->dvb.frontend != NULL)
+ if (fe0->dvb.frontend)
fe0->dvb.frontend->ops.set_voltage = tevii_dvbs_set_voltage;
break;
case CX88_BOARD_TEVII_S464:
fe0->dvb.frontend = dvb_attach(ds3000_attach,
&tevii_ds3000_config,
&core->i2c_adap);
- if (fe0->dvb.frontend != NULL) {
+ if (fe0->dvb.frontend) {
dvb_attach(ts2020_attach, fe0->dvb.frontend,
- &tevii_ts2020_config, &core->i2c_adap);
+ &tevii_ts2020_config, &core->i2c_adap);
fe0->dvb.frontend->ops.set_voltage =
tevii_dvbs_set_voltage;
}
@@ -1540,7 +1538,7 @@ static int dvb_register(struct cx8802_dev *dev)
fe0->dvb.frontend = dvb_attach(cx24116_attach,
&hauppauge_hvr4000_config,
&core->i2c_adap);
- if (fe0->dvb.frontend != NULL)
+ if (fe0->dvb.frontend)
fe0->dvb.frontend->ops.set_voltage = tevii_dvbs_set_voltage;
break;
case CX88_BOARD_TERRATEC_CINERGY_HT_PCI_MKII:
@@ -1557,9 +1555,9 @@ static int dvb_register(struct cx8802_dev *dev)
struct dvb_tuner_ops *tuner_ops = NULL;
fe0->dvb.frontend = dvb_attach(stv0900_attach,
- &prof_7301_stv0900_config,
- &core->i2c_adap, 0);
- if (fe0->dvb.frontend != NULL) {
+ &prof_7301_stv0900_config,
+ &core->i2c_adap, 0);
+ if (fe0->dvb.frontend) {
if (!dvb_attach(stb6100_attach, fe0->dvb.frontend,
&prof_7301_stb6100_config,
&core->i2c_adap))
@@ -1589,8 +1587,8 @@ static int dvb_register(struct cx8802_dev *dev)
mdelay(200);
fe0->dvb.frontend = dvb_attach(stv0299_attach,
- &samsung_stv0299_config,
- &dev->core->i2c_adap);
+ &samsung_stv0299_config,
+ &dev->core->i2c_adap);
if (fe0->dvb.frontend) {
fe0->dvb.frontend->ops.tuner_ops.set_params =
samsung_smt_7020_tuner_set_params;
@@ -1606,8 +1604,8 @@ static int dvb_register(struct cx8802_dev *dev)
case CX88_BOARD_TWINHAN_VP1027_DVBS:
dev->ts_gen_cntrl = 0x00;
fe0->dvb.frontend = dvb_attach(mb86a16_attach,
- &twinhan_vp1027,
- &core->i2c_adap);
+ &twinhan_vp1027,
+ &core->i2c_adap);
if (fe0->dvb.frontend) {
core->prev_set_voltage =
fe0->dvb.frontend->ops.set_voltage;
@@ -1617,15 +1615,12 @@ static int dvb_register(struct cx8802_dev *dev)
break;
default:
- printk(KERN_ERR "%s/2: The frontend of your DVB/ATSC card isn't supported yet\n",
- core->name);
+ pr_err("The frontend of your DVB/ATSC card isn't supported yet\n");
break;
}
- if ( (NULL == fe0->dvb.frontend) || (fe1 && NULL == fe1->dvb.frontend) ) {
- printk(KERN_ERR
- "%s/2: frontend initialization failed\n",
- core->name);
+ if ((NULL == fe0->dvb.frontend) || (fe1 && NULL == fe1->dvb.frontend)) {
+ pr_err("frontend initialization failed\n");
goto frontend_detach;
}
/* define general-purpose callback pointer */
@@ -1660,7 +1655,8 @@ static int cx8802_dvb_advise_acquire(struct cx8802_driver *drv)
{
struct cx88_core *core = drv->core;
int err = 0;
- dprintk( 1, "%s\n", __func__);
+
+ dprintk(1, "%s\n", __func__);
switch (core->boardnr) {
case CX88_BOARD_HAUPPAUGE_HVR1300:
@@ -1724,7 +1720,8 @@ static int cx8802_dvb_advise_release(struct cx8802_driver *drv)
{
struct cx88_core *core = drv->core;
int err = 0;
- dprintk( 1, "%s\n", __func__);
+
+ dprintk(1, "%s\n", __func__);
switch (core->boardnr) {
case CX88_BOARD_HAUPPAUGE_HVR1300:
@@ -1747,8 +1744,8 @@ static int cx8802_dvb_probe(struct cx8802_driver *drv)
struct vb2_dvb_frontend *fe;
int i;
- dprintk( 1, "%s\n", __func__);
- dprintk( 1, " ->being probed by Card=%d Name=%s, PCI %02x:%02x\n",
+ dprintk(1, "%s\n", __func__);
+ dprintk(1, " ->being probed by Card=%d Name=%s, PCI %02x:%02x\n",
core->boardnr,
core->name,
core->pci_bus,
@@ -1760,25 +1757,25 @@ static int cx8802_dvb_probe(struct cx8802_driver *drv)
/* If vp3054 isn't enabled, a stub will just return 0 */
err = vp3054_i2c_probe(dev);
- if (0 != err)
+ if (err != 0)
goto fail_core;
/* dvb stuff */
- printk(KERN_INFO "%s/2: cx2388x based DVB/ATSC card\n", core->name);
+ pr_info("cx2388x based DVB/ATSC card\n");
dev->ts_gen_cntrl = 0x0c;
err = cx8802_alloc_frontends(dev);
if (err)
goto fail_core;
- err = -ENODEV;
for (i = 1; i <= core->board.num_frontends; i++) {
struct vb2_queue *q;
fe = vb2_dvb_get_frontend(&core->dvbdev->frontends, i);
- if (fe == NULL) {
- printk(KERN_ERR "%s() failed to get frontend(%d)\n",
- __func__, i);
+ if (!fe) {
+ pr_err("%s() failed to get frontend(%d)\n",
+ __func__, i);
+ err = -ENODEV;
goto fail_probe;
}
q = &fe->dvb.dvbq;
@@ -1805,8 +1802,7 @@ static int cx8802_dvb_probe(struct cx8802_driver *drv)
err = dvb_register(dev);
if (err)
/* frontends/adapter de-allocated in dvb_register */
- printk(KERN_ERR "%s/2: dvb_register failed (err = %d)\n",
- core->name, err);
+ pr_err("dvb_register failed (err = %d)\n", err);
return err;
fail_probe:
vb2_dvb_dealloc_frontends(&core->dvbdev->frontends);
@@ -1819,7 +1815,7 @@ static int cx8802_dvb_remove(struct cx8802_driver *drv)
struct cx88_core *core = drv->core;
struct cx8802_dev *dev = drv->core->dvbdev;
- dprintk( 1, "%s\n", __func__);
+ dprintk(1, "%s\n", __func__);
vb2_dvb_unregister_bus(&dev->frontends);
@@ -1841,8 +1837,7 @@ static struct cx8802_driver cx8802_dvb_driver = {
static int __init dvb_init(void)
{
- printk(KERN_INFO "cx88/2: cx2388x dvb driver version %s loaded\n",
- CX88_VERSION);
+ pr_info("cx2388x dvb driver version %s loaded\n", CX88_VERSION);
return cx8802_register_driver(&cx8802_dvb_driver);
}
diff --git a/drivers/media/pci/cx88/cx88-i2c.c b/drivers/media/pci/cx88/cx88-i2c.c
index cf2d69615838..f7692775fb5a 100644
--- a/drivers/media/pci/cx88/cx88-i2c.c
+++ b/drivers/media/pci/cx88/cx88-i2c.c
@@ -1,55 +1,53 @@
/*
+ *
+ * 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)
+ * (c) 2002 Yurij Sysoev <yurij@naturesoft.net>
+ * (c) 1999-2003 Gerd Knorr <kraxel@bytesex.org>
+ *
+ * (c) 2005 Mauro Carvalho Chehab <mchehab@infradead.org>
+ * - Multituner support and i2c address binding
+ *
+ * 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.
+ */
- 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)
- (c) 2002 Yurij Sysoev <yurij@naturesoft.net>
- (c) 1999-2003 Gerd Knorr <kraxel@bytesex.org>
-
- (c) 2005 Mauro Carvalho Chehab <mchehab@infradead.org>
- - Multituner support and i2c address binding
-
- 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 "cx88.h"
-#include <linux/module.h>
#include <linux/init.h>
+#include <linux/io.h>
+#include <linux/module.h>
-#include <asm/io.h>
-
-#include "cx88.h"
#include <media/v4l2-common.h>
static unsigned int i2c_debug;
module_param(i2c_debug, int, 0644);
-MODULE_PARM_DESC(i2c_debug,"enable debug messages [i2c]");
+MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]");
static unsigned int i2c_scan;
module_param(i2c_scan, int, 0444);
-MODULE_PARM_DESC(i2c_scan,"scan i2c bus at insmod time");
+MODULE_PARM_DESC(i2c_scan, "scan i2c bus at insmod time");
static unsigned int i2c_udelay = 5;
module_param(i2c_udelay, int, 0644);
-MODULE_PARM_DESC(i2c_udelay,"i2c delay at insmod time, in usecs "
- "(should be 5 or higher). Lower value means higher bus speed.");
+MODULE_PARM_DESC(i2c_udelay,
+ "i2c delay at insmod time, in usecs (should be 5 or higher). Lower value means higher bus speed.");
-#define dprintk(level,fmt, arg...) if (i2c_debug >= level) \
- printk(KERN_DEBUG "%s: " fmt, core->name , ## arg)
+#define dprintk(level, fmt, arg...) do { \
+ if (i2c_debug >= level) \
+ printk(KERN_DEBUG pr_fmt("%s: i2c:" fmt), \
+ __func__, ##arg); \
+} while (0)
/* ----------------------------------------------------------------------- */
@@ -109,26 +107,26 @@ static const struct i2c_algo_bit_data cx8800_i2c_algo_template = {
/* ----------------------------------------------------------------------- */
static const char * const i2c_devs[128] = {
- [ 0x1c >> 1 ] = "lgdt330x",
- [ 0x86 >> 1 ] = "tda9887/cx22702",
- [ 0xa0 >> 1 ] = "eeprom",
- [ 0xc0 >> 1 ] = "tuner (analog)",
- [ 0xc2 >> 1 ] = "tuner (analog/dvb)",
- [ 0xc8 >> 1 ] = "xc5000",
+ [0x1c >> 1] = "lgdt330x",
+ [0x86 >> 1] = "tda9887/cx22702",
+ [0xa0 >> 1] = "eeprom",
+ [0xc0 >> 1] = "tuner (analog)",
+ [0xc2 >> 1] = "tuner (analog/dvb)",
+ [0xc8 >> 1] = "xc5000",
};
static void do_i2c_scan(const char *name, struct i2c_client *c)
{
unsigned char buf;
- int i,rc;
+ int i, rc;
for (i = 0; i < ARRAY_SIZE(i2c_devs); i++) {
c->addr = i;
- rc = i2c_master_recv(c,&buf,0);
+ rc = i2c_master_recv(c, &buf, 0);
if (rc < 0)
continue;
- printk("%s: i2c scan: found device @ 0x%x [%s]\n",
- name, i << 1, i2c_devs[i] ? i2c_devs[i] : "???");
+ pr_info("i2c scan: found device @ 0x%x [%s]\n",
+ i << 1, i2c_devs[i] ? i2c_devs[i] : "???");
}
}
@@ -136,14 +134,13 @@ static void do_i2c_scan(const char *name, struct i2c_client *c)
int cx88_i2c_init(struct cx88_core *core, struct pci_dev *pci)
{
/* Prevents usage of invalid delay values */
- if (i2c_udelay<5)
- i2c_udelay=5;
+ if (i2c_udelay < 5)
+ i2c_udelay = 5;
core->i2c_algo = cx8800_i2c_algo_template;
-
core->i2c_adap.dev.parent = &pci->dev;
- strlcpy(core->i2c_adap.name,core->name,sizeof(core->i2c_adap.name));
+ strlcpy(core->i2c_adap.name, core->name, sizeof(core->i2c_adap.name));
core->i2c_adap.owner = THIS_MODULE;
core->i2c_algo.udelay = i2c_udelay;
core->i2c_algo.data = core;
@@ -152,32 +149,35 @@ int cx88_i2c_init(struct cx88_core *core, struct pci_dev *pci)
core->i2c_client.adapter = &core->i2c_adap;
strlcpy(core->i2c_client.name, "cx88xx internal", I2C_NAME_SIZE);
- cx8800_bit_setscl(core,1);
- cx8800_bit_setsda(core,1);
+ cx8800_bit_setscl(core, 1);
+ cx8800_bit_setsda(core, 1);
core->i2c_rc = i2c_bit_add_bus(&core->i2c_adap);
- if (0 == core->i2c_rc) {
- static u8 tuner_data[] =
- { 0x0b, 0xdc, 0x86, 0x52 };
- static struct i2c_msg tuner_msg =
- { .flags = 0, .addr = 0xc2 >> 1, .buf = tuner_data, .len = 4 };
+ if (core->i2c_rc == 0) {
+ static u8 tuner_data[] = {
+ 0x0b, 0xdc, 0x86, 0x52 };
+ static struct i2c_msg tuner_msg = {
+ .flags = 0,
+ .addr = 0xc2 >> 1,
+ .buf = tuner_data,
+ .len = 4
+ };
dprintk(1, "i2c register ok\n");
- switch( core->boardnr ) {
- case CX88_BOARD_HAUPPAUGE_HVR1300:
- case CX88_BOARD_HAUPPAUGE_HVR3000:
- case CX88_BOARD_HAUPPAUGE_HVR4000:
- printk("%s: i2c init: enabling analog demod on HVR1300/3000/4000 tuner\n",
- core->name);
- i2c_transfer(core->i2c_client.adapter, &tuner_msg, 1);
- break;
- default:
- break;
+ switch (core->boardnr) {
+ case CX88_BOARD_HAUPPAUGE_HVR1300:
+ case CX88_BOARD_HAUPPAUGE_HVR3000:
+ case CX88_BOARD_HAUPPAUGE_HVR4000:
+ pr_info("i2c init: enabling analog demod on HVR1300/3000/4000 tuner\n");
+ i2c_transfer(core->i2c_client.adapter, &tuner_msg, 1);
+ break;
+ default:
+ break;
}
if (i2c_scan)
- do_i2c_scan(core->name,&core->i2c_client);
+ do_i2c_scan(core->name, &core->i2c_client);
} else
- printk("%s: i2c register FAILED\n", core->name);
+ pr_err("i2c register FAILED\n");
return core->i2c_rc;
}
diff --git a/drivers/media/pci/cx88/cx88-input.c b/drivers/media/pci/cx88/cx88-input.c
index cd7687183381..dcfea3502e42 100644
--- a/drivers/media/pci/cx88/cx88-input.c
+++ b/drivers/media/pci/cx88/cx88-input.c
@@ -16,19 +16,16 @@
* 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 "cx88.h"
+
#include <linux/init.h>
#include <linux/hrtimer.h>
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/module.h>
-#include "cx88.h"
#include <media/rc-core.h>
#define MODULE_NAME "cx88xx"
@@ -57,7 +54,7 @@ struct cx88_IR {
u32 mask_keyup;
};
-static unsigned ir_samplerate = 4;
+static unsigned int ir_samplerate = 4;
module_param(ir_samplerate, uint, 0444);
MODULE_PARM_DESC(ir_samplerate, "IR samplerate in kHz, 1 - 20, default 4");
@@ -65,11 +62,15 @@ static int ir_debug;
module_param(ir_debug, int, 0644); /* debug level [IR] */
MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]");
-#define ir_dprintk(fmt, arg...) if (ir_debug) \
- printk(KERN_DEBUG "%s IR: " fmt , ir->core->name , ##arg)
+#define ir_dprintk(fmt, arg...) do { \
+ if (ir_debug) \
+ printk(KERN_DEBUG "%s IR: " fmt, ir->core->name, ##arg);\
+} while (0)
-#define dprintk(fmt, arg...) if (ir_debug) \
- printk(KERN_DEBUG "cx88 IR: " fmt , ##arg)
+#define dprintk(fmt, arg...) do { \
+ if (ir_debug) \
+ printk(KERN_DEBUG "cx88 IR: " fmt, ##arg); \
+} while (0)
/* ---------------------------------------------------------------------- */
@@ -82,21 +83,22 @@ static void cx88_ir_handle_key(struct cx88_IR *ir)
gpio = cx_read(ir->gpio_addr);
switch (core->boardnr) {
case CX88_BOARD_NPGTECH_REALTV_TOP10FM:
- /* This board apparently uses a combination of 2 GPIO
- to represent the keys. Additionally, the second GPIO
- can be used for parity.
-
- Example:
-
- for key "5"
- gpio = 0x758, auxgpio = 0xe5 or 0xf5
- for key "Power"
- gpio = 0x758, auxgpio = 0xed or 0xfd
+ /*
+ * This board apparently uses a combination of 2 GPIO
+ * to represent the keys. Additionally, the second GPIO
+ * can be used for parity.
+ *
+ * Example:
+ *
+ * for key "5"
+ * gpio = 0x758, auxgpio = 0xe5 or 0xf5
+ * for key "Power"
+ * gpio = 0x758, auxgpio = 0xed or 0xfd
*/
auxgpio = cx_read(MO_GP1_IO);
/* Take out the parity part */
- gpio=(gpio & 0x7fd) + (auxgpio & 0xef);
+ gpio = (gpio & 0x7fd) + (auxgpio & 0xef);
break;
case CX88_BOARD_WINFAST_DTV1000:
case CX88_BOARD_WINFAST_DTV1800H:
@@ -145,7 +147,7 @@ static void cx88_ir_handle_key(struct cx88_IR *ir)
if (0 == (gpio & ir->mask_keyup))
rc_keydown_notimeout(ir->dev, RC_TYPE_NECX, scancode,
- 0);
+ 0);
else
rc_keyup(ir->dev);
@@ -234,12 +236,14 @@ int cx88_ir_start(struct cx88_core *core)
return 0;
}
+EXPORT_SYMBOL(cx88_ir_start);
void cx88_ir_stop(struct cx88_core *core)
{
if (core->ir->users)
__cx88_ir_stop(core);
}
+EXPORT_SYMBOL(cx88_ir_stop);
static int cx88_ir_open(struct rc_dev *rc)
{
@@ -511,7 +515,7 @@ int cx88_ir_fini(struct cx88_core *core)
struct cx88_IR *ir = core->ir;
/* skip detach on non attached boards */
- if (NULL == ir)
+ if (!ir)
return 0;
cx88_ir_stop(core);
@@ -529,7 +533,7 @@ void cx88_ir_irq(struct cx88_core *core)
{
struct cx88_IR *ir = core->ir;
u32 samples;
- unsigned todo, bits;
+ unsigned int todo, bits;
struct ir_raw_event ev;
if (!ir || !ir->sampling)
@@ -579,7 +583,7 @@ static int get_key_pvr2000(struct IR_i2c *ir, enum rc_type *protocol,
}
dprintk("IR Key/Flags: (0x%02x/0x%02x)\n",
- code & 0xff, flags & 0xff);
+ code & 0xff, flags & 0xff);
*protocol = RC_TYPE_UNKNOWN;
*scancode = code & 0xff;
@@ -601,7 +605,7 @@ void cx88_i2c_init_ir(struct cx88_core *core)
const unsigned short *addr_list = default_addr_list;
const unsigned short *addrp;
/* Instantiate the IR receiver device, if present */
- if (0 != core->i2c_rc)
+ if (core->i2c_rc != 0)
return;
memset(&info, 0, sizeof(struct i2c_board_info));
@@ -639,8 +643,8 @@ void cx88_i2c_init_ir(struct cx88_core *core)
info.platform_data = &core->init_data;
}
if (i2c_smbus_xfer(&core->i2c_adap, *addrp, 0,
- I2C_SMBUS_READ, 0,
- I2C_SMBUS_QUICK, NULL) >= 0) {
+ I2C_SMBUS_READ, 0,
+ I2C_SMBUS_QUICK, NULL) >= 0) {
info.addr = *addrp;
i2c_new_device(&core->i2c_adap, &info);
break;
diff --git a/drivers/media/pci/cx88/cx88-mpeg.c b/drivers/media/pci/cx88/cx88-mpeg.c
index 245357adbc25..52ff00ebd4bd 100644
--- a/drivers/media/pci/cx88/cx88-mpeg.c
+++ b/drivers/media/pci/cx88/cx88-mpeg.c
@@ -16,21 +16,17 @@
* 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 "cx88.h"
+
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/dma-mapping.h>
#include <linux/interrupt.h>
-#include <asm/delay.h>
-
-#include "cx88.h"
+#include <linux/delay.h>
/* ------------------------------------------------------------------ */
@@ -42,23 +38,20 @@ MODULE_LICENSE("GPL");
MODULE_VERSION(CX88_VERSION);
static unsigned int debug;
-module_param(debug,int,0644);
-MODULE_PARM_DESC(debug,"enable debug messages [mpeg]");
+module_param(debug, int, 0644);
+MODULE_PARM_DESC(debug, "enable debug messages [mpeg]");
-#define dprintk(level, fmt, arg...) do { \
- if (debug + 1 > level) \
- printk(KERN_DEBUG "%s/2-mpeg: " fmt, dev->core->name, ## arg); \
-} while(0)
-
-#define mpeg_dbg(level, fmt, arg...) do { \
- if (debug + 1 > level) \
- printk(KERN_DEBUG "%s/2-mpeg: " fmt, core->name, ## arg); \
-} while(0)
+#define dprintk(level, fmt, arg...) do { \
+ if (debug + 1 > level) \
+ printk(KERN_DEBUG pr_fmt("%s: mpeg:" fmt), \
+ __func__, ##arg); \
+} while (0)
#if defined(CONFIG_MODULES) && defined(MODULE)
static void request_module_async(struct work_struct *work)
{
- struct cx8802_dev *dev=container_of(work, struct cx8802_dev, request_module_wk);
+ struct cx8802_dev *dev = container_of(work, struct cx8802_dev,
+ request_module_wk);
if (dev->core->board.mpeg & CX88_MPEG_DVB)
request_module("cx88-dvb");
@@ -81,18 +74,17 @@ static void flush_request_modules(struct cx8802_dev *dev)
#define flush_request_modules(dev)
#endif /* CONFIG_MODULES */
-
static LIST_HEAD(cx8802_devlist);
static DEFINE_MUTEX(cx8802_mutex);
/* ------------------------------------------------------------------ */
int cx8802_start_dma(struct cx8802_dev *dev,
- struct cx88_dmaqueue *q,
- struct cx88_buffer *buf)
+ struct cx88_dmaqueue *q,
+ struct cx88_buffer *buf)
{
struct cx88_core *core = dev->core;
- dprintk(1, "cx8802_start_dma w: %d, h: %d, f: %d\n",
+ dprintk(1, "w: %d, h: %d, f: %d\n",
core->width, core->height, core->field);
/* setup fifo + format */
@@ -102,33 +94,35 @@ int cx8802_start_dma(struct cx8802_dev *dev,
/* write TS length to chip */
cx_write(MO_TS_LNGTH, dev->ts_packet_size);
- /* FIXME: this needs a review.
- * also: move to cx88-blackbird + cx88-dvb source files? */
+ /*
+ * FIXME: this needs a review.
+ * also: move to cx88-blackbird + cx88-dvb source files?
+ */
- dprintk( 1, "core->active_type_id = 0x%08x\n", core->active_type_id);
+ dprintk(1, "core->active_type_id = 0x%08x\n", core->active_type_id);
- if ( (core->active_type_id == CX88_MPEG_DVB) &&
- (core->board.mpeg & CX88_MPEG_DVB) ) {
-
- dprintk( 1, "cx8802_start_dma doing .dvb\n");
+ if ((core->active_type_id == CX88_MPEG_DVB) &&
+ (core->board.mpeg & CX88_MPEG_DVB)) {
+ dprintk(1, "cx8802_start_dma doing .dvb\n");
/* negedge driven & software reset */
cx_write(TS_GEN_CNTRL, 0x0040 | dev->ts_gen_cntrl);
udelay(100);
cx_write(MO_PINMUX_IO, 0x00);
- cx_write(TS_HW_SOP_CNTRL, 0x47<<16|188<<4|0x01);
+ cx_write(TS_HW_SOP_CNTRL, 0x47 << 16 | 188 << 4 | 0x01);
switch (core->boardnr) {
case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q:
case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T:
case CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD:
case CX88_BOARD_PCHDTV_HD5500:
- cx_write(TS_SOP_STAT, 1<<13);
+ cx_write(TS_SOP_STAT, 1 << 13);
break;
case CX88_BOARD_SAMSUNG_SMT_7020:
cx_write(TS_SOP_STAT, 0x00);
break;
case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1:
case CX88_BOARD_HAUPPAUGE_NOVASE2_S1:
- cx_write(MO_PINMUX_IO, 0x88); /* Enable MPEG parallel IO and video signal pins */
+ /* Enable MPEG parallel IO and video signal pins */
+ cx_write(MO_PINMUX_IO, 0x88);
udelay(100);
break;
case CX88_BOARD_HAUPPAUGE_HVR1300:
@@ -152,22 +146,24 @@ int cx8802_start_dma(struct cx8802_dev *dev,
}
cx_write(TS_GEN_CNTRL, dev->ts_gen_cntrl);
udelay(100);
- } else if ( (core->active_type_id == CX88_MPEG_BLACKBIRD) &&
- (core->board.mpeg & CX88_MPEG_BLACKBIRD) ) {
- dprintk( 1, "cx8802_start_dma doing .blackbird\n");
+ } else if ((core->active_type_id == CX88_MPEG_BLACKBIRD) &&
+ (core->board.mpeg & CX88_MPEG_BLACKBIRD)) {
+ dprintk(1, "cx8802_start_dma doing .blackbird\n");
cx_write(MO_PINMUX_IO, 0x88); /* enable MPEG parallel IO */
- cx_write(TS_GEN_CNTRL, 0x46); /* punctured clock TS & posedge driven & software reset */
+ /* punctured clock TS & posedge driven & software reset */
+ cx_write(TS_GEN_CNTRL, 0x46);
udelay(100);
cx_write(TS_HW_SOP_CNTRL, 0x408); /* mpeg start byte */
cx_write(TS_VALERR_CNTRL, 0x2000);
- cx_write(TS_GEN_CNTRL, 0x06); /* punctured clock TS & posedge driven */
+ /* punctured clock TS & posedge driven */
+ cx_write(TS_GEN_CNTRL, 0x06);
udelay(100);
} else {
- printk( "%s() Failed. Unsupported value in .mpeg (0x%08x)\n", __func__,
- core->board.mpeg );
+ pr_err("%s() Failed. Unsupported value in .mpeg (0x%08x)\n",
+ __func__, core->board.mpeg);
return -EINVAL;
}
@@ -176,20 +172,22 @@ int cx8802_start_dma(struct cx8802_dev *dev,
q->count = 0;
/* enable irqs */
- dprintk( 1, "setting the interrupt mask\n" );
+ dprintk(1, "setting the interrupt mask\n");
cx_set(MO_PCI_INTMSK, core->pci_irqmask | PCI_INT_TSINT);
cx_set(MO_TS_INTMSK, 0x1f0011);
/* start dma */
- cx_set(MO_DEV_CNTRL2, (1<<5));
+ cx_set(MO_DEV_CNTRL2, (1 << 5));
cx_set(MO_TS_DMACNTRL, 0x11);
return 0;
}
+EXPORT_SYMBOL(cx8802_start_dma);
static int cx8802_stop_dma(struct cx8802_dev *dev)
{
struct cx88_core *core = dev->core;
- dprintk( 1, "cx8802_stop_dma\n" );
+
+ dprintk(1, "\n");
/* stop dma */
cx_clear(MO_TS_DMACNTRL, 0x11);
@@ -208,12 +206,12 @@ static int cx8802_restart_queue(struct cx8802_dev *dev,
{
struct cx88_buffer *buf;
- dprintk( 1, "cx8802_restart_queue\n" );
+ dprintk(1, "\n");
if (list_empty(&q->active))
return 0;
buf = list_entry(q->active.next, struct cx88_buffer, list);
- dprintk(2,"restart_queue [%p/%d]: restart dma\n",
+ dprintk(2, "restart_queue [%p/%d]: restart dma\n",
buf, buf->vb.vb2_buf.index);
cx8802_start_dma(dev, q, buf);
return 0;
@@ -222,7 +220,7 @@ static int cx8802_restart_queue(struct cx8802_dev *dev,
/* ------------------------------------------------------------------ */
int cx8802_buf_prepare(struct vb2_queue *q, struct cx8802_dev *dev,
- struct cx88_buffer *buf)
+ struct cx88_buffer *buf)
{
int size = dev->ts_packet_size * dev->ts_packet_count;
struct sg_table *sgt = vb2_dma_sg_plane_desc(&buf->vb.vb2_buf, 0);
@@ -234,43 +232,46 @@ int cx8802_buf_prepare(struct vb2_queue *q, struct cx8802_dev *dev,
vb2_set_plane_payload(&buf->vb.vb2_buf, 0, size);
rc = cx88_risc_databuffer(dev->pci, risc, sgt->sgl,
- dev->ts_packet_size, dev->ts_packet_count, 0);
+ dev->ts_packet_size, dev->ts_packet_count, 0);
if (rc) {
if (risc->cpu)
- pci_free_consistent(dev->pci, risc->size, risc->cpu, risc->dma);
+ pci_free_consistent(dev->pci, risc->size,
+ risc->cpu, risc->dma);
memset(risc, 0, sizeof(*risc));
return rc;
}
return 0;
}
+EXPORT_SYMBOL(cx8802_buf_prepare);
void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf)
{
struct cx88_buffer *prev;
struct cx88_dmaqueue *cx88q = &dev->mpegq;
- dprintk( 1, "cx8802_buf_queue\n" );
+ dprintk(1, "\n");
/* add jump to start */
buf->risc.cpu[1] = cpu_to_le32(buf->risc.dma + 8);
buf->risc.jmp[0] = cpu_to_le32(RISC_JUMP | RISC_CNT_INC);
buf->risc.jmp[1] = cpu_to_le32(buf->risc.dma + 8);
if (list_empty(&cx88q->active)) {
- dprintk( 1, "queue is empty - first active\n" );
+ dprintk(1, "queue is empty - first active\n");
list_add_tail(&buf->list, &cx88q->active);
- dprintk(1,"[%p/%d] %s - first active\n",
+ dprintk(1, "[%p/%d] %s - first active\n",
buf, buf->vb.vb2_buf.index, __func__);
} else {
buf->risc.cpu[0] |= cpu_to_le32(RISC_IRQ1);
- dprintk( 1, "queue is not empty - append to active\n" );
+ dprintk(1, "queue is not empty - append to active\n");
prev = list_entry(cx88q->active.prev, struct cx88_buffer, list);
list_add_tail(&buf->list, &cx88q->active);
prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
- dprintk( 1, "[%p/%d] %s - append to active\n",
+ dprintk(1, "[%p/%d] %s - append to active\n",
buf, buf->vb.vb2_buf.index, __func__);
}
}
+EXPORT_SYMBOL(cx8802_buf_queue);
/* ----------------------------------------------------------- */
@@ -280,23 +281,24 @@ static void do_cancel_buffers(struct cx8802_dev *dev)
struct cx88_buffer *buf;
unsigned long flags;
- spin_lock_irqsave(&dev->slock,flags);
+ spin_lock_irqsave(&dev->slock, flags);
while (!list_empty(&q->active)) {
buf = list_entry(q->active.next, struct cx88_buffer, list);
list_del(&buf->list);
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
}
- spin_unlock_irqrestore(&dev->slock,flags);
+ spin_unlock_irqrestore(&dev->slock, flags);
}
void cx8802_cancel_buffers(struct cx8802_dev *dev)
{
- dprintk( 1, "cx8802_cancel_buffers" );
+ dprintk(1, "\n");
cx8802_stop_dma(dev);
do_cancel_buffers(dev);
}
+EXPORT_SYMBOL(cx8802_cancel_buffers);
-static const char * cx88_mpeg_irqs[32] = {
+static const char *cx88_mpeg_irqs[32] = {
"ts_risci1", NULL, NULL, NULL,
"ts_risci2", NULL, NULL, NULL,
"ts_oflow", NULL, NULL, NULL,
@@ -310,7 +312,7 @@ static void cx8802_mpeg_irq(struct cx8802_dev *dev)
struct cx88_core *core = dev->core;
u32 status, mask, count;
- dprintk( 1, "cx8802_mpeg_irq\n" );
+ dprintk(1, "\n");
status = cx_read(MO_TS_INTSTAT);
mask = cx_read(MO_TS_INTMSK);
if (0 == (status & mask))
@@ -319,20 +321,21 @@ static void cx8802_mpeg_irq(struct cx8802_dev *dev)
cx_write(MO_TS_INTSTAT, status);
if (debug || (status & mask & ~0xff))
- cx88_print_irqbits(core->name, "irq mpeg ",
+ cx88_print_irqbits("irq mpeg ",
cx88_mpeg_irqs, ARRAY_SIZE(cx88_mpeg_irqs),
status, mask);
/* risc op code error */
if (status & (1 << 16)) {
- printk(KERN_WARNING "%s: mpeg risc op code error\n",core->name);
+ pr_warn("mpeg risc op code error\n");
cx_clear(MO_TS_DMACNTRL, 0x11);
- cx88_sram_channel_dump(dev->core, &cx88_sram_channels[SRAM_CH28]);
+ cx88_sram_channel_dump(dev->core,
+ &cx88_sram_channels[SRAM_CH28]);
}
/* risc1 y */
if (status & 0x01) {
- dprintk( 1, "wake up\n" );
+ dprintk(1, "wake up\n");
spin_lock(&dev->slock);
count = cx_read(MO_TS_GPCNT);
cx88_wakeup(dev->core, &dev->mpegq, count);
@@ -341,7 +344,7 @@ static void cx8802_mpeg_irq(struct cx8802_dev *dev)
/* other general errors */
if (status & 0x1f0100) {
- dprintk( 0, "general errors: 0x%08x\n", status & 0x1f0100 );
+ dprintk(0, "general errors: 0x%08x\n", status & 0x1f0100);
spin_lock(&dev->slock);
cx8802_stop_dma(dev);
spin_unlock(&dev->slock);
@@ -360,24 +363,23 @@ static irqreturn_t cx8802_irq(int irq, void *dev_id)
for (loop = 0; loop < MAX_IRQ_LOOP; loop++) {
status = cx_read(MO_PCI_INTSTAT) &
(core->pci_irqmask | PCI_INT_TSINT);
- if (0 == status)
+ if (status == 0)
goto out;
- dprintk( 1, "cx8802_irq\n" );
- dprintk( 1, " loop: %d/%d\n", loop, MAX_IRQ_LOOP );
- dprintk( 1, " status: %d\n", status );
+ dprintk(1, "cx8802_irq\n");
+ dprintk(1, " loop: %d/%d\n", loop, MAX_IRQ_LOOP);
+ dprintk(1, " status: %d\n", status);
handled = 1;
cx_write(MO_PCI_INTSTAT, status);
if (status & core->pci_irqmask)
- cx88_core_irq(core,status);
+ cx88_core_irq(core, status);
if (status & PCI_INT_TSINT)
cx8802_mpeg_irq(dev);
}
- if (MAX_IRQ_LOOP == loop) {
- dprintk( 0, "clearing mask\n" );
- printk(KERN_WARNING "%s/0: irq loop -- clearing mask\n",
- core->name);
- cx_write(MO_PCI_INTMSK,0);
+ if (loop == MAX_IRQ_LOOP) {
+ dprintk(0, "clearing mask\n");
+ pr_warn("irq loop -- clearing mask\n");
+ cx_write(MO_PCI_INTMSK, 0);
}
out:
@@ -393,18 +395,18 @@ static int cx8802_init_common(struct cx8802_dev *dev)
if (pci_enable_device(dev->pci))
return -EIO;
pci_set_master(dev->pci);
- err = pci_set_dma_mask(dev->pci,DMA_BIT_MASK(32));
+ err = pci_set_dma_mask(dev->pci, DMA_BIT_MASK(32));
if (err) {
- printk("%s/2: Oops: no 32bit PCI DMA ???\n",dev->core->name);
+ pr_err("Oops: no 32bit PCI DMA ???\n");
return -EIO;
}
dev->pci_rev = dev->pci->revision;
pci_read_config_byte(dev->pci, PCI_LATENCY_TIMER, &dev->pci_lat);
- printk(KERN_INFO "%s/2: found at %s, rev: %d, irq: %d, "
- "latency: %d, mmio: 0x%llx\n", dev->core->name,
- pci_name(dev->pci), dev->pci_rev, dev->pci->irq,
- dev->pci_lat,(unsigned long long)pci_resource_start(dev->pci,0));
+ pr_info("found at %s, rev: %d, irq: %d, latency: %d, mmio: 0x%llx\n",
+ pci_name(dev->pci), dev->pci_rev, dev->pci->irq,
+ dev->pci_lat,
+ (unsigned long long)pci_resource_start(dev->pci, 0));
/* initialize driver struct */
spin_lock_init(&dev->slock);
@@ -416,20 +418,19 @@ static int cx8802_init_common(struct cx8802_dev *dev)
err = request_irq(dev->pci->irq, cx8802_irq,
IRQF_SHARED, dev->core->name, dev);
if (err < 0) {
- printk(KERN_ERR "%s: can't get IRQ %d\n",
- dev->core->name, dev->pci->irq);
+ pr_err("can't get IRQ %d\n", dev->pci->irq);
return err;
}
cx_set(MO_PCI_INTMSK, core->pci_irqmask);
/* everything worked */
- pci_set_drvdata(dev->pci,dev);
+ pci_set_drvdata(dev->pci, dev);
return 0;
}
static void cx8802_fini_common(struct cx8802_dev *dev)
{
- dprintk( 2, "cx8802_fini_common\n" );
+ dprintk(2, "\n");
cx8802_stop_dma(dev);
pci_disable_device(dev->pci);
@@ -442,14 +443,13 @@ static void cx8802_fini_common(struct cx8802_dev *dev)
static int cx8802_suspend_common(struct pci_dev *pci_dev, pm_message_t state)
{
struct cx8802_dev *dev = pci_get_drvdata(pci_dev);
- struct cx88_core *core = dev->core;
unsigned long flags;
/* stop mpeg dma */
spin_lock_irqsave(&dev->slock, flags);
if (!list_empty(&dev->mpegq.active)) {
- dprintk( 2, "suspend\n" );
- printk("%s: suspend mpeg\n", core->name);
+ dprintk(2, "suspend\n");
+ pr_info("suspend mpeg\n");
cx8802_stop_dma(dev);
}
spin_unlock_irqrestore(&dev->slock, flags);
@@ -458,7 +458,8 @@ static int cx8802_suspend_common(struct pci_dev *pci_dev, pm_message_t state)
cx88_shutdown(dev->core);
pci_save_state(pci_dev);
- if (0 != pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state))) {
+ if (pci_set_power_state(pci_dev,
+ pci_choose_state(pci_dev, state)) != 0) {
pci_disable_device(pci_dev);
dev->state.disabled = 1;
}
@@ -468,23 +469,20 @@ static int cx8802_suspend_common(struct pci_dev *pci_dev, pm_message_t state)
static int cx8802_resume_common(struct pci_dev *pci_dev)
{
struct cx8802_dev *dev = pci_get_drvdata(pci_dev);
- struct cx88_core *core = dev->core;
unsigned long flags;
int err;
if (dev->state.disabled) {
- err=pci_enable_device(pci_dev);
+ err = pci_enable_device(pci_dev);
if (err) {
- printk(KERN_ERR "%s: can't enable device\n",
- dev->core->name);
+ pr_err("can't enable device\n");
return err;
}
dev->state.disabled = 0;
}
- err=pci_set_power_state(pci_dev, PCI_D0);
+ err = pci_set_power_state(pci_dev, PCI_D0);
if (err) {
- printk(KERN_ERR "%s: can't enable device\n",
- dev->core->name);
+ pr_err("can't enable device\n");
pci_disable_device(pci_dev);
dev->state.disabled = 1;
@@ -498,15 +496,16 @@ static int cx8802_resume_common(struct pci_dev *pci_dev)
/* restart video+vbi capture */
spin_lock_irqsave(&dev->slock, flags);
if (!list_empty(&dev->mpegq.active)) {
- printk("%s: resume mpeg\n", core->name);
- cx8802_restart_queue(dev,&dev->mpegq);
+ pr_info("resume mpeg\n");
+ cx8802_restart_queue(dev, &dev->mpegq);
}
spin_unlock_irqrestore(&dev->slock, flags);
return 0;
}
-struct cx8802_driver * cx8802_get_driver(struct cx8802_dev *dev, enum cx88_board_type btype)
+struct cx8802_driver *cx8802_get_driver(struct cx8802_dev *dev,
+ enum cx88_board_type btype)
{
struct cx8802_driver *d;
@@ -516,6 +515,7 @@ struct cx8802_driver * cx8802_get_driver(struct cx8802_dev *dev, enum cx88_board
return NULL;
}
+EXPORT_SYMBOL(cx8802_get_driver);
/* Driver asked for hardware access. */
static int cx8802_request_acquire(struct cx8802_driver *drv)
@@ -533,7 +533,8 @@ static int cx8802_request_acquire(struct cx8802_driver *drv)
core->last_analog_input = core->input;
core->input = 0;
for (i = 0;
- i < (sizeof(core->board.input) / sizeof(struct cx88_input));
+ i < (sizeof(core->board.input) /
+ sizeof(struct cx88_input));
i++) {
if (core->board.input[i].type == CX88_VMUX_DVB) {
core->input = i;
@@ -542,15 +543,14 @@ static int cx8802_request_acquire(struct cx8802_driver *drv)
}
}
- if (drv->advise_acquire)
- {
+ if (drv->advise_acquire) {
core->active_ref++;
if (core->active_type_id == CX88_BOARD_NONE) {
core->active_type_id = drv->type_id;
drv->advise_acquire(drv);
}
- mpeg_dbg(1,"%s() Post acquire GPIO=%x\n", __func__, cx_read(MO_GP0_IO));
+ dprintk(1, "Post acquire GPIO=%x\n", cx_read(MO_GP0_IO));
}
return 0;
@@ -561,17 +561,18 @@ static int cx8802_request_release(struct cx8802_driver *drv)
{
struct cx88_core *core = drv->core;
- if (drv->advise_release && --core->active_ref == 0)
- {
+ if (drv->advise_release && --core->active_ref == 0) {
if (drv->type_id == CX88_MPEG_DVB) {
- /* If the DVB driver is releasing, reset the input
- state to the last configured analog input */
+ /*
+ * If the DVB driver is releasing, reset the input
+ * state to the last configured analog input
+ */
core->input = core->last_analog_input;
}
drv->advise_release(drv);
core->active_type_id = CX88_BOARD_NONE;
- mpeg_dbg(1,"%s() Post release GPIO=%x\n", __func__, cx_read(MO_GP0_IO));
+ dprintk(1, "Post release GPIO=%x\n", cx_read(MO_GP0_IO));
}
return 0;
@@ -579,21 +580,21 @@ static int cx8802_request_release(struct cx8802_driver *drv)
static int cx8802_check_driver(struct cx8802_driver *drv)
{
- if (drv == NULL)
+ if (!drv)
return -ENODEV;
if ((drv->type_id != CX88_MPEG_DVB) &&
- (drv->type_id != CX88_MPEG_BLACKBIRD))
+ (drv->type_id != CX88_MPEG_BLACKBIRD))
return -EINVAL;
if ((drv->hw_access != CX8802_DRVCTL_SHARED) &&
- (drv->hw_access != CX8802_DRVCTL_EXCLUSIVE))
+ (drv->hw_access != CX8802_DRVCTL_EXCLUSIVE))
return -EINVAL;
- if ((drv->probe == NULL) ||
- (drv->remove == NULL) ||
- (drv->advise_acquire == NULL) ||
- (drv->advise_release == NULL))
+ if ((!drv->probe) ||
+ (!drv->remove) ||
+ (!drv->advise_acquire) ||
+ (!drv->advise_release))
return -EINVAL;
return 0;
@@ -605,28 +606,28 @@ int cx8802_register_driver(struct cx8802_driver *drv)
struct cx8802_driver *driver;
int err, i = 0;
- printk(KERN_INFO
- "cx88/2: registering cx8802 driver, type: %s access: %s\n",
- drv->type_id == CX88_MPEG_DVB ? "dvb" : "blackbird",
- drv->hw_access == CX8802_DRVCTL_SHARED ? "shared" : "exclusive");
+ pr_info("registering cx8802 driver, type: %s access: %s\n",
+ drv->type_id == CX88_MPEG_DVB ? "dvb" : "blackbird",
+ drv->hw_access == CX8802_DRVCTL_SHARED ?
+ "shared" : "exclusive");
- if ((err = cx8802_check_driver(drv)) != 0) {
- printk(KERN_ERR "cx88/2: cx8802_driver is invalid\n");
+ err = cx8802_check_driver(drv);
+ if (err) {
+ pr_err("cx8802_driver is invalid\n");
return err;
}
mutex_lock(&cx8802_mutex);
list_for_each_entry(dev, &cx8802_devlist, devlist) {
- printk(KERN_INFO
- "%s/2: subsystem: %04x:%04x, board: %s [card=%d]\n",
- dev->core->name, dev->pci->subsystem_vendor,
- dev->pci->subsystem_device, dev->core->board.name,
- dev->core->boardnr);
+ pr_info("subsystem: %04x:%04x, board: %s [card=%d]\n",
+ dev->pci->subsystem_vendor,
+ dev->pci->subsystem_device, dev->core->board.name,
+ dev->core->boardnr);
/* Bring up a new struct for each driver instance */
- driver = kzalloc(sizeof(*drv),GFP_KERNEL);
- if (driver == NULL) {
+ driver = kzalloc(sizeof(*drv), GFP_KERNEL);
+ if (!driver) {
err = -ENOMEM;
goto out;
}
@@ -645,9 +646,7 @@ int cx8802_register_driver(struct cx8802_driver *drv)
i++;
list_add_tail(&driver->drvlist, &dev->drvlist);
} else {
- printk(KERN_ERR
- "%s/2: cx8802 probe failed, err = %d\n",
- dev->core->name, err);
+ pr_err("cx8802 probe failed, err = %d\n", err);
}
mutex_unlock(&drv->core->lock);
}
@@ -657,6 +656,7 @@ out:
mutex_unlock(&cx8802_mutex);
return err;
}
+EXPORT_SYMBOL(cx8802_register_driver);
int cx8802_unregister_driver(struct cx8802_driver *drv)
{
@@ -664,19 +664,18 @@ int cx8802_unregister_driver(struct cx8802_driver *drv)
struct cx8802_driver *d, *dtmp;
int err = 0;
- printk(KERN_INFO
- "cx88/2: unregistering cx8802 driver, type: %s access: %s\n",
- drv->type_id == CX88_MPEG_DVB ? "dvb" : "blackbird",
- drv->hw_access == CX8802_DRVCTL_SHARED ? "shared" : "exclusive");
+ pr_info("unregistering cx8802 driver, type: %s access: %s\n",
+ drv->type_id == CX88_MPEG_DVB ? "dvb" : "blackbird",
+ drv->hw_access == CX8802_DRVCTL_SHARED ?
+ "shared" : "exclusive");
mutex_lock(&cx8802_mutex);
list_for_each_entry(dev, &cx8802_devlist, devlist) {
- printk(KERN_INFO
- "%s/2: subsystem: %04x:%04x, board: %s [card=%d]\n",
- dev->core->name, dev->pci->subsystem_vendor,
- dev->pci->subsystem_device, dev->core->board.name,
- dev->core->boardnr);
+ pr_info("subsystem: %04x:%04x, board: %s [card=%d]\n",
+ dev->pci->subsystem_vendor,
+ dev->pci->subsystem_device, dev->core->board.name,
+ dev->core->boardnr);
mutex_lock(&dev->core->lock);
@@ -690,8 +689,8 @@ int cx8802_unregister_driver(struct cx8802_driver *drv)
list_del(&d->drvlist);
kfree(d);
} else
- printk(KERN_ERR "%s/2: cx8802 driver remove "
- "failed (%d)\n", dev->core->name, err);
+ pr_err("cx8802 driver remove failed (%d)\n",
+ err);
}
mutex_unlock(&dev->core->lock);
@@ -701,6 +700,7 @@ int cx8802_unregister_driver(struct cx8802_driver *drv)
return err;
}
+EXPORT_SYMBOL(cx8802_unregister_driver);
/* ----------------------------------------------------------- */
static int cx8802_probe(struct pci_dev *pci_dev,
@@ -712,18 +712,18 @@ static int cx8802_probe(struct pci_dev *pci_dev,
/* general setup */
core = cx88_core_get(pci_dev);
- if (NULL == core)
+ if (!core)
return -EINVAL;
- printk("%s/2: cx2388x 8802 Driver Manager\n", core->name);
+ pr_info("cx2388x 8802 Driver Manager\n");
err = -ENODEV;
if (!core->board.mpeg)
goto fail_core;
err = -ENOMEM;
- dev = kzalloc(sizeof(*dev),GFP_KERNEL);
- if (NULL == dev)
+ dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+ if (!dev)
goto fail_core;
dev->pci = pci_dev;
dev->core = core;
@@ -737,7 +737,7 @@ static int cx8802_probe(struct pci_dev *pci_dev,
INIT_LIST_HEAD(&dev->drvlist);
mutex_lock(&cx8802_mutex);
- list_add_tail(&dev->devlist,&cx8802_devlist);
+ list_add_tail(&dev->devlist, &cx8802_devlist);
mutex_unlock(&cx8802_mutex);
/* now autoload cx88-dvb or cx88-blackbird */
@@ -748,7 +748,7 @@ static int cx8802_probe(struct pci_dev *pci_dev,
kfree(dev);
fail_core:
core->dvbdev = NULL;
- cx88_core_put(core,pci_dev);
+ cx88_core_put(core, pci_dev);
return err;
}
@@ -758,7 +758,7 @@ static void cx8802_remove(struct pci_dev *pci_dev)
dev = pci_get_drvdata(pci_dev);
- dprintk( 1, "%s\n", __func__);
+ dprintk(1, "%s\n", __func__);
flush_request_modules(dev);
@@ -768,17 +768,15 @@ static void cx8802_remove(struct pci_dev *pci_dev)
struct cx8802_driver *drv, *tmp;
int err;
- printk(KERN_WARNING "%s/2: Trying to remove cx8802 driver "
- "while cx8802 sub-drivers still loaded?!\n",
- dev->core->name);
+ pr_warn("Trying to remove cx8802 driver while cx8802 sub-drivers still loaded?!\n");
list_for_each_entry_safe(drv, tmp, &dev->drvlist, drvlist) {
err = drv->remove(drv);
if (err == 0) {
list_del(&drv->drvlist);
} else
- printk(KERN_ERR "%s/2: cx8802 driver remove "
- "failed (%d)\n", dev->core->name, err);
+ pr_err("cx8802 driver remove failed (%d)\n",
+ err);
kfree(drv);
}
}
@@ -790,7 +788,7 @@ static void cx8802_remove(struct pci_dev *pci_dev)
/* common */
cx8802_fini_common(dev);
- cx88_core_put(dev->core,dev->pci);
+ cx88_core_put(dev->core, dev->pci);
kfree(dev);
}
@@ -800,7 +798,7 @@ static const struct pci_device_id cx8802_pci_tbl[] = {
.device = 0x8802,
.subvendor = PCI_ANY_ID,
.subdevice = PCI_ANY_ID,
- },{
+ }, {
/* --- end of list --- */
}
};
@@ -814,12 +812,3 @@ static struct pci_driver cx8802_pci_driver = {
};
module_pci_driver(cx8802_pci_driver);
-
-EXPORT_SYMBOL(cx8802_buf_prepare);
-EXPORT_SYMBOL(cx8802_buf_queue);
-EXPORT_SYMBOL(cx8802_cancel_buffers);
-EXPORT_SYMBOL(cx8802_start_dma);
-
-EXPORT_SYMBOL(cx8802_register_driver);
-EXPORT_SYMBOL(cx8802_unregister_driver);
-EXPORT_SYMBOL(cx8802_get_driver);
diff --git a/drivers/media/pci/cx88/cx88-reg.h b/drivers/media/pci/cx88/cx88-reg.h
index 2ec52d1cdea0..f1e1dd634a72 100644
--- a/drivers/media/pci/cx88/cx88-reg.h
+++ b/drivers/media/pci/cx88/cx88-reg.h
@@ -1,32 +1,28 @@
/*
-
- cx88x-hw.h - CX2388x register offsets
-
- Copyright (C) 1996,97,98 Ralph Metzler (rjkm@thp.uni-koeln.de)
- 2001 Michael Eskin
- 2002 Yurij Sysoev <yurij@naturesoft.net>
- 2003 Gerd Knorr <kraxel@bytesex.org>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
+ * cx88x-hw.h - CX2388x register offsets
+ *
+ * Copyright (C) 1996,97,98 Ralph Metzler (rjkm@thp.uni-koeln.de)
+ * 2001 Michael Eskin
+ * 2002 Yurij Sysoev <yurij@naturesoft.net>
+ * 2003 Gerd Knorr <kraxel@bytesex.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
#ifndef _CX88_REG_H_
#define _CX88_REG_H_
-/* ---------------------------------------------------------------------- */
-/* PCI IDs and config space */
+/*
+ * PCI IDs and config space
+ */
#ifndef PCI_VENDOR_ID_CONEXANT
# define PCI_VENDOR_ID_CONEXANT 0x14F1
@@ -39,8 +35,9 @@
#define CX88X_EN_TBFX 0x02
#define CX88X_EN_VSFX 0x04
-/* ---------------------------------------------------------------------- */
-/* PCI controller registers */
+/*
+ * PCI controller registers
+ */
/* Command and Status Register */
#define F0_CMD_STAT_MM 0x2f0004
@@ -63,8 +60,9 @@
#define F3_BAR0_MM 0x2f0310
#define F4_BAR0_MM 0x2f0410
-/* ---------------------------------------------------------------------- */
-/* DMA Controller registers */
+/*
+ * DMA Controller registers
+ */
#define MO_PDMA_STHRSH 0x200000 // Source threshold
#define MO_PDMA_STADRS 0x200004 // Source target address
@@ -157,9 +155,9 @@
#define MO_DMA31_CNT2 0x300168 // {11}RW* DMA Table Size : Ch#31
#define MO_DMA32_CNT2 0x30016C // {11}RW* DMA Table Size : Ch#32
-
-/* ---------------------------------------------------------------------- */
-/* Video registers */
+/*
+ * Video registers
+ */
#define MO_VIDY_DMA 0x310000 // {64}RWp Video Y
#define MO_VIDU_DMA 0x310008 // {64}RWp Video U
@@ -217,9 +215,9 @@
#define MO_VID_DMACNTRL 0x31C040 // {8}RW Video DMA control
#define MO_VID_XFR_STAT 0x31C044 // {1}RO Video transfer status
-
-/* ---------------------------------------------------------------------- */
-/* audio registers */
+/*
+ * audio registers
+ */
#define MO_AUDD_DMA 0x320000 // {64}RWp Audio downstream
#define MO_AUDU_DMA 0x320008 // {64}RWp Audio upstream
@@ -437,9 +435,9 @@
#define AUD_PHACC_FREQ_8LSB 0x320d2b
#define AUD_QAM_MODE 0x320d04
-
-/* ---------------------------------------------------------------------- */
-/* transport stream registers */
+/*
+ * transport stream registers
+ */
#define MO_TS_DMA 0x330000 // {64}RWp Transport stream downstream
#define MO_TS_GPCNT 0x33C020 // {16}RO TS general purpose counter
@@ -455,9 +453,9 @@
#define TS_FIFO_OVFL_STAT 0x33C05C
#define TS_VALERR_CNTRL 0x33C060
-
-/* ---------------------------------------------------------------------- */
-/* VIP registers */
+/*
+ * VIP registers
+ */
#define MO_VIPD_DMA 0x340000 // {64}RWp VIP downstream
#define MO_VIPU_DMA 0x340008 // {64}RWp VIP upstream
@@ -475,9 +473,9 @@
#define MO_VIP_INTCNTRL 0x34C05C // VIP Interrupt Control
#define MO_VIP_XFTERM 0x340060 // VIP transfer terminate
-
-/* ---------------------------------------------------------------------- */
-/* misc registers */
+/*
+ * misc registers
+ */
#define MO_M2M_DMA 0x350000 // {64}RWp Mem2Mem DMA Bfr
#define MO_GP0_IO 0x350010 // {32}RW* GPIOoutput enablesdata I/O
@@ -509,9 +507,9 @@
#define MO_INT1_STAT 0x35C064 // DMA RISC interrupt status
#define MO_INT1_MSTAT 0x35C068 // DMA RISC interrupt masked status
-
-/* ---------------------------------------------------------------------- */
-/* i2c bus registers */
+/*
+ * i2c bus registers
+ */
#define MO_I2C 0x368000 // I2C data/control
#define MO_I2C_DIV (0xf<<4)
@@ -521,9 +519,11 @@
#define MO_I2C_SDA (1<<0)
-/* ---------------------------------------------------------------------- */
-/* general purpose host registers */
-/* FIXME: tyops? s/0x35/0x38/ ?? */
+/*
+ * general purpose host registers
+ *
+ * FIXME: tyops? s/0x35/0x38/ ??
+ */
#define MO_GPHSTD_DMA 0x350000 // {64}RWp Host downstream
#define MO_GPHSTU_DMA 0x350008 // {64}RWp Host upstream
@@ -545,9 +545,9 @@
#define MO_GPHST_XFR_STAT 0x38C044 // Host transfer status
#define MO_GPHST_SOFT_RST 0x38C06C // Host software reset
-
-/* ---------------------------------------------------------------------- */
-/* RISC instructions */
+/*
+ * RISC instructions
+ */
#define RISC_SYNC 0x80000000
#define RISC_SYNC_ODD 0x80000000
@@ -576,11 +576,11 @@
#define RISC_CNT_INC 0x00010000
#define RISC_CNT_RSVR 0x00020000
#define RISC_CNT_RESET 0x00030000
-#define RISC_JMP_SRP 0x01
+#define RISC_JMP_SRP 0x01
-
-/* ---------------------------------------------------------------------- */
-/* various constants */
+/*
+ * various constants
+ */
// DMA
/* Interrupt mask/status */
@@ -822,15 +822,4 @@
#define DEFAULT_SAT_U_NTSC 0x7F
#define DEFAULT_SAT_V_NTSC 0x5A
-typedef enum
-{
- SOURCE_TUNER = 0,
- SOURCE_COMPOSITE,
- SOURCE_SVIDEO,
- SOURCE_OTHER1,
- SOURCE_OTHER2,
- SOURCE_COMPVIASVIDEO,
- SOURCE_CCIR656
-} VIDEOSOURCETYPE;
-
#endif /* _CX88_REG_H_ */
diff --git a/drivers/media/pci/cx88/cx88-tvaudio.c b/drivers/media/pci/cx88/cx88-tvaudio.c
index 6bbce6ad6295..545ad4c4d1c7 100644
--- a/drivers/media/pci/cx88/cx88-tvaudio.c
+++ b/drivers/media/pci/cx88/cx88-tvaudio.c
@@ -1,39 +1,36 @@
/*
+ * cx88x-audio.c - Conexant CX23880/23881 audio downstream driver driver
+ *
+ * (c) 2001 Michael Eskin, Tom Zakrajsek [Windows version]
+ * (c) 2002 Yurij Sysoev <yurij@naturesoft.net>
+ * (c) 2003 Gerd Knorr <kraxel@bytesex.org>
+ *
+ * -----------------------------------------------------------------------
+ *
+ * Lot of voodoo here. Even the data sheet doesn't help to
+ * understand what is going on here, the documentation for the audio
+ * part of the cx2388x chip is *very* bad.
+ *
+ * Some of this comes from party done linux driver sources I got from
+ * [undocumented].
+ *
+ * Some comes from the dscaler sources, one of the dscaler driver guy works
+ * for Conexant ...
+ *
+ * -----------------------------------------------------------------------
+ *
+ * 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.
+ */
- cx88x-audio.c - Conexant CX23880/23881 audio downstream driver driver
-
- (c) 2001 Michael Eskin, Tom Zakrajsek [Windows version]
- (c) 2002 Yurij Sysoev <yurij@naturesoft.net>
- (c) 2003 Gerd Knorr <kraxel@bytesex.org>
-
- -----------------------------------------------------------------------
-
- Lot of voodoo here. Even the data sheet doesn't help to
- understand what is going on here, the documentation for the audio
- part of the cx2388x chip is *very* bad.
-
- Some of this comes from party done linux driver sources I got from
- [undocumented].
-
- Some comes from the dscaler sources, one of the dscaler driver guy works
- for Conexant ...
-
- -----------------------------------------------------------------------
-
- 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 "cx88.h"
#include <linux/module.h>
#include <linux/errno.h>
@@ -50,24 +47,24 @@
#include <linux/delay.h>
#include <linux/kthread.h>
-#include "cx88.h"
-
static unsigned int audio_debug;
module_param(audio_debug, int, 0644);
MODULE_PARM_DESC(audio_debug, "enable debug messages [audio]");
static unsigned int always_analog;
-module_param(always_analog,int,0644);
-MODULE_PARM_DESC(always_analog,"force analog audio out");
+module_param(always_analog, int, 0644);
+MODULE_PARM_DESC(always_analog, "force analog audio out");
static unsigned int radio_deemphasis;
-module_param(radio_deemphasis,int,0644);
-MODULE_PARM_DESC(radio_deemphasis, "Radio deemphasis time constant, "
- "0=None, 1=50us (elsewhere), 2=75us (USA)");
-
-#define dprintk(fmt, arg...) if (audio_debug) \
- printk(KERN_DEBUG "%s/0: " fmt, core->name , ## arg)
-
+module_param(radio_deemphasis, int, 0644);
+MODULE_PARM_DESC(radio_deemphasis,
+ "Radio deemphasis time constant, 0=None, 1=50us (elsewhere), 2=75us (USA)");
+
+#define dprintk(fmt, arg...) do { \
+ if (audio_debug) \
+ printk(KERN_DEBUG pr_fmt("%s: tvaudio:" fmt), \
+ __func__, ##arg); \
+} while (0)
/* ----------------------------------------------------------- */
static const char * const aud_ctl_names[64] = {
@@ -145,7 +142,10 @@ static void set_audio_finish(struct cx88_core *core, u32 ctl)
if (core->board.mpeg & CX88_MPEG_BLACKBIRD) {
cx_write(AUD_I2SINPUTCNTL, 4);
cx_write(AUD_BAUDRATE, 1);
- /* 'pass-thru mode': this enables the i2s output to the mpeg encoder */
+ /*
+ * 'pass-thru mode': this enables the i2s
+ * output to the mpeg encoder
+ */
cx_set(AUD_CTL, EN_I2SOUT_ENABLE);
cx_write(AUD_I2SOUTPUTCNTL, 1);
cx_write(AUD_I2SCNTL, 0);
@@ -349,7 +349,7 @@ static void set_audio_standard_NICAM(struct cx88_core *core, u32 mode)
{ /* end of list */ },
};
- set_audio_start(core,SEL_NICAM);
+ set_audio_start(core, SEL_NICAM);
switch (core->tvaudio) {
case WW_L:
dprintk("%s SECAM-L NICAM (status: devel)\n", __func__);
@@ -638,7 +638,6 @@ static void set_audio_standard_A2(struct cx88_core *core, u32 mode)
case WW_M:
dprintk("%s Warning: wrong value\n", __func__);
return;
- break;
}
mode |= EN_FMRADIO_EN_RDS | EN_DMTRX_SUMDIFF;
@@ -695,13 +694,15 @@ static void set_audio_standard_FM(struct cx88_core *core,
{ /* end of list */ },
};
- /* It is enough to leave default values? */
- /* No, it's not! The deemphasis registers are reset to the 75us
+ /*
+ * It is enough to leave default values?
+ *
+ * No, it's not! The deemphasis registers are reset to the 75us
* values by default. Analyzing the spectrum of the decoded audio
* reveals that "no deemphasis" is the same as 75 us, while the 50 us
- * setting results in less deemphasis. */
+ * setting results in less deemphasis.
+ */
static const struct rlist fm_no_deemph[] = {
-
{AUD_POLYPH80SCALEFAC, 0x0003},
{ /* end of list */ },
};
@@ -745,7 +746,7 @@ static int cx88_detect_nicam(struct cx88_core *core)
}
/* wait a little bit for next reading status */
- msleep(10);
+ usleep_range(10000, 20000);
}
dprintk("nicam is not detected.\n");
@@ -766,10 +767,12 @@ void cx88_set_tvaudio(struct cx88_core *core)
/* prepare all dsp registers */
set_audio_standard_A2(core, EN_A2_FORCE_MONO1);
- /* set nicam mode - otherwise
- AUD_NICAM_STATUS2 contains wrong values */
+ /*
+ * set nicam mode - otherwise
+ * AUD_NICAM_STATUS2 contains wrong values
+ */
set_audio_standard_NICAM(core, EN_NICAM_AUTO_STEREO);
- if (0 == cx88_detect_nicam(core)) {
+ if (cx88_detect_nicam(core) == 0) {
/* fall back to fm / am mono */
set_audio_standard_A2(core, EN_A2_FORCE_MONO1);
core->audiomode_current = V4L2_TUNER_MODE_MONO;
@@ -798,23 +801,25 @@ void cx88_set_tvaudio(struct cx88_core *core)
break;
case WW_NONE:
case WW_I2SPT:
- printk("%s/0: unknown tv audio mode [%d]\n",
- core->name, core->tvaudio);
+ pr_info("unknown tv audio mode [%d]\n", core->tvaudio);
break;
}
- return;
}
+EXPORT_SYMBOL(cx88_set_tvaudio);
void cx88_newstation(struct cx88_core *core)
{
core->audiomode_manual = UNSET;
core->last_change = jiffies;
}
+EXPORT_SYMBOL(cx88_newstation);
void cx88_get_stereo(struct cx88_core *core, struct v4l2_tuner *t)
{
- static const char * const m[] = { "stereo", "dual mono", "mono", "sap" };
- static const char * const p[] = { "no pilot", "pilot c1", "pilot c2", "?" };
+ static const char * const m[] = { "stereo", "dual mono",
+ "mono", "sap" };
+ static const char * const p[] = { "no pilot", "pilot c1",
+ "pilot c2", "?" };
u32 reg, mode, pilot;
reg = cx_read(AUD_STATUS);
@@ -869,15 +874,18 @@ void cx88_get_stereo(struct cx88_core *core, struct v4l2_tuner *t)
}
/* If software stereo detection is not supported... */
- if (UNSET == t->rxsubchans) {
+ if (t->rxsubchans == UNSET) {
t->rxsubchans = V4L2_TUNER_SUB_MONO;
- /* If the hardware itself detected stereo, also return
- stereo as an available subchannel */
- if (V4L2_TUNER_MODE_STEREO == t->audmode)
+ /*
+ * If the hardware itself detected stereo, also return
+ * stereo as an available subchannel
+ */
+ if (t->audmode == V4L2_TUNER_MODE_STEREO)
t->rxsubchans |= V4L2_TUNER_SUB_STEREO;
}
- return;
}
+EXPORT_SYMBOL(cx88_get_stereo);
+
void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual)
{
@@ -887,7 +895,7 @@ void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual)
if (manual) {
core->audiomode_manual = mode;
} else {
- if (UNSET != core->audiomode_manual)
+ if (core->audiomode_manual != UNSET)
return;
}
core->audiomode_current = mode;
@@ -915,7 +923,7 @@ void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual)
case WW_M:
case WW_I:
case WW_L:
- if (1 == core->use_nicam) {
+ if (core->use_nicam == 1) {
switch (mode) {
case V4L2_TUNER_MODE_MONO:
case V4L2_TUNER_MODE_LANG1:
@@ -933,7 +941,8 @@ void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual)
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 {
@@ -975,15 +984,14 @@ void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual)
break;
}
- if (UNSET != ctl) {
- dprintk("cx88_set_stereo: mask 0x%x, ctl 0x%x "
- "[status=0x%x,ctl=0x%x,vol=0x%x]\n",
+ if (ctl != UNSET) {
+ dprintk("cx88_set_stereo: mask 0x%x, ctl 0x%x [status=0x%x,ctl=0x%x,vol=0x%x]\n",
mask, ctl, cx_read(AUD_STATUS),
cx_read(AUD_CTL), cx_sread(SHADOW_AUD_VOL_CTL));
cx_andor(AUD_CTL, mask, ctl);
}
- return;
}
+EXPORT_SYMBOL(cx88_set_stereo);
int cx88_audio_thread(void *data)
{
@@ -1012,7 +1020,7 @@ int cx88_audio_thread(void *data)
memset(&t, 0, sizeof(t));
cx88_get_stereo(core, &t);
- if (UNSET != core->audiomode_manual)
+ if (core->audiomode_manual != UNSET)
/* manually set, don't do anything. */
continue;
@@ -1033,8 +1041,10 @@ int cx88_audio_thread(void *data)
case WW_FM:
case WW_I2SADC:
hw_autodetect:
- /* stereo autodetection is supported by hardware so
- we don't need to do it manually. Do nothing. */
+ /*
+ * stereo autodetection is supported by hardware so
+ * we don't need to do it manually. Do nothing.
+ */
break;
}
}
@@ -1042,11 +1052,4 @@ hw_autodetect:
dprintk("cx88: tvaudio thread exiting\n");
return 0;
}
-
-/* ----------------------------------------------------------- */
-
-EXPORT_SYMBOL(cx88_set_tvaudio);
-EXPORT_SYMBOL(cx88_newstation);
-EXPORT_SYMBOL(cx88_set_stereo);
-EXPORT_SYMBOL(cx88_get_stereo);
EXPORT_SYMBOL(cx88_audio_thread);
diff --git a/drivers/media/pci/cx88/cx88-vbi.c b/drivers/media/pci/cx88/cx88-vbi.c
index d3237cf8ffa3..2d0ef19e6d65 100644
--- a/drivers/media/pci/cx88/cx88-vbi.c
+++ b/drivers/media/pci/cx88/cx88-vbi.c
@@ -1,22 +1,26 @@
/*
*/
+
+#include "cx88.h"
+
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
-#include "cx88.h"
-
static unsigned int vbi_debug;
-module_param(vbi_debug,int,0644);
-MODULE_PARM_DESC(vbi_debug,"enable debug messages [vbi]");
+module_param(vbi_debug, int, 0644);
+MODULE_PARM_DESC(vbi_debug, "enable debug messages [vbi]");
-#define dprintk(level,fmt, arg...) if (vbi_debug >= level) \
- printk(KERN_DEBUG "%s: " fmt, dev->core->name , ## arg)
+#define dprintk(level, fmt, arg...) do { \
+ if (vbi_debug >= level) \
+ printk(KERN_DEBUG pr_fmt("%s: vbi:" fmt), \
+ __func__, ##arg); \
+} while (0)
/* ------------------------------------------------------------------ */
-int cx8800_vbi_fmt (struct file *file, void *priv,
- struct v4l2_format *f)
+int cx8800_vbi_fmt(struct file *file, void *priv,
+ struct v4l2_format *f)
{
struct cx8800_dev *dev = video_drvdata(file);
@@ -44,8 +48,8 @@ int cx8800_vbi_fmt (struct file *file, void *priv,
}
static int cx8800_start_vbi_dma(struct cx8800_dev *dev,
- struct cx88_dmaqueue *q,
- struct cx88_buffer *buf)
+ struct cx88_dmaqueue *q,
+ struct cx88_buffer *buf)
{
struct cx88_core *core = dev->core;
@@ -53,9 +57,9 @@ static int cx8800_start_vbi_dma(struct cx8800_dev *dev,
cx88_sram_channel_setup(dev->core, &cx88_sram_channels[SRAM_CH24],
VBI_LINE_LENGTH, buf->risc.dma);
- cx_write(MO_VBOS_CONTROL, ( (1 << 18) | // comb filter delay fixup
- (1 << 15) | // enable vbi capture
- (1 << 11) ));
+ cx_write(MO_VBOS_CONTROL, (1 << 18) | /* comb filter delay fixup */
+ (1 << 15) | /* enable vbi capture */
+ (1 << 11));
/* reset counter */
cx_write(MO_VBI_GPCNTRL, GP_COUNT_CONTROL_RESET);
@@ -66,10 +70,10 @@ static int cx8800_start_vbi_dma(struct cx8800_dev *dev,
cx_set(MO_VID_INTMSK, 0x0f0088);
/* enable capture */
- cx_set(VID_CAPTURE_CONTROL,0x18);
+ cx_set(VID_CAPTURE_CONTROL, 0x18);
/* start dma */
- cx_set(MO_DEV_CNTRL2, (1<<5));
+ cx_set(MO_DEV_CNTRL2, (1 << 5));
cx_set(MO_VID_DMACNTRL, 0x88);
return 0;
@@ -83,7 +87,7 @@ void cx8800_stop_vbi_dma(struct cx8800_dev *dev)
cx_clear(MO_VID_DMACNTRL, 0x88);
/* disable capture */
- cx_clear(VID_CAPTURE_CONTROL,0x18);
+ cx_clear(VID_CAPTURE_CONTROL, 0x18);
/* disable irqs */
cx_clear(MO_PCI_INTMSK, PCI_INT_VIDINT);
@@ -99,7 +103,7 @@ int cx8800_restart_vbi_queue(struct cx8800_dev *dev,
return 0;
buf = list_entry(q->active.next, struct cx88_buffer, list);
- dprintk(2,"restart_queue [%p/%d]: restart dma\n",
+ dprintk(2, "restart_queue [%p/%d]: restart dma\n",
buf, buf->vb.vb2_buf.index);
cx8800_start_vbi_dma(dev, q, buf);
return 0;
@@ -108,8 +112,8 @@ int cx8800_restart_vbi_queue(struct cx8800_dev *dev,
/* ------------------------------------------------------------------ */
static int queue_setup(struct vb2_queue *q,
- unsigned int *num_buffers, unsigned int *num_planes,
- unsigned int sizes[], struct device *alloc_devs[])
+ unsigned int *num_buffers, unsigned int *num_planes,
+ unsigned int sizes[], struct device *alloc_devs[])
{
struct cx8800_dev *dev = q->drv_priv;
@@ -121,7 +125,6 @@ static int queue_setup(struct vb2_queue *q,
return 0;
}
-
static int buffer_prepare(struct vb2_buffer *vb)
{
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
@@ -175,7 +178,7 @@ static void buffer_queue(struct vb2_buffer *vb)
if (list_empty(&q->active)) {
list_add_tail(&buf->list, &q->active);
cx8800_start_vbi_dma(dev, q, buf);
- dprintk(2,"[%p/%d] vbi_queue - first active\n",
+ dprintk(2, "[%p/%d] vbi_queue - first active\n",
buf, buf->vb.vb2_buf.index);
} else {
@@ -183,7 +186,7 @@ static void buffer_queue(struct vb2_buffer *vb)
prev = list_entry(q->active.prev, struct cx88_buffer, list);
list_add_tail(&buf->list, &q->active);
prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
- dprintk(2,"[%p/%d] buffer_queue - append to active\n",
+ dprintk(2, "[%p/%d] buffer_queue - append to active\n",
buf, buf->vb.vb2_buf.index);
}
}
diff --git a/drivers/media/pci/cx88/cx88-video.c b/drivers/media/pci/cx88/cx88-video.c
index d83eb3b10f54..c7d4e87ccb64 100644
--- a/drivers/media/pci/cx88/cx88-video.c
+++ b/drivers/media/pci/cx88/cx88-video.c
@@ -19,12 +19,10 @@
* 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 "cx88.h"
+
#include <linux/init.h>
#include <linux/list.h>
#include <linux/module.h>
@@ -37,7 +35,6 @@
#include <linux/kthread.h>
#include <asm/div64.h>
-#include "cx88.h"
#include <media/v4l2-common.h>
#include <media/v4l2-ioctl.h>
#include <media/v4l2-event.h>
@@ -58,20 +55,23 @@ module_param_array(video_nr, int, NULL, 0444);
module_param_array(vbi_nr, int, NULL, 0444);
module_param_array(radio_nr, int, NULL, 0444);
-MODULE_PARM_DESC(video_nr,"video device numbers");
-MODULE_PARM_DESC(vbi_nr,"vbi device numbers");
-MODULE_PARM_DESC(radio_nr,"radio device numbers");
+MODULE_PARM_DESC(video_nr, "video device numbers");
+MODULE_PARM_DESC(vbi_nr, "vbi device numbers");
+MODULE_PARM_DESC(radio_nr, "radio device numbers");
static unsigned int video_debug;
-module_param(video_debug,int,0644);
-MODULE_PARM_DESC(video_debug,"enable debug messages [video]");
+module_param(video_debug, int, 0644);
+MODULE_PARM_DESC(video_debug, "enable debug messages [video]");
static unsigned int irq_debug;
-module_param(irq_debug,int,0644);
-MODULE_PARM_DESC(irq_debug,"enable debug messages [IRQ handler]");
+module_param(irq_debug, int, 0644);
+MODULE_PARM_DESC(irq_debug, "enable debug messages [IRQ handler]");
-#define dprintk(level,fmt, arg...) if (video_debug >= level) \
- printk(KERN_DEBUG "%s/0: " fmt, core->name , ## arg)
+#define dprintk(level, fmt, arg...) do { \
+ if (video_debug >= level) \
+ printk(KERN_DEBUG pr_fmt("%s: video:" fmt), \
+ __func__, ##arg); \
+} while (0)
/* ------------------------------------------------------------------- */
/* static data */
@@ -83,55 +83,56 @@ static const struct cx8800_fmt formats[] = {
.cxformat = ColorFormatY8,
.depth = 8,
.flags = FORMAT_FLAGS_PACKED,
- },{
+ }, {
.name = "15 bpp RGB, le",
.fourcc = V4L2_PIX_FMT_RGB555,
.cxformat = ColorFormatRGB15,
.depth = 16,
.flags = FORMAT_FLAGS_PACKED,
- },{
+ }, {
.name = "15 bpp RGB, be",
.fourcc = V4L2_PIX_FMT_RGB555X,
.cxformat = ColorFormatRGB15 | ColorFormatBSWAP,
.depth = 16,
.flags = FORMAT_FLAGS_PACKED,
- },{
+ }, {
.name = "16 bpp RGB, le",
.fourcc = V4L2_PIX_FMT_RGB565,
.cxformat = ColorFormatRGB16,
.depth = 16,
.flags = FORMAT_FLAGS_PACKED,
- },{
+ }, {
.name = "16 bpp RGB, be",
.fourcc = V4L2_PIX_FMT_RGB565X,
.cxformat = ColorFormatRGB16 | ColorFormatBSWAP,
.depth = 16,
.flags = FORMAT_FLAGS_PACKED,
- },{
+ }, {
.name = "24 bpp RGB, le",
.fourcc = V4L2_PIX_FMT_BGR24,
.cxformat = ColorFormatRGB24,
.depth = 24,
.flags = FORMAT_FLAGS_PACKED,
- },{
+ }, {
.name = "32 bpp RGB, le",
.fourcc = V4L2_PIX_FMT_BGR32,
.cxformat = ColorFormatRGB32,
.depth = 32,
.flags = FORMAT_FLAGS_PACKED,
- },{
+ }, {
.name = "32 bpp RGB, be",
.fourcc = V4L2_PIX_FMT_RGB32,
- .cxformat = ColorFormatRGB32 | ColorFormatBSWAP | ColorFormatWSWAP,
+ .cxformat = ColorFormatRGB32 | ColorFormatBSWAP |
+ ColorFormatWSWAP,
.depth = 32,
.flags = FORMAT_FLAGS_PACKED,
- },{
+ }, {
.name = "4:2:2, packed, YUYV",
.fourcc = V4L2_PIX_FMT_YUYV,
.cxformat = ColorFormatYUY2,
.depth = 16,
.flags = FORMAT_FLAGS_PACKED,
- },{
+ }, {
.name = "4:2:2, packed, UYVY",
.fourcc = V4L2_PIX_FMT_UYVY,
.cxformat = ColorFormatYUY2 | ColorFormatBSWAP,
@@ -140,13 +141,13 @@ static const struct cx8800_fmt formats[] = {
},
};
-static const struct cx8800_fmt* format_by_fourcc(unsigned int fourcc)
+static const struct cx8800_fmt *format_by_fourcc(unsigned int fourcc)
{
unsigned int i;
for (i = 0; i < ARRAY_SIZE(formats); i++)
if (formats[i].fourcc == fourcc)
- return formats+i;
+ return formats + i;
return NULL;
}
@@ -180,7 +181,7 @@ static const struct cx88_ctrl cx8800_vid_ctls[] = {
.reg = MO_CONTR_BRIGHT,
.mask = 0x00ff,
.shift = 0,
- },{
+ }, {
.id = V4L2_CID_CONTRAST,
.minimum = 0,
.maximum = 0xff,
@@ -190,7 +191,7 @@ static const struct cx88_ctrl cx8800_vid_ctls[] = {
.reg = MO_CONTR_BRIGHT,
.mask = 0xff00,
.shift = 8,
- },{
+ }, {
.id = V4L2_CID_HUE,
.minimum = 0,
.maximum = 0xff,
@@ -200,7 +201,7 @@ static const struct cx88_ctrl cx8800_vid_ctls[] = {
.reg = MO_HUE,
.mask = 0x00ff,
.shift = 0,
- },{
+ }, {
/* strictly, this only describes only U saturation.
* V saturation is handled specially through code.
*/
@@ -220,8 +221,10 @@ static const struct cx88_ctrl cx8800_vid_ctls[] = {
.step = 1,
.default_value = 0x0,
.off = 0,
- /* NOTE: the value is converted and written to both even
- and odd registers in the code */
+ /*
+ * NOTE: the value is converted and written to both even
+ * and odd registers in the code
+ */
.reg = MO_FILTER_ODD,
.mask = 7 << 7,
.shift = 7,
@@ -265,7 +268,7 @@ static const struct cx88_ctrl cx8800_aud_ctls[] = {
.sreg = SHADOW_AUD_VOL_CTL,
.mask = (1 << 6),
.shift = 6,
- },{
+ }, {
.id = V4L2_CID_AUDIO_VOLUME,
.minimum = 0,
.maximum = 0x3f,
@@ -275,7 +278,7 @@ static const struct cx88_ctrl cx8800_aud_ctls[] = {
.sreg = SHADOW_AUD_VOL_CTL,
.mask = 0x3f,
.shift = 0,
- },{
+ }, {
.id = V4L2_CID_AUDIO_BALANCE,
.minimum = 0,
.maximum = 0x7f,
@@ -299,10 +302,10 @@ int cx88_video_mux(struct cx88_core *core, unsigned int input)
{
/* struct cx88_core *core = dev->core; */
- dprintk(1,"video_mux: %d [vmux=%d,gpio=0x%x,0x%x,0x%x,0x%x]\n",
+ dprintk(1, "video_mux: %d [vmux=%d,gpio=0x%x,0x%x,0x%x,0x%x]\n",
input, INPUT(input).vmux,
- INPUT(input).gpio0,INPUT(input).gpio1,
- INPUT(input).gpio2,INPUT(input).gpio3);
+ INPUT(input).gpio0, INPUT(input).gpio1,
+ INPUT(input).gpio2, INPUT(input).gpio3);
core->input = input;
cx_andor(MO_INPUT_FORMAT, 0x03 << 14, INPUT(input).vmux << 14);
cx_write(MO_GP3_IO, INPUT(input).gpio3);
@@ -325,19 +328,25 @@ int cx88_video_mux(struct cx88_core *core, unsigned int input)
break;
}
- /* if there are audioroutes defined, we have an external
- ADC to deal with audio */
+ /*
+ * if there are audioroutes defined, we have an external
+ * ADC to deal with audio
+ */
if (INPUT(input).audioroute) {
- /* The wm8775 module has the "2" route hardwired into
- the initialization. Some boards may use different
- routes for different inputs. HVR-1300 surely does */
+ /*
+ * The wm8775 module has the "2" route hardwired into
+ * the initialization. Some boards may use different
+ * routes for different inputs. HVR-1300 surely does
+ */
if (core->sd_wm8775) {
call_all(core, audio, s_routing,
INPUT(input).audioroute, 0, 0);
}
- /* cx2388's C-ADC is connected to the tuner only.
- When used with S-Video, that ADC is busy dealing with
- chroma, so an external must be used for baseband audio */
+ /*
+ * cx2388's C-ADC is connected to the tuner only.
+ * When used with S-Video, that ADC is busy dealing with
+ * chroma, so an external must be used for baseband audio
+ */
if (INPUT(input).type != CX88_VMUX_TELEVISION &&
INPUT(input).type != CX88_VMUX_CABLE) {
/* "I2S ADC mode" */
@@ -369,26 +378,27 @@ static int start_video_dma(struct cx8800_dev *dev,
cx_write(MO_COLOR_CTRL, dev->fmt->cxformat | ColorFormatGamma);
/* reset counter */
- cx_write(MO_VIDY_GPCNTRL,GP_COUNT_CONTROL_RESET);
+ cx_write(MO_VIDY_GPCNTRL, GP_COUNT_CONTROL_RESET);
q->count = 0;
/* enable irqs */
cx_set(MO_PCI_INTMSK, core->pci_irqmask | PCI_INT_VIDINT);
- /* Enables corresponding bits at PCI_INT_STAT:
- bits 0 to 4: video, audio, transport stream, VIP, Host
- bit 7: timer
- bits 8 and 9: DMA complete for: SRC, DST
- bits 10 and 11: BERR signal asserted for RISC: RD, WR
- bits 12 to 15: BERR signal asserted for: BRDG, SRC, DST, IPB
+ /*
+ * Enables corresponding bits at PCI_INT_STAT:
+ * bits 0 to 4: video, audio, transport stream, VIP, Host
+ * bit 7: timer
+ * bits 8 and 9: DMA complete for: SRC, DST
+ * bits 10 and 11: BERR signal asserted for RISC: RD, WR
+ * bits 12 to 15: BERR signal asserted for: BRDG, SRC, DST, IPB
*/
cx_set(MO_VID_INTMSK, 0x0f0011);
/* enable capture */
- cx_set(VID_CAPTURE_CONTROL,0x06);
+ cx_set(VID_CAPTURE_CONTROL, 0x06);
/* start dma */
- cx_set(MO_DEV_CNTRL2, (1<<5));
+ cx_set(MO_DEV_CNTRL2, (1 << 5));
cx_set(MO_VID_DMACNTRL, 0x11); /* Planar Y and packed FIFO and RISC enable */
return 0;
@@ -403,7 +413,7 @@ static int stop_video_dma(struct cx8800_dev *dev)
cx_clear(MO_VID_DMACNTRL, 0x11);
/* disable capture */
- cx_clear(VID_CAPTURE_CONTROL,0x06);
+ cx_clear(VID_CAPTURE_CONTROL, 0x06);
/* disable irqs */
cx_clear(MO_PCI_INTMSK, PCI_INT_VIDINT);
@@ -414,12 +424,11 @@ static int stop_video_dma(struct cx8800_dev *dev)
static int restart_video_queue(struct cx8800_dev *dev,
struct cx88_dmaqueue *q)
{
- struct cx88_core *core = dev->core;
struct cx88_buffer *buf;
if (!list_empty(&q->active)) {
buf = list_entry(q->active.next, struct cx88_buffer, list);
- dprintk(2,"restart_queue [%p/%d]: restart dma\n",
+ dprintk(2, "restart_queue [%p/%d]: restart dma\n",
buf, buf->vb.vb2_buf.index);
start_video_dma(dev, q, buf);
}
@@ -430,8 +439,8 @@ static int restart_video_queue(struct cx8800_dev *dev,
/* ------------------------------------------------------------------ */
static int queue_setup(struct vb2_queue *q,
- unsigned int *num_buffers, unsigned int *num_planes,
- unsigned int sizes[], struct device *alloc_devs[])
+ unsigned int *num_buffers, unsigned int *num_planes,
+ unsigned int sizes[], struct device *alloc_devs[])
{
struct cx8800_dev *dev = q->drv_priv;
struct cx88_core *core = dev->core;
@@ -488,7 +497,8 @@ static int buffer_prepare(struct vb2_buffer *vb)
core->height >> 1);
break;
}
- dprintk(2,"[%p/%d] buffer_prepare - %dx%d %dbpp \"%s\" - dma=0x%08lx\n",
+ dprintk(2,
+ "[%p/%d] buffer_prepare - %dx%d %dbpp \"%s\" - dma=0x%08lx\n",
buf, buf->vb.vb2_buf.index,
core->width, core->height, dev->fmt->depth, dev->fmt->name,
(unsigned long)buf->risc.dma);
@@ -513,7 +523,6 @@ static void buffer_queue(struct vb2_buffer *vb)
struct cx8800_dev *dev = vb->vb2_queue->drv_priv;
struct cx88_buffer *buf = container_of(vbuf, struct cx88_buffer, vb);
struct cx88_buffer *prev;
- struct cx88_core *core = dev->core;
struct cx88_dmaqueue *q = &dev->vidq;
/* add jump to start */
@@ -523,7 +532,7 @@ static void buffer_queue(struct vb2_buffer *vb)
if (list_empty(&q->active)) {
list_add_tail(&buf->list, &q->active);
- dprintk(2,"[%p/%d] buffer_queue - first active\n",
+ dprintk(2, "[%p/%d] buffer_queue - first active\n",
buf, buf->vb.vb2_buf.index);
} else {
@@ -596,7 +605,7 @@ static int radio_open(struct file *file)
if (core->board.radio.audioroute) {
if (core->sd_wm8775) {
call_all(core, audio, s_routing,
- core->board.radio.audioroute, 0, 0);
+ core->board.radio.audioroute, 0, 0);
}
/* "I2S ADC mode" */
core->tvaudio = WW_I2SADC;
@@ -650,9 +659,10 @@ static int cx8800_s_vid_ctrl(struct v4l2_ctrl *ctrl)
value = ((ctrl->val - cc->off) << cc->shift) & cc->mask;
break;
}
- dprintk(1, "set_control id=0x%X(%s) ctrl=0x%02x, reg=0x%02x val=0x%02x (mask 0x%02x)%s\n",
- ctrl->id, ctrl->name, ctrl->val, cc->reg, value,
- mask, cc->sreg ? " [shadowed]" : "");
+ dprintk(1,
+ "set_control id=0x%X(%s) ctrl=0x%02x, reg=0x%02x val=0x%02x (mask 0x%02x)%s\n",
+ ctrl->id, ctrl->name, ctrl->val, cc->reg, value,
+ mask, cc->sreg ? " [shadowed]" : "");
if (cc->sreg)
cx_sandor(cc->sreg, cc->reg, mask, value);
else
@@ -665,7 +675,7 @@ static int cx8800_s_aud_ctrl(struct v4l2_ctrl *ctrl)
struct cx88_core *core =
container_of(ctrl->handler, struct cx88_core, audio_hdl);
const struct cx88_ctrl *cc = ctrl->priv;
- u32 value,mask;
+ u32 value, mask;
/* Pass changes onto any WM8775 */
if (core->sd_wm8775) {
@@ -688,7 +698,8 @@ static int cx8800_s_aud_ctrl(struct v4l2_ctrl *ctrl)
mask = cc->mask;
switch (ctrl->id) {
case V4L2_CID_AUDIO_BALANCE:
- value = (ctrl->val < 0x40) ? (0x7f - ctrl->val) : (ctrl->val - 0x40);
+ value = (ctrl->val < 0x40) ?
+ (0x7f - ctrl->val) : (ctrl->val - 0x40);
break;
case V4L2_CID_AUDIO_VOLUME:
value = 0x3f - (ctrl->val & 0x3f);
@@ -697,9 +708,10 @@ static int cx8800_s_aud_ctrl(struct v4l2_ctrl *ctrl)
value = ((ctrl->val - cc->off) << cc->shift) & cc->mask;
break;
}
- dprintk(1,"set_control id=0x%X(%s) ctrl=0x%02x, reg=0x%02x val=0x%02x (mask 0x%02x)%s\n",
- ctrl->id, ctrl->name, ctrl->val, cc->reg, value,
- mask, cc->sreg ? " [shadowed]" : "");
+ dprintk(1,
+ "set_control id=0x%X(%s) ctrl=0x%02x, reg=0x%02x val=0x%02x (mask 0x%02x)%s\n",
+ ctrl->id, ctrl->name, ctrl->val, cc->reg, value,
+ mask, cc->sreg ? " [shadowed]" : "");
if (cc->sreg)
cx_sandor(cc->sreg, cc->reg, mask, value);
else
@@ -711,7 +723,7 @@ static int cx8800_s_aud_ctrl(struct v4l2_ctrl *ctrl)
/* VIDEO IOCTLS */
static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,
- struct v4l2_format *f)
+ struct v4l2_format *f)
{
struct cx8800_dev *dev = video_drvdata(file);
struct cx88_core *core = dev->core;
@@ -729,7 +741,7 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,
}
static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
- struct v4l2_format *f)
+ struct v4l2_format *f)
{
struct cx8800_dev *dev = video_drvdata(file);
struct cx88_core *core = dev->core;
@@ -738,7 +750,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
unsigned int maxw, maxh;
fmt = format_by_fourcc(f->fmt.pix.pixelformat);
- if (NULL == fmt)
+ if (!fmt)
return -EINVAL;
maxw = norm_maxw(core->tvnorm);
@@ -775,13 +787,13 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
}
static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
- struct v4l2_format *f)
+ struct v4l2_format *f)
{
struct cx8800_dev *dev = video_drvdata(file);
struct cx88_core *core = dev->core;
- int err = vidioc_try_fmt_vid_cap (file,priv,f);
+ int err = vidioc_try_fmt_vid_cap(file, priv, f);
- if (0 != err)
+ if (err != 0)
return err;
if (vb2_is_busy(&dev->vb2_vidq) || vb2_is_busy(&dev->vb2_vbiq))
return -EBUSY;
@@ -795,13 +807,13 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
}
void cx88_querycap(struct file *file, struct cx88_core *core,
- struct v4l2_capability *cap)
+ struct v4l2_capability *cap)
{
struct video_device *vdev = video_devdata(file);
strlcpy(cap->card, core->board.name, sizeof(cap->card));
cap->device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING;
- if (UNSET != core->board.tuner_type)
+ if (core->board.tuner_type != UNSET)
cap->device_caps |= V4L2_CAP_TUNER;
switch (vdev->vfl_type) {
case VFL_TYPE_RADIO:
@@ -822,7 +834,7 @@ void cx88_querycap(struct file *file, struct cx88_core *core,
EXPORT_SYMBOL(cx88_querycap);
static int vidioc_querycap(struct file *file, void *priv,
- struct v4l2_capability *cap)
+ struct v4l2_capability *cap)
{
struct cx8800_dev *dev = video_drvdata(file);
struct cx88_core *core = dev->core;
@@ -833,13 +845,13 @@ static int vidioc_querycap(struct file *file, void *priv,
return 0;
}
-static int vidioc_enum_fmt_vid_cap (struct file *file, void *priv,
- struct v4l2_fmtdesc *f)
+static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
+ struct v4l2_fmtdesc *f)
{
if (unlikely(f->index >= ARRAY_SIZE(formats)))
return -EINVAL;
- strlcpy(f->description,formats[f->index].name,sizeof(f->description));
+ strlcpy(f->description, formats[f->index].name, sizeof(f->description));
f->pixelformat = formats[f->index].fourcc;
return 0;
@@ -863,45 +875,46 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id tvnorms)
}
/* only one input in this sample driver */
-int cx88_enum_input (struct cx88_core *core,struct v4l2_input *i)
+int cx88_enum_input(struct cx88_core *core, struct v4l2_input *i)
{
static const char * const iname[] = {
- [ CX88_VMUX_COMPOSITE1 ] = "Composite1",
- [ CX88_VMUX_COMPOSITE2 ] = "Composite2",
- [ CX88_VMUX_COMPOSITE3 ] = "Composite3",
- [ CX88_VMUX_COMPOSITE4 ] = "Composite4",
- [ CX88_VMUX_SVIDEO ] = "S-Video",
- [ CX88_VMUX_TELEVISION ] = "Television",
- [ CX88_VMUX_CABLE ] = "Cable TV",
- [ CX88_VMUX_DVB ] = "DVB",
- [ CX88_VMUX_DEBUG ] = "for debug only",
+ [CX88_VMUX_COMPOSITE1] = "Composite1",
+ [CX88_VMUX_COMPOSITE2] = "Composite2",
+ [CX88_VMUX_COMPOSITE3] = "Composite3",
+ [CX88_VMUX_COMPOSITE4] = "Composite4",
+ [CX88_VMUX_SVIDEO] = "S-Video",
+ [CX88_VMUX_TELEVISION] = "Television",
+ [CX88_VMUX_CABLE] = "Cable TV",
+ [CX88_VMUX_DVB] = "DVB",
+ [CX88_VMUX_DEBUG] = "for debug only",
};
unsigned int n = i->index;
if (n >= 4)
return -EINVAL;
- if (0 == INPUT(n).type)
+ if (!INPUT(n).type)
return -EINVAL;
i->type = V4L2_INPUT_TYPE_CAMERA;
- strcpy(i->name,iname[INPUT(n).type]);
- if ((CX88_VMUX_TELEVISION == INPUT(n).type) ||
- (CX88_VMUX_CABLE == INPUT(n).type)) {
+ strcpy(i->name, iname[INPUT(n).type]);
+ if ((INPUT(n).type == CX88_VMUX_TELEVISION) ||
+ (INPUT(n).type == CX88_VMUX_CABLE))
i->type = V4L2_INPUT_TYPE_TUNER;
- }
+
i->std = CX88_NORMS;
return 0;
}
EXPORT_SYMBOL(cx88_enum_input);
-static int vidioc_enum_input (struct file *file, void *priv,
- struct v4l2_input *i)
+static int vidioc_enum_input(struct file *file, void *priv,
+ struct v4l2_input *i)
{
struct cx8800_dev *dev = video_drvdata(file);
struct cx88_core *core = dev->core;
- return cx88_enum_input (core,i);
+
+ return cx88_enum_input(core, i);
}
-static int vidioc_g_input (struct file *file, void *priv, unsigned int *i)
+static int vidioc_g_input(struct file *file, void *priv, unsigned int *i)
{
struct cx8800_dev *dev = video_drvdata(file);
struct cx88_core *core = dev->core;
@@ -910,31 +923,31 @@ static int vidioc_g_input (struct file *file, void *priv, unsigned int *i)
return 0;
}
-static int vidioc_s_input (struct file *file, void *priv, unsigned int i)
+static int vidioc_s_input(struct file *file, void *priv, unsigned int i)
{
struct cx8800_dev *dev = video_drvdata(file);
struct cx88_core *core = dev->core;
if (i >= 4)
return -EINVAL;
- if (0 == INPUT(i).type)
+ if (!INPUT(i).type)
return -EINVAL;
cx88_newstation(core);
- cx88_video_mux(core,i);
+ cx88_video_mux(core, i);
return 0;
}
-static int vidioc_g_tuner (struct file *file, void *priv,
- struct v4l2_tuner *t)
+static int vidioc_g_tuner(struct file *file, void *priv,
+ struct v4l2_tuner *t)
{
struct cx8800_dev *dev = video_drvdata(file);
struct cx88_core *core = dev->core;
u32 reg;
- if (unlikely(UNSET == core->board.tuner_type))
+ if (unlikely(core->board.tuner_type == UNSET))
return -EINVAL;
- if (0 != t->index)
+ if (t->index != 0)
return -EINVAL;
strcpy(t->name, "Television");
@@ -942,34 +955,34 @@ static int vidioc_g_tuner (struct file *file, void *priv,
t->rangehigh = 0xffffffffUL;
call_all(core, tuner, g_tuner, t);
- cx88_get_stereo(core ,t);
+ 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;
}
-static int vidioc_s_tuner (struct file *file, void *priv,
- const struct v4l2_tuner *t)
+static int vidioc_s_tuner(struct file *file, void *priv,
+ const struct v4l2_tuner *t)
{
struct cx8800_dev *dev = video_drvdata(file);
struct cx88_core *core = dev->core;
- if (UNSET == core->board.tuner_type)
+ if (core->board.tuner_type == UNSET)
return -EINVAL;
- if (0 != t->index)
+ if (t->index != 0)
return -EINVAL;
cx88_set_stereo(core, t->audmode, 1);
return 0;
}
-static int vidioc_g_frequency (struct file *file, void *priv,
- struct v4l2_frequency *f)
+static int vidioc_g_frequency(struct file *file, void *priv,
+ struct v4l2_frequency *f)
{
struct cx8800_dev *dev = video_drvdata(file);
struct cx88_core *core = dev->core;
- if (unlikely(UNSET == core->board.tuner_type))
+ if (unlikely(core->board.tuner_type == UNSET))
return -EINVAL;
if (f->tuner)
return -EINVAL;
@@ -981,12 +994,12 @@ static int vidioc_g_frequency (struct file *file, void *priv,
return 0;
}
-int cx88_set_freq (struct cx88_core *core,
- const struct v4l2_frequency *f)
+int cx88_set_freq(struct cx88_core *core,
+ const struct v4l2_frequency *f)
{
struct v4l2_frequency new_freq = *f;
- if (unlikely(UNSET == core->board.tuner_type))
+ if (unlikely(core->board.tuner_type == UNSET))
return -EINVAL;
if (unlikely(f->tuner != 0))
return -EINVAL;
@@ -997,15 +1010,15 @@ int cx88_set_freq (struct cx88_core *core,
core->freq = new_freq.frequency;
/* When changing channels it is required to reset TVAUDIO */
- msleep (10);
+ usleep_range(10000, 20000);
cx88_set_tvaudio(core);
return 0;
}
EXPORT_SYMBOL(cx88_set_freq);
-static int vidioc_s_frequency (struct file *file, void *priv,
- const struct v4l2_frequency *f)
+static int vidioc_s_frequency(struct file *file, void *priv,
+ const struct v4l2_frequency *f)
{
struct cx8800_dev *dev = video_drvdata(file);
struct cx88_core *core = dev->core;
@@ -1014,8 +1027,8 @@ static int vidioc_s_frequency (struct file *file, void *priv,
}
#ifdef CONFIG_VIDEO_ADV_DEBUG
-static int vidioc_g_register (struct file *file, void *fh,
- struct v4l2_dbg_register *reg)
+static int vidioc_g_register(struct file *file, void *fh,
+ struct v4l2_dbg_register *reg)
{
struct cx8800_dev *dev = video_drvdata(file);
struct cx88_core *core = dev->core;
@@ -1026,8 +1039,8 @@ static int vidioc_g_register (struct file *file, void *fh,
return 0;
}
-static int vidioc_s_register (struct file *file, void *fh,
- const struct v4l2_dbg_register *reg)
+static int vidioc_s_register(struct file *file, void *fh,
+ const struct v4l2_dbg_register *reg)
{
struct cx8800_dev *dev = video_drvdata(file);
struct cx88_core *core = dev->core;
@@ -1041,8 +1054,8 @@ static int vidioc_s_register (struct file *file, void *fh,
/* RADIO ESPECIFIC IOCTLS */
/* ----------------------------------------------------------- */
-static int radio_g_tuner (struct file *file, void *priv,
- struct v4l2_tuner *t)
+static int radio_g_tuner(struct file *file, void *priv,
+ struct v4l2_tuner *t)
{
struct cx8800_dev *dev = video_drvdata(file);
struct cx88_core *core = dev->core;
@@ -1056,13 +1069,13 @@ static int radio_g_tuner (struct file *file, void *priv,
return 0;
}
-static int radio_s_tuner (struct file *file, void *priv,
- const struct v4l2_tuner *t)
+static int radio_s_tuner(struct file *file, void *priv,
+ const struct v4l2_tuner *t)
{
struct cx8800_dev *dev = video_drvdata(file);
struct cx88_core *core = dev->core;
- if (0 != t->index)
+ if (t->index != 0)
return -EINVAL;
call_all(core, tuner, s_tuner, t);
@@ -1090,13 +1103,13 @@ static void cx8800_vid_irq(struct cx8800_dev *dev)
return;
cx_write(MO_VID_INTSTAT, status);
if (irq_debug || (status & mask & ~0xff))
- cx88_print_irqbits(core->name, "irq vid",
+ cx88_print_irqbits("irq vid",
cx88_vid_irqs, ARRAY_SIZE(cx88_vid_irqs),
status, mask);
/* risc op code error */
if (status & (1 << 16)) {
- printk(KERN_WARNING "%s/0: video risc op code error\n",core->name);
+ pr_warn("video risc op code error\n");
cx_clear(MO_VID_DMACNTRL, 0x11);
cx_clear(VID_CAPTURE_CONTROL, 0x06);
cx88_sram_channel_dump(core, &cx88_sram_channels[SRAM_CH21]);
@@ -1129,20 +1142,19 @@ static irqreturn_t cx8800_irq(int irq, void *dev_id)
for (loop = 0; loop < 10; loop++) {
status = cx_read(MO_PCI_INTSTAT) &
(core->pci_irqmask | PCI_INT_VIDINT);
- if (0 == status)
+ if (status == 0)
goto out;
cx_write(MO_PCI_INTSTAT, status);
handled = 1;
if (status & core->pci_irqmask)
- cx88_core_irq(core,status);
+ cx88_core_irq(core, status);
if (status & PCI_INT_VIDINT)
cx8800_vid_irq(dev);
}
- if (10 == loop) {
- printk(KERN_WARNING "%s/0: irq loop -- clearing mask\n",
- core->name);
- cx_write(MO_PCI_INTMSK,0);
+ if (loop == 10) {
+ pr_warn("irq loop -- clearing mask\n");
+ cx_write(MO_PCI_INTMSK, 0);
}
out:
@@ -1152,8 +1164,7 @@ static irqreturn_t cx8800_irq(int irq, void *dev_id)
/* ----------------------------------------------------------- */
/* exported stuff */
-static const struct v4l2_file_operations video_fops =
-{
+static const struct v4l2_file_operations video_fops = {
.owner = THIS_MODULE,
.open = v4l2_fh_open,
.release = vb2_fop_release,
@@ -1195,7 +1206,7 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = {
static const struct video_device cx8800_video_template = {
.name = "cx8800-video",
.fops = &video_fops,
- .ioctl_ops = &video_ioctl_ops,
+ .ioctl_ops = &video_ioctl_ops,
.tvnorms = CX88_NORMS,
};
@@ -1232,8 +1243,7 @@ static const struct video_device cx8800_vbi_template = {
.tvnorms = CX88_NORMS,
};
-static const struct v4l2_file_operations radio_fops =
-{
+static const struct v4l2_file_operations radio_fops = {
.owner = THIS_MODULE,
.open = radio_open,
.poll = v4l2_ctrl_poll,
@@ -1258,7 +1268,7 @@ static const struct v4l2_ioctl_ops radio_ioctl_ops = {
static const struct video_device cx8800_radio_template = {
.name = "cx8800-radio",
.fops = &radio_fops,
- .ioctl_ops = &radio_ioctl_ops,
+ .ioctl_ops = &radio_ioctl_ops,
};
static const struct v4l2_ctrl_ops cx8800_ctrl_vid_ops = {
@@ -1287,8 +1297,8 @@ static int cx8800_initdev(struct pci_dev *pci_dev,
int err;
int i;
- dev = kzalloc(sizeof(*dev),GFP_KERNEL);
- if (NULL == dev)
+ dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+ if (!dev)
return -ENOMEM;
/* pci init */
@@ -1298,7 +1308,7 @@ static int cx8800_initdev(struct pci_dev *pci_dev,
goto fail_free;
}
core = cx88_core_get(dev->pci);
- if (NULL == core) {
+ if (!core) {
err = -EINVAL;
goto fail_free;
}
@@ -1307,15 +1317,15 @@ static int cx8800_initdev(struct pci_dev *pci_dev,
/* print pci info */
dev->pci_rev = pci_dev->revision;
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%llx\n", core->name,
- pci_name(pci_dev), dev->pci_rev, pci_dev->irq,
- dev->pci_lat,(unsigned long long)pci_resource_start(pci_dev,0));
+ pr_info("found at %s, rev: %d, irq: %d, latency: %d, mmio: 0x%llx\n",
+ pci_name(pci_dev), dev->pci_rev, pci_dev->irq,
+ dev->pci_lat,
+ (unsigned long long)pci_resource_start(pci_dev, 0));
pci_set_master(pci_dev);
- err = pci_set_dma_mask(pci_dev,DMA_BIT_MASK(32));
+ err = pci_set_dma_mask(pci_dev, DMA_BIT_MASK(32));
if (err) {
- printk("%s/0: Oops: no 32bit PCI DMA ???\n",core->name);
+ pr_err("Oops: no 32bit PCI DMA ???\n");
goto fail_core;
}
@@ -1332,8 +1342,7 @@ static int cx8800_initdev(struct pci_dev *pci_dev,
err = request_irq(pci_dev->irq, cx8800_irq,
IRQF_SHARED, core->name, dev);
if (err < 0) {
- printk(KERN_ERR "%s/0: can't get IRQ %d\n",
- core->name,pci_dev->irq);
+ pr_err("can't get IRQ %d\n", pci_dev->irq);
goto fail_core;
}
cx_set(MO_PCI_INTMSK, core->pci_irqmask);
@@ -1343,8 +1352,9 @@ static int cx8800_initdev(struct pci_dev *pci_dev,
struct v4l2_ctrl *vc;
vc = v4l2_ctrl_new_std(&core->audio_hdl, &cx8800_ctrl_aud_ops,
- cc->id, cc->minimum, cc->maximum, cc->step, cc->default_value);
- if (vc == NULL) {
+ cc->id, cc->minimum, cc->maximum,
+ cc->step, cc->default_value);
+ if (!vc) {
err = core->audio_hdl.error;
goto fail_core;
}
@@ -1356,8 +1366,9 @@ static int cx8800_initdev(struct pci_dev *pci_dev,
struct v4l2_ctrl *vc;
vc = v4l2_ctrl_new_std(&core->video_hdl, &cx8800_ctrl_vid_ops,
- cc->id, cc->minimum, cc->maximum, cc->step, cc->default_value);
- if (vc == NULL) {
+ cc->id, cc->minimum, cc->maximum,
+ cc->step, cc->default_value);
+ if (!vc) {
err = core->video_hdl.error;
goto fail_core;
}
@@ -1383,18 +1394,20 @@ static int cx8800_initdev(struct pci_dev *pci_dev,
core->wm8775_data.is_nova_s = false;
sd = v4l2_i2c_new_subdev_board(&core->v4l2_dev, &core->i2c_adap,
- &wm8775_info, NULL);
- if (sd != NULL) {
+ &wm8775_info, NULL);
+ if (sd) {
core->sd_wm8775 = sd;
sd->grp_id = WM8775_GID;
}
}
if (core->board.audio_chip == CX88_AUDIO_TVAUDIO) {
- /* This probes for a tda9874 as is used on some
- Pixelview Ultra boards. */
+ /*
+ * This probes for a tda9874 as is used on some
+ * Pixelview Ultra boards.
+ */
v4l2_i2c_new_subdev(&core->v4l2_dev, &core->i2c_adap,
- "tvaudio", 0, I2C_ADDRS(0xb0 >> 1));
+ "tvaudio", 0, I2C_ADDRS(0xb0 >> 1));
}
switch (core->boardnr) {
@@ -1470,12 +1483,11 @@ static int cx8800_initdev(struct pci_dev *pci_dev,
err = video_register_device(&dev->video_dev, VFL_TYPE_GRABBER,
video_nr[core->nr]);
if (err < 0) {
- printk(KERN_ERR "%s/0: can't register video device\n",
- core->name);
+ pr_err("can't register video device\n");
goto fail_unreg;
}
- printk(KERN_INFO "%s/0: registered device %s [v4l2]\n",
- core->name, video_device_node_name(&dev->video_dev));
+ pr_info("registered device %s [v4l2]\n",
+ video_device_node_name(&dev->video_dev));
cx88_vdev_init(core, dev->pci, &dev->vbi_dev,
&cx8800_vbi_template, "vbi");
@@ -1484,12 +1496,11 @@ static int cx8800_initdev(struct pci_dev *pci_dev,
err = video_register_device(&dev->vbi_dev, VFL_TYPE_VBI,
vbi_nr[core->nr]);
if (err < 0) {
- printk(KERN_ERR "%s/0: can't register vbi device\n",
- core->name);
+ pr_err("can't register vbi device\n");
goto fail_unreg;
}
- printk(KERN_INFO "%s/0: registered device %s\n",
- core->name, video_device_node_name(&dev->vbi_dev));
+ pr_info("registered device %s\n",
+ video_device_node_name(&dev->vbi_dev));
if (core->board.radio.type == CX88_RADIO) {
cx88_vdev_init(core, dev->pci, &dev->radio_dev,
@@ -1499,21 +1510,21 @@ static int cx8800_initdev(struct pci_dev *pci_dev,
err = video_register_device(&dev->radio_dev, VFL_TYPE_RADIO,
radio_nr[core->nr]);
if (err < 0) {
- printk(KERN_ERR "%s/0: can't register radio device\n",
- core->name);
+ pr_err("can't register radio device\n");
goto fail_unreg;
}
- printk(KERN_INFO "%s/0: registered device %s\n",
- core->name, video_device_node_name(&dev->radio_dev));
+ pr_info("registered device %s\n",
+ video_device_node_name(&dev->radio_dev));
}
/* start tvaudio thread */
if (core->board.tuner_type != UNSET) {
- core->kthread = kthread_run(cx88_audio_thread, core, "cx88 tvaudio");
+ core->kthread = kthread_run(cx88_audio_thread,
+ core, "cx88 tvaudio");
if (IS_ERR(core->kthread)) {
err = PTR_ERR(core->kthread);
- printk(KERN_ERR "%s/0: failed to create cx88 audio thread, err=%d\n",
- core->name, err);
+ pr_err("failed to create cx88 audio thread, err=%d\n",
+ err);
}
}
mutex_unlock(&core->lock);
@@ -1526,7 +1537,7 @@ fail_unreg:
mutex_unlock(&core->lock);
fail_core:
core->v4ldev = NULL;
- cx88_core_put(core,dev->pci);
+ cx88_core_put(core, dev->pci);
fail_free:
kfree(dev);
return err;
@@ -1557,7 +1568,7 @@ static void cx8800_finidev(struct pci_dev *pci_dev)
core->v4ldev = NULL;
/* free memory */
- cx88_core_put(core,dev->pci);
+ cx88_core_put(core, dev->pci);
kfree(dev);
}
@@ -1571,11 +1582,11 @@ static int cx8800_suspend(struct pci_dev *pci_dev, pm_message_t state)
/* stop video+vbi capture */
spin_lock_irqsave(&dev->slock, flags);
if (!list_empty(&dev->vidq.active)) {
- printk("%s/0: suspend video\n", core->name);
+ pr_info("suspend video\n");
stop_video_dma(dev);
}
if (!list_empty(&dev->vbiq.active)) {
- printk("%s/0: suspend vbi\n", core->name);
+ pr_info("suspend vbi\n");
cx8800_stop_vbi_dma(dev);
}
spin_unlock_irqrestore(&dev->slock, flags);
@@ -1586,7 +1597,8 @@ static int cx8800_suspend(struct pci_dev *pci_dev, pm_message_t state)
cx88_shutdown(core);
pci_save_state(pci_dev);
- if (0 != pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state))) {
+ if (pci_set_power_state(pci_dev,
+ pci_choose_state(pci_dev, state)) != 0) {
pci_disable_device(pci_dev);
dev->state.disabled = 1;
}
@@ -1601,18 +1613,17 @@ static int cx8800_resume(struct pci_dev *pci_dev)
int err;
if (dev->state.disabled) {
- err=pci_enable_device(pci_dev);
+ err = pci_enable_device(pci_dev);
if (err) {
- printk(KERN_ERR "%s/0: can't enable device\n",
- core->name);
+ pr_err("can't enable device\n");
return err;
}
dev->state.disabled = 0;
}
- err= pci_set_power_state(pci_dev, PCI_D0);
+ err = pci_set_power_state(pci_dev, PCI_D0);
if (err) {
- printk(KERN_ERR "%s/0: can't set power state\n", core->name);
+ pr_err("can't set power state\n");
pci_disable_device(pci_dev);
dev->state.disabled = 1;
@@ -1630,12 +1641,12 @@ static int cx8800_resume(struct pci_dev *pci_dev)
/* restart video+vbi capture */
spin_lock_irqsave(&dev->slock, flags);
if (!list_empty(&dev->vidq.active)) {
- printk("%s/0: resume video\n", core->name);
- restart_video_queue(dev,&dev->vidq);
+ pr_info("resume video\n");
+ restart_video_queue(dev, &dev->vidq);
}
if (!list_empty(&dev->vbiq.active)) {
- printk("%s/0: resume vbi\n", core->name);
- cx8800_restart_vbi_queue(dev,&dev->vbiq);
+ pr_info("resume vbi\n");
+ cx8800_restart_vbi_queue(dev, &dev->vbiq);
}
spin_unlock_irqrestore(&dev->slock, flags);
@@ -1651,7 +1662,7 @@ static const struct pci_device_id cx8800_pci_tbl[] = {
.device = 0x8800,
.subvendor = PCI_ANY_ID,
.subdevice = PCI_ANY_ID,
- },{
+ }, {
/* --- end of list --- */
}
};
diff --git a/drivers/media/pci/cx88/cx88-vp3054-i2c.c b/drivers/media/pci/cx88/cx88-vp3054-i2c.c
index deede6e25d94..92876de3841c 100644
--- a/drivers/media/pci/cx88/cx88-vp3054-i2c.c
+++ b/drivers/media/pci/cx88/cx88-vp3054-i2c.c
@@ -1,35 +1,28 @@
/*
+ * cx88-vp3054-i2c.c -- support for the secondary I2C bus of the
+ * DNTV Live! DVB-T Pro (VP-3054), wired as:
+ * GPIO[0] -> SCL, GPIO[1] -> SDA
+ *
+ * (c) 2005 Chris Pascoe <c.pascoe@itee.uq.edu.au>
+ *
+ * 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.
+ */
- cx88-vp3054-i2c.c -- support for the secondary I2C bus of the
- DNTV Live! DVB-T Pro (VP-3054), wired as:
- GPIO[0] -> SCL, GPIO[1] -> SDA
-
- (c) 2005 Chris Pascoe <c.pascoe@itee.uq.edu.au>
-
- 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 "cx88.h"
+#include "cx88-vp3054-i2c.h"
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/init.h>
-
-#include <asm/io.h>
-
-#include "cx88.h"
-#include "cx88-vp3054-i2c.h"
+#include <linux/io.h>
MODULE_DESCRIPTION("driver for cx2388x VP3054 design");
MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>");
@@ -114,7 +107,7 @@ int vp3054_i2c_probe(struct cx8802_dev *dev)
return 0;
vp3054_i2c = kzalloc(sizeof(*vp3054_i2c), GFP_KERNEL);
- if (vp3054_i2c == NULL)
+ if (!vp3054_i2c)
return -ENOMEM;
dev->vp3054 = vp3054_i2c;
@@ -128,12 +121,12 @@ int vp3054_i2c_probe(struct cx8802_dev *dev)
i2c_set_adapdata(&vp3054_i2c->adap, dev);
vp3054_i2c->adap.algo_data = &vp3054_i2c->algo;
- vp3054_bit_setscl(dev,1);
- vp3054_bit_setsda(dev,1);
+ vp3054_bit_setscl(dev, 1);
+ vp3054_bit_setsda(dev, 1);
rc = i2c_bit_add_bus(&vp3054_i2c->adap);
- if (0 != rc) {
- printk("%s: vp3054_i2c register FAILED\n", core->name);
+ if (rc != 0) {
+ pr_err("vp3054_i2c register FAILED\n");
kfree(dev->vp3054);
dev->vp3054 = NULL;
@@ -141,18 +134,17 @@ int vp3054_i2c_probe(struct cx8802_dev *dev)
return rc;
}
+EXPORT_SYMBOL(vp3054_i2c_probe);
void vp3054_i2c_remove(struct cx8802_dev *dev)
{
struct vp3054_i2c_state *vp3054_i2c = dev->vp3054;
- if (vp3054_i2c == NULL ||
+ if (!vp3054_i2c ||
dev->core->boardnr != CX88_BOARD_DNTV_LIVE_DVB_T_PRO)
return;
i2c_del_adapter(&vp3054_i2c->adap);
kfree(vp3054_i2c);
}
-
-EXPORT_SYMBOL(vp3054_i2c_probe);
EXPORT_SYMBOL(vp3054_i2c_remove);
diff --git a/drivers/media/pci/cx88/cx88-vp3054-i2c.h b/drivers/media/pci/cx88/cx88-vp3054-i2c.h
index 95d0c60a35e1..ec19bea8f1e2 100644
--- a/drivers/media/pci/cx88/cx88-vp3054-i2c.h
+++ b/drivers/media/pci/cx88/cx88-vp3054-i2c.h
@@ -1,26 +1,20 @@
/*
-
- cx88-vp3054-i2c.h -- support for the secondary I2C bus of the
- DNTV Live! DVB-T Pro (VP-3054), wired as:
- GPIO[0] -> SCL, GPIO[1] -> SDA
-
- (c) 2005 Chris Pascoe <c.pascoe@itee.uq.edu.au>
-
- 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.
-
-*/
+ * cx88-vp3054-i2c.h -- support for the secondary I2C bus of the
+ * DNTV Live! DVB-T Pro (VP-3054), wired as:
+ * GPIO[0] -> SCL, GPIO[1] -> SDA
+ *
+ * (c) 2005 Chris Pascoe <c.pascoe@itee.uq.edu.au>
+ *
+ * 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.
+ */
/* ----------------------------------------------------------------------- */
struct vp3054_i2c_state {
diff --git a/drivers/media/pci/cx88/cx88.h b/drivers/media/pci/cx88/cx88.h
index ecd4b7bece99..115414cf520f 100644
--- a/drivers/media/pci/cx88/cx88.h
+++ b/drivers/media/pci/cx88/cx88.h
@@ -1,5 +1,4 @@
/*
- *
* v4l2 device driver for cx2388x based TV cards
*
* (c) 2003,04 Gerd Knorr <kraxel@bytesex.org> [SUSE Labs]
@@ -13,12 +12,13 @@
* 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 CX88_H
+#define CX88_H
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
#include <linux/pci.h>
#include <linux/i2c.h>
#include <linux/i2c-algo-bit.h>
@@ -53,7 +53,7 @@
/* defines and enums */
/* Currently unsupported by the driver: PAL/H, NTSC/Kr, SECAM/LC */
-#define CX88_NORMS (V4L2_STD_ALL \
+#define CX88_NORMS (V4L2_STD_ALL \
& ~V4L2_STD_PAL_H \
& ~V4L2_STD_NTSC_M_KR \
& ~V4L2_STD_SECAM_LC)
@@ -98,7 +98,6 @@ static inline unsigned int norm_maxw(v4l2_std_id norm)
return 720;
}
-
static inline unsigned int norm_maxh(v4l2_std_id norm)
{
return (norm & V4L2_STD_525_60) ? 480 : 576;
@@ -140,6 +139,7 @@ struct sram_channel {
u32 cnt1_reg;
u32 cnt2_reg;
};
+
extern const struct sram_channel cx88_sram_channels[];
/* ----------------------------------------------------------- */
@@ -361,12 +361,12 @@ struct cx88_core {
u32 i2c_state, i2c_rc;
/* config info -- analog */
- struct v4l2_device v4l2_dev;
+ struct v4l2_device v4l2_dev;
struct v4l2_ctrl_handler video_hdl;
struct v4l2_ctrl *chroma_agc;
struct v4l2_ctrl_handler audio_hdl;
struct v4l2_subdev *sd_wm8775;
- struct i2c_client *i2c_rtc;
+ struct i2c_client *i2c_rtc;
unsigned int boardnr;
struct cx88_board board;
@@ -383,8 +383,8 @@ struct cx88_core {
/* state info */
struct task_struct *kthread;
v4l2_std_id tvnorm;
- unsigned width, height;
- unsigned field;
+ unsigned int width, height;
+ unsigned int field;
enum cx88_tvaudio tvaudio;
u32 audiomode_manual;
u32 audiomode_current;
@@ -427,7 +427,8 @@ static inline struct cx88_core *to_core(struct v4l2_device *v4l2_dev)
if (!core->i2c_rc) { \
if (core->gate_ctrl) \
core->gate_ctrl(core, 1); \
- v4l2_device_call_all(&core->v4l2_dev, grpid, o, f, ##args); \
+ v4l2_device_call_all(&core->v4l2_dev, \
+ grpid, o, f, ##args); \
if (core->gate_ctrl) \
core->gate_ctrl(core, 0); \
} \
@@ -438,31 +439,31 @@ static inline struct cx88_core *to_core(struct v4l2_device *v4l2_dev)
#define WM8775_GID (1 << 0)
#define wm8775_s_ctrl(core, id, val) \
- do { \
- struct v4l2_ctrl *ctrl_ = \
- v4l2_ctrl_find(core->sd_wm8775->ctrl_handler, id); \
- if (ctrl_ && !core->i2c_rc) { \
- if (core->gate_ctrl) \
- core->gate_ctrl(core, 1); \
- v4l2_ctrl_s_ctrl(ctrl_, val); \
- if (core->gate_ctrl) \
- core->gate_ctrl(core, 0); \
- } \
+ do { \
+ struct v4l2_ctrl *ctrl_ = \
+ v4l2_ctrl_find(core->sd_wm8775->ctrl_handler, id);\
+ if (ctrl_ && !core->i2c_rc) { \
+ if (core->gate_ctrl) \
+ core->gate_ctrl(core, 1); \
+ v4l2_ctrl_s_ctrl(ctrl_, val); \
+ if (core->gate_ctrl) \
+ core->gate_ctrl(core, 0); \
+ } \
} while (0)
#define wm8775_g_ctrl(core, id) \
- ({ \
- struct v4l2_ctrl *ctrl_ = \
- v4l2_ctrl_find(core->sd_wm8775->ctrl_handler, id); \
- s32 val = 0; \
- if (ctrl_ && !core->i2c_rc) { \
- if (core->gate_ctrl) \
- core->gate_ctrl(core, 1); \
- val = v4l2_ctrl_g_ctrl(ctrl_); \
- if (core->gate_ctrl) \
- core->gate_ctrl(core, 0); \
- } \
- val; \
+ ({ \
+ struct v4l2_ctrl *ctrl_ = \
+ v4l2_ctrl_find(core->sd_wm8775->ctrl_handler, id);\
+ s32 val = 0; \
+ if (ctrl_ && !core->i2c_rc) { \
+ if (core->gate_ctrl) \
+ core->gate_ctrl(core, 1); \
+ val = v4l2_ctrl_g_ctrl(ctrl_); \
+ if (core->gate_ctrl) \
+ core->gate_ctrl(core, 0); \
+ } \
+ val; \
})
/* ----------------------------------------------------------- */
@@ -484,7 +485,7 @@ struct cx8800_dev {
/* pci i/o */
struct pci_dev *pci;
- unsigned char pci_rev,pci_lat;
+ unsigned char pci_rev, pci_lat;
const struct cx8800_fmt *fmt;
@@ -504,7 +505,6 @@ struct cx8800_dev {
/* function 1: audio/alsa stuff */
/* =============> moved to cx88-alsa.c <====================== */
-
/* ----------------------------------------------------------- */
/* function 2: mpeg stuff */
@@ -547,7 +547,7 @@ struct cx8802_dev {
/* pci i/o */
struct pci_dev *pci;
- unsigned char pci_rev,pci_lat;
+ unsigned char pci_rev, pci_lat;
/* dma queues */
struct cx88_dmaqueue mpegq;
@@ -566,6 +566,7 @@ struct cx8802_dev {
/* mpeg params */
struct cx2341x_handler cxhdl;
+
#endif
#if IS_ENABLED(CONFIG_VIDEO_CX88_DVB)
@@ -588,40 +589,42 @@ struct cx8802_dev {
/* ----------------------------------------------------------- */
-#define cx_read(reg) readl(core->lmmio + ((reg)>>2))
-#define cx_write(reg,value) writel((value), core->lmmio + ((reg)>>2))
-#define cx_writeb(reg,value) writeb((value), core->bmmio + (reg))
+#define cx_read(reg) readl(core->lmmio + ((reg) >> 2))
+#define cx_write(reg, value) writel((value), core->lmmio + ((reg) >> 2))
+#define cx_writeb(reg, value) writeb((value), core->bmmio + (reg))
-#define cx_andor(reg,mask,value) \
- writel((readl(core->lmmio+((reg)>>2)) & ~(mask)) |\
- ((value) & (mask)), core->lmmio+((reg)>>2))
-#define cx_set(reg,bit) cx_andor((reg),(bit),(bit))
-#define cx_clear(reg,bit) cx_andor((reg),(bit),0)
+#define cx_andor(reg, mask, value) \
+ writel((readl(core->lmmio + ((reg) >> 2)) & ~(mask)) |\
+ ((value) & (mask)), core->lmmio + ((reg) >> 2))
+#define cx_set(reg, bit) cx_andor((reg), (bit), (bit))
+#define cx_clear(reg, bit) cx_andor((reg), (bit), 0)
#define cx_wait(d) { if (need_resched()) schedule(); else udelay(d); }
/* shadow registers */
#define cx_sread(sreg) (core->shadow[sreg])
-#define cx_swrite(sreg,reg,value) \
- (core->shadow[sreg] = value, \
- writel(core->shadow[sreg], core->lmmio + ((reg)>>2)))
-#define cx_sandor(sreg,reg,mask,value) \
- (core->shadow[sreg] = (core->shadow[sreg] & ~(mask)) | ((value) & (mask)), \
- writel(core->shadow[sreg], core->lmmio + ((reg)>>2)))
+#define cx_swrite(sreg, reg, value) \
+ (core->shadow[sreg] = value, \
+ writel(core->shadow[sreg], core->lmmio + ((reg) >> 2)))
+#define cx_sandor(sreg, reg, mask, value) \
+ (core->shadow[sreg] = (core->shadow[sreg] & ~(mask)) | \
+ ((value) & (mask)), \
+ writel(core->shadow[sreg], \
+ core->lmmio + ((reg) >> 2)))
/* ----------------------------------------------------------- */
/* cx88-core.c */
extern unsigned int cx88_core_debug;
-extern void cx88_print_irqbits(const char *name, const char *tag, const char *strings[],
- int len, u32 bits, u32 mask);
+void cx88_print_irqbits(const char *tag, const char *strings[],
+ int len, u32 bits, u32 mask);
-extern int cx88_core_irq(struct cx88_core *core, u32 status);
-extern void cx88_wakeup(struct cx88_core *core,
- struct cx88_dmaqueue *q, u32 count);
-extern void cx88_shutdown(struct cx88_core *core);
-extern int cx88_reset(struct cx88_core *core);
+int cx88_core_irq(struct cx88_core *core, u32 status);
+void cx88_wakeup(struct cx88_core *core,
+ struct cx88_dmaqueue *q, u32 count);
+void cx88_shutdown(struct cx88_core *core);
+int cx88_reset(struct cx88_core *core);
extern int
cx88_risc_buffer(struct pci_dev *pci, struct cx88_riscmem *risc,
@@ -633,43 +636,37 @@ cx88_risc_databuffer(struct pci_dev *pci, struct cx88_riscmem *risc,
struct scatterlist *sglist, unsigned int bpl,
unsigned int lines, unsigned int lpi);
-extern void cx88_risc_disasm(struct cx88_core *core,
- struct cx88_riscmem *risc);
-extern int cx88_sram_channel_setup(struct cx88_core *core,
- const struct sram_channel *ch,
- unsigned int bpl, u32 risc);
-extern void cx88_sram_channel_dump(struct cx88_core *core,
- const struct sram_channel *ch);
-
-extern int cx88_set_scale(struct cx88_core *core, unsigned int width,
- unsigned int height, enum v4l2_field field);
-extern int cx88_set_tvnorm(struct cx88_core *core, v4l2_std_id norm);
-
-extern void cx88_vdev_init(struct cx88_core *core,
- struct pci_dev *pci,
- struct video_device *vfd,
- const struct video_device *template_,
- const char *type);
-extern struct cx88_core *cx88_core_get(struct pci_dev *pci);
-extern void cx88_core_put(struct cx88_core *core,
- struct pci_dev *pci);
-
-extern int cx88_start_audio_dma(struct cx88_core *core);
-extern int cx88_stop_audio_dma(struct cx88_core *core);
-
+void cx88_risc_disasm(struct cx88_core *core,
+ struct cx88_riscmem *risc);
+int cx88_sram_channel_setup(struct cx88_core *core,
+ const struct sram_channel *ch,
+ unsigned int bpl, u32 risc);
+void cx88_sram_channel_dump(struct cx88_core *core,
+ const struct sram_channel *ch);
+
+int cx88_set_scale(struct cx88_core *core, unsigned int width,
+ unsigned int height, enum v4l2_field field);
+int cx88_set_tvnorm(struct cx88_core *core, v4l2_std_id norm);
+
+void cx88_vdev_init(struct cx88_core *core,
+ struct pci_dev *pci,
+ struct video_device *vfd,
+ const struct video_device *template_,
+ const char *type);
+struct cx88_core *cx88_core_get(struct pci_dev *pci);
+void cx88_core_put(struct cx88_core *core,
+ struct pci_dev *pci);
+
+int cx88_start_audio_dma(struct cx88_core *core);
+int cx88_stop_audio_dma(struct cx88_core *core);
/* ----------------------------------------------------------- */
/* cx88-vbi.c */
/* Can be used as g_vbi_fmt, try_vbi_fmt and s_vbi_fmt */
-int cx8800_vbi_fmt (struct file *file, void *priv,
- struct v4l2_format *f);
+int cx8800_vbi_fmt(struct file *file, void *priv,
+ struct v4l2_format *f);
-/*
-int cx8800_start_vbi_dma(struct cx8800_dev *dev,
- struct cx88_dmaqueue *q,
- struct cx88_buffer *buf);
-*/
void cx8800_stop_vbi_dma(struct cx8800_dev *dev);
int cx8800_restart_vbi_queue(struct cx8800_dev *dev, struct cx88_dmaqueue *q);
@@ -678,17 +675,16 @@ extern const struct vb2_ops cx8800_vbi_qops;
/* ----------------------------------------------------------- */
/* cx88-i2c.c */
-extern int cx88_i2c_init(struct cx88_core *core, struct pci_dev *pci);
-
+int cx88_i2c_init(struct cx88_core *core, struct pci_dev *pci);
/* ----------------------------------------------------------- */
/* cx88-cards.c */
-extern int cx88_tuner_callback(void *dev, int component, int command, int arg);
-extern int cx88_get_resources(const struct cx88_core *core,
- struct pci_dev *pci);
-extern struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr);
-extern void cx88_setup_xc3028(struct cx88_core *core, struct xc2028_ctrl *ctl);
+int cx88_tuner_callback(void *dev, int component, int command, int arg);
+int cx88_get_resources(const struct cx88_core *core,
+ struct pci_dev *pci);
+struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr);
+void cx88_setup_xc3028(struct cx88_core *core, struct xc2028_ctrl *ctl);
/* ----------------------------------------------------------- */
/* cx88-tvaudio.c */
@@ -703,7 +699,8 @@ int cx8802_register_driver(struct cx8802_driver *drv);
int cx8802_unregister_driver(struct cx8802_driver *drv);
/* Caller must hold core->lock */
-struct cx8802_driver * cx8802_get_driver(struct cx8802_dev *dev, enum cx88_board_type btype);
+struct cx8802_driver *cx8802_get_driver(struct cx8802_dev *dev,
+ enum cx88_board_type btype);
/* ----------------------------------------------------------- */
/* cx88-dsp.c */
@@ -718,18 +715,18 @@ int cx88_ir_fini(struct cx88_core *core);
void cx88_ir_irq(struct cx88_core *core);
int cx88_ir_start(struct cx88_core *core);
void cx88_ir_stop(struct cx88_core *core);
-extern void cx88_i2c_init_ir(struct cx88_core *core);
+void cx88_i2c_init_ir(struct cx88_core *core);
/* ----------------------------------------------------------- */
/* cx88-mpeg.c */
int cx8802_buf_prepare(struct vb2_queue *q, struct cx8802_dev *dev,
- struct cx88_buffer *buf);
+ struct cx88_buffer *buf);
void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf);
void cx8802_cancel_buffers(struct cx8802_dev *dev);
int cx8802_start_dma(struct cx8802_dev *dev,
- struct cx88_dmaqueue *q,
- struct cx88_buffer *buf);
+ struct cx88_dmaqueue *q,
+ struct cx88_buffer *buf);
/* ----------------------------------------------------------- */
/* cx88-video.c*/
@@ -737,4 +734,6 @@ int cx88_enum_input(struct cx88_core *core, struct v4l2_input *i);
int cx88_set_freq(struct cx88_core *core, const struct v4l2_frequency *f);
int cx88_video_mux(struct cx88_core *core, unsigned int input);
void cx88_querycap(struct file *file, struct cx88_core *core,
- struct v4l2_capability *cap);
+ struct v4l2_capability *cap);
+
+#endif