From patchwork Thu Jul 4 09:02:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Eckert X-Patchwork-Id: 11031259 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BE2BB138B for ; Thu, 4 Jul 2019 09:10:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B1E2228A6B for ; Thu, 4 Jul 2019 09:10:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A660628A6D; Thu, 4 Jul 2019 09:10:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 271FE289C7 for ; Thu, 4 Jul 2019 09:10:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727284AbfGDJKP (ORCPT ); Thu, 4 Jul 2019 05:10:15 -0400 Received: from host-88-217-225-28.customer.m-online.net ([88.217.225.28]:20032 "EHLO mail.dev.tdt.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727128AbfGDJKP (ORCPT ); Thu, 4 Jul 2019 05:10:15 -0400 X-Greylist: delayed 479 seconds by postgrey-1.27 at vger.kernel.org; Thu, 04 Jul 2019 05:10:14 EDT Received: from feckert01.dev.tdt.de (unknown [10.2.3.40]) by mail.dev.tdt.de (Postfix) with ESMTPSA id A92B02158E; Thu, 4 Jul 2019 09:02:27 +0000 (UTC) From: Florian Eckert To: Eckert.Florian@googlemail.com, info@metux.net, dvhart@infradead.org, andy@infradead.org Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Florian Eckert Subject: [PATCH 1/3] platform/x86/pcengines-apuv2: add mpcie reset gpio export Date: Thu, 4 Jul 2019 11:02:03 +0200 Message-Id: <20190704090205.19400-2-fe@dev.tdt.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190704090205.19400-1-fe@dev.tdt.de> References: <20190704090205.19400-1-fe@dev.tdt.de> Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On APUx we have also mpcie2/mpcie3 reset pins. To make it possible to reset the ports from the userspace, add the definition to this platform device. The gpio can then be exported by the legancy gpio subsystem to toggle the mpcie reset pin. Signed-off-by: Florian Eckert Acked-by: Enrico Weigelt --- drivers/platform/x86/pcengines-apuv2.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/platform/x86/pcengines-apuv2.c b/drivers/platform/x86/pcengines-apuv2.c index c1ca931e1fab..f6d8ed100cab 100644 --- a/drivers/platform/x86/pcengines-apuv2.c +++ b/drivers/platform/x86/pcengines-apuv2.c @@ -32,6 +32,8 @@ #define APU2_GPIO_REG_LED3 AMD_FCH_GPIO_REG_GPIO59_DEVSLP1 #define APU2_GPIO_REG_MODESW AMD_FCH_GPIO_REG_GPIO32_GE1 #define APU2_GPIO_REG_SIMSWAP AMD_FCH_GPIO_REG_GPIO33_GE2 +#define APU2_GPIO_REG_MPCIE2 AMD_FCH_GPIO_REG_GPIO59_DEVSLP0 +#define APU2_GPIO_REG_MPCIE3 AMD_FCH_GPIO_REG_GPIO51 /* order in which the gpio lines are defined in the register list */ #define APU2_GPIO_LINE_LED1 0 @@ -39,6 +41,8 @@ #define APU2_GPIO_LINE_LED3 2 #define APU2_GPIO_LINE_MODESW 3 #define APU2_GPIO_LINE_SIMSWAP 4 +#define APU2_GPIO_LINE_MPCIE2 5 +#define APU2_GPIO_LINE_MPCIE3 6 /* gpio device */ @@ -48,6 +52,8 @@ static int apu2_gpio_regs[] = { [APU2_GPIO_LINE_LED3] = APU2_GPIO_REG_LED3, [APU2_GPIO_LINE_MODESW] = APU2_GPIO_REG_MODESW, [APU2_GPIO_LINE_SIMSWAP] = APU2_GPIO_REG_SIMSWAP, + [APU2_GPIO_LINE_MPCIE2] = APU2_GPIO_REG_MPCIE2, + [APU2_GPIO_LINE_MPCIE3] = APU2_GPIO_REG_MPCIE3, }; static const char * const apu2_gpio_names[] = { @@ -56,6 +62,8 @@ static const char * const apu2_gpio_names[] = { [APU2_GPIO_LINE_LED3] = "front-led3", [APU2_GPIO_LINE_MODESW] = "front-button", [APU2_GPIO_LINE_SIMSWAP] = "simswap", + [APU2_GPIO_LINE_MPCIE2] = "mpcie2_reset", + [APU2_GPIO_LINE_MPCIE3] = "mpcie3_reset", }; static const struct amd_fch_gpio_pdata board_apu2 = { From patchwork Thu Jul 4 09:02:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Eckert X-Patchwork-Id: 11031261 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EAD2D14F6 for ; Thu, 4 Jul 2019 09:10:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DF1F2287E9 for ; Thu, 4 Jul 2019 09:10:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D3EF328A5B; Thu, 4 Jul 2019 09:10:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 82AA628A20 for ; Thu, 4 Jul 2019 09:10:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727279AbfGDJKP (ORCPT ); Thu, 4 Jul 2019 05:10:15 -0400 Received: from host-88-217-225-28.customer.m-online.net ([88.217.225.28]:7798 "EHLO mail.dev.tdt.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727158AbfGDJKP (ORCPT ); Thu, 4 Jul 2019 05:10:15 -0400 Received: from feckert01.dev.tdt.de (unknown [10.2.3.40]) by mail.dev.tdt.de (Postfix) with ESMTPSA id 6C97121590; Thu, 4 Jul 2019 09:02:29 +0000 (UTC) From: Florian Eckert To: Eckert.Florian@googlemail.com, info@metux.net, dvhart@infradead.org, andy@infradead.org Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Florian Eckert Subject: [PATCH 2/3] platform/x86/pcengines-apuv2: add legacy leds gpio definitions Date: Thu, 4 Jul 2019 11:02:04 +0200 Message-Id: <20190704090205.19400-3-fe@dev.tdt.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190704090205.19400-1-fe@dev.tdt.de> References: <20190704090205.19400-1-fe@dev.tdt.de> Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Extend the apu2_leds definition to make the leds exportable via the legacy gpio subsystem. Without this change the leds are not visible under "/sys/class/leds" and could not be configured. Signed-off-by: Florian Eckert --- drivers/platform/x86/pcengines-apuv2.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/platform/x86/pcengines-apuv2.c b/drivers/platform/x86/pcengines-apuv2.c index f6d8ed100cab..d50a50e9d34c 100644 --- a/drivers/platform/x86/pcengines-apuv2.c +++ b/drivers/platform/x86/pcengines-apuv2.c @@ -75,9 +75,24 @@ static const struct amd_fch_gpio_pdata board_apu2 = { /* gpio leds device */ static const struct gpio_led apu2_leds[] = { - { .name = "apu:green:1" }, - { .name = "apu:green:2" }, - { .name = "apu:green:3" } + { + .name = "apu:green:1", + .gpio = 505, + .default_trigger = "default-off", + .active_low = 1, + }, + { + .name = "apu:green:2", + .gpio = 506, + .default_trigger = "default-off", + .active_low = 1, + }, + { + .name = "apu:green:3", + .gpio = 507, + .default_trigger = "default-off", + .active_low = 1, + } }; static const struct gpio_led_platform_data apu2_leds_pdata = { From patchwork Thu Jul 4 09:02:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Eckert X-Patchwork-Id: 11031263 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C694D138B for ; Thu, 4 Jul 2019 09:10:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B9C37289C7 for ; Thu, 4 Jul 2019 09:10:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AE86D28A5F; Thu, 4 Jul 2019 09:10:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 54920289C7 for ; Thu, 4 Jul 2019 09:10:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727268AbfGDJKP (ORCPT ); Thu, 4 Jul 2019 05:10:15 -0400 Received: from host-88-217-225-28.customer.m-online.net ([88.217.225.28]:10798 "EHLO mail.dev.tdt.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727140AbfGDJKP (ORCPT ); Thu, 4 Jul 2019 05:10:15 -0400 Received: from feckert01.dev.tdt.de (unknown [10.2.3.40]) by mail.dev.tdt.de (Postfix) with ESMTPSA id 64B5D21592; Thu, 4 Jul 2019 09:02:30 +0000 (UTC) From: Florian Eckert To: Eckert.Florian@googlemail.com, info@metux.net, dvhart@infradead.org, andy@infradead.org Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Florian Eckert Subject: [PATCH 3/3] platform//x86/pcengines-apuv2: update gpio button definition Date: Thu, 4 Jul 2019 11:02:05 +0200 Message-Id: <20190704090205.19400-4-fe@dev.tdt.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190704090205.19400-1-fe@dev.tdt.de> References: <20190704090205.19400-1-fe@dev.tdt.de> Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP * Add the gpio number, so the button subsystem can find the right gpio. * Change also the keycode from KEY_SETUP to KEY_RESTART, because it seems more expressive to me and in the Alix-Board, which is the predecessor, there isthis keycode defined too. I think this is also intended by Pcengines. Also many embedded systems defined in the kernel use this key code as well. Signed-off-by: Florian Eckert --- drivers/platform/x86/pcengines-apuv2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/pcengines-apuv2.c b/drivers/platform/x86/pcengines-apuv2.c index d50a50e9d34c..370fd2686d59 100644 --- a/drivers/platform/x86/pcengines-apuv2.c +++ b/drivers/platform/x86/pcengines-apuv2.c @@ -116,7 +116,8 @@ struct gpiod_lookup_table gpios_led_table = { static struct gpio_keys_button apu2_keys_buttons[] = { { - .code = KEY_SETUP, + .code = KEY_RESTART, + .gpio = 508, .active_low = 1, .desc = "front button", .type = EV_KEY,