diff mbox series

[v6,6/9] soc: mediatek: mmsys: instantiate mdp virtual device from mmsys

Message ID 20210802220943.v6.6.Ie4214d2cc73ab276dd7c41d4f63c98e011fb42d4@changeid (mailing list archive)
State New, archived
Headers show
Series Refactor MTK MDP driver into core/components | expand

Commit Message

Eizan Miyamoto Aug. 2, 2021, 12:12 p.m. UTC
A virtual device that is probed by the mtk_mdp_core driver is
instantiated by the mtk_mmsys driver.

This better reflects the logical organization of the hardware and
driver: there are a number of hardware blocks that are used by the MDP
that have no strict hierarchy, and the software driver is responsible
for driving them properly.

Signed-off-by: Eizan Miyamoto <eizan@chromium.org>
---

(no changes since v1)

 drivers/soc/mediatek/mtk-mmsys.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

Comments

Enric Balletbo Serra Aug. 3, 2021, 10:27 a.m. UTC | #1
Hi Eizan,

Thank you for your patch.

Missatge de Eizan Miyamoto <eizan@chromium.org> del dia dl., 2 d’ag.
2021 a les 14:14:
>
> A virtual device that is probed by the mtk_mdp_core driver is
> instantiated by the mtk_mmsys driver.
>
> This better reflects the logical organization of the hardware and
> driver: there are a number of hardware blocks that are used by the MDP
> that have no strict hierarchy, and the software driver is responsible
> for driving them properly.
>
> Signed-off-by: Eizan Miyamoto <eizan@chromium.org>

Reviewed-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>


