1 /* SPDX-License-Identifier: GPL-2.0 */
4 #ifndef _INTEL_SKL_INT3472_H
5 #define _INTEL_SKL_INT3472_H
7 #include <linux/clk-provider.h>
8 #include <linux/gpio/machine.h>
9 #include <linux/regulator/driver.h>
10 #include <linux/regulator/machine.h>
11 #include <linux/types.h>
13 /* FIXME drop this once the I2C_DEV_NAME_FORMAT macro has been added to include/linux/i2c.h */
14 #ifndef I2C_DEV_NAME_FORMAT
15 #define I2C_DEV_NAME_FORMAT "i2c-%s"
19 #define INT3472_GPIO_TYPE_RESET 0x00
20 #define INT3472_GPIO_TYPE_POWERDOWN 0x01
21 #define INT3472_GPIO_TYPE_POWER_ENABLE 0x0b
22 #define INT3472_GPIO_TYPE_CLK_ENABLE 0x0c
23 #define INT3472_GPIO_TYPE_PRIVACY_LED 0x0d
25 #define INT3472_PDEV_MAX_NAME_LEN 23
26 #define INT3472_MAX_SENSOR_GPIOS 3
28 #define GPIO_REGULATOR_NAME_LENGTH 21
29 #define GPIO_REGULATOR_SUPPLY_NAME_LENGTH 9
31 #define CIO2_SENSOR_SSDB_MCLKSPEED_OFFSET 86
33 #define INT3472_REGULATOR(_name, _supply, _ops) \
34 (const struct regulator_desc) { \
36 .supply_name = _supply, \
37 .type = REGULATOR_VOLTAGE, \
39 .owner = THIS_MODULE, \
42 #define to_int3472_clk(hw) \
43 container_of(hw, struct int3472_gpio_clock, clk_hw)
45 #define to_int3472_device(clk) \
46 container_of(clk, struct int3472_discrete_device, clock)
50 struct platform_device;
61 u8 control_logic_type;
67 struct int3472_gpio_function_remap {
68 const char *documented;
72 struct int3472_sensor_config {
73 const char *sensor_module_name;
74 struct regulator_consumer_supply supply_map;
75 const struct int3472_gpio_function_remap *function_maps;
78 struct int3472_discrete_device {
79 struct acpi_device *adev;
81 struct acpi_device *sensor;
82 const char *sensor_name;
84 const struct int3472_sensor_config *sensor_config;
86 struct int3472_gpio_regulator {
87 char regulator_name[GPIO_REGULATOR_NAME_LENGTH];
88 char supply_name[GPIO_REGULATOR_SUPPLY_NAME_LENGTH];
89 struct gpio_desc *gpio;
90 struct regulator_dev *rdev;
91 struct regulator_desc rdesc;
94 struct int3472_gpio_clock {
97 struct clk_lookup *cl;
98 struct gpio_desc *ena_gpio;
99 struct gpio_desc *led_gpio;
103 unsigned int ngpios; /* how many GPIOs have we seen */
104 unsigned int n_sensor_gpios; /* how many have we mapped to sensor */
105 struct gpiod_lookup_table gpios;
108 int skl_int3472_discrete_probe(struct platform_device *pdev);
109 int skl_int3472_discrete_remove(struct platform_device *pdev);
110 int skl_int3472_tps68470_probe(struct i2c_client *client);
111 union acpi_object *skl_int3472_get_acpi_buffer(struct acpi_device *adev,
113 int skl_int3472_fill_cldb(struct acpi_device *adev, struct int3472_cldb *cldb);
115 int skl_int3472_register_clock(struct int3472_discrete_device *int3472);
116 void skl_int3472_unregister_clock(struct int3472_discrete_device *int3472);
118 int skl_int3472_register_regulator(struct int3472_discrete_device *int3472,
119 struct acpi_resource_gpio *agpio);
120 void skl_int3472_unregister_regulator(struct int3472_discrete_device *int3472);