Skip to contentSkip to conversation

arm/arm64: mediatek: Fix mmsys device probing

PATCH In review Matthias Brugger 5 participants 27 messages Nov 14, 2017 – Apr 20, 2018

Subsystems (5)
lore
Share & tools
lore

Matthias Brugger

author maintainer
#0 lore raw

cover arm/arm64: mediatek: Fix mmsys device probing

MMSYS in Mediatek SoCs has some registers to control clock gates (which is used in the clk driver) and some registers to set the routing and enable the differnet blocks of the display subsystem.

Up to now both drivers, clock and drm are probed with the same device tree compatible. But only the first driver get probed, which in effect breaks graphics on mt8173 and mt2701.

This patch set introduces a new mfd device, which binds against the mmsys compatible and takes care of probing the needed devices. It was tested on the bananapi-r2 and the Acer R13 Chromebook.

Matthias Brugger (8):
drm/mediatek: Use regmap for register access
mfd: mtk-mmsys: Add mmsys driver
drm/mediatek: mt2701: switch to mfd probing.
clk: mediatek: mt2701-mm: switch to mfd device
mfd: mtk-mmsys: Add mt8173 nodes
drm/mediatek: Add mfd support for mt8173
clk: mediatek: mt8173-mm: switch to mfd device
MAINTAINERS: update Mediatek Soc entry

 MAINTAINERS                             |   2 +
 drivers/clk/mediatek/clk-mt2701-mm.c    |  13 ++--
 drivers/clk/mediatek/clk-mt8173.c       |  21 ++++++-
 drivers/gpu/drm/mediatek/mtk_drm_crtc.c |   4 +-
 drivers/gpu/drm/mediatek/mtk_drm_ddp.c  |  30 +++++----
 drivers/gpu/drm/mediatek/mtk_drm_ddp.h  |   4 +-
 drivers/gpu/drm/mediatek/mtk_drm_drv.c  |  35 ++++++-----
 drivers/gpu/drm/mediatek/mtk_drm_drv.h  |   2 +-
 drivers/mfd/Kconfig                     |   9 +++
 drivers/mfd/Makefile                    |   2 +
 drivers/mfd/mtk-mmsys.c                 | 105 ++++++++++++++++++++++++++++++++
 include/linux/mfd/mmsys.h               |  18 ++++++
 12 files changed, 200 insertions(+), 45 deletions(-)
 create mode 100644 drivers/mfd/mtk-mmsys.c
 create mode 100644 include/linux/mfd/mmsys.h
Signature · 1 line
2.14.2
author maintainer
#1 lore raw

PATCH 1/8 drm/mediatek: Use regmap for register access

The mmsys memory space is shared between the drm and the clk driver. Use regmap to access it.

---
 drivers/gpu/drm/mediatek/mtk_drm_crtc.c |  4 ++--
 drivers/gpu/drm/mediatek/mtk_drm_ddp.c  | 30 +++++++++++++++++-------------
 drivers/gpu/drm/mediatek/mtk_drm_ddp.h  |  4 ++--
 drivers/gpu/drm/mediatek/mtk_drm_drv.c  | 13 ++++---------
 drivers/gpu/drm/mediatek/mtk_drm_drv.h  |  2 +-
 5 files changed, 26 insertions(+), 27 deletions(-)
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +2 -2
index 658b8dd45b83..4c65873b4867 100644
@@ -33,7 +33,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
+ * @config_regs: regmap mapped mmsys configuration register space
  * @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
