# \[PATCH 00/12\] ARM: davinci: da850-evm: remove more legacy GPIO calls

- Subsystems: FRAMEBUFFER LAYER, ARM PORT, BACKLIGHT CLASS/SUBSYSTEM, THE REST, TI DAVINCI MACHINE SUPPORT
- Maintainers: Helge Deller, Russell King, Lee Jones, Daniel Thompson, Jingoo Han, Linus Torvalds, Bartosz Golaszewski
- Series: 12 patches touching 5 files, +196/-170
- Status: SUPERSEDED (Superseded by v2 posted 2019-07-22)
- Superseded by v2 (posted 2019-07-22).
- Revision v1 (2 revisions archived).
- List: linux-fbdev
- 28 messages, 6 authors
- Page: https://ratatoskr.run/linux-fbdev/2019/06/5639683/t

## \[PATCH 00/12\] ARM: davinci: da850-evm: remove more legacy GPIO calls

- From: Bartosz Golaszewski \<hidden\>
- Date: 2019-06-25 16:34:55 
- Message: https://ratatoskr.run/linux-fbdev/2019/06/5639683.md

```text
From: Bartosz Golaszewski <redacted>

This is another small step on the path to liberating davinci from legacy
GPIO API calls and shrinking the davinci GPIO driver by not having to
support the base GPIO number anymore.

This time we're removing the legacy calls used indirectly by the LCDC
fbdev driver.

The first three patches modify the GPIO backlight driver. The first
of them adds the necessary functionality, the other two are just
tweaks and cleanups.

Next two patches enable the GPIO backlight driver in
davinci_all_defconfig.

Patch 6/12 models the backlight GPIO as an actual GPIO backlight device.

Patches 7-9 extend the fbdev driver with regulator support and convert
the da850-evm board file to using it.

Last three patches are improvements to the da8xx fbdev driver since
we're already touching it in this series.

Bartosz Golaszewski (12):
  backlight: gpio: allow to probe non-pdata devices from board files
  backlight: gpio: use a helper variable for &pdev->dev
  backlight: gpio: pull the non-pdata device probing code into probe()
  ARM: davinci: refresh davinci_all_defconfig
  ARM: davinci_all_defconfig: enable GPIO backlight
  ARM: davinci: da850-evm: model the backlight GPIO as an actual device
  fbdev: da8xx: add support for a regulator
  ARM: davinci: da850-evm: switch to using a fixed regulator for lcdc
  fbdev: da8xx: remove panel_power_ctrl() callback from platform data
  fbdev: da8xx-fb: use devm_platform_ioremap_resource()
  fbdev: da8xx-fb: drop a redundant if
  fbdev: da8xx: use resource management for dma

 arch/arm/configs/davinci_all_defconfig   |  28 +++---
 arch/arm/mach-davinci/board-da850-evm.c  |  90 ++++++++++++-----
 drivers/video/backlight/gpio_backlight.c |  67 +++++--------
 drivers/video/fbdev/da8xx-fb.c           | 118 +++++++++++++----------
 include/video/da8xx-fb.h                 |   1 -
 5 files changed, 165 insertions(+), 139 deletions(-)

-- 
2.21.0
```

## \[PATCH 02/12\] backlight: gpio: use a helper variable for \&pdev-\>dev

- From: Bartosz Golaszewski \<hidden\>
- Date: 2019-06-25 16:35:00 
- Message: https://ratatoskr.run/linux-fbdev/2019/06/5639684.md

```text
From: Bartosz Golaszewski <redacted>

Instead of dereferencing pdev each time, use a helper variable for
the associated device pointer.

Signed-off-by: Bartosz Golaszewski <redacted>
---
 drivers/video/backlight/gpio_backlight.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c
index 654c19d3a81d..8adbc8d75097 100644
--- a/drivers/video/backlight/gpio_backlight.c
+++ b/drivers/video/backlight/gpio_backlight.c
@@ -83,15 +83,16 @@ static int gpio_backlight_probe(struct platform_device *pdev)
 	struct gpio_backlight_platform_data *pdata  		dev_get_platdata(&pdev->dev);
 	struct backlight_properties props;
+	struct device *dev = &pdev->dev;
 	struct backlight_device *bl;
 	struct gpio_backlight *gbl;
 	int ret;
 
-	gbl = devm_kzalloc(&pdev->dev, sizeof(*gbl), GFP_KERNEL);
+	gbl = devm_kzalloc(dev, sizeof(*gbl), GFP_KERNEL);
 	if (gbl = NULL)
 		return -ENOMEM;
 
-	gbl->dev = &pdev->dev;
+	gbl->dev = dev;
 
 	if (pdata) {
 		/*
@@ -108,7 +109,7 @@ static int gpio_backlight_probe(struct platform_device *pdev)
 		ret = devm_gpio_request_one(gbl->dev, pdata->gpio, flags,
 					    pdata ? pdata->name : "backlight");
 		if (ret < 0) {
-			dev_err(&pdev->dev, "unable to request GPIO\n");
+			dev_err(dev, "unable to request GPIO\n");
 			return ret;
 		}
 		gbl->gpiod = gpio_to_desc(pdata->gpio);
@@ -123,11 +124,10 @@ static int gpio_backlight_probe(struct platform_device *pdev)
 	memset(&props, 0, sizeof(props));
 	props.type = BACKLIGHT_RAW;
 	props.max_brightness = 1;
-	bl = devm_backlight_device_register(&pdev->dev, dev_name(&pdev->dev),
-					&pdev->dev, gbl, &gpio_backlight_ops,
-					&props);
+	bl = devm_backlight_device_register(dev, dev_name(dev), dev, gbl,
+					    &gpio_backlight_ops, &props);
 	if (IS_ERR(bl)) {
-		dev_err(&pdev->dev, "failed to register backlight\n");
+		dev_err(dev, "failed to register backlight\n");
 		return PTR_ERR(bl);
 	}
 
-- 
2.21.0
```

## \[PATCH 05/12\] ARM: davinci\_all\_defconfig: enable GPIO backlight

- From: Bartosz Golaszewski \<hidden\>
- Date: 2019-06-25 16:35:04 
- Message: https://ratatoskr.run/linux-fbdev/2019/06/5639685.md

```text
From: Bartosz Golaszewski <redacted>

Enable the GPIO backlight module in davinci_all_defconfig.

Signed-off-by: Bartosz Golaszewski <redacted>
---
 arch/arm/configs/davinci_all_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/configs/davinci_all_defconfig b/arch/arm/configs/davinci_all_defconfig
index 13d7846c613d..06855b2bce7e 100644
--- a/arch/arm/configs/davinci_all_defconfig
+++ b/arch/arm/configs/davinci_all_defconfig
@@ -158,6 +158,7 @@ CONFIG_FB=y
 CONFIG_FIRMWARE_EDID=y
 CONFIG_FB_DA8XX=y
 CONFIG_BACKLIGHT_PWM=m
+CONFIG_BACKLIGHT_GPIO=m
 CONFIG_FRAMEBUFFER_CONSOLE=y
 CONFIG_LOGO=y
 CONFIG_SOUND=m
-- 
2.21.0
```

## \[PATCH 08/12\] ARM: davinci: da850-evm: switch to using a fixed regulator for lcdc

- From: Bartosz Golaszewski \<hidden\>
- Date: 2019-06-25 16:35:07 
- Message: https://ratatoskr.run/linux-fbdev/2019/06/5639686.md

