All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/8] platform/x86: Remove "default n" entries
@ 2021-06-18 12:55 Andy Shevchenko
  2021-06-18 12:55 ` [PATCH v2 2/8] platform/x86: intel_skl_int3472: Free ACPI device resources after use Andy Shevchenko
                   ` (8 more replies)
  0 siblings, 9 replies; 15+ messages in thread
From: Andy Shevchenko @ 2021-06-18 12:55 UTC (permalink / raw)
  To: Hans de Goede, Mario Limonciello, Andy Shevchenko, Daniel Scally,
	Heikki Krogerus, linux-kernel, platform-driver-x86
  Cc: Mark Gross

Linus already once did that for PDx86, don't repeat our mistakes.
TL;DR: 'n' *is* the default 'default'.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: no changes
 drivers/platform/x86/Kconfig      | 1 -
 drivers/platform/x86/dell/Kconfig | 1 -
 2 files changed, 2 deletions(-)

diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index 4fd792f2a10a..ccb827b57f1f 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -1092,7 +1092,6 @@ config TOUCHSCREEN_DMI
 
 config FW_ATTR_CLASS
 	tristate
-	default n
 
 config INTEL_IMR
 	bool "Intel Isolated Memory Region support"
diff --git a/drivers/platform/x86/dell/Kconfig b/drivers/platform/x86/dell/Kconfig
index 9b0a4d080f43..9e7314d90bea 100644
--- a/drivers/platform/x86/dell/Kconfig
+++ b/drivers/platform/x86/dell/Kconfig
@@ -5,7 +5,6 @@
 
 menuconfig X86_PLATFORM_DRIVERS_DELL
 	bool "Dell X86 Platform Specific Device Drivers"
-	default n
 	depends on X86_PLATFORM_DEVICES
 	help
 	  Say Y here to get to see options for device drivers for various
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v2 2/8] platform/x86: intel_skl_int3472: Free ACPI device resources after use
  2021-06-18 12:55 [PATCH v2 1/8] platform/x86: Remove "default n" entries Andy Shevchenko
@ 2021-06-18 12:55 ` Andy Shevchenko
  2021-06-21 22:32   ` Daniel Scally
  2021-06-18 12:55 ` [PATCH v2 3/8] platform/x86: intel_skl_int3472: Fix dependencies (drop CLKDEV_LOOKUP) Andy Shevchenko
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 15+ messages in thread
From: Andy Shevchenko @ 2021-06-18 12:55 UTC (permalink / raw)
  To: Hans de Goede, Mario Limonciello, Andy Shevchenko, Daniel Scally,
	Heikki Krogerus, linux-kernel, platform-driver-x86
  Cc: Mark Gross

We may free ACPI device resources immediately after use.
Refactor skl_int3472_parse_crs() accordingly.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: new patch
 .../x86/intel-int3472/intel_skl_int3472_discrete.c  | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/platform/x86/intel-int3472/intel_skl_int3472_discrete.c b/drivers/platform/x86/intel-int3472/intel_skl_int3472_discrete.c
index 8c18dbff1c43..48a00a1f4fb6 100644
--- a/drivers/platform/x86/intel-int3472/intel_skl_int3472_discrete.c
+++ b/drivers/platform/x86/intel-int3472/intel_skl_int3472_discrete.c
@@ -308,8 +308,10 @@ static int skl_int3472_parse_crs(struct int3472_discrete_device *int3472)
 	ret = acpi_dev_get_resources(int3472->adev, &resource_list,
 				     skl_int3472_handle_gpio_resources,
 				     int3472);
-	if (ret)
-		goto out_free_res_list;
+	if (ret < 0)
+		return ret;
+
+	acpi_dev_free_resource_list(&resource_list);
 
 	/*
 	 * If we find no clock enable GPIO pin then the privacy LED won't work.
@@ -319,7 +321,7 @@ static int skl_int3472_parse_crs(struct int3472_discrete_device *int3472)
 	if (int3472->clock.ena_gpio) {
 		ret = skl_int3472_register_clock(int3472);
 		if (ret)
-			goto out_free_res_list;
+			return ret;
 	} else {
 		if (int3472->clock.led_gpio)
 			dev_warn(int3472->dev,
@@ -329,10 +331,7 @@ static int skl_int3472_parse_crs(struct int3472_discrete_device *int3472)
 	int3472->gpios.dev_id = int3472->sensor_name;
 	gpiod_add_lookup_table(&int3472->gpios);
 
-out_free_res_list:
-	acpi_dev_free_resource_list(&resource_list);
-
-	return ret;
+	return 0;
 }
 
 int skl_int3472_discrete_probe(struct platform_device *pdev)
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v2 3/8] platform/x86: intel_skl_int3472: Fix dependencies (drop CLKDEV_LOOKUP)
  2021-06-18 12:55 [PATCH v2 1/8] platform/x86: Remove "default n" entries Andy Shevchenko
  2021-06-18 12:55 ` [PATCH v2 2/8] platform/x86: intel_skl_int3472: Free ACPI device resources after use Andy Shevchenko
@ 2021-06-18 12:55 ` Andy Shevchenko
  2021-06-18 12:55 ` [PATCH v2 4/8] platform/x86: intel_skl_int3472: Use ACPI GPIO resource directly Andy Shevchenko
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: Andy Shevchenko @ 2021-06-18 12:55 UTC (permalink / raw)
  To: Hans de Goede, Mario Limonciello, Andy Shevchenko, Daniel Scally,
	Heikki Krogerus, linux-kernel, platform-driver-x86
  Cc: Mark Gross

Besides the fact that COMMON_CLK selects CLKDEV_LOOKUP, the latter
is going to be removed from clock framework.

Reviewed-by: Daniel Scally <djrscally@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: added Rb (Daniel)
 drivers/platform/x86/intel-int3472/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/x86/intel-int3472/Kconfig b/drivers/platform/x86/intel-int3472/Kconfig
index c112878e833b..62e5d4cf9ee5 100644
--- a/drivers/platform/x86/intel-int3472/Kconfig
+++ b/drivers/platform/x86/intel-int3472/Kconfig
@@ -1,7 +1,7 @@
 config INTEL_SKL_INT3472
 	tristate "Intel SkyLake ACPI INT3472 Driver"
 	depends on ACPI
-	depends on COMMON_CLK && CLKDEV_LOOKUP
+	depends on COMMON_CLK
 	depends on I2C
 	depends on GPIOLIB
 	depends on REGULATOR
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v2 4/8] platform/x86: intel_skl_int3472: Use ACPI GPIO resource directly
  2021-06-18 12:55 [PATCH v2 1/8] platform/x86: Remove "default n" entries Andy Shevchenko
  2021-06-18 12:55 ` [PATCH v2 2/8] platform/x86: intel_skl_int3472: Free ACPI device resources after use Andy Shevchenko
  2021-06-18 12:55 ` [PATCH v2 3/8] platform/x86: intel_skl_int3472: Fix dependencies (drop CLKDEV_LOOKUP) Andy Shevchenko
