-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
107 additions
and
0 deletions.
There are no files selected for viewing
107 changes: 107 additions & 0 deletions
107
patch/int3472-support-independent-clock-and-LED-gpios-5.17+.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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); |