Lines Matching +full:bl +full:- +full:name
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (C) 2009-2010, Lars-Peter Clausen <lars@metafoo.de>
20 struct backlight_device *bl; member
34 * @limit: The brightness limit. Valid values are 0-63
38 struct pcf50633_bl *pcf_bl = platform_get_drvdata(pcf->bl_pdev); in pcf50633_bl_set_brightness_limit()
41 return -ENODEV; in pcf50633_bl_set_brightness_limit()
43 pcf_bl->brightness_limit = limit & 0x3f; in pcf50633_bl_set_brightness_limit()
44 backlight_update_status(pcf_bl->bl); in pcf50633_bl_set_brightness_limit()
49 static int pcf50633_bl_update_status(struct backlight_device *bl) in pcf50633_bl_update_status() argument
51 struct pcf50633_bl *pcf_bl = bl_get_data(bl); in pcf50633_bl_update_status()
55 if (bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK) || in pcf50633_bl_update_status()
56 bl->props.power != FB_BLANK_UNBLANK) in pcf50633_bl_update_status()
58 else if (bl->props.brightness < pcf_bl->brightness_limit) in pcf50633_bl_update_status()
59 new_brightness = bl->props.brightness; in pcf50633_bl_update_status()
61 new_brightness = pcf_bl->brightness_limit; in pcf50633_bl_update_status()
64 if (pcf_bl->brightness == new_brightness) in pcf50633_bl_update_status()
68 pcf50633_reg_write(pcf_bl->pcf, PCF50633_REG_LEDOUT, in pcf50633_bl_update_status()
70 if (!pcf_bl->brightness) in pcf50633_bl_update_status()
71 pcf50633_reg_write(pcf_bl->pcf, PCF50633_REG_LEDENA, 1); in pcf50633_bl_update_status()
73 pcf50633_reg_write(pcf_bl->pcf, PCF50633_REG_LEDENA, 0); in pcf50633_bl_update_status()
76 pcf_bl->brightness = new_brightness; in pcf50633_bl_update_status()
81 static int pcf50633_bl_get_brightness(struct backlight_device *bl) in pcf50633_bl_get_brightness() argument
83 struct pcf50633_bl *pcf_bl = bl_get_data(bl); in pcf50633_bl_get_brightness()
85 return pcf_bl->brightness; in pcf50633_bl_get_brightness()
97 struct device *parent = pdev->dev.parent; in pcf50633_bl_probe()
99 struct pcf50633_bl_platform_data *pdata = pcf50633_data->backlight_data; in pcf50633_bl_probe()
102 pcf_bl = devm_kzalloc(&pdev->dev, sizeof(*pcf_bl), GFP_KERNEL); in pcf50633_bl_probe()
104 return -ENOMEM; in pcf50633_bl_probe()
112 bl_props.brightness = pdata->default_brightness; in pcf50633_bl_probe()
113 pcf_bl->brightness_limit = pdata->default_brightness_limit; in pcf50633_bl_probe()
116 pcf_bl->brightness_limit = 0x3f; in pcf50633_bl_probe()
119 pcf_bl->pcf = dev_to_pcf50633(pdev->dev.parent); in pcf50633_bl_probe()
121 pcf_bl->bl = devm_backlight_device_register(&pdev->dev, pdev->name, in pcf50633_bl_probe()
122 &pdev->dev, pcf_bl, in pcf50633_bl_probe()
125 if (IS_ERR(pcf_bl->bl)) in pcf50633_bl_probe()
126 return PTR_ERR(pcf_bl->bl); in pcf50633_bl_probe()
130 pcf50633_reg_write(pcf_bl->pcf, PCF50633_REG_LEDDIM, pdata->ramp_time); in pcf50633_bl_probe()
136 pcf_bl->brightness = pcf_bl->bl->props.brightness + 1; in pcf50633_bl_probe()
138 backlight_update_status(pcf_bl->bl); in pcf50633_bl_probe()
146 .name = "pcf50633-backlight",
152 MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
155 MODULE_ALIAS("platform:pcf50633-backlight");