dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] video: fb: imxfb: Drop platform data support
@ 2022-07-23 17:57 Uwe Kleine-König
  2022-07-23 17:57 ` [PATCH 2/4] video: fb: imxfb: Drop unused symbols from header Uwe Kleine-König
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Uwe Kleine-König @ 2022-07-23 17:57 UTC (permalink / raw)
  To: Sascha Hauer, Helge Deller, Shawn Guo
  Cc: linux-fbdev, dri-devel, NXP Linux Team, Pengutronix Kernel Team,
	linux-arm-kernel

No source file but the driver itself includes the header containing the
platform data definition. The last user is gone since commit
8485adf17a15 ("ARM: imx: Remove imx device directory").

So we can safely drop platform data support.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/video/fbdev/imxfb.c               | 99 ++++++++---------------
 include/linux/platform_data/video-imxfb.h | 12 ---
 2 files changed, 34 insertions(+), 77 deletions(-)

diff --git a/drivers/video/fbdev/imxfb.c b/drivers/video/fbdev/imxfb.c
index a2f644c97f28..85a5bf5639d9 100644
--- a/drivers/video/fbdev/imxfb.c
+++ b/drivers/video/fbdev/imxfb.c
@@ -656,7 +656,6 @@ static int imxfb_activate_var(struct fb_var_screeninfo *var, struct fb_info *inf
 
 static int imxfb_init_fbinfo(struct platform_device *pdev)
 {
-	struct imx_fb_platform_data *pdata = dev_get_platdata(&pdev->dev);
 	struct fb_info *info = platform_get_drvdata(pdev);
 	struct imxfb_info *fbi = info->par;
 	struct device_node *np;
@@ -690,25 +689,20 @@ static int imxfb_init_fbinfo(struct platform_device *pdev)
 	info->fbops			= &imxfb_ops;
 	info->flags			= FBINFO_FLAG_DEFAULT |
 					  FBINFO_READS_FAST;
-	if (pdata) {
-		fbi->lscr1			= pdata->lscr1;
-		fbi->dmacr			= pdata->dmacr;
-		fbi->pwmr			= pdata->pwmr;
-	} else {
-		np = pdev->dev.of_node;
-		info->var.grayscale = of_property_read_bool(np,
-						"cmap-greyscale");
-		fbi->cmap_inverse = of_property_read_bool(np, "cmap-inverse");
-		fbi->cmap_static = of_property_read_bool(np, "cmap-static");
 
-		fbi->lscr1 = IMXFB_LSCR1_DEFAULT;
+	np = pdev->dev.of_node;
+	info->var.grayscale = of_property_read_bool(np,
+					"cmap-greyscale");
+	fbi->cmap_inverse = of_property_read_bool(np, "cmap-inverse");
+	fbi->cmap_static = of_property_read_bool(np, "cmap-static");
 
-		of_property_read_u32(np, "fsl,lpccr", &fbi->pwmr);
+	fbi->lscr1 = IMXFB_LSCR1_DEFAULT;
 
-		of_property_read_u32(np, "fsl,lscr1", &fbi->lscr1);
+	of_property_read_u32(np, "fsl,lpccr", &fbi->pwmr);
 
-		of_property_read_u32(np, "fsl,dmacr", &fbi->dmacr);
-	}
+	of_property_read_u32(np, "fsl,lscr1", &fbi->lscr1);
+
+	of_property_read_u32(np, "fsl,dmacr", &fbi->dmacr);
 
 	return 0;
 }
@@ -863,10 +857,10 @@ static int imxfb_probe(struct platform_device *pdev)
 	struct imxfb_info *fbi;
 	struct lcd_device *lcd;
 	struct fb_info *info;
-	struct imx_fb_platform_data *pdata;
 	struct resource *res;
 	struct imx_fb_videomode *m;
 	const struct of_device_id *of_id;
+	struct device_node *display_np;
 	int ret, i;
 	int bytes_per_pixel;
 
@@ -884,8 +878,6 @@ static int imxfb_probe(struct platform_device *pdev)
 	if (!res)
 		return -ENODEV;
 
-	pdata = dev_get_platdata(&pdev->dev);
-
 	info = framebuffer_alloc(sizeof(struct imxfb_info), &pdev->dev);
 	if (!info)
 		return -ENOMEM;
@@ -898,43 +890,34 @@ static int imxfb_probe(struct platform_device *pdev)
 	if (ret < 0)
 		goto failed_init;
 
-	if (pdata) {
-		if (!fb_mode)
-			fb_mode = pdata->mode[0].mode.name;
-
-		fbi->mode = pdata->mode;
-		fbi->num_modes = pdata->num_modes;
-	} else {
-		struct device_node *display_np;
-		fb_mode = NULL;
-
-		display_np = of_parse_phandle(pdev->dev.of_node, "display", 0);
-		if (!display_np) {
-			dev_err(&pdev->dev, "No display defined in devicetree\n");
-			ret = -EINVAL;
-			goto failed_of_parse;
-		}
+	fb_mode = NULL;
 
-		/*
-		 * imxfb does not support more modes, we choose only the native
-		 * mode.
-		 */
-		fbi->num_modes = 1;
-
-		fbi->mode = devm_kzalloc(&pdev->dev,
-				sizeof(struct imx_fb_videomode), GFP_KERNEL);
-		if (!fbi->mode) {
-			ret = -ENOMEM;
-			of_node_put(display_np);
-			goto failed_of_parse;
-		}
+	display_np = of_parse_phandle(pdev->dev.of_node, "display", 0);
+	if (!display_np) {
+		dev_err(&pdev->dev, "No display defined in devicetree\n");
+		ret = -EINVAL;
+		goto failed_of_parse;
+	}
 
-		ret = imxfb_of_read_mode(&pdev->dev, display_np, fbi->mode);
+	/*
+	 * imxfb does not support more modes, we choose only the native
+	 * mode.
+	 */
+	fbi->num_modes = 1;
+
+	fbi->mode = devm_kzalloc(&pdev->dev,
+			sizeof(struct imx_fb_videomode), GFP_KERNEL);
+	if (!fbi->mode) {
+		ret = -ENOMEM;
 		of_node_put(display_np);
-		if (ret)
-			goto failed_of_parse;
+		goto failed_of_parse;
 	}
 
+	ret = imxfb_of_read_mode(&pdev->dev, display_np, fbi->mode);
+	of_node_put(display_np);
+	if (ret)
+		goto failed_of_parse;
+
 	/* Calculate maximum bytes used per pixel. In most cases this should
 	 * be the same as m->bpp/8 */
 	m = &fbi->mode[0];
@@ -1001,13 +984,6 @@ static int imxfb_probe(struct platform_device *pdev)
 
 	info->fix.smem_start = fbi->map_dma;
 
-	if (pdata && pdata->init) {
-		ret = pdata->init(fbi->pdev);
-		if (ret)
-			goto failed_platform_init;
-	}
-
-
 	INIT_LIST_HEAD(&info->modelist);
 	for (i = 0; i < fbi->num_modes; i++)
 		fb_add_videomode(&fbi->mode[i].mode, &info->modelist);
@@ -1059,9 +1035,6 @@ static int imxfb_probe(struct platform_device *pdev)
 failed_register:
 	fb_dealloc_cmap(&info->cmap);
 failed_cmap:
-	if (pdata && pdata->exit)
-		pdata->exit(fbi->pdev);
-failed_platform_init:
 	dma_free_wc(&pdev->dev, fbi->map_size, info->screen_buffer,
 		    fbi->map_dma);
 failed_map:
@@ -1079,7 +1052,6 @@ static int imxfb_probe(struct platform_device *pdev)
 
 static int imxfb_remove(struct platform_device *pdev)
 {
-	struct imx_fb_platform_data *pdata;
 	struct fb_info *info = platform_get_drvdata(pdev);
 	struct imxfb_info *fbi = info->par;
 	struct resource *res;
@@ -1092,9 +1064,6 @@ static int imxfb_remove(struct platform_device *pdev)
 
 	unregister_framebuffer(info);
 	fb_dealloc_cmap(&info->cmap);
-	pdata = dev_get_platdata(&pdev->dev);
-	if (pdata && pdata->exit)
-		pdata->exit(fbi->pdev);
 	dma_free_wc(&pdev->dev, fbi->map_size, info->screen_buffer,
 		    fbi->map_dma);
 	iounmap(fbi->regs);
diff --git a/include/linux/platform_data/video-imxfb.h b/include/linux/platform_data/video-imxfb.h
index 02812651af7d..b80a156a6617 100644
--- a/include/linux/platform_data/video-imxfb.h
+++ b/include/linux/platform_data/video-imxfb.h
@@ -55,16 +55,4 @@ struct imx_fb_videomode {
 	unsigned char	bpp;
 };
 
-struct imx_fb_platform_data {
-	struct imx_fb_videomode *mode;
-	int		num_modes;
-
-	u_int		pwmr;
-	u_int		lscr1;
-	u_int		dmacr;
-
-	int (*init)(struct platform_device *);
-	void (*exit)(struct platform_device *);
-};
-
 #endif /* ifndef __MACH_IMXFB_H__ */

base-commit: f2906aa863381afb0015a9eb7fefad885d4e5a56
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/4] video: fb: imxfb: Drop unused symbols from header
  2022-07-23 17:57 [PATCH 1/4] video: fb: imxfb: Drop platform data support Uwe Kleine-König
@ 2022-07-23 17:57 ` Uwe Kleine-König
  2022-07-23 17:57 ` [PATCH 3/4] video: fb: imxfb: Fold <linux/platform_data/video-imxfb.h> into only user Uwe Kleine-König
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Uwe Kleine-König @ 2022-07-23 17:57 UTC (permalink / raw)
  To: Sascha Hauer, Helge Deller, Shawn Guo
  Cc: linux-fbdev, dri-devel, NXP Linux Team, Pengutronix Kernel Team,
	linux-arm-kernel

The only file that includes <linux/platform_data/video-imxfb.h> is the
imxfb driver. Drop all symbols that are unused there.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 include/linux/platform_data/video-imxfb.h | 35 -----------------------
 1 file changed, 35 deletions(-)

diff --git a/include/linux/platform_data/video-imxfb.h b/include/linux/platform_data/video-imxfb.h
index b80a156a6617..a16837c5e43c 100644
--- a/include/linux/platform_data/video-imxfb.h
+++ b/include/linux/platform_data/video-imxfb.h
@@ -8,45 +8,10 @@
 #include <linux/fb.h>
 
 #define PCR_TFT		(1 << 31)
-#define PCR_COLOR	(1 << 30)
-#define PCR_PBSIZ_1	(0 << 28)
-#define PCR_PBSIZ_2	(1 << 28)
-#define PCR_PBSIZ_4	(2 << 28)
-#define PCR_PBSIZ_8	(3 << 28)
-#define PCR_BPIX_1	(0 << 25)
-#define PCR_BPIX_2	(1 << 25)
-#define PCR_BPIX_4	(2 << 25)
 #define PCR_BPIX_8	(3 << 25)
 #define PCR_BPIX_12	(4 << 25)
 #define PCR_BPIX_16	(5 << 25)
 #define PCR_BPIX_18	(6 << 25)
-#define PCR_PIXPOL	(1 << 24)
-#define PCR_FLMPOL	(1 << 23)
-#define PCR_LPPOL	(1 << 22)
-#define PCR_CLKPOL	(1 << 21)
-#define PCR_OEPOL	(1 << 20)
-#define PCR_SCLKIDLE	(1 << 19)
-#define PCR_END_SEL	(1 << 18)
-#define PCR_END_BYTE_SWAP (1 << 17)
-#define PCR_REV_VS	(1 << 16)
-#define PCR_ACD_SEL	(1 << 15)
-#define PCR_ACD(x)	(((x) & 0x7f) << 8)
-#define PCR_SCLK_SEL	(1 << 7)
-#define PCR_SHARP	(1 << 6)
-#define PCR_PCD(x)	((x) & 0x3f)
-
-#define PWMR_CLS(x)	(((x) & 0x1ff) << 16)
-#define PWMR_LDMSK	(1 << 15)
-#define PWMR_SCR1	(1 << 10)
-#define PWMR_SCR0	(1 << 9)
-#define PWMR_CC_EN	(1 << 8)
-#define PWMR_PW(x)	((x) & 0xff)
-
-#define LSCR1_PS_RISE_DELAY(x)    (((x) & 0x7f) << 26)
-#define LSCR1_CLS_RISE_DELAY(x)   (((x) & 0x3f) << 16)
-#define LSCR1_REV_TOGGLE_DELAY(x) (((x) & 0xf) << 8)
-#define LSCR1_GRAY2(x)            (((x) & 0xf) << 4)
-#define LSCR1_GRAY1(x)            (((x) & 0xf))
 
 struct imx_fb_videomode {
 	struct fb_videomode mode;
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/4] video: fb: imxfb: Fold <linux/platform_data/video-imxfb.h> into only user
  2022-07-23 17:57 [PATCH 1/4] video: fb: imxfb: Drop platform data support Uwe Kleine-König
  2022-07-23 17:57 ` [PATCH 2/4] video: fb: imxfb: Drop unused symbols from header Uwe Kleine-König
