Skip to content

Commit

Permalink
Merge tag 'backlight-next-6.10' of git://git.kernel.org/pub/scm/linux…
Browse files Browse the repository at this point in the history
…/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
  ...
  • Loading branch information
Linus Torvalds committed May 22, 2024
2 parents a85629f + 1fd949f commit 7eae27c
Show file tree
Hide file tree
Showing 47 changed files with 161 additions and 418 deletions.
15 changes: 1 addition & 14 deletions drivers/auxdisplay/ht16k33.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,27 +284,14 @@ static int ht16k33_initialize(struct ht16k33_priv *priv)

static int ht16k33_bl_update_status(struct backlight_device *bl)
{
int brightness = bl->props.brightness;
const int brightness = backlight_get_brightness(bl);
struct ht16k33_priv *priv = bl_get_data(bl);

if (bl->props.power != FB_BLANK_UNBLANK ||
bl->props.fb_blank != FB_BLANK_UNBLANK ||
bl->props.state & BL_CORE_FBBLANK)
brightness = 0;

return ht16k33_brightness_set(priv, brightness);
}

static int ht16k33_bl_check_fb(struct backlight_device *bl, struct fb_info *fi)
{
struct ht16k33_priv *priv = bl_get_data(bl);

return (fi == NULL) || (fi->par == priv);
}

static const struct backlight_ops ht16k33_bl_ops = {
.update_status = ht16k33_bl_update_status,
.check_fb = ht16k33_bl_check_fb,
};

/*
Expand Down
7 changes: 0 additions & 7 deletions drivers/hid/hid-picolcd_backlight.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

#include <linux/hid.h>

#include <linux/fb.h>
#include <linux/backlight.h>

#include "hid-picolcd.h"
Expand Down Expand Up @@ -39,15 +38,9 @@ static int picolcd_set_brightness(struct backlight_device *bdev)
return 0;
}

static int picolcd_check_bl_fb(struct backlight_device *bdev, struct fb_info *fb)
{
return fb && fb == picolcd_fbinfo((struct picolcd_data *)bl_get_data(bdev));
}

static const struct backlight_ops picolcd_blops = {
.update_status = picolcd_set_brightness,
.get_brightness = picolcd_get_brightness,
.check_fb = picolcd_check_bl_fb,
};

int picolcd_init_backlight(struct picolcd_data *data, struct hid_report *report)
Expand Down
14 changes: 7 additions & 7 deletions drivers/hid/hid-picolcd_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -474,11 +474,6 @@ static int picolcd_probe_lcd(struct hid_device *hdev, struct picolcd_data *data)
if (error)
goto err;

/* Set up the framebuffer device */
error = picolcd_init_framebuffer(data);
if (error)
goto err;

/* Setup lcd class device */
error = picolcd_init_lcd(data, picolcd_out_report(REPORT_CONTRAST, hdev));
if (error)
Expand All @@ -489,6 +484,11 @@ static int picolcd_probe_lcd(struct hid_device *hdev, struct picolcd_data *data)
if (error)
goto err;

/* Set up the framebuffer device */
error = picolcd_init_framebuffer(data);
if (error)
goto err;

/* Setup the LED class devices */
error = picolcd_init_leds(data, picolcd_out_report(REPORT_LED_STATE, hdev));
if (error)
Expand All @@ -502,9 +502,9 @@ static int picolcd_probe_lcd(struct hid_device *hdev, struct picolcd_data *data)
return 0;
err:
picolcd_exit_leds(data);
picolcd_exit_framebuffer(data);
picolcd_exit_backlight(data);
picolcd_exit_lcd(data);
picolcd_exit_framebuffer(data);
picolcd_exit_cir(data);
picolcd_exit_keys(data);
return error;
Expand Down Expand Up @@ -623,9 +623,9 @@ static void picolcd_remove(struct hid_device *hdev)
/* Cleanup LED */
picolcd_exit_leds(data);
/* Clean up the framebuffer */
picolcd_exit_framebuffer(data);
picolcd_exit_backlight(data);
picolcd_exit_lcd(data);
picolcd_exit_framebuffer(data);
/* Cleanup input */
picolcd_exit_cir(data);
picolcd_exit_keys(data);
Expand Down
6 changes: 6 additions & 0 deletions drivers/hid/hid-picolcd_fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,12 @@ int picolcd_init_framebuffer(struct picolcd_data *data)
info->fix = picolcdfb_fix;
info->fix.smem_len = PICOLCDFB_SIZE*8;

#ifdef CONFIG_FB_BACKLIGHT
#ifdef CONFIG_HID_PICOLCD_BACKLIGHT
info->bl_dev = data->backlight;
#endif
#endif

fbdata = info->par;
spin_lock_init(&fbdata->lock);
fbdata->picolcd = data;
Expand Down
2 changes: 1 addition & 1 deletion drivers/hid/hid-picolcd_lcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ static int picolcd_check_lcd_fb(struct lcd_device *ldev, struct fb_info *fb)
return fb && fb == picolcd_fbinfo((struct picolcd_data *)lcd_get_data(ldev));
}

static struct lcd_ops picolcd_lcdops = {
static const struct lcd_ops picolcd_lcdops = {
.get_contrast = picolcd_get_contrast,
.set_contrast = picolcd_set_contrast,
.check_fb = picolcd_check_lcd_fb,
Expand Down
4 changes: 1 addition & 3 deletions drivers/staging/fbtft/fb_ssd1351.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,7 @@ static int update_onboard_backlight(struct backlight_device *bd)
struct fbtft_par *par = bl_get_data(bd);
bool on;

fbtft_par_dbg(DEBUG_BACKLIGHT, par,
"%s: power=%d, fb_blank=%d\n",
__func__, bd->props.power, bd->props.fb_blank);
fbtft_par_dbg(DEBUG_BACKLIGHT, par, "%s: power=%d\n", __func__, bd->props.power);

on = !backlight_is_blank(bd);
/* Onboard backlight connected to GPIO0 on SSD1351, GPIO1 unused */
Expand Down
5 changes: 2 additions & 3 deletions drivers/staging/fbtft/fbtft-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,8 @@ static int fbtft_backlight_update_status(struct backlight_device *bd)
struct fbtft_par *par = bl_get_data(bd);
bool polarity = par->polarity;

fbtft_par_dbg(DEBUG_BACKLIGHT, par,
"%s: polarity=%d, power=%d, fb_blank=%d\n",
__func__, polarity, bd->props.power, bd->props.fb_blank);
fbtft_par_dbg(DEBUG_BACKLIGHT, par, "%s: polarity=%d, power=%d\n", __func__,
polarity, bd->props.power);

if (!backlight_is_blank(bd))
gpiod_set_value(par->gpio.led[0], polarity);
Expand Down
7 changes: 0 additions & 7 deletions drivers/video/backlight/aat2870_bl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion drivers/video/backlight/ams369fg06.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
39 changes: 22 additions & 17 deletions drivers/video/backlight/backlight.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 ... */
Expand All @@ -110,22 +112,22 @@ 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;
if (fb_blank == FB_BLANK_UNBLANK && !bd->fb_bl_on[node]) {
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);
}
}
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
Expand Down
12 changes: 6 additions & 6 deletions drivers/video/backlight/bd6107.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion drivers/video/backlight/corgi_lcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 6 additions & 6 deletions drivers/video/backlight/gpio_backlight.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion drivers/video/backlight/hx8357.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/video/backlight/ili922x.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/video/backlight/ili9320.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/video/backlight/jornada720_lcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion drivers/video/backlight/l4f00242t03.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
Loading

0 comments on commit 7eae27c

Please sign in to comment.