• Home
  • Raw
  • Download

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

4  * Copyright (C) 2003,2004 Hewlett-Packard Company
38 * and if it is and necessary, we're switching backlight power as well ...
45 int node = evdata->info->node; in fb_notifier_callback()
53 mutex_lock(&bd->ops_lock); in fb_notifier_callback()
54 if (bd->ops) in fb_notifier_callback()
55 if (!bd->ops->check_fb || in fb_notifier_callback()
56 bd->ops->check_fb(bd, evdata->info)) { in fb_notifier_callback()
57 fb_blank = *(int *)evdata->data; in fb_notifier_callback()
59 !bd->fb_bl_on[node]) { in fb_notifier_callback()
60 bd->fb_bl_on[node] = true; in fb_notifier_callback()
61 if (!bd->use_count++) { in fb_notifier_callback()
62 bd->props.state &= ~BL_CORE_FBBLANK; in fb_notifier_callback()
63 bd->props.fb_blank = FB_BLANK_UNBLANK; in fb_notifier_callback()
67 bd->fb_bl_on[node]) { in fb_notifier_callback()
68 bd->fb_bl_on[node] = false; in fb_notifier_callback()
69 if (!(--bd->use_count)) { in fb_notifier_callback()
70 bd->props.state |= BL_CORE_FBBLANK; in fb_notifier_callback()
71 bd->props.fb_blank = fb_blank; in fb_notifier_callback()
76 mutex_unlock(&bd->ops_lock); in fb_notifier_callback()
82 memset(&bd->fb_notif, 0, sizeof(bd->fb_notif)); in backlight_register_fb()
83 bd->fb_notif.notifier_call = fb_notifier_callback; in backlight_register_fb()
85 return fb_register_client(&bd->fb_notif); in backlight_register_fb()
90 fb_unregister_client(&bd->fb_notif); in backlight_unregister_fb()
120 kobject_uevent_env(&bd->dev.kobj, KOBJ_CHANGE, envp); in backlight_generate_event()
121 sysfs_notify(&bd->dev.kobj, NULL, "actual_brightness"); in backlight_generate_event()
129 return sprintf(buf, "%d\n", bd->props.power); in bl_power_show()
137 unsigned long power, old_power; in bl_power_store() local
139 rc = kstrtoul(buf, 0, &power); in bl_power_store()
143 rc = -ENXIO; in bl_power_store()
144 mutex_lock(&bd->ops_lock); in bl_power_store()
145 if (bd->ops) { in bl_power_store()
146 pr_debug("set power to %lu\n", power); in bl_power_store()
147 if (bd->props.power != power) { in bl_power_store()
148 old_power = bd->props.power; in bl_power_store()
149 bd->props.power = power; in bl_power_store()
152 bd->props.power = old_power; in bl_power_store()
159 mutex_unlock(&bd->ops_lock); in bl_power_store()
170 return sprintf(buf, "%d\n", bd->props.brightness); in brightness_show()
176 int rc = -ENXIO; in backlight_device_set_brightness()
178 mutex_lock(&bd->ops_lock); in backlight_device_set_brightness()
179 if (bd->ops) { in backlight_device_set_brightness()
180 if (brightness > bd->props.max_brightness) in backlight_device_set_brightness()
181 rc = -EINVAL; in backlight_device_set_brightness()
184 bd->props.brightness = brightness; in backlight_device_set_brightness()
188 mutex_unlock(&bd->ops_lock); in backlight_device_set_brightness()
218 return sprintf(buf, "%s\n", backlight_types[bd->props.type]); in type_show()
227 return sprintf(buf, "%d\n", bd->props.max_brightness); in max_brightness_show()
234 int rc = -ENXIO; in actual_brightness_show()
237 mutex_lock(&bd->ops_lock); in actual_brightness_show()
238 if (bd->ops && bd->ops->get_brightness) in actual_brightness_show()
239 rc = sprintf(buf, "%d\n", bd->ops->get_brightness(bd)); in actual_brightness_show()
241 rc = sprintf(buf, "%d\n", bd->props.brightness); in actual_brightness_show()
242 mutex_unlock(&bd->ops_lock); in actual_brightness_show()
255 mutex_lock(&bd->ops_lock); in backlight_suspend()
256 if (bd->ops && bd->ops->options & BL_CORE_SUSPENDRESUME) { in backlight_suspend()
257 bd->props.state |= BL_CORE_SUSPENDED; in backlight_suspend()
260 mutex_unlock(&bd->ops_lock); in backlight_suspend()
269 mutex_lock(&bd->ops_lock); in backlight_resume()
270 if (bd->ops && bd->ops->options & BL_CORE_SUSPENDRESUME) { in backlight_resume()
271 bd->props.state &= ~BL_CORE_SUSPENDED; in backlight_resume()
274 mutex_unlock(&bd->ops_lock); in backlight_resume()
300 * backlight_force_update - tell the backlight subsystem that hardware state
310 mutex_lock(&bd->ops_lock); in backlight_force_update()
311 if (bd->ops && bd->ops->get_brightness) in backlight_force_update()
312 bd->props.brightness = bd->ops->get_brightness(bd); in backlight_force_update()
313 mutex_unlock(&bd->ops_lock); in backlight_force_update()
319 * backlight_device_register - create and register a new object of
342 return ERR_PTR(-ENOMEM); in backlight_device_register()
344 mutex_init(&new_bd->update_lock); in backlight_device_register()
345 mutex_init(&new_bd->ops_lock); in backlight_device_register()
347 new_bd->dev.class = backlight_class; in backlight_device_register()
348 new_bd->dev.parent = parent; in backlight_device_register()
349 new_bd->dev.release = bl_device_release; in backlight_device_register()
350 dev_set_name(&new_bd->dev, "%s", name); in backlight_device_register()
351 dev_set_drvdata(&new_bd->dev, devdata); in backlight_device_register()
355 memcpy(&new_bd->props, props, in backlight_device_register()
357 if (props->type <= 0 || props->type >= BACKLIGHT_TYPE_MAX) { in backlight_device_register()
359 new_bd->props.type = BACKLIGHT_RAW; in backlight_device_register()
362 new_bd->props.type = BACKLIGHT_RAW; in backlight_device_register()
365 rc = device_register(&new_bd->dev); in backlight_device_register()
367 put_device(&new_bd->dev); in backlight_device_register()
373 device_unregister(&new_bd->dev); in backlight_device_register()
377 new_bd->ops = ops; in backlight_device_register()
387 list_add(&new_bd->entry, &backlight_dev_list); in backlight_device_register()
404 if (bd->props.type == type) { in backlight_device_get_by_type()
416 * backlight_device_unregister - unregisters a backlight device object.
427 list_del(&bd->entry); in backlight_device_unregister()
440 mutex_lock(&bd->ops_lock); in backlight_device_unregister()
441 bd->ops = NULL; in backlight_device_unregister()
442 mutex_unlock(&bd->ops_lock); in backlight_device_unregister()
445 device_unregister(&bd->dev); in backlight_device_unregister()
465 * backlight_register_notifier - get notified of backlight (un)registration
480 * backlight_unregister_notifier - unregister a backlight notifier
495 * devm_backlight_device_register - resource managed backlight_device_register()
505 * Managed backlight_device_register(). The backlight_device returned
519 return ERR_PTR(-ENOMEM); in devm_backlight_device_register()
535 * devm_backlight_device_unregister - resource managed backlight_device_unregister()
557 return dev->parent && dev->parent->of_node == data; in of_parent_match()
561 * of_find_backlight_by_node() - find backlight device by device-tree node
562 * @node: device-tree node of the backlight device
584 * of_find_backlight - Get backlight device
594 * Error pointer -EPROBE_DEFER if the DT property is set, but no backlight
606 if (IS_ENABLED(CONFIG_OF) && dev->of_node) { in of_find_backlight()
607 np = of_parse_phandle(dev->of_node, "backlight", 0); in of_find_backlight()
612 return ERR_PTR(-EPROBE_DEFER); in of_find_backlight()
615 * power state during probe in of_find_backlight()
617 if (!bd->props.brightness) in of_find_backlight()
618 bd->props.brightness = bd->props.max_brightness; in of_find_backlight()
632 * devm_of_find_backlight - Resource-managed of_find_backlight()
635 * Device managed version of of_find_backlight().
670 backlight_class->dev_groups = bl_device_groups; in backlight_class_init()
671 backlight_class->pm = &backlight_class_dev_pm_ops; in backlight_class_init()