Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 202043
b: refs/heads/master
c: fecfede
h: refs/heads/master
i:
  202041: 19e4fce
  202039: e6c0a14
v: v3
  • Loading branch information
Laurent Pinchart authored and Mauro Carvalho Chehab committed Aug 2, 2010
1 parent 06efce9 commit f951f78
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 31 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 952684035a91334dbe33b15063514cab5e7c6907
refs/heads/master: fecfedeb27ab9497cbdd2c6fb7972082a7ed9263
29 changes: 14 additions & 15 deletions trunk/drivers/media/video/cx88/cx88-alsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@
Data type declarations - Can be moded to a header file later
****************************************************************************/

struct cx88_audio_buffer {
unsigned int bpl;
struct btcx_riscmem risc;
struct videobuf_dmabuf dma;
};

struct cx88_audio_dev {
struct cx88_core *core;
struct cx88_dmaqueue q;
Expand All @@ -75,7 +81,7 @@ struct cx88_audio_dev {

struct videobuf_dmabuf *dma_risc;

struct cx88_buffer *buf;
struct cx88_audio_buffer *buf;

struct snd_pcm_substream *substream;
};
Expand Down Expand Up @@ -123,7 +129,7 @@ MODULE_PARM_DESC(debug,"enable debug messages");

static int _cx88_start_audio_dma(snd_cx88_card_t *chip)
{
struct cx88_buffer *buf = chip->buf;
struct cx88_audio_buffer *buf = chip->buf;
struct cx88_core *core=chip->core;
struct sram_channel *audio_ch = &cx88_sram_channels[SRAM_CH25];

Expand Down Expand Up @@ -376,7 +382,7 @@ static int snd_cx88_hw_params(struct snd_pcm_substream * substream,
snd_cx88_card_t *chip = snd_pcm_substream_chip(substream);
struct videobuf_dmabuf *dma;

struct cx88_buffer *buf;
struct cx88_audio_buffer *buf;
int ret;

if (substream->runtime->dma_area) {
Expand All @@ -391,21 +397,16 @@ static int snd_cx88_hw_params(struct snd_pcm_substream * substream,
BUG_ON(!chip->dma_size);
BUG_ON(chip->num_periods & (chip->num_periods-1));

buf = videobuf_sg_alloc(sizeof(*buf));
buf = kzalloc(sizeof(*buf), GFP_KERNEL);
if (NULL == buf)
return -ENOMEM;

buf->vb.memory = V4L2_MEMORY_MMAP;
buf->vb.field = V4L2_FIELD_NONE;
buf->vb.width = chip->period_size;
buf->bpl = chip->period_size;
buf->vb.height = chip->num_periods;
buf->vb.size = chip->dma_size;
buf->bpl = chip->period_size;

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

Expand All @@ -414,16 +415,14 @@ static int snd_cx88_hw_params(struct snd_pcm_substream * substream,
goto error;

ret = cx88_risc_databuffer(chip->pci, &buf->risc, dma->sglist,
buf->vb.width, buf->vb.height, 1);
chip->period_size, chip->num_periods, 1);
if (ret < 0)
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[1] = cpu_to_le32(buf->risc.dma);

buf->vb.state = VIDEOBUF_PREPARED;

chip->buf = buf;
chip->dma_risc = dma;

Expand Down
29 changes: 14 additions & 15 deletions trunk/drivers/staging/cx25821/cx25821-alsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@
static struct snd_card *snd_cx25821_cards[SNDRV_CARDS];
static int devno;

struct cx25821_audio_buffer {
unsigned int bpl;
struct btcx_riscmem risc;
struct videobuf_dmabuf dma;
};

struct cx25821_audio_dev {
struct cx25821_dev *dev;
struct cx25821_dmaqueue q;
Expand All @@ -77,7 +83,7 @@ struct cx25821_audio_dev {

struct videobuf_dmabuf *dma_risc;

struct cx25821_buffer *buf;
struct cx25821_audio_buffer *buf;

struct snd_pcm_substream *substream;
};
Expand Down Expand Up @@ -136,7 +142,7 @@ MODULE_PARM_DESC(debug, "enable debug messages");

static int _cx25821_start_audio_dma(struct cx25821_audio_dev *chip)
{
struct cx25821_buffer *buf = chip->buf;
struct cx25821_audio_buffer *buf = chip->buf;
struct cx25821_dev *dev = chip->dev;
struct sram_channel *audio_ch =
&cx25821_sram_channels[AUDIO_SRAM_CHANNEL];
Expand Down Expand Up @@ -432,7 +438,7 @@ static int snd_cx25821_hw_params(struct snd_pcm_substream *substream,
struct cx25821_audio_dev *chip = snd_pcm_substream_chip(substream);
struct videobuf_dmabuf *dma;

struct cx25821_buffer *buf;
struct cx25821_audio_buffer *buf;
int ret;

if (substream->runtime->dma_area) {
Expand All @@ -447,25 +453,19 @@ static int snd_cx25821_hw_params(struct snd_pcm_substream *substream,
BUG_ON(!chip->dma_size);
BUG_ON(chip->num_periods & (chip->num_periods - 1));

buf = videobuf_sg_alloc(sizeof(*buf));
buf = kzalloc(sizeof(*buf), GFP_KERNEL);
if (NULL == buf)
return -ENOMEM;

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

buf->vb.memory = V4L2_MEMORY_MMAP;
buf->vb.field = V4L2_FIELD_NONE;
buf->vb.width = chip->period_size;
buf->bpl = chip->period_size;
buf->vb.height = chip->num_periods;
buf->vb.size = chip->dma_size;

dma = videobuf_to_dma(&buf->vb);
dma = &buf->dma;
videobuf_dma_init(dma);

ret = videobuf_dma_init_kernel(dma, PCI_DMA_FROMDEVICE,
(PAGE_ALIGN(buf->vb.size) >>
(PAGE_ALIGN(chip->dma_size) >>
PAGE_SHIFT));
if (ret < 0)
goto error;
Expand All @@ -476,7 +476,8 @@ static int snd_cx25821_hw_params(struct snd_pcm_substream *substream,

ret =
cx25821_risc_databuffer_audio(chip->pci, &buf->risc, dma->sglist,
buf->vb.width, buf->vb.height, 1);
chip->period_size, chip->num_periods,
1);
if (ret < 0) {
printk(KERN_INFO
"DEBUG: ERROR after cx25821_risc_databuffer_audio()\n");
Expand All @@ -488,8 +489,6 @@ static int snd_cx25821_hw_params(struct snd_pcm_substream *substream,
buf->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
buf->risc.jmp[2] = cpu_to_le32(0); /* bits 63-32 */

buf->vb.state = VIDEOBUF_PREPARED;

chip->buf = buf;
chip->dma_risc = dma;

Expand Down

0 comments on commit f951f78

Please sign in to comment.