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