```text
From: Bartosz Golaszewski <redacted>

Now that the da8xx fbdev driver supports power control with an actual
regulator, switch to using a fixed power supply for da850-evm.

Signed-off-by: Bartosz Golaszewski <redacted>
---
 arch/arm/mach-davinci/board-da850-evm.c | 62 ++++++++++++++++++-------
 1 file changed, 44 insertions(+), 18 deletions(-)

diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index ffda623bb543..d26950f605f4 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -802,12 +802,6 @@ static const short da850_evm_mmcsd0_pins[] __initconst = {
 	-1
 };
 
-static void da850_panel_power_ctrl(int val)
-{
-	/* lcd power */
-	gpio_set_value(DA850_LCD_PWR_PIN, val);
-}
-
 static struct property_entry da850_lcd_backlight_props[] = {
 	PROPERTY_ENTRY_BOOL("default-on"),
 	{ }
@@ -827,28 +821,61 @@ static const struct platform_device_info da850_lcd_backlight_info = {
 	.properties	= da850_lcd_backlight_props,
 };
 
+static struct regulator_consumer_supply da850_lcd_supplies[] = {
+	REGULATOR_SUPPLY("lcd", NULL),
+};
+
+static struct regulator_init_data da850_lcd_supply_data = {
+	.consumer_supplies	= da850_lcd_supplies,
+	.num_consumer_supplies	= ARRAY_SIZE(da850_lcd_supplies),
+	.constraints    = {
+		.valid_ops_mask = REGULATOR_CHANGE_STATUS,
+	},
+};
+
+static struct fixed_voltage_config da850_lcd_supply = {
+	.supply_name		= "lcd",
+	.microvolts		= 33000000,
+	.init_data		= &da850_lcd_supply_data,
+};
+
+static struct platform_device da850_lcd_supply_device = {
+	.name			= "reg-fixed-voltage",
+	.id			= 1, /* Dummy fixed regulator is 0 */
+	.dev			= {
+		.platform_data = &da850_lcd_supply,
+	},
+};
+
+static struct gpiod_lookup_table da850_lcd_supply_gpio_table = {
+	.dev_id			= "reg-fixed-voltage.1",
+	.table = {
+		GPIO_LOOKUP("davinci_gpio", DA850_LCD_PWR_PIN, NULL, 0),
+		{ }
+	},
+};
+
+static struct gpiod_lookup_table *da850_lcd_gpio_lookups[] = {
+	&da850_lcd_backlight_gpio_table,
+	&da850_lcd_supply_gpio_table,
+};
+
 static int da850_lcd_hw_init(void)
 {
 	struct platform_device *backlight;
 	int status;
 
-	gpiod_add_lookup_table(&da850_lcd_backlight_gpio_table);
+	gpiod_add_lookup_tables(da850_lcd_gpio_lookups,
+				ARRAY_SIZE(da850_lcd_gpio_lookups));
+
 	backlight = platform_device_register_full(&da850_lcd_backlight_info);
 	if (IS_ERR(backlight))
 		return PTR_ERR(backlight);
 
-	status = gpio_request(DA850_LCD_PWR_PIN, "lcd pwr");
-	if (status < 0)
+	status = platform_device_register(&da850_lcd_supply_device);
+	if (status)
 		return status;
 
-	gpio_direction_output(DA850_LCD_PWR_PIN, 0);
-
-	/* Switch off panel power */
-	da850_panel_power_ctrl(0);
-
-	/* Switch on panel power */
-	da850_panel_power_ctrl(1);
-
 	return 0;
 }
 
@@ -1458,7 +1485,6 @@ static __init void da850_evm_init(void)
 	if (ret)
 		pr_warn("%s: LCD initialization failed: %d\n", __func__, ret);
 
-	sharp_lk043t1dg01_pdata.panel_power_ctrl = da850_panel_power_ctrl,
 	ret = da8xx_register_lcdc(&sharp_lk043t1dg01_pdata);
 	if (ret)
 		pr_warn("%s: LCDC registration failed: %d\n", __func__, ret);
-- 
2.21.0
```

## \[PATCH 11/12\] fbdev: da8xx-fb: drop a redundant if

- From: Bartosz Golaszewski \<hidden\>
- Date: 2019-06-25 16:35:12 
- Message: https://ratatoskr.run/linux-fbdev/2019/06/5639687.md

```text
From: Bartosz Golaszewski <redacted>

The driver data is always set in probe. The remove() callback won't be
called if probe failed which is the only way for it to be NULL. Remove
the redundant if.

Signed-off-by: Bartosz Golaszewski <redacted>
---
 drivers/video/fbdev/da8xx-fb.c | 43 ++++++++++++++++------------------
 1 file changed, 20 insertions(+), 23 deletions(-)

diff --git a/drivers/video/fbdev/da8xx-fb.c b/drivers/video/fbdev/da8xx-fb.c
index 4dda194d6b8f..6b11a8108108 100644
--- a/drivers/video/fbdev/da8xx-fb.c
+++ b/drivers/video/fbdev/da8xx-fb.c
@@ -1067,37 +1067,34 @@ static void lcd_da8xx_cpufreq_deregister(struct da8xx_fb_par *par)
 static int fb_remove(struct platform_device *dev)
 {
 	struct fb_info *info = dev_get_drvdata(&dev->dev);
+	struct da8xx_fb_par *par = info->par;
 	int ret;
 
-	if (info) {
-		struct da8xx_fb_par *par = info->par;
-
 #ifdef CONFIG_CPU_FREQ
-		lcd_da8xx_cpufreq_deregister(par);
+	lcd_da8xx_cpufreq_deregister(par);
 #endif
-		if (par->lcd_supply) {
-			ret = regulator_disable(par->lcd_supply);
-			if (ret)
-				return ret;
-		}
+	if (par->lcd_supply) {
+		ret = regulator_disable(par->lcd_supply);
+		if (ret)
+			return ret;
+	}
 
-		lcd_disable_raster(DA8XX_FRAME_WAIT);
-		lcdc_write(0, LCD_RASTER_CTRL_REG);
+	lcd_disable_raster(DA8XX_FRAME_WAIT);
+	lcdc_write(0, LCD_RASTER_CTRL_REG);
 
-		/* disable DMA  */
-		lcdc_write(0, LCD_DMA_CTRL_REG);
+	/* disable DMA  */
+	lcdc_write(0, LCD_DMA_CTRL_REG);
 
-		unregister_framebuffer(info);
-		fb_dealloc_cmap(&info->cmap);
-		dma_free_coherent(par->dev, PALETTE_SIZE, par->v_palette_base,
-				  par->p_palette_base);
-		dma_free_coherent(par->dev, par->vram_size, par->vram_virt,
-				  par->vram_phys);
-		pm_runtime_put_sync(&dev->dev);
-		pm_runtime_disable(&dev->dev);
-		framebuffer_release(info);
+	unregister_framebuffer(info);
+	fb_dealloc_cmap(&info->cmap);
+	dma_free_coherent(par->dev, PALETTE_SIZE, par->v_palette_base,
+			  par->p_palette_base);
+	dma_free_coherent(par->dev, par->vram_size, par->vram_virt,
+			  par->vram_phys);
+	pm_runtime_put_sync(&dev->dev);
+	pm_runtime_disable(&dev->dev);
+	framebuffer_release(info);
 
-	}
 	return 0;
 }
 
-- 
2.21.0
```

## \[PATCH 12/12\] fbdev: da8xx: use resource management for dma

- From: Bartosz Golaszewski \<hidden\>
- Date: 2019-06-25 16:35:14 
- Message: https://ratatoskr.run/linux-fbdev/2019/06/5639688.md

