summaryrefslogtreecommitdiffstats
path: root/drivers/video/backlight
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-07 13:18:06 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-07 13:18:06 +0000
commit638a9e433ecd61e64761352dbec1fa4f5874c941 (patch)
treefdbff74a238d7a5a7d1cef071b7230bc064b9f25 /drivers/video/backlight
parentReleasing progress-linux version 6.9.12-1~progress7.99u1. (diff)
downloadlinux-638a9e433ecd61e64761352dbec1fa4f5874c941.tar.xz
linux-638a9e433ecd61e64761352dbec1fa4f5874c941.zip
Merging upstream version 6.10.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'drivers/video/backlight')
-rw-r--r--drivers/video/backlight/aat2870_bl.c7
-rw-r--r--drivers/video/backlight/ams369fg06.c2
-rw-r--r--drivers/video/backlight/backlight.c39
-rw-r--r--drivers/video/backlight/bd6107.c12
-rw-r--r--drivers/video/backlight/corgi_lcd.c2
-rw-r--r--drivers/video/backlight/gpio_backlight.c12
-rw-r--r--drivers/video/backlight/hx8357.c2
-rw-r--r--drivers/video/backlight/ili922x.c2
-rw-r--r--drivers/video/backlight/ili9320.c2
-rw-r--r--drivers/video/backlight/jornada720_lcd.c2
-rw-r--r--drivers/video/backlight/l4f00242t03.c2
-rw-r--r--drivers/video/backlight/lcd.c27
-rw-r--r--drivers/video/backlight/lms283gf05.c2
-rw-r--r--drivers/video/backlight/lms501kf03.c2
-rw-r--r--drivers/video/backlight/lp8788_bl.c151
-rw-r--r--drivers/video/backlight/ltv350qv.c2
-rw-r--r--drivers/video/backlight/lv5207lp.c12
-rw-r--r--drivers/video/backlight/mp3309c.c6
-rw-r--r--drivers/video/backlight/omap1_bl.c47
-rw-r--r--drivers/video/backlight/otm3225a.c3
-rw-r--r--drivers/video/backlight/platform_lcd.c2
-rw-r--r--drivers/video/backlight/pwm_bl.c12
-rw-r--r--drivers/video/backlight/sky81452-backlight.c8
-rw-r--r--drivers/video/backlight/tdo24m.c2
24 files changed, 96 insertions, 264 deletions
diff --git a/drivers/video/backlight/aat2870_bl.c b/drivers/video/backlight/aat2870_bl.c
index 81fde3abb9..b4c3354a1a 100644
--- a/drivers/video/backlight/aat2870_bl.c
+++ b/drivers/video/backlight/aat2870_bl.c
@@ -12,7 +12,6 @@
#include <linux/platform_device.h>
#include <linux/mutex.h>
#include <linux/delay.h>
-#include <linux/fb.h>
#include <linux/backlight.h>
#include <linux/mfd/aat2870.h>
@@ -90,15 +89,9 @@ static int aat2870_bl_update_status(struct backlight_device *bd)
return 0;
}
-static int aat2870_bl_check_fb(struct backlight_device *bd, struct fb_info *fi)
-{
- return 1;
-}
-
static const struct backlight_ops aat2870_bl_ops = {
.options = BL_CORE_SUSPENDRESUME,
.update_status = aat2870_bl_update_status,
- .check_fb = aat2870_bl_check_fb,
};
static int aat2870_bl_probe(struct platform_device *pdev)
diff --git a/drivers/video/backlight/ams369fg06.c b/drivers/video/backlight/ams369fg06.c
index 522dd81110..57ec205d2b 100644
--- a/drivers/video/backlight/ams369fg06.c
+++ b/drivers/video/backlight/ams369fg06.c
@@ -427,7 +427,7 @@ static int ams369fg06_set_brightness(struct backlight_device *bd)
return ret;
}
-static struct lcd_ops ams369fg06_lcd_ops = {
+static const struct lcd_ops ams369fg06_lcd_ops = {
.get_power = ams369fg06_get_power,
.set_power = ams369fg06_set_power,
};
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
index 86e1cdc8e3..a82934694d 100644
--- a/drivers/video/backlight/backlight.c
+++ b/drivers/video/backlight/backlight.c
@@ -98,7 +98,9 @@ static int fb_notifier_callback(struct notifier_block *self,
{
struct backlight_device *bd;
struct fb_event *evdata = data;
- int node = evdata->info->node;
+ struct fb_info *info = evdata->info;
+ struct backlight_device *fb_bd = fb_bl_device(info);
+ int node = info->node;
int fb_blank = 0;
/* If we aren't interested in this event, skip it immediately ... */
@@ -110,7 +112,9 @@ static int fb_notifier_callback(struct notifier_block *self,
if (!bd->ops)
goto out;
- if (bd->ops->check_fb && !bd->ops->check_fb(bd, evdata->info))
+ if (bd->ops->controls_device && !bd->ops->controls_device(bd, info->device))
+ goto out;
+ if (fb_bd && fb_bd != bd)
goto out;
fb_blank = *(int *)evdata->data;
@@ -118,14 +122,12 @@ static int fb_notifier_callback(struct notifier_block *self,
bd->fb_bl_on[node] = true;
if (!bd->use_count++) {
bd->props.state &= ~BL_CORE_FBBLANK;
- bd->props.fb_blank = FB_BLANK_UNBLANK;
backlight_update_status(bd);
}
} else if (fb_blank != FB_BLANK_UNBLANK && bd->fb_bl_on[node]) {
bd->fb_bl_on[node] = false;
if (!(--bd->use_count)) {
bd->props.state |= BL_CORE_FBBLANK;
- bd->props.fb_blank = fb_blank;
backlight_update_status(bd);
}
}
@@ -317,8 +319,6 @@ static ssize_t scale_show(struct device *dev,
}
static DEVICE_ATTR_RO(scale);
-static struct class *backlight_class;
-
#ifdef CONFIG_PM_SLEEP
static int backlight_suspend(struct device *dev)
{
@@ -369,6 +369,12 @@ static struct attribute *bl_device_attrs[] = {
};
ATTRIBUTE_GROUPS(bl_device);
+static const struct class backlight_class = {
+ .name = "backlight",
+ .dev_groups = bl_device_groups,
+ .pm = &backlight_class_dev_pm_ops,
+};
+
/**
* backlight_force_update - tell the backlight subsystem that hardware state
* has changed
@@ -418,7 +424,7 @@ struct backlight_device *backlight_device_register(const char *name,
mutex_init(&new_bd->update_lock);
mutex_init(&new_bd->ops_lock);
- new_bd->dev.class = backlight_class;
+ new_bd->dev.class = &backlight_class;
new_bd->dev.parent = parent;
new_bd->dev.release = bl_device_release;
dev_set_name(&new_bd->dev, "%s", name);
@@ -510,7 +516,7 @@ struct backlight_device *backlight_device_get_by_name(const char *name)
{
struct device *dev;
- dev = class_find_device_by_name(backlight_class, name);
+ dev = class_find_device_by_name(&backlight_class, name);
return dev ? to_backlight_device(dev) : NULL;
}
@@ -678,7 +684,7 @@ struct backlight_device *of_find_backlight_by_node(struct device_node *node)
{
struct device *dev;
- dev = class_find_device(backlight_class, NULL, node, of_parent_match);
+ dev = class_find_device(&backlight_class, NULL, node, of_parent_match);
return dev ? to_backlight_device(dev) : NULL;
}
@@ -746,20 +752,19 @@ EXPORT_SYMBOL(devm_of_find_backlight);
static void __exit backlight_class_exit(void)
{
- class_destroy(backlight_class);
+ class_unregister(&backlight_class);
}
static int __init backlight_class_init(void)
{
- backlight_class = class_create("backlight");
- if (IS_ERR(backlight_class)) {
- pr_warn("Unable to create backlight class; errno = %ld\n",
- PTR_ERR(backlight_class));
- return PTR_ERR(backlight_class);
+ int ret;
+
+ ret = class_register(&backlight_class);
+ if (ret) {
+ pr_warn("Unable to create backlight class; errno = %d\n", ret);
+ return ret;
}
- backlight_class->dev_groups = bl_device_groups;
- backlight_class->pm = &backlight_class_dev_pm_ops;
INIT_LIST_HEAD(&backlight_dev_list);
mutex_init(&backlight_dev_list_mutex);
BLOCKING_INIT_NOTIFIER_HEAD(&backlight_notifier);
diff --git a/drivers/video/backlight/bd6107.c b/drivers/video/backlight/bd6107.c
index b1e7126380..6be2c67ba8 100644
--- a/drivers/video/backlight/bd6107.c
+++ b/drivers/video/backlight/bd6107.c
@@ -99,18 +99,18 @@ static int bd6107_backlight_update_status(struct backlight_device *backlight)
return 0;
}
-static int bd6107_backlight_check_fb(struct backlight_device *backlight,
- struct fb_info *info)
+static bool bd6107_backlight_controls_device(struct backlight_device *backlight,
+ struct device *display_dev)
{
struct bd6107 *bd = bl_get_data(backlight);
- return !bd->pdata->dev || bd->pdata->dev == info->device;
+ return !bd->pdata->dev || bd->pdata->dev == display_dev;
}
static const struct backlight_ops bd6107_backlight_ops = {
- .options = BL_CORE_SUSPENDRESUME,
- .update_status = bd6107_backlight_update_status,
- .check_fb = bd6107_backlight_check_fb,
+ .options = BL_CORE_SUSPENDRESUME,
+ .update_status = bd6107_backlight_update_status,
+ .controls_device = bd6107_backlight_controls_device,
};
static int bd6107_probe(struct i2c_client *client)
diff --git a/drivers/video/backlight/corgi_lcd.c b/drivers/video/backlight/corgi_lcd.c
index dd765098ad..aad1680c90 100644
--- a/drivers/video/backlight/corgi_lcd.c
+++ b/drivers/video/backlight/corgi_lcd.c
@@ -380,7 +380,7 @@ static int corgi_lcd_get_power(struct lcd_device *ld)
return lcd->power;
}
-static struct lcd_ops corgi_lcd_ops = {
+static const struct lcd_ops corgi_lcd_ops = {
.get_power = corgi_lcd_get_power,
.set_power = corgi_lcd_set_power,
.set_mode = corgi_lcd_set_mode,
diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c
index e0c8c2a3f5..4476c317ce 100644
--- a/drivers/video/backlight/gpio_backlight.c
+++ b/drivers/video/backlight/gpio_backlight.c
@@ -30,18 +30,18 @@ static int gpio_backlight_update_status(struct backlight_device *bl)
return 0;
}
-static int gpio_backlight_check_fb(struct backlight_device *bl,
- struct fb_info *info)
+static bool gpio_backlight_controls_device(struct backlight_device *bl,
+ struct device *display_dev)
{
struct gpio_backlight *gbl = bl_get_data(bl);
- return !gbl->dev || gbl->dev == info->device;
+ return !gbl->dev || gbl->dev == display_dev;
}
static const struct backlight_ops gpio_backlight_ops = {
- .options = BL_CORE_SUSPENDRESUME,
- .update_status = gpio_backlight_update_status,
- .check_fb = gpio_backlight_check_fb,
+ .options = BL_CORE_SUSPENDRESUME,
+ .update_status = gpio_backlight_update_status,
+ .controls_device = gpio_backlight_controls_device,
};
static int gpio_backlight_probe(struct platform_device *pdev)
diff --git a/drivers/video/backlight/hx8357.c b/drivers/video/backlight/hx8357.c
index 339d9128fb..cdd7b76867 100644
--- a/drivers/video/backlight/hx8357.c
+++ b/drivers/video/backlight/hx8357.c
@@ -559,7 +559,7 @@ static int hx8357_get_power(struct lcd_device *lcdev)
return lcd->state;
}
-static struct lcd_ops hx8357_ops = {
+static const struct lcd_ops hx8357_ops = {
.set_power = hx8357_set_power,
.get_power = hx8357_get_power,
};
diff --git a/drivers/video/backlight/ili922x.c b/drivers/video/backlight/ili922x.c
index c8e0e655dc..7683e209ad 100644
--- a/drivers/video/backlight/ili922x.c
+++ b/drivers/video/backlight/ili922x.c
@@ -472,7 +472,7 @@ static int ili922x_get_power(struct lcd_device *ld)
return ili->power;
}
-static struct lcd_ops ili922x_ops = {
+static const struct lcd_ops ili922x_ops = {
.get_power = ili922x_get_power,
.set_power = ili922x_set_power,
};
diff --git a/drivers/video/backlight/ili9320.c b/drivers/video/backlight/ili9320.c
index 2acd2708f8..3e318d1891 100644
--- a/drivers/video/backlight/ili9320.c
+++ b/drivers/video/backlight/ili9320.c
@@ -161,7 +161,7 @@ static int ili9320_get_power(struct lcd_device *ld)
return lcd->power;
}
-static struct lcd_ops ili9320_ops = {
+static const struct lcd_ops ili9320_ops = {
.get_power = ili9320_get_power,
.set_power = ili9320_set_power,
};
diff --git a/drivers/video/backlight/jornada720_lcd.c b/drivers/video/backlight/jornada720_lcd.c
index 6796a7c2db..5c64fa61e8 100644
--- a/drivers/video/backlight/jornada720_lcd.c
+++ b/drivers/video/backlight/jornada720_lcd.c
@@ -81,7 +81,7 @@ static int jornada_lcd_set_power(struct lcd_device *ld, int power)
return 0;
}
-static struct lcd_ops jornada_lcd_props = {
+static const struct lcd_ops jornada_lcd_props = {
.get_contrast = jornada_lcd_get_contrast,
.set_contrast = jornada_lcd_set_contrast,
.get_power = jornada_lcd_get_power,
diff --git a/drivers/video/backlight/l4f00242t03.c b/drivers/video/backlight/l4f00242t03.c
index bd5137ee20..dd0874f8c7 100644
--- a/drivers/video/backlight/l4f00242t03.c
+++ b/drivers/video/backlight/l4f00242t03.c
@@ -158,7 +158,7 @@ static int l4f00242t03_lcd_power_set(struct lcd_device *ld, int power)
return 0;
}
-static struct lcd_ops l4f_ops = {
+static const struct lcd_ops l4f_ops = {
.set_power = l4f00242t03_lcd_power_set,
.get_power = l4f00242t03_lcd_power_get,
};
diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c
index 77c5cb2a44..ceec90ca75 100644
--- a/drivers/video/backlight/lcd.c
+++ b/drivers/video/backlight/lcd.c
@@ -159,8 +159,6 @@ static ssize_t max_contrast_show(struct device *dev,
}
static DEVICE_ATTR_RO(max_contrast);
-static struct class *lcd_class;
-
static void lcd_device_release(struct device *dev)
{
struct lcd_device *ld = to_lcd_device(dev);
@@ -175,6 +173,11 @@ static struct attribute *lcd_device_attrs[] = {
};
ATTRIBUTE_GROUPS(lcd_device);
+static const struct class lcd_class = {
+ .name = "lcd",
+ .dev_groups = lcd_device_groups,
+};
+
/**
* lcd_device_register - register a new object of lcd_device class.
* @name: the name of the new object(must be the same as the name of the
@@ -188,7 +191,7 @@ ATTRIBUTE_GROUPS(lcd_device);
* or a pointer to the newly allocated device.
*/
struct lcd_device *lcd_device_register(const char *name, struct device *parent,
- void *devdata, struct lcd_ops *ops)
+ void *devdata, const struct lcd_ops *ops)
{
struct lcd_device *new_ld;
int rc;
@@ -202,7 +205,7 @@ struct lcd_device *lcd_device_register(const char *name, struct device *parent,
mutex_init(&new_ld->ops_lock);
mutex_init(&new_ld->update_lock);
- new_ld->dev.class = lcd_class;
+ new_ld->dev.class = &lcd_class;
new_ld->dev.parent = parent;
new_ld->dev.release = lcd_device_release;
dev_set_name(&new_ld->dev, "%s", name);
@@ -276,7 +279,7 @@ static int devm_lcd_device_match(struct device *dev, void *res, void *data)
*/
struct lcd_device *devm_lcd_device_register(struct device *dev,
const char *name, struct device *parent,
- void *devdata, struct lcd_ops *ops)
+ void *devdata, const struct lcd_ops *ops)
{
struct lcd_device **ptr, *lcd;
@@ -318,19 +321,19 @@ EXPORT_SYMBOL(devm_lcd_device_unregister);
static void __exit lcd_class_exit(void)
{
- class_destroy(lcd_class);
+ class_unregister(&lcd_class);
}
static int __init lcd_class_init(void)
{
- lcd_class = class_create("lcd");
- if (IS_ERR(lcd_class)) {
- pr_warn("Unable to create backlight class; errno = %ld\n",
- PTR_ERR(lcd_class));
- return PTR_ERR(lcd_class);
+ int ret;
+
+ ret = class_register(&lcd_class);
+ if (ret) {
+ pr_warn("Unable to create backlight class; errno = %d\n", ret);
+ return ret;
}
- lcd_class->dev_groups = lcd_device_groups;
return 0;
}
diff --git a/drivers/video/backlight/lms283gf05.c b/drivers/video/backlight/lms283gf05.c
index 36856962ed..a65490e83d 100644
--- a/drivers/video/backlight/lms283gf05.c
+++ b/drivers/video/backlight/lms283gf05.c
@@ -139,7 +139,7 @@ static int lms283gf05_power_set(struct lcd_device *ld, int power)
return 0;
}
-static struct lcd_ops lms_ops = {
+static const struct lcd_ops lms_ops = {
.set_power = lms283gf05_power_set,
.get_power = NULL,
};
diff --git a/drivers/video/backlight/lms501kf03.c b/drivers/video/backlight/lms501kf03.c
index 5c46df8022..8aebe0af33 100644
--- a/drivers/video/backlight/lms501kf03.c
+++ b/drivers/video/backlight/lms501kf03.c
@@ -304,7 +304,7 @@ static int lms501kf03_set_power(struct lcd_device *ld, int power)
return lms501kf03_power(lcd, power);
}
-static struct lcd_ops lms501kf03_lcd_ops = {
+static const struct lcd_ops lms501kf03_lcd_ops = {
.get_power = lms501kf03_get_power,
.set_power = lms501kf03_set_power,
};
diff --git a/drivers/video/backlight/lp8788_bl.c b/drivers/video/backlight/lp8788_bl.c
index 31f97230ee..0b7663519f 100644
--- a/drivers/video/backlight/lp8788_bl.c
+++ b/drivers/video/backlight/lp8788_bl.c
@@ -12,7 +12,6 @@
#include <linux/mfd/lp8788.h>
#include <linux/module.h>
#include <linux/platform_device.h>
-#include <linux/pwm.h>
#include <linux/slab.h>
/* Register address */
@@ -31,149 +30,40 @@
#define MAX_BRIGHTNESS 127
#define DEFAULT_BL_NAME "lcd-backlight"
-struct lp8788_bl_config {
- enum lp8788_bl_ctrl_mode bl_mode;
- enum lp8788_bl_dim_mode dim_mode;
- enum lp8788_bl_full_scale_current full_scale;
- enum lp8788_bl_ramp_step rise_time;
- enum lp8788_bl_ramp_step fall_time;
- enum pwm_polarity pwm_pol;
-};
-
struct lp8788_bl {
struct lp8788 *lp;
struct backlight_device *bl_dev;
- struct lp8788_backlight_platform_data *pdata;
- enum lp8788_bl_ctrl_mode mode;
- struct pwm_device *pwm;
-};
-
-static struct lp8788_bl_config default_bl_config = {
- .bl_mode = LP8788_BL_REGISTER_ONLY,
- .dim_mode = LP8788_DIM_EXPONENTIAL,
- .full_scale = LP8788_FULLSCALE_1900uA,
- .rise_time = LP8788_RAMP_8192us,
- .fall_time = LP8788_RAMP_8192us,
- .pwm_pol = PWM_POLARITY_NORMAL,
};
-static inline bool is_brightness_ctrl_by_pwm(enum lp8788_bl_ctrl_mode mode)
-{
- return mode == LP8788_BL_COMB_PWM_BASED;
-}
-
-static inline bool is_brightness_ctrl_by_register(enum lp8788_bl_ctrl_mode mode)
-{
- return mode == LP8788_BL_REGISTER_ONLY ||
- mode == LP8788_BL_COMB_REGISTER_BASED;
-}
-
static int lp8788_backlight_configure(struct lp8788_bl *bl)
{
- struct lp8788_backlight_platform_data *pdata = bl->pdata;
- struct lp8788_bl_config *cfg = &default_bl_config;
int ret;
u8 val;
- /*
- * Update chip configuration if platform data exists,
- * otherwise use the default settings.
- */
- if (pdata) {
- cfg->bl_mode = pdata->bl_mode;
- cfg->dim_mode = pdata->dim_mode;
- cfg->full_scale = pdata->full_scale;
- cfg->rise_time = pdata->rise_time;
- cfg->fall_time = pdata->fall_time;
- cfg->pwm_pol = pdata->pwm_pol;
- }
-
/* Brightness ramp up/down */
- val = (cfg->rise_time << LP8788_BL_RAMP_RISE_SHIFT) | cfg->fall_time;
+ val = (LP8788_RAMP_8192us << LP8788_BL_RAMP_RISE_SHIFT) | LP8788_RAMP_8192us;
ret = lp8788_write_byte(bl->lp, LP8788_BL_RAMP, val);
if (ret)
return ret;
/* Fullscale current setting */
- val = (cfg->full_scale << LP8788_BL_FULLSCALE_SHIFT) |
- (cfg->dim_mode << LP8788_BL_DIM_MODE_SHIFT);
+ val = (LP8788_FULLSCALE_1900uA << LP8788_BL_FULLSCALE_SHIFT) |
+ (LP8788_DIM_EXPONENTIAL << LP8788_BL_DIM_MODE_SHIFT);
/* Brightness control mode */
- switch (cfg->bl_mode) {
- case LP8788_BL_REGISTER_ONLY:
- val |= LP8788_BL_EN;
- break;
- case LP8788_BL_COMB_PWM_BASED:
- case LP8788_BL_COMB_REGISTER_BASED:
- val |= LP8788_BL_EN | LP8788_BL_PWM_INPUT_EN |
- (cfg->pwm_pol << LP8788_BL_PWM_POLARITY_SHIFT);
- break;
- default:
- dev_err(bl->lp->dev, "invalid mode: %d\n", cfg->bl_mode);
- return -EINVAL;
- }
-
- bl->mode = cfg->bl_mode;
+ val |= LP8788_BL_EN;
return lp8788_write_byte(bl->lp, LP8788_BL_CONFIG, val);
}
-static void lp8788_pwm_ctrl(struct lp8788_bl *bl, int br, int max_br)
-{
- unsigned int period;
- unsigned int duty;
- struct device *dev;
- struct pwm_device *pwm;
-
- if (!bl->pdata)
- return;
-
- period = bl->pdata->period_ns;
- duty = br * period / max_br;
- dev = bl->lp->dev;
-
- /* request PWM device with the consumer name */
- if (!bl->pwm) {
- pwm = devm_pwm_get(dev, LP8788_DEV_BACKLIGHT);
- if (IS_ERR(pwm)) {
- dev_err(dev, "can not get PWM device\n");
- return;
- }
-
- bl->pwm = pwm;
-
- /*
- * FIXME: pwm_apply_args() should be removed when switching to
- * the atomic PWM API.
- */
- pwm_apply_args(pwm);
- }
-
- pwm_config(bl->pwm, duty, period);
- if (duty)
- pwm_enable(bl->pwm);
- else
- pwm_disable(bl->pwm);
-}
-
static int lp8788_bl_update_status(struct backlight_device *bl_dev)
{
struct lp8788_bl *bl = bl_get_data(bl_dev);
- enum lp8788_bl_ctrl_mode mode = bl->mode;
if (bl_dev->props.state & BL_CORE_SUSPENDED)
bl_dev->props.brightness = 0;
- if (is_brightness_ctrl_by_pwm(mode)) {
- int brt = bl_dev->props.brightness;
- int max = bl_dev->props.max_brightness;
-
- lp8788_pwm_ctrl(bl, brt, max);
- } else if (is_brightness_ctrl_by_register(mode)) {
- u8 brt = bl_dev->props.brightness;
-
- lp8788_write_byte(bl->lp, LP8788_BL_BRIGHTNESS, brt);
- }
+ lp8788_write_byte(bl->lp, LP8788_BL_BRIGHTNESS, bl_dev->props.brightness);
return 0;
}
@@ -187,30 +77,16 @@ static int lp8788_backlight_register(struct lp8788_bl *bl)
{
struct backlight_device *bl_dev;
struct backlight_properties props;
- struct lp8788_backlight_platform_data *pdata = bl->pdata;
- int init_brt;
- char *name;
memset(&props, 0, sizeof(struct backlight_properties));
props.type = BACKLIGHT_PLATFORM;
props.max_brightness = MAX_BRIGHTNESS;
/* Initial brightness */
- if (pdata)
- init_brt = min_t(int, pdata->initial_brightness,
- props.max_brightness);
- else
- init_brt = 0;
-
- props.brightness = init_brt;
+ props.brightness = 0;
/* Backlight device name */
- if (!pdata || !pdata->name)
- name = DEFAULT_BL_NAME;
- else
- name = pdata->name;
-
- bl_dev = backlight_device_register(name, bl->lp->dev, bl,
+ bl_dev = backlight_device_register(DEFAULT_BL_NAME, bl->lp->dev, bl,
&lp8788_bl_ops, &props);
if (IS_ERR(bl_dev))
return PTR_ERR(bl_dev);
@@ -230,16 +106,7 @@ static void lp8788_backlight_unregister(struct lp8788_bl *bl)
static ssize_t lp8788_get_bl_ctl_mode(struct device *dev,
struct device_attribute *attr, char *buf)
{
- struct lp8788_bl *bl = dev_get_drvdata(dev);
- enum lp8788_bl_ctrl_mode mode = bl->mode;
- char *strmode;
-
- if (is_brightness_ctrl_by_pwm(mode))
- strmode = "PWM based";
- else if (is_brightness_ctrl_by_register(mode))
- strmode = "Register based";
- else
- strmode = "Invalid mode";
+ const char *strmode = "Register based";
return scnprintf(buf, PAGE_SIZE, "%s\n", strmode);
}
@@ -266,8 +133,6 @@ static int lp8788_backlight_probe(struct platform_device *pdev)
return -ENOMEM;
bl->lp = lp;
- if (lp->pdata)
- bl->pdata = lp->pdata->bl_pdata;
platform_set_drvdata(pdev, bl);
diff --git a/drivers/video/backlight/ltv350qv.c b/drivers/video/backlight/ltv350qv.c
index d54f501e42..cdc4c087f2 100644
--- a/drivers/video/backlight/ltv350qv.c
+++ b/drivers/video/backlight/ltv350qv.c
@@ -217,7 +217,7 @@ static int ltv350qv_get_power(struct lcd_device *ld)
return lcd->power;
}
-static struct lcd_ops ltv_ops = {
+static const struct lcd_ops ltv_ops = {
.get_power = ltv350qv_get_power,
.set_power = ltv350qv_set_power,
};
diff --git a/drivers/video/backlight/lv5207lp.c b/drivers/video/backlight/lv5207lp.c
index 1f1d06b4e1..0cf00fee0f 100644
--- a/drivers/video/backlight/lv5207lp.c
+++ b/drivers/video/backlight/lv5207lp.c
@@ -62,18 +62,18 @@ static int lv5207lp_backlight_update_status(struct backlight_device *backlight)
return 0;
}
-static int lv5207lp_backlight_check_fb(struct backlight_device *backlight,
- struct fb_info *info)
+static bool lv5207lp_backlight_controls_device(struct backlight_device *backlight,
+ struct device *display_dev)
{
struct lv5207lp *lv = bl_get_data(backlight);
- return !lv->pdata->dev || lv->pdata->dev == info->device;
+ return !lv->pdata->dev || lv->pdata->dev == display_dev;
}
static const struct backlight_ops lv5207lp_backlight_ops = {
- .options = BL_CORE_SUSPENDRESUME,
- .update_status = lv5207lp_backlight_update_status,
- .check_fb = lv5207lp_backlight_check_fb,
+ .options = BL_CORE_SUSPENDRESUME,
+ .update_status = lv5207lp_backlight_update_status,
+ .controls_device = lv5207lp_backlight_controls_device,
};
static int lv5207lp_probe(struct i2c_client *client)
diff --git a/drivers/video/backlight/mp3309c.c b/drivers/video/backlight/mp3309c.c
index 4e98e60417..a28036c964 100644
--- a/drivers/video/backlight/mp3309c.c
+++ b/drivers/video/backlight/mp3309c.c
@@ -97,15 +97,10 @@ static int mp3309c_enable_device(struct mp3309c_chip *chip)
/*
* I2C register #1 - Set working mode:
- * - set one of the two dimming mode:
- * - PWM dimming using an external PWM dimming signal
- * - analog dimming using I2C commands
* - enable/disable synchronous mode
* - set overvoltage protection (OVP)
*/
reg_val = 0x00;
- if (chip->pdata->dimming_mode == DIMMING_PWM)
- reg_val |= REG_I2C_1_DIMS;
if (chip->pdata->sync_mode)
reg_val |= REG_I2C_1_SYNC;
reg_val |= chip->pdata->over_voltage_protection;
@@ -364,7 +359,6 @@ static int mp3309c_probe(struct i2c_client *client)
props.scale = BACKLIGHT_SCALE_LINEAR;
props.type = BACKLIGHT_RAW;
props.power = FB_BLANK_UNBLANK;
- props.fb_blank = FB_BLANK_UNBLANK;
chip->bl = devm_backlight_device_register(dev, "mp3309c", dev, chip,
&mp3309c_bl_ops, &props);
if (IS_ERR(chip->bl))
diff --git a/drivers/video/backlight/omap1_bl.c b/drivers/video/backlight/omap1_bl.c
index 69a49384b3..e461e19231 100644
--- a/drivers/video/backlight/omap1_bl.c
+++ b/drivers/video/backlight/omap1_bl.c
@@ -9,7 +9,6 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
-#include <linux/fb.h>
#include <linux/backlight.h>
#include <linux/slab.h>
#include <linux/platform_data/omap1_bl.h>
@@ -20,7 +19,7 @@
#define OMAPBL_MAX_INTENSITY 0xff
struct omap_backlight {
- int powermode;
+ bool enabled;
int current_intensity;
struct device *dev;
@@ -37,24 +36,14 @@ static inline void omapbl_send_enable(int enable)
omap_writeb(enable, OMAP_PWL_CLK_ENABLE);
}
-static void omapbl_blank(struct omap_backlight *bl, int mode)
+static void omapbl_enable(struct omap_backlight *bl, bool enable)
{
- if (bl->pdata->set_power)
- bl->pdata->set_power(bl->dev, mode);
-
- switch (mode) {
- case FB_BLANK_NORMAL:
- case FB_BLANK_VSYNC_SUSPEND:
- case FB_BLANK_HSYNC_SUSPEND:
- case FB_BLANK_POWERDOWN:
- omapbl_send_intensity(0);
- omapbl_send_enable(0);
- break;
-
- case FB_BLANK_UNBLANK:
+ if (enable) {
omapbl_send_intensity(bl->current_intensity);
omapbl_send_enable(1);
- break;
+ } else {
+ omapbl_send_intensity(0);
+ omapbl_send_enable(0);
}
}
@@ -64,7 +53,7 @@ static int omapbl_suspend(struct device *dev)
struct backlight_device *bl_dev = dev_get_drvdata(dev);
struct omap_backlight *bl = bl_get_data(bl_dev);
- omapbl_blank(bl, FB_BLANK_POWERDOWN);
+ omapbl_enable(bl, false);
return 0;
}
@@ -73,33 +62,34 @@ static int omapbl_resume(struct device *dev)
struct backlight_device *bl_dev = dev_get_drvdata(dev);
struct omap_backlight *bl = bl_get_data(bl_dev);
- omapbl_blank(bl, bl->powermode);
+ omapbl_enable(bl, bl->enabled);
return 0;
}
#endif
-static int omapbl_set_power(struct backlight_device *dev, int state)
+static void omapbl_set_enabled(struct backlight_device *dev, bool enable)
{
struct omap_backlight *bl = bl_get_data(dev);
- omapbl_blank(bl, state);
- bl->powermode = state;
-
- return 0;
+ omapbl_enable(bl, enable);
+ bl->enabled = enable;
}
static int omapbl_update_status(struct backlight_device *dev)
{
struct omap_backlight *bl = bl_get_data(dev);
+ bool enable;
if (bl->current_intensity != dev->props.brightness) {
- if (bl->powermode == FB_BLANK_UNBLANK)
+ if (bl->enabled)
omapbl_send_intensity(dev->props.brightness);
bl->current_intensity = dev->props.brightness;
}
- if (dev->props.fb_blank != bl->powermode)
- omapbl_set_power(dev, dev->props.fb_blank);
+ enable = !backlight_is_blank(dev);
+
+ if (enable != bl->enabled)
+ omapbl_set_enabled(dev, enable);
return 0;
}
@@ -139,7 +129,7 @@ static int omapbl_probe(struct platform_device *pdev)
if (IS_ERR(dev))
return PTR_ERR(dev);
- bl->powermode = FB_BLANK_POWERDOWN;
+ bl->enabled = false;
bl->current_intensity = 0;
bl->pdata = pdata;
@@ -149,7 +139,6 @@ static int omapbl_probe(struct platform_device *pdev)
omap_cfg_reg(PWL); /* Conflicts with UART3 */
- dev->props.fb_blank = FB_BLANK_UNBLANK;
dev->props.brightness = pdata->default_intensity;
omapbl_update_status(dev);
diff --git a/drivers/video/backlight/otm3225a.c b/drivers/video/backlight/otm3225a.c
index 2472e2167a..efe52fa08b 100644
--- a/drivers/video/backlight/otm3225a.c
+++ b/drivers/video/backlight/otm3225a.c
@@ -205,7 +205,7 @@ static int otm3225a_get_power(struct lcd_device *ld)
return dd->power;
}
-static struct lcd_ops otm3225a_ops = {
+static const struct lcd_ops otm3225a_ops = {
.set_power = otm3225a_set_power,
.get_power = otm3225a_get_power,
};
@@ -239,7 +239,6 @@ static int otm3225a_probe(struct spi_device *spi)
static struct spi_driver otm3225a_driver = {
.driver = {
.name = "otm3225a",
- .owner = THIS_MODULE,
},
.probe = otm3225a_probe,
};
diff --git a/drivers/video/backlight/platform_lcd.c b/drivers/video/backlight/platform_lcd.c
index dc37494baf..76872f5c34 100644
--- a/drivers/video/backlight/platform_lcd.c
+++ b/drivers/video/backlight/platform_lcd.c
@@ -62,7 +62,7 @@ static int platform_lcd_match(struct lcd_device *lcd, struct fb_info *info)
return plcd->us->parent == info->device;
}
-static struct lcd_ops platform_lcd_ops = {
+static const struct lcd_ops platform_lcd_ops = {
.get_power = platform_lcd_get_power,
.set_power = platform_lcd_set_power,
.check_fb = platform_lcd_match,
diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
index ffcebf6aa7..61d30bc98e 100644
--- a/drivers/video/backlight/pwm_bl.c
+++ b/drivers/video/backlight/pwm_bl.c
@@ -11,7 +11,6 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
-#include <linux/fb.h>
#include <linux/backlight.h>
#include <linux/err.h>
#include <linux/pwm.h>
@@ -34,7 +33,6 @@ struct pwm_bl_data {
int brightness);
void (*notify_after)(struct device *,
int brightness);
- int (*check_fb)(struct device *, struct fb_info *);
void (*exit)(struct device *);
};
@@ -129,17 +127,8 @@ static int pwm_backlight_update_status(struct backlight_device *bl)
return 0;
}
-static int pwm_backlight_check_fb(struct backlight_device *bl,
- struct fb_info *info)
-{
- struct pwm_bl_data *pb = bl_get_data(bl);
-
- return !pb->check_fb || pb->check_fb(pb->dev, info);
-}
-
static const struct backlight_ops pwm_backlight_ops = {
.update_status = pwm_backlight_update_status,
- .check_fb = pwm_backlight_check_fb,
};
#ifdef CONFIG_OF
@@ -482,7 +471,6 @@ static int pwm_backlight_probe(struct platform_device *pdev)
pb->notify = data->notify;
pb->notify_after = data->notify_after;
- pb->check_fb = data->check_fb;
pb->exit = data->exit;
pb->dev = &pdev->dev;
pb->enabled = false;
diff --git a/drivers/video/backlight/sky81452-backlight.c b/drivers/video/backlight/sky81452-backlight.c
index eb18c6eb0f..19f9f84a9f 100644
--- a/drivers/video/backlight/sky81452-backlight.c
+++ b/drivers/video/backlight/sky81452-backlight.c
@@ -182,7 +182,7 @@ static const struct attribute_group sky81452_bl_attr_group = {
static struct sky81452_bl_platform_data *sky81452_bl_parse_dt(
struct device *dev)
{
- struct device_node *np = of_node_get(dev->of_node);
+ struct device_node *np = dev->of_node;
struct sky81452_bl_platform_data *pdata;
int num_entry;
unsigned int sources[6];
@@ -194,10 +194,8 @@ static struct sky81452_bl_platform_data *sky81452_bl_parse_dt(
}
pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
- if (!pdata) {
- of_node_put(np);
+ if (!pdata)
return ERR_PTR(-ENOMEM);
- }
of_property_read_string(np, "name", &pdata->name);
pdata->ignore_pwm = of_property_read_bool(np, "skyworks,ignore-pwm");
@@ -217,7 +215,6 @@ static struct sky81452_bl_platform_data *sky81452_bl_parse_dt(
num_entry);
if (ret < 0) {
dev_err(dev, "led-sources node is invalid.\n");
- of_node_put(np);
return ERR_PTR(-EINVAL);
}
@@ -237,7 +234,6 @@ static struct sky81452_bl_platform_data *sky81452_bl_parse_dt(
if (ret < 0)
pdata->boost_current_limit = 2750;
- of_node_put(np);
return pdata;
}
#else
diff --git a/drivers/video/backlight/tdo24m.c b/drivers/video/backlight/tdo24m.c
index fc6fbaf855..c413b3c68e 100644
--- a/drivers/video/backlight/tdo24m.c
+++ b/drivers/video/backlight/tdo24m.c
@@ -322,7 +322,7 @@ static int tdo24m_set_mode(struct lcd_device *ld, struct fb_videomode *m)
return lcd->adj_mode(lcd, mode);
}
-static struct lcd_ops tdo24m_ops = {
+static const struct lcd_ops tdo24m_ops = {
.get_power = tdo24m_get_power,
.set_power = tdo24m_set_power,
.set_mode = tdo24m_set_mode,