ARM: davinci: da850-evm: remove more legacy GPIO calls
Subsystems (5)
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.
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(-)
Signature · 1 line
2.21.0
PATCH 1/12 backlight: gpio: allow to probe non-pdata devices from board files
From: Bartosz Golaszewski <[email protected]>
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.
--- drivers/video/backlight/gpio_backlight.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-)
drivers/video/backlight/gpio_backlight.c +8 -16
@@ -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));
Signature · 1 line
2.21.0
PATCH 2/12 backlight: gpio: use a helper variable for &pdev->dev
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
Instead of dereferencing pdev each time, use a helper variable for the associated device pointer.
--- drivers/video/backlight/gpio_backlight.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/video/backlight/gpio_backlight.c +7 -7
@@ -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); }
Signature · 1 line
2.21.0
PATCH 3/12 backlight: gpio: pull the non-pdata device probing code into probe()
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
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.
--- drivers/video/backlight/gpio_backlight.c | 39 ++++++++---------------- 1 file changed, 13 insertions(+), 26 deletions(-)
drivers/video/backlight/gpio_backlight.c +13 -26
@@ -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));
Signature · 1 line
2.21.0
PATCH 4/12 ARM: davinci: refresh davinci_all_defconfig
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
Refresh davinci_all_defconfig with current master.
--- arch/arm/configs/davinci_all_defconfig | 27 ++++++++++---------------- 1 file changed, 10 insertions(+), 17 deletions(-)
arch/arm/configs/davinci_all_defconfig +10 -17
@@ -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=14
@@ -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
Signature · 1 line
2.21.0
PATCH 5/12 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 6/12 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>
@@ -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 ;
Signature · 1 line
2.21.0
PATCH 7/12 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 ;
@@ -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 );
Signature · 1 line
2.21.0
PATCH 8/12 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
@@ -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);
Signature · 1 line
2.21.0
PATCH 9/12 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;
@@ -1414,10 +1407,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)) {
@@ -1639,9 +1628,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;
@@ -1667,9 +1654,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 10/12 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 11/12 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 12/12 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 +10 -22
@@ -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);
Signature · 1 line
2.21.0
Re: [PATCH 03/12] backlight: gpio: pull the non-pdata device probing code into probe()
In reply to Bartosz GolaszewskiQuoted 7 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
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 <[email protected]>
Yours,
Linus Walleij
Re: [PATCH 06/12] ARM: davinci: da850-evm: model the backlight GPIO as an actual device
In reply to Bartosz GolaszewskiQuoted 7 lines · Bartosz Golaszewski
From: 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.
Signed-off-by Bartosz Golaszewski <[email protected]>
Yours,
Linus Walleij
Re: [PATCH 08/12] ARM: davinci: da850-evm: switch to using a fixed regulator for lcdc
In reply to Bartosz GolaszewskiQuoted 6 lines · Bartosz Golaszewski
From: 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.
Signed-off-by Bartosz Golaszewski <[email protected]>
Yours,
Linus Walleij
Re: [PATCH 01/12] backlight: gpio: allow to probe non-pdata devices from board files
In reply to Bartosz GolaszewskiQuoted 10 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
Currently we can only probe devices that either use device tree or pass platform data to
probe(). Renamegpio_backlight_probe_dt()togpio_backlight_probe_prop()and use generic device properties instead of OF specific helpers. Reverse the logic checking the presence of platform data inprobe(). This way we can probedevices()registered from machine code that neither have a DT node nor use platform data.Signed-off-by Bartosz Golaszewski <[email protected]>
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
Re: [PATCH 02/12] backlight: gpio: use a helper variable for &pdev->dev
In reply to Bartosz GolaszewskiQuoted 6 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
Instead of dereferencing pdev each time, use a helper variable for the associated device pointer.
Signed-off-by Bartosz Golaszewski <[email protected]>
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()
In reply to Bartosz GolaszewskiQuoted 7 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
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 <[email protected]>
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
Re: [PATCH 07/12] fbdev: da8xx: add support for a regulator
In reply to Bartosz GolaszewskiQuoted 8 lines · Bartosz Golaszewski
From: 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.Signed-off-by Bartosz Golaszewski <[email protected]>
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
Re: [PATCH 09/12] fbdev: da8xx: remove panel_power_ctrl() callback from platform data
In reply to Bartosz GolaszewskiQuoted 6 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
There are no more users of
panel_power_ctrl(). Remove it from the driver.Signed-off-by Bartosz Golaszewski <[email protected]>
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
Re: [PATCH 10/12] fbdev: da8xx-fb: use devm_platform_ioremap_resource()
In reply to Bartosz GolaszewskiQuoted 6 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
Shrink the code a bit by using the new helper wrapping the calls to
platform_get_resource()anddevm_ioremap_resource()together.Signed-off-by Bartosz Golaszewski <[email protected]>
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
Re: [PATCH 11/12] fbdev: da8xx-fb: drop a redundant if
In reply to Bartosz GolaszewskiQuoted 7 lines · Bartosz Golaszewski
From: 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.Signed-off-by Bartosz Golaszewski <[email protected]>
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
Re: [PATCH 12/12] fbdev: da8xx: use resource management for dma
In reply to Bartosz GolaszewskiQuoted 5 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
Use managed variants of dma alloc functions in the da8xx fbdev driver.
Signed-off-by Bartosz Golaszewski <[email protected]>
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
Hi Lee, Daniel, Jingoo,
Quoted 6 lines · Bartosz Golaszewski
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.
Quoted 6 lines
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.
Quoted 11 lines
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
Quoted 12 lines · Sekhar Nori
Hi Lee, Daniel, Jingoo,
Quoted 9 lines · Bartosz Golaszewski
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.
Quoted 7 lines
Quoted 3 lines
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.
Quoted 14 lines
Quoted 10 lines
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
Signature · 4 lines
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
In reply to Bartosz GolaszewskiQuoted 6 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
Currently we can only probe devices that either use device tree or pass platform data to
probe(). Renamegpio_backlight_probe_dt()togpio_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
Quoted 3 lines
Reverse the logic checking the presence of
platform data inprobe(). This way we can probedevices()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.
Quoted 69 lines
Signed-off-by Bartosz Golaszewski <[email protected]>--- drivers/video/backlight/gpio_backlight.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-)drivers/video/backlight/gpio_backlight.c +8
-16@@ -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
In reply to Bartosz GolaszewskiQuoted 6 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
Instead of dereferencing pdev each time, use a helper variable for the associated device pointer.
Signed-off-by Bartosz Golaszewski <[email protected]>
No objections but I think this will need to be respun against backlight-next (or v5.3).
drivers/video/backlight/gpio_backlight.c static int gpio_backlight_probe(struct platform_device *pdev) · line 84
Quoted 11 lines
--- drivers/video/backlight/gpio_backlight.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)drivers/video/backlight/gpio_backlight.c +0
-0@@ -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.
Quoted 41 lines
drivers/video/backlight/gpio_backlight.c +7
-7struct 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()
In reply to Bartosz GolaszewskiQuoted 7 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
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 <[email protected]>
Like the others, this will need to be respun to match latest code but when it comes round again:
Daniel.
Quoted 70 lines
--- drivers/video/backlight/gpio_backlight.c | 39 ++++++++---------------- 1 file changed, 13 insertions(+), 26 deletions(-)drivers/video/backlight/gpio_backlight.c +13
-26@@ -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));
Quoted 18 lines · Lee Jones
Quoted 16 lines · Sekhar Nori
Hi Lee, Daniel, Jingoo,
Quoted 12 lines · Bartosz Golaszewski
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.
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.
Quoted 7 lines
Quoted 3 lines
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=98b7404eb7d64e55f8fdd419cb3965a8abf0e217
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.
Quoted 21 lines
Quoted 15 lines
Quoted 11 lines
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,
SekharSignature · 4 lines
Lee Jones [李琼斯] Linaro Services Technical Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog