Home | History | Annotate | Line # | Download | only in hpc
hpcbatteryvar.h revision 1.2
      1  1.2  perry /*	$NetBSD: hpcbatteryvar.h,v 1.2 2005/02/27 00:26:59 perry Exp $	*/
      2  1.1   sato 
      3  1.1   sato /*
      4  1.1   sato  * Copyright (c) 2000-2001 SATO Kazumi
      5  1.1   sato  * All rights reserved.
      6  1.1   sato  *
      7  1.1   sato  * Redistribution and use in source and binary forms, with or without
      8  1.1   sato  * modification, are permitted provided that the following conditions
      9  1.1   sato  * are met:
     10  1.1   sato  * 1. Redistributions of source code must retain the above copyright
     11  1.1   sato  *    notice, this list of conditions and the following disclaimer.
     12  1.1   sato  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.1   sato  *    notice, this list of conditions and the following disclaimer in the
     14  1.1   sato  *    documentation and/or other materials provided with the distribution.
     15  1.1   sato  *
     16  1.1   sato  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
     17  1.1   sato  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     18  1.1   sato  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     19  1.1   sato  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
     20  1.1   sato  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     21  1.1   sato  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     22  1.1   sato  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     23  1.1   sato  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     24  1.1   sato  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     25  1.1   sato  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     26  1.1   sato  * SUCH DAMAGE.
     27  1.1   sato  *
     28  1.1   sato  */
     29  1.1   sato 
     30  1.1   sato #ifndef _HPCBATTERY_VAR_H
     31  1.1   sato #define _HPCBATTERY_VAR_H
     32  1.1   sato 
     33  1.1   sato #define HPCPM_MAX_BATTERY_VALUES	3
     34  1.1   sato struct hpcbattery_values {
     35  1.1   sato 	int nextpoll;
     36  1.1   sato 	int n_values;
     37  1.1   sato 	int value[HPCPM_MAX_BATTERY_VALUES];
     38  1.1   sato };
     39  1.1   sato 
     40  1.1   sato #ifdef notdef
     41  1.2  perry typedef	enum {
     42  1.1   sato 	hpcbattery_init0,
     43  1.1   sato 	hpcbattery_init1,
     44  1.1   sato 	hpcbattery_unknown,
     45  1.1   sato 	hpcbattery_dc,
     46  1.1   sato 	hpcbattery_ac_charging,
     47  1.1   sato 	hpcbattery_ac_nocharging
     48  1.1   sato } hpcbattery_ac_state;
     49  1.1   sato 
     50  1.2  perry typedef	enum {
     51  1.1   sato 	hpcbattery_batt_no_system_battery,
     52  1.1   sato 	hpcbattery_batt_unknown,
     53  1.1   sato 	hpcbattery_batt_100p,
     54  1.1   sato 	hpcbattery_batt_90p,
     55  1.1   sato 	hpcbattery_batt_80p,
     56  1.1   sato 	hpcbattery_batt_70p,
     57  1.1   sato 	hpcbattery_batt_60p,
     58  1.1   sato 	hpcbattery_batt_50p,
     59  1.1   sato 	hpcbattery_batt_40p,
     60  1.1   sato 	hpcbattery_batt_30p,
     61  1.1   sato 	hpcbattery_batt_20p,
     62  1.1   sato 	hpcbattery_batt_10p,
     63  1.1   sato 	hpcbattery_batt_critical,
     64  1.1   sato } hpcbattery_batt_state;
     65  1.1   sato 
     66  1.1   sato struct hpcbattery_softc {
     67  1.1   sato 	struct device sc_device;
     68  1.1   sato 	/* current status */
     69  1.1   sato 	hpcbattery_ac_state sc_ac_status;
     70  1.1   sato 	hpcbattery_batt_state sc_batt_status;
     71  1.1   sato 	int sc_rate;
     72  1.1   sato 	int sc_minuits;
     73  1.1   sato 	int sc_v;
     74  1.1   sato 	int sc_v_h;
     75  1.1   sato 	int sc_v_l;
     76  1.1   sato 	/* last status change values */
     77  1.1   sato 	hpcbattery_ac_state sc_ac_status0;
     78  1.1   sato 	hpcbattery_batt_state sc_batt_status0;
     79  1.1   sato 	int sc_rate0;
     80  1.1   sato 	int sc_minuits0;
     81  1.1   sato 	int sc_v0;
     82  1.1   sato 	int sc_v0_h;
     83  1.1   sato 	int sc_v0_l;
     84  1.1   sato };
     85  1.1   sato #endif /* notdef */
     86  1.1   sato 
     87  1.1   sato struct hpcbattery_spec {
     88  1.1   sato 	int guess_charge;
     89  1.1   sato 	int guess_ac_dc;
     90  1.1   sato 	int main_port;		/* index of main battery port, -1 then ignore */
     91  1.1   sato 	int drift;		/* value drifts */
     92  1.1   sato 	int ac_bias;		/* DC->AC, AC->DC BIAS */
     93  1.1   sato 	int dc_100p;		/* DC: full value (100%) */
     94  1.1   sato 	int dc_80p;		/* DC: almost full value (80%) */
     95  1.1   sato 	int dc_50p;		/* DC: half value (50%) */
     96  1.1   sato 	int dc_20p;		/* DC: battery low value (20%) */
     97  1.1   sato 	int dc_critical;	/* DC: battery critical value (0%) */
     98  1.1   sato 	int ac_charge_100p;	/* AC: charge finished value */
     99  1.1   sato 	int ac_100p;		/* AC: full value (100%) */
    100  1.1   sato 	int ac_80p;		/* AC: almost full value (80%) */
    101  1.1   sato 	int ac_50p;		/* AC: half value (50%) */
    102  1.1   sato 	int ac_20p;		/* AC: battery low value (20%) */
    103  1.1   sato 	int ac_critical;	/* AC: battery critical value */
    104  1.1   sato 	int main_flag;		/* main battery value positive, negative flag. 1 or -1 */
    105  1.1   sato 	int backup_port;	/* index of backup battery port, -1 then ignore */
    106  1.1   sato 	int b_full;		/* backup battery full */
    107  1.1   sato 	int b_low;		/* backup battery low */
    108  1.1   sato 	int b_critical;		/* backup battery hight */
    109  1.1   sato 	int b_flag;		/* main battery value positive, negative flag. 1 or -1 */
    110  1.1   sato 	int nocharge_port;	/* nocharge/(charge or dc) z50, -1 then ignore*/
    111  1.1   sato 	int n_low;		/* if n_flag*value < n_flag*n_low, now nocharging... */
    112  1.1   sato 	int n_flag;		/* -1 or 1 */
    113  1.1   sato 	int dc_ac_port;		/* index of ac/dc port ,-1 then ignore */
    114  1.1   sato 	int da_low;		/* if da_flag*value < da_flag*da_low then dc else ac */
    115  1.1   sato 	int da_flag;		/* -1 or 1 */
    116  1.1   sato 	int charge_port;	/* charge/(no charge or dc)  ,-1 then ignore */
    117  1.1   sato 	int c_low;		/* if da_flag*value < da_flag*da_low then dc else ac */
    118  1.1   sato 	int c_flag;		/* -1 or 1 */
    119  1.1   sato };
    120  1.1   sato #endif /* _HPCBATTERY_VAR_H */
    121  1.1   sato /* end */
    122