```text
From: Bartosz Golaszewski <redacted>

Use managed variants of dma alloc functions in the da8xx fbdev driver.

Signed-off-by: Bartosz Golaszewski <redacted>
---
 drivers/video/fbdev/da8xx-fb.c | 32 ++++++++++----------------------
 1 file changed, 10 insertions(+), 22 deletions(-)

diff --git a/drivers/video/fbdev/da8xx-fb.c b/drivers/video/fbdev/da8xx-fb.c
index 6b11a8108108..22f79b3c2326 100644
--- a/drivers/video/fbdev/da8xx-fb.c
+++ b/drivers/video/fbdev/da8xx-fb.c
@@ -1087,10 +1087,6 @@ static int fb_remove(struct platform_device *dev)
 
 	unregister_framebuffer(info);
 	fb_dealloc_cmap(&info->cmap);
-	dma_free_coherent(par->dev, PALETTE_SIZE, par->v_palette_base,
-			  par->p_palette_base);
-	dma_free_coherent(par->dev, par->vram_size, par->vram_virt,
-			  par->vram_phys);
 	pm_runtime_put_sync(&dev->dev);
 	pm_runtime_disable(&dev->dev);
 	framebuffer_release(info);
@@ -1428,10 +1424,10 @@ static int fb_probe(struct platform_device *device)
 	par->vram_size = roundup(par->vram_size/8, ulcm);
 	par->vram_size = par->vram_size * LCD_NUM_BUFFERS;
 
-	par->vram_virt = dma_alloc_coherent(par->dev,
-					    par->vram_size,
-					    &par->vram_phys,
-					    GFP_KERNEL | GFP_DMA);
+	par->vram_virt = dmam_alloc_coherent(par->dev,
+					     par->vram_size,
+					     &par->vram_phys,
+					     GFP_KERNEL | GFP_DMA);
 	if (!par->vram_virt) {
 		dev_err(&device->dev,
 			"GLCD: kmalloc for frame buffer failed\n");
@@ -1449,20 +1445,20 @@ static int fb_probe(struct platform_device *device)
 		da8xx_fb_fix.line_length - 1;
 
 	/* allocate palette buffer */
-	par->v_palette_base = dma_alloc_coherent(par->dev, PALETTE_SIZE,
-						 &par->p_palette_base,
-						 GFP_KERNEL | GFP_DMA);
+	par->v_palette_base = dmam_alloc_coherent(par->dev, PALETTE_SIZE,
+						  &par->p_palette_base,
+						  GFP_KERNEL | GFP_DMA);
 	if (!par->v_palette_base) {
 		dev_err(&device->dev,
 			"GLCD: kmalloc for palette buffer failed\n");
 		ret = -EINVAL;
-		goto err_release_fb_mem;
+		goto err_release_fb;
 	}
 
 	par->irq = platform_get_irq(device, 0);
 	if (par->irq < 0) {
 		ret = -ENOENT;
-		goto err_release_pl_mem;
+		goto err_release_fb;
 	}
 
 	da8xx_fb_var.grayscale @@ -1480,7 +1476,7 @@ static int fb_probe(struct platform_device *device)
 
 	ret = fb_alloc_cmap(&da8xx_fb_info->cmap, PALETTE_SIZE, 0);
 	if (ret)
-		goto err_release_pl_mem;
+		goto err_release_fb;
 	da8xx_fb_info->cmap.len = par->palette_sz;
 
 	/* initialize var_screeninfo */
@@ -1534,14 +1530,6 @@ static int fb_probe(struct platform_device *device)
 err_dealloc_cmap:
 	fb_dealloc_cmap(&da8xx_fb_info->cmap);
 
-err_release_pl_mem:
-	dma_free_coherent(par->dev, PALETTE_SIZE, par->v_palette_base,
-			  par->p_palette_base);
-
-err_release_fb_mem:
-	dma_free_coherent(par->dev, par->vram_size, par->vram_virt,
-		          par->vram_phys);
-
 err_release_fb:
 	framebuffer_release(da8xx_fb_info);
 
-- 
2.21.0
```

## \[PATCH 10/12\] fbdev: da8xx-fb: use devm\_platform\_ioremap\_resource()

- From: Bartosz Golaszewski \<hidden\>
- Date: 2019-06-25 16:35:18 
- Message: https://ratatoskr.run/linux-fbdev/2019/06/5639689.md

```text
From: Bartosz Golaszewski <redacted>

Shrink the code a bit by using the new helper wrapping the calls to
platform_get_resource() and devm_ioremap_resource() together.

Signed-off-by: Bartosz Golaszewski <redacted>
---
 drivers/video/fbdev/da8xx-fb.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/video/fbdev/da8xx-fb.c b/drivers/video/fbdev/da8xx-fb.c
index 328de29c4933..4dda194d6b8f 100644
--- a/drivers/video/fbdev/da8xx-fb.c
+++ b/drivers/video/fbdev/da8xx-fb.c
@@ -1339,7 +1339,6 @@ static int fb_probe(struct platform_device *device)
 {
 	struct da8xx_lcdc_platform_data *fb_pdata  						dev_get_platdata(&device->dev);
-	struct resource *lcdc_regs;
 	struct lcd_ctrl_config *lcd_cfg;
 	struct fb_videomode *lcdc_info;
 	struct fb_info *da8xx_fb_info;
@@ -1357,8 +1356,7 @@ static int fb_probe(struct platform_device *device)
 	if (lcdc_info = NULL)
 		return -ENODEV;
 
-	lcdc_regs = platform_get_resource(device, IORESOURCE_MEM, 0);
-	da8xx_fb_reg_base = devm_ioremap_resource(&device->dev, lcdc_regs);
+	da8xx_fb_reg_base = devm_platform_ioremap_resource(device, 0);
 	if (IS_ERR(da8xx_fb_reg_base))
 		return PTR_ERR(da8xx_fb_reg_base);
 
-- 
2.21.0
```

## \[PATCH 07/12\] fbdev: da8xx: add support for a regulator

- From: Bartosz Golaszewski \<hidden\>
- Date: 2019-06-25 16:35:26 
- Message: https://ratatoskr.run/linux-fbdev/2019/06/5639691.md

```text
From: Bartosz Golaszewski <redacted>

We want to remove the hacky platform data callback for power control.
Add a regulator to the driver data and enable/disable it next to
the current panel_power_ctrl() calls. We will use it in subsequent
patch on da850-evm.

Signed-off-by: Bartosz Golaszewski <redacted>
---
 drivers/video/fbdev/da8xx-fb.c | 54 ++++++++++++++++++++++++++++++----
 1 file changed, 49 insertions(+), 5 deletions(-)

diff --git a/drivers/video/fbdev/da8xx-fb.c b/drivers/video/fbdev/da8xx-fb.c
index 9ea817ac1d81..4fa99ff79f3b 100644
--- a/drivers/video/fbdev/da8xx-fb.c
+++ b/drivers/video/fbdev/da8xx-fb.c
@@ -19,6 +19,7 @@
 #include <linux/clk.h>
 #include <linux/cpufreq.h>
 #include <linux/console.h>
+#include <linux/regulator/consumer.h>
 #include <linux/spinlock.h>
 #include <linux/slab.h>
 #include <linux/delay.h>
@@ -165,6 +166,7 @@ struct da8xx_fb_par {
 #endif
 	unsigned int		lcdc_clk_rate;
 	void (*panel_power_ctrl)(int);
+	struct regulator	*lcd_supply;
 	u32 pseudo_palette[16];
 	struct fb_videomode	mode;
 	struct lcd_ctrl_config	cfg;
@@ -1066,6 +1068,7 @@ static void lcd_da8xx_cpufreq_deregister(struct da8xx_fb_par *par)
 static int fb_remove(struct platform_device *dev)
 {
 	struct fb_info *info = dev_get_drvdata(&dev->dev);
+	int ret;
 
 	if (info) {
 		struct da8xx_fb_par *par = info->par;
@@ -1073,8 +1076,13 @@ static int fb_remove(struct platform_device *dev)
 #ifdef CONFIG_CPU_FREQ
 		lcd_da8xx_cpufreq_deregister(par);
 #endif
-		if (par->panel_power_ctrl)
+		if (par->panel_power_ctrl) {
 			par->panel_power_ctrl(0);
+		} else if (par->lcd_supply) {
+			ret = regulator_disable(par->lcd_supply);
+			if (ret)
+				return ret;
+		}
 
 		lcd_disable_raster(DA8XX_FRAME_WAIT);
 		lcdc_write(0, LCD_RASTER_CTRL_REG);
@@ -1179,15 +1187,25 @@ static int cfb_blank(int blank, struct fb_info *info)
 	case FB_BLANK_UNBLANK:
 		lcd_enable_raster();
 
-		if (par->panel_power_ctrl)
+		if (par->panel_power_ctrl) {
 			par->panel_power_ctrl(1);
+		} else if (par->lcd_supply) {
+			ret = regulator_enable(par->lcd_supply);
+			if (ret)
+				return ret;
+		}
 		break;
 	case FB_BLANK_NORMAL:
 	case FB_BLANK_VSYNC_SUSPEND:
 	case FB_BLANK_HSYNC_SUSPEND:
 	case FB_BLANK_POWERDOWN:
-		if (par->panel_power_ctrl)
+		if (par->panel_power_ctrl) {
 			par->panel_power_ctrl(0);
+		} else if (par->lcd_supply) {
+			ret = regulator_disable(par->lcd_supply);
+			if (ret)
+				return ret;
+		}
 
 		lcd_disable_raster(DA8XX_FRAME_WAIT);
 		break;
@@ -1401,6 +1419,20 @@ static int fb_probe(struct platform_device *device)
 		par->panel_power_ctrl(1);
 	}
 
+	par->lcd_supply = devm_regulator_get_optional(&device->dev, "lcd");
+	if (IS_ERR(par->lcd_supply)) {
+		if (PTR_ERR(par->lcd_supply) = -EPROBE_DEFER) {
+			ret = -EPROBE_DEFER;
+			goto err_pm_runtime_disable;
+		}
+
+		par->lcd_supply = NULL;
+	} else {
+		ret = regulator_enable(par->lcd_supply);
+		if (ret)
+			goto err_pm_runtime_disable;
+	}
+
 	fb_videomode_to_var(&da8xx_fb_var, lcdc_info);
 	par->cfg = *lcd_cfg;
 
@@ -1604,10 +1636,16 @@ static int fb_suspend(struct device *dev)
 {
 	struct fb_info *info = dev_get_drvdata(dev);
 	struct da8xx_fb_par *par = info->par;
+	int ret;
 
 	console_lock();
-	if (par->panel_power_ctrl)
+	if (par->panel_power_ctrl) {
 		par->panel_power_ctrl(0);
+	} else if (par->lcd_supply) {
+		ret = regulator_disable(par->lcd_supply);
+		if (ret)
+			return ret;
+	}
 
 	fb_set_suspend(info, 1);
 	lcd_disable_raster(DA8XX_FRAME_WAIT);
@@ -1621,6 +1659,7 @@ static int fb_resume(struct device *dev)
 {
 	struct fb_info *info = dev_get_drvdata(dev);
 	struct da8xx_fb_par *par = info->par;
+	int ret;
 
 	console_lock();
 	pm_runtime_get_sync(dev);
@@ -1628,8 +1667,13 @@ static int fb_resume(struct device *dev)
 	if (par->blank = FB_BLANK_UNBLANK) {
 		lcd_enable_raster();
 
-		if (par->panel_power_ctrl)
+		if (par->panel_power_ctrl) {
 			par->panel_power_ctrl(1);
+		} else if (par->lcd_supply) {
+			ret = regulator_enable(par->lcd_supply);
+			if (ret)
+				return ret;
+		}
 	}
 
 	fb_set_suspend(info, 0);
-- 
2.21.0
```

