diff mbox series

[v8,04/17] media: mtk-vcodec: Build decoder pm file as module

Message ID 20211029035527.454-5-yunfei.dong@mediatek.com (mailing list archive)
State New, archived
Headers show
Series Support multi hardware decode using of_platform_populate | expand

Commit Message

Yunfei Dong Oct. 29, 2021, 3:55 a.m. UTC
Need to build decoder pm file as module for master and comp
use the same pm interface.

Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
---
v8: add new patch to build pm file as module
---
 drivers/media/platform/mtk-vcodec/Makefile            | 6 ++++--
 drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c | 9 +++++++++
 2 files changed, 13 insertions(+), 2 deletions(-)

Comments

Dafna Hirschfeld Oct. 29, 2021, 11:42 a.m. UTC | #1
On 29.10.21 05:55, Yunfei Dong wrote:
> Need to build decoder pm file as module for master and comp
> use the same pm interface.

Do you still use the component framework in this patchset?
In the cover letter you write: "- Use of_platform_populate to manage multi hardware, not component framework for patch 4/15"
If that frameworks is not used anymore you should also change the commit log, and maybe this patch is not needed anymore?

Thanks,
Dafna
> 
> Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
> ---
> v8: add new patch to build pm file as module
> ---
>   drivers/media/platform/mtk-vcodec/Makefile            | 6 ++++--
>   drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c | 9 +++++++++
>   2 files changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/platform/mtk-vcodec/Makefile b/drivers/media/platform/mtk-vcodec/Makefile
> index ca8e9e7a9c4e..5d36e05535d7 100644
> --- a/drivers/media/platform/mtk-vcodec/Makefile
> +++ b/drivers/media/platform/mtk-vcodec/Makefile
> @@ -2,7 +2,8 @@
>   
>   obj-$(CONFIG_VIDEO_MEDIATEK_VCODEC) += mtk-vcodec-dec.o \
>   				       mtk-vcodec-enc.o \
> -				       mtk-vcodec-common.o
> +				       mtk-vcodec-common.o \
> +				       mtk-vcodec-dec-common.o
>   
>   mtk-vcodec-dec-y := vdec/vdec_h264_if.o \
>   		vdec/vdec_vp8_if.o \
> @@ -14,7 +15,8 @@ mtk-vcodec-dec-y := vdec/vdec_h264_if.o \
>   		mtk_vcodec_dec.o \
>   		mtk_vcodec_dec_stateful.o \
>   		mtk_vcodec_dec_stateless.o \
> -		mtk_vcodec_dec_pm.o \
> +
> +mtk-vcodec-dec-common-y := mtk_vcodec_dec_pm.o
>   
>   mtk-vcodec-enc-y := venc/venc_vp8_if.o \
>   		venc/venc_h264_if.o \
> 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 20bd157a855c..09a281e3065a 100644
> --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
> +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
> @@ -77,12 +77,14 @@ int mtk_vcodec_init_dec_pm(struct platform_device *pdev,
>   	put_device(pm->larbvdec);
>   	return ret;
>   }
> +EXPORT_SYMBOL_GPL(mtk_vcodec_init_dec_pm);
>   
>   void mtk_vcodec_release_dec_pm(struct mtk_vcodec_pm *pm)
>   {
>   	pm_runtime_disable(pm->dev);
>   	put_device(pm->larbvdec);
>   }
> +EXPORT_SYMBOL_GPL(mtk_vcodec_release_dec_pm);
>   
>   int mtk_vcodec_dec_pw_on(struct mtk_vcodec_pm *pm)
>   {
> @@ -94,6 +96,7 @@ int mtk_vcodec_dec_pw_on(struct mtk_vcodec_pm *pm)
>   
>   	return ret;
>   }
> +EXPORT_SYMBOL_GPL(mtk_vcodec_dec_pw_on);
>   
>   void mtk_vcodec_dec_pw_off(struct mtk_vcodec_pm *pm)
>   {
> @@ -103,6 +106,7 @@ void mtk_vcodec_dec_pw_off(struct mtk_vcodec_pm *pm)
>   	if (ret)
>   		mtk_v4l2_err("pm_runtime_put_sync fail %d", ret);
>   }
> +EXPORT_SYMBOL_GPL(mtk_vcodec_dec_pw_off);
>   
>   void mtk_vcodec_dec_clock_on(struct mtk_vcodec_pm *pm)
>   {
> @@ -129,6 +133,7 @@ void mtk_vcodec_dec_clock_on(struct mtk_vcodec_pm *pm)
>   	for (i -= 1; i >= 0; i--)
>   		clk_disable_unprepare(dec_clk->clk_info[i].vcodec_clk);
>   }
> +EXPORT_SYMBOL_GPL(mtk_vcodec_dec_clock_on);
>   
>   void mtk_vcodec_dec_clock_off(struct mtk_vcodec_pm *pm)
>   {
> @@ -139,3 +144,7 @@ void mtk_vcodec_dec_clock_off(struct mtk_vcodec_pm *pm)
>   	for (i = dec_clk->clk_num - 1; i >= 0; i--)
>   		clk_disable_unprepare(dec_clk->clk_info[i].vcodec_clk);
>   }
> +EXPORT_SYMBOL_GPL(mtk_vcodec_dec_clock_off);
> +
> +MODULE_LICENSE("GPL v2");
> +MODULE_DESCRIPTION("Mediatek video decoder driver");
>
Yunfei Dong Oct. 30, 2021, 8:50 a.m. UTC | #2
Hi Danfa,

