spicvar.h revision 1.7.20.1 1 1.7.20.1 jdolecek /* $NetBSD: spicvar.h,v 1.7.20.1 2017/12/03 11:37:04 jdolecek Exp $ */
2 1.2 jmcneill
3 1.7.20.1 jdolecek /*
4 1.7.20.1 jdolecek * Copyright (c) 2002 The NetBSD Foundation, Inc.
5 1.7.20.1 jdolecek * All rights reserved.
6 1.7.20.1 jdolecek *
7 1.7.20.1 jdolecek * This code is derived from software contributed to The NetBSD Foundation
8 1.7.20.1 jdolecek * by Lennart Augustsson (lennart (at) augustsson.net) at
9 1.7.20.1 jdolecek * Carlstedt Research & Technology.
10 1.7.20.1 jdolecek *
11 1.7.20.1 jdolecek * Redistribution and use in source and binary forms, with or without
12 1.7.20.1 jdolecek * modification, are permitted provided that the following conditions
13 1.7.20.1 jdolecek * are met:
14 1.7.20.1 jdolecek * 1. Redistributions of source code must retain the above copyright
15 1.7.20.1 jdolecek * notice, this list of conditions and the following disclaimer.
16 1.7.20.1 jdolecek * 2. Redistributions in binary form must reproduce the above copyright
17 1.7.20.1 jdolecek * notice, this list of conditions and the following disclaimer in the
18 1.7.20.1 jdolecek * documentation and/or other materials provided with the distribution.
19 1.7.20.1 jdolecek *
20 1.7.20.1 jdolecek * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21 1.7.20.1 jdolecek * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 1.7.20.1 jdolecek * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 1.7.20.1 jdolecek * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24 1.7.20.1 jdolecek * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 1.7.20.1 jdolecek * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 1.7.20.1 jdolecek * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 1.7.20.1 jdolecek * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 1.7.20.1 jdolecek * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 1.7.20.1 jdolecek * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 1.7.20.1 jdolecek * POSSIBILITY OF SUCH DAMAGE.
31 1.7.20.1 jdolecek */
32 1.7.20.1 jdolecek
33 1.7.20.1 jdolecek /*
34 1.7.20.1 jdolecek * The SPIC is used on some Sony Vaios to handle the jog dial and other
35 1.7.20.1 jdolecek * peripherals.
36 1.7.20.1 jdolecek * The protocol used by the SPIC seems to vary wildly among the different
37 1.7.20.1 jdolecek * models, and I've found no documentation.
38 1.7.20.1 jdolecek * This file handles the jog dial on the SRX77 model, and perhaps nothing
39 1.7.20.1 jdolecek * else.
40 1.7.20.1 jdolecek *
41 1.7.20.1 jdolecek * The general way of talking to the SPIC was gleaned from the Linux and
42 1.7.20.1 jdolecek * FreeBSD drivers. The hex numbers were taken from these drivers (they
43 1.7.20.1 jdolecek * come from reverese engineering.)
44 1.7.20.1 jdolecek *
45 1.7.20.1 jdolecek * TODO:
46 1.7.20.1 jdolecek * Make it handle more models.
47 1.7.20.1 jdolecek * Figure out why the interrupt mode doesn't work.
48 1.7.20.1 jdolecek */
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