Skip to content

Commit 7eae27c

Browse files
committed
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 ...
2 parents a85629f + 1fd949f commit 7eae27c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+161
-418
lines changed

drivers/auxdisplay/ht16k33.c

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -284,27 +284,14 @@ static int ht16k33_initialize(struct ht16k33_priv *priv)
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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
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)
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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -474,11 +474,6 @@ static int picolcd_probe_lcd(struct hid_device *hdev, struct picolcd_data *data)
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)
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)
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)
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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,12 @@ int picolcd_init_framebuffer(struct picolcd_data *data)
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ static int picolcd_check_lcd_fb(struct lcd_device *ldev, struct fb_info *fb)
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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,7 @@ static int update_onboard_backlight(struct backlight_device *bd)
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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,8 @@ static int fbtft_backlight_update_status(struct backlight_device *bd)
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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
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)
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ static int ams369fg06_set_brightness(struct backlight_device *bd)
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

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@ static int fb_notifier_callback(struct notifier_block *self,
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,22 +112,22 @@ static int fb_notifier_callback(struct notifier_block *self,
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;
117121
if (fb_blank == FB_BLANK_UNBLANK && !bd->fb_bl_on[node]) {
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,
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[] = {
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,
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)
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)
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);
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);

0 commit comments

Comments
 (0)