@ 2022-07-23 17:57 ` Uwe Kleine-König
  2022-07-23 17:57 ` [PATCH 4/4] video: fb: imxfb: Convert request_mem_region + ioremap to devm_ioremap_resource Uwe Kleine-König
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Uwe Kleine-König @ 2022-07-23 17:57 UTC (permalink / raw)
  To: Sascha Hauer, Helge Deller, Shawn Guo
  Cc: linux-fbdev, dri-devel, NXP Linux Team, Pengutronix Kernel Team,
	linux-arm-kernel

No source file but the driver itself includes the header containing the
platform data definition. The last user is gone since commit
8485adf17a15 ("ARM: imx: Remove imx device directory").

Move the remaining symbols directly into the driver and remove the then
unused header file.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 MAINTAINERS                               |  1 -
 drivers/video/fbdev/imxfb.c               | 13 ++++++++++++-
 include/linux/platform_data/video-imxfb.h | 23 -----------------------
 3 files changed, 12 insertions(+), 25 deletions(-)
 delete mode 100644 include/linux/platform_data/video-imxfb.h

diff --git a/MAINTAINERS b/MAINTAINERS
index a6d3bd9d2a8d..52f12f492ed5 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7912,7 +7912,6 @@ L:	linux-fbdev@vger.kernel.org
 L:	linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
 S:	Maintained
 F:	drivers/video/fbdev/imxfb.c
