platform/x86: Remove "default n" entries
Subsystems (2)
PATCH v2 1/8 platform/x86: Remove "default n" entries
Linus already once did that for PDx86, don't repeat our mistakes. TL;DR: 'n' *is* the default 'default'.
---
v2: no changes
drivers/platform/x86/Kconfig | 1 - drivers/platform/x86/dell/Kconfig | 1 - 2 files changed, 2 deletions(-)
drivers/platform/x86/Kconfig +0 -1
@@ -1092,7 +1092,6 @@ config TOUCHSCREEN_DMI config FW_ATTR_CLASS tristate - default n config INTEL_IMR bool "Intel Isolated Memory Region support"
drivers/platform/x86/dell/Kconfig +0 -1
@@ -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
Signature · 1 line
2.30.2
PATCH v2 5/8 platform/x86: intel_skl_int3472: Provide skl_int3472_unregister_regulator()
For the sake of APIs to be properly layered provide skl_int3472_unregister_regulator().
---
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(-)
drivers/platform/x86/intel-int3472/intel_skl_int3472_clk_and_regulator.c +6 -0
@@ -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); +}
drivers/platform/x86/intel-int3472/intel_skl_int3472_common.h +2 -0
@@ -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
drivers/platform/x86/intel-int3472/intel_skl_int3472_discrete.c +2 -2
@@ -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 ; }
Signature · 1 line
2.30.2
PATCH v2 2/8 platform/x86: intel_skl_int3472: Free ACPI device resources after use
In reply to Andy ShevchenkoWe may free ACPI device resources immediately after use. Refactor skl_int3472_parse_crs() accordingly.
---
v2: new patch
.../x86/intel-int3472/intel_skl_int3472_discrete.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/platform/x86/intel-int3472/intel_skl_int3472_discrete.c +6 -7
@@ -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)
Signature · 1 line
2.30.2
PATCH v2 3/8 platform/x86: intel_skl_int3472: Fix dependencies (drop CLKDEV_LOOKUP)
In reply to Andy ShevchenkoBesides the fact that COMMON_CLK selects CLKDEV_LOOKUP, the latter is going to be removed from clock framework.
---
v2: added Rb (Daniel)
drivers/platform/x86/intel-int3472/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/intel-int3472/Kconfig +1 -1
@@ -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
Signature · 1 line
2.30.2
PATCH v2 8/8 platform/x86: intel_cht_int33fe: Move to its own subfolder
In reply to Andy ShevchenkoSince we have started collecting Intel x86 specific drivers in its own folder, Move intel_cht_int33fe to own subfolder there.
---
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%)drivers/platform/x86/Kconfig +0 -24
@@ -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
drivers/platform/x86/Makefile +0 -4
@@ -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
drivers/platform/x86/intel/Kconfig +1 -0
@@ -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
drivers/platform/x86/intel/Makefile +1 -0
@@ -4,4 +4,5 @@ # Intel x86 Platform-Specific Drivers # +obj-$(CONFIG_INTEL_CHT_INT33FE) += int33fe/ obj-$(CONFIG_INTEL_SKL_INT3472) += int3472/
drivers/platform/x86/intel/int33fe/Kconfig new file +25 -0
@@ -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. +
drivers/platform/x86/intel/int33fe/Makefile new file +5 -0
@@ -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
drivers/platform/x86/intel/int33fe/intel_cht_int33fe_common.c renamed from drivers/platform/x86/intel_cht_int33fe_common.c +0 -0
drivers/platform/x86/intel/int33fe/intel_cht_int33fe_common.h renamed from drivers/platform/x86/intel_cht_int33fe_common.h +0 -0
drivers/platform/x86/intel/int33fe/intel_cht_int33fe_microb.c renamed from drivers/platform/x86/intel_cht_int33fe_microb.c +0 -0
drivers/platform/x86/intel/int33fe/intel_cht_int33fe_typec.c renamed from drivers/platform/x86/intel_cht_int33fe_typec.c +0 -0
Signature · 1 line
2.30.2
PATCH v2 7/8 platform/x86: intel_skl_int3472: Move to intel/ subfolder
In reply to Andy ShevchenkoStart collecting Intel x86 related drivers in its own subfolder. Move intel_skl_int3472 first.
---
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%)drivers/platform/x86/Kconfig +2 -2
@@ -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
drivers/platform/x86/Makefile +2 -1
@@ -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
drivers/platform/x86/intel/Kconfig new file +21 -0
@@ -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
drivers/platform/x86/intel/Makefile new file +7 -0
@@ -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/
drivers/platform/x86/intel/int3472/Kconfig renamed from drivers/platform/x86/intel-int3472/Kconfig +0 -0
drivers/platform/x86/intel/int3472/Makefile renamed from drivers/platform/x86/intel-int3472/Makefile +0 -0
drivers/platform/x86/intel/int3472/intel_skl_int3472_clk_and_regulator.c renamed from drivers/platform/x86/intel-int3472/intel_skl_int3472_clk_and_regulator.c +0 -0
drivers/platform/x86/intel/int3472/intel_skl_int3472_common.c renamed from drivers/platform/x86/intel-int3472/intel_skl_int3472_common.c +0 -0
drivers/platform/x86/intel/int3472/intel_skl_int3472_common.h renamed from drivers/platform/x86/intel-int3472/intel_skl_int3472_common.h +0 -0
drivers/platform/x86/intel/int3472/intel_skl_int3472_discrete.c renamed from drivers/platform/x86/intel-int3472/intel_skl_int3472_discrete.c +0 -0
drivers/platform/x86/intel/int3472/intel_skl_int3472_tps68470.c renamed from drivers/platform/x86/intel-int3472/intel_skl_int3472_tps68470.c +0 -0
Signature · 1 line
2.30.2
PATCH v2 4/8 platform/x86: intel_skl_int3472: Use ACPI GPIO resource directly
In reply to Andy ShevchenkoWhen 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.
---
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(-)
drivers/platform/x86/intel-int3472/intel_skl_int3472_clk_and_regulator.c +3 -4
@@ -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" );
drivers/platform/x86/intel-int3472/intel_skl_int3472_common.h +1 -1
@@ -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
drivers/platform/x86/intel-int3472/intel_skl_int3472_discrete.c +13 -15
@@ -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" ;
Signature · 1 line
2.30.2
PATCH v2 6/8 platform/x86: intel_skl_int3472: Provide skl_int3472_unregister_clock()
In reply to Andy ShevchenkoFor the sake of APIs to be properly layered provide skl_int3472_unregister_clock().
---
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(-)
drivers/platform/x86/intel-int3472/intel_skl_int3472_clk_and_regulator.c +6 -0
@@ -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) {
drivers/platform/x86/intel-int3472/intel_skl_int3472_common.h +2 -0
@@ -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);
drivers/platform/x86/intel-int3472/intel_skl_int3472_discrete.c +2 -3
@@ -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);
Signature · 1 line
2.30.2
Re: [PATCH v2 2/8] platform/x86: intel_skl_int3472: Free ACPI device resources after use
In reply to Andy ShevchenkoHi Andy
Quoted 4 lines · Andy Shevchenko
We may free ACPI device resources immediately after use. Refactor
skl_int3472_parse_crs()accordingly.Signed-off-by Andy Shevchenko <[email protected]>
Sorry, only just got round to these:
Quoted 43 lines
---
v2: new patch.../x86/intel-int3472/intel_skl_int3472_discrete.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)drivers/platform/x86/intel-int3472/intel_skl_int3472_discrete.c +6
-7@@ -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)
Re: [PATCH v2 4/8] platform/x86: intel_skl_int3472: Use ACPI GPIO resource directly
In reply to Andy ShevchenkoQuoted 5 lines · Andy Shevchenko
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 <[email protected]>
This is much better, thanks.
Quoted 145 lines
---
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(-)drivers/platform/x86/intel-int3472/intel_skl_int3472_clk_and_regulator.c +3
-4@@ -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" );drivers/platform/x86/intel-int3472/intel_skl_int3472_common.h +1
-1@@ -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 drivers/platform/x86/intel-int3472/intel_skl_int3472_discrete.c +13
-15@@ -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" ;
Re: [PATCH v2 5/8] platform/x86: intel_skl_int3472: Provide skl_int3472_unregister_regulator()
In reply to Andy ShevchenkoHi Andy
Quoted 4 lines · Andy Shevchenko
For the sake of APIs to be properly layered provide
skl_int3472_unregister_regulator().Signed-off-by Andy Shevchenko <[email protected]>
And for 6/8 too.
Quoted 57 lines
---
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(-)drivers/platform/x86/intel-int3472/intel_skl_int3472_clk_and_regulator.c +6
-0@@ -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); +}drivers/platform/x86/intel-int3472/intel_skl_int3472_common.h +2
-0@@ -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 drivers/platform/x86/intel-int3472/intel_skl_int3472_discrete.c +2
-2@@ -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 ; }
Quoted 3 lines · Andy Shevchenko
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?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Hi,
Quoted 10 lines · Andy Shevchenko
Quoted 3 lines · Andy Shevchenko
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
Hi,
Quoted 4 lines · Andy Shevchenko
Linus already once did that for PDx86, don't repeat our mistakes. TL;DR: 'n' *is* the default 'default'.
Signed-off-by Andy Shevchenko <[email protected]>
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:
MAINTAINERS +1 -1
@@ -9388,7 +9388,7 @@ F: drivers/platform/x86/intel_scu_* INTEL SKYLAKE INT3472 ACPI DEVICE DRIVER M: Daniel Scally <[email protected]> S: Maintained -F: drivers/platform/x86/intel-int3472/ +F: drivers/platform/x86/intel/int3472/ INTEL SPEED SELECT TECHNOLOGY M: Srinivas Pandruvada <[email protected]>
(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
Quoted 31 lines
---
v2: no changesdrivers/platform/x86/Kconfig | 1 - drivers/platform/x86/dell/Kconfig | 1 - 2 files changed, 2 deletions(-)drivers/platform/x86/Kconfig +0
-1@@ -1092,7 +1092,6 @@ config TOUCHSCREEN_DMI config FW_ATTR_CLASS tristate - default n config INTEL_IMR bool "Intel Isolated Memory Region support"drivers/platform/x86/dell/Kconfig +0
-1@@ -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
Quoted 15 lines · Hans de Goede
Quoted 4 lines · Andy Shevchenko
Linus already once did that for PDx86, don't repeat our mistakes. TL;DR: 'n' *is* the default 'default'.
Signed-off-by Andy Shevchenko <[email protected]>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-hansNote I've squashed in the following fixup to patch 7/8:
MAINTAINERS F: drivers/platform/x86/intel_scu_* · line 9393
Quoted 7 lines
MAINTAINERS +1
-1@@ -9388,7 +9388,7 @@ F: drivers/platform/x86/intel_scu_* INTEL SKYLAKE INT3472 ACPI DEVICE DRIVER M: Daniel Scally <[email protected]> S: Maintained -F: drivers/platform/x86/intel-int3472/ +F: drivers/platform/x86/intel/int3472/ (checkpatch complained about MAINTAINERS not being updated)
Thank you, Hans!
Signature · 2 lines
With Best Regards, Andy Shevchenko