mb/google/fatcat: config GPP_F23 as ISH gpio pin
[coreboot2.git] / src / drivers / i2c / generic / chip.h
blob69ce29dae44dfdccd0f2e1960dc780e0edfb34e1
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #ifndef __I2C_GENERIC_CHIP_H__
4 #define __I2C_GENERIC_CHIP_H__
6 #include <acpi/acpi_device.h>
7 #include <device/i2c_simple.h>
9 #define MAX_GENERIC_PROPERTY_LIST 10
11 struct drivers_i2c_generic_config {
12 const char *hid; /* ACPI _HID (required) */
13 const char *cid; /* ACPI _CID */
14 const char *sub; /* ACPI _SUB */
15 const char *name; /* ACPI Device Name */
16 const char *desc; /* Device Description */
17 unsigned int uid; /* ACPI _UID */
18 enum i2c_speed speed; /* Bus speed in Hz, default is I2C_SPEED_FAST */
19 const char *compat_string; /* Compatible string for _HID=PRP0001 */
20 unsigned int wake; /* Wake GPE */
21 struct acpi_irq irq; /* Interrupt */
23 /* Use GPIO based interrupt instead of PIRQ */
24 struct acpi_gpio irq_gpio;
27 * This flag will add a device property which will indicate
28 * to the OS that it should probe this device before adding it.
30 * This can be used to declare a device that may not exist on
31 * the board, for example to support multiple trackpad vendors.
33 int probed;
36 * This flag will add a device property which will indicate
37 * that coreboot should attempt to detect the device on the i2c
38 * bus before generating a device entry in the SSDT.
40 * This can be used to declare a device that may not exist on
41 * the board, for example to support multiple touchpads and/or
42 * touchscreens.
44 int detect;
46 /* GPIO used to indicate if this device is present */
47 unsigned int device_present_gpio;
48 unsigned int device_present_gpio_invert;
50 /* Does the device have a power resource? */
51 bool has_power_resource;
53 /* GPIO used to take device out of reset or to put it into reset. */
54 struct acpi_gpio reset_gpio;
55 /* Delay to be inserted after device is taken out of reset. */
56 unsigned int reset_delay_ms;
57 /* Delay to be inserted after device is put into reset. */
58 unsigned int reset_off_delay_ms;
59 /* GPIO used to enable device. */
60 struct acpi_gpio enable_gpio;
61 /* Delay to be inserted after device is enabled. */
62 unsigned int enable_delay_ms;
63 /* Delay to be inserted after device is disabled. */
64 unsigned int enable_off_delay_ms;
65 /* GPIO used to stop operation of device. */
66 struct acpi_gpio stop_gpio;
67 /* Delay to be inserted after disabling stop. */
68 unsigned int stop_delay_ms;
69 /* Delay to be inserted after enabling stop. */
70 unsigned int stop_off_delay_ms;
73 * The Rotation Matrix' allows specifying a 3x3 matrix representing
74 * the orientation of devices, such as accelerometers. Each value in
75 * the matrix can be one of -1, 0, or 1, indicating the transformation
76 * applied to the device's axes.
78 * It is expected by linux and required for the OS to correctly interpret
79 * the data from the device.
81 bool has_rotation_matrix;
82 int rotation_matrix[9];
85 * Chip Direct Mapping is exclusive to Windows, a allows specifying the
86 * position where a chip is mounted. There are 8 positions:
87 * 1: 90 Degrees
88 * 2: 270 Degrees
89 * 3: 180 Degrees
90 * 4: 0 Degrees
91 * 5: 90 Degrees (Inverted)
92 * 6: 270 Degrees (Inverted)
93 * 7: 180 Degrees (Inverted)
94 * 8: 0 Degrees (Inverted)
96 * The _CDM method should return 0xabcd0X, where X is the position.
98 enum {
99 CDM_NOT_PRESENT = 0,
100 CDM_ROT_90,
101 CDM_ROT_180,
102 CDM_ROT_270,
103 CDM_ROT_0,
104 CDM_ROT_90_INVERT,
105 CDM_ROT_180_INVERT,
106 CDM_ROT_270_INVERT,
107 CDM_ROT_0_INVERT,
108 } cdm_index;
110 /* Generic properties for exporting device-specific data to the OS */
111 struct acpi_dp property_list[MAX_GENERIC_PROPERTY_LIST];
112 int property_count;
116 * Fills in generic information about i2c device from device-tree
117 * properties. Callback can be provided to fill in any
118 * device-specific information in SSDT.
120 * Parameters:
121 * dev: Device requesting i2c generic information to be filled
122 * callback: Callback to fill in device-specific information
123 * config: Pointer to drivers_i2c_generic_config structure
125 void i2c_generic_fill_ssdt(const struct device *dev,
126 void (*callback)(const struct device *dev),
127 struct drivers_i2c_generic_config *config);
129 #endif /* __I2C_GENERIC_CHIP_H__ */