diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2014-12-12 08:27:54 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2014-12-23 06:35:35 -0500 |
commit | 5ede94c7055392bb55c6d2e26f1912f68ef4b875 (patch) | |
tree | ee4a91eeb362cbf495a65517e9c2b6a9c0d7a0aa /drivers/media/pci/cx25821/cx25821-core.c | |
parent | 5d0beeec59e303c76160ddd67fa73dcfc5d76de0 (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/cx25821-core.c')
-rw-r--r-- | drivers/media/pci/cx25821/cx25821-core.c | 36 |
1 files changed, 29 insertions, 7 deletions
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 | } |
980 | EXPORT_SYMBOL(cx25821_dev_unregister); | 980 | EXPORT_SYMBOL(cx25821_dev_unregister); |
981 | 981 | ||
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 | |||
982 | static __le32 *cx25821_risc_field(__le32 * rp, struct scatterlist *sglist, | 1003 | static __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 | ||
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, |
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 | ||
1148 | int cx25821_risc_databuffer_audio(struct pci_dev *pci, | 1169 | int 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 | } |
1180 | EXPORT_SYMBOL(cx25821_risc_databuffer_audio); | 1201 | EXPORT_SYMBOL(cx25821_risc_databuffer_audio); |
1181 | 1202 | ||
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, |
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 | ||