Lines Matching refs:vo
366 struct acpi_video_output *vo, *vn; in acpi_video_detach() local
376 STAILQ_FOREACH_SAFE(vo, &sc->vid_outputs, vo_next, vn) { in acpi_video_detach()
377 acpi_video_vo_destroy(vo); in acpi_video_detach()
392 struct acpi_video_output *vo, *vn; in acpi_video_resume() local
400 STAILQ_FOREACH_SAFE(vo, &sc->vid_outputs, vo_next, vn) { in acpi_video_resume()
401 if ((vo->adr & DOD_DEVID_MASK_FULL) != DOD_DEVID_LCD && in acpi_video_resume()
402 (vo->adr & DOD_DEVID_MASK) != DOD_DEVID_INTDFP) in acpi_video_resume()
405 if ((vo_get_device_status(vo->handle) & DCS_ACTIVE) == 0) in acpi_video_resume()
408 level = vo_get_brightness(vo); in acpi_video_resume()
410 vo_set_brightness(vo, level); in acpi_video_resume()
439 struct acpi_video_output *vo, *vo_tmp; in acpi_video_notify_handler() local
451 STAILQ_FOREACH(vo, &sc->vid_outputs, vo_next) { in acpi_video_notify_handler()
452 dss = vo_get_graphics_state(vo->handle); in acpi_video_notify_handler()
453 dcs = vo_get_device_status(vo->handle); in acpi_video_notify_handler()
461 lasthand = vo->handle; in acpi_video_notify_handler()
471 STAILQ_FOREACH(vo, &sc->vid_outputs, vo_next) in acpi_video_notify_handler()
472 vo->handle = NULL; in acpi_video_notify_handler()
474 STAILQ_FOREACH_SAFE(vo, &sc->vid_outputs, vo_next, vo_tmp) { in acpi_video_notify_handler()
475 if (vo->handle == NULL) { in acpi_video_notify_handler()
476 STAILQ_REMOVE(&sc->vid_outputs, vo, in acpi_video_notify_handler()
478 acpi_video_vo_destroy(vo); in acpi_video_notify_handler()
505 struct acpi_video_output *vo; in acpi_video_power_profile() local
515 STAILQ_FOREACH(vo, &sc->vid_outputs, vo_next) { in acpi_video_power_profile()
516 if (vo->vo_levels != NULL && vo->vo_brightness == -1) in acpi_video_power_profile()
517 vo_set_brightness(vo, in acpi_video_power_profile()
519 vo->vo_economy : vo->vo_fullpower); in acpi_video_power_profile()
529 struct acpi_video_output *vo; in acpi_video_bind_outputs_subr() local
534 STAILQ_FOREACH(vo, &sc->vid_outputs, vo_next) { in acpi_video_bind_outputs_subr()
535 if (vo->adr == adr) { in acpi_video_bind_outputs_subr()
536 acpi_video_vo_bind(vo, handle); in acpi_video_bind_outputs_subr()
540 vo = acpi_video_vo_init(adr); in acpi_video_bind_outputs_subr()
541 if (vo != NULL) { in acpi_video_bind_outputs_subr()
543 vo->evdev = sc->evdev; in acpi_video_bind_outputs_subr()
545 acpi_video_vo_bind(vo, handle); in acpi_video_bind_outputs_subr()
546 STAILQ_INSERT_TAIL(&sc->vid_outputs, vo, vo_next); in acpi_video_bind_outputs_subr()
561 struct acpi_video_output *vn, *vo, *vp; in acpi_video_vo_init() local
614 vo = malloc(sizeof(*vo), M_ACPIVIDEO, M_NOWAIT); in acpi_video_vo_init()
615 if (vo != NULL) { in acpi_video_vo_init()
616 vo->handle = NULL; in acpi_video_vo_init()
617 vo->adr = adr; in acpi_video_vo_init()
618 vo->vo_unit.num = n; in acpi_video_vo_init()
619 vo->vo_hasbqc = -1; in acpi_video_vo_init()
620 vo->vo_level = -1; in acpi_video_vo_init()
621 vo->vo_brightness = -1; in acpi_video_vo_init()
622 vo->vo_fullpower = -1; /* TODO: override with tunables */ in acpi_video_vo_init()
623 vo->vo_economy = -1; in acpi_video_vo_init()
624 vo->vo_numlevels = 0; in acpi_video_vo_init()
625 vo->vo_levels = NULL; in acpi_video_vo_init()
628 vo->vo_fullpower = x; in acpi_video_vo_init()
631 vo->vo_economy = x; in acpi_video_vo_init()
633 sysctl_ctx_init(&vo->vo_sysctl_ctx); in acpi_video_vo_init()
635 STAILQ_INSERT_AFTER(voqh, vp, vo, vo_unit.next); in acpi_video_vo_init()
637 STAILQ_INSERT_TAIL(voqh, vo, vo_unit.next); in acpi_video_vo_init()
639 vo->vo_sysctl_tree = in acpi_video_vo_init()
640 SYSCTL_ADD_NODE(&vo->vo_sysctl_ctx, in acpi_video_vo_init()
644 if (vo->vo_sysctl_tree != NULL) { in acpi_video_vo_init()
645 SYSCTL_ADD_PROC(&vo->vo_sysctl_ctx, in acpi_video_vo_init()
646 SYSCTL_CHILDREN(vo->vo_sysctl_tree), in acpi_video_vo_init()
648 CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, vo, in acpi_video_vo_init()
651 SYSCTL_ADD_PROC(&vo->vo_sysctl_ctx, in acpi_video_vo_init()
652 SYSCTL_CHILDREN(vo->vo_sysctl_tree), in acpi_video_vo_init()
654 CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, vo, in acpi_video_vo_init()
657 SYSCTL_ADD_PROC(&vo->vo_sysctl_ctx, in acpi_video_vo_init()
658 SYSCTL_CHILDREN(vo->vo_sysctl_tree), in acpi_video_vo_init()
660 CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, vo, in acpi_video_vo_init()
664 SYSCTL_ADD_PROC(&vo->vo_sysctl_ctx, in acpi_video_vo_init()
665 SYSCTL_CHILDREN(vo->vo_sysctl_tree), in acpi_video_vo_init()
667 CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, vo, in acpi_video_vo_init()
671 SYSCTL_ADD_PROC(&vo->vo_sysctl_ctx, in acpi_video_vo_init()
672 SYSCTL_CHILDREN(vo->vo_sysctl_tree), in acpi_video_vo_init()
674 CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, vo, in acpi_video_vo_init()
694 return (vo); in acpi_video_vo_init()
698 acpi_video_vo_bind(struct acpi_video_output *vo, ACPI_HANDLE handle) in acpi_video_vo_bind() argument
702 if (vo->vo_levels != NULL) { in acpi_video_vo_bind()
703 AcpiRemoveNotifyHandler(vo->handle, ACPI_DEVICE_NOTIFY, in acpi_video_vo_bind()
705 AcpiOsFree(vo->vo_levels); in acpi_video_vo_bind()
706 vo->vo_levels = NULL; in acpi_video_vo_bind()
708 vo->handle = handle; in acpi_video_vo_bind()
709 vo->vo_numlevels = vo_get_brightness_levels(handle, &vo->vo_levels); in acpi_video_vo_bind()
710 if (vo->vo_numlevels >= 2) { in acpi_video_vo_bind()
711 if (vo->vo_fullpower == -1 || in acpi_video_vo_bind()
712 acpi_video_vo_check_level(vo, vo->vo_fullpower) != 0) { in acpi_video_vo_bind()
714 vo->vo_fullpower = vo->vo_levels[BCL_FULLPOWER]; in acpi_video_vo_bind()
716 if (vo->vo_economy == -1 || in acpi_video_vo_bind()
717 acpi_video_vo_check_level(vo, vo->vo_economy) != 0) { in acpi_video_vo_bind()
719 vo->vo_economy = vo->vo_levels[BCL_ECONOMY]; in acpi_video_vo_bind()
722 acpi_video_vo_notify_handler, vo); in acpi_video_vo_bind()
728 acpi_video_vo_destroy(struct acpi_video_output *vo) in acpi_video_vo_destroy() argument
733 if (vo->vo_sysctl_tree != NULL) { in acpi_video_vo_destroy()
734 vo->vo_sysctl_tree = NULL; in acpi_video_vo_destroy()
735 sysctl_ctx_free(&vo->vo_sysctl_ctx); in acpi_video_vo_destroy()
737 if (vo->vo_levels != NULL) { in acpi_video_vo_destroy()
738 AcpiRemoveNotifyHandler(vo->handle, ACPI_DEVICE_NOTIFY, in acpi_video_vo_destroy()
740 AcpiOsFree(vo->vo_levels); in acpi_video_vo_destroy()
743 switch (vo->adr & DOD_DEVID_MASK) { in acpi_video_vo_destroy()
745 if ((vo->adr & DOD_DEVID_MASK_FULL) == DOD_DEVID_LCD) in acpi_video_vo_destroy()
762 STAILQ_REMOVE(voqh, vo, acpi_video_output, vo_unit.next); in acpi_video_vo_destroy()
763 free(vo, M_ACPIVIDEO); in acpi_video_vo_destroy()
767 acpi_video_vo_check_level(struct acpi_video_output *vo, int level) in acpi_video_vo_check_level() argument
772 if (vo->vo_levels == NULL) in acpi_video_vo_check_level()
774 for (i = 0; i < vo->vo_numlevels; i++) in acpi_video_vo_check_level()
775 if (vo->vo_levels[i] == level) in acpi_video_vo_check_level()
783 struct acpi_video_output *vo; in acpi_video_vo_notify_handler() local
786 vo = context; in acpi_video_vo_notify_handler()
788 if (vo->handle != handle) in acpi_video_vo_notify_handler()
793 if (vo->vo_numlevels <= 3) in acpi_video_vo_notify_handler()
800 if (vo->vo_levels == NULL) in acpi_video_vo_notify_handler()
802 level = vo_get_brightness(vo); in acpi_video_vo_notify_handler()
815 for (i = 2; i < vo->vo_numlevels; i++) in acpi_video_vo_notify_handler()
816 if (vo->vo_levels[i] == level) { in acpi_video_vo_notify_handler()
817 new_level = vo->vo_numlevels > i + 1 ? in acpi_video_vo_notify_handler()
818 vo->vo_levels[i + 1] : vo->vo_levels[2]; in acpi_video_vo_notify_handler()
824 for (i = 0; i < vo->vo_numlevels; i++) { in acpi_video_vo_notify_handler()
825 j = vo->vo_levels[i]; in acpi_video_vo_notify_handler()
838 for (i = 0; i < vo->vo_numlevels; i++) in acpi_video_vo_notify_handler()
839 if (vo->vo_levels[i] == 0) { in acpi_video_vo_notify_handler()
849 vo_set_brightness(vo, new_level); in acpi_video_vo_notify_handler()
850 vo->vo_brightness = new_level; in acpi_video_vo_notify_handler()
853 acpi_video_push_evdev_event(vo->evdev, notify); in acpi_video_vo_notify_handler()
867 struct acpi_video_output *vo; in acpi_video_vo_active_sysctl() local
870 vo = (struct acpi_video_output *)arg1; in acpi_video_vo_active_sysctl()
871 if (vo->handle == NULL) in acpi_video_vo_active_sysctl()
874 state = (vo_get_device_status(vo->handle) & DCS_ACTIVE) ? 1 : 0; in acpi_video_vo_active_sysctl()
878 vo_set_device_state(vo->handle, in acpi_video_vo_active_sysctl()
889 struct acpi_video_output *vo; in acpi_video_vo_bright_sysctl() local
892 vo = (struct acpi_video_output *)arg1; in acpi_video_vo_bright_sysctl()
894 if (vo->handle == NULL) { in acpi_video_vo_bright_sysctl()
898 if (vo->vo_levels == NULL) { in acpi_video_vo_bright_sysctl()
904 vo->vo_economy : vo->vo_fullpower; in acpi_video_vo_bright_sysctl()
905 level = vo->vo_brightness; in acpi_video_vo_bright_sysctl()
917 if (level != -1 && (err = acpi_video_vo_check_level(vo, level))) in acpi_video_vo_bright_sysctl()
919 vo->vo_brightness = level; in acpi_video_vo_bright_sysctl()
920 vo_set_brightness(vo, (level == -1) ? preset : level); in acpi_video_vo_bright_sysctl()
930 struct acpi_video_output *vo; in acpi_video_vo_presets_sysctl() local
933 vo = (struct acpi_video_output *)arg1; in acpi_video_vo_presets_sysctl()
935 if (vo->handle == NULL) { in acpi_video_vo_presets_sysctl()
939 if (vo->vo_levels == NULL) { in acpi_video_vo_presets_sysctl()
944 &vo->vo_economy : &vo->vo_fullpower; in acpi_video_vo_presets_sysctl()
956 level = vo->vo_levels[i]; in acpi_video_vo_presets_sysctl()
957 } else if ((err = acpi_video_vo_check_level(vo, level)) != 0) in acpi_video_vo_presets_sysctl()
960 if (vo->vo_brightness == -1 && (power_profile_get_state() == arg2)) in acpi_video_vo_presets_sysctl()
961 vo_set_brightness(vo, level); in acpi_video_vo_presets_sysctl()
973 struct acpi_video_output *vo; in acpi_video_vo_levels_sysctl() local
976 vo = (struct acpi_video_output *)arg1; in acpi_video_vo_levels_sysctl()
978 if (vo->vo_levels == NULL) { in acpi_video_vo_levels_sysctl()
986 err = sysctl_handle_opaque(oidp, vo->vo_levels, in acpi_video_vo_levels_sysctl()
987 vo->vo_numlevels * sizeof(*vo->vo_levels), req); in acpi_video_vo_levels_sysctl()
1131 vo_get_bqc(struct acpi_video_output *vo, UINT32 *level) in vo_get_bqc() argument
1135 switch (vo->vo_hasbqc) { in vo_get_bqc()
1138 status = acpi_GetInteger(vo->handle, "_BQC", level); in vo_get_bqc()
1139 if (vo->vo_hasbqc == 1) in vo_get_bqc()
1141 vo->vo_hasbqc = status != AE_NOT_FOUND; in vo_get_bqc()
1142 if (vo->vo_hasbqc == 1) in vo_get_bqc()
1146 KASSERT(vo->vo_hasbqc == 0, in vo_get_bqc()
1147 ("bad vo_hasbqc state %d", vo->vo_hasbqc)); in vo_get_bqc()
1148 *level = vo->vo_level; in vo_get_bqc()
1155 vo_get_brightness(struct acpi_video_output *vo) in vo_get_brightness() argument
1161 status = vo_get_bqc(vo, &level); in vo_get_brightness()
1163 printf("can't evaluate %s._BQC - %s\n", acpi_name(vo->handle), in vo_get_brightness()
1174 vo_set_brightness(struct acpi_video_output *vo, int level) in vo_set_brightness() argument
1180 status = acpi_SetInteger(vo->handle, "_BCM", level); in vo_set_brightness()
1183 acpi_name(vo->handle), AcpiFormatException(status)); in vo_set_brightness()
1185 vo->vo_level = level; in vo_set_brightness()