Thanks for your feedback.
On Fri, 2021-10-29 at 13:42 +0200, Dafna Hirschfeld wrote:
> 
> On 29.10.21 05:55, Yunfei Dong wrote:
> > Need to build decoder pm file as module for master and comp
> > use the same pm interface.
> 
> Do you still use the component framework in this patchset?
> In the cover letter you write: "- Use of_platform_populate to manage
> multi hardware, not component framework for patch 4/15"
> If that frameworks is not used anymore you should also change the
> commit log, and maybe this patch is not needed anymore?
> 
Not use component framework.

For iommu limit, not only parent device, the child device also need to
register as platform device. So the child device need to call
module_platform_driver. The child and parent device all need to call pm
interface to open/close pm/clk/irq. So build pm file as module, and
export necessary function.
> > 

Thanks
Yunfei Dong
> Thanks,
> Dafna
> > Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
> > ---
> > v8: add new patch to build pm file as module
> > ---
> >   drivers/media/platform/mtk-vcodec/Makefile            | 6 ++++--
> >   drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c | 9
> > +++++++++
> >   2 files changed, 13 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/media/platform/mtk-vcodec/Makefile
> > b/drivers/media/platform/mtk-vcodec/Makefile
> > index ca8e9e7a9c4e..5d36e05535d7 100644
> > --- a/drivers/media/platform/mtk-vcodec/Makefile
> > +++ b/drivers/media/platform/mtk-vcodec/Makefile
> > @@ -2,7 +2,8 @@
> >   
> >   obj-$(CONFIG_VIDEO_MEDIATEK_VCODEC) += mtk-vcodec-dec.o \
> >   				       mtk-vcodec-enc.o \
> > -				       mtk-vcodec-common.o
> > +				       mtk-vcodec-common.o \
> > +				       mtk-vcodec-dec-common.o
> >   
> >   mtk-vcodec-dec-y := vdec/vdec_h264_if.o \
> >   		vdec/vdec_vp8_if.o \
> > @@ -14,7 +15,8 @@ mtk-vcodec-dec-y := vdec/vdec_h264_if.o \
> >   		mtk_vcodec_dec.o \
> >   		mtk_vcodec_dec_stateful.o \
> >   		mtk_vcodec_dec_stateless.o \
> > -		mtk_vcodec_dec_pm.o \
> > +
> > +mtk-vcodec-dec-common-y := mtk_vcodec_dec_pm.o
> >   
> >   mtk-vcodec-enc-y := venc/venc_vp8_if.o \
> >   		venc/venc_h264_if.o \
> > 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 20bd157a855c..09a281e3065a 100644
> > --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
> > +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
> > @@ -77,12 +77,14 @@ int mtk_vcodec_init_dec_pm(struct
> > platform_device *pdev,
> >   	put_device(pm->larbvdec);
> >   	return ret;
> >   }
> > +EXPORT_SYMBOL_GPL(mtk_vcodec_init_dec_pm);
> >   
> >   void mtk_vcodec_release_dec_pm(struct mtk_vcodec_pm *pm)
> >   {
> >   	pm_runtime_disable(pm->dev);
> >   	put_device(pm->larbvdec);
> >   }
> > +EXPORT_SYMBOL_GPL(mtk_vcodec_release_dec_pm);
> >   
> >   int mtk_vcodec_dec_pw_on(struct mtk_vcodec_pm *pm)
> >   {
> > @@ -94,6 +96,7 @@ int mtk_vcodec_dec_pw_on(struct mtk_vcodec_pm
> > *pm)
> >   
> >   	return ret;
> >   }
> > +EXPORT_SYMBOL_GPL(mtk_vcodec_dec_pw_on);
> >   
> >   void mtk_vcodec_dec_pw_off(struct mtk_vcodec_pm *pm)
> >   {
> > @@ -103,6 +106,7 @@ void mtk_vcodec_dec_pw_off(struct mtk_vcodec_pm
> > *pm)
> >   	if (ret)
> >   		mtk_v4l2_err("pm_runtime_put_sync fail %d", ret);
> >   }
> > +EXPORT_SYMBOL_GPL(mtk_vcodec_dec_pw_off);
> >   
> >   void mtk_vcodec_dec_clock_on(struct mtk_vcodec_pm *pm)
> >   {
> > @@ -129,6 +133,7 @@ void mtk_vcodec_dec_clock_on(struct
> > mtk_vcodec_pm *pm)
> >   	for (i -= 1; i >= 0; i--)
> >   		clk_disable_unprepare(dec_clk->clk_info[i].vcodec_clk);
> >   }
> > +EXPORT_SYMBOL_GPL(mtk_vcodec_dec_clock_on);
> >   
> >   void mtk_vcodec_dec_clock_off(struct mtk_vcodec_pm *pm)
> >   {
> > @@ -139,3 +144,7 @@ void mtk_vcodec_dec_clock_off(struct
> > mtk_vcodec_pm *pm)
> >   	for (i = dec_clk->clk_num - 1; i >= 0; i--)
> >   		clk_disable_unprepare(dec_clk->clk_info[i].vcodec_clk);
> >   }
> > +EXPORT_SYMBOL_GPL(mtk_vcodec_dec_clock_off);
> > +
> > +MODULE_LICENSE("GPL v2");
> > +MODULE_DESCRIPTION("Mediatek video decoder driver");
> >
Yunfei Dong Nov. 9, 2021, 10:19 a.m. UTC | #3
Hi dafna,

