From patchwork Mon Aug 29 11:26:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 9303653 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 47F40601C0 for ; Mon, 29 Aug 2016 11:30:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 37CFC2868E for ; Mon, 29 Aug 2016 11:30:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2C78728778; Mon, 29 Aug 2016 11:30:37 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8F3162868E for ; Mon, 29 Aug 2016 11:30:34 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1beKkM-0002dl-8u; Mon, 29 Aug 2016 11:28:58 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:3201:214:fdff:fe10:1be6]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1beKij-0001Xp-Ur for linux-arm-kernel@lists.infradead.org; Mon, 29 Aug 2016 11:27:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2014; h=Date:Sender:Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References:In-Reply-To; bh=P+DQC4prud+n/tmfIwsSzTcD8LltSuC16vuooMwywIc=; b=LfrExNy1EVtoeyQ/xROdLmfReMWZpQzNIoA800LfvKUkq2GS9+9hMBLgk0fTXHJpvI1HGc/aTU4xOD7xFsT7TGbgNt/vt+kt4KSN295Zv9oRRrqNcHUX56/KLnO3JR2bP/YhYmOzEuuHG6h6A8GZnS1oDBUBx71PtQ6TXmggKII=; Received: from e0022681537dd.dyn.armlinux.org.uk ([2002:4e20:1eda:1:222:68ff:fe15:37dd]:54064 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1beKi6-0004H9-CV; Mon, 29 Aug 2016 12:26:38 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1beKhz-0001HH-Di; Mon, 29 Aug 2016 12:26:31 +0100 In-Reply-To: <20160829112540.GF1041@n2100.armlinux.org.uk> References: <20160829112540.GF1041@n2100.armlinux.org.uk> From: Russell King To: dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org Subject: [PATCH 6/8] ARM: sa1100/collie: switch collie IrDA to use gpiod APIs MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Mon, 29 Aug 2016 12:26:31 +0100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160829_042718_511064_B6BB06C0 X-CRM114-Status: GOOD ( 14.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vinod Koul , Dan Williams , Samuel Ortiz 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 Switch the IrDA code to use the gpiod APIs rather than platform data with function callbacks. Signed-off-by: Russell King --- arch/arm/mach-sa1100/collie.c | 40 ++++++++++++---------------------------- 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c index 3cc2b71e16f0..8ed0cbfaa0f4 100644 --- a/arch/arm/mach-sa1100/collie.c +++ b/arch/arm/mach-sa1100/collie.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -97,35 +98,16 @@ static struct mcp_plat_data collie_mcp_data = { .codec_pdata = &collie_ucb1x00_data, }; -static int collie_ir_startup(struct device *dev) -{ - int rc = gpio_request(COLLIE_GPIO_IR_ON, "IrDA"); - if (rc) - return rc; - rc = gpio_direction_output(COLLIE_GPIO_IR_ON, 1); - - if (!rc) - return 0; - - gpio_free(COLLIE_GPIO_IR_ON); - return rc; -} - -static void collie_ir_shutdown(struct device *dev) -{ - gpio_free(COLLIE_GPIO_IR_ON); -} - -static int collie_ir_set_power(struct device *dev, unsigned int state) -{ - gpio_set_value(COLLIE_GPIO_IR_ON, !state); - return 0; -} - static struct irda_platform_data collie_ir_data = { - .startup = collie_ir_startup, - .shutdown = collie_ir_shutdown, - .set_power = collie_ir_set_power, +}; + +/* IrDA GPIO mappings */ +static struct gpiod_lookup_table collie_irda_gpio_table = { + .dev_id = "sa11x0-ir", + .table = { + GPIO_LOOKUP("ucb1x00", 3, "ir-power", GPIO_ACTIVE_LOW), + { }, + }, }; /* @@ -357,6 +339,8 @@ static void __init collie_init(void) { int ret = 0; + gpiod_add_lookup_table(&collie_irda_gpio_table); + /* cpu initialize */ GAFR = GPIO_SSP_TXD | GPIO_SSP_SCLK | GPIO_SSP_SFRM | GPIO_SSP_CLK | GPIO_MCP_CLK | GPIO_32_768kHz;