## \[PATCH 04/12\] ARM: davinci: refresh davinci\_all\_defconfig

- From: Bartosz Golaszewski \<hidden\>
- Date: 2019-06-25 16:35:31 
- Message: https://ratatoskr.run/linux-fbdev/2019/06/5639692.md

```text
From: Bartosz Golaszewski <redacted>

Refresh davinci_all_defconfig with current master.

Signed-off-by: Bartosz Golaszewski <redacted>
---
 arch/arm/configs/davinci_all_defconfig | 27 ++++++++++----------------
 1 file changed, 10 insertions(+), 17 deletions(-)

diff --git a/arch/arm/configs/davinci_all_defconfig b/arch/arm/configs/davinci_all_defconfig
index 4a8cad4d3707..13d7846c613d 100644
--- a/arch/arm/configs/davinci_all_defconfig
+++ b/arch/arm/configs/davinci_all_defconfig
@@ -3,6 +3,7 @@ CONFIG_SYSVIPC=y
 CONFIG_POSIX_MQUEUE=y
 CONFIG_NO_HZ=y
 CONFIG_HIGH_RES_TIMERS=y
+CONFIG_PREEMPT=y
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 CONFIG_LOG_BUF_SHIFT
@@ -10,13 +11,6 @@ CONFIG_CGROUPS=y
 CONFIG_CHECKPOINT_RESTORE=y
 CONFIG_BLK_DEV_INITRD=y
 CONFIG_EXPERT=y
-CONFIG_MODULES=y
-CONFIG_MODULE_UNLOAD=y
-CONFIG_MODULE_FORCE_UNLOAD=y
-CONFIG_MODVERSIONS=y
-CONFIG_PARTITION_ADVANCED=y
-# CONFIG_IOSCHED_DEADLINE is not set
-# CONFIG_IOSCHED_CFQ is not set
 CONFIG_ARCH_DAVINCI=y
 CONFIG_ARCH_DAVINCI_DM644x=y
 CONFIG_ARCH_DAVINCI_DM355=y
@@ -31,9 +25,7 @@ CONFIG_MACH_MITYOMAPL138=y
 CONFIG_MACH_OMAPL138_HAWKBOARD=y
 CONFIG_DAVINCI_MUX_DEBUG=y
 CONFIG_DAVINCI_MUX_WARNINGS=y
-CONFIG_PREEMPT=y
 CONFIG_AEABI=y
-CONFIG_CMA=y
 CONFIG_SECCOMP=y
 CONFIG_ZBOOT_ROM_TEXT=0x0
 CONFIG_ZBOOT_ROM_BSS=0x0
@@ -46,6 +38,12 @@ CONFIG_CPU_FREQ_GOV_PERFORMANCE=m
 CONFIG_CPU_FREQ_GOV_POWERSAVE=m
 CONFIG_CPU_FREQ_GOV_ONDEMAND=m
 CONFIG_CPU_IDLE=y
+CONFIG_MODULES=y
+CONFIG_MODULE_UNLOAD=y
+CONFIG_MODULE_FORCE_UNLOAD=y
+CONFIG_MODVERSIONS=y
+CONFIG_PARTITION_ADVANCED=y
+CONFIG_CMA=y
 CONFIG_NET=y
 CONFIG_PACKET=y
 CONFIG_UNIX=y
@@ -63,7 +61,6 @@ CONFIG_BT_HCIUART_LL=y
 CONFIG_DEVTMPFS=y
 CONFIG_DEVTMPFS_MOUNT=y
 CONFIG_FW_LOADER=m
-CONFIG_DMA_CMA=y
 CONFIG_DA8XX_MSTPRI=y
 CONFIG_MTD=m
 CONFIG_MTD_TESTS=m
@@ -167,8 +164,6 @@ CONFIG_SOUND=m
 CONFIG_SND=m
 CONFIG_SND_USB_AUDIO=m
 CONFIG_SND_SOC=m
-CONFIG_SND_SOC_TLV320AIC3X=m
-CONFIG_SND_SOC_DAVINCI_MCASP=m
 CONFIG_SND_SOC_DAVINCI_EVM=m
 CONFIG_SND_SIMPLE_CARD=m
 CONFIG_HID=m
@@ -213,14 +208,12 @@ CONFIG_MMC_DAVINCI=y
 CONFIG_NEW_LEDS=y
 CONFIG_LEDS_CLASS=m
 CONFIG_LEDS_GPIO=m
-CONFIG_LEDS_TRIGGERS=y
 CONFIG_LEDS_TRIGGER_TIMER=m
 CONFIG_LEDS_TRIGGER_HEARTBEAT=m
 CONFIG_LEDS_TRIGGER_DEFAULT_ON=m
 CONFIG_RTC_CLASS=y
 CONFIG_RTC_DRV_OMAP=m
 CONFIG_DMADEVICES=y
-CONFIG_TI_EDMA=y
 CONFIG_COMMON_CLK_PWM=m
 CONFIG_REMOTEPROC=m
 CONFIG_DA8XX_REMOTEPROC=m
@@ -258,10 +251,10 @@ CONFIG_NLS_CODEPAGE_437=y
 CONFIG_NLS_ASCII=m
 CONFIG_NLS_ISO8859_1=y
 CONFIG_NLS_UTF8=m
+# CONFIG_CRYPTO_HW is not set
+CONFIG_CRC_T10DIF=m
+CONFIG_DMA_CMA=y
 CONFIG_DEBUG_FS=y
 CONFIG_DEBUG_RT_MUTEXES=y
 CONFIG_DEBUG_MUTEXES=y
-# CONFIG_ARM_UNWIND is not set
 CONFIG_DEBUG_USER=y
-# CONFIG_CRYPTO_HW is not set
-CONFIG_CRC_T10DIF=m
-- 
2.21.0
```

