Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

Pull backlight updates from Lee Jones:
"Core Framework:
- Trivial: Code refactoring
- New API backlight_is_blank()
- New API backlight_get_brightness()
- Additional/reworked documentation
- Remove 'extern' labels from prototypes
- Drop backlight_put()
- Staticify of_find_backlight()

Driver Removal:
- Removal of unused OT200 driver
- Removal of unused Generic Backlight driver

Fix-ups
- Bunch of W=1 warning fixes
- Convert to GPIO descriptors; sky81452
- Move platform data handling into driver; sky81452
- Remove superfluous code; lms501kf03
- Many instances of using new APIs"

* tag 'backlight-next-5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight: (34 commits)
video: backlight: cr_bllcd: Remove unused variable 'intensity'
backlight: backlight: Make of_find_backlight static
backlight: backlight: Drop backlight_put()
backlight: Use backlight_get_brightness() throughout
backlight: jornada720_bl: Introduce backlight_is_blank()
backlight: gpio_backlight: Simplify update_status()
backlight: cr_bllcd: Introduce gpio-backlight semantics
backlight: as3711_bl: Simplify update_status
backlight: backlight: Introduce backlight_get_brightness()
doc-rst: Wire-up Backlight kernel-doc documentation
backlight: backlight: Add overview and update existing doc
backlight: backlight: Drop extern from prototypes
backlight: generic_bl: Remove this driver as it is unused
backlight: backlight: Document enums in backlight.h
backlight: backlight: Document inline functions in backlight.h
backlight: backlight: Improve backlight_device documentation
backlight: backlight: Improve backlight_properties documentation
backlight: backlight: Improve backlight_ops documentation
backlight: backlight: Add backlight_is_blank()
backlight: backlight: Refactor fb_notifier_callback()
...