@ 2021-06-18 12:55 ` Andy Shevchenko
  2021-06-21 22:37   ` Daniel Scally
  2021-06-18 12:55 ` [PATCH v2 5/8] platform/x86: intel_skl_int3472: Provide skl_int3472_unregister_regulator() Andy Shevchenko
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 15+ messages in thread
From: Andy Shevchenko @ 2021-06-18 12:55 UTC (permalink / raw)
  To: Hans de Goede, Mario Limonciello, Andy Shevchenko, Daniel Scally,
	Heikki Krogerus, linux-kernel, platform-driver-x86
  Cc: Mark Gross

When we call acpi_gpio_get_io_resource(), the output will be
the pointer to the ACPI GPIO resource. Use it directly instead of
dereferencing the generic resource.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: new patch
 .../intel_skl_int3472_clk_and_regulator.c     |  7 ++---
 .../intel-int3472/intel_skl_int3472_common.h  |  2 +-
 .../intel_skl_int3472_discrete.c              | 28 +++++++++----------
 3 files changed, 17 insertions(+), 20 deletions(-)

diff --git a/drivers/platform/x86/intel-int3472/intel_skl_int3472_clk_and_regulator.c b/drivers/platform/x86/intel-int3472/intel_skl_int3472_clk_and_regulator.c
index ceee860e2c07..49ea1e86c193 100644
--- a/drivers/platform/x86/intel-int3472/intel_skl_int3472_clk_and_regulator.c
+++ b/drivers/platform/x86/intel-int3472/intel_skl_int3472_clk_and_regulator.c
@@ -131,10 +131,10 @@ int skl_int3472_register_clock(struct int3472_discrete_device *int3472)
 }
 
 int skl_int3472_register_regulator(struct int3472_discrete_device *int3472,
-				   struct acpi_resource *ares)
+				   struct acpi_resource_gpio *agpio)
 {
-	char *path = ares->data.gpio.resource_source.string_ptr;
 	const struct int3472_sensor_config *sensor_config;
+	char *path = agpio->resource_source.string_ptr;
 	struct regulator_consumer_supply supply_map;
 	struct regulator_init_data init_data = { };
 	struct regulator_config cfg = { };
@@ -168,8 +168,7 @@ int skl_int3472_register_regulator(struct int3472_discrete_device *int3472,
 						int3472->regulator.supply_name,
 						&int3472_gpio_regulator_ops);
 
-	int3472->regulator.gpio = acpi_get_and_request_gpiod(path,
-							     ares->data.gpio.pin_table[0],
+	int3472->regulator.gpio = acpi_get_and_request_gpiod(path, agpio->pin_table[0],
 							     "int3472,regulator");
 	if (IS_ERR(int3472->regulator.gpio)) {
 		dev_err(int3472->dev, "Failed to get regulator GPIO line\n");
diff --git a/drivers/platform/x86/intel-int3472/intel_skl_int3472_common.h b/drivers/platform/x86/intel-int3472/intel_skl_int3472_common.h
index 6fdf78584219..765e01ec1604 100644
--- a/drivers/platform/x86/intel-int3472/intel_skl_int3472_common.h
+++ b/drivers/platform/x86/intel-int3472/intel_skl_int3472_common.h
@@ -113,6 +113,6 @@ union acpi_object *skl_int3472_get_acpi_buffer(struct acpi_device *adev,
 int skl_int3472_fill_cldb(struct acpi_device *adev, struct int3472_cldb *cldb);
 int skl_int3472_register_clock(struct int3472_discrete_device *int3472);
 int skl_int3472_register_regulator(struct int3472_discrete_device *int3472,
-				   struct acpi_resource *ares);
+				   struct acpi_resource_gpio *agpio);
 
 #endif
diff --git a/drivers/platform/x86/intel-int3472/intel_skl_int3472_discrete.c b/drivers/platform/x86/intel-int3472/intel_skl_int3472_discrete.c
index 48a00a1f4fb6..fd681d2a73fe 100644
--- a/drivers/platform/x86/intel-int3472/intel_skl_int3472_discrete.c
+++ b/drivers/platform/x86/intel-int3472/intel_skl_int3472_discrete.c
@@ -103,11 +103,11 @@ skl_int3472_get_sensor_module_config(struct int3472_discrete_device *int3472)
 }
 
 static int skl_int3472_map_gpio_to_sensor(struct int3472_discrete_device *int3472,
-					  struct acpi_resource *ares,
+					  struct acpi_resource_gpio *agpio,
 					  const char *func, u32 polarity)
 {
-	char *path = ares->data.gpio.resource_source.string_ptr;
 	const struct int3472_sensor_config *sensor_config;
+	char *path = agpio->resource_source.string_ptr;
 	struct gpiod_lookup *table_entry;
 	struct acpi_device *adev;
 	acpi_handle handle;
@@ -145,7 +145,7 @@ static int skl_int3472_map_gpio_to_sensor(struct int3472_discrete_device *int347
 
 	table_entry = &int3472->gpios.table[int3472->n_sensor_gpios];
 	table_entry->key = acpi_dev_name(adev);
-	table_entry->chip_hwnum = ares->data.gpio.pin_table[0];
+	table_entry->chip_hwnum = agpio->pin_table[0];
 	table_entry->con_id = func;
 	table_entry->idx = 0;
 	table_entry->flags = polarity;
@@ -156,23 +156,22 @@ static int skl_int3472_map_gpio_to_sensor(struct int3472_discrete_device *int347
 }
 
 static int skl_int3472_map_gpio_to_clk(struct int3472_discrete_device *int3472,
-				       struct acpi_resource *ares, u8 type)
+				       struct acpi_resource_gpio *agpio, u8 type)
 {
-	char *path = ares->data.gpio.resource_source.string_ptr;
+	char *path = agpio->resource_source.string_ptr;
+	u16 pin = agpio->pin_table[0];
 	struct gpio_desc *gpio;
 
 	switch (type) {
 	case INT3472_GPIO_TYPE_CLK_ENABLE:
-		gpio = acpi_get_and_request_gpiod(path, ares->data.gpio.pin_table[0],
-						  "int3472,clk-enable");
+		gpio = acpi_get_and_request_gpiod(path, pin, "int3472,clk-enable");
 		if (IS_ERR(gpio))
 			return (PTR_ERR(gpio));
 
 		int3472->clock.ena_gpio = gpio;
 		break;
 	case INT3472_GPIO_TYPE_PRIVACY_LED:
-		gpio = acpi_get_and_request_gpiod(path, ares->data.gpio.pin_table[0],
-						  "int3472,privacy-led");
+		gpio = acpi_get_and_request_gpiod(path, pin, "int3472,privacy-led");
 		if (IS_ERR(gpio))
 			return (PTR_ERR(gpio));
 
@@ -242,7 +241,7 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares,
 
 	if (!obj) {
 		dev_warn(int3472->dev, "No _DSM entry for GPIO pin %u\n",
-			 ares->data.gpio.pin_table[0]);
+			 agpio->pin_table[0]);
 		return 1;
 	}
 
@@ -250,15 +249,14 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares,
 
 	switch (type) {
 	case INT3472_GPIO_TYPE_RESET:
-		ret = skl_int3472_map_gpio_to_sensor(int3472, ares, "reset",
+		ret = skl_int3472_map_gpio_to_sensor(int3472, agpio, "reset",
 						     GPIO_ACTIVE_LOW);
 		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, ares,
-						     "powerdown",
+		ret = skl_int3472_map_gpio_to_sensor(int3472, agpio, "powerdown",
 						     GPIO_ACTIVE_LOW);
 		if (ret)
 			err_msg = "Failed to map powerdown pin to sensor\n";
@@ -266,13 +264,13 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares,
 		break;
 	case INT3472_GPIO_TYPE_CLK_ENABLE:
 	case INT3472_GPIO_TYPE_PRIVACY_LED:
-		ret = skl_int3472_map_gpio_to_clk(int3472, ares, type);
+		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, ares);
+		ret = skl_int3472_register_regulator(int3472, agpio);
 		if (ret)
 			err_msg = "Failed to map regulator to sensor\n";
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v2 5/8] platform/x86: intel_skl_int3472: Provide skl_int3472_unregister_regulator()
  2021-06-18 12:55 [PATCH v2 1/8] platform/x86: Remove "default n" entries Andy Shevchenko
                   ` (2 preceding siblings ...)
  2021-06-18 12:55 ` [PATCH v2 4/8] platform/x86: intel_skl_int3472: Use ACPI GPIO resource directly Andy Shevchenko
@ 2021-06-18 12:55 ` Andy Shevchenko
  2021-06-21 22:40   ` Daniel Scally
  2021-06-18 12:55 ` [PATCH v2 6/8] platform/x86: intel_skl_int3472: Provide skl_int3472_unregister_clock() Andy Shevchenko
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 15+ messages in thread
From: Andy Shevchenko @ 2021-06-18 12:55 UTC (permalink / raw)
  To: Hans de Goede, Mario Limonciello, Andy Shevchenko, Daniel Scally,
	Heikki Krogerus, linux-kernel, platform-driver-x86
  Cc: Mark Gross

For the sake of APIs to be properly layered provide
skl_int3472_unregister_regulator().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: new patch
 .../x86/intel-int3472/intel_skl_int3472_clk_and_regulator.c | 6 ++++++
 .../platform/x86/intel-int3472/intel_skl_int3472_common.h   | 2 ++
 .../platform/x86/intel-int3472/intel_skl_int3472_discrete.c | 4 ++--
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/intel-int3472/intel_skl_int3472_clk_and_regulator.c b/drivers/platform/x86/intel-int3472/intel_skl_int3472_clk_and_regulator.c
index 49ea1e86c193..60c7128f44ee 100644
--- a/drivers/platform/x86/intel-int3472/intel_skl_int3472_clk_and_regulator.c
+++ b/drivers/platform/x86/intel-int3472/intel_skl_int3472_clk_and_regulator.c
@@ -193,3 +193,9 @@ int skl_int3472_register_regulator(struct int3472_discrete_device *int3472,
 
 	return ret;
 }
