diff options
Diffstat (limited to 'drivers/video/backlight')
27 files changed, 398 insertions, 53 deletions
diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig index 230bca07b09d..3614a5d29c71 100644 --- a/drivers/video/backlight/Kconfig +++ b/drivers/video/backlight/Kconfig @@ -373,6 +373,13 @@ config BACKLIGHT_AAT2870 If you have a AnalogicTech AAT2870 say Y to enable the backlight driver. +config BACKLIGHT_LM3509 + tristate "Backlight Driver for LM3509" + depends on I2C + select REGMAP_I2C + help + This supports TI LM3509 Backlight Driver + config BACKLIGHT_LM3630A tristate "Backlight Driver for LM3630A" depends on I2C && PWM diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile index 8d2cb252042d..8fc98f760a8a 100644 --- a/drivers/video/backlight/Makefile +++ b/drivers/video/backlight/Makefile @@ -36,6 +36,7 @@ obj-$(CONFIG_BACKLIGHT_IPAQ_MICRO) += ipaq_micro_bl.o obj-$(CONFIG_BACKLIGHT_KTD253) += ktd253-backlight.o obj-$(CONFIG_BACKLIGHT_KTD2801) += ktd2801-backlight.o obj-$(CONFIG_BACKLIGHT_KTZ8866) += ktz8866.o +obj-$(CONFIG_BACKLIGHT_LM3509) += lm3509_bl.o obj-$(CONFIG_BACKLIGHT_LM3533) += lm3533_bl.o obj-$(CONFIG_BACKLIGHT_LM3630A) += lm3630a_bl.o obj-$(CONFIG_BACKLIGHT_LM3639) += lm3639_bl.o diff --git a/drivers/video/backlight/aat2870_bl.c b/drivers/video/backlight/aat2870_bl.c index b4c3354a1a8a..68d327ee4b2e 100644 --- a/drivers/video/backlight/aat2870_bl.c +++ b/drivers/video/backlight/aat2870_bl.c @@ -156,7 +156,7 @@ static int aat2870_bl_probe(struct platform_device *pdev) bd->props.max_brightness = 255; aat2870_bl->brightness = 0; - bd->props.power = FB_BLANK_UNBLANK; + bd->props.power = BACKLIGHT_POWER_ON; bd->props.brightness = bd->props.max_brightness; ret = aat2870_bl_update_status(bd); @@ -176,7 +176,7 @@ static void aat2870_bl_remove(struct platform_device *pdev) struct aat2870_bl_driver_data *aat2870_bl = platform_get_drvdata(pdev); struct backlight_device *bd = aat2870_bl->bd; - bd->props.power = FB_BLANK_POWERDOWN; + bd->props.power = BACKLIGHT_POWER_OFF; bd->props.brightness = 0; backlight_update_status(bd); } diff --git a/drivers/video/backlight/adp8870_bl.c b/drivers/video/backlight/adp8870_bl.c index 6bb18dc970e9..ad4bd4c8f441 100644 --- a/drivers/video/backlight/adp8870_bl.c +++ b/drivers/video/backlight/adp8870_bl.c @@ -963,7 +963,7 @@ static SIMPLE_DEV_PM_OPS(adp8870_i2c_pm_ops, adp8870_i2c_suspend, adp8870_i2c_resume); static const struct i2c_device_id adp8870_id[] = { - { "adp8870", 0 }, + { "adp8870" }, { } }; MODULE_DEVICE_TABLE(i2c, adp8870_id); diff --git a/drivers/video/backlight/ams369fg06.c b/drivers/video/backlight/ams369fg06.c index 57ec205d2bd2..f8442689ac43 100644 --- a/drivers/video/backlight/ams369fg06.c +++ b/drivers/video/backlight/ams369fg06.c @@ -10,7 +10,6 @@ #include <linux/backlight.h> #include <linux/delay.h> -#include <linux/fb.h> #include <linux/lcd.h> #include <linux/module.h> #include <linux/spi/spi.h> @@ -300,7 +299,7 @@ static int ams369fg06_ldi_disable(struct ams369fg06 *lcd) static int ams369fg06_power_is_on(int power) { - return power <= FB_BLANK_NORMAL; + return power <= BACKLIGHT_POWER_REDUCED; } static int ams369fg06_power_on(struct ams369fg06 *lcd) @@ -396,8 +395,8 @@ static int ams369fg06_set_power(struct lcd_device *ld, int power) { struct ams369fg06 *lcd = lcd_get_data(ld); - if (power != FB_BLANK_UNBLANK && power != FB_BLANK_POWERDOWN && - power != FB_BLANK_NORMAL) { + if (power != BACKLIGHT_POWER_ON && power != BACKLIGHT_POWER_OFF && + power != BACKLIGHT_POWER_REDUCED) { dev_err(lcd->dev, "power value should be 0, 1 or 4.\n"); return -EINVAL; } @@ -492,11 +491,11 @@ static int ams369fg06_probe(struct spi_device *spi) * current lcd status is powerdown and then * it enables lcd panel. */ - lcd->power = FB_BLANK_POWERDOWN; + lcd->power = BACKLIGHT_POWER_OFF; - ams369fg06_power(lcd, FB_BLANK_UNBLANK); + ams369fg06_power(lcd, BACKLIGHT_POWER_ON); } else { - lcd->power = FB_BLANK_UNBLANK; + lcd->power = BACKLIGHT_POWER_ON; } spi_set_drvdata(spi, lcd); @@ -510,7 +509,7 @@ static void ams369fg06_remove(struct spi_device *spi) { struct ams369fg06 *lcd = spi_get_drvdata(spi); - ams369fg06_power(lcd, FB_BLANK_POWERDOWN); + ams369fg06_power(lcd, BACKLIGHT_POWER_OFF); } #ifdef CONFIG_PM_SLEEP @@ -524,16 +523,16 @@ static int ams369fg06_suspend(struct device *dev) * when lcd panel is suspend, lcd panel becomes off * regardless of status. */ - return ams369fg06_power(lcd, FB_BLANK_POWERDOWN); + return ams369fg06_power(lcd, BACKLIGHT_POWER_OFF); } static int ams369fg06_resume(struct device *dev) { struct ams369fg06 *lcd = dev_get_drvdata(dev); - lcd->power = FB_BLANK_POWERDOWN; + lcd->power = BACKLIGHT_POWER_OFF; - return ams369fg06_power(lcd, FB_BLANK_UNBLANK); + return ams369fg06_power(lcd, BACKLIGHT_POWER_ON); } #endif @@ -544,7 +543,7 @@ static void ams369fg06_shutdown(struct spi_device *spi) { struct ams369fg06 *lcd = spi_get_drvdata(spi); - ams369fg06_power(lcd, FB_BLANK_POWERDOWN); + ams369fg06_power(lcd, BACKLIGHT_POWER_OFF); } static struct spi_driver ams369fg06_driver = { diff --git a/drivers/video/backlight/bd6107.c b/drivers/video/backlight/bd6107.c index 6be2c67ba85c..90764f83d2f1 100644 --- a/drivers/video/backlight/bd6107.c +++ b/drivers/video/backlight/bd6107.c @@ -180,7 +180,7 @@ static void bd6107_remove(struct i2c_client *client) } static const struct i2c_device_id bd6107_ids[] = { - { "bd6107", 0 }, + { "bd6107" }, { } }; MODULE_DEVICE_TABLE(i2c, bd6107_ids); diff --git a/drivers/video/backlight/corgi_lcd.c b/drivers/video/backlight/corgi_lcd.c index aad1680c9075..e4fcfbe38dc6 100644 --- a/drivers/video/backlight/corgi_lcd.c +++ b/drivers/video/backlight/corgi_lcd.c @@ -526,7 +526,7 @@ static int corgi_lcd_probe(struct spi_device *spi) return PTR_ERR(lcd->bl_dev); lcd->bl_dev->props.brightness = pdata->default_intensity; - lcd->bl_dev->props.power = FB_BLANK_UNBLANK; + lcd->bl_dev->props.power = BACKLIGHT_POWER_ON; ret = setup_gpio_backlight(lcd, pdata); if (ret) @@ -547,7 +547,7 @@ static void corgi_lcd_remove(struct spi_device *spi) { struct corgi_lcd *lcd = spi_get_drvdata(spi); - lcd->bl_dev->props.power = FB_BLANK_UNBLANK; + lcd->bl_dev->props.power = BACKLIGHT_POWER_ON; lcd->bl_dev->props.brightness = 0; backlight_update_status(lcd->bl_dev); corgi_lcd_set_power(lcd->lcd_dev, FB_BLANK_POWERDOWN); diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c index 4476c317ce29..728a546904b0 100644 --- a/drivers/video/backlight/gpio_backlight.c +++ b/drivers/video/backlight/gpio_backlight.c @@ -5,7 +5,6 @@ #include <linux/backlight.h> #include <linux/err.h> -#include <linux/fb.h> #include <linux/gpio/consumer.h> #include <linux/init.h> #include <linux/kernel.h> @@ -81,12 +80,12 @@ static int gpio_backlight_probe(struct platform_device *pdev) /* Set the initial power state */ if (!of_node || !of_node->phandle) /* Not booted with device tree or no phandle link to the node */ - bl->props.power = def_value ? FB_BLANK_UNBLANK - : FB_BLANK_POWERDOWN; + bl->props.power = def_value ? BACKLIGHT_POWER_ON + : BACKLIGHT_POWER_OFF; else if (gpiod_get_value_cansleep(gbl->gpiod) == 0) - bl->props.power = FB_BLANK_POWERDOWN; + bl->props.power = BACKLIGHT_POWER_OFF; else - bl->props.power = FB_BLANK_UNBLANK; + bl->props.power = BACKLIGHT_POWER_ON; bl->props.brightness = 1; diff --git a/drivers/video/backlight/ipaq_micro_bl.c b/drivers/video/backlight/ipaq_micro_bl.c index f595b8c8cbb2..19ff66e444bc 100644 --- a/drivers/video/backlight/ipaq_micro_bl.c +++ b/drivers/video/backlight/ipaq_micro_bl.c @@ -7,7 +7,6 @@ #include <linux/backlight.h> #include <linux/err.h> -#include <linux/fb.h> #include <linux/init.h> #include <linux/mfd/ipaq-micro.h> #include <linux/module.h> @@ -42,7 +41,7 @@ static const struct backlight_ops micro_bl_ops = { static const struct backlight_properties micro_bl_props = { .type = BACKLIGHT_RAW, .max_brightness = 255, - .power = FB_BLANK_UNBLANK, + .power = BACKLIGHT_POWER_ON, .brightness = 64, }; diff --git a/drivers/video/backlight/jornada720_bl.c b/drivers/video/backlight/jornada720_bl.c index 066d0dc98f60..e28d2c071798 100644 --- a/drivers/video/backlight/jornada720_bl.c +++ b/drivers/video/backlight/jornada720_bl.c @@ -7,7 +7,6 @@ #include <linux/backlight.h> #include <linux/device.h> -#include <linux/fb.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/platform_device.h> @@ -121,7 +120,7 @@ static int jornada_bl_probe(struct platform_device *pdev) return ret; } - bd->props.power = FB_BLANK_UNBLANK; + bd->props.power = BACKLIGHT_POWER_ON; bd->props.brightness = BL_DEF_BRIGHT; /* * note. make sure max brightness is set otherwise diff --git a/drivers/video/backlight/kb3886_bl.c b/drivers/video/backlight/kb3886_bl.c index 55794b239cff..050b5c21f4a8 100644 --- a/drivers/video/backlight/kb3886_bl.c +++ b/drivers/video/backlight/kb3886_bl.c @@ -10,9 +10,9 @@ #include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> +#include <linux/io.h> #include <linux/platform_device.h> #include <linux/mutex.h> -#include <linux/fb.h> #include <linux/backlight.h> #include <linux/delay.h> #include <linux/dmi.h> @@ -151,7 +151,7 @@ static int kb3886bl_probe(struct platform_device *pdev) platform_set_drvdata(pdev, kb3886_backlight_device); - kb3886_backlight_device->props.power = FB_BLANK_UNBLANK; + kb3886_backlight_device->props.power = BACKLIGHT_POWER_ON; kb3886_backlight_device->props.brightness = machinfo->default_intensity; backlight_update_status(kb3886_backlight_device); diff --git a/drivers/video/backlight/ktd253-backlight.c b/drivers/video/backlight/ktd253-backlight.c index d7d43454f64a..327b4ee75254 100644 --- a/drivers/video/backlight/ktd253-backlight.c +++ b/drivers/video/backlight/ktd253-backlight.c @@ -7,7 +7,6 @@ #include <linux/backlight.h> #include <linux/delay.h> #include <linux/err.h> -#include <linux/fb.h> #include <linux/gpio/consumer.h> #include <linux/init.h> #include <linux/kernel.h> @@ -190,10 +189,10 @@ static int ktd253_backlight_probe(struct platform_device *pdev) /* When we just enable the GPIO line we set max brightness */ if (brightness) { bl->props.brightness = brightness; - bl->props.power = FB_BLANK_UNBLANK; + bl->props.power = BACKLIGHT_POWER_ON; } else { bl->props.brightness = 0; - bl->props.power = FB_BLANK_POWERDOWN; + bl->props.power = BACKLIGHT_POWER_OFF; } ktd253->bl = bl; diff --git a/drivers/video/backlight/ktz8866.c b/drivers/video/backlight/ktz8866.c index 014877b5a984..2e508741c0af 100644 --- a/drivers/video/backlight/ktz8866.c +++ b/drivers/video/backlight/ktz8866.c @@ -179,8 +179,8 @@ static void ktz8866_remove(struct i2c_client *client) } static const struct i2c_device_id ktz8866_ids[] = { - { "ktz8866", 0 }, - {}, + { "ktz8866" }, + {} }; MODULE_DEVICE_TABLE(i2c, ktz8866_ids); diff --git a/drivers/video/backlight/led_bl.c b/drivers/video/backlight/led_bl.c index 032f8bddf872..c7aefcd6e4e3 100644 --- a/drivers/video/backlight/led_bl.c +++ b/drivers/video/backlight/led_bl.c @@ -200,8 +200,8 @@ static int led_bl_probe(struct platform_device *pdev) props.type = BACKLIGHT_RAW; props.max_brightness = priv->max_brightness; props.brightness = priv->default_brightness; - props.power = (priv->default_brightness > 0) ? FB_BLANK_POWERDOWN : - FB_BLANK_UNBLANK; + props.power = (priv->default_brightness > 0) ? BACKLIGHT_POWER_OFF : + BACKLIGHT_POWER_ON; priv->bl_dev = backlight_device_register(dev_name(&pdev->dev), &pdev->dev, priv, &led_bl_ops, &props); if (IS_ERR(priv->bl_dev)) { diff --git a/drivers/video/backlight/lm3509_bl.c b/drivers/video/backlight/lm3509_bl.c new file mode 100644 index 000000000000..24e1a19ff72d --- /dev/null +++ b/drivers/video/backlight/lm3509_bl.c @@ -0,0 +1,343 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +#include <linux/backlight.h> +#include <linux/delay.h> +#include <linux/gpio/consumer.h> +#include <linux/i2c.h> +#include <linux/module.h> +#include <linux/regmap.h> + +#define LM3509_NAME "lm3509_bl" + +#define LM3509_SINK_MAIN 0 +#define LM3509_SINK_SUB 1 +#define LM3509_NUM_SINKS 2 + +#define LM3509_DEF_BRIGHTNESS 0x12 +#define LM3509_MAX_BRIGHTNESS 0x1F + +#define REG_GP 0x10 +#define REG_BMAIN 0xA0 +#define REG_BSUB 0xB0 +#define REG_MAX 0xFF + +enum { + REG_GP_ENM_BIT = 0, + REG_GP_ENS_BIT, + REG_GP_UNI_BIT, + REG_GP_RMP0_BIT, + REG_GP_RMP1_BIT, + REG_GP_OLED_BIT, +}; + +struct lm3509_bl { + struct regmap *regmap; + struct backlight_device *bl_main; + struct backlight_device *bl_sub; + struct gpio_desc *reset_gpio; +}; + +struct lm3509_bl_led_data { + const char *label; + int led_sources; + u32 brightness; + u32 max_brightness; +}; + +static void lm3509_reset(struct lm3509_bl *data) +{ + if (data->reset_gpio) { + gpiod_set_value(data->reset_gpio, 1); + udelay(1); + gpiod_set_value(data->reset_gpio, 0); + udelay(10); + } +} + +static int lm3509_update_status(struct backlight_device *bl, + unsigned int en_mask, unsigned int br_reg) +{ + struct lm3509_bl *data = bl_get_data(bl); + int ret; + bool en; + + ret = regmap_write(data->regmap, br_reg, backlight_get_brightness(bl)); + if (ret < 0) + return ret; + + en = !backlight_is_blank(bl); + return regmap_update_bits(data->regmap, REG_GP, en_mask, + en ? en_mask : 0); +} + +static int lm3509_main_update_status(struct backlight_device *bl) +{ + return lm3509_update_status(bl, BIT(REG_GP_ENM_BIT), REG_BMAIN); +} + +static const struct backlight_ops lm3509_main_ops = { + .options = BL_CORE_SUSPENDRESUME, + .update_status = lm3509_main_update_status, +}; + +static int lm3509_sub_update_status(struct backlight_device *bl) +{ + return lm3509_update_status(bl, BIT(REG_GP_ENS_BIT), REG_BSUB); +} + +static const struct backlight_ops lm3509_sub_ops = { + .options = BL_CORE_SUSPENDRESUME, + .update_status = lm3509_sub_update_status, +}; + +static struct backlight_device * +lm3509_backlight_register(struct device *dev, const char *name_suffix, + struct lm3509_bl *data, + const struct backlight_ops *ops, + const struct lm3509_bl_led_data *led_data) + +{ + struct backlight_device *bd; + struct backlight_properties props; + const char *label = led_data->label; + char name[64]; + + memset(&props, 0, sizeof(props)); + props.type = BACKLIGHT_RAW; + props.brightness = led_data->brightness; + props.max_brightness = led_data->max_brightness; + props.scale = BACKLIGHT_SCALE_NON_LINEAR; + + if (!label) { + snprintf(name, sizeof(name), "lm3509-%s-%s", dev_name(dev), + name_suffix); + label = name; + } + + bd = devm_backlight_device_register(dev, label, dev, data, ops, &props); + if (IS_ERR(bd)) + return bd; + + backlight_update_status(bd); + return bd; +} + +static const struct regmap_config lm3509_regmap = { + .reg_bits = 8, + .val_bits = 8, + .max_register = REG_MAX, +}; + +static int lm3509_parse_led_sources(struct device_node *node, + int default_led_sources) +{ + u32 sources[LM3509_NUM_SINKS]; + int ret, num_sources, i; + + num_sources = of_property_count_u32_elems(node, "led-sources"); + if (num_sources < 0) + return default_led_sources; + else if (num_sources > ARRAY_SIZE(sources)) + return -EINVAL; + + ret = of_property_read_u32_array(node, "led-sources", sources, + num_sources); + if (ret) + return ret; + + for (i = 0; i < num_sources; i++) { + if (sources[i] >= LM3509_NUM_SINKS) + return -EINVAL; + + ret |= BIT(sources[i]); + } + + return ret; +} + +static int lm3509_parse_dt_node(struct device *dev, + struct lm3509_bl_led_data *led_data) +{ + int seen_led_sources = 0; + + for_each_child_of_node_scoped(dev->of_node, child) { + struct lm3509_bl_led_data *ld; + int ret; + u32 reg; + int valid_led_sources; + + ret = of_property_read_u32(child, "reg", ®); + if (ret < 0) + return ret; + if (reg >= LM3509_NUM_SINKS) + return -EINVAL; + ld = &led_data[reg]; + + ld->led_sources = lm3509_parse_led_sources(child, BIT(reg)); + if (ld->led_sources < 0) + return ld->led_sources; + + if (reg == 0) + valid_led_sources = BIT(LM3509_SINK_MAIN) | + BIT(LM3509_SINK_SUB); + else + valid_led_sources = BIT(LM3509_SINK_SUB); + + if (ld->led_sources != (ld->led_sources & valid_led_sources)) + return -EINVAL; + + if (seen_led_sources & ld->led_sources) + return -EINVAL; + + seen_led_sources |= ld->led_sources; + + ld->label = NULL; + of_property_read_string(child, "label", &ld->label); + + ld->max_brightness = LM3509_MAX_BRIGHTNESS; + of_property_read_u32(child, "max-brightness", + &ld->max_brightness); + ld->max_brightness = + min_t(u32, ld->max_brightness, LM3509_MAX_BRIGHTNESS); + + ld->brightness = LM3509_DEF_BRIGHTNESS; + of_property_read_u32(child, "default-brightness", + &ld->brightness); + ld->brightness = min_t(u32, ld->brightness, ld->max_brightness); + } + + return 0; +} + +static int lm3509_probe(struct i2c_client *client) +{ + struct lm3509_bl *data; + struct device *dev = &client->dev; + int ret; + bool oled_mode = false; + unsigned int reg_gp_val = 0; + struct lm3509_bl_led_data led_data[LM3509_NUM_SINKS]; + u32 rate_of_change = 0; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { + dev_err(dev, "i2c functionality check failed\n"); + return -EOPNOTSUPP; + } + + data = devm_kzalloc(dev, sizeof(struct lm3509_bl), GFP_KERNEL); + if (!data) + return -ENOMEM; + + data->regmap = devm_regmap_init_i2c(client, &lm3509_regmap); + if (IS_ERR(data->regmap)) + return PTR_ERR(data->regmap); + i2c_set_clientdata(client, data); + + data->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); + if (IS_ERR(data->reset_gpio)) + return dev_err_probe(dev, PTR_ERR(data->reset_gpio), + "Failed to get 'reset' gpio\n"); + + lm3509_reset(data); + + memset(led_data, 0, sizeof(led_data)); + ret = lm3509_parse_dt_node(dev, led_data); + if (ret) + return ret; + + oled_mode = of_property_read_bool(dev->of_node, "ti,oled-mode"); + + if (!of_property_read_u32(dev->of_node, + "ti,brightness-rate-of-change-us", + &rate_of_change)) { + switch (rate_of_change) { + case 51: + reg_gp_val = 0; + break; + case 13000: + reg_gp_val = BIT(REG_GP_RMP1_BIT); + break; + case 26000: + reg_gp_val = BIT(REG_GP_RMP0_BIT); + break; + case 52000: + reg_gp_val = BIT(REG_GP_RMP0_BIT) | + BIT(REG_GP_RMP1_BIT); + break; + default: + dev_warn(dev, "invalid rate of change %u\n", + rate_of_change); + break; + } + } + + if (led_data[0].led_sources == + (BIT(LM3509_SINK_MAIN) | BIT(LM3509_SINK_SUB))) + reg_gp_val |= BIT(REG_GP_UNI_BIT); + if (oled_mode) + reg_gp_val |= BIT(REG_GP_OLED_BIT); + + ret = regmap_write(data->regmap, REG_GP, reg_gp_val); + if (ret < 0) + return dev_err_probe(dev, ret, "failed to write register\n"); + + if (led_data[0].led_sources) { + data->bl_main = lm3509_backlight_register( + dev, "main", data, &lm3509_main_ops, &led_data[0]); + if (IS_ERR(data->bl_main)) { + return dev_err_probe( + dev, PTR_ERR(data->bl_main), + "failed to register main backlight\n"); + } + } + + if (led_data[1].led_sources) { + data->bl_sub = lm3509_backlight_register( + dev, "sub", data, &lm3509_sub_ops, &led_data[1]); + if (IS_ERR(data->bl_sub)) { + return dev_err_probe( + dev, PTR_ERR(data->bl_sub), + "failed to register secondary backlight\n"); + } + } + + return 0; +} + +static void lm3509_remove(struct i2c_client *client) +{ + struct lm3509_bl *data = i2c_get_clientdata(client); + + regmap_write(data->regmap, REG_GP, 0x00); +} + +static const struct i2c_device_id lm3509_id[] = { + { LM3509_NAME }, + {} +}; + +MODULE_DEVICE_TABLE(i2c, lm3509_id); + +static const struct of_device_id lm3509_match_table[] = { + { + .compatible = "ti,lm3509", + }, + {}, +}; + +MODULE_DEVICE_TABLE(of, lm3509_match_table); + +static struct i2c_driver lm3509_i2c_driver = { + .driver = { + .name = LM3509_NAME, + .of_match_table = lm3509_match_table, + }, + .probe = lm3509_probe, + .remove = lm3509_remove, + .id_table = lm3509_id, +}; + +module_i2c_driver(lm3509_i2c_driver); + +MODULE_DESCRIPTION("Texas Instruments Backlight driver for LM3509"); +MODULE_AUTHOR("Patrick Gansterer <paroga@paroga.com>"); +MODULE_LICENSE("GPL"); diff --git a/drivers/video/backlight/lm3533_bl.c b/drivers/video/backlight/lm3533_bl.c index 3e10d480cb7f..5d06f8ca976c 100644 --- a/drivers/video/backlight/lm3533_bl.c +++ b/drivers/video/backlight/lm3533_bl.c @@ -11,7 +11,6 @@ #include <linux/init.h> #include <linux/platform_device.h> #include <linux/backlight.h> -#include <linux/fb.h> #include <linux/slab.h> #include <linux/mfd/lm3533.h> @@ -344,7 +343,7 @@ static void lm3533_bl_remove(struct platform_device *pdev) dev_dbg(&bd->dev, "%s\n", __func__); - bd->props.power = FB_BLANK_POWERDOWN; + bd->props.power = BACKLIGHT_POWER_OFF; bd->props.brightness = 0; lm3533_ctrlbank_disable(&bl->cb); diff --git a/drivers/video/backlight/lm3630a_bl.c b/drivers/video/backlight/lm3630a_bl.c index 76d47e2e8242..37651c2b9393 100644 --- a/drivers/video/backlight/lm3630a_bl.c +++ b/drivers/video/backlight/lm3630a_bl.c @@ -596,7 +596,7 @@ static void lm3630a_remove(struct i2c_client *client) } static const struct i2c_device_id lm3630a_id[] = { - {LM3630A_NAME, 0}, + { LM3630A_NAME }, {} }; diff --git a/drivers/video/backlight/lm3639_bl.c b/drivers/video/backlight/lm3639_bl.c index 564f62acd721..37ccc631c498 100644 --- a/drivers/video/backlight/lm3639_bl.c +++ b/drivers/video/backlight/lm3639_bl.c @@ -403,7 +403,7 @@ static void lm3639_remove(struct i2c_client *client) } static const struct i2c_device_id lm3639_id[] = { - {LM3639_NAME, 0}, + { LM3639_NAME }, {} }; diff --git a/drivers/video/backlight/lv5207lp.c b/drivers/video/backlight/lv5207lp.c index 0cf00fee0f60..5f60989fa70f 100644 --- a/drivers/video/backlight/lv5207lp.c +++ b/drivers/video/backlight/lv5207lp.c @@ -132,7 +132,7 @@ static void lv5207lp_remove(struct i2c_client *client) } static const struct i2c_device_id lv5207lp_ids[] = { - { "lv5207lp", 0 }, + { "lv5207lp" }, { } }; MODULE_DEVICE_TABLE(i2c, lv5207lp_ids); diff --git a/drivers/video/backlight/mp3309c.c b/drivers/video/backlight/mp3309c.c index a28036c964af..372058e26129 100644 --- a/drivers/video/backlight/mp3309c.c +++ b/drivers/video/backlight/mp3309c.c @@ -358,7 +358,7 @@ static int mp3309c_probe(struct i2c_client *client) props.max_brightness = pdata->max_brightness; props.scale = BACKLIGHT_SCALE_LINEAR; props.type = BACKLIGHT_RAW; - props.power = FB_BLANK_UNBLANK; + props.power = BACKLIGHT_POWER_ON; chip->bl = devm_backlight_device_register(dev, "mp3309c", dev, chip, &mp3309c_bl_ops, &props); if (IS_ERR(chip->bl)) @@ -388,7 +388,7 @@ static void mp3309c_remove(struct i2c_client *client) struct mp3309c_chip *chip = i2c_get_clientdata(client); struct backlight_device *bl = chip->bl; - bl->props.power = FB_BLANK_POWERDOWN; + bl->props.power = BACKLIGHT_POWER_OFF; bl->props.brightness = 0; backlight_update_status(chip->bl); } @@ -400,7 +400,7 @@ static const struct of_device_id mp3309c_match_table[] = { MODULE_DEVICE_TABLE(of, mp3309c_match_table); static const struct i2c_device_id mp3309c_id[] = { - { "mp3309c", 0 }, + { "mp3309c" }, { } }; MODULE_DEVICE_TABLE(i2c, mp3309c_id); diff --git a/drivers/video/backlight/pandora_bl.c b/drivers/video/backlight/pandora_bl.c index 51faa889e01f..8a63ded0fa90 100644 --- a/drivers/video/backlight/pandora_bl.c +++ b/drivers/video/backlight/pandora_bl.c @@ -11,7 +11,6 @@ #include <linux/kernel.h> #include <linux/platform_device.h> #include <linux/delay.h> -#include <linux/fb.h> #include <linux/backlight.h> #include <linux/mfd/twl.h> #include <linux/err.h> @@ -43,7 +42,7 @@ static int pandora_backlight_update_status(struct backlight_device *bl) struct pandora_private *priv = bl_get_data(bl); u8 r; - if (bl->props.power != FB_BLANK_UNBLANK) + if (bl->props.power != BACKLIGHT_POWER_ON) brightness = 0; if (bl->props.state & BL_CORE_FBBLANK) brightness = 0; diff --git a/drivers/video/backlight/pcf50633-backlight.c b/drivers/video/backlight/pcf50633-backlight.c index 540dd3380c81..157be2f366df 100644 --- a/drivers/video/backlight/pcf50633-backlight.c +++ b/drivers/video/backlight/pcf50633-backlight.c @@ -10,7 +10,6 @@ #include <linux/platform_device.h> #include <linux/backlight.h> -#include <linux/fb.h> #include <linux/mfd/pcf50633/core.h> #include <linux/mfd/pcf50633/backlight.h> @@ -53,7 +52,7 @@ static int pcf50633_bl_update_status(struct backlight_device *bl) if (bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK) || - bl->props.power != FB_BLANK_UNBLANK) + bl->props.power != BACKLIGHT_POWER_ON) new_brightness = 0; else if (bl->props.brightness < pcf_bl->brightness_limit) new_brightness = bl->props.brightness; @@ -106,7 +105,7 @@ static int pcf50633_bl_probe(struct platform_device *pdev) memset(&bl_props, 0, sizeof(bl_props)); bl_props.type = BACKLIGHT_RAW; bl_props.max_brightness = 0x3f; - bl_props.power = FB_BLANK_UNBLANK; + bl_props.power = BACKLIGHT_POWER_ON; if (pdata) { bl_props.brightness = pdata->default_brightness; diff --git a/drivers/video/backlight/platform_lcd.c b/drivers/video/backlight/platform_lcd.c index 76872f5c34c5..b0af612834a7 100644 --- a/drivers/video/backlight/platform_lcd.c +++ b/drivers/video/backlight/platform_lcd.c @@ -143,5 +143,6 @@ static struct platform_driver platform_lcd_driver = { module_platform_driver(platform_lcd_driver); MODULE_AUTHOR("Ben Dooks <ben-linux@fluff.org>"); +MODULE_DESCRIPTION("Generic platform-device LCD power control interface"); MODULE_LICENSE("GPL v2"); MODULE_ALIAS("platform:platform-lcd"); diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index 61d30bc98eea..e942908d1275 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c @@ -426,7 +426,7 @@ static int pwm_backlight_initial_power_state(const struct pwm_bl_data *pb) /* Not booted with device tree or no phandle link to the node */ if (!node || !node->phandle) - return FB_BLANK_UNBLANK; + return BACKLIGHT_POWER_ON; /* * If the driver is probed from the device tree and there is a @@ -434,7 +434,7 @@ static int pwm_backlight_initial_power_state(const struct pwm_bl_data *pb) * assume that another driver will enable the backlight at the * appropriate time. Therefore, if it is disabled, keep it so. */ - return active ? FB_BLANK_UNBLANK: FB_BLANK_POWERDOWN; + return active ? BACKLIGHT_POWER_ON : BACKLIGHT_POWER_OFF; } static int pwm_backlight_probe(struct platform_device *pdev) diff --git a/drivers/video/backlight/rave-sp-backlight.c b/drivers/video/backlight/rave-sp-backlight.c index 05b5f003a3d1..e708a060a6e4 100644 --- a/drivers/video/backlight/rave-sp-backlight.c +++ b/drivers/video/backlight/rave-sp-backlight.c @@ -19,7 +19,7 @@ static int rave_sp_backlight_update_status(struct backlight_device *bd) { const struct backlight_properties *p = &bd->props; const u8 intensity = - (p->power == FB_BLANK_UNBLANK) ? p->brightness : 0; + (p->power == BACKLIGHT_POWER_ON) ? p->brightness : 0; struct rave_sp *sp = dev_get_drvdata(&bd->dev); u8 cmd[] = { [0] = RAVE_SP_CMD_SET_BACKLIGHT, diff --git a/drivers/video/backlight/rt4831-backlight.c b/drivers/video/backlight/rt4831-backlight.c index 7d1af4c2ca67..c2f6fb29e1d0 100644 --- a/drivers/video/backlight/rt4831-backlight.c +++ b/drivers/video/backlight/rt4831-backlight.c @@ -229,4 +229,5 @@ static struct platform_driver rt4831_bl_driver = { module_platform_driver(rt4831_bl_driver); MODULE_AUTHOR("ChiYuan Huang <cy_huang@richtek.com>"); +MODULE_DESCRIPTION("Richtek RT4831 Backlight Driver"); MODULE_LICENSE("GPL v2"); diff --git a/drivers/video/backlight/sky81452-backlight.c b/drivers/video/backlight/sky81452-backlight.c index 19f9f84a9fd6..935043b67786 100644 --- a/drivers/video/backlight/sky81452-backlight.c +++ b/drivers/video/backlight/sky81452-backlight.c @@ -315,7 +315,7 @@ static void sky81452_bl_remove(struct platform_device *pdev) sysfs_remove_group(&bd->dev.kobj, &sky81452_bl_attr_group); - bd->props.power = FB_BLANK_UNBLANK; + bd->props.power = BACKLIGHT_POWER_ON; bd->props.brightness = 0; backlight_update_status(bd); |