media: hantro: Make struct hantro_variant.init() optional
authorEzequiel Garcia <ezequiel@collabora.com>
Mon, 19 Jul 2021 20:52:34 +0000 (22:52 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Thu, 22 Jul 2021 06:41:31 +0000 (08:41 +0200)
The hantro_variant.init() function is there for platforms
to perform hardware-specific initialization, such as
clock rate bumping.

Not all platforms require it, so make it optional.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Tested-by: Alex Bee <knaerzche@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/staging/media/hantro/hantro.h
drivers/staging/media/hantro/hantro_drv.c
drivers/staging/media/hantro/sama5d4_vdec_hw.c

index a70c386de6f1970702d28e880153eff981926d11..c2e2dca38628ac27319815a2cad48ddfba52c288 100644 (file)
@@ -61,8 +61,8 @@ struct hantro_irq {
  * @num_postproc_fmts:         Number of post-processor formats.
  * @codec:                     Supported codecs
  * @codec_ops:                 Codec ops.
- * @init:                      Initialize hardware.
- * @runtime_resume:            reenable hardware after power gating
+ * @init:                      Initialize hardware, optional.
+ * @runtime_resume:            reenable hardware after power gating, optional.
  * @irqs:                      array of irq names and interrupt handlers
  * @num_irqs:                  number of irqs in the array
  * @clk_names:                 array of clock names
index 31d8449ca1d2dab4891647dd97032bba2ae15dcd..9b5415176bfe201680a7665e1c70fa09241f1103 100644 (file)
@@ -942,10 +942,12 @@ static int hantro_probe(struct platform_device *pdev)
                }
        }
 
-       ret = vpu->variant->init(vpu);
-       if (ret) {
-               dev_err(&pdev->dev, "Failed to init VPU hardware\n");
-               return ret;
+       if (vpu->variant->init) {
+               ret = vpu->variant->init(vpu);
+               if (ret) {
+                       dev_err(&pdev->dev, "Failed to init VPU hardware\n");
+                       return ret;
+               }
        }
 
        pm_runtime_set_autosuspend_delay(vpu->dev, 100);
index 58ae72c2b723ef15c6af70c04754858044382f13..9c3b8cd0b239453eea8f8db7daa87b90cf596883 100644 (file)
@@ -64,11 +64,6 @@ static const struct hantro_fmt sama5d4_vdec_fmts[] = {
        },
 };
 
-static int sama5d4_hw_init(struct hantro_dev *vpu)
-{
-       return 0;
-}
-
 /*
  * Supported codec ops.
  */
@@ -109,7 +104,6 @@ const struct hantro_variant sama5d4_vdec_variant = {
        .codec = HANTRO_MPEG2_DECODER | HANTRO_VP8_DECODER |
                 HANTRO_H264_DECODER,
        .codec_ops = sama5d4_vdec_codec_ops,
-       .init = sama5d4_hw_init,
        .irqs = sama5d4_irqs,
        .num_irqs = ARRAY_SIZE(sama5d4_irqs),
        .clk_names = sama5d4_clk_names,