History

Merge tag 'backlight-next-6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight

Pull backlight updates from Lee Jones: "Fix-ups: - FB Backlight interaction overhaul - Remove superfluous code and simplify overall - Constify various structs and struct attributes Bug Fixes: - Repair LED flickering - Fix signedness bugs" * tag 'backlight-next-6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight: (42 commits) backlight: sky81452-backlight: Remove unnecessary call to of_node_get() backlight: mp3309c: Fix LEDs flickering in PWM mode backlight: otm3225a: Drop driver owner assignment backlight: lp8788: Drop support for platform data backlight: lcd: Make lcd_class constant backlight: Make backlight_class constant backlight: mp3309c: Fix signedness bug in mp3309c_parse_fwnode() const_structs.checkpatch: add lcd_ops fbdev: omap: lcd_ams_delta: Constify lcd_ops fbdev: imx: Constify lcd_ops fbdev: clps711x: Constify lcd_ops HID: picoLCD: Constify lcd_ops backlight: tdo24m: Constify lcd_ops backlight: platform_lcd: Constify lcd_ops backlight: otm3225a: Constify lcd_ops backlight: ltv350qv: Constify lcd_ops backlight: lms501kf03: Constify lcd_ops backlight: lms283gf05: Constify lcd_ops backlight: l4f00242t03: Constify lcd_ops backlight: jornada720_lcd: Constify lcd_ops ...

Linus Torvalds committed 2 years ago

Commit 7eae27c2 parents a85629f 1fd949f47 files · +161 −418Browse files

Unified · Split

47 files
  1. drivers/auxdisplay/ht16k33.c +1 −14
  2. drivers/hid/hid-picolcd_backlight.c +0 −7
  3. drivers/hid/hid-picolcd_core.c +7 −7
  4. drivers/hid/hid-picolcd_fb.c +6 −0
  5. drivers/hid/hid-picolcd_lcd.c +1 −1
  6. drivers/staging/fbtft/fb_ssd1351.c +1 −3
  7. drivers/staging/fbtft/fbtft-core.c +2 −3
  8. drivers/video/backlight/aat2870_bl.c +0 −7
  9. drivers/video/backlight/ams369fg06.c +1 −1
  10. drivers/video/backlight/backlight.c +22 −17
  11. drivers/video/backlight/bd6107.c +6 −6
  12. drivers/video/backlight/corgi_lcd.c +1 −1
  13. drivers/video/backlight/gpio_backlight.c +6 −6
  14. drivers/video/backlight/hx8357.c +1 −1
  15. drivers/video/backlight/ili922x.c +1 −1
  16. drivers/video/backlight/ili9320.c +1 −1
  17. drivers/video/backlight/jornada720_lcd.c +1 −1
  18. drivers/video/backlight/l4f00242t03.c +1 −1
  19. drivers/video/backlight/lcd.c +15 −12
  20. drivers/video/backlight/lms283gf05.c +1 −1
  21. drivers/video/backlight/lms501kf03.c +1 −1
  22. drivers/video/backlight/lp8788_bl.c +8 −143
  23. drivers/video/backlight/ltv350qv.c +1 −1
  24. drivers/video/backlight/lv5207lp.c +6 −6
  25. drivers/video/backlight/mp3309c.c +2 −7
  26. drivers/video/backlight/omap1_bl.c +18 −29
  27. drivers/video/backlight/otm3225a.c +1 −2
  28. drivers/video/backlight/platform_lcd.c +1 −1
  29. drivers/video/backlight/pwm_bl.c +0 −12
  30. drivers/video/backlight/sky81452-backlight.c +2 −6
  31. drivers/video/backlight/tdo24m.c +1 −1
  32. drivers/video/fbdev/atmel_lcdfb.c +0 −1
  33. drivers/video/fbdev/clps711x-fb.c +1 −1
  34. drivers/video/fbdev/core/fb_backlight.c +6 −0
  35. drivers/video/fbdev/imxfb.c +1 −1
  36. drivers/video/fbdev/omap/lcd_ams_delta.c +1 −1
  37. drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c +1 −6
  38. drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c +2 −8
  39. drivers/video/fbdev/sh_mobile_lcdcfb.c +0 −7
  40. drivers/video/fbdev/ssd1307fb.c +11 −20
  41. include/linux/backlight.h +9 −32
  42. include/linux/fb.h +9 −0
  43. include/linux/lcd.h +3 −3
  44. include/linux/mfd/lp8788.h +0 −36
  45. include/linux/platform_data/omap1_bl.h +0 −1
  46. include/linux/pwm_backlight.h +0 −1
  47. scripts/const_structs.checkpatch +1 −0
