Re: [PATCH v12 4/5] soc / drm: mediatek: Move routing control to mmsys device

2020-04-21 Thread Matthias Brugger


On 4/16/20 6:22 PM, Chun-Kuang Hu wrote:
> Hi, Matthias:
> 
> Matthias Brugger  於 2020年3月26日 週四 下午11:45寫道:
>>
>>
>>
>> On 26/03/2020 15:51, CK Hu wrote:
>>> Hi, Matthias:
>>>
>>> On Thu, 2020-03-26 at 12:54 +0100, Matthias Brugger wrote:
 Hi CK,

 On 26/03/2020 00:05, CK Hu wrote:
> Hi, Matthias:
>
> On Wed, 2020-03-25 at 17:16 +0100, Matthias Brugger wrote:
>>
>> On 11/03/2020 17:53, Enric Balletbo i Serra wrote:
>>> Provide a mtk_mmsys_ddp_connect() and mtk_mmsys_disconnect() functions 
>>> to
>>> replace mtk_ddp_add_comp_to_path() and mtk_ddp_remove_comp_from_path().
>>> Those functions will allow DRM driver and others to control the data
>>> path routing.
>>>
>>> Signed-off-by: Enric Balletbo i Serra 
>>> Reviewed-by: Matthias Brugger 
>>> Reviewed-by: CK Hu 
>>> Acked-by: CK Hu 
>>
>> This patch does not apply against v5.6-rc1.
>> Please rebase as this is a quite big patch and it won't be easy to do 
>> that by hand.
>
> I think this patch depends on [1] which has been acked by me and I have
> not picked it. The simple way is that you pick [1] first and then pick
> this series.
>
> [1]
> https://patchwork.kernel.org/patch/11406227/
>

 You would need to provide a stable tag for me that I can merge into my 
 tree. You
 can also try to merge my for-next [1] which has the newest version from 
 Enric.
 If you see any merge conflict, then we have to do something about it :)

 Regards,
 Matthias

 [1]
 https://git.kernel.org/pub/scm/linux/kernel/git/matthias.bgg/linux.git/log/?h=for-next

>>>
>>> You have applied this series, so I would not apply other patches which
>>> would conflict with this series. After this series land on main stream
>>> (wish it happen in this merge window), I would rebase other patch on
>>> main stream.
>>>
>>
>> I haven't (yet) send the pull request. If you want to bring in your patches 
>> in
>> v5.7 as well we can find a solution to that. Shall I provide you with a 
>> stable
>> branch which you can merge? This way you can add all your patches in the pull
>> request as well and we don't have to wait for v5.8 to get things into 
>> mainline.
>>
>> Let me know and I'll provide you with a stable branch.
> 
> This series is in linux-next but does not in main stream. So would you
> please provide a stable branch so I could pull this series?
> 

Please find the pull request below:

The following changes since commit 8f3d9f354286745c751374f5f1fcafee6b3f3136:

  Linux 5.7-rc1 (2020-04-12 12:35:55 -0700)

are available in the Git repository at:


https://git.kernel.org/pub/scm/linux/kernel/git/matthias.bgg/linux.git/
tags/v5.7-next-drm-stable

for you to fetch changes up to 667c769246b01c53ad0925d603d2a2531abd3ef2:

  soc / drm: mediatek: Fix mediatek-drm device probing (2020-04-13
13:01:16 +0200)


Enric Balletbo i Serra (3):
  dt-bindings: mediatek: Update mmsys binding to reflect it is a
system controller
  soc / drm: mediatek: Move routing control to mmsys device
  soc / drm: mediatek: Fix mediatek-drm device probing

Matthias Brugger (2):
  drm/mediatek: Omit warning on probe defers
  clk / soc: mediatek: Move mt8173 MMSYS to platform driver

 Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.txt |   7 +--
 drivers/clk/mediatek/Kconfig  |   7 +++
 drivers/clk/mediatek/Makefile |   1 +
 drivers/clk/mediatek/clk-mt8173-mm.c  | 146
+++
 drivers/clk/mediatek/clk-mt8173.c | 104
--
 drivers/gpu/drm/mediatek/Kconfig  |   1 +
 drivers/gpu/drm/mediatek/mtk_disp_color.c |   5 ++-
 drivers/gpu/drm/mediatek/mtk_disp_ovl.c   |   5 ++-
 drivers/gpu/drm/mediatek/mtk_disp_rdma.c  |   5 ++-
 drivers/gpu/drm/mediatek/mtk_dpi.c|  12
+++--
 drivers/gpu/drm/mediatek/mtk_drm_crtc.c   |  19

 drivers/gpu/drm/mediatek/mtk_drm_ddp.c| 259
+
 drivers/gpu/drm/mediatek/mtk_drm_ddp.h|   7 ---
 drivers/gpu/drm/mediatek/mtk_drm_drv.c|  45
++-
 drivers/gpu/drm/mediatek/mtk_drm_drv.h|   2 +-
 drivers/gpu/drm/mediatek/mtk_dsi.c|   8
+++-
 drivers/gpu/drm/mediatek/mtk_hdmi.c   |   4 +-
 drivers/soc/mediatek/Kconfig  |   8

 drivers/soc/medi

Re: [PATCH v12 4/5] soc / drm: mediatek: Move routing control to mmsys device

2020-04-21 Thread Chun-Kuang Hu
Hi, Matthias:

Matthias Brugger  於 2020年4月21日 週二 下午5:31寫道:
>
>
>
> On 4/16/20 6:22 PM, Chun-Kuang Hu wrote:
> > Hi, Matthias:
> >
> > Matthias Brugger  於 2020年3月26日 週四 下午11:45寫道:
> >>
> >>
> >>
> >> On 26/03/2020 15:51, CK Hu wrote:
> >>> Hi, Matthias:
> >>>
> >>> On Thu, 2020-03-26 at 12:54 +0100, Matthias Brugger wrote:
>  Hi CK,
> 
>  On 26/03/2020 00:05, CK Hu wrote:
> > Hi, Matthias:
> >
> > On Wed, 2020-03-25 at 17:16 +0100, Matthias Brugger wrote:
> >>
> >> On 11/03/2020 17:53, Enric Balletbo i Serra wrote:
> >>> Provide a mtk_mmsys_ddp_connect() and mtk_mmsys_disconnect() 
> >>> functions to
> >>> replace mtk_ddp_add_comp_to_path() and 
> >>> mtk_ddp_remove_comp_from_path().
> >>> Those functions will allow DRM driver and others to control the data
> >>> path routing.
> >>>
> >>> Signed-off-by: Enric Balletbo i Serra 
> >>> Reviewed-by: Matthias Brugger 
> >>> Reviewed-by: CK Hu 
> >>> Acked-by: CK Hu 
> >>
> >> This patch does not apply against v5.6-rc1.
> >> Please rebase as this is a quite big patch and it won't be easy to do 
> >> that by hand.
> >
> > I think this patch depends on [1] which has been acked by me and I have
> > not picked it. The simple way is that you pick [1] first and then pick
> > this series.
> >
> > [1]
> > https://patchwork.kernel.org/patch/11406227/
> >
> 
>  You would need to provide a stable tag for me that I can merge into my 
>  tree. You
>  can also try to merge my for-next [1] which has the newest version from 
>  Enric.
>  If you see any merge conflict, then we have to do something about it :)
> 
>  Regards,
>  Matthias
> 
>  [1]
>  https://git.kernel.org/pub/scm/linux/kernel/git/matthias.bgg/linux.git/log/?h=for-next
> 
> >>>
> >>> You have applied this series, so I would not apply other patches which
> >>> would conflict with this series. After this series land on main stream
> >>> (wish it happen in this merge window), I would rebase other patch on
> >>> main stream.
> >>>
> >>
> >> I haven't (yet) send the pull request. If you want to bring in your 
> >> patches in
> >> v5.7 as well we can find a solution to that. Shall I provide you with a 
> >> stable
> >> branch which you can merge? This way you can add all your patches in the 
> >> pull
> >> request as well and we don't have to wait for v5.8 to get things into 
> >> mainline.
> >>
> >> Let me know and I'll provide you with a stable branch.
> >
> > This series is in linux-next but does not in main stream. So would you
> > please provide a stable branch so I could pull this series?
> >
>
> Please find the pull request below:
>
> The following changes since commit 8f3d9f354286745c751374f5f1fcafee6b3f3136:
>
>   Linux 5.7-rc1 (2020-04-12 12:35:55 -0700)
>
> are available in the Git repository at:
>
>
> https://git.kernel.org/pub/scm/linux/kernel/git/matthias.bgg/linux.git/
> tags/v5.7-next-drm-stable
>
> for you to fetch changes up to 667c769246b01c53ad0925d603d2a2531abd3ef2:
>
>   soc / drm: mediatek: Fix mediatek-drm device probing (2020-04-13
> 13:01:16 +0200)
>
> 
> Enric Balletbo i Serra (3):
>   dt-bindings: mediatek: Update mmsys binding to reflect it is a
> system controller
>   soc / drm: mediatek: Move routing control to mmsys device
>   soc / drm: mediatek: Fix mediatek-drm device probing
>
> Matthias Brugger (2):
>   drm/mediatek: Omit warning on probe defers
>   clk / soc: mediatek: Move mt8173 MMSYS to platform driver
>
>  Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.txt |   7 +--
>  drivers/clk/mediatek/Kconfig  |   7 +++
>  drivers/clk/mediatek/Makefile |   1 +
>  drivers/clk/mediatek/clk-mt8173-mm.c  | 146
> +++
>  drivers/clk/mediatek/clk-mt8173.c | 104
> --
>  drivers/gpu/drm/mediatek/Kconfig  |   1 +
>  drivers/gpu/drm/mediatek/mtk_disp_color.c |   5 ++-
>  drivers/gpu/drm/mediatek/mtk_disp_ovl.c   |   5 ++-
>  drivers/gpu/drm/mediatek/mtk_disp_rdma.c  |   5 ++-
>  drivers/gpu/drm/mediatek/mtk_dpi.c|  12
> +++--
>  drivers/gpu/drm/mediatek/mtk_drm_crtc.c   |  19
> 
>  drivers/gpu/drm/mediatek/mtk_drm_ddp.c| 259
> +
>  drivers/gpu/drm/mediatek/mtk_drm_ddp.h|   7 ---
>  drivers/gpu/drm/mediatek/mtk_drm_drv.c|  45
> ++-
>  drivers/gp

