[media] cx88: remove dependency on btcx-risc
btcx-risc is for the bt8xx driver and other drivers shouldn't depend on it. There is no benefit to use that module just to do a pci_zalloc_consistent. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
This commit is contained in:
parent
999b3ceb84
commit
5e7045e3fa
|
@ -2,7 +2,6 @@ config VIDEO_CX88
|
||||||
tristate "Conexant 2388x (bt878 successor) support"
|
tristate "Conexant 2388x (bt878 successor) support"
|
||||||
depends on VIDEO_DEV && PCI && I2C && RC_CORE
|
depends on VIDEO_DEV && PCI && I2C && RC_CORE
|
||||||
select I2C_ALGOBIT
|
select I2C_ALGOBIT
|
||||||
select VIDEO_BTCX
|
|
||||||
select VIDEOBUF2_DMA_SG
|
select VIDEOBUF2_DMA_SG
|
||||||
select VIDEO_TUNER
|
select VIDEO_TUNER
|
||||||
select VIDEO_TVEEPROM
|
select VIDEO_TVEEPROM
|
||||||
|
|
|
@ -11,7 +11,6 @@ obj-$(CONFIG_VIDEO_CX88_DVB) += cx88-dvb.o
|
||||||
obj-$(CONFIG_VIDEO_CX88_VP3054) += cx88-vp3054-i2c.o
|
obj-$(CONFIG_VIDEO_CX88_VP3054) += cx88-vp3054-i2c.o
|
||||||
|
|
||||||
ccflags-y += -Idrivers/media/i2c
|
ccflags-y += -Idrivers/media/i2c
|
||||||
ccflags-y += -Idrivers/media/common
|
|
||||||
ccflags-y += -Idrivers/media/tuners
|
ccflags-y += -Idrivers/media/tuners
|
||||||
ccflags-y += -Idrivers/media/dvb-core
|
ccflags-y += -Idrivers/media/dvb-core
|
||||||
ccflags-y += -Idrivers/media/dvb-frontends
|
ccflags-y += -Idrivers/media/dvb-frontends
|
||||||
|
|
|
@ -61,7 +61,7 @@
|
||||||
|
|
||||||
struct cx88_audio_buffer {
|
struct cx88_audio_buffer {
|
||||||
unsigned int bpl;
|
unsigned int bpl;
|
||||||
struct btcx_riscmem risc;
|
struct cx88_riscmem risc;
|
||||||
void *vaddr;
|
void *vaddr;
|
||||||
struct scatterlist *sglist;
|
struct scatterlist *sglist;
|
||||||
int sglen;
|
int sglen;
|
||||||
|
@ -370,12 +370,15 @@ static int cx88_alsa_dma_free(struct cx88_audio_buffer *buf)
|
||||||
|
|
||||||
static int dsp_buffer_free(snd_cx88_card_t *chip)
|
static int dsp_buffer_free(snd_cx88_card_t *chip)
|
||||||
{
|
{
|
||||||
|
struct cx88_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");
|
||||||
cx88_alsa_dma_unmap(chip);
|
cx88_alsa_dma_unmap(chip);
|
||||||
cx88_alsa_dma_free(chip->buf);
|
cx88_alsa_dma_free(chip->buf);
|
||||||
btcx_riscmem_free(chip->pci, &chip->buf->risc);
|
if (risc->cpu)
|
||||||
|
pci_free_consistent(chip->pci, risc->size, risc->cpu, risc->dma);
|
||||||
kfree(chip->buf);
|
kfree(chip->buf);
|
||||||
|
|
||||||
chip->buf = NULL;
|
chip->buf = NULL;
|
||||||
|
|
|
@ -666,8 +666,11 @@ static void buffer_finish(struct vb2_buffer *vb)
|
||||||
struct cx8802_dev *dev = vb->vb2_queue->drv_priv;
|
struct cx8802_dev *dev = vb->vb2_queue->drv_priv;
|
||||||
struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb);
|
struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb);
|
||||||
struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0);
|
struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0);
|
||||||
|
struct cx88_riscmem *risc = &buf->risc;
|
||||||
|
|
||||||
btcx_riscmem_free(dev->pci, &buf->risc);
|
if (risc->cpu)
|
||||||
|
pci_free_consistent(dev->pci, risc->size, risc->cpu, risc->dma);
|
||||||
|
memset(risc, 0, sizeof(*risc));
|
||||||
|
|
||||||
dma_unmap_sg(&dev->pci->dev, sgt->sgl, sgt->nents, DMA_FROM_DEVICE);
|
dma_unmap_sg(&dev->pci->dev, sgt->sgl, sgt->nents, DMA_FROM_DEVICE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,14 +132,13 @@ static __le32* cx88_risc_field(__le32 *rp, struct scatterlist *sglist,
|
||||||
return rp;
|
return rp;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cx88_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc,
|
int cx88_risc_buffer(struct pci_dev *pci, struct cx88_riscmem *risc,
|
||||||
struct scatterlist *sglist,
|
struct scatterlist *sglist,
|
||||||
unsigned int top_offset, unsigned int bottom_offset,
|
unsigned int top_offset, unsigned int bottom_offset,
|
||||||
unsigned int bpl, unsigned int padding, unsigned int lines)
|
unsigned int bpl, unsigned int padding, unsigned int lines)
|
||||||
{
|
{
|
||||||
u32 instructions,fields;
|
u32 instructions,fields;
|
||||||
__le32 *rp;
|
__le32 *rp;
|
||||||
int rc;
|
|
||||||
|
|
||||||
fields = 0;
|
fields = 0;
|
||||||
if (UNSET != top_offset)
|
if (UNSET != top_offset)
|
||||||
|
@ -153,8 +152,11 @@ int cx88_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc,
|
||||||
region may be smaller than PAGE_SIZE */
|
region may be smaller than PAGE_SIZE */
|
||||||
instructions = fields * (1 + ((bpl + padding) * lines) / PAGE_SIZE + lines);
|
instructions = fields * (1 + ((bpl + padding) * lines) / PAGE_SIZE + lines);
|
||||||
instructions += 4;
|
instructions += 4;
|
||||||
if ((rc = btcx_riscmem_alloc(pci,risc,instructions*8)) < 0)
|
risc->size = instructions * 8;
|
||||||
return rc;
|
risc->dma = 0;
|
||||||
|
risc->cpu = pci_zalloc_consistent(pci, risc->size, &risc->dma);
|
||||||
|
if (NULL == risc->cpu)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
/* write risc instructions */
|
/* write risc instructions */
|
||||||
rp = risc->cpu;
|
rp = risc->cpu;
|
||||||
|
@ -171,13 +173,12 @@ int cx88_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cx88_risc_databuffer(struct pci_dev *pci, struct btcx_riscmem *risc,
|
int cx88_risc_databuffer(struct pci_dev *pci, struct cx88_riscmem *risc,
|
||||||
struct scatterlist *sglist, unsigned int bpl,
|
struct scatterlist *sglist, unsigned int bpl,
|
||||||
unsigned int lines, unsigned int lpi)
|
unsigned int lines, unsigned int lpi)
|
||||||
{
|
{
|
||||||
u32 instructions;
|
u32 instructions;
|
||||||
__le32 *rp;
|
__le32 *rp;
|
||||||
int rc;
|
|
||||||
|
|
||||||
/* estimate risc mem: worst case is one write per page border +
|
/* estimate risc mem: worst case is one write per page border +
|
||||||
one write per scan line + syncs + jump (all 2 dwords). Here
|
one write per scan line + syncs + jump (all 2 dwords). Here
|
||||||
|
@ -185,8 +186,11 @@ int cx88_risc_databuffer(struct pci_dev *pci, struct btcx_riscmem *risc,
|
||||||
than PAGE_SIZE */
|
than PAGE_SIZE */
|
||||||
instructions = 1 + (bpl * lines) / PAGE_SIZE + lines;
|
instructions = 1 + (bpl * lines) / PAGE_SIZE + lines;
|
||||||
instructions += 3;
|
instructions += 3;
|
||||||
if ((rc = btcx_riscmem_alloc(pci,risc,instructions*8)) < 0)
|
risc->size = instructions * 8;
|
||||||
return rc;
|
risc->dma = 0;
|
||||||
|
risc->cpu = pci_zalloc_consistent(pci, risc->size, &risc->dma);
|
||||||
|
if (NULL == risc->cpu)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
/* write risc instructions */
|
/* write risc instructions */
|
||||||
rp = risc->cpu;
|
rp = risc->cpu;
|
||||||
|
|
|
@ -109,8 +109,11 @@ static void buffer_finish(struct vb2_buffer *vb)
|
||||||
struct cx8802_dev *dev = vb->vb2_queue->drv_priv;
|
struct cx8802_dev *dev = vb->vb2_queue->drv_priv;
|
||||||
struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb);
|
struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb);
|
||||||
struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0);
|
struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0);
|
||||||
|
struct cx88_riscmem *risc = &buf->risc;
|
||||||
|
|
||||||
btcx_riscmem_free(dev->pci, &buf->risc);
|
if (risc->cpu)
|
||||||
|
pci_free_consistent(dev->pci, risc->size, risc->cpu, risc->dma);
|
||||||
|
memset(risc, 0, sizeof(*risc));
|
||||||
|
|
||||||
dma_unmap_sg(&dev->pci->dev, sgt->sgl, sgt->nents, DMA_FROM_DEVICE);
|
dma_unmap_sg(&dev->pci->dev, sgt->sgl, sgt->nents, DMA_FROM_DEVICE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -228,6 +228,7 @@ int cx8802_buf_prepare(struct vb2_queue *q, struct cx8802_dev *dev,
|
||||||
{
|
{
|
||||||
int size = dev->ts_packet_size * dev->ts_packet_count;
|
int size = dev->ts_packet_size * dev->ts_packet_count;
|
||||||
struct sg_table *sgt = vb2_dma_sg_plane_desc(&buf->vb, 0);
|
struct sg_table *sgt = vb2_dma_sg_plane_desc(&buf->vb, 0);
|
||||||
|
struct cx88_riscmem *risc = &buf->risc;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (vb2_plane_size(&buf->vb, 0) < size)
|
if (vb2_plane_size(&buf->vb, 0) < size)
|
||||||
|
@ -238,10 +239,12 @@ int cx8802_buf_prepare(struct vb2_queue *q, struct cx8802_dev *dev,
|
||||||
if (!rc)
|
if (!rc)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
rc = cx88_risc_databuffer(dev->pci, &buf->risc, sgt->sgl,
|
rc = cx88_risc_databuffer(dev->pci, risc, sgt->sgl,
|
||||||
dev->ts_packet_size, dev->ts_packet_count, 0);
|
dev->ts_packet_size, dev->ts_packet_count, 0);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
btcx_riscmem_free(dev->pci, &buf->risc);
|
if (risc->cpu)
|
||||||
|
pci_free_consistent(dev->pci, risc->size, risc->cpu, risc->dma);
|
||||||
|
memset(risc, 0, sizeof(*risc));
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -146,8 +146,11 @@ static void buffer_finish(struct vb2_buffer *vb)
|
||||||
struct cx8800_dev *dev = vb->vb2_queue->drv_priv;
|
struct cx8800_dev *dev = vb->vb2_queue->drv_priv;
|
||||||
struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb);
|
struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb);
|
||||||
struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0);
|
struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0);
|
||||||
|
struct cx88_riscmem *risc = &buf->risc;
|
||||||
|
|
||||||
btcx_riscmem_free(dev->pci, &buf->risc);
|
if (risc->cpu)
|
||||||
|
pci_free_consistent(dev->pci, risc->size, risc->cpu, risc->dma);
|
||||||
|
memset(risc, 0, sizeof(*risc));
|
||||||
|
|
||||||
dma_unmap_sg(&dev->pci->dev, sgt->sgl, sgt->nents, DMA_FROM_DEVICE);
|
dma_unmap_sg(&dev->pci->dev, sgt->sgl, sgt->nents, DMA_FROM_DEVICE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -505,8 +505,11 @@ static void buffer_finish(struct vb2_buffer *vb)
|
||||||
struct cx8800_dev *dev = vb->vb2_queue->drv_priv;
|
struct cx8800_dev *dev = vb->vb2_queue->drv_priv;
|
||||||
struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb);
|
struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb);
|
||||||
struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0);
|
struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0);
|
||||||
|
struct cx88_riscmem *risc = &buf->risc;
|
||||||
|
|
||||||
btcx_riscmem_free(dev->pci, &buf->risc);
|
if (risc->cpu)
|
||||||
|
pci_free_consistent(dev->pci, risc->size, risc->cpu, risc->dma);
|
||||||
|
memset(risc, 0, sizeof(*risc));
|
||||||
|
|
||||||
dma_unmap_sg(&dev->pci->dev, sgt->sgl, sgt->nents, DMA_FROM_DEVICE);
|
dma_unmap_sg(&dev->pci->dev, sgt->sgl, sgt->nents, DMA_FROM_DEVICE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,6 @@
|
||||||
#include <media/ir-kbd-i2c.h>
|
#include <media/ir-kbd-i2c.h>
|
||||||
#include <media/wm8775.h>
|
#include <media/wm8775.h>
|
||||||
|
|
||||||
#include "btcx-risc.h"
|
|
||||||
#include "cx88-reg.h"
|
#include "cx88-reg.h"
|
||||||
#include "tuner-xc2028.h"
|
#include "tuner-xc2028.h"
|
||||||
|
|
||||||
|
@ -311,6 +310,13 @@ enum cx88_tvaudio {
|
||||||
|
|
||||||
#define BUFFER_TIMEOUT msecs_to_jiffies(2000)
|
#define BUFFER_TIMEOUT msecs_to_jiffies(2000)
|
||||||
|
|
||||||
|
struct cx88_riscmem {
|
||||||
|
unsigned int size;
|
||||||
|
__le32 *cpu;
|
||||||
|
__le32 *jmp;
|
||||||
|
dma_addr_t dma;
|
||||||
|
};
|
||||||
|
|
||||||
/* buffer for one video frame */
|
/* buffer for one video frame */
|
||||||
struct cx88_buffer {
|
struct cx88_buffer {
|
||||||
/* common v4l buffer stuff -- must be first */
|
/* common v4l buffer stuff -- must be first */
|
||||||
|
@ -319,7 +325,7 @@ struct cx88_buffer {
|
||||||
|
|
||||||
/* cx88 specific */
|
/* cx88 specific */
|
||||||
unsigned int bpl;
|
unsigned int bpl;
|
||||||
struct btcx_riscmem risc;
|
struct cx88_riscmem risc;
|
||||||
u32 count;
|
u32 count;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -616,17 +622,17 @@ extern void cx88_shutdown(struct cx88_core *core);
|
||||||
extern int cx88_reset(struct cx88_core *core);
|
extern int cx88_reset(struct cx88_core *core);
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
cx88_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc,
|
cx88_risc_buffer(struct pci_dev *pci, struct cx88_riscmem *risc,
|
||||||
struct scatterlist *sglist,
|
struct scatterlist *sglist,
|
||||||
unsigned int top_offset, unsigned int bottom_offset,
|
unsigned int top_offset, unsigned int bottom_offset,
|
||||||
unsigned int bpl, unsigned int padding, unsigned int lines);
|
unsigned int bpl, unsigned int padding, unsigned int lines);
|
||||||
extern int
|
extern int
|
||||||
cx88_risc_databuffer(struct pci_dev *pci, struct btcx_riscmem *risc,
|
cx88_risc_databuffer(struct pci_dev *pci, struct cx88_riscmem *risc,
|
||||||
struct scatterlist *sglist, unsigned int bpl,
|
struct scatterlist *sglist, unsigned int bpl,
|
||||||
unsigned int lines, unsigned int lpi);
|
unsigned int lines, unsigned int lpi);
|
||||||
|
|
||||||
extern void cx88_risc_disasm(struct cx88_core *core,
|
extern void cx88_risc_disasm(struct cx88_core *core,
|
||||||
struct btcx_riscmem *risc);
|
struct cx88_riscmem *risc);
|
||||||
extern int cx88_sram_channel_setup(struct cx88_core *core,
|
extern int cx88_sram_channel_setup(struct cx88_core *core,
|
||||||
const struct sram_channel *ch,
|
const struct sram_channel *ch,
|
||||||
unsigned int bpl, u32 risc);
|
unsigned int bpl, u32 risc);
|
||||||
|
|
Loading…
Reference in New Issue