Lines Matching +full:bl +full:- +full:name
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (C) 2009-2010, Lars-Peter Clausen <[email protected]>
19 struct backlight_device *bl; member
33 * @limit: The brightness limit. Valid values are 0-63
37 struct pcf50633_bl *pcf_bl = platform_get_drvdata(pcf->bl_pdev); in pcf50633_bl_set_brightness_limit()
40 return -ENODEV; in pcf50633_bl_set_brightness_limit()
42 pcf_bl->brightness_limit = limit & 0x3f; in pcf50633_bl_set_brightness_limit()
43 backlight_update_status(pcf_bl->bl); in pcf50633_bl_set_brightness_limit()
48 static int pcf50633_bl_update_status(struct backlight_device *bl) in pcf50633_bl_update_status() argument
50 struct pcf50633_bl *pcf_bl = bl_get_data(bl); in pcf50633_bl_update_status()
54 if (bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK) || in pcf50633_bl_update_status()
55 bl->props.power != BACKLIGHT_POWER_ON) in pcf50633_bl_update_status()
57 else if (bl->props.brightness < pcf_bl->brightness_limit) in pcf50633_bl_update_status()
58 new_brightness = bl->props.brightness; in pcf50633_bl_update_status()
60 new_brightness = pcf_bl->brightness_limit; in pcf50633_bl_update_status()
63 if (pcf_bl->brightness == new_brightness) in pcf50633_bl_update_status()
67 pcf50633_reg_write(pcf_bl->pcf, PCF50633_REG_LEDOUT, in pcf50633_bl_update_status()
69 if (!pcf_bl->brightness) in pcf50633_bl_update_status()
70 pcf50633_reg_write(pcf_bl->pcf, PCF50633_REG_LEDENA, 1); in pcf50633_bl_update_status()
72 pcf50633_reg_write(pcf_bl->pcf, PCF50633_REG_LEDENA, 0); in pcf50633_bl_update_status()
75 pcf_bl->brightness = new_brightness; in pcf50633_bl_update_status()
80 static int pcf50633_bl_get_brightness(struct backlight_device *bl) in pcf50633_bl_get_brightness() argument
82 struct pcf50633_bl *pcf_bl = bl_get_data(bl); in pcf50633_bl_get_brightness()
84 return pcf_bl->brightness; in pcf50633_bl_get_brightness()
96 struct device *parent = pdev->dev.parent; in pcf50633_bl_probe()
98 struct pcf50633_bl_platform_data *pdata = pcf50633_data->backlight_data; in pcf50633_bl_probe()
101 pcf_bl = devm_kzalloc(&pdev->dev, sizeof(*pcf_bl), GFP_KERNEL); in pcf50633_bl_probe()
103 return -ENOMEM; in pcf50633_bl_probe()
111 bl_props.brightness = pdata->default_brightness; in pcf50633_bl_probe()
112 pcf_bl->brightness_limit = pdata->default_brightness_limit; in pcf50633_bl_probe()
115 pcf_bl->brightness_limit = 0x3f; in pcf50633_bl_probe()
118 pcf_bl->pcf = dev_to_pcf50633(pdev->dev.parent); in pcf50633_bl_probe()
120 pcf_bl->bl = devm_backlight_device_register(&pdev->dev, pdev->name, in pcf50633_bl_probe()
121 &pdev->dev, pcf_bl, in pcf50633_bl_probe()
124 if (IS_ERR(pcf_bl->bl)) in pcf50633_bl_probe()
125 return PTR_ERR(pcf_bl->bl); in pcf50633_bl_probe()
129 pcf50633_reg_write(pcf_bl->pcf, PCF50633_REG_LEDDIM, pdata->ramp_time); in pcf50633_bl_probe()
135 pcf_bl->brightness = pcf_bl->bl->props.brightness + 1; in pcf50633_bl_probe()
137 backlight_update_status(pcf_bl->bl); in pcf50633_bl_probe()
145 .name = "pcf50633-backlight",
151 MODULE_AUTHOR("Lars-Peter Clausen <[email protected]>");
154 MODULE_ALIAS("platform:pcf50633-backlight");