Lines Matching full:bd

81 void backlight_notify_blank(struct backlight_device *bd, struct device *display_dev,  in backlight_notify_blank()  argument
84 guard(mutex)(&bd->ops_lock); in backlight_notify_blank()
86 if (!bd->ops) in backlight_notify_blank()
88 if (bd->ops->controls_device && !bd->ops->controls_device(bd, display_dev)) in backlight_notify_blank()
91 if (fb_on && (!prev_fb_on || !bd->use_count)) { in backlight_notify_blank()
92 if (!bd->use_count++) { in backlight_notify_blank()
93 bd->props.state &= ~BL_CORE_FBBLANK; in backlight_notify_blank()
94 backlight_update_status(bd); in backlight_notify_blank()
96 } else if (!fb_on && prev_fb_on && bd->use_count) { in backlight_notify_blank()
97 if (!(--bd->use_count)) { in backlight_notify_blank()
98 bd->props.state |= BL_CORE_FBBLANK; in backlight_notify_blank()
99 backlight_update_status(bd); in backlight_notify_blank()
107 struct backlight_device *bd; in backlight_notify_blank_all() local
111 list_for_each_entry(bd, &backlight_dev_list, entry) in backlight_notify_blank_all()
112 backlight_notify_blank(bd, display_dev, fb_on, prev_fb_on); in backlight_notify_blank_all()
116 static void backlight_generate_event(struct backlight_device *bd, in backlight_generate_event() argument
133 kobject_uevent_env(&bd->dev.kobj, KOBJ_CHANGE, envp); in backlight_generate_event()
134 sysfs_notify(&bd->dev.kobj, NULL, "actual_brightness"); in backlight_generate_event()
140 struct backlight_device *bd = to_backlight_device(dev); in bl_power_show() local
142 return sprintf(buf, "%d\n", bd->props.power); in bl_power_show()
149 struct backlight_device *bd = to_backlight_device(dev); in bl_power_store() local
157 mutex_lock(&bd->ops_lock); in bl_power_store()
158 if (bd->ops) { in bl_power_store()
160 if (bd->props.power != power) { in bl_power_store()
161 old_power = bd->props.power; in bl_power_store()
162 bd->props.power = power; in bl_power_store()
163 rc = backlight_update_status(bd); in bl_power_store()
165 bd->props.power = old_power; in bl_power_store()
172 mutex_unlock(&bd->ops_lock); in bl_power_store()
181 struct backlight_device *bd = to_backlight_device(dev); in brightness_show() local
183 return sprintf(buf, "%d\n", bd->props.brightness); in brightness_show()
186 int backlight_device_set_brightness(struct backlight_device *bd, in backlight_device_set_brightness() argument
191 mutex_lock(&bd->ops_lock); in backlight_device_set_brightness()
192 if (bd->ops) { in backlight_device_set_brightness()
193 if (brightness > bd->props.max_brightness) in backlight_device_set_brightness()
197 bd->props.brightness = brightness; in backlight_device_set_brightness()
198 rc = backlight_update_status(bd); in backlight_device_set_brightness()
201 mutex_unlock(&bd->ops_lock); in backlight_device_set_brightness()
203 backlight_generate_event(bd, BACKLIGHT_UPDATE_SYSFS); in backlight_device_set_brightness()
213 struct backlight_device *bd = to_backlight_device(dev); in brightness_store() local
220 rc = backlight_device_set_brightness(bd, brightness); in brightness_store()
229 struct backlight_device *bd = to_backlight_device(dev); in type_show() local
231 return sprintf(buf, "%s\n", backlight_types[bd->props.type]); in type_show()
238 struct backlight_device *bd = to_backlight_device(dev); in max_brightness_show() local
240 return sprintf(buf, "%d\n", bd->props.max_brightness); in max_brightness_show()
248 struct backlight_device *bd = to_backlight_device(dev); in actual_brightness_show() local
250 mutex_lock(&bd->ops_lock); in actual_brightness_show()
251 if (bd->ops && bd->ops->get_brightness) { in actual_brightness_show()
252 rc = bd->ops->get_brightness(bd); in actual_brightness_show()
256 rc = sprintf(buf, "%d\n", bd->props.brightness); in actual_brightness_show()
258 mutex_unlock(&bd->ops_lock); in actual_brightness_show()
267 struct backlight_device *bd = to_backlight_device(dev); in scale_show() local
269 if (WARN_ON(bd->props.scale > BACKLIGHT_SCALE_NON_LINEAR)) in scale_show()
272 return sprintf(buf, "%s\n", backlight_scale_types[bd->props.scale]); in scale_show()
279 struct backlight_device *bd = to_backlight_device(dev); in backlight_suspend() local
281 mutex_lock(&bd->ops_lock); in backlight_suspend()
282 if (bd->ops && bd->ops->options & BL_CORE_SUSPENDRESUME) { in backlight_suspend()
283 bd->props.state |= BL_CORE_SUSPENDED; in backlight_suspend()
284 backlight_update_status(bd); in backlight_suspend()
286 mutex_unlock(&bd->ops_lock); in backlight_suspend()
293 struct backlight_device *bd = to_backlight_device(dev); in backlight_resume() local
295 mutex_lock(&bd->ops_lock); in backlight_resume()
296 if (bd->ops && bd->ops->options & BL_CORE_SUSPENDRESUME) { in backlight_resume()
297 bd->props.state &= ~BL_CORE_SUSPENDED; in backlight_resume()
298 backlight_update_status(bd); in backlight_resume()
300 mutex_unlock(&bd->ops_lock); in backlight_resume()
311 struct backlight_device *bd = to_backlight_device(dev); in bl_device_release() local
312 kfree(bd); in bl_device_release()
335 * @bd: the backlight device to update
344 void backlight_force_update(struct backlight_device *bd, in backlight_force_update() argument
349 mutex_lock(&bd->ops_lock); in backlight_force_update()
350 if (bd->ops && bd->ops->get_brightness) { in backlight_force_update()
351 brightness = bd->ops->get_brightness(bd); in backlight_force_update()
353 bd->props.brightness = brightness; in backlight_force_update()
355 dev_err(&bd->dev, in backlight_force_update()
359 mutex_unlock(&bd->ops_lock); in backlight_force_update()
360 backlight_generate_event(bd, reason); in backlight_force_update()
434 struct backlight_device *bd; in backlight_device_get_by_type() local
437 list_for_each_entry(bd, &backlight_dev_list, entry) { in backlight_device_get_by_type()
438 if (bd->props.type == type) { in backlight_device_get_by_type()
445 return found ? bd : NULL; in backlight_device_get_by_type()
471 void backlight_device_unregister(struct backlight_device *bd) in backlight_device_unregister() argument
473 if (!bd) in backlight_device_unregister()
477 list_del(&bd->entry); in backlight_device_unregister()
482 if (pmac_backlight == bd) in backlight_device_unregister()
487 mutex_lock(&bd->ops_lock); in backlight_device_unregister()
488 bd->ops = NULL; in backlight_device_unregister()
489 mutex_unlock(&bd->ops_lock); in backlight_device_unregister()
491 device_unregister(&bd->dev); in backlight_device_unregister()
555 * @bd: the backlight device to unregister
562 struct backlight_device *bd) in devm_backlight_device_unregister() argument
567 devm_backlight_device_match, bd); in devm_backlight_device_unregister()
603 struct backlight_device *bd = NULL; in of_find_backlight() local
612 bd = of_find_backlight_by_node(np); in of_find_backlight()
614 if (!bd) in of_find_backlight()
619 return bd; in of_find_backlight()
624 struct backlight_device *bd = data; in devm_backlight_release() local
626 put_device(&bd->dev); in devm_backlight_release()
646 struct backlight_device *bd; in devm_of_find_backlight() local
649 bd = of_find_backlight(dev); in devm_of_find_backlight()
650 if (IS_ERR_OR_NULL(bd)) in devm_of_find_backlight()
651 return bd; in devm_of_find_backlight()
652 ret = devm_add_action_or_reset(dev, devm_backlight_release, bd); in devm_of_find_backlight()
656 return bd; in devm_of_find_backlight()