Re: [PATCH v12 4/5] soc / drm: mediatek: Move routing control to mmsys device

2020-04-16 Thread Chun-Kuang Hu
Hi, Matthias:

Matthias Brugger  於 2020年3月26日 週四 下午11:45寫道:
>
>
>
> On 26/03/2020 15:51, CK Hu wrote:
> > Hi, Matthias:
> >
> > On Thu, 2020-03-26 at 12:54 +0100, Matthias Brugger wrote:
> >> Hi CK,
> >>
> >> On 26/03/2020 00:05, CK Hu wrote:
> >>> Hi, Matthias:
> >>>
> >>> On Wed, 2020-03-25 at 17:16 +0100, Matthias Brugger wrote:
> 
>  On 11/03/2020 17:53, Enric Balletbo i Serra wrote:
> > Provide a mtk_mmsys_ddp_connect() and mtk_mmsys_disconnect() functions 
> > to
> > replace mtk_ddp_add_comp_to_path() and mtk_ddp_remove_comp_from_path().
> > Those functions will allow DRM driver and others to control the data
> > path routing.
> >
> > Signed-off-by: Enric Balletbo i Serra 
> > Reviewed-by: Matthias Brugger 
> > Reviewed-by: CK Hu 
> > Acked-by: CK Hu 
> 
>  This patch does not apply against v5.6-rc1.
>  Please rebase as this is a quite big patch and it won't be easy to do 
>  that by hand.
> >>>
> >>> I think this patch depends on [1] which has been acked by me and I have
> >>> not picked it. The simple way is that you pick [1] first and then pick
> >>> this series.
> >>>
> >>> [1]
> >>> https://patchwork.kernel.org/patch/11406227/
> >>>
> >>
> >> You would need to provide a stable tag for me that I can merge into my 
> >> tree. You
> >> can also try to merge my for-next [1] which has the newest version from 
> >> Enric.
> >> If you see any merge conflict, then we have to do something about it :)
> >>
> >> Regards,
> >> Matthias
> >>
> >> [1]
> >> https://git.kernel.org/pub/scm/linux/kernel/git/matthias.bgg/linux.git/log/?h=for-next
> >>
> >
> > You have applied this series, so I would not apply other patches which
> > would conflict with this series. After this series land on main stream
> > (wish it happen in this merge window), I would rebase other patch on
> > main stream.
> >
>
> I haven't (yet) send the pull request. If you want to bring in your patches in
> v5.7 as well we can find a solution to that. Shall I provide you with a stable
> branch which you can merge? This way you can add all your patches in the pull
> request as well and we don't have to wait for v5.8 to get things into 
> mainline.
>
> Let me know and I'll provide you with a stable branch.

This series is in linux-next but does not in main stream. So would you
please provide a stable branch so I could pull this series?

Regards,
Chun-Kuang.

>
> Regards,
> Matthias
>
> > Regards,
> > CK
> >
> >>> Regards,
> >>> CK
> >>>
> 
>  Regards,
>  Matthias
> 
> > ---
> >
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v12 4/5] soc / drm: mediatek: Move routing control to mmsys device

2020-03-27 Thread Matthias Brugger
Hi CK,

On 26/03/2020 00:05, CK Hu wrote:
> Hi, Matthias:
> 
> On Wed, 2020-03-25 at 17:16 +0100, Matthias Brugger wrote:
>>
>> On 11/03/2020 17:53, Enric Balletbo i Serra wrote:
>>> Provide a mtk_mmsys_ddp_connect() and mtk_mmsys_disconnect() functions to
>>> replace mtk_ddp_add_comp_to_path() and mtk_ddp_remove_comp_from_path().
>>> Those functions will allow DRM driver and others to control the data
>>> path routing.
>>>
>>> Signed-off-by: Enric Balletbo i Serra 
>>> Reviewed-by: Matthias Brugger 
>>> Reviewed-by: CK Hu 
>>> Acked-by: CK Hu 
>>
>> This patch does not apply against v5.6-rc1.
>> Please rebase as this is a quite big patch and it won't be easy to do that 
>> by hand.
> 
> I think this patch depends on [1] which has been acked by me and I have
> not picked it. The simple way is that you pick [1] first and then pick
> this series.
> 
> [1] 
> https://patchwork.kernel.org/patch/11406227/

In the end Enric rebased his branch on top of v5.6-rc1 so I won't take this
patch into branch. So feel free to take it through yours.

Regards,
Matthias

