Lines Matching full:delta
19 #include "delta.h"
20 #include "delta-debug.h"
21 #include "delta-ipc.h"
23 #define DELTA_NAME "st-delta"
63 struct delta_dev *delta = ctx->dev; in dump_au() local
68 dev_dbg(delta->dev, "%s dump au[%d] dts=%lld size=%d data=%*ph\n", in dump_au()
72 dev_dbg(delta->dev, "%s dump au[%d] dts=%lld size=%d data=%*ph..%*ph\n", in dump_au()
79 struct delta_dev *delta = ctx->dev; in dump_frame() local
83 dev_dbg(delta->dev, "%s dump frame[%d] dts=%lld type=%s field=%s data=%*ph\n", in dump_frame()
179 struct delta_dev *delta = ctx->dev; in delta_pop_dts() local
187 dev_warn(delta->dev, "%s no dts to pop ... output dts = 0\n", in delta_pop_dts()
282 struct delta_dev *delta = ctx->dev; in delta_find_decoder() local
286 for (i = 0; i < delta->nb_of_decoders; i++) { in delta_find_decoder()
287 dec = delta->decoders[i]; in delta_find_decoder()
308 static void register_formats(struct delta_dev *delta) in register_formats() argument
312 for (i = 0; i < delta->nb_of_decoders; i++) { in register_formats()
313 register_format(delta->decoders[i]->pixelformat, in register_formats()
314 delta->pixelformats, in register_formats()
315 &delta->nb_of_pixelformats); in register_formats()
317 register_format(delta->decoders[i]->streamformat, in register_formats()
318 delta->streamformats, in register_formats()
319 &delta->nb_of_streamformats); in register_formats()
323 static void register_decoders(struct delta_dev *delta) in register_decoders() argument
328 if (delta->nb_of_decoders >= DELTA_MAX_DECODERS) { in register_decoders()
329 dev_dbg(delta->dev, in register_decoders()
336 delta->decoders[delta->nb_of_decoders++] = delta_decoders[i]; in register_decoders()
337 dev_info(delta->dev, "%s %s decoder registered\n", in register_decoders()
345 struct delta_dev *delta = ctx->dev; in delta_open_decoder() local
351 dev_err(delta->dev, "%s no decoder found matching %4.4s => %4.4s\n", in delta_open_decoder()
356 dev_dbg(delta->dev, "%s one decoder matching %4.4s => %4.4s\n", in delta_open_decoder()
361 delta->instance_id, (char *)&streamformat); in delta_open_decoder()
366 dev_err(delta->dev, "%s failed to open decoder instance (%d)\n", in delta_open_decoder()
371 dev_dbg(delta->dev, "%s %s decoder opened\n", ctx->name, dec->name); in delta_open_decoder()
386 struct delta_dev *delta = ctx->dev; in delta_querycap() local
389 strscpy(cap->card, delta->vdev->name, sizeof(cap->card)); in delta_querycap()
391 delta->pdev->name); in delta_querycap()
400 struct delta_dev *delta = ctx->dev; in delta_enum_fmt_stream() local
402 if (unlikely(f->index >= delta->nb_of_streamformats)) in delta_enum_fmt_stream()
405 f->pixelformat = delta->streamformats[f->index]; in delta_enum_fmt_stream()
414 struct delta_dev *delta = ctx->dev; in delta_enum_fmt_frame() local
416 if (unlikely(f->index >= delta->nb_of_pixelformats)) in delta_enum_fmt_frame()
419 f->pixelformat = delta->pixelformats[f->index]; in delta_enum_fmt_frame()
428 struct delta_dev *delta = ctx->dev; in delta_g_fmt_stream() local
434 dev_dbg(delta->dev, in delta_g_fmt_stream()
456 struct delta_dev *delta = ctx->dev; in delta_g_fmt_frame() local
463 dev_dbg(delta->dev, in delta_g_fmt_frame()
495 struct delta_dev *delta = ctx->dev; in delta_try_fmt_stream() local
504 dev_dbg(delta->dev, in delta_try_fmt_stream()
524 dev_dbg(delta->dev, in delta_try_fmt_stream()
531 dev_dbg(delta->dev, in delta_try_fmt_stream()
549 struct delta_dev *delta = ctx->dev; in delta_try_fmt_frame() local
558 dev_dbg(delta->dev, in delta_try_fmt_frame()
575 dev_dbg(delta->dev, in delta_try_fmt_frame()
583 dev_dbg(delta->dev, in delta_try_fmt_frame()
609 struct delta_dev *delta = ctx->dev; in delta_s_fmt_stream() local
616 dev_dbg(delta->dev, in delta_s_fmt_stream()
624 dev_dbg(delta->dev, "%s V4L2 S_FMT (OUTPUT): queue busy\n", in delta_s_fmt_stream()
645 struct delta_dev *delta = ctx->dev; in delta_s_fmt_frame() local
655 dev_dbg(delta->dev, "%s V4L2 S_FMT (CAPTURE): queue busy\n", in delta_s_fmt_frame()
669 dev_dbg(delta->dev, in delta_s_fmt_frame()
702 dev_dbg(delta->dev, in delta_s_fmt_frame()
766 struct delta_dev *delta = ctx->dev; in delta_complete_eos() local
787 dev_dbg(delta->dev, "%s EOS completed\n", ctx->name); in delta_complete_eos()
809 struct delta_dev *delta = ctx->dev; in delta_decoder_stop_cmd() local
813 dev_dbg(delta->dev, "%s EOS received\n", ctx->name); in delta_decoder_stop_cmd()
830 dev_dbg(delta->dev, "%s drain frame[%d]\n", in delta_decoder_stop_cmd()
861 dev_dbg(delta->dev, "%s EOS delayed\n", ctx->name); in delta_decoder_stop_cmd()
925 struct delta_dev *delta = ctx->dev; in delta_run_work() local
934 dev_err(delta->dev, "%s no decoder opened yet\n", ctx->name); in delta_run_work()
943 dev_err(delta->dev, "%s no buffer to decode\n", ctx->name); in delta_run_work()
978 dev_err(delta->dev, "%s decoding failed (%d)\n", in delta_run_work()
1004 dev_err(delta->dev, "%s cannot get decoded frame (%d)\n", in delta_run_work()
1009 dev_err(delta->dev, in delta_run_work()
1027 v4l2_m2m_job_finish(delta->m2m_dev, ctx->fh.m2m_ctx); in delta_run_work()
1034 v4l2_m2m_job_finish(delta->m2m_dev, ctx->fh.m2m_ctx); in delta_run_work()
1040 struct delta_dev *delta = ctx->dev; in delta_device_run() local
1042 queue_work(delta->work_queue, &ctx->run_work); in delta_device_run()
1048 struct delta_dev *delta = ctx->dev; in delta_job_abort() local
1050 dev_dbg(delta->dev, "%s aborting job\n", ctx->name); in delta_job_abort()
1058 struct delta_dev *delta = ctx->dev; in delta_job_ready() local
1062 dev_dbg(delta->dev, "%s not ready: not enough video buffers.\n", in delta_job_ready()
1068 dev_dbg(delta->dev, "%s not ready: not enough video capture buffers.\n", in delta_job_ready()
1074 dev_dbg(delta->dev, "%s job not ready: aborting\n", ctx->name); in delta_job_ready()
1078 dev_dbg(delta->dev, "%s job ready\n", ctx->name); in delta_job_ready()
1121 struct delta_dev *delta = ctx->dev; in delta_vb2_au_prepare() local
1131 dev_dbg(delta->dev, "%s au[%d] prepared; virt=0x%p, phy=0x%pad\n", in delta_vb2_au_prepare()
1144 struct delta_dev *delta = ctx->dev; in delta_setup_frame() local
1148 dev_err(delta->dev, in delta_setup_frame()
1155 dev_err(delta->dev, in delta_setup_frame()
1162 dev_warn(delta->dev, in delta_setup_frame()
1223 struct delta_dev *delta = ctx->dev; in dump_frames_status() local
1228 dev_info(delta->dev, in dump_frames_status()
1233 dev_info(delta->dev, in dump_frames_status()
1244 struct delta_dev *delta = ctx->dev; in delta_get_free_frame() local
1252 dev_err(delta->dev, "%s no frame available", in delta_get_free_frame()
1260 dev_err(delta->dev, in delta_get_free_frame()
1267 dev_dbg(delta->dev, in delta_get_free_frame()
1276 struct delta_dev *delta = ctx->dev; in delta_get_sync() local
1280 ret = pm_runtime_get_sync(delta->dev); in delta_get_sync()
1282 dev_err(delta->dev, "%s pm_runtime_get_sync failed (%d)\n", in delta_get_sync()
1292 struct delta_dev *delta = ctx->dev; in delta_put_autosuspend() local
1294 pm_runtime_put_autosuspend(delta->dev); in delta_put_autosuspend()
1310 struct delta_dev *delta = ctx->dev; in delta_vb2_au_start_streaming() local
1342 dev_err(delta->dev, "%s failed to start streaming, no stream header buffer enqueued\n", in delta_vb2_au_start_streaming()
1359 dev_err(delta->dev, "%s failed to start streaming, header decoding failed (%d)\n", in delta_vb2_au_start_streaming()
1366 dev_dbg_ratelimited(delta->dev, in delta_vb2_au_start_streaming()
1380 dev_dbg(delta->dev, "%s %s => %s\n", ctx->name, in delta_vb2_au_start_streaming()
1423 struct delta_dev *delta = ctx->dev; in delta_vb2_frame_queue_setup() local
1432 * decoding peak smoothing (depends on DELTA IP perf) in delta_vb2_frame_queue_setup()
1435 dev_dbg(delta->dev, in delta_vb2_frame_queue_setup()
1444 dev_dbg(delta->dev, in delta_vb2_frame_queue_setup()
1467 struct delta_dev *delta = ctx->dev; in delta_vb2_frame_prepare() local
1480 dev_err(delta->dev, in delta_vb2_frame_prepare()
1486 dev_dbg(delta->dev, in delta_vb2_frame_prepare()
1590 struct delta_dev *delta = ctx->dev; in queue_init() local
1603 q->lock = &delta->lock; in queue_init()
1604 q->dev = delta->dev; in queue_init()
1621 q->lock = &delta->lock; in queue_init()
1622 q->dev = delta->dev; in queue_init()
1629 struct delta_dev *delta = video_drvdata(file); in delta_open() local
1633 mutex_lock(&delta->lock); in delta_open()
1640 ctx->dev = delta; in delta_open()
1649 ctx->fh.m2m_ctx = v4l2_m2m_ctx_init(delta->m2m_dev, ctx, in delta_open()
1653 dev_err(delta->dev, "%s failed to initialize m2m context (%d)\n", in delta_open()
1667 delta->instance_id++; in delta_open()
1669 delta->instance_id); in delta_open()
1675 if (delta->clk_st231) in delta_open()
1676 if (clk_prepare_enable(delta->clk_st231)) in delta_open()
1677 dev_warn(delta->dev, "failed to enable st231 clk\n"); in delta_open()
1680 if (delta->clk_flash_promip) in delta_open()
1681 if (clk_prepare_enable(delta->clk_flash_promip)) in delta_open()
1682 dev_warn(delta->dev, "failed to enable delta promip clk\n"); in delta_open()
1684 mutex_unlock(&delta->lock); in delta_open()
1686 dev_dbg(delta->dev, "%s decoder instance created\n", ctx->name); in delta_open()
1695 mutex_unlock(&delta->lock); in delta_open()
1703 struct delta_dev *delta = ctx->dev; in delta_release() local
1706 mutex_lock(&delta->lock); in delta_release()
1723 if (delta->clk_st231) in delta_release()
1724 clk_disable_unprepare(delta->clk_st231); in delta_release()
1727 if (delta->clk_flash_promip) in delta_release()
1728 clk_disable_unprepare(delta->clk_flash_promip); in delta_release()
1730 dev_dbg(delta->dev, "%s decoder instance released\n", ctx->name); in delta_release()
1734 mutex_unlock(&delta->lock); in delta_release()
1752 static int delta_register_device(struct delta_dev *delta) in delta_register_device() argument
1757 if (!delta) in delta_register_device()
1760 delta->m2m_dev = v4l2_m2m_init(&delta_m2m_ops); in delta_register_device()
1761 if (IS_ERR(delta->m2m_dev)) { in delta_register_device()
1762 dev_err(delta->dev, "%s failed to initialize v4l2-m2m device\n", in delta_register_device()
1764 ret = PTR_ERR(delta->m2m_dev); in delta_register_device()
1770 dev_err(delta->dev, "%s failed to allocate video device\n", in delta_register_device()
1779 vdev->lock = &delta->lock; in delta_register_device()
1782 vdev->v4l2_dev = &delta->v4l2_dev; in delta_register_device()
1788 dev_err(delta->dev, "%s failed to register video device\n", in delta_register_device()
1793 delta->vdev = vdev; in delta_register_device()
1794 video_set_drvdata(vdev, delta); in delta_register_device()
1800 v4l2_m2m_release(delta->m2m_dev); in delta_register_device()
1805 static void delta_unregister_device(struct delta_dev *delta) in delta_unregister_device() argument
1807 if (!delta) in delta_unregister_device()
1810 if (delta->m2m_dev) in delta_unregister_device()
1811 v4l2_m2m_release(delta->m2m_dev); in delta_unregister_device()
1813 video_unregister_device(delta->vdev); in delta_unregister_device()
1818 struct delta_dev *delta; in delta_probe() local
1822 delta = devm_kzalloc(dev, sizeof(*delta), GFP_KERNEL); in delta_probe()
1823 if (!delta) { in delta_probe()
1828 delta->dev = dev; in delta_probe()
1829 delta->pdev = pdev; in delta_probe()
1830 platform_set_drvdata(pdev, delta); in delta_probe()
1832 mutex_init(&delta->lock); in delta_probe()
1835 delta->clk_delta = devm_clk_get(dev, "delta"); in delta_probe()
1836 if (IS_ERR(delta->clk_delta)) { in delta_probe()
1837 dev_dbg(dev, "%s can't get delta clock\n", DELTA_PREFIX); in delta_probe()
1838 delta->clk_delta = NULL; in delta_probe()
1841 delta->clk_st231 = devm_clk_get(dev, "delta-st231"); in delta_probe()
1842 if (IS_ERR(delta->clk_st231)) { in delta_probe()
1843 dev_dbg(dev, "%s can't get delta-st231 clock\n", DELTA_PREFIX); in delta_probe()
1844 delta->clk_st231 = NULL; in delta_probe()
1847 delta->clk_flash_promip = devm_clk_get(dev, "delta-flash-promip"); in delta_probe()
1848 if (IS_ERR(delta->clk_flash_promip)) { in delta_probe()
1849 dev_dbg(dev, "%s can't get delta-flash-promip clock\n", in delta_probe()
1851 delta->clk_flash_promip = NULL; in delta_probe()
1861 ret = delta_ipc_init(delta); in delta_probe()
1863 dev_err(delta->dev, "%s failed to initialize firmware ipc channel\n", in delta_probe()
1869 register_decoders(delta); in delta_probe()
1872 register_formats(delta); in delta_probe()
1875 ret = v4l2_device_register(dev, &delta->v4l2_dev); in delta_probe()
1877 dev_err(delta->dev, "%s failed to register V4L2 device\n", in delta_probe()
1882 delta->work_queue = create_workqueue(DELTA_NAME); in delta_probe()
1883 if (!delta->work_queue) { in delta_probe()
1884 dev_err(delta->dev, "%s failed to allocate work queue\n", in delta_probe()
1891 ret = delta_register_device(delta); in delta_probe()
1896 DELTA_PREFIX, delta->vdev->name, delta->vdev->num); in delta_probe()
1901 destroy_workqueue(delta->work_queue); in delta_probe()
1903 v4l2_device_unregister(&delta->v4l2_dev); in delta_probe()
1910 struct delta_dev *delta = platform_get_drvdata(pdev); in delta_remove() local
1912 delta_ipc_exit(delta); in delta_remove()
1914 delta_unregister_device(delta); in delta_remove()
1916 destroy_workqueue(delta->work_queue); in delta_remove()
1918 pm_runtime_put_autosuspend(delta->dev); in delta_remove()
1919 pm_runtime_disable(delta->dev); in delta_remove()
1921 v4l2_device_unregister(&delta->v4l2_dev); in delta_remove()
1928 struct delta_dev *delta = dev_get_drvdata(dev); in delta_runtime_suspend() local
1930 if (delta->clk_delta) in delta_runtime_suspend()
1931 clk_disable_unprepare(delta->clk_delta); in delta_runtime_suspend()
1938 struct delta_dev *delta = dev_get_drvdata(dev); in delta_runtime_resume() local
1940 if (delta->clk_delta) in delta_runtime_resume()
1941 if (clk_prepare_enable(delta->clk_delta)) in delta_runtime_resume()
1942 dev_warn(dev, "failed to prepare/enable delta clk\n"); in delta_runtime_resume()
1955 .compatible = "st,st-delta",
1977 MODULE_DESCRIPTION("STMicroelectronics DELTA video decoder V4L2 driver");