From patchwork Tue Nov 16 19:39:36 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Gardiner X-Patchwork-Id: 329081 Received: from comal.ext.ti.com (comal.ext.ti.com [198.47.26.152]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oAGJgxRv030477 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 16 Nov 2010 19:43:21 GMT Received: from dlep34.itg.ti.com ([157.170.170.115]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id oAGJewko005087 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 16 Nov 2010 13:40:58 -0600 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep34.itg.ti.com (8.13.7/8.13.7) with ESMTP id oAGJetRu011994; Tue, 16 Nov 2010 13:40:56 -0600 (CST) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 8E4AD80635; Tue, 16 Nov 2010 13:40:18 -0600 (CST) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp53.itg.ti.com (dflp53.itg.ti.com [128.247.5.6]) by linux.omap.com (Postfix) with ESMTP id 3A6B180627 for ; Tue, 16 Nov 2010 13:39:44 -0600 (CST) Received: from neches.ext.ti.com (localhost [127.0.0.1]) by dflp53.itg.ti.com (8.13.8/8.13.8) with ESMTP id oAGJdhmp003513 for ; Tue, 16 Nov 2010 13:39:43 -0600 (CST) Received: from psmtp.com (na3sys009amx186.postini.com [74.125.149.167]) by neches.ext.ti.com (8.13.7/8.13.7) with SMTP id oAGJdh7q022345 for ; Tue, 16 Nov 2010 13:39:43 -0600 Received: from source ([74.125.149.73]) by na3sys009amx186.postini.com ([74.125.148.10]) with SMTP; Tue, 16 Nov 2010 11:39:43 PST Received: from source ([209.85.212.52]) by na3sys009aob104.postini.com ([74.125.148.12]) with SMTP ID DSNKTOLd/7B51YZqgnkgQGkE4Myj3JizMGFz@postini.com; Tue, 16 Nov 2010 11:39:43 PST Received: by mail-vw0-f52.google.com with SMTP id 3so552212vws.25 for ; Tue, 16 Nov 2010 11:39:43 -0800 (PST) Received: by 10.220.182.196 with SMTP id cd4mr1758236vcb.223.1289936382665; Tue, 16 Nov 2010 11:39:42 -0800 (PST) Received: from localhost.localdomain ([206.191.47.130]) by mx.google.com with ESMTPS id j13sm457716vcr.41.2010.11.16.11.39.41 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 16 Nov 2010 11:39:42 -0800 (PST) From: Ben Gardiner To: Kevin Hilman , davinci-linux-open-source@linux.davincidsp.com, linux-input@vger.kernel.org, Dmitry Torokhov Subject: [PATCH v2 3/4] da850-evm: extract defines for SEL{A, B, C} pins in UI expander Date: Tue, 16 Nov 2010 14:39:36 -0500 Message-Id: X-Mailer: git-send-email 1.7.0.4 In-Reply-To: References: X-pstn-neptune: 0/0/0.00/0 X-pstn-levels: (S:99.90000/99.90000 CV:99.9000 FC:95.5390 LC:95.5390 R:95.9108 P:95.9108 M:97.0282 C:98.6951 ) X-pstn-settings: 2 (0.5000:0.0750) s cv GT3 gt2 gt1 r p m c X-pstn-addresses: from [db-null] Cc: Paul Mundt , linux-kernel@vger.kernel.org, Alexander Clouter , Chris Cordahi X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: davinci-linux-open-source-bounces@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com X-Greylist: Sender succeeded STARTTLS authentication, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Tue, 16 Nov 2010 19:43:24 +0000 (UTC) diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c index ff71ffd..dcf21e5 100644 --- a/arch/arm/mach-davinci/board-da850-evm.c +++ b/arch/arm/mach-davinci/board-da850-evm.c @@ -292,6 +292,9 @@ static const char const *ui_expander_names[] = { "pb7", "pb6", "pb5", "pb4", "pb3", "pb2", "pb1" }; +#define DA850_SEL_A_OFFSET 7 +#define DA850_SEL_B_OFFSET 6 +#define DA850_SEL_C_OFFSET 5 #define DA850_UI_PB8_OFFSET 8 #define DA850_N_UI_PB 8 @@ -336,23 +339,23 @@ static int da850_evm_ui_expander_setup(struct i2c_client *client, unsigned gpio, { int sel_a, sel_b, sel_c, ret; - sel_a = gpio + 7; - sel_b = gpio + 6; - sel_c = gpio + 5; + sel_a = gpio + DA850_SEL_A_OFFSET; + sel_b = gpio + DA850_SEL_B_OFFSET; + sel_c = gpio + DA850_SEL_C_OFFSET; - ret = gpio_request(sel_a, "sel_a"); + ret = gpio_request(sel_a, ui_expander_names[DA850_SEL_A_OFFSET]); if (ret) { pr_warning("Cannot open UI expander pin %d\n", sel_a); goto exp_setup_sela_fail; } - ret = gpio_request(sel_b, "sel_b"); + ret = gpio_request(sel_b, ui_expander_names[DA850_SEL_B_OFFSET]); if (ret) { pr_warning("Cannot open UI expander pin %d\n", sel_b); goto exp_setup_selb_fail; } - ret = gpio_request(sel_c, "sel_c"); + ret = gpio_request(sel_c, ui_expander_names[DA850_SEL_C_OFFSET]); if (ret) { pr_warning("Cannot open UI expander pin %d\n", sel_c); goto exp_setup_selc_fail; @@ -396,13 +399,13 @@ static int da850_evm_ui_expander_teardown(struct i2c_client *client, platform_device_unregister(&user_ui_pb_gpio_key_device); /* deselect all functionalities */ - gpio_set_value(gpio + 5, 1); - gpio_set_value(gpio + 6, 1); - gpio_set_value(gpio + 7, 1); + gpio_set_value(gpio + DA850_SEL_C_OFFSET, 1); + gpio_set_value(gpio + DA850_SEL_B_OFFSET, 1); + gpio_set_value(gpio + DA850_SEL_A_OFFSET, 1); - gpio_free(gpio + 5); - gpio_free(gpio + 6); - gpio_free(gpio + 7); + gpio_free(gpio + DA850_SEL_C_OFFSET); + gpio_free(gpio + DA850_SEL_B_OFFSET); + gpio_free(gpio + DA850_SEL_A_OFFSET); return 0; }