All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v10 00/13] Clean up "mediatek,larb"
@ 2022-01-17  7:04 ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:04 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Evan Green, Robin Murphy, Tomasz Figa, Will Deacon,
	linux-mediatek, srv_heupstream, devicetree, linux-kernel,
	linux-arm-kernel, iommu, yong.wu, youlin.pei, Matthias Kaehlcke,
	anan.sun, yi.kuo, acourbot, linux-media, dri-devel,
	Daniel Vetter, Chun-Kuang Hu, Philipp Zabel, Tiffany Lin,
	Dafna Hirschfeld, Hsin-Yi Wang, Eizan Miyamoto, anthony.huang,
	Frank Wunderlich, mingyuan.ma, yf.wang, libo.kang,
	AngeloGioacchino Del Regno

MediaTek IOMMU block diagram always like below:

        M4U
         |
    smi-common
         |
  -------------
  |         |  ...
  |         |
larb1     larb2
  |         |
vdec       venc

All the consumer connect with smi-larb, then connect with smi-common.

When the consumer works, it should enable the smi-larb's power which also
need enable the smi-common's power firstly.

Thus, Firstly, use the device link connect the consumer and the
smi-larbs. then add device link between the smi-larb and smi-common.

After adding the device_link, then "mediatek,larb" property can be removed.
the iommu consumer don't need call the mtk_smi_larb_get/put to enable
the power and clock of smi-larb and smi-common.

Base on the media branch [1] and a jpeg dtbinding patchset[2] that already got
the necessary R-b.

[1] git://linuxtv.org/hverkuil/media_tree.git tags/br-v5.18d
[2] https://lore.kernel.org/linux-mediatek/20211206130425.184420-1-hsinyi@chromium.org/

Change notes:
v10: a) Rebase on the media tree. Respin the "media: mtk-vcodec:" patches.     
     b) Add Joerg's Ack for iommu patches.

v9: https://lore.kernel.org/linux-mediatek/20211112105509.12010-1-yong.wu@mediatek.com/
    1) Add return -ENODEV when the dev is null.
    2) Add more strict about the case that a iommu consume device use the ports in
    different larbs. Don't allow this case.
    3) Remove two codec interface: mtk_vcodec_release_enc/dec_pm since it only has one
    line now.

v8: https://lore.kernel.org/linux-mediatek/20210929013719.25120-1-yong.wu@mediatek.com/
    1) Rebase on v5.15-rc1.
    2) Don't rebase the below mdp patchset that may still need more discuss.
    https://lore.kernel.org/linux-mediatek/20210709022324.1607884-1-eizan@chromium.org/
    3) Add Frank's Tested-by. Remove Dafna's Tested-by as he requested.

v7: https://lore.kernel.org/linux-mediatek/20210730025238.22456-1-yong.wu@mediatek.com/
    1) Fix a arm32 boot fail issue. reported from Frank.
    2) Add a return fail in the mtk drm. suggested by Dafna.

v6: https://lore.kernel.org/linux-mediatek/20210714025626.5528-1-yong.wu@mediatek.com/
    1) rebase on v5.14-rc1.
    2) Fix the issue commented in v5 from Dafna and Hsin-Yi.
    3) Remove the patches about using pm_runtime_resume_and_get since they have
       already been merged by other patches.

v5: https://lore.kernel.org/linux-mediatek/20210410091128.31823-1-yong.wu@mediatek.com/
    1) Base v5.12-rc2.
    2) Remove changing the mtk-iommu to module_platform_driver patch, It have already been a
    independent patch.

v4: https://lore.kernel.org/linux-mediatek/1590826218-23653-1-git-send-email-yong.wu@mediatek.com/ 
    base on v5.7-rc1.
  1) Move drm PM patch before smi patchs.
  2) Change builtin_platform_driver to module_platform_driver since we may need
     build as module.
  3) Rebase many patchset as above.

v3: https://lore.kernel.org/linux-iommu/1567503456-24725-1-git-send-email-yong.wu@mediatek.com/
    1) rebase on v5.3-rc1 and the latest mt8183 patchset.
    2) Use device_is_bound to check whether the driver is ready from Matthias.    
    3) Add DL_FLAG_STATELESS flag when calling device_link_add and explain the
   reason in the commit message[3/14].
    4) Add a display patch[12/14] into this series. otherwise it may affect
   display HW fastlogo even though it don't happen in mt8183.
   
v2: https://lore.kernel.org/linux-iommu/1560171313-28299-1-git-send-email-yong.wu@mediatek.com/
   1) rebase on v5.2-rc1.
   2) Move adding device_link between the consumer and smi-larb into
iommu_add_device from Robin.
   3) add DL_FLAG_AUTOREMOVE_CONSUMER even though the smi is built-in from Evan.
   4) Remove the shutdown callback in iommu.   

v1: https://lore.kernel.org/linux-iommu/1546318276-18993-1-git-send-email-yong.wu@mediatek.com/

Yong Wu (12):
  dt-binding: mediatek: Get rid of mediatek,larb for multimedia HW
  iommu/mediatek-v1: Free the existed fwspec if the master dev already
    has
  iommu/mediatek: Return ENODEV if the device is NULL
  iommu/mediatek: Add probe_defer for smi-larb
  iommu/mediatek: Add device_link between the consumer and the larb
    devices
  media: mtk-jpeg: Get rid of mtk_smi_larb_get/put
  media: mtk-mdp: Get rid of mtk_smi_larb_get/put
  drm/mediatek: Get rid of mtk_smi_larb_get/put
  media: mtk-vcodec: Get rid of mtk_smi_larb_get/put
  memory: mtk-smi: Get rid of mtk_smi_larb_get/put
  arm: dts: mediatek: Get rid of mediatek,larb for MM nodes
  arm64: dts: mediatek: Get rid of mediatek,larb for MM nodes

Yongqiang Niu (1):
  drm/mediatek: Add pm runtime support for ovl and rdma

 .../display/mediatek/mediatek,disp.txt        |  9 ----
 .../media/mediatek,vcodec-decoder.yaml        |  7 ---
 .../media/mediatek,vcodec-encoder.yaml        |  8 ----
 .../bindings/media/mediatek-jpeg-decoder.yaml |  9 ----
 .../bindings/media/mediatek-jpeg-encoder.yaml |  9 ----
 .../bindings/media/mediatek-mdp.txt           |  8 ----
 arch/arm/boot/dts/mt2701.dtsi                 |  2 -
 arch/arm/boot/dts/mt7623n.dtsi                |  5 ---
 arch/arm64/boot/dts/mediatek/mt8173.dtsi      | 16 -------
 arch/arm64/boot/dts/mediatek/mt8183.dtsi      |  6 ---
 drivers/gpu/drm/mediatek/mtk_disp_ovl.c       |  8 +++-
 drivers/gpu/drm/mediatek/mtk_disp_rdma.c      |  9 +++-
 drivers/gpu/drm/mediatek/mtk_drm_crtc.c       | 15 ++++---
 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c   | 36 +--------------
 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h   |  1 -
 drivers/gpu/drm/mediatek/mtk_drm_drv.c        |  5 +--
 drivers/iommu/mtk_iommu.c                     | 34 ++++++++++++++
 drivers/iommu/mtk_iommu_v1.c                  | 42 ++++++++++++++++-
 .../media/platform/mtk-jpeg/mtk_jpeg_core.c   | 45 +------------------
 .../media/platform/mtk-jpeg/mtk_jpeg_core.h   |  2 -
 drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 40 -----------------
 drivers/media/platform/mtk-mdp/mtk_mdp_comp.h |  2 -
 drivers/media/platform/mtk-mdp/mtk_mdp_core.c |  1 -
 .../platform/mtk-vcodec/mtk_vcodec_dec_drv.c  |  2 -
 .../platform/mtk-vcodec/mtk_vcodec_dec_hw.c   |  1 -
 .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c   | 41 +++--------------
 .../platform/mtk-vcodec/mtk_vcodec_drv.h      |  3 --
 .../platform/mtk-vcodec/mtk_vcodec_enc.c      |  1 -
 .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c  |  2 -
 .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c   | 45 +++----------------
 drivers/memory/mtk-smi.c                      | 14 ------
 include/soc/mediatek/smi.h                    | 20 ---------
 32 files changed, 115 insertions(+), 333 deletions(-)

-- 
2.18.0



^ permalink raw reply	[flat|nested] 105+ messages in thread

* [PATCH v10 00/13] Clean up "mediatek,larb"
@ 2022-01-17  7:04 ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:04 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang, anthony.huang,
	youlin.pei, Evan Green, Eizan Miyamoto, Matthias Kaehlcke,
	linux-arm-kernel, mingyuan.ma, linux-media, devicetree,
	Philipp Zabel, Frank Wunderlich, libo.kang, yi.kuo,
	linux-mediatek, Hsin-Yi Wang, Tiffany Lin,
	AngeloGioacchino Del Regno, anan.sun, srv_heupstream, acourbot,
	linux-kernel, iommu, Daniel Vetter, Robin Murphy

MediaTek IOMMU block diagram always like below:

        M4U
         |
    smi-common
         |
  -------------
  |         |  ...
  |         |
larb1     larb2
  |         |
vdec       venc

All the consumer connect with smi-larb, then connect with smi-common.

When the consumer works, it should enable the smi-larb's power which also
need enable the smi-common's power firstly.

Thus, Firstly, use the device link connect the consumer and the
smi-larbs. then add device link between the smi-larb and smi-common.

After adding the device_link, then "mediatek,larb" property can be removed.
the iommu consumer don't need call the mtk_smi_larb_get/put to enable
the power and clock of smi-larb and smi-common.

Base on the media branch [1] and a jpeg dtbinding patchset[2] that already got
the necessary R-b.

[1] git://linuxtv.org/hverkuil/media_tree.git tags/br-v5.18d
[2] https://lore.kernel.org/linux-mediatek/20211206130425.184420-1-hsinyi@chromium.org/

Change notes:
v10: a) Rebase on the media tree. Respin the "media: mtk-vcodec:" patches.     
     b) Add Joerg's Ack for iommu patches.

v9: https://lore.kernel.org/linux-mediatek/20211112105509.12010-1-yong.wu@mediatek.com/
    1) Add return -ENODEV when the dev is null.
    2) Add more strict about the case that a iommu consume device use the ports in
    different larbs. Don't allow this case.
    3) Remove two codec interface: mtk_vcodec_release_enc/dec_pm since it only has one
    line now.

v8: https://lore.kernel.org/linux-mediatek/20210929013719.25120-1-yong.wu@mediatek.com/
    1) Rebase on v5.15-rc1.
    2) Don't rebase the below mdp patchset that may still need more discuss.
    https://lore.kernel.org/linux-mediatek/20210709022324.1607884-1-eizan@chromium.org/
    3) Add Frank's Tested-by. Remove Dafna's Tested-by as he requested.

v7: https://lore.kernel.org/linux-mediatek/20210730025238.22456-1-yong.wu@mediatek.com/
    1) Fix a arm32 boot fail issue. reported from Frank.
    2) Add a return fail in the mtk drm. suggested by Dafna.

v6: https://lore.kernel.org/linux-mediatek/20210714025626.5528-1-yong.wu@mediatek.com/
    1) rebase on v5.14-rc1.
    2) Fix the issue commented in v5 from Dafna and Hsin-Yi.
    3) Remove the patches about using pm_runtime_resume_and_get since they have
       already been merged by other patches.

v5: https://lore.kernel.org/linux-mediatek/20210410091128.31823-1-yong.wu@mediatek.com/
    1) Base v5.12-rc2.
    2) Remove changing the mtk-iommu to module_platform_driver patch, It have already been a
    independent patch.

v4: https://lore.kernel.org/linux-mediatek/1590826218-23653-1-git-send-email-yong.wu@mediatek.com/ 
    base on v5.7-rc1.
  1) Move drm PM patch before smi patchs.
  2) Change builtin_platform_driver to module_platform_driver since we may need
     build as module.
  3) Rebase many patchset as above.

v3: https://lore.kernel.org/linux-iommu/1567503456-24725-1-git-send-email-yong.wu@mediatek.com/
    1) rebase on v5.3-rc1 and the latest mt8183 patchset.
    2) Use device_is_bound to check whether the driver is ready from Matthias.    
    3) Add DL_FLAG_STATELESS flag when calling device_link_add and explain the
   reason in the commit message[3/14].
    4) Add a display patch[12/14] into this series. otherwise it may affect
   display HW fastlogo even though it don't happen in mt8183.
   
v2: https://lore.kernel.org/linux-iommu/1560171313-28299-1-git-send-email-yong.wu@mediatek.com/
   1) rebase on v5.2-rc1.
   2) Move adding device_link between the consumer and smi-larb into
iommu_add_device from Robin.
   3) add DL_FLAG_AUTOREMOVE_CONSUMER even though the smi is built-in from Evan.
   4) Remove the shutdown callback in iommu.   

v1: https://lore.kernel.org/linux-iommu/1546318276-18993-1-git-send-email-yong.wu@mediatek.com/

Yong Wu (12):
  dt-binding: mediatek: Get rid of mediatek,larb for multimedia HW
  iommu/mediatek-v1: Free the existed fwspec if the master dev already
    has
  iommu/mediatek: Return ENODEV if the device is NULL
  iommu/mediatek: Add probe_defer for smi-larb
  iommu/mediatek: Add device_link between the consumer and the larb
    devices
  media: mtk-jpeg: Get rid of mtk_smi_larb_get/put
  media: mtk-mdp: Get rid of mtk_smi_larb_get/put
  drm/mediatek: Get rid of mtk_smi_larb_get/put
  media: mtk-vcodec: Get rid of mtk_smi_larb_get/put
  memory: mtk-smi: Get rid of mtk_smi_larb_get/put
  arm: dts: mediatek: Get rid of mediatek,larb for MM nodes
  arm64: dts: mediatek: Get rid of mediatek,larb for MM nodes

Yongqiang Niu (1):
  drm/mediatek: Add pm runtime support for ovl and rdma

 .../display/mediatek/mediatek,disp.txt        |  9 ----
 .../media/mediatek,vcodec-decoder.yaml        |  7 ---
 .../media/mediatek,vcodec-encoder.yaml        |  8 ----
 .../bindings/media/mediatek-jpeg-decoder.yaml |  9 ----
 .../bindings/media/mediatek-jpeg-encoder.yaml |  9 ----
 .../bindings/media/mediatek-mdp.txt           |  8 ----
 arch/arm/boot/dts/mt2701.dtsi                 |  2 -
 arch/arm/boot/dts/mt7623n.dtsi                |  5 ---
 arch/arm64/boot/dts/mediatek/mt8173.dtsi      | 16 -------
 arch/arm64/boot/dts/mediatek/mt8183.dtsi      |  6 ---
 drivers/gpu/drm/mediatek/mtk_disp_ovl.c       |  8 +++-
 drivers/gpu/drm/mediatek/mtk_disp_rdma.c      |  9 +++-
 drivers/gpu/drm/mediatek/mtk_drm_crtc.c       | 15 ++++---
 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c   | 36 +--------------
 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h   |  1 -
 drivers/gpu/drm/mediatek/mtk_drm_drv.c        |  5 +--
 drivers/iommu/mtk_iommu.c                     | 34 ++++++++++++++
 drivers/iommu/mtk_iommu_v1.c                  | 42 ++++++++++++++++-
 .../media/platform/mtk-jpeg/mtk_jpeg_core.c   | 45 +------------------
 .../media/platform/mtk-jpeg/mtk_jpeg_core.h   |  2 -
 drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 40 -----------------
 drivers/media/platform/mtk-mdp/mtk_mdp_comp.h |  2 -
 drivers/media/platform/mtk-mdp/mtk_mdp_core.c |  1 -
 .../platform/mtk-vcodec/mtk_vcodec_dec_drv.c  |  2 -
 .../platform/mtk-vcodec/mtk_vcodec_dec_hw.c   |  1 -
 .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c   | 41 +++--------------
 .../platform/mtk-vcodec/mtk_vcodec_drv.h      |  3 --
 .../platform/mtk-vcodec/mtk_vcodec_enc.c      |  1 -
 .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c  |  2 -
 .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c   | 45 +++----------------
 drivers/memory/mtk-smi.c                      | 14 ------
 include/soc/mediatek/smi.h                    | 20 ---------
 32 files changed, 115 insertions(+), 333 deletions(-)

-- 
2.18.0


_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 105+ messages in thread

* [PATCH v10 00/13] Clean up "mediatek,larb"
@ 2022-01-17  7:04 ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:04 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Dafna Hirschfeld, Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang,
	anthony.huang, youlin.pei, Evan Green, Eizan Miyamoto,
	Matthias Kaehlcke, linux-arm-kernel, mingyuan.ma, linux-media,
	devicetree, Philipp Zabel, libo.kang, yi.kuo, linux-mediatek,
	Hsin-Yi Wang, Tiffany Lin, yong.wu, AngeloGioacchino Del Regno,
	anan.sun, srv_heupstream, acourbot, linux-kernel, Tomasz Figa,
	iommu, Daniel Vetter, Robin Murphy

MediaTek IOMMU block diagram always like below:

        M4U
         |
    smi-common
         |
  -------------
  |         |  ...
  |         |
larb1     larb2
  |         |
vdec       venc

All the consumer connect with smi-larb, then connect with smi-common.

When the consumer works, it should enable the smi-larb's power which also
need enable the smi-common's power firstly.

Thus, Firstly, use the device link connect the consumer and the
smi-larbs. then add device link between the smi-larb and smi-common.

After adding the device_link, then "mediatek,larb" property can be removed.
the iommu consumer don't need call the mtk_smi_larb_get/put to enable
the power and clock of smi-larb and smi-common.

Base on the media branch [1] and a jpeg dtbinding patchset[2] that already got
the necessary R-b.

[1] git://linuxtv.org/hverkuil/media_tree.git tags/br-v5.18d
[2] https://lore.kernel.org/linux-mediatek/20211206130425.184420-1-hsinyi@chromium.org/

Change notes:
v10: a) Rebase on the media tree. Respin the "media: mtk-vcodec:" patches.     
     b) Add Joerg's Ack for iommu patches.

v9: https://lore.kernel.org/linux-mediatek/20211112105509.12010-1-yong.wu@mediatek.com/
    1) Add return -ENODEV when the dev is null.
    2) Add more strict about the case that a iommu consume device use the ports in
    different larbs. Don't allow this case.
    3) Remove two codec interface: mtk_vcodec_release_enc/dec_pm since it only has one
    line now.

v8: https://lore.kernel.org/linux-mediatek/20210929013719.25120-1-yong.wu@mediatek.com/
    1) Rebase on v5.15-rc1.
    2) Don't rebase the below mdp patchset that may still need more discuss.
    https://lore.kernel.org/linux-mediatek/20210709022324.1607884-1-eizan@chromium.org/
    3) Add Frank's Tested-by. Remove Dafna's Tested-by as he requested.

v7: https://lore.kernel.org/linux-mediatek/20210730025238.22456-1-yong.wu@mediatek.com/
    1) Fix a arm32 boot fail issue. reported from Frank.
    2) Add a return fail in the mtk drm. suggested by Dafna.

v6: https://lore.kernel.org/linux-mediatek/20210714025626.5528-1-yong.wu@mediatek.com/
    1) rebase on v5.14-rc1.
    2) Fix the issue commented in v5 from Dafna and Hsin-Yi.
    3) Remove the patches about using pm_runtime_resume_and_get since they have
       already been merged by other patches.

v5: https://lore.kernel.org/linux-mediatek/20210410091128.31823-1-yong.wu@mediatek.com/
    1) Base v5.12-rc2.
    2) Remove changing the mtk-iommu to module_platform_driver patch, It have already been a
    independent patch.

v4: https://lore.kernel.org/linux-mediatek/1590826218-23653-1-git-send-email-yong.wu@mediatek.com/ 
    base on v5.7-rc1.
  1) Move drm PM patch before smi patchs.
  2) Change builtin_platform_driver to module_platform_driver since we may need
     build as module.
  3) Rebase many patchset as above.

v3: https://lore.kernel.org/linux-iommu/1567503456-24725-1-git-send-email-yong.wu@mediatek.com/
    1) rebase on v5.3-rc1 and the latest mt8183 patchset.
    2) Use device_is_bound to check whether the driver is ready from Matthias.    
    3) Add DL_FLAG_STATELESS flag when calling device_link_add and explain the
   reason in the commit message[3/14].
    4) Add a display patch[12/14] into this series. otherwise it may affect
   display HW fastlogo even though it don't happen in mt8183.
   
v2: https://lore.kernel.org/linux-iommu/1560171313-28299-1-git-send-email-yong.wu@mediatek.com/
   1) rebase on v5.2-rc1.
   2) Move adding device_link between the consumer and smi-larb into
iommu_add_device from Robin.
   3) add DL_FLAG_AUTOREMOVE_CONSUMER even though the smi is built-in from Evan.
   4) Remove the shutdown callback in iommu.   

v1: https://lore.kernel.org/linux-iommu/1546318276-18993-1-git-send-email-yong.wu@mediatek.com/

Yong Wu (12):
  dt-binding: mediatek: Get rid of mediatek,larb for multimedia HW
  iommu/mediatek-v1: Free the existed fwspec if the master dev already
    has
  iommu/mediatek: Return ENODEV if the device is NULL
  iommu/mediatek: Add probe_defer for smi-larb
  iommu/mediatek: Add device_link between the consumer and the larb
    devices
  media: mtk-jpeg: Get rid of mtk_smi_larb_get/put
  media: mtk-mdp: Get rid of mtk_smi_larb_get/put
  drm/mediatek: Get rid of mtk_smi_larb_get/put
  media: mtk-vcodec: Get rid of mtk_smi_larb_get/put
  memory: mtk-smi: Get rid of mtk_smi_larb_get/put
  arm: dts: mediatek: Get rid of mediatek,larb for MM nodes
  arm64: dts: mediatek: Get rid of mediatek,larb for MM nodes

Yongqiang Niu (1):
  drm/mediatek: Add pm runtime support for ovl and rdma

 .../display/mediatek/mediatek,disp.txt        |  9 ----
 .../media/mediatek,vcodec-decoder.yaml        |  7 ---
 .../media/mediatek,vcodec-encoder.yaml        |  8 ----
 .../bindings/media/mediatek-jpeg-decoder.yaml |  9 ----
 .../bindings/media/mediatek-jpeg-encoder.yaml |  9 ----
 .../bindings/media/mediatek-mdp.txt           |  8 ----
 arch/arm/boot/dts/mt2701.dtsi                 |  2 -
 arch/arm/boot/dts/mt7623n.dtsi                |  5 ---
 arch/arm64/boot/dts/mediatek/mt8173.dtsi      | 16 -------
 arch/arm64/boot/dts/mediatek/mt8183.dtsi      |  6 ---
 drivers/gpu/drm/mediatek/mtk_disp_ovl.c       |  8 +++-
 drivers/gpu/drm/mediatek/mtk_disp_rdma.c      |  9 +++-
 drivers/gpu/drm/mediatek/mtk_drm_crtc.c       | 15 ++++---
 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c   | 36 +--------------
 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h   |  1 -
 drivers/gpu/drm/mediatek/mtk_drm_drv.c        |  5 +--
 drivers/iommu/mtk_iommu.c                     | 34 ++++++++++++++
 drivers/iommu/mtk_iommu_v1.c                  | 42 ++++++++++++++++-
 .../media/platform/mtk-jpeg/mtk_jpeg_core.c   | 45 +------------------
 .../media/platform/mtk-jpeg/mtk_jpeg_core.h   |  2 -
 drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 40 -----------------
 drivers/media/platform/mtk-mdp/mtk_mdp_comp.h |  2 -
 drivers/media/platform/mtk-mdp/mtk_mdp_core.c |  1 -
 .../platform/mtk-vcodec/mtk_vcodec_dec_drv.c  |  2 -
 .../platform/mtk-vcodec/mtk_vcodec_dec_hw.c   |  1 -
 .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c   | 41 +++--------------
 .../platform/mtk-vcodec/mtk_vcodec_drv.h      |  3 --
 .../platform/mtk-vcodec/mtk_vcodec_enc.c      |  1 -
 .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c  |  2 -
 .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c   | 45 +++----------------
 drivers/memory/mtk-smi.c                      | 14 ------
 include/soc/mediatek/smi.h                    | 20 ---------
 32 files changed, 115 insertions(+), 333 deletions(-)

-- 
2.18.0



_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 105+ messages in thread

* [PATCH v10 00/13] Clean up "mediatek,larb"
@ 2022-01-17  7:04 ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:04 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Dafna Hirschfeld, Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang,
	anthony.huang, youlin.pei, Evan Green, Eizan Miyamoto,
	Matthias Kaehlcke, linux-arm-kernel, mingyuan.ma, linux-media,
	devicetree, Frank Wunderlich, libo.kang, yi.kuo, linux-mediatek,
	Hsin-Yi Wang, Tiffany Lin, yong.wu, AngeloGioacchino Del Regno,
	anan.sun, srv_heupstream, acourbot, linux-kernel, Tomasz Figa,
	iommu, Robin Murphy

MediaTek IOMMU block diagram always like below:

        M4U
         |
    smi-common
         |
  -------------
  |         |  ...
  |         |
larb1     larb2
  |         |
vdec       venc

All the consumer connect with smi-larb, then connect with smi-common.

When the consumer works, it should enable the smi-larb's power which also
need enable the smi-common's power firstly.

Thus, Firstly, use the device link connect the consumer and the
smi-larbs. then add device link between the smi-larb and smi-common.

After adding the device_link, then "mediatek,larb" property can be removed.
the iommu consumer don't need call the mtk_smi_larb_get/put to enable
the power and clock of smi-larb and smi-common.

Base on the media branch [1] and a jpeg dtbinding patchset[2] that already got
the necessary R-b.

[1] git://linuxtv.org/hverkuil/media_tree.git tags/br-v5.18d
[2] https://lore.kernel.org/linux-mediatek/20211206130425.184420-1-hsinyi@chromium.org/

Change notes:
v10: a) Rebase on the media tree. Respin the "media: mtk-vcodec:" patches.     
     b) Add Joerg's Ack for iommu patches.

v9: https://lore.kernel.org/linux-mediatek/20211112105509.12010-1-yong.wu@mediatek.com/
    1) Add return -ENODEV when the dev is null.
    2) Add more strict about the case that a iommu consume device use the ports in
    different larbs. Don't allow this case.
    3) Remove two codec interface: mtk_vcodec_release_enc/dec_pm since it only has one
    line now.

v8: https://lore.kernel.org/linux-mediatek/20210929013719.25120-1-yong.wu@mediatek.com/
    1) Rebase on v5.15-rc1.
    2) Don't rebase the below mdp patchset that may still need more discuss.
    https://lore.kernel.org/linux-mediatek/20210709022324.1607884-1-eizan@chromium.org/
    3) Add Frank's Tested-by. Remove Dafna's Tested-by as he requested.

v7: https://lore.kernel.org/linux-mediatek/20210730025238.22456-1-yong.wu@mediatek.com/
    1) Fix a arm32 boot fail issue. reported from Frank.
    2) Add a return fail in the mtk drm. suggested by Dafna.

v6: https://lore.kernel.org/linux-mediatek/20210714025626.5528-1-yong.wu@mediatek.com/
    1) rebase on v5.14-rc1.
    2) Fix the issue commented in v5 from Dafna and Hsin-Yi.
    3) Remove the patches about using pm_runtime_resume_and_get since they have
       already been merged by other patches.

v5: https://lore.kernel.org/linux-mediatek/20210410091128.31823-1-yong.wu@mediatek.com/
    1) Base v5.12-rc2.
    2) Remove changing the mtk-iommu to module_platform_driver patch, It have already been a
    independent patch.

v4: https://lore.kernel.org/linux-mediatek/1590826218-23653-1-git-send-email-yong.wu@mediatek.com/ 
    base on v5.7-rc1.
  1) Move drm PM patch before smi patchs.
  2) Change builtin_platform_driver to module_platform_driver since we may need
     build as module.
  3) Rebase many patchset as above.

v3: https://lore.kernel.org/linux-iommu/1567503456-24725-1-git-send-email-yong.wu@mediatek.com/
    1) rebase on v5.3-rc1 and the latest mt8183 patchset.
    2) Use device_is_bound to check whether the driver is ready from Matthias.    
    3) Add DL_FLAG_STATELESS flag when calling device_link_add and explain the
   reason in the commit message[3/14].
    4) Add a display patch[12/14] into this series. otherwise it may affect
   display HW fastlogo even though it don't happen in mt8183.
   
v2: https://lore.kernel.org/linux-iommu/1560171313-28299-1-git-send-email-yong.wu@mediatek.com/
   1) rebase on v5.2-rc1.
   2) Move adding device_link between the consumer and smi-larb into
iommu_add_device from Robin.
   3) add DL_FLAG_AUTOREMOVE_CONSUMER even though the smi is built-in from Evan.
   4) Remove the shutdown callback in iommu.   

v1: https://lore.kernel.org/linux-iommu/1546318276-18993-1-git-send-email-yong.wu@mediatek.com/

Yong Wu (12):
  dt-binding: mediatek: Get rid of mediatek,larb for multimedia HW
  iommu/mediatek-v1: Free the existed fwspec if the master dev already
    has
  iommu/mediatek: Return ENODEV if the device is NULL
  iommu/mediatek: Add probe_defer for smi-larb
  iommu/mediatek: Add device_link between the consumer and the larb
    devices
  media: mtk-jpeg: Get rid of mtk_smi_larb_get/put
  media: mtk-mdp: Get rid of mtk_smi_larb_get/put
  drm/mediatek: Get rid of mtk_smi_larb_get/put
  media: mtk-vcodec: Get rid of mtk_smi_larb_get/put
  memory: mtk-smi: Get rid of mtk_smi_larb_get/put
  arm: dts: mediatek: Get rid of mediatek,larb for MM nodes
  arm64: dts: mediatek: Get rid of mediatek,larb for MM nodes

Yongqiang Niu (1):
  drm/mediatek: Add pm runtime support for ovl and rdma

 .../display/mediatek/mediatek,disp.txt        |  9 ----
 .../media/mediatek,vcodec-decoder.yaml        |  7 ---
 .../media/mediatek,vcodec-encoder.yaml        |  8 ----
 .../bindings/media/mediatek-jpeg-decoder.yaml |  9 ----
 .../bindings/media/mediatek-jpeg-encoder.yaml |  9 ----
 .../bindings/media/mediatek-mdp.txt           |  8 ----
 arch/arm/boot/dts/mt2701.dtsi                 |  2 -
 arch/arm/boot/dts/mt7623n.dtsi                |  5 ---
 arch/arm64/boot/dts/mediatek/mt8173.dtsi      | 16 -------
 arch/arm64/boot/dts/mediatek/mt8183.dtsi      |  6 ---
 drivers/gpu/drm/mediatek/mtk_disp_ovl.c       |  8 +++-
 drivers/gpu/drm/mediatek/mtk_disp_rdma.c      |  9 +++-
 drivers/gpu/drm/mediatek/mtk_drm_crtc.c       | 15 ++++---
 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c   | 36 +--------------
 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h   |  1 -
 drivers/gpu/drm/mediatek/mtk_drm_drv.c        |  5 +--
 drivers/iommu/mtk_iommu.c                     | 34 ++++++++++++++
 drivers/iommu/mtk_iommu_v1.c                  | 42 ++++++++++++++++-
 .../media/platform/mtk-jpeg/mtk_jpeg_core.c   | 45 +------------------
 .../media/platform/mtk-jpeg/mtk_jpeg_core.h   |  2 -
 drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 40 -----------------
 drivers/media/platform/mtk-mdp/mtk_mdp_comp.h |  2 -
 drivers/media/platform/mtk-mdp/mtk_mdp_core.c |  1 -
 .../platform/mtk-vcodec/mtk_vcodec_dec_drv.c  |  2 -
 .../platform/mtk-vcodec/mtk_vcodec_dec_hw.c   |  1 -
 .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c   | 41 +++--------------
 .../platform/mtk-vcodec/mtk_vcodec_drv.h      |  3 --
 .../platform/mtk-vcodec/mtk_vcodec_enc.c      |  1 -
 .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c  |  2 -
 .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c   | 45 +++----------------
 drivers/memory/mtk-smi.c                      | 14 ------
 include/soc/mediatek/smi.h                    | 20 ---------
 32 files changed, 115 insertions(+), 333 deletions(-)

-- 
2.18.0



^ permalink raw reply	[flat|nested] 105+ messages in thread

* [PATCH v10 00/13] Clean up "mediatek,larb"
@ 2022-01-17  7:04 ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:04 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Evan Green, Robin Murphy, Tomasz Figa, Will Deacon,
	linux-mediatek, srv_heupstream, devicetree, linux-kernel,
	linux-arm-kernel, iommu, yong.wu, youlin.pei, Matthias Kaehlcke,
	anan.sun, yi.kuo, acourbot, linux-media, dri-devel,
	Daniel Vetter, Chun-Kuang Hu, Philipp Zabel, Tiffany Lin,
	Dafna Hirschfeld, Hsin-Yi Wang, Eizan Miyamoto, anthony.huang,
	Frank Wunderlich, mingyuan.ma, yf.wang, libo.kang,
	AngeloGioacchino Del Regno

MediaTek IOMMU block diagram always like below:

        M4U
         |
    smi-common
         |
  -------------
  |         |  ...
  |         |
larb1     larb2
  |         |
vdec       venc

All the consumer connect with smi-larb, then connect with smi-common.

When the consumer works, it should enable the smi-larb's power which also
need enable the smi-common's power firstly.

Thus, Firstly, use the device link connect the consumer and the
smi-larbs. then add device link between the smi-larb and smi-common.

After adding the device_link, then "mediatek,larb" property can be removed.
the iommu consumer don't need call the mtk_smi_larb_get/put to enable
the power and clock of smi-larb and smi-common.

Base on the media branch [1] and a jpeg dtbinding patchset[2] that already got
the necessary R-b.

[1] git://linuxtv.org/hverkuil/media_tree.git tags/br-v5.18d
[2] https://lore.kernel.org/linux-mediatek/20211206130425.184420-1-hsinyi@chromium.org/

Change notes:
v10: a) Rebase on the media tree. Respin the "media: mtk-vcodec:" patches.     
     b) Add Joerg's Ack for iommu patches.

v9: https://lore.kernel.org/linux-mediatek/20211112105509.12010-1-yong.wu@mediatek.com/
    1) Add return -ENODEV when the dev is null.
    2) Add more strict about the case that a iommu consume device use the ports in
    different larbs. Don't allow this case.
    3) Remove two codec interface: mtk_vcodec_release_enc/dec_pm since it only has one
    line now.

v8: https://lore.kernel.org/linux-mediatek/20210929013719.25120-1-yong.wu@mediatek.com/
    1) Rebase on v5.15-rc1.
    2) Don't rebase the below mdp patchset that may still need more discuss.
    https://lore.kernel.org/linux-mediatek/20210709022324.1607884-1-eizan@chromium.org/
    3) Add Frank's Tested-by. Remove Dafna's Tested-by as he requested.

v7: https://lore.kernel.org/linux-mediatek/20210730025238.22456-1-yong.wu@mediatek.com/
    1) Fix a arm32 boot fail issue. reported from Frank.
    2) Add a return fail in the mtk drm. suggested by Dafna.

v6: https://lore.kernel.org/linux-mediatek/20210714025626.5528-1-yong.wu@mediatek.com/
    1) rebase on v5.14-rc1.
    2) Fix the issue commented in v5 from Dafna and Hsin-Yi.
    3) Remove the patches about using pm_runtime_resume_and_get since they have
       already been merged by other patches.

v5: https://lore.kernel.org/linux-mediatek/20210410091128.31823-1-yong.wu@mediatek.com/
    1) Base v5.12-rc2.
    2) Remove changing the mtk-iommu to module_platform_driver patch, It have already been a
    independent patch.

v4: https://lore.kernel.org/linux-mediatek/1590826218-23653-1-git-send-email-yong.wu@mediatek.com/ 
    base on v5.7-rc1.
  1) Move drm PM patch before smi patchs.
  2) Change builtin_platform_driver to module_platform_driver since we may need
     build as module.
  3) Rebase many patchset as above.

v3: https://lore.kernel.org/linux-iommu/1567503456-24725-1-git-send-email-yong.wu@mediatek.com/
    1) rebase on v5.3-rc1 and the latest mt8183 patchset.
    2) Use device_is_bound to check whether the driver is ready from Matthias.    
    3) Add DL_FLAG_STATELESS flag when calling device_link_add and explain the
   reason in the commit message[3/14].
    4) Add a display patch[12/14] into this series. otherwise it may affect
   display HW fastlogo even though it don't happen in mt8183.
   
v2: https://lore.kernel.org/linux-iommu/1560171313-28299-1-git-send-email-yong.wu@mediatek.com/
   1) rebase on v5.2-rc1.
   2) Move adding device_link between the consumer and smi-larb into
iommu_add_device from Robin.
   3) add DL_FLAG_AUTOREMOVE_CONSUMER even though the smi is built-in from Evan.
   4) Remove the shutdown callback in iommu.   

v1: https://lore.kernel.org/linux-iommu/1546318276-18993-1-git-send-email-yong.wu@mediatek.com/

Yong Wu (12):
  dt-binding: mediatek: Get rid of mediatek,larb for multimedia HW
  iommu/mediatek-v1: Free the existed fwspec if the master dev already
    has
  iommu/mediatek: Return ENODEV if the device is NULL
  iommu/mediatek: Add probe_defer for smi-larb
  iommu/mediatek: Add device_link between the consumer and the larb
    devices
  media: mtk-jpeg: Get rid of mtk_smi_larb_get/put
  media: mtk-mdp: Get rid of mtk_smi_larb_get/put
  drm/mediatek: Get rid of mtk_smi_larb_get/put
  media: mtk-vcodec: Get rid of mtk_smi_larb_get/put
  memory: mtk-smi: Get rid of mtk_smi_larb_get/put
  arm: dts: mediatek: Get rid of mediatek,larb for MM nodes
  arm64: dts: mediatek: Get rid of mediatek,larb for MM nodes

Yongqiang Niu (1):
  drm/mediatek: Add pm runtime support for ovl and rdma

 .../display/mediatek/mediatek,disp.txt        |  9 ----
 .../media/mediatek,vcodec-decoder.yaml        |  7 ---
 .../media/mediatek,vcodec-encoder.yaml        |  8 ----
 .../bindings/media/mediatek-jpeg-decoder.yaml |  9 ----
 .../bindings/media/mediatek-jpeg-encoder.yaml |  9 ----
 .../bindings/media/mediatek-mdp.txt           |  8 ----
 arch/arm/boot/dts/mt2701.dtsi                 |  2 -
 arch/arm/boot/dts/mt7623n.dtsi                |  5 ---
 arch/arm64/boot/dts/mediatek/mt8173.dtsi      | 16 -------
 arch/arm64/boot/dts/mediatek/mt8183.dtsi      |  6 ---
 drivers/gpu/drm/mediatek/mtk_disp_ovl.c       |  8 +++-
 drivers/gpu/drm/mediatek/mtk_disp_rdma.c      |  9 +++-
 drivers/gpu/drm/mediatek/mtk_drm_crtc.c       | 15 ++++---
 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c   | 36 +--------------
 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h   |  1 -
 drivers/gpu/drm/mediatek/mtk_drm_drv.c        |  5 +--
 drivers/iommu/mtk_iommu.c                     | 34 ++++++++++++++
 drivers/iommu/mtk_iommu_v1.c                  | 42 ++++++++++++++++-
 .../media/platform/mtk-jpeg/mtk_jpeg_core.c   | 45 +------------------
 .../media/platform/mtk-jpeg/mtk_jpeg_core.h   |  2 -
 drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 40 -----------------
 drivers/media/platform/mtk-mdp/mtk_mdp_comp.h |  2 -
 drivers/media/platform/mtk-mdp/mtk_mdp_core.c |  1 -
 .../platform/mtk-vcodec/mtk_vcodec_dec_drv.c  |  2 -
 .../platform/mtk-vcodec/mtk_vcodec_dec_hw.c   |  1 -
 .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c   | 41 +++--------------
 .../platform/mtk-vcodec/mtk_vcodec_drv.h      |  3 --
 .../platform/mtk-vcodec/mtk_vcodec_enc.c      |  1 -
 .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c  |  2 -
 .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c   | 45 +++----------------
 drivers/memory/mtk-smi.c                      | 14 ------
 include/soc/mediatek/smi.h                    | 20 ---------
 32 files changed, 115 insertions(+), 333 deletions(-)

-- 
2.18.0



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 105+ messages in thread

* [PATCH v10 01/13] dt-binding: mediatek: Get rid of mediatek,larb for multimedia HW
  2022-01-17  7:04 ` Yong Wu
                     ` (2 preceding siblings ...)
  (?)
@ 2022-01-17  7:04   ` Yong Wu
  -1 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:04 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Evan Green, Robin Murphy, Tomasz Figa, Will Deacon,
	linux-mediatek, srv_heupstream, devicetree, linux-kernel,
	linux-arm-kernel, iommu, yong.wu, youlin.pei, Matthias Kaehlcke,
	anan.sun, yi.kuo, acourbot, linux-media, dri-devel,
	Daniel Vetter, Chun-Kuang Hu, Philipp Zabel, Tiffany Lin,
	Dafna Hirschfeld, Hsin-Yi Wang, Eizan Miyamoto, anthony.huang,
	Frank Wunderlich, mingyuan.ma, yf.wang, libo.kang,
	AngeloGioacchino Del Regno

After adding device_link between the consumer with the smi-larbs,
if the consumer call its owner pm_runtime_get(_sync), the
pm_runtime_get(_sync) of smi-larb and smi-common will be called
automatically. Thus, the consumer don't need this property.

And IOMMU also know which larb this consumer connects with from
iommu id in the "iommus=" property.

Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Evan Green <evgreen@chromium.org>
Acked-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 .../bindings/display/mediatek/mediatek,disp.txt          | 9 ---------
 .../bindings/media/mediatek,vcodec-decoder.yaml          | 7 -------
 .../bindings/media/mediatek,vcodec-encoder.yaml          | 8 --------
 .../devicetree/bindings/media/mediatek-jpeg-decoder.yaml | 9 ---------
 .../devicetree/bindings/media/mediatek-jpeg-encoder.yaml | 9 ---------
 Documentation/devicetree/bindings/media/mediatek-mdp.txt | 8 --------
 6 files changed, 50 deletions(-)

diff --git a/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt b/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt
index 78044c340e20..8b575e11bcec 100644
--- a/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt
+++ b/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt
@@ -61,8 +61,6 @@ Required properties (DMA function blocks):
 	"mediatek,<chip>-disp-rdma"
 	"mediatek,<chip>-disp-wdma"
   the supported chips are mt2701, mt8167 and mt8173.
-- larb: Should contain a phandle pointing to the local arbiter device as defined
-  in Documentation/devicetree/bindings/memory-controllers/mediatek,smi-larb.yaml
 - iommus: Should point to the respective IOMMU block with master port as
   argument, see Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml
   for details.
@@ -91,7 +89,6 @@ ovl0: ovl@1400c000 {
 	power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 	clocks = <&mmsys CLK_MM_DISP_OVL0>;
 	iommus = <&iommu M4U_PORT_DISP_OVL0>;
-	mediatek,larb = <&larb0>;
 };
 
 ovl1: ovl@1400d000 {
@@ -101,7 +98,6 @@ ovl1: ovl@1400d000 {
 	power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 	clocks = <&mmsys CLK_MM_DISP_OVL1>;
 	iommus = <&iommu M4U_PORT_DISP_OVL1>;
-	mediatek,larb = <&larb4>;
 };
 
 rdma0: rdma@1400e000 {
@@ -111,7 +107,6 @@ rdma0: rdma@1400e000 {
 	power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 	clocks = <&mmsys CLK_MM_DISP_RDMA0>;
 	iommus = <&iommu M4U_PORT_DISP_RDMA0>;
-	mediatek,larb = <&larb0>;
 	mediatek,rdma-fifosize = <8192>;
 };
 
@@ -122,7 +117,6 @@ rdma1: rdma@1400f000 {
 	power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 	clocks = <&mmsys CLK_MM_DISP_RDMA1>;
 	iommus = <&iommu M4U_PORT_DISP_RDMA1>;
-	mediatek,larb = <&larb4>;
 };
 
 rdma2: rdma@14010000 {
@@ -132,7 +126,6 @@ rdma2: rdma@14010000 {
 	power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 	clocks = <&mmsys CLK_MM_DISP_RDMA2>;
 	iommus = <&iommu M4U_PORT_DISP_RDMA2>;
-	mediatek,larb = <&larb4>;
 };
 
 wdma0: wdma@14011000 {
@@ -142,7 +135,6 @@ wdma0: wdma@14011000 {
 	power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 	clocks = <&mmsys CLK_MM_DISP_WDMA0>;
 	iommus = <&iommu M4U_PORT_DISP_WDMA0>;
-	mediatek,larb = <&larb0>;
 };
 
 wdma1: wdma@14012000 {
@@ -152,7 +144,6 @@ wdma1: wdma@14012000 {
 	power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 	clocks = <&mmsys CLK_MM_DISP_WDMA1>;
 	iommus = <&iommu M4U_PORT_DISP_WDMA1>;
-	mediatek,larb = <&larb4>;
 };
 
 color0: color@14013000 {
diff --git a/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml b/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
index df1d677098fd..9b179bb44dfb 100644
--- a/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
+++ b/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
@@ -61,12 +61,6 @@ properties:
     description: |
       Describes the physical address space of IOMMU maps to memory.
 
-  mediatek,larb:
-    $ref: /schemas/types.yaml#/definitions/phandle
-    maxItems: 1
-    description: |
-      Must contain the local arbiters in the current Socs.
-
   mediatek,vpu:
     $ref: /schemas/types.yaml#/definitions/phandle
     maxItems: 1
@@ -137,7 +131,6 @@ examples:
           <0x16027800 0x800>,   /*VP8_VL*/
           <0x16028400 0x400>;   /*VP9_VD*/
       interrupts = <GIC_SPI 204 IRQ_TYPE_LEVEL_LOW>;
-      mediatek,larb = <&larb1>;
       iommus = <&iommu M4U_PORT_HW_VDEC_MC_EXT>,
              <&iommu M4U_PORT_HW_VDEC_PP_EXT>,
              <&iommu M4U_PORT_HW_VDEC_AVC_MV_EXT>,
diff --git a/Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml b/Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml
index b72c1a50e89e..e7b65a91c92c 100644
--- a/Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml
+++ b/Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml
@@ -53,12 +53,6 @@ properties:
     description: |
       Describes the physical address space of IOMMU maps to memory.
 
-  mediatek,larb:
-    $ref: /schemas/types.yaml#/definitions/phandle
-    maxItems: 1
-    description: |
-      Must contain the local arbiters in the current Socs.
-
   mediatek,vpu:
     $ref: /schemas/types.yaml#/definitions/phandle
     maxItems: 1
@@ -157,7 +151,6 @@ examples:
              <&iommu M4U_PORT_VENC_REF_CHROMA>,
              <&iommu M4U_PORT_VENC_NBM_RDMA>,
              <&iommu M4U_PORT_VENC_NBM_WDMA>;
-      mediatek,larb = <&larb3>;
       mediatek,vpu = <&vpu>;
       clocks = <&topckgen CLK_TOP_VENC_SEL>;
       clock-names = "venc_sel";
@@ -178,7 +171,6 @@ examples:
              <&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";
diff --git a/Documentation/devicetree/bindings/media/mediatek-jpeg-decoder.yaml b/Documentation/devicetree/bindings/media/mediatek-jpeg-decoder.yaml
index 9b87f036f178..052e752157b4 100644
--- a/Documentation/devicetree/bindings/media/mediatek-jpeg-decoder.yaml
+++ b/Documentation/devicetree/bindings/media/mediatek-jpeg-decoder.yaml
@@ -42,13 +42,6 @@ properties:
   power-domains:
     maxItems: 1
 
-  mediatek,larb:
-    $ref: '/schemas/types.yaml#/definitions/phandle'
-    description: |
-      Must contain the local arbiters in the current Socs, see
-      Documentation/devicetree/bindings/memory-controllers/mediatek,smi-larb.yaml
-      for details.
-
   iommus:
     maxItems: 2
     description: |
@@ -63,7 +56,6 @@ required:
   - clocks
   - clock-names
   - power-domains
-  - mediatek,larb
   - iommus
 
 additionalProperties: false
@@ -83,7 +75,6 @@ examples:
       clock-names = "jpgdec-smi",
                     "jpgdec";
       power-domains = <&scpsys MT2701_POWER_DOMAIN_ISP>;
-      mediatek,larb = <&larb2>;
       iommus = <&iommu MT2701_M4U_PORT_JPGDEC_WDMA>,
                <&iommu MT2701_M4U_PORT_JPGDEC_BSDMA>;
     };
diff --git a/Documentation/devicetree/bindings/media/mediatek-jpeg-encoder.yaml b/Documentation/devicetree/bindings/media/mediatek-jpeg-encoder.yaml
index fcd9b829e036..8bfdfdfaba59 100644
--- a/Documentation/devicetree/bindings/media/mediatek-jpeg-encoder.yaml
+++ b/Documentation/devicetree/bindings/media/mediatek-jpeg-encoder.yaml
@@ -35,13 +35,6 @@ properties:
   power-domains:
     maxItems: 1
 
-  mediatek,larb:
-    $ref: '/schemas/types.yaml#/definitions/phandle'
-    description: |
-      Must contain the local arbiters in the current Socs, see
-      Documentation/devicetree/bindings/memory-controllers/mediatek,smi-larb.yaml
-      for details.
-
   iommus:
     maxItems: 2
     description: |
@@ -56,7 +49,6 @@ required:
   - clocks
   - clock-names
   - power-domains
-  - mediatek,larb
   - iommus
 
 additionalProperties: false
@@ -75,7 +67,6 @@ examples:
       clocks =  <&imgsys CLK_IMG_VENC>;
       clock-names = "jpgenc";
       power-domains = <&scpsys MT2701_POWER_DOMAIN_ISP>;
-      mediatek,larb = <&larb2>;
       iommus = <&iommu MT2701_M4U_PORT_JPGENC_RDMA>,
                <&iommu MT2701_M4U_PORT_JPGENC_BSDMA>;
     };
diff --git a/Documentation/devicetree/bindings/media/mediatek-mdp.txt b/Documentation/devicetree/bindings/media/mediatek-mdp.txt
index caa24943da33..53ef26e2c857 100644
--- a/Documentation/devicetree/bindings/media/mediatek-mdp.txt
+++ b/Documentation/devicetree/bindings/media/mediatek-mdp.txt
@@ -27,9 +27,6 @@ Required properties (DMA function blocks, child node):
 - iommus: should point to the respective IOMMU block with master port as
   argument, see Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml
   for details.
-- mediatek,larb: must contain the local arbiters in the current Socs, see
-  Documentation/devicetree/bindings/memory-controllers/mediatek,smi-larb.yaml
-  for details.
 
 Example:
 	mdp_rdma0: rdma@14001000 {
@@ -40,7 +37,6 @@ Example:
 			 <&mmsys CLK_MM_MUTEX_32K>;
 		power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 		iommus = <&iommu M4U_PORT_MDP_RDMA0>;
-		mediatek,larb = <&larb0>;
 		mediatek,vpu = <&vpu>;
 	};
 
@@ -51,7 +47,6 @@ Example:
 			 <&mmsys CLK_MM_MUTEX_32K>;
 		power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 		iommus = <&iommu M4U_PORT_MDP_RDMA1>;
-		mediatek,larb = <&larb4>;
 	};
 
 	mdp_rsz0: rsz@14003000 {
@@ -81,7 +76,6 @@ Example:
 		clocks = <&mmsys CLK_MM_MDP_WDMA>;
 		power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 		iommus = <&iommu M4U_PORT_MDP_WDMA>;
-		mediatek,larb = <&larb0>;
 	};
 
 	mdp_wrot0: wrot@14007000 {
@@ -90,7 +84,6 @@ Example:
 		clocks = <&mmsys CLK_MM_MDP_WROT0>;
 		power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 		iommus = <&iommu M4U_PORT_MDP_WROT0>;
-		mediatek,larb = <&larb0>;
 	};
 
 	mdp_wrot1: wrot@14008000 {
@@ -99,5 +92,4 @@ Example:
 		clocks = <&mmsys CLK_MM_MDP_WROT1>;
 		power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 		iommus = <&iommu M4U_PORT_MDP_WROT1>;
-		mediatek,larb = <&larb4>;
 	};
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 01/13] dt-binding: mediatek: Get rid of mediatek, larb for multimedia HW
@ 2022-01-17  7:04   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:04 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang, anthony.huang,
	youlin.pei, Evan Green, Eizan Miyamoto, Matthias Kaehlcke,
	linux-arm-kernel, mingyuan.ma, linux-media, devicetree,
	Philipp Zabel, Frank Wunderlich, libo.kang, yi.kuo,
	linux-mediatek, Hsin-Yi Wang, Tiffany Lin,
	AngeloGioacchino Del Regno, anan.sun, srv_heupstream, acourbot,
	linux-kernel, iommu, Daniel Vetter, Robin Murphy

After adding device_link between the consumer with the smi-larbs,
if the consumer call its owner pm_runtime_get(_sync), the
pm_runtime_get(_sync) of smi-larb and smi-common will be called
automatically. Thus, the consumer don't need this property.

And IOMMU also know which larb this consumer connects with from
iommu id in the "iommus=" property.

Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Evan Green <evgreen@chromium.org>
Acked-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 .../bindings/display/mediatek/mediatek,disp.txt          | 9 ---------
 .../bindings/media/mediatek,vcodec-decoder.yaml          | 7 -------
 .../bindings/media/mediatek,vcodec-encoder.yaml          | 8 --------
 .../devicetree/bindings/media/mediatek-jpeg-decoder.yaml | 9 ---------
 .../devicetree/bindings/media/mediatek-jpeg-encoder.yaml | 9 ---------
 Documentation/devicetree/bindings/media/mediatek-mdp.txt | 8 --------
 6 files changed, 50 deletions(-)

diff --git a/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt b/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt
index 78044c340e20..8b575e11bcec 100644
--- a/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt
+++ b/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt
@@ -61,8 +61,6 @@ Required properties (DMA function blocks):
 	"mediatek,<chip>-disp-rdma"
 	"mediatek,<chip>-disp-wdma"
   the supported chips are mt2701, mt8167 and mt8173.
-- larb: Should contain a phandle pointing to the local arbiter device as defined
-  in Documentation/devicetree/bindings/memory-controllers/mediatek,smi-larb.yaml
 - iommus: Should point to the respective IOMMU block with master port as
   argument, see Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml
   for details.
@@ -91,7 +89,6 @@ ovl0: ovl@1400c000 {
 	power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 	clocks = <&mmsys CLK_MM_DISP_OVL0>;
 	iommus = <&iommu M4U_PORT_DISP_OVL0>;
-	mediatek,larb = <&larb0>;
 };
 
 ovl1: ovl@1400d000 {
@@ -101,7 +98,6 @@ ovl1: ovl@1400d000 {
 	power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 	clocks = <&mmsys CLK_MM_DISP_OVL1>;
 	iommus = <&iommu M4U_PORT_DISP_OVL1>;
-	mediatek,larb = <&larb4>;
 };
 
 rdma0: rdma@1400e000 {
@@ -111,7 +107,6 @@ rdma0: rdma@1400e000 {
 	power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 	clocks = <&mmsys CLK_MM_DISP_RDMA0>;
 	iommus = <&iommu M4U_PORT_DISP_RDMA0>;
-	mediatek,larb = <&larb0>;
 	mediatek,rdma-fifosize = <8192>;
 };
 
@@ -122,7 +117,6 @@ rdma1: rdma@1400f000 {
 	power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 	clocks = <&mmsys CLK_MM_DISP_RDMA1>;
 	iommus = <&iommu M4U_PORT_DISP_RDMA1>;
-	mediatek,larb = <&larb4>;
 };
 
 rdma2: rdma@14010000 {
@@ -132,7 +126,6 @@ rdma2: rdma@14010000 {
 	power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 	clocks = <&mmsys CLK_MM_DISP_RDMA2>;
 	iommus = <&iommu M4U_PORT_DISP_RDMA2>;
-	mediatek,larb = <&larb4>;
 };
 
 wdma0: wdma@14011000 {
@@ -142,7 +135,6 @@ wdma0: wdma@14011000 {
 	power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 	clocks = <&mmsys CLK_MM_DISP_WDMA0>;
 	iommus = <&iommu M4U_PORT_DISP_WDMA0>;
-	mediatek,larb = <&larb0>;
 };
 
 wdma1: wdma@14012000 {
@@ -152,7 +144,6 @@ wdma1: wdma@14012000 {
 	power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 	clocks = <&mmsys CLK_MM_DISP_WDMA1>;
 	iommus = <&iommu M4U_PORT_DISP_WDMA1>;
-	mediatek,larb = <&larb4>;
 };
 
 color0: color@14013000 {
diff --git a/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml b/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
index df1d677098fd..9b179bb44dfb 100644
--- a/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
+++ b/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
@@ -61,12 +61,6 @@ properties:
     description: |
       Describes the physical address space of IOMMU maps to memory.
 
-  mediatek,larb:
-    $ref: /schemas/types.yaml#/definitions/phandle
-    maxItems: 1
-    description: |
-      Must contain the local arbiters in the current Socs.
-
   mediatek,vpu:
     $ref: /schemas/types.yaml#/definitions/phandle
     maxItems: 1
@@ -137,7 +131,6 @@ examples:
           <0x16027800 0x800>,   /*VP8_VL*/
           <0x16028400 0x400>;   /*VP9_VD*/
       interrupts = <GIC_SPI 204 IRQ_TYPE_LEVEL_LOW>;
-      mediatek,larb = <&larb1>;
       iommus = <&iommu M4U_PORT_HW_VDEC_MC_EXT>,
              <&iommu M4U_PORT_HW_VDEC_PP_EXT>,
              <&iommu M4U_PORT_HW_VDEC_AVC_MV_EXT>,
diff --git a/Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml b/Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml
index b72c1a50e89e..e7b65a91c92c 100644
--- a/Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml
+++ b/Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml
@@ -53,12 +53,6 @@ properties:
     description: |
       Describes the physical address space of IOMMU maps to memory.
 
-  mediatek,larb:
-    $ref: /schemas/types.yaml#/definitions/phandle
-    maxItems: 1
-    description: |
-      Must contain the local arbiters in the current Socs.
-
   mediatek,vpu:
     $ref: /schemas/types.yaml#/definitions/phandle
     maxItems: 1
@@ -157,7 +151,6 @@ examples:
              <&iommu M4U_PORT_VENC_REF_CHROMA>,
              <&iommu M4U_PORT_VENC_NBM_RDMA>,
              <&iommu M4U_PORT_VENC_NBM_WDMA>;
-      mediatek,larb = <&larb3>;
       mediatek,vpu = <&vpu>;
       clocks = <&topckgen CLK_TOP_VENC_SEL>;
       clock-names = "venc_sel";
@@ -178,7 +171,6 @@ examples:
              <&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";
diff --git a/Documentation/devicetree/bindings/media/mediatek-jpeg-decoder.yaml b/Documentation/devicetree/bindings/media/mediatek-jpeg-decoder.yaml
index 9b87f036f178..052e752157b4 100644
--- a/Documentation/devicetree/bindings/media/mediatek-jpeg-decoder.yaml
+++ b/Documentation/devicetree/bindings/media/mediatek-jpeg-decoder.yaml
@@ -42,13 +42,6 @@ properties:
   power-domains:
     maxItems: 1
 
-  mediatek,larb:
-    $ref: '/schemas/types.yaml#/definitions/phandle'
-    description: |
-      Must contain the local arbiters in the current Socs, see
-      Documentation/devicetree/bindings/memory-controllers/mediatek,smi-larb.yaml
-      for details.
-
   iommus:
     maxItems: 2
     description: |
@@ -63,7 +56,6 @@ required:
   - clocks
   - clock-names
   - power-domains
-  - mediatek,larb
   - iommus
 
 additionalProperties: false
@@ -83,7 +75,6 @@ examples:
       clock-names = "jpgdec-smi",
                     "jpgdec";
       power-domains = <&scpsys MT2701_POWER_DOMAIN_ISP>;
-      mediatek,larb = <&larb2>;
       iommus = <&iommu MT2701_M4U_PORT_JPGDEC_WDMA>,
                <&iommu MT2701_M4U_PORT_JPGDEC_BSDMA>;
     };
diff --git a/Documentation/devicetree/bindings/media/mediatek-jpeg-encoder.yaml b/Documentation/devicetree/bindings/media/mediatek-jpeg-encoder.yaml
index fcd9b829e036..8bfdfdfaba59 100644
--- a/Documentation/devicetree/bindings/media/mediatek-jpeg-encoder.yaml
+++ b/Documentation/devicetree/bindings/media/mediatek-jpeg-encoder.yaml
@@ -35,13 +35,6 @@ properties:
   power-domains:
     maxItems: 1
 
-  mediatek,larb:
-    $ref: '/schemas/types.yaml#/definitions/phandle'
-    description: |
-      Must contain the local arbiters in the current Socs, see
-      Documentation/devicetree/bindings/memory-controllers/mediatek,smi-larb.yaml
-      for details.
-
   iommus:
     maxItems: 2
     description: |
@@ -56,7 +49,6 @@ required:
   - clocks
   - clock-names
   - power-domains
-  - mediatek,larb
   - iommus
 
 additionalProperties: false
@@ -75,7 +67,6 @@ examples:
       clocks =  <&imgsys CLK_IMG_VENC>;
       clock-names = "jpgenc";
       power-domains = <&scpsys MT2701_POWER_DOMAIN_ISP>;
-      mediatek,larb = <&larb2>;
       iommus = <&iommu MT2701_M4U_PORT_JPGENC_RDMA>,
                <&iommu MT2701_M4U_PORT_JPGENC_BSDMA>;
     };
diff --git a/Documentation/devicetree/bindings/media/mediatek-mdp.txt b/Documentation/devicetree/bindings/media/mediatek-mdp.txt
index caa24943da33..53ef26e2c857 100644
--- a/Documentation/devicetree/bindings/media/mediatek-mdp.txt
+++ b/Documentation/devicetree/bindings/media/mediatek-mdp.txt
@@ -27,9 +27,6 @@ Required properties (DMA function blocks, child node):
 - iommus: should point to the respective IOMMU block with master port as
   argument, see Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml
   for details.
-- mediatek,larb: must contain the local arbiters in the current Socs, see
-  Documentation/devicetree/bindings/memory-controllers/mediatek,smi-larb.yaml
-  for details.
 
 Example:
 	mdp_rdma0: rdma@14001000 {
@@ -40,7 +37,6 @@ Example:
 			 <&mmsys CLK_MM_MUTEX_32K>;
 		power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 		iommus = <&iommu M4U_PORT_MDP_RDMA0>;
-		mediatek,larb = <&larb0>;
 		mediatek,vpu = <&vpu>;
 	};
 
@@ -51,7 +47,6 @@ Example:
 			 <&mmsys CLK_MM_MUTEX_32K>;
 		power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 		iommus = <&iommu M4U_PORT_MDP_RDMA1>;
-		mediatek,larb = <&larb4>;
 	};
 
 	mdp_rsz0: rsz@14003000 {
@@ -81,7 +76,6 @@ Example:
 		clocks = <&mmsys CLK_MM_MDP_WDMA>;
 		power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 		iommus = <&iommu M4U_PORT_MDP_WDMA>;
-		mediatek,larb = <&larb0>;
 	};
 
 	mdp_wrot0: wrot@14007000 {
@@ -90,7 +84,6 @@ Example:
 		clocks = <&mmsys CLK_MM_MDP_WROT0>;
 		power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 		iommus = <&iommu M4U_PORT_MDP_WROT0>;
-		mediatek,larb = <&larb0>;
 	};
 
 	mdp_wrot1: wrot@14008000 {
@@ -99,5 +92,4 @@ Example:
 		clocks = <&mmsys CLK_MM_MDP_WROT1>;
 		power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 		iommus = <&iommu M4U_PORT_MDP_WROT1>;
-		mediatek,larb = <&larb4>;
 	};
-- 
2.18.0

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 01/13] dt-binding: mediatek: Get rid of mediatek, larb for multimedia HW
@ 2022-01-17  7:04   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:04 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Dafna Hirschfeld, Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang,
	anthony.huang, youlin.pei, Evan Green, Eizan Miyamoto,
	Matthias Kaehlcke, linux-arm-kernel, mingyuan.ma, linux-media,
	devicetree, Frank Wunderlich, libo.kang, yi.kuo, linux-mediatek,
	Hsin-Yi Wang, Tiffany Lin, yong.wu, AngeloGioacchino Del Regno,
	anan.sun, srv_heupstream, acourbot, linux-kernel, Tomasz Figa,
	iommu, Robin Murphy

After adding device_link between the consumer with the smi-larbs,
if the consumer call its owner pm_runtime_get(_sync), the
pm_runtime_get(_sync) of smi-larb and smi-common will be called
automatically. Thus, the consumer don't need this property.

And IOMMU also know which larb this consumer connects with from
iommu id in the "iommus=" property.

Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Evan Green <evgreen@chromium.org>
Acked-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 .../bindings/display/mediatek/mediatek,disp.txt          | 9 ---------
 .../bindings/media/mediatek,vcodec-decoder.yaml          | 7 -------
 .../bindings/media/mediatek,vcodec-encoder.yaml          | 8 --------
 .../devicetree/bindings/media/mediatek-jpeg-decoder.yaml | 9 ---------
 .../devicetree/bindings/media/mediatek-jpeg-encoder.yaml | 9 ---------
 Documentation/devicetree/bindings/media/mediatek-mdp.txt | 8 --------
 6 files changed, 50 deletions(-)

diff --git a/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt b/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt
index 78044c340e20..8b575e11bcec 100644
--- a/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt
+++ b/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt
@@ -61,8 +61,6 @@ Required properties (DMA function blocks):
 	"mediatek,<chip>-disp-rdma"
 	"mediatek,<chip>-disp-wdma"
   the supported chips are mt2701, mt8167 and mt8173.
-- larb: Should contain a phandle pointing to the local arbiter device as defined
-  in Documentation/devicetree/bindings/memory-controllers/mediatek,smi-larb.yaml
 - iommus: Should point to the respective IOMMU block with master port as
   argument, see Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml
   for details.
@@ -91,7 +89,6 @@ ovl0: ovl@1400c000 {
 	power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 	clocks = <&mmsys CLK_MM_DISP_OVL0>;
 	iommus = <&iommu M4U_PORT_DISP_OVL0>;
-	mediatek,larb = <&larb0>;
 };
 
 ovl1: ovl@1400d000 {
@@ -101,7 +98,6 @@ ovl1: ovl@1400d000 {
 	power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 	clocks = <&mmsys CLK_MM_DISP_OVL1>;
 	iommus = <&iommu M4U_PORT_DISP_OVL1>;
-	mediatek,larb = <&larb4>;
 };
 
 rdma0: rdma@1400e000 {
@@ -111,7 +107,6 @@ rdma0: rdma@1400e000 {
 	power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 	clocks = <&mmsys CLK_MM_DISP_RDMA0>;
 	iommus = <&iommu M4U_PORT_DISP_RDMA0>;
-	mediatek,larb = <&larb0>;
 	mediatek,rdma-fifosize = <8192>;
 };
 
@@ -122,7 +117,6 @@ rdma1: rdma@1400f000 {
 	power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 	clocks = <&mmsys CLK_MM_DISP_RDMA1>;
 	iommus = <&iommu M4U_PORT_DISP_RDMA1>;
-	mediatek,larb = <&larb4>;
 };
 
 rdma2: rdma@14010000 {
@@ -132,7 +126,6 @@ rdma2: rdma@14010000 {
 	power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 	clocks = <&mmsys CLK_MM_DISP_RDMA2>;
 	iommus = <&iommu M4U_PORT_DISP_RDMA2>;
-	mediatek,larb = <&larb4>;
 };
 
 wdma0: wdma@14011000 {
@@ -142,7 +135,6 @@ wdma0: wdma@14011000 {
 	power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 	clocks = <&mmsys CLK_MM_DISP_WDMA0>;
 	iommus = <&iommu M4U_PORT_DISP_WDMA0>;
-	mediatek,larb = <&larb0>;
 };
 
 wdma1: wdma@14012000 {
@@ -152,7 +144,6 @@ wdma1: wdma@14012000 {
 	power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 	clocks = <&mmsys CLK_MM_DISP_WDMA1>;
 	iommus = <&iommu M4U_PORT_DISP_WDMA1>;
-	mediatek,larb = <&larb4>;
 };
 
 color0: color@14013000 {
diff --git a/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml b/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
index df1d677098fd..9b179bb44dfb 100644
--- a/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
+++ b/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
@@ -61,12 +61,6 @@ properties:
     description: |
       Describes the physical address space of IOMMU maps to memory.
 
-  mediatek,larb:
-    $ref: /schemas/types.yaml#/definitions/phandle
-    maxItems: 1
-    description: |
-      Must contain the local arbiters in the current Socs.
-
   mediatek,vpu:
     $ref: /schemas/types.yaml#/definitions/phandle
     maxItems: 1
@@ -137,7 +131,6 @@ examples:
           <0x16027800 0x800>,   /*VP8_VL*/
           <0x16028400 0x400>;   /*VP9_VD*/
       interrupts = <GIC_SPI 204 IRQ_TYPE_LEVEL_LOW>;
-      mediatek,larb = <&larb1>;
       iommus = <&iommu M4U_PORT_HW_VDEC_MC_EXT>,
              <&iommu M4U_PORT_HW_VDEC_PP_EXT>,
              <&iommu M4U_PORT_HW_VDEC_AVC_MV_EXT>,
diff --git a/Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml b/Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml
index b72c1a50e89e..e7b65a91c92c 100644
--- a/Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml
+++ b/Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml
@@ -53,12 +53,6 @@ properties:
     description: |
       Describes the physical address space of IOMMU maps to memory.
 
-  mediatek,larb:
-    $ref: /schemas/types.yaml#/definitions/phandle
-    maxItems: 1
-    description: |
-      Must contain the local arbiters in the current Socs.
-
   mediatek,vpu:
     $ref: /schemas/types.yaml#/definitions/phandle
     maxItems: 1
@@ -157,7 +151,6 @@ examples:
              <&iommu M4U_PORT_VENC_REF_CHROMA>,
              <&iommu M4U_PORT_VENC_NBM_RDMA>,
              <&iommu M4U_PORT_VENC_NBM_WDMA>;
-      mediatek,larb = <&larb3>;
       mediatek,vpu = <&vpu>;
       clocks = <&topckgen CLK_TOP_VENC_SEL>;
       clock-names = "venc_sel";
@@ -178,7 +171,6 @@ examples:
              <&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";
diff --git a/Documentation/devicetree/bindings/media/mediatek-jpeg-decoder.yaml b/Documentation/devicetree/bindings/media/mediatek-jpeg-decoder.yaml
index 9b87f036f178..052e752157b4 100644
--- a/Documentation/devicetree/bindings/media/mediatek-jpeg-decoder.yaml
+++ b/Documentation/devicetree/bindings/media/mediatek-jpeg-decoder.yaml
@@ -42,13 +42,6 @@ properties:
   power-domains:
     maxItems: 1
 
-  mediatek,larb:
-    $ref: '/schemas/types.yaml#/definitions/phandle'
-    description: |
-      Must contain the local arbiters in the current Socs, see
-      Documentation/devicetree/bindings/memory-controllers/mediatek,smi-larb.yaml
-      for details.
-
   iommus:
     maxItems: 2
     description: |
@@ -63,7 +56,6 @@ required:
   - clocks
   - clock-names
   - power-domains
-  - mediatek,larb
   - iommus
 
 additionalProperties: false
@@ -83,7 +75,6 @@ examples:
       clock-names = "jpgdec-smi",
                     "jpgdec";
       power-domains = <&scpsys MT2701_POWER_DOMAIN_ISP>;
-      mediatek,larb = <&larb2>;
       iommus = <&iommu MT2701_M4U_PORT_JPGDEC_WDMA>,
                <&iommu MT2701_M4U_PORT_JPGDEC_BSDMA>;
     };
diff --git a/Documentation/devicetree/bindings/media/mediatek-jpeg-encoder.yaml b/Documentation/devicetree/bindings/media/mediatek-jpeg-encoder.yaml
index fcd9b829e036..8bfdfdfaba59 100644
--- a/Documentation/devicetree/bindings/media/mediatek-jpeg-encoder.yaml
+++ b/Documentation/devicetree/bindings/media/mediatek-jpeg-encoder.yaml
@@ -35,13 +35,6 @@ properties:
   power-domains:
     maxItems: 1
 
-  mediatek,larb:
-    $ref: '/schemas/types.yaml#/definitions/phandle'
-    description: |
-      Must contain the local arbiters in the current Socs, see
-      Documentation/devicetree/bindings/memory-controllers/mediatek,smi-larb.yaml
-      for details.
-
   iommus:
     maxItems: 2
     description: |
@@ -56,7 +49,6 @@ required:
   - clocks
   - clock-names
   - power-domains
-  - mediatek,larb
   - iommus
 
 additionalProperties: false
@@ -75,7 +67,6 @@ examples:
       clocks =  <&imgsys CLK_IMG_VENC>;
       clock-names = "jpgenc";
       power-domains = <&scpsys MT2701_POWER_DOMAIN_ISP>;
-      mediatek,larb = <&larb2>;
       iommus = <&iommu MT2701_M4U_PORT_JPGENC_RDMA>,
                <&iommu MT2701_M4U_PORT_JPGENC_BSDMA>;
     };
diff --git a/Documentation/devicetree/bindings/media/mediatek-mdp.txt b/Documentation/devicetree/bindings/media/mediatek-mdp.txt
index caa24943da33..53ef26e2c857 100644
--- a/Documentation/devicetree/bindings/media/mediatek-mdp.txt
+++ b/Documentation/devicetree/bindings/media/mediatek-mdp.txt
@@ -27,9 +27,6 @@ Required properties (DMA function blocks, child node):
 - iommus: should point to the respective IOMMU block with master port as
   argument, see Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml
   for details.
-- mediatek,larb: must contain the local arbiters in the current Socs, see
-  Documentation/devicetree/bindings/memory-controllers/mediatek,smi-larb.yaml
-  for details.
 
 Example:
 	mdp_rdma0: rdma@14001000 {
@@ -40,7 +37,6 @@ Example:
 			 <&mmsys CLK_MM_MUTEX_32K>;
 		power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 		iommus = <&iommu M4U_PORT_MDP_RDMA0>;
-		mediatek,larb = <&larb0>;
 		mediatek,vpu = <&vpu>;
 	};
 
@@ -51,7 +47,6 @@ Example:
 			 <&mmsys CLK_MM_MUTEX_32K>;
 		power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 		iommus = <&iommu M4U_PORT_MDP_RDMA1>;
-		mediatek,larb = <&larb4>;
 	};
 
 	mdp_rsz0: rsz@14003000 {
@@ -81,7 +76,6 @@ Example:
 		clocks = <&mmsys CLK_MM_MDP_WDMA>;
 		power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 		iommus = <&iommu M4U_PORT_MDP_WDMA>;
-		mediatek,larb = <&larb0>;
 	};
 
 	mdp_wrot0: wrot@14007000 {
@@ -90,7 +84,6 @@ Example:
 		clocks = <&mmsys CLK_MM_MDP_WROT0>;
 		power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 		iommus = <&iommu M4U_PORT_MDP_WROT0>;
-		mediatek,larb = <&larb0>;
 	};
 
 	mdp_wrot1: wrot@14008000 {
@@ -99,5 +92,4 @@ Example:
 		clocks = <&mmsys CLK_MM_MDP_WROT1>;
 		power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 		iommus = <&iommu M4U_PORT_MDP_WROT1>;
-		mediatek,larb = <&larb4>;
 	};
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 01/13] dt-binding: mediatek: Get rid of mediatek, larb for multimedia HW
@ 2022-01-17  7:04   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:04 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Dafna Hirschfeld, Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang,
	anthony.huang, youlin.pei, Evan Green, Eizan Miyamoto,
	Matthias Kaehlcke, linux-arm-kernel, mingyuan.ma, linux-media,
	devicetree, Philipp Zabel, libo.kang, yi.kuo, linux-mediatek,
	Hsin-Yi Wang, Tiffany Lin, yong.wu, AngeloGioacchino Del Regno,
	anan.sun, srv_heupstream, acourbot, linux-kernel, Tomasz Figa,
	iommu, Daniel Vetter, Robin Murphy

After adding device_link between the consumer with the smi-larbs,
if the consumer call its owner pm_runtime_get(_sync), the
pm_runtime_get(_sync) of smi-larb and smi-common will be called
automatically. Thus, the consumer don't need this property.

And IOMMU also know which larb this consumer connects with from
iommu id in the "iommus=" property.

Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Evan Green <evgreen@chromium.org>
Acked-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 .../bindings/display/mediatek/mediatek,disp.txt          | 9 ---------
 .../bindings/media/mediatek,vcodec-decoder.yaml          | 7 -------
 .../bindings/media/mediatek,vcodec-encoder.yaml          | 8 --------
 .../devicetree/bindings/media/mediatek-jpeg-decoder.yaml | 9 ---------
 .../devicetree/bindings/media/mediatek-jpeg-encoder.yaml | 9 ---------
 Documentation/devicetree/bindings/media/mediatek-mdp.txt | 8 --------
 6 files changed, 50 deletions(-)

diff --git a/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt b/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt
index 78044c340e20..8b575e11bcec 100644
--- a/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt
+++ b/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt
@@ -61,8 +61,6 @@ Required properties (DMA function blocks):
 	"mediatek,<chip>-disp-rdma"
 	"mediatek,<chip>-disp-wdma"
   the supported chips are mt2701, mt8167 and mt8173.
-- larb: Should contain a phandle pointing to the local arbiter device as defined
-  in Documentation/devicetree/bindings/memory-controllers/mediatek,smi-larb.yaml
 - iommus: Should point to the respective IOMMU block with master port as
   argument, see Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml
   for details.
@@ -91,7 +89,6 @@ ovl0: ovl@1400c000 {
 	power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 	clocks = <&mmsys CLK_MM_DISP_OVL0>;
 	iommus = <&iommu M4U_PORT_DISP_OVL0>;
-	mediatek,larb = <&larb0>;
 };
 
 ovl1: ovl@1400d000 {
@@ -101,7 +98,6 @@ ovl1: ovl@1400d000 {
 	power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 	clocks = <&mmsys CLK_MM_DISP_OVL1>;
 	iommus = <&iommu M4U_PORT_DISP_OVL1>;
-	mediatek,larb = <&larb4>;
 };
 
 rdma0: rdma@1400e000 {
@@ -111,7 +107,6 @@ rdma0: rdma@1400e000 {
 	power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 	clocks = <&mmsys CLK_MM_DISP_RDMA0>;
 	iommus = <&iommu M4U_PORT_DISP_RDMA0>;
-	mediatek,larb = <&larb0>;
 	mediatek,rdma-fifosize = <8192>;
 };
 
@@ -122,7 +117,6 @@ rdma1: rdma@1400f000 {
 	power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 	clocks = <&mmsys CLK_MM_DISP_RDMA1>;
 	iommus = <&iommu M4U_PORT_DISP_RDMA1>;
-	mediatek,larb = <&larb4>;
 };
 
 rdma2: rdma@14010000 {
@@ -132,7 +126,6 @@ rdma2: rdma@14010000 {
 	power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 	clocks = <&mmsys CLK_MM_DISP_RDMA2>;
 	iommus = <&iommu M4U_PORT_DISP_RDMA2>;
-	mediatek,larb = <&larb4>;
 };
 
 wdma0: wdma@14011000 {
@@ -142,7 +135,6 @@ wdma0: wdma@14011000 {
 	power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 	clocks = <&mmsys CLK_MM_DISP_WDMA0>;
 	iommus = <&iommu M4U_PORT_DISP_WDMA0>;
-	mediatek,larb = <&larb0>;
 };
 
 wdma1: wdma@14012000 {
@@ -152,7 +144,6 @@ wdma1: wdma@14012000 {
 	power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 	clocks = <&mmsys CLK_MM_DISP_WDMA1>;
 	iommus = <&iommu M4U_PORT_DISP_WDMA1>;
-	mediatek,larb = <&larb4>;
 };
 
 color0: color@14013000 {
diff --git a/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml b/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
index df1d677098fd..9b179bb44dfb 100644
--- a/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
+++ b/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
@@ -61,12 +61,6 @@ properties:
     description: |
       Describes the physical address space of IOMMU maps to memory.
 
-  mediatek,larb:
-    $ref: /schemas/types.yaml#/definitions/phandle
-    maxItems: 1
-    description: |
-      Must contain the local arbiters in the current Socs.
-
   mediatek,vpu:
     $ref: /schemas/types.yaml#/definitions/phandle
     maxItems: 1
@@ -137,7 +131,6 @@ examples:
           <0x16027800 0x800>,   /*VP8_VL*/
           <0x16028400 0x400>;   /*VP9_VD*/
       interrupts = <GIC_SPI 204 IRQ_TYPE_LEVEL_LOW>;
-      mediatek,larb = <&larb1>;
       iommus = <&iommu M4U_PORT_HW_VDEC_MC_EXT>,
              <&iommu M4U_PORT_HW_VDEC_PP_EXT>,
              <&iommu M4U_PORT_HW_VDEC_AVC_MV_EXT>,
diff --git a/Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml b/Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml
index b72c1a50e89e..e7b65a91c92c 100644
--- a/Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml
+++ b/Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml
@@ -53,12 +53,6 @@ properties:
     description: |
       Describes the physical address space of IOMMU maps to memory.
 
-  mediatek,larb:
-    $ref: /schemas/types.yaml#/definitions/phandle
-    maxItems: 1
-    description: |
-      Must contain the local arbiters in the current Socs.
-
   mediatek,vpu:
     $ref: /schemas/types.yaml#/definitions/phandle
     maxItems: 1
@@ -157,7 +151,6 @@ examples:
              <&iommu M4U_PORT_VENC_REF_CHROMA>,
              <&iommu M4U_PORT_VENC_NBM_RDMA>,
              <&iommu M4U_PORT_VENC_NBM_WDMA>;
-      mediatek,larb = <&larb3>;
       mediatek,vpu = <&vpu>;
       clocks = <&topckgen CLK_TOP_VENC_SEL>;
       clock-names = "venc_sel";
@@ -178,7 +171,6 @@ examples:
              <&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";
diff --git a/Documentation/devicetree/bindings/media/mediatek-jpeg-decoder.yaml b/Documentation/devicetree/bindings/media/mediatek-jpeg-decoder.yaml
index 9b87f036f178..052e752157b4 100644
--- a/Documentation/devicetree/bindings/media/mediatek-jpeg-decoder.yaml
+++ b/Documentation/devicetree/bindings/media/mediatek-jpeg-decoder.yaml
@@ -42,13 +42,6 @@ properties:
   power-domains:
     maxItems: 1
 
-  mediatek,larb:
-    $ref: '/schemas/types.yaml#/definitions/phandle'
-    description: |
-      Must contain the local arbiters in the current Socs, see
-      Documentation/devicetree/bindings/memory-controllers/mediatek,smi-larb.yaml
-      for details.
-
   iommus:
     maxItems: 2
     description: |
@@ -63,7 +56,6 @@ required:
   - clocks
   - clock-names
   - power-domains
-  - mediatek,larb
   - iommus
 
 additionalProperties: false
@@ -83,7 +75,6 @@ examples:
       clock-names = "jpgdec-smi",
                     "jpgdec";
       power-domains = <&scpsys MT2701_POWER_DOMAIN_ISP>;
-      mediatek,larb = <&larb2>;
       iommus = <&iommu MT2701_M4U_PORT_JPGDEC_WDMA>,
                <&iommu MT2701_M4U_PORT_JPGDEC_BSDMA>;
     };
diff --git a/Documentation/devicetree/bindings/media/mediatek-jpeg-encoder.yaml b/Documentation/devicetree/bindings/media/mediatek-jpeg-encoder.yaml
index fcd9b829e036..8bfdfdfaba59 100644
--- a/Documentation/devicetree/bindings/media/mediatek-jpeg-encoder.yaml
+++ b/Documentation/devicetree/bindings/media/mediatek-jpeg-encoder.yaml
@@ -35,13 +35,6 @@ properties:
   power-domains:
     maxItems: 1
 
-  mediatek,larb:
-    $ref: '/schemas/types.yaml#/definitions/phandle'
-    description: |
-      Must contain the local arbiters in the current Socs, see
-      Documentation/devicetree/bindings/memory-controllers/mediatek,smi-larb.yaml
-      for details.
-
   iommus:
     maxItems: 2
     description: |
@@ -56,7 +49,6 @@ required:
   - clocks
   - clock-names
   - power-domains
-  - mediatek,larb
   - iommus
 
 additionalProperties: false
@@ -75,7 +67,6 @@ examples:
       clocks =  <&imgsys CLK_IMG_VENC>;
       clock-names = "jpgenc";
       power-domains = <&scpsys MT2701_POWER_DOMAIN_ISP>;
-      mediatek,larb = <&larb2>;
       iommus = <&iommu MT2701_M4U_PORT_JPGENC_RDMA>,
                <&iommu MT2701_M4U_PORT_JPGENC_BSDMA>;
     };
diff --git a/Documentation/devicetree/bindings/media/mediatek-mdp.txt b/Documentation/devicetree/bindings/media/mediatek-mdp.txt
index caa24943da33..53ef26e2c857 100644
--- a/Documentation/devicetree/bindings/media/mediatek-mdp.txt
+++ b/Documentation/devicetree/bindings/media/mediatek-mdp.txt
@@ -27,9 +27,6 @@ Required properties (DMA function blocks, child node):
 - iommus: should point to the respective IOMMU block with master port as
   argument, see Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml
   for details.
-- mediatek,larb: must contain the local arbiters in the current Socs, see
-  Documentation/devicetree/bindings/memory-controllers/mediatek,smi-larb.yaml
-  for details.
 
 Example:
 	mdp_rdma0: rdma@14001000 {
@@ -40,7 +37,6 @@ Example:
 			 <&mmsys CLK_MM_MUTEX_32K>;
 		power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 		iommus = <&iommu M4U_PORT_MDP_RDMA0>;
-		mediatek,larb = <&larb0>;
 		mediatek,vpu = <&vpu>;
 	};
 
@@ -51,7 +47,6 @@ Example:
 			 <&mmsys CLK_MM_MUTEX_32K>;
 		power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 		iommus = <&iommu M4U_PORT_MDP_RDMA1>;
-		mediatek,larb = <&larb4>;
 	};
 
 	mdp_rsz0: rsz@14003000 {
@@ -81,7 +76,6 @@ Example:
 		clocks = <&mmsys CLK_MM_MDP_WDMA>;
 		power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 		iommus = <&iommu M4U_PORT_MDP_WDMA>;
-		mediatek,larb = <&larb0>;
 	};
 
 	mdp_wrot0: wrot@14007000 {
@@ -90,7 +84,6 @@ Example:
 		clocks = <&mmsys CLK_MM_MDP_WROT0>;
 		power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 		iommus = <&iommu M4U_PORT_MDP_WROT0>;
-		mediatek,larb = <&larb0>;
 	};
 
 	mdp_wrot1: wrot@14008000 {
@@ -99,5 +92,4 @@ Example:
 		clocks = <&mmsys CLK_MM_MDP_WROT1>;
 		power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 		iommus = <&iommu M4U_PORT_MDP_WROT1>;
-		mediatek,larb = <&larb4>;
 	};
-- 
2.18.0


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 01/13] dt-binding: mediatek: Get rid of mediatek, larb for multimedia HW
@ 2022-01-17  7:04   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:04 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Evan Green, Robin Murphy, Tomasz Figa, Will Deacon,
	linux-mediatek, srv_heupstream, devicetree, linux-kernel,
	linux-arm-kernel, iommu, yong.wu, youlin.pei, Matthias Kaehlcke,
	anan.sun, yi.kuo, acourbot, linux-media, dri-devel,
	Daniel Vetter, Chun-Kuang Hu, Philipp Zabel, Tiffany Lin,
	Dafna Hirschfeld, Hsin-Yi Wang, Eizan Miyamoto, anthony.huang,
	Frank Wunderlich, mingyuan.ma, yf.wang, libo.kang,
	AngeloGioacchino Del Regno

After adding device_link between the consumer with the smi-larbs,
if the consumer call its owner pm_runtime_get(_sync), the
pm_runtime_get(_sync) of smi-larb and smi-common will be called
automatically. Thus, the consumer don't need this property.

And IOMMU also know which larb this consumer connects with from
iommu id in the "iommus=" property.

Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Evan Green <evgreen@chromium.org>
Acked-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 .../bindings/display/mediatek/mediatek,disp.txt          | 9 ---------
 .../bindings/media/mediatek,vcodec-decoder.yaml          | 7 -------
 .../bindings/media/mediatek,vcodec-encoder.yaml          | 8 --------
 .../devicetree/bindings/media/mediatek-jpeg-decoder.yaml | 9 ---------
 .../devicetree/bindings/media/mediatek-jpeg-encoder.yaml | 9 ---------
 Documentation/devicetree/bindings/media/mediatek-mdp.txt | 8 --------
 6 files changed, 50 deletions(-)

diff --git a/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt b/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt
index 78044c340e20..8b575e11bcec 100644
--- a/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt
+++ b/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt
@@ -61,8 +61,6 @@ Required properties (DMA function blocks):
 	"mediatek,<chip>-disp-rdma"
 	"mediatek,<chip>-disp-wdma"
   the supported chips are mt2701, mt8167 and mt8173.
-- larb: Should contain a phandle pointing to the local arbiter device as defined
-  in Documentation/devicetree/bindings/memory-controllers/mediatek,smi-larb.yaml
 - iommus: Should point to the respective IOMMU block with master port as
   argument, see Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml
   for details.
@@ -91,7 +89,6 @@ ovl0: ovl@1400c000 {
 	power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 	clocks = <&mmsys CLK_MM_DISP_OVL0>;
 	iommus = <&iommu M4U_PORT_DISP_OVL0>;
-	mediatek,larb = <&larb0>;
 };
 
 ovl1: ovl@1400d000 {
@@ -101,7 +98,6 @@ ovl1: ovl@1400d000 {
 	power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 	clocks = <&mmsys CLK_MM_DISP_OVL1>;
 	iommus = <&iommu M4U_PORT_DISP_OVL1>;
-	mediatek,larb = <&larb4>;
 };
 
 rdma0: rdma@1400e000 {
@@ -111,7 +107,6 @@ rdma0: rdma@1400e000 {
 	power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 	clocks = <&mmsys CLK_MM_DISP_RDMA0>;
 	iommus = <&iommu M4U_PORT_DISP_RDMA0>;
-	mediatek,larb = <&larb0>;
 	mediatek,rdma-fifosize = <8192>;
 };
 
@@ -122,7 +117,6 @@ rdma1: rdma@1400f000 {
 	power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 	clocks = <&mmsys CLK_MM_DISP_RDMA1>;
 	iommus = <&iommu M4U_PORT_DISP_RDMA1>;
-	mediatek,larb = <&larb4>;
 };
 
 rdma2: rdma@14010000 {
@@ -132,7 +126,6 @@ rdma2: rdma@14010000 {
 	power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 	clocks = <&mmsys CLK_MM_DISP_RDMA2>;
 	iommus = <&iommu M4U_PORT_DISP_RDMA2>;
-	mediatek,larb = <&larb4>;
 };
 
 wdma0: wdma@14011000 {
@@ -142,7 +135,6 @@ wdma0: wdma@14011000 {
 	power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 	clocks = <&mmsys CLK_MM_DISP_WDMA0>;
 	iommus = <&iommu M4U_PORT_DISP_WDMA0>;
-	mediatek,larb = <&larb0>;
 };
 
 wdma1: wdma@14012000 {
@@ -152,7 +144,6 @@ wdma1: wdma@14012000 {
 	power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 	clocks = <&mmsys CLK_MM_DISP_WDMA1>;
 	iommus = <&iommu M4U_PORT_DISP_WDMA1>;
-	mediatek,larb = <&larb4>;
 };
 
 color0: color@14013000 {
diff --git a/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml b/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
index df1d677098fd..9b179bb44dfb 100644
--- a/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
+++ b/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
@@ -61,12 +61,6 @@ properties:
     description: |
       Describes the physical address space of IOMMU maps to memory.
 
-  mediatek,larb:
-    $ref: /schemas/types.yaml#/definitions/phandle
-    maxItems: 1
-    description: |
-      Must contain the local arbiters in the current Socs.
-
   mediatek,vpu:
     $ref: /schemas/types.yaml#/definitions/phandle
     maxItems: 1
@@ -137,7 +131,6 @@ examples:
           <0x16027800 0x800>,   /*VP8_VL*/
           <0x16028400 0x400>;   /*VP9_VD*/
       interrupts = <GIC_SPI 204 IRQ_TYPE_LEVEL_LOW>;
-      mediatek,larb = <&larb1>;
       iommus = <&iommu M4U_PORT_HW_VDEC_MC_EXT>,
              <&iommu M4U_PORT_HW_VDEC_PP_EXT>,
              <&iommu M4U_PORT_HW_VDEC_AVC_MV_EXT>,
diff --git a/Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml b/Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml
index b72c1a50e89e..e7b65a91c92c 100644
--- a/Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml
+++ b/Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml
@@ -53,12 +53,6 @@ properties:
     description: |
       Describes the physical address space of IOMMU maps to memory.
 
-  mediatek,larb:
-    $ref: /schemas/types.yaml#/definitions/phandle
-    maxItems: 1
-    description: |
-      Must contain the local arbiters in the current Socs.
-
   mediatek,vpu:
     $ref: /schemas/types.yaml#/definitions/phandle
     maxItems: 1
@@ -157,7 +151,6 @@ examples:
              <&iommu M4U_PORT_VENC_REF_CHROMA>,
              <&iommu M4U_PORT_VENC_NBM_RDMA>,
              <&iommu M4U_PORT_VENC_NBM_WDMA>;
-      mediatek,larb = <&larb3>;
       mediatek,vpu = <&vpu>;
       clocks = <&topckgen CLK_TOP_VENC_SEL>;
       clock-names = "venc_sel";
@@ -178,7 +171,6 @@ examples:
              <&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";
diff --git a/Documentation/devicetree/bindings/media/mediatek-jpeg-decoder.yaml b/Documentation/devicetree/bindings/media/mediatek-jpeg-decoder.yaml
index 9b87f036f178..052e752157b4 100644
--- a/Documentation/devicetree/bindings/media/mediatek-jpeg-decoder.yaml
+++ b/Documentation/devicetree/bindings/media/mediatek-jpeg-decoder.yaml
@@ -42,13 +42,6 @@ properties:
   power-domains:
     maxItems: 1
 
-  mediatek,larb:
-    $ref: '/schemas/types.yaml#/definitions/phandle'
-    description: |
-      Must contain the local arbiters in the current Socs, see
-      Documentation/devicetree/bindings/memory-controllers/mediatek,smi-larb.yaml
-      for details.
-
   iommus:
     maxItems: 2
     description: |
@@ -63,7 +56,6 @@ required:
   - clocks
   - clock-names
   - power-domains
-  - mediatek,larb
   - iommus
 
 additionalProperties: false
@@ -83,7 +75,6 @@ examples:
       clock-names = "jpgdec-smi",
                     "jpgdec";
       power-domains = <&scpsys MT2701_POWER_DOMAIN_ISP>;
-      mediatek,larb = <&larb2>;
       iommus = <&iommu MT2701_M4U_PORT_JPGDEC_WDMA>,
                <&iommu MT2701_M4U_PORT_JPGDEC_BSDMA>;
     };
diff --git a/Documentation/devicetree/bindings/media/mediatek-jpeg-encoder.yaml b/Documentation/devicetree/bindings/media/mediatek-jpeg-encoder.yaml
index fcd9b829e036..8bfdfdfaba59 100644
--- a/Documentation/devicetree/bindings/media/mediatek-jpeg-encoder.yaml
+++ b/Documentation/devicetree/bindings/media/mediatek-jpeg-encoder.yaml
@@ -35,13 +35,6 @@ properties:
   power-domains:
     maxItems: 1
 
-  mediatek,larb:
-    $ref: '/schemas/types.yaml#/definitions/phandle'
-    description: |
-      Must contain the local arbiters in the current Socs, see
-      Documentation/devicetree/bindings/memory-controllers/mediatek,smi-larb.yaml
-      for details.
-
   iommus:
     maxItems: 2
     description: |
@@ -56,7 +49,6 @@ required:
   - clocks
   - clock-names
   - power-domains
-  - mediatek,larb
   - iommus
 
 additionalProperties: false
@@ -75,7 +67,6 @@ examples:
       clocks =  <&imgsys CLK_IMG_VENC>;
       clock-names = "jpgenc";
       power-domains = <&scpsys MT2701_POWER_DOMAIN_ISP>;
-      mediatek,larb = <&larb2>;
       iommus = <&iommu MT2701_M4U_PORT_JPGENC_RDMA>,
                <&iommu MT2701_M4U_PORT_JPGENC_BSDMA>;
     };
diff --git a/Documentation/devicetree/bindings/media/mediatek-mdp.txt b/Documentation/devicetree/bindings/media/mediatek-mdp.txt
index caa24943da33..53ef26e2c857 100644
--- a/Documentation/devicetree/bindings/media/mediatek-mdp.txt
+++ b/Documentation/devicetree/bindings/media/mediatek-mdp.txt
@@ -27,9 +27,6 @@ Required properties (DMA function blocks, child node):
 - iommus: should point to the respective IOMMU block with master port as
   argument, see Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml
   for details.
-- mediatek,larb: must contain the local arbiters in the current Socs, see
-  Documentation/devicetree/bindings/memory-controllers/mediatek,smi-larb.yaml
-  for details.
 
 Example:
 	mdp_rdma0: rdma@14001000 {
@@ -40,7 +37,6 @@ Example:
 			 <&mmsys CLK_MM_MUTEX_32K>;
 		power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 		iommus = <&iommu M4U_PORT_MDP_RDMA0>;
-		mediatek,larb = <&larb0>;
 		mediatek,vpu = <&vpu>;
 	};
 
@@ -51,7 +47,6 @@ Example:
 			 <&mmsys CLK_MM_MUTEX_32K>;
 		power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 		iommus = <&iommu M4U_PORT_MDP_RDMA1>;
-		mediatek,larb = <&larb4>;
 	};
 
 	mdp_rsz0: rsz@14003000 {
@@ -81,7 +76,6 @@ Example:
 		clocks = <&mmsys CLK_MM_MDP_WDMA>;
 		power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 		iommus = <&iommu M4U_PORT_MDP_WDMA>;
-		mediatek,larb = <&larb0>;
 	};
 
 	mdp_wrot0: wrot@14007000 {
@@ -90,7 +84,6 @@ Example:
 		clocks = <&mmsys CLK_MM_MDP_WROT0>;
 		power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 		iommus = <&iommu M4U_PORT_MDP_WROT0>;
-		mediatek,larb = <&larb0>;
 	};
 
 	mdp_wrot1: wrot@14008000 {
@@ -99,5 +92,4 @@ Example:
 		clocks = <&mmsys CLK_MM_MDP_WROT1>;
 		power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
 		iommus = <&iommu M4U_PORT_MDP_WROT1>;
-		mediatek,larb = <&larb4>;
 	};
-- 
2.18.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 02/13] iommu/mediatek-v1: Free the existed fwspec if the master dev already has
  2022-01-17  7:04 ` Yong Wu
                     ` (2 preceding siblings ...)
  (?)
@ 2022-01-17  7:04   ` Yong Wu
  -1 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:04 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Evan Green, Robin Murphy, Tomasz Figa, Will Deacon,
	linux-mediatek, srv_heupstream, devicetree, linux-kernel,
	linux-arm-kernel, iommu, yong.wu, youlin.pei, Matthias Kaehlcke,
	anan.sun, yi.kuo, acourbot, linux-media, dri-devel,
	Daniel Vetter, Chun-Kuang Hu, Philipp Zabel, Tiffany Lin,
	Dafna Hirschfeld, Hsin-Yi Wang, Eizan Miyamoto, anthony.huang,
	Frank Wunderlich, mingyuan.ma, yf.wang, libo.kang,
	AngeloGioacchino Del Regno

When the iommu master device enters of_iommu_xlate, the ops may be
NULL(iommu dev is defered), then it will initialize the fwspec here:

[<c0c9c5bc>] (dev_iommu_fwspec_set) from [<c06bda80>]
(iommu_fwspec_init+0xbc/0xd4)
[<c06bd9c4>] (iommu_fwspec_init) from [<c06c0db4>]
(of_iommu_xlate+0x7c/0x12c)
[<c06c0d38>] (of_iommu_xlate) from [<c06c10e8>]
(of_iommu_configure+0x144/0x1e8)

BUT the mtk_iommu_v1.c only supports arm32, the probing flow still is a bit
weird. We always expect create the fwspec internally. otherwise it will
enter here and return fail.

static int mtk_iommu_create_mapping(struct device *dev,
				    struct of_phandle_args *args)
{
        ...
	if (!fwspec) {
	        ....
	} else if (dev_iommu_fwspec_get(dev)->ops != &mtk_iommu_ops) {
                >>>>>>>>>>Enter here. return fail.<<<<<<<<<<<<
		return -EINVAL;
	}
	...
}

Thus, Free the existed fwspec if the master device already has fwspec.

This issue is reported at:
https://lore.kernel.org/linux-mediatek/trinity-7d9ebdc9-4849-4d93-bfb5-429dcb4ee449-1626253158870@3c-app-gmx-bs01/

Reported-by: Frank Wunderlich <frank-w@public-files.de>
Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Acked-by: Joerg Roedel <jroedel@suse.de>
Acked-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/iommu/mtk_iommu_v1.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
index be22fcf988ce..1467ba1e4417 100644
--- a/drivers/iommu/mtk_iommu_v1.c
+++ b/drivers/iommu/mtk_iommu_v1.c
@@ -425,6 +425,15 @@ static struct iommu_device *mtk_iommu_probe_device(struct device *dev)
 	struct mtk_iommu_data *data;
 	int err, idx = 0;
 
+	/*
+	 * In the deferred case, free the existed fwspec.
+	 * Always initialize the fwspec internally.
+	 */
+	if (fwspec) {
+		iommu_fwspec_free(dev);
+		fwspec = dev_iommu_fwspec_get(dev);
+	}
+
 	while (!of_parse_phandle_with_args(dev->of_node, "iommus",
 					   "#iommu-cells",
 					   idx, &iommu_spec)) {
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 02/13] iommu/mediatek-v1: Free the existed fwspec if the master dev already has
@ 2022-01-17  7:04   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:04 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang, anthony.huang,
	youlin.pei, Evan Green, Eizan Miyamoto, Matthias Kaehlcke,
	linux-arm-kernel, mingyuan.ma, linux-media, devicetree,
	Philipp Zabel, Frank Wunderlich, libo.kang, yi.kuo,
	linux-mediatek, Hsin-Yi Wang, Tiffany Lin,
	AngeloGioacchino Del Regno, anan.sun, srv_heupstream, acourbot,
	linux-kernel, iommu, Daniel Vetter, Robin Murphy

When the iommu master device enters of_iommu_xlate, the ops may be
NULL(iommu dev is defered), then it will initialize the fwspec here:

[<c0c9c5bc>] (dev_iommu_fwspec_set) from [<c06bda80>]
(iommu_fwspec_init+0xbc/0xd4)
[<c06bd9c4>] (iommu_fwspec_init) from [<c06c0db4>]
(of_iommu_xlate+0x7c/0x12c)
[<c06c0d38>] (of_iommu_xlate) from [<c06c10e8>]
(of_iommu_configure+0x144/0x1e8)

BUT the mtk_iommu_v1.c only supports arm32, the probing flow still is a bit
weird. We always expect create the fwspec internally. otherwise it will
enter here and return fail.

static int mtk_iommu_create_mapping(struct device *dev,
				    struct of_phandle_args *args)
{
        ...
	if (!fwspec) {
	        ....
	} else if (dev_iommu_fwspec_get(dev)->ops != &mtk_iommu_ops) {
                >>>>>>>>>>Enter here. return fail.<<<<<<<<<<<<
		return -EINVAL;
	}
	...
}

Thus, Free the existed fwspec if the master device already has fwspec.

This issue is reported at:
https://lore.kernel.org/linux-mediatek/trinity-7d9ebdc9-4849-4d93-bfb5-429dcb4ee449-1626253158870@3c-app-gmx-bs01/

Reported-by: Frank Wunderlich <frank-w@public-files.de>
Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Acked-by: Joerg Roedel <jroedel@suse.de>
Acked-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/iommu/mtk_iommu_v1.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
index be22fcf988ce..1467ba1e4417 100644
--- a/drivers/iommu/mtk_iommu_v1.c
+++ b/drivers/iommu/mtk_iommu_v1.c
@@ -425,6 +425,15 @@ static struct iommu_device *mtk_iommu_probe_device(struct device *dev)
 	struct mtk_iommu_data *data;
 	int err, idx = 0;
 
+	/*
+	 * In the deferred case, free the existed fwspec.
+	 * Always initialize the fwspec internally.
+	 */
+	if (fwspec) {
+		iommu_fwspec_free(dev);
+		fwspec = dev_iommu_fwspec_get(dev);
+	}
+
 	while (!of_parse_phandle_with_args(dev->of_node, "iommus",
 					   "#iommu-cells",
 					   idx, &iommu_spec)) {
-- 
2.18.0

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 02/13] iommu/mediatek-v1: Free the existed fwspec if the master dev already has
@ 2022-01-17  7:04   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:04 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Dafna Hirschfeld, Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang,
	anthony.huang, youlin.pei, Evan Green, Eizan Miyamoto,
	Matthias Kaehlcke, linux-arm-kernel, mingyuan.ma, linux-media,
	devicetree, Frank Wunderlich, libo.kang, yi.kuo, linux-mediatek,
	Hsin-Yi Wang, Tiffany Lin, yong.wu, AngeloGioacchino Del Regno,
	anan.sun, srv_heupstream, acourbot, linux-kernel, Tomasz Figa,
	iommu, Robin Murphy

When the iommu master device enters of_iommu_xlate, the ops may be
NULL(iommu dev is defered), then it will initialize the fwspec here:

[<c0c9c5bc>] (dev_iommu_fwspec_set) from [<c06bda80>]
(iommu_fwspec_init+0xbc/0xd4)
[<c06bd9c4>] (iommu_fwspec_init) from [<c06c0db4>]
(of_iommu_xlate+0x7c/0x12c)
[<c06c0d38>] (of_iommu_xlate) from [<c06c10e8>]
(of_iommu_configure+0x144/0x1e8)

BUT the mtk_iommu_v1.c only supports arm32, the probing flow still is a bit
weird. We always expect create the fwspec internally. otherwise it will
enter here and return fail.

static int mtk_iommu_create_mapping(struct device *dev,
				    struct of_phandle_args *args)
{
        ...
	if (!fwspec) {
	        ....
	} else if (dev_iommu_fwspec_get(dev)->ops != &mtk_iommu_ops) {
                >>>>>>>>>>Enter here. return fail.<<<<<<<<<<<<
		return -EINVAL;
	}
	...
}

Thus, Free the existed fwspec if the master device already has fwspec.

This issue is reported at:
https://lore.kernel.org/linux-mediatek/trinity-7d9ebdc9-4849-4d93-bfb5-429dcb4ee449-1626253158870@3c-app-gmx-bs01/

Reported-by: Frank Wunderlich <frank-w@public-files.de>
Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Acked-by: Joerg Roedel <jroedel@suse.de>
Acked-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/iommu/mtk_iommu_v1.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
index be22fcf988ce..1467ba1e4417 100644
--- a/drivers/iommu/mtk_iommu_v1.c
+++ b/drivers/iommu/mtk_iommu_v1.c
@@ -425,6 +425,15 @@ static struct iommu_device *mtk_iommu_probe_device(struct device *dev)
 	struct mtk_iommu_data *data;
 	int err, idx = 0;
 
+	/*
+	 * In the deferred case, free the existed fwspec.
+	 * Always initialize the fwspec internally.
+	 */
+	if (fwspec) {
+		iommu_fwspec_free(dev);
+		fwspec = dev_iommu_fwspec_get(dev);
+	}
+
 	while (!of_parse_phandle_with_args(dev->of_node, "iommus",
 					   "#iommu-cells",
 					   idx, &iommu_spec)) {
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 02/13] iommu/mediatek-v1: Free the existed fwspec if the master dev already has
@ 2022-01-17  7:04   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:04 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Dafna Hirschfeld, Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang,
	anthony.huang, youlin.pei, Evan Green, Eizan Miyamoto,
	Matthias Kaehlcke, linux-arm-kernel, mingyuan.ma, linux-media,
	devicetree, Philipp Zabel, libo.kang, yi.kuo, linux-mediatek,
	Hsin-Yi Wang, Tiffany Lin, yong.wu, AngeloGioacchino Del Regno,
	anan.sun, srv_heupstream, acourbot, linux-kernel, Tomasz Figa,
	iommu, Daniel Vetter, Robin Murphy

When the iommu master device enters of_iommu_xlate, the ops may be
NULL(iommu dev is defered), then it will initialize the fwspec here:

[<c0c9c5bc>] (dev_iommu_fwspec_set) from [<c06bda80>]
(iommu_fwspec_init+0xbc/0xd4)
[<c06bd9c4>] (iommu_fwspec_init) from [<c06c0db4>]
(of_iommu_xlate+0x7c/0x12c)
[<c06c0d38>] (of_iommu_xlate) from [<c06c10e8>]
(of_iommu_configure+0x144/0x1e8)

BUT the mtk_iommu_v1.c only supports arm32, the probing flow still is a bit
weird. We always expect create the fwspec internally. otherwise it will
enter here and return fail.

static int mtk_iommu_create_mapping(struct device *dev,
				    struct of_phandle_args *args)
{
        ...
	if (!fwspec) {
	        ....
	} else if (dev_iommu_fwspec_get(dev)->ops != &mtk_iommu_ops) {
                >>>>>>>>>>Enter here. return fail.<<<<<<<<<<<<
		return -EINVAL;
	}
	...
}

Thus, Free the existed fwspec if the master device already has fwspec.

This issue is reported at:
https://lore.kernel.org/linux-mediatek/trinity-7d9ebdc9-4849-4d93-bfb5-429dcb4ee449-1626253158870@3c-app-gmx-bs01/

Reported-by: Frank Wunderlich <frank-w@public-files.de>
Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Acked-by: Joerg Roedel <jroedel@suse.de>
Acked-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/iommu/mtk_iommu_v1.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
index be22fcf988ce..1467ba1e4417 100644
--- a/drivers/iommu/mtk_iommu_v1.c
+++ b/drivers/iommu/mtk_iommu_v1.c
@@ -425,6 +425,15 @@ static struct iommu_device *mtk_iommu_probe_device(struct device *dev)
 	struct mtk_iommu_data *data;
 	int err, idx = 0;
 
+	/*
+	 * In the deferred case, free the existed fwspec.
+	 * Always initialize the fwspec internally.
+	 */
+	if (fwspec) {
+		iommu_fwspec_free(dev);
+		fwspec = dev_iommu_fwspec_get(dev);
+	}
+
 	while (!of_parse_phandle_with_args(dev->of_node, "iommus",
 					   "#iommu-cells",
 					   idx, &iommu_spec)) {
-- 
2.18.0


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 02/13] iommu/mediatek-v1: Free the existed fwspec if the master dev already has
@ 2022-01-17  7:04   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:04 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Evan Green, Robin Murphy, Tomasz Figa, Will Deacon,
	linux-mediatek, srv_heupstream, devicetree, linux-kernel,
	linux-arm-kernel, iommu, yong.wu, youlin.pei, Matthias Kaehlcke,
	anan.sun, yi.kuo, acourbot, linux-media, dri-devel,
	Daniel Vetter, Chun-Kuang Hu, Philipp Zabel, Tiffany Lin,
	Dafna Hirschfeld, Hsin-Yi Wang, Eizan Miyamoto, anthony.huang,
	Frank Wunderlich, mingyuan.ma, yf.wang, libo.kang,
	AngeloGioacchino Del Regno

When the iommu master device enters of_iommu_xlate, the ops may be
NULL(iommu dev is defered), then it will initialize the fwspec here:

[<c0c9c5bc>] (dev_iommu_fwspec_set) from [<c06bda80>]
(iommu_fwspec_init+0xbc/0xd4)
[<c06bd9c4>] (iommu_fwspec_init) from [<c06c0db4>]
(of_iommu_xlate+0x7c/0x12c)
[<c06c0d38>] (of_iommu_xlate) from [<c06c10e8>]
(of_iommu_configure+0x144/0x1e8)

BUT the mtk_iommu_v1.c only supports arm32, the probing flow still is a bit
weird. We always expect create the fwspec internally. otherwise it will
enter here and return fail.

static int mtk_iommu_create_mapping(struct device *dev,
				    struct of_phandle_args *args)
{
        ...
	if (!fwspec) {
	        ....
	} else if (dev_iommu_fwspec_get(dev)->ops != &mtk_iommu_ops) {
                >>>>>>>>>>Enter here. return fail.<<<<<<<<<<<<
		return -EINVAL;
	}
	...
}

Thus, Free the existed fwspec if the master device already has fwspec.

This issue is reported at:
https://lore.kernel.org/linux-mediatek/trinity-7d9ebdc9-4849-4d93-bfb5-429dcb4ee449-1626253158870@3c-app-gmx-bs01/

Reported-by: Frank Wunderlich <frank-w@public-files.de>
Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Acked-by: Joerg Roedel <jroedel@suse.de>
Acked-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/iommu/mtk_iommu_v1.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
index be22fcf988ce..1467ba1e4417 100644
--- a/drivers/iommu/mtk_iommu_v1.c
+++ b/drivers/iommu/mtk_iommu_v1.c
@@ -425,6 +425,15 @@ static struct iommu_device *mtk_iommu_probe_device(struct device *dev)
 	struct mtk_iommu_data *data;
 	int err, idx = 0;
 
+	/*
+	 * In the deferred case, free the existed fwspec.
+	 * Always initialize the fwspec internally.
+	 */
+	if (fwspec) {
+		iommu_fwspec_free(dev);
+		fwspec = dev_iommu_fwspec_get(dev);
+	}
+
 	while (!of_parse_phandle_with_args(dev->of_node, "iommus",
 					   "#iommu-cells",
 					   idx, &iommu_spec)) {
-- 
2.18.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 03/13] iommu/mediatek: Return ENODEV if the device is NULL
  2022-01-17  7:04 ` Yong Wu
                     ` (2 preceding siblings ...)
  (?)
@ 2022-01-17  7:05   ` Yong Wu
  -1 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Evan Green, Robin Murphy, Tomasz Figa, Will Deacon,
	linux-mediatek, srv_heupstream, devicetree, linux-kernel,
	linux-arm-kernel, iommu, yong.wu, youlin.pei, Matthias Kaehlcke,
	anan.sun, yi.kuo, acourbot, linux-media, dri-devel,
	Daniel Vetter, Chun-Kuang Hu, Philipp Zabel, Tiffany Lin,
	Dafna Hirschfeld, Hsin-Yi Wang, Eizan Miyamoto, anthony.huang,
	Frank Wunderlich, mingyuan.ma, yf.wang, libo.kang,
	AngeloGioacchino Del Regno

The platform device is created at:
of_platform_default_populate_init:  arch_initcall_sync
  ->of_platform_populate
        ->of_platform_device_create_pdata

When entering our probe, all the devices should be already created.
if it is null, means NODEV. Currently we don't get the fail case.
It's a minor fix, no need add fixes tags.

Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Acked-by: Joerg Roedel <jroedel@suse.de>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/iommu/mtk_iommu.c    | 2 +-
 drivers/iommu/mtk_iommu_v1.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index 25b834104790..77ae20ff9b35 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -848,7 +848,7 @@ static int mtk_iommu_probe(struct platform_device *pdev)
 		plarbdev = of_find_device_by_node(larbnode);
 		if (!plarbdev) {
 			of_node_put(larbnode);
-			return -EPROBE_DEFER;
+			return -ENODEV;
 		}
 		data->larb_imu[id].dev = &plarbdev->dev;
 
diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
index 1467ba1e4417..68bf02f87cfd 100644
--- a/drivers/iommu/mtk_iommu_v1.c
+++ b/drivers/iommu/mtk_iommu_v1.c
@@ -604,7 +604,7 @@ static int mtk_iommu_probe(struct platform_device *pdev)
 		plarbdev = of_find_device_by_node(larbnode);
 		if (!plarbdev) {
 			of_node_put(larbnode);
-			return -EPROBE_DEFER;
+			return -ENODEV;
 		}
 		data->larb_imu[i].dev = &plarbdev->dev;
 
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 03/13] iommu/mediatek: Return ENODEV if the device is NULL
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang, anthony.huang,
	youlin.pei, Evan Green, Eizan Miyamoto, Matthias Kaehlcke,
	linux-arm-kernel, mingyuan.ma, linux-media, devicetree,
	Philipp Zabel, Frank Wunderlich, libo.kang, yi.kuo,
	linux-mediatek, Hsin-Yi Wang, Tiffany Lin,
	AngeloGioacchino Del Regno, anan.sun, srv_heupstream, acourbot,
	linux-kernel, iommu, Daniel Vetter, Robin Murphy

The platform device is created at:
of_platform_default_populate_init:  arch_initcall_sync
  ->of_platform_populate
        ->of_platform_device_create_pdata

When entering our probe, all the devices should be already created.
if it is null, means NODEV. Currently we don't get the fail case.
It's a minor fix, no need add fixes tags.

Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Acked-by: Joerg Roedel <jroedel@suse.de>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/iommu/mtk_iommu.c    | 2 +-
 drivers/iommu/mtk_iommu_v1.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index 25b834104790..77ae20ff9b35 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -848,7 +848,7 @@ static int mtk_iommu_probe(struct platform_device *pdev)
 		plarbdev = of_find_device_by_node(larbnode);
 		if (!plarbdev) {
 			of_node_put(larbnode);
-			return -EPROBE_DEFER;
+			return -ENODEV;
 		}
 		data->larb_imu[id].dev = &plarbdev->dev;
 
diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
index 1467ba1e4417..68bf02f87cfd 100644
--- a/drivers/iommu/mtk_iommu_v1.c
+++ b/drivers/iommu/mtk_iommu_v1.c
@@ -604,7 +604,7 @@ static int mtk_iommu_probe(struct platform_device *pdev)
 		plarbdev = of_find_device_by_node(larbnode);
 		if (!plarbdev) {
 			of_node_put(larbnode);
-			return -EPROBE_DEFER;
+			return -ENODEV;
 		}
 		data->larb_imu[i].dev = &plarbdev->dev;
 
-- 
2.18.0

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 03/13] iommu/mediatek: Return ENODEV if the device is NULL
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Dafna Hirschfeld, Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang,
	anthony.huang, youlin.pei, Evan Green, Eizan Miyamoto,
	Matthias Kaehlcke, linux-arm-kernel, mingyuan.ma, linux-media,
	devicetree, Philipp Zabel, libo.kang, yi.kuo, linux-mediatek,
	Hsin-Yi Wang, Tiffany Lin, yong.wu, AngeloGioacchino Del Regno,
	anan.sun, srv_heupstream, acourbot, linux-kernel, Tomasz Figa,
	iommu, Daniel Vetter, Robin Murphy

The platform device is created at:
of_platform_default_populate_init:  arch_initcall_sync
  ->of_platform_populate
        ->of_platform_device_create_pdata

When entering our probe, all the devices should be already created.
if it is null, means NODEV. Currently we don't get the fail case.
It's a minor fix, no need add fixes tags.

Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Acked-by: Joerg Roedel <jroedel@suse.de>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/iommu/mtk_iommu.c    | 2 +-
 drivers/iommu/mtk_iommu_v1.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index 25b834104790..77ae20ff9b35 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -848,7 +848,7 @@ static int mtk_iommu_probe(struct platform_device *pdev)
 		plarbdev = of_find_device_by_node(larbnode);
 		if (!plarbdev) {
 			of_node_put(larbnode);
-			return -EPROBE_DEFER;
+			return -ENODEV;
 		}
 		data->larb_imu[id].dev = &plarbdev->dev;
 
diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
index 1467ba1e4417..68bf02f87cfd 100644
--- a/drivers/iommu/mtk_iommu_v1.c
+++ b/drivers/iommu/mtk_iommu_v1.c
@@ -604,7 +604,7 @@ static int mtk_iommu_probe(struct platform_device *pdev)
 		plarbdev = of_find_device_by_node(larbnode);
 		if (!plarbdev) {
 			of_node_put(larbnode);
-			return -EPROBE_DEFER;
+			return -ENODEV;
 		}
 		data->larb_imu[i].dev = &plarbdev->dev;
 
-- 
2.18.0


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 03/13] iommu/mediatek: Return ENODEV if the device is NULL
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Dafna Hirschfeld, Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang,
	anthony.huang, youlin.pei, Evan Green, Eizan Miyamoto,
	Matthias Kaehlcke, linux-arm-kernel, mingyuan.ma, linux-media,
	devicetree, Frank Wunderlich, libo.kang, yi.kuo, linux-mediatek,
	Hsin-Yi Wang, Tiffany Lin, yong.wu, AngeloGioacchino Del Regno,
	anan.sun, srv_heupstream, acourbot, linux-kernel, Tomasz Figa,
	iommu, Robin Murphy

The platform device is created at:
of_platform_default_populate_init:  arch_initcall_sync
  ->of_platform_populate
        ->of_platform_device_create_pdata

When entering our probe, all the devices should be already created.
if it is null, means NODEV. Currently we don't get the fail case.
It's a minor fix, no need add fixes tags.

Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Acked-by: Joerg Roedel <jroedel@suse.de>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/iommu/mtk_iommu.c    | 2 +-
 drivers/iommu/mtk_iommu_v1.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index 25b834104790..77ae20ff9b35 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -848,7 +848,7 @@ static int mtk_iommu_probe(struct platform_device *pdev)
 		plarbdev = of_find_device_by_node(larbnode);
 		if (!plarbdev) {
 			of_node_put(larbnode);
-			return -EPROBE_DEFER;
+			return -ENODEV;
 		}
 		data->larb_imu[id].dev = &plarbdev->dev;
 
diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
index 1467ba1e4417..68bf02f87cfd 100644
--- a/drivers/iommu/mtk_iommu_v1.c
+++ b/drivers/iommu/mtk_iommu_v1.c
@@ -604,7 +604,7 @@ static int mtk_iommu_probe(struct platform_device *pdev)
 		plarbdev = of_find_device_by_node(larbnode);
 		if (!plarbdev) {
 			of_node_put(larbnode);
-			return -EPROBE_DEFER;
+			return -ENODEV;
 		}
 		data->larb_imu[i].dev = &plarbdev->dev;
 
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 03/13] iommu/mediatek: Return ENODEV if the device is NULL
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Evan Green, Robin Murphy, Tomasz Figa, Will Deacon,
	linux-mediatek, srv_heupstream, devicetree, linux-kernel,
	linux-arm-kernel, iommu, yong.wu, youlin.pei, Matthias Kaehlcke,
	anan.sun, yi.kuo, acourbot, linux-media, dri-devel,
	Daniel Vetter, Chun-Kuang Hu, Philipp Zabel, Tiffany Lin,
	Dafna Hirschfeld, Hsin-Yi Wang, Eizan Miyamoto, anthony.huang,
	Frank Wunderlich, mingyuan.ma, yf.wang, libo.kang,
	AngeloGioacchino Del Regno

The platform device is created at:
of_platform_default_populate_init:  arch_initcall_sync
  ->of_platform_populate
        ->of_platform_device_create_pdata

When entering our probe, all the devices should be already created.
if it is null, means NODEV. Currently we don't get the fail case.
It's a minor fix, no need add fixes tags.

Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Acked-by: Joerg Roedel <jroedel@suse.de>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/iommu/mtk_iommu.c    | 2 +-
 drivers/iommu/mtk_iommu_v1.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index 25b834104790..77ae20ff9b35 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -848,7 +848,7 @@ static int mtk_iommu_probe(struct platform_device *pdev)
 		plarbdev = of_find_device_by_node(larbnode);
 		if (!plarbdev) {
 			of_node_put(larbnode);
-			return -EPROBE_DEFER;
+			return -ENODEV;
 		}
 		data->larb_imu[id].dev = &plarbdev->dev;
 
diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
index 1467ba1e4417..68bf02f87cfd 100644
--- a/drivers/iommu/mtk_iommu_v1.c
+++ b/drivers/iommu/mtk_iommu_v1.c
@@ -604,7 +604,7 @@ static int mtk_iommu_probe(struct platform_device *pdev)
 		plarbdev = of_find_device_by_node(larbnode);
 		if (!plarbdev) {
 			of_node_put(larbnode);
-			return -EPROBE_DEFER;
+			return -ENODEV;
 		}
 		data->larb_imu[i].dev = &plarbdev->dev;
 
-- 
2.18.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 04/13] iommu/mediatek: Add probe_defer for smi-larb
  2022-01-17  7:04 ` Yong Wu
                     ` (2 preceding siblings ...)
  (?)
@ 2022-01-17  7:05   ` Yong Wu
  -1 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Evan Green, Robin Murphy, Tomasz Figa, Will Deacon,
	linux-mediatek, srv_heupstream, devicetree, linux-kernel,
	linux-arm-kernel, iommu, yong.wu, youlin.pei, Matthias Kaehlcke,
	anan.sun, yi.kuo, acourbot, linux-media, dri-devel,
	Daniel Vetter, Chun-Kuang Hu, Philipp Zabel, Tiffany Lin,
	Dafna Hirschfeld, Hsin-Yi Wang, Eizan Miyamoto, anthony.huang,
	Frank Wunderlich, mingyuan.ma, yf.wang, libo.kang,
	AngeloGioacchino Del Regno

Prepare for adding device_link.

The iommu consumer should use device_link to connect with the
smi-larb(supplier). then the smi-larb should run before the iommu
consumer. Here we delay the iommu driver until the smi driver is ready,
then all the iommu consumers always are after the smi driver.

When there is no this patch, if some consumer drivers run before
smi-larb, the supplier link_status is DL_DEV_NO_DRIVER(0) in the
device_link_add, then device_links_driver_bound will use WARN_ON
to complain that the link_status of supplier is not right.

device_is_bound may be more elegant here. but it is not allowed to
EXPORT from https://lore.kernel.org/patchwork/patch/1334670/.

Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
Acked-by: Joerg Roedel <jroedel@suse.de>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/iommu/mtk_iommu.c    | 4 ++++
 drivers/iommu/mtk_iommu_v1.c | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index 77ae20ff9b35..5cff5bc556d4 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -850,6 +850,10 @@ static int mtk_iommu_probe(struct platform_device *pdev)
 			of_node_put(larbnode);
 			return -ENODEV;
 		}
+		if (!plarbdev->dev.driver) {
+			of_node_put(larbnode);
+			return -EPROBE_DEFER;
+		}
 		data->larb_imu[id].dev = &plarbdev->dev;
 
 		component_match_add_release(dev, &match, release_of,
diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
index 68bf02f87cfd..4089077256f4 100644
--- a/drivers/iommu/mtk_iommu_v1.c
+++ b/drivers/iommu/mtk_iommu_v1.c
@@ -606,6 +606,10 @@ static int mtk_iommu_probe(struct platform_device *pdev)
 			of_node_put(larbnode);
 			return -ENODEV;
 		}
+		if (!plarbdev->dev.driver) {
+			of_node_put(larbnode);
+			return -EPROBE_DEFER;
+		}
 		data->larb_imu[i].dev = &plarbdev->dev;
 
 		component_match_add_release(dev, &match, release_of,
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 04/13] iommu/mediatek: Add probe_defer for smi-larb
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang, anthony.huang,
	youlin.pei, Evan Green, Eizan Miyamoto, Matthias Kaehlcke,
	linux-arm-kernel, mingyuan.ma, linux-media, devicetree,
	Philipp Zabel, Frank Wunderlich, libo.kang, yi.kuo,
	linux-mediatek, Hsin-Yi Wang, Tiffany Lin,
	AngeloGioacchino Del Regno, anan.sun, srv_heupstream, acourbot,
	linux-kernel, iommu, Daniel Vetter, Robin Murphy

Prepare for adding device_link.

The iommu consumer should use device_link to connect with the
smi-larb(supplier). then the smi-larb should run before the iommu
consumer. Here we delay the iommu driver until the smi driver is ready,
then all the iommu consumers always are after the smi driver.

When there is no this patch, if some consumer drivers run before
smi-larb, the supplier link_status is DL_DEV_NO_DRIVER(0) in the
device_link_add, then device_links_driver_bound will use WARN_ON
to complain that the link_status of supplier is not right.

device_is_bound may be more elegant here. but it is not allowed to
EXPORT from https://lore.kernel.org/patchwork/patch/1334670/.

Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
Acked-by: Joerg Roedel <jroedel@suse.de>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/iommu/mtk_iommu.c    | 4 ++++
 drivers/iommu/mtk_iommu_v1.c | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index 77ae20ff9b35..5cff5bc556d4 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -850,6 +850,10 @@ static int mtk_iommu_probe(struct platform_device *pdev)
 			of_node_put(larbnode);
 			return -ENODEV;
 		}
+		if (!plarbdev->dev.driver) {
+			of_node_put(larbnode);
+			return -EPROBE_DEFER;
+		}
 		data->larb_imu[id].dev = &plarbdev->dev;
 
 		component_match_add_release(dev, &match, release_of,
diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
index 68bf02f87cfd..4089077256f4 100644
--- a/drivers/iommu/mtk_iommu_v1.c
+++ b/drivers/iommu/mtk_iommu_v1.c
@@ -606,6 +606,10 @@ static int mtk_iommu_probe(struct platform_device *pdev)
 			of_node_put(larbnode);
 			return -ENODEV;
 		}
+		if (!plarbdev->dev.driver) {
+			of_node_put(larbnode);
+			return -EPROBE_DEFER;
+		}
 		data->larb_imu[i].dev = &plarbdev->dev;
 
 		component_match_add_release(dev, &match, release_of,
-- 
2.18.0

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 04/13] iommu/mediatek: Add probe_defer for smi-larb
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Dafna Hirschfeld, Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang,
	anthony.huang, youlin.pei, Evan Green, Eizan Miyamoto,
	Matthias Kaehlcke, linux-arm-kernel, mingyuan.ma, linux-media,
	devicetree, Frank Wunderlich, libo.kang, yi.kuo, linux-mediatek,
	Hsin-Yi Wang, Tiffany Lin, yong.wu, AngeloGioacchino Del Regno,
	anan.sun, srv_heupstream, acourbot, linux-kernel, Tomasz Figa,
	iommu, Robin Murphy

Prepare for adding device_link.

The iommu consumer should use device_link to connect with the
smi-larb(supplier). then the smi-larb should run before the iommu
consumer. Here we delay the iommu driver until the smi driver is ready,
then all the iommu consumers always are after the smi driver.

When there is no this patch, if some consumer drivers run before
smi-larb, the supplier link_status is DL_DEV_NO_DRIVER(0) in the
device_link_add, then device_links_driver_bound will use WARN_ON
to complain that the link_status of supplier is not right.

device_is_bound may be more elegant here. but it is not allowed to
EXPORT from https://lore.kernel.org/patchwork/patch/1334670/.

Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
Acked-by: Joerg Roedel <jroedel@suse.de>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/iommu/mtk_iommu.c    | 4 ++++
 drivers/iommu/mtk_iommu_v1.c | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index 77ae20ff9b35..5cff5bc556d4 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -850,6 +850,10 @@ static int mtk_iommu_probe(struct platform_device *pdev)
 			of_node_put(larbnode);
 			return -ENODEV;
 		}
+		if (!plarbdev->dev.driver) {
+			of_node_put(larbnode);
+			return -EPROBE_DEFER;
+		}
 		data->larb_imu[id].dev = &plarbdev->dev;
 
 		component_match_add_release(dev, &match, release_of,
diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
index 68bf02f87cfd..4089077256f4 100644
--- a/drivers/iommu/mtk_iommu_v1.c
+++ b/drivers/iommu/mtk_iommu_v1.c
@@ -606,6 +606,10 @@ static int mtk_iommu_probe(struct platform_device *pdev)
 			of_node_put(larbnode);
 			return -ENODEV;
 		}
+		if (!plarbdev->dev.driver) {
+			of_node_put(larbnode);
+			return -EPROBE_DEFER;
+		}
 		data->larb_imu[i].dev = &plarbdev->dev;
 
 		component_match_add_release(dev, &match, release_of,
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 04/13] iommu/mediatek: Add probe_defer for smi-larb
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Dafna Hirschfeld, Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang,
	anthony.huang, youlin.pei, Evan Green, Eizan Miyamoto,
	Matthias Kaehlcke, linux-arm-kernel, mingyuan.ma, linux-media,
	devicetree, Philipp Zabel, libo.kang, yi.kuo, linux-mediatek,
	Hsin-Yi Wang, Tiffany Lin, yong.wu, AngeloGioacchino Del Regno,
	anan.sun, srv_heupstream, acourbot, linux-kernel, Tomasz Figa,
	iommu, Daniel Vetter, Robin Murphy

Prepare for adding device_link.

The iommu consumer should use device_link to connect with the
smi-larb(supplier). then the smi-larb should run before the iommu
consumer. Here we delay the iommu driver until the smi driver is ready,
then all the iommu consumers always are after the smi driver.

When there is no this patch, if some consumer drivers run before
smi-larb, the supplier link_status is DL_DEV_NO_DRIVER(0) in the
device_link_add, then device_links_driver_bound will use WARN_ON
to complain that the link_status of supplier is not right.

device_is_bound may be more elegant here. but it is not allowed to
EXPORT from https://lore.kernel.org/patchwork/patch/1334670/.

Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
Acked-by: Joerg Roedel <jroedel@suse.de>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/iommu/mtk_iommu.c    | 4 ++++
 drivers/iommu/mtk_iommu_v1.c | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index 77ae20ff9b35..5cff5bc556d4 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -850,6 +850,10 @@ static int mtk_iommu_probe(struct platform_device *pdev)
 			of_node_put(larbnode);
 			return -ENODEV;
 		}
+		if (!plarbdev->dev.driver) {
+			of_node_put(larbnode);
+			return -EPROBE_DEFER;
+		}
 		data->larb_imu[id].dev = &plarbdev->dev;
 
 		component_match_add_release(dev, &match, release_of,
diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
index 68bf02f87cfd..4089077256f4 100644
--- a/drivers/iommu/mtk_iommu_v1.c
+++ b/drivers/iommu/mtk_iommu_v1.c
@@ -606,6 +606,10 @@ static int mtk_iommu_probe(struct platform_device *pdev)
 			of_node_put(larbnode);
 			return -ENODEV;
 		}
+		if (!plarbdev->dev.driver) {
+			of_node_put(larbnode);
+			return -EPROBE_DEFER;
+		}
 		data->larb_imu[i].dev = &plarbdev->dev;
 
 		component_match_add_release(dev, &match, release_of,
-- 
2.18.0


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 04/13] iommu/mediatek: Add probe_defer for smi-larb
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Evan Green, Robin Murphy, Tomasz Figa, Will Deacon,
	linux-mediatek, srv_heupstream, devicetree, linux-kernel,
	linux-arm-kernel, iommu, yong.wu, youlin.pei, Matthias Kaehlcke,
	anan.sun, yi.kuo, acourbot, linux-media, dri-devel,
	Daniel Vetter, Chun-Kuang Hu, Philipp Zabel, Tiffany Lin,
	Dafna Hirschfeld, Hsin-Yi Wang, Eizan Miyamoto, anthony.huang,
	Frank Wunderlich, mingyuan.ma, yf.wang, libo.kang,
	AngeloGioacchino Del Regno

Prepare for adding device_link.

The iommu consumer should use device_link to connect with the
smi-larb(supplier). then the smi-larb should run before the iommu
consumer. Here we delay the iommu driver until the smi driver is ready,
then all the iommu consumers always are after the smi driver.

When there is no this patch, if some consumer drivers run before
smi-larb, the supplier link_status is DL_DEV_NO_DRIVER(0) in the
device_link_add, then device_links_driver_bound will use WARN_ON
to complain that the link_status of supplier is not right.

device_is_bound may be more elegant here. but it is not allowed to
EXPORT from https://lore.kernel.org/patchwork/patch/1334670/.

Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
Acked-by: Joerg Roedel <jroedel@suse.de>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/iommu/mtk_iommu.c    | 4 ++++
 drivers/iommu/mtk_iommu_v1.c | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index 77ae20ff9b35..5cff5bc556d4 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -850,6 +850,10 @@ static int mtk_iommu_probe(struct platform_device *pdev)
 			of_node_put(larbnode);
 			return -ENODEV;
 		}
+		if (!plarbdev->dev.driver) {
+			of_node_put(larbnode);
+			return -EPROBE_DEFER;
+		}
 		data->larb_imu[id].dev = &plarbdev->dev;
 
 		component_match_add_release(dev, &match, release_of,
diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
index 68bf02f87cfd..4089077256f4 100644
--- a/drivers/iommu/mtk_iommu_v1.c
+++ b/drivers/iommu/mtk_iommu_v1.c
@@ -606,6 +606,10 @@ static int mtk_iommu_probe(struct platform_device *pdev)
 			of_node_put(larbnode);
 			return -ENODEV;
 		}
+		if (!plarbdev->dev.driver) {
+			of_node_put(larbnode);
+			return -EPROBE_DEFER;
+		}
 		data->larb_imu[i].dev = &plarbdev->dev;
 
 		component_match_add_release(dev, &match, release_of,
-- 
2.18.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 05/13] iommu/mediatek: Add device_link between the consumer and the larb devices
  2022-01-17  7:04 ` Yong Wu
                     ` (2 preceding siblings ...)
  (?)
@ 2022-01-17  7:05   ` Yong Wu
  -1 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Evan Green, Robin Murphy, Tomasz Figa, Will Deacon,
	linux-mediatek, srv_heupstream, devicetree, linux-kernel,
	linux-arm-kernel, iommu, yong.wu, youlin.pei, Matthias Kaehlcke,
	anan.sun, yi.kuo, acourbot, linux-media, dri-devel,
	Daniel Vetter, Chun-Kuang Hu, Philipp Zabel, Tiffany Lin,
	Dafna Hirschfeld, Hsin-Yi Wang, Eizan Miyamoto, anthony.huang,
	Frank Wunderlich, mingyuan.ma, yf.wang, libo.kang,
	AngeloGioacchino Del Regno

MediaTek IOMMU-SMI diagram is like below. all the consumer connect with
smi-larb, then connect with smi-common.

        M4U
         |
    smi-common
         |
  -------------
  |         |    ...
  |         |
larb1     larb2
  |         |
vdec       venc

When the consumer works, it should enable the smi-larb's power which
also need enable the smi-common's power firstly.

Thus, First of all, use the device link connect the consumer and the
smi-larbs. then add device link between the smi-larb and smi-common.

This patch adds device_link between the consumer and the larbs.

When device_link_add, I add the flag DL_FLAG_STATELESS to avoid calling
pm_runtime_xx to keep the original status of clocks. It can avoid two
issues:
1) Display HW show fastlogo abnormally reported in [1]. At the beggining,
all the clocks are enabled before entering kernel, but the clocks for
display HW(always in larb0) will be gated after clk_enable and clk_disable
called from device_link_add(->pm_runtime_resume) and rpm_idle. The clock
operation happened before display driver probe. At that time, the display
HW will be abnormal.

2) A deadlock issue reported in [2]. Use DL_FLAG_STATELESS to skip
pm_runtime_xx to avoid the deadlock.

Corresponding, DL_FLAG_AUTOREMOVE_CONSUMER can't be added, then
device_link_removed should be added explicitly.

Meanwhile, Currently we don't have a device connect with 2 larbs at the
same time. Disallow this case, print the error log.

[1] https://lore.kernel.org/linux-mediatek/1564213888.22908.4.camel@mhfsdcap03/
[2] https://lore.kernel.org/patchwork/patch/1086569/

Suggested-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
Acked-by: Joerg Roedel <jroedel@suse.de>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/iommu/mtk_iommu.c    | 30 ++++++++++++++++++++++++++++++
 drivers/iommu/mtk_iommu_v1.c | 29 ++++++++++++++++++++++++++++-
 2 files changed, 58 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index 5cff5bc556d4..77df61092be3 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -562,22 +562,52 @@ static struct iommu_device *mtk_iommu_probe_device(struct device *dev)
 {
 	struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
 	struct mtk_iommu_data *data;
+	struct device_link *link;
+	struct device *larbdev;
+	unsigned int larbid, larbidx, i;
 
 	if (!fwspec || fwspec->ops != &mtk_iommu_ops)
 		return ERR_PTR(-ENODEV); /* Not a iommu client device */
 
 	data = dev_iommu_priv_get(dev);
 
+	/*
+	 * Link the consumer device with the smi-larb device(supplier).
+	 * The device that connects with each a larb is a independent HW.
+	 * All the ports in each a device should be in the same larbs.
+	 */
+	larbid = MTK_M4U_TO_LARB(fwspec->ids[0]);
+	for (i = 1; i < fwspec->num_ids; i++) {
+		larbidx = MTK_M4U_TO_LARB(fwspec->ids[i]);
+		if (larbid != larbidx) {
+			dev_err(dev, "Can only use one larb. Fail@larb%d-%d.\n",
+				larbid, larbidx);
+			return ERR_PTR(-EINVAL);
+		}
+	}
+	larbdev = data->larb_imu[larbid].dev;
+	link = device_link_add(dev, larbdev,
+			       DL_FLAG_PM_RUNTIME | DL_FLAG_STATELESS);
+	if (!link)
+		dev_err(dev, "Unable to link %s\n", dev_name(larbdev));
 	return &data->iommu;
 }
 
 static void mtk_iommu_release_device(struct device *dev)
 {
 	struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
+	struct mtk_iommu_data *data;
+	struct device *larbdev;
+	unsigned int larbid;
 
 	if (!fwspec || fwspec->ops != &mtk_iommu_ops)
 		return;
 
+	data = dev_iommu_priv_get(dev);
+	larbid = MTK_M4U_TO_LARB(fwspec->ids[0]);
+	larbdev = data->larb_imu[larbid].dev;
+	device_link_remove(dev, larbdev);
+
 	iommu_fwspec_free(dev);
 }
 
diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
index 4089077256f4..4052aad75a81 100644
--- a/drivers/iommu/mtk_iommu_v1.c
+++ b/drivers/iommu/mtk_iommu_v1.c
@@ -423,7 +423,9 @@ static struct iommu_device *mtk_iommu_probe_device(struct device *dev)
 	struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
 	struct of_phandle_args iommu_spec;
 	struct mtk_iommu_data *data;
-	int err, idx = 0;
+	int err, idx = 0, larbid, larbidx;
+	struct device_link *link;
+	struct device *larbdev;
 
 	/*
 	 * In the deferred case, free the existed fwspec.
@@ -453,6 +455,23 @@ static struct iommu_device *mtk_iommu_probe_device(struct device *dev)
 
 	data = dev_iommu_priv_get(dev);
 
+	/* Link the consumer device with the smi-larb device(supplier) */
+	larbid = mt2701_m4u_to_larb(fwspec->ids[0]);
+	for (idx = 1; idx < fwspec->num_ids; idx++) {
+		larbidx = mt2701_m4u_to_larb(fwspec->ids[idx]);
+		if (larbid != larbidx) {
+			dev_err(dev, "Can only use one larb. Fail@larb%d-%d.\n",
+				larbid, larbidx);
+			return ERR_PTR(-EINVAL);
+		}
+	}
+
+	larbdev = data->larb_imu[larbid].dev;
+	link = device_link_add(dev, larbdev,
+			       DL_FLAG_PM_RUNTIME | DL_FLAG_STATELESS);
+	if (!link)
+		dev_err(dev, "Unable to link %s\n", dev_name(larbdev));
+
 	return &data->iommu;
 }
 
@@ -473,10 +492,18 @@ static void mtk_iommu_probe_finalize(struct device *dev)
 static void mtk_iommu_release_device(struct device *dev)
 {
 	struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
+	struct mtk_iommu_data *data;
+	struct device *larbdev;
+	unsigned int larbid;
 
 	if (!fwspec || fwspec->ops != &mtk_iommu_ops)
 		return;
 
+	data = dev_iommu_priv_get(dev);
+	larbid = mt2701_m4u_to_larb(fwspec->ids[0]);
+	larbdev = data->larb_imu[larbid].dev;
+	device_link_remove(dev, larbdev);
+
 	iommu_fwspec_free(dev);
 }
 
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 05/13] iommu/mediatek: Add device_link between the consumer and the larb devices
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang, anthony.huang,
	youlin.pei, Evan Green, Eizan Miyamoto, Matthias Kaehlcke,
	linux-arm-kernel, mingyuan.ma, linux-media, devicetree,
	Philipp Zabel, Frank Wunderlich, libo.kang, yi.kuo,
	linux-mediatek, Hsin-Yi Wang, Tiffany Lin,
	AngeloGioacchino Del Regno, anan.sun, srv_heupstream, acourbot,
	linux-kernel, iommu, Daniel Vetter, Robin Murphy

MediaTek IOMMU-SMI diagram is like below. all the consumer connect with
smi-larb, then connect with smi-common.

        M4U
         |
    smi-common
         |
  -------------
  |         |    ...
  |         |
larb1     larb2
  |         |
vdec       venc

When the consumer works, it should enable the smi-larb's power which
also need enable the smi-common's power firstly.

Thus, First of all, use the device link connect the consumer and the
smi-larbs. then add device link between the smi-larb and smi-common.

This patch adds device_link between the consumer and the larbs.

When device_link_add, I add the flag DL_FLAG_STATELESS to avoid calling
pm_runtime_xx to keep the original status of clocks. It can avoid two
issues:
1) Display HW show fastlogo abnormally reported in [1]. At the beggining,
all the clocks are enabled before entering kernel, but the clocks for
display HW(always in larb0) will be gated after clk_enable and clk_disable
called from device_link_add(->pm_runtime_resume) and rpm_idle. The clock
operation happened before display driver probe. At that time, the display
HW will be abnormal.

2) A deadlock issue reported in [2]. Use DL_FLAG_STATELESS to skip
pm_runtime_xx to avoid the deadlock.

Corresponding, DL_FLAG_AUTOREMOVE_CONSUMER can't be added, then
device_link_removed should be added explicitly.

Meanwhile, Currently we don't have a device connect with 2 larbs at the
same time. Disallow this case, print the error log.

[1] https://lore.kernel.org/linux-mediatek/1564213888.22908.4.camel@mhfsdcap03/
[2] https://lore.kernel.org/patchwork/patch/1086569/

Suggested-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
Acked-by: Joerg Roedel <jroedel@suse.de>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/iommu/mtk_iommu.c    | 30 ++++++++++++++++++++++++++++++
 drivers/iommu/mtk_iommu_v1.c | 29 ++++++++++++++++++++++++++++-
 2 files changed, 58 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index 5cff5bc556d4..77df61092be3 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -562,22 +562,52 @@ static struct iommu_device *mtk_iommu_probe_device(struct device *dev)
 {
 	struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
 	struct mtk_iommu_data *data;
+	struct device_link *link;
+	struct device *larbdev;
+	unsigned int larbid, larbidx, i;
 
 	if (!fwspec || fwspec->ops != &mtk_iommu_ops)
 		return ERR_PTR(-ENODEV); /* Not a iommu client device */
 
 	data = dev_iommu_priv_get(dev);
 
+	/*
+	 * Link the consumer device with the smi-larb device(supplier).
+	 * The device that connects with each a larb is a independent HW.
+	 * All the ports in each a device should be in the same larbs.
+	 */
+	larbid = MTK_M4U_TO_LARB(fwspec->ids[0]);
+	for (i = 1; i < fwspec->num_ids; i++) {
+		larbidx = MTK_M4U_TO_LARB(fwspec->ids[i]);
+		if (larbid != larbidx) {
+			dev_err(dev, "Can only use one larb. Fail@larb%d-%d.\n",
+				larbid, larbidx);
+			return ERR_PTR(-EINVAL);
+		}
+	}
+	larbdev = data->larb_imu[larbid].dev;
+	link = device_link_add(dev, larbdev,
+			       DL_FLAG_PM_RUNTIME | DL_FLAG_STATELESS);
+	if (!link)
+		dev_err(dev, "Unable to link %s\n", dev_name(larbdev));
 	return &data->iommu;
 }
 
 static void mtk_iommu_release_device(struct device *dev)
 {
 	struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
+	struct mtk_iommu_data *data;
+	struct device *larbdev;
+	unsigned int larbid;
 
 	if (!fwspec || fwspec->ops != &mtk_iommu_ops)
 		return;
 
+	data = dev_iommu_priv_get(dev);
+	larbid = MTK_M4U_TO_LARB(fwspec->ids[0]);
+	larbdev = data->larb_imu[larbid].dev;
+	device_link_remove(dev, larbdev);
+
 	iommu_fwspec_free(dev);
 }
 
diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
index 4089077256f4..4052aad75a81 100644
--- a/drivers/iommu/mtk_iommu_v1.c
+++ b/drivers/iommu/mtk_iommu_v1.c
@@ -423,7 +423,9 @@ static struct iommu_device *mtk_iommu_probe_device(struct device *dev)
 	struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
 	struct of_phandle_args iommu_spec;
 	struct mtk_iommu_data *data;
-	int err, idx = 0;
+	int err, idx = 0, larbid, larbidx;
+	struct device_link *link;
+	struct device *larbdev;
 
 	/*
 	 * In the deferred case, free the existed fwspec.
@@ -453,6 +455,23 @@ static struct iommu_device *mtk_iommu_probe_device(struct device *dev)
 
 	data = dev_iommu_priv_get(dev);
 
+	/* Link the consumer device with the smi-larb device(supplier) */
+	larbid = mt2701_m4u_to_larb(fwspec->ids[0]);
+	for (idx = 1; idx < fwspec->num_ids; idx++) {
+		larbidx = mt2701_m4u_to_larb(fwspec->ids[idx]);
+		if (larbid != larbidx) {
+			dev_err(dev, "Can only use one larb. Fail@larb%d-%d.\n",
+				larbid, larbidx);
+			return ERR_PTR(-EINVAL);
+		}
+	}
+
+	larbdev = data->larb_imu[larbid].dev;
+	link = device_link_add(dev, larbdev,
+			       DL_FLAG_PM_RUNTIME | DL_FLAG_STATELESS);
+	if (!link)
+		dev_err(dev, "Unable to link %s\n", dev_name(larbdev));
+
 	return &data->iommu;
 }
 
@@ -473,10 +492,18 @@ static void mtk_iommu_probe_finalize(struct device *dev)
 static void mtk_iommu_release_device(struct device *dev)
 {
 	struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
+	struct mtk_iommu_data *data;
+	struct device *larbdev;
+	unsigned int larbid;
 
 	if (!fwspec || fwspec->ops != &mtk_iommu_ops)
 		return;
 
+	data = dev_iommu_priv_get(dev);
+	larbid = mt2701_m4u_to_larb(fwspec->ids[0]);
+	larbdev = data->larb_imu[larbid].dev;
+	device_link_remove(dev, larbdev);
+
 	iommu_fwspec_free(dev);
 }
 
-- 
2.18.0

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 05/13] iommu/mediatek: Add device_link between the consumer and the larb devices
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Dafna Hirschfeld, Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang,
	anthony.huang, youlin.pei, Evan Green, Eizan Miyamoto,
	Matthias Kaehlcke, linux-arm-kernel, mingyuan.ma, linux-media,
	devicetree, Frank Wunderlich, libo.kang, yi.kuo, linux-mediatek,
	Hsin-Yi Wang, Tiffany Lin, yong.wu, AngeloGioacchino Del Regno,
	anan.sun, srv_heupstream, acourbot, linux-kernel, Tomasz Figa,
	iommu, Robin Murphy

MediaTek IOMMU-SMI diagram is like below. all the consumer connect with
smi-larb, then connect with smi-common.

        M4U
         |
    smi-common
         |
  -------------
  |         |    ...
  |         |
larb1     larb2
  |         |
vdec       venc

When the consumer works, it should enable the smi-larb's power which
also need enable the smi-common's power firstly.

Thus, First of all, use the device link connect the consumer and the
smi-larbs. then add device link between the smi-larb and smi-common.

This patch adds device_link between the consumer and the larbs.

When device_link_add, I add the flag DL_FLAG_STATELESS to avoid calling
pm_runtime_xx to keep the original status of clocks. It can avoid two
issues:
1) Display HW show fastlogo abnormally reported in [1]. At the beggining,
all the clocks are enabled before entering kernel, but the clocks for
display HW(always in larb0) will be gated after clk_enable and clk_disable
called from device_link_add(->pm_runtime_resume) and rpm_idle. The clock
operation happened before display driver probe. At that time, the display
HW will be abnormal.

2) A deadlock issue reported in [2]. Use DL_FLAG_STATELESS to skip
pm_runtime_xx to avoid the deadlock.

Corresponding, DL_FLAG_AUTOREMOVE_CONSUMER can't be added, then
device_link_removed should be added explicitly.

Meanwhile, Currently we don't have a device connect with 2 larbs at the
same time. Disallow this case, print the error log.

[1] https://lore.kernel.org/linux-mediatek/1564213888.22908.4.camel@mhfsdcap03/
[2] https://lore.kernel.org/patchwork/patch/1086569/

Suggested-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
Acked-by: Joerg Roedel <jroedel@suse.de>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/iommu/mtk_iommu.c    | 30 ++++++++++++++++++++++++++++++
 drivers/iommu/mtk_iommu_v1.c | 29 ++++++++++++++++++++++++++++-
 2 files changed, 58 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index 5cff5bc556d4..77df61092be3 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -562,22 +562,52 @@ static struct iommu_device *mtk_iommu_probe_device(struct device *dev)
 {
 	struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
 	struct mtk_iommu_data *data;
+	struct device_link *link;
+	struct device *larbdev;
+	unsigned int larbid, larbidx, i;
 
 	if (!fwspec || fwspec->ops != &mtk_iommu_ops)
 		return ERR_PTR(-ENODEV); /* Not a iommu client device */
 
 	data = dev_iommu_priv_get(dev);
 
+	/*
+	 * Link the consumer device with the smi-larb device(supplier).
+	 * The device that connects with each a larb is a independent HW.
+	 * All the ports in each a device should be in the same larbs.
+	 */
+	larbid = MTK_M4U_TO_LARB(fwspec->ids[0]);
+	for (i = 1; i < fwspec->num_ids; i++) {
+		larbidx = MTK_M4U_TO_LARB(fwspec->ids[i]);
+		if (larbid != larbidx) {
+			dev_err(dev, "Can only use one larb. Fail@larb%d-%d.\n",
+				larbid, larbidx);
+			return ERR_PTR(-EINVAL);
+		}
+	}
+	larbdev = data->larb_imu[larbid].dev;
+	link = device_link_add(dev, larbdev,
+			       DL_FLAG_PM_RUNTIME | DL_FLAG_STATELESS);
+	if (!link)
+		dev_err(dev, "Unable to link %s\n", dev_name(larbdev));
 	return &data->iommu;
 }
 
 static void mtk_iommu_release_device(struct device *dev)
 {
 	struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
+	struct mtk_iommu_data *data;
+	struct device *larbdev;
+	unsigned int larbid;
 
 	if (!fwspec || fwspec->ops != &mtk_iommu_ops)
 		return;
 
+	data = dev_iommu_priv_get(dev);
+	larbid = MTK_M4U_TO_LARB(fwspec->ids[0]);
+	larbdev = data->larb_imu[larbid].dev;
+	device_link_remove(dev, larbdev);
+
 	iommu_fwspec_free(dev);
 }
 
diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
index 4089077256f4..4052aad75a81 100644
--- a/drivers/iommu/mtk_iommu_v1.c
+++ b/drivers/iommu/mtk_iommu_v1.c
@@ -423,7 +423,9 @@ static struct iommu_device *mtk_iommu_probe_device(struct device *dev)
 	struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
 	struct of_phandle_args iommu_spec;
 	struct mtk_iommu_data *data;
-	int err, idx = 0;
+	int err, idx = 0, larbid, larbidx;
+	struct device_link *link;
+	struct device *larbdev;
 
 	/*
 	 * In the deferred case, free the existed fwspec.
@@ -453,6 +455,23 @@ static struct iommu_device *mtk_iommu_probe_device(struct device *dev)
 
 	data = dev_iommu_priv_get(dev);
 
+	/* Link the consumer device with the smi-larb device(supplier) */
+	larbid = mt2701_m4u_to_larb(fwspec->ids[0]);
+	for (idx = 1; idx < fwspec->num_ids; idx++) {
+		larbidx = mt2701_m4u_to_larb(fwspec->ids[idx]);
+		if (larbid != larbidx) {
+			dev_err(dev, "Can only use one larb. Fail@larb%d-%d.\n",
+				larbid, larbidx);
+			return ERR_PTR(-EINVAL);
+		}
+	}
+
+	larbdev = data->larb_imu[larbid].dev;
+	link = device_link_add(dev, larbdev,
+			       DL_FLAG_PM_RUNTIME | DL_FLAG_STATELESS);
+	if (!link)
+		dev_err(dev, "Unable to link %s\n", dev_name(larbdev));
+
 	return &data->iommu;
 }
 
@@ -473,10 +492,18 @@ static void mtk_iommu_probe_finalize(struct device *dev)
 static void mtk_iommu_release_device(struct device *dev)
 {
 	struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
+	struct mtk_iommu_data *data;
+	struct device *larbdev;
+	unsigned int larbid;
 
 	if (!fwspec || fwspec->ops != &mtk_iommu_ops)
 		return;
 
+	data = dev_iommu_priv_get(dev);
+	larbid = mt2701_m4u_to_larb(fwspec->ids[0]);
+	larbdev = data->larb_imu[larbid].dev;
+	device_link_remove(dev, larbdev);
+
 	iommu_fwspec_free(dev);
 }
 
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 05/13] iommu/mediatek: Add device_link between the consumer and the larb devices
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Dafna Hirschfeld, Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang,
	anthony.huang, youlin.pei, Evan Green, Eizan Miyamoto,
	Matthias Kaehlcke, linux-arm-kernel, mingyuan.ma, linux-media,
	devicetree, Philipp Zabel, libo.kang, yi.kuo, linux-mediatek,
	Hsin-Yi Wang, Tiffany Lin, yong.wu, AngeloGioacchino Del Regno,
	anan.sun, srv_heupstream, acourbot, linux-kernel, Tomasz Figa,
	iommu, Daniel Vetter, Robin Murphy

MediaTek IOMMU-SMI diagram is like below. all the consumer connect with
smi-larb, then connect with smi-common.

        M4U
         |
    smi-common
         |
  -------------
  |         |    ...
  |         |
larb1     larb2
  |         |
vdec       venc

When the consumer works, it should enable the smi-larb's power which
also need enable the smi-common's power firstly.

Thus, First of all, use the device link connect the consumer and the
smi-larbs. then add device link between the smi-larb and smi-common.

This patch adds device_link between the consumer and the larbs.

When device_link_add, I add the flag DL_FLAG_STATELESS to avoid calling
pm_runtime_xx to keep the original status of clocks. It can avoid two
issues:
1) Display HW show fastlogo abnormally reported in [1]. At the beggining,
all the clocks are enabled before entering kernel, but the clocks for
display HW(always in larb0) will be gated after clk_enable and clk_disable
called from device_link_add(->pm_runtime_resume) and rpm_idle. The clock
operation happened before display driver probe. At that time, the display
HW will be abnormal.

2) A deadlock issue reported in [2]. Use DL_FLAG_STATELESS to skip
pm_runtime_xx to avoid the deadlock.

Corresponding, DL_FLAG_AUTOREMOVE_CONSUMER can't be added, then
device_link_removed should be added explicitly.

Meanwhile, Currently we don't have a device connect with 2 larbs at the
same time. Disallow this case, print the error log.

[1] https://lore.kernel.org/linux-mediatek/1564213888.22908.4.camel@mhfsdcap03/
[2] https://lore.kernel.org/patchwork/patch/1086569/

Suggested-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
Acked-by: Joerg Roedel <jroedel@suse.de>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/iommu/mtk_iommu.c    | 30 ++++++++++++++++++++++++++++++
 drivers/iommu/mtk_iommu_v1.c | 29 ++++++++++++++++++++++++++++-
 2 files changed, 58 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index 5cff5bc556d4..77df61092be3 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -562,22 +562,52 @@ static struct iommu_device *mtk_iommu_probe_device(struct device *dev)
 {
 	struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
 	struct mtk_iommu_data *data;
+	struct device_link *link;
+	struct device *larbdev;
+	unsigned int larbid, larbidx, i;
 
 	if (!fwspec || fwspec->ops != &mtk_iommu_ops)
 		return ERR_PTR(-ENODEV); /* Not a iommu client device */
 
 	data = dev_iommu_priv_get(dev);
 
+	/*
+	 * Link the consumer device with the smi-larb device(supplier).
+	 * The device that connects with each a larb is a independent HW.
+	 * All the ports in each a device should be in the same larbs.
+	 */
+	larbid = MTK_M4U_TO_LARB(fwspec->ids[0]);
+	for (i = 1; i < fwspec->num_ids; i++) {
+		larbidx = MTK_M4U_TO_LARB(fwspec->ids[i]);
+		if (larbid != larbidx) {
+			dev_err(dev, "Can only use one larb. Fail@larb%d-%d.\n",
+				larbid, larbidx);
+			return ERR_PTR(-EINVAL);
+		}
+	}
+	larbdev = data->larb_imu[larbid].dev;
+	link = device_link_add(dev, larbdev,
+			       DL_FLAG_PM_RUNTIME | DL_FLAG_STATELESS);
+	if (!link)
+		dev_err(dev, "Unable to link %s\n", dev_name(larbdev));
 	return &data->iommu;
 }
 
 static void mtk_iommu_release_device(struct device *dev)
 {
 	struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
+	struct mtk_iommu_data *data;
+	struct device *larbdev;
+	unsigned int larbid;
 
 	if (!fwspec || fwspec->ops != &mtk_iommu_ops)
 		return;
 
+	data = dev_iommu_priv_get(dev);
+	larbid = MTK_M4U_TO_LARB(fwspec->ids[0]);
+	larbdev = data->larb_imu[larbid].dev;
+	device_link_remove(dev, larbdev);
+
 	iommu_fwspec_free(dev);
 }
 
diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
index 4089077256f4..4052aad75a81 100644
--- a/drivers/iommu/mtk_iommu_v1.c
+++ b/drivers/iommu/mtk_iommu_v1.c
@@ -423,7 +423,9 @@ static struct iommu_device *mtk_iommu_probe_device(struct device *dev)
 	struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
 	struct of_phandle_args iommu_spec;
 	struct mtk_iommu_data *data;
-	int err, idx = 0;
+	int err, idx = 0, larbid, larbidx;
+	struct device_link *link;
+	struct device *larbdev;
 
 	/*
 	 * In the deferred case, free the existed fwspec.
@@ -453,6 +455,23 @@ static struct iommu_device *mtk_iommu_probe_device(struct device *dev)
 
 	data = dev_iommu_priv_get(dev);
 
+	/* Link the consumer device with the smi-larb device(supplier) */
+	larbid = mt2701_m4u_to_larb(fwspec->ids[0]);
+	for (idx = 1; idx < fwspec->num_ids; idx++) {
+		larbidx = mt2701_m4u_to_larb(fwspec->ids[idx]);
+		if (larbid != larbidx) {
+			dev_err(dev, "Can only use one larb. Fail@larb%d-%d.\n",
+				larbid, larbidx);
+			return ERR_PTR(-EINVAL);
+		}
+	}
+
+	larbdev = data->larb_imu[larbid].dev;
+	link = device_link_add(dev, larbdev,
+			       DL_FLAG_PM_RUNTIME | DL_FLAG_STATELESS);
+	if (!link)
+		dev_err(dev, "Unable to link %s\n", dev_name(larbdev));
+
 	return &data->iommu;
 }
 
@@ -473,10 +492,18 @@ static void mtk_iommu_probe_finalize(struct device *dev)
 static void mtk_iommu_release_device(struct device *dev)
 {
 	struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
+	struct mtk_iommu_data *data;
+	struct device *larbdev;
+	unsigned int larbid;
 
 	if (!fwspec || fwspec->ops != &mtk_iommu_ops)
 		return;
 
+	data = dev_iommu_priv_get(dev);
+	larbid = mt2701_m4u_to_larb(fwspec->ids[0]);
+	larbdev = data->larb_imu[larbid].dev;
+	device_link_remove(dev, larbdev);
+
 	iommu_fwspec_free(dev);
 }
 
-- 
2.18.0


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 05/13] iommu/mediatek: Add device_link between the consumer and the larb devices
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Evan Green, Robin Murphy, Tomasz Figa, Will Deacon,
	linux-mediatek, srv_heupstream, devicetree, linux-kernel,
	linux-arm-kernel, iommu, yong.wu, youlin.pei, Matthias Kaehlcke,
	anan.sun, yi.kuo, acourbot, linux-media, dri-devel,
	Daniel Vetter, Chun-Kuang Hu, Philipp Zabel, Tiffany Lin,
	Dafna Hirschfeld, Hsin-Yi Wang, Eizan Miyamoto, anthony.huang,
	Frank Wunderlich, mingyuan.ma, yf.wang, libo.kang,
	AngeloGioacchino Del Regno

MediaTek IOMMU-SMI diagram is like below. all the consumer connect with
smi-larb, then connect with smi-common.

        M4U
         |
    smi-common
         |
  -------------
  |         |    ...
  |         |
larb1     larb2
  |         |
vdec       venc

When the consumer works, it should enable the smi-larb's power which
also need enable the smi-common's power firstly.

Thus, First of all, use the device link connect the consumer and the
smi-larbs. then add device link between the smi-larb and smi-common.

This patch adds device_link between the consumer and the larbs.

When device_link_add, I add the flag DL_FLAG_STATELESS to avoid calling
pm_runtime_xx to keep the original status of clocks. It can avoid two
issues:
1) Display HW show fastlogo abnormally reported in [1]. At the beggining,
all the clocks are enabled before entering kernel, but the clocks for
display HW(always in larb0) will be gated after clk_enable and clk_disable
called from device_link_add(->pm_runtime_resume) and rpm_idle. The clock
operation happened before display driver probe. At that time, the display
HW will be abnormal.

2) A deadlock issue reported in [2]. Use DL_FLAG_STATELESS to skip
pm_runtime_xx to avoid the deadlock.

Corresponding, DL_FLAG_AUTOREMOVE_CONSUMER can't be added, then
device_link_removed should be added explicitly.

Meanwhile, Currently we don't have a device connect with 2 larbs at the
same time. Disallow this case, print the error log.

[1] https://lore.kernel.org/linux-mediatek/1564213888.22908.4.camel@mhfsdcap03/
[2] https://lore.kernel.org/patchwork/patch/1086569/

Suggested-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
Acked-by: Joerg Roedel <jroedel@suse.de>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/iommu/mtk_iommu.c    | 30 ++++++++++++++++++++++++++++++
 drivers/iommu/mtk_iommu_v1.c | 29 ++++++++++++++++++++++++++++-
 2 files changed, 58 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index 5cff5bc556d4..77df61092be3 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -562,22 +562,52 @@ static struct iommu_device *mtk_iommu_probe_device(struct device *dev)
 {
 	struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
 	struct mtk_iommu_data *data;
+	struct device_link *link;
+	struct device *larbdev;
+	unsigned int larbid, larbidx, i;
 
 	if (!fwspec || fwspec->ops != &mtk_iommu_ops)
 		return ERR_PTR(-ENODEV); /* Not a iommu client device */
 
 	data = dev_iommu_priv_get(dev);
 
+	/*
+	 * Link the consumer device with the smi-larb device(supplier).
+	 * The device that connects with each a larb is a independent HW.
+	 * All the ports in each a device should be in the same larbs.
+	 */
+	larbid = MTK_M4U_TO_LARB(fwspec->ids[0]);
+	for (i = 1; i < fwspec->num_ids; i++) {
+		larbidx = MTK_M4U_TO_LARB(fwspec->ids[i]);
+		if (larbid != larbidx) {
+			dev_err(dev, "Can only use one larb. Fail@larb%d-%d.\n",
+				larbid, larbidx);
+			return ERR_PTR(-EINVAL);
+		}
+	}
+	larbdev = data->larb_imu[larbid].dev;
+	link = device_link_add(dev, larbdev,
+			       DL_FLAG_PM_RUNTIME | DL_FLAG_STATELESS);
+	if (!link)
+		dev_err(dev, "Unable to link %s\n", dev_name(larbdev));
 	return &data->iommu;
 }
 
 static void mtk_iommu_release_device(struct device *dev)
 {
 	struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
+	struct mtk_iommu_data *data;
+	struct device *larbdev;
+	unsigned int larbid;
 
 	if (!fwspec || fwspec->ops != &mtk_iommu_ops)
 		return;
 
+	data = dev_iommu_priv_get(dev);
+	larbid = MTK_M4U_TO_LARB(fwspec->ids[0]);
+	larbdev = data->larb_imu[larbid].dev;
+	device_link_remove(dev, larbdev);
+
 	iommu_fwspec_free(dev);
 }
 
diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
index 4089077256f4..4052aad75a81 100644
--- a/drivers/iommu/mtk_iommu_v1.c
+++ b/drivers/iommu/mtk_iommu_v1.c
@@ -423,7 +423,9 @@ static struct iommu_device *mtk_iommu_probe_device(struct device *dev)
 	struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
 	struct of_phandle_args iommu_spec;
 	struct mtk_iommu_data *data;
-	int err, idx = 0;
+	int err, idx = 0, larbid, larbidx;
+	struct device_link *link;
+	struct device *larbdev;
 
 	/*
 	 * In the deferred case, free the existed fwspec.
@@ -453,6 +455,23 @@ static struct iommu_device *mtk_iommu_probe_device(struct device *dev)
 
 	data = dev_iommu_priv_get(dev);
 
+	/* Link the consumer device with the smi-larb device(supplier) */
+	larbid = mt2701_m4u_to_larb(fwspec->ids[0]);
+	for (idx = 1; idx < fwspec->num_ids; idx++) {
+		larbidx = mt2701_m4u_to_larb(fwspec->ids[idx]);
+		if (larbid != larbidx) {
+			dev_err(dev, "Can only use one larb. Fail@larb%d-%d.\n",
+				larbid, larbidx);
+			return ERR_PTR(-EINVAL);
+		}
+	}
+
+	larbdev = data->larb_imu[larbid].dev;
+	link = device_link_add(dev, larbdev,
+			       DL_FLAG_PM_RUNTIME | DL_FLAG_STATELESS);
+	if (!link)
+		dev_err(dev, "Unable to link %s\n", dev_name(larbdev));
+
 	return &data->iommu;
 }
 
@@ -473,10 +492,18 @@ static void mtk_iommu_probe_finalize(struct device *dev)
 static void mtk_iommu_release_device(struct device *dev)
 {
 	struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
+	struct mtk_iommu_data *data;
+	struct device *larbdev;
+	unsigned int larbid;
 
 	if (!fwspec || fwspec->ops != &mtk_iommu_ops)
 		return;
 
+	data = dev_iommu_priv_get(dev);
+	larbid = mt2701_m4u_to_larb(fwspec->ids[0]);
+	larbdev = data->larb_imu[larbid].dev;
+	device_link_remove(dev, larbdev);
+
 	iommu_fwspec_free(dev);
 }
 
-- 
2.18.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 06/13] media: mtk-jpeg: Get rid of mtk_smi_larb_get/put
  2022-01-17  7:04 ` Yong Wu
                     ` (2 preceding siblings ...)
  (?)
@ 2022-01-17  7:05   ` Yong Wu
  -1 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Xia Jiang, Dafna Hirschfeld, Chun-Kuang Hu, Will Deacon,
	dri-devel, yf.wang, anthony.huang, youlin.pei, Rick Chang,
	Evan Green, Eizan Miyamoto, Matthias Kaehlcke, linux-arm-kernel,
	mingyuan.ma, linux-media, devicetree, Frank Wunderlich,
	libo.kang, yi.kuo, linux-mediatek, Hsin-Yi Wang, Tiffany Lin,
	yong.wu, AngeloGioacchino Del Regno, anan.sun, srv_heupstream,
	acourbot, linux-kernel, Tomasz Figa, iommu, Robin Murphy

MediaTek IOMMU has already added device_link between the consumer
and smi-larb device. If the jpg device calls the pm_runtime_get_sync,
the smi-larb's pm_runtime_get_sync also be called automatically.

After removing the larb_get operations, then mtk_jpeg_clk_init is
also unnecessary. Remove it too.

CC: Rick Chang <rick.chang@mediatek.com>
CC: Xia Jiang <xia.jiang@mediatek.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Evan Green <evgreen@chromium.org>
Acked-by: Rick Chang <rick.chang@mediatek.com>
Reviewed-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
Acked-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 .../media/platform/mtk-jpeg/mtk_jpeg_core.c   | 45 +------------------
 .../media/platform/mtk-jpeg/mtk_jpeg_core.h   |  2 -
 2 files changed, 2 insertions(+), 45 deletions(-)

diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
index af994b9913a6..1e29ca0aad77 100644
--- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
+++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
@@ -22,7 +22,6 @@
 #include <media/v4l2-ioctl.h>
 #include <media/videobuf2-core.h>
 #include <media/videobuf2-dma-contig.h>
-#include <soc/mediatek/smi.h>
 
 #include "mtk_jpeg_enc_hw.h"
 #include "mtk_jpeg_dec_hw.h"
@@ -1055,10 +1054,6 @@ static void mtk_jpeg_clk_on(struct mtk_jpeg_dev *jpeg)
 {
 	int ret;
 
-	ret = mtk_smi_larb_get(jpeg->larb);
-	if (ret)
-		dev_err(jpeg->dev, "mtk_smi_larb_get larbvdec fail %d\n", ret);
-
 	ret = clk_bulk_prepare_enable(jpeg->variant->num_clks,
 				      jpeg->variant->clks);
 	if (ret)
@@ -1069,7 +1064,6 @@ static void mtk_jpeg_clk_off(struct mtk_jpeg_dev *jpeg)
 {
 	clk_bulk_disable_unprepare(jpeg->variant->num_clks,
 				   jpeg->variant->clks);
-	mtk_smi_larb_put(jpeg->larb);
 }
 
 static irqreturn_t mtk_jpeg_enc_done(struct mtk_jpeg_dev *jpeg)
@@ -1284,35 +1278,6 @@ static struct clk_bulk_data mtk_jpeg_clocks[] = {
 	{ .id = "jpgenc" },
 };
 
-static int mtk_jpeg_clk_init(struct mtk_jpeg_dev *jpeg)
-{
-	struct device_node *node;
-	struct platform_device *pdev;
-	int ret;
-
-	node = of_parse_phandle(jpeg->dev->of_node, "mediatek,larb", 0);
-	if (!node)
-		return -EINVAL;
-	pdev = of_find_device_by_node(node);
-	if (WARN_ON(!pdev)) {
-		of_node_put(node);
-		return -EINVAL;
-	}
-	of_node_put(node);
-
-	jpeg->larb = &pdev->dev;
-
-	ret = devm_clk_bulk_get(jpeg->dev, jpeg->variant->num_clks,
-				jpeg->variant->clks);
-	if (ret) {
-		dev_err(&pdev->dev, "failed to get jpeg clock:%d\n", ret);
-		put_device(&pdev->dev);
-		return ret;
-	}
-
-	return 0;
-}
-
 static void mtk_jpeg_job_timeout_work(struct work_struct *work)
 {
 	struct mtk_jpeg_dev *jpeg = container_of(work, struct mtk_jpeg_dev,
@@ -1333,11 +1298,6 @@ static void mtk_jpeg_job_timeout_work(struct work_struct *work)
 	v4l2_m2m_job_finish(jpeg->m2m_dev, ctx->fh.m2m_ctx);
 }
 
-static inline void mtk_jpeg_clk_release(struct mtk_jpeg_dev *jpeg)
-{
-	put_device(jpeg->larb);
-}
-
 static int mtk_jpeg_probe(struct platform_device *pdev)
 {
 	struct mtk_jpeg_dev *jpeg;
@@ -1374,7 +1334,8 @@ static int mtk_jpeg_probe(struct platform_device *pdev)
 		goto err_req_irq;
 	}
 
-	ret = mtk_jpeg_clk_init(jpeg);
+	ret = devm_clk_bulk_get(jpeg->dev, jpeg->variant->num_clks,
+				jpeg->variant->clks);
 	if (ret) {
 		dev_err(&pdev->dev, "Failed to init clk, err %d\n", ret);
 		goto err_clk_init;
@@ -1440,7 +1401,6 @@ static int mtk_jpeg_probe(struct platform_device *pdev)
 	v4l2_device_unregister(&jpeg->v4l2_dev);
 
 err_dev_register:
-	mtk_jpeg_clk_release(jpeg);
 
 err_clk_init:
 
@@ -1458,7 +1418,6 @@ static int mtk_jpeg_remove(struct platform_device *pdev)
 	video_device_release(jpeg->vdev);
 	v4l2_m2m_release(jpeg->m2m_dev);
 	v4l2_device_unregister(&jpeg->v4l2_dev);
-	mtk_jpeg_clk_release(jpeg);
 
 	return 0;
 }
diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h
index 595f7f10c9fd..3e4811a41ba2 100644
--- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h
+++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h
@@ -85,7 +85,6 @@ struct mtk_jpeg_variant {
  * @alloc_ctx:		videobuf2 memory allocator's context
  * @vdev:		video device node for jpeg mem2mem mode
  * @reg_base:		JPEG registers mapping
- * @larb:		SMI device
  * @job_timeout_work:	IRQ timeout structure
  * @variant:		driver variant to be used
  */
@@ -99,7 +98,6 @@ struct mtk_jpeg_dev {
 	void			*alloc_ctx;
 	struct video_device	*vdev;
 	void __iomem		*reg_base;
-	struct device		*larb;
 	struct delayed_work job_timeout_work;
 	const struct mtk_jpeg_variant *variant;
 };
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 06/13] media: mtk-jpeg: Get rid of mtk_smi_larb_get/put
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Evan Green, Robin Murphy, Tomasz Figa, Will Deacon,
	linux-mediatek, srv_heupstream, devicetree, linux-kernel,
	linux-arm-kernel, iommu, yong.wu, youlin.pei, Matthias Kaehlcke,
	anan.sun, yi.kuo, acourbot, linux-media, dri-devel,
	Daniel Vetter, Chun-Kuang Hu, Philipp Zabel, Tiffany Lin,
	Dafna Hirschfeld, Hsin-Yi Wang, Eizan Miyamoto, anthony.huang,
	Frank Wunderlich, mingyuan.ma, yf.wang, libo.kang,
	AngeloGioacchino Del Regno, Rick Chang, Xia Jiang

MediaTek IOMMU has already added device_link between the consumer
and smi-larb device. If the jpg device calls the pm_runtime_get_sync,
the smi-larb's pm_runtime_get_sync also be called automatically.

After removing the larb_get operations, then mtk_jpeg_clk_init is
also unnecessary. Remove it too.

CC: Rick Chang <rick.chang@mediatek.com>
CC: Xia Jiang <xia.jiang@mediatek.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Evan Green <evgreen@chromium.org>
Acked-by: Rick Chang <rick.chang@mediatek.com>
Reviewed-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
Acked-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 .../media/platform/mtk-jpeg/mtk_jpeg_core.c   | 45 +------------------
 .../media/platform/mtk-jpeg/mtk_jpeg_core.h   |  2 -
 2 files changed, 2 insertions(+), 45 deletions(-)

diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
index af994b9913a6..1e29ca0aad77 100644
--- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
+++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
@@ -22,7 +22,6 @@
 #include <media/v4l2-ioctl.h>
 #include <media/videobuf2-core.h>
 #include <media/videobuf2-dma-contig.h>
-#include <soc/mediatek/smi.h>
 
 #include "mtk_jpeg_enc_hw.h"
 #include "mtk_jpeg_dec_hw.h"
@@ -1055,10 +1054,6 @@ static void mtk_jpeg_clk_on(struct mtk_jpeg_dev *jpeg)
 {
 	int ret;
 
-	ret = mtk_smi_larb_get(jpeg->larb);
-	if (ret)
-		dev_err(jpeg->dev, "mtk_smi_larb_get larbvdec fail %d\n", ret);
-
 	ret = clk_bulk_prepare_enable(jpeg->variant->num_clks,
 				      jpeg->variant->clks);
 	if (ret)
@@ -1069,7 +1064,6 @@ static void mtk_jpeg_clk_off(struct mtk_jpeg_dev *jpeg)
 {
 	clk_bulk_disable_unprepare(jpeg->variant->num_clks,
 				   jpeg->variant->clks);
-	mtk_smi_larb_put(jpeg->larb);
 }
 
 static irqreturn_t mtk_jpeg_enc_done(struct mtk_jpeg_dev *jpeg)
@@ -1284,35 +1278,6 @@ static struct clk_bulk_data mtk_jpeg_clocks[] = {
 	{ .id = "jpgenc" },
 };
 
-static int mtk_jpeg_clk_init(struct mtk_jpeg_dev *jpeg)
-{
-	struct device_node *node;
-	struct platform_device *pdev;
-	int ret;
-
-	node = of_parse_phandle(jpeg->dev->of_node, "mediatek,larb", 0);
-	if (!node)
-		return -EINVAL;
-	pdev = of_find_device_by_node(node);
-	if (WARN_ON(!pdev)) {
-		of_node_put(node);
-		return -EINVAL;
-	}
-	of_node_put(node);
-
-	jpeg->larb = &pdev->dev;
-
-	ret = devm_clk_bulk_get(jpeg->dev, jpeg->variant->num_clks,
-				jpeg->variant->clks);
-	if (ret) {
-		dev_err(&pdev->dev, "failed to get jpeg clock:%d\n", ret);
-		put_device(&pdev->dev);
-		return ret;
-	}
-
-	return 0;
-}
-
 static void mtk_jpeg_job_timeout_work(struct work_struct *work)
 {
 	struct mtk_jpeg_dev *jpeg = container_of(work, struct mtk_jpeg_dev,
@@ -1333,11 +1298,6 @@ static void mtk_jpeg_job_timeout_work(struct work_struct *work)
 	v4l2_m2m_job_finish(jpeg->m2m_dev, ctx->fh.m2m_ctx);
 }
 
-static inline void mtk_jpeg_clk_release(struct mtk_jpeg_dev *jpeg)
-{
-	put_device(jpeg->larb);
-}
-
 static int mtk_jpeg_probe(struct platform_device *pdev)
 {
 	struct mtk_jpeg_dev *jpeg;
@@ -1374,7 +1334,8 @@ static int mtk_jpeg_probe(struct platform_device *pdev)
 		goto err_req_irq;
 	}
 
-	ret = mtk_jpeg_clk_init(jpeg);
+	ret = devm_clk_bulk_get(jpeg->dev, jpeg->variant->num_clks,
+				jpeg->variant->clks);
 	if (ret) {
 		dev_err(&pdev->dev, "Failed to init clk, err %d\n", ret);
 		goto err_clk_init;
@@ -1440,7 +1401,6 @@ static int mtk_jpeg_probe(struct platform_device *pdev)
 	v4l2_device_unregister(&jpeg->v4l2_dev);
 
 err_dev_register:
-	mtk_jpeg_clk_release(jpeg);
 
 err_clk_init:
 
@@ -1458,7 +1418,6 @@ static int mtk_jpeg_remove(struct platform_device *pdev)
 	video_device_release(jpeg->vdev);
 	v4l2_m2m_release(jpeg->m2m_dev);
 	v4l2_device_unregister(&jpeg->v4l2_dev);
-	mtk_jpeg_clk_release(jpeg);
 
 	return 0;
 }
diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h
index 595f7f10c9fd..3e4811a41ba2 100644
--- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h
+++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h
@@ -85,7 +85,6 @@ struct mtk_jpeg_variant {
  * @alloc_ctx:		videobuf2 memory allocator's context
  * @vdev:		video device node for jpeg mem2mem mode
  * @reg_base:		JPEG registers mapping
- * @larb:		SMI device
  * @job_timeout_work:	IRQ timeout structure
  * @variant:		driver variant to be used
  */
@@ -99,7 +98,6 @@ struct mtk_jpeg_dev {
 	void			*alloc_ctx;
 	struct video_device	*vdev;
 	void __iomem		*reg_base;
-	struct device		*larb;
 	struct delayed_work job_timeout_work;
 	const struct mtk_jpeg_variant *variant;
 };
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 06/13] media: mtk-jpeg: Get rid of mtk_smi_larb_get/put
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Xia Jiang, Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang,
	anthony.huang, youlin.pei, Rick Chang, Evan Green,
	Eizan Miyamoto, Matthias Kaehlcke, linux-arm-kernel, mingyuan.ma,
	linux-media, devicetree, Philipp Zabel, Frank Wunderlich,
	libo.kang, yi.kuo, linux-mediatek, Hsin-Yi Wang, Tiffany Lin,
	AngeloGioacchino Del Regno, anan.sun, srv_heupstream, acourbot,
	linux-kernel, iommu, Daniel Vetter, Robin Murphy

MediaTek IOMMU has already added device_link between the consumer
and smi-larb device. If the jpg device calls the pm_runtime_get_sync,
the smi-larb's pm_runtime_get_sync also be called automatically.

After removing the larb_get operations, then mtk_jpeg_clk_init is
also unnecessary. Remove it too.

CC: Rick Chang <rick.chang@mediatek.com>
CC: Xia Jiang <xia.jiang@mediatek.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Evan Green <evgreen@chromium.org>
Acked-by: Rick Chang <rick.chang@mediatek.com>
Reviewed-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
Acked-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 .../media/platform/mtk-jpeg/mtk_jpeg_core.c   | 45 +------------------
 .../media/platform/mtk-jpeg/mtk_jpeg_core.h   |  2 -
 2 files changed, 2 insertions(+), 45 deletions(-)

diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
index af994b9913a6..1e29ca0aad77 100644
--- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
+++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
@@ -22,7 +22,6 @@
 #include <media/v4l2-ioctl.h>
 #include <media/videobuf2-core.h>
 #include <media/videobuf2-dma-contig.h>
-#include <soc/mediatek/smi.h>
 
 #include "mtk_jpeg_enc_hw.h"
 #include "mtk_jpeg_dec_hw.h"
@@ -1055,10 +1054,6 @@ static void mtk_jpeg_clk_on(struct mtk_jpeg_dev *jpeg)
 {
 	int ret;
 
-	ret = mtk_smi_larb_get(jpeg->larb);
-	if (ret)
-		dev_err(jpeg->dev, "mtk_smi_larb_get larbvdec fail %d\n", ret);
-
 	ret = clk_bulk_prepare_enable(jpeg->variant->num_clks,
 				      jpeg->variant->clks);
 	if (ret)
@@ -1069,7 +1064,6 @@ static void mtk_jpeg_clk_off(struct mtk_jpeg_dev *jpeg)
 {
 	clk_bulk_disable_unprepare(jpeg->variant->num_clks,
 				   jpeg->variant->clks);
-	mtk_smi_larb_put(jpeg->larb);
 }
 
 static irqreturn_t mtk_jpeg_enc_done(struct mtk_jpeg_dev *jpeg)
@@ -1284,35 +1278,6 @@ static struct clk_bulk_data mtk_jpeg_clocks[] = {
 	{ .id = "jpgenc" },
 };
 
-static int mtk_jpeg_clk_init(struct mtk_jpeg_dev *jpeg)
-{
-	struct device_node *node;
-	struct platform_device *pdev;
-	int ret;
-
-	node = of_parse_phandle(jpeg->dev->of_node, "mediatek,larb", 0);
-	if (!node)
-		return -EINVAL;
-	pdev = of_find_device_by_node(node);
-	if (WARN_ON(!pdev)) {
-		of_node_put(node);
-		return -EINVAL;
-	}
-	of_node_put(node);
-
-	jpeg->larb = &pdev->dev;
-
-	ret = devm_clk_bulk_get(jpeg->dev, jpeg->variant->num_clks,
-				jpeg->variant->clks);
-	if (ret) {
-		dev_err(&pdev->dev, "failed to get jpeg clock:%d\n", ret);
-		put_device(&pdev->dev);
-		return ret;
-	}
-
-	return 0;
-}
-
 static void mtk_jpeg_job_timeout_work(struct work_struct *work)
 {
 	struct mtk_jpeg_dev *jpeg = container_of(work, struct mtk_jpeg_dev,
@@ -1333,11 +1298,6 @@ static void mtk_jpeg_job_timeout_work(struct work_struct *work)
 	v4l2_m2m_job_finish(jpeg->m2m_dev, ctx->fh.m2m_ctx);
 }
 
-static inline void mtk_jpeg_clk_release(struct mtk_jpeg_dev *jpeg)
-{
-	put_device(jpeg->larb);
-}
-
 static int mtk_jpeg_probe(struct platform_device *pdev)
 {
 	struct mtk_jpeg_dev *jpeg;
@@ -1374,7 +1334,8 @@ static int mtk_jpeg_probe(struct platform_device *pdev)
 		goto err_req_irq;
 	}
 
-	ret = mtk_jpeg_clk_init(jpeg);
+	ret = devm_clk_bulk_get(jpeg->dev, jpeg->variant->num_clks,
+				jpeg->variant->clks);
 	if (ret) {
 		dev_err(&pdev->dev, "Failed to init clk, err %d\n", ret);
 		goto err_clk_init;
@@ -1440,7 +1401,6 @@ static int mtk_jpeg_probe(struct platform_device *pdev)
 	v4l2_device_unregister(&jpeg->v4l2_dev);
 
 err_dev_register:
-	mtk_jpeg_clk_release(jpeg);
 
 err_clk_init:
 
@@ -1458,7 +1418,6 @@ static int mtk_jpeg_remove(struct platform_device *pdev)
 	video_device_release(jpeg->vdev);
 	v4l2_m2m_release(jpeg->m2m_dev);
 	v4l2_device_unregister(&jpeg->v4l2_dev);
-	mtk_jpeg_clk_release(jpeg);
 
 	return 0;
 }
diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h
index 595f7f10c9fd..3e4811a41ba2 100644
--- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h
+++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h
@@ -85,7 +85,6 @@ struct mtk_jpeg_variant {
  * @alloc_ctx:		videobuf2 memory allocator's context
  * @vdev:		video device node for jpeg mem2mem mode
  * @reg_base:		JPEG registers mapping
- * @larb:		SMI device
  * @job_timeout_work:	IRQ timeout structure
  * @variant:		driver variant to be used
  */
@@ -99,7 +98,6 @@ struct mtk_jpeg_dev {
 	void			*alloc_ctx;
 	struct video_device	*vdev;
 	void __iomem		*reg_base;
-	struct device		*larb;
 	struct delayed_work job_timeout_work;
 	const struct mtk_jpeg_variant *variant;
 };
-- 
2.18.0

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 06/13] media: mtk-jpeg: Get rid of mtk_smi_larb_get/put
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Xia Jiang, Dafna Hirschfeld, Chun-Kuang Hu, Will Deacon,
	dri-devel, yf.wang, anthony.huang, youlin.pei, Rick Chang,
	Evan Green, Eizan Miyamoto, Matthias Kaehlcke, linux-arm-kernel,
	mingyuan.ma, linux-media, devicetree, Philipp Zabel, libo.kang,
	yi.kuo, linux-mediatek, Hsin-Yi Wang, Tiffany Lin, yong.wu,
	AngeloGioacchino Del Regno, anan.sun, srv_heupstream, acourbot,
	linux-kernel, Tomasz Figa, iommu, Daniel Vetter, Robin Murphy

MediaTek IOMMU has already added device_link between the consumer
and smi-larb device. If the jpg device calls the pm_runtime_get_sync,
the smi-larb's pm_runtime_get_sync also be called automatically.

After removing the larb_get operations, then mtk_jpeg_clk_init is
also unnecessary. Remove it too.

CC: Rick Chang <rick.chang@mediatek.com>
CC: Xia Jiang <xia.jiang@mediatek.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Evan Green <evgreen@chromium.org>
Acked-by: Rick Chang <rick.chang@mediatek.com>
Reviewed-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
Acked-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 .../media/platform/mtk-jpeg/mtk_jpeg_core.c   | 45 +------------------
 .../media/platform/mtk-jpeg/mtk_jpeg_core.h   |  2 -
 2 files changed, 2 insertions(+), 45 deletions(-)

diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
index af994b9913a6..1e29ca0aad77 100644
--- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
+++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
@@ -22,7 +22,6 @@
 #include <media/v4l2-ioctl.h>
 #include <media/videobuf2-core.h>
 #include <media/videobuf2-dma-contig.h>
-#include <soc/mediatek/smi.h>
 
 #include "mtk_jpeg_enc_hw.h"
 #include "mtk_jpeg_dec_hw.h"
@@ -1055,10 +1054,6 @@ static void mtk_jpeg_clk_on(struct mtk_jpeg_dev *jpeg)
 {
 	int ret;
 
-	ret = mtk_smi_larb_get(jpeg->larb);
-	if (ret)
-		dev_err(jpeg->dev, "mtk_smi_larb_get larbvdec fail %d\n", ret);
-
 	ret = clk_bulk_prepare_enable(jpeg->variant->num_clks,
 				      jpeg->variant->clks);
 	if (ret)
@@ -1069,7 +1064,6 @@ static void mtk_jpeg_clk_off(struct mtk_jpeg_dev *jpeg)
 {
 	clk_bulk_disable_unprepare(jpeg->variant->num_clks,
 				   jpeg->variant->clks);
-	mtk_smi_larb_put(jpeg->larb);
 }
 
 static irqreturn_t mtk_jpeg_enc_done(struct mtk_jpeg_dev *jpeg)
@@ -1284,35 +1278,6 @@ static struct clk_bulk_data mtk_jpeg_clocks[] = {
 	{ .id = "jpgenc" },
 };
 
-static int mtk_jpeg_clk_init(struct mtk_jpeg_dev *jpeg)
-{
-	struct device_node *node;
-	struct platform_device *pdev;
-	int ret;
-
-	node = of_parse_phandle(jpeg->dev->of_node, "mediatek,larb", 0);
-	if (!node)
-		return -EINVAL;
-	pdev = of_find_device_by_node(node);
-	if (WARN_ON(!pdev)) {
-		of_node_put(node);
-		return -EINVAL;
-	}
-	of_node_put(node);
-
-	jpeg->larb = &pdev->dev;
-
-	ret = devm_clk_bulk_get(jpeg->dev, jpeg->variant->num_clks,
-				jpeg->variant->clks);
-	if (ret) {
-		dev_err(&pdev->dev, "failed to get jpeg clock:%d\n", ret);
-		put_device(&pdev->dev);
-		return ret;
-	}
-
-	return 0;
-}
-
 static void mtk_jpeg_job_timeout_work(struct work_struct *work)
 {
 	struct mtk_jpeg_dev *jpeg = container_of(work, struct mtk_jpeg_dev,
@@ -1333,11 +1298,6 @@ static void mtk_jpeg_job_timeout_work(struct work_struct *work)
 	v4l2_m2m_job_finish(jpeg->m2m_dev, ctx->fh.m2m_ctx);
 }
 
-static inline void mtk_jpeg_clk_release(struct mtk_jpeg_dev *jpeg)
-{
-	put_device(jpeg->larb);
-}
-
 static int mtk_jpeg_probe(struct platform_device *pdev)
 {
 	struct mtk_jpeg_dev *jpeg;
@@ -1374,7 +1334,8 @@ static int mtk_jpeg_probe(struct platform_device *pdev)
 		goto err_req_irq;
 	}
 
-	ret = mtk_jpeg_clk_init(jpeg);
+	ret = devm_clk_bulk_get(jpeg->dev, jpeg->variant->num_clks,
+				jpeg->variant->clks);
 	if (ret) {
 		dev_err(&pdev->dev, "Failed to init clk, err %d\n", ret);
 		goto err_clk_init;
@@ -1440,7 +1401,6 @@ static int mtk_jpeg_probe(struct platform_device *pdev)
 	v4l2_device_unregister(&jpeg->v4l2_dev);
 
 err_dev_register:
-	mtk_jpeg_clk_release(jpeg);
 
 err_clk_init:
 
@@ -1458,7 +1418,6 @@ static int mtk_jpeg_remove(struct platform_device *pdev)
 	video_device_release(jpeg->vdev);
 	v4l2_m2m_release(jpeg->m2m_dev);
 	v4l2_device_unregister(&jpeg->v4l2_dev);
-	mtk_jpeg_clk_release(jpeg);
 
 	return 0;
 }
diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h
index 595f7f10c9fd..3e4811a41ba2 100644
--- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h
+++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h
@@ -85,7 +85,6 @@ struct mtk_jpeg_variant {
  * @alloc_ctx:		videobuf2 memory allocator's context
  * @vdev:		video device node for jpeg mem2mem mode
  * @reg_base:		JPEG registers mapping
- * @larb:		SMI device
  * @job_timeout_work:	IRQ timeout structure
  * @variant:		driver variant to be used
  */
@@ -99,7 +98,6 @@ struct mtk_jpeg_dev {
 	void			*alloc_ctx;
 	struct video_device	*vdev;
 	void __iomem		*reg_base;
-	struct device		*larb;
 	struct delayed_work job_timeout_work;
 	const struct mtk_jpeg_variant *variant;
 };
-- 
2.18.0


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 06/13] media: mtk-jpeg: Get rid of mtk_smi_larb_get/put
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Evan Green, Robin Murphy, Tomasz Figa, Will Deacon,
	linux-mediatek, srv_heupstream, devicetree, linux-kernel,
	linux-arm-kernel, iommu, yong.wu, youlin.pei, Matthias Kaehlcke,
	anan.sun, yi.kuo, acourbot, linux-media, dri-devel,
	Daniel Vetter, Chun-Kuang Hu, Philipp Zabel, Tiffany Lin,
	Dafna Hirschfeld, Hsin-Yi Wang, Eizan Miyamoto, anthony.huang,
	Frank Wunderlich, mingyuan.ma, yf.wang, libo.kang,
	AngeloGioacchino Del Regno, Rick Chang, Xia Jiang

MediaTek IOMMU has already added device_link between the consumer
and smi-larb device. If the jpg device calls the pm_runtime_get_sync,
the smi-larb's pm_runtime_get_sync also be called automatically.

After removing the larb_get operations, then mtk_jpeg_clk_init is
also unnecessary. Remove it too.

CC: Rick Chang <rick.chang@mediatek.com>
CC: Xia Jiang <xia.jiang@mediatek.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Evan Green <evgreen@chromium.org>
Acked-by: Rick Chang <rick.chang@mediatek.com>
Reviewed-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
Acked-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 .../media/platform/mtk-jpeg/mtk_jpeg_core.c   | 45 +------------------
 .../media/platform/mtk-jpeg/mtk_jpeg_core.h   |  2 -
 2 files changed, 2 insertions(+), 45 deletions(-)

diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
index af994b9913a6..1e29ca0aad77 100644
--- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
+++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
@@ -22,7 +22,6 @@
 #include <media/v4l2-ioctl.h>
 #include <media/videobuf2-core.h>
 #include <media/videobuf2-dma-contig.h>
-#include <soc/mediatek/smi.h>
 
 #include "mtk_jpeg_enc_hw.h"
 #include "mtk_jpeg_dec_hw.h"
@@ -1055,10 +1054,6 @@ static void mtk_jpeg_clk_on(struct mtk_jpeg_dev *jpeg)
 {
 	int ret;
 
-	ret = mtk_smi_larb_get(jpeg->larb);
-	if (ret)
-		dev_err(jpeg->dev, "mtk_smi_larb_get larbvdec fail %d\n", ret);
-
 	ret = clk_bulk_prepare_enable(jpeg->variant->num_clks,
 				      jpeg->variant->clks);
 	if (ret)
@@ -1069,7 +1064,6 @@ static void mtk_jpeg_clk_off(struct mtk_jpeg_dev *jpeg)
 {
 	clk_bulk_disable_unprepare(jpeg->variant->num_clks,
 				   jpeg->variant->clks);
-	mtk_smi_larb_put(jpeg->larb);
 }
 
 static irqreturn_t mtk_jpeg_enc_done(struct mtk_jpeg_dev *jpeg)
@@ -1284,35 +1278,6 @@ static struct clk_bulk_data mtk_jpeg_clocks[] = {
 	{ .id = "jpgenc" },
 };
 
-static int mtk_jpeg_clk_init(struct mtk_jpeg_dev *jpeg)
-{
-	struct device_node *node;
-	struct platform_device *pdev;
-	int ret;
-
-	node = of_parse_phandle(jpeg->dev->of_node, "mediatek,larb", 0);
-	if (!node)
-		return -EINVAL;
-	pdev = of_find_device_by_node(node);
-	if (WARN_ON(!pdev)) {
-		of_node_put(node);
-		return -EINVAL;
-	}
-	of_node_put(node);
-
-	jpeg->larb = &pdev->dev;
-
-	ret = devm_clk_bulk_get(jpeg->dev, jpeg->variant->num_clks,
-				jpeg->variant->clks);
-	if (ret) {
-		dev_err(&pdev->dev, "failed to get jpeg clock:%d\n", ret);
-		put_device(&pdev->dev);
-		return ret;
-	}
-
-	return 0;
-}
-
 static void mtk_jpeg_job_timeout_work(struct work_struct *work)
 {
 	struct mtk_jpeg_dev *jpeg = container_of(work, struct mtk_jpeg_dev,
@@ -1333,11 +1298,6 @@ static void mtk_jpeg_job_timeout_work(struct work_struct *work)
 	v4l2_m2m_job_finish(jpeg->m2m_dev, ctx->fh.m2m_ctx);
 }
 
-static inline void mtk_jpeg_clk_release(struct mtk_jpeg_dev *jpeg)
-{
-	put_device(jpeg->larb);
-}
-
 static int mtk_jpeg_probe(struct platform_device *pdev)
 {
 	struct mtk_jpeg_dev *jpeg;
@@ -1374,7 +1334,8 @@ static int mtk_jpeg_probe(struct platform_device *pdev)
 		goto err_req_irq;
 	}
 
-	ret = mtk_jpeg_clk_init(jpeg);
+	ret = devm_clk_bulk_get(jpeg->dev, jpeg->variant->num_clks,
+				jpeg->variant->clks);
 	if (ret) {
 		dev_err(&pdev->dev, "Failed to init clk, err %d\n", ret);
 		goto err_clk_init;
@@ -1440,7 +1401,6 @@ static int mtk_jpeg_probe(struct platform_device *pdev)
 	v4l2_device_unregister(&jpeg->v4l2_dev);
 
 err_dev_register:
-	mtk_jpeg_clk_release(jpeg);
 
 err_clk_init:
 
@@ -1458,7 +1418,6 @@ static int mtk_jpeg_remove(struct platform_device *pdev)
 	video_device_release(jpeg->vdev);
 	v4l2_m2m_release(jpeg->m2m_dev);
 	v4l2_device_unregister(&jpeg->v4l2_dev);
-	mtk_jpeg_clk_release(jpeg);
 
 	return 0;
 }
diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h
index 595f7f10c9fd..3e4811a41ba2 100644
--- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h
+++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h
@@ -85,7 +85,6 @@ struct mtk_jpeg_variant {
  * @alloc_ctx:		videobuf2 memory allocator's context
  * @vdev:		video device node for jpeg mem2mem mode
  * @reg_base:		JPEG registers mapping
- * @larb:		SMI device
  * @job_timeout_work:	IRQ timeout structure
  * @variant:		driver variant to be used
  */
@@ -99,7 +98,6 @@ struct mtk_jpeg_dev {
 	void			*alloc_ctx;
 	struct video_device	*vdev;
 	void __iomem		*reg_base;
-	struct device		*larb;
 	struct delayed_work job_timeout_work;
 	const struct mtk_jpeg_variant *variant;
 };
-- 
2.18.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 07/13] media: mtk-mdp: Get rid of mtk_smi_larb_get/put
  2022-01-17  7:04 ` Yong Wu
                     ` (2 preceding siblings ...)
  (?)
@ 2022-01-17  7:05   ` Yong Wu
  -1 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Evan Green, Robin Murphy, Tomasz Figa, Will Deacon,
	linux-mediatek, srv_heupstream, devicetree, linux-kernel,
	linux-arm-kernel, iommu, yong.wu, youlin.pei, Matthias Kaehlcke,
	anan.sun, yi.kuo, acourbot, linux-media, dri-devel,
	Daniel Vetter, Chun-Kuang Hu, Philipp Zabel, Tiffany Lin,
	Dafna Hirschfeld, Hsin-Yi Wang, Eizan Miyamoto, anthony.huang,
	Frank Wunderlich, mingyuan.ma, yf.wang, libo.kang,
	AngeloGioacchino Del Regno, Minghsiu Tsai, Houlong Wei

MediaTek IOMMU has already added the device_link between the consumer
and smi-larb device. If the mdp device calls the pm_runtime_get_sync,
the smi-larb's pm_runtime_get_sync also be called automatically.

CC: Minghsiu Tsai <minghsiu.tsai@mediatek.com>
CC: Houlong Wei <houlong.wei@mediatek.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Evan Green <evgreen@chromium.org>
Reviewed-by: Houlong Wei <houlong.wei@mediatek.com>
Reviewed-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 40 -------------------
 drivers/media/platform/mtk-mdp/mtk_mdp_comp.h |  2 -
 drivers/media/platform/mtk-mdp/mtk_mdp_core.c |  1 -
 3 files changed, 43 deletions(-)

diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c
index b3426a551bea..1e3833f1c9ae 100644
--- a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c
+++ b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c
@@ -9,7 +9,6 @@
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/of_platform.h>
-#include <soc/mediatek/smi.h>
 
 #include "mtk_mdp_comp.h"
 
@@ -18,14 +17,6 @@ void mtk_mdp_comp_clock_on(struct device *dev, struct mtk_mdp_comp *comp)
 {
 	int i, err;
 
-	if (comp->larb_dev) {
-		err = mtk_smi_larb_get(comp->larb_dev);
-		if (err)
-			dev_err(dev,
-				"failed to get larb, err %d. type:%d\n",
-				err, comp->type);
-	}
-
 	for (i = 0; i < ARRAY_SIZE(comp->clk); i++) {
 		if (IS_ERR(comp->clk[i]))
 			continue;
@@ -46,17 +37,12 @@ void mtk_mdp_comp_clock_off(struct device *dev, struct mtk_mdp_comp *comp)
 			continue;
 		clk_disable_unprepare(comp->clk[i]);
 	}
-
-	if (comp->larb_dev)
-		mtk_smi_larb_put(comp->larb_dev);
 }
 
 int mtk_mdp_comp_init(struct device *dev, struct device_node *node,
 		      struct mtk_mdp_comp *comp,
 		      enum mtk_mdp_comp_type comp_type)
 {
-	struct device_node *larb_node;
-	struct platform_device *larb_pdev;
 	int ret;
 	int i;
 
@@ -77,32 +63,6 @@ int mtk_mdp_comp_init(struct device *dev, struct device_node *node,
 			break;
 	}
 
-	/* Only DMA capable components need the LARB property */
-	comp->larb_dev = NULL;
-	if (comp->type != MTK_MDP_RDMA &&
-	    comp->type != MTK_MDP_WDMA &&
-	    comp->type != MTK_MDP_WROT)
-		return 0;
-
-	larb_node = of_parse_phandle(node, "mediatek,larb", 0);
-	if (!larb_node) {
-		dev_err(dev,
-			"Missing mediadek,larb phandle in %pOF node\n", node);
-		ret = -EINVAL;
-		goto put_dev;
-	}
-
-	larb_pdev = of_find_device_by_node(larb_node);
-	if (!larb_pdev) {
-		dev_warn(dev, "Waiting for larb device %pOF\n", larb_node);
-		of_node_put(larb_node);
-		ret = -EPROBE_DEFER;
-		goto put_dev;
-	}
-	of_node_put(larb_node);
-
-	comp->larb_dev = &larb_pdev->dev;
-
 	return 0;
 
 put_dev:
diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.h b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.h
index 7897766c96bb..ae41dd3cd72a 100644
--- a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.h
+++ b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.h
@@ -26,14 +26,12 @@ enum mtk_mdp_comp_type {
  * @node:	list node to track sibing MDP components
  * @dev_node:	component device node
  * @clk:	clocks required for component
- * @larb_dev:	SMI device required for component
  * @type:	component type
  */
 struct mtk_mdp_comp {
 	struct list_head	node;
 	struct device_node	*dev_node;
 	struct clk		*clk[2];
-	struct device		*larb_dev;
 	enum mtk_mdp_comp_type	type;
 };
 
diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_core.c b/drivers/media/platform/mtk-mdp/mtk_mdp_core.c
index 976aa1f4829b..70a8eab16863 100644
--- a/drivers/media/platform/mtk-mdp/mtk_mdp_core.c
+++ b/drivers/media/platform/mtk-mdp/mtk_mdp_core.c
@@ -17,7 +17,6 @@
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
 #include <linux/workqueue.h>
-#include <soc/mediatek/smi.h>
 
 #include "mtk_mdp_core.h"
 #include "mtk_mdp_m2m.h"
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 07/13] media: mtk-mdp: Get rid of mtk_smi_larb_get/put
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang, anthony.huang,
	youlin.pei, Evan Green, Eizan Miyamoto, Matthias Kaehlcke,
	linux-arm-kernel, mingyuan.ma, linux-media, devicetree,
	Philipp Zabel, Frank Wunderlich, libo.kang, yi.kuo,
	linux-mediatek, Houlong Wei, Hsin-Yi Wang, Tiffany Lin,
	AngeloGioacchino Del Regno, anan.sun, srv_heupstream, acourbot,
	Minghsiu Tsai, linux-kernel, iommu, Daniel Vetter, Robin Murphy

MediaTek IOMMU has already added the device_link between the consumer
and smi-larb device. If the mdp device calls the pm_runtime_get_sync,
the smi-larb's pm_runtime_get_sync also be called automatically.

CC: Minghsiu Tsai <minghsiu.tsai@mediatek.com>
CC: Houlong Wei <houlong.wei@mediatek.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Evan Green <evgreen@chromium.org>
Reviewed-by: Houlong Wei <houlong.wei@mediatek.com>
Reviewed-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 40 -------------------
 drivers/media/platform/mtk-mdp/mtk_mdp_comp.h |  2 -
 drivers/media/platform/mtk-mdp/mtk_mdp_core.c |  1 -
 3 files changed, 43 deletions(-)

diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c
index b3426a551bea..1e3833f1c9ae 100644
--- a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c
+++ b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c
@@ -9,7 +9,6 @@
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/of_platform.h>
-#include <soc/mediatek/smi.h>
 
 #include "mtk_mdp_comp.h"
 
@@ -18,14 +17,6 @@ void mtk_mdp_comp_clock_on(struct device *dev, struct mtk_mdp_comp *comp)
 {
 	int i, err;
 
-	if (comp->larb_dev) {
-		err = mtk_smi_larb_get(comp->larb_dev);
-		if (err)
-			dev_err(dev,
-				"failed to get larb, err %d. type:%d\n",
-				err, comp->type);
-	}
-
 	for (i = 0; i < ARRAY_SIZE(comp->clk); i++) {
 		if (IS_ERR(comp->clk[i]))
 			continue;
@@ -46,17 +37,12 @@ void mtk_mdp_comp_clock_off(struct device *dev, struct mtk_mdp_comp *comp)
 			continue;
 		clk_disable_unprepare(comp->clk[i]);
 	}
-
-	if (comp->larb_dev)
-		mtk_smi_larb_put(comp->larb_dev);
 }
 
 int mtk_mdp_comp_init(struct device *dev, struct device_node *node,
 		      struct mtk_mdp_comp *comp,
 		      enum mtk_mdp_comp_type comp_type)
 {
-	struct device_node *larb_node;
-	struct platform_device *larb_pdev;
 	int ret;
 	int i;
 
@@ -77,32 +63,6 @@ int mtk_mdp_comp_init(struct device *dev, struct device_node *node,
 			break;
 	}
 
-	/* Only DMA capable components need the LARB property */
-	comp->larb_dev = NULL;
-	if (comp->type != MTK_MDP_RDMA &&
-	    comp->type != MTK_MDP_WDMA &&
-	    comp->type != MTK_MDP_WROT)
-		return 0;
-
-	larb_node = of_parse_phandle(node, "mediatek,larb", 0);
-	if (!larb_node) {
-		dev_err(dev,
-			"Missing mediadek,larb phandle in %pOF node\n", node);
-		ret = -EINVAL;
-		goto put_dev;
-	}
-
-	larb_pdev = of_find_device_by_node(larb_node);
-	if (!larb_pdev) {
-		dev_warn(dev, "Waiting for larb device %pOF\n", larb_node);
-		of_node_put(larb_node);
-		ret = -EPROBE_DEFER;
-		goto put_dev;
-	}
-	of_node_put(larb_node);
-
-	comp->larb_dev = &larb_pdev->dev;
-
 	return 0;
 
 put_dev:
diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.h b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.h
index 7897766c96bb..ae41dd3cd72a 100644
--- a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.h
+++ b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.h
@@ -26,14 +26,12 @@ enum mtk_mdp_comp_type {
  * @node:	list node to track sibing MDP components
  * @dev_node:	component device node
  * @clk:	clocks required for component
- * @larb_dev:	SMI device required for component
  * @type:	component type
  */
 struct mtk_mdp_comp {
 	struct list_head	node;
 	struct device_node	*dev_node;
 	struct clk		*clk[2];
-	struct device		*larb_dev;
 	enum mtk_mdp_comp_type	type;
 };
 
diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_core.c b/drivers/media/platform/mtk-mdp/mtk_mdp_core.c
index 976aa1f4829b..70a8eab16863 100644
--- a/drivers/media/platform/mtk-mdp/mtk_mdp_core.c
+++ b/drivers/media/platform/mtk-mdp/mtk_mdp_core.c
@@ -17,7 +17,6 @@
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
 #include <linux/workqueue.h>
-#include <soc/mediatek/smi.h>
 
 #include "mtk_mdp_core.h"
 #include "mtk_mdp_m2m.h"
-- 
2.18.0

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 07/13] media: mtk-mdp: Get rid of mtk_smi_larb_get/put
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Dafna Hirschfeld, Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang,
	anthony.huang, youlin.pei, Evan Green, Eizan Miyamoto,
	Matthias Kaehlcke, linux-arm-kernel, mingyuan.ma, linux-media,
	devicetree, Frank Wunderlich, libo.kang, yi.kuo, linux-mediatek,
	Houlong Wei, Hsin-Yi Wang, Tiffany Lin, yong.wu,
	AngeloGioacchino Del Regno, anan.sun, srv_heupstream, acourbot,
	Minghsiu Tsai, linux-kernel, Tomasz Figa, iommu, Robin Murphy

MediaTek IOMMU has already added the device_link between the consumer
and smi-larb device. If the mdp device calls the pm_runtime_get_sync,
the smi-larb's pm_runtime_get_sync also be called automatically.

CC: Minghsiu Tsai <minghsiu.tsai@mediatek.com>
CC: Houlong Wei <houlong.wei@mediatek.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Evan Green <evgreen@chromium.org>
Reviewed-by: Houlong Wei <houlong.wei@mediatek.com>
Reviewed-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 40 -------------------
 drivers/media/platform/mtk-mdp/mtk_mdp_comp.h |  2 -
 drivers/media/platform/mtk-mdp/mtk_mdp_core.c |  1 -
 3 files changed, 43 deletions(-)

diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c
index b3426a551bea..1e3833f1c9ae 100644
--- a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c
+++ b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c
@@ -9,7 +9,6 @@
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/of_platform.h>
-#include <soc/mediatek/smi.h>
 
 #include "mtk_mdp_comp.h"
 
@@ -18,14 +17,6 @@ void mtk_mdp_comp_clock_on(struct device *dev, struct mtk_mdp_comp *comp)
 {
 	int i, err;
 
-	if (comp->larb_dev) {
-		err = mtk_smi_larb_get(comp->larb_dev);
-		if (err)
-			dev_err(dev,
-				"failed to get larb, err %d. type:%d\n",
-				err, comp->type);
-	}
-
 	for (i = 0; i < ARRAY_SIZE(comp->clk); i++) {
 		if (IS_ERR(comp->clk[i]))
 			continue;
@@ -46,17 +37,12 @@ void mtk_mdp_comp_clock_off(struct device *dev, struct mtk_mdp_comp *comp)
 			continue;
 		clk_disable_unprepare(comp->clk[i]);
 	}
-
-	if (comp->larb_dev)
-		mtk_smi_larb_put(comp->larb_dev);
 }
 
 int mtk_mdp_comp_init(struct device *dev, struct device_node *node,
 		      struct mtk_mdp_comp *comp,
 		      enum mtk_mdp_comp_type comp_type)
 {
-	struct device_node *larb_node;
-	struct platform_device *larb_pdev;
 	int ret;
 	int i;
 
@@ -77,32 +63,6 @@ int mtk_mdp_comp_init(struct device *dev, struct device_node *node,
 			break;
 	}
 
-	/* Only DMA capable components need the LARB property */
-	comp->larb_dev = NULL;
-	if (comp->type != MTK_MDP_RDMA &&
-	    comp->type != MTK_MDP_WDMA &&
-	    comp->type != MTK_MDP_WROT)
-		return 0;
-
-	larb_node = of_parse_phandle(node, "mediatek,larb", 0);
-	if (!larb_node) {
-		dev_err(dev,
-			"Missing mediadek,larb phandle in %pOF node\n", node);
-		ret = -EINVAL;
-		goto put_dev;
-	}
-
-	larb_pdev = of_find_device_by_node(larb_node);
-	if (!larb_pdev) {
-		dev_warn(dev, "Waiting for larb device %pOF\n", larb_node);
-		of_node_put(larb_node);
-		ret = -EPROBE_DEFER;
-		goto put_dev;
-	}
-	of_node_put(larb_node);
-
-	comp->larb_dev = &larb_pdev->dev;
-
 	return 0;
 
 put_dev:
diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.h b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.h
index 7897766c96bb..ae41dd3cd72a 100644
--- a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.h
+++ b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.h
@@ -26,14 +26,12 @@ enum mtk_mdp_comp_type {
  * @node:	list node to track sibing MDP components
  * @dev_node:	component device node
  * @clk:	clocks required for component
- * @larb_dev:	SMI device required for component
  * @type:	component type
  */
 struct mtk_mdp_comp {
 	struct list_head	node;
 	struct device_node	*dev_node;
 	struct clk		*clk[2];
-	struct device		*larb_dev;
 	enum mtk_mdp_comp_type	type;
 };
 
diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_core.c b/drivers/media/platform/mtk-mdp/mtk_mdp_core.c
index 976aa1f4829b..70a8eab16863 100644
--- a/drivers/media/platform/mtk-mdp/mtk_mdp_core.c
+++ b/drivers/media/platform/mtk-mdp/mtk_mdp_core.c
@@ -17,7 +17,6 @@
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
 #include <linux/workqueue.h>
-#include <soc/mediatek/smi.h>
 
 #include "mtk_mdp_core.h"
 #include "mtk_mdp_m2m.h"
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 07/13] media: mtk-mdp: Get rid of mtk_smi_larb_get/put
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Dafna Hirschfeld, Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang,
	anthony.huang, youlin.pei, Evan Green, Eizan Miyamoto,
	Matthias Kaehlcke, linux-arm-kernel, mingyuan.ma, linux-media,
	devicetree, Philipp Zabel, libo.kang, yi.kuo, linux-mediatek,
	Houlong Wei, Hsin-Yi Wang, Tiffany Lin, yong.wu,
	AngeloGioacchino Del Regno, anan.sun, srv_heupstream, acourbot,
	Minghsiu Tsai, linux-kernel, Tomasz Figa, iommu, Daniel Vetter,
	Robin Murphy

MediaTek IOMMU has already added the device_link between the consumer
and smi-larb device. If the mdp device calls the pm_runtime_get_sync,
the smi-larb's pm_runtime_get_sync also be called automatically.

CC: Minghsiu Tsai <minghsiu.tsai@mediatek.com>
CC: Houlong Wei <houlong.wei@mediatek.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Evan Green <evgreen@chromium.org>
Reviewed-by: Houlong Wei <houlong.wei@mediatek.com>
Reviewed-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 40 -------------------
 drivers/media/platform/mtk-mdp/mtk_mdp_comp.h |  2 -
 drivers/media/platform/mtk-mdp/mtk_mdp_core.c |  1 -
 3 files changed, 43 deletions(-)

diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c
index b3426a551bea..1e3833f1c9ae 100644
--- a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c
+++ b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c
@@ -9,7 +9,6 @@
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/of_platform.h>
-#include <soc/mediatek/smi.h>
 
 #include "mtk_mdp_comp.h"
 
@@ -18,14 +17,6 @@ void mtk_mdp_comp_clock_on(struct device *dev, struct mtk_mdp_comp *comp)
 {
 	int i, err;
 
-	if (comp->larb_dev) {
-		err = mtk_smi_larb_get(comp->larb_dev);
-		if (err)
-			dev_err(dev,
-				"failed to get larb, err %d. type:%d\n",
-				err, comp->type);
-	}
-
 	for (i = 0; i < ARRAY_SIZE(comp->clk); i++) {
 		if (IS_ERR(comp->clk[i]))
 			continue;
@@ -46,17 +37,12 @@ void mtk_mdp_comp_clock_off(struct device *dev, struct mtk_mdp_comp *comp)
 			continue;
 		clk_disable_unprepare(comp->clk[i]);
 	}
-
-	if (comp->larb_dev)
-		mtk_smi_larb_put(comp->larb_dev);
 }
 
 int mtk_mdp_comp_init(struct device *dev, struct device_node *node,
 		      struct mtk_mdp_comp *comp,
 		      enum mtk_mdp_comp_type comp_type)
 {
-	struct device_node *larb_node;
-	struct platform_device *larb_pdev;
 	int ret;
 	int i;
 
@@ -77,32 +63,6 @@ int mtk_mdp_comp_init(struct device *dev, struct device_node *node,
 			break;
 	}
 
-	/* Only DMA capable components need the LARB property */
-	comp->larb_dev = NULL;
-	if (comp->type != MTK_MDP_RDMA &&
-	    comp->type != MTK_MDP_WDMA &&
-	    comp->type != MTK_MDP_WROT)
-		return 0;
-
-	larb_node = of_parse_phandle(node, "mediatek,larb", 0);
-	if (!larb_node) {
-		dev_err(dev,
-			"Missing mediadek,larb phandle in %pOF node\n", node);
-		ret = -EINVAL;
-		goto put_dev;
-	}
-
-	larb_pdev = of_find_device_by_node(larb_node);
-	if (!larb_pdev) {
-		dev_warn(dev, "Waiting for larb device %pOF\n", larb_node);
-		of_node_put(larb_node);
-		ret = -EPROBE_DEFER;
-		goto put_dev;
-	}
-	of_node_put(larb_node);
-
-	comp->larb_dev = &larb_pdev->dev;
-
 	return 0;
 
 put_dev:
diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.h b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.h
index 7897766c96bb..ae41dd3cd72a 100644
--- a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.h
+++ b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.h
@@ -26,14 +26,12 @@ enum mtk_mdp_comp_type {
  * @node:	list node to track sibing MDP components
  * @dev_node:	component device node
  * @clk:	clocks required for component
- * @larb_dev:	SMI device required for component
  * @type:	component type
  */
 struct mtk_mdp_comp {
 	struct list_head	node;
 	struct device_node	*dev_node;
 	struct clk		*clk[2];
-	struct device		*larb_dev;
 	enum mtk_mdp_comp_type	type;
 };
 
diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_core.c b/drivers/media/platform/mtk-mdp/mtk_mdp_core.c
index 976aa1f4829b..70a8eab16863 100644
--- a/drivers/media/platform/mtk-mdp/mtk_mdp_core.c
+++ b/drivers/media/platform/mtk-mdp/mtk_mdp_core.c
@@ -17,7 +17,6 @@
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
 #include <linux/workqueue.h>
-#include <soc/mediatek/smi.h>
 
 #include "mtk_mdp_core.h"
 #include "mtk_mdp_m2m.h"
-- 
2.18.0


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 07/13] media: mtk-mdp: Get rid of mtk_smi_larb_get/put
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Evan Green, Robin Murphy, Tomasz Figa, Will Deacon,
	linux-mediatek, srv_heupstream, devicetree, linux-kernel,
	linux-arm-kernel, iommu, yong.wu, youlin.pei, Matthias Kaehlcke,
	anan.sun, yi.kuo, acourbot, linux-media, dri-devel,
	Daniel Vetter, Chun-Kuang Hu, Philipp Zabel, Tiffany Lin,
	Dafna Hirschfeld, Hsin-Yi Wang, Eizan Miyamoto, anthony.huang,
	Frank Wunderlich, mingyuan.ma, yf.wang, libo.kang,
	AngeloGioacchino Del Regno, Minghsiu Tsai, Houlong Wei

MediaTek IOMMU has already added the device_link between the consumer
and smi-larb device. If the mdp device calls the pm_runtime_get_sync,
the smi-larb's pm_runtime_get_sync also be called automatically.

CC: Minghsiu Tsai <minghsiu.tsai@mediatek.com>
CC: Houlong Wei <houlong.wei@mediatek.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Evan Green <evgreen@chromium.org>
Reviewed-by: Houlong Wei <houlong.wei@mediatek.com>
Reviewed-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 40 -------------------
 drivers/media/platform/mtk-mdp/mtk_mdp_comp.h |  2 -
 drivers/media/platform/mtk-mdp/mtk_mdp_core.c |  1 -
 3 files changed, 43 deletions(-)

diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c
index b3426a551bea..1e3833f1c9ae 100644
--- a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c
+++ b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c
@@ -9,7 +9,6 @@
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/of_platform.h>
-#include <soc/mediatek/smi.h>
 
 #include "mtk_mdp_comp.h"
 
@@ -18,14 +17,6 @@ void mtk_mdp_comp_clock_on(struct device *dev, struct mtk_mdp_comp *comp)
 {
 	int i, err;
 
-	if (comp->larb_dev) {
-		err = mtk_smi_larb_get(comp->larb_dev);
-		if (err)
-			dev_err(dev,
-				"failed to get larb, err %d. type:%d\n",
-				err, comp->type);
-	}
-
 	for (i = 0; i < ARRAY_SIZE(comp->clk); i++) {
 		if (IS_ERR(comp->clk[i]))
 			continue;
@@ -46,17 +37,12 @@ void mtk_mdp_comp_clock_off(struct device *dev, struct mtk_mdp_comp *comp)
 			continue;
 		clk_disable_unprepare(comp->clk[i]);
 	}
-
-	if (comp->larb_dev)
-		mtk_smi_larb_put(comp->larb_dev);
 }
 
 int mtk_mdp_comp_init(struct device *dev, struct device_node *node,
 		      struct mtk_mdp_comp *comp,
 		      enum mtk_mdp_comp_type comp_type)
 {
-	struct device_node *larb_node;
-	struct platform_device *larb_pdev;
 	int ret;
 	int i;
 
@@ -77,32 +63,6 @@ int mtk_mdp_comp_init(struct device *dev, struct device_node *node,
 			break;
 	}
 
-	/* Only DMA capable components need the LARB property */
-	comp->larb_dev = NULL;
-	if (comp->type != MTK_MDP_RDMA &&
-	    comp->type != MTK_MDP_WDMA &&
-	    comp->type != MTK_MDP_WROT)
-		return 0;
-
-	larb_node = of_parse_phandle(node, "mediatek,larb", 0);
-	if (!larb_node) {
-		dev_err(dev,
-			"Missing mediadek,larb phandle in %pOF node\n", node);
-		ret = -EINVAL;
-		goto put_dev;
-	}
-
-	larb_pdev = of_find_device_by_node(larb_node);
-	if (!larb_pdev) {
-		dev_warn(dev, "Waiting for larb device %pOF\n", larb_node);
-		of_node_put(larb_node);
-		ret = -EPROBE_DEFER;
-		goto put_dev;
-	}
-	of_node_put(larb_node);
-
-	comp->larb_dev = &larb_pdev->dev;
-
 	return 0;
 
 put_dev:
diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.h b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.h
index 7897766c96bb..ae41dd3cd72a 100644
--- a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.h
+++ b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.h
@@ -26,14 +26,12 @@ enum mtk_mdp_comp_type {
  * @node:	list node to track sibing MDP components
  * @dev_node:	component device node
  * @clk:	clocks required for component
- * @larb_dev:	SMI device required for component
  * @type:	component type
  */
 struct mtk_mdp_comp {
 	struct list_head	node;
 	struct device_node	*dev_node;
 	struct clk		*clk[2];
-	struct device		*larb_dev;
 	enum mtk_mdp_comp_type	type;
 };
 
diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_core.c b/drivers/media/platform/mtk-mdp/mtk_mdp_core.c
index 976aa1f4829b..70a8eab16863 100644
--- a/drivers/media/platform/mtk-mdp/mtk_mdp_core.c
+++ b/drivers/media/platform/mtk-mdp/mtk_mdp_core.c
@@ -17,7 +17,6 @@
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
 #include <linux/workqueue.h>
-#include <soc/mediatek/smi.h>
 
 #include "mtk_mdp_core.h"
 #include "mtk_mdp_m2m.h"
-- 
2.18.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 08/13] drm/mediatek: Add pm runtime support for ovl and rdma
  2022-01-17  7:04 ` Yong Wu
                     ` (2 preceding siblings ...)
  (?)
@ 2022-01-17  7:05   ` Yong Wu
  -1 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Evan Green, Robin Murphy, Tomasz Figa, Will Deacon,
	linux-mediatek, srv_heupstream, devicetree, linux-kernel,
	linux-arm-kernel, iommu, yong.wu, youlin.pei, Matthias Kaehlcke,
	anan.sun, yi.kuo, acourbot, linux-media, dri-devel,
	Daniel Vetter, Chun-Kuang Hu, Philipp Zabel, Tiffany Lin,
	Dafna Hirschfeld, Hsin-Yi Wang, Eizan Miyamoto, anthony.huang,
	Frank Wunderlich, mingyuan.ma, yf.wang, libo.kang,
	AngeloGioacchino Del Regno, Yongqiang Niu, CK Hu

From: Yongqiang Niu <yongqiang.niu@mediatek.com>

Prepare for smi cleaning up "mediatek,larb".

Display use the dispsys device to call pm_rumtime_get_sync before.
This patch add pm_runtime_xx with ovl and rdma device whose nodes has
"iommus" property, then display could help pm_runtime_get for smi via
ovl or rdma device.

CC: CK Hu <ck.hu@mediatek.com>
Signed-off-by: Yongqiang Niu <yongqiang.niu@mediatek.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
(Yong: Use pm_runtime_resume_and_get instead of pm_runtime_get_sync)
Acked-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/gpu/drm/mediatek/mtk_disp_ovl.c  |  8 +++++++-
 drivers/gpu/drm/mediatek/mtk_disp_rdma.c |  9 ++++++++-
 drivers/gpu/drm/mediatek/mtk_drm_crtc.c  | 13 ++++++++++++-
 3 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
index 5326989d5206..716eac6831f2 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
@@ -11,6 +11,7 @@
 #include <linux/of_device.h>
 #include <linux/of_irq.h>
 #include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
 #include <linux/soc/mediatek/mtk-cmdq.h>
 
 #include "mtk_disp_drv.h"
@@ -414,9 +415,13 @@ static int mtk_disp_ovl_probe(struct platform_device *pdev)
 		return ret;
 	}
 
+	pm_runtime_enable(dev);
+
 	ret = component_add(dev, &mtk_disp_ovl_component_ops);
-	if (ret)
+	if (ret) {
+		pm_runtime_disable(dev);
 		dev_err(dev, "Failed to add component: %d\n", ret);
+	}
 
 	return ret;
 }
@@ -424,6 +429,7 @@ static int mtk_disp_ovl_probe(struct platform_device *pdev)
 static int mtk_disp_ovl_remove(struct platform_device *pdev)
 {
 	component_del(&pdev->dev, &mtk_disp_ovl_component_ops);
+	pm_runtime_disable(&pdev->dev);
 
 	return 0;
 }
diff --git a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
index 75d7f45579e2..251f034acb09 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
@@ -9,6 +9,7 @@
 #include <linux/of_device.h>
 #include <linux/of_irq.h>
 #include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
 #include <linux/soc/mediatek/mtk-cmdq.h>
 
 #include "mtk_disp_drv.h"
@@ -327,9 +328,13 @@ static int mtk_disp_rdma_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, priv);
 
+	pm_runtime_enable(dev);
+
 	ret = component_add(dev, &mtk_disp_rdma_component_ops);
-	if (ret)
+	if (ret) {
+		pm_runtime_disable(dev);
 		dev_err(dev, "Failed to add component: %d\n", ret);
+	}
 
 	return ret;
 }
@@ -338,6 +343,8 @@ static int mtk_disp_rdma_remove(struct platform_device *pdev)
 {
 	component_del(&pdev->dev, &mtk_disp_rdma_component_ops);
 
+	pm_runtime_disable(&pdev->dev);
+
 	return 0;
 }
 
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
index a4e80e499674..ce5bbd6918cf 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
@@ -554,9 +554,17 @@ static void mtk_drm_crtc_atomic_enable(struct drm_crtc *crtc,
 		return;
 	}
 
+	ret = pm_runtime_resume_and_get(comp->dev);
+	if (ret < 0) {
+		mtk_smi_larb_put(comp->larb_dev);
+		DRM_DEV_ERROR(comp->dev, "Failed to enable power domain: %d\n", ret);
+		return;
+	}
+
 	ret = mtk_crtc_ddp_hw_init(mtk_crtc);
 	if (ret) {
 		mtk_smi_larb_put(comp->larb_dev);
+		pm_runtime_put(comp->dev);
 		return;
 	}
 
@@ -569,7 +577,7 @@ static void mtk_drm_crtc_atomic_disable(struct drm_crtc *crtc,
 {
 	struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc);
 	struct mtk_ddp_comp *comp = mtk_crtc->ddp_comp[0];
-	int i;
+	int i, ret;
 
 	DRM_DEBUG_DRIVER("%s %d\n", __func__, crtc->base.id);
 	if (!mtk_crtc->enabled)
@@ -593,6 +601,9 @@ static void mtk_drm_crtc_atomic_disable(struct drm_crtc *crtc,
 	drm_crtc_vblank_off(crtc);
 	mtk_crtc_ddp_hw_fini(mtk_crtc);
 	mtk_smi_larb_put(comp->larb_dev);
+	ret = pm_runtime_put(comp->dev);
+	if (ret < 0)
+		DRM_DEV_ERROR(comp->dev, "Failed to disable power domain: %d\n", ret);
 
 	mtk_crtc->enabled = false;
 }
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 08/13] drm/mediatek: Add pm runtime support for ovl and rdma
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang, anthony.huang,
	youlin.pei, Evan Green, Eizan Miyamoto, Matthias Kaehlcke,
	linux-arm-kernel, Yongqiang Niu, CK Hu, mingyuan.ma, linux-media,
	devicetree, Philipp Zabel, Frank Wunderlich, libo.kang, yi.kuo,
	linux-mediatek, Hsin-Yi Wang, Tiffany Lin,
	AngeloGioacchino Del Regno, anan.sun, srv_heupstream, acourbot,
	linux-kernel, iommu, Daniel Vetter, Robin Murphy

From: Yongqiang Niu <yongqiang.niu@mediatek.com>

Prepare for smi cleaning up "mediatek,larb".

Display use the dispsys device to call pm_rumtime_get_sync before.
This patch add pm_runtime_xx with ovl and rdma device whose nodes has
"iommus" property, then display could help pm_runtime_get for smi via
ovl or rdma device.

CC: CK Hu <ck.hu@mediatek.com>
Signed-off-by: Yongqiang Niu <yongqiang.niu@mediatek.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
(Yong: Use pm_runtime_resume_and_get instead of pm_runtime_get_sync)
Acked-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/gpu/drm/mediatek/mtk_disp_ovl.c  |  8 +++++++-
 drivers/gpu/drm/mediatek/mtk_disp_rdma.c |  9 ++++++++-
 drivers/gpu/drm/mediatek/mtk_drm_crtc.c  | 13 ++++++++++++-
 3 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
index 5326989d5206..716eac6831f2 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
@@ -11,6 +11,7 @@
 #include <linux/of_device.h>
 #include <linux/of_irq.h>
 #include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
 #include <linux/soc/mediatek/mtk-cmdq.h>
 
 #include "mtk_disp_drv.h"
@@ -414,9 +415,13 @@ static int mtk_disp_ovl_probe(struct platform_device *pdev)
 		return ret;
 	}
 
+	pm_runtime_enable(dev);
+
 	ret = component_add(dev, &mtk_disp_ovl_component_ops);
-	if (ret)
+	if (ret) {
+		pm_runtime_disable(dev);
 		dev_err(dev, "Failed to add component: %d\n", ret);
+	}
 
 	return ret;
 }
@@ -424,6 +429,7 @@ static int mtk_disp_ovl_probe(struct platform_device *pdev)
 static int mtk_disp_ovl_remove(struct platform_device *pdev)
 {
 	component_del(&pdev->dev, &mtk_disp_ovl_component_ops);
+	pm_runtime_disable(&pdev->dev);
 
 	return 0;
 }
diff --git a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
index 75d7f45579e2..251f034acb09 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
@@ -9,6 +9,7 @@
 #include <linux/of_device.h>
 #include <linux/of_irq.h>
 #include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
 #include <linux/soc/mediatek/mtk-cmdq.h>
 
 #include "mtk_disp_drv.h"
@@ -327,9 +328,13 @@ static int mtk_disp_rdma_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, priv);
 
+	pm_runtime_enable(dev);
+
 	ret = component_add(dev, &mtk_disp_rdma_component_ops);
-	if (ret)
+	if (ret) {
+		pm_runtime_disable(dev);
 		dev_err(dev, "Failed to add component: %d\n", ret);
+	}
 
 	return ret;
 }
@@ -338,6 +343,8 @@ static int mtk_disp_rdma_remove(struct platform_device *pdev)
 {
 	component_del(&pdev->dev, &mtk_disp_rdma_component_ops);
 
+	pm_runtime_disable(&pdev->dev);
+
 	return 0;
 }
 
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
index a4e80e499674..ce5bbd6918cf 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
@@ -554,9 +554,17 @@ static void mtk_drm_crtc_atomic_enable(struct drm_crtc *crtc,
 		return;
 	}
 
+	ret = pm_runtime_resume_and_get(comp->dev);
+	if (ret < 0) {
+		mtk_smi_larb_put(comp->larb_dev);
+		DRM_DEV_ERROR(comp->dev, "Failed to enable power domain: %d\n", ret);
+		return;
+	}
+
 	ret = mtk_crtc_ddp_hw_init(mtk_crtc);
 	if (ret) {
 		mtk_smi_larb_put(comp->larb_dev);
+		pm_runtime_put(comp->dev);
 		return;
 	}
 
@@ -569,7 +577,7 @@ static void mtk_drm_crtc_atomic_disable(struct drm_crtc *crtc,
 {
 	struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc);
 	struct mtk_ddp_comp *comp = mtk_crtc->ddp_comp[0];
-	int i;
+	int i, ret;
 
 	DRM_DEBUG_DRIVER("%s %d\n", __func__, crtc->base.id);
 	if (!mtk_crtc->enabled)
@@ -593,6 +601,9 @@ static void mtk_drm_crtc_atomic_disable(struct drm_crtc *crtc,
 	drm_crtc_vblank_off(crtc);
 	mtk_crtc_ddp_hw_fini(mtk_crtc);
 	mtk_smi_larb_put(comp->larb_dev);
+	ret = pm_runtime_put(comp->dev);
+	if (ret < 0)
+		DRM_DEV_ERROR(comp->dev, "Failed to disable power domain: %d\n", ret);
 
 	mtk_crtc->enabled = false;
 }
-- 
2.18.0

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 08/13] drm/mediatek: Add pm runtime support for ovl and rdma
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Dafna Hirschfeld, Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang,
	anthony.huang, youlin.pei, Evan Green, Eizan Miyamoto,
	Matthias Kaehlcke, linux-arm-kernel, Yongqiang Niu, mingyuan.ma,
	linux-media, devicetree, Frank Wunderlich, libo.kang, yi.kuo,
	linux-mediatek, Hsin-Yi Wang, Tiffany Lin, yong.wu,
	AngeloGioacchino Del Regno, anan.sun, srv_heupstream, acourbot,
	linux-kernel, Tomasz Figa, iommu, Robin Murphy

From: Yongqiang Niu <yongqiang.niu@mediatek.com>

Prepare for smi cleaning up "mediatek,larb".

Display use the dispsys device to call pm_rumtime_get_sync before.
This patch add pm_runtime_xx with ovl and rdma device whose nodes has
"iommus" property, then display could help pm_runtime_get for smi via
ovl or rdma device.

CC: CK Hu <ck.hu@mediatek.com>
Signed-off-by: Yongqiang Niu <yongqiang.niu@mediatek.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
(Yong: Use pm_runtime_resume_and_get instead of pm_runtime_get_sync)
Acked-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/gpu/drm/mediatek/mtk_disp_ovl.c  |  8 +++++++-
 drivers/gpu/drm/mediatek/mtk_disp_rdma.c |  9 ++++++++-
 drivers/gpu/drm/mediatek/mtk_drm_crtc.c  | 13 ++++++++++++-
 3 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
index 5326989d5206..716eac6831f2 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
@@ -11,6 +11,7 @@
 #include <linux/of_device.h>
 #include <linux/of_irq.h>
 #include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
 #include <linux/soc/mediatek/mtk-cmdq.h>
 
 #include "mtk_disp_drv.h"
@@ -414,9 +415,13 @@ static int mtk_disp_ovl_probe(struct platform_device *pdev)
 		return ret;
 	}
 
+	pm_runtime_enable(dev);
+
 	ret = component_add(dev, &mtk_disp_ovl_component_ops);
-	if (ret)
+	if (ret) {
+		pm_runtime_disable(dev);
 		dev_err(dev, "Failed to add component: %d\n", ret);
+	}
 
 	return ret;
 }
@@ -424,6 +429,7 @@ static int mtk_disp_ovl_probe(struct platform_device *pdev)
 static int mtk_disp_ovl_remove(struct platform_device *pdev)
 {
 	component_del(&pdev->dev, &mtk_disp_ovl_component_ops);
+	pm_runtime_disable(&pdev->dev);
 
 	return 0;
 }
diff --git a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
index 75d7f45579e2..251f034acb09 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
@@ -9,6 +9,7 @@
 #include <linux/of_device.h>
 #include <linux/of_irq.h>
 #include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
 #include <linux/soc/mediatek/mtk-cmdq.h>
 
 #include "mtk_disp_drv.h"
@@ -327,9 +328,13 @@ static int mtk_disp_rdma_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, priv);
 
+	pm_runtime_enable(dev);
+
 	ret = component_add(dev, &mtk_disp_rdma_component_ops);
-	if (ret)
+	if (ret) {
+		pm_runtime_disable(dev);
 		dev_err(dev, "Failed to add component: %d\n", ret);
+	}
 
 	return ret;
 }
@@ -338,6 +343,8 @@ static int mtk_disp_rdma_remove(struct platform_device *pdev)
 {
 	component_del(&pdev->dev, &mtk_disp_rdma_component_ops);
 
+	pm_runtime_disable(&pdev->dev);
+
 	return 0;
 }
 
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
index a4e80e499674..ce5bbd6918cf 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
@@ -554,9 +554,17 @@ static void mtk_drm_crtc_atomic_enable(struct drm_crtc *crtc,
 		return;
 	}
 
+	ret = pm_runtime_resume_and_get(comp->dev);
+	if (ret < 0) {
+		mtk_smi_larb_put(comp->larb_dev);
+		DRM_DEV_ERROR(comp->dev, "Failed to enable power domain: %d\n", ret);
+		return;
+	}
+
 	ret = mtk_crtc_ddp_hw_init(mtk_crtc);
 	if (ret) {
 		mtk_smi_larb_put(comp->larb_dev);
+		pm_runtime_put(comp->dev);
 		return;
 	}
 
@@ -569,7 +577,7 @@ static void mtk_drm_crtc_atomic_disable(struct drm_crtc *crtc,
 {
 	struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc);
 	struct mtk_ddp_comp *comp = mtk_crtc->ddp_comp[0];
-	int i;
+	int i, ret;
 
 	DRM_DEBUG_DRIVER("%s %d\n", __func__, crtc->base.id);
 	if (!mtk_crtc->enabled)
@@ -593,6 +601,9 @@ static void mtk_drm_crtc_atomic_disable(struct drm_crtc *crtc,
 	drm_crtc_vblank_off(crtc);
 	mtk_crtc_ddp_hw_fini(mtk_crtc);
 	mtk_smi_larb_put(comp->larb_dev);
+	ret = pm_runtime_put(comp->dev);
+	if (ret < 0)
+		DRM_DEV_ERROR(comp->dev, "Failed to disable power domain: %d\n", ret);
 
 	mtk_crtc->enabled = false;
 }
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 08/13] drm/mediatek: Add pm runtime support for ovl and rdma
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Dafna Hirschfeld, Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang,
	anthony.huang, youlin.pei, Evan Green, Eizan Miyamoto,
	Matthias Kaehlcke, linux-arm-kernel, Yongqiang Niu, CK Hu,
	mingyuan.ma, linux-media, devicetree, Philipp Zabel, libo.kang,
	yi.kuo, linux-mediatek, Hsin-Yi Wang, Tiffany Lin, yong.wu,
	AngeloGioacchino Del Regno, anan.sun, srv_heupstream, acourbot,
	linux-kernel, Tomasz Figa, iommu, Daniel Vetter, Robin Murphy

From: Yongqiang Niu <yongqiang.niu@mediatek.com>

Prepare for smi cleaning up "mediatek,larb".

Display use the dispsys device to call pm_rumtime_get_sync before.
This patch add pm_runtime_xx with ovl and rdma device whose nodes has
"iommus" property, then display could help pm_runtime_get for smi via
ovl or rdma device.

CC: CK Hu <ck.hu@mediatek.com>
Signed-off-by: Yongqiang Niu <yongqiang.niu@mediatek.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
(Yong: Use pm_runtime_resume_and_get instead of pm_runtime_get_sync)
Acked-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/gpu/drm/mediatek/mtk_disp_ovl.c  |  8 +++++++-
 drivers/gpu/drm/mediatek/mtk_disp_rdma.c |  9 ++++++++-
 drivers/gpu/drm/mediatek/mtk_drm_crtc.c  | 13 ++++++++++++-
 3 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
index 5326989d5206..716eac6831f2 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
@@ -11,6 +11,7 @@
 #include <linux/of_device.h>
 #include <linux/of_irq.h>
 #include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
 #include <linux/soc/mediatek/mtk-cmdq.h>
 
 #include "mtk_disp_drv.h"
@@ -414,9 +415,13 @@ static int mtk_disp_ovl_probe(struct platform_device *pdev)
 		return ret;
 	}
 
+	pm_runtime_enable(dev);
+
 	ret = component_add(dev, &mtk_disp_ovl_component_ops);
-	if (ret)
+	if (ret) {
+		pm_runtime_disable(dev);
 		dev_err(dev, "Failed to add component: %d\n", ret);
+	}
 
 	return ret;
 }
@@ -424,6 +429,7 @@ static int mtk_disp_ovl_probe(struct platform_device *pdev)
 static int mtk_disp_ovl_remove(struct platform_device *pdev)
 {
 	component_del(&pdev->dev, &mtk_disp_ovl_component_ops);
+	pm_runtime_disable(&pdev->dev);
 
 	return 0;
 }
diff --git a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
index 75d7f45579e2..251f034acb09 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
@@ -9,6 +9,7 @@
 #include <linux/of_device.h>
 #include <linux/of_irq.h>
 #include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
 #include <linux/soc/mediatek/mtk-cmdq.h>
 
 #include "mtk_disp_drv.h"
@@ -327,9 +328,13 @@ static int mtk_disp_rdma_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, priv);
 
+	pm_runtime_enable(dev);
+
 	ret = component_add(dev, &mtk_disp_rdma_component_ops);
-	if (ret)
+	if (ret) {
+		pm_runtime_disable(dev);
 		dev_err(dev, "Failed to add component: %d\n", ret);
+	}
 
 	return ret;
 }
@@ -338,6 +343,8 @@ static int mtk_disp_rdma_remove(struct platform_device *pdev)
 {
 	component_del(&pdev->dev, &mtk_disp_rdma_component_ops);
 
+	pm_runtime_disable(&pdev->dev);
+
 	return 0;
 }
 
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
index a4e80e499674..ce5bbd6918cf 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
@@ -554,9 +554,17 @@ static void mtk_drm_crtc_atomic_enable(struct drm_crtc *crtc,
 		return;
 	}
 
+	ret = pm_runtime_resume_and_get(comp->dev);
+	if (ret < 0) {
+		mtk_smi_larb_put(comp->larb_dev);
+		DRM_DEV_ERROR(comp->dev, "Failed to enable power domain: %d\n", ret);
+		return;
+	}
+
 	ret = mtk_crtc_ddp_hw_init(mtk_crtc);
 	if (ret) {
 		mtk_smi_larb_put(comp->larb_dev);
+		pm_runtime_put(comp->dev);
 		return;
 	}
 
@@ -569,7 +577,7 @@ static void mtk_drm_crtc_atomic_disable(struct drm_crtc *crtc,
 {
 	struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc);
 	struct mtk_ddp_comp *comp = mtk_crtc->ddp_comp[0];
-	int i;
+	int i, ret;
 
 	DRM_DEBUG_DRIVER("%s %d\n", __func__, crtc->base.id);
 	if (!mtk_crtc->enabled)
@@ -593,6 +601,9 @@ static void mtk_drm_crtc_atomic_disable(struct drm_crtc *crtc,
 	drm_crtc_vblank_off(crtc);
 	mtk_crtc_ddp_hw_fini(mtk_crtc);
 	mtk_smi_larb_put(comp->larb_dev);
+	ret = pm_runtime_put(comp->dev);
+	if (ret < 0)
+		DRM_DEV_ERROR(comp->dev, "Failed to disable power domain: %d\n", ret);
 
 	mtk_crtc->enabled = false;
 }
-- 
2.18.0


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 08/13] drm/mediatek: Add pm runtime support for ovl and rdma
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Evan Green, Robin Murphy, Tomasz Figa, Will Deacon,
	linux-mediatek, srv_heupstream, devicetree, linux-kernel,
	linux-arm-kernel, iommu, yong.wu, youlin.pei, Matthias Kaehlcke,
	anan.sun, yi.kuo, acourbot, linux-media, dri-devel,
	Daniel Vetter, Chun-Kuang Hu, Philipp Zabel, Tiffany Lin,
	Dafna Hirschfeld, Hsin-Yi Wang, Eizan Miyamoto, anthony.huang,
	Frank Wunderlich, mingyuan.ma, yf.wang, libo.kang,
	AngeloGioacchino Del Regno, Yongqiang Niu, CK Hu

From: Yongqiang Niu <yongqiang.niu@mediatek.com>

Prepare for smi cleaning up "mediatek,larb".

Display use the dispsys device to call pm_rumtime_get_sync before.
This patch add pm_runtime_xx with ovl and rdma device whose nodes has
"iommus" property, then display could help pm_runtime_get for smi via
ovl or rdma device.

CC: CK Hu <ck.hu@mediatek.com>
Signed-off-by: Yongqiang Niu <yongqiang.niu@mediatek.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
(Yong: Use pm_runtime_resume_and_get instead of pm_runtime_get_sync)
Acked-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/gpu/drm/mediatek/mtk_disp_ovl.c  |  8 +++++++-
 drivers/gpu/drm/mediatek/mtk_disp_rdma.c |  9 ++++++++-
 drivers/gpu/drm/mediatek/mtk_drm_crtc.c  | 13 ++++++++++++-
 3 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
index 5326989d5206..716eac6831f2 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
@@ -11,6 +11,7 @@
 #include <linux/of_device.h>
 #include <linux/of_irq.h>
 #include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
 #include <linux/soc/mediatek/mtk-cmdq.h>
 
 #include "mtk_disp_drv.h"
@@ -414,9 +415,13 @@ static int mtk_disp_ovl_probe(struct platform_device *pdev)
 		return ret;
 	}
 
+	pm_runtime_enable(dev);
+
 	ret = component_add(dev, &mtk_disp_ovl_component_ops);
-	if (ret)
+	if (ret) {
+		pm_runtime_disable(dev);
 		dev_err(dev, "Failed to add component: %d\n", ret);
+	}
 
 	return ret;
 }
@@ -424,6 +429,7 @@ static int mtk_disp_ovl_probe(struct platform_device *pdev)
 static int mtk_disp_ovl_remove(struct platform_device *pdev)
 {
 	component_del(&pdev->dev, &mtk_disp_ovl_component_ops);
+	pm_runtime_disable(&pdev->dev);
 
 	return 0;
 }
diff --git a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
index 75d7f45579e2..251f034acb09 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
@@ -9,6 +9,7 @@
 #include <linux/of_device.h>
 #include <linux/of_irq.h>
 #include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
 #include <linux/soc/mediatek/mtk-cmdq.h>
 
 #include "mtk_disp_drv.h"
@@ -327,9 +328,13 @@ static int mtk_disp_rdma_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, priv);
 
+	pm_runtime_enable(dev);
+
 	ret = component_add(dev, &mtk_disp_rdma_component_ops);
-	if (ret)
+	if (ret) {
+		pm_runtime_disable(dev);
 		dev_err(dev, "Failed to add component: %d\n", ret);
+	}
 
 	return ret;
 }
@@ -338,6 +343,8 @@ static int mtk_disp_rdma_remove(struct platform_device *pdev)
 {
 	component_del(&pdev->dev, &mtk_disp_rdma_component_ops);
 
+	pm_runtime_disable(&pdev->dev);
+
 	return 0;
 }
 
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
index a4e80e499674..ce5bbd6918cf 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
@@ -554,9 +554,17 @@ static void mtk_drm_crtc_atomic_enable(struct drm_crtc *crtc,
 		return;
 	}
 
+	ret = pm_runtime_resume_and_get(comp->dev);
+	if (ret < 0) {
+		mtk_smi_larb_put(comp->larb_dev);
+		DRM_DEV_ERROR(comp->dev, "Failed to enable power domain: %d\n", ret);
+		return;
+	}
+
 	ret = mtk_crtc_ddp_hw_init(mtk_crtc);
 	if (ret) {
 		mtk_smi_larb_put(comp->larb_dev);
+		pm_runtime_put(comp->dev);
 		return;
 	}
 
@@ -569,7 +577,7 @@ static void mtk_drm_crtc_atomic_disable(struct drm_crtc *crtc,
 {
 	struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc);
 	struct mtk_ddp_comp *comp = mtk_crtc->ddp_comp[0];
-	int i;
+	int i, ret;
 
 	DRM_DEBUG_DRIVER("%s %d\n", __func__, crtc->base.id);
 	if (!mtk_crtc->enabled)
@@ -593,6 +601,9 @@ static void mtk_drm_crtc_atomic_disable(struct drm_crtc *crtc,
 	drm_crtc_vblank_off(crtc);
 	mtk_crtc_ddp_hw_fini(mtk_crtc);
 	mtk_smi_larb_put(comp->larb_dev);
+	ret = pm_runtime_put(comp->dev);
+	if (ret < 0)
+		DRM_DEV_ERROR(comp->dev, "Failed to disable power domain: %d\n", ret);
 
 	mtk_crtc->enabled = false;
 }
-- 
2.18.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 09/13] drm/mediatek: Get rid of mtk_smi_larb_get/put
  2022-01-17  7:04 ` Yong Wu
                     ` (2 preceding siblings ...)
  (?)
@ 2022-01-17  7:05   ` Yong Wu
  -1 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Evan Green, Robin Murphy, Tomasz Figa, Will Deacon,
	linux-mediatek, srv_heupstream, devicetree, linux-kernel,
	linux-arm-kernel, iommu, yong.wu, youlin.pei, Matthias Kaehlcke,
	anan.sun, yi.kuo, acourbot, linux-media, dri-devel,
	Daniel Vetter, Chun-Kuang Hu, Philipp Zabel, Tiffany Lin,
	Dafna Hirschfeld, Hsin-Yi Wang, Eizan Miyamoto, anthony.huang,
	Frank Wunderlich, mingyuan.ma, yf.wang, libo.kang,
	AngeloGioacchino Del Regno, CK Hu

MediaTek IOMMU has already added the device_link between the consumer
and smi-larb device. If the drm device calls the pm_runtime_get_sync,
the smi-larb's pm_runtime_get_sync also be called automatically.

CC: CK Hu <ck.hu@mediatek.com>
CC: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Evan Green <evgreen@chromium.org>
Acked-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Reviewed-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/gpu/drm/mediatek/mtk_drm_crtc.c     | 10 ------
 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 36 ++-------------------
 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h |  1 -
 drivers/gpu/drm/mediatek/mtk_drm_drv.c      |  5 +--
 4 files changed, 3 insertions(+), 49 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
index ce5bbd6918cf..12c6a2097142 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
@@ -10,7 +10,6 @@
 #include <linux/soc/mediatek/mtk-mutex.h>
 
 #include <asm/barrier.h>
-#include <soc/mediatek/smi.h>
 
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
@@ -548,22 +547,14 @@ static void mtk_drm_crtc_atomic_enable(struct drm_crtc *crtc,
 
 	DRM_DEBUG_DRIVER("%s %d\n", __func__, crtc->base.id);
 
-	ret = mtk_smi_larb_get(comp->larb_dev);
-	if (ret) {
-		DRM_ERROR("Failed to get larb: %d\n", ret);
-		return;
-	}
-
 	ret = pm_runtime_resume_and_get(comp->dev);
 	if (ret < 0) {
-		mtk_smi_larb_put(comp->larb_dev);
 		DRM_DEV_ERROR(comp->dev, "Failed to enable power domain: %d\n", ret);
 		return;
 	}
 
 	ret = mtk_crtc_ddp_hw_init(mtk_crtc);
 	if (ret) {
-		mtk_smi_larb_put(comp->larb_dev);
 		pm_runtime_put(comp->dev);
 		return;
 	}
@@ -600,7 +591,6 @@ static void mtk_drm_crtc_atomic_disable(struct drm_crtc *crtc,
 
 	drm_crtc_vblank_off(crtc);
 	mtk_crtc_ddp_hw_fini(mtk_crtc);
-	mtk_smi_larb_put(comp->larb_dev);
 	ret = pm_runtime_put(comp->dev);
 	if (ret < 0)
 		DRM_DEV_ERROR(comp->dev, "Failed to disable power domain: %d\n", ret);
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
index 99cbf44463e4..48642e814370 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
@@ -414,37 +414,15 @@ unsigned int mtk_drm_find_possible_crtc_by_comp(struct drm_device *drm,
 	return ret;
 }
 
-static int mtk_ddp_get_larb_dev(struct device_node *node, struct mtk_ddp_comp *comp,
-				struct device *dev)
-{
-	struct device_node *larb_node;
-	struct platform_device *larb_pdev;
-
-	larb_node = of_parse_phandle(node, "mediatek,larb", 0);
-	if (!larb_node) {
-		dev_err(dev, "Missing mediadek,larb phandle in %pOF node\n", node);
-		return -EINVAL;
-	}
-
-	larb_pdev = of_find_device_by_node(larb_node);
-	if (!larb_pdev) {
-		dev_warn(dev, "Waiting for larb device %pOF\n", larb_node);
-		of_node_put(larb_node);
-		return -EPROBE_DEFER;
-	}
-	of_node_put(larb_node);
-	comp->larb_dev = &larb_pdev->dev;
-
-	return 0;
-}
-
 int mtk_ddp_comp_init(struct device_node *node, struct mtk_ddp_comp *comp,
 		      enum mtk_ddp_comp_id comp_id)
 {
 	struct platform_device *comp_pdev;
 	enum mtk_ddp_comp_type type;
 	struct mtk_ddp_comp_dev *priv;
+#if IS_REACHABLE(CONFIG_MTK_CMDQ)
 	int ret;
+#endif
 
 	if (comp_id < 0 || comp_id >= DDP_COMPONENT_ID_MAX)
 		return -EINVAL;
@@ -460,16 +438,6 @@ int mtk_ddp_comp_init(struct device_node *node, struct mtk_ddp_comp *comp,
 	}
 	comp->dev = &comp_pdev->dev;
 
-	/* Only DMA capable components need the LARB property */
-	if (type == MTK_DISP_OVL ||
-	    type == MTK_DISP_OVL_2L ||
-	    type == MTK_DISP_RDMA ||
-	    type == MTK_DISP_WDMA) {
-		ret = mtk_ddp_get_larb_dev(node, comp, comp->dev);
-		if (ret)
-			return ret;
-	}
-
 	if (type == MTK_DISP_AAL ||
 	    type == MTK_DISP_BLS ||
 	    type == MTK_DISP_CCORR ||
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
index bb914d976cf5..1b582262b682 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
@@ -70,7 +70,6 @@ struct mtk_ddp_comp_funcs {
 struct mtk_ddp_comp {
 	struct device *dev;
 	int irq;
-	struct device *larb_dev;
 	enum mtk_ddp_comp_id id;
 	const struct mtk_ddp_comp_funcs *funcs;
 };
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
index aec39724ebeb..c234293fc2c3 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
@@ -603,11 +603,8 @@ static int mtk_drm_probe(struct platform_device *pdev)
 	pm_runtime_disable(dev);
 err_node:
 	of_node_put(private->mutex_node);
-	for (i = 0; i < DDP_COMPONENT_ID_MAX; i++) {
+	for (i = 0; i < DDP_COMPONENT_ID_MAX; i++)
 		of_node_put(private->comp_node[i]);
-		if (private->ddp_comp[i].larb_dev)
-			put_device(private->ddp_comp[i].larb_dev);
-	}
 	return ret;
 }
 
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 09/13] drm/mediatek: Get rid of mtk_smi_larb_get/put
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang, anthony.huang,
	youlin.pei, Evan Green, Eizan Miyamoto, Matthias Kaehlcke,
	linux-arm-kernel, CK Hu, mingyuan.ma, linux-media, devicetree,
	Philipp Zabel, Frank Wunderlich, libo.kang, yi.kuo,
	linux-mediatek, Hsin-Yi Wang, Tiffany Lin,
	AngeloGioacchino Del Regno, anan.sun, srv_heupstream, acourbot,
	linux-kernel, iommu, Daniel Vetter, Robin Murphy

MediaTek IOMMU has already added the device_link between the consumer
and smi-larb device. If the drm device calls the pm_runtime_get_sync,
the smi-larb's pm_runtime_get_sync also be called automatically.

CC: CK Hu <ck.hu@mediatek.com>
CC: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Evan Green <evgreen@chromium.org>
Acked-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Reviewed-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/gpu/drm/mediatek/mtk_drm_crtc.c     | 10 ------
 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 36 ++-------------------
 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h |  1 -
 drivers/gpu/drm/mediatek/mtk_drm_drv.c      |  5 +--
 4 files changed, 3 insertions(+), 49 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
index ce5bbd6918cf..12c6a2097142 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
@@ -10,7 +10,6 @@
 #include <linux/soc/mediatek/mtk-mutex.h>
 
 #include <asm/barrier.h>
-#include <soc/mediatek/smi.h>
 
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
@@ -548,22 +547,14 @@ static void mtk_drm_crtc_atomic_enable(struct drm_crtc *crtc,
 
 	DRM_DEBUG_DRIVER("%s %d\n", __func__, crtc->base.id);
 
-	ret = mtk_smi_larb_get(comp->larb_dev);
-	if (ret) {
-		DRM_ERROR("Failed to get larb: %d\n", ret);
-		return;
-	}
-
 	ret = pm_runtime_resume_and_get(comp->dev);
 	if (ret < 0) {
-		mtk_smi_larb_put(comp->larb_dev);
 		DRM_DEV_ERROR(comp->dev, "Failed to enable power domain: %d\n", ret);
 		return;
 	}
 
 	ret = mtk_crtc_ddp_hw_init(mtk_crtc);
 	if (ret) {
-		mtk_smi_larb_put(comp->larb_dev);
 		pm_runtime_put(comp->dev);
 		return;
 	}
@@ -600,7 +591,6 @@ static void mtk_drm_crtc_atomic_disable(struct drm_crtc *crtc,
 
 	drm_crtc_vblank_off(crtc);
 	mtk_crtc_ddp_hw_fini(mtk_crtc);
-	mtk_smi_larb_put(comp->larb_dev);
 	ret = pm_runtime_put(comp->dev);
 	if (ret < 0)
 		DRM_DEV_ERROR(comp->dev, "Failed to disable power domain: %d\n", ret);
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
index 99cbf44463e4..48642e814370 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
@@ -414,37 +414,15 @@ unsigned int mtk_drm_find_possible_crtc_by_comp(struct drm_device *drm,
 	return ret;
 }
 
-static int mtk_ddp_get_larb_dev(struct device_node *node, struct mtk_ddp_comp *comp,
-				struct device *dev)
-{
-	struct device_node *larb_node;
-	struct platform_device *larb_pdev;
-
-	larb_node = of_parse_phandle(node, "mediatek,larb", 0);
-	if (!larb_node) {
-		dev_err(dev, "Missing mediadek,larb phandle in %pOF node\n", node);
-		return -EINVAL;
-	}
-
-	larb_pdev = of_find_device_by_node(larb_node);
-	if (!larb_pdev) {
-		dev_warn(dev, "Waiting for larb device %pOF\n", larb_node);
-		of_node_put(larb_node);
-		return -EPROBE_DEFER;
-	}
-	of_node_put(larb_node);
-	comp->larb_dev = &larb_pdev->dev;
-
-	return 0;
-}
-
 int mtk_ddp_comp_init(struct device_node *node, struct mtk_ddp_comp *comp,
 		      enum mtk_ddp_comp_id comp_id)
 {
 	struct platform_device *comp_pdev;
 	enum mtk_ddp_comp_type type;
 	struct mtk_ddp_comp_dev *priv;
+#if IS_REACHABLE(CONFIG_MTK_CMDQ)
 	int ret;
+#endif
 
 	if (comp_id < 0 || comp_id >= DDP_COMPONENT_ID_MAX)
 		return -EINVAL;
@@ -460,16 +438,6 @@ int mtk_ddp_comp_init(struct device_node *node, struct mtk_ddp_comp *comp,
 	}
 	comp->dev = &comp_pdev->dev;
 
-	/* Only DMA capable components need the LARB property */
-	if (type == MTK_DISP_OVL ||
-	    type == MTK_DISP_OVL_2L ||
-	    type == MTK_DISP_RDMA ||
-	    type == MTK_DISP_WDMA) {
-		ret = mtk_ddp_get_larb_dev(node, comp, comp->dev);
-		if (ret)
-			return ret;
-	}
-
 	if (type == MTK_DISP_AAL ||
 	    type == MTK_DISP_BLS ||
 	    type == MTK_DISP_CCORR ||
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
index bb914d976cf5..1b582262b682 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
@@ -70,7 +70,6 @@ struct mtk_ddp_comp_funcs {
 struct mtk_ddp_comp {
 	struct device *dev;
 	int irq;
-	struct device *larb_dev;
 	enum mtk_ddp_comp_id id;
 	const struct mtk_ddp_comp_funcs *funcs;
 };
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
index aec39724ebeb..c234293fc2c3 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
@@ -603,11 +603,8 @@ static int mtk_drm_probe(struct platform_device *pdev)
 	pm_runtime_disable(dev);
 err_node:
 	of_node_put(private->mutex_node);
-	for (i = 0; i < DDP_COMPONENT_ID_MAX; i++) {
+	for (i = 0; i < DDP_COMPONENT_ID_MAX; i++)
 		of_node_put(private->comp_node[i]);
-		if (private->ddp_comp[i].larb_dev)
-			put_device(private->ddp_comp[i].larb_dev);
-	}
 	return ret;
 }
 
-- 
2.18.0

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 09/13] drm/mediatek: Get rid of mtk_smi_larb_get/put
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Dafna Hirschfeld, Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang,
	anthony.huang, youlin.pei, Evan Green, Eizan Miyamoto,
	Matthias Kaehlcke, linux-arm-kernel, mingyuan.ma, linux-media,
	devicetree, Frank Wunderlich, libo.kang, yi.kuo, linux-mediatek,
	Hsin-Yi Wang, Tiffany Lin, yong.wu, AngeloGioacchino Del Regno,
	anan.sun, srv_heupstream, acourbot, linux-kernel, Tomasz Figa,
	iommu, Robin Murphy

MediaTek IOMMU has already added the device_link between the consumer
and smi-larb device. If the drm device calls the pm_runtime_get_sync,
the smi-larb's pm_runtime_get_sync also be called automatically.

CC: CK Hu <ck.hu@mediatek.com>
CC: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Evan Green <evgreen@chromium.org>
Acked-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Reviewed-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/gpu/drm/mediatek/mtk_drm_crtc.c     | 10 ------
 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 36 ++-------------------
 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h |  1 -
 drivers/gpu/drm/mediatek/mtk_drm_drv.c      |  5 +--
 4 files changed, 3 insertions(+), 49 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
index ce5bbd6918cf..12c6a2097142 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
@@ -10,7 +10,6 @@
 #include <linux/soc/mediatek/mtk-mutex.h>
 
 #include <asm/barrier.h>
-#include <soc/mediatek/smi.h>
 
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
@@ -548,22 +547,14 @@ static void mtk_drm_crtc_atomic_enable(struct drm_crtc *crtc,
 
 	DRM_DEBUG_DRIVER("%s %d\n", __func__, crtc->base.id);
 
-	ret = mtk_smi_larb_get(comp->larb_dev);
-	if (ret) {
-		DRM_ERROR("Failed to get larb: %d\n", ret);
-		return;
-	}
-
 	ret = pm_runtime_resume_and_get(comp->dev);
 	if (ret < 0) {
-		mtk_smi_larb_put(comp->larb_dev);
 		DRM_DEV_ERROR(comp->dev, "Failed to enable power domain: %d\n", ret);
 		return;
 	}
 
 	ret = mtk_crtc_ddp_hw_init(mtk_crtc);
 	if (ret) {
-		mtk_smi_larb_put(comp->larb_dev);
 		pm_runtime_put(comp->dev);
 		return;
 	}
@@ -600,7 +591,6 @@ static void mtk_drm_crtc_atomic_disable(struct drm_crtc *crtc,
 
 	drm_crtc_vblank_off(crtc);
 	mtk_crtc_ddp_hw_fini(mtk_crtc);
-	mtk_smi_larb_put(comp->larb_dev);
 	ret = pm_runtime_put(comp->dev);
 	if (ret < 0)
 		DRM_DEV_ERROR(comp->dev, "Failed to disable power domain: %d\n", ret);
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
index 99cbf44463e4..48642e814370 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
@@ -414,37 +414,15 @@ unsigned int mtk_drm_find_possible_crtc_by_comp(struct drm_device *drm,
 	return ret;
 }
 
-static int mtk_ddp_get_larb_dev(struct device_node *node, struct mtk_ddp_comp *comp,
-				struct device *dev)
-{
-	struct device_node *larb_node;
-	struct platform_device *larb_pdev;
-
-	larb_node = of_parse_phandle(node, "mediatek,larb", 0);
-	if (!larb_node) {
-		dev_err(dev, "Missing mediadek,larb phandle in %pOF node\n", node);
-		return -EINVAL;
-	}
-
-	larb_pdev = of_find_device_by_node(larb_node);
-	if (!larb_pdev) {
-		dev_warn(dev, "Waiting for larb device %pOF\n", larb_node);
-		of_node_put(larb_node);
-		return -EPROBE_DEFER;
-	}
-	of_node_put(larb_node);
-	comp->larb_dev = &larb_pdev->dev;
-
-	return 0;
-}
-
 int mtk_ddp_comp_init(struct device_node *node, struct mtk_ddp_comp *comp,
 		      enum mtk_ddp_comp_id comp_id)
 {
 	struct platform_device *comp_pdev;
 	enum mtk_ddp_comp_type type;
 	struct mtk_ddp_comp_dev *priv;
+#if IS_REACHABLE(CONFIG_MTK_CMDQ)
 	int ret;
+#endif
 
 	if (comp_id < 0 || comp_id >= DDP_COMPONENT_ID_MAX)
 		return -EINVAL;
@@ -460,16 +438,6 @@ int mtk_ddp_comp_init(struct device_node *node, struct mtk_ddp_comp *comp,
 	}
 	comp->dev = &comp_pdev->dev;
 
-	/* Only DMA capable components need the LARB property */
-	if (type == MTK_DISP_OVL ||
-	    type == MTK_DISP_OVL_2L ||
-	    type == MTK_DISP_RDMA ||
-	    type == MTK_DISP_WDMA) {
-		ret = mtk_ddp_get_larb_dev(node, comp, comp->dev);
-		if (ret)
-			return ret;
-	}
-
 	if (type == MTK_DISP_AAL ||
 	    type == MTK_DISP_BLS ||
 	    type == MTK_DISP_CCORR ||
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
index bb914d976cf5..1b582262b682 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
@@ -70,7 +70,6 @@ struct mtk_ddp_comp_funcs {
 struct mtk_ddp_comp {
 	struct device *dev;
 	int irq;
-	struct device *larb_dev;
 	enum mtk_ddp_comp_id id;
 	const struct mtk_ddp_comp_funcs *funcs;
 };
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
index aec39724ebeb..c234293fc2c3 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
@@ -603,11 +603,8 @@ static int mtk_drm_probe(struct platform_device *pdev)
 	pm_runtime_disable(dev);
 err_node:
 	of_node_put(private->mutex_node);
-	for (i = 0; i < DDP_COMPONENT_ID_MAX; i++) {
+	for (i = 0; i < DDP_COMPONENT_ID_MAX; i++)
 		of_node_put(private->comp_node[i]);
-		if (private->ddp_comp[i].larb_dev)
-			put_device(private->ddp_comp[i].larb_dev);
-	}
 	return ret;
 }
 
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 09/13] drm/mediatek: Get rid of mtk_smi_larb_get/put
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Dafna Hirschfeld, Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang,
	anthony.huang, youlin.pei, Evan Green, Eizan Miyamoto,
	Matthias Kaehlcke, linux-arm-kernel, CK Hu, mingyuan.ma,
	linux-media, devicetree, Philipp Zabel, libo.kang, yi.kuo,
	linux-mediatek, Hsin-Yi Wang, Tiffany Lin, yong.wu,
	AngeloGioacchino Del Regno, anan.sun, srv_heupstream, acourbot,
	linux-kernel, Tomasz Figa, iommu, Daniel Vetter, Robin Murphy

MediaTek IOMMU has already added the device_link between the consumer
and smi-larb device. If the drm device calls the pm_runtime_get_sync,
the smi-larb's pm_runtime_get_sync also be called automatically.

CC: CK Hu <ck.hu@mediatek.com>
CC: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Evan Green <evgreen@chromium.org>
Acked-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Reviewed-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/gpu/drm/mediatek/mtk_drm_crtc.c     | 10 ------
 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 36 ++-------------------
 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h |  1 -
 drivers/gpu/drm/mediatek/mtk_drm_drv.c      |  5 +--
 4 files changed, 3 insertions(+), 49 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
index ce5bbd6918cf..12c6a2097142 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
@@ -10,7 +10,6 @@
 #include <linux/soc/mediatek/mtk-mutex.h>
 
 #include <asm/barrier.h>
-#include <soc/mediatek/smi.h>
 
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
@@ -548,22 +547,14 @@ static void mtk_drm_crtc_atomic_enable(struct drm_crtc *crtc,
 
 	DRM_DEBUG_DRIVER("%s %d\n", __func__, crtc->base.id);
 
-	ret = mtk_smi_larb_get(comp->larb_dev);
-	if (ret) {
-		DRM_ERROR("Failed to get larb: %d\n", ret);
-		return;
-	}
-
 	ret = pm_runtime_resume_and_get(comp->dev);
 	if (ret < 0) {
-		mtk_smi_larb_put(comp->larb_dev);
 		DRM_DEV_ERROR(comp->dev, "Failed to enable power domain: %d\n", ret);
 		return;
 	}
 
 	ret = mtk_crtc_ddp_hw_init(mtk_crtc);
 	if (ret) {
-		mtk_smi_larb_put(comp->larb_dev);
 		pm_runtime_put(comp->dev);
 		return;
 	}
@@ -600,7 +591,6 @@ static void mtk_drm_crtc_atomic_disable(struct drm_crtc *crtc,
 
 	drm_crtc_vblank_off(crtc);
 	mtk_crtc_ddp_hw_fini(mtk_crtc);
-	mtk_smi_larb_put(comp->larb_dev);
 	ret = pm_runtime_put(comp->dev);
 	if (ret < 0)
 		DRM_DEV_ERROR(comp->dev, "Failed to disable power domain: %d\n", ret);
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
index 99cbf44463e4..48642e814370 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
@@ -414,37 +414,15 @@ unsigned int mtk_drm_find_possible_crtc_by_comp(struct drm_device *drm,
 	return ret;
 }
 
-static int mtk_ddp_get_larb_dev(struct device_node *node, struct mtk_ddp_comp *comp,
-				struct device *dev)
-{
-	struct device_node *larb_node;
-	struct platform_device *larb_pdev;
-
-	larb_node = of_parse_phandle(node, "mediatek,larb", 0);
-	if (!larb_node) {
-		dev_err(dev, "Missing mediadek,larb phandle in %pOF node\n", node);
-		return -EINVAL;
-	}
-
-	larb_pdev = of_find_device_by_node(larb_node);
-	if (!larb_pdev) {
-		dev_warn(dev, "Waiting for larb device %pOF\n", larb_node);
-		of_node_put(larb_node);
-		return -EPROBE_DEFER;
-	}
-	of_node_put(larb_node);
-	comp->larb_dev = &larb_pdev->dev;
-
-	return 0;
-}
-
 int mtk_ddp_comp_init(struct device_node *node, struct mtk_ddp_comp *comp,
 		      enum mtk_ddp_comp_id comp_id)
 {
 	struct platform_device *comp_pdev;
 	enum mtk_ddp_comp_type type;
 	struct mtk_ddp_comp_dev *priv;
+#if IS_REACHABLE(CONFIG_MTK_CMDQ)
 	int ret;
+#endif
 
 	if (comp_id < 0 || comp_id >= DDP_COMPONENT_ID_MAX)
 		return -EINVAL;
@@ -460,16 +438,6 @@ int mtk_ddp_comp_init(struct device_node *node, struct mtk_ddp_comp *comp,
 	}
 	comp->dev = &comp_pdev->dev;
 
-	/* Only DMA capable components need the LARB property */
-	if (type == MTK_DISP_OVL ||
-	    type == MTK_DISP_OVL_2L ||
-	    type == MTK_DISP_RDMA ||
-	    type == MTK_DISP_WDMA) {
-		ret = mtk_ddp_get_larb_dev(node, comp, comp->dev);
-		if (ret)
-			return ret;
-	}
-
 	if (type == MTK_DISP_AAL ||
 	    type == MTK_DISP_BLS ||
 	    type == MTK_DISP_CCORR ||
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
index bb914d976cf5..1b582262b682 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
@@ -70,7 +70,6 @@ struct mtk_ddp_comp_funcs {
 struct mtk_ddp_comp {
 	struct device *dev;
 	int irq;
-	struct device *larb_dev;
 	enum mtk_ddp_comp_id id;
 	const struct mtk_ddp_comp_funcs *funcs;
 };
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
index aec39724ebeb..c234293fc2c3 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
@@ -603,11 +603,8 @@ static int mtk_drm_probe(struct platform_device *pdev)
 	pm_runtime_disable(dev);
 err_node:
 	of_node_put(private->mutex_node);
-	for (i = 0; i < DDP_COMPONENT_ID_MAX; i++) {
+	for (i = 0; i < DDP_COMPONENT_ID_MAX; i++)
 		of_node_put(private->comp_node[i]);
-		if (private->ddp_comp[i].larb_dev)
-			put_device(private->ddp_comp[i].larb_dev);
-	}
 	return ret;
 }
 
-- 
2.18.0


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 09/13] drm/mediatek: Get rid of mtk_smi_larb_get/put
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Evan Green, Robin Murphy, Tomasz Figa, Will Deacon,
	linux-mediatek, srv_heupstream, devicetree, linux-kernel,
	linux-arm-kernel, iommu, yong.wu, youlin.pei, Matthias Kaehlcke,
	anan.sun, yi.kuo, acourbot, linux-media, dri-devel,
	Daniel Vetter, Chun-Kuang Hu, Philipp Zabel, Tiffany Lin,
	Dafna Hirschfeld, Hsin-Yi Wang, Eizan Miyamoto, anthony.huang,
	Frank Wunderlich, mingyuan.ma, yf.wang, libo.kang,
	AngeloGioacchino Del Regno, CK Hu

MediaTek IOMMU has already added the device_link between the consumer
and smi-larb device. If the drm device calls the pm_runtime_get_sync,
the smi-larb's pm_runtime_get_sync also be called automatically.

CC: CK Hu <ck.hu@mediatek.com>
CC: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Evan Green <evgreen@chromium.org>
Acked-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Reviewed-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/gpu/drm/mediatek/mtk_drm_crtc.c     | 10 ------
 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 36 ++-------------------
 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h |  1 -
 drivers/gpu/drm/mediatek/mtk_drm_drv.c      |  5 +--
 4 files changed, 3 insertions(+), 49 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
index ce5bbd6918cf..12c6a2097142 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
@@ -10,7 +10,6 @@
 #include <linux/soc/mediatek/mtk-mutex.h>
 
 #include <asm/barrier.h>
-#include <soc/mediatek/smi.h>
 
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
@@ -548,22 +547,14 @@ static void mtk_drm_crtc_atomic_enable(struct drm_crtc *crtc,
 
 	DRM_DEBUG_DRIVER("%s %d\n", __func__, crtc->base.id);
 
-	ret = mtk_smi_larb_get(comp->larb_dev);
-	if (ret) {
-		DRM_ERROR("Failed to get larb: %d\n", ret);
-		return;
-	}
-
 	ret = pm_runtime_resume_and_get(comp->dev);
 	if (ret < 0) {
-		mtk_smi_larb_put(comp->larb_dev);
 		DRM_DEV_ERROR(comp->dev, "Failed to enable power domain: %d\n", ret);
 		return;
 	}
 
 	ret = mtk_crtc_ddp_hw_init(mtk_crtc);
 	if (ret) {
-		mtk_smi_larb_put(comp->larb_dev);
 		pm_runtime_put(comp->dev);
 		return;
 	}
@@ -600,7 +591,6 @@ static void mtk_drm_crtc_atomic_disable(struct drm_crtc *crtc,
 
 	drm_crtc_vblank_off(crtc);
 	mtk_crtc_ddp_hw_fini(mtk_crtc);
-	mtk_smi_larb_put(comp->larb_dev);
 	ret = pm_runtime_put(comp->dev);
 	if (ret < 0)
 		DRM_DEV_ERROR(comp->dev, "Failed to disable power domain: %d\n", ret);
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
index 99cbf44463e4..48642e814370 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
@@ -414,37 +414,15 @@ unsigned int mtk_drm_find_possible_crtc_by_comp(struct drm_device *drm,
 	return ret;
 }
 
-static int mtk_ddp_get_larb_dev(struct device_node *node, struct mtk_ddp_comp *comp,
-				struct device *dev)
-{
-	struct device_node *larb_node;
-	struct platform_device *larb_pdev;
-
-	larb_node = of_parse_phandle(node, "mediatek,larb", 0);
-	if (!larb_node) {
-		dev_err(dev, "Missing mediadek,larb phandle in %pOF node\n", node);
-		return -EINVAL;
-	}
-
-	larb_pdev = of_find_device_by_node(larb_node);
-	if (!larb_pdev) {
-		dev_warn(dev, "Waiting for larb device %pOF\n", larb_node);
-		of_node_put(larb_node);
-		return -EPROBE_DEFER;
-	}
-	of_node_put(larb_node);
-	comp->larb_dev = &larb_pdev->dev;
-
-	return 0;
-}
-
 int mtk_ddp_comp_init(struct device_node *node, struct mtk_ddp_comp *comp,
 		      enum mtk_ddp_comp_id comp_id)
 {
 	struct platform_device *comp_pdev;
 	enum mtk_ddp_comp_type type;
 	struct mtk_ddp_comp_dev *priv;
+#if IS_REACHABLE(CONFIG_MTK_CMDQ)
 	int ret;
+#endif
 
 	if (comp_id < 0 || comp_id >= DDP_COMPONENT_ID_MAX)
 		return -EINVAL;
@@ -460,16 +438,6 @@ int mtk_ddp_comp_init(struct device_node *node, struct mtk_ddp_comp *comp,
 	}
 	comp->dev = &comp_pdev->dev;
 
-	/* Only DMA capable components need the LARB property */
-	if (type == MTK_DISP_OVL ||
-	    type == MTK_DISP_OVL_2L ||
-	    type == MTK_DISP_RDMA ||
-	    type == MTK_DISP_WDMA) {
-		ret = mtk_ddp_get_larb_dev(node, comp, comp->dev);
-		if (ret)
-			return ret;
-	}
-
 	if (type == MTK_DISP_AAL ||
 	    type == MTK_DISP_BLS ||
 	    type == MTK_DISP_CCORR ||
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
index bb914d976cf5..1b582262b682 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
@@ -70,7 +70,6 @@ struct mtk_ddp_comp_funcs {
 struct mtk_ddp_comp {
 	struct device *dev;
 	int irq;
-	struct device *larb_dev;
 	enum mtk_ddp_comp_id id;
 	const struct mtk_ddp_comp_funcs *funcs;
 };
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
index aec39724ebeb..c234293fc2c3 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
@@ -603,11 +603,8 @@ static int mtk_drm_probe(struct platform_device *pdev)
 	pm_runtime_disable(dev);
 err_node:
 	of_node_put(private->mutex_node);
-	for (i = 0; i < DDP_COMPONENT_ID_MAX; i++) {
+	for (i = 0; i < DDP_COMPONENT_ID_MAX; i++)
 		of_node_put(private->comp_node[i]);
-		if (private->ddp_comp[i].larb_dev)
-			put_device(private->ddp_comp[i].larb_dev);
-	}
 	return ret;
 }
 
-- 
2.18.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 10/13] media: mtk-vcodec: Get rid of mtk_smi_larb_get/put
  2022-01-17  7:04 ` Yong Wu
                     ` (2 preceding siblings ...)
  (?)
@ 2022-01-17  7:05   ` Yong Wu
  -1 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Evan Green, Robin Murphy, Tomasz Figa, Will Deacon,
	linux-mediatek, srv_heupstream, devicetree, linux-kernel,
	linux-arm-kernel, iommu, yong.wu, youlin.pei, Matthias Kaehlcke,
	anan.sun, yi.kuo, acourbot, linux-media, dri-devel,
	Daniel Vetter, Chun-Kuang Hu, Philipp Zabel, Tiffany Lin,
	Dafna Hirschfeld, Hsin-Yi Wang, Eizan Miyamoto, anthony.huang,
	Frank Wunderlich, mingyuan.ma, yf.wang, libo.kang,
	AngeloGioacchino Del Regno, Irui Wang

MediaTek IOMMU has already added the device_link between the consumer
and smi-larb device. If the vcodec devices call the pm_runtime_get_sync,
the smi-larb's pm_runtime_get_sync also be called automatically.

CC: Tiffany Lin <tiffany.lin@mediatek.com>
CC: Irui Wang <irui.wang@mediatek.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Evan Green <evgreen@chromium.org>
Acked-by: Tiffany Lin <tiffany.lin@mediatek.com>
Reviewed-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
---
 .../platform/mtk-vcodec/mtk_vcodec_dec_drv.c  |  2 -
 .../platform/mtk-vcodec/mtk_vcodec_dec_hw.c   |  1 -
 .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c   | 41 +++--------------
 .../platform/mtk-vcodec/mtk_vcodec_drv.h      |  3 --
 .../platform/mtk-vcodec/mtk_vcodec_enc.c      |  1 -
 .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c  |  2 -
 .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c   | 45 +++----------------
 7 files changed, 12 insertions(+), 83 deletions(-)

diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c
index 86b639d82be8..8d11510e441e 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c
@@ -450,7 +450,6 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
 		destroy_workqueue(dev->core_workqueue);
 err_res:
 	pm_runtime_disable(dev->pm.dev);
-	put_device(dev->pm.larbvdec);
 err_dec_pm:
 	mtk_vcodec_fw_release(dev->fw_handler);
 	return ret;
@@ -494,7 +493,6 @@ static int mtk_vcodec_dec_remove(struct platform_device *pdev)
 
 	v4l2_device_unregister(&dev->v4l2_dev);
 	pm_runtime_disable(dev->pm.dev);
-	put_device(dev->pm.larbvdec);
 	mtk_vcodec_fw_release(dev->fw_handler);
 	return 0;
 }
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_hw.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_hw.c
index 7b5da3e4cac2..8d2a641d92f1 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_hw.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_hw.c
@@ -184,7 +184,6 @@ static int mtk_vdec_hw_probe(struct platform_device *pdev)
 	return 0;
 err:
 	pm_runtime_disable(subdev_dev->pm.dev);
-	put_device(subdev_dev->pm.larbvdec);
 	return ret;
 }
 
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
index 44035a50e335..7e0c2644bf7b 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
@@ -9,7 +9,6 @@
 #include <linux/of_address.h>
 #include <linux/of_platform.h>
 #include <linux/pm_runtime.h>
-#include <soc/mediatek/smi.h>
 
 #include "mtk_vcodec_dec_hw.h"
 #include "mtk_vcodec_dec_pm.h"
@@ -17,25 +16,11 @@
 
 int mtk_vcodec_init_dec_clk(struct platform_device *pdev, struct mtk_vcodec_pm *pm)
 {
-	struct device_node *node;
-	struct platform_device *larb_pdev;
 	struct mtk_vcodec_clk *dec_clk;
 	struct mtk_vcodec_clk_info *clk_info;
-	int i = 0, ret = 0;
+	int i = 0, ret;
 
 	dec_clk = &pm->vdec_clk;
-	node = of_parse_phandle(pdev->dev.of_node, "mediatek,larb", 0);
-	if (!node) {
-		mtk_v4l2_err("of_parse_phandle mediatek,larb fail!");
-		return -1;
-	}
-
-	larb_pdev = of_find_device_by_node(node);
-	of_node_put(node);
-	if (WARN_ON(!larb_pdev))
-		return -1;
-
-	pm->larbvdec = &larb_pdev->dev;
 	pm->dev = &pdev->dev;
 
 	dec_clk->clk_num =
@@ -44,14 +29,11 @@ int mtk_vcodec_init_dec_clk(struct platform_device *pdev, struct mtk_vcodec_pm *
 		dec_clk->clk_info = devm_kcalloc(&pdev->dev,
 			dec_clk->clk_num, sizeof(*clk_info),
 			GFP_KERNEL);
-		if (!dec_clk->clk_info) {
-			ret = -ENOMEM;
-			goto put_device;
-		}
+		if (!dec_clk->clk_info)
+			return -ENOMEM;
 	} else {
 		mtk_v4l2_err("Failed to get vdec clock count");
-		ret = -EINVAL;
-		goto put_device;
+		return -EINVAL;
 	}
 
 	for (i = 0; i < dec_clk->clk_num; i++) {
@@ -60,22 +42,18 @@ int mtk_vcodec_init_dec_clk(struct platform_device *pdev, struct mtk_vcodec_pm *
 			"clock-names", i, &clk_info->clk_name);
 		if (ret) {
 			mtk_v4l2_err("Failed to get clock name id = %d", i);
-			goto put_device;
+			return ret;
 		}
 		clk_info->vcodec_clk = devm_clk_get(&pdev->dev,
 			clk_info->clk_name);
 		if (IS_ERR(clk_info->vcodec_clk)) {
 			mtk_v4l2_err("devm_clk_get (%d)%s fail", i,
 				clk_info->clk_name);
-			ret = PTR_ERR(clk_info->vcodec_clk);
-			goto put_device;
+			return PTR_ERR(clk_info->vcodec_clk);
 		}
 	}
 
 	return 0;
-put_device:
-	put_device(pm->larbvdec);
-	return ret;
 }
 EXPORT_SYMBOL_GPL(mtk_vcodec_init_dec_clk);
 
@@ -157,13 +135,7 @@ void mtk_vcodec_dec_clock_on(struct mtk_vcodec_dev *vdec_dev, int hw_idx)
 		}
 	}
 
-	ret = mtk_smi_larb_get(pm->larbvdec);
-	if (ret) {
-		mtk_v4l2_err("mtk_smi_larb_get larbvdec fail %d", ret);
-		goto error;
-	}
 	return;
-
 error:
 	for (i -= 1; i >= 0; i--)
 		clk_disable_unprepare(dec_clk->clk_info[i].vcodec_clk);
@@ -191,7 +163,6 @@ void mtk_vcodec_dec_clock_off(struct mtk_vcodec_dev *vdec_dev, int hw_idx)
 	}
 
 	dec_clk = &pm->vdec_clk;
-	mtk_smi_larb_put(pm->larbvdec);
 	for (i = dec_clk->clk_num - 1; i >= 0; i--)
 		clk_disable_unprepare(dec_clk->clk_info[i].vcodec_clk);
 }
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
index 94b47b7c912b..813901c4be5e 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
@@ -214,10 +214,7 @@ struct mtk_vcodec_clk {
  */
 struct mtk_vcodec_pm {
 	struct mtk_vcodec_clk	vdec_clk;
-	struct device	*larbvdec;
-
 	struct mtk_vcodec_clk	venc_clk;
-	struct device	*larbvenc;
 	struct device	*dev;
 };
 
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
index 7457451ebff0..8998244ea671 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
@@ -8,7 +8,6 @@
 #include <media/v4l2-event.h>
 #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"
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
index fc40a02af942..dbb0134e8cc0 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
@@ -371,7 +371,6 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
 	v4l2_device_unregister(&dev->v4l2_dev);
 err_res:
 	pm_runtime_disable(dev->pm.dev);
-	put_device(dev->pm.larbvenc);
 err_enc_pm:
 	mtk_vcodec_fw_release(dev->fw_handler);
 	return ret;
@@ -461,7 +460,6 @@ static int mtk_vcodec_enc_remove(struct platform_device *pdev)
 
 	v4l2_device_unregister(&dev->v4l2_dev);
 	pm_runtime_disable(dev->pm.dev);
-	put_device(dev->pm.larbvenc);
 	mtk_vcodec_fw_release(dev->fw_handler);
 	return 0;
 }
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c
index 0825c6ec4eb7..7055954eb2af 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c
@@ -8,57 +8,35 @@
 #include <linux/of_address.h>
 #include <linux/of_platform.h>
 #include <linux/pm_runtime.h>
-#include <soc/mediatek/smi.h>
 
 #include "mtk_vcodec_enc_pm.h"
 #include "mtk_vcodec_util.h"
 
 int mtk_vcodec_init_enc_clk(struct mtk_vcodec_dev *mtkdev)
 {
-	struct device_node *node;
 	struct platform_device *pdev;
 	struct mtk_vcodec_pm *pm;
 	struct mtk_vcodec_clk *enc_clk;
 	struct mtk_vcodec_clk_info *clk_info;
-	int ret = 0, i = 0;
-	struct device *dev;
+	int ret, i;
 
 	pdev = mtkdev->plat_dev;
 	pm = &mtkdev->pm;
 	memset(pm, 0, sizeof(struct mtk_vcodec_pm));
 	pm->dev = &pdev->dev;
-	dev = &pdev->dev;
 	enc_clk = &pm->venc_clk;
 
-	node = of_parse_phandle(dev->of_node, "mediatek,larb", 0);
-	if (!node) {
-		mtk_v4l2_err("no mediatek,larb found");
-		return -ENODEV;
-	}
-	pdev = of_find_device_by_node(node);
-	of_node_put(node);
-	if (!pdev) {
-		mtk_v4l2_err("no mediatek,larb device found");
-		return -ENODEV;
-	}
-	pm->larbvenc = &pdev->dev;
-	pdev = mtkdev->plat_dev;
-	pm->dev = &pdev->dev;
-
 	enc_clk->clk_num = of_property_count_strings(pdev->dev.of_node,
 		"clock-names");
 	if (enc_clk->clk_num > 0) {
 		enc_clk->clk_info = devm_kcalloc(&pdev->dev,
 			enc_clk->clk_num, sizeof(*clk_info),
 			GFP_KERNEL);
-		if (!enc_clk->clk_info) {
-			ret = -ENOMEM;
-			goto put_larbvenc;
-		}
+		if (!enc_clk->clk_info)
+			return -ENOMEM;
 	} else {
 		mtk_v4l2_err("Failed to get venc clock count");
-		ret = -EINVAL;
-		goto put_larbvenc;
+		return -EINVAL;
 	}
 
 	for (i = 0; i < enc_clk->clk_num; i++) {
@@ -67,23 +45,18 @@ int mtk_vcodec_init_enc_clk(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_larbvenc;
+			return ret;
 		}
 		clk_info->vcodec_clk = devm_clk_get(&pdev->dev,
 			clk_info->clk_name);
 		if (IS_ERR(clk_info->vcodec_clk)) {
 			mtk_v4l2_err("venc devm_clk_get (%d)%s fail", i,
 				clk_info->clk_name);
-			ret = PTR_ERR(clk_info->vcodec_clk);
-			goto put_larbvenc;
+			return PTR_ERR(clk_info->vcodec_clk);
 		}
 	}
 
 	return 0;
-
-put_larbvenc:
-	put_device(pm->larbvenc);
-	return ret;
 }
 
 void mtk_vcodec_enc_clock_on(struct mtk_vcodec_pm *pm)
@@ -100,11 +73,6 @@ 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 clkerr;
-	}
 	return;
 
 clkerr:
@@ -117,7 +85,6 @@ void mtk_vcodec_enc_clock_off(struct mtk_vcodec_pm *pm)
 	struct mtk_vcodec_clk *enc_clk = &pm->venc_clk;
 	int i = 0;
 
-	mtk_smi_larb_put(pm->larbvenc);
 	for (i = enc_clk->clk_num - 1; i >= 0; i--)
 		clk_disable_unprepare(enc_clk->clk_info[i].vcodec_clk);
 }
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 10/13] media: mtk-vcodec: Get rid of mtk_smi_larb_get/put
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang, anthony.huang,
	youlin.pei, Irui Wang, Evan Green, Eizan Miyamoto,
	Matthias Kaehlcke, linux-arm-kernel, mingyuan.ma, linux-media,
	devicetree, Philipp Zabel, Frank Wunderlich, libo.kang, yi.kuo,
	linux-mediatek, Hsin-Yi Wang, Tiffany Lin,
	AngeloGioacchino Del Regno, anan.sun, srv_heupstream, acourbot,
	linux-kernel, iommu, Daniel Vetter, Robin Murphy

MediaTek IOMMU has already added the device_link between the consumer
and smi-larb device. If the vcodec devices call the pm_runtime_get_sync,
the smi-larb's pm_runtime_get_sync also be called automatically.

CC: Tiffany Lin <tiffany.lin@mediatek.com>
CC: Irui Wang <irui.wang@mediatek.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Evan Green <evgreen@chromium.org>
Acked-by: Tiffany Lin <tiffany.lin@mediatek.com>
Reviewed-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
---
 .../platform/mtk-vcodec/mtk_vcodec_dec_drv.c  |  2 -
 .../platform/mtk-vcodec/mtk_vcodec_dec_hw.c   |  1 -
 .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c   | 41 +++--------------
 .../platform/mtk-vcodec/mtk_vcodec_drv.h      |  3 --
 .../platform/mtk-vcodec/mtk_vcodec_enc.c      |  1 -
 .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c  |  2 -
 .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c   | 45 +++----------------
 7 files changed, 12 insertions(+), 83 deletions(-)

diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c
index 86b639d82be8..8d11510e441e 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c
@@ -450,7 +450,6 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
 		destroy_workqueue(dev->core_workqueue);
 err_res:
 	pm_runtime_disable(dev->pm.dev);
-	put_device(dev->pm.larbvdec);
 err_dec_pm:
 	mtk_vcodec_fw_release(dev->fw_handler);
 	return ret;
@@ -494,7 +493,6 @@ static int mtk_vcodec_dec_remove(struct platform_device *pdev)
 
 	v4l2_device_unregister(&dev->v4l2_dev);
 	pm_runtime_disable(dev->pm.dev);
-	put_device(dev->pm.larbvdec);
 	mtk_vcodec_fw_release(dev->fw_handler);
 	return 0;
 }
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_hw.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_hw.c
index 7b5da3e4cac2..8d2a641d92f1 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_hw.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_hw.c
@@ -184,7 +184,6 @@ static int mtk_vdec_hw_probe(struct platform_device *pdev)
 	return 0;
 err:
 	pm_runtime_disable(subdev_dev->pm.dev);
-	put_device(subdev_dev->pm.larbvdec);
 	return ret;
 }
 
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
index 44035a50e335..7e0c2644bf7b 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
@@ -9,7 +9,6 @@
 #include <linux/of_address.h>
 #include <linux/of_platform.h>
 #include <linux/pm_runtime.h>
-#include <soc/mediatek/smi.h>
 
 #include "mtk_vcodec_dec_hw.h"
 #include "mtk_vcodec_dec_pm.h"
@@ -17,25 +16,11 @@
 
 int mtk_vcodec_init_dec_clk(struct platform_device *pdev, struct mtk_vcodec_pm *pm)
 {
-	struct device_node *node;
-	struct platform_device *larb_pdev;
 	struct mtk_vcodec_clk *dec_clk;
 	struct mtk_vcodec_clk_info *clk_info;
-	int i = 0, ret = 0;
+	int i = 0, ret;
 
 	dec_clk = &pm->vdec_clk;
-	node = of_parse_phandle(pdev->dev.of_node, "mediatek,larb", 0);
-	if (!node) {
-		mtk_v4l2_err("of_parse_phandle mediatek,larb fail!");
-		return -1;
-	}
-
-	larb_pdev = of_find_device_by_node(node);
-	of_node_put(node);
-	if (WARN_ON(!larb_pdev))
-		return -1;
-
-	pm->larbvdec = &larb_pdev->dev;
 	pm->dev = &pdev->dev;
 
 	dec_clk->clk_num =
@@ -44,14 +29,11 @@ int mtk_vcodec_init_dec_clk(struct platform_device *pdev, struct mtk_vcodec_pm *
 		dec_clk->clk_info = devm_kcalloc(&pdev->dev,
 			dec_clk->clk_num, sizeof(*clk_info),
 			GFP_KERNEL);
-		if (!dec_clk->clk_info) {
-			ret = -ENOMEM;
-			goto put_device;
-		}
+		if (!dec_clk->clk_info)
+			return -ENOMEM;
 	} else {
 		mtk_v4l2_err("Failed to get vdec clock count");
-		ret = -EINVAL;
-		goto put_device;
+		return -EINVAL;
 	}
 
 	for (i = 0; i < dec_clk->clk_num; i++) {
@@ -60,22 +42,18 @@ int mtk_vcodec_init_dec_clk(struct platform_device *pdev, struct mtk_vcodec_pm *
 			"clock-names", i, &clk_info->clk_name);
 		if (ret) {
 			mtk_v4l2_err("Failed to get clock name id = %d", i);
-			goto put_device;
+			return ret;
 		}
 		clk_info->vcodec_clk = devm_clk_get(&pdev->dev,
 			clk_info->clk_name);
 		if (IS_ERR(clk_info->vcodec_clk)) {
 			mtk_v4l2_err("devm_clk_get (%d)%s fail", i,
 				clk_info->clk_name);
-			ret = PTR_ERR(clk_info->vcodec_clk);
-			goto put_device;
+			return PTR_ERR(clk_info->vcodec_clk);
 		}
 	}
 
 	return 0;
-put_device:
-	put_device(pm->larbvdec);
-	return ret;
 }
 EXPORT_SYMBOL_GPL(mtk_vcodec_init_dec_clk);
 
@@ -157,13 +135,7 @@ void mtk_vcodec_dec_clock_on(struct mtk_vcodec_dev *vdec_dev, int hw_idx)
 		}
 	}
 
-	ret = mtk_smi_larb_get(pm->larbvdec);
-	if (ret) {
-		mtk_v4l2_err("mtk_smi_larb_get larbvdec fail %d", ret);
-		goto error;
-	}
 	return;
-
 error:
 	for (i -= 1; i >= 0; i--)
 		clk_disable_unprepare(dec_clk->clk_info[i].vcodec_clk);
@@ -191,7 +163,6 @@ void mtk_vcodec_dec_clock_off(struct mtk_vcodec_dev *vdec_dev, int hw_idx)
 	}
 
 	dec_clk = &pm->vdec_clk;
-	mtk_smi_larb_put(pm->larbvdec);
 	for (i = dec_clk->clk_num - 1; i >= 0; i--)
 		clk_disable_unprepare(dec_clk->clk_info[i].vcodec_clk);
 }
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
index 94b47b7c912b..813901c4be5e 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
@@ -214,10 +214,7 @@ struct mtk_vcodec_clk {
  */
 struct mtk_vcodec_pm {
 	struct mtk_vcodec_clk	vdec_clk;
-	struct device	*larbvdec;
-
 	struct mtk_vcodec_clk	venc_clk;
-	struct device	*larbvenc;
 	struct device	*dev;
 };
 
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
index 7457451ebff0..8998244ea671 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
@@ -8,7 +8,6 @@
 #include <media/v4l2-event.h>
 #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"
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
index fc40a02af942..dbb0134e8cc0 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
@@ -371,7 +371,6 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
 	v4l2_device_unregister(&dev->v4l2_dev);
 err_res:
 	pm_runtime_disable(dev->pm.dev);
-	put_device(dev->pm.larbvenc);
 err_enc_pm:
 	mtk_vcodec_fw_release(dev->fw_handler);
 	return ret;
@@ -461,7 +460,6 @@ static int mtk_vcodec_enc_remove(struct platform_device *pdev)
 
 	v4l2_device_unregister(&dev->v4l2_dev);
 	pm_runtime_disable(dev->pm.dev);
-	put_device(dev->pm.larbvenc);
 	mtk_vcodec_fw_release(dev->fw_handler);
 	return 0;
 }
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c
index 0825c6ec4eb7..7055954eb2af 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c
@@ -8,57 +8,35 @@
 #include <linux/of_address.h>
 #include <linux/of_platform.h>
 #include <linux/pm_runtime.h>
-#include <soc/mediatek/smi.h>
 
 #include "mtk_vcodec_enc_pm.h"
 #include "mtk_vcodec_util.h"
 
 int mtk_vcodec_init_enc_clk(struct mtk_vcodec_dev *mtkdev)
 {
-	struct device_node *node;
 	struct platform_device *pdev;
 	struct mtk_vcodec_pm *pm;
 	struct mtk_vcodec_clk *enc_clk;
 	struct mtk_vcodec_clk_info *clk_info;
-	int ret = 0, i = 0;
-	struct device *dev;
+	int ret, i;
 
 	pdev = mtkdev->plat_dev;
 	pm = &mtkdev->pm;
 	memset(pm, 0, sizeof(struct mtk_vcodec_pm));
 	pm->dev = &pdev->dev;
-	dev = &pdev->dev;
 	enc_clk = &pm->venc_clk;
 
-	node = of_parse_phandle(dev->of_node, "mediatek,larb", 0);
-	if (!node) {
-		mtk_v4l2_err("no mediatek,larb found");
-		return -ENODEV;
-	}
-	pdev = of_find_device_by_node(node);
-	of_node_put(node);
-	if (!pdev) {
-		mtk_v4l2_err("no mediatek,larb device found");
-		return -ENODEV;
-	}
-	pm->larbvenc = &pdev->dev;
-	pdev = mtkdev->plat_dev;
-	pm->dev = &pdev->dev;
-
 	enc_clk->clk_num = of_property_count_strings(pdev->dev.of_node,
 		"clock-names");
 	if (enc_clk->clk_num > 0) {
 		enc_clk->clk_info = devm_kcalloc(&pdev->dev,
 			enc_clk->clk_num, sizeof(*clk_info),
 			GFP_KERNEL);
-		if (!enc_clk->clk_info) {
-			ret = -ENOMEM;
-			goto put_larbvenc;
-		}
+		if (!enc_clk->clk_info)
+			return -ENOMEM;
 	} else {
 		mtk_v4l2_err("Failed to get venc clock count");
-		ret = -EINVAL;
-		goto put_larbvenc;
+		return -EINVAL;
 	}
 
 	for (i = 0; i < enc_clk->clk_num; i++) {
@@ -67,23 +45,18 @@ int mtk_vcodec_init_enc_clk(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_larbvenc;
+			return ret;
 		}
 		clk_info->vcodec_clk = devm_clk_get(&pdev->dev,
 			clk_info->clk_name);
 		if (IS_ERR(clk_info->vcodec_clk)) {
 			mtk_v4l2_err("venc devm_clk_get (%d)%s fail", i,
 				clk_info->clk_name);
-			ret = PTR_ERR(clk_info->vcodec_clk);
-			goto put_larbvenc;
+			return PTR_ERR(clk_info->vcodec_clk);
 		}
 	}
 
 	return 0;
-
-put_larbvenc:
-	put_device(pm->larbvenc);
-	return ret;
 }
 
 void mtk_vcodec_enc_clock_on(struct mtk_vcodec_pm *pm)
@@ -100,11 +73,6 @@ 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 clkerr;
-	}
 	return;
 
 clkerr:
@@ -117,7 +85,6 @@ void mtk_vcodec_enc_clock_off(struct mtk_vcodec_pm *pm)
 	struct mtk_vcodec_clk *enc_clk = &pm->venc_clk;
 	int i = 0;
 
-	mtk_smi_larb_put(pm->larbvenc);
 	for (i = enc_clk->clk_num - 1; i >= 0; i--)
 		clk_disable_unprepare(enc_clk->clk_info[i].vcodec_clk);
 }
-- 
2.18.0

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 10/13] media: mtk-vcodec: Get rid of mtk_smi_larb_get/put
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Dafna Hirschfeld, Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang,
	anthony.huang, youlin.pei, Irui Wang, Evan Green, Eizan Miyamoto,
	Matthias Kaehlcke, linux-arm-kernel, mingyuan.ma, linux-media,
	devicetree, Frank Wunderlich, libo.kang, yi.kuo, linux-mediatek,
	Hsin-Yi Wang, Tiffany Lin, yong.wu, AngeloGioacchino Del Regno,
	anan.sun, srv_heupstream, acourbot, linux-kernel, Tomasz Figa,
	iommu, Robin Murphy

MediaTek IOMMU has already added the device_link between the consumer
and smi-larb device. If the vcodec devices call the pm_runtime_get_sync,
the smi-larb's pm_runtime_get_sync also be called automatically.

CC: Tiffany Lin <tiffany.lin@mediatek.com>
CC: Irui Wang <irui.wang@mediatek.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Evan Green <evgreen@chromium.org>
Acked-by: Tiffany Lin <tiffany.lin@mediatek.com>
Reviewed-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
---
 .../platform/mtk-vcodec/mtk_vcodec_dec_drv.c  |  2 -
 .../platform/mtk-vcodec/mtk_vcodec_dec_hw.c   |  1 -
 .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c   | 41 +++--------------
 .../platform/mtk-vcodec/mtk_vcodec_drv.h      |  3 --
 .../platform/mtk-vcodec/mtk_vcodec_enc.c      |  1 -
 .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c  |  2 -
 .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c   | 45 +++----------------
 7 files changed, 12 insertions(+), 83 deletions(-)

diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c
index 86b639d82be8..8d11510e441e 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c
@@ -450,7 +450,6 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
 		destroy_workqueue(dev->core_workqueue);
 err_res:
 	pm_runtime_disable(dev->pm.dev);
-	put_device(dev->pm.larbvdec);
 err_dec_pm:
 	mtk_vcodec_fw_release(dev->fw_handler);
 	return ret;
@@ -494,7 +493,6 @@ static int mtk_vcodec_dec_remove(struct platform_device *pdev)
 
 	v4l2_device_unregister(&dev->v4l2_dev);
 	pm_runtime_disable(dev->pm.dev);
-	put_device(dev->pm.larbvdec);
 	mtk_vcodec_fw_release(dev->fw_handler);
 	return 0;
 }
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_hw.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_hw.c
index 7b5da3e4cac2..8d2a641d92f1 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_hw.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_hw.c
@@ -184,7 +184,6 @@ static int mtk_vdec_hw_probe(struct platform_device *pdev)
 	return 0;
 err:
 	pm_runtime_disable(subdev_dev->pm.dev);
-	put_device(subdev_dev->pm.larbvdec);
 	return ret;
 }
 
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
index 44035a50e335..7e0c2644bf7b 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
@@ -9,7 +9,6 @@
 #include <linux/of_address.h>
 #include <linux/of_platform.h>
 #include <linux/pm_runtime.h>
-#include <soc/mediatek/smi.h>
 
 #include "mtk_vcodec_dec_hw.h"
 #include "mtk_vcodec_dec_pm.h"
@@ -17,25 +16,11 @@
 
 int mtk_vcodec_init_dec_clk(struct platform_device *pdev, struct mtk_vcodec_pm *pm)
 {
-	struct device_node *node;
-	struct platform_device *larb_pdev;
 	struct mtk_vcodec_clk *dec_clk;
 	struct mtk_vcodec_clk_info *clk_info;
-	int i = 0, ret = 0;
+	int i = 0, ret;
 
 	dec_clk = &pm->vdec_clk;
-	node = of_parse_phandle(pdev->dev.of_node, "mediatek,larb", 0);
-	if (!node) {
-		mtk_v4l2_err("of_parse_phandle mediatek,larb fail!");
-		return -1;
-	}
-
-	larb_pdev = of_find_device_by_node(node);
-	of_node_put(node);
-	if (WARN_ON(!larb_pdev))
-		return -1;
-
-	pm->larbvdec = &larb_pdev->dev;
 	pm->dev = &pdev->dev;
 
 	dec_clk->clk_num =
@@ -44,14 +29,11 @@ int mtk_vcodec_init_dec_clk(struct platform_device *pdev, struct mtk_vcodec_pm *
 		dec_clk->clk_info = devm_kcalloc(&pdev->dev,
 			dec_clk->clk_num, sizeof(*clk_info),
 			GFP_KERNEL);
-		if (!dec_clk->clk_info) {
-			ret = -ENOMEM;
-			goto put_device;
-		}
+		if (!dec_clk->clk_info)
+			return -ENOMEM;
 	} else {
 		mtk_v4l2_err("Failed to get vdec clock count");
-		ret = -EINVAL;
-		goto put_device;
+		return -EINVAL;
 	}
 
 	for (i = 0; i < dec_clk->clk_num; i++) {
@@ -60,22 +42,18 @@ int mtk_vcodec_init_dec_clk(struct platform_device *pdev, struct mtk_vcodec_pm *
 			"clock-names", i, &clk_info->clk_name);
 		if (ret) {
 			mtk_v4l2_err("Failed to get clock name id = %d", i);
-			goto put_device;
+			return ret;
 		}
 		clk_info->vcodec_clk = devm_clk_get(&pdev->dev,
 			clk_info->clk_name);
 		if (IS_ERR(clk_info->vcodec_clk)) {
 			mtk_v4l2_err("devm_clk_get (%d)%s fail", i,
 				clk_info->clk_name);
-			ret = PTR_ERR(clk_info->vcodec_clk);
-			goto put_device;
+			return PTR_ERR(clk_info->vcodec_clk);
 		}
 	}
 
 	return 0;
-put_device:
-	put_device(pm->larbvdec);
-	return ret;
 }
 EXPORT_SYMBOL_GPL(mtk_vcodec_init_dec_clk);
 
@@ -157,13 +135,7 @@ void mtk_vcodec_dec_clock_on(struct mtk_vcodec_dev *vdec_dev, int hw_idx)
 		}
 	}
 
-	ret = mtk_smi_larb_get(pm->larbvdec);
-	if (ret) {
-		mtk_v4l2_err("mtk_smi_larb_get larbvdec fail %d", ret);
-		goto error;
-	}
 	return;
-
 error:
 	for (i -= 1; i >= 0; i--)
 		clk_disable_unprepare(dec_clk->clk_info[i].vcodec_clk);
@@ -191,7 +163,6 @@ void mtk_vcodec_dec_clock_off(struct mtk_vcodec_dev *vdec_dev, int hw_idx)
 	}
 
 	dec_clk = &pm->vdec_clk;
-	mtk_smi_larb_put(pm->larbvdec);
 	for (i = dec_clk->clk_num - 1; i >= 0; i--)
 		clk_disable_unprepare(dec_clk->clk_info[i].vcodec_clk);
 }
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
index 94b47b7c912b..813901c4be5e 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
@@ -214,10 +214,7 @@ struct mtk_vcodec_clk {
  */
 struct mtk_vcodec_pm {
 	struct mtk_vcodec_clk	vdec_clk;
-	struct device	*larbvdec;
-
 	struct mtk_vcodec_clk	venc_clk;
-	struct device	*larbvenc;
 	struct device	*dev;
 };
 
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
index 7457451ebff0..8998244ea671 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
@@ -8,7 +8,6 @@
 #include <media/v4l2-event.h>
 #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"
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
index fc40a02af942..dbb0134e8cc0 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
@@ -371,7 +371,6 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
 	v4l2_device_unregister(&dev->v4l2_dev);
 err_res:
 	pm_runtime_disable(dev->pm.dev);
-	put_device(dev->pm.larbvenc);
 err_enc_pm:
 	mtk_vcodec_fw_release(dev->fw_handler);
 	return ret;
@@ -461,7 +460,6 @@ static int mtk_vcodec_enc_remove(struct platform_device *pdev)
 
 	v4l2_device_unregister(&dev->v4l2_dev);
 	pm_runtime_disable(dev->pm.dev);
-	put_device(dev->pm.larbvenc);
 	mtk_vcodec_fw_release(dev->fw_handler);
 	return 0;
 }
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c
index 0825c6ec4eb7..7055954eb2af 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c
@@ -8,57 +8,35 @@
 #include <linux/of_address.h>
 #include <linux/of_platform.h>
 #include <linux/pm_runtime.h>
-#include <soc/mediatek/smi.h>
 
 #include "mtk_vcodec_enc_pm.h"
 #include "mtk_vcodec_util.h"
 
 int mtk_vcodec_init_enc_clk(struct mtk_vcodec_dev *mtkdev)
 {
-	struct device_node *node;
 	struct platform_device *pdev;
 	struct mtk_vcodec_pm *pm;
 	struct mtk_vcodec_clk *enc_clk;
 	struct mtk_vcodec_clk_info *clk_info;
-	int ret = 0, i = 0;
-	struct device *dev;
+	int ret, i;
 
 	pdev = mtkdev->plat_dev;
 	pm = &mtkdev->pm;
 	memset(pm, 0, sizeof(struct mtk_vcodec_pm));
 	pm->dev = &pdev->dev;
-	dev = &pdev->dev;
 	enc_clk = &pm->venc_clk;
 
-	node = of_parse_phandle(dev->of_node, "mediatek,larb", 0);
-	if (!node) {
-		mtk_v4l2_err("no mediatek,larb found");
-		return -ENODEV;
-	}
-	pdev = of_find_device_by_node(node);
-	of_node_put(node);
-	if (!pdev) {
-		mtk_v4l2_err("no mediatek,larb device found");
-		return -ENODEV;
-	}
-	pm->larbvenc = &pdev->dev;
-	pdev = mtkdev->plat_dev;
-	pm->dev = &pdev->dev;
-
 	enc_clk->clk_num = of_property_count_strings(pdev->dev.of_node,
 		"clock-names");
 	if (enc_clk->clk_num > 0) {
 		enc_clk->clk_info = devm_kcalloc(&pdev->dev,
 			enc_clk->clk_num, sizeof(*clk_info),
 			GFP_KERNEL);
-		if (!enc_clk->clk_info) {
-			ret = -ENOMEM;
-			goto put_larbvenc;
-		}
+		if (!enc_clk->clk_info)
+			return -ENOMEM;
 	} else {
 		mtk_v4l2_err("Failed to get venc clock count");
-		ret = -EINVAL;
-		goto put_larbvenc;
+		return -EINVAL;
 	}
 
 	for (i = 0; i < enc_clk->clk_num; i++) {
@@ -67,23 +45,18 @@ int mtk_vcodec_init_enc_clk(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_larbvenc;
+			return ret;
 		}
 		clk_info->vcodec_clk = devm_clk_get(&pdev->dev,
 			clk_info->clk_name);
 		if (IS_ERR(clk_info->vcodec_clk)) {
 			mtk_v4l2_err("venc devm_clk_get (%d)%s fail", i,
 				clk_info->clk_name);
-			ret = PTR_ERR(clk_info->vcodec_clk);
-			goto put_larbvenc;
+			return PTR_ERR(clk_info->vcodec_clk);
 		}
 	}
 
 	return 0;
-
-put_larbvenc:
-	put_device(pm->larbvenc);
-	return ret;
 }
 
 void mtk_vcodec_enc_clock_on(struct mtk_vcodec_pm *pm)
@@ -100,11 +73,6 @@ 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 clkerr;
-	}
 	return;
 
 clkerr:
@@ -117,7 +85,6 @@ void mtk_vcodec_enc_clock_off(struct mtk_vcodec_pm *pm)
 	struct mtk_vcodec_clk *enc_clk = &pm->venc_clk;
 	int i = 0;
 
-	mtk_smi_larb_put(pm->larbvenc);
 	for (i = enc_clk->clk_num - 1; i >= 0; i--)
 		clk_disable_unprepare(enc_clk->clk_info[i].vcodec_clk);
 }
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 10/13] media: mtk-vcodec: Get rid of mtk_smi_larb_get/put
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Dafna Hirschfeld, Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang,
	anthony.huang, youlin.pei, Irui Wang, Evan Green, Eizan Miyamoto,
	Matthias Kaehlcke, linux-arm-kernel, mingyuan.ma, linux-media,
	devicetree, Philipp Zabel, libo.kang, yi.kuo, linux-mediatek,
	Hsin-Yi Wang, Tiffany Lin, yong.wu, AngeloGioacchino Del Regno,
	anan.sun, srv_heupstream, acourbot, linux-kernel, Tomasz Figa,
	iommu, Daniel Vetter, Robin Murphy

MediaTek IOMMU has already added the device_link between the consumer
and smi-larb device. If the vcodec devices call the pm_runtime_get_sync,
the smi-larb's pm_runtime_get_sync also be called automatically.

CC: Tiffany Lin <tiffany.lin@mediatek.com>
CC: Irui Wang <irui.wang@mediatek.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Evan Green <evgreen@chromium.org>
Acked-by: Tiffany Lin <tiffany.lin@mediatek.com>
Reviewed-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
---
 .../platform/mtk-vcodec/mtk_vcodec_dec_drv.c  |  2 -
 .../platform/mtk-vcodec/mtk_vcodec_dec_hw.c   |  1 -
 .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c   | 41 +++--------------
 .../platform/mtk-vcodec/mtk_vcodec_drv.h      |  3 --
 .../platform/mtk-vcodec/mtk_vcodec_enc.c      |  1 -
 .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c  |  2 -
 .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c   | 45 +++----------------
 7 files changed, 12 insertions(+), 83 deletions(-)

diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c
index 86b639d82be8..8d11510e441e 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c
@@ -450,7 +450,6 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
 		destroy_workqueue(dev->core_workqueue);
 err_res:
 	pm_runtime_disable(dev->pm.dev);
-	put_device(dev->pm.larbvdec);
 err_dec_pm:
 	mtk_vcodec_fw_release(dev->fw_handler);
 	return ret;
@@ -494,7 +493,6 @@ static int mtk_vcodec_dec_remove(struct platform_device *pdev)
 
 	v4l2_device_unregister(&dev->v4l2_dev);
 	pm_runtime_disable(dev->pm.dev);
-	put_device(dev->pm.larbvdec);
 	mtk_vcodec_fw_release(dev->fw_handler);
 	return 0;
 }
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_hw.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_hw.c
index 7b5da3e4cac2..8d2a641d92f1 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_hw.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_hw.c
@@ -184,7 +184,6 @@ static int mtk_vdec_hw_probe(struct platform_device *pdev)
 	return 0;
 err:
 	pm_runtime_disable(subdev_dev->pm.dev);
-	put_device(subdev_dev->pm.larbvdec);
 	return ret;
 }
 
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
index 44035a50e335..7e0c2644bf7b 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
@@ -9,7 +9,6 @@
 #include <linux/of_address.h>
 #include <linux/of_platform.h>
 #include <linux/pm_runtime.h>
-#include <soc/mediatek/smi.h>
 
 #include "mtk_vcodec_dec_hw.h"
 #include "mtk_vcodec_dec_pm.h"
@@ -17,25 +16,11 @@
 
 int mtk_vcodec_init_dec_clk(struct platform_device *pdev, struct mtk_vcodec_pm *pm)
 {
-	struct device_node *node;
-	struct platform_device *larb_pdev;
 	struct mtk_vcodec_clk *dec_clk;
 	struct mtk_vcodec_clk_info *clk_info;
-	int i = 0, ret = 0;
+	int i = 0, ret;
 
 	dec_clk = &pm->vdec_clk;
-	node = of_parse_phandle(pdev->dev.of_node, "mediatek,larb", 0);
-	if (!node) {
-		mtk_v4l2_err("of_parse_phandle mediatek,larb fail!");
-		return -1;
-	}
-
-	larb_pdev = of_find_device_by_node(node);
-	of_node_put(node);
-	if (WARN_ON(!larb_pdev))
-		return -1;
-
-	pm->larbvdec = &larb_pdev->dev;
 	pm->dev = &pdev->dev;
 
 	dec_clk->clk_num =
@@ -44,14 +29,11 @@ int mtk_vcodec_init_dec_clk(struct platform_device *pdev, struct mtk_vcodec_pm *
 		dec_clk->clk_info = devm_kcalloc(&pdev->dev,
 			dec_clk->clk_num, sizeof(*clk_info),
 			GFP_KERNEL);
-		if (!dec_clk->clk_info) {
-			ret = -ENOMEM;
-			goto put_device;
-		}
+		if (!dec_clk->clk_info)
+			return -ENOMEM;
 	} else {
 		mtk_v4l2_err("Failed to get vdec clock count");
-		ret = -EINVAL;
-		goto put_device;
+		return -EINVAL;
 	}
 
 	for (i = 0; i < dec_clk->clk_num; i++) {
@@ -60,22 +42,18 @@ int mtk_vcodec_init_dec_clk(struct platform_device *pdev, struct mtk_vcodec_pm *
 			"clock-names", i, &clk_info->clk_name);
 		if (ret) {
 			mtk_v4l2_err("Failed to get clock name id = %d", i);
-			goto put_device;
+			return ret;
 		}
 		clk_info->vcodec_clk = devm_clk_get(&pdev->dev,
 			clk_info->clk_name);
 		if (IS_ERR(clk_info->vcodec_clk)) {
 			mtk_v4l2_err("devm_clk_get (%d)%s fail", i,
 				clk_info->clk_name);
-			ret = PTR_ERR(clk_info->vcodec_clk);
-			goto put_device;
+			return PTR_ERR(clk_info->vcodec_clk);
 		}
 	}
 
 	return 0;
-put_device:
-	put_device(pm->larbvdec);
-	return ret;
 }
 EXPORT_SYMBOL_GPL(mtk_vcodec_init_dec_clk);
 
@@ -157,13 +135,7 @@ void mtk_vcodec_dec_clock_on(struct mtk_vcodec_dev *vdec_dev, int hw_idx)
 		}
 	}
 
-	ret = mtk_smi_larb_get(pm->larbvdec);
-	if (ret) {
-		mtk_v4l2_err("mtk_smi_larb_get larbvdec fail %d", ret);
-		goto error;
-	}
 	return;
-
 error:
 	for (i -= 1; i >= 0; i--)
 		clk_disable_unprepare(dec_clk->clk_info[i].vcodec_clk);
@@ -191,7 +163,6 @@ void mtk_vcodec_dec_clock_off(struct mtk_vcodec_dev *vdec_dev, int hw_idx)
 	}
 
 	dec_clk = &pm->vdec_clk;
-	mtk_smi_larb_put(pm->larbvdec);
 	for (i = dec_clk->clk_num - 1; i >= 0; i--)
 		clk_disable_unprepare(dec_clk->clk_info[i].vcodec_clk);
 }
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
index 94b47b7c912b..813901c4be5e 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
@@ -214,10 +214,7 @@ struct mtk_vcodec_clk {
  */
 struct mtk_vcodec_pm {
 	struct mtk_vcodec_clk	vdec_clk;
-	struct device	*larbvdec;
-
 	struct mtk_vcodec_clk	venc_clk;
-	struct device	*larbvenc;
 	struct device	*dev;
 };
 
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
index 7457451ebff0..8998244ea671 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
@@ -8,7 +8,6 @@
 #include <media/v4l2-event.h>
 #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"
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
index fc40a02af942..dbb0134e8cc0 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
@@ -371,7 +371,6 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
 	v4l2_device_unregister(&dev->v4l2_dev);
 err_res:
 	pm_runtime_disable(dev->pm.dev);
-	put_device(dev->pm.larbvenc);
 err_enc_pm:
 	mtk_vcodec_fw_release(dev->fw_handler);
 	return ret;
@@ -461,7 +460,6 @@ static int mtk_vcodec_enc_remove(struct platform_device *pdev)
 
 	v4l2_device_unregister(&dev->v4l2_dev);
 	pm_runtime_disable(dev->pm.dev);
-	put_device(dev->pm.larbvenc);
 	mtk_vcodec_fw_release(dev->fw_handler);
 	return 0;
 }
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c
index 0825c6ec4eb7..7055954eb2af 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c
@@ -8,57 +8,35 @@
 #include <linux/of_address.h>
 #include <linux/of_platform.h>
 #include <linux/pm_runtime.h>
-#include <soc/mediatek/smi.h>
 
 #include "mtk_vcodec_enc_pm.h"
 #include "mtk_vcodec_util.h"
 
 int mtk_vcodec_init_enc_clk(struct mtk_vcodec_dev *mtkdev)
 {
-	struct device_node *node;
 	struct platform_device *pdev;
 	struct mtk_vcodec_pm *pm;
 	struct mtk_vcodec_clk *enc_clk;
 	struct mtk_vcodec_clk_info *clk_info;
-	int ret = 0, i = 0;
-	struct device *dev;
+	int ret, i;
 
 	pdev = mtkdev->plat_dev;
 	pm = &mtkdev->pm;
 	memset(pm, 0, sizeof(struct mtk_vcodec_pm));
 	pm->dev = &pdev->dev;
-	dev = &pdev->dev;
 	enc_clk = &pm->venc_clk;
 
-	node = of_parse_phandle(dev->of_node, "mediatek,larb", 0);
-	if (!node) {
-		mtk_v4l2_err("no mediatek,larb found");
-		return -ENODEV;
-	}
-	pdev = of_find_device_by_node(node);
-	of_node_put(node);
-	if (!pdev) {
-		mtk_v4l2_err("no mediatek,larb device found");
-		return -ENODEV;
-	}
-	pm->larbvenc = &pdev->dev;
-	pdev = mtkdev->plat_dev;
-	pm->dev = &pdev->dev;
-
 	enc_clk->clk_num = of_property_count_strings(pdev->dev.of_node,
 		"clock-names");
 	if (enc_clk->clk_num > 0) {
 		enc_clk->clk_info = devm_kcalloc(&pdev->dev,
 			enc_clk->clk_num, sizeof(*clk_info),
 			GFP_KERNEL);
-		if (!enc_clk->clk_info) {
-			ret = -ENOMEM;
-			goto put_larbvenc;
-		}
+		if (!enc_clk->clk_info)
+			return -ENOMEM;
 	} else {
 		mtk_v4l2_err("Failed to get venc clock count");
-		ret = -EINVAL;
-		goto put_larbvenc;
+		return -EINVAL;
 	}
 
 	for (i = 0; i < enc_clk->clk_num; i++) {
@@ -67,23 +45,18 @@ int mtk_vcodec_init_enc_clk(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_larbvenc;
+			return ret;
 		}
 		clk_info->vcodec_clk = devm_clk_get(&pdev->dev,
 			clk_info->clk_name);
 		if (IS_ERR(clk_info->vcodec_clk)) {
 			mtk_v4l2_err("venc devm_clk_get (%d)%s fail", i,
 				clk_info->clk_name);
-			ret = PTR_ERR(clk_info->vcodec_clk);
-			goto put_larbvenc;
+			return PTR_ERR(clk_info->vcodec_clk);
 		}
 	}
 
 	return 0;
-
-put_larbvenc:
-	put_device(pm->larbvenc);
-	return ret;
 }
 
 void mtk_vcodec_enc_clock_on(struct mtk_vcodec_pm *pm)
@@ -100,11 +73,6 @@ 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 clkerr;
-	}
 	return;
 
 clkerr:
@@ -117,7 +85,6 @@ void mtk_vcodec_enc_clock_off(struct mtk_vcodec_pm *pm)
 	struct mtk_vcodec_clk *enc_clk = &pm->venc_clk;
 	int i = 0;
 
-	mtk_smi_larb_put(pm->larbvenc);
 	for (i = enc_clk->clk_num - 1; i >= 0; i--)
 		clk_disable_unprepare(enc_clk->clk_info[i].vcodec_clk);
 }
-- 
2.18.0


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 10/13] media: mtk-vcodec: Get rid of mtk_smi_larb_get/put
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Evan Green, Robin Murphy, Tomasz Figa, Will Deacon,
	linux-mediatek, srv_heupstream, devicetree, linux-kernel,
	linux-arm-kernel, iommu, yong.wu, youlin.pei, Matthias Kaehlcke,
	anan.sun, yi.kuo, acourbot, linux-media, dri-devel,
	Daniel Vetter, Chun-Kuang Hu, Philipp Zabel, Tiffany Lin,
	Dafna Hirschfeld, Hsin-Yi Wang, Eizan Miyamoto, anthony.huang,
	Frank Wunderlich, mingyuan.ma, yf.wang, libo.kang,
	AngeloGioacchino Del Regno, Irui Wang

MediaTek IOMMU has already added the device_link between the consumer
and smi-larb device. If the vcodec devices call the pm_runtime_get_sync,
the smi-larb's pm_runtime_get_sync also be called automatically.

CC: Tiffany Lin <tiffany.lin@mediatek.com>
CC: Irui Wang <irui.wang@mediatek.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Evan Green <evgreen@chromium.org>
Acked-by: Tiffany Lin <tiffany.lin@mediatek.com>
Reviewed-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
---
 .../platform/mtk-vcodec/mtk_vcodec_dec_drv.c  |  2 -
 .../platform/mtk-vcodec/mtk_vcodec_dec_hw.c   |  1 -
 .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c   | 41 +++--------------
 .../platform/mtk-vcodec/mtk_vcodec_drv.h      |  3 --
 .../platform/mtk-vcodec/mtk_vcodec_enc.c      |  1 -
 .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c  |  2 -
 .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c   | 45 +++----------------
 7 files changed, 12 insertions(+), 83 deletions(-)

diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c
index 86b639d82be8..8d11510e441e 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c
@@ -450,7 +450,6 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
 		destroy_workqueue(dev->core_workqueue);
 err_res:
 	pm_runtime_disable(dev->pm.dev);
-	put_device(dev->pm.larbvdec);
 err_dec_pm:
 	mtk_vcodec_fw_release(dev->fw_handler);
 	return ret;
@@ -494,7 +493,6 @@ static int mtk_vcodec_dec_remove(struct platform_device *pdev)
 
 	v4l2_device_unregister(&dev->v4l2_dev);
 	pm_runtime_disable(dev->pm.dev);
-	put_device(dev->pm.larbvdec);
 	mtk_vcodec_fw_release(dev->fw_handler);
 	return 0;
 }
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_hw.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_hw.c
index 7b5da3e4cac2..8d2a641d92f1 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_hw.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_hw.c
@@ -184,7 +184,6 @@ static int mtk_vdec_hw_probe(struct platform_device *pdev)
 	return 0;
 err:
 	pm_runtime_disable(subdev_dev->pm.dev);
-	put_device(subdev_dev->pm.larbvdec);
 	return ret;
 }
 
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
index 44035a50e335..7e0c2644bf7b 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
@@ -9,7 +9,6 @@
 #include <linux/of_address.h>
 #include <linux/of_platform.h>
 #include <linux/pm_runtime.h>
-#include <soc/mediatek/smi.h>
 
 #include "mtk_vcodec_dec_hw.h"
 #include "mtk_vcodec_dec_pm.h"
@@ -17,25 +16,11 @@
 
 int mtk_vcodec_init_dec_clk(struct platform_device *pdev, struct mtk_vcodec_pm *pm)
 {
-	struct device_node *node;
-	struct platform_device *larb_pdev;
 	struct mtk_vcodec_clk *dec_clk;
 	struct mtk_vcodec_clk_info *clk_info;
-	int i = 0, ret = 0;
+	int i = 0, ret;
 
 	dec_clk = &pm->vdec_clk;
-	node = of_parse_phandle(pdev->dev.of_node, "mediatek,larb", 0);
-	if (!node) {
-		mtk_v4l2_err("of_parse_phandle mediatek,larb fail!");
-		return -1;
-	}
-
-	larb_pdev = of_find_device_by_node(node);
-	of_node_put(node);
-	if (WARN_ON(!larb_pdev))
-		return -1;
-
-	pm->larbvdec = &larb_pdev->dev;
 	pm->dev = &pdev->dev;
 
 	dec_clk->clk_num =
@@ -44,14 +29,11 @@ int mtk_vcodec_init_dec_clk(struct platform_device *pdev, struct mtk_vcodec_pm *
 		dec_clk->clk_info = devm_kcalloc(&pdev->dev,
 			dec_clk->clk_num, sizeof(*clk_info),
 			GFP_KERNEL);
-		if (!dec_clk->clk_info) {
-			ret = -ENOMEM;
-			goto put_device;
-		}
+		if (!dec_clk->clk_info)
+			return -ENOMEM;
 	} else {
 		mtk_v4l2_err("Failed to get vdec clock count");
-		ret = -EINVAL;
-		goto put_device;
+		return -EINVAL;
 	}
 
 	for (i = 0; i < dec_clk->clk_num; i++) {
@@ -60,22 +42,18 @@ int mtk_vcodec_init_dec_clk(struct platform_device *pdev, struct mtk_vcodec_pm *
 			"clock-names", i, &clk_info->clk_name);
 		if (ret) {
 			mtk_v4l2_err("Failed to get clock name id = %d", i);
-			goto put_device;
+			return ret;
 		}
 		clk_info->vcodec_clk = devm_clk_get(&pdev->dev,
 			clk_info->clk_name);
 		if (IS_ERR(clk_info->vcodec_clk)) {
 			mtk_v4l2_err("devm_clk_get (%d)%s fail", i,
 				clk_info->clk_name);
-			ret = PTR_ERR(clk_info->vcodec_clk);
-			goto put_device;
+			return PTR_ERR(clk_info->vcodec_clk);
 		}
 	}
 
 	return 0;
-put_device:
-	put_device(pm->larbvdec);
-	return ret;
 }
 EXPORT_SYMBOL_GPL(mtk_vcodec_init_dec_clk);
 
@@ -157,13 +135,7 @@ void mtk_vcodec_dec_clock_on(struct mtk_vcodec_dev *vdec_dev, int hw_idx)
 		}
 	}
 
-	ret = mtk_smi_larb_get(pm->larbvdec);
-	if (ret) {
-		mtk_v4l2_err("mtk_smi_larb_get larbvdec fail %d", ret);
-		goto error;
-	}
 	return;
-
 error:
 	for (i -= 1; i >= 0; i--)
 		clk_disable_unprepare(dec_clk->clk_info[i].vcodec_clk);
@@ -191,7 +163,6 @@ void mtk_vcodec_dec_clock_off(struct mtk_vcodec_dev *vdec_dev, int hw_idx)
 	}
 
 	dec_clk = &pm->vdec_clk;
-	mtk_smi_larb_put(pm->larbvdec);
 	for (i = dec_clk->clk_num - 1; i >= 0; i--)
 		clk_disable_unprepare(dec_clk->clk_info[i].vcodec_clk);
 }
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
index 94b47b7c912b..813901c4be5e 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
@@ -214,10 +214,7 @@ struct mtk_vcodec_clk {
  */
 struct mtk_vcodec_pm {
 	struct mtk_vcodec_clk	vdec_clk;
-	struct device	*larbvdec;
-
 	struct mtk_vcodec_clk	venc_clk;
-	struct device	*larbvenc;
 	struct device	*dev;
 };
 
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
index 7457451ebff0..8998244ea671 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
@@ -8,7 +8,6 @@
 #include <media/v4l2-event.h>
 #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"
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
index fc40a02af942..dbb0134e8cc0 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
@@ -371,7 +371,6 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
 	v4l2_device_unregister(&dev->v4l2_dev);
 err_res:
 	pm_runtime_disable(dev->pm.dev);
-	put_device(dev->pm.larbvenc);
 err_enc_pm:
 	mtk_vcodec_fw_release(dev->fw_handler);
 	return ret;
@@ -461,7 +460,6 @@ static int mtk_vcodec_enc_remove(struct platform_device *pdev)
 
 	v4l2_device_unregister(&dev->v4l2_dev);
 	pm_runtime_disable(dev->pm.dev);
-	put_device(dev->pm.larbvenc);
 	mtk_vcodec_fw_release(dev->fw_handler);
 	return 0;
 }
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c
index 0825c6ec4eb7..7055954eb2af 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c
@@ -8,57 +8,35 @@
 #include <linux/of_address.h>
 #include <linux/of_platform.h>
 #include <linux/pm_runtime.h>
-#include <soc/mediatek/smi.h>
 
 #include "mtk_vcodec_enc_pm.h"
 #include "mtk_vcodec_util.h"
 
 int mtk_vcodec_init_enc_clk(struct mtk_vcodec_dev *mtkdev)
 {
-	struct device_node *node;
 	struct platform_device *pdev;
 	struct mtk_vcodec_pm *pm;
 	struct mtk_vcodec_clk *enc_clk;
 	struct mtk_vcodec_clk_info *clk_info;
-	int ret = 0, i = 0;
-	struct device *dev;
+	int ret, i;
 
 	pdev = mtkdev->plat_dev;
 	pm = &mtkdev->pm;
 	memset(pm, 0, sizeof(struct mtk_vcodec_pm));
 	pm->dev = &pdev->dev;
-	dev = &pdev->dev;
 	enc_clk = &pm->venc_clk;
 
-	node = of_parse_phandle(dev->of_node, "mediatek,larb", 0);
-	if (!node) {
-		mtk_v4l2_err("no mediatek,larb found");
-		return -ENODEV;
-	}
-	pdev = of_find_device_by_node(node);
-	of_node_put(node);
-	if (!pdev) {
-		mtk_v4l2_err("no mediatek,larb device found");
-		return -ENODEV;
-	}
-	pm->larbvenc = &pdev->dev;
-	pdev = mtkdev->plat_dev;
-	pm->dev = &pdev->dev;
-
 	enc_clk->clk_num = of_property_count_strings(pdev->dev.of_node,
 		"clock-names");
 	if (enc_clk->clk_num > 0) {
 		enc_clk->clk_info = devm_kcalloc(&pdev->dev,
 			enc_clk->clk_num, sizeof(*clk_info),
 			GFP_KERNEL);
-		if (!enc_clk->clk_info) {
-			ret = -ENOMEM;
-			goto put_larbvenc;
-		}
+		if (!enc_clk->clk_info)
+			return -ENOMEM;
 	} else {
 		mtk_v4l2_err("Failed to get venc clock count");
-		ret = -EINVAL;
-		goto put_larbvenc;
+		return -EINVAL;
 	}
 
 	for (i = 0; i < enc_clk->clk_num; i++) {
@@ -67,23 +45,18 @@ int mtk_vcodec_init_enc_clk(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_larbvenc;
+			return ret;
 		}
 		clk_info->vcodec_clk = devm_clk_get(&pdev->dev,
 			clk_info->clk_name);
 		if (IS_ERR(clk_info->vcodec_clk)) {
 			mtk_v4l2_err("venc devm_clk_get (%d)%s fail", i,
 				clk_info->clk_name);
-			ret = PTR_ERR(clk_info->vcodec_clk);
-			goto put_larbvenc;
+			return PTR_ERR(clk_info->vcodec_clk);
 		}
 	}
 
 	return 0;
-
-put_larbvenc:
-	put_device(pm->larbvenc);
-	return ret;
 }
 
 void mtk_vcodec_enc_clock_on(struct mtk_vcodec_pm *pm)
@@ -100,11 +73,6 @@ 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 clkerr;
-	}
 	return;
 
 clkerr:
@@ -117,7 +85,6 @@ void mtk_vcodec_enc_clock_off(struct mtk_vcodec_pm *pm)
 	struct mtk_vcodec_clk *enc_clk = &pm->venc_clk;
 	int i = 0;
 
-	mtk_smi_larb_put(pm->larbvenc);
 	for (i = enc_clk->clk_num - 1; i >= 0; i--)
 		clk_disable_unprepare(enc_clk->clk_info[i].vcodec_clk);
 }
-- 
2.18.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 11/13] memory: mtk-smi: Get rid of mtk_smi_larb_get/put
  2022-01-17  7:04 ` Yong Wu
                     ` (2 preceding siblings ...)
  (?)
@ 2022-01-17  7:05   ` Yong Wu
  -1 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Evan Green, Robin Murphy, Tomasz Figa, Will Deacon,
	linux-mediatek, srv_heupstream, devicetree, linux-kernel,
	linux-arm-kernel, iommu, yong.wu, youlin.pei, Matthias Kaehlcke,
	anan.sun, yi.kuo, acourbot, linux-media, dri-devel,
	Daniel Vetter, Chun-Kuang Hu, Philipp Zabel, Tiffany Lin,
	Dafna Hirschfeld, Hsin-Yi Wang, Eizan Miyamoto, anthony.huang,
	Frank Wunderlich, mingyuan.ma, yf.wang, libo.kang,
	AngeloGioacchino Del Regno

After adding device_link between the iommu consumer and smi-larb,
the pm_runtime_get(_sync) of smi-larb and smi-common will be called
automatically. we can get rid of mtk_smi_larb_get/put.

CC: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Evan Green <evgreen@chromium.org>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Acked-by: Matthias Brugger <matthias.bgg@gmail.com>
Reviewed-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/memory/mtk-smi.c   | 14 --------------
 include/soc/mediatek/smi.h | 20 --------------------
 2 files changed, 34 deletions(-)

diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c
index b883dcc0bbfa..1b348bb93f0b 100644
--- a/drivers/memory/mtk-smi.c
+++ b/drivers/memory/mtk-smi.c
@@ -149,20 +149,6 @@ struct mtk_smi_larb { /* larb: local arbiter */
 	unsigned char			*bank;
 };
 
-int mtk_smi_larb_get(struct device *larbdev)
-{
-	int ret = pm_runtime_resume_and_get(larbdev);
-
-	return (ret < 0) ? ret : 0;
-}
-EXPORT_SYMBOL_GPL(mtk_smi_larb_get);
-
-void mtk_smi_larb_put(struct device *larbdev)
-{
-	pm_runtime_put_sync(larbdev);
-}
-EXPORT_SYMBOL_GPL(mtk_smi_larb_put);
-
 static int
 mtk_smi_larb_bind(struct device *dev, struct device *master, void *data)
 {
diff --git a/include/soc/mediatek/smi.h b/include/soc/mediatek/smi.h
index 15e3397cec58..11f7d6b59642 100644
--- a/include/soc/mediatek/smi.h
+++ b/include/soc/mediatek/smi.h
@@ -19,26 +19,6 @@ struct mtk_smi_larb_iommu {
 	unsigned char  bank[32];
 };
 
-/*
- * mtk_smi_larb_get: Enable the power domain and clocks for this local arbiter.
- *                   It also initialize some basic setting(like iommu).
- * mtk_smi_larb_put: Disable the power domain and clocks for this local arbiter.
- * Both should be called in non-atomic context.
- *
- * Returns 0 if successful, negative on failure.
- */
-int mtk_smi_larb_get(struct device *larbdev);
-void mtk_smi_larb_put(struct device *larbdev);
-
-#else
-
-static inline int mtk_smi_larb_get(struct device *larbdev)
-{
-	return 0;
-}
-
-static inline void mtk_smi_larb_put(struct device *larbdev) { }
-
 #endif
 
 #endif
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 11/13] memory: mtk-smi: Get rid of mtk_smi_larb_get/put
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang, anthony.huang,
	youlin.pei, Evan Green, Eizan Miyamoto, Matthias Kaehlcke,
	linux-arm-kernel, mingyuan.ma, linux-media, devicetree,
	Philipp Zabel, Frank Wunderlich, libo.kang, yi.kuo,
	linux-mediatek, Hsin-Yi Wang, Tiffany Lin,
	AngeloGioacchino Del Regno, anan.sun, srv_heupstream, acourbot,
	linux-kernel, iommu, Daniel Vetter, Robin Murphy

After adding device_link between the iommu consumer and smi-larb,
the pm_runtime_get(_sync) of smi-larb and smi-common will be called
automatically. we can get rid of mtk_smi_larb_get/put.

CC: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Evan Green <evgreen@chromium.org>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Acked-by: Matthias Brugger <matthias.bgg@gmail.com>
Reviewed-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/memory/mtk-smi.c   | 14 --------------
 include/soc/mediatek/smi.h | 20 --------------------
 2 files changed, 34 deletions(-)

diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c
index b883dcc0bbfa..1b348bb93f0b 100644
--- a/drivers/memory/mtk-smi.c
+++ b/drivers/memory/mtk-smi.c
@@ -149,20 +149,6 @@ struct mtk_smi_larb { /* larb: local arbiter */
 	unsigned char			*bank;
 };
 
-int mtk_smi_larb_get(struct device *larbdev)
-{
-	int ret = pm_runtime_resume_and_get(larbdev);
-
-	return (ret < 0) ? ret : 0;
-}
-EXPORT_SYMBOL_GPL(mtk_smi_larb_get);
-
-void mtk_smi_larb_put(struct device *larbdev)
-{
-	pm_runtime_put_sync(larbdev);
-}
-EXPORT_SYMBOL_GPL(mtk_smi_larb_put);
-
 static int
 mtk_smi_larb_bind(struct device *dev, struct device *master, void *data)
 {
diff --git a/include/soc/mediatek/smi.h b/include/soc/mediatek/smi.h
index 15e3397cec58..11f7d6b59642 100644
--- a/include/soc/mediatek/smi.h
+++ b/include/soc/mediatek/smi.h
@@ -19,26 +19,6 @@ struct mtk_smi_larb_iommu {
 	unsigned char  bank[32];
 };
 
-/*
- * mtk_smi_larb_get: Enable the power domain and clocks for this local arbiter.
- *                   It also initialize some basic setting(like iommu).
- * mtk_smi_larb_put: Disable the power domain and clocks for this local arbiter.
- * Both should be called in non-atomic context.
- *
- * Returns 0 if successful, negative on failure.
- */
-int mtk_smi_larb_get(struct device *larbdev);
-void mtk_smi_larb_put(struct device *larbdev);
-
-#else
-
-static inline int mtk_smi_larb_get(struct device *larbdev)
-{
-	return 0;
-}
-
-static inline void mtk_smi_larb_put(struct device *larbdev) { }
-
 #endif
 
 #endif
-- 
2.18.0

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 11/13] memory: mtk-smi: Get rid of mtk_smi_larb_get/put
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Dafna Hirschfeld, Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang,
	anthony.huang, youlin.pei, Evan Green, Eizan Miyamoto,
	Matthias Kaehlcke, linux-arm-kernel, mingyuan.ma, linux-media,
	devicetree, Frank Wunderlich, libo.kang, yi.kuo, linux-mediatek,
	Hsin-Yi Wang, Tiffany Lin, yong.wu, AngeloGioacchino Del Regno,
	anan.sun, srv_heupstream, acourbot, linux-kernel, Tomasz Figa,
	iommu, Robin Murphy

After adding device_link between the iommu consumer and smi-larb,
the pm_runtime_get(_sync) of smi-larb and smi-common will be called
automatically. we can get rid of mtk_smi_larb_get/put.

CC: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Evan Green <evgreen@chromium.org>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Acked-by: Matthias Brugger <matthias.bgg@gmail.com>
Reviewed-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/memory/mtk-smi.c   | 14 --------------
 include/soc/mediatek/smi.h | 20 --------------------
 2 files changed, 34 deletions(-)

diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c
index b883dcc0bbfa..1b348bb93f0b 100644
--- a/drivers/memory/mtk-smi.c
+++ b/drivers/memory/mtk-smi.c
@@ -149,20 +149,6 @@ struct mtk_smi_larb { /* larb: local arbiter */
 	unsigned char			*bank;
 };
 
-int mtk_smi_larb_get(struct device *larbdev)
-{
-	int ret = pm_runtime_resume_and_get(larbdev);
-
-	return (ret < 0) ? ret : 0;
-}
-EXPORT_SYMBOL_GPL(mtk_smi_larb_get);
-
-void mtk_smi_larb_put(struct device *larbdev)
-{
-	pm_runtime_put_sync(larbdev);
-}
-EXPORT_SYMBOL_GPL(mtk_smi_larb_put);
-
 static int
 mtk_smi_larb_bind(struct device *dev, struct device *master, void *data)
 {
diff --git a/include/soc/mediatek/smi.h b/include/soc/mediatek/smi.h
index 15e3397cec58..11f7d6b59642 100644
--- a/include/soc/mediatek/smi.h
+++ b/include/soc/mediatek/smi.h
@@ -19,26 +19,6 @@ struct mtk_smi_larb_iommu {
 	unsigned char  bank[32];
 };
 
-/*
- * mtk_smi_larb_get: Enable the power domain and clocks for this local arbiter.
- *                   It also initialize some basic setting(like iommu).
- * mtk_smi_larb_put: Disable the power domain and clocks for this local arbiter.
- * Both should be called in non-atomic context.
- *
- * Returns 0 if successful, negative on failure.
- */
-int mtk_smi_larb_get(struct device *larbdev);
-void mtk_smi_larb_put(struct device *larbdev);
-
-#else
-
-static inline int mtk_smi_larb_get(struct device *larbdev)
-{
-	return 0;
-}
-
-static inline void mtk_smi_larb_put(struct device *larbdev) { }
-
 #endif
 
 #endif
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 11/13] memory: mtk-smi: Get rid of mtk_smi_larb_get/put
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Dafna Hirschfeld, Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang,
	anthony.huang, youlin.pei, Evan Green, Eizan Miyamoto,
	Matthias Kaehlcke, linux-arm-kernel, mingyuan.ma, linux-media,
	devicetree, Philipp Zabel, libo.kang, yi.kuo, linux-mediatek,
	Hsin-Yi Wang, Tiffany Lin, yong.wu, AngeloGioacchino Del Regno,
	anan.sun, srv_heupstream, acourbot, linux-kernel, Tomasz Figa,
	iommu, Daniel Vetter, Robin Murphy

After adding device_link between the iommu consumer and smi-larb,
the pm_runtime_get(_sync) of smi-larb and smi-common will be called
automatically. we can get rid of mtk_smi_larb_get/put.

CC: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Evan Green <evgreen@chromium.org>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Acked-by: Matthias Brugger <matthias.bgg@gmail.com>
Reviewed-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/memory/mtk-smi.c   | 14 --------------
 include/soc/mediatek/smi.h | 20 --------------------
 2 files changed, 34 deletions(-)

diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c
index b883dcc0bbfa..1b348bb93f0b 100644
--- a/drivers/memory/mtk-smi.c
+++ b/drivers/memory/mtk-smi.c
@@ -149,20 +149,6 @@ struct mtk_smi_larb { /* larb: local arbiter */
 	unsigned char			*bank;
 };
 
-int mtk_smi_larb_get(struct device *larbdev)
-{
-	int ret = pm_runtime_resume_and_get(larbdev);
-
-	return (ret < 0) ? ret : 0;
-}
-EXPORT_SYMBOL_GPL(mtk_smi_larb_get);
-
-void mtk_smi_larb_put(struct device *larbdev)
-{
-	pm_runtime_put_sync(larbdev);
-}
-EXPORT_SYMBOL_GPL(mtk_smi_larb_put);
-
 static int
 mtk_smi_larb_bind(struct device *dev, struct device *master, void *data)
 {
diff --git a/include/soc/mediatek/smi.h b/include/soc/mediatek/smi.h
index 15e3397cec58..11f7d6b59642 100644
--- a/include/soc/mediatek/smi.h
+++ b/include/soc/mediatek/smi.h
@@ -19,26 +19,6 @@ struct mtk_smi_larb_iommu {
 	unsigned char  bank[32];
 };
 
-/*
- * mtk_smi_larb_get: Enable the power domain and clocks for this local arbiter.
- *                   It also initialize some basic setting(like iommu).
- * mtk_smi_larb_put: Disable the power domain and clocks for this local arbiter.
- * Both should be called in non-atomic context.
- *
- * Returns 0 if successful, negative on failure.
- */
-int mtk_smi_larb_get(struct device *larbdev);
-void mtk_smi_larb_put(struct device *larbdev);
-
-#else
-
-static inline int mtk_smi_larb_get(struct device *larbdev)
-{
-	return 0;
-}
-
-static inline void mtk_smi_larb_put(struct device *larbdev) { }
-
 #endif
 
 #endif
-- 
2.18.0


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 11/13] memory: mtk-smi: Get rid of mtk_smi_larb_get/put
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Evan Green, Robin Murphy, Tomasz Figa, Will Deacon,
	linux-mediatek, srv_heupstream, devicetree, linux-kernel,
	linux-arm-kernel, iommu, yong.wu, youlin.pei, Matthias Kaehlcke,
	anan.sun, yi.kuo, acourbot, linux-media, dri-devel,
	Daniel Vetter, Chun-Kuang Hu, Philipp Zabel, Tiffany Lin,
	Dafna Hirschfeld, Hsin-Yi Wang, Eizan Miyamoto, anthony.huang,
	Frank Wunderlich, mingyuan.ma, yf.wang, libo.kang,
	AngeloGioacchino Del Regno

After adding device_link between the iommu consumer and smi-larb,
the pm_runtime_get(_sync) of smi-larb and smi-common will be called
automatically. we can get rid of mtk_smi_larb_get/put.

CC: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Evan Green <evgreen@chromium.org>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Acked-by: Matthias Brugger <matthias.bgg@gmail.com>
Reviewed-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/memory/mtk-smi.c   | 14 --------------
 include/soc/mediatek/smi.h | 20 --------------------
 2 files changed, 34 deletions(-)

diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c
index b883dcc0bbfa..1b348bb93f0b 100644
--- a/drivers/memory/mtk-smi.c
+++ b/drivers/memory/mtk-smi.c
@@ -149,20 +149,6 @@ struct mtk_smi_larb { /* larb: local arbiter */
 	unsigned char			*bank;
 };
 
-int mtk_smi_larb_get(struct device *larbdev)
-{
-	int ret = pm_runtime_resume_and_get(larbdev);
-
-	return (ret < 0) ? ret : 0;
-}
-EXPORT_SYMBOL_GPL(mtk_smi_larb_get);
-
-void mtk_smi_larb_put(struct device *larbdev)
-{
-	pm_runtime_put_sync(larbdev);
-}
-EXPORT_SYMBOL_GPL(mtk_smi_larb_put);
-
 static int
 mtk_smi_larb_bind(struct device *dev, struct device *master, void *data)
 {
diff --git a/include/soc/mediatek/smi.h b/include/soc/mediatek/smi.h
index 15e3397cec58..11f7d6b59642 100644
--- a/include/soc/mediatek/smi.h
+++ b/include/soc/mediatek/smi.h
@@ -19,26 +19,6 @@ struct mtk_smi_larb_iommu {
 	unsigned char  bank[32];
 };
 
-/*
- * mtk_smi_larb_get: Enable the power domain and clocks for this local arbiter.
- *                   It also initialize some basic setting(like iommu).
- * mtk_smi_larb_put: Disable the power domain and clocks for this local arbiter.
- * Both should be called in non-atomic context.
- *
- * Returns 0 if successful, negative on failure.
- */
-int mtk_smi_larb_get(struct device *larbdev);
-void mtk_smi_larb_put(struct device *larbdev);
-
-#else
-
-static inline int mtk_smi_larb_get(struct device *larbdev)
-{
-	return 0;
-}
-
-static inline void mtk_smi_larb_put(struct device *larbdev) { }
-
 #endif
 
 #endif
-- 
2.18.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 12/13] arm: dts: mediatek: Get rid of mediatek, larb for MM nodes
  2022-01-17  7:04 ` Yong Wu
                     ` (2 preceding siblings ...)
  (?)
@ 2022-01-17  7:05   ` Yong Wu
  -1 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang, anthony.huang,
	youlin.pei, Evan Green, Eizan Miyamoto, Matthias Kaehlcke,
	linux-arm-kernel, mingyuan.ma, linux-media, devicetree,
	Philipp Zabel, Frank Wunderlich, libo.kang, yi.kuo,
	linux-mediatek, Hsin-Yi Wang, Tiffany Lin,
	AngeloGioacchino Del Regno, anan.sun, srv_heupstream, acourbot,
	linux-kernel, iommu, Daniel Vetter, Robin Murphy

After adding device_link between the IOMMU consumer and smi, the
mediatek,larb is unnecessary now.

CC: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Evan Green <evgreen@chromium.org>
Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
---
 arch/arm/boot/dts/mt2701.dtsi  | 2 --
 arch/arm/boot/dts/mt7623n.dtsi | 5 -----
 2 files changed, 7 deletions(-)

diff --git a/arch/arm/boot/dts/mt2701.dtsi b/arch/arm/boot/dts/mt2701.dtsi
index 4776f85d6d5b..ef583cfd3baf 100644
--- a/arch/arm/boot/dts/mt2701.dtsi
+++ b/arch/arm/boot/dts/mt2701.dtsi
@@ -564,7 +564,6 @@
 		clock-names = "jpgdec-smi",
 			      "jpgdec";
 		power-domains = <&scpsys MT2701_POWER_DOMAIN_ISP>;
-		mediatek,larb = <&larb2>;
 		iommus = <&iommu MT2701_M4U_PORT_JPGDEC_WDMA>,
 			 <&iommu MT2701_M4U_PORT_JPGDEC_BSDMA>;
 	};
@@ -577,7 +576,6 @@
 		clocks =  <&imgsys CLK_IMG_VENC>;
 		clock-names = "jpgenc";
 		power-domains = <&scpsys MT2701_POWER_DOMAIN_ISP>;
-		mediatek,larb = <&larb2>;
 		iommus = <&iommu MT2701_M4U_PORT_JPGENC_RDMA>,
 			 <&iommu MT2701_M4U_PORT_JPGENC_BSDMA>;
 	};
diff --git a/arch/arm/boot/dts/mt7623n.dtsi b/arch/arm/boot/dts/mt7623n.dtsi
index bcb0846e29fd..3adab5cd1fef 100644
--- a/arch/arm/boot/dts/mt7623n.dtsi
+++ b/arch/arm/boot/dts/mt7623n.dtsi
@@ -121,7 +121,6 @@
 		clock-names = "jpgdec-smi",
 			      "jpgdec";
 		power-domains = <&scpsys MT2701_POWER_DOMAIN_ISP>;
-		mediatek,larb = <&larb2>;
 		iommus = <&iommu MT2701_M4U_PORT_JPGDEC_WDMA>,
 			 <&iommu MT2701_M4U_PORT_JPGDEC_BSDMA>;
 	};
@@ -144,7 +143,6 @@
 		interrupts = <GIC_SPI 153 IRQ_TYPE_LEVEL_LOW>;
 		clocks = <&mmsys CLK_MM_DISP_OVL>;
 		iommus = <&iommu MT2701_M4U_PORT_DISP_OVL_0>;
-		mediatek,larb = <&larb0>;
 	};
 
 	rdma0: rdma@14008000 {
@@ -154,7 +152,6 @@
 		interrupts = <GIC_SPI 152 IRQ_TYPE_LEVEL_LOW>;
 		clocks = <&mmsys CLK_MM_DISP_RDMA>;
 		iommus = <&iommu MT2701_M4U_PORT_DISP_RDMA>;
-		mediatek,larb = <&larb0>;
 	};
 
 	wdma@14009000 {
@@ -164,7 +161,6 @@
 		interrupts = <GIC_SPI 154 IRQ_TYPE_LEVEL_LOW>;
 		clocks = <&mmsys CLK_MM_DISP_WDMA>;
 		iommus = <&iommu MT2701_M4U_PORT_DISP_WDMA>;
-		mediatek,larb = <&larb0>;
 	};
 
 	bls: pwm@1400a000 {
@@ -215,7 +211,6 @@
 		interrupts = <GIC_SPI 164 IRQ_TYPE_LEVEL_LOW>;
 		clocks = <&mmsys CLK_MM_DISP_RDMA1>;
 		iommus = <&iommu MT2701_M4U_PORT_DISP_RDMA1>;
-		mediatek,larb = <&larb0>;
 	};
 
 	dpi0: dpi@14014000 {
-- 
2.18.0

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 12/13] arm: dts: mediatek: Get rid of mediatek, larb for MM nodes
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Dafna Hirschfeld, Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang,
	anthony.huang, youlin.pei, Evan Green, Eizan Miyamoto,
	Matthias Kaehlcke, linux-arm-kernel, mingyuan.ma, linux-media,
	devicetree, Frank Wunderlich, libo.kang, yi.kuo, linux-mediatek,
	Hsin-Yi Wang, Tiffany Lin, yong.wu, AngeloGioacchino Del Regno,
	anan.sun, srv_heupstream, acourbot, linux-kernel, Tomasz Figa,
	iommu, Robin Murphy

After adding device_link between the IOMMU consumer and smi, the
mediatek,larb is unnecessary now.

CC: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Evan Green <evgreen@chromium.org>
Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
---
 arch/arm/boot/dts/mt2701.dtsi  | 2 --
 arch/arm/boot/dts/mt7623n.dtsi | 5 -----
 2 files changed, 7 deletions(-)

diff --git a/arch/arm/boot/dts/mt2701.dtsi b/arch/arm/boot/dts/mt2701.dtsi
index 4776f85d6d5b..ef583cfd3baf 100644
--- a/arch/arm/boot/dts/mt2701.dtsi
+++ b/arch/arm/boot/dts/mt2701.dtsi
@@ -564,7 +564,6 @@
 		clock-names = "jpgdec-smi",
 			      "jpgdec";
 		power-domains = <&scpsys MT2701_POWER_DOMAIN_ISP>;
-		mediatek,larb = <&larb2>;
 		iommus = <&iommu MT2701_M4U_PORT_JPGDEC_WDMA>,
 			 <&iommu MT2701_M4U_PORT_JPGDEC_BSDMA>;
 	};
@@ -577,7 +576,6 @@
 		clocks =  <&imgsys CLK_IMG_VENC>;
 		clock-names = "jpgenc";
 		power-domains = <&scpsys MT2701_POWER_DOMAIN_ISP>;
-		mediatek,larb = <&larb2>;
 		iommus = <&iommu MT2701_M4U_PORT_JPGENC_RDMA>,
 			 <&iommu MT2701_M4U_PORT_JPGENC_BSDMA>;
 	};
diff --git a/arch/arm/boot/dts/mt7623n.dtsi b/arch/arm/boot/dts/mt7623n.dtsi
index bcb0846e29fd..3adab5cd1fef 100644
--- a/arch/arm/boot/dts/mt7623n.dtsi
+++ b/arch/arm/boot/dts/mt7623n.dtsi
@@ -121,7 +121,6 @@
 		clock-names = "jpgdec-smi",
 			      "jpgdec";
 		power-domains = <&scpsys MT2701_POWER_DOMAIN_ISP>;
-		mediatek,larb = <&larb2>;
 		iommus = <&iommu MT2701_M4U_PORT_JPGDEC_WDMA>,
 			 <&iommu MT2701_M4U_PORT_JPGDEC_BSDMA>;
 	};
@@ -144,7 +143,6 @@
 		interrupts = <GIC_SPI 153 IRQ_TYPE_LEVEL_LOW>;
 		clocks = <&mmsys CLK_MM_DISP_OVL>;
 		iommus = <&iommu MT2701_M4U_PORT_DISP_OVL_0>;
-		mediatek,larb = <&larb0>;
 	};
 
 	rdma0: rdma@14008000 {
@@ -154,7 +152,6 @@
 		interrupts = <GIC_SPI 152 IRQ_TYPE_LEVEL_LOW>;
 		clocks = <&mmsys CLK_MM_DISP_RDMA>;
 		iommus = <&iommu MT2701_M4U_PORT_DISP_RDMA>;
-		mediatek,larb = <&larb0>;
 	};
 
 	wdma@14009000 {
@@ -164,7 +161,6 @@
 		interrupts = <GIC_SPI 154 IRQ_TYPE_LEVEL_LOW>;
 		clocks = <&mmsys CLK_MM_DISP_WDMA>;
 		iommus = <&iommu MT2701_M4U_PORT_DISP_WDMA>;
-		mediatek,larb = <&larb0>;
 	};
 
 	bls: pwm@1400a000 {
@@ -215,7 +211,6 @@
 		interrupts = <GIC_SPI 164 IRQ_TYPE_LEVEL_LOW>;
 		clocks = <&mmsys CLK_MM_DISP_RDMA1>;
 		iommus = <&iommu MT2701_M4U_PORT_DISP_RDMA1>;
-		mediatek,larb = <&larb0>;
 	};
 
 	dpi0: dpi@14014000 {
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 12/13] arm: dts: mediatek: Get rid of mediatek,larb for MM nodes
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Evan Green, Robin Murphy, Tomasz Figa, Will Deacon,
	linux-mediatek, srv_heupstream, devicetree, linux-kernel,
	linux-arm-kernel, iommu, yong.wu, youlin.pei, Matthias Kaehlcke,
	anan.sun, yi.kuo, acourbot, linux-media, dri-devel,
	Daniel Vetter, Chun-Kuang Hu, Philipp Zabel, Tiffany Lin,
	Dafna Hirschfeld, Hsin-Yi Wang, Eizan Miyamoto, anthony.huang,
	Frank Wunderlich, mingyuan.ma, yf.wang, libo.kang,
	AngeloGioacchino Del Regno

After adding device_link between the IOMMU consumer and smi, the
mediatek,larb is unnecessary now.

CC: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Evan Green <evgreen@chromium.org>
Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
---
 arch/arm/boot/dts/mt2701.dtsi  | 2 --
 arch/arm/boot/dts/mt7623n.dtsi | 5 -----
 2 files changed, 7 deletions(-)

diff --git a/arch/arm/boot/dts/mt2701.dtsi b/arch/arm/boot/dts/mt2701.dtsi
index 4776f85d6d5b..ef583cfd3baf 100644
--- a/arch/arm/boot/dts/mt2701.dtsi
+++ b/arch/arm/boot/dts/mt2701.dtsi
@@ -564,7 +564,6 @@
 		clock-names = "jpgdec-smi",
 			      "jpgdec";
 		power-domains = <&scpsys MT2701_POWER_DOMAIN_ISP>;
-		mediatek,larb = <&larb2>;
 		iommus = <&iommu MT2701_M4U_PORT_JPGDEC_WDMA>,
 			 <&iommu MT2701_M4U_PORT_JPGDEC_BSDMA>;
 	};
@@ -577,7 +576,6 @@
 		clocks =  <&imgsys CLK_IMG_VENC>;
 		clock-names = "jpgenc";
 		power-domains = <&scpsys MT2701_POWER_DOMAIN_ISP>;
-		mediatek,larb = <&larb2>;
 		iommus = <&iommu MT2701_M4U_PORT_JPGENC_RDMA>,
 			 <&iommu MT2701_M4U_PORT_JPGENC_BSDMA>;
 	};
diff --git a/arch/arm/boot/dts/mt7623n.dtsi b/arch/arm/boot/dts/mt7623n.dtsi
index bcb0846e29fd..3adab5cd1fef 100644
--- a/arch/arm/boot/dts/mt7623n.dtsi
+++ b/arch/arm/boot/dts/mt7623n.dtsi
@@ -121,7 +121,6 @@
 		clock-names = "jpgdec-smi",
 			      "jpgdec";
 		power-domains = <&scpsys MT2701_POWER_DOMAIN_ISP>;
-		mediatek,larb = <&larb2>;
 		iommus = <&iommu MT2701_M4U_PORT_JPGDEC_WDMA>,
 			 <&iommu MT2701_M4U_PORT_JPGDEC_BSDMA>;
 	};
@@ -144,7 +143,6 @@
 		interrupts = <GIC_SPI 153 IRQ_TYPE_LEVEL_LOW>;
 		clocks = <&mmsys CLK_MM_DISP_OVL>;
 		iommus = <&iommu MT2701_M4U_PORT_DISP_OVL_0>;
-		mediatek,larb = <&larb0>;
 	};
 
 	rdma0: rdma@14008000 {
@@ -154,7 +152,6 @@
 		interrupts = <GIC_SPI 152 IRQ_TYPE_LEVEL_LOW>;
 		clocks = <&mmsys CLK_MM_DISP_RDMA>;
 		iommus = <&iommu MT2701_M4U_PORT_DISP_RDMA>;
-		mediatek,larb = <&larb0>;
 	};
 
 	wdma@14009000 {
@@ -164,7 +161,6 @@
 		interrupts = <GIC_SPI 154 IRQ_TYPE_LEVEL_LOW>;
 		clocks = <&mmsys CLK_MM_DISP_WDMA>;
 		iommus = <&iommu MT2701_M4U_PORT_DISP_WDMA>;
-		mediatek,larb = <&larb0>;
 	};
 
 	bls: pwm@1400a000 {
@@ -215,7 +211,6 @@
 		interrupts = <GIC_SPI 164 IRQ_TYPE_LEVEL_LOW>;
 		clocks = <&mmsys CLK_MM_DISP_RDMA1>;
 		iommus = <&iommu MT2701_M4U_PORT_DISP_RDMA1>;
-		mediatek,larb = <&larb0>;
 	};
 
 	dpi0: dpi@14014000 {
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 12/13] arm: dts: mediatek: Get rid of mediatek, larb for MM nodes
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Evan Green, Robin Murphy, Tomasz Figa, Will Deacon,
	linux-mediatek, srv_heupstream, devicetree, linux-kernel,
	linux-arm-kernel, iommu, yong.wu, youlin.pei, Matthias Kaehlcke,
	anan.sun, yi.kuo, acourbot, linux-media, dri-devel,
	Daniel Vetter, Chun-Kuang Hu, Philipp Zabel, Tiffany Lin,
	Dafna Hirschfeld, Hsin-Yi Wang, Eizan Miyamoto, anthony.huang,
	Frank Wunderlich, mingyuan.ma, yf.wang, libo.kang,
	AngeloGioacchino Del Regno

After adding device_link between the IOMMU consumer and smi, the
mediatek,larb is unnecessary now.

CC: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Evan Green <evgreen@chromium.org>
Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
---
 arch/arm/boot/dts/mt2701.dtsi  | 2 --
 arch/arm/boot/dts/mt7623n.dtsi | 5 -----
 2 files changed, 7 deletions(-)

diff --git a/arch/arm/boot/dts/mt2701.dtsi b/arch/arm/boot/dts/mt2701.dtsi
index 4776f85d6d5b..ef583cfd3baf 100644
--- a/arch/arm/boot/dts/mt2701.dtsi
+++ b/arch/arm/boot/dts/mt2701.dtsi
@@ -564,7 +564,6 @@
 		clock-names = "jpgdec-smi",
 			      "jpgdec";
 		power-domains = <&scpsys MT2701_POWER_DOMAIN_ISP>;
-		mediatek,larb = <&larb2>;
 		iommus = <&iommu MT2701_M4U_PORT_JPGDEC_WDMA>,
 			 <&iommu MT2701_M4U_PORT_JPGDEC_BSDMA>;
 	};
@@ -577,7 +576,6 @@
 		clocks =  <&imgsys CLK_IMG_VENC>;
 		clock-names = "jpgenc";
 		power-domains = <&scpsys MT2701_POWER_DOMAIN_ISP>;
-		mediatek,larb = <&larb2>;
 		iommus = <&iommu MT2701_M4U_PORT_JPGENC_RDMA>,
 			 <&iommu MT2701_M4U_PORT_JPGENC_BSDMA>;
 	};
diff --git a/arch/arm/boot/dts/mt7623n.dtsi b/arch/arm/boot/dts/mt7623n.dtsi
index bcb0846e29fd..3adab5cd1fef 100644
--- a/arch/arm/boot/dts/mt7623n.dtsi
+++ b/arch/arm/boot/dts/mt7623n.dtsi
@@ -121,7 +121,6 @@
 		clock-names = "jpgdec-smi",
 			      "jpgdec";
 		power-domains = <&scpsys MT2701_POWER_DOMAIN_ISP>;
-		mediatek,larb = <&larb2>;
 		iommus = <&iommu MT2701_M4U_PORT_JPGDEC_WDMA>,
 			 <&iommu MT2701_M4U_PORT_JPGDEC_BSDMA>;
 	};
@@ -144,7 +143,6 @@
 		interrupts = <GIC_SPI 153 IRQ_TYPE_LEVEL_LOW>;
 		clocks = <&mmsys CLK_MM_DISP_OVL>;
 		iommus = <&iommu MT2701_M4U_PORT_DISP_OVL_0>;
-		mediatek,larb = <&larb0>;
 	};
 
 	rdma0: rdma@14008000 {
@@ -154,7 +152,6 @@
 		interrupts = <GIC_SPI 152 IRQ_TYPE_LEVEL_LOW>;
 		clocks = <&mmsys CLK_MM_DISP_RDMA>;
 		iommus = <&iommu MT2701_M4U_PORT_DISP_RDMA>;
-		mediatek,larb = <&larb0>;
 	};
 
 	wdma@14009000 {
@@ -164,7 +161,6 @@
 		interrupts = <GIC_SPI 154 IRQ_TYPE_LEVEL_LOW>;
 		clocks = <&mmsys CLK_MM_DISP_WDMA>;
 		iommus = <&iommu MT2701_M4U_PORT_DISP_WDMA>;
-		mediatek,larb = <&larb0>;
 	};
 
 	bls: pwm@1400a000 {
@@ -215,7 +211,6 @@
 		interrupts = <GIC_SPI 164 IRQ_TYPE_LEVEL_LOW>;
 		clocks = <&mmsys CLK_MM_DISP_RDMA1>;
 		iommus = <&iommu MT2701_M4U_PORT_DISP_RDMA1>;
-		mediatek,larb = <&larb0>;
 	};
 
 	dpi0: dpi@14014000 {
-- 
2.18.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 12/13] arm: dts: mediatek: Get rid of mediatek, larb for MM nodes
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Dafna Hirschfeld, Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang,
	anthony.huang, youlin.pei, Evan Green, Eizan Miyamoto,
	Matthias Kaehlcke, linux-arm-kernel, mingyuan.ma, linux-media,
	devicetree, Philipp Zabel, libo.kang, yi.kuo, linux-mediatek,
	Hsin-Yi Wang, Tiffany Lin, yong.wu, AngeloGioacchino Del Regno,
	anan.sun, srv_heupstream, acourbot, linux-kernel, Tomasz Figa,
	iommu, Daniel Vetter, Robin Murphy

After adding device_link between the IOMMU consumer and smi, the
mediatek,larb is unnecessary now.

CC: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Evan Green <evgreen@chromium.org>
Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
---
 arch/arm/boot/dts/mt2701.dtsi  | 2 --
 arch/arm/boot/dts/mt7623n.dtsi | 5 -----
 2 files changed, 7 deletions(-)

diff --git a/arch/arm/boot/dts/mt2701.dtsi b/arch/arm/boot/dts/mt2701.dtsi
index 4776f85d6d5b..ef583cfd3baf 100644
--- a/arch/arm/boot/dts/mt2701.dtsi
+++ b/arch/arm/boot/dts/mt2701.dtsi
@@ -564,7 +564,6 @@
 		clock-names = "jpgdec-smi",
 			      "jpgdec";
 		power-domains = <&scpsys MT2701_POWER_DOMAIN_ISP>;
-		mediatek,larb = <&larb2>;
 		iommus = <&iommu MT2701_M4U_PORT_JPGDEC_WDMA>,
 			 <&iommu MT2701_M4U_PORT_JPGDEC_BSDMA>;
 	};
@@ -577,7 +576,6 @@
 		clocks =  <&imgsys CLK_IMG_VENC>;
 		clock-names = "jpgenc";
 		power-domains = <&scpsys MT2701_POWER_DOMAIN_ISP>;
-		mediatek,larb = <&larb2>;
 		iommus = <&iommu MT2701_M4U_PORT_JPGENC_RDMA>,
 			 <&iommu MT2701_M4U_PORT_JPGENC_BSDMA>;
 	};
diff --git a/arch/arm/boot/dts/mt7623n.dtsi b/arch/arm/boot/dts/mt7623n.dtsi
index bcb0846e29fd..3adab5cd1fef 100644
--- a/arch/arm/boot/dts/mt7623n.dtsi
+++ b/arch/arm/boot/dts/mt7623n.dtsi
@@ -121,7 +121,6 @@
 		clock-names = "jpgdec-smi",
 			      "jpgdec";
 		power-domains = <&scpsys MT2701_POWER_DOMAIN_ISP>;
-		mediatek,larb = <&larb2>;
 		iommus = <&iommu MT2701_M4U_PORT_JPGDEC_WDMA>,
 			 <&iommu MT2701_M4U_PORT_JPGDEC_BSDMA>;
 	};
@@ -144,7 +143,6 @@
 		interrupts = <GIC_SPI 153 IRQ_TYPE_LEVEL_LOW>;
 		clocks = <&mmsys CLK_MM_DISP_OVL>;
 		iommus = <&iommu MT2701_M4U_PORT_DISP_OVL_0>;
-		mediatek,larb = <&larb0>;
 	};
 
 	rdma0: rdma@14008000 {
@@ -154,7 +152,6 @@
 		interrupts = <GIC_SPI 152 IRQ_TYPE_LEVEL_LOW>;
 		clocks = <&mmsys CLK_MM_DISP_RDMA>;
 		iommus = <&iommu MT2701_M4U_PORT_DISP_RDMA>;
-		mediatek,larb = <&larb0>;
 	};
 
 	wdma@14009000 {
@@ -164,7 +161,6 @@
 		interrupts = <GIC_SPI 154 IRQ_TYPE_LEVEL_LOW>;
 		clocks = <&mmsys CLK_MM_DISP_WDMA>;
 		iommus = <&iommu MT2701_M4U_PORT_DISP_WDMA>;
-		mediatek,larb = <&larb0>;
 	};
 
 	bls: pwm@1400a000 {
@@ -215,7 +211,6 @@
 		interrupts = <GIC_SPI 164 IRQ_TYPE_LEVEL_LOW>;
 		clocks = <&mmsys CLK_MM_DISP_RDMA1>;
 		iommus = <&iommu MT2701_M4U_PORT_DISP_RDMA1>;
-		mediatek,larb = <&larb0>;
 	};
 
 	dpi0: dpi@14014000 {
-- 
2.18.0


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 13/13] arm64: dts: mediatek: Get rid of mediatek, larb for MM nodes
  2022-01-17  7:04 ` Yong Wu
                     ` (2 preceding siblings ...)
  (?)
@ 2022-01-17  7:05   ` Yong Wu
  -1 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang, anthony.huang,
	youlin.pei, Evan Green, Eizan Miyamoto, Matthias Kaehlcke,
	linux-arm-kernel, mingyuan.ma, linux-media, devicetree,
	Philipp Zabel, Frank Wunderlich, libo.kang, yi.kuo,
	linux-mediatek, Hsin-Yi Wang, Tiffany Lin,
	AngeloGioacchino Del Regno, anan.sun, srv_heupstream, acourbot,
	linux-kernel, iommu, Daniel Vetter, Robin Murphy

After adding device_link between the IOMMU consumer and smi,
the mediatek,larb is unnecessary now.

CC: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Evan Green <evgreen@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 arch/arm64/boot/dts/mediatek/mt8173.dtsi | 16 ----------------
 arch/arm64/boot/dts/mediatek/mt8183.dtsi |  6 ------
 2 files changed, 22 deletions(-)

diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
index dee66e5f054c..417e82891a70 100644
--- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
@@ -1010,7 +1010,6 @@
 				 <&mmsys CLK_MM_MUTEX_32K>;
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			iommus = <&iommu M4U_PORT_MDP_RDMA0>;
-			mediatek,larb = <&larb0>;
 			mediatek,vpu = <&vpu>;
 		};
 
@@ -1021,7 +1020,6 @@
 				 <&mmsys CLK_MM_MUTEX_32K>;
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			iommus = <&iommu M4U_PORT_MDP_RDMA1>;
-			mediatek,larb = <&larb4>;
 		};
 
 		mdp_rsz0: rsz@14003000 {
@@ -1051,7 +1049,6 @@
 			clocks = <&mmsys CLK_MM_MDP_WDMA>;
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			iommus = <&iommu M4U_PORT_MDP_WDMA>;
-			mediatek,larb = <&larb0>;
 		};
 
 		mdp_wrot0: wrot@14007000 {
@@ -1060,7 +1057,6 @@
 			clocks = <&mmsys CLK_MM_MDP_WROT0>;
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			iommus = <&iommu M4U_PORT_MDP_WROT0>;
-			mediatek,larb = <&larb0>;
 		};
 
 		mdp_wrot1: wrot@14008000 {
@@ -1069,7 +1065,6 @@
 			clocks = <&mmsys CLK_MM_MDP_WROT1>;
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			iommus = <&iommu M4U_PORT_MDP_WROT1>;
-			mediatek,larb = <&larb4>;
 		};
 
 		ovl0: ovl@1400c000 {
@@ -1079,7 +1074,6 @@
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			clocks = <&mmsys CLK_MM_DISP_OVL0>;
 			iommus = <&iommu M4U_PORT_DISP_OVL0>;
-			mediatek,larb = <&larb0>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0xc000 0x1000>;
 		};
 
@@ -1090,7 +1084,6 @@
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			clocks = <&mmsys CLK_MM_DISP_OVL1>;
 			iommus = <&iommu M4U_PORT_DISP_OVL1>;
-			mediatek,larb = <&larb4>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0xd000 0x1000>;
 		};
 
@@ -1101,7 +1094,6 @@
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			clocks = <&mmsys CLK_MM_DISP_RDMA0>;
 			iommus = <&iommu M4U_PORT_DISP_RDMA0>;
-			mediatek,larb = <&larb0>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0xe000 0x1000>;
 		};
 
@@ -1112,7 +1104,6 @@
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			clocks = <&mmsys CLK_MM_DISP_RDMA1>;
 			iommus = <&iommu M4U_PORT_DISP_RDMA1>;
-			mediatek,larb = <&larb4>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0xf000 0x1000>;
 		};
 
@@ -1123,7 +1114,6 @@
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			clocks = <&mmsys CLK_MM_DISP_RDMA2>;
 			iommus = <&iommu M4U_PORT_DISP_RDMA2>;
-			mediatek,larb = <&larb4>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1401XXXX 0 0x1000>;
 		};
 
@@ -1134,7 +1124,6 @@
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			clocks = <&mmsys CLK_MM_DISP_WDMA0>;
 			iommus = <&iommu M4U_PORT_DISP_WDMA0>;
-			mediatek,larb = <&larb0>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1401XXXX 0x1000 0x1000>;
 		};
 
@@ -1145,7 +1134,6 @@
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			clocks = <&mmsys CLK_MM_DISP_WDMA1>;
 			iommus = <&iommu M4U_PORT_DISP_WDMA1>;
-			mediatek,larb = <&larb4>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1401XXXX 0x2000 0x1000>;
 		};
 
@@ -1397,7 +1385,6 @@
 			      <0 0x16027800 0 0x800>,	/* VDEC_HWB */
 			      <0 0x16028400 0 0x400>;	/* VDEC_HWG */
 			interrupts = <GIC_SPI 204 IRQ_TYPE_LEVEL_LOW>;
-			mediatek,larb = <&larb1>;
 			iommus = <&iommu M4U_PORT_HW_VDEC_MC_EXT>,
 				 <&iommu M4U_PORT_HW_VDEC_PP_EXT>,
 				 <&iommu M4U_PORT_HW_VDEC_AVC_MV_EXT>,
@@ -1465,7 +1452,6 @@
 			compatible = "mediatek,mt8173-vcodec-enc";
 			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>,
@@ -1493,7 +1479,6 @@
 			clock-names = "jpgdec-smi",
 				      "jpgdec";
 			power-domains = <&spm MT8173_POWER_DOMAIN_VENC>;
-			mediatek,larb = <&larb3>;
 			iommus = <&iommu M4U_PORT_JPGDEC_WDMA>,
 				 <&iommu M4U_PORT_JPGDEC_BSDMA>;
 		};
@@ -1527,7 +1512,6 @@
 				 <&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";
diff --git a/arch/arm64/boot/dts/mediatek/mt8183.dtsi b/arch/arm64/boot/dts/mediatek/mt8183.dtsi
index ac6b0c12d3b3..452102c4904a 100644
--- a/arch/arm64/boot/dts/mediatek/mt8183.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8183.dtsi
@@ -1332,7 +1332,6 @@
 			power-domains = <&spm MT8183_POWER_DOMAIN_DISP>;
 			clocks = <&mmsys CLK_MM_DISP_OVL0>;
 			iommus = <&iommu M4U_PORT_DISP_OVL0>;
-			mediatek,larb = <&larb0>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0x8000 0x1000>;
 		};
 
@@ -1343,7 +1342,6 @@
 			power-domains = <&spm MT8183_POWER_DOMAIN_DISP>;
 			clocks = <&mmsys CLK_MM_DISP_OVL0_2L>;
 			iommus = <&iommu M4U_PORT_DISP_2L_OVL0_LARB0>;
-			mediatek,larb = <&larb0>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0x9000 0x1000>;
 		};
 
@@ -1354,7 +1352,6 @@
 			power-domains = <&spm MT8183_POWER_DOMAIN_DISP>;
 			clocks = <&mmsys CLK_MM_DISP_OVL1_2L>;
 			iommus = <&iommu M4U_PORT_DISP_2L_OVL1_LARB0>;
-			mediatek,larb = <&larb0>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0xa000 0x1000>;
 		};
 
@@ -1365,7 +1362,6 @@
 			power-domains = <&spm MT8183_POWER_DOMAIN_DISP>;
 			clocks = <&mmsys CLK_MM_DISP_RDMA0>;
 			iommus = <&iommu M4U_PORT_DISP_RDMA0>;
-			mediatek,larb = <&larb0>;
 			mediatek,rdma-fifo-size = <5120>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0xb000 0x1000>;
 		};
@@ -1377,7 +1373,6 @@
 			power-domains = <&spm MT8183_POWER_DOMAIN_DISP>;
 			clocks = <&mmsys CLK_MM_DISP_RDMA1>;
 			iommus = <&iommu M4U_PORT_DISP_RDMA1>;
-			mediatek,larb = <&larb0>;
 			mediatek,rdma-fifo-size = <2048>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0xc000 0x1000>;
 		};
@@ -1534,7 +1529,6 @@
 			compatible = "mediatek,mt8183-jpgenc", "mediatek,mtk-jpgenc";
 			reg = <0 0x17030000 0 0x1000>;
 			interrupts = <GIC_SPI 249 IRQ_TYPE_LEVEL_LOW>;
-			mediatek,larb = <&larb4>;
 			iommus = <&iommu M4U_PORT_JPGENC_RDMA>,
 				 <&iommu M4U_PORT_JPGENC_BSDMA>;
 			power-domains = <&spm MT8183_POWER_DOMAIN_VENC>;
-- 
2.18.0

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 13/13] arm64: dts: mediatek: Get rid of mediatek, larb for MM nodes
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Dafna Hirschfeld, Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang,
	anthony.huang, youlin.pei, Evan Green, Eizan Miyamoto,
	Matthias Kaehlcke, linux-arm-kernel, mingyuan.ma, linux-media,
	devicetree, Frank Wunderlich, libo.kang, yi.kuo, linux-mediatek,
	Hsin-Yi Wang, Tiffany Lin, yong.wu, AngeloGioacchino Del Regno,
	anan.sun, srv_heupstream, acourbot, linux-kernel, Tomasz Figa,
	iommu, Robin Murphy

After adding device_link between the IOMMU consumer and smi,
the mediatek,larb is unnecessary now.

CC: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Evan Green <evgreen@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 arch/arm64/boot/dts/mediatek/mt8173.dtsi | 16 ----------------
 arch/arm64/boot/dts/mediatek/mt8183.dtsi |  6 ------
 2 files changed, 22 deletions(-)

diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
index dee66e5f054c..417e82891a70 100644
--- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
@@ -1010,7 +1010,6 @@
 				 <&mmsys CLK_MM_MUTEX_32K>;
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			iommus = <&iommu M4U_PORT_MDP_RDMA0>;
-			mediatek,larb = <&larb0>;
 			mediatek,vpu = <&vpu>;
 		};
 
@@ -1021,7 +1020,6 @@
 				 <&mmsys CLK_MM_MUTEX_32K>;
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			iommus = <&iommu M4U_PORT_MDP_RDMA1>;
-			mediatek,larb = <&larb4>;
 		};
 
 		mdp_rsz0: rsz@14003000 {
@@ -1051,7 +1049,6 @@
 			clocks = <&mmsys CLK_MM_MDP_WDMA>;
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			iommus = <&iommu M4U_PORT_MDP_WDMA>;
-			mediatek,larb = <&larb0>;
 		};
 
 		mdp_wrot0: wrot@14007000 {
@@ -1060,7 +1057,6 @@
 			clocks = <&mmsys CLK_MM_MDP_WROT0>;
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			iommus = <&iommu M4U_PORT_MDP_WROT0>;
-			mediatek,larb = <&larb0>;
 		};
 
 		mdp_wrot1: wrot@14008000 {
@@ -1069,7 +1065,6 @@
 			clocks = <&mmsys CLK_MM_MDP_WROT1>;
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			iommus = <&iommu M4U_PORT_MDP_WROT1>;
-			mediatek,larb = <&larb4>;
 		};
 
 		ovl0: ovl@1400c000 {
@@ -1079,7 +1074,6 @@
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			clocks = <&mmsys CLK_MM_DISP_OVL0>;
 			iommus = <&iommu M4U_PORT_DISP_OVL0>;
-			mediatek,larb = <&larb0>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0xc000 0x1000>;
 		};
 
@@ -1090,7 +1084,6 @@
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			clocks = <&mmsys CLK_MM_DISP_OVL1>;
 			iommus = <&iommu M4U_PORT_DISP_OVL1>;
-			mediatek,larb = <&larb4>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0xd000 0x1000>;
 		};
 
@@ -1101,7 +1094,6 @@
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			clocks = <&mmsys CLK_MM_DISP_RDMA0>;
 			iommus = <&iommu M4U_PORT_DISP_RDMA0>;
-			mediatek,larb = <&larb0>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0xe000 0x1000>;
 		};
 
@@ -1112,7 +1104,6 @@
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			clocks = <&mmsys CLK_MM_DISP_RDMA1>;
 			iommus = <&iommu M4U_PORT_DISP_RDMA1>;
-			mediatek,larb = <&larb4>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0xf000 0x1000>;
 		};
 
@@ -1123,7 +1114,6 @@
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			clocks = <&mmsys CLK_MM_DISP_RDMA2>;
 			iommus = <&iommu M4U_PORT_DISP_RDMA2>;
-			mediatek,larb = <&larb4>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1401XXXX 0 0x1000>;
 		};
 
@@ -1134,7 +1124,6 @@
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			clocks = <&mmsys CLK_MM_DISP_WDMA0>;
 			iommus = <&iommu M4U_PORT_DISP_WDMA0>;
-			mediatek,larb = <&larb0>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1401XXXX 0x1000 0x1000>;
 		};
 
@@ -1145,7 +1134,6 @@
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			clocks = <&mmsys CLK_MM_DISP_WDMA1>;
 			iommus = <&iommu M4U_PORT_DISP_WDMA1>;
-			mediatek,larb = <&larb4>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1401XXXX 0x2000 0x1000>;
 		};
 
@@ -1397,7 +1385,6 @@
 			      <0 0x16027800 0 0x800>,	/* VDEC_HWB */
 			      <0 0x16028400 0 0x400>;	/* VDEC_HWG */
 			interrupts = <GIC_SPI 204 IRQ_TYPE_LEVEL_LOW>;
-			mediatek,larb = <&larb1>;
 			iommus = <&iommu M4U_PORT_HW_VDEC_MC_EXT>,
 				 <&iommu M4U_PORT_HW_VDEC_PP_EXT>,
 				 <&iommu M4U_PORT_HW_VDEC_AVC_MV_EXT>,
@@ -1465,7 +1452,6 @@
 			compatible = "mediatek,mt8173-vcodec-enc";
 			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>,
@@ -1493,7 +1479,6 @@
 			clock-names = "jpgdec-smi",
 				      "jpgdec";
 			power-domains = <&spm MT8173_POWER_DOMAIN_VENC>;
-			mediatek,larb = <&larb3>;
 			iommus = <&iommu M4U_PORT_JPGDEC_WDMA>,
 				 <&iommu M4U_PORT_JPGDEC_BSDMA>;
 		};
@@ -1527,7 +1512,6 @@
 				 <&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";
diff --git a/arch/arm64/boot/dts/mediatek/mt8183.dtsi b/arch/arm64/boot/dts/mediatek/mt8183.dtsi
index ac6b0c12d3b3..452102c4904a 100644
--- a/arch/arm64/boot/dts/mediatek/mt8183.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8183.dtsi
@@ -1332,7 +1332,6 @@
 			power-domains = <&spm MT8183_POWER_DOMAIN_DISP>;
 			clocks = <&mmsys CLK_MM_DISP_OVL0>;
 			iommus = <&iommu M4U_PORT_DISP_OVL0>;
-			mediatek,larb = <&larb0>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0x8000 0x1000>;
 		};
 
@@ -1343,7 +1342,6 @@
 			power-domains = <&spm MT8183_POWER_DOMAIN_DISP>;
 			clocks = <&mmsys CLK_MM_DISP_OVL0_2L>;
 			iommus = <&iommu M4U_PORT_DISP_2L_OVL0_LARB0>;
-			mediatek,larb = <&larb0>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0x9000 0x1000>;
 		};
 
@@ -1354,7 +1352,6 @@
 			power-domains = <&spm MT8183_POWER_DOMAIN_DISP>;
 			clocks = <&mmsys CLK_MM_DISP_OVL1_2L>;
 			iommus = <&iommu M4U_PORT_DISP_2L_OVL1_LARB0>;
-			mediatek,larb = <&larb0>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0xa000 0x1000>;
 		};
 
@@ -1365,7 +1362,6 @@
 			power-domains = <&spm MT8183_POWER_DOMAIN_DISP>;
 			clocks = <&mmsys CLK_MM_DISP_RDMA0>;
 			iommus = <&iommu M4U_PORT_DISP_RDMA0>;
-			mediatek,larb = <&larb0>;
 			mediatek,rdma-fifo-size = <5120>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0xb000 0x1000>;
 		};
@@ -1377,7 +1373,6 @@
 			power-domains = <&spm MT8183_POWER_DOMAIN_DISP>;
 			clocks = <&mmsys CLK_MM_DISP_RDMA1>;
 			iommus = <&iommu M4U_PORT_DISP_RDMA1>;
-			mediatek,larb = <&larb0>;
 			mediatek,rdma-fifo-size = <2048>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0xc000 0x1000>;
 		};
@@ -1534,7 +1529,6 @@
 			compatible = "mediatek,mt8183-jpgenc", "mediatek,mtk-jpgenc";
 			reg = <0 0x17030000 0 0x1000>;
 			interrupts = <GIC_SPI 249 IRQ_TYPE_LEVEL_LOW>;
-			mediatek,larb = <&larb4>;
 			iommus = <&iommu M4U_PORT_JPGENC_RDMA>,
 				 <&iommu M4U_PORT_JPGENC_BSDMA>;
 			power-domains = <&spm MT8183_POWER_DOMAIN_VENC>;
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 13/13] arm64: dts: mediatek: Get rid of mediatek,larb for MM nodes
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Evan Green, Robin Murphy, Tomasz Figa, Will Deacon,
	linux-mediatek, srv_heupstream, devicetree, linux-kernel,
	linux-arm-kernel, iommu, yong.wu, youlin.pei, Matthias Kaehlcke,
	anan.sun, yi.kuo, acourbot, linux-media, dri-devel,
	Daniel Vetter, Chun-Kuang Hu, Philipp Zabel, Tiffany Lin,
	Dafna Hirschfeld, Hsin-Yi Wang, Eizan Miyamoto, anthony.huang,
	Frank Wunderlich, mingyuan.ma, yf.wang, libo.kang,
	AngeloGioacchino Del Regno

After adding device_link between the IOMMU consumer and smi,
the mediatek,larb is unnecessary now.

CC: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Evan Green <evgreen@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 arch/arm64/boot/dts/mediatek/mt8173.dtsi | 16 ----------------
 arch/arm64/boot/dts/mediatek/mt8183.dtsi |  6 ------
 2 files changed, 22 deletions(-)

diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
index dee66e5f054c..417e82891a70 100644
--- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
@@ -1010,7 +1010,6 @@
 				 <&mmsys CLK_MM_MUTEX_32K>;
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			iommus = <&iommu M4U_PORT_MDP_RDMA0>;
-			mediatek,larb = <&larb0>;
 			mediatek,vpu = <&vpu>;
 		};
 
@@ -1021,7 +1020,6 @@
 				 <&mmsys CLK_MM_MUTEX_32K>;
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			iommus = <&iommu M4U_PORT_MDP_RDMA1>;
-			mediatek,larb = <&larb4>;
 		};
 
 		mdp_rsz0: rsz@14003000 {
@@ -1051,7 +1049,6 @@
 			clocks = <&mmsys CLK_MM_MDP_WDMA>;
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			iommus = <&iommu M4U_PORT_MDP_WDMA>;
-			mediatek,larb = <&larb0>;
 		};
 
 		mdp_wrot0: wrot@14007000 {
@@ -1060,7 +1057,6 @@
 			clocks = <&mmsys CLK_MM_MDP_WROT0>;
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			iommus = <&iommu M4U_PORT_MDP_WROT0>;
-			mediatek,larb = <&larb0>;
 		};
 
 		mdp_wrot1: wrot@14008000 {
@@ -1069,7 +1065,6 @@
 			clocks = <&mmsys CLK_MM_MDP_WROT1>;
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			iommus = <&iommu M4U_PORT_MDP_WROT1>;
-			mediatek,larb = <&larb4>;
 		};
 
 		ovl0: ovl@1400c000 {
@@ -1079,7 +1074,6 @@
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			clocks = <&mmsys CLK_MM_DISP_OVL0>;
 			iommus = <&iommu M4U_PORT_DISP_OVL0>;
-			mediatek,larb = <&larb0>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0xc000 0x1000>;
 		};
 
@@ -1090,7 +1084,6 @@
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			clocks = <&mmsys CLK_MM_DISP_OVL1>;
 			iommus = <&iommu M4U_PORT_DISP_OVL1>;
-			mediatek,larb = <&larb4>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0xd000 0x1000>;
 		};
 
@@ -1101,7 +1094,6 @@
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			clocks = <&mmsys CLK_MM_DISP_RDMA0>;
 			iommus = <&iommu M4U_PORT_DISP_RDMA0>;
-			mediatek,larb = <&larb0>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0xe000 0x1000>;
 		};
 
@@ -1112,7 +1104,6 @@
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			clocks = <&mmsys CLK_MM_DISP_RDMA1>;
 			iommus = <&iommu M4U_PORT_DISP_RDMA1>;
-			mediatek,larb = <&larb4>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0xf000 0x1000>;
 		};
 
@@ -1123,7 +1114,6 @@
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			clocks = <&mmsys CLK_MM_DISP_RDMA2>;
 			iommus = <&iommu M4U_PORT_DISP_RDMA2>;
-			mediatek,larb = <&larb4>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1401XXXX 0 0x1000>;
 		};
 
@@ -1134,7 +1124,6 @@
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			clocks = <&mmsys CLK_MM_DISP_WDMA0>;
 			iommus = <&iommu M4U_PORT_DISP_WDMA0>;
-			mediatek,larb = <&larb0>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1401XXXX 0x1000 0x1000>;
 		};
 
@@ -1145,7 +1134,6 @@
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			clocks = <&mmsys CLK_MM_DISP_WDMA1>;
 			iommus = <&iommu M4U_PORT_DISP_WDMA1>;
-			mediatek,larb = <&larb4>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1401XXXX 0x2000 0x1000>;
 		};
 
@@ -1397,7 +1385,6 @@
 			      <0 0x16027800 0 0x800>,	/* VDEC_HWB */
 			      <0 0x16028400 0 0x400>;	/* VDEC_HWG */
 			interrupts = <GIC_SPI 204 IRQ_TYPE_LEVEL_LOW>;
-			mediatek,larb = <&larb1>;
 			iommus = <&iommu M4U_PORT_HW_VDEC_MC_EXT>,
 				 <&iommu M4U_PORT_HW_VDEC_PP_EXT>,
 				 <&iommu M4U_PORT_HW_VDEC_AVC_MV_EXT>,
@@ -1465,7 +1452,6 @@
 			compatible = "mediatek,mt8173-vcodec-enc";
 			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>,
@@ -1493,7 +1479,6 @@
 			clock-names = "jpgdec-smi",
 				      "jpgdec";
 			power-domains = <&spm MT8173_POWER_DOMAIN_VENC>;
-			mediatek,larb = <&larb3>;
 			iommus = <&iommu M4U_PORT_JPGDEC_WDMA>,
 				 <&iommu M4U_PORT_JPGDEC_BSDMA>;
 		};
@@ -1527,7 +1512,6 @@
 				 <&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";
diff --git a/arch/arm64/boot/dts/mediatek/mt8183.dtsi b/arch/arm64/boot/dts/mediatek/mt8183.dtsi
index ac6b0c12d3b3..452102c4904a 100644
--- a/arch/arm64/boot/dts/mediatek/mt8183.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8183.dtsi
@@ -1332,7 +1332,6 @@
 			power-domains = <&spm MT8183_POWER_DOMAIN_DISP>;
 			clocks = <&mmsys CLK_MM_DISP_OVL0>;
 			iommus = <&iommu M4U_PORT_DISP_OVL0>;
-			mediatek,larb = <&larb0>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0x8000 0x1000>;
 		};
 
@@ -1343,7 +1342,6 @@
 			power-domains = <&spm MT8183_POWER_DOMAIN_DISP>;
 			clocks = <&mmsys CLK_MM_DISP_OVL0_2L>;
 			iommus = <&iommu M4U_PORT_DISP_2L_OVL0_LARB0>;
-			mediatek,larb = <&larb0>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0x9000 0x1000>;
 		};
 
@@ -1354,7 +1352,6 @@
 			power-domains = <&spm MT8183_POWER_DOMAIN_DISP>;
 			clocks = <&mmsys CLK_MM_DISP_OVL1_2L>;
 			iommus = <&iommu M4U_PORT_DISP_2L_OVL1_LARB0>;
-			mediatek,larb = <&larb0>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0xa000 0x1000>;
 		};
 
@@ -1365,7 +1362,6 @@
 			power-domains = <&spm MT8183_POWER_DOMAIN_DISP>;
 			clocks = <&mmsys CLK_MM_DISP_RDMA0>;
 			iommus = <&iommu M4U_PORT_DISP_RDMA0>;
-			mediatek,larb = <&larb0>;
 			mediatek,rdma-fifo-size = <5120>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0xb000 0x1000>;
 		};
@@ -1377,7 +1373,6 @@
 			power-domains = <&spm MT8183_POWER_DOMAIN_DISP>;
 			clocks = <&mmsys CLK_MM_DISP_RDMA1>;
 			iommus = <&iommu M4U_PORT_DISP_RDMA1>;
-			mediatek,larb = <&larb0>;
 			mediatek,rdma-fifo-size = <2048>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0xc000 0x1000>;
 		};
@@ -1534,7 +1529,6 @@
 			compatible = "mediatek,mt8183-jpgenc", "mediatek,mtk-jpgenc";
 			reg = <0 0x17030000 0 0x1000>;
 			interrupts = <GIC_SPI 249 IRQ_TYPE_LEVEL_LOW>;
-			mediatek,larb = <&larb4>;
 			iommus = <&iommu M4U_PORT_JPGENC_RDMA>,
 				 <&iommu M4U_PORT_JPGENC_BSDMA>;
 			power-domains = <&spm MT8183_POWER_DOMAIN_VENC>;
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 13/13] arm64: dts: mediatek: Get rid of mediatek, larb for MM nodes
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Dafna Hirschfeld, Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang,
	anthony.huang, youlin.pei, Evan Green, Eizan Miyamoto,
	Matthias Kaehlcke, linux-arm-kernel, mingyuan.ma, linux-media,
	devicetree, Philipp Zabel, libo.kang, yi.kuo, linux-mediatek,
	Hsin-Yi Wang, Tiffany Lin, yong.wu, AngeloGioacchino Del Regno,
	anan.sun, srv_heupstream, acourbot, linux-kernel, Tomasz Figa,
	iommu, Daniel Vetter, Robin Murphy

After adding device_link between the IOMMU consumer and smi,
the mediatek,larb is unnecessary now.

CC: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Evan Green <evgreen@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 arch/arm64/boot/dts/mediatek/mt8173.dtsi | 16 ----------------
 arch/arm64/boot/dts/mediatek/mt8183.dtsi |  6 ------
 2 files changed, 22 deletions(-)

diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
index dee66e5f054c..417e82891a70 100644
--- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
@@ -1010,7 +1010,6 @@
 				 <&mmsys CLK_MM_MUTEX_32K>;
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			iommus = <&iommu M4U_PORT_MDP_RDMA0>;
-			mediatek,larb = <&larb0>;
 			mediatek,vpu = <&vpu>;
 		};
 
@@ -1021,7 +1020,6 @@
 				 <&mmsys CLK_MM_MUTEX_32K>;
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			iommus = <&iommu M4U_PORT_MDP_RDMA1>;
-			mediatek,larb = <&larb4>;
 		};
 
 		mdp_rsz0: rsz@14003000 {
@@ -1051,7 +1049,6 @@
 			clocks = <&mmsys CLK_MM_MDP_WDMA>;
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			iommus = <&iommu M4U_PORT_MDP_WDMA>;
-			mediatek,larb = <&larb0>;
 		};
 
 		mdp_wrot0: wrot@14007000 {
@@ -1060,7 +1057,6 @@
 			clocks = <&mmsys CLK_MM_MDP_WROT0>;
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			iommus = <&iommu M4U_PORT_MDP_WROT0>;
-			mediatek,larb = <&larb0>;
 		};
 
 		mdp_wrot1: wrot@14008000 {
@@ -1069,7 +1065,6 @@
 			clocks = <&mmsys CLK_MM_MDP_WROT1>;
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			iommus = <&iommu M4U_PORT_MDP_WROT1>;
-			mediatek,larb = <&larb4>;
 		};
 
 		ovl0: ovl@1400c000 {
@@ -1079,7 +1074,6 @@
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			clocks = <&mmsys CLK_MM_DISP_OVL0>;
 			iommus = <&iommu M4U_PORT_DISP_OVL0>;
-			mediatek,larb = <&larb0>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0xc000 0x1000>;
 		};
 
@@ -1090,7 +1084,6 @@
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			clocks = <&mmsys CLK_MM_DISP_OVL1>;
 			iommus = <&iommu M4U_PORT_DISP_OVL1>;
-			mediatek,larb = <&larb4>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0xd000 0x1000>;
 		};
 
@@ -1101,7 +1094,6 @@
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			clocks = <&mmsys CLK_MM_DISP_RDMA0>;
 			iommus = <&iommu M4U_PORT_DISP_RDMA0>;
-			mediatek,larb = <&larb0>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0xe000 0x1000>;
 		};
 
@@ -1112,7 +1104,6 @@
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			clocks = <&mmsys CLK_MM_DISP_RDMA1>;
 			iommus = <&iommu M4U_PORT_DISP_RDMA1>;
-			mediatek,larb = <&larb4>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0xf000 0x1000>;
 		};
 
@@ -1123,7 +1114,6 @@
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			clocks = <&mmsys CLK_MM_DISP_RDMA2>;
 			iommus = <&iommu M4U_PORT_DISP_RDMA2>;
-			mediatek,larb = <&larb4>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1401XXXX 0 0x1000>;
 		};
 
@@ -1134,7 +1124,6 @@
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			clocks = <&mmsys CLK_MM_DISP_WDMA0>;
 			iommus = <&iommu M4U_PORT_DISP_WDMA0>;
-			mediatek,larb = <&larb0>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1401XXXX 0x1000 0x1000>;
 		};
 
@@ -1145,7 +1134,6 @@
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			clocks = <&mmsys CLK_MM_DISP_WDMA1>;
 			iommus = <&iommu M4U_PORT_DISP_WDMA1>;
-			mediatek,larb = <&larb4>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1401XXXX 0x2000 0x1000>;
 		};
 
@@ -1397,7 +1385,6 @@
 			      <0 0x16027800 0 0x800>,	/* VDEC_HWB */
 			      <0 0x16028400 0 0x400>;	/* VDEC_HWG */
 			interrupts = <GIC_SPI 204 IRQ_TYPE_LEVEL_LOW>;
-			mediatek,larb = <&larb1>;
 			iommus = <&iommu M4U_PORT_HW_VDEC_MC_EXT>,
 				 <&iommu M4U_PORT_HW_VDEC_PP_EXT>,
 				 <&iommu M4U_PORT_HW_VDEC_AVC_MV_EXT>,
@@ -1465,7 +1452,6 @@
 			compatible = "mediatek,mt8173-vcodec-enc";
 			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>,
@@ -1493,7 +1479,6 @@
 			clock-names = "jpgdec-smi",
 				      "jpgdec";
 			power-domains = <&spm MT8173_POWER_DOMAIN_VENC>;
-			mediatek,larb = <&larb3>;
 			iommus = <&iommu M4U_PORT_JPGDEC_WDMA>,
 				 <&iommu M4U_PORT_JPGDEC_BSDMA>;
 		};
@@ -1527,7 +1512,6 @@
 				 <&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";
diff --git a/arch/arm64/boot/dts/mediatek/mt8183.dtsi b/arch/arm64/boot/dts/mediatek/mt8183.dtsi
index ac6b0c12d3b3..452102c4904a 100644
--- a/arch/arm64/boot/dts/mediatek/mt8183.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8183.dtsi
@@ -1332,7 +1332,6 @@
 			power-domains = <&spm MT8183_POWER_DOMAIN_DISP>;
 			clocks = <&mmsys CLK_MM_DISP_OVL0>;
 			iommus = <&iommu M4U_PORT_DISP_OVL0>;
-			mediatek,larb = <&larb0>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0x8000 0x1000>;
 		};
 
@@ -1343,7 +1342,6 @@
 			power-domains = <&spm MT8183_POWER_DOMAIN_DISP>;
 			clocks = <&mmsys CLK_MM_DISP_OVL0_2L>;
 			iommus = <&iommu M4U_PORT_DISP_2L_OVL0_LARB0>;
-			mediatek,larb = <&larb0>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0x9000 0x1000>;
 		};
 
@@ -1354,7 +1352,6 @@
 			power-domains = <&spm MT8183_POWER_DOMAIN_DISP>;
 			clocks = <&mmsys CLK_MM_DISP_OVL1_2L>;
 			iommus = <&iommu M4U_PORT_DISP_2L_OVL1_LARB0>;
-			mediatek,larb = <&larb0>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0xa000 0x1000>;
 		};
 
@@ -1365,7 +1362,6 @@
 			power-domains = <&spm MT8183_POWER_DOMAIN_DISP>;
 			clocks = <&mmsys CLK_MM_DISP_RDMA0>;
 			iommus = <&iommu M4U_PORT_DISP_RDMA0>;
-			mediatek,larb = <&larb0>;
 			mediatek,rdma-fifo-size = <5120>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0xb000 0x1000>;
 		};
@@ -1377,7 +1373,6 @@
 			power-domains = <&spm MT8183_POWER_DOMAIN_DISP>;
 			clocks = <&mmsys CLK_MM_DISP_RDMA1>;
 			iommus = <&iommu M4U_PORT_DISP_RDMA1>;
-			mediatek,larb = <&larb0>;
 			mediatek,rdma-fifo-size = <2048>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0xc000 0x1000>;
 		};
@@ -1534,7 +1529,6 @@
 			compatible = "mediatek,mt8183-jpgenc", "mediatek,mtk-jpgenc";
 			reg = <0 0x17030000 0 0x1000>;
 			interrupts = <GIC_SPI 249 IRQ_TYPE_LEVEL_LOW>;
-			mediatek,larb = <&larb4>;
 			iommus = <&iommu M4U_PORT_JPGENC_RDMA>,
 				 <&iommu M4U_PORT_JPGENC_BSDMA>;
 			power-domains = <&spm MT8183_POWER_DOMAIN_VENC>;
-- 
2.18.0


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply related	[flat|nested] 105+ messages in thread

* [PATCH v10 13/13] arm64: dts: mediatek: Get rid of mediatek, larb for MM nodes
@ 2022-01-17  7:05   ` Yong Wu
  0 siblings, 0 replies; 105+ messages in thread
From: Yong Wu @ 2022-01-17  7:05 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil, Joerg Roedel, Rob Herring,
	Krzysztof Kozlowski, David Airlie, Mauro Carvalho Chehab
  Cc: Evan Green, Robin Murphy, Tomasz Figa, Will Deacon,
	linux-mediatek, srv_heupstream, devicetree, linux-kernel,
	linux-arm-kernel, iommu, yong.wu, youlin.pei, Matthias Kaehlcke,
	anan.sun, yi.kuo, acourbot, linux-media, dri-devel,
	Daniel Vetter, Chun-Kuang Hu, Philipp Zabel, Tiffany Lin,
	Dafna Hirschfeld, Hsin-Yi Wang, Eizan Miyamoto, anthony.huang,
	Frank Wunderlich, mingyuan.ma, yf.wang, libo.kang,
	AngeloGioacchino Del Regno

After adding device_link between the IOMMU consumer and smi,
the mediatek,larb is unnecessary now.

CC: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Evan Green <evgreen@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 arch/arm64/boot/dts/mediatek/mt8173.dtsi | 16 ----------------
 arch/arm64/boot/dts/mediatek/mt8183.dtsi |  6 ------
 2 files changed, 22 deletions(-)

diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
index dee66e5f054c..417e82891a70 100644
--- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
@@ -1010,7 +1010,6 @@
 				 <&mmsys CLK_MM_MUTEX_32K>;
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			iommus = <&iommu M4U_PORT_MDP_RDMA0>;
-			mediatek,larb = <&larb0>;
 			mediatek,vpu = <&vpu>;
 		};
 
@@ -1021,7 +1020,6 @@
 				 <&mmsys CLK_MM_MUTEX_32K>;
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			iommus = <&iommu M4U_PORT_MDP_RDMA1>;
-			mediatek,larb = <&larb4>;
 		};
 
 		mdp_rsz0: rsz@14003000 {
@@ -1051,7 +1049,6 @@
 			clocks = <&mmsys CLK_MM_MDP_WDMA>;
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			iommus = <&iommu M4U_PORT_MDP_WDMA>;
-			mediatek,larb = <&larb0>;
 		};
 
 		mdp_wrot0: wrot@14007000 {
@@ -1060,7 +1057,6 @@
 			clocks = <&mmsys CLK_MM_MDP_WROT0>;
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			iommus = <&iommu M4U_PORT_MDP_WROT0>;
-			mediatek,larb = <&larb0>;
 		};
 
 		mdp_wrot1: wrot@14008000 {
@@ -1069,7 +1065,6 @@
 			clocks = <&mmsys CLK_MM_MDP_WROT1>;
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			iommus = <&iommu M4U_PORT_MDP_WROT1>;
-			mediatek,larb = <&larb4>;
 		};
 
 		ovl0: ovl@1400c000 {
@@ -1079,7 +1074,6 @@
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			clocks = <&mmsys CLK_MM_DISP_OVL0>;
 			iommus = <&iommu M4U_PORT_DISP_OVL0>;
-			mediatek,larb = <&larb0>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0xc000 0x1000>;
 		};
 
@@ -1090,7 +1084,6 @@
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			clocks = <&mmsys CLK_MM_DISP_OVL1>;
 			iommus = <&iommu M4U_PORT_DISP_OVL1>;
-			mediatek,larb = <&larb4>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0xd000 0x1000>;
 		};
 
@@ -1101,7 +1094,6 @@
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			clocks = <&mmsys CLK_MM_DISP_RDMA0>;
 			iommus = <&iommu M4U_PORT_DISP_RDMA0>;
-			mediatek,larb = <&larb0>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0xe000 0x1000>;
 		};
 
@@ -1112,7 +1104,6 @@
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			clocks = <&mmsys CLK_MM_DISP_RDMA1>;
 			iommus = <&iommu M4U_PORT_DISP_RDMA1>;
-			mediatek,larb = <&larb4>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0xf000 0x1000>;
 		};
 
@@ -1123,7 +1114,6 @@
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			clocks = <&mmsys CLK_MM_DISP_RDMA2>;
 			iommus = <&iommu M4U_PORT_DISP_RDMA2>;
-			mediatek,larb = <&larb4>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1401XXXX 0 0x1000>;
 		};
 
@@ -1134,7 +1124,6 @@
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			clocks = <&mmsys CLK_MM_DISP_WDMA0>;
 			iommus = <&iommu M4U_PORT_DISP_WDMA0>;
-			mediatek,larb = <&larb0>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1401XXXX 0x1000 0x1000>;
 		};
 
@@ -1145,7 +1134,6 @@
 			power-domains = <&spm MT8173_POWER_DOMAIN_MM>;
 			clocks = <&mmsys CLK_MM_DISP_WDMA1>;
 			iommus = <&iommu M4U_PORT_DISP_WDMA1>;
-			mediatek,larb = <&larb4>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1401XXXX 0x2000 0x1000>;
 		};
 
@@ -1397,7 +1385,6 @@
 			      <0 0x16027800 0 0x800>,	/* VDEC_HWB */
 			      <0 0x16028400 0 0x400>;	/* VDEC_HWG */
 			interrupts = <GIC_SPI 204 IRQ_TYPE_LEVEL_LOW>;
-			mediatek,larb = <&larb1>;
 			iommus = <&iommu M4U_PORT_HW_VDEC_MC_EXT>,
 				 <&iommu M4U_PORT_HW_VDEC_PP_EXT>,
 				 <&iommu M4U_PORT_HW_VDEC_AVC_MV_EXT>,
@@ -1465,7 +1452,6 @@
 			compatible = "mediatek,mt8173-vcodec-enc";
 			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>,
@@ -1493,7 +1479,6 @@
 			clock-names = "jpgdec-smi",
 				      "jpgdec";
 			power-domains = <&spm MT8173_POWER_DOMAIN_VENC>;
-			mediatek,larb = <&larb3>;
 			iommus = <&iommu M4U_PORT_JPGDEC_WDMA>,
 				 <&iommu M4U_PORT_JPGDEC_BSDMA>;
 		};
@@ -1527,7 +1512,6 @@
 				 <&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";
diff --git a/arch/arm64/boot/dts/mediatek/mt8183.dtsi b/arch/arm64/boot/dts/mediatek/mt8183.dtsi
index ac6b0c12d3b3..452102c4904a 100644
--- a/arch/arm64/boot/dts/mediatek/mt8183.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8183.dtsi
@@ -1332,7 +1332,6 @@
 			power-domains = <&spm MT8183_POWER_DOMAIN_DISP>;
 			clocks = <&mmsys CLK_MM_DISP_OVL0>;
 			iommus = <&iommu M4U_PORT_DISP_OVL0>;
-			mediatek,larb = <&larb0>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0x8000 0x1000>;
 		};
 
@@ -1343,7 +1342,6 @@
 			power-domains = <&spm MT8183_POWER_DOMAIN_DISP>;
 			clocks = <&mmsys CLK_MM_DISP_OVL0_2L>;
 			iommus = <&iommu M4U_PORT_DISP_2L_OVL0_LARB0>;
-			mediatek,larb = <&larb0>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0x9000 0x1000>;
 		};
 
@@ -1354,7 +1352,6 @@
 			power-domains = <&spm MT8183_POWER_DOMAIN_DISP>;
 			clocks = <&mmsys CLK_MM_DISP_OVL1_2L>;
 			iommus = <&iommu M4U_PORT_DISP_2L_OVL1_LARB0>;
-			mediatek,larb = <&larb0>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0xa000 0x1000>;
 		};
 
@@ -1365,7 +1362,6 @@
 			power-domains = <&spm MT8183_POWER_DOMAIN_DISP>;
 			clocks = <&mmsys CLK_MM_DISP_RDMA0>;
 			iommus = <&iommu M4U_PORT_DISP_RDMA0>;
-			mediatek,larb = <&larb0>;
 			mediatek,rdma-fifo-size = <5120>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0xb000 0x1000>;
 		};
@@ -1377,7 +1373,6 @@
 			power-domains = <&spm MT8183_POWER_DOMAIN_DISP>;
 			clocks = <&mmsys CLK_MM_DISP_RDMA1>;
 			iommus = <&iommu M4U_PORT_DISP_RDMA1>;
-			mediatek,larb = <&larb0>;
 			mediatek,rdma-fifo-size = <2048>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0xc000 0x1000>;
 		};
@@ -1534,7 +1529,6 @@
 			compatible = "mediatek,mt8183-jpgenc", "mediatek,mtk-jpgenc";
 			reg = <0 0x17030000 0 0x1000>;
 			interrupts = <GIC_SPI 249 IRQ_TYPE_LEVEL_LOW>;
-			mediatek,larb = <&larb4>;
 			iommus = <&iommu M4U_PORT_JPGENC_RDMA>,
 				 <&iommu M4U_PORT_JPGENC_BSDMA>;
 			power-domains = <&spm MT8183_POWER_DOMAIN_VENC>;
-- 
2.18.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 105+ messages in thread

* Re: [PATCH v10 00/13] Clean up "mediatek,larb"
  2022-01-17  7:04 ` Yong Wu
                     ` (2 preceding siblings ...)
  (?)
@ 2022-01-17 10:27   ` AngeloGioacchino Del Regno
  -1 siblings, 0 replies; 105+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-01-17 10:27 UTC (permalink / raw)
  To: Yong Wu, Matthias Brugger, Hans Verkuil, Joerg Roedel,
	Rob Herring, Krzysztof Kozlowski, David Airlie,
	Mauro Carvalho Chehab
  Cc: Evan Green, Robin Murphy, Tomasz Figa, Will Deacon,
	linux-mediatek, srv_heupstream, devicetree, linux-kernel,
	linux-arm-kernel, iommu, youlin.pei, Matthias Kaehlcke, anan.sun,
	yi.kuo, acourbot, linux-media, dri-devel, Daniel Vetter,
	Chun-Kuang Hu, Philipp Zabel, Tiffany Lin, Dafna Hirschfeld,
	Hsin-Yi Wang, Eizan Miyamoto, anthony.huang, Frank Wunderlich,
	mingyuan.ma, yf.wang, libo.kang

Il 17/01/22 08:04, Yong Wu ha scritto:
> MediaTek IOMMU block diagram always like below:
> 
>          M4U
>           |
>      smi-common
>           |
>    -------------
>    |         |  ...
>    |         |
> larb1     larb2
>    |         |
> vdec       venc
> 
> All the consumer connect with smi-larb, then connect with smi-common.
> 
> When the consumer works, it should enable the smi-larb's power which also
> need enable the smi-common's power firstly.
> 
> Thus, Firstly, use the device link connect the consumer and the
> smi-larbs. then add device link between the smi-larb and smi-common.
> 
> After adding the device_link, then "mediatek,larb" property can be removed.
> the iommu consumer don't need call the mtk_smi_larb_get/put to enable
> the power and clock of smi-larb and smi-common.
> 
> Base on the media branch [1] and a jpeg dtbinding patchset[2] that already got
> the necessary R-b.
> 
> [1] git://linuxtv.org/hverkuil/media_tree.git tags/br-v5.18d
> [2] https://lore.kernel.org/linux-mediatek/20211206130425.184420-1-hsinyi@chromium.org/
> 
> Change notes:
> v10: a) Rebase on the media tree. Respin the "media: mtk-vcodec:" patches.
>       b) Add Joerg's Ack for iommu patches.
> 
> v9: https://lore.kernel.org/linux-mediatek/20211112105509.12010-1-yong.wu@mediatek.com/
>      1) Add return -ENODEV when the dev is null.
>      2) Add more strict about the case that a iommu consume device use the ports in
>      different larbs. Don't allow this case.
>      3) Remove two codec interface: mtk_vcodec_release_enc/dec_pm since it only has one
>      line now.
> 
> v8: https://lore.kernel.org/linux-mediatek/20210929013719.25120-1-yong.wu@mediatek.com/
>      1) Rebase on v5.15-rc1.
>      2) Don't rebase the below mdp patchset that may still need more discuss.
>      https://lore.kernel.org/linux-mediatek/20210709022324.1607884-1-eizan@chromium.org/
>      3) Add Frank's Tested-by. Remove Dafna's Tested-by as he requested.
> 
> v7: https://lore.kernel.org/linux-mediatek/20210730025238.22456-1-yong.wu@mediatek.com/
>      1) Fix a arm32 boot fail issue. reported from Frank.
>      2) Add a return fail in the mtk drm. suggested by Dafna.
> 
> v6: https://lore.kernel.org/linux-mediatek/20210714025626.5528-1-yong.wu@mediatek.com/
>      1) rebase on v5.14-rc1.
>      2) Fix the issue commented in v5 from Dafna and Hsin-Yi.
>      3) Remove the patches about using pm_runtime_resume_and_get since they have
>         already been merged by other patches.
> 
> v5: https://lore.kernel.org/linux-mediatek/20210410091128.31823-1-yong.wu@mediatek.com/
>      1) Base v5.12-rc2.
>      2) Remove changing the mtk-iommu to module_platform_driver patch, It have already been a
>      independent patch.
> 
> v4: https://lore.kernel.org/linux-mediatek/1590826218-23653-1-git-send-email-yong.wu@mediatek.com/
>      base on v5.7-rc1.
>    1) Move drm PM patch before smi patchs.
>    2) Change builtin_platform_driver to module_platform_driver since we may need
>       build as module.
>    3) Rebase many patchset as above.
> 
> v3: https://lore.kernel.org/linux-iommu/1567503456-24725-1-git-send-email-yong.wu@mediatek.com/
>      1) rebase on v5.3-rc1 and the latest mt8183 patchset.
>      2) Use device_is_bound to check whether the driver is ready from Matthias.
>      3) Add DL_FLAG_STATELESS flag when calling device_link_add and explain the
>     reason in the commit message[3/14].
>      4) Add a display patch[12/14] into this series. otherwise it may affect
>     display HW fastlogo even though it don't happen in mt8183.
>     
> v2: https://lore.kernel.org/linux-iommu/1560171313-28299-1-git-send-email-yong.wu@mediatek.com/
>     1) rebase on v5.2-rc1.
>     2) Move adding device_link between the consumer and smi-larb into
> iommu_add_device from Robin.
>     3) add DL_FLAG_AUTOREMOVE_CONSUMER even though the smi is built-in from Evan.
>     4) Remove the shutdown callback in iommu.
> 
> v1: https://lore.kernel.org/linux-iommu/1546318276-18993-1-git-send-email-yong.wu@mediatek.com/
> 
> Yong Wu (12):
>    dt-binding: mediatek: Get rid of mediatek,larb for multimedia HW
>    iommu/mediatek-v1: Free the existed fwspec if the master dev already
>      has
>    iommu/mediatek: Return ENODEV if the device is NULL
>    iommu/mediatek: Add probe_defer for smi-larb
>    iommu/mediatek: Add device_link between the consumer and the larb
>      devices
>    media: mtk-jpeg: Get rid of mtk_smi_larb_get/put
>    media: mtk-mdp: Get rid of mtk_smi_larb_get/put
>    drm/mediatek: Get rid of mtk_smi_larb_get/put
>    media: mtk-vcodec: Get rid of mtk_smi_larb_get/put
>    memory: mtk-smi: Get rid of mtk_smi_larb_get/put
>    arm: dts: mediatek: Get rid of mediatek,larb for MM nodes
>    arm64: dts: mediatek: Get rid of mediatek,larb for MM nodes
> 
> Yongqiang Niu (1):
>    drm/mediatek: Add pm runtime support for ovl and rdma
> 
>   .../display/mediatek/mediatek,disp.txt        |  9 ----
>   .../media/mediatek,vcodec-decoder.yaml        |  7 ---
>   .../media/mediatek,vcodec-encoder.yaml        |  8 ----
>   .../bindings/media/mediatek-jpeg-decoder.yaml |  9 ----
>   .../bindings/media/mediatek-jpeg-encoder.yaml |  9 ----
>   .../bindings/media/mediatek-mdp.txt           |  8 ----
>   arch/arm/boot/dts/mt2701.dtsi                 |  2 -
>   arch/arm/boot/dts/mt7623n.dtsi                |  5 ---
>   arch/arm64/boot/dts/mediatek/mt8173.dtsi      | 16 -------
>   arch/arm64/boot/dts/mediatek/mt8183.dtsi      |  6 ---
>   drivers/gpu/drm/mediatek/mtk_disp_ovl.c       |  8 +++-
>   drivers/gpu/drm/mediatek/mtk_disp_rdma.c      |  9 +++-
>   drivers/gpu/drm/mediatek/mtk_drm_crtc.c       | 15 ++++---
>   drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c   | 36 +--------------
>   drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h   |  1 -
>   drivers/gpu/drm/mediatek/mtk_drm_drv.c        |  5 +--
>   drivers/iommu/mtk_iommu.c                     | 34 ++++++++++++++
>   drivers/iommu/mtk_iommu_v1.c                  | 42 ++++++++++++++++-
>   .../media/platform/mtk-jpeg/mtk_jpeg_core.c   | 45 +------------------
>   .../media/platform/mtk-jpeg/mtk_jpeg_core.h   |  2 -
>   drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 40 -----------------
>   drivers/media/platform/mtk-mdp/mtk_mdp_comp.h |  2 -
>   drivers/media/platform/mtk-mdp/mtk_mdp_core.c |  1 -
>   .../platform/mtk-vcodec/mtk_vcodec_dec_drv.c  |  2 -
>   .../platform/mtk-vcodec/mtk_vcodec_dec_hw.c   |  1 -
>   .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c   | 41 +++--------------
>   .../platform/mtk-vcodec/mtk_vcodec_drv.h      |  3 --
>   .../platform/mtk-vcodec/mtk_vcodec_enc.c      |  1 -
>   .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c  |  2 -
>   .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c   | 45 +++----------------
>   drivers/memory/mtk-smi.c                      | 14 ------
>   include/soc/mediatek/smi.h                    | 20 ---------
>   32 files changed, 115 insertions(+), 333 deletions(-)
> 

Hello Hans, Matthias,
on my side, this series is totally ready for merge, hence, green light from here.

Can you please take it for 5.18?

Thank you,
Angelo

^ permalink raw reply	[flat|nested] 105+ messages in thread

* Re: [PATCH v10 00/13] Clean up "mediatek,larb"
@ 2022-01-17 10:27   ` AngeloGioacchino Del Regno
  0 siblings, 0 replies; 105+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-01-17 10:27 UTC (permalink / raw)
  To: Yong Wu, Matthias Brugger, Hans Verkuil, Joerg Roedel,
	Rob Herring, Krzysztof Kozlowski, David Airlie,
	Mauro Carvalho Chehab
  Cc: Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang, anthony.huang,
	youlin.pei, Evan Green, Eizan Miyamoto, Matthias Kaehlcke,
	mingyuan.ma, linux-media, devicetree, Philipp Zabel,
	Frank Wunderlich, libo.kang, yi.kuo, linux-mediatek,
	Hsin-Yi Wang, Tiffany Lin, linux-arm-kernel, anan.sun,
	srv_heupstream, acourbot, linux-kernel, iommu, Daniel Vetter,
	Robin Murphy

Il 17/01/22 08:04, Yong Wu ha scritto:
> MediaTek IOMMU block diagram always like below:
> 
>          M4U
>           |
>      smi-common
>           |
>    -------------
>    |         |  ...
>    |         |
> larb1     larb2
>    |         |
> vdec       venc
> 
> All the consumer connect with smi-larb, then connect with smi-common.
> 
> When the consumer works, it should enable the smi-larb's power which also
> need enable the smi-common's power firstly.
> 
> Thus, Firstly, use the device link connect the consumer and the
> smi-larbs. then add device link between the smi-larb and smi-common.
> 
> After adding the device_link, then "mediatek,larb" property can be removed.
> the iommu consumer don't need call the mtk_smi_larb_get/put to enable
> the power and clock of smi-larb and smi-common.
> 
> Base on the media branch [1] and a jpeg dtbinding patchset[2] that already got
> the necessary R-b.
> 
> [1] git://linuxtv.org/hverkuil/media_tree.git tags/br-v5.18d
> [2] https://lore.kernel.org/linux-mediatek/20211206130425.184420-1-hsinyi@chromium.org/
> 
> Change notes:
> v10: a) Rebase on the media tree. Respin the "media: mtk-vcodec:" patches.
>       b) Add Joerg's Ack for iommu patches.
> 
> v9: https://lore.kernel.org/linux-mediatek/20211112105509.12010-1-yong.wu@mediatek.com/
>      1) Add return -ENODEV when the dev is null.
>      2) Add more strict about the case that a iommu consume device use the ports in
>      different larbs. Don't allow this case.
>      3) Remove two codec interface: mtk_vcodec_release_enc/dec_pm since it only has one
>      line now.
> 
> v8: https://lore.kernel.org/linux-mediatek/20210929013719.25120-1-yong.wu@mediatek.com/
>      1) Rebase on v5.15-rc1.
>      2) Don't rebase the below mdp patchset that may still need more discuss.
>      https://lore.kernel.org/linux-mediatek/20210709022324.1607884-1-eizan@chromium.org/
>      3) Add Frank's Tested-by. Remove Dafna's Tested-by as he requested.
> 
> v7: https://lore.kernel.org/linux-mediatek/20210730025238.22456-1-yong.wu@mediatek.com/
>      1) Fix a arm32 boot fail issue. reported from Frank.
>      2) Add a return fail in the mtk drm. suggested by Dafna.
> 
> v6: https://lore.kernel.org/linux-mediatek/20210714025626.5528-1-yong.wu@mediatek.com/
>      1) rebase on v5.14-rc1.
>      2) Fix the issue commented in v5 from Dafna and Hsin-Yi.
>      3) Remove the patches about using pm_runtime_resume_and_get since they have
>         already been merged by other patches.
> 
> v5: https://lore.kernel.org/linux-mediatek/20210410091128.31823-1-yong.wu@mediatek.com/
>      1) Base v5.12-rc2.
>      2) Remove changing the mtk-iommu to module_platform_driver patch, It have already been a
>      independent patch.
> 
> v4: https://lore.kernel.org/linux-mediatek/1590826218-23653-1-git-send-email-yong.wu@mediatek.com/
>      base on v5.7-rc1.
>    1) Move drm PM patch before smi patchs.
>    2) Change builtin_platform_driver to module_platform_driver since we may need
>       build as module.
>    3) Rebase many patchset as above.
> 
> v3: https://lore.kernel.org/linux-iommu/1567503456-24725-1-git-send-email-yong.wu@mediatek.com/
>      1) rebase on v5.3-rc1 and the latest mt8183 patchset.
>      2) Use device_is_bound to check whether the driver is ready from Matthias.
>      3) Add DL_FLAG_STATELESS flag when calling device_link_add and explain the
>     reason in the commit message[3/14].
>      4) Add a display patch[12/14] into this series. otherwise it may affect
>     display HW fastlogo even though it don't happen in mt8183.
>     
> v2: https://lore.kernel.org/linux-iommu/1560171313-28299-1-git-send-email-yong.wu@mediatek.com/
>     1) rebase on v5.2-rc1.
>     2) Move adding device_link between the consumer and smi-larb into
> iommu_add_device from Robin.
>     3) add DL_FLAG_AUTOREMOVE_CONSUMER even though the smi is built-in from Evan.
>     4) Remove the shutdown callback in iommu.
> 
> v1: https://lore.kernel.org/linux-iommu/1546318276-18993-1-git-send-email-yong.wu@mediatek.com/
> 
> Yong Wu (12):
>    dt-binding: mediatek: Get rid of mediatek,larb for multimedia HW
>    iommu/mediatek-v1: Free the existed fwspec if the master dev already
>      has
>    iommu/mediatek: Return ENODEV if the device is NULL
>    iommu/mediatek: Add probe_defer for smi-larb
>    iommu/mediatek: Add device_link between the consumer and the larb
>      devices
>    media: mtk-jpeg: Get rid of mtk_smi_larb_get/put
>    media: mtk-mdp: Get rid of mtk_smi_larb_get/put
>    drm/mediatek: Get rid of mtk_smi_larb_get/put
>    media: mtk-vcodec: Get rid of mtk_smi_larb_get/put
>    memory: mtk-smi: Get rid of mtk_smi_larb_get/put
>    arm: dts: mediatek: Get rid of mediatek,larb for MM nodes
>    arm64: dts: mediatek: Get rid of mediatek,larb for MM nodes
> 
> Yongqiang Niu (1):
>    drm/mediatek: Add pm runtime support for ovl and rdma
> 
>   .../display/mediatek/mediatek,disp.txt        |  9 ----
>   .../media/mediatek,vcodec-decoder.yaml        |  7 ---
>   .../media/mediatek,vcodec-encoder.yaml        |  8 ----
>   .../bindings/media/mediatek-jpeg-decoder.yaml |  9 ----
>   .../bindings/media/mediatek-jpeg-encoder.yaml |  9 ----
>   .../bindings/media/mediatek-mdp.txt           |  8 ----
>   arch/arm/boot/dts/mt2701.dtsi                 |  2 -
>   arch/arm/boot/dts/mt7623n.dtsi                |  5 ---
>   arch/arm64/boot/dts/mediatek/mt8173.dtsi      | 16 -------
>   arch/arm64/boot/dts/mediatek/mt8183.dtsi      |  6 ---
>   drivers/gpu/drm/mediatek/mtk_disp_ovl.c       |  8 +++-
>   drivers/gpu/drm/mediatek/mtk_disp_rdma.c      |  9 +++-
>   drivers/gpu/drm/mediatek/mtk_drm_crtc.c       | 15 ++++---
>   drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c   | 36 +--------------
>   drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h   |  1 -
>   drivers/gpu/drm/mediatek/mtk_drm_drv.c        |  5 +--
>   drivers/iommu/mtk_iommu.c                     | 34 ++++++++++++++
>   drivers/iommu/mtk_iommu_v1.c                  | 42 ++++++++++++++++-
>   .../media/platform/mtk-jpeg/mtk_jpeg_core.c   | 45 +------------------
>   .../media/platform/mtk-jpeg/mtk_jpeg_core.h   |  2 -
>   drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 40 -----------------
>   drivers/media/platform/mtk-mdp/mtk_mdp_comp.h |  2 -
>   drivers/media/platform/mtk-mdp/mtk_mdp_core.c |  1 -
>   .../platform/mtk-vcodec/mtk_vcodec_dec_drv.c  |  2 -
>   .../platform/mtk-vcodec/mtk_vcodec_dec_hw.c   |  1 -
>   .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c   | 41 +++--------------
>   .../platform/mtk-vcodec/mtk_vcodec_drv.h      |  3 --
>   .../platform/mtk-vcodec/mtk_vcodec_enc.c      |  1 -
>   .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c  |  2 -
>   .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c   | 45 +++----------------
>   drivers/memory/mtk-smi.c                      | 14 ------
>   include/soc/mediatek/smi.h                    | 20 ---------
>   32 files changed, 115 insertions(+), 333 deletions(-)
> 

Hello Hans, Matthias,
on my side, this series is totally ready for merge, hence, green light from here.

Can you please take it for 5.18?

Thank you,
Angelo
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 105+ messages in thread

* Re: [PATCH v10 00/13] Clean up "mediatek,larb"
@ 2022-01-17 10:27   ` AngeloGioacchino Del Regno
  0 siblings, 0 replies; 105+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-01-17 10:27 UTC (permalink / raw)
  To: Yong Wu, Matthias Brugger, Hans Verkuil, Joerg Roedel,
	Rob Herring, Krzysztof Kozlowski, David Airlie,
	Mauro Carvalho Chehab
  Cc: Dafna Hirschfeld, Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang,
	anthony.huang, youlin.pei, Evan Green, Eizan Miyamoto,
	Matthias Kaehlcke, mingyuan.ma, linux-media, devicetree,
	Philipp Zabel, libo.kang, yi.kuo, linux-mediatek, Hsin-Yi Wang,
	Tiffany Lin, linux-arm-kernel, anan.sun, srv_heupstream,
	acourbot, linux-kernel, Tomasz Figa, iommu, Daniel Vetter,
	Robin Murphy

Il 17/01/22 08:04, Yong Wu ha scritto:
> MediaTek IOMMU block diagram always like below:
> 
>          M4U
>           |
>      smi-common
>           |
>    -------------
>    |         |  ...
>    |         |
> larb1     larb2
>    |         |
> vdec       venc
> 
> All the consumer connect with smi-larb, then connect with smi-common.
> 
> When the consumer works, it should enable the smi-larb's power which also
> need enable the smi-common's power firstly.
> 
> Thus, Firstly, use the device link connect the consumer and the
> smi-larbs. then add device link between the smi-larb and smi-common.
> 
> After adding the device_link, then "mediatek,larb" property can be removed.
> the iommu consumer don't need call the mtk_smi_larb_get/put to enable
> the power and clock of smi-larb and smi-common.
> 
> Base on the media branch [1] and a jpeg dtbinding patchset[2] that already got
> the necessary R-b.
> 
> [1] git://linuxtv.org/hverkuil/media_tree.git tags/br-v5.18d
> [2] https://lore.kernel.org/linux-mediatek/20211206130425.184420-1-hsinyi@chromium.org/
> 
> Change notes:
> v10: a) Rebase on the media tree. Respin the "media: mtk-vcodec:" patches.
>       b) Add Joerg's Ack for iommu patches.
> 
> v9: https://lore.kernel.org/linux-mediatek/20211112105509.12010-1-yong.wu@mediatek.com/
>      1) Add return -ENODEV when the dev is null.
>      2) Add more strict about the case that a iommu consume device use the ports in
>      different larbs. Don't allow this case.
>      3) Remove two codec interface: mtk_vcodec_release_enc/dec_pm since it only has one
>      line now.
> 
> v8: https://lore.kernel.org/linux-mediatek/20210929013719.25120-1-yong.wu@mediatek.com/
>      1) Rebase on v5.15-rc1.
>      2) Don't rebase the below mdp patchset that may still need more discuss.
>      https://lore.kernel.org/linux-mediatek/20210709022324.1607884-1-eizan@chromium.org/
>      3) Add Frank's Tested-by. Remove Dafna's Tested-by as he requested.
> 
> v7: https://lore.kernel.org/linux-mediatek/20210730025238.22456-1-yong.wu@mediatek.com/
>      1) Fix a arm32 boot fail issue. reported from Frank.
>      2) Add a return fail in the mtk drm. suggested by Dafna.
> 
> v6: https://lore.kernel.org/linux-mediatek/20210714025626.5528-1-yong.wu@mediatek.com/
>      1) rebase on v5.14-rc1.
>      2) Fix the issue commented in v5 from Dafna and Hsin-Yi.
>      3) Remove the patches about using pm_runtime_resume_and_get since they have
>         already been merged by other patches.
> 
> v5: https://lore.kernel.org/linux-mediatek/20210410091128.31823-1-yong.wu@mediatek.com/
>      1) Base v5.12-rc2.
>      2) Remove changing the mtk-iommu to module_platform_driver patch, It have already been a
>      independent patch.
> 
> v4: https://lore.kernel.org/linux-mediatek/1590826218-23653-1-git-send-email-yong.wu@mediatek.com/
>      base on v5.7-rc1.
>    1) Move drm PM patch before smi patchs.
>    2) Change builtin_platform_driver to module_platform_driver since we may need
>       build as module.
>    3) Rebase many patchset as above.
> 
> v3: https://lore.kernel.org/linux-iommu/1567503456-24725-1-git-send-email-yong.wu@mediatek.com/
>      1) rebase on v5.3-rc1 and the latest mt8183 patchset.
>      2) Use device_is_bound to check whether the driver is ready from Matthias.
>      3) Add DL_FLAG_STATELESS flag when calling device_link_add and explain the
>     reason in the commit message[3/14].
>      4) Add a display patch[12/14] into this series. otherwise it may affect
>     display HW fastlogo even though it don't happen in mt8183.
>     
> v2: https://lore.kernel.org/linux-iommu/1560171313-28299-1-git-send-email-yong.wu@mediatek.com/
>     1) rebase on v5.2-rc1.
>     2) Move adding device_link between the consumer and smi-larb into
> iommu_add_device from Robin.
>     3) add DL_FLAG_AUTOREMOVE_CONSUMER even though the smi is built-in from Evan.
>     4) Remove the shutdown callback in iommu.
> 
> v1: https://lore.kernel.org/linux-iommu/1546318276-18993-1-git-send-email-yong.wu@mediatek.com/
> 
> Yong Wu (12):
>    dt-binding: mediatek: Get rid of mediatek,larb for multimedia HW
>    iommu/mediatek-v1: Free the existed fwspec if the master dev already
>      has
>    iommu/mediatek: Return ENODEV if the device is NULL
>    iommu/mediatek: Add probe_defer for smi-larb
>    iommu/mediatek: Add device_link between the consumer and the larb
>      devices
>    media: mtk-jpeg: Get rid of mtk_smi_larb_get/put
>    media: mtk-mdp: Get rid of mtk_smi_larb_get/put
>    drm/mediatek: Get rid of mtk_smi_larb_get/put
>    media: mtk-vcodec: Get rid of mtk_smi_larb_get/put
>    memory: mtk-smi: Get rid of mtk_smi_larb_get/put
>    arm: dts: mediatek: Get rid of mediatek,larb for MM nodes
>    arm64: dts: mediatek: Get rid of mediatek,larb for MM nodes
> 
> Yongqiang Niu (1):
>    drm/mediatek: Add pm runtime support for ovl and rdma
> 
>   .../display/mediatek/mediatek,disp.txt        |  9 ----
>   .../media/mediatek,vcodec-decoder.yaml        |  7 ---
>   .../media/mediatek,vcodec-encoder.yaml        |  8 ----
>   .../bindings/media/mediatek-jpeg-decoder.yaml |  9 ----
>   .../bindings/media/mediatek-jpeg-encoder.yaml |  9 ----
>   .../bindings/media/mediatek-mdp.txt           |  8 ----
>   arch/arm/boot/dts/mt2701.dtsi                 |  2 -
>   arch/arm/boot/dts/mt7623n.dtsi                |  5 ---
>   arch/arm64/boot/dts/mediatek/mt8173.dtsi      | 16 -------
>   arch/arm64/boot/dts/mediatek/mt8183.dtsi      |  6 ---
>   drivers/gpu/drm/mediatek/mtk_disp_ovl.c       |  8 +++-
>   drivers/gpu/drm/mediatek/mtk_disp_rdma.c      |  9 +++-
>   drivers/gpu/drm/mediatek/mtk_drm_crtc.c       | 15 ++++---
>   drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c   | 36 +--------------
>   drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h   |  1 -
>   drivers/gpu/drm/mediatek/mtk_drm_drv.c        |  5 +--
>   drivers/iommu/mtk_iommu.c                     | 34 ++++++++++++++
>   drivers/iommu/mtk_iommu_v1.c                  | 42 ++++++++++++++++-
>   .../media/platform/mtk-jpeg/mtk_jpeg_core.c   | 45 +------------------
>   .../media/platform/mtk-jpeg/mtk_jpeg_core.h   |  2 -
>   drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 40 -----------------
>   drivers/media/platform/mtk-mdp/mtk_mdp_comp.h |  2 -
>   drivers/media/platform/mtk-mdp/mtk_mdp_core.c |  1 -
>   .../platform/mtk-vcodec/mtk_vcodec_dec_drv.c  |  2 -
>   .../platform/mtk-vcodec/mtk_vcodec_dec_hw.c   |  1 -
>   .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c   | 41 +++--------------
>   .../platform/mtk-vcodec/mtk_vcodec_drv.h      |  3 --
>   .../platform/mtk-vcodec/mtk_vcodec_enc.c      |  1 -
>   .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c  |  2 -
>   .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c   | 45 +++----------------
>   drivers/memory/mtk-smi.c                      | 14 ------
>   include/soc/mediatek/smi.h                    | 20 ---------
>   32 files changed, 115 insertions(+), 333 deletions(-)
> 

Hello Hans, Matthias,
on my side, this series is totally ready for merge, hence, green light from here.

Can you please take it for 5.18?

Thank you,
Angelo

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 105+ messages in thread

* Re: [PATCH v10 00/13] Clean up "mediatek,larb"
@ 2022-01-17 10:27   ` AngeloGioacchino Del Regno
  0 siblings, 0 replies; 105+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-01-17 10:27 UTC (permalink / raw)
  To: Yong Wu, Matthias Brugger, Hans Verkuil, Joerg Roedel,
	Rob Herring, Krzysztof Kozlowski, David Airlie,
	Mauro Carvalho Chehab
  Cc: Dafna Hirschfeld, Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang,
	anthony.huang, youlin.pei, Evan Green, Eizan Miyamoto,
	Matthias Kaehlcke, mingyuan.ma, linux-media, devicetree,
	Frank Wunderlich, libo.kang, yi.kuo, linux-mediatek,
	Hsin-Yi Wang, Tiffany Lin, linux-arm-kernel, anan.sun,
	srv_heupstream, acourbot, linux-kernel, Tomasz Figa, iommu,
	Robin Murphy

Il 17/01/22 08:04, Yong Wu ha scritto:
> MediaTek IOMMU block diagram always like below:
> 
>          M4U
>           |
>      smi-common
>           |
>    -------------
>    |         |  ...
>    |         |
> larb1     larb2
>    |         |
> vdec       venc
> 
> All the consumer connect with smi-larb, then connect with smi-common.
> 
> When the consumer works, it should enable the smi-larb's power which also
> need enable the smi-common's power firstly.
> 
> Thus, Firstly, use the device link connect the consumer and the
> smi-larbs. then add device link between the smi-larb and smi-common.
> 
> After adding the device_link, then "mediatek,larb" property can be removed.
> the iommu consumer don't need call the mtk_smi_larb_get/put to enable
> the power and clock of smi-larb and smi-common.
> 
> Base on the media branch [1] and a jpeg dtbinding patchset[2] that already got
> the necessary R-b.
> 
> [1] git://linuxtv.org/hverkuil/media_tree.git tags/br-v5.18d
> [2] https://lore.kernel.org/linux-mediatek/20211206130425.184420-1-hsinyi@chromium.org/
> 
> Change notes:
> v10: a) Rebase on the media tree. Respin the "media: mtk-vcodec:" patches.
>       b) Add Joerg's Ack for iommu patches.
> 
> v9: https://lore.kernel.org/linux-mediatek/20211112105509.12010-1-yong.wu@mediatek.com/
>      1) Add return -ENODEV when the dev is null.
>      2) Add more strict about the case that a iommu consume device use the ports in
>      different larbs. Don't allow this case.
>      3) Remove two codec interface: mtk_vcodec_release_enc/dec_pm since it only has one
>      line now.
> 
> v8: https://lore.kernel.org/linux-mediatek/20210929013719.25120-1-yong.wu@mediatek.com/
>      1) Rebase on v5.15-rc1.
>      2) Don't rebase the below mdp patchset that may still need more discuss.
>      https://lore.kernel.org/linux-mediatek/20210709022324.1607884-1-eizan@chromium.org/
>      3) Add Frank's Tested-by. Remove Dafna's Tested-by as he requested.
> 
> v7: https://lore.kernel.org/linux-mediatek/20210730025238.22456-1-yong.wu@mediatek.com/
>      1) Fix a arm32 boot fail issue. reported from Frank.
>      2) Add a return fail in the mtk drm. suggested by Dafna.
> 
> v6: https://lore.kernel.org/linux-mediatek/20210714025626.5528-1-yong.wu@mediatek.com/
>      1) rebase on v5.14-rc1.
>      2) Fix the issue commented in v5 from Dafna and Hsin-Yi.
>      3) Remove the patches about using pm_runtime_resume_and_get since they have
>         already been merged by other patches.
> 
> v5: https://lore.kernel.org/linux-mediatek/20210410091128.31823-1-yong.wu@mediatek.com/
>      1) Base v5.12-rc2.
>      2) Remove changing the mtk-iommu to module_platform_driver patch, It have already been a
>      independent patch.
> 
> v4: https://lore.kernel.org/linux-mediatek/1590826218-23653-1-git-send-email-yong.wu@mediatek.com/
>      base on v5.7-rc1.
>    1) Move drm PM patch before smi patchs.
>    2) Change builtin_platform_driver to module_platform_driver since we may need
>       build as module.
>    3) Rebase many patchset as above.
> 
> v3: https://lore.kernel.org/linux-iommu/1567503456-24725-1-git-send-email-yong.wu@mediatek.com/
>      1) rebase on v5.3-rc1 and the latest mt8183 patchset.
>      2) Use device_is_bound to check whether the driver is ready from Matthias.
>      3) Add DL_FLAG_STATELESS flag when calling device_link_add and explain the
>     reason in the commit message[3/14].
>      4) Add a display patch[12/14] into this series. otherwise it may affect
>     display HW fastlogo even though it don't happen in mt8183.
>     
> v2: https://lore.kernel.org/linux-iommu/1560171313-28299-1-git-send-email-yong.wu@mediatek.com/
>     1) rebase on v5.2-rc1.
>     2) Move adding device_link between the consumer and smi-larb into
> iommu_add_device from Robin.
>     3) add DL_FLAG_AUTOREMOVE_CONSUMER even though the smi is built-in from Evan.
>     4) Remove the shutdown callback in iommu.
> 
> v1: https://lore.kernel.org/linux-iommu/1546318276-18993-1-git-send-email-yong.wu@mediatek.com/
> 
> Yong Wu (12):
>    dt-binding: mediatek: Get rid of mediatek,larb for multimedia HW
>    iommu/mediatek-v1: Free the existed fwspec if the master dev already
>      has
>    iommu/mediatek: Return ENODEV if the device is NULL
>    iommu/mediatek: Add probe_defer for smi-larb
>    iommu/mediatek: Add device_link between the consumer and the larb
>      devices
>    media: mtk-jpeg: Get rid of mtk_smi_larb_get/put
>    media: mtk-mdp: Get rid of mtk_smi_larb_get/put
>    drm/mediatek: Get rid of mtk_smi_larb_get/put
>    media: mtk-vcodec: Get rid of mtk_smi_larb_get/put
>    memory: mtk-smi: Get rid of mtk_smi_larb_get/put
>    arm: dts: mediatek: Get rid of mediatek,larb for MM nodes
>    arm64: dts: mediatek: Get rid of mediatek,larb for MM nodes
> 
> Yongqiang Niu (1):
>    drm/mediatek: Add pm runtime support for ovl and rdma
> 
>   .../display/mediatek/mediatek,disp.txt        |  9 ----
>   .../media/mediatek,vcodec-decoder.yaml        |  7 ---
>   .../media/mediatek,vcodec-encoder.yaml        |  8 ----
>   .../bindings/media/mediatek-jpeg-decoder.yaml |  9 ----
>   .../bindings/media/mediatek-jpeg-encoder.yaml |  9 ----
>   .../bindings/media/mediatek-mdp.txt           |  8 ----
>   arch/arm/boot/dts/mt2701.dtsi                 |  2 -
>   arch/arm/boot/dts/mt7623n.dtsi                |  5 ---
>   arch/arm64/boot/dts/mediatek/mt8173.dtsi      | 16 -------
>   arch/arm64/boot/dts/mediatek/mt8183.dtsi      |  6 ---
>   drivers/gpu/drm/mediatek/mtk_disp_ovl.c       |  8 +++-
>   drivers/gpu/drm/mediatek/mtk_disp_rdma.c      |  9 +++-
>   drivers/gpu/drm/mediatek/mtk_drm_crtc.c       | 15 ++++---
>   drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c   | 36 +--------------
>   drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h   |  1 -
>   drivers/gpu/drm/mediatek/mtk_drm_drv.c        |  5 +--
>   drivers/iommu/mtk_iommu.c                     | 34 ++++++++++++++
>   drivers/iommu/mtk_iommu_v1.c                  | 42 ++++++++++++++++-
>   .../media/platform/mtk-jpeg/mtk_jpeg_core.c   | 45 +------------------
>   .../media/platform/mtk-jpeg/mtk_jpeg_core.h   |  2 -
>   drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 40 -----------------
>   drivers/media/platform/mtk-mdp/mtk_mdp_comp.h |  2 -
>   drivers/media/platform/mtk-mdp/mtk_mdp_core.c |  1 -
>   .../platform/mtk-vcodec/mtk_vcodec_dec_drv.c  |  2 -
>   .../platform/mtk-vcodec/mtk_vcodec_dec_hw.c   |  1 -
>   .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c   | 41 +++--------------
>   .../platform/mtk-vcodec/mtk_vcodec_drv.h      |  3 --
>   .../platform/mtk-vcodec/mtk_vcodec_enc.c      |  1 -
>   .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c  |  2 -
>   .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c   | 45 +++----------------
>   drivers/memory/mtk-smi.c                      | 14 ------
>   include/soc/mediatek/smi.h                    | 20 ---------
>   32 files changed, 115 insertions(+), 333 deletions(-)
> 

Hello Hans, Matthias,
on my side, this series is totally ready for merge, hence, green light from here.

Can you please take it for 5.18?

Thank you,
Angelo

^ permalink raw reply	[flat|nested] 105+ messages in thread

* Re: [PATCH v10 00/13] Clean up "mediatek,larb"
@ 2022-01-17 10:27   ` AngeloGioacchino Del Regno
  0 siblings, 0 replies; 105+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-01-17 10:27 UTC (permalink / raw)
  To: Yong Wu, Matthias Brugger, Hans Verkuil, Joerg Roedel,
	Rob Herring, Krzysztof Kozlowski, David Airlie,
	Mauro Carvalho Chehab
  Cc: Evan Green, Robin Murphy, Tomasz Figa, Will Deacon,
	linux-mediatek, srv_heupstream, devicetree, linux-kernel,
	linux-arm-kernel, iommu, youlin.pei, Matthias Kaehlcke, anan.sun,
	yi.kuo, acourbot, linux-media, dri-devel, Daniel Vetter,
	Chun-Kuang Hu, Philipp Zabel, Tiffany Lin, Dafna Hirschfeld,
	Hsin-Yi Wang, Eizan Miyamoto, anthony.huang, Frank Wunderlich,
	mingyuan.ma, yf.wang, libo.kang

Il 17/01/22 08:04, Yong Wu ha scritto:
> MediaTek IOMMU block diagram always like below:
> 
>          M4U
>           |
>      smi-common
>           |
>    -------------
>    |         |  ...
>    |         |
> larb1     larb2
>    |         |
> vdec       venc
> 
> All the consumer connect with smi-larb, then connect with smi-common.
> 
> When the consumer works, it should enable the smi-larb's power which also
> need enable the smi-common's power firstly.
> 
> Thus, Firstly, use the device link connect the consumer and the
> smi-larbs. then add device link between the smi-larb and smi-common.
> 
> After adding the device_link, then "mediatek,larb" property can be removed.
> the iommu consumer don't need call the mtk_smi_larb_get/put to enable
> the power and clock of smi-larb and smi-common.
> 
> Base on the media branch [1] and a jpeg dtbinding patchset[2] that already got
> the necessary R-b.
> 
> [1] git://linuxtv.org/hverkuil/media_tree.git tags/br-v5.18d
> [2] https://lore.kernel.org/linux-mediatek/20211206130425.184420-1-hsinyi@chromium.org/
> 
> Change notes:
> v10: a) Rebase on the media tree. Respin the "media: mtk-vcodec:" patches.
>       b) Add Joerg's Ack for iommu patches.
> 
> v9: https://lore.kernel.org/linux-mediatek/20211112105509.12010-1-yong.wu@mediatek.com/
>      1) Add return -ENODEV when the dev is null.
>      2) Add more strict about the case that a iommu consume device use the ports in
>      different larbs. Don't allow this case.
>      3) Remove two codec interface: mtk_vcodec_release_enc/dec_pm since it only has one
>      line now.
> 
> v8: https://lore.kernel.org/linux-mediatek/20210929013719.25120-1-yong.wu@mediatek.com/
>      1) Rebase on v5.15-rc1.
>      2) Don't rebase the below mdp patchset that may still need more discuss.
>      https://lore.kernel.org/linux-mediatek/20210709022324.1607884-1-eizan@chromium.org/
>      3) Add Frank's Tested-by. Remove Dafna's Tested-by as he requested.
> 
> v7: https://lore.kernel.org/linux-mediatek/20210730025238.22456-1-yong.wu@mediatek.com/
>      1) Fix a arm32 boot fail issue. reported from Frank.
>      2) Add a return fail in the mtk drm. suggested by Dafna.
> 
> v6: https://lore.kernel.org/linux-mediatek/20210714025626.5528-1-yong.wu@mediatek.com/
>      1) rebase on v5.14-rc1.
>      2) Fix the issue commented in v5 from Dafna and Hsin-Yi.
>      3) Remove the patches about using pm_runtime_resume_and_get since they have
>         already been merged by other patches.
> 
> v5: https://lore.kernel.org/linux-mediatek/20210410091128.31823-1-yong.wu@mediatek.com/
>      1) Base v5.12-rc2.
>      2) Remove changing the mtk-iommu to module_platform_driver patch, It have already been a
>      independent patch.
> 
> v4: https://lore.kernel.org/linux-mediatek/1590826218-23653-1-git-send-email-yong.wu@mediatek.com/
>      base on v5.7-rc1.
>    1) Move drm PM patch before smi patchs.
>    2) Change builtin_platform_driver to module_platform_driver since we may need
>       build as module.
>    3) Rebase many patchset as above.
> 
> v3: https://lore.kernel.org/linux-iommu/1567503456-24725-1-git-send-email-yong.wu@mediatek.com/
>      1) rebase on v5.3-rc1 and the latest mt8183 patchset.
>      2) Use device_is_bound to check whether the driver is ready from Matthias.
>      3) Add DL_FLAG_STATELESS flag when calling device_link_add and explain the
>     reason in the commit message[3/14].
>      4) Add a display patch[12/14] into this series. otherwise it may affect
>     display HW fastlogo even though it don't happen in mt8183.
>     
> v2: https://lore.kernel.org/linux-iommu/1560171313-28299-1-git-send-email-yong.wu@mediatek.com/
>     1) rebase on v5.2-rc1.
>     2) Move adding device_link between the consumer and smi-larb into
> iommu_add_device from Robin.
>     3) add DL_FLAG_AUTOREMOVE_CONSUMER even though the smi is built-in from Evan.
>     4) Remove the shutdown callback in iommu.
> 
> v1: https://lore.kernel.org/linux-iommu/1546318276-18993-1-git-send-email-yong.wu@mediatek.com/
> 
> Yong Wu (12):
>    dt-binding: mediatek: Get rid of mediatek,larb for multimedia HW
>    iommu/mediatek-v1: Free the existed fwspec if the master dev already
>      has
>    iommu/mediatek: Return ENODEV if the device is NULL
>    iommu/mediatek: Add probe_defer for smi-larb
>    iommu/mediatek: Add device_link between the consumer and the larb
>      devices
>    media: mtk-jpeg: Get rid of mtk_smi_larb_get/put
>    media: mtk-mdp: Get rid of mtk_smi_larb_get/put
>    drm/mediatek: Get rid of mtk_smi_larb_get/put
>    media: mtk-vcodec: Get rid of mtk_smi_larb_get/put
>    memory: mtk-smi: Get rid of mtk_smi_larb_get/put
>    arm: dts: mediatek: Get rid of mediatek,larb for MM nodes
>    arm64: dts: mediatek: Get rid of mediatek,larb for MM nodes
> 
> Yongqiang Niu (1):
>    drm/mediatek: Add pm runtime support for ovl and rdma
> 
>   .../display/mediatek/mediatek,disp.txt        |  9 ----
>   .../media/mediatek,vcodec-decoder.yaml        |  7 ---
>   .../media/mediatek,vcodec-encoder.yaml        |  8 ----
>   .../bindings/media/mediatek-jpeg-decoder.yaml |  9 ----
>   .../bindings/media/mediatek-jpeg-encoder.yaml |  9 ----
>   .../bindings/media/mediatek-mdp.txt           |  8 ----
>   arch/arm/boot/dts/mt2701.dtsi                 |  2 -
>   arch/arm/boot/dts/mt7623n.dtsi                |  5 ---
>   arch/arm64/boot/dts/mediatek/mt8173.dtsi      | 16 -------
>   arch/arm64/boot/dts/mediatek/mt8183.dtsi      |  6 ---
>   drivers/gpu/drm/mediatek/mtk_disp_ovl.c       |  8 +++-
>   drivers/gpu/drm/mediatek/mtk_disp_rdma.c      |  9 +++-
>   drivers/gpu/drm/mediatek/mtk_drm_crtc.c       | 15 ++++---
>   drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c   | 36 +--------------
>   drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h   |  1 -
>   drivers/gpu/drm/mediatek/mtk_drm_drv.c        |  5 +--
>   drivers/iommu/mtk_iommu.c                     | 34 ++++++++++++++
>   drivers/iommu/mtk_iommu_v1.c                  | 42 ++++++++++++++++-
>   .../media/platform/mtk-jpeg/mtk_jpeg_core.c   | 45 +------------------
>   .../media/platform/mtk-jpeg/mtk_jpeg_core.h   |  2 -
>   drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 40 -----------------
>   drivers/media/platform/mtk-mdp/mtk_mdp_comp.h |  2 -
>   drivers/media/platform/mtk-mdp/mtk_mdp_core.c |  1 -
>   .../platform/mtk-vcodec/mtk_vcodec_dec_drv.c  |  2 -
>   .../platform/mtk-vcodec/mtk_vcodec_dec_hw.c   |  1 -
>   .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c   | 41 +++--------------
>   .../platform/mtk-vcodec/mtk_vcodec_drv.h      |  3 --
>   .../platform/mtk-vcodec/mtk_vcodec_enc.c      |  1 -
>   .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c  |  2 -
>   .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c   | 45 +++----------------
>   drivers/memory/mtk-smi.c                      | 14 ------
>   include/soc/mediatek/smi.h                    | 20 ---------
>   32 files changed, 115 insertions(+), 333 deletions(-)
> 

Hello Hans, Matthias,
on my side, this series is totally ready for merge, hence, green light from here.

Can you please take it for 5.18?

Thank you,
Angelo

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 105+ messages in thread

* Re: [PATCH v10 00/13] Clean up "mediatek,larb"
  2022-01-17 10:27   ` AngeloGioacchino Del Regno
                       ` (2 preceding siblings ...)
  (?)
@ 2022-01-17 11:49     ` Matthias Brugger
  -1 siblings, 0 replies; 105+ messages in thread
From: Matthias Brugger @ 2022-01-17 11:49 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno, Yong Wu, Hans Verkuil, Joerg Roedel,
	Rob Herring, Krzysztof Kozlowski, David Airlie,
	Mauro Carvalho Chehab
  Cc: Evan Green, Robin Murphy, Tomasz Figa, Will Deacon,
	linux-mediatek, srv_heupstream, devicetree, linux-kernel,
	linux-arm-kernel, iommu, youlin.pei, Matthias Kaehlcke, anan.sun,
	yi.kuo, acourbot, linux-media, dri-devel, Daniel Vetter,
	Chun-Kuang Hu, Philipp Zabel, Tiffany Lin, Dafna Hirschfeld,
	Hsin-Yi Wang, Eizan Miyamoto, anthony.huang, Frank Wunderlich,
	mingyuan.ma, yf.wang, libo.kang



On 17/01/2022 11:27, AngeloGioacchino Del Regno wrote:
> Il 17/01/22 08:04, Yong Wu ha scritto:
>> MediaTek IOMMU block diagram always like below:
>>
>>          M4U
>>           |
>>      smi-common
>>           |
>>    -------------
>>    |         |  ...
>>    |         |
>> larb1     larb2
>>    |         |
>> vdec       venc
>>
>> All the consumer connect with smi-larb, then connect with smi-common.
>>
>> When the consumer works, it should enable the smi-larb's power which also
>> need enable the smi-common's power firstly.
>>
>> Thus, Firstly, use the device link connect the consumer and the
>> smi-larbs. then add device link between the smi-larb and smi-common.
>>
>> After adding the device_link, then "mediatek,larb" property can be removed.
>> the iommu consumer don't need call the mtk_smi_larb_get/put to enable
>> the power and clock of smi-larb and smi-common.
>>
>> Base on the media branch [1] and a jpeg dtbinding patchset[2] that already got
>> the necessary R-b.
>>
>> [1] git://linuxtv.org/hverkuil/media_tree.git tags/br-v5.18d
>> [2] 
>> https://lore.kernel.org/linux-mediatek/20211206130425.184420-1-hsinyi@chromium.org/ 
>>
>>
>> Change notes:
>> v10: a) Rebase on the media tree. Respin the "media: mtk-vcodec:" patches.
>>       b) Add Joerg's Ack for iommu patches.
>>
>> v9: 
>> https://lore.kernel.org/linux-mediatek/20211112105509.12010-1-yong.wu@mediatek.com/ 
>>
>>      1) Add return -ENODEV when the dev is null.
>>      2) Add more strict about the case that a iommu consume device use the 
>> ports in
>>      different larbs. Don't allow this case.
>>      3) Remove two codec interface: mtk_vcodec_release_enc/dec_pm since it 
>> only has one
>>      line now.
>>
>> v8: 
>> https://lore.kernel.org/linux-mediatek/20210929013719.25120-1-yong.wu@mediatek.com/ 
>>
>>      1) Rebase on v5.15-rc1.
>>      2) Don't rebase the below mdp patchset that may still need more discuss.
>>      
>> https://lore.kernel.org/linux-mediatek/20210709022324.1607884-1-eizan@chromium.org/ 
>>
>>      3) Add Frank's Tested-by. Remove Dafna's Tested-by as he requested.
>>
>> v7: 
>> https://lore.kernel.org/linux-mediatek/20210730025238.22456-1-yong.wu@mediatek.com/ 
>>
>>      1) Fix a arm32 boot fail issue. reported from Frank.
>>      2) Add a return fail in the mtk drm. suggested by Dafna.
>>
>> v6: 
>> https://lore.kernel.org/linux-mediatek/20210714025626.5528-1-yong.wu@mediatek.com/ 
>>
>>      1) rebase on v5.14-rc1.
>>      2) Fix the issue commented in v5 from Dafna and Hsin-Yi.
>>      3) Remove the patches about using pm_runtime_resume_and_get since they have
>>         already been merged by other patches.
>>
>> v5: 
>> https://lore.kernel.org/linux-mediatek/20210410091128.31823-1-yong.wu@mediatek.com/ 
>>
>>      1) Base v5.12-rc2.
>>      2) Remove changing the mtk-iommu to module_platform_driver patch, It have 
>> already been a
>>      independent patch.
>>
>> v4: 
>> https://lore.kernel.org/linux-mediatek/1590826218-23653-1-git-send-email-yong.wu@mediatek.com/ 
>>
>>      base on v5.7-rc1.
>>    1) Move drm PM patch before smi patchs.
>>    2) Change builtin_platform_driver to module_platform_driver since we may need
>>       build as module.
>>    3) Rebase many patchset as above.
>>
>> v3: 
>> https://lore.kernel.org/linux-iommu/1567503456-24725-1-git-send-email-yong.wu@mediatek.com/ 
>>
>>      1) rebase on v5.3-rc1 and the latest mt8183 patchset.
>>      2) Use device_is_bound to check whether the driver is ready from Matthias.
>>      3) Add DL_FLAG_STATELESS flag when calling device_link_add and explain the
>>     reason in the commit message[3/14].
>>      4) Add a display patch[12/14] into this series. otherwise it may affect
>>     display HW fastlogo even though it don't happen in mt8183.
>> v2: 
>> https://lore.kernel.org/linux-iommu/1560171313-28299-1-git-send-email-yong.wu@mediatek.com/ 
>>
>>     1) rebase on v5.2-rc1.
>>     2) Move adding device_link between the consumer and smi-larb into
>> iommu_add_device from Robin.
>>     3) add DL_FLAG_AUTOREMOVE_CONSUMER even though the smi is built-in from Evan.
>>     4) Remove the shutdown callback in iommu.
>>
>> v1: 
>> https://lore.kernel.org/linux-iommu/1546318276-18993-1-git-send-email-yong.wu@mediatek.com/ 
>>
>>
>> Yong Wu (12):
>>    dt-binding: mediatek: Get rid of mediatek,larb for multimedia HW
>>    iommu/mediatek-v1: Free the existed fwspec if the master dev already
>>      has
>>    iommu/mediatek: Return ENODEV if the device is NULL
>>    iommu/mediatek: Add probe_defer for smi-larb
>>    iommu/mediatek: Add device_link between the consumer and the larb
>>      devices
>>    media: mtk-jpeg: Get rid of mtk_smi_larb_get/put
>>    media: mtk-mdp: Get rid of mtk_smi_larb_get/put
>>    drm/mediatek: Get rid of mtk_smi_larb_get/put
>>    media: mtk-vcodec: Get rid of mtk_smi_larb_get/put
>>    memory: mtk-smi: Get rid of mtk_smi_larb_get/put
>>    arm: dts: mediatek: Get rid of mediatek,larb for MM nodes
>>    arm64: dts: mediatek: Get rid of mediatek,larb for MM nodes
>>
>> Yongqiang Niu (1):
>>    drm/mediatek: Add pm runtime support for ovl and rdma
>>
>>   .../display/mediatek/mediatek,disp.txt        |  9 ----
>>   .../media/mediatek,vcodec-decoder.yaml        |  7 ---
>>   .../media/mediatek,vcodec-encoder.yaml        |  8 ----
>>   .../bindings/media/mediatek-jpeg-decoder.yaml |  9 ----
>>   .../bindings/media/mediatek-jpeg-encoder.yaml |  9 ----
>>   .../bindings/media/mediatek-mdp.txt           |  8 ----
>>   arch/arm/boot/dts/mt2701.dtsi                 |  2 -
>>   arch/arm/boot/dts/mt7623n.dtsi                |  5 ---
>>   arch/arm64/boot/dts/mediatek/mt8173.dtsi      | 16 -------
>>   arch/arm64/boot/dts/mediatek/mt8183.dtsi      |  6 ---
>>   drivers/gpu/drm/mediatek/mtk_disp_ovl.c       |  8 +++-
>>   drivers/gpu/drm/mediatek/mtk_disp_rdma.c      |  9 +++-
>>   drivers/gpu/drm/mediatek/mtk_drm_crtc.c       | 15 ++++---
>>   drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c   | 36 +--------------
>>   drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h   |  1 -
>>   drivers/gpu/drm/mediatek/mtk_drm_drv.c        |  5 +--
>>   drivers/iommu/mtk_iommu.c                     | 34 ++++++++++++++
>>   drivers/iommu/mtk_iommu_v1.c                  | 42 ++++++++++++++++-
>>   .../media/platform/mtk-jpeg/mtk_jpeg_core.c   | 45 +------------------
>>   .../media/platform/mtk-jpeg/mtk_jpeg_core.h   |  2 -
>>   drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 40 -----------------
>>   drivers/media/platform/mtk-mdp/mtk_mdp_comp.h |  2 -
>>   drivers/media/platform/mtk-mdp/mtk_mdp_core.c |  1 -
>>   .../platform/mtk-vcodec/mtk_vcodec_dec_drv.c  |  2 -
>>   .../platform/mtk-vcodec/mtk_vcodec_dec_hw.c   |  1 -
>>   .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c   | 41 +++--------------
>>   .../platform/mtk-vcodec/mtk_vcodec_drv.h      |  3 --
>>   .../platform/mtk-vcodec/mtk_vcodec_enc.c      |  1 -
>>   .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c  |  2 -
>>   .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c   | 45 +++----------------
>>   drivers/memory/mtk-smi.c                      | 14 ------
>>   include/soc/mediatek/smi.h                    | 20 ---------
>>   32 files changed, 115 insertions(+), 333 deletions(-)
>>
> 
> Hello Hans, Matthias,
> on my side, this series is totally ready for merge, hence, green light from here.
> 
> Can you please take it for 5.18?
> 

@Hans: I understand you take the series through your tree. Please let me know 
when you do so. I'll take care of patch 12 and 13, which should go through my tree.

Thanks!
Matthias

^ permalink raw reply	[flat|nested] 105+ messages in thread

* Re: [PATCH v10 00/13] Clean up "mediatek,larb"
@ 2022-01-17 11:49     ` Matthias Brugger
  0 siblings, 0 replies; 105+ messages in thread
From: Matthias Brugger @ 2022-01-17 11:49 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno, Yong Wu, Hans Verkuil, Joerg Roedel,
	Rob Herring, Krzysztof Kozlowski, David Airlie,
	Mauro Carvalho Chehab
  Cc: Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang, anthony.huang,
	youlin.pei, Evan Green, Eizan Miyamoto, Matthias Kaehlcke,
	mingyuan.ma, linux-media, devicetree, Philipp Zabel,
	Frank Wunderlich, libo.kang, yi.kuo, linux-mediatek,
	Hsin-Yi Wang, Tiffany Lin, linux-arm-kernel, anan.sun,
	srv_heupstream, acourbot, linux-kernel, iommu, Daniel Vetter,
	Robin Murphy



On 17/01/2022 11:27, AngeloGioacchino Del Regno wrote:
> Il 17/01/22 08:04, Yong Wu ha scritto:
>> MediaTek IOMMU block diagram always like below:
>>
>>          M4U
>>           |
>>      smi-common
>>           |
>>    -------------
>>    |         |  ...
>>    |         |
>> larb1     larb2
>>    |         |
>> vdec       venc
>>
>> All the consumer connect with smi-larb, then connect with smi-common.
>>
>> When the consumer works, it should enable the smi-larb's power which also
>> need enable the smi-common's power firstly.
>>
>> Thus, Firstly, use the device link connect the consumer and the
>> smi-larbs. then add device link between the smi-larb and smi-common.
>>
>> After adding the device_link, then "mediatek,larb" property can be removed.
>> the iommu consumer don't need call the mtk_smi_larb_get/put to enable
>> the power and clock of smi-larb and smi-common.
>>
>> Base on the media branch [1] and a jpeg dtbinding patchset[2] that already got
>> the necessary R-b.
>>
>> [1] git://linuxtv.org/hverkuil/media_tree.git tags/br-v5.18d
>> [2] 
>> https://lore.kernel.org/linux-mediatek/20211206130425.184420-1-hsinyi@chromium.org/ 
>>
>>
>> Change notes:
>> v10: a) Rebase on the media tree. Respin the "media: mtk-vcodec:" patches.
>>       b) Add Joerg's Ack for iommu patches.
>>
>> v9: 
>> https://lore.kernel.org/linux-mediatek/20211112105509.12010-1-yong.wu@mediatek.com/ 
>>
>>      1) Add return -ENODEV when the dev is null.
>>      2) Add more strict about the case that a iommu consume device use the 
>> ports in
>>      different larbs. Don't allow this case.
>>      3) Remove two codec interface: mtk_vcodec_release_enc/dec_pm since it 
>> only has one
>>      line now.
>>
>> v8: 
>> https://lore.kernel.org/linux-mediatek/20210929013719.25120-1-yong.wu@mediatek.com/ 
>>
>>      1) Rebase on v5.15-rc1.
>>      2) Don't rebase the below mdp patchset that may still need more discuss.
>>      
>> https://lore.kernel.org/linux-mediatek/20210709022324.1607884-1-eizan@chromium.org/ 
>>
>>      3) Add Frank's Tested-by. Remove Dafna's Tested-by as he requested.
>>
>> v7: 
>> https://lore.kernel.org/linux-mediatek/20210730025238.22456-1-yong.wu@mediatek.com/ 
>>
>>      1) Fix a arm32 boot fail issue. reported from Frank.
>>      2) Add a return fail in the mtk drm. suggested by Dafna.
>>
>> v6: 
>> https://lore.kernel.org/linux-mediatek/20210714025626.5528-1-yong.wu@mediatek.com/ 
>>
>>      1) rebase on v5.14-rc1.
>>      2) Fix the issue commented in v5 from Dafna and Hsin-Yi.
>>      3) Remove the patches about using pm_runtime_resume_and_get since they have
>>         already been merged by other patches.
>>
>> v5: 
>> https://lore.kernel.org/linux-mediatek/20210410091128.31823-1-yong.wu@mediatek.com/ 
>>
>>      1) Base v5.12-rc2.
>>      2) Remove changing the mtk-iommu to module_platform_driver patch, It have 
>> already been a
>>      independent patch.
>>
>> v4: 
>> https://lore.kernel.org/linux-mediatek/1590826218-23653-1-git-send-email-yong.wu@mediatek.com/ 
>>
>>      base on v5.7-rc1.
>>    1) Move drm PM patch before smi patchs.
>>    2) Change builtin_platform_driver to module_platform_driver since we may need
>>       build as module.
>>    3) Rebase many patchset as above.
>>
>> v3: 
>> https://lore.kernel.org/linux-iommu/1567503456-24725-1-git-send-email-yong.wu@mediatek.com/ 
>>
>>      1) rebase on v5.3-rc1 and the latest mt8183 patchset.
>>      2) Use device_is_bound to check whether the driver is ready from Matthias.
>>      3) Add DL_FLAG_STATELESS flag when calling device_link_add and explain the
>>     reason in the commit message[3/14].
>>      4) Add a display patch[12/14] into this series. otherwise it may affect
>>     display HW fastlogo even though it don't happen in mt8183.
>> v2: 
>> https://lore.kernel.org/linux-iommu/1560171313-28299-1-git-send-email-yong.wu@mediatek.com/ 
>>
>>     1) rebase on v5.2-rc1.
>>     2) Move adding device_link between the consumer and smi-larb into
>> iommu_add_device from Robin.
>>     3) add DL_FLAG_AUTOREMOVE_CONSUMER even though the smi is built-in from Evan.
>>     4) Remove the shutdown callback in iommu.
>>
>> v1: 
>> https://lore.kernel.org/linux-iommu/1546318276-18993-1-git-send-email-yong.wu@mediatek.com/ 
>>
>>
>> Yong Wu (12):
>>    dt-binding: mediatek: Get rid of mediatek,larb for multimedia HW
>>    iommu/mediatek-v1: Free the existed fwspec if the master dev already
>>      has
>>    iommu/mediatek: Return ENODEV if the device is NULL
>>    iommu/mediatek: Add probe_defer for smi-larb
>>    iommu/mediatek: Add device_link between the consumer and the larb
>>      devices
>>    media: mtk-jpeg: Get rid of mtk_smi_larb_get/put
>>    media: mtk-mdp: Get rid of mtk_smi_larb_get/put
>>    drm/mediatek: Get rid of mtk_smi_larb_get/put
>>    media: mtk-vcodec: Get rid of mtk_smi_larb_get/put
>>    memory: mtk-smi: Get rid of mtk_smi_larb_get/put
>>    arm: dts: mediatek: Get rid of mediatek,larb for MM nodes
>>    arm64: dts: mediatek: Get rid of mediatek,larb for MM nodes
>>
>> Yongqiang Niu (1):
>>    drm/mediatek: Add pm runtime support for ovl and rdma
>>
>>   .../display/mediatek/mediatek,disp.txt        |  9 ----
>>   .../media/mediatek,vcodec-decoder.yaml        |  7 ---
>>   .../media/mediatek,vcodec-encoder.yaml        |  8 ----
>>   .../bindings/media/mediatek-jpeg-decoder.yaml |  9 ----
>>   .../bindings/media/mediatek-jpeg-encoder.yaml |  9 ----
>>   .../bindings/media/mediatek-mdp.txt           |  8 ----
>>   arch/arm/boot/dts/mt2701.dtsi                 |  2 -
>>   arch/arm/boot/dts/mt7623n.dtsi                |  5 ---
>>   arch/arm64/boot/dts/mediatek/mt8173.dtsi      | 16 -------
>>   arch/arm64/boot/dts/mediatek/mt8183.dtsi      |  6 ---
>>   drivers/gpu/drm/mediatek/mtk_disp_ovl.c       |  8 +++-
>>   drivers/gpu/drm/mediatek/mtk_disp_rdma.c      |  9 +++-
>>   drivers/gpu/drm/mediatek/mtk_drm_crtc.c       | 15 ++++---
>>   drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c   | 36 +--------------
>>   drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h   |  1 -
>>   drivers/gpu/drm/mediatek/mtk_drm_drv.c        |  5 +--
>>   drivers/iommu/mtk_iommu.c                     | 34 ++++++++++++++
>>   drivers/iommu/mtk_iommu_v1.c                  | 42 ++++++++++++++++-
>>   .../media/platform/mtk-jpeg/mtk_jpeg_core.c   | 45 +------------------
>>   .../media/platform/mtk-jpeg/mtk_jpeg_core.h   |  2 -
>>   drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 40 -----------------
>>   drivers/media/platform/mtk-mdp/mtk_mdp_comp.h |  2 -
>>   drivers/media/platform/mtk-mdp/mtk_mdp_core.c |  1 -
>>   .../platform/mtk-vcodec/mtk_vcodec_dec_drv.c  |  2 -
>>   .../platform/mtk-vcodec/mtk_vcodec_dec_hw.c   |  1 -
>>   .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c   | 41 +++--------------
>>   .../platform/mtk-vcodec/mtk_vcodec_drv.h      |  3 --
>>   .../platform/mtk-vcodec/mtk_vcodec_enc.c      |  1 -
>>   .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c  |  2 -
>>   .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c   | 45 +++----------------
>>   drivers/memory/mtk-smi.c                      | 14 ------
>>   include/soc/mediatek/smi.h                    | 20 ---------
>>   32 files changed, 115 insertions(+), 333 deletions(-)
>>
> 
> Hello Hans, Matthias,
> on my side, this series is totally ready for merge, hence, green light from here.
> 
> Can you please take it for 5.18?
> 

@Hans: I understand you take the series through your tree. Please let me know 
when you do so. I'll take care of patch 12 and 13, which should go through my tree.

Thanks!
Matthias
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 105+ messages in thread

* Re: [PATCH v10 00/13] Clean up "mediatek,larb"
@ 2022-01-17 11:49     ` Matthias Brugger
  0 siblings, 0 replies; 105+ messages in thread
From: Matthias Brugger @ 2022-01-17 11:49 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno, Yong Wu, Hans Verkuil, Joerg Roedel,
	Rob Herring, Krzysztof Kozlowski, David Airlie,
	Mauro Carvalho Chehab
  Cc: Dafna Hirschfeld, Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang,
	anthony.huang, youlin.pei, Evan Green, Eizan Miyamoto,
	Matthias Kaehlcke, mingyuan.ma, linux-media, devicetree,
	Philipp Zabel, libo.kang, yi.kuo, linux-mediatek, Hsin-Yi Wang,
	Tiffany Lin, linux-arm-kernel, anan.sun, srv_heupstream,
	acourbot, linux-kernel, Tomasz Figa, iommu, Daniel Vetter,
	Robin Murphy



On 17/01/2022 11:27, AngeloGioacchino Del Regno wrote:
> Il 17/01/22 08:04, Yong Wu ha scritto:
>> MediaTek IOMMU block diagram always like below:
>>
>>          M4U
>>           |
>>      smi-common
>>           |
>>    -------------
>>    |         |  ...
>>    |         |
>> larb1     larb2
>>    |         |
>> vdec       venc
>>
>> All the consumer connect with smi-larb, then connect with smi-common.
>>
>> When the consumer works, it should enable the smi-larb's power which also
>> need enable the smi-common's power firstly.
>>
>> Thus, Firstly, use the device link connect the consumer and the
>> smi-larbs. then add device link between the smi-larb and smi-common.
>>
>> After adding the device_link, then "mediatek,larb" property can be removed.
>> the iommu consumer don't need call the mtk_smi_larb_get/put to enable
>> the power and clock of smi-larb and smi-common.
>>
>> Base on the media branch [1] and a jpeg dtbinding patchset[2] that already got
>> the necessary R-b.
>>
>> [1] git://linuxtv.org/hverkuil/media_tree.git tags/br-v5.18d
>> [2] 
>> https://lore.kernel.org/linux-mediatek/20211206130425.184420-1-hsinyi@chromium.org/ 
>>
>>
>> Change notes:
>> v10: a) Rebase on the media tree. Respin the "media: mtk-vcodec:" patches.
>>       b) Add Joerg's Ack for iommu patches.
>>
>> v9: 
>> https://lore.kernel.org/linux-mediatek/20211112105509.12010-1-yong.wu@mediatek.com/ 
>>
>>      1) Add return -ENODEV when the dev is null.
>>      2) Add more strict about the case that a iommu consume device use the 
>> ports in
>>      different larbs. Don't allow this case.
>>      3) Remove two codec interface: mtk_vcodec_release_enc/dec_pm since it 
>> only has one
>>      line now.
>>
>> v8: 
>> https://lore.kernel.org/linux-mediatek/20210929013719.25120-1-yong.wu@mediatek.com/ 
>>
>>      1) Rebase on v5.15-rc1.
>>      2) Don't rebase the below mdp patchset that may still need more discuss.
>>      
>> https://lore.kernel.org/linux-mediatek/20210709022324.1607884-1-eizan@chromium.org/ 
>>
>>      3) Add Frank's Tested-by. Remove Dafna's Tested-by as he requested.
>>
>> v7: 
>> https://lore.kernel.org/linux-mediatek/20210730025238.22456-1-yong.wu@mediatek.com/ 
>>
>>      1) Fix a arm32 boot fail issue. reported from Frank.
>>      2) Add a return fail in the mtk drm. suggested by Dafna.
>>
>> v6: 
>> https://lore.kernel.org/linux-mediatek/20210714025626.5528-1-yong.wu@mediatek.com/ 
>>
>>      1) rebase on v5.14-rc1.
>>      2) Fix the issue commented in v5 from Dafna and Hsin-Yi.
>>      3) Remove the patches about using pm_runtime_resume_and_get since they have
>>         already been merged by other patches.
>>
>> v5: 
>> https://lore.kernel.org/linux-mediatek/20210410091128.31823-1-yong.wu@mediatek.com/ 
>>
>>      1) Base v5.12-rc2.
>>      2) Remove changing the mtk-iommu to module_platform_driver patch, It have 
>> already been a
>>      independent patch.
>>
>> v4: 
>> https://lore.kernel.org/linux-mediatek/1590826218-23653-1-git-send-email-yong.wu@mediatek.com/ 
>>
>>      base on v5.7-rc1.
>>    1) Move drm PM patch before smi patchs.
>>    2) Change builtin_platform_driver to module_platform_driver since we may need
>>       build as module.
>>    3) Rebase many patchset as above.
>>
>> v3: 
>> https://lore.kernel.org/linux-iommu/1567503456-24725-1-git-send-email-yong.wu@mediatek.com/ 
>>
>>      1) rebase on v5.3-rc1 and the latest mt8183 patchset.
>>      2) Use device_is_bound to check whether the driver is ready from Matthias.
>>      3) Add DL_FLAG_STATELESS flag when calling device_link_add and explain the
>>     reason in the commit message[3/14].
>>      4) Add a display patch[12/14] into this series. otherwise it may affect
>>     display HW fastlogo even though it don't happen in mt8183.
>> v2: 
>> https://lore.kernel.org/linux-iommu/1560171313-28299-1-git-send-email-yong.wu@mediatek.com/ 
>>
>>     1) rebase on v5.2-rc1.
>>     2) Move adding device_link between the consumer and smi-larb into
>> iommu_add_device from Robin.
>>     3) add DL_FLAG_AUTOREMOVE_CONSUMER even though the smi is built-in from Evan.
>>     4) Remove the shutdown callback in iommu.
>>
>> v1: 
>> https://lore.kernel.org/linux-iommu/1546318276-18993-1-git-send-email-yong.wu@mediatek.com/ 
>>
>>
>> Yong Wu (12):
>>    dt-binding: mediatek: Get rid of mediatek,larb for multimedia HW
>>    iommu/mediatek-v1: Free the existed fwspec if the master dev already
>>      has
>>    iommu/mediatek: Return ENODEV if the device is NULL
>>    iommu/mediatek: Add probe_defer for smi-larb
>>    iommu/mediatek: Add device_link between the consumer and the larb
>>      devices
>>    media: mtk-jpeg: Get rid of mtk_smi_larb_get/put
>>    media: mtk-mdp: Get rid of mtk_smi_larb_get/put
>>    drm/mediatek: Get rid of mtk_smi_larb_get/put
>>    media: mtk-vcodec: Get rid of mtk_smi_larb_get/put
>>    memory: mtk-smi: Get rid of mtk_smi_larb_get/put
>>    arm: dts: mediatek: Get rid of mediatek,larb for MM nodes
>>    arm64: dts: mediatek: Get rid of mediatek,larb for MM nodes
>>
>> Yongqiang Niu (1):
>>    drm/mediatek: Add pm runtime support for ovl and rdma
>>
>>   .../display/mediatek/mediatek,disp.txt        |  9 ----
>>   .../media/mediatek,vcodec-decoder.yaml        |  7 ---
>>   .../media/mediatek,vcodec-encoder.yaml        |  8 ----
>>   .../bindings/media/mediatek-jpeg-decoder.yaml |  9 ----
>>   .../bindings/media/mediatek-jpeg-encoder.yaml |  9 ----
>>   .../bindings/media/mediatek-mdp.txt           |  8 ----
>>   arch/arm/boot/dts/mt2701.dtsi                 |  2 -
>>   arch/arm/boot/dts/mt7623n.dtsi                |  5 ---
>>   arch/arm64/boot/dts/mediatek/mt8173.dtsi      | 16 -------
>>   arch/arm64/boot/dts/mediatek/mt8183.dtsi      |  6 ---
>>   drivers/gpu/drm/mediatek/mtk_disp_ovl.c       |  8 +++-
>>   drivers/gpu/drm/mediatek/mtk_disp_rdma.c      |  9 +++-
>>   drivers/gpu/drm/mediatek/mtk_drm_crtc.c       | 15 ++++---
>>   drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c   | 36 +--------------
>>   drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h   |  1 -
>>   drivers/gpu/drm/mediatek/mtk_drm_drv.c        |  5 +--
>>   drivers/iommu/mtk_iommu.c                     | 34 ++++++++++++++
>>   drivers/iommu/mtk_iommu_v1.c                  | 42 ++++++++++++++++-
>>   .../media/platform/mtk-jpeg/mtk_jpeg_core.c   | 45 +------------------
>>   .../media/platform/mtk-jpeg/mtk_jpeg_core.h   |  2 -
>>   drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 40 -----------------
>>   drivers/media/platform/mtk-mdp/mtk_mdp_comp.h |  2 -
>>   drivers/media/platform/mtk-mdp/mtk_mdp_core.c |  1 -
>>   .../platform/mtk-vcodec/mtk_vcodec_dec_drv.c  |  2 -
>>   .../platform/mtk-vcodec/mtk_vcodec_dec_hw.c   |  1 -
>>   .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c   | 41 +++--------------
>>   .../platform/mtk-vcodec/mtk_vcodec_drv.h      |  3 --
>>   .../platform/mtk-vcodec/mtk_vcodec_enc.c      |  1 -
>>   .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c  |  2 -
>>   .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c   | 45 +++----------------
>>   drivers/memory/mtk-smi.c                      | 14 ------
>>   include/soc/mediatek/smi.h                    | 20 ---------
>>   32 files changed, 115 insertions(+), 333 deletions(-)
>>
> 
> Hello Hans, Matthias,
> on my side, this series is totally ready for merge, hence, green light from here.
> 
> Can you please take it for 5.18?
> 

@Hans: I understand you take the series through your tree. Please let me know 
when you do so. I'll take care of patch 12 and 13, which should go through my tree.

Thanks!
Matthias

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 105+ messages in thread

* Re: [PATCH v10 00/13] Clean up "mediatek,larb"
@ 2022-01-17 11:49     ` Matthias Brugger
  0 siblings, 0 replies; 105+ messages in thread
From: Matthias Brugger @ 2022-01-17 11:49 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno, Yong Wu, Hans Verkuil, Joerg Roedel,
	Rob Herring, Krzysztof Kozlowski, David Airlie,
	Mauro Carvalho Chehab
  Cc: Dafna Hirschfeld, Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang,
	anthony.huang, youlin.pei, Evan Green, Eizan Miyamoto,
	Matthias Kaehlcke, mingyuan.ma, linux-media, devicetree,
	Frank Wunderlich, libo.kang, yi.kuo, linux-mediatek,
	Hsin-Yi Wang, Tiffany Lin, linux-arm-kernel, anan.sun,
	srv_heupstream, acourbot, linux-kernel, Tomasz Figa, iommu,
	Robin Murphy



On 17/01/2022 11:27, AngeloGioacchino Del Regno wrote:
> Il 17/01/22 08:04, Yong Wu ha scritto:
>> MediaTek IOMMU block diagram always like below:
>>
>>          M4U
>>           |
>>      smi-common
>>           |
>>    -------------
>>    |         |  ...
>>    |         |
>> larb1     larb2
>>    |         |
>> vdec       venc
>>
>> All the consumer connect with smi-larb, then connect with smi-common.
>>
>> When the consumer works, it should enable the smi-larb's power which also
>> need enable the smi-common's power firstly.
>>
>> Thus, Firstly, use the device link connect the consumer and the
>> smi-larbs. then add device link between the smi-larb and smi-common.
>>
>> After adding the device_link, then "mediatek,larb" property can be removed.
>> the iommu consumer don't need call the mtk_smi_larb_get/put to enable
>> the power and clock of smi-larb and smi-common.
>>
>> Base on the media branch [1] and a jpeg dtbinding patchset[2] that already got
>> the necessary R-b.
>>
>> [1] git://linuxtv.org/hverkuil/media_tree.git tags/br-v5.18d
>> [2] 
>> https://lore.kernel.org/linux-mediatek/20211206130425.184420-1-hsinyi@chromium.org/ 
>>
>>
>> Change notes:
>> v10: a) Rebase on the media tree. Respin the "media: mtk-vcodec:" patches.
>>       b) Add Joerg's Ack for iommu patches.
>>
>> v9: 
>> https://lore.kernel.org/linux-mediatek/20211112105509.12010-1-yong.wu@mediatek.com/ 
>>
>>      1) Add return -ENODEV when the dev is null.
>>      2) Add more strict about the case that a iommu consume device use the 
>> ports in
>>      different larbs. Don't allow this case.
>>      3) Remove two codec interface: mtk_vcodec_release_enc/dec_pm since it 
>> only has one
>>      line now.
>>
>> v8: 
>> https://lore.kernel.org/linux-mediatek/20210929013719.25120-1-yong.wu@mediatek.com/ 
>>
>>      1) Rebase on v5.15-rc1.
>>      2) Don't rebase the below mdp patchset that may still need more discuss.
>>      
>> https://lore.kernel.org/linux-mediatek/20210709022324.1607884-1-eizan@chromium.org/ 
>>
>>      3) Add Frank's Tested-by. Remove Dafna's Tested-by as he requested.
>>
>> v7: 
>> https://lore.kernel.org/linux-mediatek/20210730025238.22456-1-yong.wu@mediatek.com/ 
>>
>>      1) Fix a arm32 boot fail issue. reported from Frank.
>>      2) Add a return fail in the mtk drm. suggested by Dafna.
>>
>> v6: 
>> https://lore.kernel.org/linux-mediatek/20210714025626.5528-1-yong.wu@mediatek.com/ 
>>
>>      1) rebase on v5.14-rc1.
>>      2) Fix the issue commented in v5 from Dafna and Hsin-Yi.
>>      3) Remove the patches about using pm_runtime_resume_and_get since they have
>>         already been merged by other patches.
>>
>> v5: 
>> https://lore.kernel.org/linux-mediatek/20210410091128.31823-1-yong.wu@mediatek.com/ 
>>
>>      1) Base v5.12-rc2.
>>      2) Remove changing the mtk-iommu to module_platform_driver patch, It have 
>> already been a
>>      independent patch.
>>
>> v4: 
>> https://lore.kernel.org/linux-mediatek/1590826218-23653-1-git-send-email-yong.wu@mediatek.com/ 
>>
>>      base on v5.7-rc1.
>>    1) Move drm PM patch before smi patchs.
>>    2) Change builtin_platform_driver to module_platform_driver since we may need
>>       build as module.
>>    3) Rebase many patchset as above.
>>
>> v3: 
>> https://lore.kernel.org/linux-iommu/1567503456-24725-1-git-send-email-yong.wu@mediatek.com/ 
>>
>>      1) rebase on v5.3-rc1 and the latest mt8183 patchset.
>>      2) Use device_is_bound to check whether the driver is ready from Matthias.
>>      3) Add DL_FLAG_STATELESS flag when calling device_link_add and explain the
>>     reason in the commit message[3/14].
>>      4) Add a display patch[12/14] into this series. otherwise it may affect
>>     display HW fastlogo even though it don't happen in mt8183.
>> v2: 
>> https://lore.kernel.org/linux-iommu/1560171313-28299-1-git-send-email-yong.wu@mediatek.com/ 
>>
>>     1) rebase on v5.2-rc1.
>>     2) Move adding device_link between the consumer and smi-larb into
>> iommu_add_device from Robin.
>>     3) add DL_FLAG_AUTOREMOVE_CONSUMER even though the smi is built-in from Evan.
>>     4) Remove the shutdown callback in iommu.
>>
>> v1: 
>> https://lore.kernel.org/linux-iommu/1546318276-18993-1-git-send-email-yong.wu@mediatek.com/ 
>>
>>
>> Yong Wu (12):
>>    dt-binding: mediatek: Get rid of mediatek,larb for multimedia HW
>>    iommu/mediatek-v1: Free the existed fwspec if the master dev already
>>      has
>>    iommu/mediatek: Return ENODEV if the device is NULL
>>    iommu/mediatek: Add probe_defer for smi-larb
>>    iommu/mediatek: Add device_link between the consumer and the larb
>>      devices
>>    media: mtk-jpeg: Get rid of mtk_smi_larb_get/put
>>    media: mtk-mdp: Get rid of mtk_smi_larb_get/put
>>    drm/mediatek: Get rid of mtk_smi_larb_get/put
>>    media: mtk-vcodec: Get rid of mtk_smi_larb_get/put
>>    memory: mtk-smi: Get rid of mtk_smi_larb_get/put
>>    arm: dts: mediatek: Get rid of mediatek,larb for MM nodes
>>    arm64: dts: mediatek: Get rid of mediatek,larb for MM nodes
>>
>> Yongqiang Niu (1):
>>    drm/mediatek: Add pm runtime support for ovl and rdma
>>
>>   .../display/mediatek/mediatek,disp.txt        |  9 ----
>>   .../media/mediatek,vcodec-decoder.yaml        |  7 ---
>>   .../media/mediatek,vcodec-encoder.yaml        |  8 ----
>>   .../bindings/media/mediatek-jpeg-decoder.yaml |  9 ----
>>   .../bindings/media/mediatek-jpeg-encoder.yaml |  9 ----
>>   .../bindings/media/mediatek-mdp.txt           |  8 ----
>>   arch/arm/boot/dts/mt2701.dtsi                 |  2 -
>>   arch/arm/boot/dts/mt7623n.dtsi                |  5 ---
>>   arch/arm64/boot/dts/mediatek/mt8173.dtsi      | 16 -------
>>   arch/arm64/boot/dts/mediatek/mt8183.dtsi      |  6 ---
>>   drivers/gpu/drm/mediatek/mtk_disp_ovl.c       |  8 +++-
>>   drivers/gpu/drm/mediatek/mtk_disp_rdma.c      |  9 +++-
>>   drivers/gpu/drm/mediatek/mtk_drm_crtc.c       | 15 ++++---
>>   drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c   | 36 +--------------
>>   drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h   |  1 -
>>   drivers/gpu/drm/mediatek/mtk_drm_drv.c        |  5 +--
>>   drivers/iommu/mtk_iommu.c                     | 34 ++++++++++++++
>>   drivers/iommu/mtk_iommu_v1.c                  | 42 ++++++++++++++++-
>>   .../media/platform/mtk-jpeg/mtk_jpeg_core.c   | 45 +------------------
>>   .../media/platform/mtk-jpeg/mtk_jpeg_core.h   |  2 -
>>   drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 40 -----------------
>>   drivers/media/platform/mtk-mdp/mtk_mdp_comp.h |  2 -
>>   drivers/media/platform/mtk-mdp/mtk_mdp_core.c |  1 -
>>   .../platform/mtk-vcodec/mtk_vcodec_dec_drv.c  |  2 -
>>   .../platform/mtk-vcodec/mtk_vcodec_dec_hw.c   |  1 -
>>   .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c   | 41 +++--------------
>>   .../platform/mtk-vcodec/mtk_vcodec_drv.h      |  3 --
>>   .../platform/mtk-vcodec/mtk_vcodec_enc.c      |  1 -
>>   .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c  |  2 -
>>   .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c   | 45 +++----------------
>>   drivers/memory/mtk-smi.c                      | 14 ------
>>   include/soc/mediatek/smi.h                    | 20 ---------
>>   32 files changed, 115 insertions(+), 333 deletions(-)
>>
> 
> Hello Hans, Matthias,
> on my side, this series is totally ready for merge, hence, green light from here.
> 
> Can you please take it for 5.18?
> 

@Hans: I understand you take the series through your tree. Please let me know 
when you do so. I'll take care of patch 12 and 13, which should go through my tree.

Thanks!
Matthias

^ permalink raw reply	[flat|nested] 105+ messages in thread

* Re: [PATCH v10 00/13] Clean up "mediatek,larb"
@ 2022-01-17 11:49     ` Matthias Brugger
  0 siblings, 0 replies; 105+ messages in thread
From: Matthias Brugger @ 2022-01-17 11:49 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno, Yong Wu, Hans Verkuil, Joerg Roedel,
	Rob Herring, Krzysztof Kozlowski, David Airlie,
	Mauro Carvalho Chehab
  Cc: Evan Green, Robin Murphy, Tomasz Figa, Will Deacon,
	linux-mediatek, srv_heupstream, devicetree, linux-kernel,
	linux-arm-kernel, iommu, youlin.pei, Matthias Kaehlcke, anan.sun,
	yi.kuo, acourbot, linux-media, dri-devel, Daniel Vetter,
	Chun-Kuang Hu, Philipp Zabel, Tiffany Lin, Dafna Hirschfeld,
	Hsin-Yi Wang, Eizan Miyamoto, anthony.huang, Frank Wunderlich,
	mingyuan.ma, yf.wang, libo.kang



On 17/01/2022 11:27, AngeloGioacchino Del Regno wrote:
> Il 17/01/22 08:04, Yong Wu ha scritto:
>> MediaTek IOMMU block diagram always like below:
>>
>>          M4U
>>           |
>>      smi-common
>>           |
>>    -------------
>>    |         |  ...
>>    |         |
>> larb1     larb2
>>    |         |
>> vdec       venc
>>
>> All the consumer connect with smi-larb, then connect with smi-common.
>>
>> When the consumer works, it should enable the smi-larb's power which also
>> need enable the smi-common's power firstly.
>>
>> Thus, Firstly, use the device link connect the consumer and the
>> smi-larbs. then add device link between the smi-larb and smi-common.
>>
>> After adding the device_link, then "mediatek,larb" property can be removed.
>> the iommu consumer don't need call the mtk_smi_larb_get/put to enable
>> the power and clock of smi-larb and smi-common.
>>
>> Base on the media branch [1] and a jpeg dtbinding patchset[2] that already got
>> the necessary R-b.
>>
>> [1] git://linuxtv.org/hverkuil/media_tree.git tags/br-v5.18d
>> [2] 
>> https://lore.kernel.org/linux-mediatek/20211206130425.184420-1-hsinyi@chromium.org/ 
>>
>>
>> Change notes:
>> v10: a) Rebase on the media tree. Respin the "media: mtk-vcodec:" patches.
>>       b) Add Joerg's Ack for iommu patches.
>>
>> v9: 
>> https://lore.kernel.org/linux-mediatek/20211112105509.12010-1-yong.wu@mediatek.com/ 
>>
>>      1) Add return -ENODEV when the dev is null.
>>      2) Add more strict about the case that a iommu consume device use the 
>> ports in
>>      different larbs. Don't allow this case.
>>      3) Remove two codec interface: mtk_vcodec_release_enc/dec_pm since it 
>> only has one
>>      line now.
>>
>> v8: 
>> https://lore.kernel.org/linux-mediatek/20210929013719.25120-1-yong.wu@mediatek.com/ 
>>
>>      1) Rebase on v5.15-rc1.
>>      2) Don't rebase the below mdp patchset that may still need more discuss.
>>      
>> https://lore.kernel.org/linux-mediatek/20210709022324.1607884-1-eizan@chromium.org/ 
>>
>>      3) Add Frank's Tested-by. Remove Dafna's Tested-by as he requested.
>>
>> v7: 
>> https://lore.kernel.org/linux-mediatek/20210730025238.22456-1-yong.wu@mediatek.com/ 
>>
>>      1) Fix a arm32 boot fail issue. reported from Frank.
>>      2) Add a return fail in the mtk drm. suggested by Dafna.
>>
>> v6: 
>> https://lore.kernel.org/linux-mediatek/20210714025626.5528-1-yong.wu@mediatek.com/ 
>>
>>      1) rebase on v5.14-rc1.
>>      2) Fix the issue commented in v5 from Dafna and Hsin-Yi.
>>      3) Remove the patches about using pm_runtime_resume_and_get since they have
>>         already been merged by other patches.
>>
>> v5: 
>> https://lore.kernel.org/linux-mediatek/20210410091128.31823-1-yong.wu@mediatek.com/ 
>>
>>      1) Base v5.12-rc2.
>>      2) Remove changing the mtk-iommu to module_platform_driver patch, It have 
>> already been a
>>      independent patch.
>>
>> v4: 
>> https://lore.kernel.org/linux-mediatek/1590826218-23653-1-git-send-email-yong.wu@mediatek.com/ 
>>
>>      base on v5.7-rc1.
>>    1) Move drm PM patch before smi patchs.
>>    2) Change builtin_platform_driver to module_platform_driver since we may need
>>       build as module.
>>    3) Rebase many patchset as above.
>>
>> v3: 
>> https://lore.kernel.org/linux-iommu/1567503456-24725-1-git-send-email-yong.wu@mediatek.com/ 
>>
>>      1) rebase on v5.3-rc1 and the latest mt8183 patchset.
>>      2) Use device_is_bound to check whether the driver is ready from Matthias.
>>      3) Add DL_FLAG_STATELESS flag when calling device_link_add and explain the
>>     reason in the commit message[3/14].
>>      4) Add a display patch[12/14] into this series. otherwise it may affect
>>     display HW fastlogo even though it don't happen in mt8183.
>> v2: 
>> https://lore.kernel.org/linux-iommu/1560171313-28299-1-git-send-email-yong.wu@mediatek.com/ 
>>
>>     1) rebase on v5.2-rc1.
>>     2) Move adding device_link between the consumer and smi-larb into
>> iommu_add_device from Robin.
>>     3) add DL_FLAG_AUTOREMOVE_CONSUMER even though the smi is built-in from Evan.
>>     4) Remove the shutdown callback in iommu.
>>
>> v1: 
>> https://lore.kernel.org/linux-iommu/1546318276-18993-1-git-send-email-yong.wu@mediatek.com/ 
>>
>>
>> Yong Wu (12):
>>    dt-binding: mediatek: Get rid of mediatek,larb for multimedia HW
>>    iommu/mediatek-v1: Free the existed fwspec if the master dev already
>>      has
>>    iommu/mediatek: Return ENODEV if the device is NULL
>>    iommu/mediatek: Add probe_defer for smi-larb
>>    iommu/mediatek: Add device_link between the consumer and the larb
>>      devices
>>    media: mtk-jpeg: Get rid of mtk_smi_larb_get/put
>>    media: mtk-mdp: Get rid of mtk_smi_larb_get/put
>>    drm/mediatek: Get rid of mtk_smi_larb_get/put
>>    media: mtk-vcodec: Get rid of mtk_smi_larb_get/put
>>    memory: mtk-smi: Get rid of mtk_smi_larb_get/put
>>    arm: dts: mediatek: Get rid of mediatek,larb for MM nodes
>>    arm64: dts: mediatek: Get rid of mediatek,larb for MM nodes
>>
>> Yongqiang Niu (1):
>>    drm/mediatek: Add pm runtime support for ovl and rdma
>>
>>   .../display/mediatek/mediatek,disp.txt        |  9 ----
>>   .../media/mediatek,vcodec-decoder.yaml        |  7 ---
>>   .../media/mediatek,vcodec-encoder.yaml        |  8 ----
>>   .../bindings/media/mediatek-jpeg-decoder.yaml |  9 ----
>>   .../bindings/media/mediatek-jpeg-encoder.yaml |  9 ----
>>   .../bindings/media/mediatek-mdp.txt           |  8 ----
>>   arch/arm/boot/dts/mt2701.dtsi                 |  2 -
>>   arch/arm/boot/dts/mt7623n.dtsi                |  5 ---
>>   arch/arm64/boot/dts/mediatek/mt8173.dtsi      | 16 -------
>>   arch/arm64/boot/dts/mediatek/mt8183.dtsi      |  6 ---
>>   drivers/gpu/drm/mediatek/mtk_disp_ovl.c       |  8 +++-
>>   drivers/gpu/drm/mediatek/mtk_disp_rdma.c      |  9 +++-
>>   drivers/gpu/drm/mediatek/mtk_drm_crtc.c       | 15 ++++---
>>   drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c   | 36 +--------------
>>   drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h   |  1 -
>>   drivers/gpu/drm/mediatek/mtk_drm_drv.c        |  5 +--
>>   drivers/iommu/mtk_iommu.c                     | 34 ++++++++++++++
>>   drivers/iommu/mtk_iommu_v1.c                  | 42 ++++++++++++++++-
>>   .../media/platform/mtk-jpeg/mtk_jpeg_core.c   | 45 +------------------
>>   .../media/platform/mtk-jpeg/mtk_jpeg_core.h   |  2 -
>>   drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 40 -----------------
>>   drivers/media/platform/mtk-mdp/mtk_mdp_comp.h |  2 -
>>   drivers/media/platform/mtk-mdp/mtk_mdp_core.c |  1 -
>>   .../platform/mtk-vcodec/mtk_vcodec_dec_drv.c  |  2 -
>>   .../platform/mtk-vcodec/mtk_vcodec_dec_hw.c   |  1 -
>>   .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c   | 41 +++--------------
>>   .../platform/mtk-vcodec/mtk_vcodec_drv.h      |  3 --
>>   .../platform/mtk-vcodec/mtk_vcodec_enc.c      |  1 -
>>   .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c  |  2 -
>>   .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c   | 45 +++----------------
>>   drivers/memory/mtk-smi.c                      | 14 ------
>>   include/soc/mediatek/smi.h                    | 20 ---------
>>   32 files changed, 115 insertions(+), 333 deletions(-)
>>
> 
> Hello Hans, Matthias,
> on my side, this series is totally ready for merge, hence, green light from here.
> 
> Can you please take it for 5.18?
> 

@Hans: I understand you take the series through your tree. Please let me know 
when you do so. I'll take care of patch 12 and 13, which should go through my tree.

Thanks!
Matthias

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 105+ messages in thread

* Re: [PATCH v10 00/13] Clean up "mediatek,larb"
  2022-01-17 11:49     ` Matthias Brugger
                         ` (2 preceding siblings ...)
  (?)
@ 2022-01-17 12:04       ` Hans Verkuil
  -1 siblings, 0 replies; 105+ messages in thread
From: Hans Verkuil @ 2022-01-17 12:04 UTC (permalink / raw)
  To: Matthias Brugger, AngeloGioacchino Del Regno, Yong Wu,
	Joerg Roedel, Rob Herring, Krzysztof Kozlowski, David Airlie,
	Mauro Carvalho Chehab
  Cc: Evan Green, Robin Murphy, Tomasz Figa, Will Deacon,
	linux-mediatek, srv_heupstream, devicetree, linux-kernel,
	linux-arm-kernel, iommu, youlin.pei, Matthias Kaehlcke, anan.sun,
	yi.kuo, acourbot, linux-media, dri-devel, Daniel Vetter,
	Chun-Kuang Hu, Philipp Zabel, Tiffany Lin, Dafna Hirschfeld,
	Hsin-Yi Wang, Eizan Miyamoto, anthony.huang, Frank Wunderlich,
	mingyuan.ma, yf.wang, libo.kang

Hi Matthias,

On 1/17/22 12:49, Matthias Brugger wrote:
> 
> 
> On 17/01/2022 11:27, AngeloGioacchino Del Regno wrote:
>> Il 17/01/22 08:04, Yong Wu ha scritto:
>>> MediaTek IOMMU block diagram always like below:
>>>
>>>          M4U
>>>           |
>>>      smi-common
>>>           |
>>>    -------------
>>>    |         |  ...
>>>    |         |
>>> larb1     larb2
>>>    |         |
>>> vdec       venc
>>>
>>> All the consumer connect with smi-larb, then connect with smi-common.
>>>
>>> When the consumer works, it should enable the smi-larb's power which also
>>> need enable the smi-common's power firstly.
>>>
>>> Thus, Firstly, use the device link connect the consumer and the
>>> smi-larbs. then add device link between the smi-larb and smi-common.
>>>
>>> After adding the device_link, then "mediatek,larb" property can be removed.
>>> the iommu consumer don't need call the mtk_smi_larb_get/put to enable
>>> the power and clock of smi-larb and smi-common.
>>>
>>> Base on the media branch [1] and a jpeg dtbinding patchset[2] that already got
>>> the necessary R-b.
>>>
>>> [1] git://linuxtv.org/hverkuil/media_tree.git tags/br-v5.18d
>>> [2] https://lore.kernel.org/linux-mediatek/20211206130425.184420-1-hsinyi@chromium.org/
>>>
>>> Change notes:
>>> v10: a) Rebase on the media tree. Respin the "media: mtk-vcodec:" patches.
>>>       b) Add Joerg's Ack for iommu patches.
>>>
>>> v9: https://lore.kernel.org/linux-mediatek/20211112105509.12010-1-yong.wu@mediatek.com/
>>>      1) Add return -ENODEV when the dev is null.
>>>      2) Add more strict about the case that a iommu consume device use the ports in
>>>      different larbs. Don't allow this case.
>>>      3) Remove two codec interface: mtk_vcodec_release_enc/dec_pm since it only has one
>>>      line now.
>>>
>>> v8: https://lore.kernel.org/linux-mediatek/20210929013719.25120-1-yong.wu@mediatek.com/
>>>      1) Rebase on v5.15-rc1.
>>>      2) Don't rebase the below mdp patchset that may still need more discuss.
>>>      https://lore.kernel.org/linux-mediatek/20210709022324.1607884-1-eizan@chromium.org/
>>>      3) Add Frank's Tested-by. Remove Dafna's Tested-by as he requested.
>>>
>>> v7: https://lore.kernel.org/linux-mediatek/20210730025238.22456-1-yong.wu@mediatek.com/
>>>      1) Fix a arm32 boot fail issue. reported from Frank.
>>>      2) Add a return fail in the mtk drm. suggested by Dafna.
>>>
>>> v6: https://lore.kernel.org/linux-mediatek/20210714025626.5528-1-yong.wu@mediatek.com/
>>>      1) rebase on v5.14-rc1.
>>>      2) Fix the issue commented in v5 from Dafna and Hsin-Yi.
>>>      3) Remove the patches about using pm_runtime_resume_and_get since they have
>>>         already been merged by other patches.
>>>
>>> v5: https://lore.kernel.org/linux-mediatek/20210410091128.31823-1-yong.wu@mediatek.com/
>>>      1) Base v5.12-rc2.
>>>      2) Remove changing the mtk-iommu to module_platform_driver patch, It have already been a
>>>      independent patch.
>>>
>>> v4: https://lore.kernel.org/linux-mediatek/1590826218-23653-1-git-send-email-yong.wu@mediatek.com/
>>>      base on v5.7-rc1.
>>>    1) Move drm PM patch before smi patchs.
>>>    2) Change builtin_platform_driver to module_platform_driver since we may need
>>>       build as module.
>>>    3) Rebase many patchset as above.
>>>
>>> v3: https://lore.kernel.org/linux-iommu/1567503456-24725-1-git-send-email-yong.wu@mediatek.com/
>>>      1) rebase on v5.3-rc1 and the latest mt8183 patchset.
>>>      2) Use device_is_bound to check whether the driver is ready from Matthias.
>>>      3) Add DL_FLAG_STATELESS flag when calling device_link_add and explain the
>>>     reason in the commit message[3/14].
>>>      4) Add a display patch[12/14] into this series. otherwise it may affect
>>>     display HW fastlogo even though it don't happen in mt8183.
>>> v2: https://lore.kernel.org/linux-iommu/1560171313-28299-1-git-send-email-yong.wu@mediatek.com/
>>>     1) rebase on v5.2-rc1.
>>>     2) Move adding device_link between the consumer and smi-larb into
>>> iommu_add_device from Robin.
>>>     3) add DL_FLAG_AUTOREMOVE_CONSUMER even though the smi is built-in from Evan.
>>>     4) Remove the shutdown callback in iommu.
>>>
>>> v1: https://lore.kernel.org/linux-iommu/1546318276-18993-1-git-send-email-yong.wu@mediatek.com/
>>>
>>> Yong Wu (12):
>>>    dt-binding: mediatek: Get rid of mediatek,larb for multimedia HW
>>>    iommu/mediatek-v1: Free the existed fwspec if the master dev already
>>>      has
>>>    iommu/mediatek: Return ENODEV if the device is NULL
>>>    iommu/mediatek: Add probe_defer for smi-larb
>>>    iommu/mediatek: Add device_link between the consumer and the larb
>>>      devices
>>>    media: mtk-jpeg: Get rid of mtk_smi_larb_get/put
>>>    media: mtk-mdp: Get rid of mtk_smi_larb_get/put
>>>    drm/mediatek: Get rid of mtk_smi_larb_get/put
>>>    media: mtk-vcodec: Get rid of mtk_smi_larb_get/put
>>>    memory: mtk-smi: Get rid of mtk_smi_larb_get/put
>>>    arm: dts: mediatek: Get rid of mediatek,larb for MM nodes
>>>    arm64: dts: mediatek: Get rid of mediatek,larb for MM nodes
>>>
>>> Yongqiang Niu (1):
>>>    drm/mediatek: Add pm runtime support for ovl and rdma
>>>
>>>   .../display/mediatek/mediatek,disp.txt        |  9 ----
>>>   .../media/mediatek,vcodec-decoder.yaml        |  7 ---
>>>   .../media/mediatek,vcodec-encoder.yaml        |  8 ----
>>>   .../bindings/media/mediatek-jpeg-decoder.yaml |  9 ----
>>>   .../bindings/media/mediatek-jpeg-encoder.yaml |  9 ----
>>>   .../bindings/media/mediatek-mdp.txt           |  8 ----
>>>   arch/arm/boot/dts/mt2701.dtsi                 |  2 -
>>>   arch/arm/boot/dts/mt7623n.dtsi                |  5 ---
>>>   arch/arm64/boot/dts/mediatek/mt8173.dtsi      | 16 -------
>>>   arch/arm64/boot/dts/mediatek/mt8183.dtsi      |  6 ---
>>>   drivers/gpu/drm/mediatek/mtk_disp_ovl.c       |  8 +++-
>>>   drivers/gpu/drm/mediatek/mtk_disp_rdma.c      |  9 +++-
>>>   drivers/gpu/drm/mediatek/mtk_drm_crtc.c       | 15 ++++---
>>>   drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c   | 36 +--------------
>>>   drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h   |  1 -
>>>   drivers/gpu/drm/mediatek/mtk_drm_drv.c        |  5 +--
>>>   drivers/iommu/mtk_iommu.c                     | 34 ++++++++++++++
>>>   drivers/iommu/mtk_iommu_v1.c                  | 42 ++++++++++++++++-
>>>   .../media/platform/mtk-jpeg/mtk_jpeg_core.c   | 45 +------------------
>>>   .../media/platform/mtk-jpeg/mtk_jpeg_core.h   |  2 -
>>>   drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 40 -----------------
>>>   drivers/media/platform/mtk-mdp/mtk_mdp_comp.h |  2 -
>>>   drivers/media/platform/mtk-mdp/mtk_mdp_core.c |  1 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_dec_drv.c  |  2 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_dec_hw.c   |  1 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c   | 41 +++--------------
>>>   .../platform/mtk-vcodec/mtk_vcodec_drv.h      |  3 --
>>>   .../platform/mtk-vcodec/mtk_vcodec_enc.c      |  1 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c  |  2 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c   | 45 +++----------------
>>>   drivers/memory/mtk-smi.c                      | 14 ------
>>>   include/soc/mediatek/smi.h                    | 20 ---------
>>>   32 files changed, 115 insertions(+), 333 deletions(-)
>>>
>>
>> Hello Hans, Matthias,
>> on my side, this series is totally ready for merge, hence, green light from here.
>>
>> Can you please take it for 5.18?
>>
> 
> @Hans: I understand you take the series through your tree. Please let me know when you do so. I'll take care of patch 12 and 13, which should go through my tree.

Will do. I hope to send the PR in the next few days.

Regards,

	Hans

^ permalink raw reply	[flat|nested] 105+ messages in thread

* Re: [PATCH v10 00/13] Clean up "mediatek,larb"
@ 2022-01-17 12:04       ` Hans Verkuil
  0 siblings, 0 replies; 105+ messages in thread
From: Hans Verkuil @ 2022-01-17 12:04 UTC (permalink / raw)
  To: Matthias Brugger, AngeloGioacchino Del Regno, Yong Wu,
	Joerg Roedel, Rob Herring, Krzysztof Kozlowski, David Airlie,
	Mauro Carvalho Chehab
  Cc: Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang, anthony.huang,
	youlin.pei, Evan Green, Eizan Miyamoto, Matthias Kaehlcke,
	mingyuan.ma, linux-media, devicetree, Philipp Zabel,
	Frank Wunderlich, libo.kang, yi.kuo, linux-mediatek,
	Hsin-Yi Wang, Tiffany Lin, linux-arm-kernel, anan.sun,
	srv_heupstream, acourbot, linux-kernel, iommu, Daniel Vetter,
	Robin Murphy

Hi Matthias,

On 1/17/22 12:49, Matthias Brugger wrote:
> 
> 
> On 17/01/2022 11:27, AngeloGioacchino Del Regno wrote:
>> Il 17/01/22 08:04, Yong Wu ha scritto:
>>> MediaTek IOMMU block diagram always like below:
>>>
>>>          M4U
>>>           |
>>>      smi-common
>>>           |
>>>    -------------
>>>    |         |  ...
>>>    |         |
>>> larb1     larb2
>>>    |         |
>>> vdec       venc
>>>
>>> All the consumer connect with smi-larb, then connect with smi-common.
>>>
>>> When the consumer works, it should enable the smi-larb's power which also
>>> need enable the smi-common's power firstly.
>>>
>>> Thus, Firstly, use the device link connect the consumer and the
>>> smi-larbs. then add device link between the smi-larb and smi-common.
>>>
>>> After adding the device_link, then "mediatek,larb" property can be removed.
>>> the iommu consumer don't need call the mtk_smi_larb_get/put to enable
>>> the power and clock of smi-larb and smi-common.
>>>
>>> Base on the media branch [1] and a jpeg dtbinding patchset[2] that already got
>>> the necessary R-b.
>>>
>>> [1] git://linuxtv.org/hverkuil/media_tree.git tags/br-v5.18d
>>> [2] https://lore.kernel.org/linux-mediatek/20211206130425.184420-1-hsinyi@chromium.org/
>>>
>>> Change notes:
>>> v10: a) Rebase on the media tree. Respin the "media: mtk-vcodec:" patches.
>>>       b) Add Joerg's Ack for iommu patches.
>>>
>>> v9: https://lore.kernel.org/linux-mediatek/20211112105509.12010-1-yong.wu@mediatek.com/
>>>      1) Add return -ENODEV when the dev is null.
>>>      2) Add more strict about the case that a iommu consume device use the ports in
>>>      different larbs. Don't allow this case.
>>>      3) Remove two codec interface: mtk_vcodec_release_enc/dec_pm since it only has one
>>>      line now.
>>>
>>> v8: https://lore.kernel.org/linux-mediatek/20210929013719.25120-1-yong.wu@mediatek.com/
>>>      1) Rebase on v5.15-rc1.
>>>      2) Don't rebase the below mdp patchset that may still need more discuss.
>>>      https://lore.kernel.org/linux-mediatek/20210709022324.1607884-1-eizan@chromium.org/
>>>      3) Add Frank's Tested-by. Remove Dafna's Tested-by as he requested.
>>>
>>> v7: https://lore.kernel.org/linux-mediatek/20210730025238.22456-1-yong.wu@mediatek.com/
>>>      1) Fix a arm32 boot fail issue. reported from Frank.
>>>      2) Add a return fail in the mtk drm. suggested by Dafna.
>>>
>>> v6: https://lore.kernel.org/linux-mediatek/20210714025626.5528-1-yong.wu@mediatek.com/
>>>      1) rebase on v5.14-rc1.
>>>      2) Fix the issue commented in v5 from Dafna and Hsin-Yi.
>>>      3) Remove the patches about using pm_runtime_resume_and_get since they have
>>>         already been merged by other patches.
>>>
>>> v5: https://lore.kernel.org/linux-mediatek/20210410091128.31823-1-yong.wu@mediatek.com/
>>>      1) Base v5.12-rc2.
>>>      2) Remove changing the mtk-iommu to module_platform_driver patch, It have already been a
>>>      independent patch.
>>>
>>> v4: https://lore.kernel.org/linux-mediatek/1590826218-23653-1-git-send-email-yong.wu@mediatek.com/
>>>      base on v5.7-rc1.
>>>    1) Move drm PM patch before smi patchs.
>>>    2) Change builtin_platform_driver to module_platform_driver since we may need
>>>       build as module.
>>>    3) Rebase many patchset as above.
>>>
>>> v3: https://lore.kernel.org/linux-iommu/1567503456-24725-1-git-send-email-yong.wu@mediatek.com/
>>>      1) rebase on v5.3-rc1 and the latest mt8183 patchset.
>>>      2) Use device_is_bound to check whether the driver is ready from Matthias.
>>>      3) Add DL_FLAG_STATELESS flag when calling device_link_add and explain the
>>>     reason in the commit message[3/14].
>>>      4) Add a display patch[12/14] into this series. otherwise it may affect
>>>     display HW fastlogo even though it don't happen in mt8183.
>>> v2: https://lore.kernel.org/linux-iommu/1560171313-28299-1-git-send-email-yong.wu@mediatek.com/
>>>     1) rebase on v5.2-rc1.
>>>     2) Move adding device_link between the consumer and smi-larb into
>>> iommu_add_device from Robin.
>>>     3) add DL_FLAG_AUTOREMOVE_CONSUMER even though the smi is built-in from Evan.
>>>     4) Remove the shutdown callback in iommu.
>>>
>>> v1: https://lore.kernel.org/linux-iommu/1546318276-18993-1-git-send-email-yong.wu@mediatek.com/
>>>
>>> Yong Wu (12):
>>>    dt-binding: mediatek: Get rid of mediatek,larb for multimedia HW
>>>    iommu/mediatek-v1: Free the existed fwspec if the master dev already
>>>      has
>>>    iommu/mediatek: Return ENODEV if the device is NULL
>>>    iommu/mediatek: Add probe_defer for smi-larb
>>>    iommu/mediatek: Add device_link between the consumer and the larb
>>>      devices
>>>    media: mtk-jpeg: Get rid of mtk_smi_larb_get/put
>>>    media: mtk-mdp: Get rid of mtk_smi_larb_get/put
>>>    drm/mediatek: Get rid of mtk_smi_larb_get/put
>>>    media: mtk-vcodec: Get rid of mtk_smi_larb_get/put
>>>    memory: mtk-smi: Get rid of mtk_smi_larb_get/put
>>>    arm: dts: mediatek: Get rid of mediatek,larb for MM nodes
>>>    arm64: dts: mediatek: Get rid of mediatek,larb for MM nodes
>>>
>>> Yongqiang Niu (1):
>>>    drm/mediatek: Add pm runtime support for ovl and rdma
>>>
>>>   .../display/mediatek/mediatek,disp.txt        |  9 ----
>>>   .../media/mediatek,vcodec-decoder.yaml        |  7 ---
>>>   .../media/mediatek,vcodec-encoder.yaml        |  8 ----
>>>   .../bindings/media/mediatek-jpeg-decoder.yaml |  9 ----
>>>   .../bindings/media/mediatek-jpeg-encoder.yaml |  9 ----
>>>   .../bindings/media/mediatek-mdp.txt           |  8 ----
>>>   arch/arm/boot/dts/mt2701.dtsi                 |  2 -
>>>   arch/arm/boot/dts/mt7623n.dtsi                |  5 ---
>>>   arch/arm64/boot/dts/mediatek/mt8173.dtsi      | 16 -------
>>>   arch/arm64/boot/dts/mediatek/mt8183.dtsi      |  6 ---
>>>   drivers/gpu/drm/mediatek/mtk_disp_ovl.c       |  8 +++-
>>>   drivers/gpu/drm/mediatek/mtk_disp_rdma.c      |  9 +++-
>>>   drivers/gpu/drm/mediatek/mtk_drm_crtc.c       | 15 ++++---
>>>   drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c   | 36 +--------------
>>>   drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h   |  1 -
>>>   drivers/gpu/drm/mediatek/mtk_drm_drv.c        |  5 +--
>>>   drivers/iommu/mtk_iommu.c                     | 34 ++++++++++++++
>>>   drivers/iommu/mtk_iommu_v1.c                  | 42 ++++++++++++++++-
>>>   .../media/platform/mtk-jpeg/mtk_jpeg_core.c   | 45 +------------------
>>>   .../media/platform/mtk-jpeg/mtk_jpeg_core.h   |  2 -
>>>   drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 40 -----------------
>>>   drivers/media/platform/mtk-mdp/mtk_mdp_comp.h |  2 -
>>>   drivers/media/platform/mtk-mdp/mtk_mdp_core.c |  1 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_dec_drv.c  |  2 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_dec_hw.c   |  1 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c   | 41 +++--------------
>>>   .../platform/mtk-vcodec/mtk_vcodec_drv.h      |  3 --
>>>   .../platform/mtk-vcodec/mtk_vcodec_enc.c      |  1 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c  |  2 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c   | 45 +++----------------
>>>   drivers/memory/mtk-smi.c                      | 14 ------
>>>   include/soc/mediatek/smi.h                    | 20 ---------
>>>   32 files changed, 115 insertions(+), 333 deletions(-)
>>>
>>
>> Hello Hans, Matthias,
>> on my side, this series is totally ready for merge, hence, green light from here.
>>
>> Can you please take it for 5.18?
>>
> 
> @Hans: I understand you take the series through your tree. Please let me know when you do so. I'll take care of patch 12 and 13, which should go through my tree.

Will do. I hope to send the PR in the next few days.

Regards,

	Hans
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 105+ messages in thread

* Re: [PATCH v10 00/13] Clean up "mediatek,larb"
@ 2022-01-17 12:04       ` Hans Verkuil
  0 siblings, 0 replies; 105+ messages in thread
From: Hans Verkuil @ 2022-01-17 12:04 UTC (permalink / raw)
  To: Matthias Brugger, AngeloGioacchino Del Regno, Yong Wu,
	Joerg Roedel, Rob Herring, Krzysztof Kozlowski, David Airlie,
	Mauro Carvalho Chehab
  Cc: Dafna Hirschfeld, Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang,
	anthony.huang, youlin.pei, Evan Green, Eizan Miyamoto,
	Matthias Kaehlcke, mingyuan.ma, linux-media, devicetree,
	Philipp Zabel, libo.kang, yi.kuo, linux-mediatek, Hsin-Yi Wang,
	Tiffany Lin, linux-arm-kernel, anan.sun, srv_heupstream,
	acourbot, linux-kernel, Tomasz Figa, iommu, Daniel Vetter,
	Robin Murphy

Hi Matthias,

On 1/17/22 12:49, Matthias Brugger wrote:
> 
> 
> On 17/01/2022 11:27, AngeloGioacchino Del Regno wrote:
>> Il 17/01/22 08:04, Yong Wu ha scritto:
>>> MediaTek IOMMU block diagram always like below:
>>>
>>>          M4U
>>>           |
>>>      smi-common
>>>           |
>>>    -------------
>>>    |         |  ...
>>>    |         |
>>> larb1     larb2
>>>    |         |
>>> vdec       venc
>>>
>>> All the consumer connect with smi-larb, then connect with smi-common.
>>>
>>> When the consumer works, it should enable the smi-larb's power which also
>>> need enable the smi-common's power firstly.
>>>
>>> Thus, Firstly, use the device link connect the consumer and the
>>> smi-larbs. then add device link between the smi-larb and smi-common.
>>>
>>> After adding the device_link, then "mediatek,larb" property can be removed.
>>> the iommu consumer don't need call the mtk_smi_larb_get/put to enable
>>> the power and clock of smi-larb and smi-common.
>>>
>>> Base on the media branch [1] and a jpeg dtbinding patchset[2] that already got
>>> the necessary R-b.
>>>
>>> [1] git://linuxtv.org/hverkuil/media_tree.git tags/br-v5.18d
>>> [2] https://lore.kernel.org/linux-mediatek/20211206130425.184420-1-hsinyi@chromium.org/
>>>
>>> Change notes:
>>> v10: a) Rebase on the media tree. Respin the "media: mtk-vcodec:" patches.
>>>       b) Add Joerg's Ack for iommu patches.
>>>
>>> v9: https://lore.kernel.org/linux-mediatek/20211112105509.12010-1-yong.wu@mediatek.com/
>>>      1) Add return -ENODEV when the dev is null.
>>>      2) Add more strict about the case that a iommu consume device use the ports in
>>>      different larbs. Don't allow this case.
>>>      3) Remove two codec interface: mtk_vcodec_release_enc/dec_pm since it only has one
>>>      line now.
>>>
>>> v8: https://lore.kernel.org/linux-mediatek/20210929013719.25120-1-yong.wu@mediatek.com/
>>>      1) Rebase on v5.15-rc1.
>>>      2) Don't rebase the below mdp patchset that may still need more discuss.
>>>      https://lore.kernel.org/linux-mediatek/20210709022324.1607884-1-eizan@chromium.org/
>>>      3) Add Frank's Tested-by. Remove Dafna's Tested-by as he requested.
>>>
>>> v7: https://lore.kernel.org/linux-mediatek/20210730025238.22456-1-yong.wu@mediatek.com/
>>>      1) Fix a arm32 boot fail issue. reported from Frank.
>>>      2) Add a return fail in the mtk drm. suggested by Dafna.
>>>
>>> v6: https://lore.kernel.org/linux-mediatek/20210714025626.5528-1-yong.wu@mediatek.com/
>>>      1) rebase on v5.14-rc1.
>>>      2) Fix the issue commented in v5 from Dafna and Hsin-Yi.
>>>      3) Remove the patches about using pm_runtime_resume_and_get since they have
>>>         already been merged by other patches.
>>>
>>> v5: https://lore.kernel.org/linux-mediatek/20210410091128.31823-1-yong.wu@mediatek.com/
>>>      1) Base v5.12-rc2.
>>>      2) Remove changing the mtk-iommu to module_platform_driver patch, It have already been a
>>>      independent patch.
>>>
>>> v4: https://lore.kernel.org/linux-mediatek/1590826218-23653-1-git-send-email-yong.wu@mediatek.com/
>>>      base on v5.7-rc1.
>>>    1) Move drm PM patch before smi patchs.
>>>    2) Change builtin_platform_driver to module_platform_driver since we may need
>>>       build as module.
>>>    3) Rebase many patchset as above.
>>>
>>> v3: https://lore.kernel.org/linux-iommu/1567503456-24725-1-git-send-email-yong.wu@mediatek.com/
>>>      1) rebase on v5.3-rc1 and the latest mt8183 patchset.
>>>      2) Use device_is_bound to check whether the driver is ready from Matthias.
>>>      3) Add DL_FLAG_STATELESS flag when calling device_link_add and explain the
>>>     reason in the commit message[3/14].
>>>      4) Add a display patch[12/14] into this series. otherwise it may affect
>>>     display HW fastlogo even though it don't happen in mt8183.
>>> v2: https://lore.kernel.org/linux-iommu/1560171313-28299-1-git-send-email-yong.wu@mediatek.com/
>>>     1) rebase on v5.2-rc1.
>>>     2) Move adding device_link between the consumer and smi-larb into
>>> iommu_add_device from Robin.
>>>     3) add DL_FLAG_AUTOREMOVE_CONSUMER even though the smi is built-in from Evan.
>>>     4) Remove the shutdown callback in iommu.
>>>
>>> v1: https://lore.kernel.org/linux-iommu/1546318276-18993-1-git-send-email-yong.wu@mediatek.com/
>>>
>>> Yong Wu (12):
>>>    dt-binding: mediatek: Get rid of mediatek,larb for multimedia HW
>>>    iommu/mediatek-v1: Free the existed fwspec if the master dev already
>>>      has
>>>    iommu/mediatek: Return ENODEV if the device is NULL
>>>    iommu/mediatek: Add probe_defer for smi-larb
>>>    iommu/mediatek: Add device_link between the consumer and the larb
>>>      devices
>>>    media: mtk-jpeg: Get rid of mtk_smi_larb_get/put
>>>    media: mtk-mdp: Get rid of mtk_smi_larb_get/put
>>>    drm/mediatek: Get rid of mtk_smi_larb_get/put
>>>    media: mtk-vcodec: Get rid of mtk_smi_larb_get/put
>>>    memory: mtk-smi: Get rid of mtk_smi_larb_get/put
>>>    arm: dts: mediatek: Get rid of mediatek,larb for MM nodes
>>>    arm64: dts: mediatek: Get rid of mediatek,larb for MM nodes
>>>
>>> Yongqiang Niu (1):
>>>    drm/mediatek: Add pm runtime support for ovl and rdma
>>>
>>>   .../display/mediatek/mediatek,disp.txt        |  9 ----
>>>   .../media/mediatek,vcodec-decoder.yaml        |  7 ---
>>>   .../media/mediatek,vcodec-encoder.yaml        |  8 ----
>>>   .../bindings/media/mediatek-jpeg-decoder.yaml |  9 ----
>>>   .../bindings/media/mediatek-jpeg-encoder.yaml |  9 ----
>>>   .../bindings/media/mediatek-mdp.txt           |  8 ----
>>>   arch/arm/boot/dts/mt2701.dtsi                 |  2 -
>>>   arch/arm/boot/dts/mt7623n.dtsi                |  5 ---
>>>   arch/arm64/boot/dts/mediatek/mt8173.dtsi      | 16 -------
>>>   arch/arm64/boot/dts/mediatek/mt8183.dtsi      |  6 ---
>>>   drivers/gpu/drm/mediatek/mtk_disp_ovl.c       |  8 +++-
>>>   drivers/gpu/drm/mediatek/mtk_disp_rdma.c      |  9 +++-
>>>   drivers/gpu/drm/mediatek/mtk_drm_crtc.c       | 15 ++++---
>>>   drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c   | 36 +--------------
>>>   drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h   |  1 -
>>>   drivers/gpu/drm/mediatek/mtk_drm_drv.c        |  5 +--
>>>   drivers/iommu/mtk_iommu.c                     | 34 ++++++++++++++
>>>   drivers/iommu/mtk_iommu_v1.c                  | 42 ++++++++++++++++-
>>>   .../media/platform/mtk-jpeg/mtk_jpeg_core.c   | 45 +------------------
>>>   .../media/platform/mtk-jpeg/mtk_jpeg_core.h   |  2 -
>>>   drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 40 -----------------
>>>   drivers/media/platform/mtk-mdp/mtk_mdp_comp.h |  2 -
>>>   drivers/media/platform/mtk-mdp/mtk_mdp_core.c |  1 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_dec_drv.c  |  2 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_dec_hw.c   |  1 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c   | 41 +++--------------
>>>   .../platform/mtk-vcodec/mtk_vcodec_drv.h      |  3 --
>>>   .../platform/mtk-vcodec/mtk_vcodec_enc.c      |  1 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c  |  2 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c   | 45 +++----------------
>>>   drivers/memory/mtk-smi.c                      | 14 ------
>>>   include/soc/mediatek/smi.h                    | 20 ---------
>>>   32 files changed, 115 insertions(+), 333 deletions(-)
>>>
>>
>> Hello Hans, Matthias,
>> on my side, this series is totally ready for merge, hence, green light from here.
>>
>> Can you please take it for 5.18?
>>
> 
> @Hans: I understand you take the series through your tree. Please let me know when you do so. I'll take care of patch 12 and 13, which should go through my tree.

Will do. I hope to send the PR in the next few days.

Regards,

	Hans

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 105+ messages in thread

* Re: [PATCH v10 00/13] Clean up "mediatek,larb"
@ 2022-01-17 12:04       ` Hans Verkuil
  0 siblings, 0 replies; 105+ messages in thread
From: Hans Verkuil @ 2022-01-17 12:04 UTC (permalink / raw)
  To: Matthias Brugger, AngeloGioacchino Del Regno, Yong Wu,
	Joerg Roedel, Rob Herring, Krzysztof Kozlowski, David Airlie,
	Mauro Carvalho Chehab
  Cc: Dafna Hirschfeld, Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang,
	anthony.huang, youlin.pei, Evan Green, Eizan Miyamoto,
	Matthias Kaehlcke, mingyuan.ma, linux-media, devicetree,
	Frank Wunderlich, libo.kang, yi.kuo, linux-mediatek,
	Hsin-Yi Wang, Tiffany Lin, linux-arm-kernel, anan.sun,
	srv_heupstream, acourbot, linux-kernel, Tomasz Figa, iommu,
	Robin Murphy

Hi Matthias,

On 1/17/22 12:49, Matthias Brugger wrote:
> 
> 
> On 17/01/2022 11:27, AngeloGioacchino Del Regno wrote:
>> Il 17/01/22 08:04, Yong Wu ha scritto:
>>> MediaTek IOMMU block diagram always like below:
>>>
>>>          M4U
>>>           |
>>>      smi-common
>>>           |
>>>    -------------
>>>    |         |  ...
>>>    |         |
>>> larb1     larb2
>>>    |         |
>>> vdec       venc
>>>
>>> All the consumer connect with smi-larb, then connect with smi-common.
>>>
>>> When the consumer works, it should enable the smi-larb's power which also
>>> need enable the smi-common's power firstly.
>>>
>>> Thus, Firstly, use the device link connect the consumer and the
>>> smi-larbs. then add device link between the smi-larb and smi-common.
>>>
>>> After adding the device_link, then "mediatek,larb" property can be removed.
>>> the iommu consumer don't need call the mtk_smi_larb_get/put to enable
>>> the power and clock of smi-larb and smi-common.
>>>
>>> Base on the media branch [1] and a jpeg dtbinding patchset[2] that already got
>>> the necessary R-b.
>>>
>>> [1] git://linuxtv.org/hverkuil/media_tree.git tags/br-v5.18d
>>> [2] https://lore.kernel.org/linux-mediatek/20211206130425.184420-1-hsinyi@chromium.org/
>>>
>>> Change notes:
>>> v10: a) Rebase on the media tree. Respin the "media: mtk-vcodec:" patches.
>>>       b) Add Joerg's Ack for iommu patches.
>>>
>>> v9: https://lore.kernel.org/linux-mediatek/20211112105509.12010-1-yong.wu@mediatek.com/
>>>      1) Add return -ENODEV when the dev is null.
>>>      2) Add more strict about the case that a iommu consume device use the ports in
>>>      different larbs. Don't allow this case.
>>>      3) Remove two codec interface: mtk_vcodec_release_enc/dec_pm since it only has one
>>>      line now.
>>>
>>> v8: https://lore.kernel.org/linux-mediatek/20210929013719.25120-1-yong.wu@mediatek.com/
>>>      1) Rebase on v5.15-rc1.
>>>      2) Don't rebase the below mdp patchset that may still need more discuss.
>>>      https://lore.kernel.org/linux-mediatek/20210709022324.1607884-1-eizan@chromium.org/
>>>      3) Add Frank's Tested-by. Remove Dafna's Tested-by as he requested.
>>>
>>> v7: https://lore.kernel.org/linux-mediatek/20210730025238.22456-1-yong.wu@mediatek.com/
>>>      1) Fix a arm32 boot fail issue. reported from Frank.
>>>      2) Add a return fail in the mtk drm. suggested by Dafna.
>>>
>>> v6: https://lore.kernel.org/linux-mediatek/20210714025626.5528-1-yong.wu@mediatek.com/
>>>      1) rebase on v5.14-rc1.
>>>      2) Fix the issue commented in v5 from Dafna and Hsin-Yi.
>>>      3) Remove the patches about using pm_runtime_resume_and_get since they have
>>>         already been merged by other patches.
>>>
>>> v5: https://lore.kernel.org/linux-mediatek/20210410091128.31823-1-yong.wu@mediatek.com/
>>>      1) Base v5.12-rc2.
>>>      2) Remove changing the mtk-iommu to module_platform_driver patch, It have already been a
>>>      independent patch.
>>>
>>> v4: https://lore.kernel.org/linux-mediatek/1590826218-23653-1-git-send-email-yong.wu@mediatek.com/
>>>      base on v5.7-rc1.
>>>    1) Move drm PM patch before smi patchs.
>>>    2) Change builtin_platform_driver to module_platform_driver since we may need
>>>       build as module.
>>>    3) Rebase many patchset as above.
>>>
>>> v3: https://lore.kernel.org/linux-iommu/1567503456-24725-1-git-send-email-yong.wu@mediatek.com/
>>>      1) rebase on v5.3-rc1 and the latest mt8183 patchset.
>>>      2) Use device_is_bound to check whether the driver is ready from Matthias.
>>>      3) Add DL_FLAG_STATELESS flag when calling device_link_add and explain the
>>>     reason in the commit message[3/14].
>>>      4) Add a display patch[12/14] into this series. otherwise it may affect
>>>     display HW fastlogo even though it don't happen in mt8183.
>>> v2: https://lore.kernel.org/linux-iommu/1560171313-28299-1-git-send-email-yong.wu@mediatek.com/
>>>     1) rebase on v5.2-rc1.
>>>     2) Move adding device_link between the consumer and smi-larb into
>>> iommu_add_device from Robin.
>>>     3) add DL_FLAG_AUTOREMOVE_CONSUMER even though the smi is built-in from Evan.
>>>     4) Remove the shutdown callback in iommu.
>>>
>>> v1: https://lore.kernel.org/linux-iommu/1546318276-18993-1-git-send-email-yong.wu@mediatek.com/
>>>
>>> Yong Wu (12):
>>>    dt-binding: mediatek: Get rid of mediatek,larb for multimedia HW
>>>    iommu/mediatek-v1: Free the existed fwspec if the master dev already
>>>      has
>>>    iommu/mediatek: Return ENODEV if the device is NULL
>>>    iommu/mediatek: Add probe_defer for smi-larb
>>>    iommu/mediatek: Add device_link between the consumer and the larb
>>>      devices
>>>    media: mtk-jpeg: Get rid of mtk_smi_larb_get/put
>>>    media: mtk-mdp: Get rid of mtk_smi_larb_get/put
>>>    drm/mediatek: Get rid of mtk_smi_larb_get/put
>>>    media: mtk-vcodec: Get rid of mtk_smi_larb_get/put
>>>    memory: mtk-smi: Get rid of mtk_smi_larb_get/put
>>>    arm: dts: mediatek: Get rid of mediatek,larb for MM nodes
>>>    arm64: dts: mediatek: Get rid of mediatek,larb for MM nodes
>>>
>>> Yongqiang Niu (1):
>>>    drm/mediatek: Add pm runtime support for ovl and rdma
>>>
>>>   .../display/mediatek/mediatek,disp.txt        |  9 ----
>>>   .../media/mediatek,vcodec-decoder.yaml        |  7 ---
>>>   .../media/mediatek,vcodec-encoder.yaml        |  8 ----
>>>   .../bindings/media/mediatek-jpeg-decoder.yaml |  9 ----
>>>   .../bindings/media/mediatek-jpeg-encoder.yaml |  9 ----
>>>   .../bindings/media/mediatek-mdp.txt           |  8 ----
>>>   arch/arm/boot/dts/mt2701.dtsi                 |  2 -
>>>   arch/arm/boot/dts/mt7623n.dtsi                |  5 ---
>>>   arch/arm64/boot/dts/mediatek/mt8173.dtsi      | 16 -------
>>>   arch/arm64/boot/dts/mediatek/mt8183.dtsi      |  6 ---
>>>   drivers/gpu/drm/mediatek/mtk_disp_ovl.c       |  8 +++-
>>>   drivers/gpu/drm/mediatek/mtk_disp_rdma.c      |  9 +++-
>>>   drivers/gpu/drm/mediatek/mtk_drm_crtc.c       | 15 ++++---
>>>   drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c   | 36 +--------------
>>>   drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h   |  1 -
>>>   drivers/gpu/drm/mediatek/mtk_drm_drv.c        |  5 +--
>>>   drivers/iommu/mtk_iommu.c                     | 34 ++++++++++++++
>>>   drivers/iommu/mtk_iommu_v1.c                  | 42 ++++++++++++++++-
>>>   .../media/platform/mtk-jpeg/mtk_jpeg_core.c   | 45 +------------------
>>>   .../media/platform/mtk-jpeg/mtk_jpeg_core.h   |  2 -
>>>   drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 40 -----------------
>>>   drivers/media/platform/mtk-mdp/mtk_mdp_comp.h |  2 -
>>>   drivers/media/platform/mtk-mdp/mtk_mdp_core.c |  1 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_dec_drv.c  |  2 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_dec_hw.c   |  1 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c   | 41 +++--------------
>>>   .../platform/mtk-vcodec/mtk_vcodec_drv.h      |  3 --
>>>   .../platform/mtk-vcodec/mtk_vcodec_enc.c      |  1 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c  |  2 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c   | 45 +++----------------
>>>   drivers/memory/mtk-smi.c                      | 14 ------
>>>   include/soc/mediatek/smi.h                    | 20 ---------
>>>   32 files changed, 115 insertions(+), 333 deletions(-)
>>>
>>
>> Hello Hans, Matthias,
>> on my side, this series is totally ready for merge, hence, green light from here.
>>
>> Can you please take it for 5.18?
>>
> 
> @Hans: I understand you take the series through your tree. Please let me know when you do so. I'll take care of patch 12 and 13, which should go through my tree.

Will do. I hope to send the PR in the next few days.

Regards,

	Hans

^ permalink raw reply	[flat|nested] 105+ messages in thread

* Re: [PATCH v10 00/13] Clean up "mediatek,larb"
@ 2022-01-17 12:04       ` Hans Verkuil
  0 siblings, 0 replies; 105+ messages in thread
From: Hans Verkuil @ 2022-01-17 12:04 UTC (permalink / raw)
  To: Matthias Brugger, AngeloGioacchino Del Regno, Yong Wu,
	Joerg Roedel, Rob Herring, Krzysztof Kozlowski, David Airlie,
	Mauro Carvalho Chehab
  Cc: Evan Green, Robin Murphy, Tomasz Figa, Will Deacon,
	linux-mediatek, srv_heupstream, devicetree, linux-kernel,
	linux-arm-kernel, iommu, youlin.pei, Matthias Kaehlcke, anan.sun,
	yi.kuo, acourbot, linux-media, dri-devel, Daniel Vetter,
	Chun-Kuang Hu, Philipp Zabel, Tiffany Lin, Dafna Hirschfeld,
	Hsin-Yi Wang, Eizan Miyamoto, anthony.huang, Frank Wunderlich,
	mingyuan.ma, yf.wang, libo.kang

Hi Matthias,

On 1/17/22 12:49, Matthias Brugger wrote:
> 
> 
> On 17/01/2022 11:27, AngeloGioacchino Del Regno wrote:
>> Il 17/01/22 08:04, Yong Wu ha scritto:
>>> MediaTek IOMMU block diagram always like below:
>>>
>>>          M4U
>>>           |
>>>      smi-common
>>>           |
>>>    -------------
>>>    |         |  ...
>>>    |         |
>>> larb1     larb2
>>>    |         |
>>> vdec       venc
>>>
>>> All the consumer connect with smi-larb, then connect with smi-common.
>>>
>>> When the consumer works, it should enable the smi-larb's power which also
>>> need enable the smi-common's power firstly.
>>>
>>> Thus, Firstly, use the device link connect the consumer and the
>>> smi-larbs. then add device link between the smi-larb and smi-common.
>>>
>>> After adding the device_link, then "mediatek,larb" property can be removed.
>>> the iommu consumer don't need call the mtk_smi_larb_get/put to enable
>>> the power and clock of smi-larb and smi-common.
>>>
>>> Base on the media branch [1] and a jpeg dtbinding patchset[2] that already got
>>> the necessary R-b.
>>>
>>> [1] git://linuxtv.org/hverkuil/media_tree.git tags/br-v5.18d
>>> [2] https://lore.kernel.org/linux-mediatek/20211206130425.184420-1-hsinyi@chromium.org/
>>>
>>> Change notes:
>>> v10: a) Rebase on the media tree. Respin the "media: mtk-vcodec:" patches.
>>>       b) Add Joerg's Ack for iommu patches.
>>>
>>> v9: https://lore.kernel.org/linux-mediatek/20211112105509.12010-1-yong.wu@mediatek.com/
>>>      1) Add return -ENODEV when the dev is null.
>>>      2) Add more strict about the case that a iommu consume device use the ports in
>>>      different larbs. Don't allow this case.
>>>      3) Remove two codec interface: mtk_vcodec_release_enc/dec_pm since it only has one
>>>      line now.
>>>
>>> v8: https://lore.kernel.org/linux-mediatek/20210929013719.25120-1-yong.wu@mediatek.com/
>>>      1) Rebase on v5.15-rc1.
>>>      2) Don't rebase the below mdp patchset that may still need more discuss.
>>>      https://lore.kernel.org/linux-mediatek/20210709022324.1607884-1-eizan@chromium.org/
>>>      3) Add Frank's Tested-by. Remove Dafna's Tested-by as he requested.
>>>
>>> v7: https://lore.kernel.org/linux-mediatek/20210730025238.22456-1-yong.wu@mediatek.com/
>>>      1) Fix a arm32 boot fail issue. reported from Frank.
>>>      2) Add a return fail in the mtk drm. suggested by Dafna.
>>>
>>> v6: https://lore.kernel.org/linux-mediatek/20210714025626.5528-1-yong.wu@mediatek.com/
>>>      1) rebase on v5.14-rc1.
>>>      2) Fix the issue commented in v5 from Dafna and Hsin-Yi.
>>>      3) Remove the patches about using pm_runtime_resume_and_get since they have
>>>         already been merged by other patches.
>>>
>>> v5: https://lore.kernel.org/linux-mediatek/20210410091128.31823-1-yong.wu@mediatek.com/
>>>      1) Base v5.12-rc2.
>>>      2) Remove changing the mtk-iommu to module_platform_driver patch, It have already been a
>>>      independent patch.
>>>
>>> v4: https://lore.kernel.org/linux-mediatek/1590826218-23653-1-git-send-email-yong.wu@mediatek.com/
>>>      base on v5.7-rc1.
>>>    1) Move drm PM patch before smi patchs.
>>>    2) Change builtin_platform_driver to module_platform_driver since we may need
>>>       build as module.
>>>    3) Rebase many patchset as above.
>>>
>>> v3: https://lore.kernel.org/linux-iommu/1567503456-24725-1-git-send-email-yong.wu@mediatek.com/
>>>      1) rebase on v5.3-rc1 and the latest mt8183 patchset.
>>>      2) Use device_is_bound to check whether the driver is ready from Matthias.
>>>      3) Add DL_FLAG_STATELESS flag when calling device_link_add and explain the
>>>     reason in the commit message[3/14].
>>>      4) Add a display patch[12/14] into this series. otherwise it may affect
>>>     display HW fastlogo even though it don't happen in mt8183.
>>> v2: https://lore.kernel.org/linux-iommu/1560171313-28299-1-git-send-email-yong.wu@mediatek.com/
>>>     1) rebase on v5.2-rc1.
>>>     2) Move adding device_link between the consumer and smi-larb into
>>> iommu_add_device from Robin.
>>>     3) add DL_FLAG_AUTOREMOVE_CONSUMER even though the smi is built-in from Evan.
>>>     4) Remove the shutdown callback in iommu.
>>>
>>> v1: https://lore.kernel.org/linux-iommu/1546318276-18993-1-git-send-email-yong.wu@mediatek.com/
>>>
>>> Yong Wu (12):
>>>    dt-binding: mediatek: Get rid of mediatek,larb for multimedia HW
>>>    iommu/mediatek-v1: Free the existed fwspec if the master dev already
>>>      has
>>>    iommu/mediatek: Return ENODEV if the device is NULL
>>>    iommu/mediatek: Add probe_defer for smi-larb
>>>    iommu/mediatek: Add device_link between the consumer and the larb
>>>      devices
>>>    media: mtk-jpeg: Get rid of mtk_smi_larb_get/put
>>>    media: mtk-mdp: Get rid of mtk_smi_larb_get/put
>>>    drm/mediatek: Get rid of mtk_smi_larb_get/put
>>>    media: mtk-vcodec: Get rid of mtk_smi_larb_get/put
>>>    memory: mtk-smi: Get rid of mtk_smi_larb_get/put
>>>    arm: dts: mediatek: Get rid of mediatek,larb for MM nodes
>>>    arm64: dts: mediatek: Get rid of mediatek,larb for MM nodes
>>>
>>> Yongqiang Niu (1):
>>>    drm/mediatek: Add pm runtime support for ovl and rdma
>>>
>>>   .../display/mediatek/mediatek,disp.txt        |  9 ----
>>>   .../media/mediatek,vcodec-decoder.yaml        |  7 ---
>>>   .../media/mediatek,vcodec-encoder.yaml        |  8 ----
>>>   .../bindings/media/mediatek-jpeg-decoder.yaml |  9 ----
>>>   .../bindings/media/mediatek-jpeg-encoder.yaml |  9 ----
>>>   .../bindings/media/mediatek-mdp.txt           |  8 ----
>>>   arch/arm/boot/dts/mt2701.dtsi                 |  2 -
>>>   arch/arm/boot/dts/mt7623n.dtsi                |  5 ---
>>>   arch/arm64/boot/dts/mediatek/mt8173.dtsi      | 16 -------
>>>   arch/arm64/boot/dts/mediatek/mt8183.dtsi      |  6 ---
>>>   drivers/gpu/drm/mediatek/mtk_disp_ovl.c       |  8 +++-
>>>   drivers/gpu/drm/mediatek/mtk_disp_rdma.c      |  9 +++-
>>>   drivers/gpu/drm/mediatek/mtk_drm_crtc.c       | 15 ++++---
>>>   drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c   | 36 +--------------
>>>   drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h   |  1 -
>>>   drivers/gpu/drm/mediatek/mtk_drm_drv.c        |  5 +--
>>>   drivers/iommu/mtk_iommu.c                     | 34 ++++++++++++++
>>>   drivers/iommu/mtk_iommu_v1.c                  | 42 ++++++++++++++++-
>>>   .../media/platform/mtk-jpeg/mtk_jpeg_core.c   | 45 +------------------
>>>   .../media/platform/mtk-jpeg/mtk_jpeg_core.h   |  2 -
>>>   drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 40 -----------------
>>>   drivers/media/platform/mtk-mdp/mtk_mdp_comp.h |  2 -
>>>   drivers/media/platform/mtk-mdp/mtk_mdp_core.c |  1 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_dec_drv.c  |  2 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_dec_hw.c   |  1 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c   | 41 +++--------------
>>>   .../platform/mtk-vcodec/mtk_vcodec_drv.h      |  3 --
>>>   .../platform/mtk-vcodec/mtk_vcodec_enc.c      |  1 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c  |  2 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c   | 45 +++----------------
>>>   drivers/memory/mtk-smi.c                      | 14 ------
>>>   include/soc/mediatek/smi.h                    | 20 ---------
>>>   32 files changed, 115 insertions(+), 333 deletions(-)
>>>
>>
>> Hello Hans, Matthias,
>> on my side, this series is totally ready for merge, hence, green light from here.
>>
>> Can you please take it for 5.18?
>>
> 
> @Hans: I understand you take the series through your tree. Please let me know when you do so. I'll take care of patch 12 and 13, which should go through my tree.

Will do. I hope to send the PR in the next few days.

Regards,

	Hans

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 105+ messages in thread

* Re: [PATCH v10 02/13] iommu/mediatek-v1: Free the existed fwspec if the master dev already has
  2022-01-17  7:04   ` Yong Wu
                       ` (2 preceding siblings ...)
  (?)
@ 2022-01-28 12:40     ` Mauro Carvalho Chehab
  -1 siblings, 0 replies; 105+ messages in thread
From: Mauro Carvalho Chehab @ 2022-01-28 12:40 UTC (permalink / raw)
  To: Yong Wu, Matthias Brugger
  Cc: Hans Verkuil, Joerg Roedel, Rob Herring, Krzysztof Kozlowski,
	David Airlie, Evan Green, Robin Murphy, Tomasz Figa, Will Deacon,
	linux-mediatek, srv_heupstream, devicetree, linux-kernel,
	linux-arm-kernel, iommu, youlin.pei, Matthias Kaehlcke, anan.sun,
	yi.kuo, acourbot, linux-media, dri-devel, Daniel Vetter,
	Chun-Kuang Hu, Philipp Zabel, Tiffany Lin, Dafna Hirschfeld,
	Hsin-Yi Wang, Eizan Miyamoto, anthony.huang, Frank Wunderlich,
	mingyuan.ma, yf.wang, libo.kang, AngeloGioacchino Del Regno

Hi Matthias/Yong,

Are you ok if this patch gets merged via the media tree together with the
remaining series, or do you prefer to apply it via SoC tree instead?

Regards,
Mauro


Em Mon, 17 Jan 2022 15:04:59 +0800
Yong Wu <yong.wu@mediatek.com> escreveu:

> When the iommu master device enters of_iommu_xlate, the ops may be
> NULL(iommu dev is defered), then it will initialize the fwspec here:
> 
> [<c0c9c5bc>] (dev_iommu_fwspec_set) from [<c06bda80>]
> (iommu_fwspec_init+0xbc/0xd4)
> [<c06bd9c4>] (iommu_fwspec_init) from [<c06c0db4>]
> (of_iommu_xlate+0x7c/0x12c)
> [<c06c0d38>] (of_iommu_xlate) from [<c06c10e8>]
> (of_iommu_configure+0x144/0x1e8)
> 
> BUT the mtk_iommu_v1.c only supports arm32, the probing flow still is a bit
> weird. We always expect create the fwspec internally. otherwise it will
> enter here and return fail.
> 
> static int mtk_iommu_create_mapping(struct device *dev,
> 				    struct of_phandle_args *args)
> {
>         ...
> 	if (!fwspec) {
> 	        ....
> 	} else if (dev_iommu_fwspec_get(dev)->ops != &mtk_iommu_ops) {
>                 >>>>>>>>>>Enter here. return fail.<<<<<<<<<<<<  
> 		return -EINVAL;
> 	}
> 	...
> }
> 
> Thus, Free the existed fwspec if the master device already has fwspec.
> 
> This issue is reported at:
> https://lore.kernel.org/linux-mediatek/trinity-7d9ebdc9-4849-4d93-bfb5-429dcb4ee449-1626253158870@3c-app-gmx-bs01/
> 
> Reported-by: Frank Wunderlich <frank-w@public-files.de>
> Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
> Signed-off-by: Yong Wu <yong.wu@mediatek.com>
> Acked-by: Joerg Roedel <jroedel@suse.de>
> Acked-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
>  drivers/iommu/mtk_iommu_v1.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
> index be22fcf988ce..1467ba1e4417 100644
> --- a/drivers/iommu/mtk_iommu_v1.c
> +++ b/drivers/iommu/mtk_iommu_v1.c
> @@ -425,6 +425,15 @@ static struct iommu_device *mtk_iommu_probe_device(struct device *dev)
>  	struct mtk_iommu_data *data;
>  	int err, idx = 0;
>  
> +	/*
> +	 * In the deferred case, free the existed fwspec.
> +	 * Always initialize the fwspec internally.
> +	 */
> +	if (fwspec) {
> +		iommu_fwspec_free(dev);
> +		fwspec = dev_iommu_fwspec_get(dev);
> +	}
> +
>  	while (!of_parse_phandle_with_args(dev->of_node, "iommus",
>  					   "#iommu-cells",
>  					   idx, &iommu_spec)) {



Thanks,
Mauro

^ permalink raw reply	[flat|nested] 105+ messages in thread

* Re: [PATCH v10 02/13] iommu/mediatek-v1: Free the existed fwspec if the master dev already has
@ 2022-01-28 12:40     ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 105+ messages in thread
From: Mauro Carvalho Chehab @ 2022-01-28 12:40 UTC (permalink / raw)
  To: Yong Wu, Matthias Brugger
  Cc: Dafna Hirschfeld, Chun-Kuang Hu, David Airlie, Will Deacon,
	dri-devel, yf.wang, Hans Verkuil, anthony.huang, youlin.pei,
	Krzysztof Kozlowski, Evan Green, Eizan Miyamoto,
	Matthias Kaehlcke, mingyuan.ma, linux-media, devicetree,
	Joerg Roedel, Frank Wunderlich, libo.kang, yi.kuo, Rob Herring,
	linux-mediatek, Hsin-Yi Wang, Tiffany Lin, linux-arm-kernel,
	AngeloGioacchino Del Regno, anan.sun, srv_heupstream, acourbot,
	linux-kernel, Tomasz Figa, iommu, Robin Murphy

Hi Matthias/Yong,

Are you ok if this patch gets merged via the media tree together with the
remaining series, or do you prefer to apply it via SoC tree instead?

Regards,
Mauro


Em Mon, 17 Jan 2022 15:04:59 +0800
Yong Wu <yong.wu@mediatek.com> escreveu:

> When the iommu master device enters of_iommu_xlate, the ops may be
> NULL(iommu dev is defered), then it will initialize the fwspec here:
> 
> [<c0c9c5bc>] (dev_iommu_fwspec_set) from [<c06bda80>]
> (iommu_fwspec_init+0xbc/0xd4)
> [<c06bd9c4>] (iommu_fwspec_init) from [<c06c0db4>]
> (of_iommu_xlate+0x7c/0x12c)
> [<c06c0d38>] (of_iommu_xlate) from [<c06c10e8>]
> (of_iommu_configure+0x144/0x1e8)
> 
> BUT the mtk_iommu_v1.c only supports arm32, the probing flow still is a bit
> weird. We always expect create the fwspec internally. otherwise it will
> enter here and return fail.
> 
> static int mtk_iommu_create_mapping(struct device *dev,
> 				    struct of_phandle_args *args)
> {
>         ...
> 	if (!fwspec) {
> 	        ....
> 	} else if (dev_iommu_fwspec_get(dev)->ops != &mtk_iommu_ops) {
>                 >>>>>>>>>>Enter here. return fail.<<<<<<<<<<<<  
> 		return -EINVAL;
> 	}
> 	...
> }
> 
> Thus, Free the existed fwspec if the master device already has fwspec.
> 
> This issue is reported at:
> https://lore.kernel.org/linux-mediatek/trinity-7d9ebdc9-4849-4d93-bfb5-429dcb4ee449-1626253158870@3c-app-gmx-bs01/
> 
> Reported-by: Frank Wunderlich <frank-w@public-files.de>
> Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
> Signed-off-by: Yong Wu <yong.wu@mediatek.com>
> Acked-by: Joerg Roedel <jroedel@suse.de>
> Acked-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
>  drivers/iommu/mtk_iommu_v1.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
> index be22fcf988ce..1467ba1e4417 100644
> --- a/drivers/iommu/mtk_iommu_v1.c
> +++ b/drivers/iommu/mtk_iommu_v1.c
> @@ -425,6 +425,15 @@ static struct iommu_device *mtk_iommu_probe_device(struct device *dev)
>  	struct mtk_iommu_data *data;
>  	int err, idx = 0;
>  
> +	/*
> +	 * In the deferred case, free the existed fwspec.
> +	 * Always initialize the fwspec internally.
> +	 */
> +	if (fwspec) {
> +		iommu_fwspec_free(dev);
> +		fwspec = dev_iommu_fwspec_get(dev);
> +	}
> +
>  	while (!of_parse_phandle_with_args(dev->of_node, "iommus",
>  					   "#iommu-cells",
>  					   idx, &iommu_spec)) {



Thanks,
Mauro

^ permalink raw reply	[flat|nested] 105+ messages in thread

* Re: [PATCH v10 02/13] iommu/mediatek-v1: Free the existed fwspec if the master dev already has
@ 2022-01-28 12:40     ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 105+ messages in thread
From: Mauro Carvalho Chehab @ 2022-01-28 12:40 UTC (permalink / raw)
  To: Yong Wu, Matthias Brugger
  Cc: Dafna Hirschfeld, Chun-Kuang Hu, David Airlie, Will Deacon,
	dri-devel, yf.wang, Hans Verkuil, anthony.huang, youlin.pei,
	Krzysztof Kozlowski, Evan Green, Eizan Miyamoto,
	Matthias Kaehlcke, mingyuan.ma, linux-media, devicetree,
	Joerg Roedel, Philipp Zabel, libo.kang, yi.kuo, Rob Herring,
	linux-mediatek, Hsin-Yi Wang, Tiffany Lin, linux-arm-kernel,
	AngeloGioacchino Del Regno, anan.sun, srv_heupstream, acourbot,
	linux-kernel, Tomasz Figa, iommu, Daniel Vetter, Robin Murphy

Hi Matthias/Yong,

Are you ok if this patch gets merged via the media tree together with the
remaining series, or do you prefer to apply it via SoC tree instead?

Regards,
Mauro


Em Mon, 17 Jan 2022 15:04:59 +0800
Yong Wu <yong.wu@mediatek.com> escreveu:

> When the iommu master device enters of_iommu_xlate, the ops may be
> NULL(iommu dev is defered), then it will initialize the fwspec here:
> 
> [<c0c9c5bc>] (dev_iommu_fwspec_set) from [<c06bda80>]
> (iommu_fwspec_init+0xbc/0xd4)
> [<c06bd9c4>] (iommu_fwspec_init) from [<c06c0db4>]
> (of_iommu_xlate+0x7c/0x12c)
> [<c06c0d38>] (of_iommu_xlate) from [<c06c10e8>]
> (of_iommu_configure+0x144/0x1e8)
> 
> BUT the mtk_iommu_v1.c only supports arm32, the probing flow still is a bit
> weird. We always expect create the fwspec internally. otherwise it will
> enter here and return fail.
> 
> static int mtk_iommu_create_mapping(struct device *dev,
> 				    struct of_phandle_args *args)
> {
>         ...
> 	if (!fwspec) {
> 	        ....
> 	} else if (dev_iommu_fwspec_get(dev)->ops != &mtk_iommu_ops) {
>                 >>>>>>>>>>Enter here. return fail.<<<<<<<<<<<<  
> 		return -EINVAL;
> 	}
> 	...
> }
> 
> Thus, Free the existed fwspec if the master device already has fwspec.
> 
> This issue is reported at:
> https://lore.kernel.org/linux-mediatek/trinity-7d9ebdc9-4849-4d93-bfb5-429dcb4ee449-1626253158870@3c-app-gmx-bs01/
> 
> Reported-by: Frank Wunderlich <frank-w@public-files.de>
> Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
> Signed-off-by: Yong Wu <yong.wu@mediatek.com>
> Acked-by: Joerg Roedel <jroedel@suse.de>
> Acked-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
>  drivers/iommu/mtk_iommu_v1.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
> index be22fcf988ce..1467ba1e4417 100644
> --- a/drivers/iommu/mtk_iommu_v1.c
> +++ b/drivers/iommu/mtk_iommu_v1.c
> @@ -425,6 +425,15 @@ static struct iommu_device *mtk_iommu_probe_device(struct device *dev)
>  	struct mtk_iommu_data *data;
>  	int err, idx = 0;
>  
> +	/*
> +	 * In the deferred case, free the existed fwspec.
> +	 * Always initialize the fwspec internally.
> +	 */
> +	if (fwspec) {
> +		iommu_fwspec_free(dev);
> +		fwspec = dev_iommu_fwspec_get(dev);
> +	}
> +
>  	while (!of_parse_phandle_with_args(dev->of_node, "iommus",
>  					   "#iommu-cells",
>  					   idx, &iommu_spec)) {



Thanks,
Mauro

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 105+ messages in thread

* Re: [PATCH v10 02/13] iommu/mediatek-v1: Free the existed fwspec if the master dev already has
@ 2022-01-28 12:40     ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 105+ messages in thread
From: Mauro Carvalho Chehab @ 2022-01-28 12:40 UTC (permalink / raw)
  To: Yong Wu, Matthias Brugger
  Cc: Hans Verkuil, Joerg Roedel, Rob Herring, Krzysztof Kozlowski,
	David Airlie, Evan Green, Robin Murphy, Tomasz Figa, Will Deacon,
	linux-mediatek, srv_heupstream, devicetree, linux-kernel,
	linux-arm-kernel, iommu, youlin.pei, Matthias Kaehlcke, anan.sun,
	yi.kuo, acourbot, linux-media, dri-devel, Daniel Vetter,
	Chun-Kuang Hu, Philipp Zabel, Tiffany Lin, Dafna Hirschfeld,
	Hsin-Yi Wang, Eizan Miyamoto, anthony.huang, Frank Wunderlich,
	mingyuan.ma, yf.wang, libo.kang, AngeloGioacchino Del Regno

Hi Matthias/Yong,

Are you ok if this patch gets merged via the media tree together with the
remaining series, or do you prefer to apply it via SoC tree instead?

Regards,
Mauro


Em Mon, 17 Jan 2022 15:04:59 +0800
Yong Wu <yong.wu@mediatek.com> escreveu:

> When the iommu master device enters of_iommu_xlate, the ops may be
> NULL(iommu dev is defered), then it will initialize the fwspec here:
> 
> [<c0c9c5bc>] (dev_iommu_fwspec_set) from [<c06bda80>]
> (iommu_fwspec_init+0xbc/0xd4)
> [<c06bd9c4>] (iommu_fwspec_init) from [<c06c0db4>]
> (of_iommu_xlate+0x7c/0x12c)
> [<c06c0d38>] (of_iommu_xlate) from [<c06c10e8>]
> (of_iommu_configure+0x144/0x1e8)
> 
> BUT the mtk_iommu_v1.c only supports arm32, the probing flow still is a bit
> weird. We always expect create the fwspec internally. otherwise it will
> enter here and return fail.
> 
> static int mtk_iommu_create_mapping(struct device *dev,
> 				    struct of_phandle_args *args)
> {
>         ...
> 	if (!fwspec) {
> 	        ....
> 	} else if (dev_iommu_fwspec_get(dev)->ops != &mtk_iommu_ops) {
>                 >>>>>>>>>>Enter here. return fail.<<<<<<<<<<<<  
> 		return -EINVAL;
> 	}
> 	...
> }
> 
> Thus, Free the existed fwspec if the master device already has fwspec.
> 
> This issue is reported at:
> https://lore.kernel.org/linux-mediatek/trinity-7d9ebdc9-4849-4d93-bfb5-429dcb4ee449-1626253158870@3c-app-gmx-bs01/
> 
> Reported-by: Frank Wunderlich <frank-w@public-files.de>
> Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
> Signed-off-by: Yong Wu <yong.wu@mediatek.com>
> Acked-by: Joerg Roedel <jroedel@suse.de>
> Acked-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
>  drivers/iommu/mtk_iommu_v1.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
> index be22fcf988ce..1467ba1e4417 100644
> --- a/drivers/iommu/mtk_iommu_v1.c
> +++ b/drivers/iommu/mtk_iommu_v1.c
> @@ -425,6 +425,15 @@ static struct iommu_device *mtk_iommu_probe_device(struct device *dev)
>  	struct mtk_iommu_data *data;
>  	int err, idx = 0;
>  
> +	/*
> +	 * In the deferred case, free the existed fwspec.
> +	 * Always initialize the fwspec internally.
> +	 */
> +	if (fwspec) {
> +		iommu_fwspec_free(dev);
> +		fwspec = dev_iommu_fwspec_get(dev);
> +	}
> +
>  	while (!of_parse_phandle_with_args(dev->of_node, "iommus",
>  					   "#iommu-cells",
>  					   idx, &iommu_spec)) {



Thanks,
Mauro

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 105+ messages in thread

* Re: [PATCH v10 02/13] iommu/mediatek-v1: Free the existed fwspec if the master dev already has
@ 2022-01-28 12:40     ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 105+ messages in thread
From: Mauro Carvalho Chehab @ 2022-01-28 12:40 UTC (permalink / raw)
  To: Yong Wu, Matthias Brugger
  Cc: Chun-Kuang Hu, David Airlie, Will Deacon, dri-devel, yf.wang,
	Hans Verkuil, anthony.huang, Krzysztof Kozlowski, Evan Green,
	Eizan Miyamoto, Matthias Kaehlcke, mingyuan.ma, linux-media,
	devicetree, Joerg Roedel, Philipp Zabel, Frank Wunderlich,
	libo.kang, yi.kuo, Rob Herring, linux-mediatek, Hsin-Yi Wang,
	Tiffany Lin, linux-arm-kernel, AngeloGioacchino Del Regno,
	anan.sun, srv_heupstream, acourbot, linux-kernel, iommu,
	Daniel Vetter, Robin Murphy

Hi Matthias/Yong,

Are you ok if this patch gets merged via the media tree together with the
remaining series, or do you prefer to apply it via SoC tree instead?

Regards,
Mauro


Em Mon, 17 Jan 2022 15:04:59 +0800
Yong Wu <yong.wu@mediatek.com> escreveu:

> When the iommu master device enters of_iommu_xlate, the ops may be
> NULL(iommu dev is defered), then it will initialize the fwspec here:
> 
> [<c0c9c5bc>] (dev_iommu_fwspec_set) from [<c06bda80>]
> (iommu_fwspec_init+0xbc/0xd4)
> [<c06bd9c4>] (iommu_fwspec_init) from [<c06c0db4>]
> (of_iommu_xlate+0x7c/0x12c)
> [<c06c0d38>] (of_iommu_xlate) from [<c06c10e8>]
> (of_iommu_configure+0x144/0x1e8)
> 
> BUT the mtk_iommu_v1.c only supports arm32, the probing flow still is a bit
> weird. We always expect create the fwspec internally. otherwise it will
> enter here and return fail.
> 
> static int mtk_iommu_create_mapping(struct device *dev,
> 				    struct of_phandle_args *args)
> {
>         ...
> 	if (!fwspec) {
> 	        ....
> 	} else if (dev_iommu_fwspec_get(dev)->ops != &mtk_iommu_ops) {
>                 >>>>>>>>>>Enter here. return fail.<<<<<<<<<<<<  
> 		return -EINVAL;
> 	}
> 	...
> }
> 
> Thus, Free the existed fwspec if the master device already has fwspec.
> 
> This issue is reported at:
> https://lore.kernel.org/linux-mediatek/trinity-7d9ebdc9-4849-4d93-bfb5-429dcb4ee449-1626253158870@3c-app-gmx-bs01/
> 
> Reported-by: Frank Wunderlich <frank-w@public-files.de>
> Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
> Signed-off-by: Yong Wu <yong.wu@mediatek.com>
> Acked-by: Joerg Roedel <jroedel@suse.de>
> Acked-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
>  drivers/iommu/mtk_iommu_v1.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
> index be22fcf988ce..1467ba1e4417 100644
> --- a/drivers/iommu/mtk_iommu_v1.c
> +++ b/drivers/iommu/mtk_iommu_v1.c
> @@ -425,6 +425,15 @@ static struct iommu_device *mtk_iommu_probe_device(struct device *dev)
>  	struct mtk_iommu_data *data;
>  	int err, idx = 0;
>  
> +	/*
> +	 * In the deferred case, free the existed fwspec.
> +	 * Always initialize the fwspec internally.
> +	 */
> +	if (fwspec) {
> +		iommu_fwspec_free(dev);
> +		fwspec = dev_iommu_fwspec_get(dev);
> +	}
> +
>  	while (!of_parse_phandle_with_args(dev->of_node, "iommus",
>  					   "#iommu-cells",
>  					   idx, &iommu_spec)) {



Thanks,
Mauro
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 105+ messages in thread

* Re: [PATCH v10 02/13] iommu/mediatek-v1: Free the existed fwspec if the master dev already has
  2022-01-28 12:40     ` Mauro Carvalho Chehab
                         ` (2 preceding siblings ...)
  (?)
@ 2022-01-28 12:45       ` Mauro Carvalho Chehab
  -1 siblings, 0 replies; 105+ messages in thread
From: Mauro Carvalho Chehab @ 2022-01-28 12:45 UTC (permalink / raw)
  To: Yong Wu, Matthias Brugger
  Cc: Hans Verkuil, Joerg Roedel, Rob Herring, Krzysztof Kozlowski,
	David Airlie, Evan Green, Robin Murphy, Tomasz Figa, Will Deacon,
	linux-mediatek, srv_heupstream, devicetree, linux-kernel,
	linux-arm-kernel, iommu, youlin.pei, Matthias Kaehlcke, anan.sun,
	yi.kuo, acourbot, linux-media, dri-devel, Daniel Vetter,
	Chun-Kuang Hu, Philipp Zabel, Tiffany Lin, Dafna Hirschfeld,
	Hsin-Yi Wang, Eizan Miyamoto, anthony.huang, Frank Wunderlich,
	mingyuan.ma, yf.wang, libo.kang, AngeloGioacchino Del Regno

Em Fri, 28 Jan 2022 13:40:55 +0100
Mauro Carvalho Chehab <mchehab@kernel.org> escreveu:

> Hi Matthias/Yong,
> 
> Are you ok if this patch gets merged via the media tree together with the
> remaining series, or do you prefer to apply it via SoC tree instead?

Same questions for other patches touching files outside drivers/media
on this pull request:

	https://patchwork.kernel.org/project/linux-mediatek/patch/7af52d61-47c7-581d-62ed-76a7f8315b16@xs4all.nl/

Like those:
	0004-0013-iommu-mediatek-v1-Free-the-existed-fwspec-if-the-mas.patch
	0005-0013-iommu-mediatek-Return-ENODEV-if-the-device-is-NULL.patch
	0006-0013-iommu-mediatek-Add-probe_defer-for-smi-larb.patch
	0007-0013-iommu-mediatek-Add-device_link-between-the-consumer-.patch

Regards,
Mauro

> 
> Regards,
> Mauro
> 
> 
> Em Mon, 17 Jan 2022 15:04:59 +0800
> Yong Wu <yong.wu@mediatek.com> escreveu:
> 
> > When the iommu master device enters of_iommu_xlate, the ops may be
> > NULL(iommu dev is defered), then it will initialize the fwspec here:
> > 
> > [<c0c9c5bc>] (dev_iommu_fwspec_set) from [<c06bda80>]
> > (iommu_fwspec_init+0xbc/0xd4)
> > [<c06bd9c4>] (iommu_fwspec_init) from [<c06c0db4>]
> > (of_iommu_xlate+0x7c/0x12c)
> > [<c06c0d38>] (of_iommu_xlate) from [<c06c10e8>]
> > (of_iommu_configure+0x144/0x1e8)
> > 
> > BUT the mtk_iommu_v1.c only supports arm32, the probing flow still is a bit
> > weird. We always expect create the fwspec internally. otherwise it will
> > enter here and return fail.
> > 
> > static int mtk_iommu_create_mapping(struct device *dev,
> > 				    struct of_phandle_args *args)
> > {
> >         ...
> > 	if (!fwspec) {
> > 	        ....
> > 	} else if (dev_iommu_fwspec_get(dev)->ops != &mtk_iommu_ops) {  
> >                 >>>>>>>>>>Enter here. return fail.<<<<<<<<<<<<    
> > 		return -EINVAL;
> > 	}
> > 	...
> > }
> > 
> > Thus, Free the existed fwspec if the master device already has fwspec.
> > 
> > This issue is reported at:
> > https://lore.kernel.org/linux-mediatek/trinity-7d9ebdc9-4849-4d93-bfb5-429dcb4ee449-1626253158870@3c-app-gmx-bs01/
> > 
> > Reported-by: Frank Wunderlich <frank-w@public-files.de>
> > Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
> > Signed-off-by: Yong Wu <yong.wu@mediatek.com>
> > Acked-by: Joerg Roedel <jroedel@suse.de>
> > Acked-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> > ---
> >  drivers/iommu/mtk_iommu_v1.c | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> > 
> > diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
> > index be22fcf988ce..1467ba1e4417 100644
> > --- a/drivers/iommu/mtk_iommu_v1.c
> > +++ b/drivers/iommu/mtk_iommu_v1.c
> > @@ -425,6 +425,15 @@ static struct iommu_device *mtk_iommu_probe_device(struct device *dev)
> >  	struct mtk_iommu_data *data;
> >  	int err, idx = 0;
> >  
> > +	/*
> > +	 * In the deferred case, free the existed fwspec.
> > +	 * Always initialize the fwspec internally.
> > +	 */
> > +	if (fwspec) {
> > +		iommu_fwspec_free(dev);
> > +		fwspec = dev_iommu_fwspec_get(dev);
> > +	}
> > +
> >  	while (!of_parse_phandle_with_args(dev->of_node, "iommus",
> >  					   "#iommu-cells",
> >  					   idx, &iommu_spec)) {  
> 
> 
> 
> Thanks,
> Mauro



Thanks,
Mauro

^ permalink raw reply	[flat|nested] 105+ messages in thread

* Re: [PATCH v10 02/13] iommu/mediatek-v1: Free the existed fwspec if the master dev already has
@ 2022-01-28 12:45       ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 105+ messages in thread
From: Mauro Carvalho Chehab @ 2022-01-28 12:45 UTC (permalink / raw)
  To: Yong Wu, Matthias Brugger
  Cc: Dafna Hirschfeld, Chun-Kuang Hu, David Airlie, Will Deacon,
	dri-devel, yf.wang, Hans Verkuil, anthony.huang, youlin.pei,
	Krzysztof Kozlowski, Evan Green, Eizan Miyamoto,
	Matthias Kaehlcke, mingyuan.ma, linux-media, devicetree,
	Joerg Roedel, Frank Wunderlich, libo.kang, yi.kuo, Rob Herring,
	linux-mediatek, Hsin-Yi Wang, Tiffany Lin, linux-arm-kernel,
	AngeloGioacchino Del Regno, anan.sun, srv_heupstream, acourbot,
	linux-kernel, Tomasz Figa, iommu, Robin Murphy

Em Fri, 28 Jan 2022 13:40:55 +0100
Mauro Carvalho Chehab <mchehab@kernel.org> escreveu:

> Hi Matthias/Yong,
> 
> Are you ok if this patch gets merged via the media tree together with the
> remaining series, or do you prefer to apply it via SoC tree instead?

Same questions for other patches touching files outside drivers/media
on this pull request:

	https://patchwork.kernel.org/project/linux-mediatek/patch/7af52d61-47c7-581d-62ed-76a7f8315b16@xs4all.nl/

Like those:
	0004-0013-iommu-mediatek-v1-Free-the-existed-fwspec-if-the-mas.patch
	0005-0013-iommu-mediatek-Return-ENODEV-if-the-device-is-NULL.patch
	0006-0013-iommu-mediatek-Add-probe_defer-for-smi-larb.patch
	0007-0013-iommu-mediatek-Add-device_link-between-the-consumer-.patch

Regards,
Mauro

> 
> Regards,
> Mauro
> 
> 
> Em Mon, 17 Jan 2022 15:04:59 +0800
> Yong Wu <yong.wu@mediatek.com> escreveu:
> 
> > When the iommu master device enters of_iommu_xlate, the ops may be
> > NULL(iommu dev is defered), then it will initialize the fwspec here:
> > 
> > [<c0c9c5bc>] (dev_iommu_fwspec_set) from [<c06bda80>]
> > (iommu_fwspec_init+0xbc/0xd4)
> > [<c06bd9c4>] (iommu_fwspec_init) from [<c06c0db4>]
> > (of_iommu_xlate+0x7c/0x12c)
> > [<c06c0d38>] (of_iommu_xlate) from [<c06c10e8>]
> > (of_iommu_configure+0x144/0x1e8)
> > 
> > BUT the mtk_iommu_v1.c only supports arm32, the probing flow still is a bit
> > weird. We always expect create the fwspec internally. otherwise it will
> > enter here and return fail.
> > 
> > static int mtk_iommu_create_mapping(struct device *dev,
> > 				    struct of_phandle_args *args)
> > {
> >         ...
> > 	if (!fwspec) {
> > 	        ....
> > 	} else if (dev_iommu_fwspec_get(dev)->ops != &mtk_iommu_ops) {  
> >                 >>>>>>>>>>Enter here. return fail.<<<<<<<<<<<<    
> > 		return -EINVAL;
> > 	}
> > 	...
> > }
> > 
> > Thus, Free the existed fwspec if the master device already has fwspec.
> > 
> > This issue is reported at:
> > https://lore.kernel.org/linux-mediatek/trinity-7d9ebdc9-4849-4d93-bfb5-429dcb4ee449-1626253158870@3c-app-gmx-bs01/
> > 
> > Reported-by: Frank Wunderlich <frank-w@public-files.de>
> > Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
> > Signed-off-by: Yong Wu <yong.wu@mediatek.com>
> > Acked-by: Joerg Roedel <jroedel@suse.de>
> > Acked-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> > ---
> >  drivers/iommu/mtk_iommu_v1.c | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> > 
> > diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
> > index be22fcf988ce..1467ba1e4417 100644
> > --- a/drivers/iommu/mtk_iommu_v1.c
> > +++ b/drivers/iommu/mtk_iommu_v1.c
> > @@ -425,6 +425,15 @@ static struct iommu_device *mtk_iommu_probe_device(struct device *dev)
> >  	struct mtk_iommu_data *data;
> >  	int err, idx = 0;
> >  
> > +	/*
> > +	 * In the deferred case, free the existed fwspec.
> > +	 * Always initialize the fwspec internally.
> > +	 */
> > +	if (fwspec) {
> > +		iommu_fwspec_free(dev);
> > +		fwspec = dev_iommu_fwspec_get(dev);
> > +	}
> > +
> >  	while (!of_parse_phandle_with_args(dev->of_node, "iommus",
> >  					   "#iommu-cells",
> >  					   idx, &iommu_spec)) {  
> 
> 
> 
> Thanks,
> Mauro



Thanks,
Mauro

^ permalink raw reply	[flat|nested] 105+ messages in thread

* Re: [PATCH v10 02/13] iommu/mediatek-v1: Free the existed fwspec if the master dev already has
@ 2022-01-28 12:45       ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 105+ messages in thread
From: Mauro Carvalho Chehab @ 2022-01-28 12:45 UTC (permalink / raw)
  To: Yong Wu, Matthias Brugger
  Cc: Dafna Hirschfeld, Chun-Kuang Hu, David Airlie, Will Deacon,
	dri-devel, yf.wang, Hans Verkuil, anthony.huang, youlin.pei,
	Krzysztof Kozlowski, Evan Green, Eizan Miyamoto,
	Matthias Kaehlcke, mingyuan.ma, linux-media, devicetree,
	Joerg Roedel, Philipp Zabel, libo.kang, yi.kuo, Rob Herring,
	linux-mediatek, Hsin-Yi Wang, Tiffany Lin, linux-arm-kernel,
	AngeloGioacchino Del Regno, anan.sun, srv_heupstream, acourbot,
	linux-kernel, Tomasz Figa, iommu, Daniel Vetter, Robin Murphy

Em Fri, 28 Jan 2022 13:40:55 +0100
Mauro Carvalho Chehab <mchehab@kernel.org> escreveu:

> Hi Matthias/Yong,
> 
> Are you ok if this patch gets merged via the media tree together with the
> remaining series, or do you prefer to apply it via SoC tree instead?

Same questions for other patches touching files outside drivers/media
on this pull request:

	https://patchwork.kernel.org/project/linux-mediatek/patch/7af52d61-47c7-581d-62ed-76a7f8315b16@xs4all.nl/

Like those:
	0004-0013-iommu-mediatek-v1-Free-the-existed-fwspec-if-the-mas.patch
	0005-0013-iommu-mediatek-Return-ENODEV-if-the-device-is-NULL.patch
	0006-0013-iommu-mediatek-Add-probe_defer-for-smi-larb.patch
	0007-0013-iommu-mediatek-Add-device_link-between-the-consumer-.patch

Regards,
Mauro

> 
> Regards,
> Mauro
> 
> 
> Em Mon, 17 Jan 2022 15:04:59 +0800
> Yong Wu <yong.wu@mediatek.com> escreveu:
> 
> > When the iommu master device enters of_iommu_xlate, the ops may be
> > NULL(iommu dev is defered), then it will initialize the fwspec here:
> > 
> > [<c0c9c5bc>] (dev_iommu_fwspec_set) from [<c06bda80>]
> > (iommu_fwspec_init+0xbc/0xd4)
> > [<c06bd9c4>] (iommu_fwspec_init) from [<c06c0db4>]
> > (of_iommu_xlate+0x7c/0x12c)
> > [<c06c0d38>] (of_iommu_xlate) from [<c06c10e8>]
> > (of_iommu_configure+0x144/0x1e8)
> > 
> > BUT the mtk_iommu_v1.c only supports arm32, the probing flow still is a bit
> > weird. We always expect create the fwspec internally. otherwise it will
> > enter here and return fail.
> > 
> > static int mtk_iommu_create_mapping(struct device *dev,
> > 				    struct of_phandle_args *args)
> > {
> >         ...
> > 	if (!fwspec) {
> > 	        ....
> > 	} else if (dev_iommu_fwspec_get(dev)->ops != &mtk_iommu_ops) {  
> >                 >>>>>>>>>>Enter here. return fail.<<<<<<<<<<<<    
> > 		return -EINVAL;
> > 	}
> > 	...
> > }
> > 
> > Thus, Free the existed fwspec if the master device already has fwspec.
> > 
> > This issue is reported at:
> > https://lore.kernel.org/linux-mediatek/trinity-7d9ebdc9-4849-4d93-bfb5-429dcb4ee449-1626253158870@3c-app-gmx-bs01/
> > 
> > Reported-by: Frank Wunderlich <frank-w@public-files.de>
> > Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
> > Signed-off-by: Yong Wu <yong.wu@mediatek.com>
> > Acked-by: Joerg Roedel <jroedel@suse.de>
> > Acked-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> > ---
> >  drivers/iommu/mtk_iommu_v1.c | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> > 
> > diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
> > index be22fcf988ce..1467ba1e4417 100644
> > --- a/drivers/iommu/mtk_iommu_v1.c
> > +++ b/drivers/iommu/mtk_iommu_v1.c
> > @@ -425,6 +425,15 @@ static struct iommu_device *mtk_iommu_probe_device(struct device *dev)
> >  	struct mtk_iommu_data *data;
> >  	int err, idx = 0;
> >  
> > +	/*
> > +	 * In the deferred case, free the existed fwspec.
> > +	 * Always initialize the fwspec internally.
> > +	 */
> > +	if (fwspec) {
> > +		iommu_fwspec_free(dev);
> > +		fwspec = dev_iommu_fwspec_get(dev);
> > +	}
> > +
> >  	while (!of_parse_phandle_with_args(dev->of_node, "iommus",
> >  					   "#iommu-cells",
> >  					   idx, &iommu_spec)) {  
> 
> 
> 
> Thanks,
> Mauro



Thanks,
Mauro

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 105+ messages in thread

* Re: [PATCH v10 02/13] iommu/mediatek-v1: Free the existed fwspec if the master dev already has
@ 2022-01-28 12:45       ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 105+ messages in thread
From: Mauro Carvalho Chehab @ 2022-01-28 12:45 UTC (permalink / raw)
  To: Yong Wu, Matthias Brugger
  Cc: Hans Verkuil, Joerg Roedel, Rob Herring, Krzysztof Kozlowski,
	David Airlie, Evan Green, Robin Murphy, Tomasz Figa, Will Deacon,
	linux-mediatek, srv_heupstream, devicetree, linux-kernel,
	linux-arm-kernel, iommu, youlin.pei, Matthias Kaehlcke, anan.sun,
	yi.kuo, acourbot, linux-media, dri-devel, Daniel Vetter,
	Chun-Kuang Hu, Philipp Zabel, Tiffany Lin, Dafna Hirschfeld,
	Hsin-Yi Wang, Eizan Miyamoto, anthony.huang, Frank Wunderlich,
	mingyuan.ma, yf.wang, libo.kang, AngeloGioacchino Del Regno

Em Fri, 28 Jan 2022 13:40:55 +0100
Mauro Carvalho Chehab <mchehab@kernel.org> escreveu:

> Hi Matthias/Yong,
> 
> Are you ok if this patch gets merged via the media tree together with the
> remaining series, or do you prefer to apply it via SoC tree instead?

Same questions for other patches touching files outside drivers/media
on this pull request:

	https://patchwork.kernel.org/project/linux-mediatek/patch/7af52d61-47c7-581d-62ed-76a7f8315b16@xs4all.nl/

Like those:
	0004-0013-iommu-mediatek-v1-Free-the-existed-fwspec-if-the-mas.patch
	0005-0013-iommu-mediatek-Return-ENODEV-if-the-device-is-NULL.patch
	0006-0013-iommu-mediatek-Add-probe_defer-for-smi-larb.patch
	0007-0013-iommu-mediatek-Add-device_link-between-the-consumer-.patch

Regards,
Mauro

> 
> Regards,
> Mauro
> 
> 
> Em Mon, 17 Jan 2022 15:04:59 +0800
> Yong Wu <yong.wu@mediatek.com> escreveu:
> 
> > When the iommu master device enters of_iommu_xlate, the ops may be
> > NULL(iommu dev is defered), then it will initialize the fwspec here:
> > 
> > [<c0c9c5bc>] (dev_iommu_fwspec_set) from [<c06bda80>]
> > (iommu_fwspec_init+0xbc/0xd4)
> > [<c06bd9c4>] (iommu_fwspec_init) from [<c06c0db4>]
> > (of_iommu_xlate+0x7c/0x12c)
> > [<c06c0d38>] (of_iommu_xlate) from [<c06c10e8>]
> > (of_iommu_configure+0x144/0x1e8)
> > 
> > BUT the mtk_iommu_v1.c only supports arm32, the probing flow still is a bit
> > weird. We always expect create the fwspec internally. otherwise it will
> > enter here and return fail.
> > 
> > static int mtk_iommu_create_mapping(struct device *dev,
> > 				    struct of_phandle_args *args)
> > {
> >         ...
> > 	if (!fwspec) {
> > 	        ....
> > 	} else if (dev_iommu_fwspec_get(dev)->ops != &mtk_iommu_ops) {  
> >                 >>>>>>>>>>Enter here. return fail.<<<<<<<<<<<<    
> > 		return -EINVAL;
> > 	}
> > 	...
> > }
> > 
> > Thus, Free the existed fwspec if the master device already has fwspec.
> > 
> > This issue is reported at:
> > https://lore.kernel.org/linux-mediatek/trinity-7d9ebdc9-4849-4d93-bfb5-429dcb4ee449-1626253158870@3c-app-gmx-bs01/
> > 
> > Reported-by: Frank Wunderlich <frank-w@public-files.de>
> > Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
> > Signed-off-by: Yong Wu <yong.wu@mediatek.com>
> > Acked-by: Joerg Roedel <jroedel@suse.de>
> > Acked-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> > ---
> >  drivers/iommu/mtk_iommu_v1.c | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> > 
> > diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
> > index be22fcf988ce..1467ba1e4417 100644
> > --- a/drivers/iommu/mtk_iommu_v1.c
> > +++ b/drivers/iommu/mtk_iommu_v1.c
> > @@ -425,6 +425,15 @@ static struct iommu_device *mtk_iommu_probe_device(struct device *dev)
> >  	struct mtk_iommu_data *data;
> >  	int err, idx = 0;
> >  
> > +	/*
> > +	 * In the deferred case, free the existed fwspec.
> > +	 * Always initialize the fwspec internally.
> > +	 */
> > +	if (fwspec) {
> > +		iommu_fwspec_free(dev);
> > +		fwspec = dev_iommu_fwspec_get(dev);
> > +	}
> > +
> >  	while (!of_parse_phandle_with_args(dev->of_node, "iommus",
> >  					   "#iommu-cells",
> >  					   idx, &iommu_spec)) {  
> 
> 
> 
> Thanks,
> Mauro



Thanks,
Mauro

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 105+ messages in thread

* Re: [PATCH v10 02/13] iommu/mediatek-v1: Free the existed fwspec if the master dev already has
@ 2022-01-28 12:45       ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 105+ messages in thread
From: Mauro Carvalho Chehab @ 2022-01-28 12:45 UTC (permalink / raw)
  To: Yong Wu, Matthias Brugger
  Cc: Chun-Kuang Hu, David Airlie, Will Deacon, dri-devel, yf.wang,
	Hans Verkuil, anthony.huang, Krzysztof Kozlowski, Evan Green,
	Eizan Miyamoto, Matthias Kaehlcke, mingyuan.ma, linux-media,
	devicetree, Joerg Roedel, Philipp Zabel, Frank Wunderlich,
	libo.kang, yi.kuo, Rob Herring, linux-mediatek, Hsin-Yi Wang,
	Tiffany Lin, linux-arm-kernel, AngeloGioacchino Del Regno,
	anan.sun, srv_heupstream, acourbot, linux-kernel, iommu,
	Daniel Vetter, Robin Murphy

Em Fri, 28 Jan 2022 13:40:55 +0100
Mauro Carvalho Chehab <mchehab@kernel.org> escreveu:

> Hi Matthias/Yong,
> 
> Are you ok if this patch gets merged via the media tree together with the
> remaining series, or do you prefer to apply it via SoC tree instead?

Same questions for other patches touching files outside drivers/media
on this pull request:

	https://patchwork.kernel.org/project/linux-mediatek/patch/7af52d61-47c7-581d-62ed-76a7f8315b16@xs4all.nl/

Like those:
	0004-0013-iommu-mediatek-v1-Free-the-existed-fwspec-if-the-mas.patch
	0005-0013-iommu-mediatek-Return-ENODEV-if-the-device-is-NULL.patch
	0006-0013-iommu-mediatek-Add-probe_defer-for-smi-larb.patch
	0007-0013-iommu-mediatek-Add-device_link-between-the-consumer-.patch

Regards,
Mauro

> 
> Regards,
> Mauro
> 
> 
> Em Mon, 17 Jan 2022 15:04:59 +0800
> Yong Wu <yong.wu@mediatek.com> escreveu:
> 
> > When the iommu master device enters of_iommu_xlate, the ops may be
> > NULL(iommu dev is defered), then it will initialize the fwspec here:
> > 
> > [<c0c9c5bc>] (dev_iommu_fwspec_set) from [<c06bda80>]
> > (iommu_fwspec_init+0xbc/0xd4)
> > [<c06bd9c4>] (iommu_fwspec_init) from [<c06c0db4>]
> > (of_iommu_xlate+0x7c/0x12c)
> > [<c06c0d38>] (of_iommu_xlate) from [<c06c10e8>]
> > (of_iommu_configure+0x144/0x1e8)
> > 
> > BUT the mtk_iommu_v1.c only supports arm32, the probing flow still is a bit
> > weird. We always expect create the fwspec internally. otherwise it will
> > enter here and return fail.
> > 
> > static int mtk_iommu_create_mapping(struct device *dev,
> > 				    struct of_phandle_args *args)
> > {
> >         ...
> > 	if (!fwspec) {
> > 	        ....
> > 	} else if (dev_iommu_fwspec_get(dev)->ops != &mtk_iommu_ops) {  
> >                 >>>>>>>>>>Enter here. return fail.<<<<<<<<<<<<    
> > 		return -EINVAL;
> > 	}
> > 	...
> > }
> > 
> > Thus, Free the existed fwspec if the master device already has fwspec.
> > 
> > This issue is reported at:
> > https://lore.kernel.org/linux-mediatek/trinity-7d9ebdc9-4849-4d93-bfb5-429dcb4ee449-1626253158870@3c-app-gmx-bs01/
> > 
> > Reported-by: Frank Wunderlich <frank-w@public-files.de>
> > Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
> > Signed-off-by: Yong Wu <yong.wu@mediatek.com>
> > Acked-by: Joerg Roedel <jroedel@suse.de>
> > Acked-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> > ---
> >  drivers/iommu/mtk_iommu_v1.c | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> > 
> > diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
> > index be22fcf988ce..1467ba1e4417 100644
> > --- a/drivers/iommu/mtk_iommu_v1.c
> > +++ b/drivers/iommu/mtk_iommu_v1.c
> > @@ -425,6 +425,15 @@ static struct iommu_device *mtk_iommu_probe_device(struct device *dev)
> >  	struct mtk_iommu_data *data;
> >  	int err, idx = 0;
> >  
> > +	/*
> > +	 * In the deferred case, free the existed fwspec.
> > +	 * Always initialize the fwspec internally.
> > +	 */
> > +	if (fwspec) {
> > +		iommu_fwspec_free(dev);
> > +		fwspec = dev_iommu_fwspec_get(dev);
> > +	}
> > +
> >  	while (!of_parse_phandle_with_args(dev->of_node, "iommus",
> >  					   "#iommu-cells",
> >  					   idx, &iommu_spec)) {  
> 
> 
> 
> Thanks,
> Mauro



Thanks,
Mauro
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 105+ messages in thread

* Re: [PATCH v10 00/13] Clean up "mediatek,larb"
  2022-01-17 11:49     ` Matthias Brugger
                         ` (2 preceding siblings ...)
  (?)
@ 2022-01-31  9:47       ` Hans Verkuil
  -1 siblings, 0 replies; 105+ messages in thread
From: Hans Verkuil @ 2022-01-31  9:47 UTC (permalink / raw)
  To: Matthias Brugger, AngeloGioacchino Del Regno, Yong Wu,
	Joerg Roedel, Rob Herring, Krzysztof Kozlowski, David Airlie,
	Mauro Carvalho Chehab
  Cc: Evan Green, Robin Murphy, Tomasz Figa, Will Deacon,
	linux-mediatek, srv_heupstream, devicetree, linux-kernel,
	linux-arm-kernel, iommu, youlin.pei, Matthias Kaehlcke, anan.sun,
	yi.kuo, acourbot, linux-media, dri-devel, Daniel Vetter,
	Chun-Kuang Hu, Philipp Zabel, Tiffany Lin, Dafna Hirschfeld,
	Hsin-Yi Wang, Eizan Miyamoto, anthony.huang, Frank Wunderlich,
	mingyuan.ma, yf.wang, libo.kang



On 1/17/22 12:49, Matthias Brugger wrote:
> 
> 
> On 17/01/2022 11:27, AngeloGioacchino Del Regno wrote:
>> Il 17/01/22 08:04, Yong Wu ha scritto:
>>> MediaTek IOMMU block diagram always like below:
>>>
>>>          M4U
>>>           |
>>>      smi-common
>>>           |
>>>    -------------
>>>    |         |  ...
>>>    |         |
>>> larb1     larb2
>>>    |         |
>>> vdec       venc
>>>
>>> All the consumer connect with smi-larb, then connect with smi-common.
>>>
>>> When the consumer works, it should enable the smi-larb's power which also
>>> need enable the smi-common's power firstly.
>>>
>>> Thus, Firstly, use the device link connect the consumer and the
>>> smi-larbs. then add device link between the smi-larb and smi-common.
>>>
>>> After adding the device_link, then "mediatek,larb" property can be removed.
>>> the iommu consumer don't need call the mtk_smi_larb_get/put to enable
>>> the power and clock of smi-larb and smi-common.
>>>
>>> Base on the media branch [1] and a jpeg dtbinding patchset[2] that already got
>>> the necessary R-b.
>>>
>>> [1] git://linuxtv.org/hverkuil/media_tree.git tags/br-v5.18d
>>> [2] https://lore.kernel.org/linux-mediatek/20211206130425.184420-1-hsinyi@chromium.org/
>>>
>>> Change notes:
>>> v10: a) Rebase on the media tree. Respin the "media: mtk-vcodec:" patches.
>>>       b) Add Joerg's Ack for iommu patches.
>>>
>>> v9: https://lore.kernel.org/linux-mediatek/20211112105509.12010-1-yong.wu@mediatek.com/
>>>      1) Add return -ENODEV when the dev is null.
>>>      2) Add more strict about the case that a iommu consume device use the ports in
>>>      different larbs. Don't allow this case.
>>>      3) Remove two codec interface: mtk_vcodec_release_enc/dec_pm since it only has one
>>>      line now.
>>>
>>> v8: https://lore.kernel.org/linux-mediatek/20210929013719.25120-1-yong.wu@mediatek.com/
>>>      1) Rebase on v5.15-rc1.
>>>      2) Don't rebase the below mdp patchset that may still need more discuss.
>>>      https://lore.kernel.org/linux-mediatek/20210709022324.1607884-1-eizan@chromium.org/
>>>      3) Add Frank's Tested-by. Remove Dafna's Tested-by as he requested.
>>>
>>> v7: https://lore.kernel.org/linux-mediatek/20210730025238.22456-1-yong.wu@mediatek.com/
>>>      1) Fix a arm32 boot fail issue. reported from Frank.
>>>      2) Add a return fail in the mtk drm. suggested by Dafna.
>>>
>>> v6: https://lore.kernel.org/linux-mediatek/20210714025626.5528-1-yong.wu@mediatek.com/
>>>      1) rebase on v5.14-rc1.
>>>      2) Fix the issue commented in v5 from Dafna and Hsin-Yi.
>>>      3) Remove the patches about using pm_runtime_resume_and_get since they have
>>>         already been merged by other patches.
>>>
>>> v5: https://lore.kernel.org/linux-mediatek/20210410091128.31823-1-yong.wu@mediatek.com/
>>>      1) Base v5.12-rc2.
>>>      2) Remove changing the mtk-iommu to module_platform_driver patch, It have already been a
>>>      independent patch.
>>>
>>> v4: https://lore.kernel.org/linux-mediatek/1590826218-23653-1-git-send-email-yong.wu@mediatek.com/
>>>      base on v5.7-rc1.
>>>    1) Move drm PM patch before smi patchs.
>>>    2) Change builtin_platform_driver to module_platform_driver since we may need
>>>       build as module.
>>>    3) Rebase many patchset as above.
>>>
>>> v3: https://lore.kernel.org/linux-iommu/1567503456-24725-1-git-send-email-yong.wu@mediatek.com/
>>>      1) rebase on v5.3-rc1 and the latest mt8183 patchset.
>>>      2) Use device_is_bound to check whether the driver is ready from Matthias.
>>>      3) Add DL_FLAG_STATELESS flag when calling device_link_add and explain the
>>>     reason in the commit message[3/14].
>>>      4) Add a display patch[12/14] into this series. otherwise it may affect
>>>     display HW fastlogo even though it don't happen in mt8183.
>>> v2: https://lore.kernel.org/linux-iommu/1560171313-28299-1-git-send-email-yong.wu@mediatek.com/
>>>     1) rebase on v5.2-rc1.
>>>     2) Move adding device_link between the consumer and smi-larb into
>>> iommu_add_device from Robin.
>>>     3) add DL_FLAG_AUTOREMOVE_CONSUMER even though the smi is built-in from Evan.
>>>     4) Remove the shutdown callback in iommu.
>>>
>>> v1: https://lore.kernel.org/linux-iommu/1546318276-18993-1-git-send-email-yong.wu@mediatek.com/
>>>
>>> Yong Wu (12):
>>>    dt-binding: mediatek: Get rid of mediatek,larb for multimedia HW
>>>    iommu/mediatek-v1: Free the existed fwspec if the master dev already
>>>      has
>>>    iommu/mediatek: Return ENODEV if the device is NULL
>>>    iommu/mediatek: Add probe_defer for smi-larb
>>>    iommu/mediatek: Add device_link between the consumer and the larb
>>>      devices
>>>    media: mtk-jpeg: Get rid of mtk_smi_larb_get/put
>>>    media: mtk-mdp: Get rid of mtk_smi_larb_get/put
>>>    drm/mediatek: Get rid of mtk_smi_larb_get/put
>>>    media: mtk-vcodec: Get rid of mtk_smi_larb_get/put
>>>    memory: mtk-smi: Get rid of mtk_smi_larb_get/put
>>>    arm: dts: mediatek: Get rid of mediatek,larb for MM nodes
>>>    arm64: dts: mediatek: Get rid of mediatek,larb for MM nodes
>>>
>>> Yongqiang Niu (1):
>>>    drm/mediatek: Add pm runtime support for ovl and rdma
>>>
>>>   .../display/mediatek/mediatek,disp.txt        |  9 ----
>>>   .../media/mediatek,vcodec-decoder.yaml        |  7 ---
>>>   .../media/mediatek,vcodec-encoder.yaml        |  8 ----
>>>   .../bindings/media/mediatek-jpeg-decoder.yaml |  9 ----
>>>   .../bindings/media/mediatek-jpeg-encoder.yaml |  9 ----
>>>   .../bindings/media/mediatek-mdp.txt           |  8 ----
>>>   arch/arm/boot/dts/mt2701.dtsi                 |  2 -
>>>   arch/arm/boot/dts/mt7623n.dtsi                |  5 ---
>>>   arch/arm64/boot/dts/mediatek/mt8173.dtsi      | 16 -------
>>>   arch/arm64/boot/dts/mediatek/mt8183.dtsi      |  6 ---
>>>   drivers/gpu/drm/mediatek/mtk_disp_ovl.c       |  8 +++-
>>>   drivers/gpu/drm/mediatek/mtk_disp_rdma.c      |  9 +++-
>>>   drivers/gpu/drm/mediatek/mtk_drm_crtc.c       | 15 ++++---
>>>   drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c   | 36 +--------------
>>>   drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h   |  1 -
>>>   drivers/gpu/drm/mediatek/mtk_drm_drv.c        |  5 +--
>>>   drivers/iommu/mtk_iommu.c                     | 34 ++++++++++++++
>>>   drivers/iommu/mtk_iommu_v1.c                  | 42 ++++++++++++++++-
>>>   .../media/platform/mtk-jpeg/mtk_jpeg_core.c   | 45 +------------------
>>>   .../media/platform/mtk-jpeg/mtk_jpeg_core.h   |  2 -
>>>   drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 40 -----------------
>>>   drivers/media/platform/mtk-mdp/mtk_mdp_comp.h |  2 -
>>>   drivers/media/platform/mtk-mdp/mtk_mdp_core.c |  1 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_dec_drv.c  |  2 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_dec_hw.c   |  1 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c   | 41 +++--------------
>>>   .../platform/mtk-vcodec/mtk_vcodec_drv.h      |  3 --
>>>   .../platform/mtk-vcodec/mtk_vcodec_enc.c      |  1 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c  |  2 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c   | 45 +++----------------
>>>   drivers/memory/mtk-smi.c                      | 14 ------
>>>   include/soc/mediatek/smi.h                    | 20 ---------
>>>   32 files changed, 115 insertions(+), 333 deletions(-)
>>>
>>
>> Hello Hans, Matthias,
>> on my side, this series is totally ready for merge, hence, green light from here.
>>
>> Can you please take it for 5.18?
>>
> 
> @Hans: I understand you take the series through your tree. Please let me know when you do so. I'll take care of patch 12 and 13, which should go through my tree.

FYI: this series has been merged into the media tree, so you can go ahead with patches 12 and 13.

Regards,

	Hans

^ permalink raw reply	[flat|nested] 105+ messages in thread

* Re: [PATCH v10 00/13] Clean up "mediatek,larb"
@ 2022-01-31  9:47       ` Hans Verkuil
  0 siblings, 0 replies; 105+ messages in thread
From: Hans Verkuil @ 2022-01-31  9:47 UTC (permalink / raw)
  To: Matthias Brugger, AngeloGioacchino Del Regno, Yong Wu,
	Joerg Roedel, Rob Herring, Krzysztof Kozlowski, David Airlie,
	Mauro Carvalho Chehab
  Cc: Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang, anthony.huang,
	Evan Green, Eizan Miyamoto, Matthias Kaehlcke, mingyuan.ma,
	linux-media, devicetree, Philipp Zabel, Frank Wunderlich,
	libo.kang, yi.kuo, linux-mediatek, Hsin-Yi Wang, Tiffany Lin,
	linux-arm-kernel, anan.sun, srv_heupstream, acourbot,
	linux-kernel, iommu, Daniel Vetter, Robin Murphy



On 1/17/22 12:49, Matthias Brugger wrote:
> 
> 
> On 17/01/2022 11:27, AngeloGioacchino Del Regno wrote:
>> Il 17/01/22 08:04, Yong Wu ha scritto:
>>> MediaTek IOMMU block diagram always like below:
>>>
>>>          M4U
>>>           |
>>>      smi-common
>>>           |
>>>    -------------
>>>    |         |  ...
>>>    |         |
>>> larb1     larb2
>>>    |         |
>>> vdec       venc
>>>
>>> All the consumer connect with smi-larb, then connect with smi-common.
>>>
>>> When the consumer works, it should enable the smi-larb's power which also
>>> need enable the smi-common's power firstly.
>>>
>>> Thus, Firstly, use the device link connect the consumer and the
>>> smi-larbs. then add device link between the smi-larb and smi-common.
>>>
>>> After adding the device_link, then "mediatek,larb" property can be removed.
>>> the iommu consumer don't need call the mtk_smi_larb_get/put to enable
>>> the power and clock of smi-larb and smi-common.
>>>
>>> Base on the media branch [1] and a jpeg dtbinding patchset[2] that already got
>>> the necessary R-b.
>>>
>>> [1] git://linuxtv.org/hverkuil/media_tree.git tags/br-v5.18d
>>> [2] https://lore.kernel.org/linux-mediatek/20211206130425.184420-1-hsinyi@chromium.org/
>>>
>>> Change notes:
>>> v10: a) Rebase on the media tree. Respin the "media: mtk-vcodec:" patches.
>>>       b) Add Joerg's Ack for iommu patches.
>>>
>>> v9: https://lore.kernel.org/linux-mediatek/20211112105509.12010-1-yong.wu@mediatek.com/
>>>      1) Add return -ENODEV when the dev is null.
>>>      2) Add more strict about the case that a iommu consume device use the ports in
>>>      different larbs. Don't allow this case.
>>>      3) Remove two codec interface: mtk_vcodec_release_enc/dec_pm since it only has one
>>>      line now.
>>>
>>> v8: https://lore.kernel.org/linux-mediatek/20210929013719.25120-1-yong.wu@mediatek.com/
>>>      1) Rebase on v5.15-rc1.
>>>      2) Don't rebase the below mdp patchset that may still need more discuss.
>>>      https://lore.kernel.org/linux-mediatek/20210709022324.1607884-1-eizan@chromium.org/
>>>      3) Add Frank's Tested-by. Remove Dafna's Tested-by as he requested.
>>>
>>> v7: https://lore.kernel.org/linux-mediatek/20210730025238.22456-1-yong.wu@mediatek.com/
>>>      1) Fix a arm32 boot fail issue. reported from Frank.
>>>      2) Add a return fail in the mtk drm. suggested by Dafna.
>>>
>>> v6: https://lore.kernel.org/linux-mediatek/20210714025626.5528-1-yong.wu@mediatek.com/
>>>      1) rebase on v5.14-rc1.
>>>      2) Fix the issue commented in v5 from Dafna and Hsin-Yi.
>>>      3) Remove the patches about using pm_runtime_resume_and_get since they have
>>>         already been merged by other patches.
>>>
>>> v5: https://lore.kernel.org/linux-mediatek/20210410091128.31823-1-yong.wu@mediatek.com/
>>>      1) Base v5.12-rc2.
>>>      2) Remove changing the mtk-iommu to module_platform_driver patch, It have already been a
>>>      independent patch.
>>>
>>> v4: https://lore.kernel.org/linux-mediatek/1590826218-23653-1-git-send-email-yong.wu@mediatek.com/
>>>      base on v5.7-rc1.
>>>    1) Move drm PM patch before smi patchs.
>>>    2) Change builtin_platform_driver to module_platform_driver since we may need
>>>       build as module.
>>>    3) Rebase many patchset as above.
>>>
>>> v3: https://lore.kernel.org/linux-iommu/1567503456-24725-1-git-send-email-yong.wu@mediatek.com/
>>>      1) rebase on v5.3-rc1 and the latest mt8183 patchset.
>>>      2) Use device_is_bound to check whether the driver is ready from Matthias.
>>>      3) Add DL_FLAG_STATELESS flag when calling device_link_add and explain the
>>>     reason in the commit message[3/14].
>>>      4) Add a display patch[12/14] into this series. otherwise it may affect
>>>     display HW fastlogo even though it don't happen in mt8183.
>>> v2: https://lore.kernel.org/linux-iommu/1560171313-28299-1-git-send-email-yong.wu@mediatek.com/
>>>     1) rebase on v5.2-rc1.
>>>     2) Move adding device_link between the consumer and smi-larb into
>>> iommu_add_device from Robin.
>>>     3) add DL_FLAG_AUTOREMOVE_CONSUMER even though the smi is built-in from Evan.
>>>     4) Remove the shutdown callback in iommu.
>>>
>>> v1: https://lore.kernel.org/linux-iommu/1546318276-18993-1-git-send-email-yong.wu@mediatek.com/
>>>
>>> Yong Wu (12):
>>>    dt-binding: mediatek: Get rid of mediatek,larb for multimedia HW
>>>    iommu/mediatek-v1: Free the existed fwspec if the master dev already
>>>      has
>>>    iommu/mediatek: Return ENODEV if the device is NULL
>>>    iommu/mediatek: Add probe_defer for smi-larb
>>>    iommu/mediatek: Add device_link between the consumer and the larb
>>>      devices
>>>    media: mtk-jpeg: Get rid of mtk_smi_larb_get/put
>>>    media: mtk-mdp: Get rid of mtk_smi_larb_get/put
>>>    drm/mediatek: Get rid of mtk_smi_larb_get/put
>>>    media: mtk-vcodec: Get rid of mtk_smi_larb_get/put
>>>    memory: mtk-smi: Get rid of mtk_smi_larb_get/put
>>>    arm: dts: mediatek: Get rid of mediatek,larb for MM nodes
>>>    arm64: dts: mediatek: Get rid of mediatek,larb for MM nodes
>>>
>>> Yongqiang Niu (1):
>>>    drm/mediatek: Add pm runtime support for ovl and rdma
>>>
>>>   .../display/mediatek/mediatek,disp.txt        |  9 ----
>>>   .../media/mediatek,vcodec-decoder.yaml        |  7 ---
>>>   .../media/mediatek,vcodec-encoder.yaml        |  8 ----
>>>   .../bindings/media/mediatek-jpeg-decoder.yaml |  9 ----
>>>   .../bindings/media/mediatek-jpeg-encoder.yaml |  9 ----
>>>   .../bindings/media/mediatek-mdp.txt           |  8 ----
>>>   arch/arm/boot/dts/mt2701.dtsi                 |  2 -
>>>   arch/arm/boot/dts/mt7623n.dtsi                |  5 ---
>>>   arch/arm64/boot/dts/mediatek/mt8173.dtsi      | 16 -------
>>>   arch/arm64/boot/dts/mediatek/mt8183.dtsi      |  6 ---
>>>   drivers/gpu/drm/mediatek/mtk_disp_ovl.c       |  8 +++-
>>>   drivers/gpu/drm/mediatek/mtk_disp_rdma.c      |  9 +++-
>>>   drivers/gpu/drm/mediatek/mtk_drm_crtc.c       | 15 ++++---
>>>   drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c   | 36 +--------------
>>>   drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h   |  1 -
>>>   drivers/gpu/drm/mediatek/mtk_drm_drv.c        |  5 +--
>>>   drivers/iommu/mtk_iommu.c                     | 34 ++++++++++++++
>>>   drivers/iommu/mtk_iommu_v1.c                  | 42 ++++++++++++++++-
>>>   .../media/platform/mtk-jpeg/mtk_jpeg_core.c   | 45 +------------------
>>>   .../media/platform/mtk-jpeg/mtk_jpeg_core.h   |  2 -
>>>   drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 40 -----------------
>>>   drivers/media/platform/mtk-mdp/mtk_mdp_comp.h |  2 -
>>>   drivers/media/platform/mtk-mdp/mtk_mdp_core.c |  1 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_dec_drv.c  |  2 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_dec_hw.c   |  1 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c   | 41 +++--------------
>>>   .../platform/mtk-vcodec/mtk_vcodec_drv.h      |  3 --
>>>   .../platform/mtk-vcodec/mtk_vcodec_enc.c      |  1 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c  |  2 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c   | 45 +++----------------
>>>   drivers/memory/mtk-smi.c                      | 14 ------
>>>   include/soc/mediatek/smi.h                    | 20 ---------
>>>   32 files changed, 115 insertions(+), 333 deletions(-)
>>>
>>
>> Hello Hans, Matthias,
>> on my side, this series is totally ready for merge, hence, green light from here.
>>
>> Can you please take it for 5.18?
>>
> 
> @Hans: I understand you take the series through your tree. Please let me know when you do so. I'll take care of patch 12 and 13, which should go through my tree.

FYI: this series has been merged into the media tree, so you can go ahead with patches 12 and 13.

Regards,

	Hans
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 105+ messages in thread

* Re: [PATCH v10 00/13] Clean up "mediatek,larb"
@ 2022-01-31  9:47       ` Hans Verkuil
  0 siblings, 0 replies; 105+ messages in thread
From: Hans Verkuil @ 2022-01-31  9:47 UTC (permalink / raw)
  To: Matthias Brugger, AngeloGioacchino Del Regno, Yong Wu,
	Joerg Roedel, Rob Herring, Krzysztof Kozlowski, David Airlie,
	Mauro Carvalho Chehab
  Cc: Dafna Hirschfeld, Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang,
	anthony.huang, youlin.pei, Evan Green, Eizan Miyamoto,
	Matthias Kaehlcke, mingyuan.ma, linux-media, devicetree,
	Philipp Zabel, libo.kang, yi.kuo, linux-mediatek, Hsin-Yi Wang,
	Tiffany Lin, linux-arm-kernel, anan.sun, srv_heupstream,
	acourbot, linux-kernel, Tomasz Figa, iommu, Daniel Vetter,
	Robin Murphy



On 1/17/22 12:49, Matthias Brugger wrote:
> 
> 
> On 17/01/2022 11:27, AngeloGioacchino Del Regno wrote:
>> Il 17/01/22 08:04, Yong Wu ha scritto:
>>> MediaTek IOMMU block diagram always like below:
>>>
>>>          M4U
>>>           |
>>>      smi-common
>>>           |
>>>    -------------
>>>    |         |  ...
>>>    |         |
>>> larb1     larb2
>>>    |         |
>>> vdec       venc
>>>
>>> All the consumer connect with smi-larb, then connect with smi-common.
>>>
>>> When the consumer works, it should enable the smi-larb's power which also
>>> need enable the smi-common's power firstly.
>>>
>>> Thus, Firstly, use the device link connect the consumer and the
>>> smi-larbs. then add device link between the smi-larb and smi-common.
>>>
>>> After adding the device_link, then "mediatek,larb" property can be removed.
>>> the iommu consumer don't need call the mtk_smi_larb_get/put to enable
>>> the power and clock of smi-larb and smi-common.
>>>
>>> Base on the media branch [1] and a jpeg dtbinding patchset[2] that already got
>>> the necessary R-b.
>>>
>>> [1] git://linuxtv.org/hverkuil/media_tree.git tags/br-v5.18d
>>> [2] https://lore.kernel.org/linux-mediatek/20211206130425.184420-1-hsinyi@chromium.org/
>>>
>>> Change notes:
>>> v10: a) Rebase on the media tree. Respin the "media: mtk-vcodec:" patches.
>>>       b) Add Joerg's Ack for iommu patches.
>>>
>>> v9: https://lore.kernel.org/linux-mediatek/20211112105509.12010-1-yong.wu@mediatek.com/
>>>      1) Add return -ENODEV when the dev is null.
>>>      2) Add more strict about the case that a iommu consume device use the ports in
>>>      different larbs. Don't allow this case.
>>>      3) Remove two codec interface: mtk_vcodec_release_enc/dec_pm since it only has one
>>>      line now.
>>>
>>> v8: https://lore.kernel.org/linux-mediatek/20210929013719.25120-1-yong.wu@mediatek.com/
>>>      1) Rebase on v5.15-rc1.
>>>      2) Don't rebase the below mdp patchset that may still need more discuss.
>>>      https://lore.kernel.org/linux-mediatek/20210709022324.1607884-1-eizan@chromium.org/
>>>      3) Add Frank's Tested-by. Remove Dafna's Tested-by as he requested.
>>>
>>> v7: https://lore.kernel.org/linux-mediatek/20210730025238.22456-1-yong.wu@mediatek.com/
>>>      1) Fix a arm32 boot fail issue. reported from Frank.
>>>      2) Add a return fail in the mtk drm. suggested by Dafna.
>>>
>>> v6: https://lore.kernel.org/linux-mediatek/20210714025626.5528-1-yong.wu@mediatek.com/
>>>      1) rebase on v5.14-rc1.
>>>      2) Fix the issue commented in v5 from Dafna and Hsin-Yi.
>>>      3) Remove the patches about using pm_runtime_resume_and_get since they have
>>>         already been merged by other patches.
>>>
>>> v5: https://lore.kernel.org/linux-mediatek/20210410091128.31823-1-yong.wu@mediatek.com/
>>>      1) Base v5.12-rc2.
>>>      2) Remove changing the mtk-iommu to module_platform_driver patch, It have already been a
>>>      independent patch.
>>>
>>> v4: https://lore.kernel.org/linux-mediatek/1590826218-23653-1-git-send-email-yong.wu@mediatek.com/
>>>      base on v5.7-rc1.
>>>    1) Move drm PM patch before smi patchs.
>>>    2) Change builtin_platform_driver to module_platform_driver since we may need
>>>       build as module.
>>>    3) Rebase many patchset as above.
>>>
>>> v3: https://lore.kernel.org/linux-iommu/1567503456-24725-1-git-send-email-yong.wu@mediatek.com/
>>>      1) rebase on v5.3-rc1 and the latest mt8183 patchset.
>>>      2) Use device_is_bound to check whether the driver is ready from Matthias.
>>>      3) Add DL_FLAG_STATELESS flag when calling device_link_add and explain the
>>>     reason in the commit message[3/14].
>>>      4) Add a display patch[12/14] into this series. otherwise it may affect
>>>     display HW fastlogo even though it don't happen in mt8183.
>>> v2: https://lore.kernel.org/linux-iommu/1560171313-28299-1-git-send-email-yong.wu@mediatek.com/
>>>     1) rebase on v5.2-rc1.
>>>     2) Move adding device_link between the consumer and smi-larb into
>>> iommu_add_device from Robin.
>>>     3) add DL_FLAG_AUTOREMOVE_CONSUMER even though the smi is built-in from Evan.
>>>     4) Remove the shutdown callback in iommu.
>>>
>>> v1: https://lore.kernel.org/linux-iommu/1546318276-18993-1-git-send-email-yong.wu@mediatek.com/
>>>
>>> Yong Wu (12):
>>>    dt-binding: mediatek: Get rid of mediatek,larb for multimedia HW
>>>    iommu/mediatek-v1: Free the existed fwspec if the master dev already
>>>      has
>>>    iommu/mediatek: Return ENODEV if the device is NULL
>>>    iommu/mediatek: Add probe_defer for smi-larb
>>>    iommu/mediatek: Add device_link between the consumer and the larb
>>>      devices
>>>    media: mtk-jpeg: Get rid of mtk_smi_larb_get/put
>>>    media: mtk-mdp: Get rid of mtk_smi_larb_get/put
>>>    drm/mediatek: Get rid of mtk_smi_larb_get/put
>>>    media: mtk-vcodec: Get rid of mtk_smi_larb_get/put
>>>    memory: mtk-smi: Get rid of mtk_smi_larb_get/put
>>>    arm: dts: mediatek: Get rid of mediatek,larb for MM nodes
>>>    arm64: dts: mediatek: Get rid of mediatek,larb for MM nodes
>>>
>>> Yongqiang Niu (1):
>>>    drm/mediatek: Add pm runtime support for ovl and rdma
>>>
>>>   .../display/mediatek/mediatek,disp.txt        |  9 ----
>>>   .../media/mediatek,vcodec-decoder.yaml        |  7 ---
>>>   .../media/mediatek,vcodec-encoder.yaml        |  8 ----
>>>   .../bindings/media/mediatek-jpeg-decoder.yaml |  9 ----
>>>   .../bindings/media/mediatek-jpeg-encoder.yaml |  9 ----
>>>   .../bindings/media/mediatek-mdp.txt           |  8 ----
>>>   arch/arm/boot/dts/mt2701.dtsi                 |  2 -
>>>   arch/arm/boot/dts/mt7623n.dtsi                |  5 ---
>>>   arch/arm64/boot/dts/mediatek/mt8173.dtsi      | 16 -------
>>>   arch/arm64/boot/dts/mediatek/mt8183.dtsi      |  6 ---
>>>   drivers/gpu/drm/mediatek/mtk_disp_ovl.c       |  8 +++-
>>>   drivers/gpu/drm/mediatek/mtk_disp_rdma.c      |  9 +++-
>>>   drivers/gpu/drm/mediatek/mtk_drm_crtc.c       | 15 ++++---
>>>   drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c   | 36 +--------------
>>>   drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h   |  1 -
>>>   drivers/gpu/drm/mediatek/mtk_drm_drv.c        |  5 +--
>>>   drivers/iommu/mtk_iommu.c                     | 34 ++++++++++++++
>>>   drivers/iommu/mtk_iommu_v1.c                  | 42 ++++++++++++++++-
>>>   .../media/platform/mtk-jpeg/mtk_jpeg_core.c   | 45 +------------------
>>>   .../media/platform/mtk-jpeg/mtk_jpeg_core.h   |  2 -
>>>   drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 40 -----------------
>>>   drivers/media/platform/mtk-mdp/mtk_mdp_comp.h |  2 -
>>>   drivers/media/platform/mtk-mdp/mtk_mdp_core.c |  1 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_dec_drv.c  |  2 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_dec_hw.c   |  1 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c   | 41 +++--------------
>>>   .../platform/mtk-vcodec/mtk_vcodec_drv.h      |  3 --
>>>   .../platform/mtk-vcodec/mtk_vcodec_enc.c      |  1 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c  |  2 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c   | 45 +++----------------
>>>   drivers/memory/mtk-smi.c                      | 14 ------
>>>   include/soc/mediatek/smi.h                    | 20 ---------
>>>   32 files changed, 115 insertions(+), 333 deletions(-)
>>>
>>
>> Hello Hans, Matthias,
>> on my side, this series is totally ready for merge, hence, green light from here.
>>
>> Can you please take it for 5.18?
>>
> 
> @Hans: I understand you take the series through your tree. Please let me know when you do so. I'll take care of patch 12 and 13, which should go through my tree.

FYI: this series has been merged into the media tree, so you can go ahead with patches 12 and 13.

Regards,

	Hans

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 105+ messages in thread

* Re: [PATCH v10 00/13] Clean up "mediatek,larb"
@ 2022-01-31  9:47       ` Hans Verkuil
  0 siblings, 0 replies; 105+ messages in thread
From: Hans Verkuil @ 2022-01-31  9:47 UTC (permalink / raw)
  To: Matthias Brugger, AngeloGioacchino Del Regno, Yong Wu,
	Joerg Roedel, Rob Herring, Krzysztof Kozlowski, David Airlie,
	Mauro Carvalho Chehab
  Cc: Dafna Hirschfeld, Chun-Kuang Hu, Will Deacon, dri-devel, yf.wang,
	anthony.huang, youlin.pei, Evan Green, Eizan Miyamoto,
	Matthias Kaehlcke, mingyuan.ma, linux-media, devicetree,
	Frank Wunderlich, libo.kang, yi.kuo, linux-mediatek,
	Hsin-Yi Wang, Tiffany Lin, linux-arm-kernel, anan.sun,
	srv_heupstream, acourbot, linux-kernel, Tomasz Figa, iommu,
	Robin Murphy



On 1/17/22 12:49, Matthias Brugger wrote:
> 
> 
> On 17/01/2022 11:27, AngeloGioacchino Del Regno wrote:
>> Il 17/01/22 08:04, Yong Wu ha scritto:
>>> MediaTek IOMMU block diagram always like below:
>>>
>>>          M4U
>>>           |
>>>      smi-common
>>>           |
>>>    -------------
>>>    |         |  ...
>>>    |         |
>>> larb1     larb2
>>>    |         |
>>> vdec       venc
>>>
>>> All the consumer connect with smi-larb, then connect with smi-common.
>>>
>>> When the consumer works, it should enable the smi-larb's power which also
>>> need enable the smi-common's power firstly.
>>>
>>> Thus, Firstly, use the device link connect the consumer and the
>>> smi-larbs. then add device link between the smi-larb and smi-common.
>>>
>>> After adding the device_link, then "mediatek,larb" property can be removed.
>>> the iommu consumer don't need call the mtk_smi_larb_get/put to enable
>>> the power and clock of smi-larb and smi-common.
>>>
>>> Base on the media branch [1] and a jpeg dtbinding patchset[2] that already got
>>> the necessary R-b.
>>>
>>> [1] git://linuxtv.org/hverkuil/media_tree.git tags/br-v5.18d
>>> [2] https://lore.kernel.org/linux-mediatek/20211206130425.184420-1-hsinyi@chromium.org/
>>>
>>> Change notes:
>>> v10: a) Rebase on the media tree. Respin the "media: mtk-vcodec:" patches.
>>>       b) Add Joerg's Ack for iommu patches.
>>>
>>> v9: https://lore.kernel.org/linux-mediatek/20211112105509.12010-1-yong.wu@mediatek.com/
>>>      1) Add return -ENODEV when the dev is null.
>>>      2) Add more strict about the case that a iommu consume device use the ports in
>>>      different larbs. Don't allow this case.
>>>      3) Remove two codec interface: mtk_vcodec_release_enc/dec_pm since it only has one
>>>      line now.
>>>
>>> v8: https://lore.kernel.org/linux-mediatek/20210929013719.25120-1-yong.wu@mediatek.com/
>>>      1) Rebase on v5.15-rc1.
>>>      2) Don't rebase the below mdp patchset that may still need more discuss.
>>>      https://lore.kernel.org/linux-mediatek/20210709022324.1607884-1-eizan@chromium.org/
>>>      3) Add Frank's Tested-by. Remove Dafna's Tested-by as he requested.
>>>
>>> v7: https://lore.kernel.org/linux-mediatek/20210730025238.22456-1-yong.wu@mediatek.com/
>>>      1) Fix a arm32 boot fail issue. reported from Frank.
>>>      2) Add a return fail in the mtk drm. suggested by Dafna.
>>>
>>> v6: https://lore.kernel.org/linux-mediatek/20210714025626.5528-1-yong.wu@mediatek.com/
>>>      1) rebase on v5.14-rc1.
>>>      2) Fix the issue commented in v5 from Dafna and Hsin-Yi.
>>>      3) Remove the patches about using pm_runtime_resume_and_get since they have
>>>         already been merged by other patches.
>>>
>>> v5: https://lore.kernel.org/linux-mediatek/20210410091128.31823-1-yong.wu@mediatek.com/
>>>      1) Base v5.12-rc2.
>>>      2) Remove changing the mtk-iommu to module_platform_driver patch, It have already been a
>>>      independent patch.
>>>
>>> v4: https://lore.kernel.org/linux-mediatek/1590826218-23653-1-git-send-email-yong.wu@mediatek.com/
>>>      base on v5.7-rc1.
>>>    1) Move drm PM patch before smi patchs.
>>>    2) Change builtin_platform_driver to module_platform_driver since we may need
>>>       build as module.
>>>    3) Rebase many patchset as above.
>>>
>>> v3: https://lore.kernel.org/linux-iommu/1567503456-24725-1-git-send-email-yong.wu@mediatek.com/
>>>      1) rebase on v5.3-rc1 and the latest mt8183 patchset.
>>>      2) Use device_is_bound to check whether the driver is ready from Matthias.
>>>      3) Add DL_FLAG_STATELESS flag when calling device_link_add and explain the
>>>     reason in the commit message[3/14].
>>>      4) Add a display patch[12/14] into this series. otherwise it may affect
>>>     display HW fastlogo even though it don't happen in mt8183.
>>> v2: https://lore.kernel.org/linux-iommu/1560171313-28299-1-git-send-email-yong.wu@mediatek.com/
>>>     1) rebase on v5.2-rc1.
>>>     2) Move adding device_link between the consumer and smi-larb into
>>> iommu_add_device from Robin.
>>>     3) add DL_FLAG_AUTOREMOVE_CONSUMER even though the smi is built-in from Evan.
>>>     4) Remove the shutdown callback in iommu.
>>>
>>> v1: https://lore.kernel.org/linux-iommu/1546318276-18993-1-git-send-email-yong.wu@mediatek.com/
>>>
>>> Yong Wu (12):
>>>    dt-binding: mediatek: Get rid of mediatek,larb for multimedia HW
>>>    iommu/mediatek-v1: Free the existed fwspec if the master dev already
>>>      has
>>>    iommu/mediatek: Return ENODEV if the device is NULL
>>>    iommu/mediatek: Add probe_defer for smi-larb
>>>    iommu/mediatek: Add device_link between the consumer and the larb
>>>      devices
>>>    media: mtk-jpeg: Get rid of mtk_smi_larb_get/put
>>>    media: mtk-mdp: Get rid of mtk_smi_larb_get/put
>>>    drm/mediatek: Get rid of mtk_smi_larb_get/put
>>>    media: mtk-vcodec: Get rid of mtk_smi_larb_get/put
>>>    memory: mtk-smi: Get rid of mtk_smi_larb_get/put
>>>    arm: dts: mediatek: Get rid of mediatek,larb for MM nodes
>>>    arm64: dts: mediatek: Get rid of mediatek,larb for MM nodes
>>>
>>> Yongqiang Niu (1):
>>>    drm/mediatek: Add pm runtime support for ovl and rdma
>>>
>>>   .../display/mediatek/mediatek,disp.txt        |  9 ----
>>>   .../media/mediatek,vcodec-decoder.yaml        |  7 ---
>>>   .../media/mediatek,vcodec-encoder.yaml        |  8 ----
>>>   .../bindings/media/mediatek-jpeg-decoder.yaml |  9 ----
>>>   .../bindings/media/mediatek-jpeg-encoder.yaml |  9 ----
>>>   .../bindings/media/mediatek-mdp.txt           |  8 ----
>>>   arch/arm/boot/dts/mt2701.dtsi                 |  2 -
>>>   arch/arm/boot/dts/mt7623n.dtsi                |  5 ---
>>>   arch/arm64/boot/dts/mediatek/mt8173.dtsi      | 16 -------
>>>   arch/arm64/boot/dts/mediatek/mt8183.dtsi      |  6 ---
>>>   drivers/gpu/drm/mediatek/mtk_disp_ovl.c       |  8 +++-
>>>   drivers/gpu/drm/mediatek/mtk_disp_rdma.c      |  9 +++-
>>>   drivers/gpu/drm/mediatek/mtk_drm_crtc.c       | 15 ++++---
>>>   drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c   | 36 +--------------
>>>   drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h   |  1 -
>>>   drivers/gpu/drm/mediatek/mtk_drm_drv.c        |  5 +--
>>>   drivers/iommu/mtk_iommu.c                     | 34 ++++++++++++++
>>>   drivers/iommu/mtk_iommu_v1.c                  | 42 ++++++++++++++++-
>>>   .../media/platform/mtk-jpeg/mtk_jpeg_core.c   | 45 +------------------
>>>   .../media/platform/mtk-jpeg/mtk_jpeg_core.h   |  2 -
>>>   drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 40 -----------------
>>>   drivers/media/platform/mtk-mdp/mtk_mdp_comp.h |  2 -
>>>   drivers/media/platform/mtk-mdp/mtk_mdp_core.c |  1 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_dec_drv.c  |  2 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_dec_hw.c   |  1 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c   | 41 +++--------------
>>>   .../platform/mtk-vcodec/mtk_vcodec_drv.h      |  3 --
>>>   .../platform/mtk-vcodec/mtk_vcodec_enc.c      |  1 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c  |  2 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c   | 45 +++----------------
>>>   drivers/memory/mtk-smi.c                      | 14 ------
>>>   include/soc/mediatek/smi.h                    | 20 ---------
>>>   32 files changed, 115 insertions(+), 333 deletions(-)
>>>
>>
>> Hello Hans, Matthias,
>> on my side, this series is totally ready for merge, hence, green light from here.
>>
>> Can you please take it for 5.18?
>>
> 
> @Hans: I understand you take the series through your tree. Please let me know when you do so. I'll take care of patch 12 and 13, which should go through my tree.

FYI: this series has been merged into the media tree, so you can go ahead with patches 12 and 13.

Regards,

	Hans

^ permalink raw reply	[flat|nested] 105+ messages in thread

* Re: [PATCH v10 00/13] Clean up "mediatek,larb"
@ 2022-01-31  9:47       ` Hans Verkuil
  0 siblings, 0 replies; 105+ messages in thread
From: Hans Verkuil @ 2022-01-31  9:47 UTC (permalink / raw)
  To: Matthias Brugger, AngeloGioacchino Del Regno, Yong Wu,
	Joerg Roedel, Rob Herring, Krzysztof Kozlowski, David Airlie,
	Mauro Carvalho Chehab
  Cc: Evan Green, Robin Murphy, Tomasz Figa, Will Deacon,
	linux-mediatek, srv_heupstream, devicetree, linux-kernel,
	linux-arm-kernel, iommu, youlin.pei, Matthias Kaehlcke, anan.sun,
	yi.kuo, acourbot, linux-media, dri-devel, Daniel Vetter,
	Chun-Kuang Hu, Philipp Zabel, Tiffany Lin, Dafna Hirschfeld,
	Hsin-Yi Wang, Eizan Miyamoto, anthony.huang, Frank Wunderlich,
	mingyuan.ma, yf.wang, libo.kang



On 1/17/22 12:49, Matthias Brugger wrote:
> 
> 
> On 17/01/2022 11:27, AngeloGioacchino Del Regno wrote:
>> Il 17/01/22 08:04, Yong Wu ha scritto:
>>> MediaTek IOMMU block diagram always like below:
>>>
>>>          M4U
>>>           |
>>>      smi-common
>>>           |
>>>    -------------
>>>    |         |  ...
>>>    |         |
>>> larb1     larb2
>>>    |         |
>>> vdec       venc
>>>
>>> All the consumer connect with smi-larb, then connect with smi-common.
>>>
>>> When the consumer works, it should enable the smi-larb's power which also
>>> need enable the smi-common's power firstly.
>>>
>>> Thus, Firstly, use the device link connect the consumer and the
>>> smi-larbs. then add device link between the smi-larb and smi-common.
>>>
>>> After adding the device_link, then "mediatek,larb" property can be removed.
>>> the iommu consumer don't need call the mtk_smi_larb_get/put to enable
>>> the power and clock of smi-larb and smi-common.
>>>
>>> Base on the media branch [1] and a jpeg dtbinding patchset[2] that already got
>>> the necessary R-b.
>>>
>>> [1] git://linuxtv.org/hverkuil/media_tree.git tags/br-v5.18d
>>> [2] https://lore.kernel.org/linux-mediatek/20211206130425.184420-1-hsinyi@chromium.org/
>>>
>>> Change notes:
>>> v10: a) Rebase on the media tree. Respin the "media: mtk-vcodec:" patches.
>>>       b) Add Joerg's Ack for iommu patches.
>>>
>>> v9: https://lore.kernel.org/linux-mediatek/20211112105509.12010-1-yong.wu@mediatek.com/
>>>      1) Add return -ENODEV when the dev is null.
>>>      2) Add more strict about the case that a iommu consume device use the ports in
>>>      different larbs. Don't allow this case.
>>>      3) Remove two codec interface: mtk_vcodec_release_enc/dec_pm since it only has one
>>>      line now.
>>>
>>> v8: https://lore.kernel.org/linux-mediatek/20210929013719.25120-1-yong.wu@mediatek.com/
>>>      1) Rebase on v5.15-rc1.
>>>      2) Don't rebase the below mdp patchset that may still need more discuss.
>>>      https://lore.kernel.org/linux-mediatek/20210709022324.1607884-1-eizan@chromium.org/
>>>      3) Add Frank's Tested-by. Remove Dafna's Tested-by as he requested.
>>>
>>> v7: https://lore.kernel.org/linux-mediatek/20210730025238.22456-1-yong.wu@mediatek.com/
>>>      1) Fix a arm32 boot fail issue. reported from Frank.
>>>      2) Add a return fail in the mtk drm. suggested by Dafna.
>>>
>>> v6: https://lore.kernel.org/linux-mediatek/20210714025626.5528-1-yong.wu@mediatek.com/
>>>      1) rebase on v5.14-rc1.
>>>      2) Fix the issue commented in v5 from Dafna and Hsin-Yi.
>>>      3) Remove the patches about using pm_runtime_resume_and_get since they have
>>>         already been merged by other patches.
>>>
>>> v5: https://lore.kernel.org/linux-mediatek/20210410091128.31823-1-yong.wu@mediatek.com/
>>>      1) Base v5.12-rc2.
>>>      2) Remove changing the mtk-iommu to module_platform_driver patch, It have already been a
>>>      independent patch.
>>>
>>> v4: https://lore.kernel.org/linux-mediatek/1590826218-23653-1-git-send-email-yong.wu@mediatek.com/
>>>      base on v5.7-rc1.
>>>    1) Move drm PM patch before smi patchs.
>>>    2) Change builtin_platform_driver to module_platform_driver since we may need
>>>       build as module.
>>>    3) Rebase many patchset as above.
>>>
>>> v3: https://lore.kernel.org/linux-iommu/1567503456-24725-1-git-send-email-yong.wu@mediatek.com/
>>>      1) rebase on v5.3-rc1 and the latest mt8183 patchset.
>>>      2) Use device_is_bound to check whether the driver is ready from Matthias.
>>>      3) Add DL_FLAG_STATELESS flag when calling device_link_add and explain the
>>>     reason in the commit message[3/14].
>>>      4) Add a display patch[12/14] into this series. otherwise it may affect
>>>     display HW fastlogo even though it don't happen in mt8183.
>>> v2: https://lore.kernel.org/linux-iommu/1560171313-28299-1-git-send-email-yong.wu@mediatek.com/
>>>     1) rebase on v5.2-rc1.
>>>     2) Move adding device_link between the consumer and smi-larb into
>>> iommu_add_device from Robin.
>>>     3) add DL_FLAG_AUTOREMOVE_CONSUMER even though the smi is built-in from Evan.
>>>     4) Remove the shutdown callback in iommu.
>>>
>>> v1: https://lore.kernel.org/linux-iommu/1546318276-18993-1-git-send-email-yong.wu@mediatek.com/
>>>
>>> Yong Wu (12):
>>>    dt-binding: mediatek: Get rid of mediatek,larb for multimedia HW
>>>    iommu/mediatek-v1: Free the existed fwspec if the master dev already
>>>      has
>>>    iommu/mediatek: Return ENODEV if the device is NULL
>>>    iommu/mediatek: Add probe_defer for smi-larb
>>>    iommu/mediatek: Add device_link between the consumer and the larb
>>>      devices
>>>    media: mtk-jpeg: Get rid of mtk_smi_larb_get/put
>>>    media: mtk-mdp: Get rid of mtk_smi_larb_get/put
>>>    drm/mediatek: Get rid of mtk_smi_larb_get/put
>>>    media: mtk-vcodec: Get rid of mtk_smi_larb_get/put
>>>    memory: mtk-smi: Get rid of mtk_smi_larb_get/put
>>>    arm: dts: mediatek: Get rid of mediatek,larb for MM nodes
>>>    arm64: dts: mediatek: Get rid of mediatek,larb for MM nodes
>>>
>>> Yongqiang Niu (1):
>>>    drm/mediatek: Add pm runtime support for ovl and rdma
>>>
>>>   .../display/mediatek/mediatek,disp.txt        |  9 ----
>>>   .../media/mediatek,vcodec-decoder.yaml        |  7 ---
>>>   .../media/mediatek,vcodec-encoder.yaml        |  8 ----
>>>   .../bindings/media/mediatek-jpeg-decoder.yaml |  9 ----
>>>   .../bindings/media/mediatek-jpeg-encoder.yaml |  9 ----
>>>   .../bindings/media/mediatek-mdp.txt           |  8 ----
>>>   arch/arm/boot/dts/mt2701.dtsi                 |  2 -
>>>   arch/arm/boot/dts/mt7623n.dtsi                |  5 ---
>>>   arch/arm64/boot/dts/mediatek/mt8173.dtsi      | 16 -------
>>>   arch/arm64/boot/dts/mediatek/mt8183.dtsi      |  6 ---
>>>   drivers/gpu/drm/mediatek/mtk_disp_ovl.c       |  8 +++-
>>>   drivers/gpu/drm/mediatek/mtk_disp_rdma.c      |  9 +++-
>>>   drivers/gpu/drm/mediatek/mtk_drm_crtc.c       | 15 ++++---
>>>   drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c   | 36 +--------------
>>>   drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h   |  1 -
>>>   drivers/gpu/drm/mediatek/mtk_drm_drv.c        |  5 +--
>>>   drivers/iommu/mtk_iommu.c                     | 34 ++++++++++++++
>>>   drivers/iommu/mtk_iommu_v1.c                  | 42 ++++++++++++++++-
>>>   .../media/platform/mtk-jpeg/mtk_jpeg_core.c   | 45 +------------------
>>>   .../media/platform/mtk-jpeg/mtk_jpeg_core.h   |  2 -
>>>   drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 40 -----------------
>>>   drivers/media/platform/mtk-mdp/mtk_mdp_comp.h |  2 -
>>>   drivers/media/platform/mtk-mdp/mtk_mdp_core.c |  1 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_dec_drv.c  |  2 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_dec_hw.c   |  1 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c   | 41 +++--------------
>>>   .../platform/mtk-vcodec/mtk_vcodec_drv.h      |  3 --
>>>   .../platform/mtk-vcodec/mtk_vcodec_enc.c      |  1 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c  |  2 -
>>>   .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c   | 45 +++----------------
>>>   drivers/memory/mtk-smi.c                      | 14 ------
>>>   include/soc/mediatek/smi.h                    | 20 ---------
>>>   32 files changed, 115 insertions(+), 333 deletions(-)
>>>
>>
>> Hello Hans, Matthias,
>> on my side, this series is totally ready for merge, hence, green light from here.
>>
>> Can you please take it for 5.18?
>>
> 
> @Hans: I understand you take the series through your tree. Please let me know when you do so. I'll take care of patch 12 and 13, which should go through my tree.

FYI: this series has been merged into the media tree, so you can go ahead with patches 12 and 13.

Regards,

	Hans

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 105+ messages in thread

* Re: [PATCH v10 02/13] iommu/mediatek-v1: Free the existed fwspec if the master dev already has
  2022-01-28 12:45       ` Mauro Carvalho Chehab
                           ` (2 preceding siblings ...)
  (?)
@ 2022-01-31 12:29         ` Matthias Brugger
  -1 siblings, 0 replies; 105+ messages in thread
From: Matthias Brugger @ 2022-01-31 12:29 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Yong Wu
  Cc: Hans Verkuil, Joerg Roedel, Rob Herring, Krzysztof Kozlowski,
	David Airlie, Evan Green, Robin Murphy, Tomasz Figa, Will Deacon,
	linux-mediatek, srv_heupstream, devicetree, linux-kernel,
	linux-arm-kernel, iommu, youlin.pei, Matthias Kaehlcke, anan.sun,
	yi.kuo, acourbot, linux-media, dri-devel, Daniel Vetter,
	Chun-Kuang Hu, Philipp Zabel, Tiffany Lin, Dafna Hirschfeld,
	Hsin-Yi Wang, Eizan Miyamoto, anthony.huang, Frank Wunderlich,
	mingyuan.ma, yf.wang, libo.kang, AngeloGioacchino Del Regno



On 28/01/2022 13:45, Mauro Carvalho Chehab wrote:
> Em Fri, 28 Jan 2022 13:40:55 +0100
> Mauro Carvalho Chehab <mchehab@kernel.org> escreveu:
> 
>> Hi Matthias/Yong,
>>
>> Are you ok if this patch gets merged via the media tree together with the
>> remaining series, or do you prefer to apply it via SoC tree instead?
> 
> Same questions for other patches touching files outside drivers/media
> on this pull request:
> 
> 	https://patchwork.kernel.org/project/linux-mediatek/patch/7af52d61-47c7-581d-62ed-76a7f8315b16@xs4all.nl/
> 

Looks good to me.

Please let me know once you accepted the pull request and I'll queue the DTS 
related changes from this series.

Regards,
Matthias

> Like those:
> 	0004-0013-iommu-mediatek-v1-Free-the-existed-fwspec-if-the-mas.patch
> 	0005-0013-iommu-mediatek-Return-ENODEV-if-the-device-is-NULL.patch
> 	0006-0013-iommu-mediatek-Add-probe_defer-for-smi-larb.patch
> 	0007-0013-iommu-mediatek-Add-device_link-between-the-consumer-.patch
> 
> Regards,
> Mauro
> 
>>
>> Regards,
>> Mauro
>>
>>
>> Em Mon, 17 Jan 2022 15:04:59 +0800
>> Yong Wu <yong.wu@mediatek.com> escreveu:
>>
>>> When the iommu master device enters of_iommu_xlate, the ops may be
>>> NULL(iommu dev is defered), then it will initialize the fwspec here:
>>>
>>> [<c0c9c5bc>] (dev_iommu_fwspec_set) from [<c06bda80>]
>>> (iommu_fwspec_init+0xbc/0xd4)
>>> [<c06bd9c4>] (iommu_fwspec_init) from [<c06c0db4>]
>>> (of_iommu_xlate+0x7c/0x12c)
>>> [<c06c0d38>] (of_iommu_xlate) from [<c06c10e8>]
>>> (of_iommu_configure+0x144/0x1e8)
>>>
>>> BUT the mtk_iommu_v1.c only supports arm32, the probing flow still is a bit
>>> weird. We always expect create the fwspec internally. otherwise it will
>>> enter here and return fail.
>>>
>>> static int mtk_iommu_create_mapping(struct device *dev,
>>> 				    struct of_phandle_args *args)
>>> {
>>>          ...
>>> 	if (!fwspec) {
>>> 	        ....
>>> 	} else if (dev_iommu_fwspec_get(dev)->ops != &mtk_iommu_ops) {
>>>                  >>>>>>>>>>Enter here. return fail.<<<<<<<<<<<<
>>> 		return -EINVAL;
>>> 	}
>>> 	...
>>> }
>>>
>>> Thus, Free the existed fwspec if the master device already has fwspec.
>>>
>>> This issue is reported at:
>>> https://lore.kernel.org/linux-mediatek/trinity-7d9ebdc9-4849-4d93-bfb5-429dcb4ee449-1626253158870@3c-app-gmx-bs01/
>>>
>>> Reported-by: Frank Wunderlich <frank-w@public-files.de>
>>> Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
>>> Signed-off-by: Yong Wu <yong.wu@mediatek.com>
>>> Acked-by: Joerg Roedel <jroedel@suse.de>
>>> Acked-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
>>> ---
>>>   drivers/iommu/mtk_iommu_v1.c | 9 +++++++++
>>>   1 file changed, 9 insertions(+)
>>>
>>> diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
>>> index be22fcf988ce..1467ba1e4417 100644
>>> --- a/drivers/iommu/mtk_iommu_v1.c
>>> +++ b/drivers/iommu/mtk_iommu_v1.c
>>> @@ -425,6 +425,15 @@ static struct iommu_device *mtk_iommu_probe_device(struct device *dev)
>>>   	struct mtk_iommu_data *data;
>>>   	int err, idx = 0;
>>>   
>>> +	/*
>>> +	 * In the deferred case, free the existed fwspec.
>>> +	 * Always initialize the fwspec internally.
>>> +	 */
>>> +	if (fwspec) {
>>> +		iommu_fwspec_free(dev);
>>> +		fwspec = dev_iommu_fwspec_get(dev);
>>> +	}
>>> +
>>>   	while (!of_parse_phandle_with_args(dev->of_node, "iommus",
>>>   					   "#iommu-cells",
>>>   					   idx, &iommu_spec)) {
>>
>>
>>
>> Thanks,
>> Mauro
> 
> 
> 
> Thanks,
> Mauro

^ permalink raw reply	[flat|nested] 105+ messages in thread

* Re: [PATCH v10 02/13] iommu/mediatek-v1: Free the existed fwspec if the master dev already has
@ 2022-01-31 12:29         ` Matthias Brugger
  0 siblings, 0 replies; 105+ messages in thread
From: Matthias Brugger @ 2022-01-31 12:29 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Yong Wu
  Cc: Chun-Kuang Hu, David Airlie, Will Deacon, dri-devel, yf.wang,
	Hans Verkuil, anthony.huang, Krzysztof Kozlowski, Evan Green,
	Eizan Miyamoto, Matthias Kaehlcke, mingyuan.ma, linux-media,
	devicetree, Joerg Roedel, Philipp Zabel, Frank Wunderlich,
	libo.kang, yi.kuo, Rob Herring, linux-mediatek, Hsin-Yi Wang,
	Tiffany Lin, linux-arm-kernel, AngeloGioacchino Del Regno,
	anan.sun, srv_heupstream, acourbot, linux-kernel, iommu,
	Daniel Vetter, Robin Murphy



On 28/01/2022 13:45, Mauro Carvalho Chehab wrote:
> Em Fri, 28 Jan 2022 13:40:55 +0100
> Mauro Carvalho Chehab <mchehab@kernel.org> escreveu:
> 
>> Hi Matthias/Yong,
>>
>> Are you ok if this patch gets merged via the media tree together with the
>> remaining series, or do you prefer to apply it via SoC tree instead?
> 
> Same questions for other patches touching files outside drivers/media
> on this pull request:
> 
> 	https://patchwork.kernel.org/project/linux-mediatek/patch/7af52d61-47c7-581d-62ed-76a7f8315b16@xs4all.nl/
> 

Looks good to me.

Please let me know once you accepted the pull request and I'll queue the DTS 
related changes from this series.

Regards,
Matthias

> Like those:
> 	0004-0013-iommu-mediatek-v1-Free-the-existed-fwspec-if-the-mas.patch
> 	0005-0013-iommu-mediatek-Return-ENODEV-if-the-device-is-NULL.patch
> 	0006-0013-iommu-mediatek-Add-probe_defer-for-smi-larb.patch
> 	0007-0013-iommu-mediatek-Add-device_link-between-the-consumer-.patch
> 
> Regards,
> Mauro
> 
>>
>> Regards,
>> Mauro
>>
>>
>> Em Mon, 17 Jan 2022 15:04:59 +0800
>> Yong Wu <yong.wu@mediatek.com> escreveu:
>>
>>> When the iommu master device enters of_iommu_xlate, the ops may be
>>> NULL(iommu dev is defered), then it will initialize the fwspec here:
>>>
>>> [<c0c9c5bc>] (dev_iommu_fwspec_set) from [<c06bda80>]
>>> (iommu_fwspec_init+0xbc/0xd4)
>>> [<c06bd9c4>] (iommu_fwspec_init) from [<c06c0db4>]
>>> (of_iommu_xlate+0x7c/0x12c)
>>> [<c06c0d38>] (of_iommu_xlate) from [<c06c10e8>]
>>> (of_iommu_configure+0x144/0x1e8)
>>>
>>> BUT the mtk_iommu_v1.c only supports arm32, the probing flow still is a bit
>>> weird. We always expect create the fwspec internally. otherwise it will
>>> enter here and return fail.
>>>
>>> static int mtk_iommu_create_mapping(struct device *dev,
>>> 				    struct of_phandle_args *args)
>>> {
>>>          ...
>>> 	if (!fwspec) {
>>> 	        ....
>>> 	} else if (dev_iommu_fwspec_get(dev)->ops != &mtk_iommu_ops) {
>>>                  >>>>>>>>>>Enter here. return fail.<<<<<<<<<<<<
>>> 		return -EINVAL;
>>> 	}
>>> 	...
>>> }
>>>
>>> Thus, Free the existed fwspec if the master device already has fwspec.
>>>
>>> This issue is reported at:
>>> https://lore.kernel.org/linux-mediatek/trinity-7d9ebdc9-4849-4d93-bfb5-429dcb4ee449-1626253158870@3c-app-gmx-bs01/
>>>
>>> Reported-by: Frank Wunderlich <frank-w@public-files.de>
>>> Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
>>> Signed-off-by: Yong Wu <yong.wu@mediatek.com>
>>> Acked-by: Joerg Roedel <jroedel@suse.de>
>>> Acked-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
>>> ---
>>>   drivers/iommu/mtk_iommu_v1.c | 9 +++++++++
>>>   1 file changed, 9 insertions(+)
>>>
>>> diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
>>> index be22fcf988ce..1467ba1e4417 100644
>>> --- a/drivers/iommu/mtk_iommu_v1.c
>>> +++ b/drivers/iommu/mtk_iommu_v1.c
>>> @@ -425,6 +425,15 @@ static struct iommu_device *mtk_iommu_probe_device(struct device *dev)
>>>   	struct mtk_iommu_data *data;
>>>   	int err, idx = 0;
>>>   
>>> +	/*
>>> +	 * In the deferred case, free the existed fwspec.
>>> +	 * Always initialize the fwspec internally.
>>> +	 */
>>> +	if (fwspec) {
>>> +		iommu_fwspec_free(dev);
>>> +		fwspec = dev_iommu_fwspec_get(dev);
>>> +	}
>>> +
>>>   	while (!of_parse_phandle_with_args(dev->of_node, "iommus",
>>>   					   "#iommu-cells",
>>>   					   idx, &iommu_spec)) {
>>
>>
>>
>> Thanks,
>> Mauro
> 
> 
> 
> Thanks,
> Mauro
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 105+ messages in thread

* Re: [PATCH v10 02/13] iommu/mediatek-v1: Free the existed fwspec if the master dev already has
@ 2022-01-31 12:29         ` Matthias Brugger
  0 siblings, 0 replies; 105+ messages in thread
From: Matthias Brugger @ 2022-01-31 12:29 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Yong Wu
  Cc: Dafna Hirschfeld, Chun-Kuang Hu, David Airlie, Will Deacon,
	dri-devel, yf.wang, Hans Verkuil, anthony.huang, youlin.pei,
	Krzysztof Kozlowski, Evan Green, Eizan Miyamoto,
	Matthias Kaehlcke, mingyuan.ma, linux-media, devicetree,
	Joerg Roedel, Frank Wunderlich, libo.kang, yi.kuo, Rob Herring,
	linux-mediatek, Hsin-Yi Wang, Tiffany Lin, linux-arm-kernel,
	AngeloGioacchino Del Regno, anan.sun, srv_heupstream, acourbot,
	linux-kernel, Tomasz Figa, iommu, Robin Murphy



On 28/01/2022 13:45, Mauro Carvalho Chehab wrote:
> Em Fri, 28 Jan 2022 13:40:55 +0100
> Mauro Carvalho Chehab <mchehab@kernel.org> escreveu:
> 
>> Hi Matthias/Yong,
>>
>> Are you ok if this patch gets merged via the media tree together with the
>> remaining series, or do you prefer to apply it via SoC tree instead?
> 
> Same questions for other patches touching files outside drivers/media
> on this pull request:
> 
> 	https://patchwork.kernel.org/project/linux-mediatek/patch/7af52d61-47c7-581d-62ed-76a7f8315b16@xs4all.nl/
> 

Looks good to me.

Please let me know once you accepted the pull request and I'll queue the DTS 
related changes from this series.

Regards,
Matthias

> Like those:
> 	0004-0013-iommu-mediatek-v1-Free-the-existed-fwspec-if-the-mas.patch
> 	0005-0013-iommu-mediatek-Return-ENODEV-if-the-device-is-NULL.patch
> 	0006-0013-iommu-mediatek-Add-probe_defer-for-smi-larb.patch
> 	0007-0013-iommu-mediatek-Add-device_link-between-the-consumer-.patch
> 
> Regards,
> Mauro
> 
>>
>> Regards,
>> Mauro
>>
>>
>> Em Mon, 17 Jan 2022 15:04:59 +0800
>> Yong Wu <yong.wu@mediatek.com> escreveu:
>>
>>> When the iommu master device enters of_iommu_xlate, the ops may be
>>> NULL(iommu dev is defered), then it will initialize the fwspec here:
>>>
>>> [<c0c9c5bc>] (dev_iommu_fwspec_set) from [<c06bda80>]
>>> (iommu_fwspec_init+0xbc/0xd4)
>>> [<c06bd9c4>] (iommu_fwspec_init) from [<c06c0db4>]
>>> (of_iommu_xlate+0x7c/0x12c)
>>> [<c06c0d38>] (of_iommu_xlate) from [<c06c10e8>]
>>> (of_iommu_configure+0x144/0x1e8)
>>>
>>> BUT the mtk_iommu_v1.c only supports arm32, the probing flow still is a bit
>>> weird. We always expect create the fwspec internally. otherwise it will
>>> enter here and return fail.
>>>
>>> static int mtk_iommu_create_mapping(struct device *dev,
>>> 				    struct of_phandle_args *args)
>>> {
>>>          ...
>>> 	if (!fwspec) {
>>> 	        ....
>>> 	} else if (dev_iommu_fwspec_get(dev)->ops != &mtk_iommu_ops) {
>>>                  >>>>>>>>>>Enter here. return fail.<<<<<<<<<<<<
>>> 		return -EINVAL;
>>> 	}
>>> 	...
>>> }
>>>
>>> Thus, Free the existed fwspec if the master device already has fwspec.
>>>
>>> This issue is reported at:
>>> https://lore.kernel.org/linux-mediatek/trinity-7d9ebdc9-4849-4d93-bfb5-429dcb4ee449-1626253158870@3c-app-gmx-bs01/
>>>
>>> Reported-by: Frank Wunderlich <frank-w@public-files.de>
>>> Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
>>> Signed-off-by: Yong Wu <yong.wu@mediatek.com>
>>> Acked-by: Joerg Roedel <jroedel@suse.de>
>>> Acked-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
>>> ---
>>>   drivers/iommu/mtk_iommu_v1.c | 9 +++++++++
>>>   1 file changed, 9 insertions(+)
>>>
>>> diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
>>> index be22fcf988ce..1467ba1e4417 100644
>>> --- a/drivers/iommu/mtk_iommu_v1.c
>>> +++ b/drivers/iommu/mtk_iommu_v1.c
>>> @@ -425,6 +425,15 @@ static struct iommu_device *mtk_iommu_probe_device(struct device *dev)
>>>   	struct mtk_iommu_data *data;
>>>   	int err, idx = 0;
>>>   
>>> +	/*
>>> +	 * In the deferred case, free the existed fwspec.
>>> +	 * Always initialize the fwspec internally.
>>> +	 */
>>> +	if (fwspec) {
>>> +		iommu_fwspec_free(dev);
>>> +		fwspec = dev_iommu_fwspec_get(dev);
>>> +	}
>>> +
>>>   	while (!of_parse_phandle_with_args(dev->of_node, "iommus",
>>>   					   "#iommu-cells",
>>>   					   idx, &iommu_spec)) {
>>
>>
>>
>> Thanks,
>> Mauro
> 
> 
> 
> Thanks,
> Mauro

^ permalink raw reply	[flat|nested] 105+ messages in thread

* Re: [PATCH v10 02/13] iommu/mediatek-v1: Free the existed fwspec if the master dev already has
@ 2022-01-31 12:29         ` Matthias Brugger
  0 siblings, 0 replies; 105+ messages in thread
From: Matthias Brugger @ 2022-01-31 12:29 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Yong Wu
  Cc: Dafna Hirschfeld, Chun-Kuang Hu, David Airlie, Will Deacon,
	dri-devel, yf.wang, Hans Verkuil, anthony.huang, youlin.pei,
	Krzysztof Kozlowski, Evan Green, Eizan Miyamoto,
	Matthias Kaehlcke, mingyuan.ma, linux-media, devicetree,
	Joerg Roedel, Philipp Zabel, libo.kang, yi.kuo, Rob Herring,
	linux-mediatek, Hsin-Yi Wang, Tiffany Lin, linux-arm-kernel,
	AngeloGioacchino Del Regno, anan.sun, srv_heupstream, acourbot,
	linux-kernel, Tomasz Figa, iommu, Daniel Vetter, Robin Murphy



On 28/01/2022 13:45, Mauro Carvalho Chehab wrote:
> Em Fri, 28 Jan 2022 13:40:55 +0100
> Mauro Carvalho Chehab <mchehab@kernel.org> escreveu:
> 
>> Hi Matthias/Yong,
>>
>> Are you ok if this patch gets merged via the media tree together with the
>> remaining series, or do you prefer to apply it via SoC tree instead?
> 
> Same questions for other patches touching files outside drivers/media
> on this pull request:
> 
> 	https://patchwork.kernel.org/project/linux-mediatek/patch/7af52d61-47c7-581d-62ed-76a7f8315b16@xs4all.nl/
> 

Looks good to me.

Please let me know once you accepted the pull request and I'll queue the DTS 
related changes from this series.

Regards,
Matthias

> Like those:
> 	0004-0013-iommu-mediatek-v1-Free-the-existed-fwspec-if-the-mas.patch
> 	0005-0013-iommu-mediatek-Return-ENODEV-if-the-device-is-NULL.patch
> 	0006-0013-iommu-mediatek-Add-probe_defer-for-smi-larb.patch
> 	0007-0013-iommu-mediatek-Add-device_link-between-the-consumer-.patch
> 
> Regards,
> Mauro
> 
>>
>> Regards,
>> Mauro
>>
>>
>> Em Mon, 17 Jan 2022 15:04:59 +0800
>> Yong Wu <yong.wu@mediatek.com> escreveu:
>>
>>> When the iommu master device enters of_iommu_xlate, the ops may be
>>> NULL(iommu dev is defered), then it will initialize the fwspec here:
>>>
>>> [<c0c9c5bc>] (dev_iommu_fwspec_set) from [<c06bda80>]
>>> (iommu_fwspec_init+0xbc/0xd4)
>>> [<c06bd9c4>] (iommu_fwspec_init) from [<c06c0db4>]
>>> (of_iommu_xlate+0x7c/0x12c)
>>> [<c06c0d38>] (of_iommu_xlate) from [<c06c10e8>]
>>> (of_iommu_configure+0x144/0x1e8)
>>>
>>> BUT the mtk_iommu_v1.c only supports arm32, the probing flow still is a bit
>>> weird. We always expect create the fwspec internally. otherwise it will
>>> enter here and return fail.
>>>
>>> static int mtk_iommu_create_mapping(struct device *dev,
>>> 				    struct of_phandle_args *args)
>>> {
>>>          ...
>>> 	if (!fwspec) {
>>> 	        ....
>>> 	} else if (dev_iommu_fwspec_get(dev)->ops != &mtk_iommu_ops) {
>>>                  >>>>>>>>>>Enter here. return fail.<<<<<<<<<<<<
>>> 		return -EINVAL;
>>> 	}
>>> 	...
>>> }
>>>
>>> Thus, Free the existed fwspec if the master device already has fwspec.
>>>
>>> This issue is reported at:
>>> https://lore.kernel.org/linux-mediatek/trinity-7d9ebdc9-4849-4d93-bfb5-429dcb4ee449-1626253158870@3c-app-gmx-bs01/
>>>
>>> Reported-by: Frank Wunderlich <frank-w@public-files.de>
>>> Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
>>> Signed-off-by: Yong Wu <yong.wu@mediatek.com>
>>> Acked-by: Joerg Roedel <jroedel@suse.de>
>>> Acked-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
>>> ---
>>>   drivers/iommu/mtk_iommu_v1.c | 9 +++++++++
>>>   1 file changed, 9 insertions(+)
>>>
>>> diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
>>> index be22fcf988ce..1467ba1e4417 100644
>>> --- a/drivers/iommu/mtk_iommu_v1.c
>>> +++ b/drivers/iommu/mtk_iommu_v1.c
>>> @@ -425,6 +425,15 @@ static struct iommu_device *mtk_iommu_probe_device(struct device *dev)
>>>   	struct mtk_iommu_data *data;
>>>   	int err, idx = 0;
>>>   
>>> +	/*
>>> +	 * In the deferred case, free the existed fwspec.
>>> +	 * Always initialize the fwspec internally.
>>> +	 */
>>> +	if (fwspec) {
>>> +		iommu_fwspec_free(dev);
>>> +		fwspec = dev_iommu_fwspec_get(dev);
>>> +	}
>>> +
>>>   	while (!of_parse_phandle_with_args(dev->of_node, "iommus",
>>>   					   "#iommu-cells",
>>>   					   idx, &iommu_spec)) {
>>
>>
>>
>> Thanks,
>> Mauro
> 
> 
> 
> Thanks,
> Mauro

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 105+ messages in thread

* Re: [PATCH v10 02/13] iommu/mediatek-v1: Free the existed fwspec if the master dev already has
@ 2022-01-31 12:29         ` Matthias Brugger
  0 siblings, 0 replies; 105+ messages in thread
From: Matthias Brugger @ 2022-01-31 12:29 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Yong Wu
  Cc: Hans Verkuil, Joerg Roedel, Rob Herring, Krzysztof Kozlowski,
	David Airlie, Evan Green, Robin Murphy, Tomasz Figa, Will Deacon,
	linux-mediatek, srv_heupstream, devicetree, linux-kernel,
	linux-arm-kernel, iommu, youlin.pei, Matthias Kaehlcke, anan.sun,
	yi.kuo, acourbot, linux-media, dri-devel, Daniel Vetter,
	Chun-Kuang Hu, Philipp Zabel, Tiffany Lin, Dafna Hirschfeld,
	Hsin-Yi Wang, Eizan Miyamoto, anthony.huang, Frank Wunderlich,
	mingyuan.ma, yf.wang, libo.kang, AngeloGioacchino Del Regno



On 28/01/2022 13:45, Mauro Carvalho Chehab wrote:
> Em Fri, 28 Jan 2022 13:40:55 +0100
> Mauro Carvalho Chehab <mchehab@kernel.org> escreveu:
> 
>> Hi Matthias/Yong,
>>
>> Are you ok if this patch gets merged via the media tree together with the
>> remaining series, or do you prefer to apply it via SoC tree instead?
> 
> Same questions for other patches touching files outside drivers/media
> on this pull request:
> 
> 	https://patchwork.kernel.org/project/linux-mediatek/patch/7af52d61-47c7-581d-62ed-76a7f8315b16@xs4all.nl/
> 

Looks good to me.

Please let me know once you accepted the pull request and I'll queue the DTS 
related changes from this series.

Regards,
Matthias

> Like those:
> 	0004-0013-iommu-mediatek-v1-Free-the-existed-fwspec-if-the-mas.patch
> 	0005-0013-iommu-mediatek-Return-ENODEV-if-the-device-is-NULL.patch
> 	0006-0013-iommu-mediatek-Add-probe_defer-for-smi-larb.patch
> 	0007-0013-iommu-mediatek-Add-device_link-between-the-consumer-.patch
> 
> Regards,
> Mauro
> 
>>
>> Regards,
>> Mauro
>>
>>
>> Em Mon, 17 Jan 2022 15:04:59 +0800
>> Yong Wu <yong.wu@mediatek.com> escreveu:
>>
>>> When the iommu master device enters of_iommu_xlate, the ops may be
>>> NULL(iommu dev is defered), then it will initialize the fwspec here:
>>>
>>> [<c0c9c5bc>] (dev_iommu_fwspec_set) from [<c06bda80>]
>>> (iommu_fwspec_init+0xbc/0xd4)
>>> [<c06bd9c4>] (iommu_fwspec_init) from [<c06c0db4>]
>>> (of_iommu_xlate+0x7c/0x12c)
>>> [<c06c0d38>] (of_iommu_xlate) from [<c06c10e8>]
>>> (of_iommu_configure+0x144/0x1e8)
>>>
>>> BUT the mtk_iommu_v1.c only supports arm32, the probing flow still is a bit
>>> weird. We always expect create the fwspec internally. otherwise it will
>>> enter here and return fail.
>>>
>>> static int mtk_iommu_create_mapping(struct device *dev,
>>> 				    struct of_phandle_args *args)
>>> {
>>>          ...
>>> 	if (!fwspec) {
>>> 	        ....
>>> 	} else if (dev_iommu_fwspec_get(dev)->ops != &mtk_iommu_ops) {
>>>                  >>>>>>>>>>Enter here. return fail.<<<<<<<<<<<<
>>> 		return -EINVAL;
>>> 	}
>>> 	...
>>> }
>>>
>>> Thus, Free the existed fwspec if the master device already has fwspec.
>>>
>>> This issue is reported at:
>>> https://lore.kernel.org/linux-mediatek/trinity-7d9ebdc9-4849-4d93-bfb5-429dcb4ee449-1626253158870@3c-app-gmx-bs01/
>>>
>>> Reported-by: Frank Wunderlich <frank-w@public-files.de>
>>> Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
>>> Signed-off-by: Yong Wu <yong.wu@mediatek.com>
>>> Acked-by: Joerg Roedel <jroedel@suse.de>
>>> Acked-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
>>> ---
>>>   drivers/iommu/mtk_iommu_v1.c | 9 +++++++++
>>>   1 file changed, 9 insertions(+)
>>>
>>> diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
>>> index be22fcf988ce..1467ba1e4417 100644
>>> --- a/drivers/iommu/mtk_iommu_v1.c
>>> +++ b/drivers/iommu/mtk_iommu_v1.c
>>> @@ -425,6 +425,15 @@ static struct iommu_device *mtk_iommu_probe_device(struct device *dev)
>>>   	struct mtk_iommu_data *data;
>>>   	int err, idx = 0;
>>>   
>>> +	/*
>>> +	 * In the deferred case, free the existed fwspec.
>>> +	 * Always initialize the fwspec internally.
>>> +	 */
>>> +	if (fwspec) {
>>> +		iommu_fwspec_free(dev);
>>> +		fwspec = dev_iommu_fwspec_get(dev);
>>> +	}
>>> +
>>>   	while (!of_parse_phandle_with_args(dev->of_node, "iommus",
>>>   					   "#iommu-cells",
>>>   					   idx, &iommu_spec)) {
>>
>>
>>
>> Thanks,
>> Mauro
> 
> 
> 
> Thanks,
> Mauro

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 105+ messages in thread

end of thread, other threads:[~2022-01-31 12:31 UTC | newest]

Thread overview: 105+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-17  7:04 [PATCH v10 00/13] Clean up "mediatek,larb" Yong Wu
2022-01-17  7:04 ` Yong Wu
2022-01-17  7:04 ` Yong Wu
2022-01-17  7:04 ` Yong Wu
2022-01-17  7:04 ` Yong Wu
2022-01-17  7:04 ` [PATCH v10 01/13] dt-binding: mediatek: Get rid of mediatek,larb for multimedia HW Yong Wu
2022-01-17  7:04   ` [PATCH v10 01/13] dt-binding: mediatek: Get rid of mediatek, larb " Yong Wu
2022-01-17  7:04   ` Yong Wu
2022-01-17  7:04   ` Yong Wu
2022-01-17  7:04   ` Yong Wu
2022-01-17  7:04 ` [PATCH v10 02/13] iommu/mediatek-v1: Free the existed fwspec if the master dev already has Yong Wu
2022-01-17  7:04   ` Yong Wu
2022-01-17  7:04   ` Yong Wu
2022-01-17  7:04   ` Yong Wu
2022-01-17  7:04   ` Yong Wu
2022-01-28 12:40   ` Mauro Carvalho Chehab
2022-01-28 12:40     ` Mauro Carvalho Chehab
2022-01-28 12:40     ` Mauro Carvalho Chehab
2022-01-28 12:40     ` Mauro Carvalho Chehab
2022-01-28 12:40     ` Mauro Carvalho Chehab
2022-01-28 12:45     ` Mauro Carvalho Chehab
2022-01-28 12:45       ` Mauro Carvalho Chehab
2022-01-28 12:45       ` Mauro Carvalho Chehab
2022-01-28 12:45       ` Mauro Carvalho Chehab
2022-01-28 12:45       ` Mauro Carvalho Chehab
2022-01-31 12:29       ` Matthias Brugger
2022-01-31 12:29         ` Matthias Brugger
2022-01-31 12:29         ` Matthias Brugger
2022-01-31 12:29         ` Matthias Brugger
2022-01-31 12:29         ` Matthias Brugger
2022-01-17  7:05 ` [PATCH v10 03/13] iommu/mediatek: Return ENODEV if the device is NULL Yong Wu
2022-01-17  7:05   ` Yong Wu
2022-01-17  7:05   ` Yong Wu
2022-01-17  7:05   ` Yong Wu
2022-01-17  7:05   ` Yong Wu
2022-01-17  7:05 ` [PATCH v10 04/13] iommu/mediatek: Add probe_defer for smi-larb Yong Wu
2022-01-17  7:05   ` Yong Wu
2022-01-17  7:05   ` Yong Wu
2022-01-17  7:05   ` Yong Wu
2022-01-17  7:05   ` Yong Wu
2022-01-17  7:05 ` [PATCH v10 05/13] iommu/mediatek: Add device_link between the consumer and the larb devices Yong Wu
2022-01-17  7:05   ` Yong Wu
2022-01-17  7:05   ` Yong Wu
2022-01-17  7:05   ` Yong Wu
2022-01-17  7:05   ` Yong Wu
2022-01-17  7:05 ` [PATCH v10 06/13] media: mtk-jpeg: Get rid of mtk_smi_larb_get/put Yong Wu
2022-01-17  7:05   ` Yong Wu
2022-01-17  7:05   ` Yong Wu
2022-01-17  7:05   ` Yong Wu
2022-01-17  7:05   ` Yong Wu
2022-01-17  7:05 ` [PATCH v10 07/13] media: mtk-mdp: " Yong Wu
2022-01-17  7:05   ` Yong Wu
2022-01-17  7:05   ` Yong Wu
2022-01-17  7:05   ` Yong Wu
2022-01-17  7:05   ` Yong Wu
2022-01-17  7:05 ` [PATCH v10 08/13] drm/mediatek: Add pm runtime support for ovl and rdma Yong Wu
2022-01-17  7:05   ` Yong Wu
2022-01-17  7:05   ` Yong Wu
2022-01-17  7:05   ` Yong Wu
2022-01-17  7:05   ` Yong Wu
2022-01-17  7:05 ` [PATCH v10 09/13] drm/mediatek: Get rid of mtk_smi_larb_get/put Yong Wu
2022-01-17  7:05   ` Yong Wu
2022-01-17  7:05   ` Yong Wu
2022-01-17  7:05   ` Yong Wu
2022-01-17  7:05   ` Yong Wu
2022-01-17  7:05 ` [PATCH v10 10/13] media: mtk-vcodec: " Yong Wu
2022-01-17  7:05   ` Yong Wu
2022-01-17  7:05   ` Yong Wu
2022-01-17  7:05   ` Yong Wu
2022-01-17  7:05   ` Yong Wu
2022-01-17  7:05 ` [PATCH v10 11/13] memory: mtk-smi: " Yong Wu
2022-01-17  7:05   ` Yong Wu
2022-01-17  7:05   ` Yong Wu
2022-01-17  7:05   ` Yong Wu
2022-01-17  7:05   ` Yong Wu
2022-01-17  7:05 ` [PATCH v10 12/13] arm: dts: mediatek: Get rid of mediatek, larb for MM nodes Yong Wu
2022-01-17  7:05   ` Yong Wu
2022-01-17  7:05   ` Yong Wu
2022-01-17  7:05   ` [PATCH v10 12/13] arm: dts: mediatek: Get rid of mediatek,larb " Yong Wu
2022-01-17  7:05   ` [PATCH v10 12/13] arm: dts: mediatek: Get rid of mediatek, larb " Yong Wu
2022-01-17  7:05 ` [PATCH v10 13/13] arm64: " Yong Wu
2022-01-17  7:05   ` Yong Wu
2022-01-17  7:05   ` Yong Wu
2022-01-17  7:05   ` [PATCH v10 13/13] arm64: dts: mediatek: Get rid of mediatek,larb " Yong Wu
2022-01-17  7:05   ` [PATCH v10 13/13] arm64: dts: mediatek: Get rid of mediatek, larb " Yong Wu
2022-01-17 10:27 ` [PATCH v10 00/13] Clean up "mediatek,larb" AngeloGioacchino Del Regno
2022-01-17 10:27   ` AngeloGioacchino Del Regno
2022-01-17 10:27   ` AngeloGioacchino Del Regno
2022-01-17 10:27   ` AngeloGioacchino Del Regno
2022-01-17 10:27   ` AngeloGioacchino Del Regno
2022-01-17 11:49   ` Matthias Brugger
2022-01-17 11:49     ` Matthias Brugger
2022-01-17 11:49     ` Matthias Brugger
2022-01-17 11:49     ` Matthias Brugger
2022-01-17 11:49     ` Matthias Brugger
2022-01-17 12:04     ` Hans Verkuil
2022-01-17 12:04       ` Hans Verkuil
2022-01-17 12:04       ` Hans Verkuil
2022-01-17 12:04       ` Hans Verkuil
2022-01-17 12:04       ` Hans Verkuil
2022-01-31  9:47     ` Hans Verkuil
2022-01-31  9:47       ` Hans Verkuil
2022-01-31  9:47       ` Hans Verkuil
2022-01-31  9:47       ` Hans Verkuil
2022-01-31  9:47       ` Hans Verkuil

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.