From 4d866723d3e4f11b2e4b4f166f115f830bf5e481 Mon Sep 17 00:00:00 2001 From: Arun Bharadwaj Date: Wed, 15 Apr 2015 17:21:24 -0700 Subject: gpio-backlight: Discover driver during boot time The gpio-backlight driver seems to be missing the MODULE_DEVICE_TABLE line which is preventing it from being modprobed during boot time even if the gpio-backlight device exists. This seems to be a bug and this patch attempts to fix that. Signed-off-by: Arun Bharadwaj Signed-off-by: Ash Charles Signed-off-by: Lee Jones --- drivers/video/backlight/gpio_backlight.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/video') diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c index 439feb2389a8..5fbbc2ebdf93 100644 --- a/drivers/video/backlight/gpio_backlight.c +++ b/drivers/video/backlight/gpio_backlight.c @@ -146,6 +146,8 @@ static struct of_device_id gpio_backlight_of_match[] = { { .compatible = "gpio-backlight" }, { /* sentinel */ } }; + +MODULE_DEVICE_TABLE(of, gpio_backlight_of_match); #endif static struct platform_driver gpio_backlight_driver = { -- cgit v1.2.3 From dba5ff95b6b810577d4881a28f1243960226bb14 Mon Sep 17 00:00:00 2001 From: Krzysztof Kozlowski Date: Sat, 2 May 2015 00:38:38 +0900 Subject: video: backlight: da9052: Constify platform_device_id The platform_device_id is not modified by the driver and core uses it as const. Signed-off-by: Krzysztof Kozlowski Signed-off-by: Lee Jones --- drivers/video/backlight/da9052_bl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/video') diff --git a/drivers/video/backlight/da9052_bl.c b/drivers/video/backlight/da9052_bl.c index b1943e7735a1..fd2be417aa64 100644 --- a/drivers/video/backlight/da9052_bl.c +++ b/drivers/video/backlight/da9052_bl.c @@ -152,7 +152,7 @@ static int da9052_backlight_remove(struct platform_device *pdev) return 0; } -static struct platform_device_id da9052_wled_ids[] = { +static const struct platform_device_id da9052_wled_ids[] = { { .name = "da9052-wled1", .driver_data = DA9052_TYPE_WLED1, -- cgit v1.2.3 From 0e441665bc6286a306a23cb0354b56d61e1d9ce6 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Tue, 5 May 2015 18:32:39 +0200 Subject: backlight: Allow compile test of GPIO consumers if !GPIOLIB The GPIO subsystem provides dummy GPIO consumer functions if GPIOLIB is not enabled. Hence drivers that depend on GPIOLIB, but use GPIO consumer functionality only, can still be compiled if GPIOLIB is not enabled. Relax the dependency on GPIOLIB if COMPILE_TEST is enabled, where appropriate. Cc: Jingoo Han Signed-off-by: Geert Uytterhoeven Signed-off-by: Lee Jones --- drivers/video/backlight/Kconfig | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig index 2d9923a60076..0505b796d743 100644 --- a/drivers/video/backlight/Kconfig +++ b/drivers/video/backlight/Kconfig @@ -36,14 +36,16 @@ config LCD_CORGI config LCD_L4F00242T03 tristate "Epson L4F00242T03 LCD" - depends on SPI_MASTER && GPIOLIB + depends on SPI_MASTER + depends on GPIOLIB || COMPILE_TEST help SPI driver for Epson L4F00242T03. This provides basic support for init and powering the LCD up/down through a sysfs interface. config LCD_LMS283GF05 tristate "Samsung LMS283GF05 LCD" - depends on SPI_MASTER && GPIOLIB + depends on SPI_MASTER + depends on GPIOLIB || COMPILE_TEST help SPI driver for Samsung LMS283GF05. This provides basic support for powering the LCD up/down through a sysfs interface. @@ -434,7 +436,7 @@ config BACKLIGHT_AS3711 config BACKLIGHT_GPIO tristate "Generic GPIO based Backlight Driver" - depends on GPIOLIB + depends on GPIOLIB || COMPILE_TEST help If you have a LCD backlight adjustable by GPIO, say Y to enable this driver. -- cgit v1.2.3 From 61c1c6147f69d8dea31fd133d2ec0b1594c9a3eb Mon Sep 17 00:00:00 2001 From: Sean Paul Date: Mon, 11 May 2015 13:32:05 -0700 Subject: backlight: lp855x: Don't clear level on suspend/blank Don't clear the backlight level when we're going into suspend or blanking. Instead, just temporarily set the level to 0 so we retain the value when we resume. Reported-by: Benson Leung Signed-off-by: Sean Paul Tested-by: Stephen Barber Reviewed-by: Benson Leung Acked-by: Milo Kim Signed-off-by: Lee Jones --- drivers/video/backlight/lp855x_bl.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c index a26d3bb25650..88116b493f3b 100644 --- a/drivers/video/backlight/lp855x_bl.c +++ b/drivers/video/backlight/lp855x_bl.c @@ -257,21 +257,15 @@ static void lp855x_pwm_ctrl(struct lp855x *lp, int br, int max_br) static int lp855x_bl_update_status(struct backlight_device *bl) { struct lp855x *lp = bl_get_data(bl); + int brightness = bl->props.brightness; if (bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK)) - bl->props.brightness = 0; + brightness = 0; - if (lp->mode == PWM_BASED) { - int br = bl->props.brightness; - int max_br = bl->props.max_brightness; - - lp855x_pwm_ctrl(lp, br, max_br); - - } else if (lp->mode == REGISTER_BASED) { - u8 val = bl->props.brightness; - - lp855x_write_byte(lp, lp->cfg->reg_brightness, val); - } + if (lp->mode == PWM_BASED) + lp855x_pwm_ctrl(lp, brightness, bl->props.max_brightness); + else if (lp->mode == REGISTER_BASED) + lp855x_write_byte(lp, lp->cfg->reg_brightness, (u8)brightness); return 0; } -- cgit v1.2.3 From cdaefccefa988495e732d85d81914fbba99f4ca6 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Sat, 16 May 2015 22:08:10 +0800 Subject: backlight: pwm_bl: Simplify usage of devm_gpiod_get_optional Since 39b2bbe3d715 (gpio: add flags argument to gpiod_get*() functions), the gpiod_get* functions take an additional parameter that allows to specify direction and initial value for output. Simplify the usage of devm_gpiod_get_optional accordingly. Signed-off-by: Axel Lin Signed-off-by: Lee Jones --- drivers/video/backlight/pwm_bl.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index 3a145a643e0d..57cb9ec8be43 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c @@ -241,7 +241,8 @@ static int pwm_backlight_probe(struct platform_device *pdev) pb->dev = &pdev->dev; pb->enabled = false; - pb->enable_gpio = devm_gpiod_get_optional(&pdev->dev, "enable"); + pb->enable_gpio = devm_gpiod_get_optional(&pdev->dev, "enable", + GPIOD_OUT_HIGH); if (IS_ERR(pb->enable_gpio)) { ret = PTR_ERR(pb->enable_gpio); goto err_alloc; @@ -263,9 +264,6 @@ static int pwm_backlight_probe(struct platform_device *pdev) pb->enable_gpio = gpio_to_desc(data->enable_gpio); } - if (pb->enable_gpio) - gpiod_direction_output(pb->enable_gpio, 1); - pb->power_supply = devm_regulator_get(&pdev->dev, "power"); if (IS_ERR(pb->power_supply)) { ret = PTR_ERR(pb->power_supply); -- cgit v1.2.3