> 
> Regards,
> CK
> 
>>
>> Regards,
>> Matthias
>>
>>> ---
>>>
>>> Changes in v12: None
>>> Changes in v10:
>>> - Select CONFIG_MTK_MMSYS (CK)
>>> - Pass device pointer of mmsys device instead of config regs (CK)
>>>
>>> Changes in v9:
>>> - Introduced a new patch to move routing control into mmsys driver.
>>> - Removed the patch to use regmap as is not needed anymore.
>>>
>>> Changes in v8: None
>>> Changes in v7: None
>>>
>>>  drivers/gpu/drm/mediatek/Kconfig|   1 +
>>>  drivers/gpu/drm/mediatek/mtk_drm_crtc.c |  19 +-
>>>  drivers/gpu/drm/mediatek/mtk_drm_ddp.c  | 256 --
>>>  drivers/gpu/drm/mediatek/mtk_drm_ddp.h  |   7 -
>>>  drivers/gpu/drm/mediatek/mtk_drm_drv.c  |  14 +-
>>>  drivers/gpu/drm/mediatek/mtk_drm_drv.h  |   2 +-
>>>  drivers/soc/mediatek/mtk-mmsys.c| 279 
>>>  include/linux/soc/mediatek/mtk-mmsys.h  |  20 ++
>>>  8 files changed, 316 insertions(+), 282 deletions(-)
>>>  create mode 100644 include/linux/soc/mediatek/mtk-mmsys.h
>>>
>>> diff --git a/drivers/gpu/drm/mediatek/Kconfig 
>>> b/drivers/gpu/drm/mediatek/Kconfig
>>> index fa5ffc4fe823..c420f5a3d33b 100644
>>> --- a/drivers/gpu/drm/mediatek/Kconfig
>>> +++ b/drivers/gpu/drm/mediatek/Kconfig
>>> @@ -11,6 +11,7 @@ config DRM_MEDIATEK
>>> select DRM_MIPI_DSI
>>> select DRM_PANEL
>>> select MEMORY
>>> +   select MTK_MMSYS
>>> select MTK_SMI
>>> select VIDEOMODE_HELPERS
>>> help
>>> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c 
>>> b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
>>> index 0e05683d7b53..579a5a5d4472 100644
>>> --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
>>> +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
>>> @@ -6,6 +6,7 @@
>>>  #include 
>>>  #include 
>>>  #include 
>>> +#include 
>>>  
>>>  #include 
>>>  #include 
>>> @@ -28,7 +29,7 @@
>>>   * @enabled: records whether crtc_enable succeeded
>>>   * @planes: array of 4 drm_plane structures, one for each overlay plane
>>>   * @pending_planes: whether any plane has pending changes to be applied
>>> - * @config_regs: memory mapped mmsys configuration register space
>>> + * @mmsys_dev: pointer to the mmsys device for configuration registers
>>>   * @mutex: handle to one of the ten disp_mutex streams
>>>   * @ddp_comp_nr: number of components in ddp_comp
>>>   * @ddp_comp: array of pointers the mtk_ddp_comp structures used by this 
>>> crtc
>>> @@ -50,7 +51,7 @@ struct mtk_drm_crtc {
>>> u32 cmdq_event;
>>>  #endif
>>>  
>>> -   void __iomem*config_regs;
>>> +   struct device   *mmsys_dev;
>>> struct mtk_disp_mutex   *mutex;
>>> unsigned intddp_comp_nr;
>>> struct mtk_ddp_comp **ddp_comp;
>>> @@ -296,9 +297,9 @@ static int mtk_crtc_ddp_hw_init(struct mtk_drm_crtc 
>>> *mtk_crtc)
>>> }
>>>  
>>> for (i = 0; i < mtk_crtc->ddp_comp_nr - 1; i++) {
>>> -   mtk_ddp_add_comp_to_path(mtk_crtc->config_regs,
>>> -mtk_crtc->ddp_comp[i]->id,
>>> -mtk_crtc->ddp_comp[i + 1]->id);
>>> +   mtk_mmsys_ddp_connect(mtk_crtc->mmsys_dev,
>>> + mtk_crtc->ddp_comp[i]->id,
>>> + mtk_crtc->ddp_comp[i + 1]->id);
>>> mtk_disp_mutex_add_comp(mtk_crtc->mutex,
>>> mtk_crtc->ddp_comp[i]->id);
>>> }
>>> @@ -355,9 +356,9 @@ static void mtk_crtc_ddp_hw_fini(struct mtk_drm_crtc 
>>> *mtk_crtc)
>>>mtk_crtc->ddp_comp[i]->id);
>>> mtk_disp_mutex_disable(mtk_crtc->mutex);
>>> for (i = 0; i < mtk_crtc->ddp_comp_nr - 1; i++) {
>>> -   mtk_ddp_remove_comp_from_path(mtk_crtc->config_regs,
>>> - mtk_crtc->ddp_comp[i]->id,
>>> -

Re: [PATCH v12 4/5] soc / drm: mediatek: Move routing control to mmsys device

2020-03-26 Thread CK Hu
Hi, Matthias:

On Thu, 2020-03-26 at 16:45 +0100, Matthias Brugger wrote:
> 
> On 26/03/2020 15:51, CK Hu wrote:
> > Hi, Matthias:
> > 
> > On Thu, 2020-03-26 at 12:54 +0100, Matthias Brugger wrote:
> >> Hi CK,
> >>
> >> On 26/03/2020 00:05, CK Hu wrote:
> >>> Hi, Matthias:
> >>>
> >>> On Wed, 2020-03-25 at 17:16 +0100, Matthias Brugger wrote:
> 
>  On 11/03/2020 17:53, Enric Balletbo i Serra wrote:
> > Provide a mtk_mmsys_ddp_connect() and mtk_mmsys_disconnect() functions 
> > to
> > replace mtk_ddp_add_comp_to_path() and mtk_ddp_remove_comp_from_path().
> > Those functions will allow DRM driver and others to control the data
> > path routing.
> >
> > Signed-off-by: Enric Balletbo i Serra 
> > Reviewed-by: Matthias Brugger 
> > Reviewed-by: CK Hu 
> > Acked-by: CK Hu 
> 
>  This patch does not apply against v5.6-rc1.
>  Please rebase as this is a quite big patch and it won't be easy to do 
>  that by hand.
> >>>
> >>> I think this patch depends on [1] which has been acked by me and I have
> >>> not picked it. The simple way is that you pick [1] first and then pick
> >>> this series.
> >>>
> >>> [1] 
> >>> https://patchwork.kernel.org/patch/11406227/
> >>>
> >>
> >> You would need to provide a stable tag for me that I can merge into my 
> >> tree. You
> >> can also try to merge my for-next [1] which has the newest version from 
> >> Enric.
> >> If you see any merge conflict, then we have to do something about it :)
> >>
> >> Regards,
> >> Matthias
> >>
> >> [1]
> >> https://git.kernel.org/pub/scm/linux/kernel/git/matthias.bgg/linux.git/log/?h=for-next
> >>
> > 
> > You have applied this series, so I would not apply other patches which
> > would conflict with this series. After this series land on main stream
> > (wish it happen in this merge window), I would rebase other patch on
> > main stream.
> > 
> 
> I haven't (yet) send the pull request. If you want to bring in your patches in
> v5.7 as well we can find a solution to that. Shall I provide you with a stable
> branch which you can merge? This way you can add all your patches in the pull
> request as well and we don't have to wait for v5.8 to get things into 
> mainline.
> 
> Let me know and I'll provide you with a stable branch.
> 

Other drm patches is not in a hurry, for now I don't need a stable
branch. If I need one, I would tell you, thanks.

Regards,
CK

> Regards,
> Matthias
> 
> > Regards,
> > CK
> > 
> >>> Regards,
> >>> CK
> >>>
> 
>  Regards,
>  Matthias
> 
> > ---
> >
> > Changes in v12: None
> > Changes in v10:
> > - Select CONFIG_MTK_MMSYS (CK)
> > - Pass device pointer of mmsys device instead of config regs (CK)
> >
> > Changes in v9:
> > - Introduced a new patch to move routing control into mmsys driver.
> > - Removed the patch to use regmap as is not needed anymore.
> >
> > Changes in v8: None
> > Changes in v7: None
> >
> >  drivers/gpu/drm/mediatek/Kconfig|   1 +
> >  drivers/gpu/drm/mediatek/mtk_drm_crtc.c |  19 +-
> >  drivers/gpu/drm/mediatek/mtk_drm_ddp.c  | 256 --
> >  drivers/gpu/drm/mediatek/mtk_drm_ddp.h  |   7 -
> >  drivers/gpu/drm/mediatek/mtk_drm_drv.c  |  14 +-
> >  drivers/gpu/drm/mediatek/mtk_drm_drv.h  |   2 +-
> >  drivers/soc/mediatek/mtk-mmsys.c| 279 
> >  include/linux/soc/mediatek/mtk-mmsys.h  |  20 ++
> >  8 files changed, 316 insertions(+), 282 deletions(-)
> >  create mode 100644 include/linux/soc/mediatek/mtk-mmsys.h
> >
> > diff --git a/drivers/gpu/drm/mediatek/Kconfig 
> > b/drivers/gpu/drm/mediatek/Kconfig
> > index fa5ffc4fe823..c420f5a3d33b 100644
> > --- a/drivers/gpu/drm/mediatek/Kconfig
> > +++ b/drivers/gpu/drm/mediatek/Kconfig
> > @@ -11,6 +11,7 @@ config DRM_MEDIATEK
> > select DRM_MIPI_DSI
> > select DRM_PANEL
> > select MEMORY
> > +   select MTK_MMSYS
> > select MTK_SMI
> > select VIDEOMODE_HELPERS
> > help
> > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c 
> > b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> > index 0e05683d7b53..579a5a5d4472 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> > @@ -6,6 +6,7 @@
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> >  
> >  #include 
> >  #include 
> > @@ -28,7 +29,7 @@
> >   * @enabled: records whether crtc_enable succeeded
> >   * @planes: array of 4 drm_plane structures, one for each overlay plane
> >   * @pending_planes: whether any plane has pending changes to be applied
> > - * @config_regs: memory mapped mmsys configuration register space
> > + * @mmsys_dev: pointer to the mmsys device for configuration registers
> >   * @mutex: handle to one of the ten dis

Re: [PATCH v12 4/5] soc / drm: mediatek: Move routing control to mmsys device

2020-03-26 Thread Matthias Brugger



On 26/03/2020 15:51, CK Hu wrote:
> Hi, Matthias:
> 
> On Thu, 2020-03-26 at 12:54 +0100, Matthias Brugger wrote:
>> Hi CK,
>>
>> On 26/03/2020 00:05, CK Hu wrote:
>>> Hi, Matthias:
>>>
>>> On Wed, 2020-03-25 at 17:16 +0100, Matthias Brugger wrote:

 On 11/03/2020 17:53, Enric Balletbo i Serra wrote:
> Provide a mtk_mmsys_ddp_connect() and mtk_mmsys_disconnect() functions to
> replace mtk_ddp_add_comp_to_path() and mtk_ddp_remove_comp_from_path().
> Those functions will allow DRM driver and others to control the data
> path routing.
>
> Signed-off-by: Enric Balletbo i Serra 
> Reviewed-by: Matthias Brugger 
> Reviewed-by: CK Hu 
> Acked-by: CK Hu 

 This patch does not apply against v5.6-rc1.
 Please rebase as this is a quite big patch and it won't be easy to do that 
 by hand.
>>>
>>> I think this patch depends on [1] which has been acked by me and I have
>>> not picked it. The simple way is that you pick [1] first and then pick
>>> this series.
>>>
>>> [1] 
>>> https://patchwork.kernel.org/patch/11406227/
>>>
>>
>> You would need to provide a stable tag for me that I can merge into my tree. 
>> You
>> can also try to merge my for-next [1] which has the newest version from 
>> Enric.
>> If you see any merge conflict, then we have to do something about it :)
>>
>> Regards,
>> Matthias
>>
>> [1]
>> https://git.kernel.org/pub/scm/linux/kernel/git/matthias.bgg/linux.git/log/?h=for-next
>>
> 
> You have applied this series, so I would not apply other patches which
> would conflict with this series. After this series land on main stream
> (wish it happen in this merge window), I would rebase other patch on
> main stream.
> 

I haven't (yet) send the pull request. If you want to bring in your patches in
v5.7 as well we can find a solution to that. Shall I provide you with a stable
branch which you can merge? This way you can add all your patches in the pull
request as well and we don't have to wait for v5.8 to get things into mainline.

Let me know and I'll provide you with a stable branch.

Regards,
Matthias

> Regards,
> CK
> 
>>> Regards,
>>> CK
>>>

 Regards,
 Matthias

> ---
>
> Changes in v12: None
> Changes in v10:
> - Select CONFIG_MTK_MMSYS (CK)
> - Pass device pointer of mmsys device instead of config regs (CK)
>
> Changes in v9:
> - Introduced a new patch to move routing control into mmsys driver.
> - Removed the patch to use regmap as is not needed anymore.
>
> Changes in v8: None
> Changes in v7: None
>
>  drivers/gpu/drm/mediatek/Kconfig|   1 +
>  drivers/gpu/drm/mediatek/mtk_drm_crtc.c |  19 +-
>  drivers/gpu/drm/mediatek/mtk_drm_ddp.c  | 256 --
>  drivers/gpu/drm/mediatek/mtk_drm_ddp.h  |   7 -
>  drivers/gpu/drm/mediatek/mtk_drm_drv.c  |  14 +-
>  drivers/gpu/drm/mediatek/mtk_drm_drv.h  |   2 +-
>  drivers/soc/mediatek/mtk-mmsys.c| 279 
>  include/linux/soc/mediatek/mtk-mmsys.h  |  20 ++
>  8 files changed, 316 insertions(+), 282 deletions(-)
>  create mode 100644 include/linux/soc/mediatek/mtk-mmsys.h
>
> diff --git a/drivers/gpu/drm/mediatek/Kconfig 
> b/drivers/gpu/drm/mediatek/Kconfig
> index fa5ffc4fe823..c420f5a3d33b 100644
> --- a/drivers/gpu/drm/mediatek/Kconfig
> +++ b/drivers/gpu/drm/mediatek/Kconfig
> @@ -11,6 +11,7 @@ config DRM_MEDIATEK
>   select DRM_MIPI_DSI
>   select DRM_PANEL
>   select MEMORY
> + select MTK_MMSYS
>   select MTK_SMI
>   select VIDEOMODE_HELPERS
>   help
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c 
> b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> index 0e05683d7b53..579a5a5d4472 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> @@ -6,6 +6,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  #include 
>  #include 
> @@ -28,7 +29,7 @@
>   * @enabled: records whether crtc_enable succeeded
>   * @planes: array of 4 drm_plane structures, one for each overlay plane
>   * @pending_planes: whether any plane has pending changes to be applied
> - * @config_regs: memory mapped mmsys configuration register space
> + * @mmsys_dev: pointer to the mmsys device for configuration registers
>   * @mutex: handle to one of the ten disp_mutex streams
>   * @ddp_comp_nr: number of components in ddp_comp
>   * @ddp_comp: array of pointers the mtk_ddp_comp structures used by this 
> crtc
> @@ -50,7 +51,7 @@ struct mtk_drm_crtc {
>   u32 cmdq_event;
>  #endif
>  
> - void __iomem*config_regs;
> + struct device   *mmsys_dev;
>   struct mtk_disp_mutex   *mutex;
>   unsigned intddp_comp_nr;
>   struct mtk_ddp_comp  

Re: [PATCH v12 4/5] soc / drm: mediatek: Move routing control to mmsys device

2020-03-26 Thread Matthias Brugger
Hi CK,

On 26/03/2020 00:05, CK Hu wrote:
> Hi, Matthias:
> 
> On Wed, 2020-03-25 at 17:16 +0100, Matthias Brugger wrote:
>>
>> On 11/03/2020 17:53, Enric Balletbo i Serra wrote:
>>> Provide a mtk_mmsys_ddp_connect() and mtk_mmsys_disconnect() functions to
>>> replace mtk_ddp_add_comp_to_path() and mtk_ddp_remove_comp_from_path().
>>> Those functions will allow DRM driver and others to control the data
>>> path routing.
>>>
>>> Signed-off-by: Enric Balletbo i Serra 
>>> Reviewed-by: Matthias Brugger 
>>> Reviewed-by: CK Hu 
>>> Acked-by: CK Hu 
>>
>> This patch does not apply against v5.6-rc1.
>> Please rebase as this is a quite big patch and it won't be easy to do that 
>> by hand.
> 
> I think this patch depends on [1] which has been acked by me and I have
> not picked it. The simple way is that you pick [1] first and then pick
> this series.
> 
> [1] 
> https://patchwork.kernel.org/patch/11406227/
> 

You would need to provide a stable tag for me that I can merge into my tree. You
can also try to merge my for-next [1] which has the newest version from Enric.
If you see any merge conflict, then we have to do something about it :)

Regards,
Matthias

[1]
https://git.kernel.org/pub/scm/linux/kernel/git/matthias.bgg/linux.git/log/?h=for-next

