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

Configure Feed

Select the types of activity you want to include in your feed.

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

Pull backlight updates from Lee Jones:

- Improve handling of LCD power states and interactions with the fbdev
subsystem

- Introduce new LCD_POWER_ constants to decouple the LCD subsystem from
fbdev

- Update several drivers to use the new LCD_POWER_ constants

- Clarify the semantics of the lcd_ops.controls_device callback

- Remove unnecessary includes and dependencies

- Remove unused notifier functionality

- Simplify code with scoped for-each loops

- Fix module autoloading for the ktz8866 driver

- Update device tree bindings to yaml format

- Minor cleanups and improvements in various drivers

* tag 'backlight-next-6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight: (33 commits)
MAINTAINERS: Use Daniel Thompson's korg address for Backlight work
dt-bindings: backlight: Convert zii,rave-sp-backlight.txt to yaml
backlight: Remove notifier
backlight: ktz8866: Fix module autoloading
backlight: 88pm860x_bl: Simplify with scoped for each OF child loop
backlight: lcd: Do not include <linux/fb.h> in lcd header
backlight: lcd: Remove struct fb_videomode from set_mode callback
backlight: lcd: Replace check_fb with controls_device
HID: picoLCD: Replace check_fb in favor of struct fb_info.lcd_dev
fbdev: omap: Use lcd power constants
fbdev: imxfb: Use lcd power constants
fbdev: imxfb: Replace check_fb in favor of struct fb_info.lcd_dev
fbdev: clps711x-fb: Use lcd power constants
fbdev: clps711x-fb: Replace check_fb in favor of struct fb_info.lcd_dev
backlight: tdo24m: Use lcd power constants
backlight: platform_lcd: Use lcd power constants
backlight: platform_lcd: Remove match_fb from struct plat_lcd_data
backlight: platform_lcd: Remove include statement for <linux/backlight.h>
backlight: otm3225a: Use lcd power constants
backlight: ltv350qv: Use lcd power constants
...

