Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1a9fc855 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab
Browse files

V4L/DVB (12733): cx25821: some CodingStyle fixes



The original driver were generated with some dos editor, and used their
own coding style.

This patch does some automatic CodingStyle fixes, by running dos2unix
and Lindent tools.

More work still needs to be done for it to use upstream CodingStyle.

Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent bb4c9a74
Loading
Loading
Loading
Loading
+206 −207
Original line number Original line Diff line number Diff line
@@ -20,7 +20,6 @@
 *
 *
 */
 */



#include <linux/module.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/device.h>
@@ -37,7 +36,6 @@
#include <sound/initval.h>
#include <sound/initval.h>
#include <sound/tlv.h>
#include <sound/tlv.h>



#include "cx25821.h"
#include "cx25821.h"
#include "cx25821-reg.h"
#include "cx25821-reg.h"


@@ -49,12 +47,10 @@
#define dprintk_core(level,fmt, arg...)	if (debug >= level) \
#define dprintk_core(level,fmt, arg...)	if (debug >= level) \
	printk(KERN_DEBUG "%s/1: " fmt, chip->dev->name , ## arg)
	printk(KERN_DEBUG "%s/1: " fmt, chip->dev->name , ## arg)



/****************************************************************************
/****************************************************************************
	Data type declarations - Can be moded to a header file later
	Data type declarations - Can be moded to a header file later
 ****************************************************************************/
 ****************************************************************************/



static struct snd_card *snd_cx25821_cards[SNDRV_CARDS];
static struct snd_card *snd_cx25821_cards[SNDRV_CARDS];
static int devno;
static int devno;


@@ -87,7 +83,6 @@ struct cx25821_audio_dev {
typedef struct cx25821_audio_dev snd_cx25821_card_t;
typedef struct cx25821_audio_dev snd_cx25821_card_t;





/****************************************************************************
/****************************************************************************
			Module global static vars
			Module global static vars
 ****************************************************************************/
 ****************************************************************************/
@@ -102,7 +97,6 @@ MODULE_PARM_DESC(enable, "Enable cx25821 soundcard. default enabled.");
module_param_array(index, int, NULL, 0444);
module_param_array(index, int, NULL, 0444);
MODULE_PARM_DESC(index, "Index value for cx25821 capture interface(s).");
MODULE_PARM_DESC(index, "Index value for cx25821 capture interface(s).");



/****************************************************************************
/****************************************************************************
				Module macros
				Module macros
 ****************************************************************************/
 ****************************************************************************/
@@ -144,17 +138,20 @@ static int _cx25821_start_audio_dma(snd_cx25821_card_t *chip)
{
{
	struct cx25821_buffer *buf = chip->buf;
	struct cx25821_buffer *buf = chip->buf;
	struct cx25821_dev *dev = chip->dev;
	struct cx25821_dev *dev = chip->dev;
	struct sram_channel *audio_ch = &cx25821_sram_channels[AUDIO_SRAM_CHANNEL];
	struct sram_channel *audio_ch =
	    &cx25821_sram_channels[AUDIO_SRAM_CHANNEL];
	u32 tmp = 0;
	u32 tmp = 0;


	// enable output on the GPIO 0 for the MCLK ADC (Audio)
	// enable output on the GPIO 0 for the MCLK ADC (Audio)
	cx25821_set_gpiopin_direction(chip->dev, 0, 0);
	cx25821_set_gpiopin_direction(chip->dev, 0, 0);


	/* Make sure RISC/FIFO are off before changing FIFO/RISC settings */
	/* Make sure RISC/FIFO are off before changing FIFO/RISC settings */
	cx_clear(AUD_INT_DMA_CTL, FLD_AUD_DST_A_RISC_EN | FLD_AUD_DST_A_FIFO_EN );
	cx_clear(AUD_INT_DMA_CTL,
		 FLD_AUD_DST_A_RISC_EN | FLD_AUD_DST_A_FIFO_EN);


	/* setup fifo + format - out channel */
	/* setup fifo + format - out channel */
	cx25821_sram_channel_setup_audio(chip->dev, audio_ch, buf->bpl, buf->risc.dma);
	cx25821_sram_channel_setup_audio(chip->dev, audio_ch, buf->bpl,
					 buf->risc.dma);


	/* sets bpl size */
	/* sets bpl size */
	cx_write(AUD_A_LNGTH, buf->bpl);
	cx_write(AUD_A_LNGTH, buf->bpl);
@@ -165,15 +162,18 @@ static int _cx25821_start_audio_dma(snd_cx25821_card_t *chip)


	//Set the input mode to 16-bit
	//Set the input mode to 16-bit
	tmp = cx_read(AUD_A_CFG);
	tmp = cx_read(AUD_A_CFG);
    cx_write(AUD_A_CFG, tmp | FLD_AUD_DST_PK_MODE | FLD_AUD_DST_ENABLE | FLD_AUD_CLK_ENABLE);
	cx_write(AUD_A_CFG,
		 tmp | FLD_AUD_DST_PK_MODE | FLD_AUD_DST_ENABLE |
		 FLD_AUD_CLK_ENABLE);


	//printk(KERN_INFO "DEBUG: Start audio DMA, %d B/line, cmds_start(0x%x)= %d lines/FIFO, %d periods, %d "
	//printk(KERN_INFO "DEBUG: Start audio DMA, %d B/line, cmds_start(0x%x)= %d lines/FIFO, %d periods, %d "
	//      "byte buffer\n", buf->bpl, audio_ch->cmds_start, cx_read(audio_ch->cmds_start + 12)>>1,
	//      "byte buffer\n", buf->bpl, audio_ch->cmds_start, cx_read(audio_ch->cmds_start + 12)>>1,
	//      chip->num_periods, buf->bpl * chip->num_periods);
	//      chip->num_periods, buf->bpl * chip->num_periods);



	/* Enables corresponding bits at AUD_INT_STAT */
	/* Enables corresponding bits at AUD_INT_STAT */
	cx_write(AUD_A_INT_MSK, FLD_AUD_DST_RISCI1 | FLD_AUD_DST_OF | FLD_AUD_DST_SYNC | FLD_AUD_DST_OPC_ERR );
	cx_write(AUD_A_INT_MSK,
		 FLD_AUD_DST_RISCI1 | FLD_AUD_DST_OF | FLD_AUD_DST_SYNC |
		 FLD_AUD_DST_OPC_ERR);


	/* Clean any pending interrupt bits already set */
	/* Clean any pending interrupt bits already set */
	cx_write(AUD_A_INT_STAT, ~0);
	cx_write(AUD_A_INT_STAT, ~0);
@@ -183,7 +183,8 @@ static int _cx25821_start_audio_dma(snd_cx25821_card_t *chip)


	// Turn on audio downstream fifo and risc enable 0x101
	// Turn on audio downstream fifo and risc enable 0x101
	tmp = cx_read(AUD_INT_DMA_CTL);
	tmp = cx_read(AUD_INT_DMA_CTL);
	cx_set(AUD_INT_DMA_CTL, tmp | (FLD_AUD_DST_A_RISC_EN | FLD_AUD_DST_A_FIFO_EN) );
	cx_set(AUD_INT_DMA_CTL,
	       tmp | (FLD_AUD_DST_A_RISC_EN | FLD_AUD_DST_A_FIFO_EN));


	mdelay(100);
	mdelay(100);
	return 0;
	return 0;
@@ -197,11 +198,14 @@ static int _cx25821_stop_audio_dma(snd_cx25821_card_t *chip)
	struct cx25821_dev *dev = chip->dev;
	struct cx25821_dev *dev = chip->dev;


	/* stop dma */
	/* stop dma */
	cx_clear(AUD_INT_DMA_CTL,  FLD_AUD_DST_A_RISC_EN | FLD_AUD_DST_A_FIFO_EN );
	cx_clear(AUD_INT_DMA_CTL,
		 FLD_AUD_DST_A_RISC_EN | FLD_AUD_DST_A_FIFO_EN);


	/* disable irqs */
	/* disable irqs */
	cx_clear(PCI_INT_MSK, PCI_MSK_AUD_INT);
	cx_clear(PCI_INT_MSK, PCI_MSK_AUD_INT);
	cx_clear(AUD_A_INT_MSK, AUD_INT_OPC_ERR | AUD_INT_DN_SYNC |	AUD_INT_DN_RISCI2 | AUD_INT_DN_RISCI1);
	cx_clear(AUD_A_INT_MSK,
		 AUD_INT_OPC_ERR | AUD_INT_DN_SYNC | AUD_INT_DN_RISCI2 |
		 AUD_INT_DN_RISCI1);


	return 0;
	return 0;
}
}
@@ -231,31 +235,35 @@ static void cx25821_aud_irq(snd_cx25821_card_t *chip, u32 status, u32 mask)
{
{
	struct cx25821_dev *dev = chip->dev;
	struct cx25821_dev *dev = chip->dev;


	if (0 == (status & mask))
	if (0 == (status & mask)) {
	{
		return;
		return;
	}
	}


	cx_write(AUD_A_INT_STAT, status);
	cx_write(AUD_A_INT_STAT, status);
	if (debug > 1 || (status & mask & ~0xff))
	if (debug > 1 || (status & mask & ~0xff))
		cx25821_print_irqbits(dev->name, "irq aud",
		cx25821_print_irqbits(dev->name, "irq aud",
				   cx25821_aud_irqs, ARRAY_SIZE(cx25821_aud_irqs),
				      cx25821_aud_irqs,
				   status, mask);
				      ARRAY_SIZE(cx25821_aud_irqs), status,
				      mask);


	/* risc op code error */
	/* risc op code error */
	if (status & AUD_INT_OPC_ERR) {
	if (status & AUD_INT_OPC_ERR) {
		printk(KERN_WARNING "WARNING %s/1: Audio risc op code error\n",dev->name);
		printk(KERN_WARNING "WARNING %s/1: Audio risc op code error\n",
		       dev->name);


		cx_clear(AUD_INT_DMA_CTL, FLD_AUD_DST_A_RISC_EN | FLD_AUD_DST_A_FIFO_EN );
		cx_clear(AUD_INT_DMA_CTL,
		cx25821_sram_channel_dump_audio(dev, &cx25821_sram_channels[AUDIO_SRAM_CHANNEL]);
			 FLD_AUD_DST_A_RISC_EN | FLD_AUD_DST_A_FIFO_EN);
		cx25821_sram_channel_dump_audio(dev,
						&cx25821_sram_channels
						[AUDIO_SRAM_CHANNEL]);
	}
	}
	if (status & AUD_INT_DN_SYNC) {
	if (status & AUD_INT_DN_SYNC) {
		printk(KERN_WARNING "WARNING %s: Downstream sync error!\n",dev->name);
		printk(KERN_WARNING "WARNING %s: Downstream sync error!\n",
		       dev->name);
		cx_write(AUD_A_GPCNT_CTL, GP_COUNT_CONTROL_RESET);
		cx_write(AUD_A_GPCNT_CTL, GP_COUNT_CONTROL_RESET);
		return;
		return;
	}
	}



	/* risc1 downstream */
	/* risc1 downstream */
	if (status & AUD_INT_DN_RISCI1) {
	if (status & AUD_INT_DN_RISCI1) {
		atomic_set(&chip->count, cx_read(AUD_A_GPCNT));
		atomic_set(&chip->count, cx_read(AUD_A_GPCNT));
@@ -263,7 +271,6 @@ static void cx25821_aud_irq(snd_cx25821_card_t *chip, u32 status, u32 mask)
	}
	}
}
}



/*
/*
 * BOARD Specific: Handles IRQ calls
 * BOARD Specific: Handles IRQ calls
 */
 */
@@ -276,30 +283,26 @@ static irqreturn_t cx25821_irq(int irq, void *dev_id)
	int loop, handled = 0;
	int loop, handled = 0;
	int audint_count = 0;
	int audint_count = 0;



	audint_status = cx_read(AUD_A_INT_STAT);
	audint_status = cx_read(AUD_A_INT_STAT);
	audint_mask = cx_read(AUD_A_INT_MSK);
	audint_mask = cx_read(AUD_A_INT_MSK);
	audint_count = cx_read(AUD_A_GPCNT);
	audint_count = cx_read(AUD_A_GPCNT);
	status = cx_read(PCI_INT_STAT);
	status = cx_read(PCI_INT_STAT);


	for (loop = 0; loop < 1; loop++)
	for (loop = 0; loop < 1; loop++) {
	{
		status = cx_read(PCI_INT_STAT);
		status = cx_read(PCI_INT_STAT);
		if (0 == status)
		if (0 == status) {
		{
			status = cx_read(PCI_INT_STAT);
			status = cx_read(PCI_INT_STAT);
			audint_status = cx_read(AUD_A_INT_STAT);
			audint_status = cx_read(AUD_A_INT_STAT);
			audint_mask = cx_read(AUD_A_INT_MSK);
			audint_mask = cx_read(AUD_A_INT_MSK);


			if (status)
			if (status) {
			{
				handled = 1;
				handled = 1;
				cx_write(PCI_INT_STAT, status);
				cx_write(PCI_INT_STAT, status);


				cx25821_aud_irq(chip, audint_status, audint_mask);
				cx25821_aud_irq(chip, audint_status,
						audint_mask);
				break;
				break;
			}
			} else
			else
				goto out;
				goto out;
		}
		}


@@ -318,7 +321,6 @@ static irqreturn_t cx25821_irq(int irq, void *dev_id)
	return IRQ_RETVAL(handled);
	return IRQ_RETVAL(handled);
}
}



static int dsp_buffer_free(snd_cx25821_card_t * chip)
static int dsp_buffer_free(snd_cx25821_card_t * chip)
{
{
	BUG_ON(!chip->dma_size);
	BUG_ON(!chip->dma_size);
@@ -346,8 +348,7 @@ static int dsp_buffer_free(snd_cx25821_card_t *chip)
static struct snd_pcm_hardware snd_cx25821_digital_hw = {
static struct snd_pcm_hardware snd_cx25821_digital_hw = {
	.info = SNDRV_PCM_INFO_MMAP |
	.info = SNDRV_PCM_INFO_MMAP |
	    SNDRV_PCM_INFO_INTERLEAVED |
	    SNDRV_PCM_INFO_INTERLEAVED |
		SNDRV_PCM_INFO_BLOCK_TRANSFER |
	    SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_MMAP_VALID,
		SNDRV_PCM_INFO_MMAP_VALID,
	.formats = SNDRV_PCM_FMTBIT_S16_LE,
	.formats = SNDRV_PCM_FMTBIT_S16_LE,


	.rates = SNDRV_PCM_RATE_48000,
	.rates = SNDRV_PCM_RATE_48000,
@@ -364,8 +365,6 @@ static struct snd_pcm_hardware snd_cx25821_digital_hw = {
	.buffer_bytes_max = (AUDIO_LINE_SIZE * AUDIO_LINE_SIZE),	//128*128 = 16384 = 1024 * 16
	.buffer_bytes_max = (AUDIO_LINE_SIZE * AUDIO_LINE_SIZE),	//128*128 = 16384 = 1024 * 16
};
};




/*
/*
 * audio pcm capture open callback
 * audio pcm capture open callback
 */
 */
@@ -382,7 +381,8 @@ static int snd_cx25821_pcm_open(struct snd_pcm_substream *substream)
		return -ENODEV;
		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)
	if (err < 0)
		goto _error;
		goto _error;


@@ -390,13 +390,12 @@ static int snd_cx25821_pcm_open(struct snd_pcm_substream *substream)


	runtime->hw = snd_cx25821_digital_hw;
	runtime->hw = snd_cx25821_digital_hw;


	if (cx25821_sram_channels[AUDIO_SRAM_CHANNEL].fifo_size != DEFAULT_FIFO_SIZE)
	if (cx25821_sram_channels[AUDIO_SRAM_CHANNEL].fifo_size !=
	{
	    DEFAULT_FIFO_SIZE) {
		bpl = cx25821_sram_channels[AUDIO_SRAM_CHANNEL].fifo_size / 3;	//since there are 3 audio Clusters
		bpl = cx25821_sram_channels[AUDIO_SRAM_CHANNEL].fifo_size / 3;	//since there are 3 audio Clusters
		bpl &= ~7;	/* must be multiple of 8 */
		bpl &= ~7;	/* must be multiple of 8 */


		if( bpl > AUDIO_LINE_SIZE )
		if (bpl > AUDIO_LINE_SIZE) {
		{
			bpl = AUDIO_LINE_SIZE;
			bpl = AUDIO_LINE_SIZE;
		}
		}
		runtime->hw.period_bytes_min = bpl;
		runtime->hw.period_bytes_min = bpl;
@@ -434,7 +433,6 @@ static int snd_cx25821_hw_params(struct snd_pcm_substream * substream,
		substream->runtime->dma_area = NULL;
		substream->runtime->dma_area = NULL;
	}
	}



	chip->period_size = params_period_bytes(hw_params);
	chip->period_size = params_period_bytes(hw_params);
	chip->num_periods = params_periods(hw_params);
	chip->num_periods = params_periods(hw_params);
	chip->dma_size = chip->period_size * params_periods(hw_params);
	chip->dma_size = chip->period_size * params_periods(hw_params);
@@ -446,13 +444,10 @@ static int snd_cx25821_hw_params(struct snd_pcm_substream * substream,
	if (NULL == buf)
	if (NULL == buf)
		return -ENOMEM;
		return -ENOMEM;



	if (chip->period_size > AUDIO_LINE_SIZE) {
	if( chip->period_size > AUDIO_LINE_SIZE )
	{
		chip->period_size = AUDIO_LINE_SIZE;
		chip->period_size = AUDIO_LINE_SIZE;
	}
	}



	buf->vb.memory = V4L2_MEMORY_MMAP;
	buf->vb.memory = V4L2_MEMORY_MMAP;
	buf->vb.field = V4L2_FIELD_NONE;
	buf->vb.field = V4L2_FIELD_NONE;
	buf->vb.width = chip->period_size;
	buf->vb.width = chip->period_size;
@@ -464,7 +459,8 @@ static int snd_cx25821_hw_params(struct snd_pcm_substream * substream,
	videobuf_dma_init(dma);
	videobuf_dma_init(dma);


	ret = videobuf_dma_init_kernel(dma, PCI_DMA_FROMDEVICE,
	ret = videobuf_dma_init_kernel(dma, PCI_DMA_FROMDEVICE,
			(PAGE_ALIGN(buf->vb.size) >> PAGE_SHIFT));
				       (PAGE_ALIGN(buf->vb.size) >>
					PAGE_SHIFT));
	if (ret < 0)
	if (ret < 0)
		goto error;
		goto error;


@@ -472,15 +468,15 @@ static int snd_cx25821_hw_params(struct snd_pcm_substream * substream,
	if (ret < 0)
	if (ret < 0)
		goto error;
		goto error;



	ret =
	ret = cx25821_risc_databuffer_audio(chip->pci, &buf->risc, dma->sglist,  buf->vb.width, buf->vb.height, 1);
	    cx25821_risc_databuffer_audio(chip->pci, &buf->risc, dma->sglist,
	if (ret < 0)
					  buf->vb.width, buf->vb.height, 1);
	{
	if (ret < 0) {
		printk(KERN_INFO "DEBUG: ERROR after cx25821_risc_databuffer_audio() \n");
		printk(KERN_INFO
		       "DEBUG: ERROR after cx25821_risc_databuffer_audio() \n");
		goto error;
		goto error;
	}
	}



	/* Loop back to start of program */
	/* 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);
	buf->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
@@ -528,7 +524,8 @@ static int snd_cx25821_prepare(struct snd_pcm_substream *substream)
/*
/*
 * trigger callback
 * trigger callback
 */
 */
static int snd_cx25821_card_trigger(struct snd_pcm_substream *substream, int cmd)
static int snd_cx25821_card_trigger(struct snd_pcm_substream *substream,
				    int cmd)
{
{
	snd_cx25821_card_t *chip = snd_pcm_substream_chip(substream);
	snd_cx25821_card_t *chip = snd_pcm_substream_chip(substream);
	int err = 0;
	int err = 0;
@@ -536,8 +533,7 @@ static int snd_cx25821_card_trigger(struct snd_pcm_substream *substream, int cmd
	/* Local interrupts are already disabled by ALSA */
	/* Local interrupts are already disabled by ALSA */
	spin_lock(&chip->reg_lock);
	spin_lock(&chip->reg_lock);


	switch (cmd)
	switch (cmd) {
	{
	case SNDRV_PCM_TRIGGER_START:
	case SNDRV_PCM_TRIGGER_START:
		err = _cx25821_start_audio_dma(chip);
		err = _cx25821_start_audio_dma(chip);
		break;
		break;
@@ -557,7 +553,8 @@ static int snd_cx25821_card_trigger(struct snd_pcm_substream *substream, int cmd
/*
/*
 * pointer callback
 * pointer callback
 */
 */
static snd_pcm_uframes_t snd_cx25821_pointer(struct snd_pcm_substream *substream)
static snd_pcm_uframes_t snd_cx25821_pointer(struct snd_pcm_substream
					     *substream)
{
{
	snd_cx25821_card_t *chip = snd_pcm_substream_chip(substream);
	snd_cx25821_card_t *chip = snd_pcm_substream_chip(substream);
	struct snd_pcm_runtime *runtime = substream->runtime;
	struct snd_pcm_runtime *runtime = substream->runtime;
@@ -594,7 +591,6 @@ static struct snd_pcm_ops snd_cx25821_pcm_ops = {
	.page = snd_cx25821_page,
	.page = snd_cx25821_page,
};
};



/*
/*
 * ALSA create a PCM device:  Called when initializing the board. Sets up the name and hooks up
 * ALSA create a PCM device:  Called when initializing the board. Sets up the name and hooks up
 *  the callbacks
 *  the callbacks
@@ -605,9 +601,9 @@ static int snd_cx25821_pcm(snd_cx25821_card_t *chip, int device, char *name)
	int err;
	int err;


	err = snd_pcm_new(chip->card, name, device, 0, 1, &pcm);
	err = snd_pcm_new(chip->card, name, device, 0, 1, &pcm);
	if (err < 0)
	if (err < 0) {
	{
		printk(KERN_INFO "ERROR: FAILED snd_pcm_new() in %s\n",
		printk(KERN_INFO "ERROR: FAILED snd_pcm_new() in %s\n", __func__);
		       __func__);
		return err;
		return err;
	}
	}
	pcm->private_data = chip;
	pcm->private_data = chip;
@@ -618,7 +614,6 @@ static int snd_cx25821_pcm(snd_cx25821_card_t *chip, int device, char *name)
	return 0;
	return 0;
}
}



/****************************************************************************
/****************************************************************************
			Basic Flow for Sound Devices
			Basic Flow for Sound Devices
 ****************************************************************************/
 ****************************************************************************/
@@ -632,6 +627,7 @@ static struct pci_device_id cx25821_audio_pci_tbl[] __devinitdata = {
	{0x14f1, 0x0920, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
	{0x14f1, 0x0920, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
	{0,}
	{0,}
};
};

MODULE_DEVICE_TABLE(pci, cx25821_audio_pci_tbl);
MODULE_DEVICE_TABLE(pci, cx25821_audio_pci_tbl);


/*
/*
@@ -662,7 +658,6 @@ static void snd_cx25821_dev_free(struct snd_card * card)
	snd_card_free(chip->card);
	snd_card_free(chip->card);
}
}



/*
/*
 * Alsa Constructor - Component probe
 * Alsa Constructor - Component probe
 */
 */
@@ -672,9 +667,9 @@ static int cx25821_audio_initdev(struct cx25821_dev *dev)
	snd_cx25821_card_t *chip;
	snd_cx25821_card_t *chip;
	int err;
	int err;


	if (devno >= SNDRV_CARDS)
	if (devno >= SNDRV_CARDS) {
	{
		printk(KERN_INFO "DEBUG ERROR: devno >= SNDRV_CARDS %s\n",
	    printk(KERN_INFO "DEBUG ERROR: devno >= SNDRV_CARDS %s\n", __func__);
		       __func__);
		return (-ENODEV);
		return (-ENODEV);
	}
	}


@@ -684,10 +679,13 @@ static int cx25821_audio_initdev(struct cx25821_dev *dev)
		return (-ENOENT);
		return (-ENOENT);
	}
	}


	card = snd_card_new(index[devno], id[devno], THIS_MODULE, sizeof(snd_cx25821_card_t));
	card =
	if (!card)
	    snd_card_new(index[devno], id[devno], THIS_MODULE,
	{
			 sizeof(snd_cx25821_card_t));
	    printk(KERN_INFO "DEBUG ERROR: cannot create snd_card_new in %s\n", __func__);
	if (!card) {
		printk(KERN_INFO
		       "DEBUG ERROR: cannot create snd_card_new in %s\n",
		       __func__);
		return (-ENOMEM);
		return (-ENOMEM);
	}
	}


@@ -703,37 +701,38 @@ static int cx25821_audio_initdev(struct cx25821_dev *dev)
	chip->pci = dev->pci;
	chip->pci = dev->pci;
	chip->iobase = pci_resource_start(dev->pci, 0);
	chip->iobase = pci_resource_start(dev->pci, 0);



	chip->irq = dev->pci->irq;
	chip->irq = dev->pci->irq;


	err = request_irq(dev->pci->irq, cx25821_irq,
	err = request_irq(dev->pci->irq, cx25821_irq,
			  IRQF_SHARED | IRQF_DISABLED, chip->dev->name, chip);
			  IRQF_SHARED | IRQF_DISABLED, chip->dev->name, chip);


	if (err < 0) {
	if (err < 0) {
		printk(KERN_ERR "ERROR %s: can't get IRQ %d for ALSA\n", chip->dev->name, dev->pci->irq);
		printk(KERN_ERR "ERROR %s: can't get IRQ %d for ALSA\n",
		       chip->dev->name, dev->pci->irq);
		goto error;
		goto error;
	}
	}



	if ((err = snd_cx25821_pcm(chip, 0, "cx25821 Digital")) < 0) {
	if ((err = snd_cx25821_pcm(chip, 0, "cx25821 Digital")) < 0)
		printk(KERN_INFO
	{
		       "DEBUG ERROR: cannot create snd_cx25821_pcm %s\n",
	    printk(KERN_INFO "DEBUG ERROR: cannot create snd_cx25821_pcm %s\n", __func__);
		       __func__);
		goto error;
		goto error;
	}
	}


	snd_card_set_dev(card, &chip->pci->dev);
	snd_card_set_dev(card, &chip->pci->dev);



	strcpy(card->shortname, "cx25821");
	strcpy(card->shortname, "cx25821");
	sprintf(card->longname, "%s at 0x%lx irq %d", chip->dev->name, chip->iobase, chip->irq);
	sprintf(card->longname, "%s at 0x%lx irq %d", chip->dev->name,
		chip->iobase, chip->irq);
	strcpy(card->mixername, "CX25821");
	strcpy(card->mixername, "CX25821");


	printk(KERN_INFO "%s/%i: ALSA support for cx25821 boards\n", card->driver, devno);
	printk(KERN_INFO "%s/%i: ALSA support for cx25821 boards\n",
	       card->driver, devno);


	err = snd_card_register(card);
	err = snd_card_register(card);
	if (err < 0)
	if (err < 0) {
	{
		printk(KERN_INFO "DEBUG ERROR: cannot register sound card %s\n",
	    printk(KERN_INFO "DEBUG ERROR: cannot register sound card %s\n", __func__);
		       __func__);
		goto error;
		goto error;
	}
	}


@@ -747,7 +746,6 @@ error:
	return err;
	return err;
}
}



/****************************************************************************
/****************************************************************************
				LINUX MODULE INIT
				LINUX MODULE INIT
 ****************************************************************************/
 ****************************************************************************/
@@ -774,7 +772,8 @@ static int cx25821_alsa_init(void)
	}
	}


	if (dev == NULL)
	if (dev == NULL)
		printk(KERN_INFO "cx25821 ERROR ALSA: no cx25821 cards found\n");
		printk(KERN_INFO
		       "cx25821 ERROR ALSA: no cx25821 cards found\n");


	return 0;
	return 0;


Loading