Home | History | Annotate | Line # | Download | only in ic
spicvar.h revision 1.7.38.1
      1  1.7.38.1     skrll /*	$NetBSD: spicvar.h,v 1.7.38.1 2016/07/09 20:25:02 skrll Exp $ */
      2       1.2  jmcneill 
      3  1.7.38.1     skrll /*
      4  1.7.38.1     skrll  * Copyright (c) 2002 The NetBSD Foundation, Inc.
      5  1.7.38.1     skrll  * All rights reserved.
      6  1.7.38.1     skrll  *
      7  1.7.38.1     skrll  * This code is derived from software contributed to The NetBSD Foundation
      8  1.7.38.1     skrll  * by Lennart Augustsson (lennart (at) augustsson.net) at
      9  1.7.38.1     skrll  * Carlstedt Research & Technology.
     10  1.7.38.1     skrll  *
     11  1.7.38.1     skrll  * Redistribution and use in source and binary forms, with or without
     12  1.7.38.1     skrll  * modification, are permitted provided that the following conditions
     13  1.7.38.1     skrll  * are met:
     14  1.7.38.1     skrll  * 1. Redistributions of source code must retain the above copyright
     15  1.7.38.1     skrll  *    notice, this list of conditions and the following disclaimer.
     16  1.7.38.1     skrll  * 2. Redistributions in binary form must reproduce the above copyright
     17  1.7.38.1     skrll  *    notice, this list of conditions and the following disclaimer in the
     18  1.7.38.1     skrll  *    documentation and/or other materials provided with the distribution.
     19  1.7.38.1     skrll  *
     20  1.7.38.1     skrll  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     21  1.7.38.1     skrll  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     22  1.7.38.1     skrll  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     23  1.7.38.1     skrll  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     24  1.7.38.1     skrll  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     25  1.7.38.1     skrll  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     26  1.7.38.1     skrll  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     27  1.7.38.1     skrll  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     28  1.7.38.1     skrll  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     29  1.7.38.1     skrll  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     30  1.7.38.1     skrll  * POSSIBILITY OF SUCH DAMAGE.
     31  1.7.38.1     skrll  */
     32  1.7.38.1     skrll 
     33  1.7.38.1     skrll /*
     34  1.7.38.1     skrll  * The SPIC is used on some Sony Vaios to handle the jog dial and other
     35  1.7.38.1     skrll  * peripherals.
     36  1.7.38.1     skrll  * The protocol used by the SPIC seems to vary wildly among the different
     37  1.7.38.1     skrll  * models, and I've found no documentation.
     38  1.7.38.1     skrll  * This file handles the jog dial on the SRX77 model, and perhaps nothing
     39  1.7.38.1     skrll  * else.
     40  1.7.38.1     skrll  *
     41  1.7.38.1     skrll  * The general way of talking to the SPIC was gleaned from the Linux and
     42  1.7.38.1     skrll  * FreeBSD drivers.  The hex numbers were taken from these drivers (they
     43  1.7.38.1     skrll  * come from reverese engineering.)
     44  1.7.38.1     skrll  *
     45  1.7.38.1     skrll  * TODO:
     46  1.7.38.1     skrll  *   Make it handle more models.
     47  1.7.38.1     skrll  *   Figure out why the interrupt mode doesn't work.
     48  1.7.38.1     skrll  */
     49       1.2  jmcneill #include <dev/sysmon/sysmonvar.h>
     50       1.2  jmcneill 
     51       1.1  augustss struct spic_softc {
     52       1.5   xtraeme 	device_t sc_dev;
     53       1.1  augustss 
     54       1.1  augustss 	bus_space_tag_t	sc_iot;
     55       1.1  augustss 	bus_space_handle_t sc_ioh;
     56       1.1  augustss 
     57       1.1  augustss 	struct callout sc_poll;
     58       1.1  augustss 
     59       1.1  augustss 	int sc_buttons;
     60       1.1  augustss 	char sc_enabled;
     61       1.1  augustss 
     62       1.5   xtraeme 	device_t sc_wsmousedev;
     63       1.2  jmcneill 
     64       1.2  jmcneill #define	SPIC_PSWITCH_LID	0
     65       1.2  jmcneill #define	SPIC_PSWITCH_SUSPEND	1
     66       1.2  jmcneill #define	SPIC_PSWITCH_HIBERNATE	2
     67       1.2  jmcneill #define	SPIC_NPSWITCH		3
     68       1.2  jmcneill 	struct sysmon_pswitch sc_smpsw[SPIC_NPSWITCH];
     69       1.1  augustss };
     70       1.1  augustss 
     71       1.1  augustss void spic_attach(struct spic_softc *);
     72       1.7    dyoung bool spic_suspend(device_t, const pmf_qual_t *);
     73       1.7    dyoung bool spic_resume(device_t, const pmf_qual_t *);
     74       1.1  augustss 
     75       1.1  augustss int spic_intr(void *);
     76