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()
976 dev_err(delta->dev, "%s decoding failed (%d)\n", in delta_run_work()
1002 dev_err(delta->dev, "%s cannot get decoded frame (%d)\n", in delta_run_work()
1007 dev_err(delta->dev, in delta_run_work()
1024 v4l2_m2m_job_finish(delta->m2m_dev, ctx->fh.m2m_ctx); in delta_run_work()
1031 v4l2_m2m_job_finish(delta->m2m_dev, ctx->fh.m2m_ctx); in delta_run_work()
1037 struct delta_dev *delta = ctx->dev; in delta_device_run() local
1039 queue_work(delta->work_queue, &ctx->run_work); in delta_device_run()
1045 struct delta_dev *delta = ctx->dev; in delta_job_abort() local
1047 dev_dbg(delta->dev, "%s aborting job\n", ctx->name); in delta_job_abort()
1055 struct delta_dev *delta = ctx->dev; in delta_job_ready() local
1059 dev_dbg(delta->dev, "%s not ready: not enough video buffers.\n", in delta_job_ready()
1065 dev_dbg(delta->dev, "%s not ready: not enough video capture buffers.\n", in delta_job_ready()
1071 dev_dbg(delta->dev, "%s job not ready: aborting\n", ctx->name); in delta_job_ready()
1075 dev_dbg(delta->dev, "%s job ready\n", ctx->name); in delta_job_ready()
1118 struct delta_dev *delta = ctx->dev; in delta_vb2_au_prepare() local
1128 dev_dbg(delta->dev, "%s au[%d] prepared; virt=0x%p, phy=0x%pad\n", in delta_vb2_au_prepare()
1141 struct delta_dev *delta = ctx->dev; in delta_setup_frame() local
1145 dev_err(delta->dev, in delta_setup_frame()
1152 dev_err(delta->dev, in delta_setup_frame()
1159 dev_warn(delta->dev, in delta_setup_frame()
1220 struct delta_dev *delta = ctx->dev; in dump_frames_status() local
1225 dev_info(delta->dev, in dump_frames_status()
1230 dev_info(delta->dev, in dump_frames_status()
1241 struct delta_dev *delta = ctx->dev; in delta_get_free_frame() local
1249 dev_err(delta->dev, "%s no frame available", in delta_get_free_frame()
1257 dev_err(delta->dev, in delta_get_free_frame()
1264 dev_dbg(delta->dev, in delta_get_free_frame()
1273 struct delta_dev *delta = ctx->dev; in delta_get_sync() local
1277 ret = pm_runtime_resume_and_get(delta->dev); in delta_get_sync()
1279 dev_err(delta->dev, "%s pm_runtime_resume_and_get failed (%d)\n", in delta_get_sync()
1289 struct delta_dev *delta = ctx->dev; in delta_put_autosuspend() local
1291 pm_runtime_put_autosuspend(delta->dev); in delta_put_autosuspend()
1307 struct delta_dev *delta = ctx->dev; in delta_vb2_au_start_streaming() local
1339 dev_err(delta->dev, "%s failed to start streaming, no stream header buffer enqueued\n", in delta_vb2_au_start_streaming()
1356 dev_err(delta->dev, "%s failed to start streaming, header decoding failed (%d)\n", in delta_vb2_au_start_streaming()
1363 dev_dbg_ratelimited(delta->dev, in delta_vb2_au_start_streaming()
1377 dev_dbg(delta->dev, "%s %s => %s\n", ctx->name, in delta_vb2_au_start_streaming()
1420 struct delta_dev *delta = ctx->dev; in delta_vb2_frame_queue_setup() local
1429 * decoding peak smoothing (depends on DELTA IP perf) in delta_vb2_frame_queue_setup()
1432 dev_dbg(delta->dev, in delta_vb2_frame_queue_setup()
1441 dev_dbg(delta->dev, in delta_vb2_frame_queue_setup()
1464 struct delta_dev *delta = ctx->dev; in delta_vb2_frame_prepare() local
1477 dev_err(delta->dev, in delta_vb2_frame_prepare()
1483 dev_dbg(delta->dev, in delta_vb2_frame_prepare()
1587 struct delta_dev *delta = ctx->dev; in queue_init() local
1600 q->lock = &delta->lock; in queue_init()
1601 q->dev = delta->dev; in queue_init()
1618 q->lock = &delta->lock; in queue_init()
1619 q->dev = delta->dev; in queue_init()
1626 struct delta_dev *delta = video_drvdata(file); in delta_open() local
1630 mutex_lock(&delta->lock); in delta_open()
1637 ctx->dev = delta; in delta_open()
1646 ctx->fh.m2m_ctx = v4l2_m2m_ctx_init(delta->m2m_dev, ctx, in delta_open()
1650 dev_err(delta->dev, "%s failed to initialize m2m context (%d)\n", in delta_open()
1664 delta->instance_id++; in delta_open()
1666 delta->instance_id); in delta_open()
1672 if (clk_prepare_enable(delta->clk_st231)) in delta_open()
1673 dev_warn(delta->dev, "failed to enable st231 clk\n"); in delta_open()
1676 if (clk_prepare_enable(delta->clk_flash_promip)) in delta_open()
1677 dev_warn(delta->dev, "failed to enable delta promip clk\n"); in delta_open()
1679 mutex_unlock(&delta->lock); in delta_open()
1681 dev_dbg(delta->dev, "%s decoder instance created\n", ctx->name); in delta_open()
1690 mutex_unlock(&delta->lock); in delta_open()
1698 struct delta_dev *delta = ctx->dev; in delta_release() local
1701 mutex_lock(&delta->lock); in delta_release()
1718 clk_disable_unprepare(delta->clk_st231); in delta_release()
1721 clk_disable_unprepare(delta->clk_flash_promip); in delta_release()
1723 dev_dbg(delta->dev, "%s decoder instance released\n", ctx->name); in delta_release()
1727 mutex_unlock(&delta->lock); in delta_release()
1745 static int delta_register_device(struct delta_dev *delta) in delta_register_device() argument
1750 if (!delta) in delta_register_device()
1753 delta->m2m_dev = v4l2_m2m_init(&delta_m2m_ops); in delta_register_device()
1754 if (IS_ERR(delta->m2m_dev)) { in delta_register_device()
1755 dev_err(delta->dev, "%s failed to initialize v4l2-m2m device\n", in delta_register_device()
1757 ret = PTR_ERR(delta->m2m_dev); in delta_register_device()
1763 dev_err(delta->dev, "%s failed to allocate video device\n", in delta_register_device()
1772 vdev->lock = &delta->lock; in delta_register_device()
1775 vdev->v4l2_dev = &delta->v4l2_dev; in delta_register_device()
1781 dev_err(delta->dev, "%s failed to register video device\n", in delta_register_device()
1786 delta->vdev = vdev; in delta_register_device()
1787 video_set_drvdata(vdev, delta); in delta_register_device()
1793 v4l2_m2m_release(delta->m2m_dev); in delta_register_device()
1798 static void delta_unregister_device(struct delta_dev *delta) in delta_unregister_device() argument
1800 if (!delta) in delta_unregister_device()
1803 if (delta->m2m_dev) in delta_unregister_device()
1804 v4l2_m2m_release(delta->m2m_dev); in delta_unregister_device()
1806 video_unregister_device(delta->vdev); in delta_unregister_device()
1811 struct delta_dev *delta; in delta_probe() local
1815 delta = devm_kzalloc(dev, sizeof(*delta), GFP_KERNEL); in delta_probe()
1816 if (!delta) { in delta_probe()
1821 delta->dev = dev; in delta_probe()
1822 delta->pdev = pdev; in delta_probe()
1823 platform_set_drvdata(pdev, delta); in delta_probe()
1825 mutex_init(&delta->lock); in delta_probe()
1828 delta->clk_delta = devm_clk_get(dev, "delta"); in delta_probe()
1829 if (IS_ERR(delta->clk_delta)) { in delta_probe()
1830 dev_dbg(dev, "%s can't get delta clock\n", DELTA_PREFIX); in delta_probe()
1831 delta->clk_delta = NULL; in delta_probe()
1834 delta->clk_st231 = devm_clk_get(dev, "delta-st231"); in delta_probe()
1835 if (IS_ERR(delta->clk_st231)) { in delta_probe()
1836 dev_dbg(dev, "%s can't get delta-st231 clock\n", DELTA_PREFIX); in delta_probe()
1837 delta->clk_st231 = NULL; in delta_probe()
1840 delta->clk_flash_promip = devm_clk_get(dev, "delta-flash-promip"); in delta_probe()
1841 if (IS_ERR(delta->clk_flash_promip)) { in delta_probe()
1842 dev_dbg(dev, "%s can't get delta-flash-promip clock\n", in delta_probe()
1844 delta->clk_flash_promip = NULL; in delta_probe()
1854 ret = delta_ipc_init(delta); in delta_probe()
1856 dev_err(delta->dev, "%s failed to initialize firmware ipc channel\n", in delta_probe()
1862 register_decoders(delta); in delta_probe()
1865 register_formats(delta); in delta_probe()
1868 ret = v4l2_device_register(dev, &delta->v4l2_dev); in delta_probe()
1870 dev_err(delta->dev, "%s failed to register V4L2 device\n", in delta_probe()
1875 delta->work_queue = create_workqueue(DELTA_NAME); in delta_probe()
1876 if (!delta->work_queue) { in delta_probe()
1877 dev_err(delta->dev, "%s failed to allocate work queue\n", in delta_probe()
1884 ret = delta_register_device(delta); in delta_probe()
1889 DELTA_PREFIX, delta->vdev->name, delta->vdev->num); in delta_probe()
1894 destroy_workqueue(delta->work_queue); in delta_probe()
1896 v4l2_device_unregister(&delta->v4l2_dev); in delta_probe()
1905 struct delta_dev *delta = platform_get_drvdata(pdev); in delta_remove() local
1907 delta_ipc_exit(delta); in delta_remove()
1909 delta_unregister_device(delta); in delta_remove()
1911 destroy_workqueue(delta->work_queue); in delta_remove()
1913 pm_runtime_put_autosuspend(delta->dev); in delta_remove()
1914 pm_runtime_disable(delta->dev); in delta_remove()
1916 v4l2_device_unregister(&delta->v4l2_dev); in delta_remove()
1921 struct delta_dev *delta = dev_get_drvdata(dev); in delta_runtime_suspend() local
1923 clk_disable_unprepare(delta->clk_delta); in delta_runtime_suspend()
1930 struct delta_dev *delta = dev_get_drvdata(dev); in delta_runtime_resume() local
1932 if (clk_prepare_enable(delta->clk_delta)) in delta_runtime_resume()
1933 dev_warn(dev, "failed to prepare/enable delta clk\n"); in delta_runtime_resume()
1946 .compatible = "st,st-delta",
1968 MODULE_DESCRIPTION("STMicroelectronics DELTA video decoder V4L2 driver");