+221 -247
-23
Documentation/devicetree/bindings/leds/backlight/zii,rave-sp-backlight.txt
··· 1 - Zodiac Inflight Innovations RAVE Supervisory Processor Backlight Bindings 2 - 3 - RAVE SP backlight device is a "MFD cell" device corresponding to 4 - backlight functionality of RAVE Supervisory Processor. It is expected 5 - that its Device Tree node is specified as a child of the node 6 - corresponding to the parent RAVE SP device (as documented in 7 - Documentation/devicetree/bindings/mfd/zii,rave-sp.txt) 8 - 9 - Required properties: 10 - 11 - - compatible: Should be "zii,rave-sp-backlight" 12 - 13 - Example: 14 - 15 - rave-sp { 16 - compatible = "zii,rave-sp-rdu1"; 17 - current-speed = <38400>; 18 - 19 - backlight { 20 - compatible = "zii,rave-sp-backlight"; 21 - }; 22 - } 23 -
+36
Documentation/devicetree/bindings/leds/backlight/zii,rave-sp-backlight.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/leds/backlight/zii,rave-sp-backlight.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Zodiac Inflight Innovations RAVE Supervisory Processor Backlight 8 + 9 + maintainers: 10 + - Frank Li <Frank.Li@nxp.com> 11 + 12 + description: 13 + RAVE SP backlight device is a "MFD cell" device corresponding to 14 + backlight functionality of RAVE Supervisory Processor. It is expected 15 + that its Device Tree node is specified as a child of the node 16 + corresponding to the parent RAVE SP device (as documented in 17 + Documentation/devicetree/bindings/mfd/zii,rave-sp.yaml) 18 + 19 + properties: 20 + compatible: 21 + const: zii,rave-sp-backlight 22 + 23 + required: 24 + - compatible 25 + 26 + allOf: 27 + - $ref: common.yaml 28 + 29 + unevaluatedProperties: false 30 + 31 + examples: 32 + - | 33 + backlight { 34 + compatible = "zii,rave-sp-backlight"; 35 + }; 36 +
+1 -1
MAINTAINERS
··· 3812 3812 3813 3813 BACKLIGHT CLASS/SUBSYSTEM 3814 3814 M: Lee Jones <lee@kernel.org> 3815 - M: Daniel Thompson <daniel.thompson@linaro.org> 3815 + M: Daniel Thompson <danielt@kernel.org> 3816 3816 M: Jingoo Han <jingoohan1@gmail.com> 3817 3817 L: dri-devel@lists.freedesktop.org 3818 3818 S: Maintained
+4
drivers/hid/hid-picolcd_fb.c
··· 497 497 #endif 498 498 #endif 499 499 500 + #ifdef CONFIG_HID_PICOLCD_LCD 501 + info->lcd_dev = data->lcd; 502 + #endif 503 + 500 504 fbdata = info->par; 501 505 spin_lock_init(&fbdata->lock); 502 506 fbdata->picolcd = data;
-6
drivers/hid/hid-picolcd_lcd.c
··· 41 41 return 0; 42 42 } 43 43 44 - static int picolcd_check_lcd_fb(struct lcd_device *ldev, struct fb_info *fb) 45 - { 46 - return fb && fb == picolcd_fbinfo((struct picolcd_data *)lcd_get_data(ldev)); 47 - } 48 - 49 44 static const struct lcd_ops picolcd_lcdops = { 50 45 .get_contrast = picolcd_get_contrast, 51 46 .set_contrast = picolcd_set_contrast, 52 - .check_fb = picolcd_check_lcd_fb, 53 47 }; 54 48 55 49 int picolcd_init_lcd(struct picolcd_data *data, struct hid_report *report)
+2 -3
drivers/video/backlight/88pm860x_bl.c
··· 151 151 struct pm860x_backlight_data *data, 152 152 char *name) 153 153 { 154 - struct device_node *nproot, *np; 154 + struct device_node *nproot; 155 155 int iset = 0; 156 156 157 157 nproot = of_get_child_by_name(pdev->dev.parent->of_node, "backlights"); ··· 159 159 dev_err(&pdev->dev, "failed to find backlights node\n"); 160 160 return -ENODEV; 161 161 } 162 - for_each_child_of_node(nproot, np) { 162 + for_each_child_of_node_scoped(nproot, np) { 163 163 if (of_node_name_eq(np, name)) { 164 164 of_property_read_u32(np, "marvell,88pm860x-iset", 165 165 &iset); 166 166 data->iset = PM8606_WLED_CURRENT(iset); 167 167 of_property_read_u32(np, "marvell,88pm860x-pwm", 168 168 &data->pwm); 169 - of_node_put(np); 170 169 break; 171 170 } 172 171 }
-42
drivers/video/backlight/backlight.c
··· 65 65 66 66 static struct list_head backlight_dev_list; 67 67 static struct mutex backlight_dev_list_mutex; 68 - static struct blocking_notifier_head backlight_notifier; 69 68 70 69 static const char *const backlight_types[] = { 71 70 [BACKLIGHT_RAW] = "raw", ··· 466 467 list_add(&new_bd->entry, &backlight_dev_list); 467 468 mutex_unlock(&backlight_dev_list_mutex); 468 469 469 - blocking_notifier_call_chain(&backlight_notifier, 470 - BACKLIGHT_REGISTERED, new_bd); 471 - 472 470 return new_bd; 473 471 } 474 472 EXPORT_SYMBOL(backlight_device_register); ··· 535 539 mutex_unlock(&pmac_backlight_mutex); 536 540 #endif 537 541 538 - blocking_notifier_call_chain(&backlight_notifier, 539 - BACKLIGHT_UNREGISTERED, bd); 540 - 541 542 mutex_lock(&bd->ops_lock); 542 543 bd->ops = NULL; 543 544 mutex_unlock(&bd->ops_lock); ··· 558 565 559 566 return *r == data; 560 567 } 561 - 562 - /** 563 - * backlight_register_notifier - get notified of backlight (un)registration 564 - * @nb: notifier block with the notifier to call on backlight (un)registration 565 - * 566 - * Register a notifier to get notified when backlight devices get registered 567 - * or unregistered. 568 - * 569 - * RETURNS: 570 - * 571 - * 0 on success, otherwise a negative error code 572 - */ 573 - int backlight_register_notifier(struct notifier_block *nb) 574 - { 575 - return blocking_notifier_chain_register(&backlight_notifier, nb); 576 - } 577 - EXPORT_SYMBOL(backlight_register_notifier); 578 - 579 - /** 580 - * backlight_unregister_notifier - unregister a backlight notifier 581 - * @nb: notifier block to unregister 582 - * 583 - * Register a notifier to get notified when backlight devices get registered 584 - * or unregistered. 585 - * 586 - * RETURNS: 587 - * 588 - * 0 on success, otherwise a negative error code 589 - */ 590 - int backlight_unregister_notifier(struct notifier_block *nb) 591 - { 592 - return blocking_notifier_chain_unregister(&backlight_notifier, nb); 593 - } 594 - EXPORT_SYMBOL(backlight_unregister_notifier); 595 568 596 569 /** 597 570 * devm_backlight_device_register - register a new backlight device ··· 726 767 727 768 INIT_LIST_HEAD(&backlight_dev_list); 728 769 mutex_init(&backlight_dev_list_mutex); 729 - BLOCKING_INIT_NOTIFIER_HEAD(&backlight_notifier); 730 770 731 771 return 0; 732 772 }
+8 -9
drivers/video/backlight/corgi_lcd.c
··· 17 17 #include <linux/init.h> 18 18 #include <linux/delay.h> 19 19 #include <linux/gpio/consumer.h> 20 - #include <linux/fb.h> 21 20 #include <linux/lcd.h> 22 21 #include <linux/spi/spi.h> 23 22 #include <linux/spi/corgi_lcd.h> 24 23 #include <linux/slab.h> 25 24 #include <asm/mach/sharpsl_param.h> 26 25 27 - #define POWER_IS_ON(pwr) ((pwr) <= FB_BLANK_NORMAL) 26 + #define POWER_IS_ON(pwr) ((pwr) <= LCD_POWER_REDUCED) 28 27 29 28 /* Register Addresses */ 30 29 #define RESCTL_ADRS 0x00 ··· 331 332 POWER1_VW_OFF | POWER1_GVSS_OFF | POWER1_VDD_OFF); 332 333 } 333 334 334 - static int corgi_lcd_set_mode(struct lcd_device *ld, struct fb_videomode *m) 335 + static int corgi_lcd_set_mode(struct lcd_device *ld, u32 xres, u32 yres) 335 336 { 336 337 struct corgi_lcd *lcd = lcd_get_data(ld); 337 338 int mode = CORGI_LCD_MODE_QVGA; 338 339 339 - if (m->xres == 640 || m->xres == 480) 340 + if (xres == 640 || xres == 480) 340 341 mode = CORGI_LCD_MODE_VGA; 341 342 342 343 if (lcd->mode == mode) ··· 454 455 455 456 corgibl_flags |= CORGIBL_SUSPENDED; 456 457 corgi_bl_set_intensity(lcd, 0); 457 - corgi_lcd_set_power(lcd->lcd_dev, FB_BLANK_POWERDOWN); 458 + corgi_lcd_set_power(lcd->lcd_dev, LCD_POWER_OFF); 458 459 return 0; 459 460 } 460 461 ··· 463 464 struct corgi_lcd *lcd = dev_get_drvdata(dev); 464 465 465 466 corgibl_flags &= ~CORGIBL_SUSPENDED; 466 - corgi_lcd_set_power(lcd->lcd_dev, FB_BLANK_UNBLANK); 467 + corgi_lcd_set_power(lcd->lcd_dev, LCD_POWER_ON); 467 468 backlight_update_status(lcd->bl_dev); 468 469 return 0; 469 470 } ··· 512 513 if (IS_ERR(lcd->lcd_dev)) 513 514 return PTR_ERR(lcd->lcd_dev); 514 515 515 - lcd->power = FB_BLANK_POWERDOWN; 516 + lcd->power = LCD_POWER_OFF; 516 517 lcd->mode = (pdata) ? pdata->init_mode : CORGI_LCD_MODE_VGA; 517 518 518 519 memset(&props, 0, sizeof(struct backlight_properties)); ··· 534 535 lcd->kick_battery = pdata->kick_battery; 535 536 536 537 spi_set_drvdata(spi, lcd); 537 - corgi_lcd_set_power(lcd->lcd_dev, FB_BLANK_UNBLANK); 538 + corgi_lcd_set_power(lcd->lcd_dev, LCD_POWER_ON); 538 539 backlight_update_status(lcd->bl_dev); 539 540 540 541 lcd->limit_mask = pdata->limit_mask; ··· 549 550 lcd->bl_dev->props.power = BACKLIGHT_POWER_ON; 550 551 lcd->bl_dev->props.brightness = 0; 551 552 backlight_update_status(lcd->bl_dev); 552 - corgi_lcd_set_power(lcd->lcd_dev, FB_BLANK_POWERDOWN); 553 + corgi_lcd_set_power(lcd->lcd_dev, LCD_POWER_OFF); 553 554 } 554 555 555 556 static struct spi_driver corgi_lcd_driver = {
+1 -1
drivers/video/backlight/hx8357.c
··· 532 532 return 0; 533 533 } 534 534 535 - #define POWER_IS_ON(pwr) ((pwr) <= FB_BLANK_NORMAL) 535 + #define POWER_IS_ON(pwr) ((pwr) <= LCD_POWER_REDUCED) 536 536 537 537 static int hx8357_set_power(struct lcd_device *lcdev, int power) 538 538 {
+3 -4
drivers/video/backlight/ili922x.c
··· 8 8 * memory is cyclically updated over the RGB interface. 9 9 */ 10 10 11 - #include <linux/fb.h> 12 11 #include <linux/delay.h> 13 12 #include <linux/errno.h> 14 13 #include <linux/init.h> ··· 118 119 119 120 #define CMD_BUFSIZE 16 120 121 121 - #define POWER_IS_ON(pwr) ((pwr) <= FB_BLANK_NORMAL) 122 + #define POWER_IS_ON(pwr) ((pwr) <= LCD_POWER_REDUCED) 122 123 123 124 #define set_tx_byte(b) (tx_invert ? ~(b) : b) 124 125 ··· 512 513 513 514 ili922x_display_init(spi); 514 515 515 - ili->power = FB_BLANK_POWERDOWN; 516 + ili->power = LCD_POWER_OFF; 516 517 517 518 lcd = devm_lcd_device_register(&spi->dev, "ili922xlcd", &spi->dev, ili, 518 519 &ili922x_ops); ··· 524 525 ili->ld = lcd; 525 526 spi_set_drvdata(spi, ili); 526 527 527 - ili922x_lcd_power(ili, FB_BLANK_UNBLANK); 528 + ili922x_lcd_power(ili, LCD_POWER_ON); 528 529 529 530 return 0; 530 531 }
+7 -8
drivers/video/backlight/ili9320.c
··· 10 10 11 11 #include <linux/delay.h> 12 12 #include <linux/err.h> 13 - #include <linux/fb.h> 14 13 #include <linux/init.h> 15 14 #include <linux/lcd.h> 16 15 #include <linux/module.h> ··· 120 121 return 0; 121 122 } 122 123 123 - #define POWER_IS_ON(pwr) ((pwr) <= FB_BLANK_NORMAL) 124 + #define POWER_IS_ON(pwr) ((pwr) <= LCD_POWER_REDUCED) 124 125 125 126 static int ili9320_power(struct ili9320 *lcd, int power) 126 127 { ··· 222 223 223 224 ili->dev = dev; 224 225 ili->client = client; 225 - ili->power = FB_BLANK_POWERDOWN; 226 + ili->power = LCD_POWER_OFF; 226 227 ili->platdata = cfg; 227 228 228 229 spi_set_drvdata(spi, ili); ··· 240 241 241 242 dev_info(dev, "initialising %s\n", client->name); 242 243 243 - ret = ili9320_power(ili, FB_BLANK_UNBLANK); 244 + ret = ili9320_power(ili, LCD_POWER_ON); 244 245 if (ret != 0) { 245 246 dev_err(dev, "failed to set lcd power state\n"); 246 247 return ret; ··· 252 253 253 254 void ili9320_remove(struct ili9320 *ili) 254 255 { 255 - ili9320_power(ili, FB_BLANK_POWERDOWN); 256 + ili9320_power(ili, LCD_POWER_OFF); 256 257 } 257 258 EXPORT_SYMBOL_GPL(ili9320_remove); 258 259 ··· 261 262 { 262 263 int ret; 263 264 264 - ret = ili9320_power(lcd, FB_BLANK_POWERDOWN); 265 + ret = ili9320_power(lcd, LCD_POWER_OFF); 265 266 266 267 if (lcd->platdata->suspend == ILI9320_SUSPEND_DEEP) { 267 268 ili9320_write(lcd, ILI9320_POWER1, lcd->power1 | ··· 281 282 if (lcd->platdata->suspend == ILI9320_SUSPEND_DEEP) 282 283 ili9320_write(lcd, ILI9320_POWER1, 0x00); 283 284 284 - return ili9320_power(lcd, FB_BLANK_UNBLANK); 285 + return ili9320_power(lcd, LCD_POWER_ON); 285 286 } 286 287 EXPORT_SYMBOL_GPL(ili9320_resume); 287 288 #endif ··· 289 290 /* Power down all displays on reboot, poweroff or halt */ 290 291 void ili9320_shutdown(struct ili9320 *lcd) 291 292 { 292 - ili9320_power(lcd, FB_BLANK_POWERDOWN); 293 + ili9320_power(lcd, LCD_POWER_OFF); 293 294 } 294 295 EXPORT_SYMBOL_GPL(ili9320_shutdown); 295 296
+5 -5
drivers/video/backlight/jornada720_lcd.c
··· 6 6 */ 7 7 8 8 #include <linux/device.h> 9 - #include <linux/fb.h> 9 + #include <linux/io.h> 10 10 #include <linux/kernel.h> 11 11 #include <linux/lcd.h> 12 12 #include <linux/module.h> ··· 23 23 24 24 static int jornada_lcd_get_power(struct lcd_device *ld) 25 25 { 26 - return PPSR & PPC_LDD2 ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN; 26 + return PPSR & PPC_LDD2 ? LCD_POWER_ON : LCD_POWER_OFF; 27 27 } 28 28 29 29 static int jornada_lcd_get_contrast(struct lcd_device *ld) 30 30 { 31 31 int ret; 32 32 33 - if (jornada_lcd_get_power(ld) != FB_BLANK_UNBLANK) 33 + if (jornada_lcd_get_power(ld) != LCD_POWER_ON) 34 34 return 0; 35 35 36 36 jornada_ssp_start(); ··· 71 71 72 72 static int jornada_lcd_set_power(struct lcd_device *ld, int power) 73 73 { 74 - if (power != FB_BLANK_UNBLANK) { 74 + if (power != LCD_POWER_ON) { 75 75 PPSR &= ~PPC_LDD2; 76 76 PPDR |= PPC_LDD2; 77 77 } else { ··· 106 106 107 107 /* lets set our default values */ 108 108 jornada_lcd_set_contrast(lcd_device, LCD_DEF_CONTRAST); 109 - jornada_lcd_set_power(lcd_device, FB_BLANK_UNBLANK); 109 + jornada_lcd_set_power(lcd_device, LCD_POWER_ON); 110 110 /* give it some time to startup */ 111 111 msleep(100); 112 112
+1
drivers/video/backlight/ktz8866.c
··· 190 190 }, 191 191 {}, 192 192 }; 193 + MODULE_DEVICE_TABLE(of, ktz8866_match_table); 193 194 194 195 static struct i2c_driver ktz8866_driver = { 195 196 .driver = {
+16 -16
drivers/video/backlight/l4f00242t03.c
··· 112 112 const u16 slpin = 0x10; 113 113 const u16 disoff = 0x28; 114 114 115 - if (power <= FB_BLANK_NORMAL) { 116 - if (priv->lcd_state <= FB_BLANK_NORMAL) { 115 + if (power <= LCD_POWER_REDUCED) { 116 + if (priv->lcd_state <= LCD_POWER_REDUCED) { 117 117 /* Do nothing, the LCD is running */ 118 - } else if (priv->lcd_state < FB_BLANK_POWERDOWN) { 118 + } else if (priv->lcd_state < LCD_POWER_OFF) { 119 119 dev_dbg(&spi->dev, "Resuming LCD\n"); 120 120 121 121 spi_write(spi, (const u8 *)&slpout, sizeof(u16)); 122 122 msleep(60); 123 123 spi_write(spi, (const u8 *)&dison, sizeof(u16)); 124 124 } else { 125 - /* priv->lcd_state == FB_BLANK_POWERDOWN */ 125 + /* priv->lcd_state == LCD_POWER_OFF */ 126 126 l4f00242t03_lcd_init(spi); 127 - priv->lcd_state = FB_BLANK_VSYNC_SUSPEND; 127 + priv->lcd_state = LCD_POWER_REDUCED_VSYNC_SUSPEND; 128 128 l4f00242t03_lcd_power_set(priv->ld, power); 129 129 } 130 - } else if (power < FB_BLANK_POWERDOWN) { 131 - if (priv->lcd_state <= FB_BLANK_NORMAL) { 130 + } else if (power < LCD_POWER_OFF) { 131 + if (priv->lcd_state <= LCD_POWER_REDUCED) { 132 132 /* Send the display in standby */ 133 133 dev_dbg(&spi->dev, "Standby the LCD\n"); 134 134 135 135 spi_write(spi, (const u8 *)&disoff, sizeof(u16)); 136 136 msleep(60); 137 137 spi_write(spi, (const u8 *)&slpin, sizeof(u16)); 138 - } else if (priv->lcd_state < FB_BLANK_POWERDOWN) { 138 + } else if (priv->lcd_state < LCD_POWER_OFF) { 139 139 /* Do nothing, the LCD is already in standby */ 140 140 } else { 141 - /* priv->lcd_state == FB_BLANK_POWERDOWN */ 141 + /* priv->lcd_state == LCD_POWER_OFF */ 142 142 l4f00242t03_lcd_init(spi); 143 - priv->lcd_state = FB_BLANK_UNBLANK; 143 + priv->lcd_state = LCD_POWER_ON; 144 144 l4f00242t03_lcd_power_set(ld, power); 145 145 } 146 146 } else { 147 - /* power == FB_BLANK_POWERDOWN */ 148 - if (priv->lcd_state != FB_BLANK_POWERDOWN) { 147 + /* power == LCD_POWER_OFF */ 148 + if (priv->lcd_state != LCD_POWER_OFF) { 149 149 /* Clear the screen before shutting down */ 150 150 spi_write(spi, (const u8 *)&disoff, sizeof(u16)); 151 151 msleep(60); ··· 212 212 213 213 /* Init the LCD */ 214 214 l4f00242t03_lcd_init(spi); 215 - priv->lcd_state = FB_BLANK_VSYNC_SUSPEND; 216 - l4f00242t03_lcd_power_set(priv->ld, FB_BLANK_UNBLANK); 215 + priv->lcd_state = LCD_POWER_REDUCED_VSYNC_SUSPEND; 216 + l4f00242t03_lcd_power_set(priv->ld, LCD_POWER_ON); 217 217 218 218 dev_info(&spi->dev, "Epson l4f00242t03 lcd probed.\n"); 219 219 ··· 224 224 { 225 225 struct l4f00242t03_priv *priv = spi_get_drvdata(spi); 226 226 227 - l4f00242t03_lcd_power_set(priv->ld, FB_BLANK_POWERDOWN); 227 + l4f00242t03_lcd_power_set(priv->ld, LCD_POWER_OFF); 228 228 } 229 229 230 230 static void l4f00242t03_shutdown(struct spi_device *spi) ··· 232 232 struct l4f00242t03_priv *priv = spi_get_drvdata(spi); 233 233 234 234 if (priv) 235 - l4f00242t03_lcd_power_set(priv->ld, FB_BLANK_POWERDOWN); 235 + l4f00242t03_lcd_power_set(priv->ld, LCD_POWER_OFF); 236 236 237 237 } 238 238
+38 -12
drivers/video/backlight/lcd.c
··· 20 20 21 21 #if defined(CONFIG_FB) || (defined(CONFIG_FB_MODULE) && \ 22 22 defined(CONFIG_LCD_CLASS_DEVICE_MODULE)) 23 + static int to_lcd_power(int fb_blank) 24 + { 25 + switch (fb_blank) { 26 + case FB_BLANK_UNBLANK: 27 + return LCD_POWER_ON; 28 + /* deprecated; TODO: should become 'off' */ 29 + case FB_BLANK_NORMAL: 30 + return LCD_POWER_REDUCED; 31 + case FB_BLANK_VSYNC_SUSPEND: 32 + return LCD_POWER_REDUCED_VSYNC_SUSPEND; 33 + /* 'off' */ 34 + case FB_BLANK_HSYNC_SUSPEND: 35 + case FB_BLANK_POWERDOWN: 36 + default: 37 + return LCD_POWER_OFF; 38 + } 39 + } 40 + 23 41 /* This callback gets called when something important happens inside a 24 42 * framebuffer driver. We're looking if that important event is blanking, 25 43 * and if it is, we're switching lcd power as well ... ··· 45 27 static int fb_notifier_callback(struct notifier_block *self, 46 28 unsigned long event, void *data) 47 29 { 48 - struct lcd_device *ld; 30 + struct lcd_device *ld = container_of(self, struct lcd_device, fb_notif); 49 31 struct fb_event *evdata = data; 32 + struct fb_info *info = evdata->info; 33 + struct lcd_device *fb_lcd = fb_lcd_device(info); 50 34 51 - ld = container_of(self, struct lcd_device, fb_notif); 35 + guard(mutex)(&ld->ops_lock); 36 + 52 37 if (!ld->ops) 53 38 return 0; 39 + if (ld->ops->controls_device && !ld->ops->controls_device(ld, info->device)) 40 + return 0; 41 + if (fb_lcd && fb_lcd != ld) 42 + return 0; 54 43 55 - mutex_lock(&ld->ops_lock); 56 - if (!ld->ops->check_fb || ld->ops->check_fb(ld, evdata->info)) { 57 - if (event == FB_EVENT_BLANK) { 58 - if (ld->ops->set_power) 59 - ld->ops->set_power(ld, *(int *)evdata->data); 60 - } else { 61 - if (ld->ops->set_mode) 62 - ld->ops->set_mode(ld, evdata->data); 63 - } 44 + if (event == FB_EVENT_BLANK) { 45 + int power = to_lcd_power(*(int *)evdata->data); 46 + 47 + if (ld->ops->set_power) 48 + ld->ops->set_power(ld, power); 49 + } else { 50 + const struct fb_videomode *videomode = evdata->data; 51 + 52 + if (ld->ops->set_mode) 53 + ld->ops->set_mode(ld, videomode->xres, videomode->yres); 64 54 } 65 - mutex_unlock(&ld->ops_lock); 55 + 66 56 return 0; 67 57 } 68 58
+1 -1
drivers/video/backlight/lms283gf05.c
··· 126 126 struct lms283gf05_state *st = lcd_get_data(ld); 127 127 struct spi_device *spi = st->spi; 128 128 129 - if (power <= FB_BLANK_NORMAL) { 129 + if (power <= LCD_POWER_REDUCED) { 130 130 if (st->reset) 131 131 lms283gf05_reset(st->reset); 132 132 lms283gf05_toggle(spi, disp_initseq, ARRAY_SIZE(disp_initseq));
+11 -13
drivers/video/backlight/lms501kf03.c
··· 6 6 * Author: Jingoo Han <jg1.han@samsung.com> 7 7 */ 8 8 9 - #include <linux/backlight.h> 10 9 #include <linux/delay.h> 11 - #include <linux/fb.h> 12 10 #include <linux/lcd.h> 13 11 #include <linux/module.h> 14 12 #include <linux/spi/spi.h> ··· 204 206 205 207 static int lms501kf03_power_is_on(int power) 206 208 { 207 - return (power) <= FB_BLANK_NORMAL; 209 + return (power) <= LCD_POWER_REDUCED; 208 210 } 209 211 210 212 static int lms501kf03_power_on(struct lms501kf03 *lcd) ··· 293 295 { 294 296 struct lms501kf03 *lcd = lcd_get_data(ld); 295 297 296 - if (power != FB_BLANK_UNBLANK && power != FB_BLANK_POWERDOWN && 297 - power != FB_BLANK_NORMAL) { 298 + if (power != LCD_POWER_ON && power != LCD_POWER_OFF && 299 + power != LCD_POWER_REDUCED) { 298 300 dev_err(lcd->dev, "power value should be 0, 1 or 4.\n"); 299 301 return -EINVAL; 300 302 } ··· 348 350 * current lcd status is powerdown and then 349 351 * it enables lcd panel. 350 352 */ 351 - lcd->power = FB_BLANK_POWERDOWN; 353 + lcd->power = LCD_POWER_OFF; 352 354 353 - lms501kf03_power(lcd, FB_BLANK_UNBLANK); 355 + lms501kf03_power(lcd, LCD_POWER_ON); 354 356 } else { 355 - lcd->power = FB_BLANK_UNBLANK; 357 + lcd->power = LCD_POWER_ON; 356 358 } 357 359 358 360 spi_set_drvdata(spi, lcd); ··· 366 368 { 367 369 struct lms501kf03 *lcd = spi_get_drvdata(spi); 368 370 369 - lms501kf03_power(lcd, FB_BLANK_POWERDOWN); 371 + lms501kf03_power(lcd, LCD_POWER_OFF); 370 372 } 371 373 372 374 #ifdef CONFIG_PM_SLEEP ··· 380 382 * when lcd panel is suspend, lcd panel becomes off 381 383 * regardless of status. 382 384 */ 383 - return lms501kf03_power(lcd, FB_BLANK_POWERDOWN); 385 + return lms501kf03_power(lcd, LCD_POWER_OFF); 384 386 } 385 387 386 388 static int lms501kf03_resume(struct device *dev) 387 389 { 388 390 struct lms501kf03 *lcd = dev_get_drvdata(dev); 389 391 390 - lcd->power = FB_BLANK_POWERDOWN; 392 + lcd->power = LCD_POWER_OFF; 391 393 392 - return lms501kf03_power(lcd, FB_BLANK_UNBLANK); 394 + return lms501kf03_power(lcd, LCD_POWER_ON); 393 395 } 394 396 #endif 395 397 ··· 400 402 { 401 403 struct lms501kf03 *lcd = spi_get_drvdata(spi); 402 404 403 - lms501kf03_power(lcd, FB_BLANK_POWERDOWN); 405 + lms501kf03_power(lcd, LCD_POWER_OFF); 404 406 } 405 407 406 408 static struct spi_driver lms501kf03_driver = {
+7 -8
drivers/video/backlight/ltv350qv.c
··· 6 6 */ 7 7 #include <linux/delay.h> 8 8 #include <linux/err.h> 9 - #include <linux/fb.h> 10 9 #include <linux/init.h> 11 10 #include <linux/lcd.h> 12 11 #include <linux/module.h> ··· 14 15 15 16 #include "ltv350qv.h" 16 17 17 - #define POWER_IS_ON(pwr) ((pwr) <= FB_BLANK_NORMAL) 18 + #define POWER_IS_ON(pwr) ((pwr) <= LCD_POWER_REDUCED) 18 19 19 20 struct ltv350qv { 20 21 struct spi_device *spi; ··· 232 233 return -ENOMEM; 233 234 234 235 lcd->spi = spi; 235 - lcd->power = FB_BLANK_POWERDOWN; 236 + lcd->power = LCD_POWER_OFF; 236 237 lcd->buffer = devm_kzalloc(&spi->dev, 8, GFP_KERNEL); 237 238 if (!lcd->buffer) 238 239 return -ENOMEM; ··· 244 245 245 246 lcd->ld = ld; 246 247 247 - ret = ltv350qv_power(lcd, FB_BLANK_UNBLANK); 248 + ret = ltv350qv_power(lcd, LCD_POWER_ON); 248 249 if (ret) 249 250 return ret; 250 251 ··· 257 258 { 258 259 struct ltv350qv *lcd = spi_get_drvdata(spi); 259 260 260 - ltv350qv_power(lcd, FB_BLANK_POWERDOWN); 261 + ltv350qv_power(lcd, LCD_POWER_OFF); 261 262 } 262 263 263 264 #ifdef CONFIG_PM_SLEEP ··· 265 266 { 266 267 struct ltv350qv *lcd = dev_get_drvdata(dev); 267 268 268 - return ltv350qv_power(lcd, FB_BLANK_POWERDOWN); 269 + return ltv350qv_power(lcd, LCD_POWER_OFF); 269 270 } 270 271 271 272 static int ltv350qv_resume(struct device *dev) 272 273 { 273 274 struct ltv350qv *lcd = dev_get_drvdata(dev); 274 275 275 - return ltv350qv_power(lcd, FB_BLANK_UNBLANK); 276 + return ltv350qv_power(lcd, LCD_POWER_ON); 276 277 } 277 278 #endif 278 279 ··· 283 284 { 284 285 struct ltv350qv *lcd = spi_get_drvdata(spi); 285 286 286 - ltv350qv_power(lcd, FB_BLANK_POWERDOWN); 287 + ltv350qv_power(lcd, LCD_POWER_OFF); 287 288 } 288 289 289 290 static struct spi_driver ltv350qv_driver = {
+1 -1
drivers/video/backlight/otm3225a.c
··· 189 189 if (power == dd->power) 190 190 return 0; 191 191 192 - if (power > FB_BLANK_UNBLANK) 192 + if (power > LCD_POWER_ON) 193 193 otm3225a_write(dd->spi, display_off, ARRAY_SIZE(display_off)); 194 194 else 195 195 otm3225a_write(dd->spi, display_on, ARRAY_SIZE(display_on));
+7 -13
drivers/video/backlight/platform_lcd.c
··· 9 9 10 10 #include <linux/module.h> 11 11 #include <linux/platform_device.h> 12 - #include <linux/fb.h> 13 - #include <linux/backlight.h> 14 12 #include <linux/lcd.h> 15 13 #include <linux/slab.h> 16 14 ··· 40 42 struct platform_lcd *plcd = to_our_lcd(lcd); 41 43 int lcd_power = 1; 42 44 43 - if (power == FB_BLANK_POWERDOWN || plcd->suspended) 45 + if (power == LCD_POWER_OFF || plcd->suspended) 44 46 lcd_power = 0; 45 47 46 48 plcd->pdata->set_power(plcd->pdata, lcd_power); ··· 49 51 return 0; 50 52 } 51 53 52 - static int platform_lcd_match(struct lcd_device *lcd, struct fb_info *info) 54 + static bool platform_lcd_controls_device(struct lcd_device *lcd, struct device *display_device) 53 55 { 54 56 struct platform_lcd *plcd = to_our_lcd(lcd); 55 - struct plat_lcd_data *pdata = plcd->pdata; 56 57 57 - if (pdata->match_fb) 58 - return pdata->match_fb(pdata, info); 59 - 60 - return plcd->us->parent == info->device; 58 + return plcd->us->parent == display_device; 61 59 } 62 60 63 61 static const struct lcd_ops platform_lcd_ops = { 64 - .get_power = platform_lcd_get_power, 65 - .set_power = platform_lcd_set_power, 66 - .check_fb = platform_lcd_match, 62 + .get_power = platform_lcd_get_power, 63 + .set_power = platform_lcd_set_power, 64 + .controls_device = platform_lcd_controls_device, 67 65 }; 68 66 69 67 static int platform_lcd_probe(struct platform_device *pdev) ··· 96 102 } 97 103 98 104 platform_set_drvdata(pdev, plcd); 99 - platform_lcd_set_power(plcd->lcd, FB_BLANK_NORMAL); 105 + platform_lcd_set_power(plcd->lcd, LCD_POWER_REDUCED); 100 106 101 107 return 0; 102 108 }
+9 -10
drivers/video/backlight/tdo24m.c
··· 12 12 #include <linux/device.h> 13 13 #include <linux/spi/spi.h> 14 14 #include <linux/spi/tdo24m.h> 15 - #include <linux/fb.h> 16 15 #include <linux/lcd.h> 17 16 #include <linux/slab.h> 18 17 19 - #define POWER_IS_ON(pwr) ((pwr) <= FB_BLANK_NORMAL) 18 + #define POWER_IS_ON(pwr) ((pwr) <= LCD_POWER_REDUCED) 20 19 21 20 #define TDO24M_SPI_BUFF_SIZE (4) 22 21 #define MODE_QVGA 0 ··· 307 308 return lcd->power; 308 309 } 309 310 310 - static int tdo24m_set_mode(struct lcd_device *ld, struct fb_videomode *m) 311 + static int tdo24m_set_mode(struct lcd_device *ld, u32 xres, u32 yres) 311 312 { 312 313 struct tdo24m *lcd = lcd_get_data(ld); 313 314 int mode = MODE_QVGA; 314 315 315 - if (m->xres == 640 || m->xres == 480) 316 + if (xres == 640 || xres == 480) 316 317 mode = MODE_VGA; 317 318 318 319 if (lcd->mode == mode) ··· 353 354 return -ENOMEM; 354 355 355 356 lcd->spi_dev = spi; 356 - lcd->power = FB_BLANK_POWERDOWN; 357 + lcd->power = LCD_POWER_OFF; 357 358 lcd->mode = MODE_VGA; /* default to VGA */ 358 359 359 360 lcd->buf = devm_kzalloc(&spi->dev, TDO24M_SPI_BUFF_SIZE, GFP_KERNEL); ··· 389 390 return PTR_ERR(lcd->lcd_dev); 390 391 391 392 spi_set_drvdata(spi, lcd); 392 - err = tdo24m_power(lcd, FB_BLANK_UNBLANK); 393 + err = tdo24m_power(lcd, LCD_POWER_ON); 393 394 if (err) 394 395 return err; 395 396 ··· 400 401 { 401 402 struct tdo24m *lcd = spi_get_drvdata(spi); 402 403 403 - tdo24m_power(lcd, FB_BLANK_POWERDOWN); 404 + tdo24m_power(lcd, LCD_POWER_OFF); 404 405 } 405 406 406 407 #ifdef CONFIG_PM_SLEEP ··· 408 409 { 409 410 struct tdo24m *lcd = dev_get_drvdata(dev); 410 411 411 - return tdo24m_power(lcd, FB_BLANK_POWERDOWN); 412 + return tdo24m_power(lcd, LCD_POWER_OFF); 412 413 } 413 414 414 415 static int tdo24m_resume(struct device *dev) 415 416 { 416 417 struct tdo24m *lcd = dev_get_drvdata(dev); 417 418 418 - return tdo24m_power(lcd, FB_BLANK_UNBLANK); 419 + return tdo24m_power(lcd, LCD_POWER_ON); 419 420 } 420 421 #endif 421 422 ··· 426 427 { 427 428 struct tdo24m *lcd = spi_get_drvdata(spi); 428 429 429 - tdo24m_power(lcd, FB_BLANK_POWERDOWN); 430 + tdo24m_power(lcd, LCD_POWER_OFF); 430 431 } 431 432 432 433 static struct spi_driver tdo24m_driver = {
+13 -16
drivers/video/fbdev/clps711x-fb.c
··· 162 162 .fb_blank = clps711x_fb_blank, 163 163 }; 164 164 165 - static int clps711x_lcd_check_fb(struct lcd_device *lcddev, struct fb_info *fi) 166 - { 167 - struct clps711x_fb_info *cfb = dev_get_drvdata(&lcddev->dev); 168 - 169 - return (!fi || fi->par == cfb) ? 1 : 0; 170 - } 171 - 172 165 static int clps711x_lcd_get_power(struct lcd_device *lcddev) 173 166 { 174 167 struct clps711x_fb_info *cfb = dev_get_drvdata(&lcddev->dev); 175 168 176 169 if (!IS_ERR_OR_NULL(cfb->lcd_pwr)) 177 170 if (!regulator_is_enabled(cfb->lcd_pwr)) 178 - return FB_BLANK_NORMAL; 171 + return LCD_POWER_REDUCED; 179 172 180 - return FB_BLANK_UNBLANK; 173 + return LCD_POWER_ON; 181 174 } 182 175 183 176 static int clps711x_lcd_set_power(struct lcd_device *lcddev, int blank) ··· 178 185 struct clps711x_fb_info *cfb = dev_get_drvdata(&lcddev->dev); 179 186 180 187 if (!IS_ERR_OR_NULL(cfb->lcd_pwr)) { 181 - if (blank == FB_BLANK_UNBLANK) { 188 + if (blank == LCD_POWER_ON) { 182 189 if (!regulator_is_enabled(cfb->lcd_pwr)) 183 190 return regulator_enable(cfb->lcd_pwr); 184 191 } else { ··· 191 198 } 192 199 193 200 static const struct lcd_ops clps711x_lcd_ops = { 194 - .check_fb = clps711x_lcd_check_fb, 195 201 .get_power = clps711x_lcd_get_power, 196 202 .set_power = clps711x_lcd_set_power, 197 203 }; ··· 317 325 if (ret) 318 326 goto out_fb_dealloc_cmap; 319 327 328 + lcd = devm_lcd_device_register(dev, "clps711x-lcd", dev, cfb, 329 + &clps711x_lcd_ops); 330 + if (IS_ERR(lcd)) { 331 + ret = PTR_ERR(lcd); 332 + goto out_fb_dealloc_cmap; 333 + } 334 + 335 + info->lcd_dev = lcd; 336 + 320 337 ret = register_framebuffer(info); 321 338 if (ret) 322 339 goto out_fb_dealloc_cmap; 323 340 324 - lcd = devm_lcd_device_register(dev, "clps711x-lcd", dev, cfb, 325 - &clps711x_lcd_ops); 326 - if (!IS_ERR(lcd)) 327 - return 0; 341 + return 0; 328 342 329 - ret = PTR_ERR(lcd); 330 343 unregister_framebuffer(info); 331 344 332 345 out_fb_dealloc_cmap:
+11 -21
drivers/video/fbdev/imxfb.c
··· 782 782 return 0; 783 783 } 784 784 785 - static int imxfb_lcd_check_fb(struct lcd_device *lcddev, struct fb_info *fi) 786 - { 787 - struct imxfb_info *fbi = dev_get_drvdata(&lcddev->dev); 788 - 789 - if (!fi || fi->par == fbi) 790 - return 1; 791 - 792 - return 0; 793 - } 794 - 795 785 static int imxfb_lcd_get_contrast(struct lcd_device *lcddev) 796 786 { 797 787 struct imxfb_info *fbi = dev_get_drvdata(&lcddev->dev); ··· 814 824 815 825 if (!IS_ERR(fbi->lcd_pwr) && 816 826 !regulator_is_enabled(fbi->lcd_pwr)) 817 - return FB_BLANK_POWERDOWN; 827 + return LCD_POWER_OFF; 818 828 819 - return FB_BLANK_UNBLANK; 829 + return LCD_POWER_ON; 820 830 } 821 831 822 832 static int imxfb_regulator_set(struct imxfb_info *fbi, int enable) ··· 842 852 struct imxfb_info *fbi = dev_get_drvdata(&lcddev->dev); 843 853 844 854 if (!IS_ERR(fbi->lcd_pwr)) 845 - return imxfb_regulator_set(fbi, power == FB_BLANK_UNBLANK); 855 + return imxfb_regulator_set(fbi, power == LCD_POWER_ON); 846 856 847 857 return 0; 848 858 } 849 859 850 860 static const struct lcd_ops imxfb_lcd_ops = { 851 - .check_fb = imxfb_lcd_check_fb, 852 861 .get_contrast = imxfb_lcd_get_contrast, 853 862 .set_contrast = imxfb_lcd_set_contrast, 854 863 .get_power = imxfb_lcd_get_power, ··· 1014 1025 goto failed_cmap; 1015 1026 1016 1027 imxfb_set_par(info); 1017 - ret = register_framebuffer(info); 1018 - if (ret < 0) { 1019 - dev_err(&pdev->dev, "failed to register framebuffer\n"); 1020 - goto failed_register; 1021 - } 1022 1028 1023 1029 fbi->lcd_pwr = devm_regulator_get(&pdev->dev, "lcd"); 1024 1030 if (PTR_ERR(fbi->lcd_pwr) == -EPROBE_DEFER) { ··· 1030 1046 1031 1047 lcd->props.max_contrast = 0xff; 1032 1048 1049 + info->lcd_dev = lcd; 1050 + 1051 + ret = register_framebuffer(info); 1052 + if (ret < 0) { 1053 + dev_err(&pdev->dev, "failed to register framebuffer\n"); 1054 + goto failed_lcd; 1055 + } 1056 + 1033 1057 imxfb_enable_controller(fbi); 1034 1058 1035 1059 return 0; 1036 1060 1037 1061 failed_lcd: 1038 - unregister_framebuffer(info); 1039 - failed_register: 1040 1062 fb_dealloc_cmap(&info->cmap); 1041 1063 failed_cmap: 1042 1064 dma_free_wc(&pdev->dev, fbi->map_size, info->screen_buffer,
+4 -4
drivers/video/fbdev/omap/lcd_ams_delta.c
··· 32 32 33 33 static int ams_delta_lcd_set_power(struct lcd_device *dev, int power) 34 34 { 35 - if (power == FB_BLANK_UNBLANK) { 35 + if (power == LCD_POWER_ON) { 36 36 if (!(ams_delta_lcd & AMS_DELTA_LCD_POWER)) { 37 37 omap_writeb(ams_delta_lcd & AMS_DELTA_MAX_CONTRAST, 38 38 OMAP_PWL_ENABLE); ··· 63 63 static int ams_delta_lcd_get_power(struct lcd_device *dev) 64 64 { 65 65 if (ams_delta_lcd & AMS_DELTA_LCD_POWER) 66 - return FB_BLANK_UNBLANK; 66 + return LCD_POWER_ON; 67 67 else 68 - return FB_BLANK_POWERDOWN; 68 + return LCD_POWER_OFF; 69 69 } 70 70 71 71 static int ams_delta_lcd_get_contrast(struct lcd_device *dev) ··· 155 155 #endif 156 156 157 157 ams_delta_lcd_set_contrast(lcd_device, AMS_DELTA_DEFAULT_CONTRAST); 158 - ams_delta_lcd_set_power(lcd_device, FB_BLANK_UNBLANK); 158 + ams_delta_lcd_set_power(lcd_device, LCD_POWER_ON); 159 159 160 160 omapfb_register_panel(&ams_delta_panel); 161 161 return 0;
-20
include/linux/backlight.h
··· 66 66 BACKLIGHT_TYPE_MAX, 67 67 }; 68 68 69 - /** 70 - * enum backlight_notification - the type of notification 71 - * 72 - * The notifications that is used for notification sent to the receiver 73 - * that registered notifications using backlight_register_notifier(). 74 - */ 75 - enum backlight_notification { 76 - /** 77 - * @BACKLIGHT_REGISTERED: The backlight device is registered. 78 - */ 79 - BACKLIGHT_REGISTERED, 80 - 81 - /** 82 - * @BACKLIGHT_UNREGISTERED: The backlight revice is unregistered. 83 - */ 84 - BACKLIGHT_UNREGISTERED, 85 - }; 86 - 87 69 /** enum backlight_scale - the type of scale used for brightness values 88 70 * 89 71 * The type of scale used for brightness values. ··· 403 421 struct backlight_device *bd); 404 422 void backlight_force_update(struct backlight_device *bd, 405 423 enum backlight_update_reason reason); 406 - int backlight_register_notifier(struct notifier_block *nb); 407 - int backlight_unregister_notifier(struct notifier_block *nb); 408 424 struct backlight_device *backlight_device_get_by_name(const char *name); 409 425 struct backlight_device *backlight_device_get_by_type(enum backlight_type type); 410 426 int backlight_device_set_brightness(struct backlight_device *bd,
+13
include/linux/fb.h
··· 21 21 struct file; 22 22 struct i2c_adapter; 23 23 struct inode; 24 + struct lcd_device; 24 25 struct module; 25 26 struct notifier_block; 26 27 struct page; ··· 481 480 struct mutex bl_curve_mutex; 482 481 u8 bl_curve[FB_BACKLIGHT_LEVELS]; 483 482 #endif 483 + 484 + /* 485 + * Assigned LCD device; set before framebuffer 486 + * registration, remove after unregister 487 + */ 488 + struct lcd_device *lcd_dev; 489 + 484 490 #ifdef CONFIG_FB_DEFERRED_IO 485 491 struct delayed_work deferred_work; 486 492 unsigned long npagerefs; ··· 761 753 return NULL; 762 754 } 763 755 #endif 756 + 757 + static inline struct lcd_device *fb_lcd_device(struct fb_info *info) 758 + { 759 + return info->lcd_dev; 760 + } 764 761 765 762 /* fbmon.c */ 766 763 #define FB_MAXTIMINGS 0
+22 -7
include/linux/lcd.h
··· 12 12 #include <linux/device.h> 13 13 #include <linux/mutex.h> 14 14 #include <linux/notifier.h> 15 - #include <linux/fb.h> 15 + 16 + #define LCD_POWER_ON (0) 17 + #define LCD_POWER_REDUCED (1) // deprecated; don't use in new code 18 + #define LCD_POWER_REDUCED_VSYNC_SUSPEND (2) // deprecated; don't use in new code 19 + #define LCD_POWER_OFF (4) 16 20 17 21 /* Notes on locking: 18 22 * ··· 34 30 */ 35 31 36 32 struct lcd_device; 37 - struct fb_info; 38 33 39 34 struct lcd_properties { 40 35 /* The maximum value for contrast (read-only) */ ··· 50 47 int (*get_contrast)(struct lcd_device *); 51 48 /* Set LCD panel contrast */ 52 49 int (*set_contrast)(struct lcd_device *, int contrast); 53 - /* Set LCD panel mode (resolutions ...) */ 54 - int (*set_mode)(struct lcd_device *, struct fb_videomode *); 55 - /* Check if given framebuffer device is the one LCD is bound to; 56 - return 0 if not, !=0 if it is. If NULL, lcd always matches the fb. */ 57 - int (*check_fb)(struct lcd_device *, struct fb_info *); 50 + 51 + /* 52 + * Set LCD panel mode (resolutions ...) 53 + */ 54 + int (*set_mode)(struct lcd_device *lcd, u32 xres, u32 yres); 55 + 56 + /* 57 + * Check if the LCD controls the given display device. This 58 + * operation is optional and if not implemented it is assumed that 59 + * the display is always the one controlled by the LCD. 60 + * 61 + * RETURNS: 62 + * 63 + * If display_dev is NULL or display_dev matches the device controlled by 64 + * the LCD, return true. Otherwise return false. 65 + */ 66 + bool (*controls_device)(struct lcd_device *lcd, struct device *display_device); 58 67 }; 59 68 60 69 struct lcd_device {
-3
include/video/platform_lcd.h
··· 8 8 */ 9 9 10 10 struct plat_lcd_data; 11 - struct fb_info; 12 11 13 12 struct plat_lcd_data { 14 13 int (*probe)(struct plat_lcd_data *); 15 14 void (*set_power)(struct plat_lcd_data *, unsigned int power); 16 - int (*match_fb)(struct plat_lcd_data *, struct fb_info *); 17 15 }; 18 -