Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4371365ybi; Mon, 15 Jul 2019 07:59:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqzPjTaI3BaJ/0tIo/EbFjSpf7465ofu+EaRFRZySQKWAwr5s3l5N7Zraqdou8ZI5X7rtsCB X-Received: by 2002:a17:90a:8a84:: with SMTP id x4mr29272827pjn.105.1563202767460; Mon, 15 Jul 2019 07:59:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563202767; cv=none; d=google.com; s=arc-20160816; b=RSQFq8DArsMKT9i2g/pEd04HPCklbN0EldIps3oryRFFDBl9zM9EwS/WdIFmkEis5/ pJACuFzVMKfeQssxaDiiRt/Jb96i8+U4szhy4nfi6OMzcFr9YMtiKwQo6WIU9ktrVq2G teuUVtmuk+bULopvN6yarKNWBxuUhv8VYRRF3qzOnE25IQTPLPwcdL8zbrOevqGWtM0d pYgyjYxt/mqvdOKWby12bzjQIJJ5WR0GO+bj0gX6BoAjsusiCTgSYXaO9BVizsSVqIDf cdW0ylrrb8MrTxHp1ZKbiQzPvZvxIUo8FD/o3Lw6rTPt9ZMS9C+X3w4NquZFObTeBqqd wf0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=lXcsKNiVD5LH42fpEciypVSqPoY7Zc6M8HaxsI7EkmE=; b=e6joLqjQuOSCwbB/pBn544oereredDeaqBtGMcHq5da2t30rZvwwhcHlCvsw5v6Tdv TkgaySjaCftC/PHdLlmxUQf+WKpKez/WX7G7d5nFYP7sv05FZNmP/XtMTdys8WbgkagT 7zKYbthsqU5QJb3gKxPM576PqTMelv+Qj3mBVs9Ye8fGg389YvnAOJCLvxCf3u+wQ3vQ CXJHXRjUTc7uKns+7pMKoaBOyph7jHdcyoxEwxA+j8Qf8H4kKhzW6b1YSPT+hxmz72Ww +C65SY34bRbpT/41Yu9ghoK+FDdTR9gwx+PVlJRfEFgeF9R0zzeJbI6hV73QxXErdzYX PjvQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w10si17300266pfq.115.2019.07.15.07.59.10; Mon, 15 Jul 2019 07:59:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391162AbfGOO5w (ORCPT + 99 others); Mon, 15 Jul 2019 10:57:52 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:56233 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390305AbfGOO5o (ORCPT ); Mon, 15 Jul 2019 10:57:44 -0400 Received: from orion.localdomain ([95.118.111.244]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.183]) with ESMTPSA (Nemesis) id 1Mo6zF-1iGLxR3Mxn-00pdeU; Mon, 15 Jul 2019 16:57:38 +0200 From: "Enrico Weigelt, metux IT consult" To: linux-kernel@vger.kernel.org Cc: jacek.anaszewski@gmail.com, pavel@ucw.cz, dmurphy@ti.com, linux-leds@vger.kernel.org Subject: [PATCH 1/6] leds: apu: drop superseeded apu2/3 led support Date: Mon, 15 Jul 2019 16:57:28 +0200 Message-Id: <1563202653-20994-2-git-send-email-info@metux.net> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1563202653-20994-1-git-send-email-info@metux.net> References: <1563202653-20994-1-git-send-email-info@metux.net> X-Provags-ID: V03:K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g== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Enrico Weigelt This driver only supports gpio-attached LEDs on apu1/2/3 boards, but neither gpio's themselves, nor other gpio-attached devices (eg. front button). For apu2+ a newer, more complete driver exists, based on a generic driver for the AMD SOCs gpio-controller, supporting LEDs as well other devices. Therefore these boards don't need legacy support from this driver anymore. Both drivers claim the same device, so only one driver may exist in a system, putting distros in the position to decide between either apu2+ keys or apu1 led support. Therefore drop the apu2+ led support from the old driver, solve the conflict and reduce unnecessary code. Signed-off-by: Enrico Weigelt --- drivers/leds/Kconfig | 5 +- drivers/leds/leds-apu.c | 124 +++--------------------------------------------- 2 files changed, 10 insertions(+), 119 deletions(-) diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index b0fdeef..f7a3dd7 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig @@ -74,9 +74,12 @@ config LEDS_APU depends on LEDS_CLASS depends on X86 && DMI help - This driver makes the PC Engines APU/APU2/APU3 front panel LEDs + This driver makes the PC Engines APU1 front panel LEDs accessible from userspace programs through the LED subsystem. + If you're looking for APU2/3, use the pcengines-apu2 driver. + (symbol CONFIG_PCENGINES_APU2) + To compile this driver as a module, choose M here: the module will be called leds-apu. diff --git a/drivers/leds/leds-apu.c b/drivers/leds/leds-apu.c index 8d42e46..140093a 100644 --- a/drivers/leds/leds-apu.c +++ b/drivers/leds/leds-apu.c @@ -47,12 +47,6 @@ #define APU1_NUM_GPIO 3 #define APU1_IOSIZE sizeof(u8) -#define APU2_FCH_ACPI_MMIO_BASE 0xFED80000 -#define APU2_FCH_GPIO_BASE (APU2_FCH_ACPI_MMIO_BASE + 0x1500) -#define APU2_GPIO_BIT_WRITE 22 -#define APU2_APU2_NUM_GPIO 4 -#define APU2_IOSIZE sizeof(u32) - /* LED access parameters */ struct apu_param { void __iomem *addr; /* for ioread/iowrite */ @@ -75,7 +69,6 @@ struct apu_led_profile { /* Supported platform types */ enum apu_led_platform_types { APU1_LED_PLATFORM, - APU2_LED_PLATFORM, }; struct apu_led_pdata { @@ -96,19 +89,6 @@ struct apu_led_pdata { { "apu:green:3", LED_OFF, APU1_FCH_GPIO_BASE + 2 * APU1_IOSIZE }, }; -static const struct apu_led_profile apu2_led_profile[] = { - { "apu2:green:1", LED_ON, APU2_FCH_GPIO_BASE + 68 * APU2_IOSIZE }, - { "apu2:green:2", LED_OFF, APU2_FCH_GPIO_BASE + 69 * APU2_IOSIZE }, - { "apu2:green:3", LED_OFF, APU2_FCH_GPIO_BASE + 70 * APU2_IOSIZE }, -}; - -/* Same as apu2_led_profile, but with "3" in the LED names. */ -static const struct apu_led_profile apu3_led_profile[] = { - { "apu3:green:1", LED_ON, APU2_FCH_GPIO_BASE + 68 * APU2_IOSIZE }, - { "apu3:green:2", LED_OFF, APU2_FCH_GPIO_BASE + 69 * APU2_IOSIZE }, - { "apu3:green:3", LED_OFF, APU2_FCH_GPIO_BASE + 70 * APU2_IOSIZE }, -}; - static const struct dmi_system_id apu_led_dmi_table[] __initconst = { { .ident = "apu", @@ -117,54 +97,6 @@ struct apu_led_pdata { DMI_MATCH(DMI_PRODUCT_NAME, "APU") } }, - /* PC Engines APU2 with "Legacy" bios < 4.0.8 */ - { - .ident = "apu2", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "PC Engines"), - DMI_MATCH(DMI_BOARD_NAME, "APU2") - } - }, - /* PC Engines APU2 with "Legacy" bios >= 4.0.8 */ - { - .ident = "apu2", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "PC Engines"), - DMI_MATCH(DMI_BOARD_NAME, "apu2") - } - }, - /* PC Engines APU2 with "Mainline" bios */ - { - .ident = "apu2", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "PC Engines"), - DMI_MATCH(DMI_BOARD_NAME, "PC Engines apu2") - } - }, - /* PC Engines APU3 with "Legacy" bios < 4.0.8 */ - { - .ident = "apu3", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "PC Engines"), - DMI_MATCH(DMI_BOARD_NAME, "APU3") - } - }, - /* PC Engines APU3 with "Legacy" bios >= 4.0.8 */ - { - .ident = "apu3", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "PC Engines"), - DMI_MATCH(DMI_BOARD_NAME, "apu3") - } - }, - /* PC Engines APU2 with "Mainline" bios */ - { - .ident = "apu3", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "PC Engines"), - DMI_MATCH(DMI_BOARD_NAME, "PC Engines apu3") - } - }, {} }; MODULE_DEVICE_TABLE(dmi, apu_led_dmi_table); @@ -178,25 +110,6 @@ static void apu1_led_brightness_set(struct led_classdev *led, enum led_brightnes spin_unlock(&apu_led->lock); } -static void apu2_led_brightness_set(struct led_classdev *led, enum led_brightness value) -{ - struct apu_led_priv *pled = cdev_to_priv(led); - u32 value_new; - - spin_lock(&apu_led->lock); - - value_new = ioread32(pled->param.addr); - - if (value) - value_new &= ~BIT(APU2_GPIO_BIT_WRITE); - else - value_new |= BIT(APU2_GPIO_BIT_WRITE); - - iowrite32(value_new, pled->param.addr); - - spin_unlock(&apu_led->lock); -} - static int apu_led_config(struct device *dev, struct apu_led_pdata *apuld) { int i; @@ -219,8 +132,6 @@ static int apu_led_config(struct device *dev, struct apu_led_pdata *apuld) led_cdev->flags = LED_CORE_SUSPENDRESUME; if (apu_led->platform == APU1_LED_PLATFORM) led_cdev->brightness_set = apu1_led_brightness_set; - else if (apu_led->platform == APU2_LED_PLATFORM) - led_cdev->brightness_set = apu2_led_brightness_set; pled->param.addr = devm_ioremap(dev, apu_led->profile[i].offset, apu_led->iosize); @@ -254,27 +165,10 @@ static int __init apu_led_probe(struct platform_device *pdev) apu_led->pdev = pdev; - if (dmi_match(DMI_PRODUCT_NAME, "APU")) { - apu_led->profile = apu1_led_profile; - apu_led->platform = APU1_LED_PLATFORM; - apu_led->num_led_instances = ARRAY_SIZE(apu1_led_profile); - apu_led->iosize = APU1_IOSIZE; - } else if (dmi_match(DMI_BOARD_NAME, "APU2") || - dmi_match(DMI_BOARD_NAME, "apu2") || - dmi_match(DMI_BOARD_NAME, "PC Engines apu2")) { - apu_led->profile = apu2_led_profile; - apu_led->platform = APU2_LED_PLATFORM; - apu_led->num_led_instances = ARRAY_SIZE(apu2_led_profile); - apu_led->iosize = APU2_IOSIZE; - } else if (dmi_match(DMI_BOARD_NAME, "APU3") || - dmi_match(DMI_BOARD_NAME, "apu3") || - dmi_match(DMI_BOARD_NAME, "PC Engines apu3")) { - apu_led->profile = apu3_led_profile; - /* Otherwise identical to APU2. */ - apu_led->platform = APU2_LED_PLATFORM; - apu_led->num_led_instances = ARRAY_SIZE(apu3_led_profile); - apu_led->iosize = APU2_IOSIZE; - } + apu_led->profile = apu1_led_profile; + apu_led->platform = APU1_LED_PLATFORM; + apu_led->num_led_instances = ARRAY_SIZE(apu1_led_profile); + apu_led->iosize = APU1_IOSIZE; spin_lock_init(&apu_led->lock); return apu_led_config(&pdev->dev, apu_led); @@ -295,13 +189,7 @@ static int __init apu_led_init(void) pr_err("No PC Engines board detected\n"); return -ENODEV; } - if (!(dmi_match(DMI_PRODUCT_NAME, "APU") || - dmi_match(DMI_PRODUCT_NAME, "APU2") || - dmi_match(DMI_PRODUCT_NAME, "apu2") || - dmi_match(DMI_PRODUCT_NAME, "PC Engines apu2") || - dmi_match(DMI_PRODUCT_NAME, "APU3") || - dmi_match(DMI_PRODUCT_NAME, "apu3") || - dmi_match(DMI_PRODUCT_NAME, "PC Engines apu3"))) { + if (!(dmi_match(DMI_PRODUCT_NAME, "APU"))) { pr_err("Unknown PC Engines board: %s\n", dmi_get_system_info(DMI_PRODUCT_NAME)); return -ENODEV; @@ -337,6 +225,6 @@ static void __exit apu_led_exit(void) module_exit(apu_led_exit); MODULE_AUTHOR("Alan Mizrahi"); -MODULE_DESCRIPTION("PC Engines APU family LED driver"); +MODULE_DESCRIPTION("PC Engines APU1 front LED driver"); MODULE_LICENSE("GPL v2"); MODULE_ALIAS("platform:leds_apu"); -- 1.9.1