• Home
  • Raw
  • Download

Lines Matching refs:dmadev

77 static inline struct hidma_dev *to_hidma_dev(struct dma_device *dmadev)  in to_hidma_dev()  argument
79 return container_of(dmadev, struct hidma_dev, ddev); in to_hidma_dev()
99 static void hidma_free(struct hidma_dev *dmadev) in hidma_free() argument
101 INIT_LIST_HEAD(&dmadev->ddev.channels); in hidma_free()
176 struct hidma_dev *dmadev = to_hidma_dev(ddev); in hidma_callback() local
195 pm_runtime_mark_last_busy(dmadev->ddev.dev); in hidma_callback()
196 pm_runtime_put_autosuspend(dmadev->ddev.dev); in hidma_callback()
200 static int hidma_chan_init(struct hidma_dev *dmadev, u32 dma_sig) in hidma_chan_init() argument
205 mchan = devm_kzalloc(dmadev->ddev.dev, sizeof(*mchan), GFP_KERNEL); in hidma_chan_init()
209 ddev = &dmadev->ddev; in hidma_chan_init()
211 mchan->dmadev = dmadev; in hidma_chan_init()
223 dmadev->ddev.chancnt++; in hidma_chan_init()
229 struct hidma_dev *dmadev = from_tasklet(dmadev, t, task); in hidma_issue_task() local
231 pm_runtime_get_sync(dmadev->ddev.dev); in hidma_issue_task()
232 hidma_ll_start(dmadev->lldev); in hidma_issue_task()
238 struct hidma_dev *dmadev = mchan->dmadev; in hidma_issue_pending() local
245 hidma_ll_queue_request(dmadev->lldev, qdesc->tre_ch); in hidma_issue_pending()
258 status = pm_runtime_get(dmadev->ddev.dev); in hidma_issue_pending()
260 tasklet_schedule(&dmadev->task); in hidma_issue_pending()
262 hidma_ll_start(dmadev->lldev); in hidma_issue_pending()
320 struct hidma_dev *dmadev = mchan->dmadev; in hidma_tx_submit() local
325 pm_runtime_get_sync(dmadev->ddev.dev); in hidma_tx_submit()
326 if (!hidma_ll_isenabled(dmadev->lldev)) { in hidma_tx_submit()
327 pm_runtime_mark_last_busy(dmadev->ddev.dev); in hidma_tx_submit()
328 pm_runtime_put_autosuspend(dmadev->ddev.dev); in hidma_tx_submit()
331 pm_runtime_mark_last_busy(dmadev->ddev.dev); in hidma_tx_submit()
332 pm_runtime_put_autosuspend(dmadev->ddev.dev); in hidma_tx_submit()
351 struct hidma_dev *dmadev = mchan->dmadev; in hidma_alloc_chan_resources() local
362 for (i = 0; i < dmadev->nr_descriptors; i++) { in hidma_alloc_chan_resources()
371 rc = hidma_ll_request(dmadev->lldev, mchan->dma_sig, in hidma_alloc_chan_resources()
386 hidma_ll_free(dmadev->lldev, mdesc->tre_ch); in hidma_alloc_chan_resources()
405 struct hidma_dev *mdma = mchan->dmadev; in hidma_prep_dma_memcpy()
438 struct hidma_dev *mdma = mchan->dmadev; in hidma_prep_dma_memset()
468 struct hidma_dev *dmadev = to_hidma_dev(mchan->chan.device); in hidma_terminate_channel() local
474 pm_runtime_get_sync(dmadev->ddev.dev); in hidma_terminate_channel()
487 rc = hidma_ll_disable(dmadev->lldev); in hidma_terminate_channel()
489 dev_err(dmadev->ddev.dev, "channel did not pause\n"); in hidma_terminate_channel()
505 rc = hidma_ll_enable(dmadev->lldev); in hidma_terminate_channel()
507 pm_runtime_mark_last_busy(dmadev->ddev.dev); in hidma_terminate_channel()
508 pm_runtime_put_autosuspend(dmadev->ddev.dev); in hidma_terminate_channel()
515 struct hidma_dev *dmadev = to_hidma_dev(mchan->chan.device); in hidma_terminate_all() local
523 pm_runtime_get_sync(dmadev->ddev.dev); in hidma_terminate_all()
524 rc = hidma_ll_setup(dmadev->lldev); in hidma_terminate_all()
525 pm_runtime_mark_last_busy(dmadev->ddev.dev); in hidma_terminate_all()
526 pm_runtime_put_autosuspend(dmadev->ddev.dev); in hidma_terminate_all()
533 struct hidma_dev *mdma = mchan->dmadev; in hidma_free_chan_resources()
560 struct hidma_dev *dmadev; in hidma_pause() local
563 dmadev = to_hidma_dev(mchan->chan.device); in hidma_pause()
565 pm_runtime_get_sync(dmadev->ddev.dev); in hidma_pause()
566 if (hidma_ll_disable(dmadev->lldev)) in hidma_pause()
567 dev_warn(dmadev->ddev.dev, "channel did not stop\n"); in hidma_pause()
569 pm_runtime_mark_last_busy(dmadev->ddev.dev); in hidma_pause()
570 pm_runtime_put_autosuspend(dmadev->ddev.dev); in hidma_pause()
578 struct hidma_dev *dmadev; in hidma_resume() local
582 dmadev = to_hidma_dev(mchan->chan.device); in hidma_resume()
584 pm_runtime_get_sync(dmadev->ddev.dev); in hidma_resume()
585 rc = hidma_ll_enable(dmadev->lldev); in hidma_resume()
589 dev_err(dmadev->ddev.dev, in hidma_resume()
591 pm_runtime_mark_last_busy(dmadev->ddev.dev); in hidma_resume()
592 pm_runtime_put_autosuspend(dmadev->ddev.dev); in hidma_resume()
612 struct hidma_dev *dmadev = to_hidma_dev_from_lldev(lldevp); in hidma_chirq_handler_msi() local
615 1 << (chirq - dmadev->msi_virqbase)); in hidma_chirq_handler_msi()
673 struct hidma_dev *dmadev = dev_get_drvdata(dev); in hidma_write_msi_msg() local
676 writel(msg->address_lo, dmadev->dev_evca + 0x118); in hidma_write_msi_msg()
677 writel(msg->address_hi, dmadev->dev_evca + 0x11C); in hidma_write_msi_msg()
678 writel(msg->data, dmadev->dev_evca + 0x120); in hidma_write_msi_msg()
683 static void hidma_free_msis(struct hidma_dev *dmadev) in hidma_free_msis() argument
686 struct device *dev = dmadev->ddev.dev; in hidma_free_msis()
691 devm_free_irq(dev, desc->irq, &dmadev->lldev); in hidma_free_msis()
697 static int hidma_request_msi(struct hidma_dev *dmadev, in hidma_request_msi() argument
712 dmadev->msi_virqbase = desc->irq; in hidma_request_msi()
717 &dmadev->lldev); in hidma_request_msi()
730 &dmadev->lldev); in hidma_request_msi()
734 hidma_ll_setup_irq(dmadev->lldev, true); in hidma_request_msi()
756 struct hidma_dev *dmadev; in hidma_probe() local
794 dmadev = devm_kzalloc(&pdev->dev, sizeof(*dmadev), GFP_KERNEL); in hidma_probe()
795 if (!dmadev) { in hidma_probe()
800 INIT_LIST_HEAD(&dmadev->ddev.channels); in hidma_probe()
801 spin_lock_init(&dmadev->lock); in hidma_probe()
802 dmadev->ddev.dev = &pdev->dev; in hidma_probe()
803 pm_runtime_get_sync(dmadev->ddev.dev); in hidma_probe()
805 dma_cap_set(DMA_MEMCPY, dmadev->ddev.cap_mask); in hidma_probe()
806 dma_cap_set(DMA_MEMSET, dmadev->ddev.cap_mask); in hidma_probe()
812 dmadev->dev_evca = evca; in hidma_probe()
813 dmadev->evca_resource = evca_resource; in hidma_probe()
814 dmadev->dev_trca = trca; in hidma_probe()
815 dmadev->trca_resource = trca_resource; in hidma_probe()
816 dmadev->ddev.device_prep_dma_memcpy = hidma_prep_dma_memcpy; in hidma_probe()
817 dmadev->ddev.device_prep_dma_memset = hidma_prep_dma_memset; in hidma_probe()
818 dmadev->ddev.device_alloc_chan_resources = hidma_alloc_chan_resources; in hidma_probe()
819 dmadev->ddev.device_free_chan_resources = hidma_free_chan_resources; in hidma_probe()
820 dmadev->ddev.device_tx_status = hidma_tx_status; in hidma_probe()
821 dmadev->ddev.device_issue_pending = hidma_issue_pending; in hidma_probe()
822 dmadev->ddev.device_pause = hidma_pause; in hidma_probe()
823 dmadev->ddev.device_resume = hidma_resume; in hidma_probe()
824 dmadev->ddev.device_terminate_all = hidma_terminate_all; in hidma_probe()
825 dmadev->ddev.copy_align = 8; in hidma_probe()
833 &dmadev->nr_descriptors); in hidma_probe()
838 dmadev->nr_descriptors = nr_desc_prm; in hidma_probe()
841 if (!dmadev->nr_descriptors) in hidma_probe()
842 dmadev->nr_descriptors = HIDMA_NR_DEFAULT_DESC; in hidma_probe()
845 dmadev->chidx = readl(dmadev->dev_trca + 0x40); in hidma_probe()
847 dmadev->chidx = readl(dmadev->dev_trca + 0x28); in hidma_probe()
858 dmadev->lldev = hidma_ll_init(dmadev->ddev.dev, in hidma_probe()
859 dmadev->nr_descriptors, dmadev->dev_trca, in hidma_probe()
860 dmadev->dev_evca, dmadev->chidx); in hidma_probe()
861 if (!dmadev->lldev) { in hidma_probe()
866 platform_set_drvdata(pdev, dmadev); in hidma_probe()
868 rc = hidma_request_msi(dmadev, pdev); in hidma_probe()
871 hidma_ll_setup_irq(dmadev->lldev, false); in hidma_probe()
873 0, "qcom-hidma", dmadev->lldev); in hidma_probe()
878 INIT_LIST_HEAD(&dmadev->ddev.channels); in hidma_probe()
879 rc = hidma_chan_init(dmadev, 0); in hidma_probe()
883 rc = dma_async_device_register(&dmadev->ddev); in hidma_probe()
887 dmadev->irq = chirq; in hidma_probe()
888 tasklet_setup(&dmadev->task, hidma_issue_task); in hidma_probe()
889 hidma_debug_init(dmadev); in hidma_probe()
890 hidma_sysfs_init(dmadev); in hidma_probe()
892 pm_runtime_mark_last_busy(dmadev->ddev.dev); in hidma_probe()
893 pm_runtime_put_autosuspend(dmadev->ddev.dev); in hidma_probe()
898 hidma_free_msis(dmadev); in hidma_probe()
900 hidma_ll_uninit(dmadev->lldev); in hidma_probe()
902 if (dmadev) in hidma_probe()
903 hidma_free(dmadev); in hidma_probe()
912 struct hidma_dev *dmadev = platform_get_drvdata(pdev); in hidma_shutdown() local
914 dev_info(dmadev->ddev.dev, "HI-DMA engine shutdown\n"); in hidma_shutdown()
916 pm_runtime_get_sync(dmadev->ddev.dev); in hidma_shutdown()
917 if (hidma_ll_disable(dmadev->lldev)) in hidma_shutdown()
918 dev_warn(dmadev->ddev.dev, "channel did not stop\n"); in hidma_shutdown()
919 pm_runtime_mark_last_busy(dmadev->ddev.dev); in hidma_shutdown()
920 pm_runtime_put_autosuspend(dmadev->ddev.dev); in hidma_shutdown()
926 struct hidma_dev *dmadev = platform_get_drvdata(pdev); in hidma_remove() local
928 pm_runtime_get_sync(dmadev->ddev.dev); in hidma_remove()
929 dma_async_device_unregister(&dmadev->ddev); in hidma_remove()
930 if (!dmadev->lldev->msi_support) in hidma_remove()
931 devm_free_irq(dmadev->ddev.dev, dmadev->irq, dmadev->lldev); in hidma_remove()
933 hidma_free_msis(dmadev); in hidma_remove()
935 tasklet_kill(&dmadev->task); in hidma_remove()
936 hidma_sysfs_uninit(dmadev); in hidma_remove()
937 hidma_debug_uninit(dmadev); in hidma_remove()
938 hidma_ll_uninit(dmadev->lldev); in hidma_remove()
939 hidma_free(dmadev); in hidma_remove()