## \[PATCH 06/12\] ARM: davinci: da850-evm: model the backlight GPIO as an actual device

- From: Bartosz Golaszewski \<hidden\>
- Date: 2019-06-25 16:35:34 
- Message: https://ratatoskr.run/linux-fbdev/2019/06/5639693.md

```text
From: Bartosz Golaszewski <redacted>

Instead of enabling the panel backlight in a callback defined in board
file using deprecated legacy GPIO API calls, model the line as a GPIO
backlight device.

Signed-off-by: Bartosz Golaszewski <redacted>
---
 arch/arm/mach-davinci/board-da850-evm.c | 40 +++++++++++++++++--------
 1 file changed, 28 insertions(+), 12 deletions(-)

diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index 31ae3be5741d..ffda623bb543 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -36,6 +36,7 @@
 #include <linux/platform_data/ti-aemif.h>
 #include <linux/platform_data/spi-davinci.h>
 #include <linux/platform_data/uio_pruss.h>
+#include <linux/property.h>
 #include <linux/regulator/machine.h>
 #include <linux/regulator/tps6507x.h>
 #include <linux/regulator/fixed.h>
@@ -803,34 +804,49 @@ static const short da850_evm_mmcsd0_pins[] __initconst = {
 
 static void da850_panel_power_ctrl(int val)
 {
-	/* lcd backlight */
-	gpio_set_value(DA850_LCD_BL_PIN, val);
-
 	/* lcd power */
 	gpio_set_value(DA850_LCD_PWR_PIN, val);
 }
 
+static struct property_entry da850_lcd_backlight_props[] = {
+	PROPERTY_ENTRY_BOOL("default-on"),
+	{ }
+};
+
+static struct gpiod_lookup_table da850_lcd_backlight_gpio_table = {
+	.dev_id		= "gpio-backlight",
+	.table = {
+		GPIO_LOOKUP("davinci_gpio", DA850_LCD_BL_PIN, NULL, 0),
+		{ }
+	},
+};
+
+static const struct platform_device_info da850_lcd_backlight_info = {
+	.name		= "gpio-backlight",
+	.id		= PLATFORM_DEVID_NONE,
+	.properties	= da850_lcd_backlight_props,
+};
+
 static int da850_lcd_hw_init(void)
 {
+	struct platform_device *backlight;
 	int status;
 
-	status = gpio_request(DA850_LCD_BL_PIN, "lcd bl");
-	if (status < 0)
-		return status;
+	gpiod_add_lookup_table(&da850_lcd_backlight_gpio_table);
+	backlight = platform_device_register_full(&da850_lcd_backlight_info);
+	if (IS_ERR(backlight))
+		return PTR_ERR(backlight);
 
 	status = gpio_request(DA850_LCD_PWR_PIN, "lcd pwr");
-	if (status < 0) {
-		gpio_free(DA850_LCD_BL_PIN);
+	if (status < 0)
 		return status;
-	}
 
-	gpio_direction_output(DA850_LCD_BL_PIN, 0);
 	gpio_direction_output(DA850_LCD_PWR_PIN, 0);
 
-	/* Switch off panel power and backlight */
+	/* Switch off panel power */
 	da850_panel_power_ctrl(0);
 
-	/* Switch on panel power and backlight */
+	/* Switch on panel power */
 	da850_panel_power_ctrl(1);
 
 	return 0;
-- 
2.21.0
```

## \[PATCH 03/12\] backlight: gpio: pull the non-pdata device probing code into probe()

- From: Bartosz Golaszewski \<hidden\>
- Date: 2019-06-25 16:35:41 
- Message: https://ratatoskr.run/linux-fbdev/2019/06/5639694.md

```text
From: Bartosz Golaszewski <redacted>

There's no good reason to have the generic probing code in a separate
routine. This function is short and is inlined by the compiler anyway.
Move it into probe under the pdata-specific part.

Signed-off-by: Bartosz Golaszewski <redacted>
---
 drivers/video/backlight/gpio_backlight.c | 39 ++++++++----------------
 1 file changed, 13 insertions(+), 26 deletions(-)

diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c
index 8adbc8d75097..89e10bccfd3c 100644
--- a/drivers/video/backlight/gpio_backlight.c
+++ b/drivers/video/backlight/gpio_backlight.c
@@ -54,30 +54,6 @@ static const struct backlight_ops gpio_backlight_ops = {
 	.check_fb	= gpio_backlight_check_fb,
 };
 
-static int gpio_backlight_probe_prop(struct platform_device *pdev,
-				     struct gpio_backlight *gbl)
-{
-	struct device *dev = &pdev->dev;
-	enum gpiod_flags flags;
-	int ret;
-
-	gbl->def_value = device_property_read_bool(dev, "default-on");
-	flags = gbl->def_value ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW;
-
-	gbl->gpiod = devm_gpiod_get(dev, NULL, flags);
-	if (IS_ERR(gbl->gpiod)) {
-		ret = PTR_ERR(gbl->gpiod);
-
-		if (ret != -EPROBE_DEFER) {
-			dev_err(dev,
-				"Error: The gpios parameter is missing or invalid.\n");
-		}
-		return ret;
-	}
-
-	return 0;
-}
-
 static int gpio_backlight_probe(struct platform_device *pdev)
 {
 	struct gpio_backlight_platform_data *pdata @@ -86,6 +62,7 @@ static int gpio_backlight_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct backlight_device *bl;
 	struct gpio_backlight *gbl;
+	enum gpiod_flags flags;
 	int ret;
 
 	gbl = devm_kzalloc(dev, sizeof(*gbl), GFP_KERNEL);
@@ -116,9 +93,19 @@ static int gpio_backlight_probe(struct platform_device *pdev)
 		if (!gbl->gpiod)
 			return -EINVAL;
 	} else {
-		ret = gpio_backlight_probe_prop(pdev, gbl);
-		if (ret)
+		gbl->def_value = device_property_read_bool(dev, "default-on");
+		flags = gbl->def_value ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW;
+
+		gbl->gpiod = devm_gpiod_get(dev, NULL, flags);
+		if (IS_ERR(gbl->gpiod)) {
+			ret = PTR_ERR(gbl->gpiod);
+
+			if (ret != -EPROBE_DEFER) {
+				dev_err(dev,
+					"Error: The gpios parameter is missing or invalid.\n");
+			}
 			return ret;
+		}
 	}
 
 	memset(&props, 0, sizeof(props));
-- 
2.21.0
```

## \[PATCH 01/12\] backlight: gpio: allow to probe non-pdata devices from board files

- From: Bartosz Golaszewski \<hidden\>
- Date: 2019-06-25 16:35:43 
- Message: https://ratatoskr.run/linux-fbdev/2019/06/5639695.md

