diff options
Diffstat (limited to 'drivers/media/pci/cx23885/cx23885-core.c')
-rw-r--r-- | drivers/media/pci/cx23885/cx23885-core.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/drivers/media/pci/cx23885/cx23885-core.c b/drivers/media/pci/cx23885/cx23885-core.c index 8d77a5649777..cb94366b9504 100644 --- a/drivers/media/pci/cx23885/cx23885-core.c +++ b/drivers/media/pci/cx23885/cx23885-core.c | |||
@@ -570,7 +570,7 @@ void cx23885_sram_channel_dump(struct cx23885_dev *dev, | |||
570 | } | 570 | } |
571 | 571 | ||
572 | static void cx23885_risc_disasm(struct cx23885_tsport *port, | 572 | static void cx23885_risc_disasm(struct cx23885_tsport *port, |
573 | struct btcx_riscmem *risc) | 573 | struct cx23885_riscmem *risc) |
574 | { | 574 | { |
575 | struct cx23885_dev *dev = port->dev; | 575 | struct cx23885_dev *dev = port->dev; |
576 | unsigned int i, j, n; | 576 | unsigned int i, j, n; |
@@ -1121,14 +1121,13 @@ static __le32 *cx23885_risc_field(__le32 *rp, struct scatterlist *sglist, | |||
1121 | return rp; | 1121 | return rp; |
1122 | } | 1122 | } |
1123 | 1123 | ||
1124 | int cx23885_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc, | 1124 | int cx23885_risc_buffer(struct pci_dev *pci, struct cx23885_riscmem *risc, |
1125 | struct scatterlist *sglist, unsigned int top_offset, | 1125 | struct scatterlist *sglist, unsigned int top_offset, |
1126 | unsigned int bottom_offset, unsigned int bpl, | 1126 | unsigned int bottom_offset, unsigned int bpl, |
1127 | unsigned int padding, unsigned int lines) | 1127 | unsigned int padding, unsigned int lines) |
1128 | { | 1128 | { |
1129 | u32 instructions, fields; | 1129 | u32 instructions, fields; |
1130 | __le32 *rp; | 1130 | __le32 *rp; |
1131 | int rc; | ||
1132 | 1131 | ||
1133 | fields = 0; | 1132 | fields = 0; |
1134 | if (UNSET != top_offset) | 1133 | if (UNSET != top_offset) |
@@ -1144,9 +1143,10 @@ int cx23885_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc, | |||
1144 | instructions = fields * (1 + ((bpl + padding) * lines) | 1143 | instructions = fields * (1 + ((bpl + padding) * lines) |
1145 | / PAGE_SIZE + lines); | 1144 | / PAGE_SIZE + lines); |
1146 | instructions += 5; | 1145 | instructions += 5; |
1147 | rc = btcx_riscmem_alloc(pci, risc, instructions*12); | 1146 | risc->size = instructions * 12; |
1148 | if (rc < 0) | 1147 | risc->cpu = pci_alloc_consistent(pci, risc->size, &risc->dma); |
1149 | return rc; | 1148 | if (risc->cpu == NULL) |
1149 | return -ENOMEM; | ||
1150 | 1150 | ||
1151 | /* write risc instructions */ | 1151 | /* write risc instructions */ |
1152 | rp = risc->cpu; | 1152 | rp = risc->cpu; |
@@ -1164,14 +1164,13 @@ int cx23885_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc, | |||
1164 | } | 1164 | } |
1165 | 1165 | ||
1166 | int cx23885_risc_databuffer(struct pci_dev *pci, | 1166 | int cx23885_risc_databuffer(struct pci_dev *pci, |
1167 | struct btcx_riscmem *risc, | 1167 | struct cx23885_riscmem *risc, |
1168 | struct scatterlist *sglist, | 1168 | struct scatterlist *sglist, |
1169 | unsigned int bpl, | 1169 | unsigned int bpl, |
1170 | unsigned int lines, unsigned int lpi) | 1170 | unsigned int lines, unsigned int lpi) |
1171 | { | 1171 | { |
1172 | u32 instructions; | 1172 | u32 instructions; |
1173 | __le32 *rp; | 1173 | __le32 *rp; |
1174 | int rc; | ||
1175 | 1174 | ||
1176 | /* estimate risc mem: worst case is one write per page border + | 1175 | /* estimate risc mem: worst case is one write per page border + |
1177 | one write per scan line + syncs + jump (all 2 dwords). Here | 1176 | one write per scan line + syncs + jump (all 2 dwords). Here |
@@ -1181,9 +1180,10 @@ int cx23885_risc_databuffer(struct pci_dev *pci, | |||
1181 | instructions = 1 + (bpl * lines) / PAGE_SIZE + lines; | 1180 | instructions = 1 + (bpl * lines) / PAGE_SIZE + lines; |
1182 | instructions += 4; | 1181 | instructions += 4; |
1183 | 1182 | ||
1184 | rc = btcx_riscmem_alloc(pci, risc, instructions*12); | 1183 | risc->size = instructions * 12; |
1185 | if (rc < 0) | 1184 | risc->cpu = pci_alloc_consistent(pci, risc->size, &risc->dma); |
1186 | return rc; | 1185 | if (risc->cpu == NULL) |
1186 | return -ENOMEM; | ||
1187 | 1187 | ||
1188 | /* write risc instructions */ | 1188 | /* write risc instructions */ |
1189 | rp = risc->cpu; | 1189 | rp = risc->cpu; |
@@ -1196,14 +1196,13 @@ int cx23885_risc_databuffer(struct pci_dev *pci, | |||
1196 | return 0; | 1196 | return 0; |
1197 | } | 1197 | } |
1198 | 1198 | ||
1199 | int cx23885_risc_vbibuffer(struct pci_dev *pci, struct btcx_riscmem *risc, | 1199 | int cx23885_risc_vbibuffer(struct pci_dev *pci, struct cx23885_riscmem *risc, |
1200 | struct scatterlist *sglist, unsigned int top_offset, | 1200 | struct scatterlist *sglist, unsigned int top_offset, |
1201 | unsigned int bottom_offset, unsigned int bpl, | 1201 | unsigned int bottom_offset, unsigned int bpl, |
1202 | unsigned int padding, unsigned int lines) | 1202 | unsigned int padding, unsigned int lines) |
1203 | { | 1203 | { |
1204 | u32 instructions, fields; | 1204 | u32 instructions, fields; |
1205 | __le32 *rp; | 1205 | __le32 *rp; |
1206 | int rc; | ||
1207 | 1206 | ||
1208 | fields = 0; | 1207 | fields = 0; |
1209 | if (UNSET != top_offset) | 1208 | if (UNSET != top_offset) |
@@ -1219,9 +1218,10 @@ int cx23885_risc_vbibuffer(struct pci_dev *pci, struct btcx_riscmem *risc, | |||
1219 | instructions = fields * (1 + ((bpl + padding) * lines) | 1218 | instructions = fields * (1 + ((bpl + padding) * lines) |
1220 | / PAGE_SIZE + lines); | 1219 | / PAGE_SIZE + lines); |
1221 | instructions += 5; | 1220 | instructions += 5; |
1222 | rc = btcx_riscmem_alloc(pci, risc, instructions*12); | 1221 | risc->size = instructions * 12; |
1223 | if (rc < 0) | 1222 | risc->cpu = pci_alloc_consistent(pci, risc->size, &risc->dma); |
1224 | return rc; | 1223 | if (risc->cpu == NULL) |
1224 | return -ENOMEM; | ||
1225 | /* write risc instructions */ | 1225 | /* write risc instructions */ |
1226 | rp = risc->cpu; | 1226 | rp = risc->cpu; |
1227 | 1227 | ||
@@ -1246,8 +1246,10 @@ int cx23885_risc_vbibuffer(struct pci_dev *pci, struct btcx_riscmem *risc, | |||
1246 | 1246 | ||
1247 | void cx23885_free_buffer(struct cx23885_dev *dev, struct cx23885_buffer *buf) | 1247 | void cx23885_free_buffer(struct cx23885_dev *dev, struct cx23885_buffer *buf) |
1248 | { | 1248 | { |
1249 | struct cx23885_riscmem *risc = &buf->risc; | ||
1250 | |||
1249 | BUG_ON(in_interrupt()); | 1251 | BUG_ON(in_interrupt()); |
1250 | btcx_riscmem_free(dev->pci, &buf->risc); | 1252 | pci_free_consistent(dev->pci, risc->size, risc->cpu, risc->dma); |
1251 | } | 1253 | } |
1252 | 1254 | ||
1253 | static void cx23885_tsport_reg_dump(struct cx23885_tsport *port) | 1255 | static void cx23885_tsport_reg_dump(struct cx23885_tsport *port) |