aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/pci
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2014-08-29 03:11:54 -0400
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2014-11-03 05:29:51 -0500
commit5e7045e3fa4976a37c6bbf337729ea47d0c886d0 (patch)
tree8acc1cb9e2105bba2789da0a325941ec1f31a0d3 /drivers/media/pci
parent999b3ceb849b5b9ed25739fea2e69adef09845c7 (diff)
[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>
Diffstat (limited to 'drivers/media/pci')
-rw-r--r--drivers/media/pci/cx88/Kconfig1
-rw-r--r--drivers/media/pci/cx88/Makefile1
-rw-r--r--drivers/media/pci/cx88/cx88-alsa.c7
-rw-r--r--drivers/media/pci/cx88/cx88-blackbird.c5
-rw-r--r--drivers/media/pci/cx88/cx88-core.c20
-rw-r--r--drivers/media/pci/cx88/cx88-dvb.c5
-rw-r--r--drivers/media/pci/cx88/cx88-mpeg.c7
-rw-r--r--drivers/media/pci/cx88/cx88-vbi.c5
-rw-r--r--drivers/media/pci/cx88/cx88-video.c5
-rw-r--r--drivers/media/pci/cx88/cx88.h16
10 files changed, 49 insertions, 23 deletions
diff --git a/drivers/media/pci/cx88/Kconfig b/drivers/media/pci/cx88/Kconfig
index d5b125e4ab02..14b813d634a8 100644
--- a/drivers/media/pci/cx88/Kconfig
+++ b/drivers/media/pci/cx88/Kconfig
@@ -2,7 +2,6 @@ config VIDEO_CX88
2 tristate "Conexant 2388x (bt878 successor) support" 2 tristate "Conexant 2388x (bt878 successor) support"
3 depends on VIDEO_DEV && PCI && I2C && RC_CORE 3 depends on VIDEO_DEV && PCI && I2C && RC_CORE
4 select I2C_ALGOBIT 4 select I2C_ALGOBIT
5 select VIDEO_BTCX
6 select VIDEOBUF2_DMA_SG 5 select VIDEOBUF2_DMA_SG
7 select VIDEO_TUNER 6 select VIDEO_TUNER
8 select VIDEO_TVEEPROM 7 select VIDEO_TVEEPROM
diff --git a/drivers/media/pci/cx88/Makefile b/drivers/media/pci/cx88/Makefile
index 8619c1becee2..d3679c3ee248 100644
--- a/drivers/media/pci/cx88/Makefile
+++ b/drivers/media/pci/cx88/Makefile
@@ -11,7 +11,6 @@ obj-$(CONFIG_VIDEO_CX88_DVB) += cx88-dvb.o
11obj-$(CONFIG_VIDEO_CX88_VP3054) += cx88-vp3054-i2c.o 11obj-$(CONFIG_VIDEO_CX88_VP3054) += cx88-vp3054-i2c.o
12 12
13ccflags-y += -Idrivers/media/i2c 13ccflags-y += -Idrivers/media/i2c
14ccflags-y += -Idrivers/media/common
15ccflags-y += -Idrivers/media/tuners 14ccflags-y += -Idrivers/media/tuners
16ccflags-y += -Idrivers/media/dvb-core 15ccflags-y += -Idrivers/media/dvb-core
17ccflags-y += -Idrivers/media/dvb-frontends 16ccflags-y += -Idrivers/media/dvb-frontends
diff --git a/drivers/media/pci/cx88/cx88-alsa.c b/drivers/media/pci/cx88/cx88-alsa.c
index 73021a22de1b..7f8dc60028d5 100644
--- a/drivers/media/pci/cx88/cx88-alsa.c
+++ b/drivers/media/pci/cx88/cx88-alsa.c
@@ -61,7 +61,7 @@
61 61
62struct cx88_audio_buffer { 62struct cx88_audio_buffer {
63 unsigned int bpl; 63 unsigned int bpl;
64 struct btcx_riscmem risc; 64 struct cx88_riscmem risc;
65 void *vaddr; 65 void *vaddr;
66 struct scatterlist *sglist; 66 struct scatterlist *sglist;
67 int sglen; 67 int sglen;
@@ -370,12 +370,15 @@ static int cx88_alsa_dma_free(struct cx88_audio_buffer *buf)
370 370
371static int dsp_buffer_free(snd_cx88_card_t *chip) 371static int dsp_buffer_free(snd_cx88_card_t *chip)
372{ 372{
373 struct cx88_riscmem *risc = &chip->buf->risc;
374
373 BUG_ON(!chip->dma_size); 375 BUG_ON(!chip->dma_size);
374 376
375 dprintk(2,"Freeing buffer\n"); 377 dprintk(2,"Freeing buffer\n");
376 cx88_alsa_dma_unmap(chip); 378 cx88_alsa_dma_unmap(chip);
377 cx88_alsa_dma_free(chip->buf); 379 cx88_alsa_dma_free(chip->buf);
378 btcx_riscmem_free(chip->pci, &chip->buf->risc); 380 if (risc->cpu)
381 pci_free_consistent(chip->pci, risc->size, risc->cpu, risc->dma);
379 kfree(chip->buf); 382 kfree(chip->buf);
380 383
381 chip->buf = NULL; 384 chip->buf = NULL;
diff --git a/drivers/media/pci/cx88/cx88-blackbird.c b/drivers/media/pci/cx88/cx88-blackbird.c
index b24266ec2b5d..f27a3f134025 100644
--- a/drivers/media/pci/cx88/cx88-blackbird.c
+++ b/drivers/media/pci/cx88/cx88-blackbird.c
@@ -666,8 +666,11 @@ static void buffer_finish(struct vb2_buffer *vb)
666 struct cx8802_dev *dev = vb->vb2_queue->drv_priv; 666 struct cx8802_dev *dev = vb->vb2_queue->drv_priv;
667 struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb); 667 struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb);
668 struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0); 668 struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0);
669 struct cx88_riscmem *risc = &buf->risc;
669 670
670 btcx_riscmem_free(dev->pci, &buf->risc); 671 if (risc->cpu)
672 pci_free_consistent(dev->pci, risc->size, risc->cpu, risc->dma);
673 memset(risc, 0, sizeof(*risc));
671 674
672 dma_unmap_sg(&dev->pci->dev, sgt->sgl, sgt->nents, DMA_FROM_DEVICE); 675 dma_unmap_sg(&dev->pci->dev, sgt->sgl, sgt->nents, DMA_FROM_DEVICE);
673} 676}
diff --git a/drivers/media/pci/cx88/cx88-core.c b/drivers/media/pci/cx88/cx88-core.c
index 902b662be2ff..bbdbb58576ef 100644
--- a/drivers/media/pci/cx88/cx88-core.c
+++ b/drivers/media/pci/cx88/cx88-core.c
@@ -132,14 +132,13 @@ static __le32* cx88_risc_field(__le32 *rp, struct scatterlist *sglist,
132 return rp; 132 return rp;
133} 133}
134 134
135int cx88_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc, 135int cx88_risc_buffer(struct pci_dev *pci, struct cx88_riscmem *risc,
136 struct scatterlist *sglist, 136 struct scatterlist *sglist,
137 unsigned int top_offset, unsigned int bottom_offset, 137 unsigned int top_offset, unsigned int bottom_offset,
138 unsigned int bpl, unsigned int padding, unsigned int lines) 138 unsigned int bpl, unsigned int padding, unsigned int lines)
139{ 139{
140 u32 instructions,fields; 140 u32 instructions,fields;
141 __le32 *rp; 141 __le32 *rp;
142 int rc;
143 142
144 fields = 0; 143 fields = 0;
145 if (UNSET != top_offset) 144 if (UNSET != top_offset)
@@ -153,8 +152,11 @@ int cx88_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc,
153 region may be smaller than PAGE_SIZE */ 152 region may be smaller than PAGE_SIZE */
154 instructions = fields * (1 + ((bpl + padding) * lines) / PAGE_SIZE + lines); 153 instructions = fields * (1 + ((bpl + padding) * lines) / PAGE_SIZE + lines);
155 instructions += 4; 154 instructions += 4;
156 if ((rc = btcx_riscmem_alloc(pci,risc,instructions*8)) < 0) 155 risc->size = instructions * 8;
157 return rc; 156 risc->dma = 0;
157 risc->cpu = pci_zalloc_consistent(pci, risc->size, &risc->dma);
158 if (NULL == risc->cpu)
159 return -ENOMEM;
158 160
159 /* write risc instructions */ 161 /* write risc instructions */
160 rp = risc->cpu; 162 rp = risc->cpu;
@@ -171,13 +173,12 @@ int cx88_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc,
171 return 0; 173 return 0;
172} 174}
173 175
174int cx88_risc_databuffer(struct pci_dev *pci, struct btcx_riscmem *risc, 176int cx88_risc_databuffer(struct pci_dev *pci, struct cx88_riscmem *risc,
175 struct scatterlist *sglist, unsigned int bpl, 177 struct scatterlist *sglist, unsigned int bpl,
176 unsigned int lines, unsigned int lpi) 178 unsigned int lines, unsigned int lpi)
177{ 179{
178 u32 instructions; 180 u32 instructions;
179 __le32 *rp; 181 __le32 *rp;
180 int rc;
181 182
182 /* estimate risc mem: worst case is one write per page border + 183 /* estimate risc mem: worst case is one write per page border +
183 one write per scan line + syncs + jump (all 2 dwords). Here 184 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,
185 than PAGE_SIZE */ 186 than PAGE_SIZE */
186 instructions = 1 + (bpl * lines) / PAGE_SIZE + lines; 187 instructions = 1 + (bpl * lines) / PAGE_SIZE + lines;
187 instructions += 3; 188 instructions += 3;
188 if ((rc = btcx_riscmem_alloc(pci,risc,instructions*8)) < 0) 189 risc->size = instructions * 8;
189 return rc; 190 risc->dma = 0;
191 risc->cpu = pci_zalloc_consistent(pci, risc->size, &risc->dma);
192 if (NULL == risc->cpu)
193 return -ENOMEM;
190 194
191 /* write risc instructions */ 195 /* write risc instructions */
192 rp = risc->cpu; 196 rp = risc->cpu;
diff --git a/drivers/media/pci/cx88/cx88-dvb.c b/drivers/media/pci/cx88/cx88-dvb.c
index b5b88a64ad7f..dd0deb1c87ce 100644
--- a/drivers/media/pci/cx88/cx88-dvb.c
+++ b/drivers/media/pci/cx88/cx88-dvb.c
@@ -109,8 +109,11 @@ static void buffer_finish(struct vb2_buffer *vb)
109 struct cx8802_dev *dev = vb->vb2_queue->drv_priv; 109 struct cx8802_dev *dev = vb->vb2_queue->drv_priv;
110 struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb); 110 struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb);
111 struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0); 111 struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0);
112 struct cx88_riscmem *risc = &buf->risc;
112 113
113 btcx_riscmem_free(dev->pci, &buf->risc); 114 if (risc->cpu)
115 pci_free_consistent(dev->pci, risc->size, risc->cpu, risc->dma);
116 memset(risc, 0, sizeof(*risc));
114 117
115 dma_unmap_sg(&dev->pci->dev, sgt->sgl, sgt->nents, DMA_FROM_DEVICE); 118 dma_unmap_sg(&dev->pci->dev, sgt->sgl, sgt->nents, DMA_FROM_DEVICE);
116} 119}
diff --git a/drivers/media/pci/cx88/cx88-mpeg.c b/drivers/media/pci/cx88/cx88-mpeg.c
index 0589dccae3bd..746c0ea13035 100644
--- a/drivers/media/pci/cx88/cx88-mpeg.c
+++ b/drivers/media/pci/cx88/cx88-mpeg.c
@@ -228,6 +228,7 @@ int cx8802_buf_prepare(struct vb2_queue *q, struct cx8802_dev *dev,
228{ 228{
229 int size = dev->ts_packet_size * dev->ts_packet_count; 229 int size = dev->ts_packet_size * dev->ts_packet_count;
230 struct sg_table *sgt = vb2_dma_sg_plane_desc(&buf->vb, 0); 230 struct sg_table *sgt = vb2_dma_sg_plane_desc(&buf->vb, 0);
231 struct cx88_riscmem *risc = &buf->risc;
231 int rc; 232 int rc;
232 233
233 if (vb2_plane_size(&buf->vb, 0) < size) 234 if (vb2_plane_size(&buf->vb, 0) < size)
@@ -238,10 +239,12 @@ int cx8802_buf_prepare(struct vb2_queue *q, struct cx8802_dev *dev,
238 if (!rc) 239 if (!rc)
239 return -EIO; 240 return -EIO;
240 241
241 rc = cx88_risc_databuffer(dev->pci, &buf->risc, sgt->sgl, 242 rc = cx88_risc_databuffer(dev->pci, risc, sgt->sgl,
242 dev->ts_packet_size, dev->ts_packet_count, 0); 243 dev->ts_packet_size, dev->ts_packet_count, 0);
243 if (rc) { 244 if (rc) {
244 btcx_riscmem_free(dev->pci, &buf->risc); 245 if (risc->cpu)
246 pci_free_consistent(dev->pci, risc->size, risc->cpu, risc->dma);
247 memset(risc, 0, sizeof(*risc));
245 return rc; 248 return rc;
246 } 249 }
247 return 0; 250 return 0;
diff --git a/drivers/media/pci/cx88/cx88-vbi.c b/drivers/media/pci/cx88/cx88-vbi.c
index 8f20612c5853..4e0747a6a9c2 100644
--- a/drivers/media/pci/cx88/cx88-vbi.c
+++ b/drivers/media/pci/cx88/cx88-vbi.c
@@ -146,8 +146,11 @@ static void buffer_finish(struct vb2_buffer *vb)
146 struct cx8800_dev *dev = vb->vb2_queue->drv_priv; 146 struct cx8800_dev *dev = vb->vb2_queue->drv_priv;
147 struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb); 147 struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb);
148 struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0); 148 struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0);
149 struct cx88_riscmem *risc = &buf->risc;
149 150
150 btcx_riscmem_free(dev->pci, &buf->risc); 151 if (risc->cpu)
152 pci_free_consistent(dev->pci, risc->size, risc->cpu, risc->dma);
153 memset(risc, 0, sizeof(*risc));
151 154
152 dma_unmap_sg(&dev->pci->dev, sgt->sgl, sgt->nents, DMA_FROM_DEVICE); 155 dma_unmap_sg(&dev->pci->dev, sgt->sgl, sgt->nents, DMA_FROM_DEVICE);
153} 156}
diff --git a/drivers/media/pci/cx88/cx88-video.c b/drivers/media/pci/cx88/cx88-video.c
index c64f8f48850f..a74e21dd4aad 100644
--- a/drivers/media/pci/cx88/cx88-video.c
+++ b/drivers/media/pci/cx88/cx88-video.c
@@ -505,8 +505,11 @@ static void buffer_finish(struct vb2_buffer *vb)
505 struct cx8800_dev *dev = vb->vb2_queue->drv_priv; 505 struct cx8800_dev *dev = vb->vb2_queue->drv_priv;
506 struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb); 506 struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb);
507 struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0); 507 struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0);
508 struct cx88_riscmem *risc = &buf->risc;
508 509
509 btcx_riscmem_free(dev->pci, &buf->risc); 510 if (risc->cpu)
511 pci_free_consistent(dev->pci, risc->size, risc->cpu, risc->dma);
512 memset(risc, 0, sizeof(*risc));
510 513
511 dma_unmap_sg(&dev->pci->dev, sgt->sgl, sgt->nents, DMA_FROM_DEVICE); 514 dma_unmap_sg(&dev->pci->dev, sgt->sgl, sgt->nents, DMA_FROM_DEVICE);
512} 515}
diff --git a/drivers/media/pci/cx88/cx88.h b/drivers/media/pci/cx88/cx88.h
index 16965c84090b..dd50177cea1e 100644
--- a/drivers/media/pci/cx88/cx88.h
+++ b/drivers/media/pci/cx88/cx88.h
@@ -35,7 +35,6 @@
35#include <media/ir-kbd-i2c.h> 35#include <media/ir-kbd-i2c.h>
36#include <media/wm8775.h> 36#include <media/wm8775.h>
37 37
38#include "btcx-risc.h"
39#include "cx88-reg.h" 38#include "cx88-reg.h"
40#include "tuner-xc2028.h" 39#include "tuner-xc2028.h"
41 40
@@ -311,6 +310,13 @@ enum cx88_tvaudio {
311 310
312#define BUFFER_TIMEOUT msecs_to_jiffies(2000) 311#define BUFFER_TIMEOUT msecs_to_jiffies(2000)
313 312
313struct cx88_riscmem {
314 unsigned int size;
315 __le32 *cpu;
316 __le32 *jmp;
317 dma_addr_t dma;
318};
319
314/* buffer for one video frame */ 320/* buffer for one video frame */
315struct cx88_buffer { 321struct cx88_buffer {
316 /* common v4l buffer stuff -- must be first */ 322 /* common v4l buffer stuff -- must be first */
@@ -319,7 +325,7 @@ struct cx88_buffer {
319 325
320 /* cx88 specific */ 326 /* cx88 specific */
321 unsigned int bpl; 327 unsigned int bpl;
322 struct btcx_riscmem risc; 328 struct cx88_riscmem risc;
323 u32 count; 329 u32 count;
324}; 330};
325 331
@@ -616,17 +622,17 @@ extern void cx88_shutdown(struct cx88_core *core);
616extern int cx88_reset(struct cx88_core *core); 622extern int cx88_reset(struct cx88_core *core);
617 623
618extern int 624extern int
619cx88_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc, 625cx88_risc_buffer(struct pci_dev *pci, struct cx88_riscmem *risc,
620 struct scatterlist *sglist, 626 struct scatterlist *sglist,
621 unsigned int top_offset, unsigned int bottom_offset, 627 unsigned int top_offset, unsigned int bottom_offset,
622 unsigned int bpl, unsigned int padding, unsigned int lines); 628 unsigned int bpl, unsigned int padding, unsigned int lines);
623extern int 629extern int
624cx88_risc_databuffer(struct pci_dev *pci, struct btcx_riscmem *risc, 630cx88_risc_databuffer(struct pci_dev *pci, struct cx88_riscmem *risc,
625 struct scatterlist *sglist, unsigned int bpl, 631 struct scatterlist *sglist, unsigned int bpl,
626 unsigned int lines, unsigned int lpi); 632 unsigned int lines, unsigned int lpi);
627 633
628extern void cx88_risc_disasm(struct cx88_core *core, 634extern void cx88_risc_disasm(struct cx88_core *core,
629 struct btcx_riscmem *risc); 635 struct cx88_riscmem *risc);
630extern int cx88_sram_channel_setup(struct cx88_core *core, 636extern int cx88_sram_channel_setup(struct cx88_core *core,
631 const struct sram_channel *ch, 637 const struct sram_channel *ch,
632 unsigned int bpl, u32 risc); 638 unsigned int bpl, u32 risc);