```text
From: Bartosz Golaszewski <redacted>

Currently we can only probe devices that either use device tree or pass
platform data to probe(). Rename gpio_backlight_probe_dt() to
gpio_backlight_probe_prop() and use generic device properties instead
of OF specific helpers. Reverse the logic checking the presence of
platform data in probe(). This way we can probe devices() registered
from machine code that neither have a DT node nor use platform data.

Signed-off-by: Bartosz Golaszewski <redacted>
---
 drivers/video/backlight/gpio_backlight.c | 24 ++++++++----------------
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c
index b9300f3e1ee6..654c19d3a81d 100644
--- a/drivers/video/backlight/gpio_backlight.c
+++ b/drivers/video/backlight/gpio_backlight.c
@@ -54,15 +54,14 @@ static const struct backlight_ops gpio_backlight_ops = {
 	.check_fb	= gpio_backlight_check_fb,
 };
 
-static int gpio_backlight_probe_dt(struct platform_device *pdev,
-				   struct gpio_backlight *gbl)
+static int gpio_backlight_probe_prop(struct platform_device *pdev,
+				     struct gpio_backlight *gbl)
 {
 	struct device *dev = &pdev->dev;
-	struct device_node *np = dev->of_node;
 	enum gpiod_flags flags;
 	int ret;
 
-	gbl->def_value = of_property_read_bool(np, "default-on");
+	gbl->def_value = device_property_read_bool(dev, "default-on");
 	flags = gbl->def_value ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW;
 
 	gbl->gpiod = devm_gpiod_get(dev, NULL, flags);
@@ -86,26 +85,15 @@ static int gpio_backlight_probe(struct platform_device *pdev)
 	struct backlight_properties props;
 	struct backlight_device *bl;
 	struct gpio_backlight *gbl;
-	struct device_node *np = pdev->dev.of_node;
 	int ret;
 
-	if (!pdata && !np) {
-		dev_err(&pdev->dev,
-			"failed to find platform data or device tree node.\n");
-		return -ENODEV;
-	}
-
 	gbl = devm_kzalloc(&pdev->dev, sizeof(*gbl), GFP_KERNEL);
 	if (gbl = NULL)
 		return -ENOMEM;
 
 	gbl->dev = &pdev->dev;
 
-	if (np) {
-		ret = gpio_backlight_probe_dt(pdev, gbl);
-		if (ret)
-			return ret;
-	} else {
+	if (pdata) {
 		/*
 		 * Legacy platform data GPIO retrieveal. Do not expand
 		 * the use of this code path, currently only used by one
@@ -126,6 +114,10 @@ static int gpio_backlight_probe(struct platform_device *pdev)
 		gbl->gpiod = gpio_to_desc(pdata->gpio);
 		if (!gbl->gpiod)
 			return -EINVAL;
+	} else {
+		ret = gpio_backlight_probe_prop(pdev, gbl);
+		if (ret)
+			return ret;
 	}
 
 	memset(&props, 0, sizeof(props));
-- 
2.21.0
```

## Re: \[PATCH 03/12\] backlight: gpio: pull the non-pdata device probing code into probe()

- From: Linus Walleij \<hidden\>
- Date: 2019-06-27 11:15:13 
- Message: https://ratatoskr.run/linux-fbdev/2019/06/5641992.md

```text
On Tue, Jun 25, 2019 at 5:34 PM Bartosz Golaszewski [ref] wrote:

> From: Bartosz Golaszewski <redacted>
>
> There's no good reason to have the generic probing code in a separate
> routine. This function is short and is inlined by the compiler anyway.
> Move it into probe under the pdata-specific part.
>
> Signed-off-by: Bartosz Golaszewski <redacted>

Reviewed-by: Linus Walleij <redacted>

Yours,
Linus Walleij
```

## Re: \[PATCH 06/12\] ARM: davinci: da850-evm: model the backlight GPIO as an actual device

- From: Linus Walleij \<hidden\>
- Date: 2019-06-27 11:17:10 
- Message: https://ratatoskr.run/linux-fbdev/2019/06/5641995.md

```text
On Tue, Jun 25, 2019 at 5:34 PM Bartosz Golaszewski [ref] wrote:

> From: Bartosz Golaszewski <redacted>
>
> Instead of enabling the panel backlight in a callback defined in board
> file using deprecated legacy GPIO API calls, model the line as a GPIO
> backlight device.
>
> Signed-off-by: Bartosz Golaszewski <redacted>

Reviewed-by: Linus Walleij <redacted>

Yours,
Linus Walleij
```

## Re: \[PATCH 08/12\] ARM: davinci: da850-evm: switch to using a fixed regulator for lcdc

- From: Linus Walleij \<hidden\>
- Date: 2019-06-27 11:18:36 
- Message: https://ratatoskr.run/linux-fbdev/2019/06/5641997.md

```text
On Tue, Jun 25, 2019 at 5:35 PM Bartosz Golaszewski [ref] wrote:

> From: Bartosz Golaszewski <redacted>
>
> Now that the da8xx fbdev driver supports power control with an actual
> regulator, switch to using a fixed power supply for da850-evm.
>
> Signed-off-by: Bartosz Golaszewski <redacted>

Reviewed-by: Linus Walleij <redacted>

Yours,
Linus Walleij
```

## Re: \[PATCH 01/12\] backlight: gpio: allow to probe non-pdata devices from board files

- From: Bartlomiej Zolnierkiewicz \<hidden\>
- Date: 2019-06-28 12:58:41 
- Message: https://ratatoskr.run/linux-fbdev/2019/06/5643505.md

```text

On 6/25/19 6:34 PM, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <redacted>
> 
> Currently we can only probe devices that either use device tree or pass
> platform data to probe(). Rename gpio_backlight_probe_dt() to
> gpio_backlight_probe_prop() and use generic device properties instead
> of OF specific helpers. Reverse the logic checking the presence of
> platform data in probe(). This way we can probe devices() registered
> from machine code that neither have a DT node nor use platform data.
> 
> Signed-off-by: Bartosz Golaszewski <redacted>

Reviewed-by: Bartlomiej Zolnierkiewicz <redacted>

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
```

## Re: \[PATCH 02/12\] backlight: gpio: use a helper variable for \&pdev-\>dev

- From: Bartlomiej Zolnierkiewicz \<hidden\>
- Date: 2019-06-28 12:59:14 
- Message: https://ratatoskr.run/linux-fbdev/2019/06/5643506.md

```text

On 6/25/19 6:34 PM, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <redacted>
> 
> Instead of dereferencing pdev each time, use a helper variable for
> the associated device pointer.
> 
> Signed-off-by: Bartosz Golaszewski <redacted>

Reviewed-by: Bartlomiej Zolnierkiewicz <redacted>

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
```

## Re: \[PATCH 03/12\] backlight: gpio: pull the non-pdata device probing code into probe()

- From: Bartlomiej Zolnierkiewicz \<hidden\>
- Date: 2019-06-28 13:00:01 
- Message: https://ratatoskr.run/linux-fbdev/2019/06/5643507.md

```text

On 6/25/19 6:34 PM, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <redacted>
> 
> There's no good reason to have the generic probing code in a separate
> routine. This function is short and is inlined by the compiler anyway.
> Move it into probe under the pdata-specific part.
> 
> Signed-off-by: Bartosz Golaszewski <redacted>

Reviewed-by: Bartlomiej Zolnierkiewicz <redacted>

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
```

## Re: \[PATCH 07/12\] fbdev: da8xx: add support for a regulator

- From: Bartlomiej Zolnierkiewicz \<hidden\>
- Date: 2019-06-28 13:03:37 
- Message: https://ratatoskr.run/linux-fbdev/2019/06/5643522.md

```text

On 6/25/19 6:34 PM, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <redacted>
> 
> We want to remove the hacky platform data callback for power control.
> Add a regulator to the driver data and enable/disable it next to
> the current panel_power_ctrl() calls. We will use it in subsequent
> patch on da850-evm.
> 
> Signed-off-by: Bartosz Golaszewski <redacted>

Acked-by: Bartlomiej Zolnierkiewicz <redacted>

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
```

## Re: \[PATCH 10/12\] fbdev: da8xx-fb: use devm\_platform\_ioremap\_resource()

- From: Bartlomiej Zolnierkiewicz \<hidden\>
- Date: 2019-06-28 13:05:01 
- Message: https://ratatoskr.run/linux-fbdev/2019/06/5643525.md

```text

On 6/25/19 6:34 PM, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <redacted>
> 
> Shrink the code a bit by using the new helper wrapping the calls to
> platform_get_resource() and devm_ioremap_resource() together.
> 
> Signed-off-by: Bartosz Golaszewski <redacted>

Acked-by: Bartlomiej Zolnierkiewicz <redacted>

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
```

## Re: \[PATCH 11/12\] fbdev: da8xx-fb: drop a redundant if

- From: Bartlomiej Zolnierkiewicz \<hidden\>
- Date: 2019-06-28 13:05:31 
- Message: https://ratatoskr.run/linux-fbdev/2019/06/5643527.md

```text

On 6/25/19 6:34 PM, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <redacted>
> 
> The driver data is always set in probe. The remove() callback won't be
> called if probe failed which is the only way for it to be NULL. Remove
> the redundant if.
> 
> Signed-off-by: Bartosz Golaszewski <redacted>

Acked-by: Bartlomiej Zolnierkiewicz <redacted>

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
```

## Re: \[PATCH 12/12\] fbdev: da8xx: use resource management for dma

