1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ 2*4882a593Smuzhiyun /* 3*4882a593Smuzhiyun * Copyright (C) 2005-2007 Jiri Slaby <jirislaby@gmail.com> 4*4882a593Smuzhiyun * 5*4882a593Smuzhiyun * This program is free software; you can redistribute it and/or modify 6*4882a593Smuzhiyun * it under the terms of the GNU General Public License as published by 7*4882a593Smuzhiyun * the Free Software Foundation; either version 2 of the License, or 8*4882a593Smuzhiyun * (at your option) any later version. 9*4882a593Smuzhiyun */ 10*4882a593Smuzhiyun 11*4882a593Smuzhiyun #ifndef __PHANTOM_H 12*4882a593Smuzhiyun #define __PHANTOM_H 13*4882a593Smuzhiyun 14*4882a593Smuzhiyun #include <linux/types.h> 15*4882a593Smuzhiyun 16*4882a593Smuzhiyun /* PHN_(G/S)ET_REG param */ 17*4882a593Smuzhiyun struct phm_reg { 18*4882a593Smuzhiyun __u32 reg; 19*4882a593Smuzhiyun __u32 value; 20*4882a593Smuzhiyun }; 21*4882a593Smuzhiyun 22*4882a593Smuzhiyun /* PHN_(G/S)ET_REGS param */ 23*4882a593Smuzhiyun struct phm_regs { 24*4882a593Smuzhiyun __u32 count; 25*4882a593Smuzhiyun __u32 mask; 26*4882a593Smuzhiyun __u32 values[8]; 27*4882a593Smuzhiyun }; 28*4882a593Smuzhiyun 29*4882a593Smuzhiyun #define PH_IOC_MAGIC 'p' 30*4882a593Smuzhiyun #define PHN_GET_REG _IOWR(PH_IOC_MAGIC, 0, struct phm_reg *) 31*4882a593Smuzhiyun #define PHN_SET_REG _IOW(PH_IOC_MAGIC, 1, struct phm_reg *) 32*4882a593Smuzhiyun #define PHN_GET_REGS _IOWR(PH_IOC_MAGIC, 2, struct phm_regs *) 33*4882a593Smuzhiyun #define PHN_SET_REGS _IOW(PH_IOC_MAGIC, 3, struct phm_regs *) 34*4882a593Smuzhiyun /* this ioctl tells the driver, that the caller is not OpenHaptics and might 35*4882a593Smuzhiyun * use improved registers update (no more phantom switchoffs when using 36*4882a593Smuzhiyun * libphantom) */ 37*4882a593Smuzhiyun #define PHN_NOT_OH _IO(PH_IOC_MAGIC, 4) 38*4882a593Smuzhiyun #define PHN_GETREG _IOWR(PH_IOC_MAGIC, 5, struct phm_reg) 39*4882a593Smuzhiyun #define PHN_SETREG _IOW(PH_IOC_MAGIC, 6, struct phm_reg) 40*4882a593Smuzhiyun #define PHN_GETREGS _IOWR(PH_IOC_MAGIC, 7, struct phm_regs) 41*4882a593Smuzhiyun #define PHN_SETREGS _IOW(PH_IOC_MAGIC, 8, struct phm_regs) 42*4882a593Smuzhiyun 43*4882a593Smuzhiyun #define PHN_CONTROL 0x6 /* control byte in iaddr space */ 44*4882a593Smuzhiyun #define PHN_CTL_AMP 0x1 /* switch after torques change */ 45*4882a593Smuzhiyun #define PHN_CTL_BUT 0x2 /* is button switched */ 46*4882a593Smuzhiyun #define PHN_CTL_IRQ 0x10 /* is irq enabled */ 47*4882a593Smuzhiyun 48*4882a593Smuzhiyun #define PHN_ZERO_FORCE 2048 /* zero torque on motor */ 49*4882a593Smuzhiyun 50*4882a593Smuzhiyun #endif 51