• Home
  • Raw
  • Download

Lines Matching refs:bd

99 	struct backlight_device *bd;  in fb_notifier_callback()  local
108 bd = container_of(self, struct backlight_device, fb_notif); in fb_notifier_callback()
109 mutex_lock(&bd->ops_lock); in fb_notifier_callback()
111 if (!bd->ops) in fb_notifier_callback()
113 if (bd->ops->check_fb && !bd->ops->check_fb(bd, evdata->info)) in fb_notifier_callback()
117 if (fb_blank == FB_BLANK_UNBLANK && !bd->fb_bl_on[node]) { in fb_notifier_callback()
118 bd->fb_bl_on[node] = true; in fb_notifier_callback()
119 if (!bd->use_count++) { in fb_notifier_callback()
120 bd->props.state &= ~BL_CORE_FBBLANK; in fb_notifier_callback()
121 bd->props.fb_blank = FB_BLANK_UNBLANK; in fb_notifier_callback()
122 backlight_update_status(bd); in fb_notifier_callback()
124 } else if (fb_blank != FB_BLANK_UNBLANK && bd->fb_bl_on[node]) { in fb_notifier_callback()
125 bd->fb_bl_on[node] = false; in fb_notifier_callback()
126 if (!(--bd->use_count)) { in fb_notifier_callback()
127 bd->props.state |= BL_CORE_FBBLANK; in fb_notifier_callback()
128 bd->props.fb_blank = fb_blank; in fb_notifier_callback()
129 backlight_update_status(bd); in fb_notifier_callback()
133 mutex_unlock(&bd->ops_lock); in fb_notifier_callback()
137 static int backlight_register_fb(struct backlight_device *bd) in backlight_register_fb() argument
139 memset(&bd->fb_notif, 0, sizeof(bd->fb_notif)); in backlight_register_fb()
140 bd->fb_notif.notifier_call = fb_notifier_callback; in backlight_register_fb()
142 return fb_register_client(&bd->fb_notif); in backlight_register_fb()
145 static void backlight_unregister_fb(struct backlight_device *bd) in backlight_unregister_fb() argument
147 fb_unregister_client(&bd->fb_notif); in backlight_unregister_fb()
150 static inline int backlight_register_fb(struct backlight_device *bd) in backlight_register_fb() argument
155 static inline void backlight_unregister_fb(struct backlight_device *bd) in backlight_unregister_fb() argument
160 static void backlight_generate_event(struct backlight_device *bd, in backlight_generate_event() argument
177 kobject_uevent_env(&bd->dev.kobj, KOBJ_CHANGE, envp); in backlight_generate_event()
178 sysfs_notify(&bd->dev.kobj, NULL, "actual_brightness"); in backlight_generate_event()
184 struct backlight_device *bd = to_backlight_device(dev); in bl_power_show() local
186 return sprintf(buf, "%d\n", bd->props.power); in bl_power_show()
193 struct backlight_device *bd = to_backlight_device(dev); in bl_power_store() local
201 mutex_lock(&bd->ops_lock); in bl_power_store()
202 if (bd->ops) { in bl_power_store()
204 if (bd->props.power != power) { in bl_power_store()
205 old_power = bd->props.power; in bl_power_store()
206 bd->props.power = power; in bl_power_store()
207 rc = backlight_update_status(bd); in bl_power_store()
209 bd->props.power = old_power; in bl_power_store()
216 mutex_unlock(&bd->ops_lock); in bl_power_store()
225 struct backlight_device *bd = to_backlight_device(dev); in brightness_show() local
227 return sprintf(buf, "%d\n", bd->props.brightness); in brightness_show()
230 int backlight_device_set_brightness(struct backlight_device *bd, in backlight_device_set_brightness() argument
235 mutex_lock(&bd->ops_lock); in backlight_device_set_brightness()
236 if (bd->ops) { in backlight_device_set_brightness()
237 if (brightness > bd->props.max_brightness) in backlight_device_set_brightness()
241 bd->props.brightness = brightness; in backlight_device_set_brightness()
242 rc = backlight_update_status(bd); in backlight_device_set_brightness()
245 mutex_unlock(&bd->ops_lock); in backlight_device_set_brightness()
247 backlight_generate_event(bd, BACKLIGHT_UPDATE_SYSFS); in backlight_device_set_brightness()
257 struct backlight_device *bd = to_backlight_device(dev); in brightness_store() local
264 rc = backlight_device_set_brightness(bd, brightness); in brightness_store()
273 struct backlight_device *bd = to_backlight_device(dev); in type_show() local
275 return sprintf(buf, "%s\n", backlight_types[bd->props.type]); in type_show()
282 struct backlight_device *bd = to_backlight_device(dev); in max_brightness_show() local
284 return sprintf(buf, "%d\n", bd->props.max_brightness); in max_brightness_show()
292 struct backlight_device *bd = to_backlight_device(dev); in actual_brightness_show() local
294 mutex_lock(&bd->ops_lock); in actual_brightness_show()
295 if (bd->ops && bd->ops->get_brightness) in actual_brightness_show()
296 rc = sprintf(buf, "%d\n", bd->ops->get_brightness(bd)); in actual_brightness_show()
298 rc = sprintf(buf, "%d\n", bd->props.brightness); in actual_brightness_show()
299 mutex_unlock(&bd->ops_lock); in actual_brightness_show()
308 struct backlight_device *bd = to_backlight_device(dev); in scale_show() local
310 if (WARN_ON(bd->props.scale > BACKLIGHT_SCALE_NON_LINEAR)) in scale_show()
313 return sprintf(buf, "%s\n", backlight_scale_types[bd->props.scale]); in scale_show()
322 struct backlight_device *bd = to_backlight_device(dev); in backlight_suspend() local
324 mutex_lock(&bd->ops_lock); in backlight_suspend()
325 if (bd->ops && bd->ops->options & BL_CORE_SUSPENDRESUME) { in backlight_suspend()
326 bd->props.state |= BL_CORE_SUSPENDED; in backlight_suspend()
327 backlight_update_status(bd); in backlight_suspend()
329 mutex_unlock(&bd->ops_lock); in backlight_suspend()
336 struct backlight_device *bd = to_backlight_device(dev); in backlight_resume() local
338 mutex_lock(&bd->ops_lock); in backlight_resume()
339 if (bd->ops && bd->ops->options & BL_CORE_SUSPENDRESUME) { in backlight_resume()
340 bd->props.state &= ~BL_CORE_SUSPENDED; in backlight_resume()
341 backlight_update_status(bd); in backlight_resume()
343 mutex_unlock(&bd->ops_lock); in backlight_resume()
354 struct backlight_device *bd = to_backlight_device(dev); in bl_device_release() local
355 kfree(bd); in bl_device_release()
381 void backlight_force_update(struct backlight_device *bd, in backlight_force_update() argument
384 mutex_lock(&bd->ops_lock); in backlight_force_update()
385 if (bd->ops && bd->ops->get_brightness) in backlight_force_update()
386 bd->props.brightness = bd->ops->get_brightness(bd); in backlight_force_update()
387 mutex_unlock(&bd->ops_lock); in backlight_force_update()
388 backlight_generate_event(bd, reason); in backlight_force_update()
471 struct backlight_device *bd; in backlight_device_get_by_type() local
474 list_for_each_entry(bd, &backlight_dev_list, entry) { in backlight_device_get_by_type()
475 if (bd->props.type == type) { in backlight_device_get_by_type()
482 return found ? bd : NULL; in backlight_device_get_by_type()
508 void backlight_device_unregister(struct backlight_device *bd) in backlight_device_unregister() argument
510 if (!bd) in backlight_device_unregister()
514 list_del(&bd->entry); in backlight_device_unregister()
519 if (pmac_backlight == bd) in backlight_device_unregister()
525 BACKLIGHT_UNREGISTERED, bd); in backlight_device_unregister()
527 mutex_lock(&bd->ops_lock); in backlight_device_unregister()
528 bd->ops = NULL; in backlight_device_unregister()
529 mutex_unlock(&bd->ops_lock); in backlight_device_unregister()
531 backlight_unregister_fb(bd); in backlight_device_unregister()
532 device_unregister(&bd->dev); in backlight_device_unregister()
637 struct backlight_device *bd) in devm_backlight_device_unregister() argument
642 devm_backlight_device_match, bd); in devm_backlight_device_unregister()
678 struct backlight_device *bd = NULL; in of_find_backlight() local
687 bd = of_find_backlight_by_node(np); in of_find_backlight()
689 if (!bd) in of_find_backlight()
694 return bd; in of_find_backlight()
699 struct backlight_device *bd = data; in devm_backlight_release() local
701 if (bd) in devm_backlight_release()
702 put_device(&bd->dev); in devm_backlight_release()
722 struct backlight_device *bd; in devm_of_find_backlight() local
725 bd = of_find_backlight(dev); in devm_of_find_backlight()
726 if (IS_ERR_OR_NULL(bd)) in devm_of_find_backlight()
727 return bd; in devm_of_find_backlight()
728 ret = devm_add_action(dev, devm_backlight_release, bd); in devm_of_find_backlight()
730 put_device(&bd->dev); in devm_of_find_backlight()
733 return bd; in devm_of_find_backlight()