-F:	include/linux/platform_data/video-imxfb.h
 
 FREESCALE IMX DDR PMU DRIVER
 M:	Frank Li <Frank.li@nxp.com>
diff --git a/drivers/video/fbdev/imxfb.c b/drivers/video/fbdev/imxfb.c
index 85a5bf5639d9..fa6a19c1ae9b 100644
--- a/drivers/video/fbdev/imxfb.c
+++ b/drivers/video/fbdev/imxfb.c
@@ -41,7 +41,18 @@
 #include <video/of_videomode.h>
 #include <video/videomode.h>
 
-#include <linux/platform_data/video-imxfb.h>
+#define PCR_TFT		(1 << 31)
+#define PCR_BPIX_8	(3 << 25)
+#define PCR_BPIX_12	(4 << 25)
+#define PCR_BPIX_16	(5 << 25)
+#define PCR_BPIX_18	(6 << 25)
+
+struct imx_fb_videomode {
+	struct fb_videomode mode;
+	u32 pcr;
+	bool aus_mode;
+	unsigned char	bpp;
+};
 
 /*
  * Complain if VAR is out of range.
diff --git a/include/linux/platform_data/video-imxfb.h b/include/linux/platform_data/video-imxfb.h
deleted file mode 100644
index a16837c5e43c..000000000000
--- a/include/linux/platform_data/video-imxfb.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * This structure describes the machine which we are running on.
- */
-#ifndef __MACH_IMXFB_H__
-#define __MACH_IMXFB_H__
-
-#include <linux/fb.h>
-
-#define PCR_TFT		(1 << 31)
-#define PCR_BPIX_8	(3 << 25)
-#define PCR_BPIX_12	(4 << 25)
-#define PCR_BPIX_16	(5 << 25)
-#define PCR_BPIX_18	(6 << 25)
-
-struct imx_fb_videomode {
-	struct fb_videomode mode;
-	u32 pcr;
-	bool aus_mode;
-	unsigned char	bpp;
-};
-
-#endif /* ifndef __MACH_IMXFB_H__ */
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/4] video: fb: imxfb: Convert request_mem_region + ioremap to devm_ioremap_resource
  2022-07-23 17:57 [PATCH 1/4] video: fb: imxfb: Drop platform data support Uwe Kleine-König
  2022-07-23 17:57 ` [PATCH 2/4] video: fb: imxfb: Drop unused symbols from header Uwe Kleine-König
  2022-07-23 17:57 ` [PATCH 3/4] video: fb: imxfb: Fold <linux/platform_data/video-imxfb.h> into only user Uwe Kleine-König