Thanks for your suggestion.
On Fri, 2021-10-29 at 13:42 +0200, Dafna Hirschfeld wrote:
> 
> On 29.10.21 05:55, Yunfei Dong wrote:
> > Need to build decoder pm file as module for master and comp
> > use the same pm interface.
> 
> Do you still use the component framework in this patchset?
> In the cover letter you write: "- Use of_platform_populate to manage
> multi hardware, not component framework for patch 4/15"
remove component.
> If that frameworks is not used anymore you should also change the
> commit log, and maybe this patch is not needed anymore?
> 
main device and subdev device all use the same pm interface, so build
the file as module.
> Thanks,
> Dafna
Thanks,
Yunfei Dong
> > 
> > Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
> > ---
> > v8: add new patch to build pm file as module
> > ---
> >   drivers/media/platform/mtk-vcodec/Makefile            | 6 ++++--
> >   drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c | 9
> > +++++++++
> >   2 files changed, 13 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/media/platform/mtk-vcodec/Makefile
> > b/drivers/media/platform/mtk-vcodec/Makefile
> > index ca8e9e7a9c4e..5d36e05535d7 100644
> > --- a/drivers/media/platform/mtk-vcodec/Makefile
> > +++ b/drivers/media/platform/mtk-vcodec/Makefile
> > @@ -2,7 +2,8 @@
> >   
> >   obj-$(CONFIG_VIDEO_MEDIATEK_VCODEC) += mtk-vcodec-dec.o \
> >   				       mtk-vcodec-enc.o \
> > -				       mtk-vcodec-common.o
> > +				       mtk-vcodec-common.o \
> > +				       mtk-vcodec-dec-common.o
> >   
> >   mtk-vcodec-dec-y := vdec/vdec_h264_if.o \
> >   		vdec/vdec_vp8_if.o \
> > @@ -14,7 +15,8 @@ mtk-vcodec-dec-y := vdec/vdec_h264_if.o \
> >   		mtk_vcodec_dec.o \
> >   		mtk_vcodec_dec_stateful.o \
> >   		mtk_vcodec_dec_stateless.o \
> > -		mtk_vcodec_dec_pm.o \
> > +
> > +mtk-vcodec-dec-common-y := mtk_vcodec_dec_pm.o
> >   
> >   mtk-vcodec-enc-y := venc/venc_vp8_if.o \
> >   		venc/venc_h264_if.o \
> > 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 20bd157a855c..09a281e3065a 100644
> > --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
> > +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
> > @@ -77,12 +77,14 @@ int mtk_vcodec_init_dec_pm(struct
> > platform_device *pdev,
> >   	put_device(pm->larbvdec);
> >   	return ret;
> >   }
> > +EXPORT_SYMBOL_GPL(mtk_vcodec_init_dec_pm);
> >   
> >   void mtk_vcodec_release_dec_pm(struct mtk_vcodec_pm *pm)
> >   {
> >   	pm_runtime_disable(pm->dev);
> >   	put_device(pm->larbvdec);
> >   }
> > +EXPORT_SYMBOL_GPL(mtk_vcodec_release_dec_pm);
> >   
> >   int mtk_vcodec_dec_pw_on(struct mtk_vcodec_pm *pm)
> >   {
> > @@ -94,6 +96,7 @@ int mtk_vcodec_dec_pw_on(struct mtk_vcodec_pm
> > *pm)
> >   
> >   	return ret;
> >   }
> > +EXPORT_SYMBOL_GPL(mtk_vcodec_dec_pw_on);
> >   
> >   void mtk_vcodec_dec_pw_off(struct mtk_vcodec_pm *pm)
> >   {
> > @@ -103,6 +106,7 @@ void mtk_vcodec_dec_pw_off(struct mtk_vcodec_pm
> > *pm)
> >   	if (ret)
> >   		mtk_v4l2_err("pm_runtime_put_sync fail %d", ret);
> >   }
> > +EXPORT_SYMBOL_GPL(mtk_vcodec_dec_pw_off);
> >   
> >   void mtk_vcodec_dec_clock_on(struct mtk_vcodec_pm *pm)
> >   {
> > @@ -129,6 +133,7 @@ void mtk_vcodec_dec_clock_on(struct
> > mtk_vcodec_pm *pm)
> >   	for (i -= 1; i >= 0; i--)
> >   		clk_disable_unprepare(dec_clk->clk_info[i].vcodec_clk);
> >   }
> > +EXPORT_SYMBOL_GPL(mtk_vcodec_dec_clock_on);
> >   
> >   void mtk_vcodec_dec_clock_off(struct mtk_vcodec_pm *pm)
> >   {
> > @@ -139,3 +144,7 @@ void mtk_vcodec_dec_clock_off(struct
> > mtk_vcodec_pm *pm)
> >   	for (i = dec_clk->clk_num - 1; i >= 0; i--)
> >   		clk_disable_unprepare(dec_clk->clk_info[i].vcodec_clk);
> >   }
> > +EXPORT_SYMBOL_GPL(mtk_vcodec_dec_clock_off);
> > +
> > +MODULE_LICENSE("GPL v2");
> > +MODULE_DESCRIPTION("Mediatek video decoder driver");
> >
diff mbox series

