diff mbox series

[RFC,3/3] soc: imx: Rename generic BLK CTRL driver to suggest future usability

Message ID 20220121112238.47281-4-abel.vesa@nxp.com (mailing list archive)
State New, archived
Headers show
Series soc: imx: Refactor BLK CTRL driver | expand

Commit Message

Abel Vesa Jan. 21, 2022, 11:22 a.m. UTC
By changing the prefix for every single generic API from "imx8m_" to
"imx_" we suggest that it can be used by future i.MX SoC families.

Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
---
 drivers/soc/imx/Makefile                      |  2 +-
 .../imx/{imx8m-blk-ctrl.c => imx-blk-ctrl.c}  | 64 +++++++++----------
 .../imx/{imx8m-blk-ctrl.h => imx-blk-ctrl.h}  | 24 +++----
 drivers/soc/imx/imx8mm-blk-ctrl.c             | 20 +++---
 drivers/soc/imx/imx8mn-blk-ctrl.c             | 14 ++--
 5 files changed, 62 insertions(+), 62 deletions(-)
 rename drivers/soc/imx/{imx8m-blk-ctrl.c => imx-blk-ctrl.c} (79%)
 rename drivers/soc/imx/{imx8m-blk-ctrl.h => imx-blk-ctrl.h} (72%)
diff mbox series

Patch

diff --git a/drivers/soc/imx/Makefile b/drivers/soc/imx/Makefile
index f5243bc5f08f..5cbcb14ab631 100644
--- a/drivers/soc/imx/Makefile
+++ b/drivers/soc/imx/Makefile
@@ -5,6 +5,6 @@  endif
 obj-$(CONFIG_HAVE_IMX_GPC) += gpc.o
 obj-$(CONFIG_IMX_GPCV2_PM_DOMAINS) += gpcv2.o
 obj-$(CONFIG_SOC_IMX8M) += soc-imx8m.o
-obj-$(CONFIG_SOC_IMX8M) += imx8m-blk-ctrl.o
+obj-$(CONFIG_SOC_IMX8M) += imx-blk-ctrl.o
 obj-$(CONFIG_SOC_IMX8MM_BLK_CTRL) += imx8mm-blk-ctrl.o
 obj-$(CONFIG_SOC_IMX8MN_BLK_CTRL) += imx8mn-blk-ctrl.o
diff --git a/drivers/soc/imx/imx8m-blk-ctrl.c b/drivers/soc/imx/imx-blk-ctrl.c
similarity index 79%
rename from drivers/soc/imx/imx8m-blk-ctrl.c
rename to drivers/soc/imx/imx-blk-ctrl.c
index ebdb044c6afa..58452a936085 100644
--- a/drivers/soc/imx/imx8m-blk-ctrl.c
+++ b/drivers/soc/imx/imx-blk-ctrl.c
@@ -6,19 +6,19 @@ 
 
 #include <linux/of_device.h>
 
-#include "imx8m-blk-ctrl.h"
+#include "imx-blk-ctrl.h"
 
-static inline struct imx8m_blk_ctrl_domain *
-to_imx8m_blk_ctrl_domain(struct generic_pm_domain *genpd)
+static inline struct imx_blk_ctrl_domain *
+to_imx_blk_ctrl_domain(struct generic_pm_domain *genpd)
 {
-	return container_of(genpd, struct imx8m_blk_ctrl_domain, genpd);
+	return container_of(genpd, struct imx_blk_ctrl_domain, genpd);
 }
 
-static int imx8m_blk_ctrl_power_on(struct generic_pm_domain *genpd)
+static int imx_blk_ctrl_power_on(struct generic_pm_domain *genpd)
 {
-	struct imx8m_blk_ctrl_domain *domain = to_imx8m_blk_ctrl_domain(genpd);
-	const struct imx8m_blk_ctrl_domain_data *data = domain->data;
-	struct imx8m_blk_ctrl *bc = domain->bc;
+	struct imx_blk_ctrl_domain *domain = to_imx_blk_ctrl_domain(genpd);
+	const struct imx_blk_ctrl_domain_data *data = domain->data;
+	struct imx_blk_ctrl *bc = domain->bc;
 	int ret;
 
 	/* make sure bus domain is awake */
@@ -70,11 +70,11 @@  static int imx8m_blk_ctrl_power_on(struct generic_pm_domain *genpd)
 	return ret;
 }
 
