Skip to contentSkip to conversation

apu6: add apu6 variation to apu2 driver family

PATCH In review Philip Prindeville 3 participants 4 messages Dec 30, 2022 – Jan 1, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 apu6: add apu6 variation to apu2 driver family

From: Philip Prindeville <[email protected]>

Add detection of PC Engines "apu6" platform via DMI.

Also, revise leds-apu.c to call out additional platforms which aren't supported.

---

drivers/leds/leds-apu.c                |  2 +-
drivers/platform/x86/Kconfig           |  4 ++--
drivers/platform/x86/pcengines-apuv2.c | 19 ++++++++++++++++---
3 files changed, 19 insertions(+), 6 deletions(-)
drivers/leds/leds-apu.c +0 -0
index c409b80c236d7182c79944225dd4b9e5d32f0a9f..5a71ced5ed3dc850d7355be90f4f7ed14ad4cc47 100644
@@ -183,7 +183,7 @@ static int __init apu_led_init(void)
 
	if (!(dmi_match(DMI_SYS_VENDOR, "PC Engines") &&
	      (dmi_match(DMI_PRODUCT_NAME, "APU") || dmi_match(DMI_PRODUCT_NAME, "apu1")))) {
-		pr_err("No PC Engines APUv1 board detected. For APUv2,3 support, enable CONFIG_PCENGINES_APU2\n");
+		pr_err("No PC Engines APUv1 board detected. For APUv2,3,4,6 support, enable CONFIG_PCENGINES_APU2\n");
		return -ENODEV;
	}
drivers/platform/x86/Kconfig +0 -0
index 5692385e2d26fed92785488ce1c6e88449c54c78..86bb334a6d4d6a3a7e0319470c16d49cf6a3d9f2 100644
@@ -698,7 +698,7 @@ config XO1_RFKILL

laptop.

config PCENGINES_APU2
- tristate "PC Engines APUv2/3 front button and LEDs driver"
+ tristate "PC Engines APUv2/3/4/6 front button and LEDs driver"

	depends on INPUT && INPUT_KEYBOARD && GPIOLIB
	depends on LEDS_CLASS
	select GPIO_AMD_FCH

@@ -706,7 +706,7 @@ config PCENGINES_APU2
select LEDS_GPIO
help
This driver provides support for the front button and LEDs on
- PC Engines APUv2/APUv3 board.
+ PC Engines APUv2/APUv3/APUv4/APUv6 board.

To compile this driver as a module, choose M here: the module will be called pcengines-apuv2.

drivers/platform/x86/pcengines-apuv2.c +0 -0
index d063d91db9bcbe5ceb2ac641d3105df37651ac4d..405dea012ab80fa35775c6169b3e659d0a3fb30c 100644
@@ -1,10 +1,11 @@

// SPDX-License-Identifier: GPL-2.0+

/*
- * PC-Engines APUv2/APUv3 board platform driver
+ * PC-Engines APUv2/APUv3/APUv4/APUv6 board platform driver
* for GPIO buttons and LEDs
*
* Copyright (C) 2018 metux IT consult
+ * Copyright (C) 2022 Redfish Solutions, LLC
* Author: Enrico Weigelt <[email protected]>
*/

@@ -22,7 +23,7 @@
#include <linux/platform_data/gpio/gpio-amd-fch.h>

/*
- * NOTE: this driver only supports APUv2/3 - not APUv1, as this one
+ * NOTE: this driver only supports APUv2/3/4/6 - not APUv1, as this one
* has completely different register layouts.
*/

@@ -215,6 +216,15 @@ static const struct dmi_system_id apu_gpio_dmi_table[] __initconst = {
		},
		.driver_data = (void *)&board_apu2,
	},

+ /* APU6 w/ legacy BIOS >= 4.12 */
+ {
+ .ident = "apu6",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "PC Engines"),
+ DMI_MATCH(DMI_BOARD_NAME, "apu6")
+ },
+ .driver_data = (void *)&board_apu2,
+ },

	{}
};

@@ -288,8 +298,11 @@ module_init(apu_board_init);
module_exit(apu_board_exit);

MODULE_AUTHOR("Enrico Weigelt, metux IT consult <[email protected]>"); -MODULE_DESCRIPTION("PC Engines APUv2/APUv3 board GPIO/LEDs/keys driver"); +MODULE_DESCRIPTION("PC Engines APUv2/APUv3/APUv4/APUv6 board GPIO/LEDs/keys driver"); MODULE_LICENSE("GPL");
MODULE_DEVICE_TABLE(dmi, apu_gpio_dmi_table);
MODULE_ALIAS("platform:pcengines-apuv2");
+MODULE_ALIAS("platform:pcengines-apuv3");
+MODULE_ALIAS("platform:pcengines-apuv4");
+MODULE_ALIAS("platform:pcengines-apuv6");
MODULE_SOFTDEP("pre: platform:" AMD_FCH_GPIO_DRIVER_NAME " platform:leds-gpio platform:gpio_keys_polled");

Signature · 1 line
2.34.1
#1 lore raw
Quoted 6 lines · Philip Prindeville

From: Philip Prindeville <[email protected]>

Add detection of PC Engines "apu6" platform via DMI.

Also, revise leds-apu.c to call out additional platforms which aren't supported.

Any chance of also adding the APU5? Details in my previous patches

Ed W

#2 lore raw
Quoted 10 lines · Ed Wildgoose
Quoted 4 lines · Philip Prindeville

From: Philip Prindeville <[email protected]>

Add detection of PC Engines "apu6" platform via DMI.

Quoted 8 lines
Quoted 2 lines

Also, revise leds-apu.c to call out additional platforms which aren't supported.

Any chance of also adding the APU5? Details in my previous patches

Ed W

Sure, but I have questions about this:

+ /* APU5 w/ mainline BIOS */
+ {

+               .ident          = "apu5",
+               .matches        = {

+ DMI_MATCH(DMI_SYS_VENDOR, "PC Engines"),
+ DMI_MATCH(DMI_BOARD_NAME, "apu5")
+ },
+ .driver_data = (void *)&apu5_driver_data,
+ },

All the other entries have their .driver_data pointing to a struct amd_fch_gpio_pdata... but not this one. It points to a struct apu_driver_data and I don't even see the definition of that type. Should it point to "board_apu5" instead and we can drop:

+static const struct amd_fch_gpio_pdata board_apu5 = {

+       .gpio_num       = ARRAY_SIZE(apu5_gpio_regs),
+       .gpio_reg       = apu5_gpio_regs,
+       .gpio_names     = apu5_gpio_names,

+};
+