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