Lines Matching +full:power +full:- +full:managed

1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright (C) 2003,2004 Hewlett-Packard Company
25 * and if it is, we're switching lcd power as well ...
34 if (!ld->ops) in fb_notifier_callback()
37 mutex_lock(&ld->ops_lock); in fb_notifier_callback()
38 if (!ld->ops->check_fb || ld->ops->check_fb(ld, evdata->info)) { in fb_notifier_callback()
40 if (ld->ops->set_power) in fb_notifier_callback()
41 ld->ops->set_power(ld, *(int *)evdata->data); in fb_notifier_callback()
43 if (ld->ops->set_mode) in fb_notifier_callback()
44 ld->ops->set_mode(ld, evdata->data); in fb_notifier_callback()
47 mutex_unlock(&ld->ops_lock); in fb_notifier_callback()
53 memset(&ld->fb_notif, 0, sizeof(ld->fb_notif)); in lcd_register_fb()
54 ld->fb_notif.notifier_call = fb_notifier_callback; in lcd_register_fb()
55 return fb_register_client(&ld->fb_notif); in lcd_register_fb()
60 fb_unregister_client(&ld->fb_notif); in lcd_unregister_fb()
79 mutex_lock(&ld->ops_lock); in lcd_power_show()
80 if (ld->ops && ld->ops->get_power) in lcd_power_show()
81 rc = sprintf(buf, "%d\n", ld->ops->get_power(ld)); in lcd_power_show()
83 rc = -ENXIO; in lcd_power_show()
84 mutex_unlock(&ld->ops_lock); in lcd_power_show()
94 unsigned long power; in lcd_power_store() local
96 rc = kstrtoul(buf, 0, &power); in lcd_power_store()
100 rc = -ENXIO; in lcd_power_store()
102 mutex_lock(&ld->ops_lock); in lcd_power_store()
103 if (ld->ops && ld->ops->set_power) { in lcd_power_store()
104 pr_debug("set power to %lu\n", power); in lcd_power_store()
105 ld->ops->set_power(ld, power); in lcd_power_store()
108 mutex_unlock(&ld->ops_lock); in lcd_power_store()
117 int rc = -ENXIO; in contrast_show()
120 mutex_lock(&ld->ops_lock); in contrast_show()
121 if (ld->ops && ld->ops->get_contrast) in contrast_show()
122 rc = sprintf(buf, "%d\n", ld->ops->get_contrast(ld)); in contrast_show()
123 mutex_unlock(&ld->ops_lock); in contrast_show()
139 rc = -ENXIO; in contrast_store()
141 mutex_lock(&ld->ops_lock); in contrast_store()
142 if (ld->ops && ld->ops->set_contrast) { in contrast_store()
144 ld->ops->set_contrast(ld, contrast); in contrast_store()
147 mutex_unlock(&ld->ops_lock); in contrast_store()
158 return sprintf(buf, "%d\n", ld->props.max_contrast); in max_contrast_show()
182 * lcd_device_register - register a new object of lcd_device class.
203 return ERR_PTR(-ENOMEM); in lcd_device_register()
205 mutex_init(&new_ld->ops_lock); in lcd_device_register()
206 mutex_init(&new_ld->update_lock); in lcd_device_register()
208 new_ld->dev.class = &lcd_class; in lcd_device_register()
209 new_ld->dev.parent = parent; in lcd_device_register()
210 new_ld->dev.release = lcd_device_release; in lcd_device_register()
211 dev_set_name(&new_ld->dev, "%s", name); in lcd_device_register()
212 dev_set_drvdata(&new_ld->dev, devdata); in lcd_device_register()
214 new_ld->ops = ops; in lcd_device_register()
216 rc = device_register(&new_ld->dev); in lcd_device_register()
218 put_device(&new_ld->dev); in lcd_device_register()
224 device_unregister(&new_ld->dev); in lcd_device_register()
233 * lcd_device_unregister - unregisters a object of lcd_device class.
243 mutex_lock(&ld->ops_lock); in lcd_device_unregister()
244 ld->ops = NULL; in lcd_device_unregister()
245 mutex_unlock(&ld->ops_lock); in lcd_device_unregister()
248 device_unregister(&ld->dev); in lcd_device_unregister()
267 * devm_lcd_device_register - resource managed lcd_device_register()
276 * Managed lcd_device_register(). The lcd_device returned from this function
288 return ERR_PTR(-ENOMEM); in devm_lcd_device_register()
303 * devm_lcd_device_unregister - resource managed lcd_device_unregister()