+
+void skl_int3472_unregister_regulator(struct int3472_discrete_device *int3472)
+{
+	regulator_unregister(int3472->regulator.rdev);
+	gpiod_put(int3472->regulator.gpio);
+}
diff --git a/drivers/platform/x86/intel-int3472/intel_skl_int3472_common.h b/drivers/platform/x86/intel-int3472/intel_skl_int3472_common.h
index 765e01ec1604..50f73c6eab44 100644
--- a/drivers/platform/x86/intel-int3472/intel_skl_int3472_common.h
+++ b/drivers/platform/x86/intel-int3472/intel_skl_int3472_common.h
@@ -112,7 +112,9 @@ union acpi_object *skl_int3472_get_acpi_buffer(struct acpi_device *adev,
 					       char *id);
 int skl_int3472_fill_cldb(struct acpi_device *adev, struct int3472_cldb *cldb);
 int skl_int3472_register_clock(struct int3472_discrete_device *int3472);
+
 int skl_int3472_register_regulator(struct int3472_discrete_device *int3472,
 				   struct acpi_resource_gpio *agpio);
+void skl_int3472_unregister_regulator(struct int3472_discrete_device *int3472);
 
 #endif
diff --git a/drivers/platform/x86/intel-int3472/intel_skl_int3472_discrete.c b/drivers/platform/x86/intel-int3472/intel_skl_int3472_discrete.c
index fd681d2a73fe..2638d375e226 100644
--- a/drivers/platform/x86/intel-int3472/intel_skl_int3472_discrete.c
+++ b/drivers/platform/x86/intel-int3472/intel_skl_int3472_discrete.c
@@ -400,15 +400,15 @@ int skl_int3472_discrete_remove(struct platform_device *pdev)
 	struct int3472_discrete_device *int3472 = platform_get_drvdata(pdev);
 
 	gpiod_remove_lookup_table(&int3472->gpios);
-	regulator_unregister(int3472->regulator.rdev);
 	clk_unregister(int3472->clock.clk);
 
 	if (int3472->clock.cl)
 		clkdev_drop(int3472->clock.cl);
 
-	gpiod_put(int3472->regulator.gpio);
 	gpiod_put(int3472->clock.ena_gpio);
 	gpiod_put(int3472->clock.led_gpio);
 
+	skl_int3472_unregister_regulator(int3472);
+
 	return 0;
 }
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v2 6/8] platform/x86: intel_skl_int3472: Provide skl_int3472_unregister_clock()
  2021-06-18 12:55 [PATCH v2 1/8] platform/x86: Remove "default n" entries Andy Shevchenko
                   ` (3 preceding siblings ...)
  2021-06-18 12:55 ` [PATCH v2 5/8] platform/x86: intel_skl_int3472: Provide skl_int3472_unregister_regulator() Andy Shevchenko
@ 2021-06-18 12:55 ` Andy Shevchenko
  2021-06-18 12:55 ` [PATCH v2 7/8] platform/x86: intel_skl_int3472: Move to intel/ subfolder Andy Shevchenko
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: Andy Shevchenko @ 2021-06-18 12:55 UTC (permalink / raw)
  To: Hans de Goede, Mario Limonciello, Andy Shevchenko, Daniel Scally,
	Heikki Krogerus, linux-kernel, platform-driver-x86
  Cc: Mark Gross

For the sake of APIs to be properly layered provide
skl_int3472_unregister_clock().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: new patch
 .../x86/intel-int3472/intel_skl_int3472_clk_and_regulator.c | 6 ++++++
 .../platform/x86/intel-int3472/intel_skl_int3472_common.h   | 2 ++
 .../platform/x86/intel-int3472/intel_skl_int3472_discrete.c | 5 ++---
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/x86/intel-int3472/intel_skl_int3472_clk_and_regulator.c b/drivers/platform/x86/intel-int3472/intel_skl_int3472_clk_and_regulator.c
index 60c7128f44ee..1700e7557a82 100644
--- a/drivers/platform/x86/intel-int3472/intel_skl_int3472_clk_and_regulator.c
+++ b/drivers/platform/x86/intel-int3472/intel_skl_int3472_clk_and_regulator.c
@@ -130,6 +130,12 @@ int skl_int3472_register_clock(struct int3472_discrete_device *int3472)
 	return ret;
 }
 
+void skl_int3472_unregister_clock(struct int3472_discrete_device *int3472)
+{
+	clkdev_drop(int3472->clock.cl);
+	clk_unregister(int3472->clock.clk);
+}
+
 int skl_int3472_register_regulator(struct int3472_discrete_device *int3472,
 				   struct acpi_resource_gpio *agpio)
 {
diff --git a/drivers/platform/x86/intel-int3472/intel_skl_int3472_common.h b/drivers/platform/x86/intel-int3472/intel_skl_int3472_common.h
index 50f73c6eab44..714fde73b524 100644
--- a/drivers/platform/x86/intel-int3472/intel_skl_int3472_common.h
+++ b/drivers/platform/x86/intel-int3472/intel_skl_int3472_common.h
@@ -111,7 +111,9 @@ int skl_int3472_tps68470_probe(struct i2c_client *client);
 union acpi_object *skl_int3472_get_acpi_buffer(struct acpi_device *adev,
 					       char *id);
 int skl_int3472_fill_cldb(struct acpi_device *adev, struct int3472_cldb *cldb);
+
 int skl_int3472_register_clock(struct int3472_discrete_device *int3472);
+void skl_int3472_unregister_clock(struct int3472_discrete_device *int3472);
 
 int skl_int3472_register_regulator(struct int3472_discrete_device *int3472,
 				   struct acpi_resource_gpio *agpio);
diff --git a/drivers/platform/x86/intel-int3472/intel_skl_int3472_discrete.c b/drivers/platform/x86/intel-int3472/intel_skl_int3472_discrete.c
index 2638d375e226..17c6fe830765 100644
--- a/drivers/platform/x86/intel-int3472/intel_skl_int3472_discrete.c
+++ b/drivers/platform/x86/intel-int3472/intel_skl_int3472_discrete.c
@@ -400,10 +400,9 @@ int skl_int3472_discrete_remove(struct platform_device *pdev)
 	struct int3472_discrete_device *int3472 = platform_get_drvdata(pdev);
 
 	gpiod_remove_lookup_table(&int3472->gpios);
-	clk_unregister(int3472->clock.clk);
 
-	if (int3472->clock.cl)
-		clkdev_drop(int3472->clock.cl);
+	if (int3472->clock.ena_gpio)
+		skl_int3472_unregister_clock(int3472);
 
 	gpiod_put(int3472->clock.ena_gpio);
 	gpiod_put(int3472->clock.led_gpio);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v2 7/8] platform/x86: intel_skl_int3472: Move to intel/ subfolder
  2021-06-18 12:55 [PATCH v2 1/8] platform/x86: Remove "default n" entries Andy Shevchenko
                   ` (4 preceding siblings ...)
  2021-06-18 12:55 ` [PATCH v2 6/8] platform/x86: intel_skl_int3472: Provide skl_int3472_unregister_clock() Andy Shevchenko
@ 2021-06-18 12:55 ` Andy Shevchenko
  2021-06-18 12:55 ` [PATCH v2 8/8] platform/x86: intel_cht_int33fe: Move to its own subfolder Andy Shevchenko
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: Andy Shevchenko @ 2021-06-18 12:55 UTC (permalink / raw)
  To: Hans de Goede, Mario Limonciello, Andy Shevchenko, Daniel Scally,
	Heikki Krogerus, linux-kernel, platform-driver-x86
  Cc: Mark Gross

