TCTRL(4)              OpenBSD Programmer's Manual (SPARC)             TCTRL(4)

NAME
     tctrl - Tadpole Microcontroller Interface

SYNOPSIS
     tctrl0 at obio0

DESCRIPTION
     The tctrl driver provides control over many functions on the Tadpole
     SPARCbook 3 series laptops, via their TS102 chip.

     The microcontroller is used to power the TFT display down when the laptop
     lid is closed and when the screen is blanked by the pninek(4) or pnozz(4)
     driver.  The tctrl is also used to power the laptop off when the
     reboot(2) system call is used with the RB_POWERDOWN flag is set.

     The PCMCIA part of the controller is managed by the tslot(4) driver.

POWER MANAGEMENT INTERFACE
     The tctrl driver provides an interface which simulates the Advanced Power
     Management (APM) BIOS functions encountered on some x86 hardware.  The
     BIOS functions are translated into the appropriate microcontroller re-
     quests.  Currently only battery level, AC connection, and charging status
     are available from the tctrl device.  Suspend/resume and other power
     events are not yet supported.

     The tctrl driver implements the following ioctl(2) calls.  They are de-
     fined in <machine/apmvar.h>.

     APM_IOC_GETPOWER
             (struct apm_power_info) Request the current power state.  The ar-
             gument structure is as follows:

                   struct apm_power_info {
                           u_char battery_state;
                           u_char ac_state;
                           u_char battery_life;
                           u_char spare1;
                           u_int minutes_left;
                           u_int spare2[6];
                   };

             The following values are defined for battery_state:

             APM_BATT_HIGH
                     Battery has a high state of charge.

             APM_BATT_LOW
                     Battery has a low state of charge.

             APM_BATT_CRITICAL
                     Battery has a critical state of charge.

             APM_BATT_CHARGING
                     Battery is not high, low, or critical and is currently
                     charging.

             APM_BATT_UNKNOWN
                     Can not read the current battery state.

             APM_BATTERY_ABSENT
                     No battery installed.

             The following values are defined for ac_state:

             APM_AC_OFF
                     External power not detected.

             APM_AC_ON
                     External power detected.

             The battery_life value contains the estimated percentage of bat-
             tery life available.  100% indicates a full charge.

             The minutes_left value is always -1, as the hardware does not
             provide an estimated number of minutes of battery life remaining.

     APM_IOC_PRN_CTL
             (int) This ioctl(2) controls message output by the tctrl driver
             when a power change event is detected.  The integer parameter is
             one of:

             APM_PRINT_ON
                     All power change events result in a message.  This is the
                     normal operating mode for the driver.

             APM_PRINT_OFF
                     Power change event messages are suppressed.

             APM_PRINT_PCT
                     Power change event messages are suppressed unless the es-
                     timated battery life percentage changes.

FILES
     /dev/apm     APM data device.  May only be opened read-only.  May be
                  opened by multiple concurrent users.

     /dev/apmctl  APM control device.  May be opened read-write or write-only.
                  May only be opened by one user at a time.  An attempt to
                  open the file when in use will fail, returning EBUSY.

SEE ALSO
     reboot(2), intro(4), pninek(4), pnozz(4), tslot(4), apm(8), apmd(8)

BUGS
     Not all power management functions of the microcontroller are supported.

OpenBSD 4.7                      May 31, 2007                                2
