mbox series

[v10,00/19] Support multi hardware decode using of_platform_populate

Message ID 20211111041500.17363-1-yunfei.dong@mediatek.com
Headers show
Series Support multi hardware decode using of_platform_populate | expand

Message

Yunfei Dong Nov. 11, 2021, 4:14 a.m. UTC
This series adds support for multi hardware decode into mtk-vcodec, by first adding use
of_platform_populate to manage each hardware information: interrupt, clock, register
bases and power. Secondly add core work queue to deal with core hardware message,
at the same time, add msg queue for different hardware share messages. Lastly, the
architecture of different specs are not the same, using specs type to separate them.

This series has been tested with both MT8183 and MT8173. Decoding was working for both chips.

Patches 1~3 rewrite get register bases and power on/off interface.
Patches 4 export decoder pm interfaces.
Patches 5 add to support 8192.
Patch 6 support multi hardware.
Patch 7 separate video encoder and decoder document
Patch 8-17 add interfaces to support core hardware.
Patch 18-19 remove mtk_vcodec_release_dec/enc_pm interfaces.
---
changes compared with v9:
- need not to build ko, just export pm interfaces for patch 04/19.
- fix comments for patch 06/19

changes compared with v8:
- add new patch 18~19 to remove mtk_vcodec_release_de/enc_pm interfaces.
- fix spelling mistakes for patch 17/19
- fix yaml comments for patch 15/19

Changes compared with v7:
- add new patch 4 to build decoder pm file as module
- add new patch 5 to support 8192
- fix comments for patch 6/17
- change some logic for using work queue instead of create thread for core hardware decode for patch 10/17
- using work queue for hardware decode instead of create thread for patch 13/17
- add returen value for patch 14/17
- fix yaml check fail 15/17

Changes compared with v6:
- Use of_platform_populate to manage multi hardware, not component framework for patch 4/15
- Re-write dtsi document for hardware architecture changed for patch 13/15 -The dtsi will write like below in patch 13/15:
    vcodec_dec: vcodec_dec@16000000 {
        compatible = "mediatek,mt8192-vcodec-dec";
        #address-cells = <2>;
        #size-cells = <2>;
        ranges;
        reg = <0 0x16000000 0 0x1000>;		/* VDEC_SYS */
        mediatek,scp = <&scp>;
        iommus = <&iommu0 M4U_PORT_L4_VDEC_MC_EXT>;
        dma-ranges = <0x1 0x0 0x0 0x40000000 0x0 0xfff00000>;
        vcodec_lat {
            compatible = "mediatek,mtk-vcodec-lat";
            reg = <0 0x16010000 0 0x800>;		/* VDEC_MISC */
            reg-name = "reg-misc";
            interrupts = <GIC_SPI 426 IRQ_TYPE_LEVEL_HIGH 0>;
            iommus = <&iommu0 M4U_PORT_L5_VDEC_LAT0_VLD_EXT>,
                 <&iommu0 M4U_PORT_L5_VDEC_LAT0_VLD2_EXT>,
                 <&iommu0 M4U_PORT_L5_VDEC_LAT0_AVC_MV_EXT>,
                 <&iommu0 M4U_PORT_L5_VDEC_LAT0_PRED_RD_EXT>,
                 <&iommu0 M4U_PORT_L5_VDEC_LAT0_TILE_EXT>,
                 <&iommu0 M4U_PORT_L5_VDEC_LAT0_WDMA_EXT>,
                 <&iommu0 M4U_PORT_L5_VDEC_LAT0_RG_CTRL_DMA_EXT>,
                 <&iommu0 M4U_PORT_L5_VDEC_UFO_ENC_EXT>;
            clocks = <&topckgen CLK_TOP_VDEC_SEL>,
                 <&vdecsys_soc CLK_VDEC_SOC_VDEC>,
                 <&vdecsys_soc CLK_VDEC_SOC_LAT>,
                 <&vdecsys_soc CLK_VDEC_SOC_LARB1>,
                 <&topckgen CLK_TOP_MAINPLL_D4>;
            clock-names = "vdec-sel", "vdec-soc-vdec", "vdec-soc-lat",
                  "vdec-vdec", "vdec-top";
            assigned-clocks = <&topckgen CLK_TOP_VDEC_SEL>;
            assigned-clock-parents = <&topckgen CLK_TOP_MAINPLL_D4>;
            power-domains = <&spm MT8192_POWER_DOMAIN_VDEC>;
        };

        vcodec_core {
            compatible = "mediatek,mtk-vcodec-core";
            reg = <0 0x16025000 0 0x1000>;		/* VDEC_CORE_MISC */
            reg-names = "reg-misc";
            interrupts = <GIC_SPI 425 IRQ_TYPE_LEVEL_HIGH 0>;
            iommus = <&iommu0 M4U_PORT_L4_VDEC_MC_EXT>,
                 <&iommu0 M4U_PORT_L4_VDEC_UFO_EXT>,
                 <&iommu0 M4U_PORT_L4_VDEC_PP_EXT>,
                 <&iommu0 M4U_PORT_L4_VDEC_PRED_RD_EXT>,
                 <&iommu0 M4U_PORT_L4_VDEC_PRED_WR_EXT>,
                 <&iommu0 M4U_PORT_L4_VDEC_PPWRAP_EXT>,
                 <&iommu0 M4U_PORT_L4_VDEC_TILE_EXT>,
                 <&iommu0 M4U_PORT_L4_VDEC_VLD_EXT>,
                 <&iommu0 M4U_PORT_L4_VDEC_VLD2_EXT>,
                 <&iommu0 M4U_PORT_L4_VDEC_AVC_MV_EXT>,
                 <&iommu0 M4U_PORT_L4_VDEC_RG_CTRL_DMA_EXT>;
            clocks = <&topckgen CLK_TOP_VDEC_SEL>,
                 <&vdecsys CLK_VDEC_VDEC>,
                 <&vdecsys CLK_VDEC_LAT>,
                 <&vdecsys CLK_VDEC_LARB1>,
                 <&topckgen CLK_TOP_MAINPLL_D4>;
            clock-names = "vdec-sel", "vdec-soc-vdec", "vdec-soc-lat",
                  "vdec-vdec", "vdec-top";
            assigned-clocks = <&topckgen CLK_TOP_VDEC_SEL>;
            assigned-clock-parents = <&topckgen CLK_TOP_MAINPLL_D4>;
            power-domains = <&spm MT8192_POWER_DOMAIN_VDEC2>;
        };
    };

Changes compared with v5:
- Add decoder hardware block diagram for patch 13/15

Changes compared with v4:
- Fix comments for patch 4/15
  >> +     if (dev->is_comp_supported) {
  >> +             ret = mtk_vcodec_init_master(dev);
  >> +             if (ret < 0)
  >> +                     goto err_component_match;
  >> +     } else {
  >> +             platform_set_drvdata(pdev, dev);
  >> +     }
  Fix platform_set_drvdata.
- Fix build error for patch 9/15
- Add depend patch in case of error header file for patch 13/15

Changes compared with v3:
- Fix return value for patch 1/15
- Fix comments for patch 4/15
  > Looking up "mediatek,mtk-vcodec-core" to determine if it uses component framwork sounds like...
  Add prameter in pdata, for all platform will use compoent after mt8183

  >> +     if (dev->is_comp_supported) {
  >> +             ret = mtk_vcodec_init_master(dev);
  >> +             if (ret < 0)
  >> +                     goto err_component_match;
  >> +     } else {
  >> +             platform_set_drvdata(pdev, dev);
  >> +     }
  > + Has asked the same question in [1].  Why it removes the
  > +platform_set_drvdata() above?  mtk_vcodec_init_master() also calls platform_set_drvdata().
  Must call component_master_add_with_match after platform_set_drvdata for component architecture.
- Fix yaml files check fail for patch 5/15
- Fix yaml file check fail for patch 14/15

Changes compared with v1:
- Fix many comments for patch 3/14
- Remove unnecessary code for patch 4/14
- Using enum mtk_vdec_hw_count instead of magic numbers for patch 6/14
- Reconstructed get/put lat buffer for lat and core hardware for patch 7/14
- Using yaml format to instead of txt file for patch 12/14