+538 -717
+12
Documentation/gpu/backlight.rst
··· 1 + ================= 2 + Backlight support 3 + ================= 4 + 5 + .. kernel-doc:: drivers/video/backlight/backlight.c 6 + :doc: overview 7 + 8 + .. kernel-doc:: include/linux/backlight.h 9 + :internal: 10 + 11 + .. kernel-doc:: drivers/video/backlight/backlight.c 12 + :export:
+1
Documentation/gpu/index.rst
··· 12 12 drm-uapi 13 13 drm-client 14 14 drivers 15 + backlight 15 16 vga-switcheroo 16 17 vgaarbiter 17 18 todo
-2
drivers/mfd/sky81452.c
··· 47 47 memset(cells, 0, sizeof(cells)); 48 48 cells[0].name = "sky81452-backlight"; 49 49 cells[0].of_compatible = "skyworks,sky81452-backlight"; 50 - cells[0].platform_data = pdata->bl_pdata; 51 - cells[0].pdata_size = sizeof(*pdata->bl_pdata); 52 50 cells[1].name = "sky81452-regulator"; 53 51 cells[1].platform_data = pdata->regulator_init_data; 54 52 cells[1].pdata_size = sizeof(*pdata->regulator_init_data);
+1 -12
drivers/video/backlight/88pm860x_bl.c
··· 121 121 122 122 static int pm860x_backlight_update_status(struct backlight_device *bl) 123 123 { 124 - int brightness = bl->props.brightness; 125 - 126 - if (bl->props.power != FB_BLANK_UNBLANK) 127 - brightness = 0; 128 - 129 - if (bl->props.fb_blank != FB_BLANK_UNBLANK) 130 - brightness = 0; 131 - 132 - if (bl->props.state & BL_CORE_SUSPENDED) 133 - brightness = 0; 134 - 135 - return pm860x_backlight_set(bl, brightness); 124 + return pm860x_backlight_set(bl, backlight_get_brightness(bl)); 136 125 } 137 126 138 127 static int pm860x_backlight_get_brightness(struct backlight_device *bl)
-15
drivers/video/backlight/Kconfig
··· 173 173 To compile this driver as a module, choose M here: the module will 174 174 be called ep93xx_bl. 175 175 176 - config BACKLIGHT_GENERIC 177 - tristate "Generic (aka Sharp Corgi) Backlight Driver" 178 - default y 179 - help 180 - Say y to enable the generic platform backlight driver previously 181 - known as the Corgi backlight driver. If you have a Sharp Zaurus 182 - SL-C7xx, SL-Cxx00 or SL-6000x say y. 183 - 184 176 config BACKLIGHT_IPAQ_MICRO 185 177 tristate "iPAQ microcontroller backlight driver" 186 178 depends on MFD_IPAQ_MICRO ··· 377 385 depends on MFD_LP8788 && PWM 378 386 help 379 387 This supports TI LP8788 backlight driver. 380 - 381 - config BACKLIGHT_OT200 382 - tristate "Backlight driver for ot200 visualisation device" 383 - depends on CS5535_MFGPT && GPIO_CS5535 384 - help 385 - To compile this driver as a module, choose M here: the module will be 386 - called ot200_bl. 387 388 388 389 config BACKLIGHT_PANDORA 389 390 tristate "Backlight driver for Pandora console"
-2
drivers/video/backlight/Makefile
··· 31 31 obj-$(CONFIG_BACKLIGHT_DA903X) += da903x_bl.o 32 32 obj-$(CONFIG_BACKLIGHT_DA9052) += da9052_bl.o 33 33 obj-$(CONFIG_BACKLIGHT_EP93XX) += ep93xx_bl.o 34 - obj-$(CONFIG_BACKLIGHT_GENERIC) += generic_bl.o 35 34 obj-$(CONFIG_BACKLIGHT_GPIO) += gpio_backlight.o 36 35 obj-$(CONFIG_BACKLIGHT_HP680) += hp680_bl.o 37 36 obj-$(CONFIG_BACKLIGHT_HP700) += jornada720_bl.o ··· 44 45 obj-$(CONFIG_BACKLIGHT_LV5207LP) += lv5207lp.o 45 46 obj-$(CONFIG_BACKLIGHT_MAX8925) += max8925_bl.o 46 47 obj-$(CONFIG_BACKLIGHT_OMAP1) += omap1_bl.o 47 - obj-$(CONFIG_BACKLIGHT_OT200) += ot200_bl.o 48 48 obj-$(CONFIG_BACKLIGHT_PANDORA) += pandora_bl.o 49 49 obj-$(CONFIG_BACKLIGHT_PCF50633) += pcf50633-backlight.o 50 50 obj-$(CONFIG_BACKLIGHT_PWM) += pwm_bl.o
+1 -9
drivers/video/backlight/adp5520_bl.c
··· 65 65 66 66 static int adp5520_bl_update_status(struct backlight_device *bl) 67 67 { 68 - int brightness = bl->props.brightness; 69 - 70 - if (bl->props.power != FB_BLANK_UNBLANK) 71 - brightness = 0; 72 - 73 - if (bl->props.fb_blank != FB_BLANK_UNBLANK) 74 - brightness = 0; 75 - 76 - return adp5520_bl_set(bl, brightness); 68 + return adp5520_bl_set(bl, backlight_get_brightness(bl)); 77 69 } 78 70 79 71 static int adp5520_bl_get_brightness(struct backlight_device *bl)
+1 -9
drivers/video/backlight/adp8860_bl.c
··· 361 361 362 362 static int adp8860_bl_update_status(struct backlight_device *bl) 363 363 { 364 - int brightness = bl->props.brightness; 365 - 366 - if (bl->props.power != FB_BLANK_UNBLANK) 367 - brightness = 0; 368 - 369 - if (bl->props.fb_blank != FB_BLANK_UNBLANK) 370 - brightness = 0; 371 - 372 - return adp8860_bl_set(bl, brightness); 364 + return adp8860_bl_set(bl, backlight_get_brightness(bl)); 373 365 } 374 366 375 367 static int adp8860_bl_get_brightness(struct backlight_device *bl)
+1 -9
drivers/video/backlight/adp8870_bl.c
··· 399 399 400 400 static int adp8870_bl_update_status(struct backlight_device *bl) 401 401 { 402 - int brightness = bl->props.brightness; 403 - 404 - if (bl->props.power != FB_BLANK_UNBLANK) 405 - brightness = 0; 406 - 407 - if (bl->props.fb_blank != FB_BLANK_UNBLANK) 408 - brightness = 0; 409 - 410 - return adp8870_bl_set(bl, brightness); 402 + return adp8870_bl_set(bl, backlight_get_brightness(bl)); 411 403 } 412 404 413 405 static int adp8870_bl_get_brightness(struct backlight_device *bl)
+2 -9
drivers/video/backlight/as3711_bl.c
··· 104 104 struct as3711_bl_data *data = bl_get_data(bl); 105 105 struct as3711_bl_supply *supply = to_supply(data); 106 106 struct as3711 *as3711 = supply->as3711; 107 - int brightness = bl->props.brightness; 107 + int brightness; 108 108 int ret = 0; 109 109 110 - dev_dbg(&bl->dev, "%s(): brightness %u, pwr %x, blank %x, state %x\n", 111 - __func__, bl->props.brightness, bl->props.power, 112 - bl->props.fb_blank, bl->props.state); 113 - 114 - if (bl->props.power != FB_BLANK_UNBLANK || 115 - bl->props.fb_blank != FB_BLANK_UNBLANK || 116 - bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK)) 117 - brightness = 0; 110 + brightness = backlight_get_brightness(bl); 118 111 119 112 if (data->type == AS3711_BL_SU1) { 120 113 ret = as3711_set_brightness_v(as3711, brightness,
+126 -80
drivers/video/backlight/backlight.c
··· 22 22 #include <asm/backlight.h> 23 23 #endif 24 24 25 + /** 26 + * DOC: overview 27 + * 28 + * The backlight core supports implementing backlight drivers. 29 + * 30 + * A backlight driver registers a driver using 31 + * devm_backlight_device_register(). The properties of the backlight 32 + * driver such as type and max_brightness must be specified. 33 + * When the core detect changes in for example brightness or power state 34 + * the update_status() operation is called. The backlight driver shall 35 + * implement this operation and use it to adjust backlight. 36 + * 37 + * Several sysfs attributes are provided by the backlight core:: 38 + * 39 + * - brightness R/W, set the requested brightness level 40 + * - actual_brightness RO, the brightness level used by the HW 41 + * - max_brightness RO, the maximum brightness level supported 42 + * 43 + * See Documentation/ABI/stable/sysfs-class-backlight for the full list. 44 + * 45 + * The backlight can be adjusted using the sysfs interface, and 46 + * the backlight driver may also support adjusting backlight using 47 + * a hot-key or some other platform or firmware specific way. 48 + * 49 + * The driver must implement the get_brightness() operation if 50 + * the HW do not support all the levels that can be specified in 51 + * brightness, thus providing user-space access to the actual level 52 + * via the actual_brightness attribute. 53 + * 54 + * When the backlight changes this is reported to user-space using 55 + * an uevent connected to the actual_brightness attribute. 56 + * When brightness is set by platform specific means, for example 57 + * a hot-key to adjust backlight, the driver must notify the backlight 58 + * core that brightness has changed using backlight_force_update(). 59 + * 60 + * The backlight driver core receives notifications from fbdev and 61 + * if the event is FB_EVENT_BLANK and if the value of blank, from the 62 + * FBIOBLANK ioctrl, results in a change in the backlight state the 63 + * update_status() operation is called. 64 + */ 65 + 25 66 static struct list_head backlight_dev_list; 26 67 static struct mutex backlight_dev_list_mutex; 27 68 static struct blocking_notifier_head backlight_notifier; ··· 81 40 82 41 #if defined(CONFIG_FB) || (defined(CONFIG_FB_MODULE) && \ 83 42 defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE)) 84 - /* This callback gets called when something important happens inside a 85 - * framebuffer driver. We're looking if that important event is blanking, 86 - * and if it is and necessary, we're switching backlight power as well ... 43 + /* 44 + * fb_notifier_callback 45 + * 46 + * This callback gets called when something important happens inside a 47 + * framebuffer driver. The backlight core only cares about FB_BLANK_UNBLANK 48 + * which is reported to the driver using backlight_update_status() 49 + * as a state change. 50 + * 51 + * There may be several fbdev's connected to the backlight device, 52 + * in which case they are kept track of. A state change is only reported 53 + * if there is a change in backlight for the specified fbdev. 87 54 */ 88 55 static int fb_notifier_callback(struct notifier_block *self, 89 56 unsigned long event, void *data) ··· 107 58 108 59 bd = container_of(self, struct backlight_device, fb_notif); 109 60 mutex_lock(&bd->ops_lock); 110 - if (bd->ops) 111 - if (!bd->ops->check_fb || 112 - bd->ops->check_fb(bd, evdata->info)) { 113 - fb_blank = *(int *)evdata->data; 114 - if (fb_blank == FB_BLANK_UNBLANK && 115 - !bd->fb_bl_on[node]) { 116 - bd->fb_bl_on[node] = true; 117 - if (!bd->use_count++) { 118 - bd->props.state &= ~BL_CORE_FBBLANK; 119 - bd->props.fb_blank = FB_BLANK_UNBLANK; 120 - backlight_update_status(bd); 121 - } 122 - } else if (fb_blank != FB_BLANK_UNBLANK && 123 - 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 - bd->props.fb_blank = fb_blank; 128 - backlight_update_status(bd); 129 - } 130 - } 61 + 62 + if (!bd->ops) 63 + goto out; 64 + if (bd->ops->check_fb && !bd->ops->check_fb(bd, evdata->info)) 65 + goto out; 66 + 67 + fb_blank = *(int *)evdata->data; 68 + if (fb_blank == FB_BLANK_UNBLANK && !bd->fb_bl_on[node]) { 69 + bd->fb_bl_on[node] = true; 70 + if (!bd->use_count++) { 71 + bd->props.state &= ~BL_CORE_FBBLANK; 72 + bd->props.fb_blank = FB_BLANK_UNBLANK; 73 + backlight_update_status(bd); 131 74 } 75 + } else if (fb_blank != FB_BLANK_UNBLANK && bd->fb_bl_on[node]) { 76 + bd->fb_bl_on[node] = false; 77 + if (!(--bd->use_count)) { 78 + bd->props.state |= BL_CORE_FBBLANK; 79 + bd->props.fb_blank = fb_blank; 80 + backlight_update_status(bd); 81 + } 82 + } 83 + out: 132 84 mutex_unlock(&bd->ops_lock); 133 85 return 0; 134 86 } ··· 370 320 * backlight_force_update - tell the backlight subsystem that hardware state 371 321 * has changed 372 322 * @bd: the backlight device to update 323 + * @reason: reason for update 373 324 * 374 325 * Updates the internal state of the backlight in response to a hardware event, 375 - * and generate a uevent to notify userspace 326 + * and generates an uevent to notify userspace. A backlight driver shall call 327 + * backlight_force_update() when the backlight is changed using, for example, 328 + * a hot-key. The updated brightness is read using get_brightness() and the 329 + * brightness value is reported using an uevent. 376 330 */ 377 331 void backlight_force_update(struct backlight_device *bd, 378 332 enum backlight_update_reason reason) ··· 389 335 } 390 336 EXPORT_SYMBOL(backlight_force_update); 391 337 392 - /** 393 - * backlight_device_register - create and register a new object of 394 - * backlight_device class. 395 - * @name: the name of the new object(must be the same as the name of the 396 - * respective framebuffer device). 397 - * @parent: a pointer to the parent device 398 - * @devdata: an optional pointer to be stored for private driver use. The 399 - * methods may retrieve it by using bl_get_data(bd). 400 - * @ops: the backlight operations structure. 401 - * 402 - * Creates and registers new backlight device. Returns either an 403 - * ERR_PTR() or a pointer to the newly allocated device. 404 - */ 338 + /* deprecated - use devm_backlight_device_register() */ 405 339 struct backlight_device *backlight_device_register(const char *name, 406 340 struct device *parent, void *devdata, const struct backlight_ops *ops, 407 341 const struct backlight_properties *props) ··· 456 414 } 457 415 EXPORT_SYMBOL(backlight_device_register); 458 416 417 + /** backlight_device_get_by_type - find first backlight device of a type 418 + * @type: the type of backlight device 419 + * 420 + * Look up the first backlight device of the specified type 421 + * 422 + * RETURNS: 423 + * 424 + * Pointer to backlight device if any was found. Otherwise NULL. 425 + */ 459 426 struct backlight_device *backlight_device_get_by_type(enum backlight_type type) 460 427 { 461 428 bool found = false; ··· 504 453 } 505 454 EXPORT_SYMBOL(backlight_device_get_by_name); 506 455 507 - /** 508 - * backlight_device_unregister - unregisters a backlight device object. 509 - * @bd: the backlight device object to be unregistered and freed. 510 - * 511 - * Unregisters a previously registered via backlight_device_register object. 512 - */ 456 + /* deprecated - use devm_backlight_device_unregister() */ 513 457 void backlight_device_unregister(struct backlight_device *bd) 514 458 { 515 459 if (!bd) ··· 552 506 * backlight_register_notifier - get notified of backlight (un)registration 553 507 * @nb: notifier block with the notifier to call on backlight (un)registration 554 508 * 555 - * @return 0 on success, otherwise a negative error code 556 - * 557 509 * Register a notifier to get notified when backlight devices get registered 558 510 * or unregistered. 511 + * 512 + * RETURNS: 513 + * 514 + * 0 on success, otherwise a negative error code 559 515 */ 560 516 int backlight_register_notifier(struct notifier_block *nb) 561 517 { ··· 569 521 * backlight_unregister_notifier - unregister a backlight notifier 570 522 * @nb: notifier block to unregister 571 523 * 572 - * @return 0 on success, otherwise a negative error code 573 - * 574 524 * Register a notifier to get notified when backlight devices get registered 575 525 * or unregistered. 526 + * 527 + * RETURNS: 528 + * 529 + * 0 on success, otherwise a negative error code 576 530 */ 577 531 int backlight_unregister_notifier(struct notifier_block *nb) 578 532 { ··· 583 533 EXPORT_SYMBOL(backlight_unregister_notifier); 584 534 585 535 /** 586 - * devm_backlight_device_register - resource managed backlight_device_register() 536 + * devm_backlight_device_register - register a new backlight device 587 537 * @dev: the device to register 588 538 * @name: the name of the device 589 - * @parent: a pointer to the parent device 539 + * @parent: a pointer to the parent device (often the same as @dev) 590 540 * @devdata: an optional pointer to be stored for private driver use 591 541 * @ops: the backlight operations structure 592 542 * @props: the backlight properties 593 543 * 594 - * @return a struct backlight on success, or an ERR_PTR on error 544 + * Creates and registers new backlight device. When a backlight device 545 + * is registered the configuration must be specified in the @props 546 + * parameter. See description of &backlight_properties. 595 547 * 596 - * Managed backlight_device_register(). The backlight_device returned 597 - * from this function are automatically freed on driver detach. 598 - * See backlight_device_register() for more information. 548 + * RETURNS: 549 + * 550 + * struct backlight on success, or an ERR_PTR on error 599 551 */ 600 552 struct backlight_device *devm_backlight_device_register(struct device *dev, 601 553 const char *name, struct device *parent, void *devdata, ··· 625 573 EXPORT_SYMBOL(devm_backlight_device_register); 626 574 627 575 /** 628 - * devm_backlight_device_unregister - resource managed backlight_device_unregister() 576 + * devm_backlight_device_unregister - unregister backlight device 629 577 * @dev: the device to unregister 630 578 * @bd: the backlight device to unregister 631 579 * 632 - * Deallocated a backlight allocated with devm_backlight_device_register(). 580 + * Deallocates a backlight allocated with devm_backlight_device_register(). 633 581 * Normally this function will not need to be called and the resource management 634 - * code will ensure that the resource is freed. 582 + * code will ensure that the resources are freed. 635 583 */ 636 584 void devm_backlight_device_unregister(struct device *dev, 637 585 struct backlight_device *bd) ··· 673 621 EXPORT_SYMBOL(of_find_backlight_by_node); 674 622 #endif 675 623 676 - /** 677 - * of_find_backlight - Get backlight device 678 - * @dev: Device 679 - * 680 - * This function looks for a property named 'backlight' on the DT node 681 - * connected to @dev and looks up the backlight device. 682 - * 683 - * Call backlight_put() to drop the reference on the backlight device. 684 - * 685 - * Returns: 686 - * A pointer to the backlight device if found. 687 - * Error pointer -EPROBE_DEFER if the DT property is set, but no backlight 688 - * device is found. 689 - * NULL if there's no backlight property. 690 - */ 691 - struct backlight_device *of_find_backlight(struct device *dev) 624 + static struct backlight_device *of_find_backlight(struct device *dev) 692 625 { 693 626 struct backlight_device *bd = NULL; 694 627 struct device_node *np; ··· 699 662 700 663 return bd; 701 664 } 702 - EXPORT_SYMBOL(of_find_backlight); 703 665 704 666 static void devm_backlight_release(void *data) 705 667 { 706 - backlight_put(data); 668 + struct backlight_device *bd = data; 669 + 670 + if (bd) 671 + put_device(&bd->dev); 707 672 } 708 673 709 674 /** 710 - * devm_of_find_backlight - Resource-managed of_find_backlight() 711 - * @dev: Device 675 + * devm_of_find_backlight - find backlight for a device 676 + * @dev: the device 712 677 * 713 - * Device managed version of of_find_backlight(). 714 - * The reference on the backlight device is automatically 678 + * This function looks for a property named 'backlight' on the DT node 679 + * connected to @dev and looks up the backlight device. The lookup is 680 + * device managed so the reference to the backlight device is automatically 715 681 * dropped on driver detach. 682 + * 683 + * RETURNS: 684 + * 685 + * A pointer to the backlight device if found. 686 + * Error pointer -EPROBE_DEFER if the DT property is set, but no backlight 687 + * device is found. NULL if there's no backlight property. 716 688 */ 717 689 struct backlight_device *devm_of_find_backlight(struct device *dev) 718 690 { ··· 733 687 return bd; 734 688 ret = devm_add_action(dev, devm_backlight_release, bd); 735 689 if (ret) { 736 - backlight_put(bd); 690 + put_device(&bd->dev); 737 691 return ERR_PTR(ret); 738 692 } 739 693 return bd;
+1 -6
drivers/video/backlight/bd6107.c
··· 82 82 static int bd6107_backlight_update_status(struct backlight_device *backlight) 83 83 { 84 84 struct bd6107 *bd = bl_get_data(backlight); 85 - int brightness = backlight->props.brightness; 86 - 87 - if (backlight->props.power != FB_BLANK_UNBLANK || 88 - backlight->props.fb_blank != FB_BLANK_UNBLANK || 89 - backlight->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK)) 90 - brightness = 0; 85 + int brightness = backlight_get_brightness(backlight); 91 86 92 87 if (brightness) { 93 88 bd6107_write(bd, BD6107_PORTSEL, BD6107_PORTSEL_LEDM(2) |
+1 -7
drivers/video/backlight/corgi_lcd.c
··· 420 420 static int corgi_bl_update_status(struct backlight_device *bd) 421 421 { 422 422 struct corgi_lcd *lcd = bl_get_data(bd); 423 - int intensity = bd->props.brightness; 424 - 425 - if (bd->props.power != FB_BLANK_UNBLANK) 426 - intensity = 0; 427 - 428 - if (bd->props.fb_blank != FB_BLANK_UNBLANK) 429 - intensity = 0; 423 + int intensity = backlight_get_brightness(bd); 430 424 431 425 if (corgibl_flags & CORGIBL_SUSPENDED) 432 426 intensity = 0;
+9 -17
drivers/video/backlight/cr_bllcd.c
··· 59 59 60 60 static int cr_backlight_set_intensity(struct backlight_device *bd) 61 61 { 62 - int intensity = bd->props.brightness; 63 62 u32 addr = gpio_bar + CRVML_PANEL_PORT; 64 63 u32 cur = inl(addr); 65 64 66 - if (bd->props.power == FB_BLANK_UNBLANK) 67 - intensity = FB_BLANK_UNBLANK; 68 - if (bd->props.fb_blank == FB_BLANK_UNBLANK) 69 - intensity = FB_BLANK_UNBLANK; 70 - if (bd->props.power == FB_BLANK_POWERDOWN) 71 - intensity = FB_BLANK_POWERDOWN; 72 - if (bd->props.fb_blank == FB_BLANK_POWERDOWN) 73 - intensity = FB_BLANK_POWERDOWN; 74 - 75 - if (intensity == FB_BLANK_UNBLANK) { /* FULL ON */ 76 - cur &= ~CRVML_BACKLIGHT_OFF; 77 - outl(cur, addr); 78 - } else if (intensity == FB_BLANK_POWERDOWN) { /* OFF */ 65 + if (backlight_get_brightness(bd) == 0) { 66 + /* OFF */ 79 67 cur |= CRVML_BACKLIGHT_OFF; 80 68 outl(cur, addr); 81 - } /* anything else, don't bother */ 69 + } else { 70 + /* FULL ON */ 71 + cur &= ~CRVML_BACKLIGHT_OFF; 72 + outl(cur, addr); 73 + } 82 74 83 75 return 0; 84 76 } ··· 82 90 u8 intensity; 83 91 84 92 if (cur & CRVML_BACKLIGHT_OFF) 85 - intensity = FB_BLANK_POWERDOWN; 93 + intensity = 0; 86 94 else 87 - intensity = FB_BLANK_UNBLANK; 95 + intensity = 1; 88 96 89 97 return intensity; 90 98 }
+1 -12
drivers/video/backlight/da903x_bl.c
··· 77 77 78 78 static int da903x_backlight_update_status(struct backlight_device *bl) 79 79 { 80 - int brightness = bl->props.brightness; 81 - 82 - if (bl->props.power != FB_BLANK_UNBLANK) 83 - brightness = 0; 84 - 85 - if (bl->props.fb_blank != FB_BLANK_UNBLANK) 86 - brightness = 0; 87 - 88 - if (bl->props.state & BL_CORE_SUSPENDED) 89 - brightness = 0; 90 - 91 - return da903x_backlight_set(bl, brightness); 80 + return da903x_backlight_set(bl, backlight_get_brightness(bl)); 92 81 } 93 82 94 83 static int da903x_backlight_get_brightness(struct backlight_device *bl)
+1 -7
drivers/video/backlight/ep93xx_bl.c
··· 36 36 37 37 static int ep93xxbl_update_status(struct backlight_device *bl) 38 38 { 39 - int brightness = bl->props.brightness; 40 - 41 - if (bl->props.power != FB_BLANK_UNBLANK || 42 - bl->props.fb_blank != FB_BLANK_UNBLANK) 43 - brightness = 0; 44 - 45 - return ep93xxbl_set(bl, brightness); 39 + return ep93xxbl_set(bl, backlight_get_brightness(bl)); 46 40 } 47 41 48 42 static int ep93xxbl_get_brightness(struct backlight_device *bl)
-110
drivers/video/backlight/generic_bl.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * Generic Backlight Driver 4 - * 5 - * Copyright (c) 2004-2008 Richard Purdie 6 - */ 7 - 8 - #include <linux/module.h> 9 - #include <linux/kernel.h> 10 - #include <linux/init.h> 11 - #include <linux/platform_device.h> 12 - #include <linux/mutex.h> 13 - #include <linux/fb.h> 14 - #include <linux/backlight.h> 15 - 16 - static int genericbl_intensity; 17 - static struct backlight_device *generic_backlight_device; 18 - static struct generic_bl_info *bl_machinfo; 19 - 20 - static int genericbl_send_intensity(struct backlight_device *bd) 21 - { 22 - int intensity = bd->props.brightness; 23 - 24 - if (bd->props.power != FB_BLANK_UNBLANK) 25 - intensity = 0; 26 - if (bd->props.state & BL_CORE_FBBLANK) 27 - intensity = 0; 28 - if (bd->props.state & BL_CORE_SUSPENDED) 29 - intensity = 0; 30 - 31 - bl_machinfo->set_bl_intensity(intensity); 32 - 33 - genericbl_intensity = intensity; 34 - 35 - if (bl_machinfo->kick_battery) 36 - bl_machinfo->kick_battery(); 37 - 38 - return 0; 39 - } 40 - 41 - static int genericbl_get_intensity(struct backlight_device *bd) 42 - { 43 - return genericbl_intensity; 44 - } 45 - 46 - static const struct backlight_ops genericbl_ops = { 47 - .options = BL_CORE_SUSPENDRESUME, 48 - .get_brightness = genericbl_get_intensity, 49 - .update_status = genericbl_send_intensity, 50 - }; 51 - 52 - static int genericbl_probe(struct platform_device *pdev) 53 - { 54 - struct backlight_properties props; 55 - struct generic_bl_info *machinfo = dev_get_platdata(&pdev->dev); 56 - const char *name = "generic-bl"; 57 - struct backlight_device *bd; 58 - 59 - bl_machinfo = machinfo; 60 - if (!machinfo->limit_mask) 61 - machinfo->limit_mask = -1; 62 - 63 - if (machinfo->name) 64 - name = machinfo->name; 65 - 66 - memset(&props, 0, sizeof(struct backlight_properties)); 67 - props.type = BACKLIGHT_RAW; 68 - props.max_brightness = machinfo->max_intensity; 69 - bd = devm_backlight_device_register(&pdev->dev, name, &pdev->dev, 70 - NULL, &genericbl_ops, &props); 71 - if (IS_ERR(bd)) 72 - return PTR_ERR(bd); 73 - 74 - platform_set_drvdata(pdev, bd); 75 - 76 - bd->props.power = FB_BLANK_UNBLANK; 77 - bd->props.brightness = machinfo->default_intensity; 78 - backlight_update_status(bd); 79 - 80 - generic_backlight_device = bd; 81 - 82 - dev_info(&pdev->dev, "Generic Backlight Driver Initialized.\n"); 83 - return 0; 84 - } 85 - 86 - static int genericbl_remove(struct platform_device *pdev) 87 - { 88 - struct backlight_device *bd = platform_get_drvdata(pdev); 89 - 90 - bd->props.power = 0; 91 - bd->props.brightness = 0; 92 - backlight_update_status(bd); 93 - 94 - dev_info(&pdev->dev, "Generic Backlight Driver Unloaded\n"); 95 - return 0; 96 - } 97 - 98 - static struct platform_driver genericbl_driver = { 99 - .probe = genericbl_probe, 100 - .remove = genericbl_remove, 101 - .driver = { 102 - .name = "generic-bl", 103 - }, 104 - }; 105 - 106 - module_platform_driver(genericbl_driver); 107 - 108 - MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>"); 109 - MODULE_DESCRIPTION("Generic Backlight Driver"); 110 - MODULE_LICENSE("GPL");
+2 -15
drivers/video/backlight/gpio_backlight.c
··· 21 21 struct gpio_desc *gpiod; 22 22 }; 23 23 24 - static int gpio_backlight_get_next_brightness(struct backlight_device *bl) 25 - { 26 - int brightness = bl->props.brightness; 27 - 28 - if (bl->props.power != FB_BLANK_UNBLANK || 29 - bl->props.fb_blank != FB_BLANK_UNBLANK || 30 - bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK)) 31 - brightness = 0; 32 - 33 - return brightness; 34 - } 35 - 36 24 static int gpio_backlight_update_status(struct backlight_device *bl) 37 25 { 38 26 struct gpio_backlight *gbl = bl_get_data(bl); 39 - int brightness = gpio_backlight_get_next_brightness(bl); 40 27 41 - gpiod_set_value_cansleep(gbl->gpiod, brightness); 28 + gpiod_set_value_cansleep(gbl->gpiod, backlight_get_brightness(bl)); 42 29 43 30 return 0; 44 31 } ··· 95 108 96 109 bl->props.brightness = 1; 97 110 98 - init_brightness = gpio_backlight_get_next_brightness(bl); 111 + init_brightness = backlight_get_brightness(bl); 99 112 ret = gpiod_direction_output(gbl->gpiod, init_brightness); 100 113 if (ret) { 101 114 dev_err(dev, "failed to set initial brightness\n");
+1 -5
drivers/video/backlight/hp680_bl.c
··· 33 33 { 34 34 unsigned long flags; 35 35 u16 v; 36 - int intensity = bd->props.brightness; 36 + int intensity = backlight_get_brightness(bd); 37 37 38 - if (bd->props.power != FB_BLANK_UNBLANK) 39 - intensity = 0; 40 - if (bd->props.fb_blank != FB_BLANK_UNBLANK) 41 - intensity = 0; 42 38 if (hp680bl_suspended) 43 39 intensity = 0; 44 40
+6 -2
drivers/video/backlight/ili922x.c
··· 107 107 * lower frequency when the registers are read/written. 108 108 * The macro sets the frequency in the spi_transfer structure if 109 109 * the frequency exceeds the maximum value. 110 + * @s: pointer to an SPI device 111 + * @x: pointer to the read/write buffer pair 110 112 */ 111 113 #define CHECK_FREQ_REG(s, x) \ 112 114 do { \ ··· 123 121 124 122 #define set_tx_byte(b) (tx_invert ? ~(b) : b) 125 123 126 - /** 124 + /* 127 125 * ili922x_id - id as set by manufacturer 128 126 */ 129 127 static int ili922x_id = 1; ··· 132 130 static int tx_invert; 133 131 module_param(tx_invert, int, 0); 134 132 135 - /** 133 + /* 136 134 * driver's private structure 137 135 */ 138 136 struct ili922x { ··· 295 293 #ifdef DEBUG 296 294 /** 297 295 * ili922x_reg_dump - dump all registers 296 + * 297 + * @spi: pointer to an SPI device 298 298 */ 299 299 static void ili922x_reg_dump(struct spi_device *spi) 300 300 {
+1 -1
drivers/video/backlight/jornada720_bl.c
··· 54 54 jornada_ssp_start(); 55 55 56 56 /* If backlight is off then really turn it off */ 57 - if ((bd->props.power != FB_BLANK_UNBLANK) || (bd->props.fb_blank != FB_BLANK_UNBLANK)) { 57 + if (backlight_is_blank(bd)) { 58 58 ret = jornada_ssp_byte(BRIGHTNESSOFF); 59 59 if (ret != TXDUMMY) { 60 60 dev_info(&bd->dev, "brightness off timeout\n");
+1 -5
drivers/video/backlight/kb3886_bl.c
··· 87 87 88 88 static int kb3886bl_send_intensity(struct backlight_device *bd) 89 89 { 90 - int intensity = bd->props.brightness; 90 + int intensity = backlight_get_brightness(bd); 91 91 92 - if (bd->props.power != FB_BLANK_UNBLANK) 93 - intensity = 0; 94 - if (bd->props.fb_blank != FB_BLANK_UNBLANK) 95 - intensity = 0; 96 92 if (kb3886bl_flags & KB3886BL_SUSPENDED) 97 93 intensity = 0; 98 94
+1
drivers/video/backlight/lcd.c
··· 179 179 * lcd_device_register - register a new object of lcd_device class. 180 180 * @name: the name of the new object(must be the same as the name of the 181 181 * respective framebuffer device). 182 + * @parent: pointer to the parent's struct device . 182 183 * @devdata: an optional pointer to be stored in the device. The 183 184 * methods may retrieve it by using lcd_get_data(ld). 184 185 * @ops: the lcd operations structure.
+1 -6
drivers/video/backlight/led_bl.c
··· 54 54 static int led_bl_update_status(struct backlight_device *bl) 55 55 { 56 56 struct led_bl_data *priv = bl_get_data(bl); 57 - int brightness = bl->props.brightness; 58 - 59 - if (bl->props.power != FB_BLANK_UNBLANK || 60 - bl->props.fb_blank != FB_BLANK_UNBLANK || 61 - bl->props.state & BL_CORE_FBBLANK) 62 - brightness = 0; 57 + int brightness = backlight_get_brightness(bl); 63 58 64 59 if (brightness > 0) 65 60 led_bl_set_brightness(priv, brightness);
+2 -8
drivers/video/backlight/lm3533_bl.c
··· 39 39 static int lm3533_bl_update_status(struct backlight_device *bd) 40 40 { 41 41 struct lm3533_bl *bl = bl_get_data(bd); 42 - int brightness = bd->props.brightness; 43 42 44 - if (bd->props.power != FB_BLANK_UNBLANK) 45 - brightness = 0; 46 - if (bd->props.fb_blank != FB_BLANK_UNBLANK) 47 - brightness = 0; 48 - 49 - return lm3533_ctrlbank_set_brightness(&bl->cb, (u8)brightness); 43 + return lm3533_ctrlbank_set_brightness(&bl->cb, backlight_get_brightness(bd)); 50 44 } 51 45 52 46 static int lm3533_bl_get_brightness(struct backlight_device *bd) ··· 229 235 static umode_t lm3533_bl_attr_is_visible(struct kobject *kobj, 230 236 struct attribute *attr, int n) 231 237 { 232 - struct device *dev = container_of(kobj, struct device, kobj); 238 + struct device *dev = kobj_to_dev(kobj); 233 239 struct lm3533_bl *bl = dev_get_drvdata(dev); 234 240 umode_t mode = attr->mode; 235 241
+2 -2
drivers/video/backlight/lm3630a_bl.c
··· 391 391 return ret; 392 392 393 393 for (i = 0; i < num_sources; i++) { 394 - if (sources[i] < LM3630A_SINK_0 || sources[i] > LM3630A_SINK_1) 394 + if (sources[i] != LM3630A_SINK_0 && sources[i] != LM3630A_SINK_1) 395 395 return -EINVAL; 396 396 397 397 ret |= BIT(sources[i]); ··· 412 412 if (ret) 413 413 return ret; 414 414 415 - if (bank < LM3630A_BANK_0 || bank > LM3630A_BANK_1) 415 + if (bank != LM3630A_BANK_0 && bank != LM3630A_BANK_1) 416 416 return -EINVAL; 417 417 418 418 led_sources = lm3630a_parse_led_sources(node, BIT(bank));
-9
drivers/video/backlight/lms501kf03.c
··· 9 9 #include <linux/backlight.h> 10 10 #include <linux/delay.h> 11 11 #include <linux/fb.h> 12 - #include <linux/gpio.h> 13 12 #include <linux/lcd.h> 14 13 #include <linux/module.h> 15 14 #include <linux/spi/spi.h> ··· 86 87 0x6a, 0x73, 0x7a, 0x82, 0x8a, 0x91, 0x98, 0xa1, 0xa8, 0xb0, 87 88 0xb7, 0xc1, 0xc9, 0xcf, 0xd9, 0xe3, 0xea, 0xf4, 0xff, 0x00, 88 89 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 89 - }; 90 - 91 - static const unsigned char seq_up_dn[] = { 92 - 0x36, 0x10, 93 - }; 94 - 95 - static const unsigned char seq_sleep_in[] = { 96 - 0x10, 97 90 }; 98 91 99 92 static const unsigned char seq_sleep_out[] = {
+1 -5
drivers/video/backlight/locomolcd.c
··· 111 111 112 112 static int locomolcd_set_intensity(struct backlight_device *bd) 113 113 { 114 - int intensity = bd->props.brightness; 114 + int intensity = backlight_get_brightness(bd); 115 115 116 - if (bd->props.power != FB_BLANK_UNBLANK) 117 - intensity = 0; 118 - if (bd->props.fb_blank != FB_BLANK_UNBLANK) 119 - intensity = 0; 120 116 if (locomolcd_flags & LOCOMOLCD_SUSPENDED) 121 117 intensity = 0; 122 118
+1 -6
drivers/video/backlight/lv5207lp.c
··· 46 46 static int lv5207lp_backlight_update_status(struct backlight_device *backlight) 47 47 { 48 48 struct lv5207lp *lv = bl_get_data(backlight); 49 - int brightness = backlight->props.brightness; 50 - 51 - if (backlight->props.power != FB_BLANK_UNBLANK || 52 - backlight->props.fb_blank != FB_BLANK_UNBLANK || 53 - backlight->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK)) 54 - brightness = 0; 49 + int brightness = backlight_get_brightness(backlight); 55 50 56 51 if (brightness) { 57 52 lv5207lp_write(lv, LV5207LP_CTRL1,
+1 -12
drivers/video/backlight/max8925_bl.c
··· 64 64 65 65 static int max8925_backlight_update_status(struct backlight_device *bl) 66 66 { 67 - int brightness = bl->props.brightness; 68 - 69 - if (bl->props.power != FB_BLANK_UNBLANK) 70 - brightness = 0; 71 - 72 - if (bl->props.fb_blank != FB_BLANK_UNBLANK) 73 - brightness = 0; 74 - 75 - if (bl->props.state & BL_CORE_SUSPENDED) 76 - brightness = 0; 77 - 78 - return max8925_backlight_set(bl, brightness); 67 + return max8925_backlight_set(bl, backlight_get_brightness(bl)); 79 68 } 80 69 81 70 static int max8925_backlight_get_brightness(struct backlight_device *bl)
-162
drivers/video/backlight/ot200_bl.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * Copyright (C) 2012 Bachmann electronic GmbH 4 - * Christian Gmeiner <christian.gmeiner@gmail.com> 5 - * 6 - * Backlight driver for ot200 visualisation device from 7 - * Bachmann electronic GmbH. 8 - */ 9 - 10 - #include <linux/module.h> 11 - #include <linux/fb.h> 12 - #include <linux/backlight.h> 13 - #include <linux/gpio.h> 14 - #include <linux/platform_device.h> 15 - #include <linux/cs5535.h> 16 - 17 - static struct cs5535_mfgpt_timer *pwm_timer; 18 - 19 - /* this array defines the mapping of brightness in % to pwm frequency */ 20 - static const u8 dim_table[101] = {0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 21 - 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 22 - 4, 5, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 9, 9, 23 - 10, 10, 11, 11, 12, 12, 13, 14, 15, 15, 16, 24 - 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28, 25 - 30, 31, 33, 35, 37, 39, 41, 43, 45, 47, 50, 26 - 53, 55, 58, 61, 65, 68, 72, 75, 79, 84, 88, 27 - 93, 97, 103, 108, 114, 120, 126, 133, 140, 28 - 147, 155, 163}; 29 - 30 - struct ot200_backlight_data { 31 - int current_brightness; 32 - }; 33 - 34 - #define GPIO_DIMM 27 35 - #define SCALE 1 36 - #define CMP1MODE 0x2 /* compare on GE; output high on compare 37 - * greater than or equal */ 38 - #define PWM_SETUP (SCALE | CMP1MODE << 6 | MFGPT_SETUP_CNTEN) 39 - #define MAX_COMP2 163 40 - 41 - static int ot200_backlight_update_status(struct backlight_device *bl) 42 - { 43 - struct ot200_backlight_data *data = bl_get_data(bl); 44 - int brightness = bl->props.brightness; 45 - 46 - if (bl->props.state & BL_CORE_FBBLANK) 47 - brightness = 0; 48 - 49 - /* enable or disable PWM timer */ 50 - if (brightness == 0) 51 - cs5535_mfgpt_write(pwm_timer, MFGPT_REG_SETUP, 0); 52 - else if (data->current_brightness == 0) { 53 - cs5535_mfgpt_write(pwm_timer, MFGPT_REG_COUNTER, 0); 54 - cs5535_mfgpt_write(pwm_timer, MFGPT_REG_SETUP, 55 - MFGPT_SETUP_CNTEN); 56 - } 57 - 58 - /* apply new brightness value */ 59 - cs5535_mfgpt_write(pwm_timer, MFGPT_REG_CMP1, 60 - MAX_COMP2 - dim_table[brightness]); 61 - data->current_brightness = brightness; 62 - 63 - return 0; 64 - } 65 - 66 - static int ot200_backlight_get_brightness(struct backlight_device *bl) 67 - { 68 - struct ot200_backlight_data *data = bl_get_data(bl); 69 - return data->current_brightness; 70 - } 71 - 72 - static const struct backlight_ops ot200_backlight_ops = { 73 - .update_status = ot200_backlight_update_status, 74 - .get_brightness = ot200_backlight_get_brightness, 75 - }; 76 - 77 - static int ot200_backlight_probe(struct platform_device *pdev) 78 - { 79 - struct backlight_device *bl; 80 - struct ot200_backlight_data *data; 81 - struct backlight_properties props; 82 - int retval = 0; 83 - 84 - /* request gpio */ 85 - if (devm_gpio_request(&pdev->dev, GPIO_DIMM, 86 - "ot200 backlight dimmer") < 0) { 87 - dev_err(&pdev->dev, "failed to request GPIO %d\n", GPIO_DIMM); 88 - return -ENODEV; 89 - } 90 - 91 - /* request timer */ 92 - pwm_timer = cs5535_mfgpt_alloc_timer(7, MFGPT_DOMAIN_ANY); 93 - if (!pwm_timer) { 94 - dev_err(&pdev->dev, "MFGPT 7 not available\n"); 95 - return -ENODEV; 96 - } 97 - 98 - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); 99 - if (!data) { 100 - retval = -ENOMEM; 101 - goto error_devm_kzalloc; 102 - } 103 - 104 - /* setup gpio */ 105 - cs5535_gpio_set(GPIO_DIMM, GPIO_OUTPUT_ENABLE); 106 - cs5535_gpio_set(GPIO_DIMM, GPIO_OUTPUT_AUX1); 107 - 108 - /* setup timer */ 109 - cs5535_mfgpt_write(pwm_timer, MFGPT_REG_CMP1, 0); 110 - cs5535_mfgpt_write(pwm_timer, MFGPT_REG_CMP2, MAX_COMP2); 111 - cs5535_mfgpt_write(pwm_timer, MFGPT_REG_SETUP, PWM_SETUP); 112 - 113 - data->current_brightness = 100; 114 - props.max_brightness = 100; 115 - props.brightness = 100; 116 - props.type = BACKLIGHT_RAW; 117 - 118 - bl = devm_backlight_device_register(&pdev->dev, dev_name(&pdev->dev), 119 - &pdev->dev, data, &ot200_backlight_ops, 120 - &props); 121 - if (IS_ERR(bl)) { 122 - dev_err(&pdev->dev, "failed to register backlight\n"); 123 - retval = PTR_ERR(bl); 124 - goto error_devm_kzalloc; 125 - } 126 - 127 - platform_set_drvdata(pdev, bl); 128 - 129 - return 0; 130 - 131 - error_devm_kzalloc: 132 - cs5535_mfgpt_free_timer(pwm_timer); 133 - return retval; 134 - } 135 - 136 - static int ot200_backlight_remove(struct platform_device *pdev) 137 - { 138 - /* on module unload set brightness to 100% */ 139 - cs5535_mfgpt_write(pwm_timer, MFGPT_REG_COUNTER, 0); 140 - cs5535_mfgpt_write(pwm_timer, MFGPT_REG_SETUP, MFGPT_SETUP_CNTEN); 141 - cs5535_mfgpt_write(pwm_timer, MFGPT_REG_CMP1, 142 - MAX_COMP2 - dim_table[100]); 143 - 144 - cs5535_mfgpt_free_timer(pwm_timer); 145 - 146 - return 0; 147 - } 148 - 149 - static struct platform_driver ot200_backlight_driver = { 150 - .driver = { 151 - .name = "ot200-backlight", 152 - }, 153 - .probe = ot200_backlight_probe, 154 - .remove = ot200_backlight_remove, 155 - }; 156 - 157 - module_platform_driver(ot200_backlight_driver); 158 - 159 - MODULE_DESCRIPTION("backlight driver for ot200 visualisation device"); 160 - MODULE_AUTHOR("Christian Gmeiner <christian.gmeiner@gmail.com>"); 161 - MODULE_LICENSE("GPL"); 162 - MODULE_ALIAS("platform:ot200-backlight");
+1 -6
drivers/video/backlight/pwm_bl.c
··· 108 108 static int pwm_backlight_update_status(struct backlight_device *bl) 109 109 { 110 110 struct pwm_bl_data *pb = bl_get_data(bl); 111 - int brightness = bl->props.brightness; 111 + int brightness = backlight_get_brightness(bl); 112 112 struct pwm_state state; 113 - 114 - if (bl->props.power != FB_BLANK_UNBLANK || 115 - bl->props.fb_blank != FB_BLANK_UNBLANK || 116 - bl->props.state & BL_CORE_FBBLANK) 117 - brightness = 0; 118 113 119 114 if (pb->notify) 120 115 brightness = pb->notify(pb->dev, brightness);
+1 -14
drivers/video/backlight/qcom-wled.c
··· 433 433 static int wled_update_status(struct backlight_device *bl) 434 434 { 435 435 struct wled *wled = bl_get_data(bl); 436 - u16 brightness = bl->props.brightness; 436 + u16 brightness = backlight_get_brightness(bl); 437 437 int rc = 0; 438 - 439 - if (bl->props.power != FB_BLANK_UNBLANK || 440 - bl->props.fb_blank != FB_BLANK_UNBLANK || 441 - bl->props.state & BL_CORE_FBBLANK) 442 - brightness = 0; 443 438 444 439 mutex_lock(&wled->lock); 445 440 if (brightness) { ··· 1280 1285 static const struct wled_var_cfg wled4_string_i_limit_cfg = { 1281 1286 .values = wled4_string_i_limit_values, 1282 1287 .size = ARRAY_SIZE(wled4_string_i_limit_values), 1283 - }; 1284 - 1285 - static const struct wled_var_cfg wled3_string_cfg = { 1286 - .size = 8, 1287 - }; 1288 - 1289 - static const struct wled_var_cfg wled4_string_cfg = { 1290 - .size = 16, 1291 1288 }; 1292 1289 1293 1290 static const struct wled_var_cfg wled5_mod_sel_cfg = {
+31 -21
drivers/video/backlight/sky81452-backlight.c
··· 8 8 9 9 #include <linux/backlight.h> 10 10 #include <linux/err.h> 11 - #include <linux/gpio.h> 11 + #include <linux/gpio/consumer.h> 12 12 #include <linux/init.h> 13 13 #include <linux/kernel.h> 14 14 #include <linux/module.h> 15 15 #include <linux/of.h> 16 - #include <linux/of_gpio.h> 17 16 #include <linux/platform_device.h> 18 17 #include <linux/regmap.h> 19 - #include <linux/platform_data/sky81452-backlight.h> 20 18 #include <linux/slab.h> 21 19 22 20 /* registers */ ··· 39 41 40 42 #define SKY81452_DEFAULT_NAME "lcd-backlight" 41 43 #define SKY81452_MAX_BRIGHTNESS (SKY81452_CS + 1) 44 + 45 + /** 46 + * struct sky81452_platform_data 47 + * @name: backlight driver name. 48 + * If it is not defined, default name is lcd-backlight. 49 + * @gpiod_enable:GPIO descriptor which control EN pin 50 + * @enable: Enable mask for current sink channel 1, 2, 3, 4, 5 and 6. 51 + * @ignore_pwm: true if DPWMI should be ignored. 52 + * @dpwm_mode: true is DPWM dimming mode, otherwise Analog dimming mode. 53 + * @phase_shift:true is phase shift mode. 54 + * @short_detection_threshold: It should be one of 4, 5, 6 and 7V. 55 + * @boost_current_limit: It should be one of 2300, 2750mA. 56 + */ 57 + struct sky81452_bl_platform_data { 58 + const char *name; 59 + struct gpio_desc *gpiod_enable; 60 + unsigned int enable; 61 + bool ignore_pwm; 62 + bool dpwm_mode; 63 + bool phase_shift; 64 + unsigned int short_detection_threshold; 65 + unsigned int boost_current_limit; 66 + }; 42 67 43 68 #define CTZ(b) __builtin_ctz(b) 44 69 ··· 203 182 pdata->ignore_pwm = of_property_read_bool(np, "skyworks,ignore-pwm"); 204 183 pdata->dpwm_mode = of_property_read_bool(np, "skyworks,dpwm-mode"); 205 184 pdata->phase_shift = of_property_read_bool(np, "skyworks,phase-shift"); 206 - pdata->gpio_enable = of_get_gpio(np, 0); 185 + pdata->gpiod_enable = devm_gpiod_get_optional(dev, NULL, GPIOD_OUT_HIGH); 207 186 208 187 ret = of_property_count_u32_elems(np, "led-sources"); 209 188 if (ret < 0) { ··· 273 252 { 274 253 struct device *dev = &pdev->dev; 275 254 struct regmap *regmap = dev_get_drvdata(dev->parent); 276 - struct sky81452_bl_platform_data *pdata = dev_get_platdata(dev); 255 + struct sky81452_bl_platform_data *pdata; 277 256 struct backlight_device *bd; 278 257 struct backlight_properties props; 279 258 const char *name; 280 259 int ret; 281 260 282 - if (!pdata) { 283 - pdata = sky81452_bl_parse_dt(dev); 284 - if (IS_ERR(pdata)) 285 - return PTR_ERR(pdata); 286 - } 287 - 288 - if (gpio_is_valid(pdata->gpio_enable)) { 289 - ret = devm_gpio_request_one(dev, pdata->gpio_enable, 290 - GPIOF_OUT_INIT_HIGH, "sky81452-en"); 291 - if (ret < 0) { 292 - dev_err(dev, "failed to request GPIO. err=%d\n", ret); 293 - return ret; 294 - } 295 - } 261 + pdata = sky81452_bl_parse_dt(dev); 262 + if (IS_ERR(pdata)) 263 + return PTR_ERR(pdata); 296 264 297 265 ret = sky81452_bl_init_device(regmap, pdata); 298 266 if (ret < 0) { ··· 322 312 bd->props.brightness = 0; 323 313 backlight_update_status(bd); 324 314 325 - if (gpio_is_valid(pdata->gpio_enable)) 326 - gpio_set_value_cansleep(pdata->gpio_enable, 0); 315 + if (pdata->gpiod_enable) 316 + gpiod_set_value_cansleep(pdata->gpiod_enable, 0); 327 317 328 318 return 0; 329 319 }
+1 -9
drivers/video/backlight/tps65217_bl.c
··· 77 77 { 78 78 struct tps65217_bl *tps65217_bl = bl_get_data(bl); 79 79 int rc; 80 - int brightness = bl->props.brightness; 81 - 82 - if (bl->props.state & BL_CORE_SUSPENDED) 83 - brightness = 0; 84 - 85 - if ((bl->props.power != FB_BLANK_UNBLANK) || 86 - (bl->props.fb_blank != FB_BLANK_UNBLANK)) 87 - /* framebuffer in low power mode or blanking active */ 88 - brightness = 0; 80 + int brightness = backlight_get_brightness(bl); 89 81 90 82 if (brightness > 0) { 91 83 rc = tps65217_reg_write(tps65217_bl->tps,
+1 -12
drivers/video/backlight/wm831x_bl.c
··· 91 91 92 92 static int wm831x_backlight_update_status(struct backlight_device *bl) 93 93 { 94 - int brightness = bl->props.brightness; 95 - 96 - if (bl->props.power != FB_BLANK_UNBLANK) 97 - brightness = 0; 98 - 99 - if (bl->props.fb_blank != FB_BLANK_UNBLANK) 100 - brightness = 0; 101 - 102 - if (bl->props.state & BL_CORE_SUSPENDED) 103 - brightness = 0; 104 - 105 - return wm831x_backlight_set(bl, brightness); 94 + return wm831x_backlight_set(bl, backlight_get_brightness(bl)); 106 95 } 107 96 108 97 static int wm831x_backlight_get_brightness(struct backlight_device *bl)
+325 -74
include/linux/backlight.h
··· 14 14 #include <linux/mutex.h> 15 15 #include <linux/notifier.h> 16 16 17 - /* Notes on locking: 17 + /** 18 + * enum backlight_update_reason - what method was used to update backlight 18 19 * 19 - * backlight_device->ops_lock is an internal backlight lock protecting the 20 - * ops pointer and no code outside the core should need to touch it. 21 - * 22 - * Access to update_status() is serialised by the update_lock mutex since 23 - * most drivers seem to need this and historically get it wrong. 24 - * 25 - * Most drivers don't need locking on their get_brightness() method. 26 - * If yours does, you need to implement it in the driver. You can use the 27 - * update_lock mutex if appropriate. 28 - * 29 - * Any other use of the locks below is probably wrong. 20 + * A driver indicates the method (reason) used for updating the backlight 21 + * when calling backlight_force_update(). 30 22 */ 31 - 32 23 enum backlight_update_reason { 24 + /** 25 + * @BACKLIGHT_UPDATE_HOTKEY: The backlight was updated using a hot-key. 26 + */ 33 27 BACKLIGHT_UPDATE_HOTKEY, 28 + 29 + /** 30 + * @BACKLIGHT_UPDATE_SYSFS: The backlight was updated using sysfs. 31 + */ 34 32 BACKLIGHT_UPDATE_SYSFS, 35 33 }; 36 34 35 + /** 36 + * enum backlight_type - the type of backlight control 37 + * 38 + * The type of interface used to control the backlight. 39 + */ 37 40 enum backlight_type { 41 + /** 42 + * @BACKLIGHT_RAW: 43 + * 44 + * The backlight is controlled using hardware registers. 45 + */ 38 46 BACKLIGHT_RAW = 1, 47 + 48 + /** 49 + * @BACKLIGHT_PLATFORM: 50 + * 51 + * The backlight is controlled using a platform-specific interface. 52 + */ 39 53 BACKLIGHT_PLATFORM, 54 + 55 + /** 56 + * @BACKLIGHT_FIRMWARE: 57 + * 58 + * The backlight is controlled using a standard firmware interface. 59 + */ 40 60 BACKLIGHT_FIRMWARE, 61 + 62 + /** 63 + * @BACKLIGHT_TYPE_MAX: Number of entries. 64 + */ 41 65 BACKLIGHT_TYPE_MAX, 42 66 }; 43 67 68 + /** 69 + * enum backlight_notification - the type of notification 70 + * 71 + * The notifications that is used for notification sent to the receiver 72 + * that registered notifications using backlight_register_notifier(). 73 + */ 44 74 enum backlight_notification { 75 + /** 76 + * @BACKLIGHT_REGISTERED: The backlight device is registered. 77 + */ 45 78 BACKLIGHT_REGISTERED, 79 + 80 + /** 81 + * @BACKLIGHT_UNREGISTERED: The backlight revice is unregistered. 82 + */ 46 83 BACKLIGHT_UNREGISTERED, 47 84 }; 48 85 86 + /** enum backlight_scale - the type of scale used for brightness values 87 + * 88 + * The type of scale used for brightness values. 89 + */ 49 90 enum backlight_scale { 91 + /** 92 + * @BACKLIGHT_SCALE_UNKNOWN: The scale is unknown. 93 + */ 50 94 BACKLIGHT_SCALE_UNKNOWN = 0, 95 + 96 + /** 97 + * @BACKLIGHT_SCALE_LINEAR: The scale is linear. 98 + * 99 + * The linear scale will increase brightness the same for each step. 100 + */ 51 101 BACKLIGHT_SCALE_LINEAR, 102 + 103 + /** 104 + * @BACKLIGHT_SCALE_NON_LINEAR: The scale is not linear. 105 + * 106 + * This is often used when the brightness values tries to adjust to 107 + * the relative perception of the eye demanding a non-linear scale. 108 + */ 52 109 BACKLIGHT_SCALE_NON_LINEAR, 53 110 }; 54 111 55 112 struct backlight_device; 56 113 struct fb_info; 57 114 115 + /** 116 + * struct backlight_ops - backlight operations 117 + * 118 + * The backlight operations are specified when the backlight device is registered. 119 + */ 58 120 struct backlight_ops { 121 + /** 122 + * @options: Configure how operations are called from the core. 123 + * 124 + * The options parameter is used to adjust the behaviour of the core. 125 + * Set BL_CORE_SUSPENDRESUME to get the update_status() operation called 126 + * upon suspend and resume. 127 + */ 59 128 unsigned int options; 60 129 61 130 #define BL_CORE_SUSPENDRESUME (1 << 0) 62 131 63 - /* Notify the backlight driver some property has changed */ 132 + /** 133 + * @update_status: Operation called when properties have changed. 134 + * 135 + * Notify the backlight driver some property has changed. 136 + * The update_status operation is protected by the update_lock. 137 + * 138 + * The backlight driver is expected to use backlight_is_blank() 139 + * to check if the display is blanked and set brightness accordingly. 140 + * update_status() is called when any of the properties has changed. 141 + * 142 + * RETURNS: 143 + * 144 + * 0 on success, negative error code if any failure occurred. 145 + */ 64 146 int (*update_status)(struct backlight_device *); 65 - /* Return the current backlight brightness (accounting for power, 66 - fb_blank etc.) */ 147 + 148 + /** 149 + * @get_brightness: Return the current backlight brightness. 150 + * 151 + * The driver may implement this as a readback from the HW. 152 + * This operation is optional and if not present then the current 153 + * brightness property value is used. 154 + * 155 + * RETURNS: 156 + * 157 + * A brightness value which is 0 or a positive number. 158 + * On failure a negative error code is returned. 159 + */ 67 160 int (*get_brightness)(struct backlight_device *); 68 - /* Check if given framebuffer device is the one bound to this backlight; 69 - return 0 if not, !=0 if it is. If NULL, backlight always matches the fb. */ 70 - int (*check_fb)(struct backlight_device *, struct fb_info *); 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); 71 175 }; 72 176 73 - /* This structure defines all the properties of a backlight */ 177 + /** 178 + * struct backlight_properties - backlight properties 179 + * 180 + * This structure defines all the properties of a backlight. 181 + */ 74 182 struct backlight_properties { 75 - /* Current User requested brightness (0 - max_brightness) */ 183 + /** 184 + * @brightness: The current brightness requested by the user. 185 + * 186 + * The backlight core makes sure the range is (0 to max_brightness) 187 + * when the brightness is set via the sysfs attribute: 188 + * /sys/class/backlight/<backlight>/brightness. 189 + * 190 + * This value can be set in the backlight_properties passed 191 + * to devm_backlight_device_register() to set a default brightness 192 + * value. 193 + */ 76 194 int brightness; 77 - /* Maximal value for brightness (read-only) */ 195 + 196 + /** 197 + * @max_brightness: The maximum brightness value. 198 + * 199 + * This value must be set in the backlight_properties passed to 200 + * devm_backlight_device_register() and shall not be modified by the 201 + * driver after registration. 202 + */ 78 203 int max_brightness; 79 - /* Current FB Power mode (0: full on, 1..3: power saving 80 - modes; 4: full off), see FB_BLANK_XXX */ 204 + 205 + /** 206 + * @power: The current power mode. 207 + * 208 + * User space can configure the power mode using the sysfs 209 + * attribute: /sys/class/backlight/<backlight>/bl_power 210 + * When the power property is updated update_status() is called. 211 + * 212 + * The possible values are: (0: full on, 1 to 3: power saving 213 + * modes; 4: full off), see FB_BLANK_XXX. 214 + * 215 + * When the backlight device is enabled @power is set 216 + * to FB_BLANK_UNBLANK. When the backlight device is disabled 217 + * @power is set to FB_BLANK_POWERDOWN. 218 + */ 81 219 int power; 82 - /* FB Blanking active? (values as for power) */ 83 - /* Due to be removed, please use (state & BL_CORE_FBBLANK) */ 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 + */ 84 238 int fb_blank; 85 - /* Backlight type */ 239 + 240 + /** 241 + * @type: The type of backlight supported. 242 + * 243 + * The backlight type allows userspace to make appropriate 244 + * policy decisions based on the backlight type. 245 + * 246 + * This value must be set in the backlight_properties 247 + * passed to devm_backlight_device_register(). 248 + */ 86 249 enum backlight_type type; 87 - /* Flags used to signal drivers of state changes */ 250 + 251 + /** 252 + * @state: The state of the backlight core. 253 + * 254 + * The state is a bitmask. BL_CORE_FBBLANK is set when the display 255 + * is expected to be blank. BL_CORE_SUSPENDED is set when the 256 + * driver is suspended. 257 + * 258 + * backlight drivers are expected to use backlight_is_blank() 259 + * in their update_status() operation rather than reading the 260 + * state property. 261 + * 262 + * The state is maintained by the core and drivers may not modify it. 263 + */ 88 264 unsigned int state; 89 - /* Type of the brightness scale (linear, non-linear, ...) */ 90 - enum backlight_scale scale; 91 265 92 266 #define BL_CORE_SUSPENDED (1 << 0) /* backlight is suspended */ 93 267 #define BL_CORE_FBBLANK (1 << 1) /* backlight is under an fb blank event */ 94 268 269 + /** 270 + * @scale: The type of the brightness scale. 271 + */ 272 + enum backlight_scale scale; 95 273 }; 96 274 275 + /** 276 + * struct backlight_device - backlight device data 277 + * 278 + * This structure holds all data required by a backlight device. 279 + */ 97 280 struct backlight_device { 98 - /* Backlight properties */ 281 + /** 282 + * @props: Backlight properties 283 + */ 99 284 struct backlight_properties props; 100 285 101 - /* Serialise access to update_status method */ 286 + /** 287 + * @update_lock: The lock used when calling the update_status() operation. 288 + * 289 + * update_lock is an internal backlight lock that serialise access 290 + * to the update_status() operation. The backlight core holds the update_lock 291 + * when calling the update_status() operation. The update_lock shall not 292 + * be used by backlight drivers. 293 + */ 102 294 struct mutex update_lock; 103 295 104 - /* This protects the 'ops' field. If 'ops' is NULL, the driver that 105 - registered this device has been unloaded, and if class_get_devdata() 106 - points to something in the body of that driver, it is also invalid. */ 296 + /** 297 + * @ops_lock: The lock used around everything related to backlight_ops. 298 + * 299 + * ops_lock is an internal backlight lock that protects the ops pointer 300 + * and is used around all accesses to ops and when the operations are 301 + * invoked. The ops_lock shall not be used by backlight drivers. 302 + */ 107 303 struct mutex ops_lock; 304 + 305 + /** 306 + * @ops: Pointer to the backlight operations. 307 + * 308 + * If ops is NULL, the driver that registered this device has been unloaded, 309 + * and if class_get_devdata() points to something in the body of that driver, 310 + * it is also invalid. 311 + */ 108 312 const struct backlight_ops *ops; 109 313 110 - /* The framebuffer notifier block */ 314 + /** 315 + * @fb_notif: The framebuffer notifier block 316 + */ 111 317 struct notifier_block fb_notif; 112 318 113 - /* list entry of all registered backlight devices */ 319 + /** 320 + * @entry: List entry of all registered backlight devices 321 + */ 114 322 struct list_head entry; 115 323 324 + /** 325 + * @dev: Parent device. 326 + */ 116 327 struct device dev; 117 328 118 - /* Multiple framebuffers may share one backlight device */ 329 + /** 330 + * @fb_bl_on: The state of individual fbdev's. 331 + * 332 + * Multiple fbdev's may share one backlight device. The fb_bl_on 333 + * records the state of the individual fbdev. 334 + */ 119 335 bool fb_bl_on[FB_MAX]; 120 336 337 + /** 338 + * @use_count: The number of uses of fb_bl_on. 339 + */ 121 340 int use_count; 122 341 }; 123 342 343 + /** 344 + * backlight_update_status - force an update of the backlight device status 345 + * @bd: the backlight device 346 + */ 124 347 static inline int backlight_update_status(struct backlight_device *bd) 125 348 { 126 349 int ret = -ENOENT; ··· 389 166 } 390 167 391 168 /** 392 - * backlight_put - Drop backlight reference 393 - * @bd: the backlight device to put 169 + * backlight_is_blank - Return true if display is expected to be blank 170 + * @bd: the backlight device 171 + * 172 + * Display is expected to be blank if any of these is true:: 173 + * 174 + * 1) if power in not UNBLANK 175 + * 2) if fb_blank is not UNBLANK 176 + * 3) if state indicate BLANK or SUSPENDED 177 + * 178 + * Returns true if display is expected to be blank, false otherwise. 394 179 */ 395 - static inline void backlight_put(struct backlight_device *bd) 180 + static inline bool backlight_is_blank(const struct backlight_device *bd) 396 181 { 397 - if (bd) 398 - put_device(&bd->dev); 182 + return bd->props.power != FB_BLANK_UNBLANK || 183 + bd->props.fb_blank != FB_BLANK_UNBLANK || 184 + bd->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK); 399 185 } 400 186 401 - extern struct backlight_device *backlight_device_register(const char *name, 402 - struct device *dev, void *devdata, const struct backlight_ops *ops, 403 - const struct backlight_properties *props); 404 - extern struct backlight_device *devm_backlight_device_register( 405 - struct device *dev, const char *name, struct device *parent, 406 - void *devdata, const struct backlight_ops *ops, 407 - const struct backlight_properties *props); 408 - extern void backlight_device_unregister(struct backlight_device *bd); 409 - extern void devm_backlight_device_unregister(struct device *dev, 410 - struct backlight_device *bd); 411 - extern void backlight_force_update(struct backlight_device *bd, 412 - enum backlight_update_reason reason); 413 - extern int backlight_register_notifier(struct notifier_block *nb); 414 - extern int backlight_unregister_notifier(struct notifier_block *nb); 415 - extern struct backlight_device *backlight_device_get_by_type(enum backlight_type type); 187 + /** 188 + * backlight_get_brightness - Returns the current brightness value 189 + * @bd: the backlight device 190 + * 191 + * Returns the current brightness value, taking in consideration the current 192 + * state. If backlight_is_blank() returns true then return 0 as brightness 193 + * otherwise return the current brightness property value. 194 + * 195 + * Backlight drivers are expected to use this function in their update_status() 196 + * operation to get the brightness value. 197 + */ 198 + static inline int backlight_get_brightness(const struct backlight_device *bd) 199 + { 200 + if (backlight_is_blank(bd)) 201 + return 0; 202 + else 203 + return bd->props.brightness; 204 + } 205 + 206 + struct backlight_device * 207 + backlight_device_register(const char *name, struct device *dev, void *devdata, 208 + const struct backlight_ops *ops, 209 + const struct backlight_properties *props); 210 + struct backlight_device * 211 + devm_backlight_device_register(struct device *dev, const char *name, 212 + struct device *parent, void *devdata, 213 + const struct backlight_ops *ops, 214 + const struct backlight_properties *props); 215 + void backlight_device_unregister(struct backlight_device *bd); 216 + void devm_backlight_device_unregister(struct device *dev, 217 + struct backlight_device *bd); 218 + void backlight_force_update(struct backlight_device *bd, 219 + enum backlight_update_reason reason); 220 + int backlight_register_notifier(struct notifier_block *nb); 221 + int backlight_unregister_notifier(struct notifier_block *nb); 416 222 struct backlight_device *backlight_device_get_by_name(const char *name); 417 - extern int backlight_device_set_brightness(struct backlight_device *bd, unsigned long brightness); 223 + struct backlight_device *backlight_device_get_by_type(enum backlight_type type); 224 + int backlight_device_set_brightness(struct backlight_device *bd, 225 + unsigned long brightness); 418 226 419 227 #define to_backlight_device(obj) container_of(obj, struct backlight_device, dev) 420 228 229 + /** 230 + * bl_get_data - access devdata 231 + * @bl_dev: pointer to backlight device 232 + * 233 + * When a backlight device is registered the driver has the possibility 234 + * to supply a void * devdata. bl_get_data() return a pointer to the 235 + * devdata. 236 + * 237 + * RETURNS: 238 + * 239 + * pointer to devdata stored while registering the backlight device. 240 + */ 421 241 static inline void * bl_get_data(struct backlight_device *bl_dev) 422 242 { 423 243 return dev_get_drvdata(&bl_dev->dev); 424 244 } 425 - 426 - struct generic_bl_info { 427 - const char *name; 428 - int max_intensity; 429 - int default_intensity; 430 - int limit_mask; 431 - void (*set_bl_intensity)(int intensity); 432 - void (*kick_battery)(void); 433 - }; 434 245 435 246 #ifdef CONFIG_OF 436 247 struct backlight_device *of_find_backlight_by_node(struct device_node *node); ··· 477 220 #endif 478 221 479 222 #if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE) 480 - struct backlight_device *of_find_backlight(struct device *dev); 481 223 struct backlight_device *devm_of_find_backlight(struct device *dev); 482 224 #else 483 - static inline struct backlight_device *of_find_backlight(struct device *dev) 484 - { 485 - return NULL; 486 - } 487 - 488 225 static inline struct backlight_device * 489 226 devm_of_find_backlight(struct device *dev) 490 227 {
-2
include/linux/mfd/sky81452.h
··· 9 9 #ifndef _SKY81452_H 10 10 #define _SKY81452_H 11 11 12 - #include <linux/platform_data/sky81452-backlight.h> 13 12 #include <linux/regulator/machine.h> 14 13 15 14 struct sky81452_platform_data { 16 - struct sky81452_bl_platform_data *bl_pdata; 17 15 struct regulator_init_data *regulator_init_data; 18 16 }; 19 17
-35
include/linux/platform_data/sky81452-backlight.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* 3 - * sky81452.h SKY81452 backlight driver 4 - * 5 - * Copyright 2014 Skyworks Solutions Inc. 6 - * Author : Gyungoh Yoo <jack.yoo@skyworksinc.com> 7 - */ 8 - 9 - #ifndef _SKY81452_BACKLIGHT_H 10 - #define _SKY81452_BACKLIGHT_H 11 - 12 - /** 13 - * struct sky81452_platform_data 14 - * @name: backlight driver name. 15 - If it is not defined, default name is lcd-backlight. 16 - * @gpio_enable:GPIO number which control EN pin 17 - * @enable: Enable mask for current sink channel 1, 2, 3, 4, 5 and 6. 18 - * @ignore_pwm: true if DPWMI should be ignored. 19 - * @dpwm_mode: true is DPWM dimming mode, otherwise Analog dimming mode. 20 - * @phase_shift:true is phase shift mode. 21 - * @short_detecion_threshold: It should be one of 4, 5, 6 and 7V. 22 - * @boost_current_limit: It should be one of 2300, 2750mA. 23 - */ 24 - struct sky81452_bl_platform_data { 25 - const char *name; 26 - int gpio_enable; 27 - unsigned int enable; 28 - bool ignore_pwm; 29 - bool dpwm_mode; 30 - bool phase_shift; 31 - unsigned int short_detection_threshold; 32 - unsigned int boost_current_limit; 33 - }; 34 - 35 - #endif