• Home
  • Raw
  • Download

Lines Matching refs:ichan

30 static int ipu_disable_channel(struct idmac *idmac, struct idmac_channel *ichan,
602 static int ipu_enable_channel(struct idmac *idmac, struct idmac_channel *ichan) in ipu_enable_channel() argument
605 enum ipu_channel channel = ichan->dma_chan.chan_id; in ipu_enable_channel()
613 ichan->active_buffer = 0; in ipu_enable_channel()
614 ichan->status = IPU_CHANNEL_ENABLED; in ipu_enable_channel()
650 static int ipu_init_channel_buffer(struct idmac_channel *ichan, in ipu_init_channel_buffer() argument
657 enum ipu_channel channel = ichan->dma_chan.chan_id; in ipu_init_channel_buffer()
658 struct idmac *idmac = to_idmac(ichan->dma_chan.device); in ipu_init_channel_buffer()
698 ichan->status = IPU_CHANNEL_READY; in ipu_init_channel_buffer()
729 static void ipu_update_channel_buffer(struct idmac_channel *ichan, in ipu_update_channel_buffer() argument
732 enum ipu_channel channel = ichan->dma_chan.chan_id; in ipu_update_channel_buffer()
742 ichan->status = IPU_CHANNEL_READY; in ipu_update_channel_buffer()
753 ichan->status = IPU_CHANNEL_READY; in ipu_update_channel_buffer()
773 static int ipu_submit_buffer(struct idmac_channel *ichan, in ipu_submit_buffer() argument
776 unsigned int chan_id = ichan->dma_chan.chan_id; in ipu_submit_buffer()
777 struct device *dev = &ichan->dma_chan.dev->device; in ipu_submit_buffer()
788 ipu_update_channel_buffer(ichan, buf_idx, sg_dma_address(sg)); in ipu_submit_buffer()
798 static int ipu_submit_channel_buffers(struct idmac_channel *ichan, in ipu_submit_channel_buffers() argument
805 if (!ichan->sg[i]) { in ipu_submit_channel_buffers()
806 ichan->sg[i] = sg; in ipu_submit_channel_buffers()
808 ret = ipu_submit_buffer(ichan, desc, sg, i); in ipu_submit_channel_buffers()
822 struct idmac_channel *ichan = to_idmac_chan(tx->chan); in idmac_tx_submit() local
825 struct device *dev = &ichan->dma_chan.dev->device; in idmac_tx_submit()
837 mutex_lock(&ichan->chan_mutex); in idmac_tx_submit()
841 if (ichan->status < IPU_CHANNEL_READY) { in idmac_tx_submit()
842 struct idmac_video_param *video = &ichan->params.video; in idmac_tx_submit()
850 WARN_ON(ichan->sg[0] || ichan->sg[1]); in idmac_tx_submit()
852 cookie = ipu_init_channel_buffer(ichan, in idmac_tx_submit()
869 spin_lock_irqsave(&ichan->lock, flags); in idmac_tx_submit()
871 list_add_tail(&desc->list, &ichan->queue); in idmac_tx_submit()
873 ret = ipu_submit_channel_buffers(ichan, desc); in idmac_tx_submit()
875 spin_unlock_irqrestore(&ichan->lock, flags); in idmac_tx_submit()
882 if (ichan->status < IPU_CHANNEL_ENABLED) { in idmac_tx_submit()
883 ret = ipu_enable_channel(idmac, ichan); in idmac_tx_submit()
894 spin_lock_irqsave(&ichan->lock, flags); in idmac_tx_submit()
896 spin_unlock_irqrestore(&ichan->lock, flags); in idmac_tx_submit()
898 ichan->dma_chan.cookie = cookie; in idmac_tx_submit()
902 mutex_unlock(&ichan->chan_mutex); in idmac_tx_submit()
908 static int idmac_desc_alloc(struct idmac_channel *ichan, int n) in idmac_desc_alloc() argument
912 struct idmac *idmac = to_idmac(ichan->dma_chan.device); in idmac_desc_alloc()
920 ichan->n_tx_desc = n; in idmac_desc_alloc()
921 ichan->desc = desc; in idmac_desc_alloc()
922 INIT_LIST_HEAD(&ichan->queue); in idmac_desc_alloc()
923 INIT_LIST_HEAD(&ichan->free_list); in idmac_desc_alloc()
929 dma_async_tx_descriptor_init(txd, &ichan->dma_chan); in idmac_desc_alloc()
932 list_add(&desc->list, &ichan->free_list); in idmac_desc_alloc()
948 static int ipu_init_channel(struct idmac *idmac, struct idmac_channel *ichan) in ipu_init_channel() argument
950 union ipu_channel_param *params = &ichan->params; in ipu_init_channel()
952 enum ipu_channel channel = ichan->dma_chan.chan_id; in ipu_init_channel()
994 if (n_desc && !ichan->desc) in ipu_init_channel()
995 ret = idmac_desc_alloc(ichan, n_desc); in ipu_init_channel()
1007 static void ipu_uninit_channel(struct idmac *idmac, struct idmac_channel *ichan) in ipu_uninit_channel() argument
1009 enum ipu_channel channel = ichan->dma_chan.chan_id; in ipu_uninit_channel()
1029 ichan->sec_chan_en = false; in ipu_uninit_channel()
1056 ichan->n_tx_desc = 0; in ipu_uninit_channel()
1057 vfree(ichan->desc); in ipu_uninit_channel()
1058 ichan->desc = NULL; in ipu_uninit_channel()
1069 static int ipu_disable_channel(struct idmac *idmac, struct idmac_channel *ichan, in ipu_disable_channel() argument
1072 enum ipu_channel channel = ichan->dma_chan.chan_id; in ipu_disable_channel()
1105 timeout && !ipu_irq_status(ichan->eof_irq); timeout--) in ipu_disable_channel()
1123 static struct scatterlist *idmac_sg_next(struct idmac_channel *ichan, in idmac_sg_next() argument
1132 if ((*desc)->list.next == &ichan->queue) in idmac_sg_next()
1155 struct idmac_channel *ichan = dev_id; in idmac_interrupt() local
1156 struct device *dev = &ichan->dma_chan.dev->device; in idmac_interrupt()
1157 unsigned int chan_id = ichan->dma_chan.chan_id; in idmac_interrupt()
1168 dev_dbg(dev, "IDMAC irq %d, buf %d\n", irq, ichan->active_buffer); in idmac_interrupt()
1194 spin_lock(&ichan->lock); in idmac_interrupt()
1195 if (unlikely((ichan->active_buffer && (ready1 >> chan_id) & 1) || in idmac_interrupt()
1196 (!ichan->active_buffer && (ready0 >> chan_id) & 1) in idmac_interrupt()
1198 spin_unlock(&ichan->lock); in idmac_interrupt()
1202 ichan->active_buffer, ready0, ready1); in idmac_interrupt()
1206 if (unlikely(list_empty(&ichan->queue))) { in idmac_interrupt()
1207 ichan->sg[ichan->active_buffer] = NULL; in idmac_interrupt()
1208 spin_unlock(&ichan->lock); in idmac_interrupt()
1212 ichan->active_buffer, ready0, ready1); in idmac_interrupt()
1221 sg = &ichan->sg[ichan->active_buffer]; in idmac_interrupt()
1222 sgnext = ichan->sg[!ichan->active_buffer]; in idmac_interrupt()
1225 spin_unlock(&ichan->lock); in idmac_interrupt()
1229 desc = list_entry(ichan->queue.next, struct idmac_tx_desc, list); in idmac_interrupt()
1235 ichan->active_buffer, curbuf); in idmac_interrupt()
1238 sgnew = idmac_sg_next(ichan, &descnew, *sg); in idmac_interrupt()
1249 ichan->sg[!ichan->active_buffer] = sgnew; in idmac_interrupt()
1252 ipu_submit_buffer(ichan, descnew, sgnew, !ichan->active_buffer); in idmac_interrupt()
1257 ichan->status = IPU_CHANNEL_READY; in idmac_interrupt()
1263 sgnew = idmac_sg_next(ichan, &descnew, sgnew); in idmac_interrupt()
1277 ipu_submit_buffer(ichan, descnew, sgnew, ichan->active_buffer) < 0) { in idmac_interrupt()
1281 spin_unlock(&ichan->lock); in idmac_interrupt()
1284 spin_lock(&ichan->lock); in idmac_interrupt()
1288 ichan->active_buffer = !ichan->active_buffer; in idmac_interrupt()
1294 spin_unlock(&ichan->lock); in idmac_interrupt()
1308 struct idmac_channel *ichan = ipu->channel + i; in ipu_gc_tasklet() local
1314 for (j = 0; j < ichan->n_tx_desc; j++) { in ipu_gc_tasklet()
1315 desc = ichan->desc + j; in ipu_gc_tasklet()
1316 spin_lock_irqsave(&ichan->lock, flags); in ipu_gc_tasklet()
1318 list_move(&desc->list, &ichan->free_list); in ipu_gc_tasklet()
1320 if (ichan->sg[0] == sg) in ipu_gc_tasklet()
1321 ichan->sg[0] = NULL; in ipu_gc_tasklet()
1322 else if (ichan->sg[1] == sg) in ipu_gc_tasklet()
1323 ichan->sg[1] = NULL; in ipu_gc_tasklet()
1327 spin_unlock_irqrestore(&ichan->lock, flags); in ipu_gc_tasklet()
1338 struct idmac_channel *ichan = to_idmac_chan(chan); in idmac_prep_slave_sg() local
1353 mutex_lock(&ichan->chan_mutex); in idmac_prep_slave_sg()
1355 spin_lock_irqsave(&ichan->lock, flags); in idmac_prep_slave_sg()
1356 if (!list_empty(&ichan->free_list)) { in idmac_prep_slave_sg()
1357 desc = list_entry(ichan->free_list.next, in idmac_prep_slave_sg()
1367 spin_unlock_irqrestore(&ichan->lock, flags); in idmac_prep_slave_sg()
1369 mutex_unlock(&ichan->chan_mutex); in idmac_prep_slave_sg()
1379 struct idmac_channel *ichan = to_idmac_chan(chan); in idmac_issue_pending() local
1386 ipu_select_buffer(chan->chan_id, ichan->active_buffer); in idmac_issue_pending()
1399 struct idmac_channel *ichan = to_idmac_chan(chan); in idmac_pause() local
1405 mutex_lock(&ichan->chan_mutex); in idmac_pause()
1411 list_for_each_safe(list, tmp, &ichan->queue) in idmac_pause()
1414 ichan->sg[0] = NULL; in idmac_pause()
1415 ichan->sg[1] = NULL; in idmac_pause()
1419 ichan->status = IPU_CHANNEL_INITIALIZED; in idmac_pause()
1421 mutex_unlock(&ichan->chan_mutex); in idmac_pause()
1428 struct idmac_channel *ichan = to_idmac_chan(chan); in __idmac_terminate_all() local
1434 ipu_disable_channel(idmac, ichan, in __idmac_terminate_all()
1435 ichan->status >= IPU_CHANNEL_ENABLED); in __idmac_terminate_all()
1440 spin_lock_irqsave(&ichan->lock, flags); in __idmac_terminate_all()
1441 list_splice_init(&ichan->queue, &ichan->free_list); in __idmac_terminate_all()
1443 if (ichan->desc) in __idmac_terminate_all()
1444 for (i = 0; i < ichan->n_tx_desc; i++) { in __idmac_terminate_all()
1445 struct idmac_tx_desc *desc = ichan->desc + i; in __idmac_terminate_all()
1448 list_add(&desc->list, &ichan->free_list); in __idmac_terminate_all()
1453 ichan->sg[0] = NULL; in __idmac_terminate_all()
1454 ichan->sg[1] = NULL; in __idmac_terminate_all()
1455 spin_unlock_irqrestore(&ichan->lock, flags); in __idmac_terminate_all()
1459 ichan->status = IPU_CHANNEL_INITIALIZED; in __idmac_terminate_all()
1466 struct idmac_channel *ichan = to_idmac_chan(chan); in idmac_terminate_all() local
1469 mutex_lock(&ichan->chan_mutex); in idmac_terminate_all()
1473 mutex_unlock(&ichan->chan_mutex); in idmac_terminate_all()
1481 struct idmac_channel *ichan = dev_id; in ic_sof_irq() local
1483 irq, ichan->dma_chan.chan_id); in ic_sof_irq()
1490 struct idmac_channel *ichan = dev_id; in ic_eof_irq() local
1492 irq, ichan->dma_chan.chan_id); in ic_eof_irq()
1502 struct idmac_channel *ichan = to_idmac_chan(chan); in idmac_alloc_chan_resources() local
1508 WARN_ON(ichan->status != IPU_CHANNEL_FREE); in idmac_alloc_chan_resources()
1516 ichan->eof_irq = ret; in idmac_alloc_chan_resources()
1522 ipu_disable_channel(idmac, ichan, true); in idmac_alloc_chan_resources()
1524 ret = ipu_init_channel(idmac, ichan); in idmac_alloc_chan_resources()
1528 ret = request_irq(ichan->eof_irq, idmac_interrupt, 0, in idmac_alloc_chan_resources()
1529 ichan->eof_name, ichan); in idmac_alloc_chan_resources()
1537 ret = request_irq(ic_sof, ic_sof_irq, 0, "IC SOF", ichan); in idmac_alloc_chan_resources()
1543 ret = request_irq(ic_eof, ic_eof_irq, 0, "IC EOF", ichan); in idmac_alloc_chan_resources()
1550 ichan->status = IPU_CHANNEL_INITIALIZED; in idmac_alloc_chan_resources()
1553 chan->chan_id, ichan->eof_irq); in idmac_alloc_chan_resources()
1558 ipu_uninit_channel(idmac, ichan); in idmac_alloc_chan_resources()
1567 struct idmac_channel *ichan = to_idmac_chan(chan); in idmac_free_chan_resources() local
1570 mutex_lock(&ichan->chan_mutex); in idmac_free_chan_resources()
1574 if (ichan->status > IPU_CHANNEL_FREE) { in idmac_free_chan_resources()
1578 free_irq(ic_sof, ichan); in idmac_free_chan_resources()
1583 free_irq(ic_eof, ichan); in idmac_free_chan_resources()
1589 free_irq(ichan->eof_irq, ichan); in idmac_free_chan_resources()
1593 ichan->status = IPU_CHANNEL_FREE; in idmac_free_chan_resources()
1595 ipu_uninit_channel(idmac, ichan); in idmac_free_chan_resources()
1597 mutex_unlock(&ichan->chan_mutex); in idmac_free_chan_resources()
1631 struct idmac_channel *ichan = ipu->channel + i; in ipu_idmac_init() local
1632 struct dma_chan *dma_chan = &ichan->dma_chan; in ipu_idmac_init()
1634 spin_lock_init(&ichan->lock); in ipu_idmac_init()
1635 mutex_init(&ichan->chan_mutex); in ipu_idmac_init()
1637 ichan->status = IPU_CHANNEL_FREE; in ipu_idmac_init()
1638 ichan->sec_chan_en = false; in ipu_idmac_init()
1639 snprintf(ichan->eof_name, sizeof(ichan->eof_name), "IDMAC EOF %d", i); in ipu_idmac_init()
1658 struct idmac_channel *ichan = ipu->channel + i; in ipu_idmac_exit() local
1660 idmac_terminate_all(&ichan->dma_chan); in ipu_idmac_exit()