Patch

diff --git a/drivers/media/platform/mtk-vcodec/Makefile b/drivers/media/platform/mtk-vcodec/Makefile
index ca8e9e7a9c4e..5d36e05535d7 100644
--- a/drivers/media/platform/mtk-vcodec/Makefile
+++ b/drivers/media/platform/mtk-vcodec/Makefile
@@ -2,7 +2,8 @@ 
 
 obj-$(CONFIG_VIDEO_MEDIATEK_VCODEC) += mtk-vcodec-dec.o \
 				       mtk-vcodec-enc.o \
-				       mtk-vcodec-common.o
+				       mtk-vcodec-common.o \
+				       mtk-vcodec-dec-common.o
 
 mtk-vcodec-dec-y := vdec/vdec_h264_if.o \
 		vdec/vdec_vp8_if.o \
@@ -14,7 +15,8 @@  mtk-vcodec-dec-y := vdec/vdec_h264_if.o \
 		mtk_vcodec_dec.o \
 		mtk_vcodec_dec_stateful.o \
 		mtk_vcodec_dec_stateless.o \
-		mtk_vcodec_dec_pm.o \
+
+mtk-vcodec-dec-common-y := mtk_vcodec_dec_pm.o
 
 mtk-vcodec-enc-y := venc/venc_vp8_if.o \
 		venc/venc_h264_if.o \
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 20bd157a855c..09a281e3065a 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
@@ -77,12 +77,14 @@  int mtk_vcodec_init_dec_pm(struct platform_device *pdev,
 	put_device(pm->larbvdec);
 	return ret;
 }
