dt-bindings: media: mtk-vcodec: Separating mtk vcodec encoder node
Subsystems (3)
PATCH v2 1/3 dt-bindings: media: mtk-vcodec: Separating mtk vcodec encoder node
Updates binding document since the avc and vp8 hardware encoder in MT8173 are now separated. Separate "mediatek,mt8173-vcodec-enc" to "mediatek,mt8173-vcodec-enc-vp8" and "mediatek,mt8173-vcodec-enc".
This is a preparing patch for smi cleaning up "mediatek,larb".
---
Change since v1:
- rename compatible and device node
--- .../bindings/media/mediatek-vcodec.txt | 55 ++++++++++--------- 1 file changed, 29 insertions(+), 26 deletions(-)
Documentation/devicetree/bindings/media/mediatek-vcodec.txt +29 -26
@@ -4,7 +4,9 @@ Mediatek Video Codec is the video codec hw present in Mediatek SoCs which supports high resolution encoding and decoding functionalities. Required properties: -- compatible : "mediatek,mt8173-vcodec-enc" for MT8173 encoder +- compatible : must be one of the following string: + "mediatek,mt8173-vcodec-enc-vp8" for mt8173 vp8 encoder. + "mediatek,mt8173-vcodec-enc" for mt8173 avc encoder. "mediatek,mt8183-vcodec-enc" for MT8183 encoder. "mediatek,mt8173-vcodec-dec" for MT8173 decoder. - reg : Physical base address of the video codec registers and length of
@@ -13,10 +15,10 @@ Required properties: - mediatek,larb : must contain the local arbiters in the current Socs. - clocks : list of clock specifiers, corresponding to entries in the clock-names property. -- clock-names: encoder must contain "venc_sel_src", "venc_sel",, - "venc_lt_sel_src", "venc_lt_sel", decoder must contain "vcodecpll", - "univpll_d2", "clk_cci400_sel", "vdec_sel", "vdecpll", "vencpll", - "venc_lt_sel", "vdec_bus_clk_src". +- clock-names: + encoder must contain "venc_sel"; + decoder must contain "vcodecpll", "univpll_d2", "clk_cci400_sel", + "vdec_sel", "vdecpll", "vencpll", "venc_lt_sel", "vdec_bus_clk_src". - iommus : should point to the respective IOMMU block with master port as argument, see Documentation/devicetree/bindings/iommu/mediatek,iommu.txt for details.
@@ -80,14 +82,10 @@ vcodec_dec: vcodec@16000000 { assigned-clock-rates = <0>, <0>, <0>, <1482000000>, <800000000>; }; - vcodec_enc: vcodec@18002000 { +vcodec_enc_avc: vcodec@18002000 { compatible = "mediatek,mt8173-vcodec-enc"; - reg = <0 0x18002000 0 0x1000>, /*VENC_SYS*/ - <0 0x19002000 0 0x1000>; /*VENC_LT_SYS*/ - interrupts = <GIC_SPI 198 IRQ_TYPE_LEVEL_LOW>, - <GIC_SPI 202 IRQ_TYPE_LEVEL_LOW>; - mediatek,larb = <&larb3>, - <&larb5>; + reg = <0 0x18002000 0 0x1000>; + interrupts = <GIC_SPI 198 IRQ_TYPE_LEVEL_LOW>; iommus = <&iommu M4U_PORT_VENC_RCPU>, <&iommu M4U_PORT_VENC_REC>, <&iommu M4U_PORT_VENC_BSDMA>,
@@ -98,8 +96,20 @@ vcodec_dec: vcodec@16000000 { <&iommu M4U_PORT_VENC_REF_LUMA>, <&iommu M4U_PORT_VENC_REF_CHROMA>, <&iommu M4U_PORT_VENC_NBM_RDMA>, - <&iommu M4U_PORT_VENC_NBM_WDMA>, - <&iommu M4U_PORT_VENC_RCPU_SET2>, + <&iommu M4U_PORT_VENC_NBM_WDMA>; + mediatek,larb = <&larb3>; + mediatek,vpu = <&vpu>; + clocks = <&topckgen CLK_TOP_VENC_SEL>; + clock-names = "venc_sel"; + assigned-clocks = <&topckgen CLK_TOP_VENC_SEL>; + assigned-clock-parents = <&topckgen CLK_TOP_VCODECPLL>; + }; + +vcodec_enc_vp8: vcodec@19002000 { + compatible = "mediatek,mt8173-vcodec-enc-vp8"; + reg = <0 0x19002000 0 0x1000>; /* VENC_LT_SYS */ + interrupts = <GIC_SPI 202 IRQ_TYPE_LEVEL_LOW>; + iommus = <&iommu M4U_PORT_VENC_RCPU_SET2>, <&iommu M4U_PORT_VENC_REC_FRM_SET2>, <&iommu M4U_PORT_VENC_BSDMA_SET2>, <&iommu M4U_PORT_VENC_SV_COMA_SET2>,
@@ -108,17 +118,10 @@ vcodec_dec: vcodec@16000000 { <&iommu M4U_PORT_VENC_CUR_CHROMA_SET2>, <&iommu M4U_PORT_VENC_REF_LUMA_SET2>, <&iommu M4U_PORT_VENC_REC_CHROMA_SET2>; + mediatek,larb = <&larb5>; mediatek,vpu = <&vpu>; - clocks = <&topckgen CLK_TOP_VENCPLL_D2>, - <&topckgen CLK_TOP_VENC_SEL>, - <&topckgen CLK_TOP_UNIVPLL1_D2>, - <&topckgen CLK_TOP_VENC_LT_SEL>; - clock-names = "venc_sel_src", - "venc_sel", - "venc_lt_sel_src", - "venc_lt_sel"; - assigned-clocks = <&topckgen CLK_TOP_VENC_SEL>, - <&topckgen CLK_TOP_VENC_LT_SEL>; - assigned-clock-parents = <&topckgen CLK_TOP_VENCPLL_D2>, - <&topckgen CLK_TOP_UNIVPLL1_D2>; + clocks = <&topckgen CLK_TOP_VENC_LT_SEL>; + clock-names = "venc_lt_sel"; + assigned-clocks = <&topckgen CLK_TOP_VENC_LT_SEL>; + assigned-clock-parents = <&topckgen CLK_TOP_VCODECPLL_370P5>; };
Signature · 1 line
2.25.1
PATCH v2 2/3 arm64: dts: mt8173: Separating mtk-vcodec-enc device node
There are two separate hardware encoder blocks inside MT8173. Split the current mtk-vcodec-enc node to match the hardware architecture.
---
Change since v1:
- rename compatible and device node
--- arch/arm64/boot/dts/mediatek/mt8173.dtsi | 60 ++++++++++++------------ 1 file changed, 31 insertions(+), 29 deletions(-)
arch/arm64/boot/dts/mediatek/mt8173.dtsi +31 -29
@@ -1458,14 +1458,11 @@ larb3: larb@18001000 { clock-names = "apb", "smi"; }; - vcodec_enc: vcodec@18002000 { + vcodec_enc_avc: vcodec@18002000 { compatible = "mediatek,mt8173-vcodec-enc"; - reg = <0 0x18002000 0 0x1000>, /* VENC_SYS */ - <0 0x19002000 0 0x1000>; /* VENC_LT_SYS */ - interrupts = <GIC_SPI 198 IRQ_TYPE_LEVEL_LOW>, - <GIC_SPI 202 IRQ_TYPE_LEVEL_LOW>; - mediatek,larb = <&larb3>, - <&larb5>; + reg = <0 0x18002000 0 0x1000>; /* VENC_SYS */ + interrupts = <GIC_SPI 198 IRQ_TYPE_LEVEL_LOW>; + mediatek,larb = <&larb3>; iommus = <&iommu M4U_PORT_VENC_RCPU>, <&iommu M4U_PORT_VENC_REC>, <&iommu M4U_PORT_VENC_BSDMA>,
@@ -1476,29 +1473,12 @@ vcodec_enc: vcodec@18002000 { <&iommu M4U_PORT_VENC_REF_LUMA>, <&iommu M4U_PORT_VENC_REF_CHROMA>, <&iommu M4U_PORT_VENC_NBM_RDMA>, - <&iommu M4U_PORT_VENC_NBM_WDMA>, - <&iommu M4U_PORT_VENC_RCPU_SET2>, - <&iommu M4U_PORT_VENC_REC_FRM_SET2>, - <&iommu M4U_PORT_VENC_BSDMA_SET2>, - <&iommu M4U_PORT_VENC_SV_COMA_SET2>, - <&iommu M4U_PORT_VENC_RD_COMA_SET2>, - <&iommu M4U_PORT_VENC_CUR_LUMA_SET2>, - <&iommu M4U_PORT_VENC_CUR_CHROMA_SET2>, - <&iommu M4U_PORT_VENC_REF_LUMA_SET2>, - <&iommu M4U_PORT_VENC_REC_CHROMA_SET2>; + <&iommu M4U_PORT_VENC_NBM_WDMA>; mediatek,vpu = <&vpu>; - clocks = <&topckgen CLK_TOP_VENCPLL_D2>, - <&topckgen CLK_TOP_VENC_SEL>, - <&topckgen CLK_TOP_UNIVPLL1_D2>, - <&topckgen CLK_TOP_VENC_LT_SEL>; - clock-names = "venc_sel_src", - "venc_sel", - "venc_lt_sel_src", - "venc_lt_sel"; - assigned-clocks = <&topckgen CLK_TOP_VENC_SEL>, - <&topckgen CLK_TOP_VENC_LT_SEL>; - assigned-clock-parents = <&topckgen CLK_TOP_VCODECPLL>, - <&topckgen CLK_TOP_VCODECPLL_370P5>; + clocks = <&topckgen CLK_TOP_VENC_SEL>; + clock-names = "venc_sel"; + assigned-clocks = <&topckgen CLK_TOP_VENC_SEL>; + assigned-clock-parents = <&topckgen CLK_TOP_VCODECPLL>; }; jpegdec: jpegdec@18004000 {
@@ -1530,5 +1510,27 @@ larb5: larb@19001000 { <&vencltsys CLK_VENCLT_CKE0>; clock-names = "apb", "smi"; }; + + vcodec_enc_vp8: vcodec@19002000 { + compatible = "mediatek,mt8173-vcodec-enc-vp8"; + reg = <0 0x19002000 0 0x1000>; /* VENC_LT_SYS */ + interrupts = <GIC_SPI 202 IRQ_TYPE_LEVEL_LOW>; + iommus = <&iommu M4U_PORT_VENC_RCPU_SET2>, + <&iommu M4U_PORT_VENC_REC_FRM_SET2>, + <&iommu M4U_PORT_VENC_BSDMA_SET2>, + <&iommu M4U_PORT_VENC_SV_COMA_SET2>, + <&iommu M4U_PORT_VENC_RD_COMA_SET2>, + <&iommu M4U_PORT_VENC_CUR_LUMA_SET2>, + <&iommu M4U_PORT_VENC_CUR_CHROMA_SET2>, + <&iommu M4U_PORT_VENC_REF_LUMA_SET2>, + <&iommu M4U_PORT_VENC_REC_CHROMA_SET2>; + mediatek,larb = <&larb5>; + mediatek,vpu = <&vpu>; + clocks = <&topckgen CLK_TOP_VENC_LT_SEL>; + clock-names = "venc_lt_sel"; + assigned-clocks = <&topckgen CLK_TOP_VENC_LT_SEL>; + assigned-clock-parents = + <&topckgen CLK_TOP_VCODECPLL_370P5>; + }; }; };
Signature · 5 lines
2.25.1 _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
PATCH v2 3/3 media: mtk-vcodec: Separating mtk encoder driver
In reply to Irui WangMTK H264 Encoder(VENC_SYS) and VP8 Encoder(VENC_LT_SYS) are two independent hardware instance. They have their owner interrupt, register mapping, and special clocks.
This patch separates them into two devices. This is a preparing patch for adding device_link between the larbs and venc-device. It's mainly for fixing the problem:
https://lkml.org/lkml/2019/9/3/316
---
Change since v1:
- use the same name for both devices instead of using "name" member
- rename compatible for backward compatibility
--- .../platform/mtk-vcodec/mtk_vcodec_drv.h | 7 +- .../platform/mtk-vcodec/mtk_vcodec_enc.c | 18 ++- .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c | 108 +++++++----------- .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c | 40 +------ .../platform/mtk-vcodec/venc/venc_vp8_if.c | 4 +- 5 files changed, 67 insertions(+), 110 deletions(-)
drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h +2 -5
@@ -193,7 +193,6 @@ struct mtk_vcodec_pm {struct mtk_vcodec_clk venc_clk;struct device *larbvenc; -struct device *larbvenclt;struct device *dev;struct mtk_vcodec_dev *mtkdev; };
@@ -311,25 +310,25 @@ enum mtk_chip {* @chip: chip this encoder is compatible with * * @uses_ext: whether the encoder uses the extended firmware messaging format -* @has_lt_irq: whether the encoder uses the LT irq * @min_birate: minimum supported encoding bitrate * @max_bitrate: maximum supported encoding bitrate * @capture_formats: array of supported capture formats * @num_capture_formats: number of entries in capture_formats * @output_formats: array of supported output formats * @num_output_formats: number of entries in output_formats +* @core_id: stand for h264 or vp8 encode index */ struct mtk_vcodec_enc_pdata {enum mtk_chip chip;bool uses_ext; -bool has_lt_irq;unsigned long min_bitrate;unsigned long max_bitrate;const struct mtk_video_fmt *capture_formats;size_t num_capture_formats;const struct mtk_video_fmt *output_formats;size_t num_output_formats; +int core_id; };#define MTK_ENC_CTX_IS_EXT (ctx) ((ctx)->dev->venc_pdata->uses_ext)
@@ -361,7 +360,6 @@ struct mtk_vcodec_enc_pdata {* * @dec_irq: decoder irq resource * @enc_irq: h264 encoder irq resource -* @enc_lt_irq: vp8 encoder irq resource * * @dec_mutex: decoder hardware lock * @enc_mutex: encoder hardware lock.
@@ -397,7 +395,6 @@ struct mtk_vcodec_dev {int dec_irq;int enc_irq; -int enc_lt_irq;struct mutex dec_mutex;struct mutex enc_mutex;
drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c +17 -1
@@ -9,6 +9,7 @@#include <media/v4l2-mem2mem.h> #include <media/videobuf2-dma-contig.h> #include <soc/mediatek/smi.h> +#include <linux/pm_runtime.h> #include "mtk_vcodec_drv.h" #include "mtk_vcodec_enc.h"
@@ -787,7 +788,7 @@ static int vb2ops_venc_start_streaming(struct vb2_queue *q, unsigned int count)*/ if ((ctx->state ==MTK_STATE_ABORT ) || (ctx->state ==MTK_STATE_FREE )) { ret = -EIO ; - goto err_set_param; + goto err_start_stream; }/* Do the initialization when both start_streaming have been called */
@@ -799,6 +800,12 @@ static int vb2ops_venc_start_streaming(struct vb2_queue *q, unsigned int count)return 0 ; } + ret =pm_runtime_resume_and_get (&ctx->dev->plat_dev->dev); +if (ret <0 ) { +mtk_v4l2_err ("pm_runtime_resume_and_get fail %d" , ret); + goto err_start_stream; + } +mtk_venc_set_param (ctx, ¶m); ret =venc_if_set_param (ctx,VENC_SET_PARAM_ENC , ¶m);if (ret) {
@@ -825,6 +832,11 @@ static int vb2ops_venc_start_streaming(struct vb2_queue *q, unsigned int count)return 0 ; err_set_param: + ret =pm_runtime_put (&ctx->dev->plat_dev->dev); +if (ret <0 ) +mtk_v4l2_err ("pm_runtime_put fail %d" , ret); + +err_start_stream:for (i =0 ; i < q->num_buffers; ++i) {struct vb2_buffer *buf =vb2_get_buffer (q, i);
@@ -878,6 +890,10 @@ static void vb2ops_venc_stop_streaming(struct vb2_queue *q)if (ret)mtk_v4l2_err ("venc_if_deinit failed=%d" , ret); + ret =pm_runtime_put (&ctx->dev->plat_dev->dev); +if (ret <0 ) +mtk_v4l2_err ("pm_runtime_put fail %d" , ret); + ctx->state =MTK_STATE_FREE ; }
drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c +40 -68
183 lines not on this page · raw message
drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c +6 -34
@@ -43,23 +43,6 @@ int mtk_vcodec_init_enc_pm(struct mtk_vcodec_dev *mtkdev)return -ENODEV ; } pm->larbvenc = &pdev->dev; - - node =of_parse_phandle (dev->of_node,"mediatek,larb" ,1 ); -if (!node) { -mtk_v4l2_err ("no mediatek,larb found" ); - ret = -ENODEV ; - goto put_larbvenc; - } - - pdev =of_find_device_by_node (node); -of_node_put (node); -if (!pdev) { -mtk_v4l2_err ("no mediatek,larb device found" ); - ret = -ENODEV ; - goto put_larbvenc; - } - - pm->larbvenclt = &pdev->dev; pdev = mtkdev->plat_dev; pm->dev = &pdev->dev;
@@ -71,12 +54,12 @@ int mtk_vcodec_init_enc_pm(struct mtk_vcodec_dev *mtkdev) GFP_KERNEL);if (!enc_clk->clk_info) { ret = -ENOMEM ; - goto put_larbvenclt; + goto put_larbvenc; } }else {mtk_v4l2_err ("Failed to get venc clock count" ); ret = -EINVAL ; - goto put_larbvenclt; + goto put_larbvenc; }for (i =0 ; i < enc_clk->clk_num; i++) {
@@ -85,7 +68,7 @@ int mtk_vcodec_init_enc_pm(struct mtk_vcodec_dev *mtkdev) "clock-names", i, &clk_info->clk_name);if (ret) {mtk_v4l2_err ("venc failed to get clk name %d" , i); - goto put_larbvenclt; + goto put_larbvenc; } clk_info->vcodec_clk =devm_clk_get (&pdev->dev, clk_info->clk_name);
@@ -93,14 +76,12 @@ int mtk_vcodec_init_enc_pm(struct mtk_vcodec_dev *mtkdev)mtk_v4l2_err ("venc devm_clk_get (%d)%s fail" , i, clk_info->clk_name); ret =PTR_ERR (clk_info->vcodec_clk); - goto put_larbvenclt; + goto put_larbvenc; } }return 0 ; -put_larbvenclt: -put_device (pm->larbvenclt); put_larbvenc:put_device (pm->larbvenc);return ret;
@@ -108,7 +89,7 @@ int mtk_vcodec_init_enc_pm(struct mtk_vcodec_dev *mtkdev)void mtk_vcodec_release_enc_pm (struct mtk_vcodec_dev *mtkdev) { -put_device (mtkdev->pm.larbvenclt); +pm_runtime_disable (mtkdev->pm.dev);put_device (mtkdev->pm.larbvenc); }
@@ -130,18 +111,10 @@ void mtk_vcodec_enc_clock_on(struct mtk_vcodec_pm *pm) ret =mtk_smi_larb_get (pm->larbvenc);if (ret) {mtk_v4l2_err ("mtk_smi_larb_get larb3 fail %d" , ret); - goto larbvencerr; - } - ret =mtk_smi_larb_get (pm->larbvenclt); -if (ret) { -mtk_v4l2_err ("mtk_smi_larb_get larb4 fail %d" , ret); - goto larbvenclterr; + goto clkerr; }return ; -larbvenclterr: -mtk_smi_larb_put (pm->larbvenc); -larbvencerr: clkerr:for (i -=1 ; i >=0 ; i--)clk_disable_unprepare (enc_clk->clk_info[i].vcodec_clk);
@@ -153,7 +126,6 @@ void mtk_vcodec_enc_clock_off(struct mtk_vcodec_pm *pm)int i =0 ;mtk_smi_larb_put (pm->larbvenc); -mtk_smi_larb_put (pm->larbvenclt);for (i = enc_clk->clk_num -1 ; i >=0 ; i--)clk_disable_unprepare (enc_clk->clk_info[i].vcodec_clk); }
drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c +2 -2
@@ -367,7 +367,7 @@ static int vp8_enc_encode(void *handle,mtk_vcodec_debug_enter (inst); -enable_irq (ctx->dev->enc_lt_irq); +enable_irq (ctx->dev->enc_irq);switch (opt) {case VENC_START_OPT_ENCODE_FRAME :
@@ -386,7 +386,7 @@ static int vp8_enc_encode(void *handle, encode_err: -disable_irq (ctx->dev->enc_lt_irq); +disable_irq (ctx->dev->enc_irq);mtk_vcodec_debug_leave (inst);return ret;
Signature · 5 lines
2.25.1 _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
Rob Herring
maintainerQuoted 3 lines · Irui Wang
Updates binding document since the avc and vp8 hardware encoder in MT8173 are now separated. Separate "mediatek,mt8173-vcodec-enc" to "mediatek,mt8173-vcodec-enc-vp8" and "mediatek,mt8173-vcodec-enc".
This is not a compatible change. Please explain that here and why that's okay (if it is).
Quoted 30 lines
This is a preparing patch for smi cleaning up "mediatek,larb".
Acked-by Tiffany Lin <[email protected]>Signed-off-by Hsin-Yi Wang <[email protected]>Signed-off-by Maoguang Meng <[email protected]>Signed-off-by Irui Wang <[email protected]>---
Change since v1:
- rename compatible and device node--- .../bindings/media/mediatek-vcodec.txt | 55 ++++++++++--------- 1 file changed, 29 insertions(+), 26 deletions(-)Documentation/devicetree/bindings/media/mediatek-vcodec.txt +3
-1@@ -4,7 +4,9 @@ Mediatek Video Codec is the video codec hw present in Mediatek SoCs which supports high resolution encoding and decoding functionalities. Required properties: -- compatible : "mediatek,mt8173-vcodec-enc" for MT8173 encoder +- compatible : must be one of the following string: + "mediatek,mt8173-vcodec-enc-vp8" for mt8173 vp8 encoder. + "mediatek,mt8173-vcodec-enc" for mt8173 avc encoder. "mediatek,mt8183-vcodec-enc" for MT8183 encoder. "mediatek,mt8173-vcodec-dec" for MT8173 decoder. - reg : Physical base address of the video codec registers and length of
Documentation/devicetree/bindings/media/mediatek-vcodec.txt Required properties: · line 19
Quoted 9 lines
Documentation/devicetree/bindings/media/mediatek-vcodec.txt +2
-4@@ -13,10 +15,10 @@ Required properties: - mediatek,larb : must contain the local arbiters in the current Socs. - clocks : list of clock specifiers, corresponding to entries in the clock-names property. -- clock-names: encoder must contain "venc_sel_src", "venc_sel",, - "venc_lt_sel_src", "venc_lt_sel", decoder must contain "vcodecpll", - "univpll_d2", "clk_cci400_sel", "vdec_sel", "vdecpll", "vencpll", - "venc_lt_sel", "vdec_bus_clk_src". +- clock-names: + encoder must contain "venc_sel";
What happened to the other clocks?
Seems like you are dropping what are parent clocks? That seems unrelated to the VP8 split? If so, that's a separate change.
Quoted 72 lines
Documentation/devicetree/bindings/media/mediatek-vcodec.txt +24
-21+ decoder must contain "vcodecpll", "univpll_d2", "clk_cci400_sel", + "vdec_sel", "vdecpll", "vencpll", "venc_lt_sel", "vdec_bus_clk_src". - iommus : should point to the respective IOMMU block with master port as argument, see Documentation/devicetree/bindings/iommu/mediatek,iommu.txt for details.@@ -80,14 +82,10 @@ vcodec_dec: vcodec@16000000 { assigned-clock-rates = <0>, <0>, <0>, <1482000000>, <800000000>; }; - vcodec_enc: vcodec@18002000 { +vcodec_enc_avc: vcodec@18002000 { compatible = "mediatek,mt8173-vcodec-enc"; - reg = <0 0x18002000 0 0x1000>, /*VENC_SYS*/ - <0 0x19002000 0 0x1000>; /*VENC_LT_SYS*/ - interrupts = <GIC_SPI 198 IRQ_TYPE_LEVEL_LOW>, - <GIC_SPI 202 IRQ_TYPE_LEVEL_LOW>; - mediatek,larb = <&larb3>, - <&larb5>; + reg = <0 0x18002000 0 0x1000>; + interrupts = <GIC_SPI 198 IRQ_TYPE_LEVEL_LOW>; iommus = <&iommu M4U_PORT_VENC_RCPU>, <&iommu M4U_PORT_VENC_REC>, <&iommu M4U_PORT_VENC_BSDMA>,@@ -98,8 +96,20 @@ vcodec_dec: vcodec@16000000 { <&iommu M4U_PORT_VENC_REF_LUMA>, <&iommu M4U_PORT_VENC_REF_CHROMA>, <&iommu M4U_PORT_VENC_NBM_RDMA>, - <&iommu M4U_PORT_VENC_NBM_WDMA>, - <&iommu M4U_PORT_VENC_RCPU_SET2>, + <&iommu M4U_PORT_VENC_NBM_WDMA>; + mediatek,larb = <&larb3>; + mediatek,vpu = <&vpu>; + clocks = <&topckgen CLK_TOP_VENC_SEL>; + clock-names = "venc_sel"; + assigned-clocks = <&topckgen CLK_TOP_VENC_SEL>; + assigned-clock-parents = <&topckgen CLK_TOP_VCODECPLL>; + }; + +vcodec_enc_vp8: vcodec@19002000 { + compatible = "mediatek,mt8173-vcodec-enc-vp8"; + reg = <0 0x19002000 0 0x1000>; /* VENC_LT_SYS */ + interrupts = <GIC_SPI 202 IRQ_TYPE_LEVEL_LOW>; + iommus = <&iommu M4U_PORT_VENC_RCPU_SET2>, <&iommu M4U_PORT_VENC_REC_FRM_SET2>, <&iommu M4U_PORT_VENC_BSDMA_SET2>, <&iommu M4U_PORT_VENC_SV_COMA_SET2>,@@ -108,17 +118,10 @@ vcodec_dec: vcodec@16000000 { <&iommu M4U_PORT_VENC_CUR_CHROMA_SET2>, <&iommu M4U_PORT_VENC_REF_LUMA_SET2>, <&iommu M4U_PORT_VENC_REC_CHROMA_SET2>; + mediatek,larb = <&larb5>; mediatek,vpu = <&vpu>; - clocks = <&topckgen CLK_TOP_VENCPLL_D2>, - <&topckgen CLK_TOP_VENC_SEL>, - <&topckgen CLK_TOP_UNIVPLL1_D2>, - <&topckgen CLK_TOP_VENC_LT_SEL>; - clock-names = "venc_sel_src", - "venc_sel", - "venc_lt_sel_src", - "venc_lt_sel"; - assigned-clocks = <&topckgen CLK_TOP_VENC_SEL>, - <&topckgen CLK_TOP_VENC_LT_SEL>; - assigned-clock-parents = <&topckgen CLK_TOP_VENCPLL_D2>, - <&topckgen CLK_TOP_UNIVPLL1_D2>; + clocks = <&topckgen CLK_TOP_VENC_LT_SEL>; + clock-names = "venc_lt_sel"; + assigned-clocks = <&topckgen CLK_TOP_VENC_LT_SEL>; + assigned-clock-parents = <&topckgen CLK_TOP_VCODECPLL_370P5>; };Signature · 1 line
2.25.1
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Quoted 8 lines · Rob Herring
Quoted 3 lines · Irui Wang
Updates binding document since the avc and vp8 hardware encoder in MT8173 are now separated. Separate "mediatek,mt8173-vcodec-enc" to "mediatek,mt8173-vcodec-enc-vp8" and "mediatek,mt8173-vcodec-enc".
This is not a compatible change. Please explain that here and why that's okay (if it is).
Dear Rob,
As the following commit message, this is a patch for smi cleaning up "mediatek,larb", or put the following message in the commit message:
this patch separates the two devices, it's a preparing patch for adding device_link between the larbs and venc-device. It's mainly for fixing the problem:
https://lkml.org/lkml/2019/9/3/316
Is this OK ?
Quoted 42 lines
Quoted 30 lines
This is a preparing patch for smi cleaning up "mediatek,larb".
Acked-by Tiffany Lin <[email protected]>Signed-off-by Hsin-Yi Wang <[email protected]>Signed-off-by Maoguang Meng <[email protected]>Signed-off-by Irui Wang <[email protected]>---
Change since v1:
- rename compatible and device node--- .../bindings/media/mediatek-vcodec.txt | 55 ++++++++++--------- 1 file changed, 29 insertions(+), 26 deletions(-)Documentation/devicetree/bindings/media/mediatek-vcodec.txt +3
-1@@ -4,7 +4,9 @@ Mediatek Video Codec is the video codec hw present in Mediatek SoCs which supports high resolution encoding and decoding functionalities. Required properties: -- compatible : "mediatek,mt8173-vcodec-enc" for MT8173 encoder +- compatible : must be one of the following string: + "mediatek,mt8173-vcodec-enc-vp8" for mt8173 vp8 encoder. + "mediatek,mt8173-vcodec-enc" for mt8173 avc encoder. "mediatek,mt8183-vcodec-enc" for MT8183 encoder. "mediatek,mt8173-vcodec-dec" for MT8173 decoder. - reg : Physical base address of the video codec registers and length ofDocumentation/devicetree/bindings/media/mediatek-vcodec.txt Required properties: · line 19
Quoted 9 lines
Documentation/devicetree/bindings/media/mediatek-vcodec.txt +2
-4@@ -13,10 +15,10 @@ Required properties: - mediatek,larb : must contain the local arbiters in the current Socs. - clocks : list of clock specifiers, corresponding to entries in the clock-names property. -- clock-names: encoder must contain "venc_sel_src", "venc_sel",, - "venc_lt_sel_src", "venc_lt_sel", decoder must contain "vcodecpll", - "univpll_d2", "clk_cci400_sel", "vdec_sel", "vdecpll", "vencpll", - "venc_lt_sel", "vdec_bus_clk_src". +- clock-names: + encoder must contain "venc_sel";What happened to the other clocks?
Quoted 2 lines
Seems like you are dropping what are parent clocks? That seems unrelated to the VP8 split? If so, that's a separate change.
Dear Rob,
"venc_sel" is for avc encoder clock, "venc_sel_src" is its parent, we remove the parent because we set "assigned-clocks" and "assigned-clock-parents"
same as venc_lt_sel" for vp8 encoder, we split the device node, so the clocks need split as well. or can we say:
- clock-names:
avc venc must contain "venc_sel";
vp8 venc must contain "venc_lt_sel";
Dear Alexandre,
could you help to give some more suggestions about this?
Thanks
Best Regards
Quoted 73 lines
Quoted 73 lines
Documentation/devicetree/bindings/media/mediatek-vcodec.txt +24
-21+ decoder must contain "vcodecpll", "univpll_d2", "clk_cci400_sel", + "vdec_sel", "vdecpll", "vencpll", "venc_lt_sel", "vdec_bus_clk_src". - iommus : should point to the respective IOMMU block with master port as argument, see Documentation/devicetree/bindings/iommu/mediatek,iommu.txt for details.@@ -80,14 +82,10 @@ vcodec_dec: vcodec@16000000 { assigned-clock-rates = <0>, <0>, <0>, <1482000000>, <800000000>; }; - vcodec_enc: vcodec@18002000 { +vcodec_enc_avc: vcodec@18002000 { compatible = "mediatek,mt8173-vcodec-enc"; - reg = <0 0x18002000 0 0x1000>, /*VENC_SYS*/ - <0 0x19002000 0 0x1000>; /*VENC_LT_SYS*/ - interrupts = <GIC_SPI 198 IRQ_TYPE_LEVEL_LOW>, - <GIC_SPI 202 IRQ_TYPE_LEVEL_LOW>; - mediatek,larb = <&larb3>, - <&larb5>; + reg = <0 0x18002000 0 0x1000>; + interrupts = <GIC_SPI 198 IRQ_TYPE_LEVEL_LOW>; iommus = <&iommu M4U_PORT_VENC_RCPU>, <&iommu M4U_PORT_VENC_REC>, <&iommu M4U_PORT_VENC_BSDMA>,@@ -98,8 +96,20 @@ vcodec_dec: vcodec@16000000 { <&iommu M4U_PORT_VENC_REF_LUMA>, <&iommu M4U_PORT_VENC_REF_CHROMA>, <&iommu M4U_PORT_VENC_NBM_RDMA>, - <&iommu M4U_PORT_VENC_NBM_WDMA>, - <&iommu M4U_PORT_VENC_RCPU_SET2>, + <&iommu M4U_PORT_VENC_NBM_WDMA>; + mediatek,larb = <&larb3>; + mediatek,vpu = <&vpu>; + clocks = <&topckgen CLK_TOP_VENC_SEL>; + clock-names = "venc_sel"; + assigned-clocks = <&topckgen CLK_TOP_VENC_SEL>; + assigned-clock-parents = <&topckgen CLK_TOP_VCODECPLL>; + }; + +vcodec_enc_vp8: vcodec@19002000 { + compatible = "mediatek,mt8173-vcodec-enc-vp8"; + reg = <0 0x19002000 0 0x1000>; /* VENC_LT_SYS */ + interrupts = <GIC_SPI 202 IRQ_TYPE_LEVEL_LOW>; + iommus = <&iommu M4U_PORT_VENC_RCPU_SET2>, <&iommu M4U_PORT_VENC_REC_FRM_SET2>, <&iommu M4U_PORT_VENC_BSDMA_SET2>, <&iommu M4U_PORT_VENC_SV_COMA_SET2>,@@ -108,17 +118,10 @@ vcodec_dec: vcodec@16000000 { <&iommu M4U_PORT_VENC_CUR_CHROMA_SET2>, <&iommu M4U_PORT_VENC_REF_LUMA_SET2>, <&iommu M4U_PORT_VENC_REC_CHROMA_SET2>; + mediatek,larb = <&larb5>; mediatek,vpu = <&vpu>; - clocks = <&topckgen CLK_TOP_VENCPLL_D2>, - <&topckgen CLK_TOP_VENC_SEL>, - <&topckgen CLK_TOP_UNIVPLL1_D2>, - <&topckgen CLK_TOP_VENC_LT_SEL>; - clock-names = "venc_sel_src", - "venc_sel", - "venc_lt_sel_src", - "venc_lt_sel"; - assigned-clocks = <&topckgen CLK_TOP_VENC_SEL>, - <&topckgen CLK_TOP_VENC_LT_SEL>; - assigned-clock-parents = <&topckgen CLK_TOP_VENCPLL_D2>, - <&topckgen CLK_TOP_UNIVPLL1_D2>; + clocks = <&topckgen CLK_TOP_VENC_LT_SEL>; + clock-names = "venc_lt_sel"; + assigned-clocks = <&topckgen CLK_TOP_VENC_LT_SEL>; + assigned-clock-parents = <&topckgen CLK_TOP_VCODECPLL_370P5>; };Signature · 1 line
2.25.1