@ 2022-07-23 17:57 ` Uwe Kleine-König
  2022-07-23 19:23 ` [PATCH 1/4] video: fb: imxfb: Drop platform data support Sam Ravnborg
  2022-07-26  7:08 ` Helge Deller
  4 siblings, 0 replies; 9+ messages in thread
From: Uwe Kleine-König @ 2022-07-23 17:57 UTC (permalink / raw)
  To: Sascha Hauer, Helge Deller, Shawn Guo
  Cc: linux-fbdev, dri-devel, NXP Linux Team, Pengutronix Kernel Team,
	linux-arm-kernel

This has several advantages:

 - No need for manual undo of the two functions in the error path and
   the remove function.
 - Drops error handling in .remove()
   Note that returning early in .remove() yields resource leaks that
   often result in access of freed memory or unmapped registers later.
 - Fixes a resource leak
   request_mem_region allocates memory for the returned pointer that was
   never freed.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/video/fbdev/imxfb.c | 18 +-----------------
 1 file changed, 1 insertion(+), 17 deletions(-)

diff --git a/drivers/video/fbdev/imxfb.c b/drivers/video/fbdev/imxfb.c
index fa6a19c1ae9b..c48477893dd0 100644
--- a/drivers/video/fbdev/imxfb.c
+++ b/drivers/video/fbdev/imxfb.c
@@ -937,13 +937,6 @@ static int imxfb_probe(struct platform_device *pdev)
 		info->fix.smem_len = max_t(size_t, info->fix.smem_len,
 				m->mode.xres * m->mode.yres * bytes_per_pixel);
 
-	res = request_mem_region(res->start, resource_size(res),
-				DRIVER_NAME);
-	if (!res) {
-		ret = -EBUSY;
-		goto failed_req;
-	}
-
 	fbi->clk_ipg = devm_clk_get(&pdev->dev, "ipg");
 	if (IS_ERR(fbi->clk_ipg)) {
 		ret = PTR_ERR(fbi->clk_ipg);
@@ -977,7 +970,7 @@ static int imxfb_probe(struct platform_device *pdev)
 		goto failed_getclock;
 	}
 
-	fbi->regs = ioremap(res->start, resource_size(res));
+	fbi->regs = devm_ioremap_resource(&pdev->dev, res);
 	if (fbi->regs == NULL) {
 		dev_err(&pdev->dev, "Cannot map frame buffer registers\n");
 		ret = -ENOMEM;
@@ -1049,11 +1042,9 @@ static int imxfb_probe(struct platform_device *pdev)
 	dma_free_wc(&pdev->dev, fbi->map_size, info->screen_buffer,
 		    fbi->map_dma);
 failed_map:
-	iounmap(fbi->regs);
 failed_ioremap:
 failed_getclock:
 	release_mem_region(res->start, resource_size(res));
-failed_req:
 failed_of_parse:
 	kfree(info->pseudo_palette);
 failed_init:
@@ -1065,11 +1056,6 @@ static int imxfb_remove(struct platform_device *pdev)
 {
 	struct fb_info *info = platform_get_drvdata(pdev);
 	struct imxfb_info *fbi = info->par;
-	struct resource *res;
-
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res)
-		return -EINVAL;
 
 	imxfb_disable_controller(fbi);
 
@@ -1077,8 +1063,6 @@ static int imxfb_remove(struct platform_device *pdev)
 	fb_dealloc_cmap(&info->cmap);
 	dma_free_wc(&pdev->dev, fbi->map_size, info->screen_buffer,
 		    fbi->map_dma);
-	iounmap(fbi->regs);
-	release_mem_region(res->start, resource_size(res));
 	kfree(info->pseudo_palette);
 	framebuffer_release(info);
 
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/4] video: fb: imxfb: Drop platform data support
  2022-07-23 17:57 [PATCH 1/4] video: fb: imxfb: Drop platform data support Uwe Kleine-König
                   ` (2 preceding siblings ...)
  2022-07-23 17:57 ` [PATCH 4/4] video: fb: imxfb: Convert request_mem_region + ioremap to devm_ioremap_resource Uwe Kleine-König
@ 2022-07-23 19:23 ` Sam Ravnborg
  2022-07-23 22:02   ` Uwe Kleine-König
  2022-07-26  7:08 ` Helge Deller
  4 siblings, 1 reply; 9+ messages in thread