drivers/auxdisplay/ht16k33.c+1−14
@@ -284,27 +284,14 @@ static int ht16k33_initialize(struct ht16k33_priv *priv) · 283 unmodified lines
284284
285285 static int ht16k33_bl_update_status(struct backlight_device *bl)
286286 {
287− int brightness = bl->props.brightness;
287+ const int brightness = backlight_get_brightness(bl);
288288 struct ht16k33_priv *priv = bl_get_data(bl);
289289
290− if (bl->props.power != FB_BLANK_UNBLANK ||
291− bl->props.fb_blank != FB_BLANK_UNBLANK ||
292− bl->props.state & BL_CORE_FBBLANK)
293− brightness = 0;
294−
295290 return ht16k33_brightness_set(priv, brightness);
296291 }
297292
298−static int ht16k33_bl_check_fb(struct backlight_device *bl, struct fb_info *fi)
299−{
300− struct ht16k33_priv *priv = bl_get_data(bl);
301−
302− return (fi == NULL) || (fi->par == priv);
303−}
304−
305293 static const struct backlight_ops ht16k33_bl_ops = {
306294 .update_status = ht16k33_bl_update_status,
307− .check_fb = ht16k33_bl_check_fb,
308295 };
309296
310297 /*
drivers/hid/hid-picolcd_backlight.c+0−7
@@ -9,7 +9,6 @@ · 8 unmodified lines
99
1010 #include <linux/hid.h>
1111
12−#include <linux/fb.h>
1312 #include <linux/backlight.h>
1413
1514 #include "hid-picolcd.h"
@@ -39,15 +38,9 @@ static int picolcd_set_brightness(struct backlight_device *bdev) · 23 unmodified lines
3938 return 0;
4039 }
4140
42−static int picolcd_check_bl_fb(struct backlight_device *bdev, struct fb_info *fb)
43−{
44− return fb && fb == picolcd_fbinfo((struct picolcd_data *)bl_get_data(bdev));
45−}
46−
4741 static const struct backlight_ops picolcd_blops = {
4842 .update_status = picolcd_set_brightness,
4943 .get_brightness = picolcd_get_brightness,
50− .check_fb = picolcd_check_bl_fb,
5144 };
5245
5346 int picolcd_init_backlight(struct picolcd_data *data, struct hid_report *report)
drivers/hid/hid-picolcd_core.c+7−7
@@ -474,11 +474,6 @@ static int picolcd_probe_lcd(struct hid_device *hdev, struct picolcd_data *data) · 473 unmodified lines
474474 if (error)
475475 goto err;
476476
477− /* Set up the framebuffer device */
478− error = picolcd_init_framebuffer(data);
479− if (error)
480− goto err;
481−
482477 /* Setup lcd class device */
483478 error = picolcd_init_lcd(data, picolcd_out_report(REPORT_CONTRAST, hdev));
484479 if (error)
@@ -489,6 +484,11 @@ static int picolcd_probe_lcd(struct hid_device *hdev, struct picolcd_data *data) · 4 unmodified lines
489484 if (error)
490485 goto err;
491486
487+ /* Set up the framebuffer device */
488+ error = picolcd_init_framebuffer(data);
489+ if (error)
490+ goto err;
491+
492492 /* Setup the LED class devices */
493493 error = picolcd_init_leds(data, picolcd_out_report(REPORT_LED_STATE, hdev));
494494 if (error)
@@ -502,9 +502,9 @@ static int picolcd_probe_lcd(struct hid_device *hdev, struct picolcd_data *data) · 7 unmodified lines
502502 return 0;
503503 err:
504504 picolcd_exit_leds(data);
505+ picolcd_exit_framebuffer(data);
505506 picolcd_exit_backlight(data);
506507 picolcd_exit_lcd(data);
507− picolcd_exit_framebuffer(data);
508508 picolcd_exit_cir(data);
509509 picolcd_exit_keys(data);
510510 return error;
@@ -623,9 +623,9 @@ static void picolcd_remove(struct hid_device *hdev) · 112 unmodified lines
623623 /* Cleanup LED */
624624 picolcd_exit_leds(data);
625625 /* Clean up the framebuffer */
626+ picolcd_exit_framebuffer(data);
626627 picolcd_exit_backlight(data);
627628 picolcd_exit_lcd(data);
628− picolcd_exit_framebuffer(data);
629629 /* Cleanup input */
630630 picolcd_exit_cir(data);
631631 picolcd_exit_keys(data);
drivers/hid/hid-picolcd_fb.c+6−0
@@ -491,6 +491,12 @@ int picolcd_init_framebuffer(struct picolcd_data *data) · 490 unmodified lines
491491 info->fix = picolcdfb_fix;
492492 info->fix.smem_len = PICOLCDFB_SIZE*8;
493493
494+#ifdef CONFIG_FB_BACKLIGHT
495+#ifdef CONFIG_HID_PICOLCD_BACKLIGHT
496+ info->bl_dev = data->backlight;
497+#endif
498+#endif
499+
494500 fbdata = info->par;
495501 spin_lock_init(&fbdata->lock);
496502 fbdata->picolcd = data;
drivers/hid/hid-picolcd_lcd.c+1−1
@@ -46,7 +46,7 @@ static int picolcd_check_lcd_fb(struct lcd_device *ldev, struct fb_info *fb) · 45 unmodified lines
4646 return fb && fb == picolcd_fbinfo((struct picolcd_data *)lcd_get_data(ldev));
4747 }
4848
49−static struct lcd_ops picolcd_lcdops = {
49+static const struct lcd_ops picolcd_lcdops = {
5050 .get_contrast = picolcd_get_contrast,
5151 .set_contrast = picolcd_set_contrast,
5252 .check_fb = picolcd_check_lcd_fb,
drivers/staging/fbtft/fb_ssd1351.c+1−3
@@ -194,9 +194,7 @@ static int update_onboard_backlight(struct backlight_device *bd) · 193 unmodified lines
194194 struct fbtft_par *par = bl_get_data(bd);
195195 bool on;
196196
197− fbtft_par_dbg(DEBUG_BACKLIGHT, par,
198− "%s: power=%d, fb_blank=%d\n",
199− __func__, bd->props.power, bd->props.fb_blank);
197+ fbtft_par_dbg(DEBUG_BACKLIGHT, par, "%s: power=%d\n", __func__, bd->props.power);
200198
201199 on = !backlight_is_blank(bd);
202200 /* Onboard backlight connected to GPIO0 on SSD1351, GPIO1 unused */
drivers/staging/fbtft/fbtft-core.c+2−3
@@ -133,9 +133,8 @@ static int fbtft_backlight_update_status(struct backlight_device *bd) · 132 unmodified lines
133133 struct fbtft_par *par = bl_get_data(bd);
134134 bool polarity = par->polarity;
135135
136− fbtft_par_dbg(DEBUG_BACKLIGHT, par,
137− "%s: polarity=%d, power=%d, fb_blank=%d\n",
138− __func__, polarity, bd->props.power, bd->props.fb_blank);
136+ fbtft_par_dbg(DEBUG_BACKLIGHT, par, "%s: polarity=%d, power=%d\n", __func__,
137+ polarity, bd->props.power);
139138
140139 if (!backlight_is_blank(bd))
141140 gpiod_set_value(par->gpio.led[0], polarity);
drivers/video/backlight/aat2870_bl.c+0−7
@@ -12,7 +12,6 @@ · 11 unmodified lines
1212 #include <linux/platform_device.h>
1313 #include <linux/mutex.h>
1414 #include <linux/delay.h>
15−#include <linux/fb.h>
1615 #include <linux/backlight.h>
1716 #include <linux/mfd/aat2870.h>
1817
@@ -90,15 +89,9 @@ static int aat2870_bl_update_status(struct backlight_device *bd) · 71 unmodified lines
9089 return 0;
9190 }
9291
93−static int aat2870_bl_check_fb(struct backlight_device *bd, struct fb_info *fi)
94−{
95− return 1;
96−}
97−
9892 static const struct backlight_ops aat2870_bl_ops = {
9993 .options = BL_CORE_SUSPENDRESUME,
10094 .update_status = aat2870_bl_update_status,
101− .check_fb = aat2870_bl_check_fb,
10295 };
10396
10497 static int aat2870_bl_probe(struct platform_device *pdev)
drivers/video/backlight/ams369fg06.c+1−1
@@ -427,7 +427,7 @@ static int ams369fg06_set_brightness(struct backlight_device *bd) · 426 unmodified lines
427427 return ret;
428428 }
429429
430−static struct lcd_ops ams369fg06_lcd_ops = {
430+static const struct lcd_ops ams369fg06_lcd_ops = {
431431 .get_power = ams369fg06_get_power,
432432 .set_power = ams369fg06_set_power,
433433 };
drivers/video/backlight/backlight.c+22−17
@@ -98,7 +98,9 @@ static int fb_notifier_callback(struct notifier_block *self, · 97 unmodified lines
9898 {
9999 struct backlight_device *bd;
100100 struct fb_event *evdata = data;
101− int node = evdata->info->node;
101+ struct fb_info *info = evdata->info;
102+ struct backlight_device *fb_bd = fb_bl_device(info);
103+ int node = info->node;
102104 int fb_blank = 0;
103105
104106 /* If we aren't interested in this event, skip it immediately ... */
@@ -110,7 +112,9 @@ static int fb_notifier_callback(struct notifier_block *self, · 5 unmodified lines
110112
111113 if (!bd->ops)
112114 goto out;
113− if (bd->ops->check_fb && !bd->ops->check_fb(bd, evdata->info))
115+ if (bd->ops->controls_device && !bd->ops->controls_device(bd, info->device))
116+ goto out;
117+ if (fb_bd && fb_bd != bd)
114118 goto out;
115119
116120 fb_blank = *(int *)evdata->data;
@@ -118,14 +122,12 @@ static int fb_notifier_callback(struct notifier_block *self, · 1 unmodified line
118122 bd->fb_bl_on[node] = true;
119123 if (!bd->use_count++) {
120124 bd->props.state &= ~BL_CORE_FBBLANK;
121− bd->props.fb_blank = FB_BLANK_UNBLANK;
122125 backlight_update_status(bd);
123126 }
124127 } else if (fb_blank != FB_BLANK_UNBLANK && bd->fb_bl_on[node]) {
125128 bd->fb_bl_on[node] = false;
126129 if (!(--bd->use_count)) {
127130 bd->props.state |= BL_CORE_FBBLANK;
128− bd->props.fb_blank = fb_blank;
129131 backlight_update_status(bd);
130132 }
131133 }
@@ -317,8 +319,6 @@ static ssize_t scale_show(struct device *dev, · 185 unmodified lines
317319 }
318320 static DEVICE_ATTR_RO(scale);
319321
320−static struct class *backlight_class;
321−
322322 #ifdef CONFIG_PM_SLEEP
323323 static int backlight_suspend(struct device *dev)
324324 {
@@ -369,6 +369,12 @@ static struct attribute *bl_device_attrs[] = { · 44 unmodified lines
369369 };
370370 ATTRIBUTE_GROUPS(bl_device);
371371
372+static const struct class backlight_class = {
373+ .name = "backlight",
374+ .dev_groups = bl_device_groups,
375+ .pm = &backlight_class_dev_pm_ops,
376+};
377+
372378 /**
373379 * backlight_force_update - tell the backlight subsystem that hardware state
374380 * has changed
@@ -418,7 +424,7 @@ struct backlight_device *backlight_device_register(const char *name, · 43 unmodified lines
418424 mutex_init(&new_bd->update_lock);
419425 mutex_init(&new_bd->ops_lock);
420426
421− new_bd->dev.class = backlight_class;
427+ new_bd->dev.class = &backlight_class;
422428 new_bd->dev.parent = parent;
423429 new_bd->dev.release = bl_device_release;
424430 dev_set_name(&new_bd->dev, "%s", name);
@@ -510,7 +516,7 @@ struct backlight_device *backlight_device_get_by_name(const char *name) · 85 unmodified lines
510516 {
511517 struct device *dev;
512518
513− dev = class_find_device_by_name(backlight_class, name);
519+ dev = class_find_device_by_name(&backlight_class, name);
514520
515521 return dev ? to_backlight_device(dev) : NULL;
516522 }
@@ -678,7 +684,7 @@ struct backlight_device *of_find_backlight_by_node(struct device_node *node) · 161 unmodified lines
678684 {
679685 struct device *dev;
680686
681− dev = class_find_device(backlight_class, NULL, node, of_parent_match);
687+ dev = class_find_device(&backlight_class, NULL, node, of_parent_match);
682688
683689 return dev ? to_backlight_device(dev) : NULL;
684690 }
@@ -746,20 +752,19 @@ EXPORT_SYMBOL(devm_of_find_backlight); · 61 unmodified lines
746752
747753 static void __exit backlight_class_exit(void)
748754 {
749− class_destroy(backlight_class);
755+ class_unregister(&backlight_class);
750756 }
751757
752758 static int __init backlight_class_init(void)
753759 {
754− backlight_class = class_create("backlight");
755− if (IS_ERR(backlight_class)) {
756− pr_warn("Unable to create backlight class; errno = %ld\n",
757− PTR_ERR(backlight_class));
758− return PTR_ERR(backlight_class);
760+ int ret;
761+
762+ ret = class_register(&backlight_class);
763+ if (ret) {
764+ pr_warn("Unable to create backlight class; errno = %d\n", ret);
765+ return ret;
759766 }
760767
761− backlight_class->dev_groups = bl_device_groups;
762− backlight_class->pm = &backlight_class_dev_pm_ops;
763768 INIT_LIST_HEAD(&backlight_dev_list);
764769 mutex_init(&backlight_dev_list_mutex);
765770 BLOCKING_INIT_NOTIFIER_HEAD(&backlight_notifier);
drivers/video/backlight/bd6107.c+6−6
@@ -99,18 +99,18 @@ static int bd6107_backlight_update_status(struct backlight_device *backlight) · 98 unmodified lines
9999 return 0;
100100 }
101101
102−static int bd6107_backlight_check_fb(struct backlight_device *backlight,
103− struct fb_info *info)
102+static bool bd6107_backlight_controls_device(struct backlight_device *backlight,
103+ struct device *display_dev)
104104 {
105105 struct bd6107 *bd = bl_get_data(backlight);
106106
107− return !bd->pdata->dev || bd->pdata->dev == info->device;
107+ return !bd->pdata->dev || bd->pdata->dev == display_dev;
108108 }
109109
110110 static const struct backlight_ops bd6107_backlight_ops = {
111− .options = BL_CORE_SUSPENDRESUME,
112− .update_status = bd6107_backlight_update_status,
113− .check_fb = bd6107_backlight_check_fb,
111+ .options = BL_CORE_SUSPENDRESUME,
112+ .update_status = bd6107_backlight_update_status,
113+ .controls_device = bd6107_backlight_controls_device,
114114 };
115115
116116 static int bd6107_probe(struct i2c_client *client)
drivers/video/backlight/corgi_lcd.c+1−1
@@ -380,7 +380,7 @@ static int corgi_lcd_get_power(struct lcd_device *ld) · 379 unmodified lines
380380 return lcd->power;
381381 }
382382
383−static struct lcd_ops corgi_lcd_ops = {
383+static const struct lcd_ops corgi_lcd_ops = {
384384 .get_power = corgi_lcd_get_power,
385385 .set_power = corgi_lcd_set_power,
386386 .set_mode = corgi_lcd_set_mode,
drivers/video/backlight/gpio_backlight.c+6−6
@@ -30,18 +30,18 @@ static int gpio_backlight_update_status(struct backlight_device *bl) · 29 unmodified lines
3030 return 0;
3131 }
3232
33−static int gpio_backlight_check_fb(struct backlight_device *bl,
34− struct fb_info *info)
33+static bool gpio_backlight_controls_device(struct backlight_device *bl,
34+ struct device *display_dev)
3535 {
3636 struct gpio_backlight *gbl = bl_get_data(bl);
3737
38− return !gbl->dev || gbl->dev == info->device;
38+ return !gbl->dev || gbl->dev == display_dev;
3939 }
4040
4141 static const struct backlight_ops gpio_backlight_ops = {
42− .options = BL_CORE_SUSPENDRESUME,
43− .update_status = gpio_backlight_update_status,
44− .check_fb = gpio_backlight_check_fb,
42+ .options = BL_CORE_SUSPENDRESUME,
43+ .update_status = gpio_backlight_update_status,
44+ .controls_device = gpio_backlight_controls_device,
4545 };
4646
4747 static int gpio_backlight_probe(struct platform_device *pdev)
drivers/video/backlight/hx8357.c+1−1
@@ -559,7 +559,7 @@ static int hx8357_get_power(struct lcd_device *lcdev) · 558 unmodified lines
559559 return lcd->state;
560560 }
561561
562−static struct lcd_ops hx8357_ops = {
562+static const struct lcd_ops hx8357_ops = {
563563 .set_power = hx8357_set_power,
564564 .get_power = hx8357_get_power,
565565 };
drivers/video/backlight/ili922x.c+1−1
@@ -472,7 +472,7 @@ static int ili922x_get_power(struct lcd_device *ld) · 471 unmodified lines
472472 return ili->power;
473473 }
474474
475−static struct lcd_ops ili922x_ops = {
475+static const struct lcd_ops ili922x_ops = {
476476 .get_power = ili922x_get_power,
477477 .set_power = ili922x_set_power,
478478 };
drivers/video/backlight/ili9320.c+1−1
@@ -161,7 +161,7 @@ static int ili9320_get_power(struct lcd_device *ld) · 160 unmodified lines
161161 return lcd->power;
162162 }
163163
164−static struct lcd_ops ili9320_ops = {
164+static const struct lcd_ops ili9320_ops = {
165165 .get_power = ili9320_get_power,
166166 .set_power = ili9320_set_power,
167167 };
drivers/video/backlight/jornada720_lcd.c+1−1
@@ -81,7 +81,7 @@ static int jornada_lcd_set_power(struct lcd_device *ld, int power) · 80 unmodified lines
8181 return 0;
8282 }
8383
84−static struct lcd_ops jornada_lcd_props = {
84+static const struct lcd_ops jornada_lcd_props = {
8585 .get_contrast = jornada_lcd_get_contrast,
8686 .set_contrast = jornada_lcd_set_contrast,
8787 .get_power = jornada_lcd_get_power,
drivers/video/backlight/l4f00242t03.c+1−1
@@ -158,7 +158,7 @@ static int l4f00242t03_lcd_power_set(struct lcd_device *ld, int power) · 157 unmodified lines
158158 return 0;
159159 }
160160
161−static struct lcd_ops l4f_ops = {
161+static const struct lcd_ops l4f_ops = {
162162 .set_power = l4f00242t03_lcd_power_set,
163163 .get_power = l4f00242t03_lcd_power_get,
164164 };
drivers/video/backlight/lcd.c+15−12
@@ -159,8 +159,6 @@ static ssize_t max_contrast_show(struct device *dev, · 158 unmodified lines
159159 }
160160 static DEVICE_ATTR_RO(max_contrast);
161161
162−static struct class *lcd_class;
163−
164162 static void lcd_device_release(struct device *dev)
165163 {
166164 struct lcd_device *ld = to_lcd_device(dev);
@@ -175,6 +173,11 @@ static struct attribute *lcd_device_attrs[] = { · 8 unmodified lines
175173 };
176174 ATTRIBUTE_GROUPS(lcd_device);
177175
176+static const struct class lcd_class = {
177+ .name = "lcd",
178+ .dev_groups = lcd_device_groups,
179+};
180+
178181 /**
179182 * lcd_device_register - register a new object of lcd_device class.
180183 * @name: the name of the new object(must be the same as the name of the
@@ -188,7 +191,7 @@ ATTRIBUTE_GROUPS(lcd_device); · 7 unmodified lines
188191 * or a pointer to the newly allocated device.
189192 */
190193 struct lcd_device *lcd_device_register(const char *name, struct device *parent,
191− void *devdata, struct lcd_ops *ops)
194+ void *devdata, const struct lcd_ops *ops)
192195 {
193196 struct lcd_device *new_ld;
194197 int rc;
@@ -202,7 +205,7 @@ struct lcd_device *lcd_device_register(const char *name, struct device *parent, · 7 unmodified lines
202205 mutex_init(&new_ld->ops_lock);
203206 mutex_init(&new_ld->update_lock);
204207
205− new_ld->dev.class = lcd_class;
208+ new_ld->dev.class = &lcd_class;
206209 new_ld->dev.parent = parent;
207210 new_ld->dev.release = lcd_device_release;
208211 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) · 67 unmodified lines
276279 */
277280 struct lcd_device *devm_lcd_device_register(struct device *dev,
278281 const char *name, struct device *parent,
279− void *devdata, struct lcd_ops *ops)
282+ void *devdata, const struct lcd_ops *ops)
280283 {
281284 struct lcd_device **ptr, *lcd;
282285
@@ -318,19 +321,19 @@ EXPORT_SYMBOL(devm_lcd_device_unregister); · 35 unmodified lines
318321
319322 static void __exit lcd_class_exit(void)
320323 {
321− class_destroy(lcd_class);
324+ class_unregister(&lcd_class);
322325 }
323326
324327 static int __init lcd_class_init(void)
325328 {
326− lcd_class = class_create("lcd");
327− if (IS_ERR(lcd_class)) {
328− pr_warn("Unable to create backlight class; errno = %ld\n",
329− PTR_ERR(lcd_class));
330− return PTR_ERR(lcd_class);
329+ int ret;
330+
331+ ret = class_register(&lcd_class);
332+ if (ret) {
333+ pr_warn("Unable to create backlight class; errno = %d\n", ret);
334+ return ret;
331335 }
332336
333− lcd_class->dev_groups = lcd_device_groups;
334337 return 0;
335338 }
336339
drivers/video/backlight/lms283gf05.c+1−1
@@ -139,7 +139,7 @@ static int lms283gf05_power_set(struct lcd_device *ld, int power) · 138 unmodified lines
139139 return 0;
140140 }
141141
142−static struct lcd_ops lms_ops = {
142+static const struct lcd_ops lms_ops = {
143143 .set_power = lms283gf05_power_set,
144144 .get_power = NULL,
145145 };
drivers/video/backlight/lms501kf03.c+1−1
@@ -304,7 +304,7 @@ static int lms501kf03_set_power(struct lcd_device *ld, int power) · 303 unmodified lines
304304 return lms501kf03_power(lcd, power);
305305 }
306306
307−static struct lcd_ops lms501kf03_lcd_ops = {
307+static const struct lcd_ops lms501kf03_lcd_ops = {
308308 .get_power = lms501kf03_get_power,
309309 .set_power = lms501kf03_set_power,
310310 };
drivers/video/backlight/lp8788_bl.c+8−143
@@ -12,7 +12,6 @@ · 11 unmodified lines
1212 #include <linux/mfd/lp8788.h>
1313 #include <linux/module.h>
1414 #include <linux/platform_device.h>
15−#include <linux/pwm.h>
1615 #include <linux/slab.h>
1716
1817 /* Register address */
@@ -31,149 +30,40 @@ · 12 unmodified lines
3130 #define MAX_BRIGHTNESS 127
3231 #define DEFAULT_BL_NAME "lcd-backlight"
3332
34−struct lp8788_bl_config {
35− enum lp8788_bl_ctrl_mode bl_mode;
36− enum lp8788_bl_dim_mode dim_mode;
37− enum lp8788_bl_full_scale_current full_scale;
38− enum lp8788_bl_ramp_step rise_time;
39− enum lp8788_bl_ramp_step fall_time;
40− enum pwm_polarity pwm_pol;
41−};
42−
4333 struct lp8788_bl {
4434 struct lp8788 *lp;
4535 struct backlight_device *bl_dev;
46− struct lp8788_backlight_platform_data *pdata;
47− enum lp8788_bl_ctrl_mode mode;
48− struct pwm_device *pwm;
49−};
50−
51−static struct lp8788_bl_config default_bl_config = {
52− .bl_mode = LP8788_BL_REGISTER_ONLY,
53− .dim_mode = LP8788_DIM_EXPONENTIAL,
54− .full_scale = LP8788_FULLSCALE_1900uA,
55− .rise_time = LP8788_RAMP_8192us,
56− .fall_time = LP8788_RAMP_8192us,
57− .pwm_pol = PWM_POLARITY_NORMAL,
5836 };
5937
60−static inline bool is_brightness_ctrl_by_pwm(enum lp8788_bl_ctrl_mode mode)
61−{
62− return mode == LP8788_BL_COMB_PWM_BASED;
63−}
64−
65−static inline bool is_brightness_ctrl_by_register(enum lp8788_bl_ctrl_mode mode)
66−{
67− return mode == LP8788_BL_REGISTER_ONLY ||
68− mode == LP8788_BL_COMB_REGISTER_BASED;
69−}
70−
7138 static int lp8788_backlight_configure(struct lp8788_bl *bl)
7239 {
73− struct lp8788_backlight_platform_data *pdata = bl->pdata;
74− struct lp8788_bl_config *cfg = &default_bl_config;
7540 int ret;
7641 u8 val;
7742
78− /*
79− * Update chip configuration if platform data exists,
80− * otherwise use the default settings.
81− */
82− if (pdata) {
83− cfg->bl_mode = pdata->bl_mode;
84− cfg->dim_mode = pdata->dim_mode;
85− cfg->full_scale = pdata->full_scale;
86− cfg->rise_time = pdata->rise_time;
87− cfg->fall_time = pdata->fall_time;
88− cfg->pwm_pol = pdata->pwm_pol;
89− }
90−
9143 /* Brightness ramp up/down */
92− val = (cfg->rise_time << LP8788_BL_RAMP_RISE_SHIFT) | cfg->fall_time;
44+ val = (LP8788_RAMP_8192us << LP8788_BL_RAMP_RISE_SHIFT) | LP8788_RAMP_8192us;
9345 ret = lp8788_write_byte(bl->lp, LP8788_BL_RAMP, val);
9446 if (ret)
9547 return ret;
9648
9749 /* Fullscale current setting */
98− val = (cfg->full_scale << LP8788_BL_FULLSCALE_SHIFT) |
99− (cfg->dim_mode << LP8788_BL_DIM_MODE_SHIFT);
50+ val = (LP8788_FULLSCALE_1900uA << LP8788_BL_FULLSCALE_SHIFT) |
51+ (LP8788_DIM_EXPONENTIAL << LP8788_BL_DIM_MODE_SHIFT);
10052
10153 /* Brightness control mode */
102− switch (cfg->bl_mode) {
103− case LP8788_BL_REGISTER_ONLY:
104− val |= LP8788_BL_EN;
105− break;
106− case LP8788_BL_COMB_PWM_BASED:
107− case LP8788_BL_COMB_REGISTER_BASED:
108− val |= LP8788_BL_EN | LP8788_BL_PWM_INPUT_EN |
109− (cfg->pwm_pol << LP8788_BL_PWM_POLARITY_SHIFT);
110− break;
111− default:
112− dev_err(bl->lp->dev, "invalid mode: %d\n", cfg->bl_mode);
113− return -EINVAL;
114− }
115−
116− bl->mode = cfg->bl_mode;
54+ val |= LP8788_BL_EN;
11755
11856 return lp8788_write_byte(bl->lp, LP8788_BL_CONFIG, val);
11957 }
12058
121−static void lp8788_pwm_ctrl(struct lp8788_bl *bl, int br, int max_br)
122−{
123− unsigned int period;
124− unsigned int duty;
125− struct device *dev;
126− struct pwm_device *pwm;
127−
128− if (!bl->pdata)
129− return;
130−
131− period = bl->pdata->period_ns;
132− duty = br * period / max_br;
133− dev = bl->lp->dev;
134−
135− /* request PWM device with the consumer name */
136− if (!bl->pwm) {
137− pwm = devm_pwm_get(dev, LP8788_DEV_BACKLIGHT);
138− if (IS_ERR(pwm)) {
139− dev_err(dev, "can not get PWM device\n");
140− return;
141− }
142−
143− bl->pwm = pwm;
144−
145− /*
146− * FIXME: pwm_apply_args() should be removed when switching to
147− * the atomic PWM API.
148− */
149− pwm_apply_args(pwm);
150− }
151−
152− pwm_config(bl->pwm, duty, period);
153− if (duty)
154− pwm_enable(bl->pwm);
155− else
156− pwm_disable(bl->pwm);
157−}
158−
15959 static int lp8788_bl_update_status(struct backlight_device *bl_dev)
16060 {
16161 struct lp8788_bl *bl = bl_get_data(bl_dev);
162− enum lp8788_bl_ctrl_mode mode = bl->mode;
16362
16463 if (bl_dev->props.state & BL_CORE_SUSPENDED)
16564 bl_dev->props.brightness = 0;
16665
167− if (is_brightness_ctrl_by_pwm(mode)) {
168− int brt = bl_dev->props.brightness;
169− int max = bl_dev->props.max_brightness;
170−
171− lp8788_pwm_ctrl(bl, brt, max);
172− } else if (is_brightness_ctrl_by_register(mode)) {
173− u8 brt = bl_dev->props.brightness;
174−
175− lp8788_write_byte(bl->lp, LP8788_BL_BRIGHTNESS, brt);
176− }
66+ lp8788_write_byte(bl->lp, LP8788_BL_BRIGHTNESS, bl_dev->props.brightness);
17767
17868 return 0;
17969 }
@@ -187,30 +77,16 @@ static int lp8788_backlight_register(struct lp8788_bl *bl) · 7 unmodified lines
18777 {
18878 struct backlight_device *bl_dev;
18979 struct backlight_properties props;
190− struct lp8788_backlight_platform_data *pdata = bl->pdata;
191− int init_brt;
192− char *name;
19380
19481 memset(&props, 0, sizeof(struct backlight_properties));
19582 props.type = BACKLIGHT_PLATFORM;
19683 props.max_brightness = MAX_BRIGHTNESS;
19784
19885 /* Initial brightness */
199− if (pdata)
200− init_brt = min_t(int, pdata->initial_brightness,
201− props.max_brightness);
202− else
203− init_brt = 0;
204−
205− props.brightness = init_brt;
86+ props.brightness = 0;
20687
20788 /* Backlight device name */
208− if (!pdata || !pdata->name)
209− name = DEFAULT_BL_NAME;
210− else
211− name = pdata->name;
212−
213− bl_dev = backlight_device_register(name, bl->lp->dev, bl,
89+ bl_dev = backlight_device_register(DEFAULT_BL_NAME, bl->lp->dev, bl,
21490 &lp8788_bl_ops, &props);
21591 if (IS_ERR(bl_dev))
21692 return PTR_ERR(bl_dev);
@@ -230,16 +106,7 @@ static void lp8788_backlight_unregister(struct lp8788_bl *bl) · 13 unmodified lines
230106 static ssize_t lp8788_get_bl_ctl_mode(struct device *dev,
231107 struct device_attribute *attr, char *buf)
232108 {
233− struct lp8788_bl *bl = dev_get_drvdata(dev);
234− enum lp8788_bl_ctrl_mode mode = bl->mode;
235− char *strmode;
236−
237− if (is_brightness_ctrl_by_pwm(mode))
238− strmode = "PWM based";
239− else if (is_brightness_ctrl_by_register(mode))
240− strmode = "Register based";
241− else
242− strmode = "Invalid mode";
109+ const char *strmode = "Register based";
243110
244111 return scnprintf(buf, PAGE_SIZE, "%s\n", strmode);
245112 }
@@ -266,8 +133,6 @@ static int lp8788_backlight_probe(struct platform_device *pdev) · 20 unmodified lines
266133 return -ENOMEM;
267134
268135 bl->lp = lp;
269− if (lp->pdata)
270− bl->pdata = lp->pdata->bl_pdata;
271136
272137 platform_set_drvdata(pdev, bl);
273138
drivers/video/backlight/ltv350qv.c+1−1
@@ -217,7 +217,7 @@ static int ltv350qv_get_power(struct lcd_device *ld) · 216 unmodified lines
217217 return lcd->power;
218218 }
219219
220−static struct lcd_ops ltv_ops = {
220+static const struct lcd_ops ltv_ops = {
221221 .get_power = ltv350qv_get_power,
222222 .set_power = ltv350qv_set_power,
223223 };
drivers/video/backlight/lv5207lp.c+6−6
@@ -62,18 +62,18 @@ static int lv5207lp_backlight_update_status(struct backlight_device *backlight) · 61 unmodified lines
6262 return 0;
6363 }
6464
65−static int lv5207lp_backlight_check_fb(struct backlight_device *backlight,
66− struct fb_info *info)
65+static bool lv5207lp_backlight_controls_device(struct backlight_device *backlight,
66+ struct device *display_dev)
6767 {
6868 struct lv5207lp *lv = bl_get_data(backlight);
6969
70− return !lv->pdata->dev || lv->pdata->dev == info->device;
70+ return !lv->pdata->dev || lv->pdata->dev == display_dev;
7171 }
7272
7373 static const struct backlight_ops lv5207lp_backlight_ops = {
74− .options = BL_CORE_SUSPENDRESUME,
75− .update_status = lv5207lp_backlight_update_status,
76− .check_fb = lv5207lp_backlight_check_fb,
74+ .options = BL_CORE_SUSPENDRESUME,
75+ .update_status = lv5207lp_backlight_update_status,
76+ .controls_device = lv5207lp_backlight_controls_device,
7777 };
7878
7979 static int lv5207lp_probe(struct i2c_client *client)
drivers/video/backlight/mp3309c.c+2−7
@@ -97,15 +97,10 @@ static int mp3309c_enable_device(struct mp3309c_chip *chip) · 96 unmodified lines
9797
9898 /*
9999 * I2C register #1 - Set working mode:
100− * - set one of the two dimming mode:
101− * - PWM dimming using an external PWM dimming signal
102− * - analog dimming using I2C commands
103100 * - enable/disable synchronous mode
104101 * - set overvoltage protection (OVP)
105102 */
106103 reg_val = 0x00;
107− if (chip->pdata->dimming_mode == DIMMING_PWM)
108− reg_val |= REG_I2C_1_DIMS;
109104 if (chip->pdata->sync_mode)
110105 reg_val |= REG_I2C_1_SYNC;
111106 reg_val |= chip->pdata->over_voltage_protection;
@@ -205,8 +200,9 @@ static int mp3309c_parse_fwnode(struct mp3309c_chip *chip, · 93 unmodified lines
205200 struct mp3309c_platform_data *pdata)
206201 {
207202 int ret, i;
208− unsigned int num_levels, tmp_value;
203+ unsigned int tmp_value;
209204 struct device *dev = chip->dev;
205+ int num_levels;
210206
211207 if (!dev_fwnode(dev))
212208 return dev_err_probe(dev, -ENODEV, "failed to get firmware node\n");
@@ -363,7 +359,6 @@ static int mp3309c_probe(struct i2c_client *client) · 150 unmodified lines
363359 props.scale = BACKLIGHT_SCALE_LINEAR;
364360 props.type = BACKLIGHT_RAW;
365361 props.power = FB_BLANK_UNBLANK;
366− props.fb_blank = FB_BLANK_UNBLANK;
367362 chip->bl = devm_backlight_device_register(dev, "mp3309c", dev, chip,
368363 &mp3309c_bl_ops, &props);
369364 if (IS_ERR(chip->bl))
drivers/video/backlight/omap1_bl.c+18−29
@@ -9,7 +9,6 @@ · 8 unmodified lines
99 #include <linux/kernel.h>
1010 #include <linux/init.h>
1111 #include <linux/platform_device.h>
12−#include <linux/fb.h>
1312 #include <linux/backlight.h>
1413 #include <linux/slab.h>
1514 #include <linux/platform_data/omap1_bl.h>
@@ -20,7 +19,7 @@ · 4 unmodified lines
2019 #define OMAPBL_MAX_INTENSITY 0xff
2120
2221 struct omap_backlight {
23− int powermode;
22+ bool enabled;
2423 int current_intensity;
2524
2625 struct device *dev;
@@ -37,24 +36,14 @@ static inline void omapbl_send_enable(int enable) · 10 unmodified lines
3736 omap_writeb(enable, OMAP_PWL_CLK_ENABLE);
3837 }
3938
40−static void omapbl_blank(struct omap_backlight *bl, int mode)
39+static void omapbl_enable(struct omap_backlight *bl, bool enable)
4140 {
42− if (bl->pdata->set_power)
43− bl->pdata->set_power(bl->dev, mode);
44−
45− switch (mode) {
46− case FB_BLANK_NORMAL:
47− case FB_BLANK_VSYNC_SUSPEND:
48− case FB_BLANK_HSYNC_SUSPEND:
49− case FB_BLANK_POWERDOWN:
50− omapbl_send_intensity(0);
51− omapbl_send_enable(0);
52− break;
53−
54− case FB_BLANK_UNBLANK:
41+ if (enable) {
5542 omapbl_send_intensity(bl->current_intensity);
5643 omapbl_send_enable(1);
57− break;
44+ } else {
45+ omapbl_send_intensity(0);
46+ omapbl_send_enable(0);
5847 }
5948 }
6049
@@ -64,7 +53,7 @@ static int omapbl_suspend(struct device *dev) · 3 unmodified lines
6453 struct backlight_device *bl_dev = dev_get_drvdata(dev);
6554 struct omap_backlight *bl = bl_get_data(bl_dev);
6655
67− omapbl_blank(bl, FB_BLANK_POWERDOWN);
56+ omapbl_enable(bl, false);
6857 return 0;
6958 }
7059
@@ -73,33 +62,34 @@ static int omapbl_resume(struct device *dev) · 2 unmodified lines
7362 struct backlight_device *bl_dev = dev_get_drvdata(dev);
7463 struct omap_backlight *bl = bl_get_data(bl_dev);
7564
76− omapbl_blank(bl, bl->powermode);
65+ omapbl_enable(bl, bl->enabled);
7766 return 0;
7867 }
7968 #endif
8069
81−static int omapbl_set_power(struct backlight_device *dev, int state)
70+static void omapbl_set_enabled(struct backlight_device *dev, bool enable)
8271 {
8372 struct omap_backlight *bl = bl_get_data(dev);
8473
85− omapbl_blank(bl, state);
86− bl->powermode = state;
87−
88− return 0;
74+ omapbl_enable(bl, enable);
75+ bl->enabled = enable;
8976 }
9077
9178 static int omapbl_update_status(struct backlight_device *dev)
9279 {
9380 struct omap_backlight *bl = bl_get_data(dev);
81+ bool enable;
9482
9583 if (bl->current_intensity != dev->props.brightness) {
96− if (bl->powermode == FB_BLANK_UNBLANK)
84+ if (bl->enabled)
9785 omapbl_send_intensity(dev->props.brightness);
9886 bl->current_intensity = dev->props.brightness;
9987 }
10088
101− if (dev->props.fb_blank != bl->powermode)
102− omapbl_set_power(dev, dev->props.fb_blank);
89+ enable = !backlight_is_blank(dev);
90+
91+ if (enable != bl->enabled)
92+ omapbl_set_enabled(dev, enable);
10393
10494 return 0;
10595 }
@@ -139,7 +129,7 @@ static int omapbl_probe(struct platform_device *pdev) · 33 unmodified lines
139129 if (IS_ERR(dev))
140130 return PTR_ERR(dev);
141131
142− bl->powermode = FB_BLANK_POWERDOWN;
132+ bl->enabled = false;
143133 bl->current_intensity = 0;
144134
145135 bl->pdata = pdata;
@@ -149,7 +139,6 @@ static int omapbl_probe(struct platform_device *pdev) · 3 unmodified lines
149139
150140 omap_cfg_reg(PWL); /* Conflicts with UART3 */
151141
152− dev->props.fb_blank = FB_BLANK_UNBLANK;
153142 dev->props.brightness = pdata->default_intensity;
154143 omapbl_update_status(dev);
155144
drivers/video/backlight/otm3225a.c+1−2
@@ -205,7 +205,7 @@ static int otm3225a_get_power(struct lcd_device *ld) · 204 unmodified lines
205205 return dd->power;
206206 }
207207
208−static struct lcd_ops otm3225a_ops = {
208+static const struct lcd_ops otm3225a_ops = {
209209 .set_power = otm3225a_set_power,
210210 .get_power = otm3225a_get_power,
211211 };
@@ -239,7 +239,6 @@ static int otm3225a_probe(struct spi_device *spi) · 27 unmodified lines
239239 static struct spi_driver otm3225a_driver = {
240240 .driver = {
241241 .name = "otm3225a",
242− .owner = THIS_MODULE,
243242 },
244243 .probe = otm3225a_probe,
245244 };
drivers/video/backlight/platform_lcd.c+1−1
@@ -62,7 +62,7 @@ static int platform_lcd_match(struct lcd_device *lcd, struct fb_info *info) · 61 unmodified lines
6262 return plcd->us->parent == info->device;
6363 }
6464
65−static struct lcd_ops platform_lcd_ops = {
65+static const struct lcd_ops platform_lcd_ops = {
6666 .get_power = platform_lcd_get_power,
6767 .set_power = platform_lcd_set_power,
6868 .check_fb = platform_lcd_match,
drivers/video/backlight/pwm_bl.c+0−12
@@ -11,7 +11,6 @@ · 10 unmodified lines
1111 #include <linux/kernel.h>
1212 #include <linux/init.h>
1313 #include <linux/platform_device.h>
14−#include <linux/fb.h>
1514 #include <linux/backlight.h>
1615 #include <linux/err.h>
1716 #include <linux/pwm.h>
@@ -34,7 +33,6 @@ struct pwm_bl_data { · 16 unmodified lines
3433 int brightness);
3534 void (*notify_after)(struct device *,
3635 int brightness);
37− int (*check_fb)(struct device *, struct fb_info *);
3836 void (*exit)(struct device *);
3937 };
4038
@@ -129,17 +127,8 @@ static int pwm_backlight_update_status(struct backlight_device *bl) · 88 unmodified lines
129127 return 0;
130128 }
131129
132−static int pwm_backlight_check_fb(struct backlight_device *bl,
133− struct fb_info *info)
134−{
135− struct pwm_bl_data *pb = bl_get_data(bl);
136−
137− return !pb->check_fb || pb->check_fb(pb->dev, info);
138−}
139−
140130 static const struct backlight_ops pwm_backlight_ops = {
141131 .update_status = pwm_backlight_update_status,
142− .check_fb = pwm_backlight_check_fb,
143132 };
144133
145134 #ifdef CONFIG_OF
@@ -482,7 +471,6 @@ static int pwm_backlight_probe(struct platform_device *pdev) · 336 unmodified lines
482471
483472 pb->notify = data->notify;
484473 pb->notify_after = data->notify_after;
485− pb->check_fb = data->check_fb;
486474 pb->exit = data->exit;
487475 pb->dev = &pdev->dev;
488476 pb->enabled = false;
drivers/video/backlight/sky81452-backlight.c+2−6
@@ -182,7 +182,7 @@ static const struct attribute_group sky81452_bl_attr_group = { · 181 unmodified lines
182182 static struct sky81452_bl_platform_data *sky81452_bl_parse_dt(
183183 struct device *dev)
184184 {
185− struct device_node *np = of_node_get(dev->of_node);
185+ struct device_node *np = dev->of_node;
186186 struct sky81452_bl_platform_data *pdata;
187187 int num_entry;
188188 unsigned int sources[6];
@@ -194,10 +194,8 @@ static struct sky81452_bl_platform_data *sky81452_bl_parse_dt( · 5 unmodified lines
194194 }
195195
196196 pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
197− if (!pdata) {
198− of_node_put(np);
197+ if (!pdata)
199198 return ERR_PTR(-ENOMEM);
200− }
201199
202200 of_property_read_string(np, "name", &pdata->name);
203201 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( · 13 unmodified lines
217215 num_entry);
218216 if (ret < 0) {
219217 dev_err(dev, "led-sources node is invalid.\n");
220− of_node_put(np);
221218 return ERR_PTR(-EINVAL);
222219 }
223220
@@ -237,7 +234,6 @@ static struct sky81452_bl_platform_data *sky81452_bl_parse_dt( · 13 unmodified lines
237234 if (ret < 0)
238235 pdata->boost_current_limit = 2750;
239236
240− of_node_put(np);
241237 return pdata;
242238 }
243239 #else
drivers/video/backlight/tdo24m.c+1−1
@@ -322,7 +322,7 @@ static int tdo24m_set_mode(struct lcd_device *ld, struct fb_videomode *m) · 321 unmodified lines
322322 return lcd->adj_mode(lcd, mode);
323323 }
324324
325−static struct lcd_ops tdo24m_ops = {
325+static const struct lcd_ops tdo24m_ops = {
326326 .get_power = tdo24m_get_power,
327327 .set_power = tdo24m_set_power,
328328 .set_mode = tdo24m_set_mode,
drivers/video/fbdev/atmel_lcdfb.c+0−1
@@ -153,7 +153,6 @@ static void init_backlight(struct atmel_lcdfb_info *sinfo) · 152 unmodified lines
153153 sinfo->backlight = bl;
154154
155155 bl->props.power = FB_BLANK_UNBLANK;
156− bl->props.fb_blank = FB_BLANK_UNBLANK;
157156 bl->props.brightness = atmel_bl_get_brightness(bl);
158157 }
159158
drivers/video/fbdev/clps711x-fb.c+1−1
@@ -197,7 +197,7 @@ static int clps711x_lcd_set_power(struct lcd_device *lcddev, int blank) · 196 unmodified lines
197197 return 0;
198198 }
199199
200−static struct lcd_ops clps711x_lcd_ops = {
200+static const struct lcd_ops clps711x_lcd_ops = {
201201 .check_fb = clps711x_lcd_check_fb,
202202 .get_power = clps711x_lcd_get_power,
203203 .set_power = clps711x_lcd_set_power,
drivers/video/fbdev/core/fb_backlight.c+6−0
@@ -30,4 +30,10 @@ void fb_bl_default_curve(struct fb_info *fb_info, u8 off, u8 min, u8 max) · 29 unmodified lines
3030 mutex_unlock(&fb_info->bl_curve_mutex);
3131 }
3232 EXPORT_SYMBOL_GPL(fb_bl_default_curve);
33+
34+struct backlight_device *fb_bl_device(struct fb_info *info)
35+{
36+ return info->bl_dev;
37+}
38+EXPORT_SYMBOL(fb_bl_device);
3339 #endif
drivers/video/fbdev/imxfb.c+1−1
@@ -857,7 +857,7 @@ static int imxfb_lcd_set_power(struct lcd_device *lcddev, int power) · 856 unmodified lines
857857 return 0;
858858 }
859859
860−static struct lcd_ops imxfb_lcd_ops = {
860+static const struct lcd_ops imxfb_lcd_ops = {
861861 .check_fb = imxfb_lcd_check_fb,
862862 .get_contrast = imxfb_lcd_get_contrast,
863863 .set_contrast = imxfb_lcd_set_contrast,
drivers/video/fbdev/omap/lcd_ams_delta.c+1−1
@@ -76,7 +76,7 @@ static int ams_delta_lcd_get_contrast(struct lcd_device *dev) · 75 unmodified lines
7676 return ams_delta_lcd & AMS_DELTA_MAX_CONTRAST;
7777 }
7878
79−static struct lcd_ops ams_delta_lcd_ops = {
79+static const struct lcd_ops ams_delta_lcd_ops = {
8080 .get_power = ams_delta_lcd_get_power,
8181 .set_power = ams_delta_lcd_set_power,
8282 .get_contrast = ams_delta_lcd_get_contrast,
drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c+1−6
@@ -356,11 +356,7 @@ static int dsicm_bl_update_status(struct backlight_device *dev) · 355 unmodified lines
356356
357357 static int dsicm_bl_get_intensity(struct backlight_device *dev)
358358 {
359− if (dev->props.fb_blank == FB_BLANK_UNBLANK &&
360− dev->props.power == FB_BLANK_UNBLANK)
361− return dev->props.brightness;
362−
363− return 0;
359+ return backlight_get_brightness(dev);
364360 }
365361
366362 static const struct backlight_ops dsicm_bl_ops = {
@@ -1219,7 +1215,6 @@ static int dsicm_probe(struct platform_device *pdev) · 852 unmodified lines
12191215
12201216 ddata->bldev = bldev;
12211217
1222− bldev->props.fb_blank = FB_BLANK_UNBLANK;
12231218 bldev->props.power = FB_BLANK_UNBLANK;
12241219 bldev->props.brightness = 255;
12251220
drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c+2−8
@@ -340,11 +340,7 @@ static int acx565akm_bl_update_status(struct backlight_device *dev) · 339 unmodified lines
340340
341341 dev_dbg(&ddata->spi->dev, "%s\n", __func__);
342342
343− if (dev->props.fb_blank == FB_BLANK_UNBLANK &&
344− dev->props.power == FB_BLANK_UNBLANK)
345− level = dev->props.brightness;
346− else
347− level = 0;
343+ level = backlight_get_brightness(dev);
348344
349345 if (ddata->has_bc)
350346 acx565akm_set_brightness(ddata, level);
@@ -363,8 +359,7 @@ static int acx565akm_bl_get_intensity(struct backlight_device *dev) · 12 unmodified lines
363359 if (!ddata->has_bc)
364360 return -ENODEV;
365361
366− if (dev->props.fb_blank == FB_BLANK_UNBLANK &&
367− dev->props.power == FB_BLANK_UNBLANK) {
362+ if (!backlight_is_blank(dev)) {
368363 if (ddata->has_bc)
369364 return acx565akm_get_actual_brightness(ddata);
370365 else
@@ -758,7 +753,6 @@ static int acx565akm_probe(struct spi_device *spi) · 387 unmodified lines
758753 }
759754
760755 memset(&props, 0, sizeof(props));
761− props.fb_blank = FB_BLANK_UNBLANK;
762756 props.power = FB_BLANK_UNBLANK;
763757 props.type = BACKLIGHT_RAW;
764758
drivers/video/fbdev/sh_mobile_lcdcfb.c+0−7
@@ -2140,17 +2140,10 @@ static int sh_mobile_lcdc_get_brightness(struct backlight_device *bdev) · 2139 unmodified lines
21402140 return ch->bl_brightness;
21412141 }
21422142
2143−static int sh_mobile_lcdc_check_fb(struct backlight_device *bdev,
2144− struct fb_info *info)
2145−{
2146− return (info->bl_dev == bdev);
2147−}
2148−
21492143 static const struct backlight_ops sh_mobile_lcdc_bl_ops = {
21502144 .options = BL_CORE_SUSPENDRESUME,
21512145 .update_status = sh_mobile_lcdc_update_bl,
21522146 .get_brightness = sh_mobile_lcdc_get_brightness,
2153− .check_fb = sh_mobile_lcdc_check_fb,
21542147 };
21552148
21562149 static struct backlight_device *sh_mobile_lcdc_bl_probe(struct device *parent,
drivers/video/fbdev/ssd1307fb.c+11−20
@@ -530,17 +530,10 @@ static int ssd1307fb_get_brightness(struct backlight_device *bdev) · 529 unmodified lines
530530 return par->contrast;
531531 }
532532
533−static int ssd1307fb_check_fb(struct backlight_device *bdev,
534− struct fb_info *info)
535−{
536− return (info->bl_dev == bdev);
537−}
538−
539533 static const struct backlight_ops ssd1307fb_bl_ops = {
540534 .options = BL_CORE_SUSPENDRESUME,
541535 .update_status = ssd1307fb_update_bl,
542536 .get_brightness = ssd1307fb_get_brightness,
543− .check_fb = ssd1307fb_check_fb,
544537 };
545538
546539 static struct ssd1307fb_deviceinfo ssd1307fb_ssd1305_deviceinfo = {
@@ -594,7 +587,6 @@ static int ssd1307fb_probe(struct i2c_client *client) · 47 unmodified lines
594587 {
595588 struct device *dev = &client->dev;
596589 struct backlight_device *bl;
597− char bl_name[12];
598590 struct fb_info *info;
599591 struct fb_deferred_io *ssd1307fb_defio;
600592 u32 vmem_size;
@@ -733,31 +725,30 @@ static int ssd1307fb_probe(struct i2c_client *client) · 132 unmodified lines
733725 if (ret)
734726 goto regulator_enable_error;
735727
736− ret = register_framebuffer(info);
737− if (ret) {
738− dev_err(dev, "Couldn't register the framebuffer\n");
739− goto panel_init_error;
740− }
741−
742− snprintf(bl_name, sizeof(bl_name), "ssd1307fb%d", info->node);
743− bl = backlight_device_register(bl_name, dev, par, &ssd1307fb_bl_ops,
728+ bl = backlight_device_register("ssd1307fb-bl", dev, par, &ssd1307fb_bl_ops,
744729 NULL);
745730 if (IS_ERR(bl)) {
746731 ret = PTR_ERR(bl);
747732 dev_err(dev, "unable to register backlight device: %d\n", ret);
748− goto bl_init_error;
733+ goto panel_init_error;
734+ }
735+ info->bl_dev = bl;
736+
737+ ret = register_framebuffer(info);
738+ if (ret) {
739+ dev_err(dev, "Couldn't register the framebuffer\n");
740+ goto fb_init_error;
749741 }
750742
751743 bl->props.brightness = par->contrast;
752744 bl->props.max_brightness = MAX_CONTRAST;
753− info->bl_dev = bl;
754745
755746 dev_info(dev, "fb%d: %s framebuffer device registered, using %d bytes of video memory\n", info->node, info->fix.id, vmem_size);
756747
757748 return 0;
758749
759−bl_init_error:
760− unregister_framebuffer(info);
750+fb_init_error:
751+ backlight_device_unregister(bl);
761752 panel_init_error:
762753 pwm_disable(par->pwm);
763754 pwm_put(par->pwm);
include/linux/backlight.h+9−32
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313 #include <linux/fb.h>
1414 #include <linux/mutex.h>
1515 #include <linux/notifier.h>
16+#include <linux/types.h>
1617
1718 /**
1819 * enum backlight_update_reason - what method was used to update backlight
@@ -110,7 +111,6 @@ enum backlight_scale { · 91 unmodified lines
110111 };
111112
112113 struct backlight_device;
113−struct fb_info;
114114
115115 /**
116116 * struct backlight_ops - backlight operations
@@ -160,18 +160,18 @@ struct backlight_ops { · 43 unmodified lines
160160 int (*get_brightness)(struct backlight_device *);
161161
162162 /**
163− * @check_fb: Check the framebuffer device.
163+ * @controls_device: Check against the display device
164164 *
165− * Check if given framebuffer device is the one bound to this backlight.
166− * This operation is optional and if not implemented it is assumed that the
167− * fbdev is always the one bound to the backlight.
165+ * Check if the backlight controls the given display device. This
166+ * operation is optional and if not implemented it is assumed that
167+ * the display is always the one controlled by the backlight.
168168 *
169169 * RETURNS:
170170 *
171− * If info is NULL or the info matches the fbdev bound to the backlight return true.
172− * If info does not match the fbdev bound to the backlight return false.
171+ * If display_dev is NULL or display_dev matches the device controlled by
172+ * the backlight, return true. Otherwise return false.
173173 */
174− int (*check_fb)(struct backlight_device *bd, struct fb_info *info);
174+ bool (*controls_device)(struct backlight_device *bd, struct device *display_dev);
175175 };
176176
177177 /**
@@ -218,25 +218,6 @@ struct backlight_properties { · 40 unmodified lines
218218 */
219219 int power;
220220
221− /**
222− * @fb_blank: The power state from the FBIOBLANK ioctl.
223− *
224− * When the FBIOBLANK ioctl is called @fb_blank is set to the
225− * blank parameter and the update_status() operation is called.
226− *
227− * When the backlight device is enabled @fb_blank is set
228− * to FB_BLANK_UNBLANK. When the backlight device is disabled
229− * @fb_blank is set to FB_BLANK_POWERDOWN.
230− *
231− * Backlight drivers should avoid using this property. It has been
232− * replaced by state & BL_CORE_FBLANK (although most drivers should
233− * use backlight_is_blank() as the preferred means to get the blank
234− * state).
235− *
236− * fb_blank is deprecated and will be removed.
237− */
238− int fb_blank;
239−
240221 /**
241222 * @type: The type of backlight supported.
242223 *
@@ -366,7 +347,6 @@ static inline int backlight_enable(struct backlight_device *bd) · 123 unmodified lines
366347 return 0;
367348
368349 bd->props.power = FB_BLANK_UNBLANK;
369− bd->props.fb_blank = FB_BLANK_UNBLANK;
370350 bd->props.state &= ~BL_CORE_FBBLANK;
371351
372352 return backlight_update_status(bd);
@@ -382,7 +362,6 @@ static inline int backlight_disable(struct backlight_device *bd) · 9 unmodified lines
382362 return 0;
383363
384364 bd->props.power = FB_BLANK_POWERDOWN;
385− bd->props.fb_blank = FB_BLANK_POWERDOWN;
386365 bd->props.state |= BL_CORE_FBBLANK;
387366
388367 return backlight_update_status(bd);
@@ -395,15 +374,13 @@ static inline int backlight_disable(struct backlight_device *bd) · 6 unmodified lines
395374 * Display is expected to be blank if any of these is true::
396375 *
397376 * 1) if power in not UNBLANK
398− * 2) if fb_blank is not UNBLANK
399− * 3) if state indicate BLANK or SUSPENDED
377+ * 2) if state indicate BLANK or SUSPENDED
400378 *
401379 * Returns true if display is expected to be blank, false otherwise.
402380 */
403381 static inline bool backlight_is_blank(const struct backlight_device *bd)
404382 {
405383 return bd->props.power != FB_BLANK_UNBLANK ||
406− bd->props.fb_blank != FB_BLANK_UNBLANK ||
407384 bd->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK);
408385 }
409386
include/linux/fb.h+9−0
@@ -742,6 +742,15 @@ extern struct fb_info *framebuffer_alloc(size_t size, struct device *dev); · 741 unmodified lines
742742 extern void framebuffer_release(struct fb_info *info);
743743 extern void fb_bl_default_curve(struct fb_info *fb_info, u8 off, u8 min, u8 max);
744744
745+#if IS_ENABLED(CONFIG_FB_BACKLIGHT)
746+struct backlight_device *fb_bl_device(struct fb_info *info);
747+#else
748+static inline struct backlight_device *fb_bl_device(struct fb_info *info)
749+{
750+ return NULL;
751+}
752+#endif
753+
745754 /* fbmon.c */
746755 #define FB_MAXTIMINGS 0
747756 #define FB_VSYNCTIMINGS 1
include/linux/lcd.h+3−3
@@ -61,7 +61,7 @@ struct lcd_device { · 60 unmodified lines
6161 points to something in the body of that driver, it is also invalid. */
6262 struct mutex ops_lock;
6363 /* If this is NULL, the backing module is unloaded */
64− struct lcd_ops *ops;
64+ const struct lcd_ops *ops;
6565 /* Serialise access to set_power method */
6666 struct mutex update_lock;
6767 /* The framebuffer notifier block */
@@ -102,10 +102,10 @@ static inline void lcd_set_power(struct lcd_device *ld, int power) · 34 unmodified lines
102102 }
103103
104104 extern struct lcd_device *lcd_device_register(const char *name,
105− struct device *parent, void *devdata, struct lcd_ops *ops);
105+ struct device *parent, void *devdata, const struct lcd_ops *ops);
106106 extern struct lcd_device *devm_lcd_device_register(struct device *dev,
107107 const char *name, struct device *parent,
108− void *devdata, struct lcd_ops *ops);
108+ void *devdata, const struct lcd_ops *ops);
109109 extern void lcd_device_unregister(struct lcd_device *ld);
110110 extern void devm_lcd_device_unregister(struct device *dev,
111111 struct lcd_device *ld);
include/linux/mfd/lp8788.h+0−36
@@ -11,7 +11,6 @@ · 10 unmodified lines
1111 #define __MFD_LP8788_H__
1212
1313 #include <linux/irqdomain.h>
14−#include <linux/pwm.h>
1514 #include <linux/regmap.h>
1615
1716 #define LP8788_DEV_BUCK "lp8788-buck"
@@ -87,12 +86,6 @@ enum lp8788_charger_event { · 69 unmodified lines
8786 CHARGER_DETECTED,
8887 };
8988
90−enum lp8788_bl_ctrl_mode {
91− LP8788_BL_REGISTER_ONLY,
92− LP8788_BL_COMB_PWM_BASED, /* PWM + I2C, changed by PWM input */
93− LP8788_BL_COMB_REGISTER_BASED, /* PWM + I2C, changed by I2C */
94−};
95−
9689 enum lp8788_bl_dim_mode {
9790 LP8788_DIM_EXPONENTIAL,
9891 LP8788_DIM_LINEAR,
@@ -201,31 +194,6 @@ struct lp8788_charger_platform_data { · 102 unmodified lines
201194 enum lp8788_charger_event event);
202195 };
203196
204−/*
205− * struct lp8788_backlight_platform_data
206− * @name : backlight driver name. (default: "lcd-backlight")
207− * @initial_brightness : initial value of backlight brightness
208− * @bl_mode : brightness control by pwm or lp8788 register
209− * @dim_mode : dimming mode selection
210− * @full_scale : full scale current setting
211− * @rise_time : brightness ramp up step time
212− * @fall_time : brightness ramp down step time
213− * @pwm_pol : pwm polarity setting when bl_mode is pwm based
214− * @period_ns : platform specific pwm period value. unit is nano.
215− Only valid when bl_mode is LP8788_BL_COMB_PWM_BASED
216− */
217−struct lp8788_backlight_platform_data {
218− char *name;
219− int initial_brightness;
220− enum lp8788_bl_ctrl_mode bl_mode;
221− enum lp8788_bl_dim_mode dim_mode;
222− enum lp8788_bl_full_scale_current full_scale;
223− enum lp8788_bl_ramp_step rise_time;
224− enum lp8788_bl_ramp_step fall_time;
225− enum pwm_polarity pwm_pol;
226− unsigned int period_ns;
227−};
228−
229197 /*
230198 * struct lp8788_led_platform_data
231199 * @name : led driver name. (default: "keyboard-backlight")
@@ -267,7 +235,6 @@ struct lp8788_vib_platform_data { · 35 unmodified lines
267235 * @buck2_dvs : configurations for buck2 dvs
268236 * @chg_pdata : platform data for charger driver
269237 * @alarm_sel : rtc alarm selection (1 or 2)
270− * @bl_pdata : configurable data for backlight driver
271238 * @led_pdata : configurable data for led driver
272239 * @vib_pdata : configurable data for vibrator driver
273240 * @adc_pdata : iio map data for adc driver
@@ -289,9 +256,6 @@ struct lp8788_platform_data { · 15 unmodified lines
289256 /* rtc alarm */
290257 enum lp8788_alarm_sel alarm_sel;
291258
292− /* backlight */
293− struct lp8788_backlight_platform_data *bl_pdata;
294−
295259 /* current sinks */
296260 struct lp8788_led_platform_data *led_pdata;
297261 struct lp8788_vib_platform_data *vib_pdata;
include/linux/platform_data/omap1_bl.h+0−1
@@ -6,7 +6,6 @@ · 5 unmodified lines
66
77 struct omap_backlight_config {
88 int default_intensity;
9− int (*set_power)(struct device *dev, int state);
109 };
1110
1211 #endif
include/linux/pwm_backlight.h+0−1
@@ -19,7 +19,6 @@ struct platform_pwm_backlight_data { · 18 unmodified lines
1919 int (*notify)(struct device *dev, int brightness);
2020 void (*notify_after)(struct device *dev, int brightness);
2121 void (*exit)(struct device *dev);
22− int (*check_fb)(struct device *dev, struct fb_info *info);
2322 };
2423
2524 #endif
scripts/const_structs.checkpatch+1−0
@@ -39,6 +39,7 @@ kgdb_arch · 38 unmodified lines
3939 kgdb_io
4040 kobj_type
4141 kset_uevent_ops
42+lcd_ops
4243 lock_manager_operations
4344 machine_desc
4445 microcode_ops

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t