Skip to content

Commit 5ede94c

Browse files
Hans Verkuilmchehab
authored andcommitted
[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: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
1 parent 5d0beee commit 5ede94c

File tree

6 files changed

+52
-19
lines changed

6 files changed

+52
-19
lines changed

drivers/media/pci/cx25821/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ config VIDEO_CX25821
22
tristate "Conexant cx25821 support"
33
depends on VIDEO_DEV && PCI && I2C
44
select I2C_ALGOBIT
5-
select VIDEO_BTCX
65
select VIDEOBUF_DMA_SG
76
---help---
87
This is a video4linux driver for Conexant 25821 based

drivers/media/pci/cx25821/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@ obj-$(CONFIG_VIDEO_CX25821) += cx25821.o
66
obj-$(CONFIG_VIDEO_CX25821_ALSA) += cx25821-alsa.o
77

88
ccflags-y += -Idrivers/media/i2c
9-
ccflags-y += -Idrivers/media/common

drivers/media/pci/cx25821/cx25821-alsa.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ static int devno;
6363

6464
struct cx25821_audio_buffer {
6565
unsigned int bpl;
66-
struct btcx_riscmem risc;
66+
struct cx25821_riscmem risc;
6767
struct videobuf_dmabuf dma;
6868
};
6969

@@ -330,12 +330,14 @@ static irqreturn_t cx25821_irq(int irq, void *dev_id)
330330

331331
static int dsp_buffer_free(struct cx25821_audio_dev *chip)
332332
{
333+
struct cx25821_riscmem *risc = &chip->buf->risc;
334+
333335
BUG_ON(!chip->dma_size);
334336

335337
dprintk(2, "Freeing buffer\n");
336338
videobuf_dma_unmap(&chip->pci->dev, chip->dma_risc);
337339
videobuf_dma_free(chip->dma_risc);
338-
btcx_riscmem_free(chip->pci, &chip->buf->risc);
340+
pci_free_consistent(chip->pci, risc->size, risc->cpu, risc->dma);
339341
kfree(chip->buf);
340342

341343
chip->dma_risc = NULL;

drivers/media/pci/cx25821/cx25821-core.c

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -979,6 +979,27 @@ void cx25821_dev_unregister(struct cx25821_dev *dev)
979979
}
980980
EXPORT_SYMBOL(cx25821_dev_unregister);
981981

982+
int cx25821_riscmem_alloc(struct pci_dev *pci,
983+
struct cx25821_riscmem *risc,
984+
unsigned int size)
985+
{
986+
__le32 *cpu;
987+
dma_addr_t dma = 0;
988+
989+
if (NULL != risc->cpu && risc->size < size)
990+
pci_free_consistent(pci, risc->size, risc->cpu, risc->dma);
991+
if (NULL == risc->cpu) {
992+
cpu = pci_zalloc_consistent(pci, size, &dma);
993+
if (NULL == cpu)
994+
return -ENOMEM;
995+
risc->cpu = cpu;
996+
risc->dma = dma;
997+
risc->size = size;
998+
}
999+
return 0;
1000+
}
1001+
EXPORT_SYMBOL(cx25821_riscmem_alloc);
1002+
9821003
static __le32 *cx25821_risc_field(__le32 * rp, struct scatterlist *sglist,
9831004
unsigned int offset, u32 sync_line,
9841005
unsigned int bpl, unsigned int padding,
@@ -1035,7 +1056,7 @@ static __le32 *cx25821_risc_field(__le32 * rp, struct scatterlist *sglist,
10351056
return rp;
10361057
}
10371058

1038-
int cx25821_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc,
1059+
int cx25821_risc_buffer(struct pci_dev *pci, struct cx25821_riscmem *risc,
10391060
struct scatterlist *sglist, unsigned int top_offset,
10401061
unsigned int bottom_offset, unsigned int bpl,
10411062
unsigned int padding, unsigned int lines)
@@ -1059,7 +1080,7 @@ int cx25821_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc,
10591080
instructions = fields * (1 + ((bpl + padding) * lines) / PAGE_SIZE +
10601081
lines);
10611082
instructions += 2;
1062-
rc = btcx_riscmem_alloc(pci, risc, instructions * 12);
1083+
rc = cx25821_riscmem_alloc(pci, risc, instructions * 12);
10631084

10641085
if (rc < 0)
10651086
return rc;
@@ -1146,7 +1167,7 @@ static __le32 *cx25821_risc_field_audio(__le32 * rp, struct scatterlist *sglist,
11461167
}
11471168

11481169
int cx25821_risc_databuffer_audio(struct pci_dev *pci,
1149-
struct btcx_riscmem *risc,
1170+
struct cx25821_riscmem *risc,
11501171
struct scatterlist *sglist,
11511172
unsigned int bpl,
11521173
unsigned int lines, unsigned int lpi)
@@ -1163,7 +1184,7 @@ int cx25821_risc_databuffer_audio(struct pci_dev *pci,
11631184
instructions = 1 + (bpl * lines) / PAGE_SIZE + lines;
11641185
instructions += 1;
11651186

1166-
rc = btcx_riscmem_alloc(pci, risc, instructions * 12);
1187+
rc = cx25821_riscmem_alloc(pci, risc, instructions * 12);
11671188
if (rc < 0)
11681189
return rc;
11691190

@@ -1179,13 +1200,13 @@ int cx25821_risc_databuffer_audio(struct pci_dev *pci,
11791200
}
11801201
EXPORT_SYMBOL(cx25821_risc_databuffer_audio);
11811202

1182-
int cx25821_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc,
1203+
int cx25821_risc_stopper(struct pci_dev *pci, struct cx25821_riscmem *risc,
11831204
u32 reg, u32 mask, u32 value)
11841205
{
11851206
__le32 *rp;
11861207
int rc;
11871208

1188-
rc = btcx_riscmem_alloc(pci, risc, 4 * 16);
1209+
rc = cx25821_riscmem_alloc(pci, risc, 4 * 16);
11891210

11901211
if (rc < 0)
11911212
return rc;
@@ -1211,7 +1232,8 @@ void cx25821_free_buffer(struct videobuf_queue *q, struct cx25821_buffer *buf)
12111232
videobuf_waiton(q, &buf->vb, 0, 0);
12121233
videobuf_dma_unmap(q->dev, dma);
12131234
videobuf_dma_free(dma);
1214-
btcx_riscmem_free(to_pci_dev(q->dev), &buf->risc);
1235+
pci_free_consistent(to_pci_dev(q->dev),
1236+
buf->risc.size, buf->risc.cpu, buf->risc.dma);
12151237
buf->vb.state = VIDEOBUF_NEEDS_INIT;
12161238
}
12171239

drivers/media/pci/cx25821/cx25821-video.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,11 +1017,13 @@ void cx25821_video_unregister(struct cx25821_dev *dev, int chan_num)
10171017
cx_clear(PCI_INT_MSK, 1);
10181018

10191019
if (video_is_registered(&dev->channels[chan_num].vdev)) {
1020+
struct cx25821_riscmem *risc =
1021+
&dev->channels[chan_num].dma_vidq.stopper;
1022+
10201023
video_unregister_device(&dev->channels[chan_num].vdev);
10211024
v4l2_ctrl_handler_free(&dev->channels[chan_num].hdl);
10221025

1023-
btcx_riscmem_free(dev->pci,
1024-
&dev->channels[chan_num].dma_vidq.stopper);
1026+
pci_free_consistent(dev->pci, risc->size, risc->cpu, risc->dma);
10251027
}
10261028
}
10271029

drivers/media/pci/cx25821/cx25821.h

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
#include <media/v4l2-ctrls.h>
3737
#include <media/videobuf-dma-sg.h>
3838

39-
#include "btcx-risc.h"
4039
#include "cx25821-reg.h"
4140
#include "cx25821-medusa-reg.h"
4241
#include "cx25821-sram.h"
@@ -111,14 +110,21 @@ enum cx25821_src_sel_type {
111110
CX25821_SRC_SEL_PARALLEL_MPEG_VIDEO
112111
};
113112

113+
struct cx25821_riscmem {
114+
unsigned int size;
115+
__le32 *cpu;
116+
__le32 *jmp;
117+
dma_addr_t dma;
118+
};
119+
114120
/* buffer for one video frame */
115121
struct cx25821_buffer {
116122
/* common v4l buffer stuff -- must be first */
117123
struct videobuf_buffer vb;
118124

119125
/* cx25821 specific */
120126
unsigned int bpl;
121-
struct btcx_riscmem risc;
127+
struct cx25821_riscmem risc;
122128
const struct cx25821_fmt *fmt;
123129
u32 count;
124130
};
@@ -161,7 +167,7 @@ struct cx25821_dmaqueue {
161167
struct list_head active;
162168
struct list_head queued;
163169
struct timer_list timeout;
164-
struct btcx_riscmem stopper;
170+
struct cx25821_riscmem stopper;
165171
u32 count;
166172
};
167173

@@ -405,20 +411,23 @@ extern int cx25821_sram_channel_setup(struct cx25821_dev *dev,
405411
const struct sram_channel *ch, unsigned int bpl,
406412
u32 risc);
407413

408-
extern int cx25821_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc,
414+
extern int cx25821_riscmem_alloc(struct pci_dev *pci,
415+
struct cx25821_riscmem *risc,
416+
unsigned int size);
417+
extern int cx25821_risc_buffer(struct pci_dev *pci, struct cx25821_riscmem *risc,
409418
struct scatterlist *sglist,
410419
unsigned int top_offset,
411420
unsigned int bottom_offset,
412421
unsigned int bpl,
413422
unsigned int padding, unsigned int lines);
414423
extern int cx25821_risc_databuffer_audio(struct pci_dev *pci,
415-
struct btcx_riscmem *risc,
424+
struct cx25821_riscmem *risc,
416425
struct scatterlist *sglist,
417426
unsigned int bpl,
418427
unsigned int lines, unsigned int lpi);
419428
extern void cx25821_free_buffer(struct videobuf_queue *q,
420429
struct cx25821_buffer *buf);
421-
extern int cx25821_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc,
430+
extern int cx25821_risc_stopper(struct pci_dev *pci, struct cx25821_riscmem *risc,
422431
u32 reg, u32 mask, u32 value);
423432
extern void cx25821_sram_channel_dump(struct cx25821_dev *dev,
424433
const struct sram_channel *ch);

0 commit comments

Comments
 (0)