xref: /linux/include/uapi/linux/phantom.h (revision 498495dba268b20e8eadd7fe93c140c68b6cc9d2)
1*e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2607ca46eSDavid Howells /*
3607ca46eSDavid Howells  *  Copyright (C) 2005-2007 Jiri Slaby <jirislaby@gmail.com>
4607ca46eSDavid Howells  *
5607ca46eSDavid Howells  *  This program is free software; you can redistribute it and/or modify
6607ca46eSDavid Howells  *  it under the terms of the GNU General Public License as published by
7607ca46eSDavid Howells  *  the Free Software Foundation; either version 2 of the License, or
8607ca46eSDavid Howells  *  (at your option) any later version.
9607ca46eSDavid Howells  */
10607ca46eSDavid Howells 
11607ca46eSDavid Howells #ifndef __PHANTOM_H
12607ca46eSDavid Howells #define __PHANTOM_H
13607ca46eSDavid Howells 
14607ca46eSDavid Howells #include <linux/types.h>
15607ca46eSDavid Howells 
16607ca46eSDavid Howells /* PHN_(G/S)ET_REG param */
17607ca46eSDavid Howells struct phm_reg {
18607ca46eSDavid Howells 	__u32 reg;
19607ca46eSDavid Howells 	__u32 value;
20607ca46eSDavid Howells };
21607ca46eSDavid Howells 
22607ca46eSDavid Howells /* PHN_(G/S)ET_REGS param */
23607ca46eSDavid Howells struct phm_regs {
24607ca46eSDavid Howells 	__u32 count;
25607ca46eSDavid Howells 	__u32 mask;
26607ca46eSDavid Howells 	__u32 values[8];
27607ca46eSDavid Howells };
28607ca46eSDavid Howells 
29607ca46eSDavid Howells #define PH_IOC_MAGIC		'p'
30607ca46eSDavid Howells #define PHN_GET_REG		_IOWR(PH_IOC_MAGIC, 0, struct phm_reg *)
31607ca46eSDavid Howells #define PHN_SET_REG		_IOW(PH_IOC_MAGIC, 1, struct phm_reg *)
32607ca46eSDavid Howells #define PHN_GET_REGS		_IOWR(PH_IOC_MAGIC, 2, struct phm_regs *)
33607ca46eSDavid Howells #define PHN_SET_REGS		_IOW(PH_IOC_MAGIC, 3, struct phm_regs *)
34607ca46eSDavid Howells /* this ioctl tells the driver, that the caller is not OpenHaptics and might
35607ca46eSDavid Howells  * use improved registers update (no more phantom switchoffs when using
36607ca46eSDavid Howells  * libphantom) */
37607ca46eSDavid Howells #define PHN_NOT_OH		_IO(PH_IOC_MAGIC, 4)
38607ca46eSDavid Howells #define PHN_GETREG		_IOWR(PH_IOC_MAGIC, 5, struct phm_reg)
39607ca46eSDavid Howells #define PHN_SETREG		_IOW(PH_IOC_MAGIC, 6, struct phm_reg)
40607ca46eSDavid Howells #define PHN_GETREGS		_IOWR(PH_IOC_MAGIC, 7, struct phm_regs)
41607ca46eSDavid Howells #define PHN_SETREGS		_IOW(PH_IOC_MAGIC, 8, struct phm_regs)
42607ca46eSDavid Howells 
43607ca46eSDavid Howells #define PHN_CONTROL		0x6     /* control byte in iaddr space */
44607ca46eSDavid Howells #define PHN_CTL_AMP		0x1     /*   switch after torques change */
45607ca46eSDavid Howells #define PHN_CTL_BUT		0x2     /*   is button switched */
46607ca46eSDavid Howells #define PHN_CTL_IRQ		0x10    /*   is irq enabled */
47607ca46eSDavid Howells 
48607ca46eSDavid Howells #define PHN_ZERO_FORCE		2048	/* zero torque on motor */
49607ca46eSDavid Howells 
50607ca46eSDavid Howells #endif
51