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