aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/pci/cx25821
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2014-12-12 08:27:54 -0500
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2014-12-23 06:35:35 -0500
commit5ede94c7055392bb55c6d2e26f1912f68ef4b875 (patch)
treeee4a91eeb362cbf495a65517e9c2b6a9c0d7a0aa /drivers/media/pci/cx25821
parent5d0beeec59e303c76160ddd67fa73dcfc5d76de0 (diff)
[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>
Diffstat (limited to 'drivers/media/pci/cx25821')
-rw-r--r--drivers/media/pci/cx25821/Kconfig1
-rw-r--r--drivers/media/pci/cx25821/Makefile1
-rw-r--r--drivers/media/pci/cx25821/cx25821-alsa.c6
-rw-r--r--drivers/media/pci/cx25821/cx25821-core.c36
-rw-r--r--drivers/media/pci/cx25821/cx25821-video.c6
-rw-r--r--drivers/media/pci/cx25821/cx25821.h21
6 files changed, 52 insertions, 19 deletions
diff --git a/drivers/media/pci/cx25821/Kconfig b/drivers/media/pci/cx25821/Kconfig
index 6439a847680c..0e69cabb006f 100644
--- a/drivers/media/pci/cx25821/Kconfig
+++ b/drivers/media/pci/cx25821/Kconfig
@@ -2,7 +2,6 @@ config VIDEO_CX25821
2 tristate "Conexant cx25821 support" 2 tristate "Conexant cx25821 support"
3 depends on VIDEO_DEV && PCI && I2C 3 depends on VIDEO_DEV && PCI && I2C
4 select I2C_ALGOBIT 4 select I2C_ALGOBIT
5 select VIDEO_BTCX
6 select VIDEOBUF_DMA_SG 5 select VIDEOBUF_DMA_SG
7 ---help--- 6 ---help---
8 This is a video4linux driver for Conexant 25821 based 7 This is a video4linux driver for Conexant 25821 based
diff --git a/drivers/media/pci/cx25821/Makefile b/drivers/media/pci/cx25821/Makefile
index fb76c3d3713a..5872feb266a6 100644
--- a/drivers/media/pci/cx25821/Makefile
+++ b/drivers/media/pci/cx25821/Makefile
@@ -6,4 +6,3 @@ obj-$(CONFIG_VIDEO_CX25821) += cx25821.o
6obj-$(CONFIG_VIDEO_CX25821_ALSA) += cx25821-alsa.o 6obj-$(CONFIG_VIDEO_CX25821_ALSA) += cx25821-alsa.o
7 7
8ccflags-y += -Idrivers/media/i2c 8ccflags-y += -Idrivers/media/i2c
9ccflags-y += -Idrivers/media/common
diff --git a/drivers/media/pci/cx25821/cx25821-alsa.c b/drivers/media/pci/cx25821/cx25821-alsa.c
index 2dd5bcaa7e53..27e6493622b6 100644
--- a/drivers/media/pci/cx25821/cx25821-alsa.c
+++ b/drivers/media/pci/cx25821/cx25821-alsa.c
@@ -63,7 +63,7 @@ static int devno;
63 63
64struct cx25821_audio_buffer { 64struct cx25821_audio_buffer {
65 unsigned int bpl; 65 unsigned int bpl;
66 struct btcx_riscmem risc; 66 struct cx25821_riscmem risc;
67 struct videobuf_dmabuf dma; 67 struct videobuf_dmabuf dma;
68}; 68};
69 69
@@ -330,12 +330,14 @@ out:
330 330
331static int dsp_buffer_free(struct cx25821_audio_dev *chip) 331static int dsp_buffer_free(struct cx25821_audio_dev *chip)
332{ 332{
333 struct cx25821_riscmem *risc = &chip->buf->risc;
334
333 BUG_ON(!chip->dma_size); 335 BUG_ON(!chip->dma_size);
334 336
335 dprintk(2, "Freeing buffer\n"); 337 dprintk(2, "Freeing buffer\n");
336 videobuf_dma_unmap(&chip->pci->dev, chip->dma_risc); 338 videobuf_dma_unmap(&chip->pci->dev, chip->dma_risc);
337 videobuf_dma_free(chip->dma_risc); 339 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);
339 kfree(chip->buf); 341 kfree(chip->buf);
340 342
341 chip->dma_risc = NULL; 343 chip->dma_risc = NULL;
diff --git a/drivers/media/pci/cx25821/cx25821-core.c b/drivers/media/pci/cx25821/cx25821-core.c
index 389fffd2f36f..c8c65b793581 100644
--- a/drivers/media/pci/cx25821/cx25821-core.c
+++ b/drivers/media/pci/cx25821/cx25821-core.c
@@ -979,6 +979,27 @@ void cx25821_dev_unregister(struct cx25821_dev *dev)
979} 979}
980EXPORT_SYMBOL(cx25821_dev_unregister); 980EXPORT_SYMBOL(cx25821_dev_unregister);
981 981
982int 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}
1001EXPORT_SYMBOL(cx25821_riscmem_alloc);
1002
982static __le32 *cx25821_risc_field(__le32 * rp, struct scatterlist *sglist, 1003static __le32 *cx25821_risc_field(__le32 * rp, struct scatterlist *sglist,
983 unsigned int offset, u32 sync_line, 1004 unsigned int offset, u32 sync_line,
984 unsigned int bpl, unsigned int padding, 1005 unsigned int bpl, unsigned int padding,
@@ -1035,7 +1056,7 @@ static __le32 *cx25821_risc_field(__le32 * rp, struct scatterlist *sglist,
1035 return rp; 1056 return rp;
1036} 1057}
1037 1058
1038int cx25821_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc, 1059int cx25821_risc_buffer(struct pci_dev *pci, struct cx25821_riscmem *risc,
1039 struct scatterlist *sglist, unsigned int top_offset, 1060 struct scatterlist *sglist, unsigned int top_offset,
1040 unsigned int bottom_offset, unsigned int bpl, 1061 unsigned int bottom_offset, unsigned int bpl,
1041 unsigned int padding, unsigned int lines) 1062 unsigned int padding, unsigned int lines)
@@ -1059,7 +1080,7 @@ int cx25821_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc,
1059 instructions = fields * (1 + ((bpl + padding) * lines) / PAGE_SIZE + 1080 instructions = fields * (1 + ((bpl + padding) * lines) / PAGE_SIZE +
1060 lines); 1081 lines);
1061 instructions += 2; 1082 instructions += 2;
1062 rc = btcx_riscmem_alloc(pci, risc, instructions * 12); 1083 rc = cx25821_riscmem_alloc(pci, risc, instructions * 12);
1063 1084
1064 if (rc < 0) 1085 if (rc < 0)
1065 return rc; 1086 return rc;
@@ -1146,7 +1167,7 @@ static __le32 *cx25821_risc_field_audio(__le32 * rp, struct scatterlist *sglist,
1146} 1167}
1147 1168
1148int cx25821_risc_databuffer_audio(struct pci_dev *pci, 1169int cx25821_risc_databuffer_audio(struct pci_dev *pci,
1149 struct btcx_riscmem *risc, 1170 struct cx25821_riscmem *risc,
1150 struct scatterlist *sglist, 1171 struct scatterlist *sglist,
1151 unsigned int bpl, 1172 unsigned int bpl,
1152 unsigned int lines, unsigned int lpi) 1173 unsigned int lines, unsigned int lpi)
@@ -1163,7 +1184,7 @@ int cx25821_risc_databuffer_audio(struct pci_dev *pci,
1163 instructions = 1 + (bpl * lines) / PAGE_SIZE + lines; 1184 instructions = 1 + (bpl * lines) / PAGE_SIZE + lines;
1164 instructions += 1; 1185 instructions += 1;
1165 1186
1166 rc = btcx_riscmem_alloc(pci, risc, instructions * 12); 1187 rc = cx25821_riscmem_alloc(pci, risc, instructions * 12);
1167 if (rc < 0) 1188 if (rc < 0)
1168 return rc; 1189 return rc;
1169 1190
@@ -1179,13 +1200,13 @@ int cx25821_risc_databuffer_audio(struct pci_dev *pci,
1179} 1200}
1180EXPORT_SYMBOL(cx25821_risc_databuffer_audio); 1201EXPORT_SYMBOL(cx25821_risc_databuffer_audio);
1181 1202
1182int cx25821_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc, 1203int cx25821_risc_stopper(struct pci_dev *pci, struct cx25821_riscmem *risc,
1183 u32 reg, u32 mask, u32 value) 1204 u32 reg, u32 mask, u32 value)
1184{ 1205{
1185 __le32 *rp; 1206 __le32 *rp;
1186 int rc; 1207 int rc;
1187 1208
1188 rc = btcx_riscmem_alloc(pci, risc, 4 * 16); 1209 rc = cx25821_riscmem_alloc(pci, risc, 4 * 16);
1189 1210
1190 if (rc < 0) 1211 if (rc < 0)
1191 return rc; 1212 return rc;
@@ -1211,7 +1232,8 @@ void cx25821_free_buffer(struct videobuf_queue *q, struct cx25821_buffer *buf)
1211 videobuf_waiton(q, &buf->vb, 0, 0); 1232 videobuf_waiton(q, &buf->vb, 0, 0);
1212 videobuf_dma_unmap(q->dev, dma); 1233 videobuf_dma_unmap(q->dev, dma);
1213 videobuf_dma_free(dma); 1234 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);
1215 buf->vb.state = VIDEOBUF_NEEDS_INIT; 1237 buf->vb.state = VIDEOBUF_NEEDS_INIT;
1216} 1238}
1217 1239
diff --git a/drivers/media/pci/cx25821/cx25821-video.c b/drivers/media/pci/cx25821/cx25821-video.c
index 3a419f134584..3eda1a1e1e25 100644
--- a/drivers/media/pci/cx25821/cx25821-video.c
+++ b/drivers/media/pci/cx25821/cx25821-video.c
@@ -1017,11 +1017,13 @@ void cx25821_video_unregister(struct cx25821_dev *dev, int chan_num)
1017 cx_clear(PCI_INT_MSK, 1); 1017 cx_clear(PCI_INT_MSK, 1);
1018 1018
1019 if (video_is_registered(&dev->channels[chan_num].vdev)) { 1019 if (video_is_registered(&dev->channels[chan_num].vdev)) {
1020 struct cx25821_riscmem *risc =
1021 &dev->channels[chan_num].dma_vidq.stopper;
1022
1020 video_unregister_device(&dev->channels[chan_num].vdev); 1023 video_unregister_device(&dev->channels[chan_num].vdev);
1021 v4l2_ctrl_handler_free(&dev->channels[chan_num].hdl); 1024 v4l2_ctrl_handler_free(&dev->channels[chan_num].hdl);
1022 1025
1023 btcx_riscmem_free(dev->pci, 1026 pci_free_consistent(dev->pci, risc->size, risc->cpu, risc->dma);
1024 &dev->channels[chan_num].dma_vidq.stopper);
1025 } 1027 }
1026} 1028}
1027 1029
diff --git a/drivers/media/pci/cx25821/cx25821.h b/drivers/media/pci/cx25821/cx25821.h
index 90bdc196929f..38beec2c0969 100644
--- a/drivers/media/pci/cx25821/cx25821.h
+++ b/drivers/media/pci/cx25821/cx25821.h
@@ -36,7 +36,6 @@
36#include <media/v4l2-ctrls.h> 36#include <media/v4l2-ctrls.h>
37#include <media/videobuf-dma-sg.h> 37#include <media/videobuf-dma-sg.h>
38 38
39#include "btcx-risc.h"
40#include "cx25821-reg.h" 39#include "cx25821-reg.h"
41#include "cx25821-medusa-reg.h" 40#include "cx25821-medusa-reg.h"
42#include "cx25821-sram.h" 41#include "cx25821-sram.h"
@@ -111,6 +110,13 @@ enum cx25821_src_sel_type {
111 CX25821_SRC_SEL_PARALLEL_MPEG_VIDEO 110 CX25821_SRC_SEL_PARALLEL_MPEG_VIDEO
112}; 111};
113 112
113struct cx25821_riscmem {
114 unsigned int size;
115 __le32 *cpu;
116 __le32 *jmp;
117 dma_addr_t dma;
118};
119
114/* buffer for one video frame */ 120/* buffer for one video frame */
115struct cx25821_buffer { 121struct cx25821_buffer {
116 /* common v4l buffer stuff -- must be first */ 122 /* common v4l buffer stuff -- must be first */
@@ -118,7 +124,7 @@ struct cx25821_buffer {
118 124
119 /* cx25821 specific */ 125 /* cx25821 specific */
120 unsigned int bpl; 126 unsigned int bpl;
121 struct btcx_riscmem risc; 127 struct cx25821_riscmem risc;
122 const struct cx25821_fmt *fmt; 128 const struct cx25821_fmt *fmt;
123 u32 count; 129 u32 count;
124}; 130};
@@ -161,7 +167,7 @@ struct cx25821_dmaqueue {
161 struct list_head active; 167 struct list_head active;
162 struct list_head queued; 168 struct list_head queued;
163 struct timer_list timeout; 169 struct timer_list timeout;
164 struct btcx_riscmem stopper; 170 struct cx25821_riscmem stopper;
165 u32 count; 171 u32 count;
166}; 172};
167 173
@@ -405,20 +411,23 @@ extern int cx25821_sram_channel_setup(struct cx25821_dev *dev,
405 const struct sram_channel *ch, unsigned int bpl, 411 const struct sram_channel *ch, unsigned int bpl,
406 u32 risc); 412 u32 risc);
407 413
408extern int cx25821_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc, 414extern int cx25821_riscmem_alloc(struct pci_dev *pci,
415 struct cx25821_riscmem *risc,
416 unsigned int size);
417extern int cx25821_risc_buffer(struct pci_dev *pci, struct cx25821_riscmem *risc,
409 struct scatterlist *sglist, 418 struct scatterlist *sglist,
410 unsigned int top_offset, 419 unsigned int top_offset,
411 unsigned int bottom_offset, 420 unsigned int bottom_offset,
412 unsigned int bpl, 421 unsigned int bpl,
413 unsigned int padding, unsigned int lines); 422 unsigned int padding, unsigned int lines);
414extern int cx25821_risc_databuffer_audio(struct pci_dev *pci, 423extern int cx25821_risc_databuffer_audio(struct pci_dev *pci,
415 struct btcx_riscmem *risc, 424 struct cx25821_riscmem *risc,
416 struct scatterlist *sglist, 425 struct scatterlist *sglist,
417 unsigned int bpl, 426 unsigned int bpl,
418 unsigned int lines, unsigned int lpi); 427 unsigned int lines, unsigned int lpi);
419extern void cx25821_free_buffer(struct videobuf_queue *q, 428extern void cx25821_free_buffer(struct videobuf_queue *q,
420 struct cx25821_buffer *buf); 429 struct cx25821_buffer *buf);
421extern int cx25821_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc, 430extern int cx25821_risc_stopper(struct pci_dev *pci, struct cx25821_riscmem *risc,
422 u32 reg, u32 mask, u32 value); 431 u32 reg, u32 mask, u32 value);
423extern void cx25821_sram_channel_dump(struct cx25821_dev *dev, 432extern void cx25821_sram_channel_dump(struct cx25821_dev *dev,
424 const struct sram_channel *ch); 433 const struct sram_channel *ch);