From patchwork Wed Jul 3 10:58:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Utsav Agarwal via B4 Relay X-Patchwork-Id: 809594 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D6D55194A61; Wed, 3 Jul 2024 10:58:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720004302; cv=none; b=q/1Xj8XpbOUcj1E8qBTKrElMtSmWifjnouTMVzdLhY/dSFh6fvXATr/BQ4c0+PXWfJVnntYB6sFm/Ysdu1DDuQOUGorGFO/3DD2yXV9Zx0VHzToHZ6KAuINKs5ILvsQ8nFA8lyfzXhakxm4k3slexwKyI7oU74hy7UsPzunHw9Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720004302; c=relaxed/simple; bh=aEuCjWxRkzWwfDTMdgU+LpngRSgkeUQ7WrIWnqmQ1+I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HjAD4mDezL3F1/9u4DKn6Gpwgal2dfxQY56IanPW+858FdFkimJcCiXWp0jYX35vZ+Yl+jMZV47zpNwwL9HUpVu4c/hqV11UIkXH29qyjom2H4NDWW9w1QSNUNLUxfRfGB+FjopSYT640hRLwsTba9eAjXoja5Yr4FZ2YvkQlaQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=I3/JcvEi; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="I3/JcvEi" Received: by smtp.kernel.org (Postfix) with ESMTPS id A048FC4AF0C; Wed, 3 Jul 2024 10:58:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720004302; bh=aEuCjWxRkzWwfDTMdgU+LpngRSgkeUQ7WrIWnqmQ1+I=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=I3/JcvEiwOginYTFAnj+tYCVxSmrkuJ1tk2Vnevrmh0X1MhI3ugqmM4Mop2s7G2DS GABk6/peN/3skwvld22hxvU7G6M20QpqJLlSEV/hZGcFgTYXz5BzR4P+ufEDgpsHpk zMJrRYATd9fjE1DCpYJiv+dGyJ+B1atofDIhUxfx/gLlkO4FhHm1G8zsrIaeWMkFA+ leC2dwZoc81BASnzKQPrV5REufclSUkm7P4Y2nS2jCqL5SudMTFk/6P4f3wVbGDPUJ F6/g/zl8ejre+OW4OmQvpPVrovekF0tHk1RIgHrg4Q2cbcx+615hVxvkbiDXri0Hb1 G/zh7L9iD6TZQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F6F5C30653; Wed, 3 Jul 2024 10:58:22 +0000 (UTC) From: Utsav Agarwal via B4 Relay Date: Wed, 03 Jul 2024 11:58:14 +0100 Subject: [PATCH v5 1/3] iInput: adp5588-keys - use guard notation when acquiring mutexes Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240703-adp5588_gpio_support-v5-1-49fcead0d390@analog.com> References: <20240703-adp5588_gpio_support-v5-0-49fcead0d390@analog.com> In-Reply-To: <20240703-adp5588_gpio_support-v5-0-49fcead0d390@analog.com> To: Utsav Agarwal , Michael Hennerich , Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , =?utf-8?q?Nuno_S=C3=A1?= Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Arturs Artamonovs , Vasileios Bimpikas , Oliver Gaskell X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1720004298; l=4350; i=utsav.agarwal@analog.com; s=20240701; h=from:subject:message-id; bh=mDwNB6wUzoZc6JGCdhyWFTBkDbZltiAbjw3N6y6sDvU=; b=jjBqSWcwnCVzitZS8QoidLwX+c3dn+VHXbdi+9FWtIk/bQ05CH4Ff5URgrqubb75obuhY4T6X spmwdD+N+NZDIUSyhLwXe1W268/QaPs5KuoVnKqVFQaPQ4sfGHDsnqJ X-Developer-Key: i=utsav.agarwal@analog.com; a=ed25519; pk=mIG5Dmd3TO5rcICwTsixl2MoUcf/i2u+jYqifd7+fmI= X-Endpoint-Received: by B4 Relay for utsav.agarwal@analog.com/20240701 with auth_id=178 X-Original-From: Utsav Agarwal Reply-To: utsav.agarwal@analog.com From: Dmitry Torokhov This makes the code more compact and error handling more robust. Signed-off-by: Dmitry Torokhov Acked-by: Michael Hennerich --- drivers/input/keyboard/adp5588-keys.c | 49 ++++++++++++----------------------- 1 file changed, 17 insertions(+), 32 deletions(-) diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c index 1b0279393df4..09bcfc6b9408 100644 --- a/drivers/input/keyboard/adp5588-keys.c +++ b/drivers/input/keyboard/adp5588-keys.c @@ -221,15 +221,13 @@ static int adp5588_gpio_get_value(struct gpio_chip *chip, unsigned int off) unsigned int bit = ADP5588_BIT(kpad->gpiomap[off]); int val; - mutex_lock(&kpad->gpio_lock); + guard(mutex)(&kpad->gpio_lock); if (kpad->dir[bank] & bit) val = kpad->dat_out[bank]; else val = adp5588_read(kpad->client, GPIO_DAT_STAT1 + bank); - mutex_unlock(&kpad->gpio_lock); - return !!(val & bit); } @@ -240,7 +238,7 @@ static void adp5588_gpio_set_value(struct gpio_chip *chip, unsigned int bank = ADP5588_BANK(kpad->gpiomap[off]); unsigned int bit = ADP5588_BIT(kpad->gpiomap[off]); - mutex_lock(&kpad->gpio_lock); + guard(mutex)(&kpad->gpio_lock); if (val) kpad->dat_out[bank] |= bit; @@ -248,8 +246,6 @@ static void adp5588_gpio_set_value(struct gpio_chip *chip, kpad->dat_out[bank] &= ~bit; adp5588_write(kpad->client, GPIO_DAT_OUT1 + bank, kpad->dat_out[bank]); - - mutex_unlock(&kpad->gpio_lock); } static int adp5588_gpio_set_config(struct gpio_chip *chip, unsigned int off, @@ -259,7 +255,6 @@ static int adp5588_gpio_set_config(struct gpio_chip *chip, unsigned int off, unsigned int bank = ADP5588_BANK(kpad->gpiomap[off]); unsigned int bit = ADP5588_BIT(kpad->gpiomap[off]); bool pull_disable; - int ret; switch (pinconf_to_config_param(config)) { case PIN_CONFIG_BIAS_PULL_UP: @@ -272,19 +267,15 @@ static int adp5588_gpio_set_config(struct gpio_chip *chip, unsigned int off, return -ENOTSUPP; } - mutex_lock(&kpad->gpio_lock); + guard(mutex)(&kpad->gpio_lock); if (pull_disable) kpad->pull_dis[bank] |= bit; else kpad->pull_dis[bank] &= bit; - ret = adp5588_write(kpad->client, GPIO_PULL1 + bank, - kpad->pull_dis[bank]); - - mutex_unlock(&kpad->gpio_lock); - - return ret; + return adp5588_write(kpad->client, GPIO_PULL1 + bank, + kpad->pull_dis[bank]); } static int adp5588_gpio_direction_input(struct gpio_chip *chip, unsigned int off) @@ -292,16 +283,11 @@ static int adp5588_gpio_direction_input(struct gpio_chip *chip, unsigned int off struct adp5588_kpad *kpad = gpiochip_get_data(chip); unsigned int bank = ADP5588_BANK(kpad->gpiomap[off]); unsigned int bit = ADP5588_BIT(kpad->gpiomap[off]); - int ret; - mutex_lock(&kpad->gpio_lock); + guard(mutex)(&kpad->gpio_lock); kpad->dir[bank] &= ~bit; - ret = adp5588_write(kpad->client, GPIO_DIR1 + bank, kpad->dir[bank]); - - mutex_unlock(&kpad->gpio_lock); - - return ret; + return adp5588_write(kpad->client, GPIO_DIR1 + bank, kpad->dir[bank]); } static int adp5588_gpio_direction_output(struct gpio_chip *chip, @@ -310,9 +296,9 @@ static int adp5588_gpio_direction_output(struct gpio_chip *chip, struct adp5588_kpad *kpad = gpiochip_get_data(chip); unsigned int bank = ADP5588_BANK(kpad->gpiomap[off]); unsigned int bit = ADP5588_BIT(kpad->gpiomap[off]); - int ret; + int error; - mutex_lock(&kpad->gpio_lock); + guard(mutex)(&kpad->gpio_lock); kpad->dir[bank] |= bit; @@ -321,17 +307,16 @@ static int adp5588_gpio_direction_output(struct gpio_chip *chip, else kpad->dat_out[bank] &= ~bit; - ret = adp5588_write(kpad->client, GPIO_DAT_OUT1 + bank, - kpad->dat_out[bank]); - if (ret) - goto out_unlock; - - ret = adp5588_write(kpad->client, GPIO_DIR1 + bank, kpad->dir[bank]); + error = adp5588_write(kpad->client, GPIO_DAT_OUT1 + bank, + kpad->dat_out[bank]); + if (error) + return error; -out_unlock: - mutex_unlock(&kpad->gpio_lock); + error = adp5588_write(kpad->client, GPIO_DIR1 + bank, kpad->dir[bank]); + if (error) + return error; - return ret; + return 0; } static int adp5588_build_gpiomap(struct adp5588_kpad *kpad) From patchwork Wed Jul 3 10:58:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Utsav Agarwal via B4 Relay X-Patchwork-Id: 810184 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E9319194A63; Wed, 3 Jul 2024 10:58:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720004303; cv=none; b=ucMjnrKXjVw2i8F5nQFiXFOOMiJhDvVr1eMHrZQNZvglKfJrRtZK4uygK7vMP/lPwjMvBusYNkUu2DdLOsSgO2bWdXVC5iqXdGwx2TPWhkbStmNe36kki75NoWyaSqmTJQW8ApcVGCadFqEgonjK4m0osLMn2u9WHX+S+zTBcq0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720004303; c=relaxed/simple; bh=CEs8+DRIeGmiY561Jx5O7M3jRBsDAakbraDmK/LnE38=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=r7iKXT2Ro34yq5GRdC9CoZeMlaYTXpug3IZBnCKDzFvzQzn0RYaolXZdJbrMOs8Tojnwv8gwP+HgjWbBECPmCfJDBYAZXRL92mma3o5qGjc/oo12U41Ss1Z+onCb7vqOmb0IR06QFWmPE0vogJ9nAJ+K7cFeTA/2VUnrbgMHcJY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ERIj6EAf; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ERIj6EAf" Received: by smtp.kernel.org (Postfix) with ESMTPS id B4317C4AF10; Wed, 3 Jul 2024 10:58:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720004302; bh=CEs8+DRIeGmiY561Jx5O7M3jRBsDAakbraDmK/LnE38=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=ERIj6EAf62GA6PxpHTAnqAHl9HFEtlDAT72A4aVJ2m7BRUOlcI//hgTfwgmE/7Q7A /UArRY+6jFUGIqHqw1WJVNiTLl56VukBtwa9JSjwHJrrSNUBm2h3t1o6yan+9263ho 149q+FrlaC+7uB2c6DrQEX0TuEpDrPlFrixjv3L1QWriWkz3DszvMAfWJ2exglOy0L bF92okZiB8327xb1kLL7F3B7JVfp4NjLCfouc+Ax4GObbAfMntR6kfY6RV3XrkBYY5 1NT8qEbSWGpWNU1xzYl601cpzqxQipt+HkozdsXB/HsZNHY0h+JG6JPavrryxr0srz Hp4nncH8JXClA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2F48C3271E; Wed, 3 Jul 2024 10:58:22 +0000 (UTC) From: Utsav Agarwal via B4 Relay Date: Wed, 03 Jul 2024 11:58:15 +0100 Subject: [PATCH v5 2/3] Input: adp5588-keys - add support for pure gpio Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240703-adp5588_gpio_support-v5-2-49fcead0d390@analog.com> References: <20240703-adp5588_gpio_support-v5-0-49fcead0d390@analog.com> In-Reply-To: <20240703-adp5588_gpio_support-v5-0-49fcead0d390@analog.com> To: Utsav Agarwal , Michael Hennerich , Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , =?utf-8?q?Nuno_S=C3=A1?= Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Arturs Artamonovs , Vasileios Bimpikas , Oliver Gaskell X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1720004298; l=1837; i=utsav.agarwal@analog.com; s=20240701; h=from:subject:message-id; bh=klq1Qyb0WqtpIF6DNp6B1Ru2NbKchTFAx0S9eaqYMPw=; b=46q6iaWJTKRlCxyzM6hfyyT1WBMh37c2qgQvk6UGnT26xoQgiQtbEoysYCyRLaafxr61i/IP2 rk0sNi9+nscCJSBXeQq3MrOT+m4kTHBSm2KLreH7tGt6jqCgjf1kxqF X-Developer-Key: i=utsav.agarwal@analog.com; a=ed25519; pk=mIG5Dmd3TO5rcICwTsixl2MoUcf/i2u+jYqifd7+fmI= X-Endpoint-Received: by B4 Relay for utsav.agarwal@analog.com/20240701 with auth_id=178 X-Original-From: Utsav Agarwal Reply-To: utsav.agarwal@analog.com From: Utsav Agarwal Keypad specific setup is relaxed if no keypad rows/columns are specified, enabling a purely gpio operation. Signed-off-by: Utsav Agarwal --- drivers/input/keyboard/adp5588-keys.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c index 09bcfc6b9408..691f5790bc81 100644 --- a/drivers/input/keyboard/adp5588-keys.c +++ b/drivers/input/keyboard/adp5588-keys.c @@ -188,6 +188,7 @@ struct adp5588_kpad { u32 cols; u32 unlock_keys[2]; int nkeys_unlock; + bool gpio_only; unsigned short keycode[ADP5588_KEYMAPSIZE]; unsigned char gpiomap[ADP5588_MAXGPIO]; struct gpio_chip gc; @@ -632,6 +633,21 @@ static int adp5588_fw_parse(struct adp5588_kpad *kpad) struct i2c_client *client = kpad->client; int ret, i; + /* + * Check if the device is to be operated purely in GPIO mode. To do + * so, check that no keypad rows or columns have been specified, + * since all GPINS should be configured as GPIO. + */ + ret = device_property_present(&client->dev, + "keypad,num-rows"); + ret |= device_property_present(&client->dev, + "keypad,num-columns"); + /* If purely GPIO, skip keypad setup */ + if (!ret) { + kpad->gpio_only = true; + return 0; + } + ret = matrix_keypad_parse_properties(&client->dev, &kpad->rows, &kpad->cols); if (ret) @@ -775,6 +791,11 @@ static int adp5588_probe(struct i2c_client *client) if (error) return error; + if (kpad->gpio_only) { + dev_info(&client->dev, "Rev.%d, started as GPIO only\n", revid); + return 0; + } + error = devm_request_threaded_irq(&client->dev, client->irq, adp5588_hard_irq, adp5588_thread_irq, IRQF_TRIGGER_FALLING | IRQF_ONESHOT, From patchwork Wed Jul 3 10:58:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Utsav Agarwal via B4 Relay X-Patchwork-Id: 809593 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EF35019D8A7; Wed, 3 Jul 2024 10:58:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720004303; cv=none; b=LMzOBHJoaUx22Tl4mm+H/Hpn6U+k29aHDcV+uVkTYCX1B9IQQmquR3oZQGIHEbZX6riO7OSL+ZxN/u4WvagiwzOGEUX36vUH1gPjobxX3Z9zIpHI0mmDDuPx0+I19QKqDTfQt6644euBS2YR/tB1FXFp1Os7fFhO6kzTNI4d+vk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720004303; c=relaxed/simple; bh=FUmSJ3hCqUQZpVdVyEjx9kxZ6fyN1xtB8s0g5QGOEwg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=nK2+D1Ao9BVBP2VhCYbogq3r1YSKI3zQ9IIXHcJUWD5AspZ7weNVVKebzV08SfqTghwNyxUe+6F3aI7pZR7aFgEaYlh4ugNZDxJvdUkGBQ0qS+TbomDFtkCnmg3XaYs4xb/YFyfviYCupCmm0YiQz65/E2K+n3vGSZg79ADbbS0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TDW5hu17; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="TDW5hu17" Received: by smtp.kernel.org (Postfix) with ESMTPS id BFF76C4AF14; Wed, 3 Jul 2024 10:58:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720004302; bh=FUmSJ3hCqUQZpVdVyEjx9kxZ6fyN1xtB8s0g5QGOEwg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=TDW5hu17btpZvvBazsa/Pg+npcggsqhGUvVtMg5EDn+FtX0B8bSfkrtS3RO/fTASF ABgXqmlgMlJz+/Xtd60Wu4xsak2vE3RX4A9K/vXvaraACnWexRLBUNprYhjg9TT4XV oN9cH+/64JPcI5xC57Z3KrlxD3L8LEbhSvONXp87+yNKY6u81ugXtPcetv+VCYaX4x yzeDh2/eZNsXhWSME/0ERC6GCIhqr3Hx74NHY8eNMmELapS3UfaZztiTXknHsx/OQY WKE76KmqCXsZxNKtiVSLNX4Dj2DzPIVHlGc+zc13+SjszwGyBdiJInLCbOzAuwj0gS dWAT/6851Lf5w== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id B52E8C31D97; Wed, 3 Jul 2024 10:58:22 +0000 (UTC) From: Utsav Agarwal via B4 Relay Date: Wed, 03 Jul 2024 11:58:16 +0100 Subject: [PATCH v5 3/3] dt-bindings: input: Update dtbinding for adp5588 Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240703-adp5588_gpio_support-v5-3-49fcead0d390@analog.com> References: <20240703-adp5588_gpio_support-v5-0-49fcead0d390@analog.com> In-Reply-To: <20240703-adp5588_gpio_support-v5-0-49fcead0d390@analog.com> To: Utsav Agarwal , Michael Hennerich , Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , =?utf-8?q?Nuno_S=C3=A1?= Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Arturs Artamonovs , Vasileios Bimpikas , Oliver Gaskell X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1720004298; l=2319; i=utsav.agarwal@analog.com; s=20240701; h=from:subject:message-id; bh=tjToYmfL/IEyCDgaXOsMEe4jog3UMGcJT5HUGpTVFL0=; b=mHTnfZZzd4M7OG8aN82knWmCDe4h3Ye/4JzKymjrAuucTMwx+XDs9c9mL2A8SUgrfG2KkNFcg uVEgfOKNmsHAFmnWG41J0MPhCGXbio5m2/Sgq/p/A/AlrTG4X0XDDJ0 X-Developer-Key: i=utsav.agarwal@analog.com; a=ed25519; pk=mIG5Dmd3TO5rcICwTsixl2MoUcf/i2u+jYqifd7+fmI= X-Endpoint-Received: by B4 Relay for utsav.agarwal@analog.com/20240701 with auth_id=178 X-Original-From: Utsav Agarwal Reply-To: utsav.agarwal@analog.com From: Utsav Agarwal Updating dt bindings for adp5588. Since the device can now function in a purely gpio mode, the following keypad specific properties are now made optional: - interrupts - keypad,num-rows - keypad,num-columns - linux,keymap However since the above properties are required to be specified when configuring the device as a keypad, dependencies have been added such that specifying either one would require the remaining as well. Signed-off-by: Utsav Agarwal --- .../devicetree/bindings/input/adi,adp5588.yaml | 33 ++++++++++++++++++---- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/Documentation/devicetree/bindings/input/adi,adp5588.yaml b/Documentation/devicetree/bindings/input/adi,adp5588.yaml index 26ea66834ae2..6c06464f822b 100644 --- a/Documentation/devicetree/bindings/input/adi,adp5588.yaml +++ b/Documentation/devicetree/bindings/input/adi,adp5588.yaml @@ -49,7 +49,10 @@ properties: interrupt-controller: description: This property applies if either keypad,num-rows lower than 8 or - keypad,num-columns lower than 10. + keypad,num-columns lower than 10. This property does not apply if + keypad,num-rows or keypad,num-columns are not specified since the + device then acts as gpio only, during which interrupts are not + utilized. '#interrupt-cells': const: 2 @@ -65,13 +68,15 @@ properties: minItems: 1 maxItems: 2 +dependencies: + keypad,num-rows: ["keypad,num-columns"] + keypad,num-cols: ["keypad,num-rows"] + linux,keymap: ["keypad,num-rows"] + interrupts: ["linux,keymap"] + required: - compatible - reg - - interrupts - - keypad,num-rows - - keypad,num-columns - - linux,keymap unevaluatedProperties: false @@ -108,4 +113,22 @@ examples: >; }; }; + + - | + #include + #include + #include + + i2c { + #address-cells = <1>; + #size-cells = <0>; + gpio@34 { + compatible = "adi,adp5588"; + reg = <0x34>; + + #gpio-cells = <2>; + gpio-controller; + }; + }; + ...