Start collecting Intel x86 related drivers in its own subfolder.
Move intel_skl_int3472 first.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: no changes
 drivers/platform/x86/Kconfig                  |  4 ++--
 drivers/platform/x86/Makefile                 |  3 ++-
 drivers/platform/x86/intel/Kconfig            | 21 +++++++++++++++++++
 drivers/platform/x86/intel/Makefile           |  7 +++++++
 .../{intel-int3472 => intel/int3472}/Kconfig  |  0
 .../{intel-int3472 => intel/int3472}/Makefile |  0
 .../intel_skl_int3472_clk_and_regulator.c     |  0
 .../int3472}/intel_skl_int3472_common.c       |  0
 .../int3472}/intel_skl_int3472_common.h       |  0
 .../int3472}/intel_skl_int3472_discrete.c     |  0
 .../int3472}/intel_skl_int3472_tps68470.c     |  0
 11 files changed, 32 insertions(+), 3 deletions(-)
 create mode 100644 drivers/platform/x86/intel/Kconfig
 create mode 100644 drivers/platform/x86/intel/Makefile
 rename drivers/platform/x86/{intel-int3472 => intel/int3472}/Kconfig (100%)
 rename drivers/platform/x86/{intel-int3472 => intel/int3472}/Makefile (100%)
 rename drivers/platform/x86/{intel-int3472 => intel/int3472}/intel_skl_int3472_clk_and_regulator.c (100%)
 rename drivers/platform/x86/{intel-int3472 => intel/int3472}/intel_skl_int3472_common.c (100%)
 rename drivers/platform/x86/{intel-int3472 => intel/int3472}/intel_skl_int3472_common.h (100%)
 rename drivers/platform/x86/{intel-int3472 => intel/int3472}/intel_skl_int3472_discrete.c (100%)
 rename drivers/platform/x86/{intel-int3472 => intel/int3472}/intel_skl_int3472_tps68470.c (100%)

diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index ccb827b57f1f..79d095c0ab61 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -651,6 +651,8 @@ config THINKPAD_LMI
 	  To compile this driver as a module, choose M here: the module will
 	  be called think-lmi.
 
+source "drivers/platform/x86/intel/Kconfig"
+
 config INTEL_ATOMISP2_LED
 	tristate "Intel AtomISP2 camera LED driver"
 	depends on GPIOLIB && LEDS_GPIO
@@ -709,8 +711,6 @@ config INTEL_CHT_INT33FE
 	  device and CONFIG_TYPEC_FUSB302=m and CONFIG_BATTERY_MAX17042=m
 	  for Type-C device.
 
-source "drivers/platform/x86/intel-int3472/Kconfig"
-
 config INTEL_HID_EVENT
 	tristate "INTEL HID Event"
 	depends on ACPI
diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile
index a1f64613af71..e03b59ce3f9f 100644
--- a/drivers/platform/x86/Makefile
+++ b/drivers/platform/x86/Makefile
@@ -66,6 +66,8 @@ obj-$(CONFIG_THINKPAD_ACPI)	+= thinkpad_acpi.o
 obj-$(CONFIG_THINKPAD_LMI)	+= think-lmi.o
 
 # Intel
+obj-$(CONFIG_X86_PLATFORM_DRIVERS_INTEL)		+= intel/
+
 obj-$(CONFIG_INTEL_ATOMISP2_LED)	+= intel_atomisp2_led.o
 obj-$(CONFIG_INTEL_ATOMISP2_PM)		+= intel_atomisp2_pm.o
 obj-$(CONFIG_INTEL_CHT_INT33FE)		+= intel_cht_int33fe.o
@@ -76,7 +78,6 @@ obj-$(CONFIG_INTEL_HID_EVENT)		+= intel-hid.o
 obj-$(CONFIG_INTEL_INT0002_VGPIO)	+= intel_int0002_vgpio.o
 obj-$(CONFIG_INTEL_MENLOW)		+= intel_menlow.o
 obj-$(CONFIG_INTEL_OAKTRAIL)		+= intel_oaktrail.o
-obj-$(CONFIG_INTEL_SKL_INT3472)		+= intel-int3472/
 obj-$(CONFIG_INTEL_VBTN)		+= intel-vbtn.o
 
 # MSI
diff --git a/drivers/platform/x86/intel/Kconfig b/drivers/platform/x86/intel/Kconfig
new file mode 100644
index 000000000000..33f2dab03d3d
--- /dev/null
+++ b/drivers/platform/x86/intel/Kconfig
@@ -0,0 +1,21 @@
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Intel x86 Platform Specific Drivers
+#
+
+menuconfig X86_PLATFORM_DRIVERS_INTEL
+	bool "Intel x86 Platform Specific Device Drivers"
+	default y
+	help
+	  Say Y here to get to see options for device drivers for
+	  various Intel x86 platforms, including vendor-specific
+	  drivers. This option alone does not add any kernel code.
+
+	  If you say N, all options in this submenu will be skipped
+	  and disabled.
+
+if X86_PLATFORM_DRIVERS_INTEL
+
+source "drivers/platform/x86/intel/int3472/Kconfig"
+
+endif # X86_PLATFORM_DRIVERS_INTEL
diff --git a/drivers/platform/x86/intel/Makefile b/drivers/platform/x86/intel/Makefile
new file mode 100644
index 000000000000..3ac795d810f1
--- /dev/null
+++ b/drivers/platform/x86/intel/Makefile
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Makefile for drivers/platform/x86/intel
+# Intel x86 Platform-Specific Drivers
+#
+
+obj-$(CONFIG_INTEL_SKL_INT3472)		+= int3472/
diff --git a/drivers/platform/x86/intel-int3472/Kconfig b/drivers/platform/x86/intel/int3472/Kconfig
similarity index 100%
rename from drivers/platform/x86/intel-int3472/Kconfig
rename to drivers/platform/x86/intel/int3472/Kconfig
diff --git a/drivers/platform/x86/intel-int3472/Makefile b/drivers/platform/x86/intel/int3472/Makefile
similarity index 100%
rename from drivers/platform/x86/intel-int3472/Makefile
rename to drivers/platform/x86/intel/int3472/Makefile
diff --git a/drivers/platform/x86/intel-int3472/intel_skl_int3472_clk_and_regulator.c b/drivers/platform/x86/intel/int3472/intel_skl_int3472_clk_and_regulator.c
similarity index 100%
rename from drivers/platform/x86/intel-int3472/intel_skl_int3472_clk_and_regulator.c
rename to drivers/platform/x86/intel/int3472/intel_skl_int3472_clk_and_regulator.c
diff --git a/drivers/platform/x86/intel-int3472/intel_skl_int3472_common.c b/drivers/platform/x86/intel/int3472/intel_skl_int3472_common.c
similarity index 100%
rename from drivers/platform/x86/intel-int3472/intel_skl_int3472_common.c
rename to drivers/platform/x86/intel/int3472/intel_skl_int3472_common.c
diff --git a/drivers/platform/x86/intel-int3472/intel_skl_int3472_common.h b/drivers/platform/x86/intel/int3472/intel_skl_int3472_common.h
similarity index 100%
rename from drivers/platform/x86/intel-int3472/intel_skl_int3472_common.h
rename to drivers/platform/x86/intel/int3472/intel_skl_int3472_common.h
diff --git a/drivers/platform/x86/intel-int3472/intel_skl_int3472_discrete.c b/drivers/platform/x86/intel/int3472/intel_skl_int3472_discrete.c
similarity index 100%
rename from drivers/platform/x86/intel-int3472/intel_skl_int3472_discrete.c
rename to drivers/platform/x86/intel/int3472/intel_skl_int3472_discrete.c
diff --git a/drivers/platform/x86/intel-int3472/intel_skl_int3472_tps68470.c b/drivers/platform/x86/intel/int3472/intel_skl_int3472_tps68470.c
similarity index 100%
rename from drivers/platform/x86/intel-int3472/intel_skl_int3472_tps68470.c
rename to drivers/platform/x86/intel/int3472/intel_skl_int3472_tps68470.c
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v2 8/8] platform/x86: intel_cht_int33fe: Move to its own subfolder
  2021-06-18 12:55 [PATCH v2 1/8] platform/x86: Remove "default n" entries Andy Shevchenko
                   ` (5 preceding siblings ...)
  2021-06-18 12:55 ` [PATCH v2 7/8] platform/x86: intel_skl_int3472: Move to intel/ subfolder Andy Shevchenko