- From: Bartlomiej Zolnierkiewicz \<hidden\>
- Date: 2019-06-28 13:06:10 
- Message: https://ratatoskr.run/linux-fbdev/2019/06/5643528.md

```text

On 6/25/19 6:34 PM, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <redacted>
> 
> Use managed variants of dma alloc functions in the da8xx fbdev driver.
> 
> Signed-off-by: Bartosz Golaszewski <redacted>

Acked-by: Bartlomiej Zolnierkiewicz <redacted>

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
```

## Re: \[PATCH 00/12\] ARM: davinci: da850-evm: remove more legacy GPIO calls

- From: Sekhar Nori \<hidden\>
- Date: 2019-07-01 14:41:47 
- Message: https://ratatoskr.run/linux-fbdev/2019/07/5644872.md

```text
Hi Lee, Daniel, Jingoo,

On 25/06/19 10:04 PM, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <redacted>
> 
> This is another small step on the path to liberating davinci from legacy
> GPIO API calls and shrinking the davinci GPIO driver by not having to
> support the base GPIO number anymore.
> 
> This time we're removing the legacy calls used indirectly by the LCDC
> fbdev driver.
> 
> The first three patches modify the GPIO backlight driver. The first
> of them adds the necessary functionality, the other two are just
> tweaks and cleanups.

Can you take the first three patches for v5.3 - if its not too late? I
think that will make it easy for rest of patches to make into subsequent
kernel releases.

> 
> Next two patches enable the GPIO backlight driver in
> davinci_all_defconfig.
> 
> Patch 6/12 models the backlight GPIO as an actual GPIO backlight device.
> 
> Patches 7-9 extend the fbdev driver with regulator support and convert
> the da850-evm board file to using it.
> 
> Last three patches are improvements to the da8xx fbdev driver since
> we're already touching it in this series.

Thanks,
Sekhar
```

## Re: \[PATCH 00/12\] ARM: davinci: da850-evm: remove more legacy GPIO calls

- From: Lee Jones \<hidden\>
- Date: 2019-07-02 06:37:00 
- Message: https://ratatoskr.run/linux-fbdev/2019/07/5645384.md

```text
On Mon, 01 Jul 2019, Sekhar Nori wrote:

> Hi Lee, Daniel, Jingoo,
> 
> On 25/06/19 10:04 PM, Bartosz Golaszewski wrote:
> > From: Bartosz Golaszewski <redacted>
> > 
> > This is another small step on the path to liberating davinci from legacy
> > GPIO API calls and shrinking the davinci GPIO driver by not having to
> > support the base GPIO number anymore.
> > 
> > This time we're removing the legacy calls used indirectly by the LCDC
> > fbdev driver.
> > 
> > The first three patches modify the GPIO backlight driver. The first
> > of them adds the necessary functionality, the other two are just
> > tweaks and cleanups.
> 
> Can you take the first three patches for v5.3 - if its not too late? I
> think that will make it easy for rest of patches to make into subsequent
> kernel releases.

It's already too late in the cycle (-rc7) for that.  I require patches
of this nature to have a good soak in -next before being merged. There
shouldn't be an issue with getting them into v5.4 though.

> > Next two patches enable the GPIO backlight driver in
> > davinci_all_defconfig.
> > 
> > Patch 6/12 models the backlight GPIO as an actual GPIO backlight device.
> > 
> > Patches 7-9 extend the fbdev driver with regulator support and convert
> > the da850-evm board file to using it.
> > 
> > Last three patches are improvements to the da8xx fbdev driver since
> > we're already touching it in this series.
> 
> Thanks,
> Sekhar
> 

-- 
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
```

## Re: \[PATCH 01/12\] backlight: gpio: allow to probe non-pdata devices from board files

- From: Daniel Thompson \<hidden\>
- Date: 2019-07-02 09:02:09 
- Message: https://ratatoskr.run/linux-fbdev/2019/07/5645661.md

```text
On 25/06/2019 17:34, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <redacted>
> 
> Currently we can only probe devices that either use device tree or pass
> platform data to probe(). Rename gpio_backlight_probe_dt() to
> gpio_backlight_probe_prop() and use generic device properties instead
> of OF specific helpers.

This has already been done in (which IIRC did get queued for the next 
release):
https://www.spinics.net/lists/dri-devel/msg215050.html

> Reverse the logic checking the presence of
> platform data in probe(). This way we can probe devices() registered
> from machine code that neither have a DT node nor use platform data.

Andy's patch did not reverse this logic... but it does check 
pdev->dev.fwnode rather than of_node .


Daniel.


> 
> Signed-off-by: Bartosz Golaszewski <redacted>
> ---
>   drivers/video/backlight/gpio_backlight.c | 24 ++++++++----------------
>   1 file changed, 8 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c
> index b9300f3e1ee6..654c19d3a81d 100644
> --- a/drivers/video/backlight/gpio_backlight.c
> +++ b/drivers/video/backlight/gpio_backlight.c
> @@ -54,15 +54,14 @@ static const struct backlight_ops gpio_backlight_ops = {
>   	.check_fb	= gpio_backlight_check_fb,
>   };
>   
> -static int gpio_backlight_probe_dt(struct platform_device *pdev,
> -				   struct gpio_backlight *gbl)
> +static int gpio_backlight_probe_prop(struct platform_device *pdev,
> +				     struct gpio_backlight *gbl)
>   {
>   	struct device *dev = &pdev->dev;
> -	struct device_node *np = dev->of_node;
>   	enum gpiod_flags flags;
>   	int ret;
>   
> -	gbl->def_value = of_property_read_bool(np, "default-on");
> +	gbl->def_value = device_property_read_bool(dev, "default-on");
>   	flags = gbl->def_value ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW;
>   
>   	gbl->gpiod = devm_gpiod_get(dev, NULL, flags);
> @@ -86,26 +85,15 @@ static int gpio_backlight_probe(struct platform_device *pdev)
>   	struct backlight_properties props;
>   	struct backlight_device *bl;
>   	struct gpio_backlight *gbl;
> -	struct device_node *np = pdev->dev.of_node;
>   	int ret;
>   
> -	if (!pdata && !np) {
> -		dev_err(&pdev->dev,
> -			"failed to find platform data or device tree node.\n");
> -		return -ENODEV;
> -	}
> -
>   	gbl = devm_kzalloc(&pdev->dev, sizeof(*gbl), GFP_KERNEL);
>   	if (gbl = NULL)
>   		return -ENOMEM;
>   
>   	gbl->dev = &pdev->dev;
>   
> -	if (np) {
> -		ret = gpio_backlight_probe_dt(pdev, gbl);
> -		if (ret)
> -			return ret;
> -	} else {
> +	if (pdata) {
>   		/*
>   		 * Legacy platform data GPIO retrieveal. Do not expand
>   		 * the use of this code path, currently only used by one
> @@ -126,6 +114,10 @@ static int gpio_backlight_probe(struct platform_device *pdev)
>   		gbl->gpiod = gpio_to_desc(pdata->gpio);
>   		if (!gbl->gpiod)
>   			return -EINVAL;
> +	} else {
> +		ret = gpio_backlight_probe_prop(pdev, gbl);
> +		if (ret)
> +			return ret;
>   	}
>   
>   	memset(&props, 0, sizeof(props));
> 
```

## Re: \[PATCH 02/12\] backlight: gpio: use a helper variable for \&pdev-\>dev

- From: Daniel Thompson \<hidden\>
- Date: 2019-07-02 09:05:46 
- Message: https://ratatoskr.run/linux-fbdev/2019/07/5645663.md

