From patchwork Thu Jul 4 10:45:45 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: 810176 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 7E55018C38; Thu, 4 Jul 2024 10:45:55 +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=1720089955; cv=none; b=Zv1nDcsBcfD2lNZxy6QtcPabnjk3X/joAaywjcuGKvhBOSzlyOmh5NW9e6Gj+YD03XBJS4E8dtO6OQRcg9zpRFem/hkXhf0duTbZAS4EGcy3SJcuVZkkILXG0dx/uBt9tA15dSR6VAxxTFY7Rwn5IimckE6Vkv7sVFvTfu6pWcE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720089955; c=relaxed/simple; bh=aEuCjWxRkzWwfDTMdgU+LpngRSgkeUQ7WrIWnqmQ1+I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=eILzQIqvQ4OMFP/qeoIPxlF8VZLU7puYLvAk97/w53wAP5kSGRV880l4lpWDvG6Pv/yY5Xnd3BSDAoZevtS9ubJfrZGpJE43QLLJB8tw5SHTPzptWv4KZPA2u6Q9LrPjEinfeXC/mRkP/JKWHB5/vgvnHww6V48+vZIjIok5Nes= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=oZCXHma8; 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="oZCXHma8" Received: by smtp.kernel.org (Postfix) with ESMTPS id 319FDC3277B; Thu, 4 Jul 2024 10:45:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720089955; bh=aEuCjWxRkzWwfDTMdgU+LpngRSgkeUQ7WrIWnqmQ1+I=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=oZCXHma8X0v2ZqaXm1d72CBuy/dhQLiE5EUXnUtS9w07ZKlTHz/aLi7OuB6s7P7yK YK9Lg/F6uUeLOzuDjTSbwXDN0JvZBb549CW8UhThxpryIrjciKbabXNV32uX3/9jUO Wg84fxp04UTmuhPfAxWscl3bEC2Uzqjvg2yEtznHyLqmoxdMOR0PG9cKm3hnwZad6r +JymznQPGC+tjk4AUMCpTfpi0rZK2TO0+ZZcmmECxwOVkkTY2IenHs58ACHaTwF7eU nh/I/UQDvKH61OxZudOUGactmNZuLhZwCuTSmPt9mMvNeLimD+a2cH8kt0j/QzkLSR kPyQ9eKMRBJCA== 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 16708C31D97; Thu, 4 Jul 2024 10:45:55 +0000 (UTC) From: Utsav Agarwal via B4 Relay Date: Thu, 04 Jul 2024 11:45:45 +0100 Subject: [PATCH v6 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: <20240704-adp5588_gpio_support-v6-1-cb65514d714b@analog.com> References: <20240704-adp5588_gpio_support-v6-0-cb65514d714b@analog.com> In-Reply-To: <20240704-adp5588_gpio_support-v6-0-cb65514d714b@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=1720089949; l=4350; i=utsav.agarwal@analog.com; s=20240701; h=from:subject:message-id; bh=mDwNB6wUzoZc6JGCdhyWFTBkDbZltiAbjw3N6y6sDvU=; b=fp77fv9CMZIcvWcZxj1Sd5gU3xEZNdoJYHIalijVnOa9yZ6FkPguacFJv1rLbZn9nCN4xZqgv hCcY0wVqsXGDvRVHuvtxz6paMpW4LjFLoncXnBy2kpONjn+vQav4d54 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 Thu Jul 4 10:45:46 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: 810175 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 7E5A01A0AED; Thu, 4 Jul 2024 10:45:55 +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=1720089955; cv=none; b=qRVt/cNAxJtcbrKJZpp6D3YASpGapHgG62PG4H15snVG5tkIUdHnZHPOyrsSexjmDH7P58SZMg8wx2dihkmQNjlxcaHoPfWC3n1JGwxUdBIXev4maTX70IkrrK9gDQyzSwJrBVDQw2gooDTc/P25BUVx2RJ6kVeuOOrcxUp4Zso= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720089955; c=relaxed/simple; bh=Lvvrrd7mYjOlQxC3TN6pgCaiOiNL8DLaS982MVUlJBQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=r+9aOh7aFSZUJn0dJ3f7/SkwJjKMvB9u/dWeIT7nIBPc53ew2J7qO/ejz9whPVUWWtpJAPYgBE2bdYY49JhMQK/e44arzEB1GhfTunTE4E9/74cpSfdp8dXcxXfddbyYxMfvAQNOV8I7cV9SUeF3fGBf6jqwb4dFF0cVz6Io1VA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ebO1yfGc; 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="ebO1yfGc" Received: by smtp.kernel.org (Postfix) with ESMTPS id 3E460C4AF0E; Thu, 4 Jul 2024 10:45:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720089955; bh=Lvvrrd7mYjOlQxC3TN6pgCaiOiNL8DLaS982MVUlJBQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=ebO1yfGc72lm0agkjiEbG/DymwuoQ7OgoPzDDFCR4kWgdHo3HWrNArSZkGKUOdMqB C7czhLB83M15IDW9LYGti0SRoLW7BdQrm58s/A0m+Z+lgAh0S5oOpXGhAR65Uo6ZX7 eIE29i5wPu7yVbGWdbbCsQns2tEL5z5zd399dnBmY9gX2Vi1R/1ST5Htcfksu6hmgV nlArC6DTljcEn0ExrwZGB0hegzqNrAIJ5e10flOIlTRei5kkRF3+/jcXul1M2KDC0z DBdvZRUh5Ey/qA1TRQOPADSO/KW2aI/tbVJSmCeBhPqmt7IVpOG05je7wdDdPf+IOp lVWAJYRUxlTsQ== 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 2EDCDC38150; Thu, 4 Jul 2024 10:45:55 +0000 (UTC) From: Utsav Agarwal via B4 Relay Date: Thu, 04 Jul 2024 11:45:46 +0100 Subject: [PATCH v6 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: <20240704-adp5588_gpio_support-v6-2-cb65514d714b@analog.com> References: <20240704-adp5588_gpio_support-v6-0-cb65514d714b@analog.com> In-Reply-To: <20240704-adp5588_gpio_support-v6-0-cb65514d714b@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=1720089949; l=2182; i=utsav.agarwal@analog.com; s=20240701; h=from:subject:message-id; bh=RLvbAKclXYThmpc9z3NjA2d/lPg83Ijm1bN8oVwBbz8=; b=c7lQA6euh/Nx5PmNJOAwwb0pAOQ+h2u3neUxFTbLPvvxiqvY983gzqdBExD+WxEJEaGswnJQf +p2+TJJQAAUAus/rMuo9ufD/wad50rjb0K5tIFE1uTTH3mo0P2YJRFi 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 | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c index 09bcfc6b9408..572335c8ef0f 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 && !client->irq) { + 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, @@ -785,6 +806,12 @@ static int adp5588_probe(struct i2c_client *client) return error; } + if (kpad->gpio_only) { + dev_info(&client->dev, "Rev.%d GPIO only, irq %d\n", + revid, client->irq); + return 0; + } + dev_info(&client->dev, "Rev.%d keypad, irq %d\n", revid, client->irq); return 0; } From patchwork Thu Jul 4 10:45:47 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: 810510 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 AB4D01AC225; Thu, 4 Jul 2024 10:45:55 +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=1720089955; cv=none; b=IrZLpNKbccPGgPnzzKfiZG1ERGE+pLbpTU+JqYkTOEG0nPiQadeHs4Du60h97XNyJeyeAiI7xnEm+jGfIh09XxvD47Nie4JoMTUfZN6bAHYjMdpaPW/ME4Zkvp3WdUJ8/96VTjWNNdxiqoDEAQhHf2DTb+rGXIBG41m0qbrmavo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720089955; c=relaxed/simple; bh=btyKYgKxulxcREhhqyKc6sMNH2B3Tv+O/a65GEtdop4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jOOTf9n6WKX8rMChNPw0gcNo9UGLiDg0qS7ORlEDlL7Ewp1IrUIRa8iU8U0SvYXRhCDdR3nrqFzzSuW/7RZIt611VLnuLYaES/YB234v0pXSFtadU6TgEZYS4YKYf//Uia9XDa6DXqT77+UkIEkFR/ieYmd21urG61vbRdet8eE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qpD4FRDA; 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="qpD4FRDA" Received: by smtp.kernel.org (Postfix) with ESMTPS id 5764BC4AF15; Thu, 4 Jul 2024 10:45:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720089955; bh=btyKYgKxulxcREhhqyKc6sMNH2B3Tv+O/a65GEtdop4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=qpD4FRDAbaVyvUL/OXOGxR0hLGQj29pj8wdUTnFugmEB4wuBeZ+MqMPSoNk13G+J6 NaHjT+LC3d5o9HjWABcT5GrmU2WrNoyykLTDQsotiPZEjqKqphT75v6JBamNpm+EeS jhhfxFuvVrBNv94HXUQiEj3IXloIwL4yfbLfSz9qnUXbXq34WvuelXQJx3Y31t+3z8 b6VKAsHJkNUqsHvIfMGiaxKDqwh9SPzSFrgYO/gMOqVBFC+oEBjiyv8cU/wICvN/tF YfwoyllG8ZW7x7x9TJ3h8WJ08sgoQIqFNyrpw2pEwTzPOo9/8erkSB8b9+tIWzu/XK g3h6YSerc51cw== 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 413B4C30653; Thu, 4 Jul 2024 10:45:55 +0000 (UTC) From: Utsav Agarwal via B4 Relay Date: Thu, 04 Jul 2024 11:45:47 +0100 Subject: [PATCH v6 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: <20240704-adp5588_gpio_support-v6-3-cb65514d714b@analog.com> References: <20240704-adp5588_gpio_support-v6-0-cb65514d714b@analog.com> In-Reply-To: <20240704-adp5588_gpio_support-v6-0-cb65514d714b@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=1720089949; l=2563; i=utsav.agarwal@analog.com; s=20240701; h=from:subject:message-id; bh=OMFJbwEMECu/NabLGM/jlM9LLkgSio9rGjjfimXDvFE=; b=w0DRxFawt5rT6euOYCLq1XMbhrD5o5CR6egqwE3Z8jaR5wHjnStjwzeRHKnnOUyTEs7tgo1y9 itLHk6X5J2EDnrPtnP2KYEtaQ4CRBUidUsu1i3e5QykvmyzcVk/LDRh 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 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. Note that interrupts are optional, but required when the device has been configured in keypad mode. Signed-off-by: Utsav Agarwal --- .../devicetree/bindings/input/adi,adp5588.yaml | 46 +++++++++++++++++++--- 1 file changed, 41 insertions(+), 5 deletions(-) diff --git a/Documentation/devicetree/bindings/input/adi,adp5588.yaml b/Documentation/devicetree/bindings/input/adi,adp5588.yaml index 26ea66834ae2..83d1fe19e300 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 is optional if + keypad,num-rows or keypad,num-columns are not specified since the + device then acts as gpio only, during which interrupts may or may + not be utilized. '#interrupt-cells': const: 2 @@ -65,13 +68,28 @@ properties: minItems: 1 maxItems: 2 + +dependencies: + keypad,num-rows: + - linux,keymap + - keypad,num-columns + keypad,num-columns: + - linux,keymap + - keypad,num-rows + linux,keymap: + - keypad,num-rows + - keypad,num-columns + +if: + required: + - linux,keymap +then: + required: + - interrupts + required: - compatible - reg - - interrupts - - keypad,num-rows - - keypad,num-columns - - linux,keymap unevaluatedProperties: false @@ -108,4 +126,22 @@ examples: >; }; }; + + - | + #include + #include + #include + + i2c { + #address-cells = <1>; + #size-cells = <0>; + gpio@34 { + compatible = "adi,adp5588"; + reg = <0x34>; + + #gpio-cells = <2>; + gpio-controller; + }; + }; + ...