Lines Matching refs:bd

80 void backlight_notify_blank(struct backlight_device *bd, struct device *display_dev,  in backlight_notify_blank()  argument
83 guard(mutex)(&bd->ops_lock); in backlight_notify_blank()
85 if (!bd->ops) in backlight_notify_blank()
87 if (bd->ops->controls_device && !bd->ops->controls_device(bd, display_dev)) in backlight_notify_blank()
90 if (fb_on && (!prev_fb_on || !bd->use_count)) { in backlight_notify_blank()
91 if (!bd->use_count++) { in backlight_notify_blank()
92 bd->props.state &= ~BL_CORE_FBBLANK; in backlight_notify_blank()
93 backlight_update_status(bd); in backlight_notify_blank()
95 } else if (!fb_on && prev_fb_on && bd->use_count) { in backlight_notify_blank()
96 if (!(--bd->use_count)) { in backlight_notify_blank()
97 bd->props.state |= BL_CORE_FBBLANK; in backlight_notify_blank()
98 backlight_update_status(bd); in backlight_notify_blank()
106 struct backlight_device *bd; in backlight_notify_blank_all() local
110 list_for_each_entry(bd, &backlight_dev_list, entry) in backlight_notify_blank_all()
111 backlight_notify_blank(bd, display_dev, fb_on, prev_fb_on); in backlight_notify_blank_all()
115 static void backlight_generate_event(struct backlight_device *bd, in backlight_generate_event() argument
132 kobject_uevent_env(&bd->dev.kobj, KOBJ_CHANGE, envp); in backlight_generate_event()
133 sysfs_notify(&bd->dev.kobj, NULL, "actual_brightness"); in backlight_generate_event()
139 struct backlight_device *bd = to_backlight_device(dev); in bl_power_show() local
141 return sprintf(buf, "%d\n", bd->props.power); in bl_power_show()
148 struct backlight_device *bd = to_backlight_device(dev); in bl_power_store() local
156 mutex_lock(&bd->ops_lock); in bl_power_store()
157 if (bd->ops) { in bl_power_store()
159 if (bd->props.power != power) { in bl_power_store()
160 old_power = bd->props.power; in bl_power_store()
161 bd->props.power = power; in bl_power_store()
162 rc = backlight_update_status(bd); in bl_power_store()
164 bd->props.power = old_power; in bl_power_store()
171 mutex_unlock(&bd->ops_lock); in bl_power_store()
180 struct backlight_device *bd = to_backlight_device(dev); in brightness_show() local
182 return sprintf(buf, "%d\n", bd->props.brightness); in brightness_show()
185 int backlight_device_set_brightness(struct backlight_device *bd, in backlight_device_set_brightness() argument
190 mutex_lock(&bd->ops_lock); in backlight_device_set_brightness()
191 if (bd->ops) { in backlight_device_set_brightness()
192 if (brightness > bd->props.max_brightness) in backlight_device_set_brightness()
196 bd->props.brightness = brightness; in backlight_device_set_brightness()
197 rc = backlight_update_status(bd); in backlight_device_set_brightness()
200 mutex_unlock(&bd->ops_lock); in backlight_device_set_brightness()
202 backlight_generate_event(bd, BACKLIGHT_UPDATE_SYSFS); in backlight_device_set_brightness()
212 struct backlight_device *bd = to_backlight_device(dev); in brightness_store() local
219 rc = backlight_device_set_brightness(bd, brightness); in brightness_store()
228 struct backlight_device *bd = to_backlight_device(dev); in type_show() local
230 return sprintf(buf, "%s\n", backlight_types[bd->props.type]); in type_show()
237 struct backlight_device *bd = to_backlight_device(dev); in max_brightness_show() local
239 return sprintf(buf, "%d\n", bd->props.max_brightness); in max_brightness_show()
247 struct backlight_device *bd = to_backlight_device(dev); in actual_brightness_show() local
249 mutex_lock(&bd->ops_lock); in actual_brightness_show()
250 if (bd->ops && bd->ops->get_brightness) { in actual_brightness_show()
251 rc = bd->ops->get_brightness(bd); in actual_brightness_show()
255 rc = sprintf(buf, "%d\n", bd->props.brightness); in actual_brightness_show()
257 mutex_unlock(&bd->ops_lock); in actual_brightness_show()
266 struct backlight_device *bd = to_backlight_device(dev); in scale_show() local
268 if (WARN_ON(bd->props.scale > BACKLIGHT_SCALE_NON_LINEAR)) in scale_show()
271 return sprintf(buf, "%s\n", backlight_scale_types[bd->props.scale]); in scale_show()
278 struct backlight_device *bd = to_backlight_device(dev); in backlight_suspend() local
280 mutex_lock(&bd->ops_lock); in backlight_suspend()
281 if (bd->ops && bd->ops->options & BL_CORE_SUSPENDRESUME) { in backlight_suspend()
282 bd->props.state |= BL_CORE_SUSPENDED; in backlight_suspend()
283 backlight_update_status(bd); in backlight_suspend()
285 mutex_unlock(&bd->ops_lock); in backlight_suspend()
292 struct backlight_device *bd = to_backlight_device(dev); in backlight_resume() local
294 mutex_lock(&bd->ops_lock); in backlight_resume()
295 if (bd->ops && bd->ops->options & BL_CORE_SUSPENDRESUME) { in backlight_resume()
296 bd->props.state &= ~BL_CORE_SUSPENDED; in backlight_resume()
297 backlight_update_status(bd); in backlight_resume()
299 mutex_unlock(&bd->ops_lock); in backlight_resume()
310 struct backlight_device *bd = to_backlight_device(dev); in bl_device_release() local
311 kfree(bd); in bl_device_release()
343 void backlight_force_update(struct backlight_device *bd, in backlight_force_update() argument
348 mutex_lock(&bd->ops_lock); in backlight_force_update()
349 if (bd->ops && bd->ops->get_brightness) { in backlight_force_update()
350 brightness = bd->ops->get_brightness(bd); in backlight_force_update()
352 bd->props.brightness = brightness; in backlight_force_update()
354 dev_err(&bd->dev, in backlight_force_update()
358 mutex_unlock(&bd->ops_lock); in backlight_force_update()
359 backlight_generate_event(bd, reason); in backlight_force_update()
433 struct backlight_device *bd; in backlight_device_get_by_type() local
436 list_for_each_entry(bd, &backlight_dev_list, entry) { in backlight_device_get_by_type()
437 if (bd->props.type == type) { in backlight_device_get_by_type()
444 return found ? bd : NULL; in backlight_device_get_by_type()
470 void backlight_device_unregister(struct backlight_device *bd) in backlight_device_unregister() argument
472 if (!bd) in backlight_device_unregister()
476 list_del(&bd->entry); in backlight_device_unregister()
481 if (pmac_backlight == bd) in backlight_device_unregister()
486 mutex_lock(&bd->ops_lock); in backlight_device_unregister()
487 bd->ops = NULL; in backlight_device_unregister()
488 mutex_unlock(&bd->ops_lock); in backlight_device_unregister()
490 device_unregister(&bd->dev); in backlight_device_unregister()
561 struct backlight_device *bd) in devm_backlight_device_unregister() argument
566 devm_backlight_device_match, bd); in devm_backlight_device_unregister()
602 struct backlight_device *bd = NULL; in of_find_backlight() local
611 bd = of_find_backlight_by_node(np); in of_find_backlight()
613 if (!bd) in of_find_backlight()
618 return bd; in of_find_backlight()
623 struct backlight_device *bd = data; in devm_backlight_release() local
625 put_device(&bd->dev); in devm_backlight_release()
645 struct backlight_device *bd; in devm_of_find_backlight() local
648 bd = of_find_backlight(dev); in devm_of_find_backlight()
649 if (IS_ERR_OR_NULL(bd)) in devm_of_find_backlight()
650 return bd; in devm_of_find_backlight()
651 ret = devm_add_action_or_reset(dev, devm_backlight_release, bd); in devm_of_find_backlight()
655 return bd; in devm_of_find_backlight()