/*-1* Copyright (c) 2005 Hans Petter Selasky2* All rights reserved.3*4* Redistribution and use in source and binary forms, with or without5* modification, are permitted provided that the following conditions6* are met:7* 1. Redistributions of source code must retain the above copyright8* notice, this list of conditions and the following disclaimer.9* 2. Redistributions in binary form must reproduce the above copyright10* notice, this list of conditions and the following disclaimer in the11* documentation and/or other materials provided with the distribution.12*13* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND14* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE15* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE16* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE17* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL18* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS19* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)20* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT21* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY22* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF23* SUCH DAMAGE.24*/2526#ifndef _ACPI_SMBUS_H_27#define _ACPI_SMBUS_H_2829/*30* System Management Bus register offsets31*/32#define SMBUS_PRTCL 033#define SMBUS_STS 134#define SMBUS_STS_MASK 0x1f35#define SMBUS_ADDR 236#define SMBUS_CMD 337#define SMBUS_DATA 4 /* 32 bytes */38#define SMBUS_BCNT 3639#define SMBUS_ALRM_ADDR 3740#define SMBUS_ALRM_DATA 38 /* 2 bytes */4142/*43* Smart-Battery commands and definitions44*/4546/* Base address */47#define SMBATT_ADDRESS 0x164849/* access: READ WRITE WORD */50#define SMBATT_CMD_MANUFACTURER_ACCESS 05152/*53* access: READ WRITE WORD54* unit : mAh (CAPACITY_MODE=0) or 10 mWh (CAPACITY_MODE=1)55* range : 0 .. 65535 inclusively56*/57#define SMBATT_CMD_REMAINING_CAPACITY_ALARM 0x15859/*60* access: READ WRITE WORD61* unit : minutes62* range : 0 .. 65535 inclusively63*/64#define SMBATT_CMD_REMAINING_TIME_ALARM 0x26566/* access: READ WRITE WORD */67#define SMBATT_CMD_BATTERY_MODE 0x36869#define SMBATT_BM_INTERNAL_CHARGE_CONTROLLER (1 << 0) /* READ */70#define SMBATT_BM_PRIMARY_BATTERY_SUPPORT (1 << 1) /* READ */71#define SMBATT_BM_CONDITION_FLAG (1 << 7) /* READ */72#define SMBATT_BM_CHARGE_CONTROLLER_ENABLED (1 << 8) /* READ WRITE */73#define SMBATT_BM_PRIMARY_BATTERY (1 << 9) /* READ WRITE */74#define SMBATT_BM_ALARM_MODE (1 << 13) /* READ WRITE */75#define SMBATT_BM_CHARGER_MODE (1 << 14) /* READ WRITE */76#define SMBATT_BM_CAPACITY_MODE (1 << 15) /* READ WRITE */7778/*79* access: READ WRITE WORD80* unit : mAh (CAPACITY_MODE=0) or 10 mWh (CAPACITY_MODE=1)81* range : signed WORD82*/83#define SMBATT_CMD_AT_RATE 0x48485/*86* access: READ WORD87* unit : minutes88* range : 0 .. 65534, 65535 has special meaning89*/90#define SMBATT_CMD_AT_RATE_TIME_TO_FULL 0x59192/*93* access: READ WORD94* unit : minutes95* range : 0 .. 65534, 65535 has special meaning96*/97#define SMBATT_CMD_AT_RATE_TIME_TO_EMPTY 0x69899/*100* access: READ WORD */101#define SMBATT_CMD_AT_RATE_OK 0x7102103/*104* access: READ WORD105* unit : 0.1 degrees Kelvin106* range : 0 .. 6553.5 Kelvin107*/108#define SMBATT_CMD_TEMPERATURE 0x8109110/*111* access: READ WORD112* unit : mV113* range : 0 .. 65535 inclusively114*/115#define SMBATT_CMD_VOLTAGE 0x9116117/*118* access: READ WORD119* unit : mA120* range : signed WORD121*/122#define SMBATT_CMD_CURRENT 0xa123124/*125* access: READ WORD126* unit : mA127* range : signed WORD128*/129#define SMBATT_CMD_AVERAGE_CURRENT 0xb130131/*132* access: READ WORD133* unit : percent134* range : 0..100 inclusively135*/136#define SMBATT_CMD_MAX_ERROR 0xc137138/*139* access: READ WORD140* unit : percent141* range : 0..100 inclusively142*/143#define SMBATT_CMD_RELATIVE_STATE_OF_CHARGE 0xd144145/*146* access: READ WORD147* unit : percent148* range : 0..100 inclusively149*/150#define SMBATT_CMD_ABSOLUTE_STATE_OF_CHARGE 0xe151152/*153* access: READ WORD154* unit : mAh (CAPACITY_MODE=0) or 10 mWh (CAPACITY_MODE=1)155* range : 0..65535 inclusively156*/157#define SMBATT_CMD_REMAINING_CAPACITY 0xf158159/*160* access: READ WORD161* unit : mAh (CAPACITY_MODE=0) or 10 mWh (CAPACITY_MODE=1)162* range : 0..65535 inclusively163*/164#define SMBATT_CMD_FULL_CHARGE_CAPACITY 0x10165166/*167* access: READ WORD168* unit : minutes169* range : 0..65534, 65535 is reserved170*/171#define SMBATT_CMD_RUN_TIME_TO_EMPTY 0x11172173/*174* access: READ WORD175* unit : minutes176* range : 0..65534, 65535 is reserved177*/178#define SMBATT_CMD_AVERAGE_TIME_TO_EMPTY 0x12179180/*181* access: READ WORD182* unit : minutes183* range : 0..65534, 65535 is reserved184*/185#define SMBATT_CMD_AVERAGE_TIME_TO_FULL 0x13186187/*188* access: READ WORD189* unit : mA190*/191#define SMBATT_CMD_CHARGING_CURRENT 0x14192193/*194* access: READ WORD195* unit : mV196* range : 0 .. 65534, 65535 reserved197*/198#define SMBATT_CMD_CHARGING_VOLTAGE 0x15199200/* access: READ WORD */201#define SMBATT_CMD_BATTERY_STATUS 0x16202203/* alarm bits */204#define SMBATT_BS_OVER_CHARGED_ALARM (1 << 15)205#define SMBATT_BS_TERMINATE_CHARGE_ALARM (1 << 14)206#define SMBATT_BS_RESERVED_2 (1 << 13)207#define SMBATT_BS_OVER_TEMP_ALARM (1 << 12)208#define SMBATT_BS_TERMINATE_DISCHARGE_ALARM (1 << 11)209#define SMBATT_BS_RESERVED_1 (1 << 10)210#define SMBATT_BS_REMAINING_CAPACITY_ALARM (1 << 9)211#define SMBATT_BS_REMAINING_TIME_ALARM (1 << 8)212213/* status bits */214#define SMBATT_BS_INITIALIZED (1 << 7)215#define SMBATT_BS_DISCHARGING (1 << 6)216#define SMBATT_BS_FULLY_CHARGED (1 << 5)217#define SMBATT_BS_FULLY_DISCHARGED (1 << 4)218219/* error bits */220#define SMBATT_BS_GET_ERROR(x) ((x) & 0xf)221#define SMBATT_BS_ERROR_OK 0222#define SMBATT_BS_ERROR_BUSY 1223#define SMBATT_BS_ERROR_RESERVED_COMMAND 2224#define SMBATT_BS_ERROR_UNSUPPORTED_COMMAND 3225#define SMBATT_BS_ERROR_ACCESS_DENIED 4226#define SMBATT_BS_ERROR_OVER_UNDER_FLOW 5227#define SMBATT_BS_ERROR_BADSIZE 6228#define SMBATT_BS_ERROR_UNKNOWN 7229230/*231* access: READ WORD232* unit : cycle(s)233* range : 0 .. 65534, 65535 reserved234*/235#define SMBATT_CMD_CYCLE_COUNT 0x17236237/*238* access: READ WORD239* unit : mAh (CAPACITY_MODE=0) or 10 mWh (CAPACITY_MODE=1)240* range : 0..65535 inclusively241*/242#define SMBATT_CMD_DESIGN_CAPACITY 0x18243244/*245* access: READ WORD246* unit : mV247* range : 0..65535 mV248*/249#define SMBATT_CMD_DESIGN_VOLTAGE 0x19250251/* access: READ WORD */252#define SMBATT_CMD_SPECIFICATION_INFO 0x1a253254#define SMBATT_SI_GET_REVISION(x) (((x) >> 0) & 0xf)255#define SMBATT_SI_GET_VERSION(x) (((x) >> 4) & 0xf)256#define SMBATT_SI_GET_VSCALE(x) (((x) >> 8) & 0xf)257#define SMBATT_SI_GET_IPSCALE(x) (((x) >> 12) & 0xf)258259/* access: READ WORD */260#define SMBATT_CMD_MANUFACTURE_DATE 0x1b261262#define SMBATT_MD_GET_DAY(x) (((x) >> 0) & 0x1f)263#define SMBATT_MD_GET_MONTH(x) (((x) >> 5) & 0xf)264#define SMBATT_MD_GET_YEAR(x) ((((x) >> 9) & 0x7f) + 1980)265266/* access: READ WORD */267#define SMBATT_CMD_SERIAL_NUMBER 0x1c268269/* access: READ BLOCK */270#define SMBATT_CMD_MANUFACTURER_NAME 0x20271272/* access: READ BLOCK */273#define SMBATT_CMD_DEVICE_NAME 0x21274275/* access: READ BLOCK */276#define SMBATT_CMD_DEVICE_CHEMISTRY 0x22277278/* access: READ BLOCK */279#define SMBATT_CMD_MANUFACTURER_DATA 0x23280281#endif /* !_ACPI_SMBUS_H_ */282283284