-static int imx8m_blk_ctrl_power_off(struct generic_pm_domain *genpd)
+static int imx_blk_ctrl_power_off(struct generic_pm_domain *genpd)
 {
-	struct imx8m_blk_ctrl_domain *domain = to_imx8m_blk_ctrl_domain(genpd);
-	const struct imx8m_blk_ctrl_domain_data *data = domain->data;
-	struct imx8m_blk_ctrl *bc = domain->bc;
+	struct imx_blk_ctrl_domain *domain = to_imx_blk_ctrl_domain(genpd);
+	const struct imx_blk_ctrl_domain_data *data = domain->data;
+	struct imx_blk_ctrl *bc = domain->bc;
 
 	/* put devices into reset and disable clocks */
 	if (data->mipi_phy_rst_mask)
@@ -93,7 +93,7 @@  static int imx8m_blk_ctrl_power_off(struct generic_pm_domain *genpd)
 }
 
 static struct generic_pm_domain *
-imx8m_blk_ctrl_xlate(struct of_phandle_args *args, void *data)
+imx_blk_ctrl_xlate(struct of_phandle_args *args, void *data)
 {
 	struct genpd_onecell_data *onecell_data = data;
 	unsigned int index = args->args[0];
@@ -107,11 +107,11 @@  imx8m_blk_ctrl_xlate(struct of_phandle_args *args, void *data)
 
 static struct lock_class_key blk_ctrl_genpd_lock_class;
 
-int imx8m_blk_ctrl_probe(struct platform_device *pdev)
+int imx_blk_ctrl_probe(struct platform_device *pdev)
 {
-	const struct imx8m_blk_ctrl_data *bc_data;
+	const struct imx_blk_ctrl_data *bc_data;
 	struct device *dev = &pdev->dev;
-	struct imx8m_blk_ctrl *bc;
+	struct imx_blk_ctrl *bc;
 	void __iomem *base;
 	int i, ret;
 
@@ -140,13 +140,13 @@  int imx8m_blk_ctrl_probe(struct platform_device *pdev)
 				     "failed to init regmap\n");
 
 	bc->domains = devm_kcalloc(dev, bc_data->num_domains,
-				   sizeof(struct imx8m_blk_ctrl_domain),
+				   sizeof(struct imx_blk_ctrl_domain),
 				   GFP_KERNEL);
 	if (!bc->domains)
 		return -ENOMEM;
 
 	bc->onecell_data.num_domains = bc_data->num_domains;
-	bc->onecell_data.xlate = imx8m_blk_ctrl_xlate;
+	bc->onecell_data.xlate = imx_blk_ctrl_xlate;
 	bc->onecell_data.domains =
 		devm_kcalloc(dev, bc_data->num_domains,
 			     sizeof(struct generic_pm_domain *), GFP_KERNEL);
@@ -159,8 +159,8 @@  int imx8m_blk_ctrl_probe(struct platform_device *pdev)
 				     "failed to attach power domain\n");
 
 	for (i = 0; i < bc_data->num_domains; i++) {
-		const struct imx8m_blk_ctrl_domain_data *data = &bc_data->domains[i];
-		struct imx8m_blk_ctrl_domain *domain = &bc->domains[i];
+		const struct imx_blk_ctrl_domain_data *data = &bc_data->domains[i];
+		struct imx_blk_ctrl_domain *domain = &bc->domains[i];
 		int j;
 
 		domain->data = data;
@@ -184,8 +184,8 @@  int imx8m_blk_ctrl_probe(struct platform_device *pdev)
 		}
 
 		domain->genpd.name = data->name;
-		domain->genpd.power_on = imx8m_blk_ctrl_power_on;
-		domain->genpd.power_off = imx8m_blk_ctrl_power_off;
+		domain->genpd.power_on = imx_blk_ctrl_power_on;
+		domain->genpd.power_off = imx_blk_ctrl_power_off;
 		domain->bc = bc;
 
 		ret = pm_genpd_init(&domain->genpd, NULL, true);
@@ -241,15 +241,15 @@  int imx8m_blk_ctrl_probe(struct platform_device *pdev)
 	return ret;
 }
 