Yunfei Dong (19):
  media: mtk-vcodec: Get numbers of register bases from DT
  media: mtk-vcodec: Align vcodec wake up interrupt interface
  media: mtk-vcodec: Refactor vcodec pm interface
  media: mtk-vcodec: export decoder pm functions
  media: mtk-vcodec: Support MT8192
  media: mtk-vcodec: Manage multi hardware information
  dt-bindings: media: mtk-vcodec: Separate video encoder and decoder
    dt-bindings
  media: mtk-vcodec: Use pure single core for MT8183
  media: mtk-vcodec: Add irq interface for multi hardware
  media: mtk-vcodec: Add msg queue feature for lat and core architecture
  media: mtk-vcodec: Generalize power and clock on/off interfaces
  media: mtk-vcodec: Add new interface to lock different hardware
  media: mtk-vcodec: Add work queue for core hardware decode
  media: mtk-vcodec: Support 34bits dma address for vdec
  dt-bindings: media: mtk-vcodec: Adds decoder dt-bindings for mt8192
  media: mtk-vcodec: Add core dec and dec end ipi msg
  media: mtk-vcodec: Use codec type to separate different hardware
  media: mtk-vcodec: Remove mtk_vcodec_release_dec_pm
  media: mtk-vcodec: Remove mtk_vcodec_release_enc_pm

 .../media/mediatek,vcodec-decoder.yaml        | 176 +++++++++++
 .../media/mediatek,vcodec-encoder.yaml        | 187 ++++++++++++
 .../media/mediatek,vcodec-subdev-decoder.yaml | 261 ++++++++++++++++
 .../bindings/media/mediatek-vcodec.txt        | 131 --------
 drivers/media/platform/mtk-vcodec/Makefile    |   6 +-
 .../platform/mtk-vcodec/mtk_vcodec_dec.c      |   4 +-
 .../platform/mtk-vcodec/mtk_vcodec_dec.h      |   1 +
 .../platform/mtk-vcodec/mtk_vcodec_dec_drv.c  | 219 +++++++++++---
 .../platform/mtk-vcodec/mtk_vcodec_dec_hw.c   | 172 +++++++++++
 .../platform/mtk-vcodec/mtk_vcodec_dec_hw.h   |  55 ++++
 .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c   | 104 +++++--
 .../platform/mtk-vcodec/mtk_vcodec_dec_pm.h   |  12 +-
 .../mtk-vcodec/mtk_vcodec_dec_stateful.c      |   2 +
 .../mtk-vcodec/mtk_vcodec_dec_stateless.c     |  20 ++
 .../platform/mtk-vcodec/mtk_vcodec_drv.h      |  75 ++++-
 .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c  |  21 +-
 .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c   |  10 +-
 .../platform/mtk-vcodec/mtk_vcodec_enc_pm.h   |   3 +-
 .../platform/mtk-vcodec/mtk_vcodec_intr.c     |  27 +-
 .../platform/mtk-vcodec/mtk_vcodec_intr.h     |   4 +-
 .../platform/mtk-vcodec/mtk_vcodec_util.c     |  87 +++++-
 .../platform/mtk-vcodec/mtk_vcodec_util.h     |   8 +-
 .../platform/mtk-vcodec/vdec/vdec_h264_if.c   |   2 +-
 .../mtk-vcodec/vdec/vdec_h264_req_if.c        |   2 +-
 .../platform/mtk-vcodec/vdec/vdec_vp8_if.c    |   2 +-
 .../platform/mtk-vcodec/vdec/vdec_vp9_if.c    |   2 +-
 .../media/platform/mtk-vcodec/vdec_drv_if.c   |  21 +-
 .../media/platform/mtk-vcodec/vdec_ipi_msg.h  |  16 +-
 .../platform/mtk-vcodec/vdec_msg_queue.c      | 286 ++++++++++++++++++
 .../platform/mtk-vcodec/vdec_msg_queue.h      | 148 +++++++++
 .../media/platform/mtk-vcodec/vdec_vpu_if.c   |  46 ++-
 .../media/platform/mtk-vcodec/vdec_vpu_if.h   |  22 ++
 .../platform/mtk-vcodec/venc/venc_h264_if.c   |   2 +-
 .../platform/mtk-vcodec/venc/venc_vp8_if.c    |   2 +-
 34 files changed, 1841 insertions(+), 295 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
 create mode 100644 Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml
 create mode 100644 Documentation/devicetree/bindings/media/mediatek,vcodec-subdev-decoder.yaml
 delete mode 100644 Documentation/devicetree/bindings/media/mediatek-vcodec.txt
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_hw.c
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_hw.h
 create mode 100644 drivers/media/platform/mtk-vcodec/vdec_msg_queue.c
 create mode 100644 drivers/media/platform/mtk-vcodec/vdec_msg_queue.h

Comments

Ezequiel Garcia Nov. 14, 2021, 10:04 p.m. UTC | #1
Hi Yunfei,

On Thu, 11 Nov 2021 at 01:15, Yunfei Dong <yunfei.dong@mediatek.com> wrote:
>
> This series adds support for multi hardware decode into mtk-vcodec, by first adding use
> of_platform_populate to manage each hardware information: interrupt, clock, register
> bases and power. Secondly add core work queue to deal with core hardware message,
> at the same time, add msg queue for different hardware share messages. Lastly, the
> architecture of different specs are not the same, using specs type to separate them.
>
> This series has been tested with both MT8183 and MT8173. Decoding was working for both chips.
>

How are you testing Decoding? If you are running some test suite, it would
be good to add such information.

Are you testing some edge-cases such as parallel/concurrent decoding,
removing the driver while streaming, and so on? This should help catch
some typical issues.

Thanks,
Ezequiel

> Patches 1~3 rewrite get register bases and power on/off interface.
> Patches 4 export decoder pm interfaces.
> Patches 5 add to support 8192.
> Patch 6 support multi hardware.
> Patch 7 separate video encoder and decoder document
> Patch 8-17 add interfaces to support core hardware.
> Patch 18-19 remove mtk_vcodec_release_dec/enc_pm interfaces.
> ---
> changes compared with v9:
> - need not to build ko, just export pm interfaces for patch 04/19.
> - fix comments for patch 06/19
>
> changes compared with v8:
> - add new patch 18~19 to remove mtk_vcodec_release_de/enc_pm interfaces.
> - fix spelling mistakes for patch 17/19
> - fix yaml comments for patch 15/19
>
> Changes compared with v7:
> - add new patch 4 to build decoder pm file as module
> - add new patch 5 to support 8192
> - fix comments for patch 6/17
> - change some logic for using work queue instead of create thread for core hardware decode for patch 10/17
> - using work queue for hardware decode instead of create thread for patch 13/17
> - add returen value for patch 14/17
> - fix yaml check fail 15/17
>
> Changes compared with v6:
> - Use of_platform_populate to manage multi hardware, not component framework for patch 4/15
> - Re-write dtsi document for hardware architecture changed for patch 13/15 -The dtsi will write like below in patch 13/15:
>     vcodec_dec: vcodec_dec@16000000 {
>         compatible = "mediatek,mt8192-vcodec-dec";
>         #address-cells = <2>;
>         #size-cells = <2>;
>         ranges;
>         reg = <0 0x16000000 0 0x1000>;          /* VDEC_SYS */
>         mediatek,scp = <&scp>;
>         iommus = <&iommu0 M4U_PORT_L4_VDEC_MC_EXT>;
>         dma-ranges = <0x1 0x0 0x0 0x40000000 0x0 0xfff00000>;
>         vcodec_lat {
>             compatible = "mediatek,mtk-vcodec-lat";
>             reg = <0 0x16010000 0 0x800>;               /* VDEC_MISC */
>             reg-name = "reg-misc";
>             interrupts = <GIC_SPI 426 IRQ_TYPE_LEVEL_HIGH 0>;
>             iommus = <&iommu0 M4U_PORT_L5_VDEC_LAT0_VLD_EXT>,
>                  <&iommu0 M4U_PORT_L5_VDEC_LAT0_VLD2_EXT>,
>                  <&iommu0 M4U_PORT_L5_VDEC_LAT0_AVC_MV_EXT>,
>                  <&iommu0 M4U_PORT_L5_VDEC_LAT0_PRED_RD_EXT>,
>                  <&iommu0 M4U_PORT_L5_VDEC_LAT0_TILE_EXT>,
>                  <&iommu0 M4U_PORT_L5_VDEC_LAT0_WDMA_EXT>,
>                  <&iommu0 M4U_PORT_L5_VDEC_LAT0_RG_CTRL_DMA_EXT>,
>                  <&iommu0 M4U_PORT_L5_VDEC_UFO_ENC_EXT>;
>             clocks = <&topckgen CLK_TOP_VDEC_SEL>,
>                  <&vdecsys_soc CLK_VDEC_SOC_VDEC>,
>                  <&vdecsys_soc CLK_VDEC_SOC_LAT>,
>                  <&vdecsys_soc CLK_VDEC_SOC_LARB1>,
>                  <&topckgen CLK_TOP_MAINPLL_D4>;
>             clock-names = "vdec-sel", "vdec-soc-vdec", "vdec-soc-lat",
>                   "vdec-vdec", "vdec-top";
>             assigned-clocks = <&topckgen CLK_TOP_VDEC_SEL>;
>             assigned-clock-parents = <&topckgen CLK_TOP_MAINPLL_D4>;
>             power-domains = <&spm MT8192_POWER_DOMAIN_VDEC>;
>         };
>
>         vcodec_core {
>             compatible = "mediatek,mtk-vcodec-core";
>             reg = <0 0x16025000 0 0x1000>;              /* VDEC_CORE_MISC */
>             reg-names = "reg-misc";
>             interrupts = <GIC_SPI 425 IRQ_TYPE_LEVEL_HIGH 0>;
>             iommus = <&iommu0 M4U_PORT_L4_VDEC_MC_EXT>,
>                  <&iommu0 M4U_PORT_L4_VDEC_UFO_EXT>,
>                  <&iommu0 M4U_PORT_L4_VDEC_PP_EXT>,
>                  <&iommu0 M4U_PORT_L4_VDEC_PRED_RD_EXT>,
>                  <&iommu0 M4U_PORT_L4_VDEC_PRED_WR_EXT>,
>                  <&iommu0 M4U_PORT_L4_VDEC_PPWRAP_EXT>,
>                  <&iommu0 M4U_PORT_L4_VDEC_TILE_EXT>,
>                  <&iommu0 M4U_PORT_L4_VDEC_VLD_EXT>,
>                  <&iommu0 M4U_PORT_L4_VDEC_VLD2_EXT>,
>                  <&iommu0 M4U_PORT_L4_VDEC_AVC_MV_EXT>,
>                  <&iommu0 M4U_PORT_L4_VDEC_RG_CTRL_DMA_EXT>;
>             clocks = <&topckgen CLK_TOP_VDEC_SEL>,
>                  <&vdecsys CLK_VDEC_VDEC>,
>                  <&vdecsys CLK_VDEC_LAT>,
>                  <&vdecsys CLK_VDEC_LARB1>,
>                  <&topckgen CLK_TOP_MAINPLL_D4>;
>             clock-names = "vdec-sel", "vdec-soc-vdec", "vdec-soc-lat",
>                   "vdec-vdec", "vdec-top";
>             assigned-clocks = <&topckgen CLK_TOP_VDEC_SEL>;
>             assigned-clock-parents = <&topckgen CLK_TOP_MAINPLL_D4>;
>             power-domains = <&spm MT8192_POWER_DOMAIN_VDEC2>;
>         };
>     };
>
> Changes compared with v5:
> - Add decoder hardware block diagram for patch 13/15
>
> Changes compared with v4:
> - Fix comments for patch 4/15
>   >> +     if (dev->is_comp_supported) {
>   >> +             ret = mtk_vcodec_init_master(dev);
>   >> +             if (ret < 0)
>   >> +                     goto err_component_match;
>   >> +     } else {
>   >> +             platform_set_drvdata(pdev, dev);
>   >> +     }
>   Fix platform_set_drvdata.
> - Fix build error for patch 9/15
> - Add depend patch in case of error header file for patch 13/15
>
> Changes compared with v3:
> - Fix return value for patch 1/15
> - Fix comments for patch 4/15
>   > Looking up "mediatek,mtk-vcodec-core" to determine if it uses component framwork sounds like...
>   Add prameter in pdata, for all platform will use compoent after mt8183
>
>   >> +     if (dev->is_comp_supported) {
>   >> +             ret = mtk_vcodec_init_master(dev);
>   >> +             if (ret < 0)
>   >> +                     goto err_component_match;
>   >> +     } else {
>   >> +             platform_set_drvdata(pdev, dev);
>   >> +     }
>   > + Has asked the same question in [1].  Why it removes the
>   > +platform_set_drvdata() above?  mtk_vcodec_init_master() also calls platform_set_drvdata().
>   Must call component_master_add_with_match after platform_set_drvdata for component architecture.
> - Fix yaml files check fail for patch 5/15
> - Fix yaml file check fail for patch 14/15
>
> Changes compared with v1:
> - Fix many comments for patch 3/14
> - Remove unnecessary code for patch 4/14
> - Using enum mtk_vdec_hw_count instead of magic numbers for patch 6/14
> - Reconstructed get/put lat buffer for lat and core hardware for patch 7/14
> - Using yaml format to instead of txt file for patch 12/14
>
> Yunfei Dong (19):
>   media: mtk-vcodec: Get numbers of register bases from DT
>   media: mtk-vcodec: Align vcodec wake up interrupt interface
>   media: mtk-vcodec: Refactor vcodec pm interface
>   media: mtk-vcodec: export decoder pm functions
>   media: mtk-vcodec: Support MT8192
>   media: mtk-vcodec: Manage multi hardware information
>   dt-bindings: media: mtk-vcodec: Separate video encoder and decoder
>     dt-bindings
>   media: mtk-vcodec: Use pure single core for MT8183
>   media: mtk-vcodec: Add irq interface for multi hardware
>   media: mtk-vcodec: Add msg queue feature for lat and core architecture
>   media: mtk-vcodec: Generalize power and clock on/off interfaces
>   media: mtk-vcodec: Add new interface to lock different hardware
>   media: mtk-vcodec: Add work queue for core hardware decode
>   media: mtk-vcodec: Support 34bits dma address for vdec
>   dt-bindings: media: mtk-vcodec: Adds decoder dt-bindings for mt8192
>   media: mtk-vcodec: Add core dec and dec end ipi msg
>   media: mtk-vcodec: Use codec type to separate different hardware
>   media: mtk-vcodec: Remove mtk_vcodec_release_dec_pm
>   media: mtk-vcodec: Remove mtk_vcodec_release_enc_pm
>
>  .../media/mediatek,vcodec-decoder.yaml        | 176 +++++++++++
>  .../media/mediatek,vcodec-encoder.yaml        | 187 ++++++++++++
>  .../media/mediatek,vcodec-subdev-decoder.yaml | 261 ++++++++++++++++
>  .../bindings/media/mediatek-vcodec.txt        | 131 --------
>  drivers/media/platform/mtk-vcodec/Makefile    |   6 +-
>  .../platform/mtk-vcodec/mtk_vcodec_dec.c      |   4 +-
>  .../platform/mtk-vcodec/mtk_vcodec_dec.h      |   1 +
>  .../platform/mtk-vcodec/mtk_vcodec_dec_drv.c  | 219 +++++++++++---
>  .../platform/mtk-vcodec/mtk_vcodec_dec_hw.c   | 172 +++++++++++
>  .../platform/mtk-vcodec/mtk_vcodec_dec_hw.h   |  55 ++++
>  .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c   | 104 +++++--
>  .../platform/mtk-vcodec/mtk_vcodec_dec_pm.h   |  12 +-
>  .../mtk-vcodec/mtk_vcodec_dec_stateful.c      |   2 +
>  .../mtk-vcodec/mtk_vcodec_dec_stateless.c     |  20 ++
>  .../platform/mtk-vcodec/mtk_vcodec_drv.h      |  75 ++++-
>  .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c  |  21 +-
>  .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c   |  10 +-
>  .../platform/mtk-vcodec/mtk_vcodec_enc_pm.h   |   3 +-
>  .../platform/mtk-vcodec/mtk_vcodec_intr.c     |  27 +-
>  .../platform/mtk-vcodec/mtk_vcodec_intr.h     |   4 +-
>  .../platform/mtk-vcodec/mtk_vcodec_util.c     |  87 +++++-
>  .../platform/mtk-vcodec/mtk_vcodec_util.h     |   8 +-
>  .../platform/mtk-vcodec/vdec/vdec_h264_if.c   |   2 +-
>  .../mtk-vcodec/vdec/vdec_h264_req_if.c        |   2 +-
>  .../platform/mtk-vcodec/vdec/vdec_vp8_if.c    |   2 +-
>  .../platform/mtk-vcodec/vdec/vdec_vp9_if.c    |   2 +-
>  .../media/platform/mtk-vcodec/vdec_drv_if.c   |  21 +-
>  .../media/platform/mtk-vcodec/vdec_ipi_msg.h  |  16 +-
>  .../platform/mtk-vcodec/vdec_msg_queue.c      | 286 ++++++++++++++++++
>  .../platform/mtk-vcodec/vdec_msg_queue.h      | 148 +++++++++
>  .../media/platform/mtk-vcodec/vdec_vpu_if.c   |  46 ++-
>  .../media/platform/mtk-vcodec/vdec_vpu_if.h   |  22 ++
>  .../platform/mtk-vcodec/venc/venc_h264_if.c   |   2 +-
>  .../platform/mtk-vcodec/venc/venc_vp8_if.c    |   2 +-
>  34 files changed, 1841 insertions(+), 295 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
>  create mode 100644 Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml
>  create mode 100644 Documentation/devicetree/bindings/media/mediatek,vcodec-subdev-decoder.yaml
>  delete mode 100644 Documentation/devicetree/bindings/media/mediatek-vcodec.txt
>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_hw.c
>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_hw.h
>  create mode 100644 drivers/media/platform/mtk-vcodec/vdec_msg_queue.c
>  create mode 100644 drivers/media/platform/mtk-vcodec/vdec_msg_queue.h
>
> --
> 2.25.1
>
Tzung-Bi Shih Nov. 16, 2021, 9:23 a.m. UTC | #2
On Thu, Nov 11, 2021 at 12:14:47PM +0800, Yunfei Dong wrote:
> Register each hardware(subdev) as platform device used to manage each
> hardware information which includes irq/power/clk. The hardware includes
> LAT0, LAT1 and CORE. And call of_platform_populate in main device.
> 
> Using subdev_bitmap to record whether each device is register done. Then check
> whether all subdev are register done before open main device.

