xref: /linux-6.15/include/linux/input/kxtj9.h (revision 45051539)
1*45051539SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
2e8e70d83SChris Hudson /*
3e8e70d83SChris Hudson  * Copyright (C) 2011 Kionix, Inc.
4e8e70d83SChris Hudson  * Written by Chris Hudson <[email protected]>
5e8e70d83SChris Hudson  */
6e8e70d83SChris Hudson 
7e8e70d83SChris Hudson #ifndef __KXTJ9_H__
8e8e70d83SChris Hudson #define __KXTJ9_H__
9e8e70d83SChris Hudson 
10e8e70d83SChris Hudson #define KXTJ9_I2C_ADDR		0x0F
11e8e70d83SChris Hudson 
12e8e70d83SChris Hudson struct kxtj9_platform_data {
13e8e70d83SChris Hudson 	unsigned int min_interval;	/* minimum poll interval (in milli-seconds) */
1404391660SChristopher Hudson 	unsigned int init_interval;	/* initial poll interval (in milli-seconds) */
15e8e70d83SChris Hudson 
16e8e70d83SChris Hudson 	/*
17e8e70d83SChris Hudson 	 * By default, x is axis 0, y is axis 1, z is axis 2; these can be
18e8e70d83SChris Hudson 	 * changed to account for sensor orientation within the host device.
19e8e70d83SChris Hudson 	 */
20e8e70d83SChris Hudson 	u8 axis_map_x;
21e8e70d83SChris Hudson 	u8 axis_map_y;
22e8e70d83SChris Hudson 	u8 axis_map_z;
23e8e70d83SChris Hudson 
24e8e70d83SChris Hudson 	/*
25e8e70d83SChris Hudson 	 * Each axis can be negated to account for sensor orientation within
26e8e70d83SChris Hudson 	 * the host device.
27e8e70d83SChris Hudson 	 */
28e8e70d83SChris Hudson 	bool negate_x;
29e8e70d83SChris Hudson 	bool negate_y;
30e8e70d83SChris Hudson 	bool negate_z;
31e8e70d83SChris Hudson 
32e8e70d83SChris Hudson 	/* CTRL_REG1: set resolution, g-range, data ready enable */
33e8e70d83SChris Hudson 	/* Output resolution: 8-bit valid or 12-bit valid */
34e8e70d83SChris Hudson 	#define RES_8BIT		0
35e8e70d83SChris Hudson 	#define RES_12BIT		(1 << 6)
36e8e70d83SChris Hudson 	u8 res_12bit;
37e8e70d83SChris Hudson 	/* Output g-range: +/-2g, 4g, or 8g */
38e8e70d83SChris Hudson 	#define KXTJ9_G_2G		0
39e8e70d83SChris Hudson 	#define KXTJ9_G_4G		(1 << 3)
40e8e70d83SChris Hudson 	#define KXTJ9_G_8G		(1 << 4)
41e8e70d83SChris Hudson 	u8 g_range;
42e8e70d83SChris Hudson 
43e8e70d83SChris Hudson 	int (*init)(void);
44e8e70d83SChris Hudson 	void (*exit)(void);
45e8e70d83SChris Hudson 	int (*power_on)(void);
46e8e70d83SChris Hudson 	int (*power_off)(void);
47e8e70d83SChris Hudson };
48e8e70d83SChris Hudson #endif  /* __KXTJ9_H__ */
49