From: Sam Ravnborg @ 2022-07-23 19:23 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: linux-fbdev, Sascha Hauer, dri-devel, NXP Linux Team,
	Pengutronix Kernel Team, Shawn Guo, Helge Deller,
	linux-arm-kernel

Hi Uwe,

On Sat, Jul 23, 2022 at 07:57:17PM +0200, Uwe Kleine-König wrote:
> No source file but the driver itself includes the header containing the
> platform data definition. The last user is gone since commit
> 8485adf17a15 ("ARM: imx: Remove imx device directory").
> 
> So we can safely drop platform data support.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Do imxfb offer something that is not supported by the DRM drivers?
If yes then the clean-up is good, if not then we could drop the driver?

	Sam

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/4] video: fb: imxfb: Drop platform data support
  2022-07-23 19:23 ` [PATCH 1/4] video: fb: imxfb: Drop platform data support Sam Ravnborg
@ 2022-07-23 22:02   ` Uwe Kleine-König
  2022-07-24  9:40     ` Sam Ravnborg
  0 siblings, 1 reply; 9+ messages in thread
From: Uwe Kleine-König @ 2022-07-23 22:02 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: linux-fbdev, Sascha Hauer, dri-devel, NXP Linux Team,
	Pengutronix Kernel Team, Shawn Guo, Helge Deller,
	linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 1116 bytes --]

Hi Sam,

On Sat, Jul 23, 2022 at 09:23:43PM +0200, Sam Ravnborg wrote:
> On Sat, Jul 23, 2022 at 07:57:17PM +0200, Uwe Kleine-König wrote:
> > No source file but the driver itself includes the header containing the
> > platform data definition. The last user is gone since commit
> > 8485adf17a15 ("ARM: imx: Remove imx device directory").
> > 
> > So we can safely drop platform data support.
> > 
> > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> 
> Do imxfb offer something that is not supported by the DRM drivers?
> If yes then the clean-up is good, if not then we could drop the driver?

It's for different i.MX variants. imxfb is for i.MX2x while the DRM
drivers in mainline are for i.MX6. (Not sure about the i.MX3 and i.MX5x
variants.)

Somewhere in the middle of my todo list is to mainline an i.MX2x DRM
driver that could replace the imxfb driver. If I only had a bit more
time ...

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/4] video: fb: imxfb: Drop platform data support
  2022-07-23 22:02   ` Uwe Kleine-König
@ 2022-07-24  9:40     ` Sam Ravnborg
  2022-07-24  9:46       ` Sam Ravnborg
  0 siblings, 1 reply; 9+ messages in thread
From: Sam Ravnborg @ 2022-07-24  9:40 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: linux-fbdev, Sascha Hauer, dri-devel, NXP Linux Team,
	Pengutronix Kernel Team, Shawn Guo, Helge Deller,
	linux-arm-kernel

