Lines Matching refs:bd
43 struct backlight_device *bd; in fb_notifier_callback() local
52 bd = container_of(self, struct backlight_device, fb_notif); 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()
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()
64 backlight_update_status(bd); 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()
72 backlight_update_status(bd); in fb_notifier_callback()
76 mutex_unlock(&bd->ops_lock); in fb_notifier_callback()
80 static int backlight_register_fb(struct backlight_device *bd) in backlight_register_fb() argument
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()
88 static void backlight_unregister_fb(struct backlight_device *bd) in backlight_unregister_fb() argument
90 fb_unregister_client(&bd->fb_notif); in backlight_unregister_fb()
93 static inline int backlight_register_fb(struct backlight_device *bd) in backlight_register_fb() argument
98 static inline void backlight_unregister_fb(struct backlight_device *bd) in backlight_unregister_fb() argument
103 static void backlight_generate_event(struct backlight_device *bd, in backlight_generate_event() argument
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()
127 struct backlight_device *bd = to_backlight_device(dev); in bl_power_show() local
129 return sprintf(buf, "%d\n", bd->props.power); in bl_power_show()
136 struct backlight_device *bd = to_backlight_device(dev); in bl_power_store() local
144 mutex_lock(&bd->ops_lock); in bl_power_store()
145 if (bd->ops) { in bl_power_store()
147 if (bd->props.power != power) { in bl_power_store()
148 bd->props.power = power; in bl_power_store()
149 backlight_update_status(bd); in bl_power_store()
153 mutex_unlock(&bd->ops_lock); in bl_power_store()
162 struct backlight_device *bd = to_backlight_device(dev); in brightness_show() local
164 return sprintf(buf, "%d\n", bd->props.brightness); in brightness_show()
171 struct backlight_device *bd = to_backlight_device(dev); in brightness_store() local
180 mutex_lock(&bd->ops_lock); in brightness_store()
181 if (bd->ops) { in brightness_store()
182 if (brightness > bd->props.max_brightness) in brightness_store()
186 bd->props.brightness = brightness; in brightness_store()
187 backlight_update_status(bd); in brightness_store()
191 mutex_unlock(&bd->ops_lock); in brightness_store()
193 backlight_generate_event(bd, BACKLIGHT_UPDATE_SYSFS); in brightness_store()
202 struct backlight_device *bd = to_backlight_device(dev); in type_show() local
204 return sprintf(buf, "%s\n", backlight_types[bd->props.type]); in type_show()
211 struct backlight_device *bd = to_backlight_device(dev); in max_brightness_show() local
213 return sprintf(buf, "%d\n", bd->props.max_brightness); in max_brightness_show()
221 struct backlight_device *bd = to_backlight_device(dev); in actual_brightness_show() local
223 mutex_lock(&bd->ops_lock); in actual_brightness_show()
224 if (bd->ops && bd->ops->get_brightness) in actual_brightness_show()
225 rc = sprintf(buf, "%d\n", bd->ops->get_brightness(bd)); in actual_brightness_show()
227 rc = sprintf(buf, "%d\n", bd->props.brightness); in actual_brightness_show()
228 mutex_unlock(&bd->ops_lock); in actual_brightness_show()
239 struct backlight_device *bd = to_backlight_device(dev); in backlight_suspend() local
241 mutex_lock(&bd->ops_lock); in backlight_suspend()
242 if (bd->ops && bd->ops->options & BL_CORE_SUSPENDRESUME) { in backlight_suspend()
243 bd->props.state |= BL_CORE_SUSPENDED; in backlight_suspend()
244 backlight_update_status(bd); in backlight_suspend()
246 mutex_unlock(&bd->ops_lock); in backlight_suspend()
253 struct backlight_device *bd = to_backlight_device(dev); in backlight_resume() local
255 mutex_lock(&bd->ops_lock); in backlight_resume()
256 if (bd->ops && bd->ops->options & BL_CORE_SUSPENDRESUME) { in backlight_resume()
257 bd->props.state &= ~BL_CORE_SUSPENDED; in backlight_resume()
258 backlight_update_status(bd); in backlight_resume()
260 mutex_unlock(&bd->ops_lock); in backlight_resume()
271 struct backlight_device *bd = to_backlight_device(dev); in bl_device_release() local
272 kfree(bd); in bl_device_release()
293 void backlight_force_update(struct backlight_device *bd, in backlight_force_update() argument
296 mutex_lock(&bd->ops_lock); in backlight_force_update()
297 if (bd->ops && bd->ops->get_brightness) in backlight_force_update()
298 bd->props.brightness = bd->ops->get_brightness(bd); in backlight_force_update()
299 mutex_unlock(&bd->ops_lock); in backlight_force_update()
300 backlight_generate_event(bd, reason); in backlight_force_update()
386 struct backlight_device *bd; in backlight_device_registered() local
389 list_for_each_entry(bd, &backlight_dev_list, entry) { in backlight_device_registered()
390 if (bd->props.type == type) { in backlight_device_registered()
407 void backlight_device_unregister(struct backlight_device *bd) in backlight_device_unregister() argument
409 if (!bd) in backlight_device_unregister()
413 list_del(&bd->entry); in backlight_device_unregister()
418 if (pmac_backlight == bd) in backlight_device_unregister()
424 BACKLIGHT_UNREGISTERED, bd); in backlight_device_unregister()
426 mutex_lock(&bd->ops_lock); in backlight_device_unregister()
427 bd->ops = NULL; in backlight_device_unregister()
428 mutex_unlock(&bd->ops_lock); in backlight_device_unregister()
430 backlight_unregister_fb(bd); in backlight_device_unregister()
431 device_unregister(&bd->dev); in backlight_device_unregister()
530 struct backlight_device *bd) in devm_backlight_device_unregister() argument
535 devm_backlight_device_match, bd); in devm_backlight_device_unregister()