```text
On 25/06/2019 17:34, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <redacted>
> 
> Instead of dereferencing pdev each time, use a helper variable for
> the associated device pointer.
> 
> Signed-off-by: Bartosz Golaszewski <redacted>

No objections but I think this will need to be respun against 
backlight-next (or v5.3).

> ---
>   drivers/video/backlight/gpio_backlight.c | 14 +++++++-------
>   1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c
> index 654c19d3a81d..8adbc8d75097 100644
> --- a/drivers/video/backlight/gpio_backlight.c
> +++ b/drivers/video/backlight/gpio_backlight.c
> @@ -83,15 +83,16 @@ static int gpio_backlight_probe(struct platform_device *pdev)
>   	struct gpio_backlight_platform_data *pdata >   		dev_get_platdata(&pdev->dev);

Why leave this one out?


Daniel.


>   	struct backlight_properties props;
> +	struct device *dev = &pdev->dev;
>   	struct backlight_device *bl;
>   	struct gpio_backlight *gbl;
>   	int ret;
>   
> -	gbl = devm_kzalloc(&pdev->dev, sizeof(*gbl), GFP_KERNEL);
> +	gbl = devm_kzalloc(dev, sizeof(*gbl), GFP_KERNEL);
>   	if (gbl = NULL)
>   		return -ENOMEM;
>   
> -	gbl->dev = &pdev->dev;
> +	gbl->dev = dev;
>   
>   	if (pdata) {
>   		/*
> @@ -108,7 +109,7 @@ static int gpio_backlight_probe(struct platform_device *pdev)
>   		ret = devm_gpio_request_one(gbl->dev, pdata->gpio, flags,
>   					    pdata ? pdata->name : "backlight");
>   		if (ret < 0) {
> -			dev_err(&pdev->dev, "unable to request GPIO\n");
> +			dev_err(dev, "unable to request GPIO\n");
>   			return ret;
>   		}
>   		gbl->gpiod = gpio_to_desc(pdata->gpio);
> @@ -123,11 +124,10 @@ static int gpio_backlight_probe(struct platform_device *pdev)
>   	memset(&props, 0, sizeof(props));
>   	props.type = BACKLIGHT_RAW;
>   	props.max_brightness = 1;
> -	bl = devm_backlight_device_register(&pdev->dev, dev_name(&pdev->dev),
> -					&pdev->dev, gbl, &gpio_backlight_ops,
> -					&props);
> +	bl = devm_backlight_device_register(dev, dev_name(dev), dev, gbl,
> +					    &gpio_backlight_ops, &props);
>   	if (IS_ERR(bl)) {
> -		dev_err(&pdev->dev, "failed to register backlight\n");
> +		dev_err(dev, "failed to register backlight\n");
>   		return PTR_ERR(bl);
>   	}
>   
> 
```

## Re: \[PATCH 03/12\] backlight: gpio: pull the non-pdata device probing code into probe()

- From: Daniel Thompson \<hidden\>
- Date: 2019-07-02 09:11:21 
- Message: https://ratatoskr.run/linux-fbdev/2019/07/5645667.md

```text
On 25/06/2019 17:34, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <redacted>
> 
> There's no good reason to have the generic probing code in a separate
> routine. This function is short and is inlined by the compiler anyway.
> Move it into probe under the pdata-specific part.
> 
> Signed-off-by: Bartosz Golaszewski <redacted>

Like the others, this will need to be respun to match latest code but 
when it comes round again:
Acked-by: Daniel Thompson <redacted>


Daniel.


> ---
>   drivers/video/backlight/gpio_backlight.c | 39 ++++++++----------------
>   1 file changed, 13 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c
> index 8adbc8d75097..89e10bccfd3c 100644
> --- a/drivers/video/backlight/gpio_backlight.c
> +++ b/drivers/video/backlight/gpio_backlight.c
> @@ -54,30 +54,6 @@ static const struct backlight_ops gpio_backlight_ops = {
>   	.check_fb	= gpio_backlight_check_fb,
>   };
>   
> -static int gpio_backlight_probe_prop(struct platform_device *pdev,
> -				     struct gpio_backlight *gbl)
> -{
> -	struct device *dev = &pdev->dev;
> -	enum gpiod_flags flags;
> -	int ret;
> -
> -	gbl->def_value = device_property_read_bool(dev, "default-on");
> -	flags = gbl->def_value ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW;
> -
> -	gbl->gpiod = devm_gpiod_get(dev, NULL, flags);
> -	if (IS_ERR(gbl->gpiod)) {
> -		ret = PTR_ERR(gbl->gpiod);
> -
> -		if (ret != -EPROBE_DEFER) {
> -			dev_err(dev,
> -				"Error: The gpios parameter is missing or invalid.\n");
> -		}
> -		return ret;
> -	}
> -
> -	return 0;
> -}
> -
>   static int gpio_backlight_probe(struct platform_device *pdev)
>   {
>   	struct gpio_backlight_platform_data *pdata > @@ -86,6 +62,7 @@ static int gpio_backlight_probe(struct platform_device *pdev)
>   	struct device *dev = &pdev->dev;
>   	struct backlight_device *bl;
>   	struct gpio_backlight *gbl;
> +	enum gpiod_flags flags;
>   	int ret;
>   
>   	gbl = devm_kzalloc(dev, sizeof(*gbl), GFP_KERNEL);
> @@ -116,9 +93,19 @@ static int gpio_backlight_probe(struct platform_device *pdev)
>   		if (!gbl->gpiod)
>   			return -EINVAL;
>   	} else {
> -		ret = gpio_backlight_probe_prop(pdev, gbl);
> -		if (ret)
> +		gbl->def_value = device_property_read_bool(dev, "default-on");
> +		flags = gbl->def_value ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW;
> +
> +		gbl->gpiod = devm_gpiod_get(dev, NULL, flags);
> +		if (IS_ERR(gbl->gpiod)) {
> +			ret = PTR_ERR(gbl->gpiod);
> +
> +			if (ret != -EPROBE_DEFER) {
> +				dev_err(dev,
> +					"Error: The gpios parameter is missing or invalid.\n");
> +			}
>   			return ret;
> +		}
>   	}
>   
>   	memset(&props, 0, sizeof(props));
> 
```

## Re: \[PATCH 00/12\] ARM: davinci: da850-evm: remove more legacy GPIO calls

- From: Daniel Thompson \<hidden\>
- Date: 2019-07-02 10:06:52 
- Message: https://ratatoskr.run/linux-fbdev/2019/07/5645704.md

```text
On Tue, Jul 02, 2019 at 07:36:53AM +0100, Lee Jones wrote:
> On Mon, 01 Jul 2019, Sekhar Nori wrote:
> 
> > Hi Lee, Daniel, Jingoo,
> > 
> > On 25/06/19 10:04 PM, Bartosz Golaszewski wrote:
> > > From: Bartosz Golaszewski <redacted>
> > > 
> > > This is another small step on the path to liberating davinci from legacy
> > > GPIO API calls and shrinking the davinci GPIO driver by not having to
> > > support the base GPIO number anymore.
> > > 
> > > This time we're removing the legacy calls used indirectly by the LCDC
> > > fbdev driver.
> > > 
> > > The first three patches modify the GPIO backlight driver. The first
> > > of them adds the necessary functionality, the other two are just
> > > tweaks and cleanups.
> > 
> > Can you take the first three patches for v5.3 - if its not too late? I
> > think that will make it easy for rest of patches to make into subsequent
> > kernel releases.
> 
> It's already too late in the cycle (-rc7) for that.  I require patches
> of this nature to have a good soak in -next before being merged. There
> shouldn't be an issue with getting them into v5.4 though.

On the other hand I think we did take a patch that did much the same 
thing as patch 1/12 in this series:
https://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight.git/commit/?h=for-backlight-next&id˜b7404eb7d64e55f8fdd419cb3965a8abf0e217

I'm not 100% sure but I think that might allow the patchset to be split
into two that are independent (one for Davinci and one for gpio
backlight improvements).


Daniel.

> 
> > > Next two patches enable the GPIO backlight driver in
> > > davinci_all_defconfig.
> > > 
> > > Patch 6/12 models the backlight GPIO as an actual GPIO backlight device.
> > > 
> > > Patches 7-9 extend the fbdev driver with regulator support and convert
> > > the da850-evm board file to using it.
> > > 
> > > Last three patches are improvements to the da8xx fbdev driver since
> > > we're already touching it in this series.
> > 
> > Thanks,
> > Sekhar
> > 
> 
> -- 
> Lee Jones [æ��ç�¼æ–¯]
> Linaro Services Technical Lead
> Linaro.org â”‚ Open source software for ARM SoCs
> Follow Linaro: Facebook | Twitter | Blog
```