> ---
>
> (no changes since v1)
>
>  drivers/soc/mediatek/mtk-mmsys.c | 20 +++++++++++++++++++-
>  1 file changed, 19 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/soc/mediatek/mtk-mmsys.c b/drivers/soc/mediatek/mtk-mmsys.c
> index 080660ef11bf..e681029fe804 100644
> --- a/drivers/soc/mediatek/mtk-mmsys.c
> +++ b/drivers/soc/mediatek/mtk-mmsys.c
> @@ -97,6 +97,7 @@ static int mtk_mmsys_probe(struct platform_device *pdev)
>         struct platform_device *clks;
>         struct platform_device *drm;
>         struct mtk_mmsys *mmsys;
> +       struct platform_device *mdp;
>         int ret;
>
>         mmsys = devm_kzalloc(dev, sizeof(*mmsys), GFP_KERNEL);
> @@ -122,10 +123,27 @@ static int mtk_mmsys_probe(struct platform_device *pdev)
>                                             PLATFORM_DEVID_AUTO, NULL, 0);
>         if (IS_ERR(drm)) {
>                 platform_device_unregister(clks);
> -               return PTR_ERR(drm);
> +               ret = PTR_ERR(drm);
> +               goto err_drm;
> +       }
> +
> +       mdp = platform_device_register_data(&pdev->dev, "mtk-mdp",
> +                                           PLATFORM_DEVID_AUTO, NULL, 0);
> +       if (IS_ERR(mdp)) {
> +               ret = PTR_ERR(mdp);
> +               dev_err(dev, "Failed to register mdp: %d\n", ret);
> +               goto err_mdp;
>         }
>
>         return 0;
> +
> +err_mdp:
> +       platform_device_unregister(drm);
> +
> +err_drm:
> +       platform_device_unregister(clks);
> +
> +       return ret;
>  }
>
>  static const struct of_device_id of_match_mtk_mmsys[] = {
> --
> 2.32.0.554.ge1b32706d8-goog
>
houlong.wei Aug. 16, 2021, 1:18 a.m. UTC | #2
On Mon, 2021-08-02 at 20:12 +0800, Eizan Miyamoto wrote:
> A virtual device that is probed by the mtk_mdp_core driver is
> instantiated by the mtk_mmsys driver.
> 
> This better reflects the logical organization of the hardware and
> driver: there are a number of hardware blocks that are used by the
> MDP
> that have no strict hierarchy, and the software driver is responsible
> for driving them properly.
> 
> Signed-off-by: Eizan Miyamoto <eizan@chromium.org>
> ---

Reviewed-by: Houlong Wei <houlong.wei@mediatek.com>

> (no changes since v1)
> 
>  drivers/soc/mediatek/mtk-mmsys.c | 20 +++++++++++++++++++-
>  1 file changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/soc/mediatek/mtk-mmsys.c
> b/drivers/soc/mediatek/mtk-mmsys.c
> index 080660ef11bf..e681029fe804 100644
> --- a/drivers/soc/mediatek/mtk-mmsys.c
> +++ b/drivers/soc/mediatek/mtk-mmsys.c
> @@ -97,6 +97,7 @@ static int mtk_mmsys_probe(struct platform_device
> *pdev)
>  	struct platform_device *clks;
>  	struct platform_device *drm;
>  	struct mtk_mmsys *mmsys;
> +	struct platform_device *mdp;
>  	int ret;
>  
>  	mmsys = devm_kzalloc(dev, sizeof(*mmsys), GFP_KERNEL);
> @@ -122,10 +123,27 @@ static int mtk_mmsys_probe(struct
> platform_device *pdev)
>  					    PLATFORM_DEVID_AUTO, NULL,
> 0);
>  	if (IS_ERR(drm)) {
>  		platform_device_unregister(clks);
> -		return PTR_ERR(drm);
> +		ret = PTR_ERR(drm);
> +		goto err_drm;
> +	}
> +
> +	mdp = platform_device_register_data(&pdev->dev, "mtk-mdp",
> +					    PLATFORM_DEVID_AUTO, NULL,
> 0);
> +	if (IS_ERR(mdp)) {
> +		ret = PTR_ERR(mdp);
> +		dev_err(dev, "Failed to register mdp: %d\n", ret);
> +		goto err_mdp;
>  	}
>  
>  	return 0;
> +
> +err_mdp:
> +	platform_device_unregister(drm);
> +
> +err_drm:
> +	platform_device_unregister(clks);
> +
> +	return ret;
>  }
>  
>  static const struct of_device_id of_match_mtk_mmsys[] = {
> -- 
> 2.32.0.554.ge1b32706d8-goog
>
diff mbox series

Patch

diff --git a/drivers/soc/mediatek/mtk-mmsys.c b/drivers/soc/mediatek/mtk-mmsys.c
index 080660ef11bf..e681029fe804 100644
--- a/drivers/soc/mediatek/mtk-mmsys.c
+++ b/drivers/soc/mediatek/mtk-mmsys.c
@@ -97,6 +97,7 @@  static int mtk_mmsys_probe(struct platform_device *pdev)
 	struct platform_device *clks;
 	struct platform_device *drm;
 	struct mtk_mmsys *mmsys;
+	struct platform_device *mdp;
 	int ret;
 
 	mmsys = devm_kzalloc(dev, sizeof(*mmsys), GFP_KERNEL);
@@ -122,10 +123,27 @@  static int mtk_mmsys_probe(struct platform_device *pdev)
 					    PLATFORM_DEVID_AUTO, NULL, 0);
 	if (IS_ERR(drm)) {
 		platform_device_unregister(clks);
-		return PTR_ERR(drm);
+		ret = PTR_ERR(drm);
+		goto err_drm;
+	}
+
+	mdp = platform_device_register_data(&pdev->dev, "mtk-mdp",
+					    PLATFORM_DEVID_AUTO, NULL, 0);
+	if (IS_ERR(mdp)) {
+		ret = PTR_ERR(mdp);
+		dev_err(dev, "Failed to register mdp: %d\n", ret);
+		goto err_mdp;
 	}
 
 	return 0;
+
+err_mdp:
+	platform_device_unregister(drm);
+
+err_drm:
+	platform_device_unregister(clks);
+
+	return ret;
 }
 
 static const struct of_device_id of_match_mtk_mmsys[] = {