Hi Uwe,

On Sun, Jul 24, 2022 at 12:02:18AM +0200, Uwe Kleine-König wrote:
> Hi Sam,
> 
> On Sat, Jul 23, 2022 at 09:23:43PM +0200, Sam Ravnborg wrote:
> > On Sat, Jul 23, 2022 at 07:57:17PM +0200, Uwe Kleine-König wrote:
> > > No source file but the driver itself includes the header containing the
> > > platform data definition. The last user is gone since commit
> > > 8485adf17a15 ("ARM: imx: Remove imx device directory").
> > > 
> > > So we can safely drop platform data support.
> > > 
> > > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > 
> > Do imxfb offer something that is not supported by the DRM drivers?
> > If yes then the clean-up is good, if not then we could drop the driver?
> 
> It's for different i.MX variants. imxfb is for i.MX2x while the DRM
> drivers in mainline are for i.MX6. (Not sure about the i.MX3 and i.MX5x
> variants.)
> 
> Somewhere in the middle of my todo list is to mainline an i.MX2x DRM
> driver that could replace the imxfb driver. If I only had a bit more
> time ...

There is drm/mxsfb, where Kconfig says:
"including i.MX23, i.MX28, i.MX6SX, i.MX7 and i.MX8M".

So there is already something but if this is a 1:1 replacement I dunno.

	Sam

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/4] video: fb: imxfb: Drop platform data support
  2022-07-24  9:40     ` Sam Ravnborg
@ 2022-07-24  9:46       ` Sam Ravnborg
  0 siblings, 0 replies; 9+ messages in thread
From: Sam Ravnborg @ 2022-07-24  9:46 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: linux-fbdev, Sascha Hauer, dri-devel, NXP Linux Team,
	Pengutronix Kernel Team, Shawn Guo, Helge Deller,
	linux-arm-kernel

Hi Uwe,

On Sun, Jul 24, 2022 at 11:40:22AM +0200, Sam Ravnborg wrote:
> Hi Uwe,
> 
> On Sun, Jul 24, 2022 at 12:02:18AM +0200, Uwe Kleine-König wrote:
> > Hi Sam,
> > 
> > On Sat, Jul 23, 2022 at 09:23:43PM +0200, Sam Ravnborg wrote:
> > > On Sat, Jul 23, 2022 at 07:57:17PM +0200, Uwe Kleine-König wrote:
> > > > No source file but the driver itself includes the header containing the
> > > > platform data definition. The last user is gone since commit
> > > > 8485adf17a15 ("ARM: imx: Remove imx device directory").
> > > > 
> > > > So we can safely drop platform data support.
> > > > 
> > > > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > > 
> > > Do imxfb offer something that is not supported by the DRM drivers?
> > > If yes then the clean-up is good, if not then we could drop the driver?
> > 
> > It's for different i.MX variants. imxfb is for i.MX2x while the DRM
> > drivers in mainline are for i.MX6. (Not sure about the i.MX3 and i.MX5x
> > variants.)
> > 
> > Somewhere in the middle of my todo list is to mainline an i.MX2x DRM
> > driver that could replace the imxfb driver. If I only had a bit more
> > time ...
> 
> There is drm/mxsfb, where Kconfig says:
> "including i.MX23, i.MX28, i.MX6SX, i.MX7 and i.MX8M".
> 
> So there is already something but if this is a 1:1 replacement I dunno.

I suddenly remembered we had the following commit:

f225f1393f034e17281274180626086276da766c ("video: fbdev: mxsfb: Remove driver")

So the fbdev counterpart of drm/mxsfb is already dropped.

	Sam

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/4] video: fb: imxfb: Drop platform data support
  2022-07-23 17:57 [PATCH 1/4] video: fb: imxfb: Drop platform data support Uwe Kleine-König
                   ` (3 preceding siblings ...)
  2022-07-23 19:23 ` [PATCH 1/4] video: fb: imxfb: Drop platform data support Sam Ravnborg
