Home | History | Annotate | Line # | Download | only in dev
tadpmureg.h revision 1.1
      1  1.1  macallan /* $NetBSD: tadpmureg.h,v 1.1 2018/10/12 21:44:32 macallan Exp $ */
      2  1.1  macallan 
      3  1.1  macallan /*-
      4  1.1  macallan  * Copyright (c) 2018 Michael Lorenz <macallan (at) netbsd.org>
      5  1.1  macallan  * All rights reserved.
      6  1.1  macallan  *
      7  1.1  macallan  * Redistribution and use in source and binary forms, with or without
      8  1.1  macallan  * modification, are permitted provided that the following conditions
      9  1.1  macallan  * are met:
     10  1.1  macallan  * 1. Redistributions of source code must retain the above copyright
     11  1.1  macallan  *    notice, this list of conditions and the following disclaimer.
     12  1.1  macallan  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.1  macallan  *    notice, this list of conditions and the following disclaimer in the
     14  1.1  macallan  *    documentation and/or other materials provided with the distribution.
     15  1.1  macallan  *
     16  1.1  macallan  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     17  1.1  macallan  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     18  1.1  macallan  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     19  1.1  macallan  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     20  1.1  macallan  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     21  1.1  macallan  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     22  1.1  macallan  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     23  1.1  macallan  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     24  1.1  macallan  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     25  1.1  macallan  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     26  1.1  macallan  * POSSIBILITY OF SUCH DAMAGE.
     27  1.1  macallan  */
     28  1.1  macallan 
     29  1.1  macallan /* registers and commands for the PMU found in Tadpole Viper laptops */
     30  1.1  macallan 
     31  1.1  macallan #ifndef TADPMUREG_H
     32  1.1  macallan #define TADPMUREG_H
     33  1.1  macallan 
     34  1.1  macallan /* all values were found by looking at OF methods on the tadpmu node */
     35  1.1  macallan 
     36  1.1  macallan /* these registers live in the pckbc's address space */
     37  1.1  macallan #define TADPMU_CMD	0x6
     38  1.1  macallan #define TADPMU_STATUS	0x6
     39  1.1  macallan #define TADPMU_DATA	0x2
     40  1.1  macallan 
     41  1.1  macallan #define STATUS_HAVE_DATA	0x01
     42  1.1  macallan #define STATUS_CMD_IN_PROGRESS	0x02
     43  1.1  macallan #define STATUS_SEND_DATA	0x08
     44  1.1  macallan 
     45  1.1  macallan #define CMD_SET_OPMODE		0x41	/* not sure what exactly this does... */
     46  1.1  macallan #define		OPMODE_UNIX	0x75	/* other than toggling the UNIX mode  */
     47  1.1  macallan #define		OPMODE_OF	0x67	/* bit in the GENSTAT register        */
     48  1.1  macallan #define CMD_SET_BACKLIGHT	0x43	/* apparently 0 - 1f */
     49  1.1  macallan #define CMD_SET_CPUSPEED	0x44	/* in 10MHz, so 120 == 1.2GHz */
     50  1.1  macallan #define CMD_SET_FANSPEED	0x46	/* ??? */
     51  1.1  macallan #define CMD_SET_VOLUME		0x48	/* beeper volume */
     52  1.1  macallan 
     53  1.1  macallan #define CMD_READ_GENSTAT	0x10
     54  1.1  macallan #define CMD_READ_BACKLIGHT	0x11
     55  1.1  macallan #define CMD_READ_SYSTEMP	0x12	/* temperature */
     56  1.1  macallan #define CMD_READ_VOLUME		0x13
     57  1.1  macallan #define CMD_READ_VBATT		0x14
     58  1.1  macallan #define CMD_READ_VERSION	0x15
     59  1.1  macallan #define CMD_READ_CPUSPEED	0x16
     60  1.1  macallan /* 0x17 returns a byte, always 0 */
     61  1.1  macallan /* 0x18 returns a byte, always(?) 0x77 */
     62  1.1  macallan #define CMD_READ_GENSTAT2	0x19
     63  1.1  macallan #define CMD_READ_FANSPEED	0x50	/* takes a parameter, returns nothing? */
     64  1.1  macallan 
     65  1.1  macallan /* these are according to the ROM methods
     66  1.1  macallan    #define GENSTAT_DC_PRESENT		0x01
     67  1.1  macallan    #define GENSTAT_DC_ENABLE		0x02
     68  1.1  macallan    #define GENSTAT_BATTERY_PRESENT	0x04
     69  1.1  macallan    #define GENSTAT_BATTERY_CHARGING	0x08
     70  1.1  macallan    #define GENSTAT_LID_CLOSED		0x10
     71  1.1  macallan    #define GENSTAT_UNIX_MODE		0x20
     72  1.1  macallan    #define GENSTAT_SPREADSPECTRUM	0x40
     73  1.1  macallan */
     74  1.1  macallan 
     75  1.1  macallan /* these are according to experiment */
     76  1.1  macallan #define GENSTAT_UNIX_MODE		0x01
     77  1.1  macallan    #define GENSTAT_DC_PRESENT		0x08	/* guess */
     78  1.1  macallan    #define GENSTAT_DC_ENABLE		0x18	/* guess */
     79  1.1  macallan #define GENSTAT_LID_CLOSED		0x80
     80  1.1  macallan 
     81  1.1  macallan #define GENSTAT2_MUTE		0x02
     82  1.1  macallan 
     83  1.1  macallan 
     84  1.1  macallan 
     85  1.1  macallan #endif /* TADPMUREG_H */