1 /* $NetBSD: hpcbatteryvar.h,v 1.1.24.1 2005/03/04 16:41:15 skrll Exp $ */
4 * Copyright (c) 2000-2001 SATO Kazumi
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 #ifndef _HPCBATTERY_VAR_H
31 #define _HPCBATTERY_VAR_H
33 #define HPCPM_MAX_BATTERY_VALUES 3
34 struct hpcbattery_values
{
37 int value
[HPCPM_MAX_BATTERY_VALUES
];
46 hpcbattery_ac_charging
,
47 hpcbattery_ac_nocharging
48 } hpcbattery_ac_state
;
51 hpcbattery_batt_no_system_battery
,
52 hpcbattery_batt_unknown
,
63 hpcbattery_batt_critical
,
64 } hpcbattery_batt_state
;
66 struct hpcbattery_softc
{
67 struct device sc_device
;
69 hpcbattery_ac_state sc_ac_status
;
70 hpcbattery_batt_state sc_batt_status
;
76 /* last status change values */
77 hpcbattery_ac_state sc_ac_status0
;
78 hpcbattery_batt_state sc_batt_status0
;
87 struct hpcbattery_spec
{
90 int main_port
; /* index of main battery port, -1 then ignore */
91 int drift
; /* value drifts */
92 int ac_bias
; /* DC->AC, AC->DC BIAS */
93 int dc_100p
; /* DC: full value (100%) */
94 int dc_80p
; /* DC: almost full value (80%) */
95 int dc_50p
; /* DC: half value (50%) */
96 int dc_20p
; /* DC: battery low value (20%) */
97 int dc_critical
; /* DC: battery critical value (0%) */
98 int ac_charge_100p
; /* AC: charge finished value */
99 int ac_100p
; /* AC: full value (100%) */
100 int ac_80p
; /* AC: almost full value (80%) */
101 int ac_50p
; /* AC: half value (50%) */
102 int ac_20p
; /* AC: battery low value (20%) */
103 int ac_critical
; /* AC: battery critical value */
104 int main_flag
; /* main battery value positive, negative flag. 1 or -1 */
105 int backup_port
; /* index of backup battery port, -1 then ignore */
106 int b_full
; /* backup battery full */
107 int b_low
; /* backup battery low */
108 int b_critical
; /* backup battery hight */
109 int b_flag
; /* main battery value positive, negative flag. 1 or -1 */
110 int nocharge_port
; /* nocharge/(charge or dc) z50, -1 then ignore*/
111 int n_low
; /* if n_flag*value < n_flag*n_low, now nocharging... */
112 int n_flag
; /* -1 or 1 */
113 int dc_ac_port
; /* index of ac/dc port ,-1 then ignore */
114 int da_low
; /* if da_flag*value < da_flag*da_low then dc else ac */
115 int da_flag
; /* -1 or 1 */
116 int charge_port
; /* charge/(no charge or dc) ,-1 then ignore */
117 int c_low
; /* if da_flag*value < da_flag*da_low then dc else ac */
118 int c_flag
; /* -1 or 1 */
120 #endif /* _HPCBATTERY_VAR_H */