571
572
573 /*
574 * tzmon_monitor
575 * Run as a separate thread, this wakes according to polling period and
576 * checks particular objects in the thermal zone. One instance per
577 * thermal zone.
578 */
579 static void
580 tzmon_monitor(void *ctx)
581 {
582 thermal_zone_t *tzp = (thermal_zone_t *)ctx;
583 clock_t ticks;
584
585 do {
586 /* Check out the zone */
587 tzmon_eval_zone(tzp);
588
589 /* Go back to sleep */
590 mutex_enter(&tzp->lock);
591 ticks = drv_usectohz(tzp->polling_period * 1000000);
592 if (ticks > 0)
593 (void) cv_reltimedwait(&zone_list_condvar,
594 &tzp->lock, ticks, TR_CLOCK_TICK);
595 mutex_exit(&tzp->lock);
596 } while (ticks > 0);
597 }
598
599
600 /*
601 * tzmon_set_power_device
602 */
603 static void
604 tzmon_set_power_device(ACPI_HANDLE dev, int on_off, char *tz_name)
605 {
606 ACPI_BUFFER rb;
607 ACPI_OBJECT *pr0;
608 ACPI_STATUS status;
609 int i;
610
611 rb.Length = ACPI_ALLOCATE_BUFFER;
|
571
572
573 /*
574 * tzmon_monitor
575 * Run as a separate thread, this wakes according to polling period and
576 * checks particular objects in the thermal zone. One instance per
577 * thermal zone.
578 */
579 static void
580 tzmon_monitor(void *ctx)
581 {
582 thermal_zone_t *tzp = (thermal_zone_t *)ctx;
583 clock_t ticks;
584
585 do {
586 /* Check out the zone */
587 tzmon_eval_zone(tzp);
588
589 /* Go back to sleep */
590 mutex_enter(&tzp->lock);
591 ticks = drv_sectohz(tzp->polling_period);
592 if (ticks > 0)
593 (void) cv_reltimedwait(&zone_list_condvar,
594 &tzp->lock, ticks, TR_CLOCK_TICK);
595 mutex_exit(&tzp->lock);
596 } while (ticks > 0);
597 }
598
599
600 /*
601 * tzmon_set_power_device
602 */
603 static void
604 tzmon_set_power_device(ACPI_HANDLE dev, int on_off, char *tz_name)
605 {
606 ACPI_BUFFER rb;
607 ACPI_OBJECT *pr0;
608 ACPI_STATUS status;
609 int i;
610
611 rb.Length = ACPI_ALLOCATE_BUFFER;
|