-
Notifications
You must be signed in to change notification settings - Fork 48
/
int3472-support-independent-clock-and-LED-gpios-5.17+.patch
107 lines (97 loc) · 3.84 KB
/
int3472-support-independent-clock-and-LED-gpios-5.17+.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
diff --git a/drivers/platform/x86/intel/int3472/common.h b/drivers/platform/x86/intel/int3472/common.h
index 53270d19c73a..6c5b52ac6c2c 100644
--- a/drivers/platform/x86/intel/int3472/common.h
+++ b/drivers/platform/x86/intel/int3472/common.h
@@ -23,7 +23,7 @@
#define INT3472_GPIO_TYPE_PRIVACY_LED 0x0d
#define INT3472_PDEV_MAX_NAME_LEN 23
-#define INT3472_MAX_SENSOR_GPIOS 3
+#define INT3472_MAX_SENSOR_GPIOS 4
#define GPIO_REGULATOR_NAME_LENGTH 21
#define GPIO_REGULATOR_SUPPLY_NAME_LENGTH 9
@@ -73,6 +73,7 @@ struct int3472_sensor_config {
const char *sensor_module_name;
struct regulator_consumer_supply supply_map;
const struct int3472_gpio_function_remap *function_maps;
+ const bool independent_clk_gpios;
};
struct int3472_discrete_device {
diff --git a/drivers/platform/x86/intel/int3472/discrete.c b/drivers/platform/x86/intel/int3472/discrete.c
index ed4c9d760757..f5857ec334fa 100644
--- a/drivers/platform/x86/intel/int3472/discrete.c
+++ b/drivers/platform/x86/intel/int3472/discrete.c
@@ -57,11 +57,17 @@ static const struct int3472_gpio_function_remap ov2680_gpio_function_remaps[] =
static const struct int3472_sensor_config int3472_sensor_configs[] = {
/* Lenovo Miix 510-12ISK - OV2680, Front */
- { "GNDF140809R", { 0 }, ov2680_gpio_function_remaps },
+ { "GNDF140809R", { 0 }, ov2680_gpio_function_remaps, false },
/* Lenovo Miix 510-12ISK - OV5648, Rear */
- { "GEFF150023R", REGULATOR_SUPPLY("avdd", NULL), NULL },
+ { "GEFF150023R", REGULATOR_SUPPLY("avdd", NULL), NULL, false },
/* Surface Go 1&2 - OV5693, Front */
- { "YHCU", REGULATOR_SUPPLY("avdd", NULL), NULL },
+ { "YHCU", REGULATOR_SUPPLY("avdd", NULL), NULL, false },
+ /* Dell Latitude 9420 - OV01A1S, Front */
+ { "0BF111N3", { 0 }, NULL, true },
+ /* Dell Latitude 9420 - HM11B1, Front */
+ { "9BF123N3", { 0 }, NULL, true },
+ /* Lenovo X1 Yoga - OV2740, Front */
+ { "CJFLE23", { 0 }, NULL, true },
};
static const struct int3472_sensor_config *
@@ -225,6 +231,8 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares,
const char *err_msg;
int ret;
u8 type;
+ u8 active_value;
+ u32 polarity = GPIO_LOOKUP_FLAGS_DEFAULT;
if (!acpi_gpio_get_io_resource(ares, &agpio))
return 1;
@@ -245,28 +253,45 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares,
}
type = obj->integer.value & 0xff;
+ active_value = obj->integer.value >> 24;
+ if (!active_value)
+ polarity = GPIO_ACTIVE_LOW;
switch (type) {
case INT3472_GPIO_TYPE_RESET:
ret = skl_int3472_map_gpio_to_sensor(int3472, agpio, "reset",
- GPIO_ACTIVE_LOW);
+ polarity);
if (ret)
err_msg = "Failed to map reset pin to sensor\n";
break;
case INT3472_GPIO_TYPE_POWERDOWN:
ret = skl_int3472_map_gpio_to_sensor(int3472, agpio, "powerdown",
- GPIO_ACTIVE_LOW);
+ polarity);
if (ret)
err_msg = "Failed to map powerdown pin to sensor\n";
break;
case INT3472_GPIO_TYPE_CLK_ENABLE:
case INT3472_GPIO_TYPE_PRIVACY_LED:
- ret = skl_int3472_map_gpio_to_clk(int3472, agpio, type);
- if (ret)
- err_msg = "Failed to map GPIO to clock\n";
-
+ if (!IS_ERR(int3472->sensor_config) &&
+ int3472->sensor_config->independent_clk_gpios) {
+ if (type == INT3472_GPIO_TYPE_CLK_ENABLE) {
+ ret = skl_int3472_map_gpio_to_sensor(int3472, agpio,
+ "clken", polarity);
+ if (ret)
+ err_msg = "Failed to map clken pin to sensor\n";
+ } else if (type == INT3472_GPIO_TYPE_PRIVACY_LED) {
+ ret = skl_int3472_map_gpio_to_sensor(int3472, agpio,
+ "pled", polarity);
+ if (ret)
+ err_msg = "Failed to map pled pin to sensor\n";
+ }
+ } else {
+ ret = skl_int3472_map_gpio_to_clk(int3472, agpio, type);
+ if (ret)
+ err_msg = "Failed to map GPIO to clock\n";
+ }
break;
case INT3472_GPIO_TYPE_POWER_ENABLE:
ret = skl_int3472_register_regulator(int3472, agpio);