From patchwork Sat Jun 9 14:02:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 10455919 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 675EE6028A for ; Sat, 9 Jun 2018 14:03:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5493F223A6 for ; Sat, 9 Jun 2018 14:03:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 49458223B2; Sat, 9 Jun 2018 14:03:42 +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=-2.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DF205223A6 for ; Sat, 9 Jun 2018 14:03:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=tO/6v+nOqya7SD1Cq87ShV1oCEJewgADm9yTWtWLAjw=; b=RnHbmltL9alUooMKizZx+y19XP vcnTVwOHExfrj9I41W/qGvJvHEnE+4yi3WSrbZ6LOPbGXvniNcv6wN3RSeNyHftNM2jZk6azZHcLw cJT5MG4F9sDYJGbmQD3gI3QXed2f/nfi+qwrdcFSlujSPYuFZpa3QGmAAsWkuVJUIUXNLK1dbHbu2 czqfqMDhfHm8UEeGSLTdfWW97e9TpmMpxdVpuloDgQ8AVg+Li11dA+1grncHT84DmTBLsClweNpo2 hbJVWnwXxtuhUfViar6ZhQn2sBj3oyXPY0xT0239hSqn2kfAQQD3RYH2P6SI57x0qAo2n/9Dy2qlb ByYjnUAg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fReSm-0007jT-E4; Sat, 09 Jun 2018 14:03:28 +0000 Received: from mail-lf0-x242.google.com ([2a00:1450:4010:c07::242]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fReS7-0007D5-TH for linux-arm-kernel@lists.infradead.org; Sat, 09 Jun 2018 14:02:49 +0000 Received: by mail-lf0-x242.google.com with SMTP id d24-v6so24159595lfa.8 for ; Sat, 09 Jun 2018 07:02:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=mOjLsJfnKdGMrPPfSAYY48IQW/M2iyitMXHZcPfc+Bc=; b=DpC8CwSUS27YBAwqW1vSudxGoz7qmAyZVRlDW/MsOO639ld5s8YSbRfb0uzIGU31A0 fRijTPxPeiItH196pEdxaVfpFFvQMPrsbVmT/0tfRfzz9+S6i7pVt7t1/J6YGKiBRz8o efodSyuwLLfKauC9/85w5V175rokr+cmkDEh3QlFbXlW3AXILFcns3IS2ZQyhLAP38cW J9d4rWJ+IMSDaWtrIonno+l9OPXdJo9q66HtDvc7PNRoBW081Yw+MM85UA2D5CdBzHVi VhEh3CCCOyR0m/sN+PHheXCZgJHIqt2Q5hivVunDFVcV44l1afyqrb6SCPNStoBP53Cu V9Pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=mOjLsJfnKdGMrPPfSAYY48IQW/M2iyitMXHZcPfc+Bc=; b=j4vf9t04uiwJSjb5JikkJ4+76Vi9sujoheEsxq2P0mfMjP65HgeLVaqhP/nVxTm5Ob HsQrpBj9FJYrR7Efbz+uKGONgf350i78PE9ho5Eq1TGewDpd6tmsmkvX6YVl98GySNZZ +H3S64kl/7Gn1nide3sU3rVgZ0LW60JFuG+SQudOOp/gkfXVKWWYjclezbzXOHqs6Hht KML59fBM9roCZoQc7NeOF8/6fe4qcObVDcuZe3tfxm0Zb7z918zKw5E1suauXRn/KM3c O1Hzi//saka3VhAt97ExjFetWf1H3HkGhSaL5/nB2vYmzCG68rYa9/UnRKa4rfKmb48e bVJw== X-Gm-Message-State: APt69E1y20y/DujA9/yJwEISvyTqn/uMZETH86F5iWrIJJ6Oz8Bvm0Hg XSbBRKKbNBJKEKsco/9PeSg= X-Google-Smtp-Source: ADUXVKKgdijZdWPTDV0itN7GLvBHpgCGKWt8sjcomNosd+E1zwWYYwvwv2ZkdRQ79MYGybG3In175g== X-Received: by 2002:a19:cc4b:: with SMTP id c72-v6mr6676158lfg.30.1528552963947; Sat, 09 Jun 2018 07:02:43 -0700 (PDT) Received: from localhost.localdomain (apn-31-0-40-98.dynamic.gprs.plus.pl. [31.0.40.98]) by smtp.gmail.com with ESMTPSA id n84-v6sm4477727lfi.19.2018.06.09.07.02.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 09 Jun 2018 07:02:43 -0700 (PDT) From: Janusz Krzysztofik To: Dmitry Torokhov , Tony Lindgren , Aaro Koskinen Subject: [PATCH 02/10] Input: ams_delta_serio: convert to platform driver Date: Sat, 9 Jun 2018 16:02:16 +0200 Message-Id: <20180609140224.32606-2-jmkrzyszt@gmail.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180609140224.32606-1-jmkrzyszt@gmail.com> References: <20180609140224.32606-1-jmkrzyszt@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180609_070247_993056_A600F5AE X-CRM114-Status: GOOD ( 16.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Greg Kroah-Hartman , Linus Walleij , Randy Dunlap , Janusz Krzysztofik , Liam Girdwood , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Mark Brown , linux-input@vger.kernel.org, Mauro Carvalho Chehab , Andrew Morton , linux-omap@vger.kernel.org, "David S . Miller" , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Convert the driver to an "ams-delta-serio" platform driver. For it to be used with Amstrad Delta, register an "ams-delta-serio" platform device from the board init file. Signed-off-by: Janusz Krzysztofik --- arch/arm/mach-omap1/board-ams-delta.c | 6 ++++++ drivers/input/serio/ams_delta_serio.c | 34 +++++++++++++++++++++------------- 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c index 18e0ff437b27..2119d2d3ba84 100644 --- a/arch/arm/mach-omap1/board-ams-delta.c +++ b/arch/arm/mach-omap1/board-ams-delta.c @@ -504,12 +504,18 @@ static struct platform_device cx20442_codec_device = { .id = -1, }; +static struct platform_device ams_delta_serio_device = { + .name = "ams-delta-serio", + .id = PLATFORM_DEVID_NONE, +}; + static struct platform_device *ams_delta_devices[] __initdata = { &latch1_gpio_device, &latch2_gpio_device, &ams_delta_kp_device, &ams_delta_camera_device, &ams_delta_audio_device, + &ams_delta_serio_device, }; static struct platform_device *late_devices[] __initdata = { diff --git a/drivers/input/serio/ams_delta_serio.c b/drivers/input/serio/ams_delta_serio.c index 3df501c3421b..a2a7fa19bf49 100644 --- a/drivers/input/serio/ams_delta_serio.c +++ b/drivers/input/serio/ams_delta_serio.c @@ -22,15 +22,17 @@ */ #include #include +#include #include #include #include -#include #include #include +#define DRIVER_NAME "ams-delta-serio" + MODULE_AUTHOR("Matt Callow"); MODULE_DESCRIPTION("AMS Delta (E3) keyboard port driver"); MODULE_LICENSE("GPL"); @@ -126,13 +128,10 @@ static const struct gpio ams_delta_gpios[] __initconst_or_module = { }, }; -static int __init ams_delta_serio_init(void) +static int ams_delta_serio_init(struct platform_device *pdev) { int err; - if (!machine_is_ams_delta()) - return -ENODEV; - ams_delta_serio = kzalloc(sizeof(struct serio), GFP_KERNEL); if (!ams_delta_serio) return -ENOMEM; @@ -142,22 +141,22 @@ static int __init ams_delta_serio_init(void) ams_delta_serio->close = ams_delta_serio_close; strlcpy(ams_delta_serio->name, "AMS DELTA keyboard adapter", sizeof(ams_delta_serio->name)); - strlcpy(ams_delta_serio->phys, "GPIO/serio0", + strlcpy(ams_delta_serio->phys, dev_name(&pdev->dev), sizeof(ams_delta_serio->phys)); + ams_delta_serio->dev.parent = &pdev->dev; err = gpio_request_array(ams_delta_gpios, ARRAY_SIZE(ams_delta_gpios)); if (err) { - pr_err("ams_delta_serio: Couldn't request gpio pins\n"); + dev_err(&pdev->dev, "Couldn't request gpio pins\n"); goto serio; } err = request_irq(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK), ams_delta_serio_interrupt, IRQ_TYPE_EDGE_RISING, - "ams-delta-serio", 0); + DRIVER_NAME, 0); if (err < 0) { - pr_err("ams_delta_serio: couldn't request gpio interrupt %d\n", - gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK)); + dev_err(&pdev->dev, "IRQ request failed (%d)\n", err); goto gpio; } /* @@ -179,13 +178,22 @@ static int __init ams_delta_serio_init(void) kfree(ams_delta_serio); return err; } -module_init(ams_delta_serio_init); -static void __exit ams_delta_serio_exit(void) +static int ams_delta_serio_exit(struct platform_device *pdev) { serio_unregister_port(ams_delta_serio); free_irq(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK), 0); gpio_free_array(ams_delta_gpios, ARRAY_SIZE(ams_delta_gpios)); + + return 0; } -module_exit(ams_delta_serio_exit); + +static struct platform_driver ams_delta_serio_driver = { + .probe = ams_delta_serio_init, + .remove = ams_delta_serio_exit, + .driver = { + .name = DRIVER_NAME + }, +}; +module_platform_driver(ams_delta_serio_driver);