@ 2021-06-18 12:55 ` Andy Shevchenko
  2021-06-22  9:02 ` [PATCH v2 1/8] platform/x86: Remove "default n" entries Andy Shevchenko
  2021-06-22  9:42 ` Hans de Goede
  8 siblings, 0 replies; 15+ messages in thread
From: Andy Shevchenko @ 2021-06-18 12:55 UTC (permalink / raw)
  To: Hans de Goede, Mario Limonciello, Andy Shevchenko, Daniel Scally,
	Heikki Krogerus, linux-kernel, platform-driver-x86
  Cc: Mark Gross

Since we have started collecting Intel x86 specific drivers in its own folder,
Move intel_cht_int33fe to own subfolder there.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: no changes
 drivers/platform/x86/Kconfig                  | 24 ------------------
 drivers/platform/x86/Makefile                 |  4 ---
 drivers/platform/x86/intel/Kconfig            |  1 +
 drivers/platform/x86/intel/Makefile           |  1 +
 drivers/platform/x86/intel/int33fe/Kconfig    | 25 +++++++++++++++++++
 drivers/platform/x86/intel/int33fe/Makefile   |  5 ++++
 .../int33fe}/intel_cht_int33fe_common.c       |  0
 .../int33fe}/intel_cht_int33fe_common.h       |  0
 .../int33fe}/intel_cht_int33fe_microb.c       |  0
 .../int33fe}/intel_cht_int33fe_typec.c        |  0
 10 files changed, 32 insertions(+), 28 deletions(-)
 create mode 100644 drivers/platform/x86/intel/int33fe/Kconfig
 create mode 100644 drivers/platform/x86/intel/int33fe/Makefile
 rename drivers/platform/x86/{ => intel/int33fe}/intel_cht_int33fe_common.c (100%)
 rename drivers/platform/x86/{ => intel/int33fe}/intel_cht_int33fe_common.h (100%)
 rename drivers/platform/x86/{ => intel/int33fe}/intel_cht_int33fe_microb.c (100%)
 rename drivers/platform/x86/{ => intel/int33fe}/intel_cht_int33fe_typec.c (100%)

diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index 79d095c0ab61..7d385c3b2239 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -687,30 +687,6 @@ config INTEL_ATOMISP2_PM
 	  To compile this driver as a module, choose M here: the module
 	  will be called intel_atomisp2_pm.
 
-config INTEL_CHT_INT33FE
-	tristate "Intel Cherry Trail ACPI INT33FE Driver"
-	depends on X86 && ACPI && I2C && REGULATOR
-	depends on CHARGER_BQ24190=y || (CHARGER_BQ24190=m && m)
-	depends on USB_ROLES_INTEL_XHCI=y || (USB_ROLES_INTEL_XHCI=m && m)
-	depends on TYPEC_MUX_PI3USB30532=y || (TYPEC_MUX_PI3USB30532=m && m)
-	help
-	  This driver add support for the INT33FE ACPI device found on
-	  some Intel Cherry Trail devices.
-
-	  There are two kinds of INT33FE ACPI device possible: for hardware
-	  with USB Type-C and Micro-B connectors. This driver supports both.
-
-	  The INT33FE ACPI device has a CRS table with I2cSerialBusV2
-	  resources for Fuel Gauge Controller and (in the Type-C variant)
-	  FUSB302 USB Type-C Controller and PI3USB30532 USB switch.
-	  This driver instantiates i2c-clients for these, so that standard
-	  i2c drivers for these chips can bind to the them.
-
-	  If you enable this driver it is advised to also select
-	  CONFIG_BATTERY_BQ27XXX=m or CONFIG_BATTERY_BQ27XXX_I2C=m for Micro-B
-	  device and CONFIG_TYPEC_FUSB302=m and CONFIG_BATTERY_MAX17042=m
-	  for Type-C device.
-
 config INTEL_HID_EVENT
 	tristate "INTEL HID Event"
 	depends on ACPI
diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile
index e03b59ce3f9f..7ee369aab10d 100644
--- a/drivers/platform/x86/Makefile
+++ b/drivers/platform/x86/Makefile
@@ -70,10 +70,6 @@ obj-$(CONFIG_X86_PLATFORM_DRIVERS_INTEL)		+= intel/
 
 obj-$(CONFIG_INTEL_ATOMISP2_LED)	+= intel_atomisp2_led.o
 obj-$(CONFIG_INTEL_ATOMISP2_PM)		+= intel_atomisp2_pm.o
-obj-$(CONFIG_INTEL_CHT_INT33FE)		+= intel_cht_int33fe.o
-intel_cht_int33fe-objs			:= intel_cht_int33fe_common.o \
-					   intel_cht_int33fe_typec.o \
-					   intel_cht_int33fe_microb.o
 obj-$(CONFIG_INTEL_HID_EVENT)		+= intel-hid.o
 obj-$(CONFIG_INTEL_INT0002_VGPIO)	+= intel_int0002_vgpio.o
 obj-$(CONFIG_INTEL_MENLOW)		+= intel_menlow.o
diff --git a/drivers/platform/x86/intel/Kconfig b/drivers/platform/x86/intel/Kconfig
index 33f2dab03d3d..f2eef337eb98 100644
--- a/drivers/platform/x86/intel/Kconfig
+++ b/drivers/platform/x86/intel/Kconfig
@@ -16,6 +16,7 @@ menuconfig X86_PLATFORM_DRIVERS_INTEL
 
 if X86_PLATFORM_DRIVERS_INTEL
 
+source "drivers/platform/x86/intel/int33fe/Kconfig"
 source "drivers/platform/x86/intel/int3472/Kconfig"
 
 endif # X86_PLATFORM_DRIVERS_INTEL
diff --git a/drivers/platform/x86/intel/Makefile b/drivers/platform/x86/intel/Makefile
index 3ac795d810f1..0653055942d5 100644
--- a/drivers/platform/x86/intel/Makefile
+++ b/drivers/platform/x86/intel/Makefile
@@ -4,4 +4,5 @@
 # Intel x86 Platform-Specific Drivers
 #
 
+obj-$(CONFIG_INTEL_CHT_INT33FE)		+= int33fe/
 obj-$(CONFIG_INTEL_SKL_INT3472)		+= int3472/
diff --git a/drivers/platform/x86/intel/int33fe/Kconfig b/drivers/platform/x86/intel/int33fe/Kconfig
new file mode 100644
index 000000000000..c7efb461d97d
--- /dev/null
+++ b/drivers/platform/x86/intel/int33fe/Kconfig
@@ -0,0 +1,25 @@
+# SPDX-License-Identifier: GPL-2.0-only
+config INTEL_CHT_INT33FE
+	tristate "Intel Cherry Trail ACPI INT33FE Driver"
+	depends on X86 && ACPI && I2C && REGULATOR
+	depends on CHARGER_BQ24190=y || (CHARGER_BQ24190=m && m)
+	depends on USB_ROLES_INTEL_XHCI=y || (USB_ROLES_INTEL_XHCI=m && m)
+	depends on TYPEC_MUX_PI3USB30532=y || (TYPEC_MUX_PI3USB30532=m && m)
+	help
+	  This driver add support for the INT33FE ACPI device found on
+	  some Intel Cherry Trail devices.
+
+	  There are two kinds of INT33FE ACPI device possible: for hardware
+	  with USB Type-C and Micro-B connectors. This driver supports both.
+
+	  The INT33FE ACPI device has a CRS table with I2cSerialBusV2
+	  resources for Fuel Gauge Controller and (in the Type-C variant)
+	  FUSB302 USB Type-C Controller and PI3USB30532 USB switch.
+	  This driver instantiates i2c-clients for these, so that standard
+	  i2c drivers for these chips can bind to the them.
+
+	  If you enable this driver it is advised to also select
+	  CONFIG_BATTERY_BQ27XXX=m or CONFIG_BATTERY_BQ27XXX_I2C=m for Micro-B
+	  device and CONFIG_TYPEC_FUSB302=m and CONFIG_BATTERY_MAX17042=m
+	  for Type-C device.
+
diff --git a/drivers/platform/x86/intel/int33fe/Makefile b/drivers/platform/x86/intel/int33fe/Makefile
new file mode 100644
index 000000000000..cc11183ce179
--- /dev/null
+++ b/drivers/platform/x86/intel/int33fe/Makefile
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0-only
+obj-$(CONFIG_INTEL_CHT_INT33FE)		+= intel_cht_int33fe.o
+intel_cht_int33fe-objs			:= intel_cht_int33fe_common.o \
+					   intel_cht_int33fe_typec.o \
+					   intel_cht_int33fe_microb.o
diff --git a/drivers/platform/x86/intel_cht_int33fe_common.c b/drivers/platform/x86/intel/int33fe/intel_cht_int33fe_common.c
similarity index 100%
rename from drivers/platform/x86/intel_cht_int33fe_common.c
rename to drivers/platform/x86/intel/int33fe/intel_cht_int33fe_common.c
diff --git a/drivers/platform/x86/intel_cht_int33fe_common.h b/drivers/platform/x86/intel/int33fe/intel_cht_int33fe_common.h
similarity index 100%
rename from drivers/platform/x86/intel_cht_int33fe_common.h
rename to drivers/platform/x86/intel/int33fe/intel_cht_int33fe_common.h
diff --git a/drivers/platform/x86/intel_cht_int33fe_microb.c b/drivers/platform/x86/intel/int33fe/intel_cht_int33fe_microb.c
similarity index 100%
rename from drivers/platform/x86/intel_cht_int33fe_microb.c
rename to drivers/platform/x86/intel/int33fe/intel_cht_int33fe_microb.c
diff --git a/drivers/platform/x86/intel_cht_int33fe_typec.c b/drivers/platform/x86/intel/int33fe/intel_cht_int33fe_typec.c
similarity index 100%
rename from drivers/platform/x86/intel_cht_int33fe_typec.c
rename to drivers/platform/x86/intel/int33fe/intel_cht_int33fe_typec.c
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 2/8] platform/x86: intel_skl_int3472: Free ACPI device resources after use
  2021-06-18 12:55 ` [PATCH v2 2/8] platform/x86: intel_skl_int3472: Free ACPI device resources after use Andy Shevchenko