> Regards,
> CK
> 
>>
>> Regards,
>> Matthias
>>
>>> ---
>>>
>>> Changes in v12: None
>>> Changes in v10:
>>> - Select CONFIG_MTK_MMSYS (CK)
>>> - Pass device pointer of mmsys device instead of config regs (CK)
>>>
>>> Changes in v9:
>>> - Introduced a new patch to move routing control into mmsys driver.
>>> - Removed the patch to use regmap as is not needed anymore.
>>>
>>> Changes in v8: None
>>> Changes in v7: None
>>>
>>>  drivers/gpu/drm/mediatek/Kconfig|   1 +
>>>  drivers/gpu/drm/mediatek/mtk_drm_crtc.c |  19 +-
>>>  drivers/gpu/drm/mediatek/mtk_drm_ddp.c  | 256 --
>>>  drivers/gpu/drm/mediatek/mtk_drm_ddp.h  |   7 -
>>>  drivers/gpu/drm/mediatek/mtk_drm_drv.c  |  14 +-
>>>  drivers/gpu/drm/mediatek/mtk_drm_drv.h  |   2 +-
>>>  drivers/soc/mediatek/mtk-mmsys.c| 279 
>>>  include/linux/soc/mediatek/mtk-mmsys.h  |  20 ++
>>>  8 files changed, 316 insertions(+), 282 deletions(-)
>>>  create mode 100644 include/linux/soc/mediatek/mtk-mmsys.h
>>>
>>> diff --git a/drivers/gpu/drm/mediatek/Kconfig 
>>> b/drivers/gpu/drm/mediatek/Kconfig
>>> index fa5ffc4fe823..c420f5a3d33b 100644
>>> --- a/drivers/gpu/drm/mediatek/Kconfig
>>> +++ b/drivers/gpu/drm/mediatek/Kconfig
>>> @@ -11,6 +11,7 @@ config DRM_MEDIATEK
>>> select DRM_MIPI_DSI
>>> select DRM_PANEL
>>> select MEMORY
>>> +   select MTK_MMSYS
>>> select MTK_SMI
>>> select VIDEOMODE_HELPERS
>>> help
>>> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c 
>>> b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
>>> index 0e05683d7b53..579a5a5d4472 100644
>>> --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
>>> +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
>>> @@ -6,6 +6,7 @@
>>>  #include 
>>>  #include 
>>>  #include 
>>> +#include 
>>>  
>>>  #include 
>>>  #include 
>>> @@ -28,7 +29,7 @@
>>>   * @enabled: records whether crtc_enable succeeded
>>>   * @planes: array of 4 drm_plane structures, one for each overlay plane
>>>   * @pending_planes: whether any plane has pending changes to be applied
>>> - * @config_regs: memory mapped mmsys configuration register space
>>> + * @mmsys_dev: pointer to the mmsys device for configuration registers
>>>   * @mutex: handle to one of the ten disp_mutex streams
>>>   * @ddp_comp_nr: number of components in ddp_comp
>>>   * @ddp_comp: array of pointers the mtk_ddp_comp structures used by this 
>>> crtc
>>> @@ -50,7 +51,7 @@ struct mtk_drm_crtc {
>>> u32 cmdq_event;
>>>  #endif
>>>  
>>> -   void __iomem*config_regs;
>>> +   struct device   *mmsys_dev;
>>> struct mtk_disp_mutex   *mutex;
>>> unsigned intddp_comp_nr;
>>> struct mtk_ddp_comp **ddp_comp;
>>> @@ -296,9 +297,9 @@ static int mtk_crtc_ddp_hw_init(struct mtk_drm_crtc 
>>> *mtk_crtc)
>>> }
>>>  
>>> for (i = 0; i < mtk_crtc->ddp_comp_nr - 1; i++) {
>>> -   mtk_ddp_add_comp_to_path(mtk_crtc->config_regs,
>>> -mtk_crtc->ddp_comp[i]->id,
>>> -mtk_crtc->ddp_comp[i + 1]->id);
>>> +   mtk_mmsys_ddp_connect(mtk_crtc->mmsys_dev,
>>> + mtk_crtc->ddp_comp[i]->id,
>>> + mtk_crtc->ddp_comp[i + 1]->id);
>>> mtk_disp_mutex_add_comp(mtk_crtc->mutex,
>>> mtk_crtc->ddp_comp[i]->id);
>>> }
>>> @@ -355,9 +356,9 @@ static void mtk_crtc_ddp_hw_fini(struct mtk_drm_crtc 
>>> *mtk_crtc)
>>>mtk_crtc->ddp_comp[i]->id);
>>> mtk_disp_mutex_disable(mtk_crtc->mutex);
>>> for (i = 0; i < mtk_crtc->ddp_comp_nr - 1; 

Re: [PATCH v12 4/5] soc / drm: mediatek: Move routing control to mmsys device

2020-03-26 Thread CK Hu
Hi, Matthias:

On Thu, 2020-03-26 at 12:54 +0100, Matthias Brugger wrote:
> Hi CK,
> 
> On 26/03/2020 00:05, CK Hu wrote:
> > Hi, Matthias:
> > 
> > On Wed, 2020-03-25 at 17:16 +0100, Matthias Brugger wrote:
> >>
> >> On 11/03/2020 17:53, Enric Balletbo i Serra wrote:
> >>> Provide a mtk_mmsys_ddp_connect() and mtk_mmsys_disconnect() functions to
> >>> replace mtk_ddp_add_comp_to_path() and mtk_ddp_remove_comp_from_path().
> >>> Those functions will allow DRM driver and others to control the data
> >>> path routing.
> >>>
> >>> Signed-off-by: Enric Balletbo i Serra 
> >>> Reviewed-by: Matthias Brugger 
> >>> Reviewed-by: CK Hu 
> >>> Acked-by: CK Hu 
> >>
> >> This patch does not apply against v5.6-rc1.
> >> Please rebase as this is a quite big patch and it won't be easy to do that 
> >> by hand.
> > 
> > I think this patch depends on [1] which has been acked by me and I have
> > not picked it. The simple way is that you pick [1] first and then pick
> > this series.
> > 
> > [1] 
> > https://patchwork.kernel.org/patch/11406227/
> > 
> 
> You would need to provide a stable tag for me that I can merge into my tree. 
> You
> can also try to merge my for-next [1] which has the newest version from Enric.
> If you see any merge conflict, then we have to do something about it :)
> 
> Regards,
> Matthias
> 
> [1]
> https://git.kernel.org/pub/scm/linux/kernel/git/matthias.bgg/linux.git/log/?h=for-next
> 

You have applied this series, so I would not apply other patches which
would conflict with this series. After this series land on main stream
(wish it happen in this merge window), I would rebase other patch on
main stream.

Regards,
CK

