From patchwork Fri Oct 24 17:14:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 5148931 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id CB9489F349 for ; Fri, 24 Oct 2014 17:17:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F0CFE20251 for ; Fri, 24 Oct 2014 17:17:50 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 285862021B for ; Fri, 24 Oct 2014 17:17:50 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XhiSF-0003OP-Tc; Fri, 24 Oct 2014 17:15:11 +0000 Received: from mail-pa0-x22a.google.com ([2607:f8b0:400e:c03::22a]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XhiSB-0002CH-Rh for linux-arm-kernel@lists.infradead.org; Fri, 24 Oct 2014 17:15:08 +0000 Received: by mail-pa0-f42.google.com with SMTP id bj1so1484237pad.15 for ; Fri, 24 Oct 2014 10:14:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=sFLC7QiX5nsv8cBnmDAGtiVXWEBOtV6jD2QRPtOL9ek=; b=mU1zEaIsmKMRI6odSaW5FcRoEpw7sn/Hf1ysc+R+l7r2shNX+3PdQsbWH1AGVn/kk4 yxIc5qDGLDGrT8z6Iu0OxKq+CW8tZtyCeUJR2MIXSyIph5dbSnVTdMsbATGWisEObNGA hOQyZMqj4JZd1xEqM0kcAfb0FvnnkDsZ+okU96M9QGJJlx8WZwThuTibz7jZp2U4uxM+ ShTwkqECYQQM/T+dH/p5+JnP4H+p5osr7Pt52dfn0OngGQwkRFjJ9Suk4HrCF+0BFCEH 7JXnrIL87FtJ7AtGTxyxKWU/zCBoqKippGJsxI7pgh95PAWPvgdsIirbuJFXibBfVI00 pJjA== X-Received: by 10.69.18.65 with SMTP id gk1mr5999801pbd.57.1414170885847; Fri, 24 Oct 2014 10:14:45 -0700 (PDT) Received: from fangorn.rup.mentorg.com (nat-min.mentorg.com. [139.181.32.34]) by mx.google.com with ESMTPSA id yc4sm4380292pab.27.2014.10.24.10.14.43 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 24 Oct 2014 10:14:45 -0700 (PDT) From: Dmitry Eremin-Solenikov To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] ARM: pxa: tosa: switch to gpio-charger Date: Fri, 24 Oct 2014 21:14:22 +0400 Message-Id: <1414170862-17995-1-git-send-email-dbaryshkov@gmail.com> X-Mailer: git-send-email 2.1.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141024_101508_129348_48938229 X-CRM114-Status: GOOD ( 12.46 ) X-Spam-Score: -0.8 (/) Cc: Robert Jarzmik X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Switch to simpler gpio-charger module. PDA power requires additional setup in platform file and is more suited for boards with separate AC and USB charging inputs. Tosa has a unified input, so it's better suited for gpio-charger. Signed-off-by: Dmitry Eremin-Solenikov --- arch/arm/mach-pxa/tosa.c | 41 +++++++---------------------------------- 1 file changed, 7 insertions(+), 34 deletions(-) diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c index c158a6e..7780d1fa 100644 --- a/arch/arm/mach-pxa/tosa.c +++ b/arch/arm/mach-pxa/tosa.c @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include #include @@ -361,44 +361,17 @@ static struct pxaficp_platform_data tosa_ficp_platform_data = { /* * Tosa AC IN */ -static int tosa_power_init(struct device *dev) -{ - int ret = gpio_request(TOSA_GPIO_AC_IN, "ac in"); - if (ret) - goto err_gpio_req; - - ret = gpio_direction_input(TOSA_GPIO_AC_IN); - if (ret) - goto err_gpio_in; - - return 0; - -err_gpio_in: - gpio_free(TOSA_GPIO_AC_IN); -err_gpio_req: - return ret; -} - -static void tosa_power_exit(struct device *dev) -{ - gpio_free(TOSA_GPIO_AC_IN); -} - -static int tosa_power_ac_online(void) -{ - return gpio_get_value(TOSA_GPIO_AC_IN) == 0; -} - static char *tosa_ac_supplied_to[] = { "main-battery", "backup-battery", "jacket-battery", }; -static struct pda_power_pdata tosa_power_data = { - .init = tosa_power_init, - .is_ac_online = tosa_power_ac_online, - .exit = tosa_power_exit, +static struct gpio_charger_platform_data tosa_power_data = { + .name = "charger", + .type = POWER_SUPPLY_TYPE_MAINS, + .gpio = TOSA_GPIO_AC_IN, + .gpio_active_low = 1, .supplied_to = tosa_ac_supplied_to, .num_supplicants = ARRAY_SIZE(tosa_ac_supplied_to), }; @@ -415,7 +388,7 @@ static struct resource tosa_power_resource[] = { }; static struct platform_device tosa_power_device = { - .name = "pda-power", + .name = "gpio-charger", .id = -1, .dev.platform_data = &tosa_power_data, .resource = tosa_power_resource,