From patchwork Fri Nov 19 11:19:18 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sekhar Nori X-Patchwork-Id: 339111 Received: from devils.ext.ti.com (devils.ext.ti.com [198.47.26.153]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oAJBMDTJ007894 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 19 Nov 2010 11:22:35 GMT Received: from dlep35.itg.ti.com ([157.170.170.118]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id oAJBJRme017491 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 19 Nov 2010 05:19:27 -0600 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep35.itg.ti.com (8.13.7/8.13.7) with ESMTP id oAJBJRZ5002348; Fri, 19 Nov 2010 05:19:27 -0600 (CST) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 3073F80627; Fri, 19 Nov 2010 05:19:27 -0600 (CST) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dbdp20.itg.ti.com (dbdp20.itg.ti.com [172.24.170.38]) by linux.omap.com (Postfix) with ESMTP id 50FC880626 for ; Fri, 19 Nov 2010 05:19:24 -0600 (CST) Received: from dbde70.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id oAJBJKhi013060; Fri, 19 Nov 2010 16:49:20 +0530 (IST) Received: from dbde02.ent.ti.com ([172.24.170.145]) by dbde70.ent.ti.com ([172.24.170.148]) with mapi; Fri, 19 Nov 2010 16:49:20 +0530 From: "Nori, Sekhar" To: Ben Gardiner , Kevin Hilman , "davinci-linux-open-source@linux.davincidsp.com" , "linux-input@vger.kernel.org" , Dmitry Torokhov Date: Fri, 19 Nov 2010 16:49:18 +0530 Subject: RE: [PATCH v2 3/4] da850-evm: extract defines for SEL{A, B, C} pins in UI expander Thread-Topic: [PATCH v2 3/4] da850-evm: extract defines for SEL{A, B, C} pins in UI expander Thread-Index: AcuFxjZ0LyPbXqW5T56Bls+tgjoTuwCE43uQ Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 Cc: Chris Cordahi , Paul Mundt , "linux-kernel@vger.kernel.org" , Alexander Clouter 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: , 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]); Fri, 19 Nov 2010 11:22:35 +0000 (UTC) diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c index dcf21e5..508e5f2 100644 --- a/arch/arm/mach-davinci/board-da850-evm.c +++ b/arch/arm/mach-davinci/board-da850-evm.c @@ -287,16 +287,35 @@ static inline void da850_evm_setup_emac_rmii(int rmii_sel) { } /* No need to poll switches anywhere near as fast */ #define DA850_SW_POLL_MS 700 -static const char const *ui_expander_names[] = { - "dgnd", "dgnd", "dgnd", "dgnd", "nc", "sel_c", "sel_b", "sel_a", "pb8", - "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 +static enum da850_evm_ui_exp_pins { + DA850_EVM_UI_EXP_SEL_C = 5, + DA850_EVM_UI_EXP_SEL_B, + DA850_EVM_UI_EXP_SEL_A, + DA850_EVM_UI_EXP_PB8, + DA850_EVM_UI_EXP_PB7, + DA850_EVM_UI_EXP_PB6, + DA850_EVM_UI_EXP_PB5, + DA850_EVM_UI_EXP_PB4, + DA850_EVM_UI_EXP_PB3, + DA850_EVM_UI_EXP_PB2, + DA850_EVM_UI_EXP_PB1, +}; + +static const char const *da850_evm_ui_exp[] = { + [DA850_EVM_UI_EXP_SEL_C] = "sel_c", + [DA850_EVM_UI_EXP_SEL_B] = "sel_b", + [DA850_EVM_UI_EXP_SEL_A] = "sel_a", + [DA850_EVM_UI_EXP_PB8] = "pb8", + [DA850_EVM_UI_EXP_PB7] = "pb7", + [DA850_EVM_UI_EXP_PB6] = "pb6", + [DA850_EVM_UI_EXP_PB5] = "pb5", + [DA850_EVM_UI_EXP_PB4] = "pb4", + [DA850_EVM_UI_EXP_PB3] = "pb3", + [DA850_EVM_UI_EXP_PB2] = "pb2", + [DA850_EVM_UI_EXP_PB1] = "pb1", +}; + +#define DA850_N_UI_PB 8 static struct gpio_keys_button user_ui_pbs_gpio_keys[DA850_N_UI_PB]; @@ -329,8 +348,8 @@ static void da850_ui_pushbuttons_init(unsigned gpio) button->wakeup = 0; button->debounce_interval = DA850_PB_DEBOUNCE_MS; button->desc = (char *) - ui_expander_names[DA850_UI_PB8_OFFSET + i]; - button->gpio = gpio + DA850_UI_PB8_OFFSET + i; + da850_evm_ui_exp[DA850_EVM_UI_EXP_PB8 + i]; + button->gpio = gpio + DA850_EVM_UI_EXP_PB8 + i; } } @@ -339,23 +358,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 + DA850_SEL_A_OFFSET; - sel_b = gpio + DA850_SEL_B_OFFSET; - sel_c = gpio + DA850_SEL_C_OFFSET; + sel_a = gpio + DA850_EVM_UI_EXP_SEL_A; + sel_b = gpio + DA850_EVM_UI_EXP_SEL_B; + sel_c = gpio + DA850_EVM_UI_EXP_SEL_C; - ret = gpio_request(sel_a, ui_expander_names[DA850_SEL_A_OFFSET]); + ret = gpio_request(sel_a, da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_A]); if (ret) { pr_warning("Cannot open UI expander pin %d\n", sel_a); goto exp_setup_sela_fail; } - ret = gpio_request(sel_b, ui_expander_names[DA850_SEL_B_OFFSET]); + ret = gpio_request(sel_b, da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_B]); if (ret) { pr_warning("Cannot open UI expander pin %d\n", sel_b); goto exp_setup_selb_fail; } - ret = gpio_request(sel_c, ui_expander_names[DA850_SEL_C_OFFSET]); + ret = gpio_request(sel_c, da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_B]); if (ret) { pr_warning("Cannot open UI expander pin %d\n", sel_c); goto exp_setup_selc_fail; @@ -399,13 +418,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 + DA850_SEL_C_OFFSET, 1); - gpio_set_value(gpio + DA850_SEL_B_OFFSET, 1); - gpio_set_value(gpio + DA850_SEL_A_OFFSET, 1); + gpio_set_value(gpio + DA850_EVM_UI_EXP_SEL_C, 1); + gpio_set_value(gpio + DA850_EVM_UI_EXP_SEL_B, 1); + gpio_set_value(gpio + DA850_EVM_UI_EXP_SEL_A, 1); - gpio_free(gpio + DA850_SEL_C_OFFSET); - gpio_free(gpio + DA850_SEL_B_OFFSET); - gpio_free(gpio + DA850_SEL_A_OFFSET); + gpio_free(gpio + DA850_EVM_UI_EXP_SEL_C); + gpio_free(gpio + DA850_EVM_UI_EXP_SEL_B); + gpio_free(gpio + DA850_EVM_UI_EXP_SEL_A); return 0; } @@ -414,7 +433,7 @@ static struct pca953x_platform_data da850_evm_ui_expander_info = { .gpio_base = DAVINCI_N_GPIO, .setup = da850_evm_ui_expander_setup, .teardown = da850_evm_ui_expander_teardown, - .names = ui_expander_names, + .names = da850_evm_ui_exp, }; static struct i2c_board_info __initdata da850_evm_i2c_devices[] = {