1/*
2 * Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24#ifndef __AppleSmartBatteryKeys__
25#define __AppleSmartBatteryKeys__
26
27
28/*
29 * This file contains constants defined in Smart Battery and Smart Battery
30 * System Manager specs.
31 *
32 * kM - All system manager constants begin with kM
33 * kB - All smart battery constants begin with kB
34 *
35 */
36
37
38/* SMBus Device addresses */
39enum {
40    kSMBusAppleDoublerAddr                  = 0xd,
41    kSMBusBatteryAddr                       = 0xb,
42    kSMBusManagerAddr                       = 0xa,
43    kSMBusChargerAddr                       = 0x9
44};
45
46/*  System Manager Commands                             */
47/*  Smart Battery System Manager spec - rev 1.1         */
48/*  Section 5 SBSM Interface                            */
49enum {
50    kMStateCmd                              = 0x01,
51    kMStateContCmd                          = 0x02
52};
53
54/*  SBSM BatterySystemState bitfields                   */
55/*  Smart Battery System Manager spec - rev 1.1         */
56/*  Section 5.1                                         */
57enum {
58    kMChargingBatt_A_Bit                    = 0x0010,
59    kMPresentBatt_A_Bit                     = 0x0001
60};
61
62/*  SBSM BatterySystemStateCont bitfields               */
63/*  Smart Battery System Manager spec - rev 1.1         */
64/*  Section 5.2                                         */
65enum {
66    kMACPresentBit                          = 0x0001,
67    kMPowerNotGoodBit                       = 0x0002,
68    kMCalibrateBit                          = 0x0040,
69};
70
71/*  Smart Battery Commands                              */
72/*  Smart Battery Data Specification - rev 1.1          */
73/*  Section 5.1 SMBus Host to Smart Battery Messages    */
74
75/* kBManufactureDateCmd
76 * Date is published in a bitfield per the Smart Battery Data spec rev 1.1
77 * in section 5.1.26
78 *   Bits 0...4 => day (value 1-31; 5 bits)
79 *   Bits 5...8 => month (value 1-12; 4 bits)
80 *   Bits 9...15 => years since 1980 (value 0-127; 7 bits)
81 */
82enum {
83    kBManufacturerAccessCmd           = 0x00,     // READ/WRITE WORD
84    kBTemperatureCmd                  = 0x08,     // READ WORD
85    kBVoltageCmd                      = 0x09,     // READ WORD
86    kBCurrentCmd                      = 0x0a,     // READ WORD
87    kBAverageCurrentCmd               = 0x0b,     // READ WORD
88    kBMaxErrorCmd                     = 0x0c,     // READ WORD
89    kBRemainingCapacityCmd            = 0x0f,     // READ WORD
90    kBFullChargeCapacityCmd           = 0x10,     // READ WORD
91    kBRunTimeToEmptyCmd               = 0x11,     // READ WORD
92    kBAverageTimeToEmptyCmd           = 0x12,     // READ WORD
93    kBAverageTimeToFullCmd            = 0x13,     // READ WORD
94    kBChargingCurrentCmd              = 0x14,     // READ/WRITE WORD
95    kBBatteryStatusCmd                = 0x16,     // READ WORD
96    kBCycleCountCmd                   = 0x17,     // READ WORD
97    kBDesignCapacityCmd               = 0x18,     // READ WORD
98    kBManufactureDateCmd              = 0x1b,     // READ WORD
99    kBSerialNumberCmd                 = 0x1c,     // READ WORD
100    kBManufactureNameCmd              = 0x20,     // READ BLOCK
101    kBDeviceNameCmd                   = 0x21,     // READ BLOCK
102    kBManufactureDataCmd              = 0x23,     // READ BLOCK
103    kBReadCellVoltage4Cmd             = 0x3c,     // READ WORD
104    kBReadCellVoltage3Cmd             = 0x3d,     // READ WORD
105    kBReadCellVoltage2Cmd             = 0x3e,     // READ WORD
106    kBReadCellVoltage1Cmd             = 0x3f,     // READ WORD
107    kBManufacturerInfoCmd             = 0x70,     // READ BLOCK
108    kBDesignCycleCount9CCmd           = 0x9C,     // READ WORD
109    kBPackReserveCmd                  = 0x8B      // READ WORD
110};
111
112
113/*  Smart Battery Extended Registers                    */
114/*  bq20z90-V110 + bq29330 Chipset Technical Reference Manual    */
115/*  TI Literature SLUU264                               */
116enum {
117    kBExtendedPFStatusCmd             = 0x53,     // READ WORD
118    kBExtendedOperationStatusCmd      = 0x54      // READ WORD
119};
120
121/* Apple Hardware Serial Number */
122enum {
123    kBAppleHardwareSerialCmd          = 0x76      // READ BLOCK
124};
125
126/*  Smart Battery Status Message Bits                   */
127/*  Smart Battery Data Specification - rev 1.1          */
128/*  Section 5.4 page 42                                 */
129enum {
130    kBTerminateChargeAlarmBit         = 0x4000,
131    kBTerminateDischargeAlarmBit      = 0x0800,
132    kBFullyChargedStatusBit           = 0x0020,
133    kBFullyDischargedStatusBit        = 0x0010
134};
135
136
137#endif
138