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