@ 2021-06-21 22:32   ` Daniel Scally
  0 siblings, 0 replies; 15+ messages in thread
From: Daniel Scally @ 2021-06-21 22:32 UTC (permalink / raw)
  To: Andy Shevchenko, Hans de Goede, Mario Limonciello,
	Heikki Krogerus, linux-kernel, platform-driver-x86
  Cc: Mark Gross

Hi Andy

On 18/06/2021 13:55, Andy Shevchenko wrote:
> We may free ACPI device resources immediately after use.
> Refactor skl_int3472_parse_crs() accordingly.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Sorry, only just got round to these:


Reviewed-by: Daniel Scally <djrscally@gmail.com>

Tested-by: Daniel Scally <djrscally@gmail.com>

> ---
> v2: new patch
>  .../x86/intel-int3472/intel_skl_int3472_discrete.c  | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/platform/x86/intel-int3472/intel_skl_int3472_discrete.c b/drivers/platform/x86/intel-int3472/intel_skl_int3472_discrete.c
> index 8c18dbff1c43..48a00a1f4fb6 100644
> --- a/drivers/platform/x86/intel-int3472/intel_skl_int3472_discrete.c
> +++ b/drivers/platform/x86/intel-int3472/intel_skl_int3472_discrete.c
> @@ -308,8 +308,10 @@ static int skl_int3472_parse_crs(struct int3472_discrete_device *int3472)
>  	ret = acpi_dev_get_resources(int3472->adev, &resource_list,
>  				     skl_int3472_handle_gpio_resources,
>  				     int3472);
> -	if (ret)
> -		goto out_free_res_list;
> +	if (ret < 0)
> +		return ret;
> +
> +	acpi_dev_free_resource_list(&resource_list);
>  
>  	/*
>  	 * If we find no clock enable GPIO pin then the privacy LED won't work.
> @@ -319,7 +321,7 @@ static int skl_int3472_parse_crs(struct int3472_discrete_device *int3472)
>  	if (int3472->clock.ena_gpio) {
>  		ret = skl_int3472_register_clock(int3472);
>  		if (ret)
> -			goto out_free_res_list;
> +			return ret;
>  	} else {
>  		if (int3472->clock.led_gpio)
>  			dev_warn(int3472->dev,
> @@ -329,10 +331,7 @@ static int skl_int3472_parse_crs(struct int3472_discrete_device *int3472)
>  	int3472->gpios.dev_id = int3472->sensor_name;
>  	gpiod_add_lookup_table(&int3472->gpios);
>  
> -out_free_res_list:
> -	acpi_dev_free_resource_list(&resource_list);
> -
> -	return ret;
> +	return 0;
>  }
>  
>  int skl_int3472_discrete_probe(struct platform_device *pdev)

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 4/8] platform/x86: intel_skl_int3472: Use ACPI GPIO resource directly
  2021-06-18 12:55 ` [PATCH v2 4/8] platform/x86: intel_skl_int3472: Use ACPI GPIO resource directly Andy Shevchenko
