The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/acpica/acpi_smbus.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright (c) 2005 Hans Petter Selasky
    3  * All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  * 1. Redistributions of source code must retain the above copyright
    9  *    notice, this list of conditions and the following disclaimer.
   10  * 2. Redistributions in binary form must reproduce the above copyright
   11  *    notice, this list of conditions and the following disclaimer in the
   12  *    documentation and/or other materials provided with the distribution.
   13  *
   14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   24  * SUCH DAMAGE.
   25  *
   26  *      $FreeBSD$
   27  */
   28 
   29 #ifndef _ACPI_SMBUS_H_
   30 #define _ACPI_SMBUS_H_
   31 
   32 /*
   33  * System Management Bus register offsets
   34  */
   35 #define SMBUS_PRTCL             0
   36 #define SMBUS_STS               1
   37 #define SMBUS_STS_MASK          0x1f
   38 #define SMBUS_ADDR              2
   39 #define SMBUS_CMD               3
   40 #define SMBUS_DATA              4       /* 32 bytes */
   41 #define SMBUS_BCNT              36
   42 #define SMBUS_ALRM_ADDR         37
   43 #define SMBUS_ALRM_DATA         38      /* 2 bytes */
   44 
   45 /*
   46  * Smart-Battery commands and definitions
   47  */
   48 
   49 /* Base address */
   50 #define SMBATT_ADDRESS          0x16
   51 
   52 /* access: READ WRITE WORD */
   53 #define SMBATT_CMD_MANUFACTURER_ACCESS          0
   54 
   55 /*
   56  * access: READ WRITE WORD
   57  * unit  : mAh (CAPACITY_MODE=0) or 10 mWh (CAPACITY_MODE=1)
   58  * range : 0 .. 65535 inclusively
   59  */
   60 #define SMBATT_CMD_REMAINING_CAPACITY_ALARM     0x1
   61 
   62 /*
   63  * access: READ WRITE WORD
   64  * unit  : minutes
   65  * range : 0 .. 65535 inclusively
   66  */
   67 #define SMBATT_CMD_REMAINING_TIME_ALARM         0x2
   68 
   69 /* access: READ WRITE WORD */
   70 #define SMBATT_CMD_BATTERY_MODE                 0x3
   71 
   72 #define SMBATT_BM_INTERNAL_CHARGE_CONTROLLER    (1 <<  0) /* READ */
   73 #define SMBATT_BM_PRIMARY_BATTERY_SUPPORT       (1 <<  1) /* READ */
   74 #define SMBATT_BM_CONDITION_FLAG                (1 <<  7) /* READ */
   75 #define SMBATT_BM_CHARGE_CONTROLLER_ENABLED     (1 <<  8) /* READ WRITE */
   76 #define SMBATT_BM_PRIMARY_BATTERY               (1 <<  9) /* READ WRITE */
   77 #define SMBATT_BM_ALARM_MODE                    (1 << 13) /* READ WRITE */
   78 #define SMBATT_BM_CHARGER_MODE                  (1 << 14) /* READ WRITE */
   79 #define SMBATT_BM_CAPACITY_MODE                 (1 << 15) /* READ WRITE */
   80 
   81 /*
   82  * access: READ WRITE WORD
   83  * unit  : mAh (CAPACITY_MODE=0) or 10 mWh (CAPACITY_MODE=1)
   84  * range : signed WORD
   85  */
   86 #define SMBATT_CMD_AT_RATE                      0x4
   87 
   88 /*
   89  * access: READ WORD
   90  * unit  : minutes
   91  * range : 0 .. 65534, 65535 has special meaning
   92  */
   93 #define SMBATT_CMD_AT_RATE_TIME_TO_FULL         0x5
   94 
   95 /*
   96  * access: READ WORD
   97  * unit  : minutes
   98  * range : 0 .. 65534, 65535 has special meaning
   99  */
  100 #define SMBATT_CMD_AT_RATE_TIME_TO_EMPTY        0x6
  101 
  102 /*
  103  * access: READ WORD */
  104 #define SMBATT_CMD_AT_RATE_OK                   0x7
  105 
  106 /*
  107  * access: READ WORD
  108  * unit  : 0.1 degrees Kelvin
  109  * range : 0 .. 6553.5 Kelvin
  110  */
  111 #define SMBATT_CMD_TEMPERATURE                  0x8
  112 
  113 /*
  114  * access: READ WORD
  115  * unit  : mV
  116  * range : 0 .. 65535 inclusively
  117  */
  118 #define SMBATT_CMD_VOLTAGE                      0x9
  119 
  120 /*
  121  * access: READ WORD
  122  * unit  : mA
  123  * range : signed WORD
  124  */
  125 #define SMBATT_CMD_CURRENT                      0xa
  126 
  127 /*
  128  * access: READ WORD
  129  * unit  : mA
  130  * range : signed WORD
  131  */
  132 #define SMBATT_CMD_AVERAGE_CURRENT              0xb
  133 
  134 /*
  135  * access: READ WORD
  136  * unit  : percent
  137  * range : 0..100 inclusively
  138  */
  139 #define SMBATT_CMD_MAX_ERROR                    0xc
  140 
  141 /*
  142  * access: READ WORD
  143  * unit  : percent
  144  * range : 0..100 inclusively
  145  */
  146 #define SMBATT_CMD_RELATIVE_STATE_OF_CHARGE     0xd
  147 
  148 /*
  149  * access: READ WORD
  150  * unit  : percent
  151  * range : 0..100 inclusively
  152  */
  153 #define SMBATT_CMD_ABSOLUTE_STATE_OF_CHARGE     0xe
  154 
  155 /*
  156  * access: READ WORD
  157  * unit  : mAh (CAPACITY_MODE=0) or 10 mWh (CAPACITY_MODE=1)
  158  * range : 0..65535 inclusively
  159  */
  160 #define SMBATT_CMD_REMAINING_CAPACITY           0xf
  161 
  162 /*
  163  * access: READ WORD
  164  * unit  : mAh (CAPACITY_MODE=0) or 10 mWh (CAPACITY_MODE=1)
  165  * range : 0..65535 inclusively
  166  */
  167 #define SMBATT_CMD_FULL_CHARGE_CAPACITY         0x10
  168 
  169 /*
  170  * access: READ WORD
  171  * unit  : minutes
  172  * range : 0..65534, 65535 is reserved
  173  */
  174 #define SMBATT_CMD_RUN_TIME_TO_EMPTY            0x11
  175 
  176 /*
  177  * access: READ WORD
  178  * unit  : minutes
  179  * range : 0..65534, 65535 is reserved
  180  */
  181 #define SMBATT_CMD_AVERAGE_TIME_TO_EMPTY        0x12
  182 
  183 /*
  184  * access: READ WORD
  185  * unit  : minutes
  186  * range : 0..65534, 65535 is reserved
  187  */
  188 #define SMBATT_CMD_AVERAGE_TIME_TO_FULL         0x13
  189 
  190 /*
  191  * access: READ WORD
  192  * unit  : mA
  193  */
  194 #define SMBATT_CMD_CHARGING_CURRENT             0x14
  195 
  196 /*
  197  * access: READ WORD
  198  * unit  : mV
  199  * range : 0 .. 65534, 65535 reserved
  200  */
  201 #define SMBATT_CMD_CHARGING_VOLTAGE             0x15
  202 
  203 /* access: READ WORD */
  204 #define SMBATT_CMD_BATTERY_STATUS               0x16
  205 
  206 /* alarm bits */
  207 #define SMBATT_BS_OVER_CHARGED_ALARM            (1 << 15)
  208 #define SMBATT_BS_TERMINATE_CHARGE_ALARM        (1 << 14)
  209 #define SMBATT_BS_RESERVED_2                    (1 << 13)
  210 #define SMBATT_BS_OVER_TEMP_ALARM               (1 << 12)
  211 #define SMBATT_BS_TERMINATE_DISCHARGE_ALARM     (1 << 11)
  212 #define SMBATT_BS_RESERVED_1                    (1 << 10)
  213 #define SMBATT_BS_REMAINING_CAPACITY_ALARM      (1 << 9)
  214 #define SMBATT_BS_REMAINING_TIME_ALARM          (1 << 8)
  215 
  216 /* status bits */
  217 #define SMBATT_BS_INITIALIZED                   (1 << 7)
  218 #define SMBATT_BS_DISCHARGING                   (1 << 6)
  219 #define SMBATT_BS_FULLY_CHARGED                 (1 << 5)
  220 #define SMBATT_BS_FULLY_DISCHARGED              (1 << 4)
  221 
  222 /* error bits */
  223 #define SMBATT_BS_GET_ERROR(x)                  ((x) & 0xf)
  224 #define SMBATT_BS_ERROR_OK                      0
  225 #define SMBATT_BS_ERROR_BUSY                    1
  226 #define SMBATT_BS_ERROR_RESERVED_COMMAND        2
  227 #define SMBATT_BS_ERROR_UNSUPPORTED_COMMAND     3
  228 #define SMBATT_BS_ERROR_ACCESS_DENIED           4
  229 #define SMBATT_BS_ERROR_OVER_UNDER_FLOW         5
  230 #define SMBATT_BS_ERROR_BADSIZE                 6
  231 #define SMBATT_BS_ERROR_UNKNOWN                 7
  232 
  233 /*
  234  * access: READ WORD
  235  * unit  : cycle(s)
  236  * range : 0 .. 65534, 65535 reserved
  237  */
  238 #define SMBATT_CMD_CYCLE_COUNT                  0x17
  239 
  240 /*
  241  * access: READ WORD
  242  * unit  : mAh (CAPACITY_MODE=0) or 10 mWh (CAPACITY_MODE=1)
  243  * range : 0..65535 inclusively
  244  */
  245 #define SMBATT_CMD_DESIGN_CAPACITY              0x18
  246 
  247 /*
  248  * access: READ WORD
  249  * unit  : mV
  250  * range : 0..65535 mV
  251  */
  252 #define SMBATT_CMD_DESIGN_VOLTAGE               0x19
  253 
  254 /* access: READ WORD */
  255 #define SMBATT_CMD_SPECIFICATION_INFO           0x1a
  256 
  257 #define SMBATT_SI_GET_REVISION(x)       (((x) >>  0) & 0xf)
  258 #define SMBATT_SI_GET_VERSION(x)        (((x) >>  4) & 0xf)
  259 #define SMBATT_SI_GET_VSCALE(x)         (((x) >>  8) & 0xf)
  260 #define SMBATT_SI_GET_IPSCALE(x)        (((x) >> 12) & 0xf)
  261 
  262 /* access: READ WORD */
  263 #define SMBATT_CMD_MANUFACTURE_DATE             0x1b
  264 
  265 #define SMBATT_MD_GET_DAY(x)             (((x) >> 0) & 0x1f)
  266 #define SMBATT_MD_GET_MONTH(x)           (((x) >> 5) & 0xf)
  267 #define SMBATT_MD_GET_YEAR(x)           ((((x) >> 9) & 0x7f) + 1980)
  268 
  269 /* access: READ WORD */
  270 #define SMBATT_CMD_SERIAL_NUMBER                0x1c
  271 
  272 /* access: READ BLOCK */
  273 #define SMBATT_CMD_MANUFACTURER_NAME            0x20
  274 
  275 /* access: READ BLOCK */
  276 #define SMBATT_CMD_DEVICE_NAME                  0x21
  277 
  278 /* access: READ BLOCK */
  279 #define SMBATT_CMD_DEVICE_CHEMISTRY             0x22
  280 
  281 /* access: READ BLOCK */
  282 #define SMBATT_CMD_MANUFACTURER_DATA            0x23
  283 
  284 #endif /* !_ACPI_SMBUS_H_ */

Cache object: ac8eb088b4dfc5a7e859792e6e8e6563


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.