-int imx8m_blk_ctrl_remove(struct platform_device *pdev)
+int imx_blk_ctrl_remove(struct platform_device *pdev)
 {
-	struct imx8m_blk_ctrl *bc = dev_get_drvdata(&pdev->dev);
+	struct imx_blk_ctrl *bc = dev_get_drvdata(&pdev->dev);
 	int i;
 
 	of_genpd_del_provider(pdev->dev.of_node);
 
 	for (i = 0; bc->onecell_data.num_domains; i++) {
-		struct imx8m_blk_ctrl_domain *domain = &bc->domains[i];
+		struct imx_blk_ctrl_domain *domain = &bc->domains[i];
 
 		pm_genpd_remove(&domain->genpd);
 		dev_pm_domain_detach(domain->power_dev, true);
@@ -263,9 +263,9 @@  int imx8m_blk_ctrl_remove(struct platform_device *pdev)
 }
 
 #ifdef CONFIG_PM_SLEEP
-static int imx8m_blk_ctrl_suspend(struct device *dev)
+static int imx_blk_ctrl_suspend(struct device *dev)
 {
-	struct imx8m_blk_ctrl *bc = dev_get_drvdata(dev);
+	struct imx_blk_ctrl *bc = dev_get_drvdata(dev);
 	int ret, i;
 
 	/*
@@ -283,7 +283,7 @@  static int imx8m_blk_ctrl_suspend(struct device *dev)
 	}
 
 	for (i = 0; i < bc->onecell_data.num_domains; i++) {
-		struct imx8m_blk_ctrl_domain *domain = &bc->domains[i];
+		struct imx_blk_ctrl_domain *domain = &bc->domains[i];
 
 		ret = pm_runtime_get_sync(domain->power_dev);
 		if (ret < 0) {
@@ -303,9 +303,9 @@  static int imx8m_blk_ctrl_suspend(struct device *dev)
 	return ret;
 }
 
-static int imx8m_blk_ctrl_resume(struct device *dev)
+static int imx_blk_ctrl_resume(struct device *dev)
 {
-	struct imx8m_blk_ctrl *bc = dev_get_drvdata(dev);
+	struct imx_blk_ctrl *bc = dev_get_drvdata(dev);
 	int i;
 
 	for (i = 0; i < bc->onecell_data.num_domains; i++)
@@ -317,6 +317,6 @@  static int imx8m_blk_ctrl_resume(struct device *dev)
 }
 #endif
 
-const struct dev_pm_ops imx8m_blk_ctrl_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(imx8m_blk_ctrl_suspend, imx8m_blk_ctrl_resume)
+const struct dev_pm_ops imx_blk_ctrl_pm_ops = {
+	SET_SYSTEM_SLEEP_PM_OPS(imx_blk_ctrl_suspend, imx_blk_ctrl_resume)
 };
diff --git a/drivers/soc/imx/imx8m-blk-ctrl.h b/drivers/soc/imx/imx-blk-ctrl.h
similarity index 72%
rename from drivers/soc/imx/imx8m-blk-ctrl.h
rename to drivers/soc/imx/imx-blk-ctrl.h
index 618b3429bb69..8b70e072db1c 100644
--- a/drivers/soc/imx/imx8m-blk-ctrl.h
+++ b/drivers/soc/imx/imx-blk-ctrl.h
@@ -18,18 +18,18 @@ 
 #define BLK_CLK_EN	0x4
 #define BLK_MIPI_RESET_DIV	0x8 /* Mini/Nano DISPLAY_BLK_CTRL only */
 
-struct imx8m_blk_ctrl_domain;
+struct imx_blk_ctrl_domain;
 
-struct imx8m_blk_ctrl {
+struct imx_blk_ctrl {
 	struct device *dev;
 	struct notifier_block power_nb;
 	struct device *bus_power_dev;
 	struct regmap *regmap;
-	struct imx8m_blk_ctrl_domain *domains;
+	struct imx_blk_ctrl_domain *domains;
 	struct genpd_onecell_data onecell_data;
 };
 
-struct imx8m_blk_ctrl_domain_data {
+struct imx_blk_ctrl_domain_data {
 	const char *name;
 	const char * const *clk_names;
 	int num_clks;
@@ -49,24 +49,24 @@  struct imx8m_blk_ctrl_domain_data {
 
 #define DOMAIN_MAX_CLKS 3
 
-struct imx8m_blk_ctrl_domain {
+struct imx_blk_ctrl_domain {
 	struct generic_pm_domain genpd;
-	const struct imx8m_blk_ctrl_domain_data *data;
+	const struct imx_blk_ctrl_domain_data *data;
 	struct clk_bulk_data clks[DOMAIN_MAX_CLKS];
 	struct device *power_dev;
-	struct imx8m_blk_ctrl *bc;
+	struct imx_blk_ctrl *bc;
 };
 
-struct imx8m_blk_ctrl_data {
+struct imx_blk_ctrl_data {
 	int max_reg;
 	notifier_fn_t power_notifier_fn;
-	const struct imx8m_blk_ctrl_domain_data *domains;
+	const struct imx_blk_ctrl_domain_data *domains;
 	int num_domains;
 };
 
-extern const struct dev_pm_ops imx8m_blk_ctrl_pm_ops;
+extern const struct dev_pm_ops imx_blk_ctrl_pm_ops;
 
-int imx8m_blk_ctrl_remove(struct platform_device *pdev);
-int imx8m_blk_ctrl_probe(struct platform_device *pdev);
+int imx_blk_ctrl_remove(struct platform_device *pdev);
+int imx_blk_ctrl_probe(struct platform_device *pdev);
 
 #endif
diff --git a/drivers/soc/imx/imx8mm-blk-ctrl.c b/drivers/soc/imx/imx8mm-blk-ctrl.c
index eb63d28b0157..15f1e431c1f3 100644
--- a/drivers/soc/imx/imx8mm-blk-ctrl.c
+++ b/drivers/soc/imx/imx8mm-blk-ctrl.c
@@ -7,12 +7,12 @@ 
 
 #include <dt-bindings/power/imx8mm-power.h>
 
-#include "imx8m-blk-ctrl.h"
+#include "imx-blk-ctrl.h"
 
 static int imx8mm_vpu_power_notifier(struct notifier_block *nb,
 				     unsigned long action, void *data)
 {
-	struct imx8m_blk_ctrl *bc = container_of(nb, struct imx8m_blk_ctrl,
+	struct imx_blk_ctrl *bc = container_of(nb, struct imx_blk_ctrl,
 						 power_nb);
 
 	if (action != GENPD_NOTIFY_ON && action != GENPD_NOTIFY_PRE_OFF)
@@ -45,7 +45,7 @@  static int imx8mm_vpu_power_notifier(struct notifier_block *nb,
 	return NOTIFY_OK;
 }
 
-static const struct imx8m_blk_ctrl_domain_data imx8mm_vpu_blk_ctl_domain_data[] = {
+static const struct imx_blk_ctrl_domain_data imx8mm_vpu_blk_ctl_domain_data[] = {
 	[IMX8MM_VPUBLK_PD_G1] = {
 		.name = "vpublk-g1",
 		.clk_names = (const char *[]){ "g1", },
@@ -72,7 +72,7 @@  static const struct imx8m_blk_ctrl_domain_data imx8mm_vpu_blk_ctl_domain_data[]
 	},
 };
 
-static const struct imx8m_blk_ctrl_data imx8mm_vpu_blk_ctl_dev_data = {
+static const struct imx_blk_ctrl_data imx8mm_vpu_blk_ctl_dev_data = {
 	.max_reg = 0x18,
 	.power_notifier_fn = imx8mm_vpu_power_notifier,
 	.domains = imx8mm_vpu_blk_ctl_domain_data,
@@ -82,7 +82,7 @@  static const struct imx8m_blk_ctrl_data imx8mm_vpu_blk_ctl_dev_data = {
 static int imx8mm_disp_power_notifier(struct notifier_block *nb,
 				      unsigned long action, void *data)
 {
-	struct imx8m_blk_ctrl *bc = container_of(nb, struct imx8m_blk_ctrl,
+	struct imx_blk_ctrl *bc = container_of(nb, struct imx_blk_ctrl,
 						 power_nb);
 
 	if (action != GENPD_NOTIFY_ON && action != GENPD_NOTIFY_PRE_OFF)
@@ -104,7 +104,7 @@  static int imx8mm_disp_power_notifier(struct notifier_block *nb,
 	return NOTIFY_OK;
 }
 
-static const struct imx8m_blk_ctrl_domain_data imx8mm_disp_blk_ctl_domain_data[] = {
+static const struct imx_blk_ctrl_domain_data imx8mm_disp_blk_ctl_domain_data[] = {
 	[IMX8MM_DISPBLK_PD_CSI_BRIDGE] = {
 		.name = "dispblk-csi-bridge",
 		.clk_names = (const char *[]){ "csi-bridge-axi", "csi-bridge-apb",
@@ -141,7 +141,7 @@  static const struct imx8m_blk_ctrl_domain_data imx8mm_disp_blk_ctl_domain_data[]
 	},
 };
 
-static const struct imx8m_blk_ctrl_data imx8mm_disp_blk_ctl_dev_data = {
+static const struct imx_blk_ctrl_data imx8mm_disp_blk_ctl_dev_data = {
 	.max_reg = 0x2c,
 	.power_notifier_fn = imx8mm_disp_power_notifier,
 	.domains = imx8mm_disp_blk_ctl_domain_data,
@@ -162,11 +162,11 @@  static const struct of_device_id imx8mm_blk_ctrl_of_match[] = {
 MODULE_DEVICE_TABLE(of, imx8mm_blk_ctrl_of_match);
 
 static struct platform_driver imx8mm_blk_ctrl_driver = {
-	.probe = imx8m_blk_ctrl_probe,
-	.remove = imx8m_blk_ctrl_remove,
+	.probe = imx_blk_ctrl_probe,
+	.remove = imx_blk_ctrl_remove,
 	.driver = {
 		.name = "imx8mm-blk-ctrl",
-		.pm = &imx8m_blk_ctrl_pm_ops,
+		.pm = &imx_blk_ctrl_pm_ops,
 		.of_match_table = imx8mm_blk_ctrl_of_match,
 	},
 };
diff --git a/drivers/soc/imx/imx8mn-blk-ctrl.c b/drivers/soc/imx/imx8mn-blk-ctrl.c
index 20f53cd4e387..932b81515792 100644
--- a/drivers/soc/imx/imx8mn-blk-ctrl.c
+++ b/drivers/soc/imx/imx8mn-blk-ctrl.c
@@ -7,12 +7,12 @@ 
 
 #include <dt-bindings/power/imx8mn-power.h>
 
-#include "imx8m-blk-ctrl.h"
+#include "imx-blk-ctrl.h"
 
 static int imx8mn_disp_power_notifier(struct notifier_block *nb,
 				      unsigned long action, void *data)
 {
-	struct imx8m_blk_ctrl *bc = container_of(nb, struct imx8m_blk_ctrl,
+	struct imx_blk_ctrl *bc = container_of(nb, struct imx_blk_ctrl,
 						 power_nb);
 
 	if (action != GENPD_NOTIFY_ON && action != GENPD_NOTIFY_PRE_OFF)
@@ -34,7 +34,7 @@  static int imx8mn_disp_power_notifier(struct notifier_block *nb,
 	return NOTIFY_OK;
 }
 
-static const struct imx8m_blk_ctrl_domain_data imx8mn_disp_blk_ctl_domain_data[] = {
+static const struct imx_blk_ctrl_domain_data imx8mn_disp_blk_ctl_domain_data[] = {
 	[IMX8MN_DISPBLK_PD_MIPI_DSI] = {
 		.name = "dispblk-mipi-dsi",
 		.clk_names = (const char *[]){ "dsi-pclk", "dsi-ref", },
@@ -72,7 +72,7 @@  static const struct imx8m_blk_ctrl_domain_data imx8mn_disp_blk_ctl_domain_data[]
 	},
 };
 
-static const struct imx8m_blk_ctrl_data imx8mn_disp_blk_ctl_dev_data = {
+static const struct imx_blk_ctrl_data imx8mn_disp_blk_ctl_dev_data = {
 	.max_reg = 0x84,
 	.power_notifier_fn = imx8mn_disp_power_notifier,
 	.domains = imx8mn_disp_blk_ctl_domain_data,
@@ -90,11 +90,11 @@  static const struct of_device_id imx8mn_blk_ctrl_of_match[] = {
 MODULE_DEVICE_TABLE(of, imx8mn_blk_ctrl_of_match);
 
 static struct platform_driver imx8mn_blk_ctrl_driver = {
-	.probe = imx8m_blk_ctrl_probe,
-	.remove = imx8m_blk_ctrl_remove,
+	.probe = imx_blk_ctrl_probe,
+	.remove = imx_blk_ctrl_remove,
 	.driver = {
 		.name = "imx8mn-blk-ctrl",
-		.pm = &imx8m_blk_ctrl_pm_ops,
+		.pm = &imx_blk_ctrl_pm_ops,
 		.of_match_table = imx8mn_blk_ctrl_of_match,
 	},
 };