@@ -48,7 +48,7 @@ struct mtk_drm_crtc {
 	struct drm_plane		planes[OVL_LAYER_NR];
 	bool				pending_planes;
 
-	void __iomem			*config_regs;
+	struct regmap			*config_regs;
 	struct mtk_disp_mutex		*mutex;
 	unsigned int			ddp_comp_nr;
 	struct mtk_ddp_comp		**ddp_comp;
drivers/gpu/drm/mediatek/mtk_drm_ddp.c +17 -13
index 8130f3dab661..1227d6db07da 100644
@@ -185,16 +185,16 @@ static unsigned int mtk_ddp_sel_in(enum mtk_ddp_comp_id cur,
 	return value;
 }
 
-static void mtk_ddp_sout_sel(void __iomem *config_regs,
+static void mtk_ddp_sout_sel(struct regmap *config_regs,
 			     enum mtk_ddp_comp_id cur,
 			     enum mtk_ddp_comp_id next)
 {
 	if (cur == DDP_COMPONENT_BLS && next == DDP_COMPONENT_DSI0)
-		writel_relaxed(BLS_TO_DSI_RDMA1_TO_DPI1,
-			       config_regs + DISP_REG_CONFIG_OUT_SEL);
+		regmap_write(config_regs, DISP_REG_CONFIG_OUT_SEL,
+				BLS_TO_DSI_RDMA1_TO_DPI1);
 }
 
-void mtk_ddp_add_comp_to_path(void __iomem *config_regs,
+void mtk_ddp_add_comp_to_path(struct regmap *config_regs,
 			      enum mtk_ddp_comp_id cur,
 			      enum mtk_ddp_comp_id next)
 {
@@ -202,20 +202,22 @@ void mtk_ddp_add_comp_to_path(void __iomem *config_regs,
 
 	value = mtk_ddp_mout_en(cur, next, &addr);
 	if (value) {
-		reg = readl_relaxed(config_regs + addr) | value;
-		writel_relaxed(reg, config_regs + addr);
+		regmap_read(config_regs, addr, &reg);
+		reg |= value;
+		regmap_write(config_regs, addr, reg);
 	}
 
 	mtk_ddp_sout_sel(config_regs, cur, next);
 
 	value = mtk_ddp_sel_in(cur, next, &addr);
 	if (value) {
-		reg = readl_relaxed(config_regs + addr) | value;
-		writel_relaxed(reg, config_regs + addr);
+		regmap_read(config_regs, addr, &reg);
+		reg |= value;
+		regmap_write(config_regs, addr, reg);
 	}
 }
 
-void mtk_ddp_remove_comp_from_path(void __iomem *config_regs,
+void mtk_ddp_remove_comp_from_path(struct regmap *config_regs,
 				   enum mtk_ddp_comp_id cur,
 				   enum mtk_ddp_comp_id next)
 {
@@ -223,14 +225,16 @@ void mtk_ddp_remove_comp_from_path(void __iomem *config_regs,
 
 	value = mtk_ddp_mout_en(cur, next, &addr);
 	if (value) {
-		reg = readl_relaxed(config_regs + addr) & ~value;
-		writel_relaxed(reg, config_regs + addr);
+		regmap_read(config_regs, addr, &reg);
+		reg &= ~value;
+		regmap_write(config_regs, addr, reg);
 	}
 
 	value = mtk_ddp_sel_in(cur, next, &addr);
 	if (value) {
-		reg = readl_relaxed(config_regs + addr) & ~value;
-		writel_relaxed(reg, config_regs + addr);
+		regmap_read(config_regs, addr, &reg);
+		reg &= ~value;
+		regmap_write(config_regs, addr, reg);
 	}
 }
 
drivers/gpu/drm/mediatek/mtk_drm_ddp.h +2 -2
index f9a799168077..32e12f33b76a 100644
@@ -20,10 +20,10 @@ struct regmap;
 struct device;
 struct mtk_disp_mutex;
 
-void mtk_ddp_add_comp_to_path(void __iomem *config_regs,
+void mtk_ddp_add_comp_to_path(struct regmap *config_regs,
 			      enum mtk_ddp_comp_id cur,
 			      enum mtk_ddp_comp_id next);
-void mtk_ddp_remove_comp_from_path(void __iomem *config_regs,
+void mtk_ddp_remove_comp_from_path(struct regmap *config_regs,
 				   enum mtk_ddp_comp_id cur,
 				   enum mtk_ddp_comp_id next);
 
drivers/gpu/drm/mediatek/mtk_drm_drv.c +4 -9
index b2ad19bd1e00..dd249cf5121e 100644
@@ -21,6 +21,7 @@
 #include <drm/drm_of.h>
 #include <linux/component.h>
 #include <linux/iommu.h>
+#include <linux/mfd/syscon.h>
 #include <linux/of_address.h>
 #include <linux/of_platform.h>
 #include <linux/pm_runtime.h>
@@ -393,7 +394,6 @@ static int mtk_drm_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct mtk_drm_private *private;
-	struct resource *mem;
 	struct device_node *node;
 	struct component_match *match = NULL;
 	int ret;
@@ -407,14 +407,9 @@ static int mtk_drm_probe(struct platform_device *pdev)
 	INIT_WORK(&private->commit.work, mtk_atomic_work);
 	private->data = of_device_get_match_data(dev);
 
-	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	private->config_regs = devm_ioremap_resource(dev, mem);
-	if (IS_ERR(private->config_regs)) {
-		ret = PTR_ERR(private->config_regs);
-		dev_err(dev, "Failed to ioremap mmsys-config resource: %d\n",
-			ret);
-		return ret;
-	}
+	private->config_regs = syscon_node_to_regmap(dev->of_node);
+	if (IS_ERR(private->config_regs))
+		return PTR_ERR(private->config_regs);
 
 	/* Iterate over sibling DISP function blocks */
 	for_each_child_of_node(dev->of_node->parent, node) {
drivers/gpu/drm/mediatek/mtk_drm_drv.h +1 -1
index 4edc0023684c..86cec19193c4 100644
@@ -44,7 +44,7 @@ struct mtk_drm_private {
 
 	struct device_node *mutex_node;
 	struct device *mutex_dev;
-	void __iomem *config_regs;
+	struct regmap *config_regs;
 	struct device_node *comp_node[DDP_COMPONENT_ID_MAX];
 	struct mtk_ddp_comp *ddp_comp[DDP_COMPONENT_ID_MAX];
 	const struct mtk_mmsys_driver_data *data;
Signature · 1 line
2.14.2
Acked-by on v1 1/8
#2 lore raw

Re: [PATCH 1/8] drm/mediatek: Use regmap for register access

Hi, Matthias:

Quoted 4 lines · Matthias Brugger

The mmsys memory space is shared between the drm and the clk driver. Use regmap to access it.

Quoted 172 lines
---
 drivers/gpu/drm/mediatek/mtk_drm_crtc.c |  4 ++--
 drivers/gpu/drm/mediatek/mtk_drm_ddp.c  | 30 +++++++++++++++++-------------
 drivers/gpu/drm/mediatek/mtk_drm_ddp.h  |  4 ++--
 drivers/gpu/drm/mediatek/mtk_drm_drv.c  | 13 ++++---------
 drivers/gpu/drm/mediatek/mtk_drm_drv.h  |  2 +-
 5 files changed, 26 insertions(+), 27 deletions(-)
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +2 -2
index 658b8dd45b83..4c65873b4867 100644
@@ -33,7 +33,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
+ * @config_regs: regmap mapped mmsys configuration register space
  * @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
@@ -48,7 +48,7 @@ struct mtk_drm_crtc {
 	struct drm_plane		planes[OVL_LAYER_NR];
 	bool				pending_planes;
 
-	void __iomem			*config_regs;
+	struct regmap			*config_regs;
 	struct mtk_disp_mutex		*mutex;
 	unsigned int			ddp_comp_nr;
 	struct mtk_ddp_comp		**ddp_comp;
drivers/gpu/drm/mediatek/mtk_drm_ddp.c +17 -13
index 8130f3dab661..1227d6db07da 100644
@@ -185,16 +185,16 @@ static unsigned int mtk_ddp_sel_in(enum mtk_ddp_comp_id cur,
 	return value;
 }
 
-static void mtk_ddp_sout_sel(void __iomem *config_regs,
+static void mtk_ddp_sout_sel(struct regmap *config_regs,
 			     enum mtk_ddp_comp_id cur,
 			     enum mtk_ddp_comp_id next)
 {
 	if (cur == DDP_COMPONENT_BLS && next == DDP_COMPONENT_DSI0)
-		writel_relaxed(BLS_TO_DSI_RDMA1_TO_DPI1,
-			       config_regs + DISP_REG_CONFIG_OUT_SEL);
+		regmap_write(config_regs, DISP_REG_CONFIG_OUT_SEL,
+				BLS_TO_DSI_RDMA1_TO_DPI1);
 }
 
-void mtk_ddp_add_comp_to_path(void __iomem *config_regs,
+void mtk_ddp_add_comp_to_path(struct regmap *config_regs,
 			      enum mtk_ddp_comp_id cur,
 			      enum mtk_ddp_comp_id next)
 {
@@ -202,20 +202,22 @@ void mtk_ddp_add_comp_to_path(void __iomem *config_regs,
 
 	value = mtk_ddp_mout_en(cur, next, &addr);
 	if (value) {
-		reg = readl_relaxed(config_regs + addr) | value;
-		writel_relaxed(reg, config_regs + addr);
+		regmap_read(config_regs, addr, &reg);
+		reg |= value;
+		regmap_write(config_regs, addr, reg);
 	}
 
 	mtk_ddp_sout_sel(config_regs, cur, next);
 
 	value = mtk_ddp_sel_in(cur, next, &addr);
 	if (value) {
-		reg = readl_relaxed(config_regs + addr) | value;
-		writel_relaxed(reg, config_regs + addr);
+		regmap_read(config_regs, addr, &reg);
+		reg |= value;
+		regmap_write(config_regs, addr, reg);
 	}
 }
 
-void mtk_ddp_remove_comp_from_path(void __iomem *config_regs,
+void mtk_ddp_remove_comp_from_path(struct regmap *config_regs,
 				   enum mtk_ddp_comp_id cur,
 				   enum mtk_ddp_comp_id next)
 {
@@ -223,14 +225,16 @@ void mtk_ddp_remove_comp_from_path(void __iomem *config_regs,
 
 	value = mtk_ddp_mout_en(cur, next, &addr);
 	if (value) {
-		reg = readl_relaxed(config_regs + addr) & ~value;
-		writel_relaxed(reg, config_regs + addr);
+		regmap_read(config_regs, addr, &reg);
+		reg &= ~value;
+		regmap_write(config_regs, addr, reg);
 	}
 
 	value = mtk_ddp_sel_in(cur, next, &addr);
 	if (value) {
-		reg = readl_relaxed(config_regs + addr) & ~value;
-		writel_relaxed(reg, config_regs + addr);
+		regmap_read(config_regs, addr, &reg);
+		reg &= ~value;
+		regmap_write(config_regs, addr, reg);
 	}
 }
 
drivers/gpu/drm/mediatek/mtk_drm_ddp.h +2 -2
index f9a799168077..32e12f33b76a 100644
@@ -20,10 +20,10 @@ struct regmap;
 struct device;
 struct mtk_disp_mutex;
 
-void mtk_ddp_add_comp_to_path(void __iomem *config_regs,
+void mtk_ddp_add_comp_to_path(struct regmap *config_regs,
 			      enum mtk_ddp_comp_id cur,
 			      enum mtk_ddp_comp_id next);
-void mtk_ddp_remove_comp_from_path(void __iomem *config_regs,
+void mtk_ddp_remove_comp_from_path(struct regmap *config_regs,
 				   enum mtk_ddp_comp_id cur,
 				   enum mtk_ddp_comp_id next);
 
drivers/gpu/drm/mediatek/mtk_drm_drv.c +4 -9
index b2ad19bd1e00..dd249cf5121e 100644
@@ -21,6 +21,7 @@
 #include <drm/drm_of.h>
 #include <linux/component.h>
 #include <linux/iommu.h>
+#include <linux/mfd/syscon.h>
 #include <linux/of_address.h>
 #include <linux/of_platform.h>
 #include <linux/pm_runtime.h>
@@ -393,7 +394,6 @@ static int mtk_drm_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct mtk_drm_private *private;
-	struct resource *mem;
 	struct device_node *node;
 	struct component_match *match = NULL;
 	int ret;
@@ -407,14 +407,9 @@ static int mtk_drm_probe(struct platform_device *pdev)
 	INIT_WORK(&private->commit.work, mtk_atomic_work);
 	private->data = of_device_get_match_data(dev);
 
-	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	private->config_regs = devm_ioremap_resource(dev, mem);
-	if (IS_ERR(private->config_regs)) {
-		ret = PTR_ERR(private->config_regs);
-		dev_err(dev, "Failed to ioremap mmsys-config resource: %d\n",
-			ret);
-		return ret;
-	}
+	private->config_regs = syscon_node_to_regmap(dev->of_node);
+	if (IS_ERR(private->config_regs))
+		return PTR_ERR(private->config_regs);
 
 	/* Iterate over sibling DISP function blocks */
 	for_each_child_of_node(dev->of_node->parent, node) {
drivers/gpu/drm/mediatek/mtk_drm_drv.h +1 -1
index 4edc0023684c..86cec19193c4 100644
@@ -44,7 +44,7 @@ struct mtk_drm_private {
 
 	struct device_node *mutex_node;
 	struct device *mutex_dev;
-	void __iomem *config_regs;
+	struct regmap *config_regs;
 	struct device_node *comp_node[DDP_COMPONENT_ID_MAX];
 	struct mtk_ddp_comp *ddp_comp[DDP_COMPONENT_ID_MAX];
 	const struct mtk_mmsys_driver_data *data;
maintainer Reviewed-by on v1 1/8
#3 lore raw

Re: [PATCH 1/8] drm/mediatek: Use regmap for register access

In reply to Matthias Brugger

Hi Matthias,

Quoted 11 lines · Matthias Brugger

The mmsys memory space is shared between the drm and the clk driver. Use regmap to access it.

---
 drivers/gpu/drm/mediatek/mtk_drm_crtc.c |  4 ++--
 drivers/gpu/drm/mediatek/mtk_drm_ddp.c  | 30 +++++++++++++++++-------------
 drivers/gpu/drm/mediatek/mtk_drm_ddp.h  |  4 ++--
 drivers/gpu/drm/mediatek/mtk_drm_drv.c  | 13 ++++---------
 drivers/gpu/drm/mediatek/mtk_drm_drv.h  |  2 +-
 5 files changed, 26 insertions(+), 27 deletions(-)

[...]

Quoted 26 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp.c +4 -4
index 8130f3dab661..1227d6db07da 100644
@@ -185,16 +185,16 @@ static unsigned int mtk_ddp_sel_in(enum mtk_ddp_comp_id cur,
 	return value;
 }
 
-static void mtk_ddp_sout_sel(void __iomem *config_regs,
+static void mtk_ddp_sout_sel(struct regmap *config_regs,
 			     enum mtk_ddp_comp_id cur,
 			     enum mtk_ddp_comp_id next)
 {
 	if (cur == DDP_COMPONENT_BLS && next == DDP_COMPONENT_DSI0)
-		writel_relaxed(BLS_TO_DSI_RDMA1_TO_DPI1,
-			       config_regs + DISP_REG_CONFIG_OUT_SEL);
+		regmap_write(config_regs, DISP_REG_CONFIG_OUT_SEL,
+				BLS_TO_DSI_RDMA1_TO_DPI1);
 }
 
-void mtk_ddp_add_comp_to_path(void __iomem *config_regs,
+void mtk_ddp_add_comp_to_path(struct regmap *config_regs,
 			      enum mtk_ddp_comp_id cur,
 			      enum mtk_ddp_comp_id next)
 {

drivers/gpu/drm/mediatek/mtk_drm_ddp.c void mtk_ddp_add_comp_to_path(void __iomem *config_regs, · line 207

Quoted 8 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp.c +3 -2
@@ -202,20 +202,22 @@ void mtk_ddp_add_comp_to_path(void __iomem *config_regs,
 
 	value = mtk_ddp_mout_en(cur, next, &addr);
 	if (value) {
-		reg = readl_relaxed(config_regs + addr) | value;
-		writel_relaxed(reg, config_regs + addr);
+		regmap_read(config_regs, addr, &reg);
+		reg |= value;
+		regmap_write(config_regs, addr, reg);

You can use

		regmap_update_bits(config_regs, addr, value, value);

here and drop the local variable reg.

drivers/gpu/drm/mediatek/mtk_drm_ddp.c void mtk_ddp_add_comp_to_path(void __iomem *config_regs, · line 216

Quoted 11 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp.c +3 -2
 	}
 
 	mtk_ddp_sout_sel(config_regs, cur, next);
 
 	value = mtk_ddp_sel_in(cur, next, &addr);
 	if (value) {
-		reg = readl_relaxed(config_regs + addr) | value;
-		writel_relaxed(reg, config_regs + addr);
+		regmap_read(config_regs, addr, &reg);
+		reg |= value;
+		regmap_write(config_regs, addr, reg);
		regmap_update_bits(config_regs, addr, value, value);
Quoted 9 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp.c +1 -1
 	}
 }
 
-void mtk_ddp_remove_comp_from_path(void __iomem *config_regs,
+void mtk_ddp_remove_comp_from_path(struct regmap *config_regs,
 				   enum mtk_ddp_comp_id cur,
 				   enum mtk_ddp_comp_id next)
 {

drivers/gpu/drm/mediatek/mtk_drm_ddp.c void mtk_ddp_remove_comp_from_path(void __iomem *config_regs, · line 230

Quoted 8 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp.c +3 -2
@@ -223,14 +225,16 @@ void mtk_ddp_remove_comp_from_path(void __iomem *config_regs,
 
 	value = mtk_ddp_mout_en(cur, next, &addr);
 	if (value) {
-		reg = readl_relaxed(config_regs + addr) & ~value;
-		writel_relaxed(reg, config_regs + addr);
+		regmap_read(config_regs, addr, &reg);
+		reg &= ~value;
+		regmap_write(config_regs, addr, reg);
		regmap_update_bits(config_regs, addr, value, 0);

drivers/gpu/drm/mediatek/mtk_drm_ddp.c void mtk_ddp_remove_comp_from_path(void __iomem *config_regs, · line 237

Quoted 9 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp.c +3 -2
 	}
 
 	value = mtk_ddp_sel_in(cur, next, &addr);
 	if (value) {
-		reg = readl_relaxed(config_regs + addr) & ~value;
-		writel_relaxed(reg, config_regs + addr);
+		regmap_read(config_regs, addr, &reg);
+		reg &= ~value;
+		regmap_write(config_regs, addr, reg);
		regmap_update_bits(config_regs, addr, value, 0);

regards
Philipp

author maintainer
#4 lore raw

Re: [PATCH 1/8] drm/mediatek: Use regmap for register access

Hi Philipp,

Quoted 15 lines · Philipp Zabel

Hi Matthias,

Quoted 11 lines · Matthias Brugger

The mmsys memory space is shared between the drm and the clk driver. Use regmap to access it.

---
 drivers/gpu/drm/mediatek/mtk_drm_crtc.c |  4 ++--
 drivers/gpu/drm/mediatek/mtk_drm_ddp.c  | 30 +++++++++++++++++-------------
 drivers/gpu/drm/mediatek/mtk_drm_ddp.h  |  4 ++--
 drivers/gpu/drm/mediatek/mtk_drm_drv.c  | 13 ++++---------
 drivers/gpu/drm/mediatek/mtk_drm_drv.h  |  2 +-
 5 files changed, 26 insertions(+), 27 deletions(-)

[...]

[...]

Quoted 12 lines

drivers/gpu/drm/mediatek/mtk_drm_ddp.c void mtk_ddp_remove_comp_from_path(void __iomem *config_regs, · line 237

Quoted 9 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp.c +3 -2
 	}
 
 	value = mtk_ddp_sel_in(cur, next, &addr);
 	if (value) {
-		reg = readl_relaxed(config_regs + addr) & ~value;
-		writel_relaxed(reg, config_regs + addr);
+		regmap_read(config_regs, addr, &reg);
+		reg &= ~value;
+		regmap_write(config_regs, addr, reg);
		regmap_update_bits(config_regs, addr, value, 0);
Quoted 2 lines

Thanks for having a look on that.

I'll update the next version with regmap_update_bits and leave your Reviewed-by, hope that's ok.

Regards,
Matthias

maintainer
#5 lore raw

Re: [PATCH 1/8] drm/mediatek: Use regmap for register access

Hi Matthias,

Quoted 33 lines · Matthias Brugger

Hi Philipp,

Quoted 16 lines · Philipp Zabel

Hi Matthias,

Quoted 11 lines · Matthias Brugger

The mmsys memory space is shared between the drm and the clk driver. Use regmap to access it.

---
 drivers/gpu/drm/mediatek/mtk_drm_crtc.c |  4 ++--
 drivers/gpu/drm/mediatek/mtk_drm_ddp.c  | 30 +++++++++++++++++-------------
 drivers/gpu/drm/mediatek/mtk_drm_ddp.h  |  4 ++--
 drivers/gpu/drm/mediatek/mtk_drm_drv.c  | 13 ++++---------
 drivers/gpu/drm/mediatek/mtk_drm_drv.h  |  2 +-
 5 files changed, 26 insertions(+), 27 deletions(-)

[...]

[...]

Quoted 12 lines

drivers/gpu/drm/mediatek/mtk_drm_ddp.c void mtk_ddp_remove_comp_from_path(void __iomem *config_regs, · line 237

Quoted 9 lines
drivers/gpu/drm/mediatek/mtk_drm_ddp.c +3 -2
 	}
 
 	value = mtk_ddp_sel_in(cur, next, &addr);
 	if (value) {
-		reg = readl_relaxed(config_regs + addr) & ~value;
-		writel_relaxed(reg, config_regs + addr);
+		regmap_read(config_regs, addr, &reg);
+		reg &= ~value;
+		regmap_write(config_regs, addr, reg);
		regmap_update_bits(config_regs, addr, value, 0);
Quoted 7 lines
Quoted 2 lines

Thanks for having a look on that.

I'll update the next version with regmap_update_bits and leave your Reviewed-by, hope that's ok.

Yes, that's fine.

regards
Philipp

author maintainer
#6 lore raw

PATCH 2/8 mfd: mtk-mmsys: Add mmsys driver

In reply to Matthias Brugger

The MMSYS subsystem includes clocks and drm components. This patch adds a MFD device to probe both drivers from the same device tree compatible.

---
 drivers/mfd/Kconfig       |  9 +++++
 drivers/mfd/Makefile      |  2 ++
 drivers/mfd/mtk-mmsys.c   | 91 +++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/mfd/mmsys.h | 18 ++++++++++
 4 files changed, 120 insertions(+)
 create mode 100644 drivers/mfd/mtk-mmsys.c
 create mode 100644 include/linux/mfd/mmsys.h
drivers/mfd/Kconfig +9 -0
index fc5e4fef89d2..3250ce5d205a 100644
@@ -368,6 +368,15 @@ config MFD_MC13XXX_I2C
 	help
 	  Select this if your MC13xxx is connected via an I2C bus.
 
+config MFD_MEDIATEK_MMSYS
+	tristate "Mediatek MMSYS interface"
+	select MDF_CORE
+	select REGMAP_MMIO
+	help
+	  Select this if you have a MMSYS subsystem in your SoC. The
+	  MMSYS subsystem has at least a clock driver part and some
+	  DRM components.
+
 config MFD_MXS_LRADC
 	tristate "Freescale i.MX23/i.MX28 LRADC"
 	depends on ARCH_MXS || COMPILE_TEST
drivers/mfd/Makefile +2 -0
index 8703ff17998e..d4fc99df784c 100644
@@ -100,6 +100,8 @@ obj-$(CONFIG_MFD_MC13XXX)	+= mc13xxx-core.o
 obj-$(CONFIG_MFD_MC13XXX_SPI)	+= mc13xxx-spi.o
 obj-$(CONFIG_MFD_MC13XXX_I2C)	+= mc13xxx-i2c.o
 
+obj-$(CONFIG_MFD_MEDIATEK_MMSYS) += mtk-mmsys.o
+
 obj-$(CONFIG_MFD_CORE)		+= mfd-core.o
 
 obj-$(CONFIG_EZX_PCAP)		+= ezx-pcap.o
drivers/mfd/mtk-mmsys.c new file +91 -0

91 lines not on this page · raw message

include/linux/mfd/mmsys.h new file +18 -0
new file mode 100644
index 000000000000..274b9ee03ada
@@ -0,0 +1,18 @@
+/* Header of MMSYS MFD core driver for Mediatek platforms
+ *
+ * Copyright (c) 2017 Matthias Brugger <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License version 2 as published by the
+ * Free Software Foundation.
+ */
+
+#ifndef __MEDIATEK_MMSYS__H__
+#define __MEDIATEK_MMSYS__H__
+
+struct mmsys_dev {
+	struct device		*dev;
+	struct device_node	*of_node;
+};
+
+#endif
Signature · 1 line
2.14.2
#7 lore raw

Re: [PATCH 2/8] mfd: mtk-mmsys: Add mmsys driver

Hi, Matthias:

Quoted 117 lines · Matthias Brugger

The MMSYS subsystem includes clocks and drm components. This patch adds a MFD device to probe both drivers from the same device tree compatible.

---
 drivers/mfd/Kconfig       |  9 +++++
 drivers/mfd/Makefile      |  2 ++
 drivers/mfd/mtk-mmsys.c   | 91 +++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/mfd/mmsys.h | 18 ++++++++++
 4 files changed, 120 insertions(+)
 create mode 100644 drivers/mfd/mtk-mmsys.c
 create mode 100644 include/linux/mfd/mmsys.h
drivers/mfd/Kconfig +9 -0
index fc5e4fef89d2..3250ce5d205a 100644
@@ -368,6 +368,15 @@ config MFD_MC13XXX_I2C
 	help
 	  Select this if your MC13xxx is connected via an I2C bus.
 
+config MFD_MEDIATEK_MMSYS
+	tristate "Mediatek MMSYS interface"
+	select MDF_CORE
+	select REGMAP_MMIO
+	help
+	  Select this if you have a MMSYS subsystem in your SoC. The
+	  MMSYS subsystem has at least a clock driver part and some
+	  DRM components.
+
 config MFD_MXS_LRADC
 	tristate "Freescale i.MX23/i.MX28 LRADC"
 	depends on ARCH_MXS || COMPILE_TEST
drivers/mfd/Makefile +2 -0
index 8703ff17998e..d4fc99df784c 100644
@@ -100,6 +100,8 @@ obj-$(CONFIG_MFD_MC13XXX)	+= mc13xxx-core.o
 obj-$(CONFIG_MFD_MC13XXX_SPI)	+= mc13xxx-spi.o
 obj-$(CONFIG_MFD_MC13XXX_I2C)	+= mc13xxx-i2c.o
 
+obj-$(CONFIG_MFD_MEDIATEK_MMSYS) += mtk-mmsys.o
+
 obj-$(CONFIG_MFD_CORE)		+= mfd-core.o
 
 obj-$(CONFIG_EZX_PCAP)		+= ezx-pcap.o
drivers/mfd/mtk-mmsys.c new file +64 -0
new file mode 100644
index 000000000000..102b491aa28f
@@ -0,0 +1,91 @@
+/*
+ * mtk-mmsys.c  --  Mediatek MMSYS multi-function driver
+ *
+ *  Copyright (c) 2017 Matthias Brugger <[email protected]>
+ *
+ * Author: Matthias Brugger <[email protected]>
+ *
+ * For licencing details see kernel-base/COPYING
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/mfd/core.h>
+#include <linux/mfd/mmsys.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_device.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+
+enum {
+	MMSYS_MT2701 = 1,
+};
+
+static const struct mfd_cell mmsys_mt2701_devs[] = {
+	{ .name = "clk-mt2701-mm", },
+	{ .name = "drm-mt2701-mm", },
+};
+
+static int mmsys_probe(struct platform_device *pdev)
+{
+	struct mmsys_dev *private;
+	const struct mfd_cell *mmsys_cells;
+	int nr_cells;
+	long id;
+	int ret;
+
+	id = (long) of_device_get_match_data(&pdev->dev);
+	if (!id) {
+		dev_err(&pdev->dev, "of_device_get match_data() failed\n");
+		return -EINVAL;
+	}
+
+	switch (id) {
+	case MMSYS_MT2701:
+		mmsys_cells = mmsys_mt2701_devs;
+		nr_cells = ARRAY_SIZE(mmsys_mt2701_devs);
+		break;
+	default:
+		return -ENODEV;
+	}
+
+	private = devm_kzalloc(&pdev->dev, sizeof(*private), GFP_KERNEL);
+	if (!private)
+		return -ENOMEM;
+
+	private->dev = &pdev->dev;
+	dev_set_drvdata(private->dev, private);
+
+	private->of_node = pdev->dev.of_node;
+
+	ret = devm_mfd_add_devices(private->dev, 0, mmsys_cells, nr_cells,
+					NULL, 0, NULL);

drivers/mfd/mtk-mmsys.c line 74

Quoted 10 lines
drivers/mfd/mtk-mmsys.c new file +10 -0
+	if (ret) {
+		dev_err(&pdev->dev, "failed to add MFD devices %d\n", ret);
+		return ret;
+	}
+
+	return 0;
+};
+
+static const struct of_device_id of_match_mmsys[] = {
+	{ .compatible = "mediatek,mt2701-mmsys",

Because this driver replace the original "mediatek,mt2701-mmsys" driver, could you modify the binding document of "mediatek,mt2701-mmsys" [1]?

[1]
https://www.kernel.org/doc/Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.txt

Regards,
CK

Quoted 41 lines
drivers/mfd/mtk-mmsys.c new file +17 -0
+	  .data = (void *) MMSYS_MT2701,
+	},
+	{ /* sentinel */ },
+};
+
+static struct platform_driver mmsys_drv = {
+	.probe = mmsys_probe,
+	.driver = {
+		.name = "mediatek-mmysys",
+		.of_match_table = of_match_ptr(of_match_mmsys),
+	},
+};
+
+builtin_platform_driver(mmsys_drv);
+
+MODULE_DESCRIPTION("Mediatek MMSYS multi-function driver");
+MODULE_LICENSE("GPL");
include/linux/mfd/mmsys.h new file +18 -0
new file mode 100644
index 000000000000..274b9ee03ada
@@ -0,0 +1,18 @@
+/* Header of MMSYS MFD core driver for Mediatek platforms
+ *
+ * Copyright (c) 2017 Matthias Brugger <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License version 2 as published by the
+ * Free Software Foundation.
+ */
+
+#ifndef __MEDIATEK_MMSYS__H__
+#define __MEDIATEK_MMSYS__H__
+
+struct mmsys_dev {
+	struct device		*dev;
+	struct device_node	*of_node;
+};
+
+#endif
author maintainer
#8 lore raw

Re: [PATCH 2/8] mfd: mtk-mmsys: Add mmsys driver

Quoted 9 lines · CK Hu

drivers/mfd/mtk-mmsys.c line 74

Quoted 2 lines
drivers/mfd/mtk-mmsys.c new file +2 -0
+static const struct of_device_id of_match_mmsys[] = {
+	{ .compatible = "mediatek,mt2701-mmsys",

Because this driver replace the original "mediatek,mt2701-mmsys" driver, could you modify the binding document of "mediatek,mt2701-mmsys" [1]?

[1]
https://www.kernel.org/doc/Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.txt

Well we are actually no replacing the compatible but keeping it. But yes, the documentation should be updated.

Apart right now we have the definition twice. The other location is here:
Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt

Regards,
Matthias

maintainer
#9 lore raw

Re: [PATCH 2/8] mfd: mtk-mmsys: Add mmsys driver

In reply to Matthias Brugger

Hi Matthias,

Quoted 104 lines · Matthias Brugger

The MMSYS subsystem includes clocks and drm components. This patch adds a MFD device to probe both drivers from the same device tree compatible.

---
 drivers/mfd/Kconfig       |  9 +++++
 drivers/mfd/Makefile      |  2 ++
 drivers/mfd/mtk-mmsys.c   | 91 +++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/mfd/mmsys.h | 18 ++++++++++
 4 files changed, 120 insertions(+)
 create mode 100644 drivers/mfd/mtk-mmsys.c
 create mode 100644 include/linux/mfd/mmsys.h
drivers/mfd/Kconfig +9 -0
index fc5e4fef89d2..3250ce5d205a 100644
@@ -368,6 +368,15 @@ config MFD_MC13XXX_I2C
 	help
 	  Select this if your MC13xxx is connected via an I2C bus.
 
+config MFD_MEDIATEK_MMSYS
+	tristate "Mediatek MMSYS interface"
+	select MDF_CORE
+	select REGMAP_MMIO
+	help
+	  Select this if you have a MMSYS subsystem in your SoC. The
+	  MMSYS subsystem has at least a clock driver part and some
+	  DRM components.
+
 config MFD_MXS_LRADC
 	tristate "Freescale i.MX23/i.MX28 LRADC"
 	depends on ARCH_MXS || COMPILE_TEST
drivers/mfd/Makefile +2 -0
index 8703ff17998e..d4fc99df784c 100644
@@ -100,6 +100,8 @@ obj-$(CONFIG_MFD_MC13XXX)	+= mc13xxx-core.o
 obj-$(CONFIG_MFD_MC13XXX_SPI)	+= mc13xxx-spi.o
 obj-$(CONFIG_MFD_MC13XXX_I2C)	+= mc13xxx-i2c.o
 
+obj-$(CONFIG_MFD_MEDIATEK_MMSYS) += mtk-mmsys.o
+
 obj-$(CONFIG_MFD_CORE)		+= mfd-core.o
 
 obj-$(CONFIG_EZX_PCAP)		+= ezx-pcap.o
drivers/mfd/mtk-mmsys.c new file +51 -0
new file mode 100644
index 000000000000..102b491aa28f
@@ -0,0 +1,91 @@
+/*
+ * mtk-mmsys.c  --  Mediatek MMSYS multi-function driver
+ *
+ *  Copyright (c) 2017 Matthias Brugger <[email protected]>
+ *
+ * Author: Matthias Brugger <[email protected]>
+ *
+ * For licencing details see kernel-base/COPYING
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/mfd/core.h>
+#include <linux/mfd/mmsys.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_device.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+
+enum {
+	MMSYS_MT2701 = 1,
+};
+
+static const struct mfd_cell mmsys_mt2701_devs[] = {
+	{ .name = "clk-mt2701-mm", },
+	{ .name = "drm-mt2701-mm", },
+};
+
+static int mmsys_probe(struct platform_device *pdev)
+{
+	struct mmsys_dev *private;
+	const struct mfd_cell *mmsys_cells;
+	int nr_cells;
+	long id;
+	int ret;
+
+	id = (long) of_device_get_match_data(&pdev->dev);
+	if (!id) {
+		dev_err(&pdev->dev, "of_device_get match_data() failed\n");
+		return -EINVAL;
+	}
+
+	switch (id) {
+	case MMSYS_MT2701:
+		mmsys_cells = mmsys_mt2701_devs;
+		nr_cells = ARRAY_SIZE(mmsys_mt2701_devs);
+		break;
+	default:
+		return -ENODEV;

drivers/mfd/mtk-mmsys.c line 61

Quoted 10 lines
drivers/mfd/mtk-mmsys.c new file +10 -0
+	}
+
+	private = devm_kzalloc(&pdev->dev, sizeof(*private), GFP_KERNEL);
+	if (!private)
+		return -ENOMEM;
+
+	private->dev = &pdev->dev;
+	dev_set_drvdata(private->dev, private);
+
+	private->of_node = pdev->dev.of_node;

This seems superfluous to me. The of_node can be obtained from the device, and the device itself is already needed to get to the drvdata.

Instead of

	mmsys_private = drv_get_drvdata(pdev->dev.parent);
	mmsys_dev = mmsys_private.dev;
	mmsys_of_node = mmsys_private.of_node;

couldn't the mfd children just do

	mmsys_dev = pdev->dev.parent;
	mmsys_of_node = pdev->dev.parent->of_node;

?

Quoted 42 lines
drivers/mfd/mtk-mmsys.c new file +30 -0
+
+	ret = devm_mfd_add_devices(private->dev, 0, mmsys_cells, nr_cells,
+					NULL, 0, NULL);
+	if (ret) {
+		dev_err(&pdev->dev, "failed to add MFD devices %d\n", ret);
+		return ret;
+	}
+
+	return 0;
+};
+
+static const struct of_device_id of_match_mmsys[] = {
+	{ .compatible = "mediatek,mt2701-mmsys",
+	  .data = (void *) MMSYS_MT2701,
+	},
+	{ /* sentinel */ },
+};
+
+static struct platform_driver mmsys_drv = {
+	.probe = mmsys_probe,
+	.driver = {
+		.name = "mediatek-mmysys",
+		.of_match_table = of_match_ptr(of_match_mmsys),
+	},
+};
+
+builtin_platform_driver(mmsys_drv);
+
+MODULE_DESCRIPTION("Mediatek MMSYS multi-function driver");
+MODULE_LICENSE("GPL");
include/linux/mfd/mmsys.h new file +6 -0
new file mode 100644
index 000000000000..274b9ee03ada
@@ -0,0 +1,18 @@
+/* Header of MMSYS MFD core driver for Mediatek platforms
+ *
+ * Copyright (c) 2017 Matthias Brugger <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License version 2 as published by the

include/linux/mfd/mmsys.h line 16

Quoted 10 lines
include/linux/mfd/mmsys.h new file +10 -0
+ * Free Software Foundation.
+ */
+
+#ifndef __MEDIATEK_MMSYS__H__
+#define __MEDIATEK_MMSYS__H__
+
+struct mmsys_dev {
+	struct device		*dev;
+	struct device_node	*of_node;
+};

This wouldn't be needed, then.

regards
Philipp

author maintainer
#10 lore raw

PATCH 3/8 drm/mediatek: mt2701: switch to mfd probing.

In reply to Matthias Brugger

With the mtk-mmsys MFD device in place, we switch the probing for mt2701 from device-tree to mfd.

---
 drivers/gpu/drm/mediatek/mtk_drm_drv.c | 32 +++++++++++++++++++++++++-------
 1 file changed, 25 insertions(+), 7 deletions(-)
drivers/gpu/drm/mediatek/mtk_drm_drv.c +25 -7
index dd249cf5121e..5a263aa3ab6e 100644
@@ -21,6 +21,7 @@
 #include <drm/drm_of.h>
 #include <linux/component.h>
 #include <linux/iommu.h>
+#include <linux/mfd/mmsys.h>
 #include <linux/mfd/syscon.h>
 #include <linux/of_address.h>
 #include <linux/of_platform.h>
@@ -392,9 +393,10 @@ static const struct of_device_id mtk_ddp_comp_dt_ids[] = {
 
 static int mtk_drm_probe(struct platform_device *pdev)
 {
+	struct mmsys_dev *mmsys_private;
 	struct device *dev = &pdev->dev;
 	struct mtk_drm_private *private;
-	struct device_node *node;
+	struct device_node *node, *parent_node;
 	struct component_match *match = NULL;
 	int ret;
 	int i;
@@ -407,12 +409,23 @@ static int mtk_drm_probe(struct platform_device *pdev)
 	INIT_WORK(&private->commit.work, mtk_atomic_work);
 	private->data = of_device_get_match_data(dev);
 
-	private->config_regs = syscon_node_to_regmap(dev->of_node);
-	if (IS_ERR(private->config_regs))
-		return PTR_ERR(private->config_regs);
+	/* Check if called from mfd */
+	if (!dev->of_node) {
+		mmsys_private = dev_get_drvdata(pdev->dev.parent);
+		private->data = (struct mtk_mmsys_driver_data *)
+				platform_get_device_id(pdev)->driver_data;
+		private->config_regs =
+			syscon_node_to_regmap(mmsys_private->of_node);
+		parent_node = mmsys_private->of_node->parent;
+	} else {
+		private->config_regs = syscon_node_to_regmap(dev->of_node);
+		if (IS_ERR(private->config_regs))
+			return PTR_ERR(private->config_regs);
+		parent_node = dev->of_node->parent;
+	}
 
 	/* Iterate over sibling DISP function blocks */
-	for_each_child_of_node(dev->of_node->parent, node) {
+	for_each_child_of_node(parent_node, node) {
 		const struct of_device_id *of_id;
 		enum mtk_ddp_comp_type comp_type;
 		int comp_id;
@@ -553,13 +566,17 @@ static SIMPLE_DEV_PM_OPS(mtk_drm_pm_ops, mtk_drm_sys_suspend,
 			 mtk_drm_sys_resume);
 
 static const struct of_device_id mtk_drm_of_ids[] = {
-	{ .compatible = "mediatek,mt2701-mmsys",
-	  .data = &mt2701_mmsys_driver_data},
 	{ .compatible = "mediatek,mt8173-mmsys",
 	  .data = &mt8173_mmsys_driver_data},
 	{ }
 };
 
+static const struct platform_device_id mtk_drm_ids[] = {
+	{ "drm-mt2701-mm", (kernel_ulong_t)&mt2701_mmsys_driver_data },
+	{ /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(platform, mtk_drm_ids);
+
 static struct platform_driver mtk_drm_platform_driver = {
 	.probe	= mtk_drm_probe,
 	.remove	= mtk_drm_remove,
@@ -568,6 +585,7 @@ static struct platform_driver mtk_drm_platform_driver = {
 		.of_match_table = mtk_drm_of_ids,
 		.pm     = &mtk_drm_pm_ops,
 	},
+	.id_table = mtk_drm_ids,
 };
 
 static struct platform_driver * const mtk_drm_drivers[] = {
Signature · 1 line
2.14.2
#11 lore raw

Re: [PATCH 3/8] drm/mediatek: mt2701: switch to mfd probing.

Hi, Matthias:

Quoted 33 lines · Matthias Brugger

With the mtk-mmsys MFD device in place, we switch the probing for mt2701 from device-tree to mfd.

---
 drivers/gpu/drm/mediatek/mtk_drm_drv.c | 32 +++++++++++++++++++++++++-------
 1 file changed, 25 insertions(+), 7 deletions(-)
drivers/gpu/drm/mediatek/mtk_drm_drv.c +3 -1
index dd249cf5121e..5a263aa3ab6e 100644
@@ -21,6 +21,7 @@
 #include <drm/drm_of.h>
 #include <linux/component.h>
 #include <linux/iommu.h>
+#include <linux/mfd/mmsys.h>
 #include <linux/mfd/syscon.h>
 #include <linux/of_address.h>
 #include <linux/of_platform.h>
@@ -392,9 +393,10 @@ static const struct of_device_id mtk_ddp_comp_dt_ids[] = {
 
 static int mtk_drm_probe(struct platform_device *pdev)
 {
+	struct mmsys_dev *mmsys_private;
 	struct device *dev = &pdev->dev;
 	struct mtk_drm_private *private;
-	struct device_node *node;
+	struct device_node *node, *parent_node;
 	struct component_match *match = NULL;
 	int ret;
 	int i;

drivers/gpu/drm/mediatek/mtk_drm_drv.c static int mtk_drm_probe(struct platform_device *pdev) · line 414

Quoted 9 lines
drivers/gpu/drm/mediatek/mtk_drm_drv.c +3 -3
@@ -407,12 +409,23 @@ static int mtk_drm_probe(struct platform_device *pdev)
 	INIT_WORK(&private->commit.work, mtk_atomic_work);
 	private->data = of_device_get_match_data(dev);
 
-	private->config_regs = syscon_node_to_regmap(dev->of_node);
-	if (IS_ERR(private->config_regs))
-		return PTR_ERR(private->config_regs);
+	/* Check if called from mfd */
+	if (!dev->of_node) {
+		mmsys_private = dev_get_drvdata(pdev->dev.parent);

Why do you directly access parent's driver data? You just need the device node of mmsys, maybe you could refer to [1].

[1]
https://elixir.free-electrons.com/linux/latest/source/drivers/reset/reset-berlin.c#L78

Regards,
CK

Quoted 46 lines
drivers/gpu/drm/mediatek/mtk_drm_drv.c +19 -3
+		private->data = (struct mtk_mmsys_driver_data *)
+				platform_get_device_id(pdev)->driver_data;
+		private->config_regs =
+			syscon_node_to_regmap(mmsys_private->of_node);
+		parent_node = mmsys_private->of_node->parent;
+	} else {
+		private->config_regs = syscon_node_to_regmap(dev->of_node);
+		if (IS_ERR(private->config_regs))
+			return PTR_ERR(private->config_regs);
+		parent_node = dev->of_node->parent;
+	}
 
 	/* Iterate over sibling DISP function blocks */
-	for_each_child_of_node(dev->of_node->parent, node) {
+	for_each_child_of_node(parent_node, node) {
 		const struct of_device_id *of_id;
 		enum mtk_ddp_comp_type comp_type;
 		int comp_id;
@@ -553,13 +566,17 @@ static SIMPLE_DEV_PM_OPS(mtk_drm_pm_ops, mtk_drm_sys_suspend,
 			 mtk_drm_sys_resume);
 
 static const struct of_device_id mtk_drm_of_ids[] = {
-	{ .compatible = "mediatek,mt2701-mmsys",
-	  .data = &mt2701_mmsys_driver_data},
 	{ .compatible = "mediatek,mt8173-mmsys",
 	  .data = &mt8173_mmsys_driver_data},
 	{ }
 };
 
+static const struct platform_device_id mtk_drm_ids[] = {
+	{ "drm-mt2701-mm", (kernel_ulong_t)&mt2701_mmsys_driver_data },
+	{ /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(platform, mtk_drm_ids);
+
 static struct platform_driver mtk_drm_platform_driver = {
 	.probe	= mtk_drm_probe,
 	.remove	= mtk_drm_remove,
@@ -568,6 +585,7 @@ static struct platform_driver mtk_drm_platform_driver = {
 		.of_match_table = mtk_drm_of_ids,
 		.pm     = &mtk_drm_pm_ops,
 	},
+	.id_table = mtk_drm_ids,
 };
 
 static struct platform_driver * const mtk_drm_drivers[] = {
#12 lore raw

Re: [PATCH 3/8] drm/mediatek: mt2701: switch to mfd probing.

Quoted 49 lines · CK Hu

Hi, Matthias:

Quoted 33 lines · Matthias Brugger

With the mtk-mmsys MFD device in place, we switch the probing for mt2701 from device-tree to mfd.

---
 drivers/gpu/drm/mediatek/mtk_drm_drv.c | 32 +++++++++++++++++++++++++-------
 1 file changed, 25 insertions(+), 7 deletions(-)
drivers/gpu/drm/mediatek/mtk_drm_drv.c +3 -1
index dd249cf5121e..5a263aa3ab6e 100644
@@ -21,6 +21,7 @@
 #include <drm/drm_of.h>
 #include <linux/component.h>
 #include <linux/iommu.h>
+#include <linux/mfd/mmsys.h>
 #include <linux/mfd/syscon.h>
 #include <linux/of_address.h>
 #include <linux/of_platform.h>
@@ -392,9 +393,10 @@ static const struct of_device_id mtk_ddp_comp_dt_ids[] = {
 
 static int mtk_drm_probe(struct platform_device *pdev)
 {
+	struct mmsys_dev *mmsys_private;
 	struct device *dev = &pdev->dev;
 	struct mtk_drm_private *private;
-	struct device_node *node;
+	struct device_node *node, *parent_node;
 	struct component_match *match = NULL;
 	int ret;
 	int i;

drivers/gpu/drm/mediatek/mtk_drm_drv.c static int mtk_drm_probe(struct platform_device *pdev) · line 414

Quoted 9 lines
drivers/gpu/drm/mediatek/mtk_drm_drv.c +3 -3
@@ -407,12 +409,23 @@ static int mtk_drm_probe(struct platform_device *pdev)
 	INIT_WORK(&private->commit.work, mtk_atomic_work);
 	private->data = of_device_get_match_data(dev);
 
-	private->config_regs = syscon_node_to_regmap(dev->of_node);
-	if (IS_ERR(private->config_regs))
-		return PTR_ERR(private->config_regs);
+	/* Check if called from mfd */
+	if (!dev->of_node) {
+		mmsys_private = dev_get_drvdata(pdev->dev.parent);

Why do you directly access parent's driver data? You just need the device node of mmsys, maybe you could refer to [1].

Quoted 3 lines

[1]
https://elixir.free-electrons.com/linux/latest/source/drivers/reset/reset-berlin.c#L78

The difference is, that the driver you mentioned gets probed via device tree matching, while we get invoked here through the id_table. So there is no device node (the if actually checkes for pdev->dev.of_node to identify exactly this case).

Regards,
Matthias

Acked-by
#13 lore raw

Re: [PATCH 3/8] drm/mediatek: mt2701: switch to mfd probing.

Hi, Matthias:

Quoted 55 lines · Matthias Brugger
Quoted 49 lines · CK Hu

Hi, Matthias:

Quoted 33 lines · Matthias Brugger

With the mtk-mmsys MFD device in place, we switch the probing for mt2701 from device-tree to mfd.

---
 drivers/gpu/drm/mediatek/mtk_drm_drv.c | 32 +++++++++++++++++++++++++-------
 1 file changed, 25 insertions(+), 7 deletions(-)
drivers/gpu/drm/mediatek/mtk_drm_drv.c +3 -1
index dd249cf5121e..5a263aa3ab6e 100644
@@ -21,6 +21,7 @@
 #include <drm/drm_of.h>
 #include <linux/component.h>
 #include <linux/iommu.h>
+#include <linux/mfd/mmsys.h>
 #include <linux/mfd/syscon.h>
 #include <linux/of_address.h>
 #include <linux/of_platform.h>
@@ -392,9 +393,10 @@ static const struct of_device_id mtk_ddp_comp_dt_ids[] = {
 
 static int mtk_drm_probe(struct platform_device *pdev)
 {
+	struct mmsys_dev *mmsys_private;
 	struct device *dev = &pdev->dev;
 	struct mtk_drm_private *private;
-	struct device_node *node;
+	struct device_node *node, *parent_node;
 	struct component_match *match = NULL;
 	int ret;
 	int i;

drivers/gpu/drm/mediatek/mtk_drm_drv.c static int mtk_drm_probe(struct platform_device *pdev) · line 414

Quoted 9 lines
drivers/gpu/drm/mediatek/mtk_drm_drv.c +3 -3
@@ -407,12 +409,23 @@ static int mtk_drm_probe(struct platform_device *pdev)
 	INIT_WORK(&private->commit.work, mtk_atomic_work);
 	private->data = of_device_get_match_data(dev);
 
-	private->config_regs = syscon_node_to_regmap(dev->of_node);
-	if (IS_ERR(private->config_regs))
-		return PTR_ERR(private->config_regs);
+	/* Check if called from mfd */
+	if (!dev->of_node) {
+		mmsys_private = dev_get_drvdata(pdev->dev.parent);

Why do you directly access parent's driver data? You just need the device node of mmsys, maybe you could refer to [1].

Quoted 3 lines

[1]
https://elixir.free-electrons.com/linux/latest/source/drivers/reset/reset-berlin.c#L78

Quoted 6 lines

The difference is, that the driver you mentioned gets probed via device tree matching, while we get invoked here through the id_table. So there is no device node (the if actually checkes for pdev->dev.of_node to identify exactly this case).

Regards,
Matthias

Yes, you are right. So

Regards,
CK

Quoted 5 lines

_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek

maintainer
#14 lore raw

Re: [PATCH 3/8] drm/mediatek: mt2701: switch to mfd probing.

In reply to Matthias Brugger
Quoted 37 lines · Matthias Brugger

With the mtk-mmsys MFD device in place, we switch the probing for mt2701 from device-tree to mfd.

---
 drivers/gpu/drm/mediatek/mtk_drm_drv.c | 32 +++++++++++++++++++++++++-------
 1 file changed, 25 insertions(+), 7 deletions(-)
drivers/gpu/drm/mediatek/mtk_drm_drv.c +3 -2
index dd249cf5121e..5a263aa3ab6e 100644
@@ -21,6 +21,7 @@
 #include <drm/drm_of.h>
 #include <linux/component.h>
 #include <linux/iommu.h>
+#include <linux/mfd/mmsys.h>
 #include <linux/mfd/syscon.h>
 #include <linux/of_address.h>
 #include <linux/of_platform.h>
@@ -392,9 +393,10 @@ static const struct of_device_id mtk_ddp_comp_dt_ids[] = {
 
 static int mtk_drm_probe(struct platform_device *pdev)
 {
+	struct mmsys_dev *mmsys_private;
 	struct device *dev = &pdev->dev;
 	struct mtk_drm_private *private;
-	struct device_node *node;
+	struct device_node *node, *parent_node;
 	struct component_match *match = NULL;
 	int ret;
 	int i;
@@ -407,12 +409,23 @@ static int mtk_drm_probe(struct platform_device *pdev)
 	INIT_WORK(&private->commit.work, mtk_atomic_work);
 	private->data = of_device_get_match_data(dev);
 
-	private->config_regs = syscon_node_to_regmap(dev->of_node);

drivers/gpu/drm/mediatek/mtk_drm_drv.c static int mtk_drm_probe(struct platform_device *pdev) · line 419

Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_drm_drv.c +8 -2
-	if (IS_ERR(private->config_regs))
-		return PTR_ERR(private->config_regs);
+	/* Check if called from mfd */
+	if (!dev->of_node) {
+		mmsys_private = dev_get_drvdata(pdev->dev.parent);
+		private->data = (struct mtk_mmsys_driver_data *)
+				platform_get_device_id(pdev)->driver_data;
+		private->config_regs =
+			syscon_node_to_regmap(mmsys_private->of_node);
+		parent_node = mmsys_private->of_node->parent;

I think this could be just:

		mmsys_node = pdev->dev.parent->of_node;
		private->data = (struct mtk_mmsys_driver_data *)> +	
			platform_get_device_id(pdev)->driver_data;
		private->config_regs = syscon_node_to_regmap(mmsys_node);
		parent_node = mmsys_node->parent;

regards
Philipp

author maintainer
#15 lore raw

PATCH 4/8 clk: mediatek: mt2701-mm: switch to mfd device

In reply to Matthias Brugger

As the new mfd device is in place, switch probing for the MMSYS to support invocation from the mfd device.

---
 drivers/clk/mediatek/clk-mt2701-mm.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/clk/mediatek/clk-mt2701-mm.c +6 -7
index fe1f85072fc5..1725c2c17ca3 100644
@@ -13,6 +13,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/mfd/mmsys.h>
 #include <linux/platform_device.h>
 
 #include "clk-mtk.h"
@@ -87,16 +88,15 @@ static const struct mtk_gate mm_clks[] = {
 	GATE_DISP1(CLK_MM_TVE_FMM, "mm_tve_fmm", "mm_sel", 14),
 };
 
-static const struct of_device_id of_match_clk_mt2701_mm[] = {
-	{ .compatible = "mediatek,mt2701-mmsys", },
-	{}
-};
-
 static int clk_mt2701_mm_probe(struct platform_device *pdev)
 {
 	struct clk_onecell_data *clk_data;
 	int r;
-	struct device_node *node = pdev->dev.of_node;
+	struct device_node *node;
+	struct mmsys_dev *mmsys_private;
+
+	mmsys_private = dev_get_drvdata(pdev->dev.parent);
+	node = mmsys_private->of_node;
 
 	clk_data = mtk_alloc_clk_data(CLK_MM_NR);
 
@@ -116,7 +116,6 @@ static struct platform_driver clk_mt2701_mm_drv = {
 	.probe = clk_mt2701_mm_probe,
 	.driver = {
 		.name = "clk-mt2701-mm",
-		.of_match_table = of_match_clk_mt2701_mm,
 	},
 };
 
Signature · 1 line
2.14.2
Acked-by on v1 4/8
#16 lore raw

Re: [PATCH 4/8] clk: mediatek: mt2701-mm: switch to mfd device

Quoted 5 lines · Matthias Brugger

As the new mfd device is in place, switch probing for the MMSYS to support invocation from the mfd device.

---

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
author maintainer
#17 lore raw

Re: [PATCH 4/8] clk: mediatek: mt2701-mm: switch to mfd device

Hi Stephen,

Quoted 9 lines · Stephen Boyd
Quoted 5 lines · Matthias Brugger

As the new mfd device is in place, switch probing for the MMSYS to support invocation from the mfd device.

---

I did a minor change to this patch and patch 7/8 to get rid of mmsys_private variable. Nevertheless I kept your Acked-by, as it only changes how we get the device tree node.

Hope that's OK with you.

Regards,
Matthias

author maintainer
#18 lore raw

Re: [PATCH 4/8] clk: mediatek: mt2701-mm: switch to mfd device

Quoted 10 lines · Matthias Brugger

Hi Stephen,

Quoted 7 lines · Stephen Boyd
Quoted 5 lines · Matthias Brugger

As the new mfd device is in place, switch probing for the MMSYS to support invocation from the mfd device.

---

Quoted 9 lines
Quoted 2 lines

I did a minor change to this patch and patch 7/8 to get rid of mmsys_private variable. Nevertheless I kept your Acked-by, as it only changes how we get the device tree node.

Hope that's OK with you.

Sorry, I didn't explain me. I'm talking about v2 of the series, which I'm working on right now.

Regards,
Matthias

author maintainer
#19 lore raw

PATCH 5/8 mfd: mtk-mmsys: Add mt8173 nodes

In reply to Matthias Brugger

Add devices for the mt8173 SoC.

---
 drivers/mfd/mtk-mmsys.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/mfd/mtk-mmsys.c +14 -0
index 102b491aa28f..45973dfc6010 100644
@@ -21,6 +21,7 @@
 
 enum {
 	MMSYS_MT2701 = 1,
+	MMSYS_MT8173,
 };
 
 static const struct mfd_cell mmsys_mt2701_devs[] = {
@@ -28,6 +29,12 @@ static const struct mfd_cell mmsys_mt2701_devs[] = {
 	{ .name = "drm-mt2701-mm", },
 };
 
+static const struct mfd_cell mmsys_mt8173_devs[] = {
+	{ .name = "clk-mt8173-mm", },
+	{ .name = "drm-mt8173-mm", },
+};
+
+
 static int mmsys_probe(struct platform_device *pdev)
 {
 	struct mmsys_dev *private;
@@ -47,6 +54,10 @@ static int mmsys_probe(struct platform_device *pdev)
 		mmsys_cells = mmsys_mt2701_devs;
 		nr_cells = ARRAY_SIZE(mmsys_mt2701_devs);
 		break;
+	case MMSYS_MT8173:
+		mmsys_cells = mmsys_mt8173_devs;
+		nr_cells = ARRAY_SIZE(mmsys_mt8173_devs);
+		break;
 	default:
 		return -ENODEV;
 	}
@@ -74,6 +85,9 @@ static const struct of_device_id of_match_mmsys[] = {
 	{ .compatible = "mediatek,mt2701-mmsys",
 	  .data = (void *) MMSYS_MT2701,
 	},
+	{ .compatible = "mediatek,mt8173-mmsys",
+	  .data = (void *) MMSYS_MT8173,
+	},
 	{ /* sentinel */ },
 };
 
Signature · 1 line
2.14.2
author maintainer
#21 lore raw

PATCH 6/8 drm/mediatek: Add mfd support for mt8173

In reply to Matthias Brugger

Use the MFD device for SoC mt8173. Probing via devicetree is no longer needed for any SoC, so delete it.

---
 drivers/gpu/drm/mediatek/mtk_drm_drv.c | 28 +++++++---------------------
 1 file changed, 7 insertions(+), 21 deletions(-)
drivers/gpu/drm/mediatek/mtk_drm_drv.c +7 -21
index 5a263aa3ab6e..1eb02acf229a 100644
@@ -409,20 +409,12 @@ static int mtk_drm_probe(struct platform_device *pdev)
 	INIT_WORK(&private->commit.work, mtk_atomic_work);
 	private->data = of_device_get_match_data(dev);
 
-	/* Check if called from mfd */
-	if (!dev->of_node) {
-		mmsys_private = dev_get_drvdata(pdev->dev.parent);
-		private->data = (struct mtk_mmsys_driver_data *)
-				platform_get_device_id(pdev)->driver_data;
-		private->config_regs =
-			syscon_node_to_regmap(mmsys_private->of_node);
-		parent_node = mmsys_private->of_node->parent;
-	} else {
-		private->config_regs = syscon_node_to_regmap(dev->of_node);
-		if (IS_ERR(private->config_regs))
-			return PTR_ERR(private->config_regs);
-		parent_node = dev->of_node->parent;
-	}
+	mmsys_private = dev_get_drvdata(pdev->dev.parent);
+	private->data = (struct mtk_mmsys_driver_data *)
+			platform_get_device_id(pdev)->driver_data;
+	private->config_regs =
+		syscon_node_to_regmap(mmsys_private->of_node);
+	parent_node = mmsys_private->of_node->parent;
 
 	/* Iterate over sibling DISP function blocks */
 	for_each_child_of_node(parent_node, node) {
@@ -565,14 +557,9 @@ static int mtk_drm_sys_resume(struct device *dev)
 static SIMPLE_DEV_PM_OPS(mtk_drm_pm_ops, mtk_drm_sys_suspend,
 			 mtk_drm_sys_resume);
 
-static const struct of_device_id mtk_drm_of_ids[] = {
-	{ .compatible = "mediatek,mt8173-mmsys",
-	  .data = &mt8173_mmsys_driver_data},
-	{ }
-};
-
 static const struct platform_device_id mtk_drm_ids[] = {
 	{ "drm-mt2701-mm", (kernel_ulong_t)&mt2701_mmsys_driver_data },
+	{ "drm-mt8173-mm", (kernel_ulong_t)&mt8173_mmsys_driver_data },
 	{ /* sentinel */ },
 };
 MODULE_DEVICE_TABLE(platform, mtk_drm_ids);
@@ -582,7 +569,6 @@ static struct platform_driver mtk_drm_platform_driver = {
 	.remove	= mtk_drm_remove,
 	.driver	= {
 		.name	= "mediatek-drm",
-		.of_match_table = mtk_drm_of_ids,
 		.pm     = &mtk_drm_pm_ops,
 	},
 	.id_table = mtk_drm_ids,
Signature · 1 line
2.14.2
Acked-by on v1 6/8
#22 lore raw

Re: [PATCH 6/8] drm/mediatek: Add mfd support for mt8173

Hi, Matthias:

Quoted 4 lines · Matthias Brugger

Use the MFD device for SoC mt8173. Probing via devicetree is no longer needed for any SoC, so delete it.

Quoted 59 lines
---
 drivers/gpu/drm/mediatek/mtk_drm_drv.c | 28 +++++++---------------------
 1 file changed, 7 insertions(+), 21 deletions(-)
drivers/gpu/drm/mediatek/mtk_drm_drv.c +7 -21
index 5a263aa3ab6e..1eb02acf229a 100644
@@ -409,20 +409,12 @@ static int mtk_drm_probe(struct platform_device *pdev)
 	INIT_WORK(&private->commit.work, mtk_atomic_work);
 	private->data = of_device_get_match_data(dev);
 
-	/* Check if called from mfd */
-	if (!dev->of_node) {
-		mmsys_private = dev_get_drvdata(pdev->dev.parent);
-		private->data = (struct mtk_mmsys_driver_data *)
-				platform_get_device_id(pdev)->driver_data;
-		private->config_regs =
-			syscon_node_to_regmap(mmsys_private->of_node);
-		parent_node = mmsys_private->of_node->parent;
-	} else {
-		private->config_regs = syscon_node_to_regmap(dev->of_node);
-		if (IS_ERR(private->config_regs))
-			return PTR_ERR(private->config_regs);
-		parent_node = dev->of_node->parent;
-	}
+	mmsys_private = dev_get_drvdata(pdev->dev.parent);
+	private->data = (struct mtk_mmsys_driver_data *)
+			platform_get_device_id(pdev)->driver_data;
+	private->config_regs =
+		syscon_node_to_regmap(mmsys_private->of_node);
+	parent_node = mmsys_private->of_node->parent;
 
 	/* Iterate over sibling DISP function blocks */
 	for_each_child_of_node(parent_node, node) {
@@ -565,14 +557,9 @@ static int mtk_drm_sys_resume(struct device *dev)
 static SIMPLE_DEV_PM_OPS(mtk_drm_pm_ops, mtk_drm_sys_suspend,
 			 mtk_drm_sys_resume);
 
-static const struct of_device_id mtk_drm_of_ids[] = {
-	{ .compatible = "mediatek,mt8173-mmsys",
-	  .data = &mt8173_mmsys_driver_data},
-	{ }
-};
-
 static const struct platform_device_id mtk_drm_ids[] = {
 	{ "drm-mt2701-mm", (kernel_ulong_t)&mt2701_mmsys_driver_data },
+	{ "drm-mt8173-mm", (kernel_ulong_t)&mt8173_mmsys_driver_data },
 	{ /* sentinel */ },
 };
 MODULE_DEVICE_TABLE(platform, mtk_drm_ids);
@@ -582,7 +569,6 @@ static struct platform_driver mtk_drm_platform_driver = {
 	.remove	= mtk_drm_remove,
 	.driver	= {
 		.name	= "mediatek-drm",
-		.of_match_table = mtk_drm_of_ids,
 		.pm     = &mtk_drm_pm_ops,
 	},
 	.id_table = mtk_drm_ids,
author maintainer
#24 lore raw

PATCH 7/8 clk: mediatek: mt8173-mm: switch to mfd device

In reply to Matthias Brugger

As the new mfd device is in place, switch probing for the MMSYS to support invocation from the mfd device.

---
 drivers/clk/mediatek/clk-mt8173.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)
drivers/clk/mediatek/clk-mt8173.c +19 -2
index 96c292c3e440..0fd39228eef4 100644
@@ -13,8 +13,10 @@
  */
 
 #include <linux/clk.h>
+#include <linux/mfd/mmsys.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
+#include <linux/platform_device.h>
 
 #include "clk-mtk.h"
 #include "clk-gate.h"
@@ -1152,10 +1154,16 @@ static void __init mtk_imgsys_init(struct device_node *node)
 }
 CLK_OF_DECLARE(mtk_imgsys, "mediatek,mt8173-imgsys", mtk_imgsys_init);
 
-static void __init mtk_mmsys_init(struct device_node *node)
+static int mtk_mmsys_probe(struct platform_device *pdev)
 {
 	struct clk_onecell_data *clk_data;
 	int r;
+	struct device_node *node;
+	struct mmsys_dev *mmsys_private;
+
+	mmsys_private = dev_get_drvdata(pdev->dev.parent);
+	node = mmsys_private->of_node;
+
 
 	clk_data = mtk_alloc_clk_data(CLK_MM_NR_CLK);
 
@@ -1166,8 +1174,17 @@ static void __init mtk_mmsys_init(struct device_node *node)
 	if (r)
 		pr_err("%s(): could not register clock provider: %d\n",
 			__func__, r);
+
+	return r;
 }
-CLK_OF_DECLARE(mtk_mmsys, "mediatek,mt8173-mmsys", mtk_mmsys_init);
+
+static struct platform_driver clk_mt8173_mm_drv = {
+	.probe = mtk_mmsys_probe,
+	.driver = {
+		.name = "clk-mt8173-mm",
+	},
+};
+builtin_platform_driver(clk_mt8173_mm_drv);
 
 static void __init mtk_vdecsys_init(struct device_node *node)
 {
Signature · 1 line
2.14.2
Acked-by on v1 7/8
#25 lore raw

Re: [PATCH 7/8] clk: mediatek: mt8173-mm: switch to mfd device

Quoted 5 lines · Matthias Brugger

As the new mfd device is in place, switch probing for the MMSYS to support invocation from the mfd device.

---

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
author maintainer
#26 lore raw

PATCH 8/8 MAINTAINERS: update Mediatek Soc entry

In reply to Matthias Brugger

Mediatek SoCs include several soc specific drivers as well as a mfd device. Add these to the maintainers file.

---
 MAINTAINERS | 2 ++
 1 file changed, 2 insertions(+)
MAINTAINERS +2 -0
index 2811a211632c..586797908865 100644
@@ -1606,6 +1606,8 @@ F:	arch/arm/boot/dts/mt7*
 F:	arch/arm/boot/dts/mt8*
 F:	arch/arm/mach-mediatek/
 F:	arch/arm64/boot/dts/mediatek/
+F:	drivers/soc/mediatek/
+F:	drivers/mfd/mtk-mmsys.c
 N:	mtk
 K:	mediatek
 
Signature · 1 line
2.14.2