[media] cx88: make checkpatch happier

This driver is old, and have lots of checkpatch violations.
As we're touching a lot on this driver due to the printk
conversions, let's run checkpatch --fix on it, in order to
solve some of those issues.

Also, do a few manual adjustments:
- remove the FSF address and use the usual coding style
  for the initial comments;
- use WARN_ON() instead of BUG_ON();
- remove an unused typedef;
- break a few long lines.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
This commit is contained in:
Mauro Carvalho Chehab 2016-11-16 06:59:49 -02:00
parent 65bc2fe86e
commit 7b61ba8ff8
15 changed files with 515 additions and 559 deletions

View File

@ -1,5 +1,4 @@
/* /*
*
* Support for audio capture * Support for audio capture
* PCI function #1 of the cx2388x. * PCI function #1 of the cx2388x.
* *
@ -18,10 +17,6 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * 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.h"
@ -178,6 +173,7 @@ static int _cx88_start_audio_dma(snd_cx88_card_t *chip)
static int _cx88_stop_audio_dma(snd_cx88_card_t *chip) static int _cx88_stop_audio_dma(snd_cx88_card_t *chip)
{ {
struct cx88_core *core = chip->core; struct cx88_core *core = chip->core;
dprintk(1, "Stopping audio DMA\n"); dprintk(1, "Stopping audio DMA\n");
/* stop dma */ /* stop dma */
@ -261,7 +257,7 @@ static irqreturn_t cx8801_irq(int irq, void *dev_id)
for (loop = 0; loop < MAX_IRQ_LOOP; loop++) { for (loop = 0; loop < MAX_IRQ_LOOP; loop++) {
status = cx_read(MO_PCI_INTSTAT) & status = cx_read(MO_PCI_INTSTAT) &
(core->pci_irqmask | PCI_INT_AUDINT); (core->pci_irqmask | PCI_INT_AUDINT);
if (0 == status) if (status == 0)
goto out; goto out;
dprintk(3, "cx8801_irq loop %d/%d, status %x\n", dprintk(3, "cx8801_irq loop %d/%d, status %x\n",
loop, MAX_IRQ_LOOP, status); loop, MAX_IRQ_LOOP, status);
@ -274,7 +270,7 @@ static irqreturn_t cx8801_irq(int irq, void *dev_id)
cx8801_aud_irq(chip); cx8801_aud_irq(chip);
} }
if (MAX_IRQ_LOOP == loop) { if (loop == MAX_IRQ_LOOP) {
pr_err("IRQ loop detected, disabling interrupts\n"); pr_err("IRQ loop detected, disabling interrupts\n");
cx_clear(MO_PCI_INTMSK, PCI_INT_AUDINT); cx_clear(MO_PCI_INTMSK, PCI_INT_AUDINT);
} }
@ -290,7 +286,7 @@ static int cx88_alsa_dma_init(struct cx88_audio_dev *chip, int nr_pages)
int i; int i;
buf->vaddr = vmalloc_32(nr_pages << PAGE_SHIFT); buf->vaddr = vmalloc_32(nr_pages << PAGE_SHIFT);
if (NULL == buf->vaddr) { if (buf->vaddr == NULL) {
dprintk(1, "vmalloc_32(%d pages) failed\n", nr_pages); dprintk(1, "vmalloc_32(%d pages) failed\n", nr_pages);
return -ENOMEM; return -ENOMEM;
} }
@ -303,13 +299,13 @@ static int cx88_alsa_dma_init(struct cx88_audio_dev *chip, int nr_pages)
buf->nr_pages = nr_pages; buf->nr_pages = nr_pages;
buf->sglist = vzalloc(buf->nr_pages * sizeof(*buf->sglist)); buf->sglist = vzalloc(buf->nr_pages * sizeof(*buf->sglist));
if (NULL == buf->sglist) if (buf->sglist == NULL)
goto vzalloc_err; goto vzalloc_err;
sg_init_table(buf->sglist, buf->nr_pages); sg_init_table(buf->sglist, buf->nr_pages);
for (i = 0; i < buf->nr_pages; i++) { for (i = 0; i < buf->nr_pages; i++) {
pg = vmalloc_to_page(buf->vaddr + i * PAGE_SIZE); pg = vmalloc_to_page(buf->vaddr + i * PAGE_SIZE);
if (NULL == pg) if (pg == NULL)
goto vmalloc_to_page_err; goto vmalloc_to_page_err;
sg_set_page(&buf->sglist[i], pg, PAGE_SIZE, 0); sg_set_page(&buf->sglist[i], pg, PAGE_SIZE, 0);
} }
@ -331,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->sglen = dma_map_sg(&dev->pci->dev, buf->sglist,
buf->nr_pages, PCI_DMA_FROMDEVICE); buf->nr_pages, PCI_DMA_FROMDEVICE);
if (0 == buf->sglen) { if (buf->sglen == 0) {
pr_warn("%s: cx88_alsa_map_sg failed\n", __func__); pr_warn("%s: cx88_alsa_map_sg failed\n", __func__);
return -ENOMEM; return -ENOMEM;
} }
@ -431,6 +427,7 @@ static int snd_cx88_pcm_open(struct snd_pcm_substream *substream)
if (cx88_sram_channels[SRAM_CH25].fifo_size != DEFAULT_FIFO_SIZE) { if (cx88_sram_channels[SRAM_CH25].fifo_size != DEFAULT_FIFO_SIZE) {
unsigned int bpl = cx88_sram_channels[SRAM_CH25].fifo_size / 4; unsigned int bpl = cx88_sram_channels[SRAM_CH25].fifo_size / 4;
bpl &= ~7; /* must be multiple of 8 */ bpl &= ~7; /* must be multiple of 8 */
runtime->hw.period_bytes_min = bpl; runtime->hw.period_bytes_min = bpl;
runtime->hw.period_bytes_max = bpl; runtime->hw.period_bytes_max = bpl;
@ -474,7 +471,7 @@ static int snd_cx88_hw_params(struct snd_pcm_substream * substream,
BUG_ON(chip->num_periods & (chip->num_periods-1)); BUG_ON(chip->num_periods & (chip->num_periods-1));
buf = kzalloc(sizeof(*buf), GFP_KERNEL); buf = kzalloc(sizeof(*buf), GFP_KERNEL);
if (NULL == buf) if (buf == NULL)
return -ENOMEM; return -ENOMEM;
chip->buf = buf; chip->buf = buf;
@ -584,6 +581,7 @@ static struct page *snd_cx88_page(struct snd_pcm_substream *substream,
unsigned long offset) unsigned long offset)
{ {
void *pageptr = substream->runtime->dma_area + offset; void *pageptr = substream->runtime->dma_area + offset;
return vmalloc_to_page(pageptr); return vmalloc_to_page(pageptr);
} }
@ -872,7 +870,7 @@ static int snd_cx88_create(struct snd_card *card, struct pci_dev *pci,
chip = card->private_data; chip = card->private_data;
core = cx88_core_get(pci); core = cx88_core_get(pci);
if (NULL == core) { if (core == NULL) {
err = -EINVAL; err = -EINVAL;
return err; return err;
} }
@ -967,7 +965,8 @@ static int cx88_audio_initdev(struct pci_dev *pci,
strcpy(card->driver, "CX88x"); strcpy(card->driver, "CX88x");
sprintf(card->shortname, "Conexant CX%x", pci->device); sprintf(card->shortname, "Conexant CX%x", pci->device);
sprintf(card->longname, "%s at %#llx", sprintf(card->longname, "%s at %#llx",
card->shortname,(unsigned long long)pci_resource_start(pci, 0)); card->shortname,
(unsigned long long)pci_resource_start(pci, 0));
strcpy(card->mixername, "CX88"); strcpy(card->mixername, "CX88");
dprintk(0, "%s/%i: ALSA support for cx2388x boards\n", dprintk(0, "%s/%i: ALSA support for cx2388x boards\n",

View File

@ -1,5 +1,4 @@
/* /*
*
* Support for a cx23416 mpeg encoder via cx2388x host port. * Support for a cx23416 mpeg encoder via cx2388x host port.
* "blackbird" reference design. * "blackbird" reference design.
* *
@ -20,10 +19,6 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * 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.h"
@ -411,7 +406,7 @@ static int blackbird_find_mailbox(struct cx8802_dev *dev)
signaturecnt++; signaturecnt++;
else else
signaturecnt = 0; signaturecnt = 0;
if (4 == signaturecnt) { if (signaturecnt == 4) {
dprintk(1, "Mailbox signature found\n"); dprintk(1, "Mailbox signature found\n");
return i+1; return i+1;
} }
@ -459,7 +454,7 @@ static int blackbird_load_firmware(struct cx8802_dev *dev)
return -EINVAL; return -EINVAL;
} }
if (0 != memcmp(firmware->data, magic, 8)) { if (memcmp(firmware->data, magic, 8) != 0) {
pr_err("Firmware magic mismatch, wrong file?\n"); pr_err("Firmware magic mismatch, wrong file?\n");
release_firmware(firmware); release_firmware(firmware);
return -EINVAL; return -EINVAL;
@ -815,7 +810,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
{ {
struct cx8802_dev *dev = video_drvdata(file); struct cx8802_dev *dev = video_drvdata(file);
struct cx88_core *core = dev->core; struct cx88_core *core = dev->core;
unsigned maxw, maxh; unsigned int maxw, maxh;
enum v4l2_field field; enum v4l2_field field;
f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG; f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG;
@ -878,7 +873,7 @@ static int vidioc_s_frequency (struct file *file, void *priv,
struct cx88_core *core = dev->core; struct cx88_core *core = dev->core;
bool streaming; bool streaming;
if (unlikely(UNSET == core->board.tuner_type)) if (unlikely(core->board.tuner_type == UNSET))
return -EINVAL; return -EINVAL;
if (unlikely(f->tuner != 0)) if (unlikely(f->tuner != 0))
return -EINVAL; return -EINVAL;
@ -912,6 +907,7 @@ static int vidioc_enum_input (struct file *file, void *priv,
{ {
struct cx8802_dev *dev = video_drvdata(file); struct cx8802_dev *dev = video_drvdata(file);
struct cx88_core *core = dev->core; struct cx88_core *core = dev->core;
return cx88_enum_input(core, i); return cx88_enum_input(core, i);
} }
@ -921,7 +917,7 @@ static int vidioc_g_frequency (struct file *file, void *priv,
struct cx8802_dev *dev = video_drvdata(file); struct cx8802_dev *dev = video_drvdata(file);
struct cx88_core *core = dev->core; struct cx88_core *core = dev->core;
if (unlikely(UNSET == core->board.tuner_type)) if (unlikely(core->board.tuner_type == UNSET))
return -EINVAL; return -EINVAL;
if (unlikely(f->tuner != 0)) if (unlikely(f->tuner != 0))
return -EINVAL; return -EINVAL;
@ -963,9 +959,9 @@ static int vidioc_g_tuner (struct file *file, void *priv,
struct cx88_core *core = dev->core; struct cx88_core *core = dev->core;
u32 reg; u32 reg;
if (unlikely(UNSET == core->board.tuner_type)) if (unlikely(core->board.tuner_type == UNSET))
return -EINVAL; return -EINVAL;
if (0 != t->index) if (t->index != 0)
return -EINVAL; return -EINVAL;
strcpy(t->name, "Television"); strcpy(t->name, "Television");
@ -985,9 +981,9 @@ static int vidioc_s_tuner (struct file *file, void *priv,
struct cx8802_dev *dev = video_drvdata(file); struct cx8802_dev *dev = video_drvdata(file);
struct cx88_core *core = dev->core; struct cx88_core *core = dev->core;
if (UNSET == core->board.tuner_type) if (core->board.tuner_type == UNSET)
return -EINVAL; return -EINVAL;
if (0 != t->index) if (t->index != 0)
return -EINVAL; return -EINVAL;
cx88_set_stereo(core, t->audmode, 1); cx88_set_stereo(core, t->audmode, 1);
@ -1011,8 +1007,8 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id id)
return cx88_set_tvnorm(core, 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, .owner = THIS_MODULE,
.open = v4l2_fh_open, .open = v4l2_fh_open,
.release = vb2_fop_release, .release = vb2_fop_release,

View File

@ -1,5 +1,4 @@
/* /*
*
* device driver for Conexant 2388x based TV cards * device driver for Conexant 2388x based TV cards
* card-specific stuff. * card-specific stuff.
* *
@ -14,10 +13,6 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * 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.h"
@ -2947,7 +2942,7 @@ static void gdi_eeprom(struct cx88_core *core, u8 *eeprom_data)
? gdi_tuner[eeprom_data[0x0d]].name : NULL; ? gdi_tuner[eeprom_data[0x0d]].name : NULL;
pr_info("GDI: tuner=%s\n", name ? name : "unknown"); pr_info("GDI: tuner=%s\n", name ? name : "unknown");
if (NULL == name) if (name == NULL)
return; return;
core->board.tuner_type = gdi_tuner[eeprom_data[0x0d]].id; core->board.tuner_type = gdi_tuner[eeprom_data[0x0d]].id;
core->board.radio.type = gdi_tuner[eeprom_data[0x0d]].fm ? core->board.radio.type = gdi_tuner[eeprom_data[0x0d]].fm ?
@ -3401,7 +3396,7 @@ static void cx88_card_setup(struct cx88_core *core)
memset(&tun_setup, 0, sizeof(tun_setup)); memset(&tun_setup, 0, sizeof(tun_setup));
if (0 == core->i2c_rc) { if (core->i2c_rc == 0) {
core->i2c_client.addr = 0xa0 >> 1; core->i2c_client.addr = 0xa0 >> 1;
tveeprom_read(&core->i2c_client, eeprom, sizeof(eeprom)); tveeprom_read(&core->i2c_client, eeprom, sizeof(eeprom));
} }
@ -3409,17 +3404,17 @@ static void cx88_card_setup(struct cx88_core *core)
switch (core->boardnr) { switch (core->boardnr) {
case CX88_BOARD_HAUPPAUGE: case CX88_BOARD_HAUPPAUGE:
case CX88_BOARD_HAUPPAUGE_ROSLYN: case CX88_BOARD_HAUPPAUGE_ROSLYN:
if (0 == core->i2c_rc) if (core->i2c_rc == 0)
hauppauge_eeprom(core, eeprom+8); hauppauge_eeprom(core, eeprom+8);
break; break;
case CX88_BOARD_GDI: case CX88_BOARD_GDI:
if (0 == core->i2c_rc) if (core->i2c_rc == 0)
gdi_eeprom(core, eeprom); gdi_eeprom(core, eeprom);
break; break;
case CX88_BOARD_LEADTEK_PVR2000: case CX88_BOARD_LEADTEK_PVR2000:
case CX88_BOARD_WINFAST_DV2000: case CX88_BOARD_WINFAST_DV2000:
case CX88_BOARD_WINFAST2000XP_EXPERT: case CX88_BOARD_WINFAST2000XP_EXPERT:
if (0 == core->i2c_rc) if (core->i2c_rc == 0)
leadtek_eeprom(core, eeprom); leadtek_eeprom(core, eeprom);
break; break;
case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1: case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1:
@ -3432,7 +3427,7 @@ static void cx88_card_setup(struct cx88_core *core)
case CX88_BOARD_HAUPPAUGE_HVR4000: case CX88_BOARD_HAUPPAUGE_HVR4000:
case CX88_BOARD_HAUPPAUGE_HVR4000LITE: case CX88_BOARD_HAUPPAUGE_HVR4000LITE:
case CX88_BOARD_HAUPPAUGE_IRONLY: case CX88_BOARD_HAUPPAUGE_IRONLY:
if (0 == core->i2c_rc) if (core->i2c_rc == 0)
hauppauge_eeprom(core, eeprom); hauppauge_eeprom(core, eeprom);
break; break;
case CX88_BOARD_KWORLD_DVBS_100: case CX88_BOARD_KWORLD_DVBS_100:
@ -3478,7 +3473,7 @@ static void cx88_card_setup(struct cx88_core *core)
cx_write(MO_GP0_IO, 0x00080808); cx_write(MO_GP0_IO, 0x00080808);
break; break;
case CX88_BOARD_ATI_HDTVWONDER: case CX88_BOARD_ATI_HDTVWONDER:
if (0 == core->i2c_rc) { if (core->i2c_rc == 0) {
/* enable tuner */ /* enable tuner */
int i; int i;
static const u8 buffer[][2] = { static const u8 buffer[][2] = {
@ -3616,7 +3611,7 @@ static int cx88_pci_quirks(const char *name, struct pci_dev *pci)
#endif #endif
/* check insmod options */ /* check insmod options */
if (UNSET != latency) if (latency != UNSET)
lat = latency; lat = latency;
/* apply stuff */ /* apply stuff */
@ -3625,7 +3620,7 @@ static int cx88_pci_quirks(const char *name, struct pci_dev *pci)
value |= ctrl; value |= ctrl;
pci_write_config_byte(pci, CX88X_DEVCTRL, value); pci_write_config_byte(pci, CX88X_DEVCTRL, value);
} }
if (UNSET != lat) { if (lat != UNSET) {
pr_info("setting pci latency timer to %d\n", pr_info("setting pci latency timer to %d\n",
latency); latency);
pci_write_config_byte(pci, PCI_LATENCY_TIMER, latency); pci_write_config_byte(pci, PCI_LATENCY_TIMER, latency);
@ -3692,7 +3687,7 @@ struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr)
return NULL; 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->video_hdl);
v4l2_ctrl_handler_free(&core->audio_hdl); v4l2_ctrl_handler_free(&core->audio_hdl);
v4l2_device_unregister(&core->v4l2_dev); v4l2_device_unregister(&core->v4l2_dev);
@ -3724,7 +3719,7 @@ struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr)
if (pci->subsystem_vendor == cx88_subids[i].subvendor && if (pci->subsystem_vendor == cx88_subids[i].subvendor &&
pci->subsystem_device == cx88_subids[i].subdevice) pci->subsystem_device == cx88_subids[i].subdevice)
core->boardnr = cx88_subids[i].card; core->boardnr = cx88_subids[i].card;
if (UNSET == core->boardnr) { if (core->boardnr == UNSET) {
core->boardnr = CX88_BOARD_UNKNOWN; core->boardnr = CX88_BOARD_UNKNOWN;
cx88_card_list(core, pci); cx88_card_list(core, pci);
} }
@ -3754,7 +3749,7 @@ struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr)
cx88_i2c_init(core, pci); cx88_i2c_init(core, pci);
/* load tuner module, if needed */ /* load tuner module, if needed */
if (UNSET != core->board.tuner_type) { if (core->board.tuner_type != UNSET) {
/* Ignore 0x6b and 0x6f on cx88 boards. /* Ignore 0x6b and 0x6f on cx88 boards.
* FusionHDTV5 RT Gold has an ir receiver at 0x6b * 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. */

View File

@ -1,5 +1,4 @@
/* /*
*
* device driver for Conexant 2388x based TV cards * device driver for Conexant 2388x based TV cards
* driver core * driver core
* *
@ -19,10 +18,6 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * 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.h"
@ -147,9 +142,9 @@ int cx88_risc_buffer(struct pci_dev *pci, struct cx88_riscmem *risc,
__le32 *rp; __le32 *rp;
fields = 0; fields = 0;
if (UNSET != top_offset) if (top_offset != UNSET)
fields++; fields++;
if (UNSET != bottom_offset) if (bottom_offset != UNSET)
fields++; fields++;
/* estimate risc mem: worst case is one write per page border + /* estimate risc mem: worst case is one write per page border +
@ -161,21 +156,21 @@ int cx88_risc_buffer(struct pci_dev *pci, struct cx88_riscmem *risc,
risc->size = instructions * 8; risc->size = instructions * 8;
risc->dma = 0; risc->dma = 0;
risc->cpu = pci_zalloc_consistent(pci, risc->size, &risc->dma); risc->cpu = pci_zalloc_consistent(pci, risc->size, &risc->dma);
if (NULL == risc->cpu) if (risc->cpu == NULL)
return -ENOMEM; return -ENOMEM;
/* write risc instructions */ /* write risc instructions */
rp = risc->cpu; rp = risc->cpu;
if (UNSET != top_offset) if (top_offset != UNSET)
rp = cx88_risc_field(rp, sglist, top_offset, 0, rp = cx88_risc_field(rp, sglist, top_offset, 0,
bpl, padding, lines, 0, true); bpl, padding, lines, 0, true);
if (UNSET != bottom_offset) if (bottom_offset != UNSET)
rp = cx88_risc_field(rp, sglist, bottom_offset, 0x200, 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 */ /* save pointer to jmp instruction address */
risc->jmp = rp; 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; return 0;
} }
@ -195,7 +190,7 @@ int cx88_risc_databuffer(struct pci_dev *pci, struct cx88_riscmem *risc,
risc->size = instructions * 8; risc->size = instructions * 8;
risc->dma = 0; risc->dma = 0;
risc->cpu = pci_zalloc_consistent(pci, risc->size, &risc->dma); risc->cpu = pci_zalloc_consistent(pci, risc->size, &risc->dma);
if (NULL == risc->cpu) if (risc->cpu == NULL)
return -ENOMEM; return -ENOMEM;
/* write risc instructions */ /* write risc instructions */
@ -204,7 +199,7 @@ int cx88_risc_databuffer(struct pci_dev *pci, struct cx88_riscmem *risc,
/* save pointer to jmp instruction address */ /* save pointer to jmp instruction address */
risc->jmp = rp; 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; return 0;
} }
@ -348,7 +343,7 @@ int cx88_sram_channel_setup(struct cx88_core *core,
lines = ch->fifo_size / bpl; lines = ch->fifo_size / bpl;
if (lines > 6) if (lines > 6)
lines = 6; lines = 6;
BUG_ON(lines < 2); WARN_ON(lines < 2);
/* write CDT */ /* write CDT */
for (i = 0; i < lines; i++) for (i = 0; i < lines; i++)
@ -711,7 +706,7 @@ int cx88_set_scale(struct cx88_core *core, unsigned int width, unsigned int heig
} }
if (INPUT(core->input).type == CX88_VMUX_SVIDEO) if (INPUT(core->input).type == CX88_VMUX_SVIDEO)
value |= (1 << 13) | (1 << 5); value |= (1 << 13) | (1 << 5);
if (V4L2_FIELD_INTERLACED == field) if (field == V4L2_FIELD_INTERLACED)
value |= (1 << 3); // VINT (interlaced vertical scaling) value |= (1 << 3); // VINT (interlaced vertical scaling)
if (width < 385) if (width < 385)
value |= (1 << 0); // 3-tap interpolation value |= (1 << 0); // 3-tap interpolation
@ -1024,7 +1019,7 @@ struct cx88_core* cx88_core_get(struct pci_dev *pci)
if (PCI_SLOT(pci->devfn) != core->pci_slot) if (PCI_SLOT(pci->devfn) != core->pci_slot)
continue; continue;
if (0 != cx88_get_resources(core, pci)) { if (cx88_get_resources(core, pci) != 0) {
mutex_unlock(&devlist); mutex_unlock(&devlist);
return NULL; return NULL;
} }
@ -1034,7 +1029,7 @@ struct cx88_core* cx88_core_get(struct pci_dev *pci)
} }
core = cx88_core_create(pci, cx88_devcount); core = cx88_core_create(pci, cx88_devcount);
if (NULL != core) { if (core != NULL) {
cx88_devcount++; cx88_devcount++;
list_add_tail(&core->devlist, &cx88_devlist); list_add_tail(&core->devlist, &cx88_devlist);
} }
@ -1053,7 +1048,7 @@ void cx88_core_put(struct cx88_core *core, struct pci_dev *pci)
mutex_lock(&devlist); mutex_lock(&devlist);
cx88_ir_fini(core); cx88_ir_fini(core);
if (0 == core->i2c_rc) { if (core->i2c_rc == 0) {
if (core->i2c_rtc) if (core->i2c_rtc)
i2c_unregister_device(core->i2c_rtc); i2c_unregister_device(core->i2c_rtc);
i2c_del_adapter(&core->i2c_adap); i2c_del_adapter(&core->i2c_adap);

View File

@ -1,5 +1,4 @@
/* /*
*
* Stereo and SAP detection for cx88 * Stereo and SAP detection for cx88
* *
* Copyright (c) 2009 Marton Balint <cus@fazekas.hu> * Copyright (c) 2009 Marton Balint <cus@fazekas.hu>
@ -13,10 +12,6 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * 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.h"
@ -82,6 +77,7 @@ static s32 int_cos(u32 x)
u32 t2, t4, t6, t8; u32 t2, t4, t6, t8;
s32 ret; s32 ret;
u16 period = x / INT_PI; u16 period = x / INT_PI;
if (period % 2) if (period % 2)
return -int_cos(x - INT_PI); return -int_cos(x - INT_PI);
x = x % INT_PI; x = x % INT_PI;
@ -111,6 +107,7 @@ static u32 int_goertzel(s16 x[], u32 N, u32 freq)
for (i = 0; i < N; i++) { 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_prev2 = s_prev;
s_prev = s; s_prev = s;
} }
@ -129,6 +126,7 @@ static u32 int_goertzel(s16 x[], u32 N, u32 freq)
static u32 freq_magnitude(s16 x[], u32 N, u32 freq) static u32 freq_magnitude(s16 x[], u32 N, u32 freq)
{ {
u32 sum = int_goertzel(x, N, freq); u32 sum = int_goertzel(x, N, freq);
return (u32)int_sqrt(sum); return (u32)int_sqrt(sum);
} }
@ -225,6 +223,7 @@ static s32 detect_btsc(struct cx88_core *core, s16 x[], u32 N)
s32 sap = freq_magnitude(x, N, FREQ_BTSC_SAP); s32 sap = freq_magnitude(x, N, FREQ_BTSC_SAP);
s32 dual_ref = freq_magnitude(x, N, FREQ_BTSC_DUAL_REF); s32 dual_ref = freq_magnitude(x, N, FREQ_BTSC_DUAL_REF);
s32 dual = freq_magnitude(x, N, FREQ_BTSC_DUAL); s32 dual = freq_magnitude(x, N, FREQ_BTSC_DUAL);
dprintk(1, "detect btsc: dual_ref=%d, dual=%d, sap_ref=%d, sap=%d\n", dprintk(1, "detect btsc: dual_ref=%d, dual=%d, sap_ref=%d, sap=%d\n",
dual_ref, dual, sap_ref, sap); dual_ref, dual, sap_ref, sap);
/* FIXME: Currently not supported */ /* FIXME: Currently not supported */
@ -307,7 +306,7 @@ s32 cx88_dsp_detect_stereo_sap(struct cx88_core *core)
kfree(samples); kfree(samples);
if (UNSET != ret) if (ret != UNSET)
dprintk(1, "stereo/sap detection result:%s%s%s\n", dprintk(1, "stereo/sap detection result:%s%s%s\n",
(ret & V4L2_TUNER_SUB_MONO) ? " mono" : "", (ret & V4L2_TUNER_SUB_MONO) ? " mono" : "",
(ret & V4L2_TUNER_SUB_STEREO) ? " stereo" : "", (ret & V4L2_TUNER_SUB_STEREO) ? " stereo" : "",

View File

@ -1,5 +1,4 @@
/* /*
*
* device driver for Conexant 2388x based TV cards * device driver for Conexant 2388x based TV cards
* MPEG Transport Stream (DVB) routines * MPEG Transport Stream (DVB) routines
* *
@ -15,10 +14,6 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * 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.h"
@ -381,6 +376,7 @@ static const struct cx22702_config hauppauge_hvr_config = {
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; dev->ts_gen_cntrl = is_punctured ? 0x04 : 0x00;
return 0; return 0;
} }
@ -406,6 +402,7 @@ static int lgdt330x_pll_rf_set(struct dvb_frontend* fe, int index)
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) if (is_punctured)
dev->ts_gen_cntrl |= 0x04; dev->ts_gen_cntrl |= 0x04;
else else
@ -437,6 +434,7 @@ static const struct lgdt330x_config pchdtv_hd5500 = {
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; dev->ts_gen_cntrl = is_punctured ? 0x04 : 0x00;
return 0; return 0;
} }
@ -450,6 +448,7 @@ static int cx24123_set_ts_param(struct dvb_frontend* fe,
int is_punctured) int is_punctured)
{ {
struct cx8802_dev *dev = fe->dvb->priv; struct cx8802_dev *dev = fe->dvb->priv;
dev->ts_gen_cntrl = 0x02; dev->ts_gen_cntrl = 0x02;
return 0; return 0;
} }
@ -688,6 +687,7 @@ static int cx24116_set_ts_param(struct dvb_frontend *fe,
int is_punctured) int is_punctured)
{ {
struct cx8802_dev *dev = fe->dvb->priv; struct cx8802_dev *dev = fe->dvb->priv;
dev->ts_gen_cntrl = 0x2; dev->ts_gen_cntrl = 0x2;
return 0; return 0;
@ -697,6 +697,7 @@ static int stv0900_set_ts_param(struct dvb_frontend *fe,
int is_punctured) int is_punctured)
{ {
struct cx8802_dev *dev = fe->dvb->priv; struct cx8802_dev *dev = fe->dvb->priv;
dev->ts_gen_cntrl = 0; dev->ts_gen_cntrl = 0;
return 0; return 0;
@ -734,6 +735,7 @@ static int ds3000_set_ts_param(struct dvb_frontend *fe,
int is_punctured) int is_punctured)
{ {
struct cx8802_dev *dev = fe->dvb->priv; struct cx8802_dev *dev = fe->dvb->priv;
dev->ts_gen_cntrl = 4; dev->ts_gen_cntrl = 4;
return 0; return 0;
@ -1005,7 +1007,7 @@ static int dvb_register(struct cx8802_dev *dev)
int mfe_shared = 0; /* bus not shared by default */ int mfe_shared = 0; /* bus not shared by default */
int res = -EINVAL; int res = -EINVAL;
if (0 != core->i2c_rc) { if (core->i2c_rc != 0) {
pr_err("no i2c-bus available, cannot attach dvb drivers\n"); pr_err("no i2c-bus available, cannot attach dvb drivers\n");
goto frontend_detach; goto frontend_detach;
} }
@ -1653,6 +1655,7 @@ static int cx8802_dvb_advise_acquire(struct cx8802_driver *drv)
{ {
struct cx88_core *core = drv->core; struct cx88_core *core = drv->core;
int err = 0; int err = 0;
dprintk(1, "%s\n", __func__); dprintk(1, "%s\n", __func__);
switch (core->boardnr) { switch (core->boardnr) {
@ -1717,6 +1720,7 @@ static int cx8802_dvb_advise_release(struct cx8802_driver *drv)
{ {
struct cx88_core *core = drv->core; struct cx88_core *core = drv->core;
int err = 0; int err = 0;
dprintk(1, "%s\n", __func__); dprintk(1, "%s\n", __func__);
switch (core->boardnr) { switch (core->boardnr) {
@ -1753,7 +1757,7 @@ static int cx8802_dvb_probe(struct cx8802_driver *drv)
/* If vp3054 isn't enabled, a stub will just return 0 */ /* If vp3054 isn't enabled, a stub will just return 0 */
err = vp3054_i2c_probe(dev); err = vp3054_i2c_probe(dev);
if (0 != err) if (err != 0)
goto fail_core; goto fail_core;
/* dvb stuff */ /* dvb stuff */

View File

@ -1,30 +1,25 @@
/* /*
*
cx88-i2c.c -- all the i2c code is here * cx88-i2c.c -- all the i2c code is here
*
Copyright (C) 1996,97,98 Ralph Metzler (rjkm@thp.uni-koeln.de) * Copyright (C) 1996,97,98 Ralph Metzler (rjkm@thp.uni-koeln.de)
& Marcus Metzler (mocm@thp.uni-koeln.de) * & Marcus Metzler (mocm@thp.uni-koeln.de)
(c) 2002 Yurij Sysoev <yurij@naturesoft.net> * (c) 2002 Yurij Sysoev <yurij@naturesoft.net>
(c) 1999-2003 Gerd Knorr <kraxel@bytesex.org> * (c) 1999-2003 Gerd Knorr <kraxel@bytesex.org>
*
(c) 2005 Mauro Carvalho Chehab <mchehab@infradead.org> * (c) 2005 Mauro Carvalho Chehab <mchehab@infradead.org>
- Multituner support and i2c address binding * - Multituner support and i2c address binding
*
This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. * (at your option) any later version.
*
This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. * 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.h"
@ -159,11 +154,15 @@ int cx88_i2c_init(struct cx88_core *core, struct pci_dev *pci)
cx8800_bit_setsda(core, 1); cx8800_bit_setsda(core, 1);
core->i2c_rc = i2c_bit_add_bus(&core->i2c_adap); core->i2c_rc = i2c_bit_add_bus(&core->i2c_adap);
if (0 == core->i2c_rc) { if (core->i2c_rc == 0) {
static u8 tuner_data[] = static u8 tuner_data[] = {
{ 0x0b, 0xdc, 0x86, 0x52 }; 0x0b, 0xdc, 0x86, 0x52 };
static struct i2c_msg tuner_msg = static struct i2c_msg tuner_msg = {
{ .flags = 0, .addr = 0xc2 >> 1, .buf = tuner_data, .len = 4 }; .flags = 0,
.addr = 0xc2 >> 1,
.buf = tuner_data,
.len = 4
};
dprintk(1, "i2c register ok\n"); dprintk(1, "i2c register ok\n");
switch (core->boardnr) { switch (core->boardnr) {

View File

@ -16,10 +16,6 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * 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 "cx88.h"
@ -58,7 +54,7 @@ struct cx88_IR {
u32 mask_keyup; u32 mask_keyup;
}; };
static unsigned ir_samplerate = 4; static unsigned int ir_samplerate = 4;
module_param(ir_samplerate, uint, 0444); module_param(ir_samplerate, uint, 0444);
MODULE_PARM_DESC(ir_samplerate, "IR samplerate in kHz, 1 - 20, default 4"); MODULE_PARM_DESC(ir_samplerate, "IR samplerate in kHz, 1 - 20, default 4");
@ -512,7 +508,7 @@ int cx88_ir_fini(struct cx88_core *core)
struct cx88_IR *ir = core->ir; struct cx88_IR *ir = core->ir;
/* skip detach on non attached boards */ /* skip detach on non attached boards */
if (NULL == ir) if (ir == NULL)
return 0; return 0;
cx88_ir_stop(core); cx88_ir_stop(core);
@ -530,7 +526,7 @@ void cx88_ir_irq(struct cx88_core *core)
{ {
struct cx88_IR *ir = core->ir; struct cx88_IR *ir = core->ir;
u32 samples; u32 samples;
unsigned todo, bits; unsigned int todo, bits;
struct ir_raw_event ev; struct ir_raw_event ev;
if (!ir || !ir->sampling) if (!ir || !ir->sampling)
@ -602,7 +598,7 @@ void cx88_i2c_init_ir(struct cx88_core *core)
const unsigned short *addr_list = default_addr_list; const unsigned short *addr_list = default_addr_list;
const unsigned short *addrp; const unsigned short *addrp;
/* Instantiate the IR receiver device, if present */ /* Instantiate the IR receiver device, if present */
if (0 != core->i2c_rc) if (core->i2c_rc != 0)
return; return;
memset(&info, 0, sizeof(struct i2c_board_info)); memset(&info, 0, sizeof(struct i2c_board_info));

View File

@ -185,6 +185,7 @@ int cx8802_start_dma(struct cx8802_dev *dev,
static int cx8802_stop_dma(struct cx8802_dev *dev) static int cx8802_stop_dma(struct cx8802_dev *dev)
{ {
struct cx88_core *core = dev->core; struct cx88_core *core = dev->core;
dprintk(1, "\n"); dprintk(1, "\n");
/* stop dma */ /* stop dma */
@ -356,7 +357,7 @@ static irqreturn_t cx8802_irq(int irq, void *dev_id)
for (loop = 0; loop < MAX_IRQ_LOOP; loop++) { for (loop = 0; loop < MAX_IRQ_LOOP; loop++) {
status = cx_read(MO_PCI_INTSTAT) & status = cx_read(MO_PCI_INTSTAT) &
(core->pci_irqmask | PCI_INT_TSINT); (core->pci_irqmask | PCI_INT_TSINT);
if (0 == status) if (status == 0)
goto out; goto out;
dprintk(1, "cx8802_irq\n"); dprintk(1, "cx8802_irq\n");
dprintk(1, " loop: %d/%d\n", loop, MAX_IRQ_LOOP); dprintk(1, " loop: %d/%d\n", loop, MAX_IRQ_LOOP);
@ -369,7 +370,7 @@ static irqreturn_t cx8802_irq(int irq, void *dev_id)
if (status & PCI_INT_TSINT) if (status & PCI_INT_TSINT)
cx8802_mpeg_irq(dev); cx8802_mpeg_irq(dev);
} }
if (MAX_IRQ_LOOP == loop) { if (loop == MAX_IRQ_LOOP) {
dprintk(0, "clearing mask\n"); dprintk(0, "clearing mask\n");
pr_warn("irq loop -- clearing mask\n"); pr_warn("irq loop -- clearing mask\n");
cx_write(MO_PCI_INTMSK, 0); cx_write(MO_PCI_INTMSK, 0);
@ -451,7 +452,7 @@ static int cx8802_suspend_common(struct pci_dev *pci_dev, pm_message_t state)
cx88_shutdown(dev->core); cx88_shutdown(dev->core);
pci_save_state(pci_dev); 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); pci_disable_device(pci_dev);
dev->state.disabled = 1; dev->state.disabled = 1;
} }
@ -696,7 +697,7 @@ static int cx8802_probe(struct pci_dev *pci_dev,
/* general setup */ /* general setup */
core = cx88_core_get(pci_dev); core = cx88_core_get(pci_dev);
if (NULL == core) if (core == NULL)
return -EINVAL; return -EINVAL;
pr_info("cx2388x 8802 Driver Manager\n"); pr_info("cx2388x 8802 Driver Manager\n");
@ -707,7 +708,7 @@ static int cx8802_probe(struct pci_dev *pci_dev,
err = -ENOMEM; err = -ENOMEM;
dev = kzalloc(sizeof(*dev), GFP_KERNEL); dev = kzalloc(sizeof(*dev), GFP_KERNEL);
if (NULL == dev) if (dev == NULL)
goto fail_core; goto fail_core;
dev->pci = pci_dev; dev->pci = pci_dev;
dev->core = core; dev->core = core;

View File

@ -822,15 +822,4 @@
#define DEFAULT_SAT_U_NTSC 0x7F #define DEFAULT_SAT_U_NTSC 0x7F
#define DEFAULT_SAT_V_NTSC 0x5A #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_ */ #endif /* _CX88_REG_H_ */

View File

@ -1,38 +1,33 @@
/* /*
* cx88x-audio.c - Conexant CX23880/23881 audio downstream driver driver
cx88x-audio.c - Conexant CX23880/23881 audio downstream driver driver *
* (c) 2001 Michael Eskin, Tom Zakrajsek [Windows version]
(c) 2001 Michael Eskin, Tom Zakrajsek [Windows version] * (c) 2002 Yurij Sysoev <yurij@naturesoft.net>
(c) 2002 Yurij Sysoev <yurij@naturesoft.net> * (c) 2003 Gerd Knorr <kraxel@bytesex.org>
(c) 2003 Gerd Knorr <kraxel@bytesex.org> *
* -----------------------------------------------------------------------
----------------------------------------------------------------------- *
* Lot of voodoo here. Even the data sheet doesn't help to
Lot of voodoo here. Even the data sheet doesn't help to * understand what is going on here, the documentation for the audio
understand what is going on here, the documentation for the audio * part of the cx2388x chip is *very* bad.
part of the cx2388x chip is *very* bad. *
* Some of this comes from party done linux driver sources I got from
Some of this comes from party done linux driver sources I got from * [undocumented].
[undocumented]. *
* Some comes from the dscaler sources, one of the dscaler driver guy works
Some comes from the dscaler sources, one of the dscaler driver guy works * for Conexant ...
for Conexant ... *
* -----------------------------------------------------------------------
----------------------------------------------------------------------- *
* This program is free software; you can redistribute it and/or modify
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
it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or
the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
(at your option) any later version. *
* This program is distributed in the hope that it will be useful,
This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of
but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details.
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.h"
@ -770,7 +765,7 @@ void cx88_set_tvaudio(struct cx88_core *core)
/* set nicam mode - otherwise /* set nicam mode - otherwise
AUD_NICAM_STATUS2 contains wrong values */ AUD_NICAM_STATUS2 contains wrong values */
set_audio_standard_NICAM(core, EN_NICAM_AUTO_STEREO); 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 */ /* fall back to fm / am mono */
set_audio_standard_A2(core, EN_A2_FORCE_MONO1); set_audio_standard_A2(core, EN_A2_FORCE_MONO1);
core->audiomode_current = V4L2_TUNER_MODE_MONO; core->audiomode_current = V4L2_TUNER_MODE_MONO;
@ -869,11 +864,11 @@ void cx88_get_stereo(struct cx88_core *core, struct v4l2_tuner *t)
} }
/* If software stereo detection is not supported... */ /* If software stereo detection is not supported... */
if (UNSET == t->rxsubchans) { if (t->rxsubchans == UNSET) {
t->rxsubchans = V4L2_TUNER_SUB_MONO; t->rxsubchans = V4L2_TUNER_SUB_MONO;
/* If the hardware itself detected stereo, also return /* If the hardware itself detected stereo, also return
stereo as an available subchannel */ stereo as an available subchannel */
if (V4L2_TUNER_MODE_STEREO == t->audmode) if (t->audmode == V4L2_TUNER_MODE_STEREO)
t->rxsubchans |= V4L2_TUNER_SUB_STEREO; t->rxsubchans |= V4L2_TUNER_SUB_STEREO;
} }
return; return;
@ -887,7 +882,7 @@ void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual)
if (manual) { if (manual) {
core->audiomode_manual = mode; core->audiomode_manual = mode;
} else { } else {
if (UNSET != core->audiomode_manual) if (core->audiomode_manual != UNSET)
return; return;
} }
core->audiomode_current = mode; core->audiomode_current = mode;
@ -915,7 +910,7 @@ void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual)
case WW_M: case WW_M:
case WW_I: case WW_I:
case WW_L: case WW_L:
if (1 == core->use_nicam) { if (core->use_nicam == 1) {
switch (mode) { switch (mode) {
case V4L2_TUNER_MODE_MONO: case V4L2_TUNER_MODE_MONO:
case V4L2_TUNER_MODE_LANG1: case V4L2_TUNER_MODE_LANG1:
@ -975,7 +970,7 @@ void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual)
break; break;
} }
if (UNSET != ctl) { if (ctl != UNSET) {
dprintk("cx88_set_stereo: mask 0x%x, ctl 0x%x [status=0x%x,ctl=0x%x,vol=0x%x]\n", 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), mask, ctl, cx_read(AUD_STATUS),
cx_read(AUD_CTL), cx_sread(SHADOW_AUD_VOL_CTL)); cx_read(AUD_CTL), cx_sread(SHADOW_AUD_VOL_CTL));
@ -1011,7 +1006,7 @@ int cx88_audio_thread(void *data)
memset(&t, 0, sizeof(t)); memset(&t, 0, sizeof(t));
cx88_get_stereo(core, &t); cx88_get_stereo(core, &t);
if (UNSET != core->audiomode_manual) if (core->audiomode_manual != UNSET)
/* manually set, don't do anything. */ /* manually set, don't do anything. */
continue; continue;

View File

@ -19,10 +19,6 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * 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.h"
@ -741,7 +737,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
unsigned int maxw, maxh; unsigned int maxw, maxh;
fmt = format_by_fourcc(f->fmt.pix.pixelformat); fmt = format_by_fourcc(f->fmt.pix.pixelformat);
if (NULL == fmt) if (fmt == NULL)
return -EINVAL; return -EINVAL;
maxw = norm_maxw(core->tvnorm); maxw = norm_maxw(core->tvnorm);
@ -784,7 +780,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
struct cx88_core *core = dev->core; 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; return err;
if (vb2_is_busy(&dev->vb2_vidq) || vb2_is_busy(&dev->vb2_vbiq)) if (vb2_is_busy(&dev->vb2_vidq) || vb2_is_busy(&dev->vb2_vbiq))
return -EBUSY; return -EBUSY;
@ -804,7 +800,7 @@ void cx88_querycap(struct file *file, struct cx88_core *core,
strlcpy(cap->card, core->board.name, sizeof(cap->card)); strlcpy(cap->card, core->board.name, sizeof(cap->card));
cap->device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING; 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; cap->device_caps |= V4L2_CAP_TUNER;
switch (vdev->vfl_type) { switch (vdev->vfl_type) {
case VFL_TYPE_RADIO: case VFL_TYPE_RADIO:
@ -901,6 +897,7 @@ static int vidioc_enum_input (struct file *file, void *priv,
{ {
struct cx8800_dev *dev = video_drvdata(file); struct cx8800_dev *dev = video_drvdata(file);
struct cx88_core *core = dev->core; struct cx88_core *core = dev->core;
return cx88_enum_input(core, i); return cx88_enum_input(core, i);
} }
@ -935,9 +932,9 @@ static int vidioc_g_tuner (struct file *file, void *priv,
struct cx88_core *core = dev->core; struct cx88_core *core = dev->core;
u32 reg; u32 reg;
if (unlikely(UNSET == core->board.tuner_type)) if (unlikely(core->board.tuner_type == UNSET))
return -EINVAL; return -EINVAL;
if (0 != t->index) if (t->index != 0)
return -EINVAL; return -EINVAL;
strcpy(t->name, "Television"); strcpy(t->name, "Television");
@ -957,9 +954,9 @@ static int vidioc_s_tuner (struct file *file, void *priv,
struct cx8800_dev *dev = video_drvdata(file); struct cx8800_dev *dev = video_drvdata(file);
struct cx88_core *core = dev->core; struct cx88_core *core = dev->core;
if (UNSET == core->board.tuner_type) if (core->board.tuner_type == UNSET)
return -EINVAL; return -EINVAL;
if (0 != t->index) if (t->index != 0)
return -EINVAL; return -EINVAL;
cx88_set_stereo(core, t->audmode, 1); cx88_set_stereo(core, t->audmode, 1);
@ -972,7 +969,7 @@ static int vidioc_g_frequency (struct file *file, void *priv,
struct cx8800_dev *dev = video_drvdata(file); struct cx8800_dev *dev = video_drvdata(file);
struct cx88_core *core = dev->core; struct cx88_core *core = dev->core;
if (unlikely(UNSET == core->board.tuner_type)) if (unlikely(core->board.tuner_type == UNSET))
return -EINVAL; return -EINVAL;
if (f->tuner) if (f->tuner)
return -EINVAL; return -EINVAL;
@ -989,7 +986,7 @@ int cx88_set_freq (struct cx88_core *core,
{ {
struct v4l2_frequency new_freq = *f; struct v4l2_frequency new_freq = *f;
if (unlikely(UNSET == core->board.tuner_type)) if (unlikely(core->board.tuner_type == UNSET))
return -EINVAL; return -EINVAL;
if (unlikely(f->tuner != 0)) if (unlikely(f->tuner != 0))
return -EINVAL; return -EINVAL;
@ -1000,7 +997,7 @@ int cx88_set_freq (struct cx88_core *core,
core->freq = new_freq.frequency; core->freq = new_freq.frequency;
/* When changing channels it is required to reset TVAUDIO */ /* When changing channels it is required to reset TVAUDIO */
msleep (10); usleep_range(10000, 20000);
cx88_set_tvaudio(core); cx88_set_tvaudio(core);
return 0; return 0;
@ -1065,7 +1062,7 @@ static int radio_s_tuner (struct file *file, void *priv,
struct cx8800_dev *dev = video_drvdata(file); struct cx8800_dev *dev = video_drvdata(file);
struct cx88_core *core = dev->core; struct cx88_core *core = dev->core;
if (0 != t->index) if (t->index != 0)
return -EINVAL; return -EINVAL;
call_all(core, tuner, s_tuner, t); call_all(core, tuner, s_tuner, t);
@ -1132,7 +1129,7 @@ static irqreturn_t cx8800_irq(int irq, void *dev_id)
for (loop = 0; loop < 10; loop++) { for (loop = 0; loop < 10; loop++) {
status = cx_read(MO_PCI_INTSTAT) & status = cx_read(MO_PCI_INTSTAT) &
(core->pci_irqmask | PCI_INT_VIDINT); (core->pci_irqmask | PCI_INT_VIDINT);
if (0 == status) if (status == 0)
goto out; goto out;
cx_write(MO_PCI_INTSTAT, status); cx_write(MO_PCI_INTSTAT, status);
handled = 1; handled = 1;
@ -1142,7 +1139,7 @@ static irqreturn_t cx8800_irq(int irq, void *dev_id)
if (status & PCI_INT_VIDINT) if (status & PCI_INT_VIDINT)
cx8800_vid_irq(dev); cx8800_vid_irq(dev);
} }
if (10 == loop) { if (loop == 10) {
pr_warn("irq loop -- clearing mask\n"); pr_warn("irq loop -- clearing mask\n");
cx_write(MO_PCI_INTMSK, 0); cx_write(MO_PCI_INTMSK, 0);
} }
@ -1154,8 +1151,8 @@ static irqreturn_t cx8800_irq(int irq, void *dev_id)
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
/* exported stuff */ /* exported stuff */
static const struct v4l2_file_operations video_fops = static const struct v4l2_file_operations video_fops = {
{
.owner = THIS_MODULE, .owner = THIS_MODULE,
.open = v4l2_fh_open, .open = v4l2_fh_open,
.release = vb2_fop_release, .release = vb2_fop_release,
@ -1234,8 +1231,8 @@ static const struct video_device cx8800_vbi_template = {
.tvnorms = CX88_NORMS, .tvnorms = CX88_NORMS,
}; };
static const struct v4l2_file_operations radio_fops = static const struct v4l2_file_operations radio_fops = {
{
.owner = THIS_MODULE, .owner = THIS_MODULE,
.open = radio_open, .open = radio_open,
.poll = v4l2_ctrl_poll, .poll = v4l2_ctrl_poll,
@ -1290,7 +1287,7 @@ static int cx8800_initdev(struct pci_dev *pci_dev,
int i; int i;
dev = kzalloc(sizeof(*dev), GFP_KERNEL); dev = kzalloc(sizeof(*dev), GFP_KERNEL);
if (NULL == dev) if (dev == NULL)
return -ENOMEM; return -ENOMEM;
/* pci init */ /* pci init */
@ -1300,7 +1297,7 @@ static int cx8800_initdev(struct pci_dev *pci_dev,
goto fail_free; goto fail_free;
} }
core = cx88_core_get(dev->pci); core = cx88_core_get(dev->pci);
if (NULL == core) { if (core == NULL) {
err = -EINVAL; err = -EINVAL;
goto fail_free; goto fail_free;
} }
@ -1584,7 +1581,7 @@ static int cx8800_suspend(struct pci_dev *pci_dev, pm_message_t state)
cx88_shutdown(core); cx88_shutdown(core);
pci_save_state(pci_dev); 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); pci_disable_device(pci_dev);
dev->state.disabled = 1; dev->state.disabled = 1;
} }

View File

@ -1,25 +1,19 @@
/* /*
* cx88-vp3054-i2c.c -- support for the secondary I2C bus of the
cx88-vp3054-i2c.c -- support for the secondary I2C bus of the * DNTV Live! DVB-T Pro (VP-3054), wired as:
DNTV Live! DVB-T Pro (VP-3054), wired as: * GPIO[0] -> SCL, GPIO[1] -> SDA
GPIO[0] -> SCL, GPIO[1] -> SDA *
* (c) 2005 Chris Pascoe <c.pascoe@itee.uq.edu.au>
(c) 2005 Chris Pascoe <c.pascoe@itee.uq.edu.au> *
* This program is free software; you can redistribute it and/or modify
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
it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or
the Free Software Foundation; either version 2 of the License, or * (at your option) any later version.
(at your option) any later version. *
* This program is distributed in the hope that it will be useful,
This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of
but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details.
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.h"
@ -132,7 +126,7 @@ int vp3054_i2c_probe(struct cx8802_dev *dev)
vp3054_bit_setsda(dev, 1); vp3054_bit_setsda(dev, 1);
rc = i2c_bit_add_bus(&vp3054_i2c->adap); rc = i2c_bit_add_bus(&vp3054_i2c->adap);
if (0 != rc) { if (rc != 0) {
pr_err("vp3054_i2c register FAILED\n"); pr_err("vp3054_i2c register FAILED\n");
kfree(dev->vp3054); kfree(dev->vp3054);

View File

@ -13,10 +13,6 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * 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 #ifndef CX88_H
@ -388,8 +384,8 @@ struct cx88_core {
/* state info */ /* state info */
struct task_struct *kthread; struct task_struct *kthread;
v4l2_std_id tvnorm; v4l2_std_id tvnorm;
unsigned width, height; unsigned int width, height;
unsigned field; unsigned int field;
enum cx88_tvaudio tvaudio; enum cx88_tvaudio tvaudio;
u32 audiomode_manual; u32 audiomode_manual;
u32 audiomode_current; u32 audiomode_current;
@ -708,7 +704,8 @@ int cx8802_register_driver(struct cx8802_driver *drv);
int cx8802_unregister_driver(struct cx8802_driver *drv); int cx8802_unregister_driver(struct cx8802_driver *drv);
/* Caller must hold core->lock */ /* 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 */ /* cx88-dsp.c */