From patchwork Fri Nov 24 09:30:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 119562 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp1952292qgn; Fri, 24 Nov 2017 01:30:57 -0800 (PST) X-Google-Smtp-Source: AGs4zMazsrJrFETtC2/oiqewUxZcxH9TRh7Rfv3/gdBDVunEzxXrKpNRG/7Ffw9b8RMQbd6hFPT3 X-Received: by 10.101.81.67 with SMTP id g3mr27250531pgq.262.1511515857836; Fri, 24 Nov 2017 01:30:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511515857; cv=none; d=google.com; s=arc-20160816; b=gZ4JqbG1vPH/9X+zS91bf/j9QPiUBfWaglekw0Jy4gAffal6wboYGph+SRCwazhS7P 7uBDyNdLLyjQJbaA9Kmne+uIyjVv0lPA2OtnBgns6hBism6EpYonccuJwkXLmwSoJc9f Ruv3B5jZ3qCwIkDq299tDOgqSjOAwaLB0JBVRNQ1EQN4TVh8ILlMgCulRBVK2oC92Uv/ cA5gXot2rgoL04iDxtiF15wkB0U6wB7TyYa1CqaBlAZJHqK54FyAALTd3HZfmeSVQj3b SCf97g6ToCrKWbPYtOjKmJyIw57KrUNJbtPWQ44109WHGhQc5j+Ytboe/bQ3e+1nLTNO kDgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=k0goBvPbWcOAdM95ODYSzRb94HnmeVJ48z75QSoN8Yg=; b=BRa3dchJFeuoG4XbQy6jbA3fUmUfQNVe0Edwu7IApdNq82Ypx8nQZsBsAYV+bmr7z3 Odnkirq3FovSXnhG+8jqFnVf43OE58QZ3Jybu4+W8FI3aQIjJReTUHfh9Hkx/r2nYfJh +2XDl9D/DdO41P+hMKNUai79obsozofL2mbYDlxsq1PAsEEJj9vR6e+teJTZoAaVtkcN uyIoCQwpSXXzQaOgxVJBqrToUI+OIg8Q7Gm6MpCZoAXkdX5df4SGtBOqhhHSjTM7erEr fBHhI3Eocuyv4nz+ZmbNu2TgxWxi/CB3RLghTxUsHy4yET+/2F9GrLnGl5ZyhyL3D/7Y oErA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=JcV7sica; spf=pass (google.com: best guess record for domain of linux-input-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-input-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u86si19793425pfg.173.2017.11.24.01.30.57 for ; Fri, 24 Nov 2017 01:30:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-input-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=JcV7sica; spf=pass (google.com: best guess record for domain of linux-input-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-input-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752935AbdKXJa4 (ORCPT ); Fri, 24 Nov 2017 04:30:56 -0500 Received: from mail-lf0-f66.google.com ([209.85.215.66]:39681 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752688AbdKXJa4 (ORCPT ); Fri, 24 Nov 2017 04:30:56 -0500 Received: by mail-lf0-f66.google.com with SMTP id x76so20102268lfb.6 for ; Fri, 24 Nov 2017 01:30:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xFL0cCmj3jzdG7ZmbOu+d9yCkniP2YUrU6RBdNJ2KiQ=; b=JcV7sicamyQxrl/Uwd6yEfwcUXHRb+Vx4KuJoNvm0zNyzxUR/UMv8VIx1jES1/C67O JKei4X2utT7TR1xp0zWyH1kidxYdfOvJnszHN7H5g0o8eFw+H7TQm6vGz+ZD9+1BoOXY TJilmDlND5/fA08CJOQiESIh02PGIC/oJO7Ww= 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=xFL0cCmj3jzdG7ZmbOu+d9yCkniP2YUrU6RBdNJ2KiQ=; b=QQKrlbyJO5hqisODl+LAQdD3CavCqvlvlXFhunWLKJ+9b7RarIgmdCyUExqZIZokyZ NInJzi/yQyItIt9zuPN4qn5V4lF6gvd3f6TanUc4dfRAG1h893Rqa0z94bRfBmC9HoOR 7An/H5K4q5zGbf/LJqA0zhv82CXsPMVxx761xUBFbeCpWsDpmZFOWvwRkEJqzCZbjNXu weyCayln/uTjaKFek1KBc2VTMSdE1nYD9UIEz33wELNth17FPAZe5EPyM8KzXux7zbfG WIFYKZbAP12CpLyd7f7Xd4HVfwB4tLhwHSHQaCPTLGq2sOqNey4Ma67GGC0DN3Cro3UY otkg== X-Gm-Message-State: AJaThX7aGKf9n6+IiJh5k5ITHvRJUmS308e9smaVISpCQgZZ9TVBrzYM jgeV/qFxXSyjuhwNWRXzbyNqHA== X-Received: by 10.46.95.28 with SMTP id t28mr10007120ljb.110.1511515854357; Fri, 24 Nov 2017 01:30:54 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id 19sm4476608ljx.58.2017.11.24.01.30.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Nov 2017 01:30:53 -0800 (PST) From: Linus Walleij To: Dmitry Torokhov , linux-input@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Linus Walleij Subject: [PATCH 3/5] ARM: davinci: Switch DA850EVM to use GPIO descriptors Date: Fri, 24 Nov 2017 10:30:43 +0100 Message-Id: <20171124093045.5961-4-linus.walleij@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171124093045.5961-1-linus.walleij@linaro.org> References: <20171124093045.5961-1-linus.walleij@linaro.org> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org To get rid of the global GPIO numberspace we need to move to using descriptor tables with local offsets on the GPIO chip to reference the GPIO lines used by kernel drivers. This moves the DaVinci DA850EVM board over to using GPIO descriptors for passing GPIOs to the GPIO keys. Signed-off-by: Linus Walleij --- arch/arm/mach-davinci/board-da850-evm.c | 57 ++++++++++++++++++++++++++++----- 1 file changed, 49 insertions(+), 8 deletions(-) -- 2.14.3 -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c index cbde0030c092..3792d760020f 100644 --- a/arch/arm/mach-davinci/board-da850-evm.c +++ b/arch/arm/mach-davinci/board-da850-evm.c @@ -404,11 +404,9 @@ static const char * const da850_evm_ui_exp[] = { static struct gpio_keys_button da850_evm_ui_keys[] = { [0 ... DA850_N_UI_PB - 1] = { .type = EV_KEY, - .active_low = 1, .wakeup = 0, .debounce_interval = DA850_KEYS_DEBOUNCE_MS, .code = -1, /* assigned at runtime */ - .gpio = -1, /* assigned at runtime */ .desc = NULL, /* assigned at runtime */ }, }; @@ -427,6 +425,29 @@ static struct platform_device da850_evm_ui_keys_device = { }, }; +static struct gpiod_lookup_table da850_evm_ui_keys_gpios_table = { + .dev_id = "gpio-keys-polled", + .table = { + GPIO_LOOKUP("tca6416-20", DA850_EVM_UI_EXP_PB8, + "pb8", GPIO_ACTIVE_LOW), + GPIO_LOOKUP("tca6416-20", DA850_EVM_UI_EXP_PB7, + "pb7", GPIO_ACTIVE_LOW), + GPIO_LOOKUP("tca6416-20", DA850_EVM_UI_EXP_PB6, + "pb6", GPIO_ACTIVE_LOW), + GPIO_LOOKUP("tca6416-20", DA850_EVM_UI_EXP_PB5, + "pb5", GPIO_ACTIVE_LOW), + GPIO_LOOKUP("tca6416-20", DA850_EVM_UI_EXP_PB4, + "pb4", GPIO_ACTIVE_LOW), + GPIO_LOOKUP("tca6416-20", DA850_EVM_UI_EXP_PB3, + "pb3", GPIO_ACTIVE_LOW), + GPIO_LOOKUP("tca6416-20", DA850_EVM_UI_EXP_PB2, + "pb2", GPIO_ACTIVE_LOW), + GPIO_LOOKUP("tca6416-20", DA850_EVM_UI_EXP_PB1, + "pb1", GPIO_ACTIVE_LOW), + + }, +}; + static void da850_evm_ui_keys_init(unsigned gpio) { int i; @@ -436,8 +457,8 @@ static void da850_evm_ui_keys_init(unsigned gpio) button = &da850_evm_ui_keys[i]; button->code = KEY_F8 - i; button->desc = da850_evm_ui_exp[DA850_EVM_UI_EXP_PB8 + i]; - button->gpio = gpio + DA850_EVM_UI_EXP_PB8 + i; } + gpiod_add_lookup_table(&da850_evm_ui_keys_gpios_table); } #ifdef CONFIG_DA850_UI_SD_VIDEO_PORT @@ -572,21 +593,17 @@ static const char * const da850_evm_bb_exp[] = { static struct gpio_keys_button da850_evm_bb_keys[] = { [0] = { .type = EV_KEY, - .active_low = 1, .wakeup = 0, .debounce_interval = DA850_KEYS_DEBOUNCE_MS, .code = KEY_PROG1, .desc = NULL, /* assigned at runtime */ - .gpio = -1, /* assigned at runtime */ }, [1 ... DA850_N_BB_USER_SW] = { .type = EV_SW, - .active_low = 1, .wakeup = 0, .debounce_interval = DA850_KEYS_DEBOUNCE_MS, .code = -1, /* assigned at runtime */ .desc = NULL, /* assigned at runtime */ - .gpio = -1, /* assigned at runtime */ }, }; @@ -604,6 +621,30 @@ static struct platform_device da850_evm_bb_keys_device = { }, }; +static struct gpiod_lookup_table da850_evm_bb_keys_gpios_table = { + .dev_id = "gpio-keys-polled", + .table = { + GPIO_LOOKUP("tca6416-21", DA850_EVM_BB_EXP_USER_PB1, + "user_pb1", GPIO_ACTIVE_LOW), + GPIO_LOOKUP("tca6416-21", DA850_EVM_BB_EXP_USER_SW1, + "user_sw1", GPIO_ACTIVE_LOW), + GPIO_LOOKUP("tca6416-21", DA850_EVM_BB_EXP_USER_SW2, + "user_sw2", GPIO_ACTIVE_LOW), + GPIO_LOOKUP("tca6416-21", DA850_EVM_BB_EXP_USER_SW3, + "user_sw3", GPIO_ACTIVE_LOW), + GPIO_LOOKUP("tca6416-21", DA850_EVM_BB_EXP_USER_SW4, + "user_sw4", GPIO_ACTIVE_LOW), + GPIO_LOOKUP("tca6416-21", DA850_EVM_BB_EXP_USER_SW5, + "user_sw5", GPIO_ACTIVE_LOW), + GPIO_LOOKUP("tca6416-21", DA850_EVM_BB_EXP_USER_SW6, + "user_sw6", GPIO_ACTIVE_LOW), + GPIO_LOOKUP("tca6416-21", DA850_EVM_BB_EXP_USER_SW7, + "user_sw7", GPIO_ACTIVE_LOW), + GPIO_LOOKUP("tca6416-21", DA850_EVM_BB_EXP_USER_SW8, + "user_sw8", GPIO_ACTIVE_LOW), + }, +}; + static void da850_evm_bb_keys_init(unsigned gpio) { int i; @@ -617,8 +658,8 @@ static void da850_evm_bb_keys_init(unsigned gpio) button = &da850_evm_bb_keys[i + 1]; button->code = SW_LID + i; button->desc = da850_evm_bb_exp[DA850_EVM_BB_EXP_USER_SW1 + i]; - button->gpio = gpio + DA850_EVM_BB_EXP_USER_SW1 + i; } + gpiod_add_lookup_table(&da850_evm_bb_keys_gpios_table); } #define DA850_N_BB_USER_LED 2