media: mediatek: vcodec: Add to support lat soc hardware
authorYunfei Dong <yunfei.dong@mediatek.com>
Wed, 18 May 2022 12:29:59 +0000 (13:29 +0100)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Mon, 20 Jun 2022 09:30:32 +0000 (10:30 +0100)
Add lat soc compatible and to support lat soc power/clk helper.

Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.h
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c
drivers/media/platform/mediatek/vcodec/mtk_vcodec_drv.h

index 14bed2bd4283d2495ca5cee8c57d9c228ef48923..376db0e433d7503e1b70d67ef30ed3f5c12f5e77 100644 (file)
@@ -28,6 +28,10 @@ static const struct of_device_id mtk_vdec_hw_match[] = {
                .compatible = "mediatek,mtk-vcodec-core",
                .data = (void *)MTK_VDEC_CORE,
        },
+       {
+               .compatible = "mediatek,mtk-vcodec-lat-soc",
+               .data = (void *)MTK_VDEC_LAT_SOC,
+       },
        {},
 };
 MODULE_DEVICE_TABLE(of, mtk_vdec_hw_match);
@@ -166,9 +170,11 @@ static int mtk_vdec_hw_probe(struct platform_device *pdev)
        subdev_dev->reg_base[VDEC_HW_SYS] = main_dev->reg_base[VDEC_HW_SYS];
        set_bit(subdev_dev->hw_idx, main_dev->subdev_bitmap);
 
-       ret = mtk_vdec_hw_init_irq(subdev_dev);
-       if (ret)
-               goto err;
+       if (IS_SUPPORT_VDEC_HW_IRQ(hw_idx)) {
+               ret = mtk_vdec_hw_init_irq(subdev_dev);
+               if (ret)
+                       goto err;
+       }
 
        subdev_dev->reg_base[VDEC_HW_MISC] =
                devm_platform_ioremap_resource(pdev, 0);
index a63e4b1b81c3e4a0f5c974027571eb6decf2ef5d..36faa8d9d681b90cd0354bc277c9d38c9bd48a37 100644 (file)
@@ -17,6 +17,8 @@
 #define VDEC_IRQ_CLR 0x10
 #define VDEC_IRQ_CFG_REG 0xa4
 
+#define IS_SUPPORT_VDEC_HW_IRQ(hw_idx) ((hw_idx) != MTK_VDEC_LAT_SOC)
+
 /**
  * enum mtk_vdec_hw_reg_idx - subdev hardware register base index
  * @VDEC_HW_SYS : vdec soc register index
index 0fb7e5ba635b47c05b9f38fd477e96aa5ab6be9b..d69faa463d04f691c5968b3151a4f509ae7934b5 100644 (file)
@@ -174,6 +174,14 @@ static void mtk_vcodec_dec_child_dev_on(struct mtk_vcodec_dev *vdec_dev,
                mtk_vcodec_dec_pw_on(pm);
                mtk_vcodec_dec_clock_on(pm);
        }
+
+       if (hw_idx == MTK_VDEC_LAT0) {
+               pm = mtk_vcodec_dec_get_pm(vdec_dev, MTK_VDEC_LAT_SOC);
+               if (pm) {
+                       mtk_vcodec_dec_pw_on(pm);
+                       mtk_vcodec_dec_clock_on(pm);
+               }
+       }
 }
 
 static void mtk_vcodec_dec_child_dev_off(struct mtk_vcodec_dev *vdec_dev,
@@ -186,6 +194,14 @@ static void mtk_vcodec_dec_child_dev_off(struct mtk_vcodec_dev *vdec_dev,
                mtk_vcodec_dec_clock_off(pm);
                mtk_vcodec_dec_pw_off(pm);
        }
+
+       if (hw_idx == MTK_VDEC_LAT0) {
+               pm = mtk_vcodec_dec_get_pm(vdec_dev, MTK_VDEC_LAT_SOC);
+               if (pm) {
+                       mtk_vcodec_dec_clock_off(pm);
+                       mtk_vcodec_dec_pw_off(pm);
+               }
+       }
 }
 
 void mtk_vcodec_dec_enable_hardware(struct mtk_vcodec_ctx *ctx, int hw_idx)
index a29041a0b7e0033513f9ff1bbcbe2f80b0861322..0e3db8ccb3986522196aea12789215a8626bd3a3 100644 (file)
@@ -104,6 +104,7 @@ enum mtk_vdec_hw_id {
        MTK_VDEC_CORE,
        MTK_VDEC_LAT0,
        MTK_VDEC_LAT1,
+       MTK_VDEC_LAT_SOC,
        MTK_VDEC_HW_MAX,
 };