I can somehow understand what the patch is trying to do but the commit message needs to be rephrased for people to understand the patch.

> --- a/drivers/media/platform/mtk-vcodec/Makefile
> +++ b/drivers/media/platform/mtk-vcodec/Makefile
> @@ -2,7 +2,8 @@
>  
>  obj-$(CONFIG_VIDEO_MEDIATEK_VCODEC) += mtk-vcodec-dec.o \
>  				       mtk-vcodec-enc.o \
> -				       mtk-vcodec-common.o
> +				       mtk-vcodec-common.o \
> +					   mtk-vcodec-dec-hw.o

Looks better to align to previous lines.

> +static int mtk_vcodec_subdev_device_check(struct mtk_vcodec_ctx *ctx)
> +{
> +	struct mtk_vcodec_dev *vdec_dev = ctx->dev;

ctx isn't used in other places.  Looks like the function can accept "struct mtk_vcodec_dev *vdec_dev" as the only argument.

> +	for (i = 0; i < ARRAY_SIZE(mtk_vdec_hw_match); i++) {
> +		of_id = &mtk_vdec_hw_match[i];
> +		subdev_node = of_find_compatible_node(NULL, NULL,
> +			of_id->compatible);
> +		if (!subdev_node)
> +			continue;

Does it really need to continue if one of the sub-devices is not ready?

It depends on whether mtk_vdec_hw_match is a must list or not.  For example, if mtk_vdec_hw_match has 4 entries but the DT only has 2 entries, shall it return an error about the entry count mismatch?

> +		if (!of_device_is_available(subdev_node)) {
> +			of_node_put(subdev_node);
> +			dev_err(&pdev->dev, "Fail to get subdev node\n");
> +			continue;

The error message shouldn't be "Fail to get ...".  Also the same question: does it really need to continue?

> +		hw_idx = (enum mtk_vdec_hw_id)(uintptr_t)of_id->data;
> +		vdec_dev->subdev_node[hw_idx] = subdev_node;

I am wondering if it wouldn't need subdev_node.  Isn't vdec_dev->subdev_dev sufficient to clue all the things?

> +		if (!test_bit(hw_idx, vdec_dev->subdev_bitmap)) {
> +			of_node_put(subdev_node);
> +			dev_err(&pdev->dev, "Vdec %d is not ready", hw_idx);
> +			return -EAGAIN;
> +		}
> +		of_node_put(subdev_node);
> +	}
> +
> +	return 0;
> +}

In addition to the question for subdev_node.  The function calls of_node_put() for every paths.  I am not sure if the function should call of_node_put() in non-error-handling paths (i.e. I thought it needs someone to hold the reference count).

By reading [v10,11/19] media: mtk-vcodec: Generalize power and clock on/off interfaces[1], the mtk_vcodec_get_hw_dev() calls of_node_put() after it gets the hw_pdev.  Looks like the code is meant to borrow the reference count to mtk_vcodec_get_hw_dev().

In short, if the subdev_node is designed to borrow reference count to others, mtk_vcodec_subdev_device_check() shouldn't call of_node_put() in non-error-handling paths.

[1]: https://patchwork.linuxtv.org/project/linux-media/patch/20211111041500.17363-12-yunfei.dong@mediatek.com/

> @@ -249,32 +322,10 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
[...]
> +	ret = mtk_vcodec_init_dec_resources(dev);
>  	if (ret) {
> -		dev_err(&pdev->dev, "Failed to install dev->dec_irq %d (%d)",
> -			dev->dec_irq,
> -			ret);
> -		goto err_res;
> +		dev_err(&pdev->dev, "Failed to init pm and registers");

The error message makes less sense about mentioning pm and registers.

> diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_hw.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_hw.c
[...]
> +static int mtk_vdec_hw_probe(struct platform_device *pdev)
> +{
> +	struct device *dev = &pdev->dev;
> +	struct mtk_vdec_hw_dev *subdev_dev;
> +	struct mtk_vcodec_dev *main_dev;
> +	const struct of_device_id *of_id;
> +	int hw_idx;
> +	int ret;
> +
> +	if (!dev->parent)
> +		return -EPROBE_DEFER;

IIUC, it shouldn't happen because the deivce is populated from main device.  Moreover, would it help to defer the probe if dev->parent is NULL?

> +	main_dev = dev_get_drvdata(dev->parent);
> +	if (!main_dev)
> +		return -EPROBE_DEFER;

Share the same concern with comment above.

> +static struct platform_driver mtk_vdec_driver = {
> +	.probe	= mtk_vdec_hw_probe,
> +	.driver	= {
> +		.name	= "mtk-vdec-comp",
> +		.of_match_table = mtk_vdec_hw_match,
> +	},
> +};
> +
> +module_platform_driver(mtk_vdec_driver);

I prefer to remove the blank line in between mtk_vdec_driver and module_platform_driver.

> diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
[...]
> @@ -423,6 +436,11 @@ struct mtk_vcodec_enc_pdata {
>   * @pm: power management control
>   * @dec_capability: used to identify decode capability, ex: 4k
>   * @enc_capability: used to identify encode capability
> + *
> + * @subdev_dev: subdev hardware device
> + * @subdev_node: subdev node
> + *
> + * @subdev_bitmap: used to record hardware is ready or not
>   */
>  struct mtk_vcodec_dev {
>  	struct v4l2_device v4l2_dev;
> @@ -460,6 +478,11 @@ struct mtk_vcodec_dev {
>  	struct mtk_vcodec_pm pm;
>  	unsigned int dec_capability;
>  	unsigned int enc_capability;
> +
> +	void *subdev_dev[MTK_VDEC_HW_MAX];
> +	struct device_node *subdev_node[MTK_VDEC_HW_MAX];

The same question: if it already has subdev_dev, does it still need subdev_node?
Tzung-Bi Shih Nov. 16, 2021, 9:24 a.m. UTC | #3
On Thu, Nov 11, 2021 at 12:14:52PM +0800, Yunfei Dong wrote:
> diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c
[...]
> +void *mtk_vcodec_get_hw_dev(struct mtk_vcodec_dev *dev, int hw_idx)
>  {
[...]
> +
> +	if (dev->subdev_dev[hw_idx])
> +		return dev->subdev_dev[hw_idx];
> +
> +	node = dev->subdev_node[hw_idx];
> +	if (!node) {
> +		mtk_v4l2_err("Get lat node fail:%d", hw_idx);
> +		return NULL;
> +	}
> +
> +	hw_pdev = of_find_device_by_node(node);
> +	of_node_put(node);

Raised the question in [v10,06/19] media: mtk-vcodec: Manage multi hardware information[1], is the reference count borrowed from mtk_vcodec_subdev_device_check?  If so, it needs comments for documentation.

[1]: https://patchwork.linuxtv.org/project/linux-media/patch/20211111041500.17363-7-yunfei.dong@mediatek.com/
Yunfei Dong Nov. 16, 2021, 11:42 a.m. UTC | #4
Hi Ezequiel,

Thanks for you suggestion.
On Sun, 2021-11-14 at 19:04 -0300, Ezequiel Garcia wrote:
> Hi Yunfei,
> 
> On Thu, 11 Nov 2021 at 01:15, Yunfei Dong <yunfei.dong@mediatek.com>
> wrote:
> > 
> > This series adds support for multi hardware decode into mtk-vcodec, 
> > by first adding use
> > of_platform_populate to manage each hardware information:
> > interrupt, clock, register
> > bases and power. Secondly add core work queue to deal with core
> > hardware message,
> > at the same time, add msg queue for different hardware share
> > messages. Lastly, the
> > architecture of different specs are not the same, using specs type
> > to separate them.
> > 
> > This series has been tested with both MT8183 and MT8173. Decoding
> > was working for both chips.
> > 
> 
> How are you testing Decoding? If you are running some test suite, it
> would
> be good to add such information.
> 
For 8183 and 8173, these patches don't have influence for them, can
work well.

These patches are used for mt8192 and 8195. We do cts/gts/stress test
to check our drivers.
> Are you testing some edge-cases such as parallel/concurrent decoding,
> removing the driver while streaming, and so on? This should help
> catch
> some typical issues.
> 
> Thanks,
> Ezequiel
> 
Thanks,
Yunfei Dong
> > Patches 1~3 rewrite get register bases and power on/off interface.
> > Patches 4 export decoder pm interfaces.
> > Patches 5 add to support 8192.
> > Patch 6 support multi hardware.
> > Patch 7 separate video encoder and decoder document
> > Patch 8-17 add interfaces to support core hardware.
> > Patch 18-19 remove mtk_vcodec_release_dec/enc_pm interfaces.
> > ---
> > changes compared with v9:
> > - need not to build ko, just export pm interfaces for patch 04/19.
> > - fix comments for patch 06/19
> > 
> > changes compared with v8:
> > - add new patch 18~19 to remove mtk_vcodec_release_de/enc_pm
> > interfaces.
> > - fix spelling mistakes for patch 17/19
> > - fix yaml comments for patch 15/19
> > 
> > Changes compared with v7:
> > - add new patch 4 to build decoder pm file as module
> > - add new patch 5 to support 8192
> > - fix comments for patch 6/17
> > - change some logic for using work queue instead of create thread
> > for core hardware decode for patch 10/17
> > - using work queue for hardware decode instead of create thread for
> > patch 13/17
> > - add returen value for patch 14/17
> > - fix yaml check fail 15/17
> > 
> > Changes compared with v6:
> > - Use of_platform_populate to manage multi hardware, not component
> > framework for patch 4/15
> > - Re-write dtsi document for hardware architecture changed for
> > patch 13/15 -The dtsi will write like below in patch 13/15:
> >     vcodec_dec: vcodec_dec@16000000 {
> >         compatible = "mediatek,mt8192-vcodec-dec";
> >         #address-cells = <2>;
> >         #size-cells = <2>;
> >         ranges;
> >         reg = <0 0x16000000 0 0x1000>;          /* VDEC_SYS */
> >         mediatek,scp = <&scp>;
> >         iommus = <&iommu0 M4U_PORT_L4_VDEC_MC_EXT>;
> >         dma-ranges = <0x1 0x0 0x0 0x40000000 0x0 0xfff00000>;
> >         vcodec_lat {
> >             compatible = "mediatek,mtk-vcodec-lat";
> >             reg = <0 0x16010000 0 0x800>;               /*
> > VDEC_MISC */
> >             reg-name = "reg-misc";
> >             interrupts = <GIC_SPI 426 IRQ_TYPE_LEVEL_HIGH 0>;
> >             iommus = <&iommu0 M4U_PORT_L5_VDEC_LAT0_VLD_EXT>,
> >                  <&iommu0 M4U_PORT_L5_VDEC_LAT0_VLD2_EXT>,
> >                  <&iommu0 M4U_PORT_L5_VDEC_LAT0_AVC_MV_EXT>,
> >                  <&iommu0 M4U_PORT_L5_VDEC_LAT0_PRED_RD_EXT>,
> >                  <&iommu0 M4U_PORT_L5_VDEC_LAT0_TILE_EXT>,
> >                  <&iommu0 M4U_PORT_L5_VDEC_LAT0_WDMA_EXT>,
> >                  <&iommu0 M4U_PORT_L5_VDEC_LAT0_RG_CTRL_DMA_EXT>,
> >                  <&iommu0 M4U_PORT_L5_VDEC_UFO_ENC_EXT>;
> >             clocks = <&topckgen CLK_TOP_VDEC_SEL>,
> >                  <&vdecsys_soc CLK_VDEC_SOC_VDEC>,
> >                  <&vdecsys_soc CLK_VDEC_SOC_LAT>,
> >                  <&vdecsys_soc CLK_VDEC_SOC_LARB1>,
> >                  <&topckgen CLK_TOP_MAINPLL_D4>;
> >             clock-names = "vdec-sel", "vdec-soc-vdec", "vdec-soc-
> > lat",
> >                   "vdec-vdec", "vdec-top";
> >             assigned-clocks = <&topckgen CLK_TOP_VDEC_SEL>;
> >             assigned-clock-parents = <&topckgen
> > CLK_TOP_MAINPLL_D4>;
> >             power-domains = <&spm MT8192_POWER_DOMAIN_VDEC>;
> >         };
> > 
> >         vcodec_core {
> >             compatible = "mediatek,mtk-vcodec-core";
> >             reg = <0 0x16025000 0 0x1000>;              /*
> > VDEC_CORE_MISC */
> >             reg-names = "reg-misc";
> >             interrupts = <GIC_SPI 425 IRQ_TYPE_LEVEL_HIGH 0>;
> >             iommus = <&iommu0 M4U_PORT_L4_VDEC_MC_EXT>,
> >                  <&iommu0 M4U_PORT_L4_VDEC_UFO_EXT>,
> >                  <&iommu0 M4U_PORT_L4_VDEC_PP_EXT>,
> >                  <&iommu0 M4U_PORT_L4_VDEC_PRED_RD_EXT>,
> >                  <&iommu0 M4U_PORT_L4_VDEC_PRED_WR_EXT>,
> >                  <&iommu0 M4U_PORT_L4_VDEC_PPWRAP_EXT>,
> >                  <&iommu0 M4U_PORT_L4_VDEC_TILE_EXT>,
> >                  <&iommu0 M4U_PORT_L4_VDEC_VLD_EXT>,
> >                  <&iommu0 M4U_PORT_L4_VDEC_VLD2_EXT>,
> >                  <&iommu0 M4U_PORT_L4_VDEC_AVC_MV_EXT>,
> >                  <&iommu0 M4U_PORT_L4_VDEC_RG_CTRL_DMA_EXT>;
> >             clocks = <&topckgen CLK_TOP_VDEC_SEL>,
> >                  <&vdecsys CLK_VDEC_VDEC>,
> >                  <&vdecsys CLK_VDEC_LAT>,
> >                  <&vdecsys CLK_VDEC_LARB1>,
> >                  <&topckgen CLK_TOP_MAINPLL_D4>;
> >             clock-names = "vdec-sel", "vdec-soc-vdec", "vdec-soc-
> > lat",
> >                   "vdec-vdec", "vdec-top";
> >             assigned-clocks = <&topckgen CLK_TOP_VDEC_SEL>;
> >             assigned-clock-parents = <&topckgen
> > CLK_TOP_MAINPLL_D4>;
> >             power-domains = <&spm MT8192_POWER_DOMAIN_VDEC2>;
> >         };
> >     };
> > 
> > Changes compared with v5:
> > - Add decoder hardware block diagram for patch 13/15
> > 
> > Changes compared with v4:
> > - Fix comments for patch 4/15
> >   >> +     if (dev->is_comp_supported) {
> >   >> +             ret = mtk_vcodec_init_master(dev);
> >   >> +             if (ret < 0)
> >   >> +                     goto err_component_match;
> >   >> +     } else {
> >   >> +             platform_set_drvdata(pdev, dev);
> >   >> +     }
> >   Fix platform_set_drvdata.
> > - Fix build error for patch 9/15
> > - Add depend patch in case of error header file for patch 13/15
> > 
> > Changes compared with v3:
> > - Fix return value for patch 1/15
> > - Fix comments for patch 4/15
> >   > Looking up "mediatek,mtk-vcodec-core" to determine if it uses
> > component framwork sounds like...
> >   Add prameter in pdata, for all platform will use compoent after
> > mt8183
> > 
> >   >> +     if (dev->is_comp_supported) {
> >   >> +             ret = mtk_vcodec_init_master(dev);
> >   >> +             if (ret < 0)
> >   >> +                     goto err_component_match;
> >   >> +     } else {
> >   >> +             platform_set_drvdata(pdev, dev);
> >   >> +     }
> >   > + Has asked the same question in [1].  Why it removes the
> >   > +platform_set_drvdata() above?  mtk_vcodec_init_master() also
> > calls platform_set_drvdata().
> >   Must call component_master_add_with_match after
> > platform_set_drvdata for component architecture.
> > - Fix yaml files check fail for patch 5/15
> > - Fix yaml file check fail for patch 14/15
> > 
> > Changes compared with v1:
> > - Fix many comments for patch 3/14
> > - Remove unnecessary code for patch 4/14
> > - Using enum mtk_vdec_hw_count instead of magic numbers for patch
> > 6/14
> > - Reconstructed get/put lat buffer for lat and core hardware for
> > patch 7/14
> > - Using yaml format to instead of txt file for patch 12/14
> > 
> > Yunfei Dong (19):
> >   media: mtk-vcodec: Get numbers of register bases from DT
> >   media: mtk-vcodec: Align vcodec wake up interrupt interface
> >   media: mtk-vcodec: Refactor vcodec pm interface
> >   media: mtk-vcodec: export decoder pm functions
> >   media: mtk-vcodec: Support MT8192
> >   media: mtk-vcodec: Manage multi hardware information
> >   dt-bindings: media: mtk-vcodec: Separate video encoder and
> > decoder
> >     dt-bindings
> >   media: mtk-vcodec: Use pure single core for MT8183
> >   media: mtk-vcodec: Add irq interface for multi hardware
> >   media: mtk-vcodec: Add msg queue feature for lat and core
> > architecture
> >   media: mtk-vcodec: Generalize power and clock on/off interfaces
> >   media: mtk-vcodec: Add new interface to lock different hardware
> >   media: mtk-vcodec: Add work queue for core hardware decode
> >   media: mtk-vcodec: Support 34bits dma address for vdec
> >   dt-bindings: media: mtk-vcodec: Adds decoder dt-bindings for
> > mt8192
> >   media: mtk-vcodec: Add core dec and dec end ipi msg
> >   media: mtk-vcodec: Use codec type to separate different hardware
> >   media: mtk-vcodec: Remove mtk_vcodec_release_dec_pm
> >   media: mtk-vcodec: Remove mtk_vcodec_release_enc_pm
> > 
> >  .../media/mediatek,vcodec-decoder.yaml        | 176 +++++++++++
> >  .../media/mediatek,vcodec-encoder.yaml        | 187 ++++++++++++
> >  .../media/mediatek,vcodec-subdev-decoder.yaml | 261
> > ++++++++++++++++
> >  .../bindings/media/mediatek-vcodec.txt        | 131 --------
> >  drivers/media/platform/mtk-vcodec/Makefile    |   6 +-
> >  .../platform/mtk-vcodec/mtk_vcodec_dec.c      |   4 +-
> >  .../platform/mtk-vcodec/mtk_vcodec_dec.h      |   1 +
> >  .../platform/mtk-vcodec/mtk_vcodec_dec_drv.c  | 219 +++++++++++---
> >  .../platform/mtk-vcodec/mtk_vcodec_dec_hw.c   | 172 +++++++++++
> >  .../platform/mtk-vcodec/mtk_vcodec_dec_hw.h   |  55 ++++
> >  .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c   | 104 +++++--
> >  .../platform/mtk-vcodec/mtk_vcodec_dec_pm.h   |  12 +-
> >  .../mtk-vcodec/mtk_vcodec_dec_stateful.c      |   2 +
> >  .../mtk-vcodec/mtk_vcodec_dec_stateless.c     |  20 ++
> >  .../platform/mtk-vcodec/mtk_vcodec_drv.h      |  75 ++++-
> >  .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c  |  21 +-
> >  .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c   |  10 +-
> >  .../platform/mtk-vcodec/mtk_vcodec_enc_pm.h   |   3 +-
> >  .../platform/mtk-vcodec/mtk_vcodec_intr.c     |  27 +-
> >  .../platform/mtk-vcodec/mtk_vcodec_intr.h     |   4 +-
> >  .../platform/mtk-vcodec/mtk_vcodec_util.c     |  87 +++++-
> >  .../platform/mtk-vcodec/mtk_vcodec_util.h     |   8 +-
> >  .../platform/mtk-vcodec/vdec/vdec_h264_if.c   |   2 +-
> >  .../mtk-vcodec/vdec/vdec_h264_req_if.c        |   2 +-
> >  .../platform/mtk-vcodec/vdec/vdec_vp8_if.c    |   2 +-
> >  .../platform/mtk-vcodec/vdec/vdec_vp9_if.c    |   2 +-
> >  .../media/platform/mtk-vcodec/vdec_drv_if.c   |  21 +-
> >  .../media/platform/mtk-vcodec/vdec_ipi_msg.h  |  16 +-
> >  .../platform/mtk-vcodec/vdec_msg_queue.c      | 286
> > ++++++++++++++++++
> >  .../platform/mtk-vcodec/vdec_msg_queue.h      | 148 +++++++++
> >  .../media/platform/mtk-vcodec/vdec_vpu_if.c   |  46 ++-
> >  .../media/platform/mtk-vcodec/vdec_vpu_if.h   |  22 ++
> >  .../platform/mtk-vcodec/venc/venc_h264_if.c   |   2 +-
> >  .../platform/mtk-vcodec/venc/venc_vp8_if.c    |   2 +-
> >  34 files changed, 1841 insertions(+), 295 deletions(-)
> >  create mode 100644
> > Documentation/devicetree/bindings/media/mediatek,vcodec-
> > decoder.yaml
> >  create mode 100644
> > Documentation/devicetree/bindings/media/mediatek,vcodec-
> > encoder.yaml
> >  create mode 100644
> > Documentation/devicetree/bindings/media/mediatek,vcodec-subdev-
> > decoder.yaml
> >  delete mode 100644
> > Documentation/devicetree/bindings/media/mediatek-vcodec.txt
> >  create mode 100644 drivers/media/platform/mtk-
> > vcodec/mtk_vcodec_dec_hw.c
> >  create mode 100644 drivers/media/platform/mtk-
> > vcodec/mtk_vcodec_dec_hw.h
> >  create mode 100644 drivers/media/platform/mtk-
> > vcodec/vdec_msg_queue.c
> >  create mode 100644 drivers/media/platform/mtk-
> > vcodec/vdec_msg_queue.h
> > 
> > --
> > 2.25.1
> >
Ezequiel Garcia Nov. 16, 2021, 12:06 p.m. UTC | #5
Hi Yunfei,

On Tue, 16 Nov 2021 at 08:42, yunfei.dong@mediatek.com
<yunfei.dong@mediatek.com> wrote:
>
> Hi Ezequiel,
>
> Thanks for you suggestion.
> On Sun, 2021-11-14 at 19:04 -0300, Ezequiel Garcia wrote:
> > Hi Yunfei,
> >
> > On Thu, 11 Nov 2021 at 01:15, Yunfei Dong <yunfei.dong@mediatek.com>
> > wrote:
> > >
> > > This series adds support for multi hardware decode into mtk-vcodec,
> > > by first adding use
> > > of_platform_populate to manage each hardware information:
> > > interrupt, clock, register
> > > bases and power. Secondly add core work queue to deal with core
> > > hardware message,
> > > at the same time, add msg queue for different hardware share
> > > messages. Lastly, the
> > > architecture of different specs are not the same, using specs type
> > > to separate them.
> > >
> > > This series has been tested with both MT8183 and MT8173. Decoding
> > > was working for both chips.
> > >
> >
> > How are you testing Decoding? If you are running some test suite, it
> > would
> > be good to add such information.
> >
> For 8183 and 8173, these patches don't have influence for them, can
> work well.
>
> These patches are used for mt8192 and 8195. We do cts/gts/stress test
> to check our drivers.

What is the meaning of cts/gts/stress tests?
Could you share the sources of the test?

Thanks,
Ezequiel

> > Are you testing some edge-cases such as parallel/concurrent decoding,
> > removing the driver while streaming, and so on? This should help
> > catch
> > some typical issues.
> >
> > Thanks,
> > Ezequiel
> >
> Thanks,
> Yunfei Dong
> > > Patches 1~3 rewrite get register bases and power on/off interface.
> > > Patches 4 export decoder pm interfaces.
> > > Patches 5 add to support 8192.
> > > Patch 6 support multi hardware.
> > > Patch 7 separate video encoder and decoder document
> > > Patch 8-17 add interfaces to support core hardware.
> > > Patch 18-19 remove mtk_vcodec_release_dec/enc_pm interfaces.
> > > ---
> > > changes compared with v9:
> > > - need not to build ko, just export pm interfaces for patch 04/19.
> > > - fix comments for patch 06/19
> > >
> > > changes compared with v8:
> > > - add new patch 18~19 to remove mtk_vcodec_release_de/enc_pm
> > > interfaces.
> > > - fix spelling mistakes for patch 17/19
> > > - fix yaml comments for patch 15/19
> > >
> > > Changes compared with v7:
> > > - add new patch 4 to build decoder pm file as module
> > > - add new patch 5 to support 8192
> > > - fix comments for patch 6/17
> > > - change some logic for using work queue instead of create thread
> > > for core hardware decode for patch 10/17
> > > - using work queue for hardware decode instead of create thread for
> > > patch 13/17
> > > - add returen value for patch 14/17
> > > - fix yaml check fail 15/17
> > >
> > > Changes compared with v6:
> > > - Use of_platform_populate to manage multi hardware, not component
> > > framework for patch 4/15
> > > - Re-write dtsi document for hardware architecture changed for
> > > patch 13/15 -The dtsi will write like below in patch 13/15:
> > >     vcodec_dec: vcodec_dec@16000000 {
> > >         compatible = "mediatek,mt8192-vcodec-dec";
> > >         #address-cells = <2>;
> > >         #size-cells = <2>;
> > >         ranges;
> > >         reg = <0 0x16000000 0 0x1000>;          /* VDEC_SYS */
> > >         mediatek,scp = <&scp>;
> > >         iommus = <&iommu0 M4U_PORT_L4_VDEC_MC_EXT>;
> > >         dma-ranges = <0x1 0x0 0x0 0x40000000 0x0 0xfff00000>;
> > >         vcodec_lat {
> > >             compatible = "mediatek,mtk-vcodec-lat";
> > >             reg = <0 0x16010000 0 0x800>;               /*
> > > VDEC_MISC */
> > >             reg-name = "reg-misc";
> > >             interrupts = <GIC_SPI 426 IRQ_TYPE_LEVEL_HIGH 0>;
> > >             iommus = <&iommu0 M4U_PORT_L5_VDEC_LAT0_VLD_EXT>,
> > >                  <&iommu0 M4U_PORT_L5_VDEC_LAT0_VLD2_EXT>,
> > >                  <&iommu0 M4U_PORT_L5_VDEC_LAT0_AVC_MV_EXT>,
> > >                  <&iommu0 M4U_PORT_L5_VDEC_LAT0_PRED_RD_EXT>,
> > >                  <&iommu0 M4U_PORT_L5_VDEC_LAT0_TILE_EXT>,
> > >                  <&iommu0 M4U_PORT_L5_VDEC_LAT0_WDMA_EXT>,
> > >                  <&iommu0 M4U_PORT_L5_VDEC_LAT0_RG_CTRL_DMA_EXT>,
> > >                  <&iommu0 M4U_PORT_L5_VDEC_UFO_ENC_EXT>;
> > >             clocks = <&topckgen CLK_TOP_VDEC_SEL>,
> > >                  <&vdecsys_soc CLK_VDEC_SOC_VDEC>,
> > >                  <&vdecsys_soc CLK_VDEC_SOC_LAT>,
> > >                  <&vdecsys_soc CLK_VDEC_SOC_LARB1>,
> > >                  <&topckgen CLK_TOP_MAINPLL_D4>;
> > >             clock-names = "vdec-sel", "vdec-soc-vdec", "vdec-soc-
> > > lat",
> > >                   "vdec-vdec", "vdec-top";
> > >             assigned-clocks = <&topckgen CLK_TOP_VDEC_SEL>;
> > >             assigned-clock-parents = <&topckgen
> > > CLK_TOP_MAINPLL_D4>;
> > >             power-domains = <&spm MT8192_POWER_DOMAIN_VDEC>;
> > >         };
> > >
> > >         vcodec_core {
> > >             compatible = "mediatek,mtk-vcodec-core";
> > >             reg = <0 0x16025000 0 0x1000>;              /*
> > > VDEC_CORE_MISC */
> > >             reg-names = "reg-misc";
> > >             interrupts = <GIC_SPI 425 IRQ_TYPE_LEVEL_HIGH 0>;
> > >             iommus = <&iommu0 M4U_PORT_L4_VDEC_MC_EXT>,
> > >                  <&iommu0 M4U_PORT_L4_VDEC_UFO_EXT>,
> > >                  <&iommu0 M4U_PORT_L4_VDEC_PP_EXT>,
> > >                  <&iommu0 M4U_PORT_L4_VDEC_PRED_RD_EXT>,
> > >                  <&iommu0 M4U_PORT_L4_VDEC_PRED_WR_EXT>,
> > >                  <&iommu0 M4U_PORT_L4_VDEC_PPWRAP_EXT>,
> > >                  <&iommu0 M4U_PORT_L4_VDEC_TILE_EXT>,
> > >                  <&iommu0 M4U_PORT_L4_VDEC_VLD_EXT>,
> > >                  <&iommu0 M4U_PORT_L4_VDEC_VLD2_EXT>,
> > >                  <&iommu0 M4U_PORT_L4_VDEC_AVC_MV_EXT>,
> > >                  <&iommu0 M4U_PORT_L4_VDEC_RG_CTRL_DMA_EXT>;
> > >             clocks = <&topckgen CLK_TOP_VDEC_SEL>,
> > >                  <&vdecsys CLK_VDEC_VDEC>,
> > >                  <&vdecsys CLK_VDEC_LAT>,
> > >                  <&vdecsys CLK_VDEC_LARB1>,
> > >                  <&topckgen CLK_TOP_MAINPLL_D4>;
> > >             clock-names = "vdec-sel", "vdec-soc-vdec", "vdec-soc-
> > > lat",
> > >                   "vdec-vdec", "vdec-top";
> > >             assigned-clocks = <&topckgen CLK_TOP_VDEC_SEL>;
> > >             assigned-clock-parents = <&topckgen
> > > CLK_TOP_MAINPLL_D4>;
> > >             power-domains = <&spm MT8192_POWER_DOMAIN_VDEC2>;
> > >         };
> > >     };
> > >
> > > Changes compared with v5:
> > > - Add decoder hardware block diagram for patch 13/15
> > >
> > > Changes compared with v4:
> > > - Fix comments for patch 4/15
> > >   >> +     if (dev->is_comp_supported) {
> > >   >> +             ret = mtk_vcodec_init_master(dev);
> > >   >> +             if (ret < 0)
> > >   >> +                     goto err_component_match;
> > >   >> +     } else {
> > >   >> +             platform_set_drvdata(pdev, dev);
> > >   >> +     }
> > >   Fix platform_set_drvdata.
> > > - Fix build error for patch 9/15
> > > - Add depend patch in case of error header file for patch 13/15
> > >
> > > Changes compared with v3:
> > > - Fix return value for patch 1/15
> > > - Fix comments for patch 4/15
> > >   > Looking up "mediatek,mtk-vcodec-core" to determine if it uses
> > > component framwork sounds like...
> > >   Add prameter in pdata, for all platform will use compoent after
> > > mt8183
> > >
> > >   >> +     if (dev->is_comp_supported) {
> > >   >> +             ret = mtk_vcodec_init_master(dev);
> > >   >> +             if (ret < 0)
> > >   >> +                     goto err_component_match;
> > >   >> +     } else {
> > >   >> +             platform_set_drvdata(pdev, dev);
> > >   >> +     }
> > >   > + Has asked the same question in [1].  Why it removes the
> > >   > +platform_set_drvdata() above?  mtk_vcodec_init_master() also
> > > calls platform_set_drvdata().
> > >   Must call component_master_add_with_match after
> > > platform_set_drvdata for component architecture.
> > > - Fix yaml files check fail for patch 5/15
> > > - Fix yaml file check fail for patch 14/15
> > >
> > > Changes compared with v1:
> > > - Fix many comments for patch 3/14
> > > - Remove unnecessary code for patch 4/14
> > > - Using enum mtk_vdec_hw_count instead of magic numbers for patch
> > > 6/14
> > > - Reconstructed get/put lat buffer for lat and core hardware for
> > > patch 7/14
> > > - Using yaml format to instead of txt file for patch 12/14
> > >
> > > Yunfei Dong (19):
> > >   media: mtk-vcodec: Get numbers of register bases from DT
> > >   media: mtk-vcodec: Align vcodec wake up interrupt interface
> > >   media: mtk-vcodec: Refactor vcodec pm interface
> > >   media: mtk-vcodec: export decoder pm functions
> > >   media: mtk-vcodec: Support MT8192
> > >   media: mtk-vcodec: Manage multi hardware information
> > >   dt-bindings: media: mtk-vcodec: Separate video encoder and
> > > decoder
> > >     dt-bindings
> > >   media: mtk-vcodec: Use pure single core for MT8183
> > >   media: mtk-vcodec: Add irq interface for multi hardware
> > >   media: mtk-vcodec: Add msg queue feature for lat and core
> > > architecture
> > >   media: mtk-vcodec: Generalize power and clock on/off interfaces
> > >   media: mtk-vcodec: Add new interface to lock different hardware
> > >   media: mtk-vcodec: Add work queue for core hardware decode
> > >   media: mtk-vcodec: Support 34bits dma address for vdec
> > >   dt-bindings: media: mtk-vcodec: Adds decoder dt-bindings for
> > > mt8192
> > >   media: mtk-vcodec: Add core dec and dec end ipi msg
> > >   media: mtk-vcodec: Use codec type to separate different hardware
> > >   media: mtk-vcodec: Remove mtk_vcodec_release_dec_pm
> > >   media: mtk-vcodec: Remove mtk_vcodec_release_enc_pm
> > >
> > >  .../media/mediatek,vcodec-decoder.yaml        | 176 +++++++++++
> > >  .../media/mediatek,vcodec-encoder.yaml        | 187 ++++++++++++
> > >  .../media/mediatek,vcodec-subdev-decoder.yaml | 261
> > > ++++++++++++++++
> > >  .../bindings/media/mediatek-vcodec.txt        | 131 --------
> > >  drivers/media/platform/mtk-vcodec/Makefile    |   6 +-
> > >  .../platform/mtk-vcodec/mtk_vcodec_dec.c      |   4 +-
> > >  .../platform/mtk-vcodec/mtk_vcodec_dec.h      |   1 +
> > >  .../platform/mtk-vcodec/mtk_vcodec_dec_drv.c  | 219 +++++++++++---
> > >  .../platform/mtk-vcodec/mtk_vcodec_dec_hw.c   | 172 +++++++++++
> > >  .../platform/mtk-vcodec/mtk_vcodec_dec_hw.h   |  55 ++++
> > >  .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c   | 104 +++++--
> > >  .../platform/mtk-vcodec/mtk_vcodec_dec_pm.h   |  12 +-
> > >  .../mtk-vcodec/mtk_vcodec_dec_stateful.c      |   2 +
> > >  .../mtk-vcodec/mtk_vcodec_dec_stateless.c     |  20 ++
> > >  .../platform/mtk-vcodec/mtk_vcodec_drv.h      |  75 ++++-
> > >  .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c  |  21 +-
> > >  .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c   |  10 +-
> > >  .../platform/mtk-vcodec/mtk_vcodec_enc_pm.h   |   3 +-
> > >  .../platform/mtk-vcodec/mtk_vcodec_intr.c     |  27 +-
> > >  .../platform/mtk-vcodec/mtk_vcodec_intr.h     |   4 +-
> > >  .../platform/mtk-vcodec/mtk_vcodec_util.c     |  87 +++++-
> > >  .../platform/mtk-vcodec/mtk_vcodec_util.h     |   8 +-
> > >  .../platform/mtk-vcodec/vdec/vdec_h264_if.c   |   2 +-
> > >  .../mtk-vcodec/vdec/vdec_h264_req_if.c        |   2 +-
> > >  .../platform/mtk-vcodec/vdec/vdec_vp8_if.c    |   2 +-
> > >  .../platform/mtk-vcodec/vdec/vdec_vp9_if.c    |   2 +-
> > >  .../media/platform/mtk-vcodec/vdec_drv_if.c   |  21 +-
> > >  .../media/platform/mtk-vcodec/vdec_ipi_msg.h  |  16 +-
> > >  .../platform/mtk-vcodec/vdec_msg_queue.c      | 286
> > > ++++++++++++++++++
> > >  .../platform/mtk-vcodec/vdec_msg_queue.h      | 148 +++++++++
> > >  .../media/platform/mtk-vcodec/vdec_vpu_if.c   |  46 ++-
> > >  .../media/platform/mtk-vcodec/vdec_vpu_if.h   |  22 ++
> > >  .../platform/mtk-vcodec/venc/venc_h264_if.c   |   2 +-
> > >  .../platform/mtk-vcodec/venc/venc_vp8_if.c    |   2 +-
> > >  34 files changed, 1841 insertions(+), 295 deletions(-)
> > >  create mode 100644
> > > Documentation/devicetree/bindings/media/mediatek,vcodec-
> > > decoder.yaml
> > >  create mode 100644
> > > Documentation/devicetree/bindings/media/mediatek,vcodec-
> > > encoder.yaml
> > >  create mode 100644
> > > Documentation/devicetree/bindings/media/mediatek,vcodec-subdev-
> > > decoder.yaml
> > >  delete mode 100644
> > > Documentation/devicetree/bindings/media/mediatek-vcodec.txt
> > >  create mode 100644 drivers/media/platform/mtk-
> > > vcodec/mtk_vcodec_dec_hw.c
> > >  create mode 100644 drivers/media/platform/mtk-
> > > vcodec/mtk_vcodec_dec_hw.h
> > >  create mode 100644 drivers/media/platform/mtk-
> > > vcodec/vdec_msg_queue.c
> > >  create mode 100644 drivers/media/platform/mtk-
> > > vcodec/vdec_msg_queue.h
> > >
> > > --
> > > 2.25.1
> > >
Yunfei Dong Nov. 16, 2021, 12:31 p.m. UTC | #6
Hi Ezequiel,

On Tue, 2021-11-16 at 09:06 -0300, Ezequiel Garcia wrote:
> Hi Yunfei,
> 
> On Tue, 16 Nov 2021 at 08:42, yunfei.dong@mediatek.com
> <yunfei.dong@mediatek.com> wrote:
> > 
> > Hi Ezequiel,
> > 
> > Thanks for you suggestion.
> > On Sun, 2021-11-14 at 19:04 -0300, Ezequiel Garcia wrote:
> > > Hi Yunfei,
> > > 
> > > On Thu, 11 Nov 2021 at 01:15, Yunfei Dong <
> > > yunfei.dong@mediatek.com>
> > > wrote:
> > > > 
> > > > This series adds support for multi hardware decode into mtk-
> > > > vcodec,
> > > > by first adding use
> > > > of_platform_populate to manage each hardware information:
> > > > interrupt, clock, register
> > > > bases and power. Secondly add core work queue to deal with core
> > > > hardware message,
> > > > at the same time, add msg queue for different hardware share
> > > > messages. Lastly, the
> > > > architecture of different specs are not the same, using specs
> > > > type
> > > > to separate them.
> > > > 
> > > > This series has been tested with both MT8183 and MT8173.
> > > > Decoding
> > > > was working for both chips.
> > > > 
> > > 
> > > How are you testing Decoding? If you are running some test suite,
> > > it
> > > would
> > > be good to add such information.
> > > 
> > 
> > For 8183 and 8173, these patches don't have influence for them, can
> > work well.
> > 
> > These patches are used for mt8192 and 8195. We do cts/gts/stress
> > test
> > to check our drivers.
> 
> What is the meaning of cts/gts/stress tests?
> Could you share the sources of the test?
> 
CTS is android compatibility test suite. You can get the information
from: https://source.android.com/compatibility.

GTS is google Mobile Service Test Suite.

Need to run the test suites to test vcodec drivers. Regards them as
google android certification.

> Thanks,
> Ezequiel
> 
Thanks,
Yunfei Dong
> > > Are you testing some edge-cases such as parallel/concurrent
> > > decoding,
> > > removing the driver while streaming, and so on? This should help
> > > catch
> > > some typical issues.
> > > 
> > > Thanks,
> > > Ezequiel
> > > 
> > 
> > Thanks,
> > Yunfei Dong
> > > > Patches 1~3 rewrite get register bases and power on/off
> > > > interface.
> > > > Patches 4 export decoder pm interfaces.
> > > > Patches 5 add to support 8192.
> > > > Patch 6 support multi hardware.
> > > > Patch 7 separate video encoder and decoder document
> > > > Patch 8-17 add interfaces to support core hardware.
> > > > Patch 18-19 remove mtk_vcodec_release_dec/enc_pm interfaces.
> > > > ---
> > > > changes compared with v9:
> > > > - need not to build ko, just export pm interfaces for patch
> > > > 04/19.
> > > > - fix comments for patch 06/19
> > > > 
> > > > changes compared with v8:
> > > > - add new patch 18~19 to remove mtk_vcodec_release_de/enc_pm
> > > > interfaces.
> > > > - fix spelling mistakes for patch 17/19
> > > > - fix yaml comments for patch 15/19
> > > > 
> > > > Changes compared with v7:
> > > > - add new patch 4 to build decoder pm file as module
> > > > - add new patch 5 to support 8192
> > > > - fix comments for patch 6/17
> > > > - change some logic for using work queue instead of create
> > > > thread
> > > > for core hardware decode for patch 10/17
> > > > - using work queue for hardware decode instead of create thread
> > > > for
> > > > patch 13/17
> > > > - add returen value for patch 14/17
> > > > - fix yaml check fail 15/17
> > > > 
> > > > Changes compared with v6:
> > > > - Use of_platform_populate to manage multi hardware, not
> > > > component
> > > > framework for patch 4/15
> > > > - Re-write dtsi document for hardware architecture changed for
> > > > patch 13/15 -The dtsi will write like below in patch 13/15:
> > > >     vcodec_dec: vcodec_dec@16000000 {
> > > >         compatible = "mediatek,mt8192-vcodec-dec";
> > > >         #address-cells = <2>;
> > > >         #size-cells = <2>;
> > > >         ranges;
> > > >         reg = <0 0x16000000 0 0x1000>;          /* VDEC_SYS */
> > > >         mediatek,scp = <&scp>;
> > > >         iommus = <&iommu0 M4U_PORT_L4_VDEC_MC_EXT>;
> > > >         dma-ranges = <0x1 0x0 0x0 0x40000000 0x0 0xfff00000>;
> > > >         vcodec_lat {
> > > >             compatible = "mediatek,mtk-vcodec-lat";
> > > >             reg = <0 0x16010000 0 0x800>;               /*
> > > > VDEC_MISC */
> > > >             reg-name = "reg-misc";
> > > >             interrupts = <GIC_SPI 426 IRQ_TYPE_LEVEL_HIGH 0>;
> > > >             iommus = <&iommu0 M4U_PORT_L5_VDEC_LAT0_VLD_EXT>,
> > > >                  <&iommu0 M4U_PORT_L5_VDEC_LAT0_VLD2_EXT>,
> > > >                  <&iommu0 M4U_PORT_L5_VDEC_LAT0_AVC_MV_EXT>,
> > > >                  <&iommu0 M4U_PORT_L5_VDEC_LAT0_PRED_RD_EXT>,
> > > >                  <&iommu0 M4U_PORT_L5_VDEC_LAT0_TILE_EXT>,
> > > >                  <&iommu0 M4U_PORT_L5_VDEC_LAT0_WDMA_EXT>,
> > > >                  <&iommu0
> > > > M4U_PORT_L5_VDEC_LAT0_RG_CTRL_DMA_EXT>,
> > > >                  <&iommu0 M4U_PORT_L5_VDEC_UFO_ENC_EXT>;
> > > >             clocks = <&topckgen CLK_TOP_VDEC_SEL>,
> > > >                  <&vdecsys_soc CLK_VDEC_SOC_VDEC>,
> > > >                  <&vdecsys_soc CLK_VDEC_SOC_LAT>,
> > > >                  <&vdecsys_soc CLK_VDEC_SOC_LARB1>,
> > > >                  <&topckgen CLK_TOP_MAINPLL_D4>;
> > > >             clock-names = "vdec-sel", "vdec-soc-vdec", "vdec-
> > > > soc-
> > > > lat",
> > > >                   "vdec-vdec", "vdec-top";
> > > >             assigned-clocks = <&topckgen CLK_TOP_VDEC_SEL>;
> > > >             assigned-clock-parents = <&topckgen
> > > > CLK_TOP_MAINPLL_D4>;
> > > >             power-domains = <&spm MT8192_POWER_DOMAIN_VDEC>;
> > > >         };
> > > > 
> > > >         vcodec_core {
> > > >             compatible = "mediatek,mtk-vcodec-core";
> > > >             reg = <0 0x16025000 0 0x1000>;              /*
> > > > VDEC_CORE_MISC */
> > > >             reg-names = "reg-misc";
> > > >             interrupts = <GIC_SPI 425 IRQ_TYPE_LEVEL_HIGH 0>;
> > > >             iommus = <&iommu0 M4U_PORT_L4_VDEC_MC_EXT>,
> > > >                  <&iommu0 M4U_PORT_L4_VDEC_UFO_EXT>,
> > > >                  <&iommu0 M4U_PORT_L4_VDEC_PP_EXT>,
> > > >                  <&iommu0 M4U_PORT_L4_VDEC_PRED_RD_EXT>,
> > > >                  <&iommu0 M4U_PORT_L4_VDEC_PRED_WR_EXT>,
> > > >                  <&iommu0 M4U_PORT_L4_VDEC_PPWRAP_EXT>,
> > > >                  <&iommu0 M4U_PORT_L4_VDEC_TILE_EXT>,
> > > >                  <&iommu0 M4U_PORT_L4_VDEC_VLD_EXT>,
> > > >                  <&iommu0 M4U_PORT_L4_VDEC_VLD2_EXT>,
> > > >                  <&iommu0 M4U_PORT_L4_VDEC_AVC_MV_EXT>,
> > > >                  <&iommu0 M4U_PORT_L4_VDEC_RG_CTRL_DMA_EXT>;
> > > >             clocks = <&topckgen CLK_TOP_VDEC_SEL>,
> > > >                  <&vdecsys CLK_VDEC_VDEC>,
> > > >                  <&vdecsys CLK_VDEC_LAT>,
> > > >                  <&vdecsys CLK_VDEC_LARB1>,
> > > >                  <&topckgen CLK_TOP_MAINPLL_D4>;
> > > >             clock-names = "vdec-sel", "vdec-soc-vdec", "vdec-
> > > > soc-
> > > > lat",
> > > >                   "vdec-vdec", "vdec-top";
> > > >             assigned-clocks = <&topckgen CLK_TOP_VDEC_SEL>;
> > > >             assigned-clock-parents = <&topckgen
> > > > CLK_TOP_MAINPLL_D4>;
> > > >             power-domains = <&spm MT8192_POWER_DOMAIN_VDEC2>;
> > > >         };
> > > >     };
> > > > 
> > > > Changes compared with v5:
> > > > - Add decoder hardware block diagram for patch 13/15
> > > > 
> > > > Changes compared with v4:
> > > > - Fix comments for patch 4/15
> > > >   >> +     if (dev->is_comp_supported) {
> > > >   >> +             ret = mtk_vcodec_init_master(dev);
> > > >   >> +             if (ret < 0)
> > > >   >> +                     goto err_component_match;
> > > >   >> +     } else {
> > > >   >> +             platform_set_drvdata(pdev, dev);
> > > >   >> +     }
> > > >   Fix platform_set_drvdata.
> > > > - Fix build error for patch 9/15
> > > > - Add depend patch in case of error header file for patch 13/15
> > > > 
> > > > Changes compared with v3:
> > > > - Fix return value for patch 1/15
> > > > - Fix comments for patch 4/15
> > > >   > Looking up "mediatek,mtk-vcodec-core" to determine if it
> > > > uses
> > > > component framwork sounds like...
> > > >   Add prameter in pdata, for all platform will use compoent
> > > > after
> > > > mt8183
> > > > 
> > > >   >> +     if (dev->is_comp_supported) {
> > > >   >> +             ret = mtk_vcodec_init_master(dev);
> > > >   >> +             if (ret < 0)
> > > >   >> +                     goto err_component_match;
> > > >   >> +     } else {
> > > >   >> +             platform_set_drvdata(pdev, dev);
> > > >   >> +     }
> > > >   > + Has asked the same question in [1].  Why it removes the
> > > >   > +platform_set_drvdata() above?  mtk_vcodec_init_master()
> > > > also
> > > > calls platform_set_drvdata().
> > > >   Must call component_master_add_with_match after
> > > > platform_set_drvdata for component architecture.
> > > > - Fix yaml files check fail for patch 5/15
> > > > - Fix yaml file check fail for patch 14/15
> > > > 
> > > > Changes compared with v1:
> > > > - Fix many comments for patch 3/14
> > > > - Remove unnecessary code for patch 4/14
> > > > - Using enum mtk_vdec_hw_count instead of magic numbers for
> > > > patch
> > > > 6/14
> > > > - Reconstructed get/put lat buffer for lat and core hardware
> > > > for
> > > > patch 7/14
> > > > - Using yaml format to instead of txt file for patch 12/14
> > > > 
> > > > Yunfei Dong (19):
> > > >   media: mtk-vcodec: Get numbers of register bases from DT
> > > >   media: mtk-vcodec: Align vcodec wake up interrupt interface
> > > >   media: mtk-vcodec: Refactor vcodec pm interface
> > > >   media: mtk-vcodec: export decoder pm functions
> > > >   media: mtk-vcodec: Support MT8192
> > > >   media: mtk-vcodec: Manage multi hardware information
> > > >   dt-bindings: media: mtk-vcodec: Separate video encoder and
> > > > decoder
> > > >     dt-bindings
> > > >   media: mtk-vcodec: Use pure single core for MT8183
> > > >   media: mtk-vcodec: Add irq interface for multi hardware
> > > >   media: mtk-vcodec: Add msg queue feature for lat and core
> > > > architecture
> > > >   media: mtk-vcodec: Generalize power and clock on/off
> > > > interfaces
> > > >   media: mtk-vcodec: Add new interface to lock different
> > > > hardware
> > > >   media: mtk-vcodec: Add work queue for core hardware decode
> > > >   media: mtk-vcodec: Support 34bits dma address for vdec
> > > >   dt-bindings: media: mtk-vcodec: Adds decoder dt-bindings for
> > > > mt8192
> > > >   media: mtk-vcodec: Add core dec and dec end ipi msg
> > > >   media: mtk-vcodec: Use codec type to separate different
> > > > hardware
> > > >   media: mtk-vcodec: Remove mtk_vcodec_release_dec_pm
> > > >   media: mtk-vcodec: Remove mtk_vcodec_release_enc_pm
> > > > 
> > > >  .../media/mediatek,vcodec-decoder.yaml        | 176
> > > > +++++++++++
> > > >  .../media/mediatek,vcodec-encoder.yaml        | 187
> > > > ++++++++++++
> > > >  .../media/mediatek,vcodec-subdev-decoder.yaml | 261
> > > > ++++++++++++++++
> > > >  .../bindings/media/mediatek-vcodec.txt        | 131 --------
> > > >  drivers/media/platform/mtk-vcodec/Makefile    |   6 +-
> > > >  .../platform/mtk-vcodec/mtk_vcodec_dec.c      |   4 +-
> > > >  .../platform/mtk-vcodec/mtk_vcodec_dec.h      |   1 +
> > > >  .../platform/mtk-vcodec/mtk_vcodec_dec_drv.c  | 219
> > > > +++++++++++---
> > > >  .../platform/mtk-vcodec/mtk_vcodec_dec_hw.c   | 172
> > > > +++++++++++
> > > >  .../platform/mtk-vcodec/mtk_vcodec_dec_hw.h   |  55 ++++
> > > >  .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c   | 104 +++++--
> > > >  .../platform/mtk-vcodec/mtk_vcodec_dec_pm.h   |  12 +-
> > > >  .../mtk-vcodec/mtk_vcodec_dec_stateful.c      |   2 +
> > > >  .../mtk-vcodec/mtk_vcodec_dec_stateless.c     |  20 ++
> > > >  .../platform/mtk-vcodec/mtk_vcodec_drv.h      |  75 ++++-
> > > >  .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c  |  21 +-
> > > >  .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c   |  10 +-
> > > >  .../platform/mtk-vcodec/mtk_vcodec_enc_pm.h   |   3 +-
> > > >  .../platform/mtk-vcodec/mtk_vcodec_intr.c     |  27 +-
> > > >  .../platform/mtk-vcodec/mtk_vcodec_intr.h     |   4 +-
> > > >  .../platform/mtk-vcodec/mtk_vcodec_util.c     |  87 +++++-
> > > >  .../platform/mtk-vcodec/mtk_vcodec_util.h     |   8 +-
> > > >  .../platform/mtk-vcodec/vdec/vdec_h264_if.c   |   2 +-
> > > >  .../mtk-vcodec/vdec/vdec_h264_req_if.c        |   2 +-
> > > >  .../platform/mtk-vcodec/vdec/vdec_vp8_if.c    |   2 +-
> > > >  .../platform/mtk-vcodec/vdec/vdec_vp9_if.c    |   2 +-
> > > >  .../media/platform/mtk-vcodec/vdec_drv_if.c   |  21 +-
> > > >  .../media/platform/mtk-vcodec/vdec_ipi_msg.h  |  16 +-
> > > >  .../platform/mtk-vcodec/vdec_msg_queue.c      | 286
> > > > ++++++++++++++++++
> > > >  .../platform/mtk-vcodec/vdec_msg_queue.h      | 148 +++++++++
> > > >  .../media/platform/mtk-vcodec/vdec_vpu_if.c   |  46 ++-
> > > >  .../media/platform/mtk-vcodec/vdec_vpu_if.h   |  22 ++
> > > >  .../platform/mtk-vcodec/venc/venc_h264_if.c   |   2 +-
> > > >  .../platform/mtk-vcodec/venc/venc_vp8_if.c    |   2 +-
> > > >  34 files changed, 1841 insertions(+), 295 deletions(-)
> > > >  create mode 100644
> > > > Documentation/devicetree/bindings/media/mediatek,vcodec-
> > > > decoder.yaml
> > > >  create mode 100644
> > > > Documentation/devicetree/bindings/media/mediatek,vcodec-
> > > > encoder.yaml
> > > >  create mode 100644
> > > > Documentation/devicetree/bindings/media/mediatek,vcodec-subdev-
> > > > decoder.yaml
> > > >  delete mode 100644
> > > > Documentation/devicetree/bindings/media/mediatek-vcodec.txt
> > > >  create mode 100644 drivers/media/platform/mtk-
> > > > vcodec/mtk_vcodec_dec_hw.c
> > > >  create mode 100644 drivers/media/platform/mtk-
> > > > vcodec/mtk_vcodec_dec_hw.h
> > > >  create mode 100644 drivers/media/platform/mtk-
> > > > vcodec/vdec_msg_queue.c
> > > >  create mode 100644 drivers/media/platform/mtk-
> > > > vcodec/vdec_msg_queue.h
> > > > 
> > > > --
> > > > 2.25.1
> > > >