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