+EXPORT_SYMBOL_GPL(mtk_vcodec_init_dec_pm);
 
 void mtk_vcodec_release_dec_pm(struct mtk_vcodec_pm *pm)
 {
 	pm_runtime_disable(pm->dev);
 	put_device(pm->larbvdec);
 }
+EXPORT_SYMBOL_GPL(mtk_vcodec_release_dec_pm);
 
 int mtk_vcodec_dec_pw_on(struct mtk_vcodec_pm *pm)
 {
@@ -94,6 +96,7 @@  int mtk_vcodec_dec_pw_on(struct mtk_vcodec_pm *pm)
 
 	return ret;
 }
+EXPORT_SYMBOL_GPL(mtk_vcodec_dec_pw_on);
 
 void mtk_vcodec_dec_pw_off(struct mtk_vcodec_pm *pm)
 {
@@ -103,6 +106,7 @@  void mtk_vcodec_dec_pw_off(struct mtk_vcodec_pm *pm)
 	if (ret)
 		mtk_v4l2_err("pm_runtime_put_sync fail %d", ret);
 }
+EXPORT_SYMBOL_GPL(mtk_vcodec_dec_pw_off);
 
 void mtk_vcodec_dec_clock_on(struct mtk_vcodec_pm *pm)
 {
@@ -129,6 +133,7 @@  void mtk_vcodec_dec_clock_on(struct mtk_vcodec_pm *pm)
 	for (i -= 1; i >= 0; i--)
 		clk_disable_unprepare(dec_clk->clk_info[i].vcodec_clk);
 }
+EXPORT_SYMBOL_GPL(mtk_vcodec_dec_clock_on);
 
 void mtk_vcodec_dec_clock_off(struct mtk_vcodec_pm *pm)
 {
@@ -139,3 +144,7 @@  void mtk_vcodec_dec_clock_off(struct mtk_vcodec_pm *pm)
 	for (i = dec_clk->clk_num - 1; i >= 0; i--)
 		clk_disable_unprepare(dec_clk->clk_info[i].vcodec_clk);
 }
+EXPORT_SYMBOL_GPL(mtk_vcodec_dec_clock_off);
+
+MODULE_LICENSE("GPL v2");
+MODULE_DESCRIPTION("Mediatek video decoder driver");