@ 2021-06-21 22:37   ` Daniel Scally
  0 siblings, 0 replies; 15+ messages in thread
From: Daniel Scally @ 2021-06-21 22:37 UTC (permalink / raw)
  To: Andy Shevchenko, Hans de Goede, Mario Limonciello,
	Heikki Krogerus, linux-kernel, platform-driver-x86
  Cc: Mark Gross

On 18/06/2021 13:55, Andy Shevchenko wrote:
> When we call acpi_gpio_get_io_resource(), the output will be
> the pointer to the ACPI GPIO resource. Use it directly instead of
> dereferencing the generic resource.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>


This is much better, thanks.


Reviewed-by: Daniel Scally <djrscally@gmail.com>

Tested-by: Daniel Scally <djrscally@gmail.com>


> ---
> v2: new patch
>  .../intel_skl_int3472_clk_and_regulator.c     |  7 ++---
>  .../intel-int3472/intel_skl_int3472_common.h  |  2 +-
>  .../intel_skl_int3472_discrete.c              | 28 +++++++++----------
>  3 files changed, 17 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/platform/x86/intel-int3472/intel_skl_int3472_clk_and_regulator.c b/drivers/platform/x86/intel-int3472/intel_skl_int3472_clk_and_regulator.c
> index ceee860e2c07..49ea1e86c193 100644
> --- a/drivers/platform/x86/intel-int3472/intel_skl_int3472_clk_and_regulator.c
> +++ b/drivers/platform/x86/intel-int3472/intel_skl_int3472_clk_and_regulator.c
> @@ -131,10 +131,10 @@ int skl_int3472_register_clock(struct int3472_discrete_device *int3472)
>  }
>  
>  int skl_int3472_register_regulator(struct int3472_discrete_device *int3472,
> -				   struct acpi_resource *ares)
> +				   struct acpi_resource_gpio *agpio)
>  {
> -	char *path = ares->data.gpio.resource_source.string_ptr;
>  	const struct int3472_sensor_config *sensor_config;
> +	char *path = agpio->resource_source.string_ptr;
>  	struct regulator_consumer_supply supply_map;
>  	struct regulator_init_data init_data = { };
>  	struct regulator_config cfg = { };
> @@ -168,8 +168,7 @@ int skl_int3472_register_regulator(struct int3472_discrete_device *int3472,
>  						int3472->regulator.supply_name,
>  						&int3472_gpio_regulator_ops);
>  
> -	int3472->regulator.gpio = acpi_get_and_request_gpiod(path,
> -							     ares->data.gpio.pin_table[0],
> +	int3472->regulator.gpio = acpi_get_and_request_gpiod(path, agpio->pin_table[0],
>  							     "int3472,regulator");
>  	if (IS_ERR(int3472->regulator.gpio)) {
>  		dev_err(int3472->dev, "Failed to get regulator GPIO line\n");
> diff --git a/drivers/platform/x86/intel-int3472/intel_skl_int3472_common.h b/drivers/platform/x86/intel-int3472/intel_skl_int3472_common.h
> index 6fdf78584219..765e01ec1604 100644
> --- a/drivers/platform/x86/intel-int3472/intel_skl_int3472_common.h
> +++ b/drivers/platform/x86/intel-int3472/intel_skl_int3472_common.h
> @@ -113,6 +113,6 @@ union acpi_object *skl_int3472_get_acpi_buffer(struct acpi_device *adev,
>  int skl_int3472_fill_cldb(struct acpi_device *adev, struct int3472_cldb *cldb);
>  int skl_int3472_register_clock(struct int3472_discrete_device *int3472);
>  int skl_int3472_register_regulator(struct int3472_discrete_device *int3472,
> -				   struct acpi_resource *ares);
> +				   struct acpi_resource_gpio *agpio);
>  
>  #endif
> diff --git a/drivers/platform/x86/intel-int3472/intel_skl_int3472_discrete.c b/drivers/platform/x86/intel-int3472/intel_skl_int3472_discrete.c
> index 48a00a1f4fb6..fd681d2a73fe 100644
> --- a/drivers/platform/x86/intel-int3472/intel_skl_int3472_discrete.c
> +++ b/drivers/platform/x86/intel-int3472/intel_skl_int3472_discrete.c
> @@ -103,11 +103,11 @@ skl_int3472_get_sensor_module_config(struct int3472_discrete_device *int3472)
>  }
>  
>  static int skl_int3472_map_gpio_to_sensor(struct int3472_discrete_device *int3472,
> -					  struct acpi_resource *ares,
> +					  struct acpi_resource_gpio *agpio,
>  					  const char *func, u32 polarity)
>  {
> -	char *path = ares->data.gpio.resource_source.string_ptr;
>  	const struct int3472_sensor_config *sensor_config;
> +	char *path = agpio->resource_source.string_ptr;
>  	struct gpiod_lookup *table_entry;
>  	struct acpi_device *adev;
>  	acpi_handle handle;
> @@ -145,7 +145,7 @@ static int skl_int3472_map_gpio_to_sensor(struct int3472_discrete_device *int347
>  
>  	table_entry = &int3472->gpios.table[int3472->n_sensor_gpios];
>  	table_entry->key = acpi_dev_name(adev);
> -	table_entry->chip_hwnum = ares->data.gpio.pin_table[0];
> +	table_entry->chip_hwnum = agpio->pin_table[0];
>  	table_entry->con_id = func;
>  	table_entry->idx = 0;
>  	table_entry->flags = polarity;
> @@ -156,23 +156,22 @@ static int skl_int3472_map_gpio_to_sensor(struct int3472_discrete_device *int347
>  }
>  
>  static int skl_int3472_map_gpio_to_clk(struct int3472_discrete_device *int3472,
> -				       struct acpi_resource *ares, u8 type)
> +				       struct acpi_resource_gpio *agpio, u8 type)
>  {
> -	char *path = ares->data.gpio.resource_source.string_ptr;
> +	char *path = agpio->resource_source.string_ptr;
> +	u16 pin = agpio->pin_table[0];
>  	struct gpio_desc *gpio;
>  
>  	switch (type) {
>  	case INT3472_GPIO_TYPE_CLK_ENABLE:
> -		gpio = acpi_get_and_request_gpiod(path, ares->data.gpio.pin_table[0],
> -						  "int3472,clk-enable");
> +		gpio = acpi_get_and_request_gpiod(path, pin, "int3472,clk-enable");
>  		if (IS_ERR(gpio))
>  			return (PTR_ERR(gpio));
>  
>  		int3472->clock.ena_gpio = gpio;
>  		break;
>  	case INT3472_GPIO_TYPE_PRIVACY_LED:
> -		gpio = acpi_get_and_request_gpiod(path, ares->data.gpio.pin_table[0],
> -						  "int3472,privacy-led");
> +		gpio = acpi_get_and_request_gpiod(path, pin, "int3472,privacy-led");
>  		if (IS_ERR(gpio))
>  			return (PTR_ERR(gpio));
>  
> @@ -242,7 +241,7 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares,
>  
>  	if (!obj) {
>  		dev_warn(int3472->dev, "No _DSM entry for GPIO pin %u\n",
> -			 ares->data.gpio.pin_table[0]);
> +			 agpio->pin_table[0]);
>  		return 1;
>  	}
>  
> @@ -250,15 +249,14 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares,
>  
>  	switch (type) {
>  	case INT3472_GPIO_TYPE_RESET:
> -		ret = skl_int3472_map_gpio_to_sensor(int3472, ares, "reset",
> +		ret = skl_int3472_map_gpio_to_sensor(int3472, agpio, "reset",
>  						     GPIO_ACTIVE_LOW);
>  		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, ares,
> -						     "powerdown",
> +		ret = skl_int3472_map_gpio_to_sensor(int3472, agpio, "powerdown",
>  						     GPIO_ACTIVE_LOW);
>  		if (ret)
>  			err_msg = "Failed to map powerdown pin to sensor\n";
> @@ -266,13 +264,13 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares,
>  		break;
>  	case INT3472_GPIO_TYPE_CLK_ENABLE:
>  	case INT3472_GPIO_TYPE_PRIVACY_LED:
> -		ret = skl_int3472_map_gpio_to_clk(int3472, ares, type);
> +		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, ares);
> +		ret = skl_int3472_register_regulator(int3472, agpio);
>  		if (ret)
>  			err_msg = "Failed to map regulator to sensor\n";
>  

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 5/8] platform/x86: intel_skl_int3472: Provide skl_int3472_unregister_regulator()
  2021-06-18 12:55 ` [PATCH v2 5/8] platform/x86: intel_skl_int3472: Provide skl_int3472_unregister_regulator() Andy Shevchenko
@ 2021-06-21 22:40   ` Daniel Scally
  0 siblings, 0 replies; 15+ messages in thread
From: Daniel Scally @ 2021-06-21 22:40 UTC (permalink / raw)
  To: Andy Shevchenko, Hans de Goede, Mario Limonciello,
	Heikki Krogerus, linux-kernel, platform-driver-x86
  Cc: Mark Gross

Hi Andy

On 18/06/2021 13:55, Andy Shevchenko wrote:
> For the sake of APIs to be properly layered provide
> skl_int3472_unregister_regulator().
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>


Reviewed-by: Daniel Scally <djrscally@gmail.com>

Tested-by: Daniel Scally <djrscally@gmail.com>

And for 6/8 too.

> ---
> v2: new patch
>  .../x86/intel-int3472/intel_skl_int3472_clk_and_regulator.c | 6 ++++++
>  .../platform/x86/intel-int3472/intel_skl_int3472_common.h   | 2 ++
>  .../platform/x86/intel-int3472/intel_skl_int3472_discrete.c | 4 ++--
>  3 files changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/platform/x86/intel-int3472/intel_skl_int3472_clk_and_regulator.c b/drivers/platform/x86/intel-int3472/intel_skl_int3472_clk_and_regulator.c
> index 49ea1e86c193..60c7128f44ee 100644
> --- a/drivers/platform/x86/intel-int3472/intel_skl_int3472_clk_and_regulator.c
> +++ b/drivers/platform/x86/intel-int3472/intel_skl_int3472_clk_and_regulator.c
> @@ -193,3 +193,9 @@ int skl_int3472_register_regulator(struct int3472_discrete_device *int3472,
>  
>  	return ret;
>  }
> +
> +void skl_int3472_unregister_regulator(struct int3472_discrete_device *int3472)
> +{
> +	regulator_unregister(int3472->regulator.rdev);
> +	gpiod_put(int3472->regulator.gpio);
> +}
> diff --git a/drivers/platform/x86/intel-int3472/intel_skl_int3472_common.h b/drivers/platform/x86/intel-int3472/intel_skl_int3472_common.h
> index 765e01ec1604..50f73c6eab44 100644
> --- a/drivers/platform/x86/intel-int3472/intel_skl_int3472_common.h
> +++ b/drivers/platform/x86/intel-int3472/intel_skl_int3472_common.h
> @@ -112,7 +112,9 @@ union acpi_object *skl_int3472_get_acpi_buffer(struct acpi_device *adev,
>  					       char *id);
>  int skl_int3472_fill_cldb(struct acpi_device *adev, struct int3472_cldb *cldb);
>  int skl_int3472_register_clock(struct int3472_discrete_device *int3472);
> +
>  int skl_int3472_register_regulator(struct int3472_discrete_device *int3472,
>  				   struct acpi_resource_gpio *agpio);
> +void skl_int3472_unregister_regulator(struct int3472_discrete_device *int3472);
>  
>  #endif
> diff --git a/drivers/platform/x86/intel-int3472/intel_skl_int3472_discrete.c b/drivers/platform/x86/intel-int3472/intel_skl_int3472_discrete.c
> index fd681d2a73fe..2638d375e226 100644
> --- a/drivers/platform/x86/intel-int3472/intel_skl_int3472_discrete.c
> +++ b/drivers/platform/x86/intel-int3472/intel_skl_int3472_discrete.c
> @@ -400,15 +400,15 @@ int skl_int3472_discrete_remove(struct platform_device *pdev)
>  	struct int3472_discrete_device *int3472 = platform_get_drvdata(pdev);
>  
>  	gpiod_remove_lookup_table(&int3472->gpios);
> -	regulator_unregister(int3472->regulator.rdev);
>  	clk_unregister(int3472->clock.clk);
>  
>  	if (int3472->clock.cl)
>  		clkdev_drop(int3472->clock.cl);
>  
> -	gpiod_put(int3472->regulator.gpio);
>  	gpiod_put(int3472->clock.ena_gpio);
>  	gpiod_put(int3472->clock.led_gpio);
>  
> +	skl_int3472_unregister_regulator(int3472);
> +
>  	return 0;
>  }

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 1/8] platform/x86: Remove "default n" entries
  2021-06-18 12:55 [PATCH v2 1/8] platform/x86: Remove "default n" entries Andy Shevchenko
                   ` (6 preceding siblings ...)
  2021-06-18 12:55 ` [PATCH v2 8/8] platform/x86: intel_cht_int33fe: Move to its own subfolder Andy Shevchenko
@ 2021-06-22  9:02 ` Andy Shevchenko
  2021-06-22  9:03   ` Hans de Goede
  2021-06-22  9:42 ` Hans de Goede
  8 siblings, 1 reply; 15+ messages in thread