@ 2022-07-26  7:08 ` Helge Deller
  4 siblings, 0 replies; 9+ messages in thread
From: Helge Deller @ 2022-07-26  7:08 UTC (permalink / raw)
  To: Uwe Kleine-König, Sascha Hauer, Shawn Guo
  Cc: linux-fbdev, dri-devel, NXP Linux Team, Pengutronix Kernel Team,
	linux-arm-kernel

On 7/23/22 19:57, Uwe Kleine-König wrote:
> No source file but the driver itself includes the header containing the
> platform data definition. The last user is gone since commit
> 8485adf17a15 ("ARM: imx: Remove imx device directory").
>
> So we can safely drop platform data support.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

I've applied all 4 patches to the fbdev git tree.

Thanks!
Helge

> ---
>  drivers/video/fbdev/imxfb.c               | 99 ++++++++---------------
>  include/linux/platform_data/video-imxfb.h | 12 ---
>  2 files changed, 34 insertions(+), 77 deletions(-)
>
> diff --git a/drivers/video/fbdev/imxfb.c b/drivers/video/fbdev/imxfb.c
> index a2f644c97f28..85a5bf5639d9 100644
> --- a/drivers/video/fbdev/imxfb.c
> +++ b/drivers/video/fbdev/imxfb.c
> @@ -656,7 +656,6 @@ static int imxfb_activate_var(struct fb_var_screeninfo *var, struct fb_info *inf
>
>  static int imxfb_init_fbinfo(struct platform_device *pdev)
>  {
> -	struct imx_fb_platform_data *pdata = dev_get_platdata(&pdev->dev);
>  	struct fb_info *info = platform_get_drvdata(pdev);
>  	struct imxfb_info *fbi = info->par;
>  	struct device_node *np;
> @@ -690,25 +689,20 @@ static int imxfb_init_fbinfo(struct platform_device *pdev)
>  	info->fbops			= &imxfb_ops;
>  	info->flags			= FBINFO_FLAG_DEFAULT |
>  					  FBINFO_READS_FAST;
> -	if (pdata) {
> -		fbi->lscr1			= pdata->lscr1;
> -		fbi->dmacr			= pdata->dmacr;
> -		fbi->pwmr			= pdata->pwmr;
> -	} else {
> -		np = pdev->dev.of_node;
> -		info->var.grayscale = of_property_read_bool(np,
> -						"cmap-greyscale");
> -		fbi->cmap_inverse = of_property_read_bool(np, "cmap-inverse");
> -		fbi->cmap_static = of_property_read_bool(np, "cmap-static");
>
> -		fbi->lscr1 = IMXFB_LSCR1_DEFAULT;
> +	np = pdev->dev.of_node;
> +	info->var.grayscale = of_property_read_bool(np,
> +					"cmap-greyscale");
> +	fbi->cmap_inverse = of_property_read_bool(np, "cmap-inverse");
> +	fbi->cmap_static = of_property_read_bool(np, "cmap-static");
>
> -		of_property_read_u32(np, "fsl,lpccr", &fbi->pwmr);
> +	fbi->lscr1 = IMXFB_LSCR1_DEFAULT;
>
> -		of_property_read_u32(np, "fsl,lscr1", &fbi->lscr1);
> +	of_property_read_u32(np, "fsl,lpccr", &fbi->pwmr);
>
> -		of_property_read_u32(np, "fsl,dmacr", &fbi->dmacr);
> -	}
> +	of_property_read_u32(np, "fsl,lscr1", &fbi->lscr1);
> +
> +	of_property_read_u32(np, "fsl,dmacr", &fbi->dmacr);
>
>  	return 0;
>  }
> @@ -863,10 +857,10 @@ static int imxfb_probe(struct platform_device *pdev)
>  	struct imxfb_info *fbi;
>  	struct lcd_device *lcd;
>  	struct fb_info *info;
> -	struct imx_fb_platform_data *pdata;
>  	struct resource *res;
>  	struct imx_fb_videomode *m;
>  	const struct of_device_id *of_id;
> +	struct device_node *display_np;
>  	int ret, i;
>  	int bytes_per_pixel;
>
> @@ -884,8 +878,6 @@ static int imxfb_probe(struct platform_device *pdev)
>  	if (!res)
>  		return -ENODEV;
>
> -	pdata = dev_get_platdata(&pdev->dev);
> -
>  	info = framebuffer_alloc(sizeof(struct imxfb_info), &pdev->dev);
>  	if (!info)
>  		return -ENOMEM;
> @@ -898,43 +890,34 @@ static int imxfb_probe(struct platform_device *pdev)
>  	if (ret < 0)
>  		goto failed_init;
>
> -	if (pdata) {
> -		if (!fb_mode)
> -			fb_mode = pdata->mode[0].mode.name;
> -
> -		fbi->mode = pdata->mode;
> -		fbi->num_modes = pdata->num_modes;
> -	} else {
> -		struct device_node *display_np;
> -		fb_mode = NULL;
> -
> -		display_np = of_parse_phandle(pdev->dev.of_node, "display", 0);
> -		if (!display_np) {
> -			dev_err(&pdev->dev, "No display defined in devicetree\n");
> -			ret = -EINVAL;
> -			goto failed_of_parse;
> -		}
> +	fb_mode = NULL;
>
> -		/*
> -		 * imxfb does not support more modes, we choose only the native
> -		 * mode.
> -		 */
> -		fbi->num_modes = 1;
> -
> -		fbi->mode = devm_kzalloc(&pdev->dev,
> -				sizeof(struct imx_fb_videomode), GFP_KERNEL);
> -		if (!fbi->mode) {
> -			ret = -ENOMEM;
> -			of_node_put(display_np);
> -			goto failed_of_parse;
> -		}
> +	display_np = of_parse_phandle(pdev->dev.of_node, "display", 0);
> +	if (!display_np) {
> +		dev_err(&pdev->dev, "No display defined in devicetree\n");
> +		ret = -EINVAL;
> +		goto failed_of_parse;
> +	}
>
> -		ret = imxfb_of_read_mode(&pdev->dev, display_np, fbi->mode);
> +	/*
> +	 * imxfb does not support more modes, we choose only the native
> +	 * mode.
> +	 */
> +	fbi->num_modes = 1;
> +
> +	fbi->mode = devm_kzalloc(&pdev->dev,
> +			sizeof(struct imx_fb_videomode), GFP_KERNEL);
> +	if (!fbi->mode) {
> +		ret = -ENOMEM;
>  		of_node_put(display_np);
> -		if (ret)
> -			goto failed_of_parse;
> +		goto failed_of_parse;
>  	}
>
> +	ret = imxfb_of_read_mode(&pdev->dev, display_np, fbi->mode);
> +	of_node_put(display_np);
> +	if (ret)
> +		goto failed_of_parse;
> +
>  	/* Calculate maximum bytes used per pixel. In most cases this should
>  	 * be the same as m->bpp/8 */
>  	m = &fbi->mode[0];
> @@ -1001,13 +984,6 @@ static int imxfb_probe(struct platform_device *pdev)
>
>  	info->fix.smem_start = fbi->map_dma;
>
> -	if (pdata && pdata->init) {
> -		ret = pdata->init(fbi->pdev);
> -		if (ret)
> -			goto failed_platform_init;
> -	}
> -
> -
>  	INIT_LIST_HEAD(&info->modelist);
>  	for (i = 0; i < fbi->num_modes; i++)
>  		fb_add_videomode(&fbi->mode[i].mode, &info->modelist);
> @@ -1059,9 +1035,6 @@ static int imxfb_probe(struct platform_device *pdev)
>  failed_register:
>  	fb_dealloc_cmap(&info->cmap);
>  failed_cmap:
> -	if (pdata && pdata->exit)
> -		pdata->exit(fbi->pdev);
> -failed_platform_init:
>  	dma_free_wc(&pdev->dev, fbi->map_size, info->screen_buffer,
>  		    fbi->map_dma);
>  failed_map:
> @@ -1079,7 +1052,6 @@ static int imxfb_probe(struct platform_device *pdev)
>
>  static int imxfb_remove(struct platform_device *pdev)
>  {
> -	struct imx_fb_platform_data *pdata;
>  	struct fb_info *info = platform_get_drvdata(pdev);
>  	struct imxfb_info *fbi = info->par;
>  	struct resource *res;
> @@ -1092,9 +1064,6 @@ static int imxfb_remove(struct platform_device *pdev)
>
>  	unregister_framebuffer(info);
>  	fb_dealloc_cmap(&info->cmap);
> -	pdata = dev_get_platdata(&pdev->dev);
> -	if (pdata && pdata->exit)
> -		pdata->exit(fbi->pdev);
>  	dma_free_wc(&pdev->dev, fbi->map_size, info->screen_buffer,
>  		    fbi->map_dma);
>  	iounmap(fbi->regs);
> diff --git a/include/linux/platform_data/video-imxfb.h b/include/linux/platform_data/video-imxfb.h
> index 02812651af7d..b80a156a6617 100644
> --- a/include/linux/platform_data/video-imxfb.h
> +++ b/include/linux/platform_data/video-imxfb.h
> @@ -55,16 +55,4 @@ struct imx_fb_videomode {
>  	unsigned char	bpp;
>  };
>
> -struct imx_fb_platform_data {
> -	struct imx_fb_videomode *mode;
> -	int		num_modes;
> -
> -	u_int		pwmr;
> -	u_int		lscr1;
> -	u_int		dmacr;
> -
> -	int (*init)(struct platform_device *);
> -	void (*exit)(struct platform_device *);
> -};
> -
>  #endif /* ifndef __MACH_IMXFB_H__ */
>
> base-commit: f2906aa863381afb0015a9eb7fefad885d4e5a56


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-07-26  7:09 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-23 17:57 [PATCH 1/4] video: fb: imxfb: Drop platform data support Uwe Kleine-König
2022-07-23 17:57 ` [PATCH 2/4] video: fb: imxfb: Drop unused symbols from header Uwe Kleine-König
2022-07-23 17:57 ` [PATCH 3/4] video: fb: imxfb: Fold <linux/platform_data/video-imxfb.h> into only user Uwe Kleine-König
2022-07-23 17:57 ` [PATCH 4/4] video: fb: imxfb: Convert request_mem_region + ioremap to devm_ioremap_resource Uwe Kleine-König
2022-07-23 19:23 ` [PATCH 1/4] video: fb: imxfb: Drop platform data support Sam Ravnborg
2022-07-23 22:02   ` Uwe Kleine-König
2022-07-24  9:40     ` Sam Ravnborg
2022-07-24  9:46       ` Sam Ravnborg
2022-07-26  7:08 ` Helge Deller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).