Commit 5ede94c7 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[media] cx25821: remove bogus btcx_risc dependency

Those btcx_risc functions are meant for use with bttv, other drivers
should just allocate the memory themselves.
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 5d0beeec
...@@ -2,7 +2,6 @@ config VIDEO_CX25821 ...@@ -2,7 +2,6 @@ config VIDEO_CX25821
tristate "Conexant cx25821 support" tristate "Conexant cx25821 support"
depends on VIDEO_DEV && PCI && I2C depends on VIDEO_DEV && PCI && I2C
select I2C_ALGOBIT select I2C_ALGOBIT
select VIDEO_BTCX
select VIDEOBUF_DMA_SG select VIDEOBUF_DMA_SG
---help--- ---help---
This is a video4linux driver for Conexant 25821 based This is a video4linux driver for Conexant 25821 based
......
...@@ -6,4 +6,3 @@ obj-$(CONFIG_VIDEO_CX25821) += cx25821.o ...@@ -6,4 +6,3 @@ obj-$(CONFIG_VIDEO_CX25821) += cx25821.o
obj-$(CONFIG_VIDEO_CX25821_ALSA) += cx25821-alsa.o obj-$(CONFIG_VIDEO_CX25821_ALSA) += cx25821-alsa.o
ccflags-y += -Idrivers/media/i2c ccflags-y += -Idrivers/media/i2c
ccflags-y += -Idrivers/media/common
...@@ -63,7 +63,7 @@ static int devno; ...@@ -63,7 +63,7 @@ static int devno;
struct cx25821_audio_buffer { struct cx25821_audio_buffer {
unsigned int bpl; unsigned int bpl;
struct btcx_riscmem risc; struct cx25821_riscmem risc;
struct videobuf_dmabuf dma; struct videobuf_dmabuf dma;
}; };
...@@ -330,12 +330,14 @@ static irqreturn_t cx25821_irq(int irq, void *dev_id) ...@@ -330,12 +330,14 @@ static irqreturn_t cx25821_irq(int irq, void *dev_id)
static int dsp_buffer_free(struct cx25821_audio_dev *chip) static int dsp_buffer_free(struct cx25821_audio_dev *chip)
{ {
struct cx25821_riscmem *risc = &chip->buf->risc;
BUG_ON(!chip->dma_size); BUG_ON(!chip->dma_size);
dprintk(2, "Freeing buffer\n"); dprintk(2, "Freeing buffer\n");
videobuf_dma_unmap(&chip->pci->dev, chip->dma_risc); videobuf_dma_unmap(&chip->pci->dev, chip->dma_risc);
videobuf_dma_free(chip->dma_risc); videobuf_dma_free(chip->dma_risc);
btcx_riscmem_free(chip->pci, &chip->buf->risc); pci_free_consistent(chip->pci, risc->size, risc->cpu, risc->dma);
kfree(chip->buf); kfree(chip->buf);
chip->dma_risc = NULL; chip->dma_risc = NULL;
......
...@@ -979,6 +979,27 @@ void cx25821_dev_unregister(struct cx25821_dev *dev) ...@@ -979,6 +979,27 @@ void cx25821_dev_unregister(struct cx25821_dev *dev)
} }
EXPORT_SYMBOL(cx25821_dev_unregister); EXPORT_SYMBOL(cx25821_dev_unregister);
int cx25821_riscmem_alloc(struct pci_dev *pci,
struct cx25821_riscmem *risc,
unsigned int size)
{
__le32 *cpu;
dma_addr_t dma = 0;
if (NULL != risc->cpu && risc->size < size)
pci_free_consistent(pci, risc->size, risc->cpu, risc->dma);
if (NULL == risc->cpu) {
cpu = pci_zalloc_consistent(pci, size, &dma);
if (NULL == cpu)
return -ENOMEM;
risc->cpu = cpu;
risc->dma = dma;
risc->size = size;
}
return 0;
}
EXPORT_SYMBOL(cx25821_riscmem_alloc);
static __le32 *cx25821_risc_field(__le32 * rp, struct scatterlist *sglist, static __le32 *cx25821_risc_field(__le32 * rp, struct scatterlist *sglist,
unsigned int offset, u32 sync_line, unsigned int offset, u32 sync_line,
unsigned int bpl, unsigned int padding, unsigned int bpl, unsigned int padding,
...@@ -1035,7 +1056,7 @@ static __le32 *cx25821_risc_field(__le32 * rp, struct scatterlist *sglist, ...@@ -1035,7 +1056,7 @@ static __le32 *cx25821_risc_field(__le32 * rp, struct scatterlist *sglist,
return rp; return rp;
} }
int cx25821_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc, int cx25821_risc_buffer(struct pci_dev *pci, struct cx25821_riscmem *risc,
struct scatterlist *sglist, unsigned int top_offset, struct scatterlist *sglist, unsigned int top_offset,
unsigned int bottom_offset, unsigned int bpl, unsigned int bottom_offset, unsigned int bpl,
unsigned int padding, unsigned int lines) unsigned int padding, unsigned int lines)
...@@ -1059,7 +1080,7 @@ int cx25821_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc, ...@@ -1059,7 +1080,7 @@ int cx25821_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc,
instructions = fields * (1 + ((bpl + padding) * lines) / PAGE_SIZE + instructions = fields * (1 + ((bpl + padding) * lines) / PAGE_SIZE +
lines); lines);
instructions += 2; instructions += 2;
rc = btcx_riscmem_alloc(pci, risc, instructions * 12); rc = cx25821_riscmem_alloc(pci, risc, instructions * 12);
if (rc < 0) if (rc < 0)
return rc; return rc;
...@@ -1146,7 +1167,7 @@ static __le32 *cx25821_risc_field_audio(__le32 * rp, struct scatterlist *sglist, ...@@ -1146,7 +1167,7 @@ static __le32 *cx25821_risc_field_audio(__le32 * rp, struct scatterlist *sglist,
} }
int cx25821_risc_databuffer_audio(struct pci_dev *pci, int cx25821_risc_databuffer_audio(struct pci_dev *pci,
struct btcx_riscmem *risc, struct cx25821_riscmem *risc,
struct scatterlist *sglist, struct scatterlist *sglist,
unsigned int bpl, unsigned int bpl,
unsigned int lines, unsigned int lpi) unsigned int lines, unsigned int lpi)
...@@ -1163,7 +1184,7 @@ int cx25821_risc_databuffer_audio(struct pci_dev *pci, ...@@ -1163,7 +1184,7 @@ int cx25821_risc_databuffer_audio(struct pci_dev *pci,
instructions = 1 + (bpl * lines) / PAGE_SIZE + lines; instructions = 1 + (bpl * lines) / PAGE_SIZE + lines;
instructions += 1; instructions += 1;
rc = btcx_riscmem_alloc(pci, risc, instructions * 12); rc = cx25821_riscmem_alloc(pci, risc, instructions * 12);
if (rc < 0) if (rc < 0)
return rc; return rc;
...@@ -1179,13 +1200,13 @@ int cx25821_risc_databuffer_audio(struct pci_dev *pci, ...@@ -1179,13 +1200,13 @@ int cx25821_risc_databuffer_audio(struct pci_dev *pci,
} }
EXPORT_SYMBOL(cx25821_risc_databuffer_audio); EXPORT_SYMBOL(cx25821_risc_databuffer_audio);
int cx25821_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc, int cx25821_risc_stopper(struct pci_dev *pci, struct cx25821_riscmem *risc,
u32 reg, u32 mask, u32 value) u32 reg, u32 mask, u32 value)
{ {
__le32 *rp; __le32 *rp;
int rc; int rc;
rc = btcx_riscmem_alloc(pci, risc, 4 * 16); rc = cx25821_riscmem_alloc(pci, risc, 4 * 16);
if (rc < 0) if (rc < 0)
return rc; return rc;
...@@ -1211,7 +1232,8 @@ void cx25821_free_buffer(struct videobuf_queue *q, struct cx25821_buffer *buf) ...@@ -1211,7 +1232,8 @@ void cx25821_free_buffer(struct videobuf_queue *q, struct cx25821_buffer *buf)
videobuf_waiton(q, &buf->vb, 0, 0); videobuf_waiton(q, &buf->vb, 0, 0);
videobuf_dma_unmap(q->dev, dma); videobuf_dma_unmap(q->dev, dma);
videobuf_dma_free(dma); videobuf_dma_free(dma);
btcx_riscmem_free(to_pci_dev(q->dev), &buf->risc); pci_free_consistent(to_pci_dev(q->dev),
buf->risc.size, buf->risc.cpu, buf->risc.dma);
buf->vb.state = VIDEOBUF_NEEDS_INIT; buf->vb.state = VIDEOBUF_NEEDS_INIT;
} }
......
...@@ -1017,11 +1017,13 @@ void cx25821_video_unregister(struct cx25821_dev *dev, int chan_num) ...@@ -1017,11 +1017,13 @@ void cx25821_video_unregister(struct cx25821_dev *dev, int chan_num)
cx_clear(PCI_INT_MSK, 1); cx_clear(PCI_INT_MSK, 1);
if (video_is_registered(&dev->channels[chan_num].vdev)) { if (video_is_registered(&dev->channels[chan_num].vdev)) {
struct cx25821_riscmem *risc =
&dev->channels[chan_num].dma_vidq.stopper;
video_unregister_device(&dev->channels[chan_num].vdev); video_unregister_device(&dev->channels[chan_num].vdev);
v4l2_ctrl_handler_free(&dev->channels[chan_num].hdl); v4l2_ctrl_handler_free(&dev->channels[chan_num].hdl);
btcx_riscmem_free(dev->pci, pci_free_consistent(dev->pci, risc->size, risc->cpu, risc->dma);
&dev->channels[chan_num].dma_vidq.stopper);
} }
} }
......
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
#include <media/v4l2-ctrls.h> #include <media/v4l2-ctrls.h>
#include <media/videobuf-dma-sg.h> #include <media/videobuf-dma-sg.h>
#include "btcx-risc.h"
#include "cx25821-reg.h" #include "cx25821-reg.h"
#include "cx25821-medusa-reg.h" #include "cx25821-medusa-reg.h"
#include "cx25821-sram.h" #include "cx25821-sram.h"
...@@ -111,6 +110,13 @@ enum cx25821_src_sel_type { ...@@ -111,6 +110,13 @@ enum cx25821_src_sel_type {
CX25821_SRC_SEL_PARALLEL_MPEG_VIDEO CX25821_SRC_SEL_PARALLEL_MPEG_VIDEO
}; };
struct cx25821_riscmem {
unsigned int size;
__le32 *cpu;
__le32 *jmp;
dma_addr_t dma;
};
/* buffer for one video frame */ /* buffer for one video frame */
struct cx25821_buffer { struct cx25821_buffer {
/* common v4l buffer stuff -- must be first */ /* common v4l buffer stuff -- must be first */
...@@ -118,7 +124,7 @@ struct cx25821_buffer { ...@@ -118,7 +124,7 @@ struct cx25821_buffer {
/* cx25821 specific */ /* cx25821 specific */
unsigned int bpl; unsigned int bpl;
struct btcx_riscmem risc; struct cx25821_riscmem risc;
const struct cx25821_fmt *fmt; const struct cx25821_fmt *fmt;
u32 count; u32 count;
}; };
...@@ -161,7 +167,7 @@ struct cx25821_dmaqueue { ...@@ -161,7 +167,7 @@ struct cx25821_dmaqueue {
struct list_head active; struct list_head active;
struct list_head queued; struct list_head queued;
struct timer_list timeout; struct timer_list timeout;
struct btcx_riscmem stopper; struct cx25821_riscmem stopper;
u32 count; u32 count;
}; };
...@@ -405,20 +411,23 @@ extern int cx25821_sram_channel_setup(struct cx25821_dev *dev, ...@@ -405,20 +411,23 @@ extern int cx25821_sram_channel_setup(struct cx25821_dev *dev,
const struct sram_channel *ch, unsigned int bpl, const struct sram_channel *ch, unsigned int bpl,
u32 risc); u32 risc);
extern int cx25821_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc, extern int cx25821_riscmem_alloc(struct pci_dev *pci,
struct cx25821_riscmem *risc,
unsigned int size);
extern int cx25821_risc_buffer(struct pci_dev *pci, struct cx25821_riscmem *risc,
struct scatterlist *sglist, struct scatterlist *sglist,
unsigned int top_offset, unsigned int top_offset,
unsigned int bottom_offset, unsigned int bottom_offset,
unsigned int bpl, unsigned int bpl,
unsigned int padding, unsigned int lines); unsigned int padding, unsigned int lines);
extern int cx25821_risc_databuffer_audio(struct pci_dev *pci, extern int cx25821_risc_databuffer_audio(struct pci_dev *pci,
struct btcx_riscmem *risc, struct cx25821_riscmem *risc,
struct scatterlist *sglist, struct scatterlist *sglist,
unsigned int bpl, unsigned int bpl,
unsigned int lines, unsigned int lpi); unsigned int lines, unsigned int lpi);
extern void cx25821_free_buffer(struct videobuf_queue *q, extern void cx25821_free_buffer(struct videobuf_queue *q,
struct cx25821_buffer *buf); struct cx25821_buffer *buf);
extern int cx25821_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc, extern int cx25821_risc_stopper(struct pci_dev *pci, struct cx25821_riscmem *risc,
u32 reg, u32 mask, u32 value); u32 reg, u32 mask, u32 value);
extern void cx25821_sram_channel_dump(struct cx25821_dev *dev, extern void cx25821_sram_channel_dump(struct cx25821_dev *dev,
const struct sram_channel *ch); const struct sram_channel *ch);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment