• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #ifndef __DRIVERS_I2C_SX9310_CHIP_H__
4 #define __DRIVERS_I2C_SX9310_CHIP_H__
5 
6 #include <acpi/acpi_device.h>
7 #include <device/i2c_simple.h>
8 
9 #define MAX_COMBINED_SENSORS_ENTRIES 4
10 
11 enum sx9310_resolution {
12 	SX9310_COARSEST = 1,
13 	SX9310_VERY_COARSE,
14 	SX9310_COARSE,
15 	SX9310_MEDIUM_COARSE,
16 	SX9310_MEDIUM,
17 	SX9310_FINE,
18 	SX9310_VERY_FINE,
19 	SX9310_FINEST,
20 };
21 
22 struct drivers_i2c_sx9310_config {
23 	/* Device Description */
24 	const char *desc;
25 
26 	/* ACPI _UID */
27 	unsigned int uid;
28 
29 	/* Bus speed in Hz, default is I2C_SPEED_FAST */
30 	enum i2c_speed speed;
31 
32 	/* Use GPIO-based interrupt instead of IO-APIC */
33 	struct acpi_gpio irq_gpio;
34 
35 	/* IO-APIC interrupt */
36 	struct acpi_irq irq;
37 
38 	/*
39 	 * Registers definition in the kernel source tree at:
40 	 * Documentation/devicetree/bindings/iio/proximity/semtech,sx9310.yaml
41 	 */
42 
43 	/* When true, cs0 is the ground. 0 [default] is false. */
44 	uint32_t cs0_ground;
45 
46 	/* Sensor used for start-up proximity detection: Default 0. */
47 	uint32_t startup_sensor;
48 
49 	/* Raw Proximity filter strength: When not set, disabled. */
50 	uint32_t proxraw_strength;
51 
52 	/* Average Proximity filter strength: When not set, disabled. */
53 	uint32_t avg_pos_strength;
54 
55 	/*
56 	 * List of which sensors are combined and represented by CS3.
57 	 * Could be standalone (3) or combination of 0, 1, 2, 3.
58 	 * Driver default: CS0 + CS1.
59 	 */
60 	uint32_t combined_sensors_count;
61 	uint32_t combined_sensors[MAX_COMBINED_SENSORS_ENTRIES];
62 
63 	/* Capacitance measure resolution. Driver default: "finest". */
64 	enum sx9310_resolution resolution;
65 };
66 
67 #endif /* __DRIVERS_I2C_SX9310_CHIP_H__ */
68