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
...

+161 -418
+1 -14
drivers/auxdisplay/ht16k33.c
··· 284 285 static int ht16k33_bl_update_status(struct backlight_device *bl) 286 { 287 - int brightness = bl->props.brightness; 288 struct ht16k33_priv *priv = bl_get_data(bl); 289 - 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 295 return ht16k33_brightness_set(priv, brightness); 296 } 297 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 - 305 static const struct backlight_ops ht16k33_bl_ops = { 306 .update_status = ht16k33_bl_update_status, 307 - .check_fb = ht16k33_bl_check_fb, 308 }; 309 310 /*
··· 284 285 static int ht16k33_bl_update_status(struct backlight_device *bl) 286 { 287 + const int brightness = backlight_get_brightness(bl); 288 struct ht16k33_priv *priv = bl_get_data(bl); 289 290 return ht16k33_brightness_set(priv, brightness); 291 } 292 293 static const struct backlight_ops ht16k33_bl_ops = { 294 .update_status = ht16k33_bl_update_status, 295 }; 296 297 /*
-7
drivers/hid/hid-picolcd_backlight.c
··· 9 10 #include <linux/hid.h> 11 12 - #include <linux/fb.h> 13 #include <linux/backlight.h> 14 15 #include "hid-picolcd.h" ··· 38 return 0; 39 } 40 41 - static int picolcd_check_bl_fb(struct backlight_device *bdev, struct fb_info *fb) 42 - { 43 - return fb && fb == picolcd_fbinfo((struct picolcd_data *)bl_get_data(bdev)); 44 - } 45 - 46 static const struct backlight_ops picolcd_blops = { 47 .update_status = picolcd_set_brightness, 48 .get_brightness = picolcd_get_brightness, 49 - .check_fb = picolcd_check_bl_fb, 50 }; 51 52 int picolcd_init_backlight(struct picolcd_data *data, struct hid_report *report)
··· 9 10 #include <linux/hid.h> 11 12 #include <linux/backlight.h> 13 14 #include "hid-picolcd.h" ··· 39 return 0; 40 } 41 42 static const struct backlight_ops picolcd_blops = { 43 .update_status = picolcd_set_brightness, 44 .get_brightness = picolcd_get_brightness, 45 }; 46 47 int picolcd_init_backlight(struct picolcd_data *data, struct hid_report *report)
+7 -7
drivers/hid/hid-picolcd_core.c
··· 474 if (error) 475 goto err; 476 477 - /* Set up the framebuffer device */ 478 - error = picolcd_init_framebuffer(data); 479 - if (error) 480 - goto err; 481 - 482 /* Setup lcd class device */ 483 error = picolcd_init_lcd(data, picolcd_out_report(REPORT_CONTRAST, hdev)); 484 if (error) ··· 481 482 /* Setup backlight class device */ 483 error = picolcd_init_backlight(data, picolcd_out_report(REPORT_BRIGHTNESS, hdev)); 484 if (error) 485 goto err; 486 ··· 502 return 0; 503 err: 504 picolcd_exit_leds(data); 505 picolcd_exit_backlight(data); 506 picolcd_exit_lcd(data); 507 - picolcd_exit_framebuffer(data); 508 picolcd_exit_cir(data); 509 picolcd_exit_keys(data); 510 return error; ··· 623 /* Cleanup LED */ 624 picolcd_exit_leds(data); 625 /* Clean up the framebuffer */ 626 picolcd_exit_backlight(data); 627 picolcd_exit_lcd(data); 628 - picolcd_exit_framebuffer(data); 629 /* Cleanup input */ 630 picolcd_exit_cir(data); 631 picolcd_exit_keys(data);
··· 474 if (error) 475 goto err; 476 477 /* Setup lcd class device */ 478 error = picolcd_init_lcd(data, picolcd_out_report(REPORT_CONTRAST, hdev)); 479 if (error) ··· 486 487 /* Setup backlight class device */ 488 error = picolcd_init_backlight(data, picolcd_out_report(REPORT_BRIGHTNESS, hdev)); 489 + if (error) 490 + goto err; 491 + 492 + /* Set up the framebuffer device */ 493 + error = picolcd_init_framebuffer(data); 494 if (error) 495 goto err; 496 ··· 502 return 0; 503 err: 504 picolcd_exit_leds(data); 505 + picolcd_exit_framebuffer(data); 506 picolcd_exit_backlight(data); 507 picolcd_exit_lcd(data); 508 picolcd_exit_cir(data); 509 picolcd_exit_keys(data); 510 return error; ··· 623 /* Cleanup LED */ 624 picolcd_exit_leds(data); 625 /* Clean up the framebuffer */ 626 + picolcd_exit_framebuffer(data); 627 picolcd_exit_backlight(data); 628 picolcd_exit_lcd(data); 629 /* Cleanup input */ 630 picolcd_exit_cir(data); 631 picolcd_exit_keys(data);
+6
drivers/hid/hid-picolcd_fb.c
··· 491 info->fix = picolcdfb_fix; 492 info->fix.smem_len = PICOLCDFB_SIZE*8; 493 494 fbdata = info->par; 495 spin_lock_init(&fbdata->lock); 496 fbdata->picolcd = data;
··· 491 info->fix = picolcdfb_fix; 492 info->fix.smem_len = PICOLCDFB_SIZE*8; 493 494 + #ifdef CONFIG_FB_BACKLIGHT 495 + #ifdef CONFIG_HID_PICOLCD_BACKLIGHT 496 + info->bl_dev = data->backlight; 497 + #endif 498 + #endif 499 + 500 fbdata = info->par; 501 spin_lock_init(&fbdata->lock); 502 fbdata->picolcd = data;
+1 -1
drivers/hid/hid-picolcd_lcd.c
··· 46 return fb && fb == picolcd_fbinfo((struct picolcd_data *)lcd_get_data(ldev)); 47 } 48 49 - static struct lcd_ops picolcd_lcdops = { 50 .get_contrast = picolcd_get_contrast, 51 .set_contrast = picolcd_set_contrast, 52 .check_fb = picolcd_check_lcd_fb,
··· 46 return fb && fb == picolcd_fbinfo((struct picolcd_data *)lcd_get_data(ldev)); 47 } 48 49 + static const struct lcd_ops picolcd_lcdops = { 50 .get_contrast = picolcd_get_contrast, 51 .set_contrast = picolcd_set_contrast, 52 .check_fb = picolcd_check_lcd_fb,
+1 -3
drivers/staging/fbtft/fb_ssd1351.c
··· 194 struct fbtft_par *par = bl_get_data(bd); 195 bool on; 196 197 - fbtft_par_dbg(DEBUG_BACKLIGHT, par, 198 - "%s: power=%d, fb_blank=%d\n", 199 - __func__, bd->props.power, bd->props.fb_blank); 200 201 on = !backlight_is_blank(bd); 202 /* Onboard backlight connected to GPIO0 on SSD1351, GPIO1 unused */
··· 194 struct fbtft_par *par = bl_get_data(bd); 195 bool on; 196 197 + fbtft_par_dbg(DEBUG_BACKLIGHT, par, "%s: power=%d\n", __func__, bd->props.power); 198 199 on = !backlight_is_blank(bd); 200 /* Onboard backlight connected to GPIO0 on SSD1351, GPIO1 unused */
+2 -3
drivers/staging/fbtft/fbtft-core.c
··· 133 struct fbtft_par *par = bl_get_data(bd); 134 bool polarity = par->polarity; 135 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); 139 140 if (!backlight_is_blank(bd)) 141 gpiod_set_value(par->gpio.led[0], polarity);
··· 133 struct fbtft_par *par = bl_get_data(bd); 134 bool polarity = par->polarity; 135 136 + fbtft_par_dbg(DEBUG_BACKLIGHT, par, "%s: polarity=%d, power=%d\n", __func__, 137 + polarity, bd->props.power); 138 139 if (!backlight_is_blank(bd)) 140 gpiod_set_value(par->gpio.led[0], polarity);
-7
drivers/video/backlight/aat2870_bl.c
··· 12 #include <linux/platform_device.h> 13 #include <linux/mutex.h> 14 #include <linux/delay.h> 15 - #include <linux/fb.h> 16 #include <linux/backlight.h> 17 #include <linux/mfd/aat2870.h> 18 ··· 89 return 0; 90 } 91 92 - static int aat2870_bl_check_fb(struct backlight_device *bd, struct fb_info *fi) 93 - { 94 - return 1; 95 - } 96 - 97 static const struct backlight_ops aat2870_bl_ops = { 98 .options = BL_CORE_SUSPENDRESUME, 99 .update_status = aat2870_bl_update_status, 100 - .check_fb = aat2870_bl_check_fb, 101 }; 102 103 static int aat2870_bl_probe(struct platform_device *pdev)
··· 12 #include <linux/platform_device.h> 13 #include <linux/mutex.h> 14 #include <linux/delay.h> 15 #include <linux/backlight.h> 16 #include <linux/mfd/aat2870.h> 17 ··· 90 return 0; 91 } 92 93 static const struct backlight_ops aat2870_bl_ops = { 94 .options = BL_CORE_SUSPENDRESUME, 95 .update_status = aat2870_bl_update_status, 96 }; 97 98 static int aat2870_bl_probe(struct platform_device *pdev)
+1 -1
drivers/video/backlight/ams369fg06.c
··· 427 return ret; 428 } 429 430 - static struct lcd_ops ams369fg06_lcd_ops = { 431 .get_power = ams369fg06_get_power, 432 .set_power = ams369fg06_set_power, 433 };
··· 427 return ret; 428 } 429 430 + static const struct lcd_ops ams369fg06_lcd_ops = { 431 .get_power = ams369fg06_get_power, 432 .set_power = ams369fg06_set_power, 433 };
+22 -17
drivers/video/backlight/backlight.c
··· 98 { 99 struct backlight_device *bd; 100 struct fb_event *evdata = data; 101 - int node = evdata->info->node; 102 int fb_blank = 0; 103 104 /* If we aren't interested in this event, skip it immediately ... */ ··· 112 113 if (!bd->ops) 114 goto out; 115 - if (bd->ops->check_fb && !bd->ops->check_fb(bd, evdata->info)) 116 goto out; 117 118 fb_blank = *(int *)evdata->data; ··· 122 bd->fb_bl_on[node] = true; 123 if (!bd->use_count++) { 124 bd->props.state &= ~BL_CORE_FBBLANK; 125 - bd->props.fb_blank = FB_BLANK_UNBLANK; 126 backlight_update_status(bd); 127 } 128 } else if (fb_blank != FB_BLANK_UNBLANK && bd->fb_bl_on[node]) { 129 bd->fb_bl_on[node] = false; 130 if (!(--bd->use_count)) { 131 bd->props.state |= BL_CORE_FBBLANK; 132 - bd->props.fb_blank = fb_blank; 133 backlight_update_status(bd); 134 } 135 } ··· 319 } 320 static DEVICE_ATTR_RO(scale); 321 322 - static struct class *backlight_class; 323 - 324 #ifdef CONFIG_PM_SLEEP 325 static int backlight_suspend(struct device *dev) 326 { ··· 369 }; 370 ATTRIBUTE_GROUPS(bl_device); 371 372 /** 373 * backlight_force_update - tell the backlight subsystem that hardware state 374 * has changed ··· 424 mutex_init(&new_bd->update_lock); 425 mutex_init(&new_bd->ops_lock); 426 427 - new_bd->dev.class = backlight_class; 428 new_bd->dev.parent = parent; 429 new_bd->dev.release = bl_device_release; 430 dev_set_name(&new_bd->dev, "%s", name); ··· 516 { 517 struct device *dev; 518 519 - dev = class_find_device_by_name(backlight_class, name); 520 521 return dev ? to_backlight_device(dev) : NULL; 522 } ··· 684 { 685 struct device *dev; 686 687 - dev = class_find_device(backlight_class, NULL, node, of_parent_match); 688 689 return dev ? to_backlight_device(dev) : NULL; 690 } ··· 752 753 static void __exit backlight_class_exit(void) 754 { 755 - class_destroy(backlight_class); 756 } 757 758 static int __init backlight_class_init(void) 759 { 760 - backlight_class = class_create("backlight"); 761 - if (IS_ERR(backlight_class)) { 762 - pr_warn("Unable to create backlight class; errno = %ld\n", 763 - PTR_ERR(backlight_class)); 764 - return PTR_ERR(backlight_class); 765 } 766 767 - backlight_class->dev_groups = bl_device_groups; 768 - backlight_class->pm = &backlight_class_dev_pm_ops; 769 INIT_LIST_HEAD(&backlight_dev_list); 770 mutex_init(&backlight_dev_list_mutex); 771 BLOCKING_INIT_NOTIFIER_HEAD(&backlight_notifier);
··· 98 { 99 struct backlight_device *bd; 100 struct fb_event *evdata = data; 101 + struct fb_info *info = evdata->info; 102 + struct backlight_device *fb_bd = fb_bl_device(info); 103 + int node = info->node; 104 int fb_blank = 0; 105 106 /* If we aren't interested in this event, skip it immediately ... */ ··· 110 111 if (!bd->ops) 112 goto out; 113 + if (bd->ops->controls_device && !bd->ops->controls_device(bd, info->device)) 114 + goto out; 115 + if (fb_bd && fb_bd != bd) 116 goto out; 117 118 fb_blank = *(int *)evdata->data; ··· 118 bd->fb_bl_on[node] = true; 119 if (!bd->use_count++) { 120 bd->props.state &= ~BL_CORE_FBBLANK; 121 backlight_update_status(bd); 122 } 123 } else if (fb_blank != FB_BLANK_UNBLANK && bd->fb_bl_on[node]) { 124 bd->fb_bl_on[node] = false; 125 if (!(--bd->use_count)) { 126 bd->props.state |= BL_CORE_FBBLANK; 127 backlight_update_status(bd); 128 } 129 } ··· 317 } 318 static DEVICE_ATTR_RO(scale); 319 320 #ifdef CONFIG_PM_SLEEP 321 static int backlight_suspend(struct device *dev) 322 { ··· 369 }; 370 ATTRIBUTE_GROUPS(bl_device); 371 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 + 378 /** 379 * backlight_force_update - tell the backlight subsystem that hardware state 380 * has changed ··· 418 mutex_init(&new_bd->update_lock); 419 mutex_init(&new_bd->ops_lock); 420 421 + new_bd->dev.class = &backlight_class; 422 new_bd->dev.parent = parent; 423 new_bd->dev.release = bl_device_release; 424 dev_set_name(&new_bd->dev, "%s", name); ··· 510 { 511 struct device *dev; 512 513 + dev = class_find_device_by_name(&backlight_class, name); 514 515 return dev ? to_backlight_device(dev) : NULL; 516 } ··· 678 { 679 struct device *dev; 680 681 + dev = class_find_device(&backlight_class, NULL, node, of_parent_match); 682 683 return dev ? to_backlight_device(dev) : NULL; 684 } ··· 746 747 static void __exit backlight_class_exit(void) 748 { 749 + class_unregister(&backlight_class); 750 } 751 752 static int __init backlight_class_init(void) 753 { 754 + int ret; 755 + 756 + ret = class_register(&backlight_class); 757 + if (ret) { 758 + pr_warn("Unable to create backlight class; errno = %d\n", ret); 759 + return ret; 760 } 761 762 INIT_LIST_HEAD(&backlight_dev_list); 763 mutex_init(&backlight_dev_list_mutex); 764 BLOCKING_INIT_NOTIFIER_HEAD(&backlight_notifier);
+6 -6
drivers/video/backlight/bd6107.c
··· 99 return 0; 100 } 101 102 - static int bd6107_backlight_check_fb(struct backlight_device *backlight, 103 - struct fb_info *info) 104 { 105 struct bd6107 *bd = bl_get_data(backlight); 106 107 - return !bd->pdata->dev || bd->pdata->dev == info->device; 108 } 109 110 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, 114 }; 115 116 static int bd6107_probe(struct i2c_client *client)
··· 99 return 0; 100 } 101 102 + static bool bd6107_backlight_controls_device(struct backlight_device *backlight, 103 + struct device *display_dev) 104 { 105 struct bd6107 *bd = bl_get_data(backlight); 106 107 + return !bd->pdata->dev || bd->pdata->dev == display_dev; 108 } 109 110 static const struct backlight_ops bd6107_backlight_ops = { 111 + .options = BL_CORE_SUSPENDRESUME, 112 + .update_status = bd6107_backlight_update_status, 113 + .controls_device = bd6107_backlight_controls_device, 114 }; 115 116 static int bd6107_probe(struct i2c_client *client)
+1 -1
drivers/video/backlight/corgi_lcd.c
··· 380 return lcd->power; 381 } 382 383 - static struct lcd_ops corgi_lcd_ops = { 384 .get_power = corgi_lcd_get_power, 385 .set_power = corgi_lcd_set_power, 386 .set_mode = corgi_lcd_set_mode,
··· 380 return lcd->power; 381 } 382 383 + static const struct lcd_ops corgi_lcd_ops = { 384 .get_power = corgi_lcd_get_power, 385 .set_power = corgi_lcd_set_power, 386 .set_mode = corgi_lcd_set_mode,
+6 -6
drivers/video/backlight/gpio_backlight.c
··· 30 return 0; 31 } 32 33 - static int gpio_backlight_check_fb(struct backlight_device *bl, 34 - struct fb_info *info) 35 { 36 struct gpio_backlight *gbl = bl_get_data(bl); 37 38 - return !gbl->dev || gbl->dev == info->device; 39 } 40 41 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, 45 }; 46 47 static int gpio_backlight_probe(struct platform_device *pdev)
··· 30 return 0; 31 } 32 33 + static bool gpio_backlight_controls_device(struct backlight_device *bl, 34 + struct device *display_dev) 35 { 36 struct gpio_backlight *gbl = bl_get_data(bl); 37 38 + return !gbl->dev || gbl->dev == display_dev; 39 } 40 41 static const struct backlight_ops gpio_backlight_ops = { 42 + .options = BL_CORE_SUSPENDRESUME, 43 + .update_status = gpio_backlight_update_status, 44 + .controls_device = gpio_backlight_controls_device, 45 }; 46 47 static int gpio_backlight_probe(struct platform_device *pdev)
+1 -1
drivers/video/backlight/hx8357.c
··· 559 return lcd->state; 560 } 561 562 - static struct lcd_ops hx8357_ops = { 563 .set_power = hx8357_set_power, 564 .get_power = hx8357_get_power, 565 };
··· 559 return lcd->state; 560 } 561 562 + static const struct lcd_ops hx8357_ops = { 563 .set_power = hx8357_set_power, 564 .get_power = hx8357_get_power, 565 };
+1 -1
drivers/video/backlight/ili922x.c
··· 472 return ili->power; 473 } 474 475 - static struct lcd_ops ili922x_ops = { 476 .get_power = ili922x_get_power, 477 .set_power = ili922x_set_power, 478 };
··· 472 return ili->power; 473 } 474 475 + static const struct lcd_ops ili922x_ops = { 476 .get_power = ili922x_get_power, 477 .set_power = ili922x_set_power, 478 };
+1 -1
drivers/video/backlight/ili9320.c
··· 161 return lcd->power; 162 } 163 164 - static struct lcd_ops ili9320_ops = { 165 .get_power = ili9320_get_power, 166 .set_power = ili9320_set_power, 167 };
··· 161 return lcd->power; 162 } 163 164 + static const struct lcd_ops ili9320_ops = { 165 .get_power = ili9320_get_power, 166 .set_power = ili9320_set_power, 167 };
+1 -1
drivers/video/backlight/jornada720_lcd.c
··· 81 return 0; 82 } 83 84 - static struct lcd_ops jornada_lcd_props = { 85 .get_contrast = jornada_lcd_get_contrast, 86 .set_contrast = jornada_lcd_set_contrast, 87 .get_power = jornada_lcd_get_power,
··· 81 return 0; 82 } 83 84 + static const struct lcd_ops jornada_lcd_props = { 85 .get_contrast = jornada_lcd_get_contrast, 86 .set_contrast = jornada_lcd_set_contrast, 87 .get_power = jornada_lcd_get_power,
+1 -1
drivers/video/backlight/l4f00242t03.c
··· 158 return 0; 159 } 160 161 - static struct lcd_ops l4f_ops = { 162 .set_power = l4f00242t03_lcd_power_set, 163 .get_power = l4f00242t03_lcd_power_get, 164 };
··· 158 return 0; 159 } 160 161 + static const struct lcd_ops l4f_ops = { 162 .set_power = l4f00242t03_lcd_power_set, 163 .get_power = l4f00242t03_lcd_power_get, 164 };
+15 -12
drivers/video/backlight/lcd.c
··· 159 } 160 static DEVICE_ATTR_RO(max_contrast); 161 162 - static struct class *lcd_class; 163 - 164 static void lcd_device_release(struct device *dev) 165 { 166 struct lcd_device *ld = to_lcd_device(dev); ··· 173 }; 174 ATTRIBUTE_GROUPS(lcd_device); 175 176 /** 177 * lcd_device_register - register a new object of lcd_device class. 178 * @name: the name of the new object(must be the same as the name of the ··· 191 * or a pointer to the newly allocated device. 192 */ 193 struct lcd_device *lcd_device_register(const char *name, struct device *parent, 194 - void *devdata, struct lcd_ops *ops) 195 { 196 struct lcd_device *new_ld; 197 int rc; ··· 205 mutex_init(&new_ld->ops_lock); 206 mutex_init(&new_ld->update_lock); 207 208 - new_ld->dev.class = lcd_class; 209 new_ld->dev.parent = parent; 210 new_ld->dev.release = lcd_device_release; 211 dev_set_name(&new_ld->dev, "%s", name); ··· 279 */ 280 struct lcd_device *devm_lcd_device_register(struct device *dev, 281 const char *name, struct device *parent, 282 - void *devdata, struct lcd_ops *ops) 283 { 284 struct lcd_device **ptr, *lcd; 285 ··· 321 322 static void __exit lcd_class_exit(void) 323 { 324 - class_destroy(lcd_class); 325 } 326 327 static int __init lcd_class_init(void) 328 { 329 - lcd_class = class_create("lcd"); 330 - if (IS_ERR(lcd_class)) { 331 - pr_warn("Unable to create backlight class; errno = %ld\n", 332 - PTR_ERR(lcd_class)); 333 - return PTR_ERR(lcd_class); 334 } 335 336 - lcd_class->dev_groups = lcd_device_groups; 337 return 0; 338 } 339
··· 159 } 160 static DEVICE_ATTR_RO(max_contrast); 161 162 static void lcd_device_release(struct device *dev) 163 { 164 struct lcd_device *ld = to_lcd_device(dev); ··· 175 }; 176 ATTRIBUTE_GROUPS(lcd_device); 177 178 + static const struct class lcd_class = { 179 + .name = "lcd", 180 + .dev_groups = lcd_device_groups, 181 + }; 182 + 183 /** 184 * lcd_device_register - register a new object of lcd_device class. 185 * @name: the name of the new object(must be the same as the name of the ··· 188 * or a pointer to the newly allocated device. 189 */ 190 struct lcd_device *lcd_device_register(const char *name, struct device *parent, 191 + void *devdata, const struct lcd_ops *ops) 192 { 193 struct lcd_device *new_ld; 194 int rc; ··· 202 mutex_init(&new_ld->ops_lock); 203 mutex_init(&new_ld->update_lock); 204 205 + new_ld->dev.class = &lcd_class; 206 new_ld->dev.parent = parent; 207 new_ld->dev.release = lcd_device_release; 208 dev_set_name(&new_ld->dev, "%s", name); ··· 276 */ 277 struct lcd_device *devm_lcd_device_register(struct device *dev, 278 const char *name, struct device *parent, 279 + void *devdata, const struct lcd_ops *ops) 280 { 281 struct lcd_device **ptr, *lcd; 282 ··· 318 319 static void __exit lcd_class_exit(void) 320 { 321 + class_unregister(&lcd_class); 322 } 323 324 static int __init lcd_class_init(void) 325 { 326 + int ret; 327 + 328 + ret = class_register(&lcd_class); 329 + if (ret) { 330 + pr_warn("Unable to create backlight class; errno = %d\n", ret); 331 + return ret; 332 } 333 334 return 0; 335 } 336
+1 -1
drivers/video/backlight/lms283gf05.c
··· 139 return 0; 140 } 141 142 - static struct lcd_ops lms_ops = { 143 .set_power = lms283gf05_power_set, 144 .get_power = NULL, 145 };
··· 139 return 0; 140 } 141 142 + static const struct lcd_ops lms_ops = { 143 .set_power = lms283gf05_power_set, 144 .get_power = NULL, 145 };
+1 -1
drivers/video/backlight/lms501kf03.c
··· 304 return lms501kf03_power(lcd, power); 305 } 306 307 - static struct lcd_ops lms501kf03_lcd_ops = { 308 .get_power = lms501kf03_get_power, 309 .set_power = lms501kf03_set_power, 310 };
··· 304 return lms501kf03_power(lcd, power); 305 } 306 307 + static const struct lcd_ops lms501kf03_lcd_ops = { 308 .get_power = lms501kf03_get_power, 309 .set_power = lms501kf03_set_power, 310 };
+8 -143
drivers/video/backlight/lp8788_bl.c
··· 12 #include <linux/mfd/lp8788.h> 13 #include <linux/module.h> 14 #include <linux/platform_device.h> 15 - #include <linux/pwm.h> 16 #include <linux/slab.h> 17 18 /* Register address */ ··· 30 #define MAX_BRIGHTNESS 127 31 #define DEFAULT_BL_NAME "lcd-backlight" 32 33 - struct lp8788_bl_config { 34 - enum lp8788_bl_ctrl_mode bl_mode; 35 - enum lp8788_bl_dim_mode dim_mode; 36 - enum lp8788_bl_full_scale_current full_scale; 37 - enum lp8788_bl_ramp_step rise_time; 38 - enum lp8788_bl_ramp_step fall_time; 39 - enum pwm_polarity pwm_pol; 40 - }; 41 - 42 struct lp8788_bl { 43 struct lp8788 *lp; 44 struct backlight_device *bl_dev; 45 - struct lp8788_backlight_platform_data *pdata; 46 - enum lp8788_bl_ctrl_mode mode; 47 - struct pwm_device *pwm; 48 }; 49 - 50 - static struct lp8788_bl_config default_bl_config = { 51 - .bl_mode = LP8788_BL_REGISTER_ONLY, 52 - .dim_mode = LP8788_DIM_EXPONENTIAL, 53 - .full_scale = LP8788_FULLSCALE_1900uA, 54 - .rise_time = LP8788_RAMP_8192us, 55 - .fall_time = LP8788_RAMP_8192us, 56 - .pwm_pol = PWM_POLARITY_NORMAL, 57 - }; 58 - 59 - static inline bool is_brightness_ctrl_by_pwm(enum lp8788_bl_ctrl_mode mode) 60 - { 61 - return mode == LP8788_BL_COMB_PWM_BASED; 62 - } 63 - 64 - static inline bool is_brightness_ctrl_by_register(enum lp8788_bl_ctrl_mode mode) 65 - { 66 - return mode == LP8788_BL_REGISTER_ONLY || 67 - mode == LP8788_BL_COMB_REGISTER_BASED; 68 - } 69 70 static int lp8788_backlight_configure(struct lp8788_bl *bl) 71 { 72 - struct lp8788_backlight_platform_data *pdata = bl->pdata; 73 - struct lp8788_bl_config *cfg = &default_bl_config; 74 int ret; 75 u8 val; 76 77 - /* 78 - * Update chip configuration if platform data exists, 79 - * otherwise use the default settings. 80 - */ 81 - if (pdata) { 82 - cfg->bl_mode = pdata->bl_mode; 83 - cfg->dim_mode = pdata->dim_mode; 84 - cfg->full_scale = pdata->full_scale; 85 - cfg->rise_time = pdata->rise_time; 86 - cfg->fall_time = pdata->fall_time; 87 - cfg->pwm_pol = pdata->pwm_pol; 88 - } 89 - 90 /* Brightness ramp up/down */ 91 - val = (cfg->rise_time << LP8788_BL_RAMP_RISE_SHIFT) | cfg->fall_time; 92 ret = lp8788_write_byte(bl->lp, LP8788_BL_RAMP, val); 93 if (ret) 94 return ret; 95 96 /* Fullscale current setting */ 97 - val = (cfg->full_scale << LP8788_BL_FULLSCALE_SHIFT) | 98 - (cfg->dim_mode << LP8788_BL_DIM_MODE_SHIFT); 99 100 /* Brightness control mode */ 101 - switch (cfg->bl_mode) { 102 - case LP8788_BL_REGISTER_ONLY: 103 - val |= LP8788_BL_EN; 104 - break; 105 - case LP8788_BL_COMB_PWM_BASED: 106 - case LP8788_BL_COMB_REGISTER_BASED: 107 - val |= LP8788_BL_EN | LP8788_BL_PWM_INPUT_EN | 108 - (cfg->pwm_pol << LP8788_BL_PWM_POLARITY_SHIFT); 109 - break; 110 - default: 111 - dev_err(bl->lp->dev, "invalid mode: %d\n", cfg->bl_mode); 112 - return -EINVAL; 113 - } 114 - 115 - bl->mode = cfg->bl_mode; 116 117 return lp8788_write_byte(bl->lp, LP8788_BL_CONFIG, val); 118 - } 119 - 120 - static void lp8788_pwm_ctrl(struct lp8788_bl *bl, int br, int max_br) 121 - { 122 - unsigned int period; 123 - unsigned int duty; 124 - struct device *dev; 125 - struct pwm_device *pwm; 126 - 127 - if (!bl->pdata) 128 - return; 129 - 130 - period = bl->pdata->period_ns; 131 - duty = br * period / max_br; 132 - dev = bl->lp->dev; 133 - 134 - /* request PWM device with the consumer name */ 135 - if (!bl->pwm) { 136 - pwm = devm_pwm_get(dev, LP8788_DEV_BACKLIGHT); 137 - if (IS_ERR(pwm)) { 138 - dev_err(dev, "can not get PWM device\n"); 139 - return; 140 - } 141 - 142 - bl->pwm = pwm; 143 - 144 - /* 145 - * FIXME: pwm_apply_args() should be removed when switching to 146 - * the atomic PWM API. 147 - */ 148 - pwm_apply_args(pwm); 149 - } 150 - 151 - pwm_config(bl->pwm, duty, period); 152 - if (duty) 153 - pwm_enable(bl->pwm); 154 - else 155 - pwm_disable(bl->pwm); 156 } 157 158 static int lp8788_bl_update_status(struct backlight_device *bl_dev) 159 { 160 struct lp8788_bl *bl = bl_get_data(bl_dev); 161 - enum lp8788_bl_ctrl_mode mode = bl->mode; 162 163 if (bl_dev->props.state & BL_CORE_SUSPENDED) 164 bl_dev->props.brightness = 0; 165 166 - if (is_brightness_ctrl_by_pwm(mode)) { 167 - int brt = bl_dev->props.brightness; 168 - int max = bl_dev->props.max_brightness; 169 - 170 - lp8788_pwm_ctrl(bl, brt, max); 171 - } else if (is_brightness_ctrl_by_register(mode)) { 172 - u8 brt = bl_dev->props.brightness; 173 - 174 - lp8788_write_byte(bl->lp, LP8788_BL_BRIGHTNESS, brt); 175 - } 176 177 return 0; 178 } ··· 77 { 78 struct backlight_device *bl_dev; 79 struct backlight_properties props; 80 - struct lp8788_backlight_platform_data *pdata = bl->pdata; 81 - int init_brt; 82 - char *name; 83 84 memset(&props, 0, sizeof(struct backlight_properties)); 85 props.type = BACKLIGHT_PLATFORM; 86 props.max_brightness = MAX_BRIGHTNESS; 87 88 /* Initial brightness */ 89 - if (pdata) 90 - init_brt = min_t(int, pdata->initial_brightness, 91 - props.max_brightness); 92 - else 93 - init_brt = 0; 94 - 95 - props.brightness = init_brt; 96 97 /* Backlight device name */ 98 - if (!pdata || !pdata->name) 99 - name = DEFAULT_BL_NAME; 100 - else 101 - name = pdata->name; 102 - 103 - bl_dev = backlight_device_register(name, bl->lp->dev, bl, 104 &lp8788_bl_ops, &props); 105 if (IS_ERR(bl_dev)) 106 return PTR_ERR(bl_dev); ··· 106 static ssize_t lp8788_get_bl_ctl_mode(struct device *dev, 107 struct device_attribute *attr, char *buf) 108 { 109 - struct lp8788_bl *bl = dev_get_drvdata(dev); 110 - enum lp8788_bl_ctrl_mode mode = bl->mode; 111 - char *strmode; 112 - 113 - if (is_brightness_ctrl_by_pwm(mode)) 114 - strmode = "PWM based"; 115 - else if (is_brightness_ctrl_by_register(mode)) 116 - strmode = "Register based"; 117 - else 118 - strmode = "Invalid mode"; 119 120 return scnprintf(buf, PAGE_SIZE, "%s\n", strmode); 121 } ··· 133 return -ENOMEM; 134 135 bl->lp = lp; 136 - if (lp->pdata) 137 - bl->pdata = lp->pdata->bl_pdata; 138 139 platform_set_drvdata(pdev, bl); 140
··· 12 #include <linux/mfd/lp8788.h> 13 #include <linux/module.h> 14 #include <linux/platform_device.h> 15 #include <linux/slab.h> 16 17 /* Register address */ ··· 31 #define MAX_BRIGHTNESS 127 32 #define DEFAULT_BL_NAME "lcd-backlight" 33 34 struct lp8788_bl { 35 struct lp8788 *lp; 36 struct backlight_device *bl_dev; 37 }; 38 39 static int lp8788_backlight_configure(struct lp8788_bl *bl) 40 { 41 int ret; 42 u8 val; 43 44 /* Brightness ramp up/down */ 45 + val = (LP8788_RAMP_8192us << LP8788_BL_RAMP_RISE_SHIFT) | LP8788_RAMP_8192us; 46 ret = lp8788_write_byte(bl->lp, LP8788_BL_RAMP, val); 47 if (ret) 48 return ret; 49 50 /* Fullscale current setting */ 51 + val = (LP8788_FULLSCALE_1900uA << LP8788_BL_FULLSCALE_SHIFT) | 52 + (LP8788_DIM_EXPONENTIAL << LP8788_BL_DIM_MODE_SHIFT); 53 54 /* Brightness control mode */ 55 + val |= LP8788_BL_EN; 56 57 return lp8788_write_byte(bl->lp, LP8788_BL_CONFIG, val); 58 } 59 60 static int lp8788_bl_update_status(struct backlight_device *bl_dev) 61 { 62 struct lp8788_bl *bl = bl_get_data(bl_dev); 63 64 if (bl_dev->props.state & BL_CORE_SUSPENDED) 65 bl_dev->props.brightness = 0; 66 67 + lp8788_write_byte(bl->lp, LP8788_BL_BRIGHTNESS, bl_dev->props.brightness); 68 69 return 0; 70 } ··· 187 { 188 struct backlight_device *bl_dev; 189 struct backlight_properties props; 190 191 memset(&props, 0, sizeof(struct backlight_properties)); 192 props.type = BACKLIGHT_PLATFORM; 193 props.max_brightness = MAX_BRIGHTNESS; 194 195 /* Initial brightness */ 196 + props.brightness = 0; 197 198 /* Backlight device name */ 199 + bl_dev = backlight_device_register(DEFAULT_BL_NAME, bl->lp->dev, bl, 200 &lp8788_bl_ops, &props); 201 if (IS_ERR(bl_dev)) 202 return PTR_ERR(bl_dev); ··· 230 static ssize_t lp8788_get_bl_ctl_mode(struct device *dev, 231 struct device_attribute *attr, char *buf) 232 { 233 + const char *strmode = "Register based"; 234 235 return scnprintf(buf, PAGE_SIZE, "%s\n", strmode); 236 } ··· 266 return -ENOMEM; 267 268 bl->lp = lp; 269 270 platform_set_drvdata(pdev, bl); 271
+1 -1
drivers/video/backlight/ltv350qv.c
··· 217 return lcd->power; 218 } 219 220 - static struct lcd_ops ltv_ops = { 221 .get_power = ltv350qv_get_power, 222 .set_power = ltv350qv_set_power, 223 };
··· 217 return lcd->power; 218 } 219 220 + static const struct lcd_ops ltv_ops = { 221 .get_power = ltv350qv_get_power, 222 .set_power = ltv350qv_set_power, 223 };
+6 -6
drivers/video/backlight/lv5207lp.c
··· 62 return 0; 63 } 64 65 - static int lv5207lp_backlight_check_fb(struct backlight_device *backlight, 66 - struct fb_info *info) 67 { 68 struct lv5207lp *lv = bl_get_data(backlight); 69 70 - return !lv->pdata->dev || lv->pdata->dev == info->device; 71 } 72 73 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, 77 }; 78 79 static int lv5207lp_probe(struct i2c_client *client)
··· 62 return 0; 63 } 64 65 + static bool lv5207lp_backlight_controls_device(struct backlight_device *backlight, 66 + struct device *display_dev) 67 { 68 struct lv5207lp *lv = bl_get_data(backlight); 69 70 + return !lv->pdata->dev || lv->pdata->dev == display_dev; 71 } 72 73 static const struct backlight_ops lv5207lp_backlight_ops = { 74 + .options = BL_CORE_SUSPENDRESUME, 75 + .update_status = lv5207lp_backlight_update_status, 76 + .controls_device = lv5207lp_backlight_controls_device, 77 }; 78 79 static int lv5207lp_probe(struct i2c_client *client)
+2 -7
drivers/video/backlight/mp3309c.c
··· 97 98 /* 99 * 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 103 * - enable/disable synchronous mode 104 * - set overvoltage protection (OVP) 105 */ 106 reg_val = 0x00; 107 - if (chip->pdata->dimming_mode == DIMMING_PWM) 108 - reg_val |= REG_I2C_1_DIMS; 109 if (chip->pdata->sync_mode) 110 reg_val |= REG_I2C_1_SYNC; 111 reg_val |= chip->pdata->over_voltage_protection; ··· 200 struct mp3309c_platform_data *pdata) 201 { 202 int ret, i; 203 - unsigned int num_levels, tmp_value; 204 struct device *dev = chip->dev; 205 206 if (!dev_fwnode(dev)) 207 return dev_err_probe(dev, -ENODEV, "failed to get firmware node\n"); ··· 359 props.scale = BACKLIGHT_SCALE_LINEAR; 360 props.type = BACKLIGHT_RAW; 361 props.power = FB_BLANK_UNBLANK; 362 - props.fb_blank = FB_BLANK_UNBLANK; 363 chip->bl = devm_backlight_device_register(dev, "mp3309c", dev, chip, 364 &mp3309c_bl_ops, &props); 365 if (IS_ERR(chip->bl))
··· 97 98 /* 99 * I2C register #1 - Set working mode: 100 * - enable/disable synchronous mode 101 * - set overvoltage protection (OVP) 102 */ 103 reg_val = 0x00; 104 if (chip->pdata->sync_mode) 105 reg_val |= REG_I2C_1_SYNC; 106 reg_val |= chip->pdata->over_voltage_protection; ··· 205 struct mp3309c_platform_data *pdata) 206 { 207 int ret, i; 208 + unsigned int tmp_value; 209 struct device *dev = chip->dev; 210 + int num_levels; 211 212 if (!dev_fwnode(dev)) 213 return dev_err_probe(dev, -ENODEV, "failed to get firmware node\n"); ··· 363 props.scale = BACKLIGHT_SCALE_LINEAR; 364 props.type = BACKLIGHT_RAW; 365 props.power = FB_BLANK_UNBLANK; 366 chip->bl = devm_backlight_device_register(dev, "mp3309c", dev, chip, 367 &mp3309c_bl_ops, &props); 368 if (IS_ERR(chip->bl))
+18 -29
drivers/video/backlight/omap1_bl.c
··· 9 #include <linux/kernel.h> 10 #include <linux/init.h> 11 #include <linux/platform_device.h> 12 - #include <linux/fb.h> 13 #include <linux/backlight.h> 14 #include <linux/slab.h> 15 #include <linux/platform_data/omap1_bl.h> ··· 19 #define OMAPBL_MAX_INTENSITY 0xff 20 21 struct omap_backlight { 22 - int powermode; 23 int current_intensity; 24 25 struct device *dev; ··· 36 omap_writeb(enable, OMAP_PWL_CLK_ENABLE); 37 } 38 39 - static void omapbl_blank(struct omap_backlight *bl, int mode) 40 { 41 - if (bl->pdata->set_power) 42 - bl->pdata->set_power(bl->dev, mode); 43 - 44 - switch (mode) { 45 - case FB_BLANK_NORMAL: 46 - case FB_BLANK_VSYNC_SUSPEND: 47 - case FB_BLANK_HSYNC_SUSPEND: 48 - case FB_BLANK_POWERDOWN: 49 - omapbl_send_intensity(0); 50 - omapbl_send_enable(0); 51 - break; 52 - 53 - case FB_BLANK_UNBLANK: 54 omapbl_send_intensity(bl->current_intensity); 55 omapbl_send_enable(1); 56 - break; 57 } 58 } 59 ··· 53 struct backlight_device *bl_dev = dev_get_drvdata(dev); 54 struct omap_backlight *bl = bl_get_data(bl_dev); 55 56 - omapbl_blank(bl, FB_BLANK_POWERDOWN); 57 return 0; 58 } 59 ··· 62 struct backlight_device *bl_dev = dev_get_drvdata(dev); 63 struct omap_backlight *bl = bl_get_data(bl_dev); 64 65 - omapbl_blank(bl, bl->powermode); 66 return 0; 67 } 68 #endif 69 70 - static int omapbl_set_power(struct backlight_device *dev, int state) 71 { 72 struct omap_backlight *bl = bl_get_data(dev); 73 74 - omapbl_blank(bl, state); 75 - bl->powermode = state; 76 - 77 - return 0; 78 } 79 80 static int omapbl_update_status(struct backlight_device *dev) 81 { 82 struct omap_backlight *bl = bl_get_data(dev); 83 84 if (bl->current_intensity != dev->props.brightness) { 85 - if (bl->powermode == FB_BLANK_UNBLANK) 86 omapbl_send_intensity(dev->props.brightness); 87 bl->current_intensity = dev->props.brightness; 88 } 89 90 - if (dev->props.fb_blank != bl->powermode) 91 - omapbl_set_power(dev, dev->props.fb_blank); 92 93 return 0; 94 } ··· 129 if (IS_ERR(dev)) 130 return PTR_ERR(dev); 131 132 - bl->powermode = FB_BLANK_POWERDOWN; 133 bl->current_intensity = 0; 134 135 bl->pdata = pdata; ··· 139 140 omap_cfg_reg(PWL); /* Conflicts with UART3 */ 141 142 - dev->props.fb_blank = FB_BLANK_UNBLANK; 143 dev->props.brightness = pdata->default_intensity; 144 omapbl_update_status(dev); 145
··· 9 #include <linux/kernel.h> 10 #include <linux/init.h> 11 #include <linux/platform_device.h> 12 #include <linux/backlight.h> 13 #include <linux/slab.h> 14 #include <linux/platform_data/omap1_bl.h> ··· 20 #define OMAPBL_MAX_INTENSITY 0xff 21 22 struct omap_backlight { 23 + bool enabled; 24 int current_intensity; 25 26 struct device *dev; ··· 37 omap_writeb(enable, OMAP_PWL_CLK_ENABLE); 38 } 39 40 + static void omapbl_enable(struct omap_backlight *bl, bool enable) 41 { 42 + if (enable) { 43 omapbl_send_intensity(bl->current_intensity); 44 omapbl_send_enable(1); 45 + } else { 46 + omapbl_send_intensity(0); 47 + omapbl_send_enable(0); 48 } 49 } 50 ··· 64 struct backlight_device *bl_dev = dev_get_drvdata(dev); 65 struct omap_backlight *bl = bl_get_data(bl_dev); 66 67 + omapbl_enable(bl, false); 68 return 0; 69 } 70 ··· 73 struct backlight_device *bl_dev = dev_get_drvdata(dev); 74 struct omap_backlight *bl = bl_get_data(bl_dev); 75 76 + omapbl_enable(bl, bl->enabled); 77 return 0; 78 } 79 #endif 80 81 + static void omapbl_set_enabled(struct backlight_device *dev, bool enable) 82 { 83 struct omap_backlight *bl = bl_get_data(dev); 84 85 + omapbl_enable(bl, enable); 86 + bl->enabled = enable; 87 } 88 89 static int omapbl_update_status(struct backlight_device *dev) 90 { 91 struct omap_backlight *bl = bl_get_data(dev); 92 + bool enable; 93 94 if (bl->current_intensity != dev->props.brightness) { 95 + if (bl->enabled) 96 omapbl_send_intensity(dev->props.brightness); 97 bl->current_intensity = dev->props.brightness; 98 } 99 100 + enable = !backlight_is_blank(dev); 101 + 102 + if (enable != bl->enabled) 103 + omapbl_set_enabled(dev, enable); 104 105 return 0; 106 } ··· 139 if (IS_ERR(dev)) 140 return PTR_ERR(dev); 141 142 + bl->enabled = false; 143 bl->current_intensity = 0; 144 145 bl->pdata = pdata; ··· 149 150 omap_cfg_reg(PWL); /* Conflicts with UART3 */ 151 152 dev->props.brightness = pdata->default_intensity; 153 omapbl_update_status(dev); 154
+1 -2
drivers/video/backlight/otm3225a.c
··· 205 return dd->power; 206 } 207 208 - static struct lcd_ops otm3225a_ops = { 209 .set_power = otm3225a_set_power, 210 .get_power = otm3225a_get_power, 211 }; ··· 239 static struct spi_driver otm3225a_driver = { 240 .driver = { 241 .name = "otm3225a", 242 - .owner = THIS_MODULE, 243 }, 244 .probe = otm3225a_probe, 245 };
··· 205 return dd->power; 206 } 207 208 + static const struct lcd_ops otm3225a_ops = { 209 .set_power = otm3225a_set_power, 210 .get_power = otm3225a_get_power, 211 }; ··· 239 static struct spi_driver otm3225a_driver = { 240 .driver = { 241 .name = "otm3225a", 242 }, 243 .probe = otm3225a_probe, 244 };
+1 -1
drivers/video/backlight/platform_lcd.c
··· 62 return plcd->us->parent == info->device; 63 } 64 65 - static struct lcd_ops platform_lcd_ops = { 66 .get_power = platform_lcd_get_power, 67 .set_power = platform_lcd_set_power, 68 .check_fb = platform_lcd_match,
··· 62 return plcd->us->parent == info->device; 63 } 64 65 + static const struct lcd_ops platform_lcd_ops = { 66 .get_power = platform_lcd_get_power, 67 .set_power = platform_lcd_set_power, 68 .check_fb = platform_lcd_match,
-12
drivers/video/backlight/pwm_bl.c
··· 11 #include <linux/kernel.h> 12 #include <linux/init.h> 13 #include <linux/platform_device.h> 14 - #include <linux/fb.h> 15 #include <linux/backlight.h> 16 #include <linux/err.h> 17 #include <linux/pwm.h> ··· 33 int brightness); 34 void (*notify_after)(struct device *, 35 int brightness); 36 - int (*check_fb)(struct device *, struct fb_info *); 37 void (*exit)(struct device *); 38 }; 39 ··· 127 return 0; 128 } 129 130 - static int pwm_backlight_check_fb(struct backlight_device *bl, 131 - struct fb_info *info) 132 - { 133 - struct pwm_bl_data *pb = bl_get_data(bl); 134 - 135 - return !pb->check_fb || pb->check_fb(pb->dev, info); 136 - } 137 - 138 static const struct backlight_ops pwm_backlight_ops = { 139 .update_status = pwm_backlight_update_status, 140 - .check_fb = pwm_backlight_check_fb, 141 }; 142 143 #ifdef CONFIG_OF ··· 471 472 pb->notify = data->notify; 473 pb->notify_after = data->notify_after; 474 - pb->check_fb = data->check_fb; 475 pb->exit = data->exit; 476 pb->dev = &pdev->dev; 477 pb->enabled = false;
··· 11 #include <linux/kernel.h> 12 #include <linux/init.h> 13 #include <linux/platform_device.h> 14 #include <linux/backlight.h> 15 #include <linux/err.h> 16 #include <linux/pwm.h> ··· 34 int brightness); 35 void (*notify_after)(struct device *, 36 int brightness); 37 void (*exit)(struct device *); 38 }; 39 ··· 129 return 0; 130 } 131 132 static const struct backlight_ops pwm_backlight_ops = { 133 .update_status = pwm_backlight_update_status, 134 }; 135 136 #ifdef CONFIG_OF ··· 482 483 pb->notify = data->notify; 484 pb->notify_after = data->notify_after; 485 pb->exit = data->exit; 486 pb->dev = &pdev->dev; 487 pb->enabled = false;
+2 -6
drivers/video/backlight/sky81452-backlight.c
··· 182 static struct sky81452_bl_platform_data *sky81452_bl_parse_dt( 183 struct device *dev) 184 { 185 - struct device_node *np = of_node_get(dev->of_node); 186 struct sky81452_bl_platform_data *pdata; 187 int num_entry; 188 unsigned int sources[6]; ··· 194 } 195 196 pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); 197 - if (!pdata) { 198 - of_node_put(np); 199 return ERR_PTR(-ENOMEM); 200 - } 201 202 of_property_read_string(np, "name", &pdata->name); 203 pdata->ignore_pwm = of_property_read_bool(np, "skyworks,ignore-pwm"); ··· 215 num_entry); 216 if (ret < 0) { 217 dev_err(dev, "led-sources node is invalid.\n"); 218 - of_node_put(np); 219 return ERR_PTR(-EINVAL); 220 } 221 ··· 234 if (ret < 0) 235 pdata->boost_current_limit = 2750; 236 237 - of_node_put(np); 238 return pdata; 239 } 240 #else
··· 182 static struct sky81452_bl_platform_data *sky81452_bl_parse_dt( 183 struct device *dev) 184 { 185 + struct device_node *np = dev->of_node; 186 struct sky81452_bl_platform_data *pdata; 187 int num_entry; 188 unsigned int sources[6]; ··· 194 } 195 196 pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); 197 + if (!pdata) 198 return ERR_PTR(-ENOMEM); 199 200 of_property_read_string(np, "name", &pdata->name); 201 pdata->ignore_pwm = of_property_read_bool(np, "skyworks,ignore-pwm"); ··· 217 num_entry); 218 if (ret < 0) { 219 dev_err(dev, "led-sources node is invalid.\n"); 220 return ERR_PTR(-EINVAL); 221 } 222 ··· 237 if (ret < 0) 238 pdata->boost_current_limit = 2750; 239 240 return pdata; 241 } 242 #else
+1 -1
drivers/video/backlight/tdo24m.c
··· 322 return lcd->adj_mode(lcd, mode); 323 } 324 325 - static struct lcd_ops tdo24m_ops = { 326 .get_power = tdo24m_get_power, 327 .set_power = tdo24m_set_power, 328 .set_mode = tdo24m_set_mode,
··· 322 return lcd->adj_mode(lcd, mode); 323 } 324 325 + static const struct lcd_ops tdo24m_ops = { 326 .get_power = tdo24m_get_power, 327 .set_power = tdo24m_set_power, 328 .set_mode = tdo24m_set_mode,
-1
drivers/video/fbdev/atmel_lcdfb.c
··· 153 sinfo->backlight = bl; 154 155 bl->props.power = FB_BLANK_UNBLANK; 156 - bl->props.fb_blank = FB_BLANK_UNBLANK; 157 bl->props.brightness = atmel_bl_get_brightness(bl); 158 } 159
··· 153 sinfo->backlight = bl; 154 155 bl->props.power = FB_BLANK_UNBLANK; 156 bl->props.brightness = atmel_bl_get_brightness(bl); 157 } 158
+1 -1
drivers/video/fbdev/clps711x-fb.c
··· 197 return 0; 198 } 199 200 - static struct lcd_ops clps711x_lcd_ops = { 201 .check_fb = clps711x_lcd_check_fb, 202 .get_power = clps711x_lcd_get_power, 203 .set_power = clps711x_lcd_set_power,
··· 197 return 0; 198 } 199 200 + static const struct lcd_ops clps711x_lcd_ops = { 201 .check_fb = clps711x_lcd_check_fb, 202 .get_power = clps711x_lcd_get_power, 203 .set_power = clps711x_lcd_set_power,
+6
drivers/video/fbdev/core/fb_backlight.c
··· 30 mutex_unlock(&fb_info->bl_curve_mutex); 31 } 32 EXPORT_SYMBOL_GPL(fb_bl_default_curve); 33 #endif
··· 30 mutex_unlock(&fb_info->bl_curve_mutex); 31 } 32 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); 39 #endif
+1 -1
drivers/video/fbdev/imxfb.c
··· 857 return 0; 858 } 859 860 - static struct lcd_ops imxfb_lcd_ops = { 861 .check_fb = imxfb_lcd_check_fb, 862 .get_contrast = imxfb_lcd_get_contrast, 863 .set_contrast = imxfb_lcd_set_contrast,
··· 857 return 0; 858 } 859 860 + static const struct lcd_ops imxfb_lcd_ops = { 861 .check_fb = imxfb_lcd_check_fb, 862 .get_contrast = imxfb_lcd_get_contrast, 863 .set_contrast = imxfb_lcd_set_contrast,
+1 -1
drivers/video/fbdev/omap/lcd_ams_delta.c
··· 76 return ams_delta_lcd & AMS_DELTA_MAX_CONTRAST; 77 } 78 79 - static struct lcd_ops ams_delta_lcd_ops = { 80 .get_power = ams_delta_lcd_get_power, 81 .set_power = ams_delta_lcd_set_power, 82 .get_contrast = ams_delta_lcd_get_contrast,
··· 76 return ams_delta_lcd & AMS_DELTA_MAX_CONTRAST; 77 } 78 79 + static const struct lcd_ops ams_delta_lcd_ops = { 80 .get_power = ams_delta_lcd_get_power, 81 .set_power = ams_delta_lcd_set_power, 82 .get_contrast = ams_delta_lcd_get_contrast,
+1 -6
drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c
··· 356 357 static int dsicm_bl_get_intensity(struct backlight_device *dev) 358 { 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; 364 } 365 366 static const struct backlight_ops dsicm_bl_ops = { ··· 1215 1216 ddata->bldev = bldev; 1217 1218 - bldev->props.fb_blank = FB_BLANK_UNBLANK; 1219 bldev->props.power = FB_BLANK_UNBLANK; 1220 bldev->props.brightness = 255; 1221
··· 356 357 static int dsicm_bl_get_intensity(struct backlight_device *dev) 358 { 359 + return backlight_get_brightness(dev); 360 } 361 362 static const struct backlight_ops dsicm_bl_ops = { ··· 1219 1220 ddata->bldev = bldev; 1221 1222 bldev->props.power = FB_BLANK_UNBLANK; 1223 bldev->props.brightness = 255; 1224
+2 -8
drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c
··· 340 341 dev_dbg(&ddata->spi->dev, "%s\n", __func__); 342 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; 348 349 if (ddata->has_bc) 350 acx565akm_set_brightness(ddata, level); ··· 359 if (!ddata->has_bc) 360 return -ENODEV; 361 362 - if (dev->props.fb_blank == FB_BLANK_UNBLANK && 363 - dev->props.power == FB_BLANK_UNBLANK) { 364 if (ddata->has_bc) 365 return acx565akm_get_actual_brightness(ddata); 366 else ··· 753 } 754 755 memset(&props, 0, sizeof(props)); 756 - props.fb_blank = FB_BLANK_UNBLANK; 757 props.power = FB_BLANK_UNBLANK; 758 props.type = BACKLIGHT_RAW; 759
··· 340 341 dev_dbg(&ddata->spi->dev, "%s\n", __func__); 342 343 + level = backlight_get_brightness(dev); 344 345 if (ddata->has_bc) 346 acx565akm_set_brightness(ddata, level); ··· 363 if (!ddata->has_bc) 364 return -ENODEV; 365 366 + if (!backlight_is_blank(dev)) { 367 if (ddata->has_bc) 368 return acx565akm_get_actual_brightness(ddata); 369 else ··· 758 } 759 760 memset(&props, 0, sizeof(props)); 761 props.power = FB_BLANK_UNBLANK; 762 props.type = BACKLIGHT_RAW; 763
-7
drivers/video/fbdev/sh_mobile_lcdcfb.c
··· 2140 return ch->bl_brightness; 2141 } 2142 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 - 2149 static const struct backlight_ops sh_mobile_lcdc_bl_ops = { 2150 .options = BL_CORE_SUSPENDRESUME, 2151 .update_status = sh_mobile_lcdc_update_bl, 2152 .get_brightness = sh_mobile_lcdc_get_brightness, 2153 - .check_fb = sh_mobile_lcdc_check_fb, 2154 }; 2155 2156 static struct backlight_device *sh_mobile_lcdc_bl_probe(struct device *parent,
··· 2140 return ch->bl_brightness; 2141 } 2142 2143 static const struct backlight_ops sh_mobile_lcdc_bl_ops = { 2144 .options = BL_CORE_SUSPENDRESUME, 2145 .update_status = sh_mobile_lcdc_update_bl, 2146 .get_brightness = sh_mobile_lcdc_get_brightness, 2147 }; 2148 2149 static struct backlight_device *sh_mobile_lcdc_bl_probe(struct device *parent,
+11 -20
drivers/video/fbdev/ssd1307fb.c
··· 530 return par->contrast; 531 } 532 533 - static int ssd1307fb_check_fb(struct backlight_device *bdev, 534 - struct fb_info *info) 535 - { 536 - return (info->bl_dev == bdev); 537 - } 538 - 539 static const struct backlight_ops ssd1307fb_bl_ops = { 540 .options = BL_CORE_SUSPENDRESUME, 541 .update_status = ssd1307fb_update_bl, 542 .get_brightness = ssd1307fb_get_brightness, 543 - .check_fb = ssd1307fb_check_fb, 544 }; 545 546 static struct ssd1307fb_deviceinfo ssd1307fb_ssd1305_deviceinfo = { ··· 587 { 588 struct device *dev = &client->dev; 589 struct backlight_device *bl; 590 - char bl_name[12]; 591 struct fb_info *info; 592 struct fb_deferred_io *ssd1307fb_defio; 593 u32 vmem_size; ··· 725 if (ret) 726 goto regulator_enable_error; 727 728 - ret = register_framebuffer(info); 729 - if (ret) { 730 - dev_err(dev, "Couldn't register the framebuffer\n"); 731 - goto panel_init_error; 732 - } 733 - 734 - snprintf(bl_name, sizeof(bl_name), "ssd1307fb%d", info->node); 735 - bl = backlight_device_register(bl_name, dev, par, &ssd1307fb_bl_ops, 736 NULL); 737 if (IS_ERR(bl)) { 738 ret = PTR_ERR(bl); 739 dev_err(dev, "unable to register backlight device: %d\n", ret); 740 - goto bl_init_error; 741 } 742 743 bl->props.brightness = par->contrast; 744 bl->props.max_brightness = MAX_CONTRAST; 745 - info->bl_dev = bl; 746 747 dev_info(dev, "fb%d: %s framebuffer device registered, using %d bytes of video memory\n", info->node, info->fix.id, vmem_size); 748 749 return 0; 750 751 - bl_init_error: 752 - unregister_framebuffer(info); 753 panel_init_error: 754 pwm_disable(par->pwm); 755 pwm_put(par->pwm);
··· 530 return par->contrast; 531 } 532 533 static const struct backlight_ops ssd1307fb_bl_ops = { 534 .options = BL_CORE_SUSPENDRESUME, 535 .update_status = ssd1307fb_update_bl, 536 .get_brightness = ssd1307fb_get_brightness, 537 }; 538 539 static struct ssd1307fb_deviceinfo ssd1307fb_ssd1305_deviceinfo = { ··· 594 { 595 struct device *dev = &client->dev; 596 struct backlight_device *bl; 597 struct fb_info *info; 598 struct fb_deferred_io *ssd1307fb_defio; 599 u32 vmem_size; ··· 733 if (ret) 734 goto regulator_enable_error; 735 736 + bl = backlight_device_register("ssd1307fb-bl", dev, par, &ssd1307fb_bl_ops, 737 NULL); 738 if (IS_ERR(bl)) { 739 ret = PTR_ERR(bl); 740 dev_err(dev, "unable to register backlight device: %d\n", ret); 741 + goto panel_init_error; 742 + } 743 + info->bl_dev = bl; 744 + 745 + ret = register_framebuffer(info); 746 + if (ret) { 747 + dev_err(dev, "Couldn't register the framebuffer\n"); 748 + goto fb_init_error; 749 } 750 751 bl->props.brightness = par->contrast; 752 bl->props.max_brightness = MAX_CONTRAST; 753 754 dev_info(dev, "fb%d: %s framebuffer device registered, using %d bytes of video memory\n", info->node, info->fix.id, vmem_size); 755 756 return 0; 757 758 + fb_init_error: 759 + backlight_device_unregister(bl); 760 panel_init_error: 761 pwm_disable(par->pwm); 762 pwm_put(par->pwm);
+9 -32
include/linux/backlight.h
··· 13 #include <linux/fb.h> 14 #include <linux/mutex.h> 15 #include <linux/notifier.h> 16 17 /** 18 * enum backlight_update_reason - what method was used to update backlight ··· 111 }; 112 113 struct backlight_device; 114 - struct fb_info; 115 116 /** 117 * struct backlight_ops - backlight operations ··· 160 int (*get_brightness)(struct backlight_device *); 161 162 /** 163 - * @check_fb: Check the framebuffer device. 164 * 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. 168 * 169 * RETURNS: 170 * 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. 173 */ 174 - int (*check_fb)(struct backlight_device *bd, struct fb_info *info); 175 }; 176 177 /** ··· 217 * @power is set to FB_BLANK_POWERDOWN. 218 */ 219 int power; 220 - 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 240 /** 241 * @type: The type of backlight supported. ··· 347 return 0; 348 349 bd->props.power = FB_BLANK_UNBLANK; 350 - bd->props.fb_blank = FB_BLANK_UNBLANK; 351 bd->props.state &= ~BL_CORE_FBBLANK; 352 353 return backlight_update_status(bd); ··· 362 return 0; 363 364 bd->props.power = FB_BLANK_POWERDOWN; 365 - bd->props.fb_blank = FB_BLANK_POWERDOWN; 366 bd->props.state |= BL_CORE_FBBLANK; 367 368 return backlight_update_status(bd); ··· 374 * Display is expected to be blank if any of these is true:: 375 * 376 * 1) if power in not UNBLANK 377 - * 2) if fb_blank is not UNBLANK 378 - * 3) if state indicate BLANK or SUSPENDED 379 * 380 * Returns true if display is expected to be blank, false otherwise. 381 */ 382 static inline bool backlight_is_blank(const struct backlight_device *bd) 383 { 384 return bd->props.power != FB_BLANK_UNBLANK || 385 - bd->props.fb_blank != FB_BLANK_UNBLANK || 386 bd->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK); 387 } 388
··· 13 #include <linux/fb.h> 14 #include <linux/mutex.h> 15 #include <linux/notifier.h> 16 + #include <linux/types.h> 17 18 /** 19 * enum backlight_update_reason - what method was used to update backlight ··· 110 }; 111 112 struct backlight_device; 113 114 /** 115 * struct backlight_ops - backlight operations ··· 160 int (*get_brightness)(struct backlight_device *); 161 162 /** 163 + * @controls_device: Check against the display device 164 * 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. 168 * 169 * RETURNS: 170 * 171 + * If display_dev is NULL or display_dev matches the device controlled by 172 + * the backlight, return true. Otherwise return false. 173 */ 174 + bool (*controls_device)(struct backlight_device *bd, struct device *display_dev); 175 }; 176 177 /** ··· 217 * @power is set to FB_BLANK_POWERDOWN. 218 */ 219 int power; 220 221 /** 222 * @type: The type of backlight supported. ··· 366 return 0; 367 368 bd->props.power = FB_BLANK_UNBLANK; 369 bd->props.state &= ~BL_CORE_FBBLANK; 370 371 return backlight_update_status(bd); ··· 382 return 0; 383 384 bd->props.power = FB_BLANK_POWERDOWN; 385 bd->props.state |= BL_CORE_FBBLANK; 386 387 return backlight_update_status(bd); ··· 395 * Display is expected to be blank if any of these is true:: 396 * 397 * 1) if power in not UNBLANK 398 + * 2) if state indicate BLANK or SUSPENDED 399 * 400 * Returns true if display is expected to be blank, false otherwise. 401 */ 402 static inline bool backlight_is_blank(const struct backlight_device *bd) 403 { 404 return bd->props.power != FB_BLANK_UNBLANK || 405 bd->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK); 406 } 407
+9
include/linux/fb.h
··· 742 extern void framebuffer_release(struct fb_info *info); 743 extern void fb_bl_default_curve(struct fb_info *fb_info, u8 off, u8 min, u8 max); 744 745 /* fbmon.c */ 746 #define FB_MAXTIMINGS 0 747 #define FB_VSYNCTIMINGS 1
··· 742 extern void framebuffer_release(struct fb_info *info); 743 extern void fb_bl_default_curve(struct fb_info *fb_info, u8 off, u8 min, u8 max); 744 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 + 754 /* fbmon.c */ 755 #define FB_MAXTIMINGS 0 756 #define FB_VSYNCTIMINGS 1
+3 -3
include/linux/lcd.h
··· 61 points to something in the body of that driver, it is also invalid. */ 62 struct mutex ops_lock; 63 /* If this is NULL, the backing module is unloaded */ 64 - struct lcd_ops *ops; 65 /* Serialise access to set_power method */ 66 struct mutex update_lock; 67 /* The framebuffer notifier block */ ··· 102 } 103 104 extern struct lcd_device *lcd_device_register(const char *name, 105 - struct device *parent, void *devdata, struct lcd_ops *ops); 106 extern struct lcd_device *devm_lcd_device_register(struct device *dev, 107 const char *name, struct device *parent, 108 - void *devdata, struct lcd_ops *ops); 109 extern void lcd_device_unregister(struct lcd_device *ld); 110 extern void devm_lcd_device_unregister(struct device *dev, 111 struct lcd_device *ld);
··· 61 points to something in the body of that driver, it is also invalid. */ 62 struct mutex ops_lock; 63 /* If this is NULL, the backing module is unloaded */ 64 + const struct lcd_ops *ops; 65 /* Serialise access to set_power method */ 66 struct mutex update_lock; 67 /* The framebuffer notifier block */ ··· 102 } 103 104 extern struct lcd_device *lcd_device_register(const char *name, 105 + struct device *parent, void *devdata, const struct lcd_ops *ops); 106 extern struct lcd_device *devm_lcd_device_register(struct device *dev, 107 const char *name, struct device *parent, 108 + void *devdata, const struct lcd_ops *ops); 109 extern void lcd_device_unregister(struct lcd_device *ld); 110 extern void devm_lcd_device_unregister(struct device *dev, 111 struct lcd_device *ld);
-36
include/linux/mfd/lp8788.h
··· 11 #define __MFD_LP8788_H__ 12 13 #include <linux/irqdomain.h> 14 - #include <linux/pwm.h> 15 #include <linux/regmap.h> 16 17 #define LP8788_DEV_BUCK "lp8788-buck" ··· 84 enum lp8788_charger_event { 85 NO_CHARGER, 86 CHARGER_DETECTED, 87 - }; 88 - 89 - enum lp8788_bl_ctrl_mode { 90 - LP8788_BL_REGISTER_ONLY, 91 - LP8788_BL_COMB_PWM_BASED, /* PWM + I2C, changed by PWM input */ 92 - LP8788_BL_COMB_REGISTER_BASED, /* PWM + I2C, changed by I2C */ 93 }; 94 95 enum lp8788_bl_dim_mode { ··· 195 }; 196 197 /* 198 - * struct lp8788_backlight_platform_data 199 - * @name : backlight driver name. (default: "lcd-backlight") 200 - * @initial_brightness : initial value of backlight brightness 201 - * @bl_mode : brightness control by pwm or lp8788 register 202 - * @dim_mode : dimming mode selection 203 - * @full_scale : full scale current setting 204 - * @rise_time : brightness ramp up step time 205 - * @fall_time : brightness ramp down step time 206 - * @pwm_pol : pwm polarity setting when bl_mode is pwm based 207 - * @period_ns : platform specific pwm period value. unit is nano. 208 - Only valid when bl_mode is LP8788_BL_COMB_PWM_BASED 209 - */ 210 - struct lp8788_backlight_platform_data { 211 - char *name; 212 - int initial_brightness; 213 - enum lp8788_bl_ctrl_mode bl_mode; 214 - enum lp8788_bl_dim_mode dim_mode; 215 - enum lp8788_bl_full_scale_current full_scale; 216 - enum lp8788_bl_ramp_step rise_time; 217 - enum lp8788_bl_ramp_step fall_time; 218 - enum pwm_polarity pwm_pol; 219 - unsigned int period_ns; 220 - }; 221 - 222 - /* 223 * struct lp8788_led_platform_data 224 * @name : led driver name. (default: "keyboard-backlight") 225 * @scale : current scale ··· 235 * @buck2_dvs : configurations for buck2 dvs 236 * @chg_pdata : platform data for charger driver 237 * @alarm_sel : rtc alarm selection (1 or 2) 238 - * @bl_pdata : configurable data for backlight driver 239 * @led_pdata : configurable data for led driver 240 * @vib_pdata : configurable data for vibrator driver 241 * @adc_pdata : iio map data for adc driver ··· 255 256 /* rtc alarm */ 257 enum lp8788_alarm_sel alarm_sel; 258 - 259 - /* backlight */ 260 - struct lp8788_backlight_platform_data *bl_pdata; 261 262 /* current sinks */ 263 struct lp8788_led_platform_data *led_pdata;
··· 11 #define __MFD_LP8788_H__ 12 13 #include <linux/irqdomain.h> 14 #include <linux/regmap.h> 15 16 #define LP8788_DEV_BUCK "lp8788-buck" ··· 85 enum lp8788_charger_event { 86 NO_CHARGER, 87 CHARGER_DETECTED, 88 }; 89 90 enum lp8788_bl_dim_mode { ··· 202 }; 203 204 /* 205 * struct lp8788_led_platform_data 206 * @name : led driver name. (default: "keyboard-backlight") 207 * @scale : current scale ··· 267 * @buck2_dvs : configurations for buck2 dvs 268 * @chg_pdata : platform data for charger driver 269 * @alarm_sel : rtc alarm selection (1 or 2) 270 * @led_pdata : configurable data for led driver 271 * @vib_pdata : configurable data for vibrator driver 272 * @adc_pdata : iio map data for adc driver ··· 288 289 /* rtc alarm */ 290 enum lp8788_alarm_sel alarm_sel; 291 292 /* current sinks */ 293 struct lp8788_led_platform_data *led_pdata;
-1
include/linux/platform_data/omap1_bl.h
··· 6 7 struct omap_backlight_config { 8 int default_intensity; 9 - int (*set_power)(struct device *dev, int state); 10 }; 11 12 #endif
··· 6 7 struct omap_backlight_config { 8 int default_intensity; 9 }; 10 11 #endif
-1
include/linux/pwm_backlight.h
··· 19 int (*notify)(struct device *dev, int brightness); 20 void (*notify_after)(struct device *dev, int brightness); 21 void (*exit)(struct device *dev); 22 - int (*check_fb)(struct device *dev, struct fb_info *info); 23 }; 24 25 #endif
··· 19 int (*notify)(struct device *dev, int brightness); 20 void (*notify_after)(struct device *dev, int brightness); 21 void (*exit)(struct device *dev); 22 }; 23 24 #endif
+1
scripts/const_structs.checkpatch
··· 39 kgdb_io 40 kobj_type 41 kset_uevent_ops 42 lock_manager_operations 43 machine_desc 44 microcode_ops
··· 39 kgdb_io 40 kobj_type 41 kset_uevent_ops 42 + lcd_ops 43 lock_manager_operations 44 machine_desc 45 microcode_ops