> > Regards,
> > CK
> > 
> >>
> >> Regards,
> >> Matthias
> >>
> >>> ---
> >>>
> >>> Changes in v12: None
> >>> Changes in v10:
> >>> - Select CONFIG_MTK_MMSYS (CK)
> >>> - Pass device pointer of mmsys device instead of config regs (CK)
> >>>
> >>> Changes in v9:
> >>> - Introduced a new patch to move routing control into mmsys driver.
> >>> - Removed the patch to use regmap as is not needed anymore.
> >>>
> >>> Changes in v8: None
> >>> Changes in v7: None
> >>>
> >>>  drivers/gpu/drm/mediatek/Kconfig|   1 +
> >>>  drivers/gpu/drm/mediatek/mtk_drm_crtc.c |  19 +-
> >>>  drivers/gpu/drm/mediatek/mtk_drm_ddp.c  | 256 --
> >>>  drivers/gpu/drm/mediatek/mtk_drm_ddp.h  |   7 -
> >>>  drivers/gpu/drm/mediatek/mtk_drm_drv.c  |  14 +-
> >>>  drivers/gpu/drm/mediatek/mtk_drm_drv.h  |   2 +-
> >>>  drivers/soc/mediatek/mtk-mmsys.c| 279 
> >>>  include/linux/soc/mediatek/mtk-mmsys.h  |  20 ++
> >>>  8 files changed, 316 insertions(+), 282 deletions(-)
> >>>  create mode 100644 include/linux/soc/mediatek/mtk-mmsys.h
> >>>
> >>> diff --git a/drivers/gpu/drm/mediatek/Kconfig 
> >>> b/drivers/gpu/drm/mediatek/Kconfig
> >>> index fa5ffc4fe823..c420f5a3d33b 100644
> >>> --- a/drivers/gpu/drm/mediatek/Kconfig
> >>> +++ b/drivers/gpu/drm/mediatek/Kconfig
> >>> @@ -11,6 +11,7 @@ config DRM_MEDIATEK
> >>>   select DRM_MIPI_DSI
> >>>   select DRM_PANEL
> >>>   select MEMORY
> >>> + select MTK_MMSYS
> >>>   select MTK_SMI
> >>>   select VIDEOMODE_HELPERS
> >>>   help
> >>> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c 
> >>> b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> >>> index 0e05683d7b53..579a5a5d4472 100644
> >>> --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> >>> +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> >>> @@ -6,6 +6,7 @@
> >>>  #include 
> >>>  #include 
> >>>  #include 
> >>> +#include 
> >>>  
> >>>  #include 
> >>>  #include 
> >>> @@ -28,7 +29,7 @@
> >>>   * @enabled: records whether crtc_enable succeeded
> >>>   * @planes: array of 4 drm_plane structures, one for each overlay plane
> >>>   * @pending_planes: whether any plane has pending changes to be applied
> >>> - * @config_regs: memory mapped mmsys configuration register space
> >>> + * @mmsys_dev: pointer to the mmsys device for configuration registers
> >>>   * @mutex: handle to one of the ten disp_mutex streams
> >>>   * @ddp_comp_nr: number of components in ddp_comp
> >>>   * @ddp_comp: array of pointers the mtk_ddp_comp structures used by this 
> >>> crtc
> >>> @@ -50,7 +51,7 @@ struct mtk_drm_crtc {
> >>>   u32 cmdq_event;
> >>>  #endif
> >>>  
> >>> - void __iomem*config_regs;
> >>> + struct device   *mmsys_dev;
> >>>   struct mtk_disp_mutex   *mutex;
> >>>   unsigned intddp_comp_nr;
> >>>   struct mtk_ddp_comp **ddp_comp;
> >>> @@ -296,9 +297,9 @@ static int mtk_crtc_ddp_hw_init(struct mtk_drm_crtc 
> >>> *mtk_crtc)
> >>>   }
> >>>  
> >>>   for (i = 0; i < mtk_crtc->ddp_comp_nr - 1; i++) {
> >>> - mtk_ddp_add_comp_to_path(mtk_crtc->config_regs,
> >>> -  mtk_crtc->ddp_comp[i]->id,
> >>> -  mtk_crtc->ddp_comp[i + 1]->id);
> >>> + mtk_mmsys_ddp_connect(mtk_crtc->mmsys_dev,
> >>

Re: [PATCH v12 4/5] soc / drm: mediatek: Move routing control to mmsys device

2020-03-26 Thread Matthias Brugger



On 11/03/2020 17:53, Enric Balletbo i Serra wrote:
> Provide a mtk_mmsys_ddp_connect() and mtk_mmsys_disconnect() functions to
> replace mtk_ddp_add_comp_to_path() and mtk_ddp_remove_comp_from_path().
> Those functions will allow DRM driver and others to control the data
> path routing.
> 
> Signed-off-by: Enric Balletbo i Serra 
> Reviewed-by: Matthias Brugger 
> Reviewed-by: CK Hu 
> Acked-by: CK Hu 

This patch does not apply against v5.6-rc1.
Please rebase as this is a quite big patch and it won't be easy to do that by 
hand.

Regards,
Matthias

> ---
> 
> Changes in v12: None
> Changes in v10:
> - Select CONFIG_MTK_MMSYS (CK)
> - Pass device pointer of mmsys device instead of config regs (CK)
> 
> Changes in v9:
> - Introduced a new patch to move routing control into mmsys driver.
> - Removed the patch to use regmap as is not needed anymore.
> 
> Changes in v8: None
> Changes in v7: None
> 
>  drivers/gpu/drm/mediatek/Kconfig|   1 +
>  drivers/gpu/drm/mediatek/mtk_drm_crtc.c |  19 +-
>  drivers/gpu/drm/mediatek/mtk_drm_ddp.c  | 256 --
>  drivers/gpu/drm/mediatek/mtk_drm_ddp.h  |   7 -
>  drivers/gpu/drm/mediatek/mtk_drm_drv.c  |  14 +-
>  drivers/gpu/drm/mediatek/mtk_drm_drv.h  |   2 +-
>  drivers/soc/mediatek/mtk-mmsys.c| 279 
>  include/linux/soc/mediatek/mtk-mmsys.h  |  20 ++
>  8 files changed, 316 insertions(+), 282 deletions(-)
>  create mode 100644 include/linux/soc/mediatek/mtk-mmsys.h
> 
> diff --git a/drivers/gpu/drm/mediatek/Kconfig 
> b/drivers/gpu/drm/mediatek/Kconfig
> index fa5ffc4fe823..c420f5a3d33b 100644
> --- a/drivers/gpu/drm/mediatek/Kconfig
> +++ b/drivers/gpu/drm/mediatek/Kconfig
> @@ -11,6 +11,7 @@ config DRM_MEDIATEK
>   select DRM_MIPI_DSI
>   select DRM_PANEL
>   select MEMORY
> + select MTK_MMSYS
>   select MTK_SMI
>   select VIDEOMODE_HELPERS
>   help
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c 
> b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> index 0e05683d7b53..579a5a5d4472 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> @@ -6,6 +6,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  #include 
>  #include 
> @@ -28,7 +29,7 @@
>   * @enabled: records whether crtc_enable succeeded
>   * @planes: array of 4 drm_plane structures, one for each overlay plane
>   * @pending_planes: whether any plane has pending changes to be applied
> - * @config_regs: memory mapped mmsys configuration register space
> + * @mmsys_dev: pointer to the mmsys device for configuration registers
>   * @mutex: handle to one of the ten disp_mutex streams
>   * @ddp_comp_nr: number of components in ddp_comp
>   * @ddp_comp: array of pointers the mtk_ddp_comp structures used by this crtc
> @@ -50,7 +51,7 @@ struct mtk_drm_crtc {
>   u32 cmdq_event;
>  #endif
>  
> - void __iomem*config_regs;
> + struct device   *mmsys_dev;
>   struct mtk_disp_mutex   *mutex;
>   unsigned intddp_comp_nr;
>   struct mtk_ddp_comp **ddp_comp;
> @@ -296,9 +297,9 @@ static int mtk_crtc_ddp_hw_init(struct mtk_drm_crtc 
> *mtk_crtc)
>   }
>  
>   for (i = 0; i < mtk_crtc->ddp_comp_nr - 1; i++) {
> - mtk_ddp_add_comp_to_path(mtk_crtc->config_regs,
> -  mtk_crtc->ddp_comp[i]->id,
> -  mtk_crtc->ddp_comp[i + 1]->id);
> + mtk_mmsys_ddp_connect(mtk_crtc->mmsys_dev,
> +   mtk_crtc->ddp_comp[i]->id,
> +   mtk_crtc->ddp_comp[i + 1]->id);
>   mtk_disp_mutex_add_comp(mtk_crtc->mutex,
>   mtk_crtc->ddp_comp[i]->id);
>   }
> @@ -355,9 +356,9 @@ static void mtk_crtc_ddp_hw_fini(struct mtk_drm_crtc 
> *mtk_crtc)
>  mtk_crtc->ddp_comp[i]->id);
>   mtk_disp_mutex_disable(mtk_crtc->mutex);
>   for (i = 0; i < mtk_crtc->ddp_comp_nr - 1; i++) {
> - mtk_ddp_remove_comp_from_path(mtk_crtc->config_regs,
> -   mtk_crtc->ddp_comp[i]->id,
> -   mtk_crtc->ddp_comp[i + 1]->id);
> + mtk_mmsys_ddp_disconnect(mtk_crtc->mmsys_dev,
> +  mtk_crtc->ddp_comp[i]->id,
> +  mtk_crtc->ddp_comp[i + 1]->id);
>   mtk_disp_mutex_remove_comp(mtk_crtc->mutex,
>  mtk_crtc->ddp_comp[i]->id);
>   }
> @@ -761,7 +762,7 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,
>   if (!mtk_crtc)
>   return -ENOMEM;
>  
> - mtk_crtc->config_regs = priv->config_regs;
> + mtk_crtc->mmsys_dev = priv->mmsys_dev;
>   mtk_crtc->ddp_comp_nr = path_len;
>   mtk_crtc->ddp_comp = d

[RESEND PATCH v12 4/5] soc / drm: mediatek: Move routing control to mmsys device

2020-03-26 Thread Enric Balletbo i Serra
Provide a mtk_mmsys_ddp_connect() and mtk_mmsys_disconnect() functions to
replace mtk_ddp_add_comp_to_path() and mtk_ddp_remove_comp_from_path().
Those functions will allow DRM driver and others to control the data
path routing.

Signed-off-by: Enric Balletbo i Serra 
Reviewed-by: Matthias Brugger 
Reviewed-by: CK Hu 
Acked-by: CK Hu 
---

Changes in v12: None
Changes in v10:
- Select CONFIG_MTK_MMSYS (CK)
- Pass device pointer of mmsys device instead of config regs (CK)

Changes in v9:
- Introduced a new patch to move routing control into mmsys driver.
- Removed the patch to use regmap as is not needed anymore.

Changes in v8: None
Changes in v7: None

 drivers/gpu/drm/mediatek/Kconfig|   1 +
 drivers/gpu/drm/mediatek/mtk_drm_crtc.c |  19 +-
 drivers/gpu/drm/mediatek/mtk_drm_ddp.c  | 256 --
 drivers/gpu/drm/mediatek/mtk_drm_ddp.h  |   7 -
 drivers/gpu/drm/mediatek/mtk_drm_drv.c  |  14 +-
 drivers/gpu/drm/mediatek/mtk_drm_drv.h  |   2 +-
 drivers/soc/mediatek/mtk-mmsys.c| 279 
 include/linux/soc/mediatek/mtk-mmsys.h  |  20 ++
 8 files changed, 316 insertions(+), 282 deletions(-)
 create mode 100644 include/linux/soc/mediatek/mtk-mmsys.h

diff --git a/drivers/gpu/drm/mediatek/Kconfig b/drivers/gpu/drm/mediatek/Kconfig
index fa5ffc4fe823..c420f5a3d33b 100644
--- a/drivers/gpu/drm/mediatek/Kconfig
+++ b/drivers/gpu/drm/mediatek/Kconfig
@@ -11,6 +11,7 @@ config DRM_MEDIATEK
select DRM_MIPI_DSI
select DRM_PANEL
select MEMORY
+   select MTK_MMSYS
select MTK_SMI
select VIDEOMODE_HELPERS
help
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c 
b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
index 0dfcd1787e65..615a54e60fe2 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
@@ -6,6 +6,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -28,7 +29,7 @@
  * @enabled: records whether crtc_enable succeeded
  * @planes: array of 4 drm_plane structures, one for each overlay plane
  * @pending_planes: whether any plane has pending changes to be applied
- * @config_regs: memory mapped mmsys configuration register space
+ * @mmsys_dev: pointer to the mmsys device for configuration registers
  * @mutex: handle to one of the ten disp_mutex streams
  * @ddp_comp_nr: number of components in ddp_comp
  * @ddp_comp: array of pointers the mtk_ddp_comp structures used by this crtc
@@ -50,7 +51,7 @@ struct mtk_drm_crtc {
u32 cmdq_event;
 #endif
 
-   void __iomem*config_regs;
+   struct device   *mmsys_dev;
struct mtk_disp_mutex   *mutex;
unsigned intddp_comp_nr;
struct mtk_ddp_comp **ddp_comp;
@@ -300,9 +301,9 @@ static int mtk_crtc_ddp_hw_init(struct mtk_drm_crtc 
*mtk_crtc)
 
DRM_DEBUG_DRIVER("mediatek_ddp_ddp_path_setup\n");
for (i = 0; i < mtk_crtc->ddp_comp_nr - 1; i++) {
-   mtk_ddp_add_comp_to_path(mtk_crtc->config_regs,
-mtk_crtc->ddp_comp[i]->id,
-mtk_crtc->ddp_comp[i + 1]->id);
+   mtk_mmsys_ddp_connect(mtk_crtc->mmsys_dev,
+ mtk_crtc->ddp_comp[i]->id,
+ mtk_crtc->ddp_comp[i + 1]->id);
mtk_disp_mutex_add_comp(mtk_crtc->mutex,
mtk_crtc->ddp_comp[i]->id);
}
@@ -360,9 +361,9 @@ static void mtk_crtc_ddp_hw_fini(struct mtk_drm_crtc 
*mtk_crtc)
   mtk_crtc->ddp_comp[i]->id);
mtk_disp_mutex_disable(mtk_crtc->mutex);
for (i = 0; i < mtk_crtc->ddp_comp_nr - 1; i++) {
-   mtk_ddp_remove_comp_from_path(mtk_crtc->config_regs,
- mtk_crtc->ddp_comp[i]->id,
- mtk_crtc->ddp_comp[i + 1]->id);
+   mtk_mmsys_ddp_disconnect(mtk_crtc->mmsys_dev,
+mtk_crtc->ddp_comp[i]->id,
+mtk_crtc->ddp_comp[i + 1]->id);
mtk_disp_mutex_remove_comp(mtk_crtc->mutex,
   mtk_crtc->ddp_comp[i]->id);
}
@@ -755,7 +756,7 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,
if (!mtk_crtc)
return -ENOMEM;
 
-   mtk_crtc->config_regs = priv->config_regs;
+   mtk_crtc->mmsys_dev = priv->mmsys_dev;
mtk_crtc->ddp_comp_nr = path_len;
mtk_crtc->ddp_comp = devm_kmalloc_array(dev, mtk_crtc->ddp_comp_nr,
sizeof(*mtk_crtc->ddp_comp),
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c 
b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
index b885f60f474c..014c1bbe1df2 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp.

Re: [PATCH v12 4/5] soc / drm: mediatek: Move routing control to mmsys device

2020-03-25 Thread CK Hu
Hi, Matthias:

On Wed, 2020-03-25 at 17:16 +0100, Matthias Brugger wrote:
> 
> On 11/03/2020 17:53, Enric Balletbo i Serra wrote:
> > Provide a mtk_mmsys_ddp_connect() and mtk_mmsys_disconnect() functions to
> > replace mtk_ddp_add_comp_to_path() and mtk_ddp_remove_comp_from_path().
> > Those functions will allow DRM driver and others to control the data
> > path routing.
> > 
> > Signed-off-by: Enric Balletbo i Serra 
> > Reviewed-by: Matthias Brugger 
> > Reviewed-by: CK Hu 
> > Acked-by: CK Hu 
> 
> This patch does not apply against v5.6-rc1.
> Please rebase as this is a quite big patch and it won't be easy to do that by 
> hand.

I think this patch depends on [1] which has been acked by me and I have
not picked it. The simple way is that you pick [1] first and then pick
this series.

[1] 
https://patchwork.kernel.org/patch/11406227/

Regards,
CK

> 
> Regards,
> Matthias
> 
> > ---
> > 
> > Changes in v12: None
> > Changes in v10:
> > - Select CONFIG_MTK_MMSYS (CK)
> > - Pass device pointer of mmsys device instead of config regs (CK)
> > 
> > Changes in v9:
> > - Introduced a new patch to move routing control into mmsys driver.
> > - Removed the patch to use regmap as is not needed anymore.
> > 
> > Changes in v8: None
> > Changes in v7: None
> > 
> >  drivers/gpu/drm/mediatek/Kconfig|   1 +
> >  drivers/gpu/drm/mediatek/mtk_drm_crtc.c |  19 +-
> >  drivers/gpu/drm/mediatek/mtk_drm_ddp.c  | 256 --
> >  drivers/gpu/drm/mediatek/mtk_drm_ddp.h  |   7 -
> >  drivers/gpu/drm/mediatek/mtk_drm_drv.c  |  14 +-
> >  drivers/gpu/drm/mediatek/mtk_drm_drv.h  |   2 +-
> >  drivers/soc/mediatek/mtk-mmsys.c| 279 
> >  include/linux/soc/mediatek/mtk-mmsys.h  |  20 ++
> >  8 files changed, 316 insertions(+), 282 deletions(-)
> >  create mode 100644 include/linux/soc/mediatek/mtk-mmsys.h
> > 
> > diff --git a/drivers/gpu/drm/mediatek/Kconfig 
> > b/drivers/gpu/drm/mediatek/Kconfig
> > index fa5ffc4fe823..c420f5a3d33b 100644
> > --- a/drivers/gpu/drm/mediatek/Kconfig
> > +++ b/drivers/gpu/drm/mediatek/Kconfig
> > @@ -11,6 +11,7 @@ config DRM_MEDIATEK
> > select DRM_MIPI_DSI
> > select DRM_PANEL
> > select MEMORY
> > +   select MTK_MMSYS
> > select MTK_SMI
> > select VIDEOMODE_HELPERS
> > help
> > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c 
> > b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> > index 0e05683d7b53..579a5a5d4472 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> > @@ -6,6 +6,7 @@
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> >  
> >  #include 
> >  #include 
> > @@ -28,7 +29,7 @@
> >   * @enabled: records whether crtc_enable succeeded
> >   * @planes: array of 4 drm_plane structures, one for each overlay plane
> >   * @pending_planes: whether any plane has pending changes to be applied
> > - * @config_regs: memory mapped mmsys configuration register space
> > + * @mmsys_dev: pointer to the mmsys device for configuration registers
> >   * @mutex: handle to one of the ten disp_mutex streams
> >   * @ddp_comp_nr: number of components in ddp_comp
> >   * @ddp_comp: array of pointers the mtk_ddp_comp structures used by this 
> > crtc
> > @@ -50,7 +51,7 @@ struct mtk_drm_crtc {
> > u32 cmdq_event;
> >  #endif
> >  
> > -   void __iomem*config_regs;
> > +   struct device   *mmsys_dev;
> > struct mtk_disp_mutex   *mutex;
> > unsigned intddp_comp_nr;
> > struct mtk_ddp_comp **ddp_comp;
> > @@ -296,9 +297,9 @@ static int mtk_crtc_ddp_hw_init(struct mtk_drm_crtc 
> > *mtk_crtc)
> > }
> >  
> > for (i = 0; i < mtk_crtc->ddp_comp_nr - 1; i++) {
> > -   mtk_ddp_add_comp_to_path(mtk_crtc->config_regs,
> > -mtk_crtc->ddp_comp[i]->id,
> > -mtk_crtc->ddp_comp[i + 1]->id);
> > +   mtk_mmsys_ddp_connect(mtk_crtc->mmsys_dev,
> > + mtk_crtc->ddp_comp[i]->id,
> > + mtk_crtc->ddp_comp[i + 1]->id);
> > mtk_disp_mutex_add_comp(mtk_crtc->mutex,
> > mtk_crtc->ddp_comp[i]->id);
> > }
> > @@ -355,9 +356,9 @@ static void mtk_crtc_ddp_hw_fini(struct mtk_drm_crtc 
> > *mtk_crtc)
> >mtk_crtc->ddp_comp[i]->id);
> > mtk_disp_mutex_disable(mtk_crtc->mutex);
> > for (i = 0; i < mtk_crtc->ddp_comp_nr - 1; i++) {
> > -   mtk_ddp_remove_comp_from_path(mtk_crtc->config_regs,
> > - mtk_crtc->ddp_comp[i]->id,
> > - mtk_crtc->ddp_comp[i + 1]->id);
> > +   mtk_mmsys_ddp_disconnect(mtk_crtc->mmsys_dev,
> > +mtk_crtc->ddp_comp[i]->id,
> > +mtk_crtc->ddp_com

[PATCH v12 4/5] soc / drm: mediatek: Move routing control to mmsys device

2020-03-12 Thread Enric Balletbo i Serra
Provide a mtk_mmsys_ddp_connect() and mtk_mmsys_disconnect() functions to
replace mtk_ddp_add_comp_to_path() and mtk_ddp_remove_comp_from_path().
Those functions will allow DRM driver and others to control the data
path routing.

Signed-off-by: Enric Balletbo i Serra 
Reviewed-by: Matthias Brugger 
Reviewed-by: CK Hu 
Acked-by: CK Hu 
---

Changes in v12: None
Changes in v10:
- Select CONFIG_MTK_MMSYS (CK)
- Pass device pointer of mmsys device instead of config regs (CK)

Changes in v9:
- Introduced a new patch to move routing control into mmsys driver.
- Removed the patch to use regmap as is not needed anymore.

Changes in v8: None
Changes in v7: None

 drivers/gpu/drm/mediatek/Kconfig|   1 +
 drivers/gpu/drm/mediatek/mtk_drm_crtc.c |  19 +-
 drivers/gpu/drm/mediatek/mtk_drm_ddp.c  | 256 --
 drivers/gpu/drm/mediatek/mtk_drm_ddp.h  |   7 -
 drivers/gpu/drm/mediatek/mtk_drm_drv.c  |  14 +-
 drivers/gpu/drm/mediatek/mtk_drm_drv.h  |   2 +-
 drivers/soc/mediatek/mtk-mmsys.c| 279 
 include/linux/soc/mediatek/mtk-mmsys.h  |  20 ++
 8 files changed, 316 insertions(+), 282 deletions(-)
 create mode 100644 include/linux/soc/mediatek/mtk-mmsys.h

diff --git a/drivers/gpu/drm/mediatek/Kconfig b/drivers/gpu/drm/mediatek/Kconfig
index fa5ffc4fe823..c420f5a3d33b 100644
--- a/drivers/gpu/drm/mediatek/Kconfig
+++ b/drivers/gpu/drm/mediatek/Kconfig
@@ -11,6 +11,7 @@ config DRM_MEDIATEK
select DRM_MIPI_DSI
select DRM_PANEL
select MEMORY
+   select MTK_MMSYS
select MTK_SMI
select VIDEOMODE_HELPERS
help
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c 
b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
index 0e05683d7b53..579a5a5d4472 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
@@ -6,6 +6,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -28,7 +29,7 @@
  * @enabled: records whether crtc_enable succeeded
  * @planes: array of 4 drm_plane structures, one for each overlay plane
  * @pending_planes: whether any plane has pending changes to be applied
- * @config_regs: memory mapped mmsys configuration register space
+ * @mmsys_dev: pointer to the mmsys device for configuration registers
  * @mutex: handle to one of the ten disp_mutex streams
  * @ddp_comp_nr: number of components in ddp_comp
  * @ddp_comp: array of pointers the mtk_ddp_comp structures used by this crtc
@@ -50,7 +51,7 @@ struct mtk_drm_crtc {
u32 cmdq_event;
 #endif
 
-   void __iomem*config_regs;
+   struct device   *mmsys_dev;
struct mtk_disp_mutex   *mutex;
unsigned intddp_comp_nr;
struct mtk_ddp_comp **ddp_comp;
@@ -296,9 +297,9 @@ static int mtk_crtc_ddp_hw_init(struct mtk_drm_crtc 
*mtk_crtc)
}
 
for (i = 0; i < mtk_crtc->ddp_comp_nr - 1; i++) {
-   mtk_ddp_add_comp_to_path(mtk_crtc->config_regs,
-mtk_crtc->ddp_comp[i]->id,
-mtk_crtc->ddp_comp[i + 1]->id);
+   mtk_mmsys_ddp_connect(mtk_crtc->mmsys_dev,
+ mtk_crtc->ddp_comp[i]->id,
+ mtk_crtc->ddp_comp[i + 1]->id);
mtk_disp_mutex_add_comp(mtk_crtc->mutex,
mtk_crtc->ddp_comp[i]->id);
}
@@ -355,9 +356,9 @@ static void mtk_crtc_ddp_hw_fini(struct mtk_drm_crtc 
*mtk_crtc)
   mtk_crtc->ddp_comp[i]->id);
mtk_disp_mutex_disable(mtk_crtc->mutex);
for (i = 0; i < mtk_crtc->ddp_comp_nr - 1; i++) {
-   mtk_ddp_remove_comp_from_path(mtk_crtc->config_regs,
- mtk_crtc->ddp_comp[i]->id,
- mtk_crtc->ddp_comp[i + 1]->id);
+   mtk_mmsys_ddp_disconnect(mtk_crtc->mmsys_dev,
+mtk_crtc->ddp_comp[i]->id,
+mtk_crtc->ddp_comp[i + 1]->id);
mtk_disp_mutex_remove_comp(mtk_crtc->mutex,
   mtk_crtc->ddp_comp[i]->id);
}
@@ -761,7 +762,7 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,
if (!mtk_crtc)
return -ENOMEM;
 
-   mtk_crtc->config_regs = priv->config_regs;
+   mtk_crtc->mmsys_dev = priv->mmsys_dev;
mtk_crtc->ddp_comp_nr = path_len;
mtk_crtc->ddp_comp = devm_kmalloc_array(dev, mtk_crtc->ddp_comp_nr,
sizeof(*mtk_crtc->ddp_comp),
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c 
b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
index b885f60f474c..014c1bbe1df2 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
@@