From: Andy Shevchenko @ 2021-06-22  9:02 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Hans de Goede, Mario Limonciello, Daniel Scally, Heikki Krogerus,
	Linux Kernel Mailing List, Platform Driver, Mark Gross

On Fri, Jun 18, 2021 at 4:09 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> Linus already once did that for PDx86, don't repeat our mistakes.
> TL;DR: 'n' *is* the default 'default'.

Daniel, thanks for your testing!

Hans, patches 2-6 were reviewed and tested, do you think we have a
chance for the series to be applied?

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 1/8] platform/x86: Remove "default n" entries
  2021-06-22  9:02 ` [PATCH v2 1/8] platform/x86: Remove "default n" entries Andy Shevchenko
@ 2021-06-22  9:03   ` Hans de Goede
  0 siblings, 0 replies; 15+ messages in thread
From: Hans de Goede @ 2021-06-22  9:03 UTC (permalink / raw)
  To: Andy Shevchenko, Andy Shevchenko
  Cc: Mario Limonciello, Daniel Scally, Heikki Krogerus,
	Linux Kernel Mailing List, Platform Driver, Mark Gross

Hi,

On 6/22/21 11:02 AM, Andy Shevchenko wrote:
> On Fri, Jun 18, 2021 at 4:09 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
>>
>> Linus already once did that for PDx86, don't repeat our mistakes.
>> TL;DR: 'n' *is* the default 'default'.
> 
> Daniel, thanks for your testing!
> 
> Hans, patches 2-6 were reviewed and tested, do you think we have a
> chance for the series to be applied?

Yes I was working on applying it right now :)

Regards,

Hans



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 1/8] platform/x86: Remove "default n" entries
  2021-06-18 12:55 [PATCH v2 1/8] platform/x86: Remove "default n" entries Andy Shevchenko
                   ` (7 preceding siblings ...)
  2021-06-22  9:02 ` [PATCH v2 1/8] platform/x86: Remove "default n" entries Andy Shevchenko
@ 2021-06-22  9:42 ` Hans de Goede
  2021-06-22  9:46   ` Andy Shevchenko
  8 siblings, 1 reply; 15+ messages in thread
From: Hans de Goede @ 2021-06-22  9:42 UTC (permalink / raw)
  To: Andy Shevchenko, Mario Limonciello, Daniel Scally,
	Heikki Krogerus, linux-kernel, platform-driver-x86
  Cc: Mark Gross

Hi,

On 6/18/21 2:55 PM, Andy Shevchenko wrote:
> Linus already once did that for PDx86, don't repeat our mistakes.
> TL;DR: 'n' *is* the default 'default'.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Thank you for your patch-series, I've applied the series to my
review-hans branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

Note I've squashed in the following fixup to patch 7/8:

--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -9388,7 +9388,7 @@ F:        drivers/platform/x86/intel_scu_*
 INTEL SKYLAKE INT3472 ACPI DEVICE DRIVER
 M:     Daniel Scally <djrscally@gmail.com>
 S:     Maintained
-F:     drivers/platform/x86/intel-int3472/
+F:     drivers/platform/x86/intel/int3472/
 
 INTEL SPEED SELECT TECHNOLOGY
 M:     Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>

(checkpatch complained about MAINTAINERS not being updated)

Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.

Regards,

Hans




> ---
> v2: no changes
>  drivers/platform/x86/Kconfig      | 1 -
>  drivers/platform/x86/dell/Kconfig | 1 -
>  2 files changed, 2 deletions(-)
> 
> diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
> index 4fd792f2a10a..ccb827b57f1f 100644
> --- a/drivers/platform/x86/Kconfig
> +++ b/drivers/platform/x86/Kconfig
> @@ -1092,7 +1092,6 @@ config TOUCHSCREEN_DMI
>  
>  config FW_ATTR_CLASS
>  	tristate
> -	default n
>  
>  config INTEL_IMR
>  	bool "Intel Isolated Memory Region support"
> diff --git a/drivers/platform/x86/dell/Kconfig b/drivers/platform/x86/dell/Kconfig
> index 9b0a4d080f43..9e7314d90bea 100644
> --- a/drivers/platform/x86/dell/Kconfig
> +++ b/drivers/platform/x86/dell/Kconfig
> @@ -5,7 +5,6 @@
>  
>  menuconfig X86_PLATFORM_DRIVERS_DELL
>  	bool "Dell X86 Platform Specific Device Drivers"
> -	default n
>  	depends on X86_PLATFORM_DEVICES
>  	help
>  	  Say Y here to get to see options for device drivers for various
> 


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 1/8] platform/x86: Remove "default n" entries
  2021-06-22  9:42 ` Hans de Goede
@ 2021-06-22  9:46   ` Andy Shevchenko
  0 siblings, 0 replies; 15+ messages in thread
From: Andy Shevchenko @ 2021-06-22  9:46 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Andy Shevchenko, Mario Limonciello, Daniel Scally,
	Heikki Krogerus, Linux Kernel Mailing List, Platform Driver,
	Mark Gross

On Tue, Jun 22, 2021 at 12:42 PM Hans de Goede <hdegoede@redhat.com> wrote:
> On 6/18/21 2:55 PM, Andy Shevchenko wrote:
> > Linus already once did that for PDx86, don't repeat our mistakes.
> > TL;DR: 'n' *is* the default 'default'.
> >
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>
> Thank you for your patch-series, I've applied the series to my
> review-hans branch:
> https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans
>
> Note I've squashed in the following fixup to patch 7/8:
>
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -9388,7 +9388,7 @@ F:        drivers/platform/x86/intel_scu_*
>  INTEL SKYLAKE INT3472 ACPI DEVICE DRIVER
>  M:     Daniel Scally <djrscally@gmail.com>
>  S:     Maintained
> -F:     drivers/platform/x86/intel-int3472/
> +F:     drivers/platform/x86/intel/int3472/

> (checkpatch complained about MAINTAINERS not being updated)

Thank you, Hans!

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2021-06-22  9:46 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-18 12:55 [PATCH v2 1/8] platform/x86: Remove "default n" entries Andy Shevchenko
2021-06-18 12:55 ` [PATCH v2 2/8] platform/x86: intel_skl_int3472: Free ACPI device resources after use Andy Shevchenko
2021-06-21 22:32   ` Daniel Scally
2021-06-18 12:55 ` [PATCH v2 3/8] platform/x86: intel_skl_int3472: Fix dependencies (drop CLKDEV_LOOKUP) Andy Shevchenko
2021-06-18 12:55 ` [PATCH v2 4/8] platform/x86: intel_skl_int3472: Use ACPI GPIO resource directly Andy Shevchenko
2021-06-21 22:37   ` Daniel Scally
2021-06-18 12:55 ` [PATCH v2 5/8] platform/x86: intel_skl_int3472: Provide skl_int3472_unregister_regulator() Andy Shevchenko
2021-06-21 22:40   ` Daniel Scally
2021-06-18 12:55 ` [PATCH v2 6/8] platform/x86: intel_skl_int3472: Provide skl_int3472_unregister_clock() Andy Shevchenko
2021-06-18 12:55 ` [PATCH v2 7/8] platform/x86: intel_skl_int3472: Move to intel/ subfolder Andy Shevchenko
2021-06-18 12:55 ` [PATCH v2 8/8] platform/x86: intel_cht_int33fe: Move to its own subfolder Andy Shevchenko
2021-06-22  9:02 ` [PATCH v2 1/8] platform/x86: Remove "default n" entries Andy Shevchenko
2021-06-22  9:03   ` Hans de Goede
2021-06-22  9:42 ` Hans de Goede
2021-06-22  9:46   ` Andy Shevchenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.