ARM: davinci: da850-evm: remove more legacy GPIO calls
v2 cover ARM: davinci: da850-evm: remove more legacy GPIO calls
From: Bartosz Golaszewski <[email protected]>
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.
First two patches enable the GPIO backlight driver in davinci_all_defconfig.
Patch 3/12 models the backlight GPIO as an actual GPIO backlight device.
Patches 4-6 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.
v1 -> v2:
- dopped the gpio-backlight patches from this series as since v5.3-rc1 we can probe the module with neither the OF node nor platform data
- collected review and ack tags
- rebased on top of v5.3-rc1
Bartosz Golaszewski (9):
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 | 27 ++---- arch/arm/mach-davinci/board-da850-evm.c | 90 +++++++++++++----- drivers/video/fbdev/da8xx-fb.c | 118 +++++++++++++----------- include/video/da8xx-fb.h | 1 - 4 files changed, 141 insertions(+), 95 deletions(-)
Signature · 1 line
2.21.0
PATCH v2 1/9 ARM: davinci: refresh davinci_all_defconfig
From: Bartosz Golaszewski <[email protected]>
Refresh davinci_all_defconfig with current master.
--- arch/arm/configs/davinci_all_defconfig | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-)
arch/arm/configs/davinci_all_defconfig +9 -17
@@ -10,13 +10,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 +24,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
@@ -47,6 +38,12 @@ CONFIG_CPU_FREQ_GOV_POWERSAVE=m CONFIG_CPU_FREQ_GOV_ONDEMAND=m CONFIG_CPUFREQ_DT=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
@@ -64,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
@@ -168,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
@@ -214,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
@@ -259,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
Signature · 1 line
2.21.0
PATCH v2 2/9 ARM: davinci_all_defconfig: enable GPIO backlight
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
Enable the GPIO backlight module in davinci_all_defconfig.
--- arch/arm/configs/davinci_all_defconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm/configs/davinci_all_defconfig +1 -0
@@ -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
Signature · 1 line
2.21.0
PATCH v2 3/9 ARM: davinci: da850-evm: model the backlight GPIO as an actual device
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
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.
--- arch/arm/mach-davinci/board-da850-evm.c | 40 +++++++++++++++++-------- 1 file changed, 28 insertions(+), 12 deletions(-)
arch/arm/mach-davinci/board-da850-evm.c +28 -12
@@ -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>
@@ -804,34 +805,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 ;
Signature · 1 line
2.21.0
PATCH v2 4/9 fbdev: da8xx: add support for a regulator
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
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.
--- drivers/video/fbdev/da8xx-fb.c | 54 ++++++++++++++++++++++++++++++---- 1 file changed, 49 insertions(+), 5 deletions(-)
drivers/video/fbdev/da8xx-fb.c +49 -5
@@ -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 ;
@@ -1400,6 +1418,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;
@@ -1603,10 +1635,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 );
@@ -1620,6 +1658,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);
@@ -1627,8 +1666,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 );
Signature · 1 line
2.21.0
PATCH v2 5/9 ARM: davinci: da850-evm: switch to using a fixed regulator for lcdc
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
Now that the da8xx fbdev driver supports power control with an actual regulator, switch to using a fixed power supply for da850-evm.
--- arch/arm/mach-davinci/board-da850-evm.c | 62 ++++++++++++++++++------- 1 file changed, 44 insertions(+), 18 deletions(-)
arch/arm/mach-davinci/board-da850-evm.c +44 -18
@@ -803,12 +803,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" ), { }
@@ -828,28 +822,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 ; }
@@ -1459,7 +1486,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);
Signature · 1 line
2.21.0
PATCH v2 6/9 fbdev: da8xx: remove panel_power_ctrl() callback from platform data
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
There are no more users of panel_power_ctrl(). Remove it from the driver.
--- drivers/video/fbdev/da8xx-fb.c | 25 +++++-------------------- include/video/da8xx-fb.h | 1 - 2 files changed, 5 insertions(+), 21 deletions(-)
drivers/video/fbdev/da8xx-fb.c +5 -20
@@ -165,7 +165,6 @@ struct da8xx_fb_par {struct notifier_block freq_transition;#endif unsigned int lcdc_clk_rate; -void (*panel_power_ctrl)(int );struct regulator *lcd_supply;u32 pseudo_palette[16 ];struct fb_videomode mode;
@@ -1076,9 +1075,7 @@ static int fb_remove(struct platform_device *dev)#ifdef CONFIG_CPU_FREQ lcd_da8xx_cpufreq_deregister (par);#endif -if (par->panel_power_ctrl) { - par->panel_power_ctrl (0 ); - }else if (par->lcd_supply) { +if (par->lcd_supply) { ret =regulator_disable (par->lcd_supply);if (ret)return ret;
@@ -1187,9 +1184,7 @@ static int cfb_blank(int blank, struct fb_info *info)case FB_BLANK_UNBLANK :lcd_enable_raster (); -if (par->panel_power_ctrl) { - par->panel_power_ctrl (1 ); - }else if (par->lcd_supply) { +if (par->lcd_supply) { ret =regulator_enable (par->lcd_supply);if (ret)return ret;
@@ -1199,9 +1194,7 @@ static int cfb_blank(int blank, struct fb_info *info)case FB_BLANK_VSYNC_SUSPEND :case FB_BLANK_HSYNC_SUSPEND :case FB_BLANK_POWERDOWN : -if (par->panel_power_ctrl) { - par->panel_power_ctrl (0 ); - }else if (par->lcd_supply) { +if (par->lcd_supply) { ret =regulator_disable (par->lcd_supply);if (ret)return ret;
@@ -1413,10 +1406,6 @@ static int fb_probe(struct platform_device *device) par->dev = &device->dev; par->lcdc_clk = tmp_lcdc_clk; par->lcdc_clk_rate =clk_get_rate (par->lcdc_clk); -if (fb_pdata->panel_power_ctrl) { - par->panel_power_ctrl = fb_pdata->panel_power_ctrl; - par->panel_power_ctrl (1 ); - } par->lcd_supply =devm_regulator_get_optional (&device->dev,"lcd" );if (IS_ERR (par->lcd_supply)) {
@@ -1638,9 +1627,7 @@ static int fb_suspend(struct device *dev)int ret;console_lock (); -if (par->panel_power_ctrl) { - par->panel_power_ctrl (0 ); - }else if (par->lcd_supply) { +if (par->lcd_supply) { ret =regulator_disable (par->lcd_supply);if (ret)return ret;
@@ -1666,9 +1653,7 @@ static int fb_resume(struct device *dev)if (par->blank =FB_BLANK_UNBLANK ) {lcd_enable_raster (); -if (par->panel_power_ctrl) { - par->panel_power_ctrl (1 ); - }else if (par->lcd_supply) { +if (par->lcd_supply) { ret =regulator_enable (par->lcd_supply);if (ret)return ret;
include/video/da8xx-fb.h +0 -1
@@ -32,7 +32,6 @@ struct da8xx_lcdc_platform_data {const char manu_name[10 ];void *controller_data;const char type[25 ]; -void (*panel_power_ctrl)(int ); };struct lcd_ctrl_config {
Signature · 1 line
2.21.0
PATCH v2 7/9 fbdev: da8xx-fb: use devm_platform_ioremap_resource()
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
Shrink the code a bit by using the new helper wrapping the calls to platform_get_resource() and devm_ioremap_resource() together.
--- drivers/video/fbdev/da8xx-fb.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/video/fbdev/da8xx-fb.c +1 -3
@@ -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);
Signature · 1 line
2.21.0
PATCH v2 8/9 fbdev: da8xx-fb: drop a redundant if
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
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.
--- drivers/video/fbdev/da8xx-fb.c | 43 ++++++++++++++++------------------ 1 file changed, 20 insertions(+), 23 deletions(-)
drivers/video/fbdev/da8xx-fb.c +20 -23
@@ -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 ; }
Signature · 1 line
2.21.0
PATCH v2 9/9 fbdev: da8xx: use resource management for dma
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
Use managed variants of dma alloc functions in the da8xx fbdev driver.
--- drivers/video/fbdev/da8xx-fb.c | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-)
drivers/video/fbdev/da8xx-fb.c +9 -13
@@ -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);
@@ -1427,10 +1423,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" );
@@ -1448,20 +1444,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 @@ -1479,7 +1475,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 */
@@ -1533,14 +1529,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);
Signature · 1 line
2.21.0
pon., 22 lip 2019 o 15:44 Bartosz Golaszewski <[email protected]> napisał(a):
Quoted 38 lines
From: Bartosz Golaszewski <[email protected]>
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.
First two patches enable the GPIO backlight driver in
davinci_all_defconfig.Patch 3/12 models the backlight GPIO as an actual GPIO backlight device.
Patches 4-6 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.
v1 -> v2:
- dopped the gpio-backlight patches from this series as since v5.3-rc1 we can probe the module with neither the OF node nor platform data
- collected review and ack tags
- rebased on top of v5.3-rc1Bartosz Golaszewski (9):
ARM: davinci: refreshdavinci_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: removepanel_power_ctrl()callback from platform data
fbdev: da8xx-fb: usedevm_platform_ioremap_resource()
fbdev: da8xx-fb: drop a redundant if
fbdev: da8xx: use resource management for dma
Quoted 9 lines
arch/arm/configs/davinci_all_defconfig | 27 ++---- arch/arm/mach-davinci/board-da850-evm.c | 90 +++++++++++++----- drivers/video/fbdev/da8xx-fb.c | 118 +++++++++++++----------- include/video/da8xx-fb.h | 1 - 4 files changed, 141 insertions(+), 95 deletions(-)--
2.21.0
Hi Sekhar,
the fbdev patches have been acked by Bartlomiej. I think the entire series can go through the ARM-SoC tree.
Bart
Quoted 45 lines · Bartosz Golaszewski
pon., 22 lip 2019 o 15:44 Bartosz Golaszewski <[email protected]> napisał(a):
Quoted 44 lines
From: Bartosz Golaszewski <[email protected]>
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.
First two patches enable the GPIO backlight driver in
davinci_all_defconfig.Patch 3/12 models the backlight GPIO as an actual GPIO backlight device.
Patches 4-6 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.
v1 -> v2:
- dopped the gpio-backlight patches from this series as since v5.3-rc1 we can probe the module with neither the OF node nor platform data
- collected review and ack tags
- rebased on top of v5.3-rc1Bartosz Golaszewski (9):
ARM: davinci: refreshdavinci_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: removepanel_power_ctrl()callback from platform data
fbdev: da8xx-fb: usedevm_platform_ioremap_resource()
fbdev: da8xx-fb: drop a redundant if
fbdev: da8xx: use resource management for dmaarch/arm/configs/davinci_all_defconfig | 27 ++---- arch/arm/mach-davinci/board-da850-evm.c | 90 +++++++++++++----- drivers/video/fbdev/da8xx-fb.c | 118 +++++++++++++----------- include/video/da8xx-fb.h | 1 - 4 files changed, 141 insertions(+), 95 deletions(-)
Quoted 8 lines
Quoted 3 lines
--
2.21.0Hi Sekhar,
the fbdev patches have been acked by Bartlomiej. I think the entire series can go through the ARM-SoC tree.
Applied for v5.4. Will queue through ARM-SoC.
Thanks,
Sekhar