From patchwork Mon Aug 5 01:47:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 13753061 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 51D64C3DA7F for ; Mon, 5 Aug 2024 01:48:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=WwJabViyOwOqlsyuvl72Ko23CJ5ZXu78YeavmKzmGHg=; b=lhEskKpVpbiMded6PhXw8jlDWb OtmSrlB+rwSHFH6nDV2loyjXzrpSDwSknZnwhiGHV5uEQ8/Rw3g/G0vU5Gfi6oiESjPc1HKFJWZhP rlztvbnxTjsZGgOkzUsdNkZrq4hT5619VJlKpsxgveFfT/8gRM1TNxC+txPOgvLmjQCe82GXi7yX1 jzWsK2wWSwjH/t233Tn8jkyuM4uYbyefXlTqXPHPF+GhjEp43H9Rqc0F2ka38MNpitKviO9Npz3LH irOZ9TeOjKBjCrOGqY6Ul1daWN9z+TX1D1+0i3D5izZVvlfyAWfc9wNGFz1KS033xu027DmupY3Iw XHY3WjXQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sampx-0000000EKe1-2Ynq; Mon, 05 Aug 2024 01:48:37 +0000 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1samol-0000000EKGp-2DB9 for linux-arm-kernel@lists.infradead.org; Mon, 05 Aug 2024 01:47:24 +0000 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1fc47abc040so64948525ad.0 for ; Sun, 04 Aug 2024 18:47:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722822442; x=1723427242; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WwJabViyOwOqlsyuvl72Ko23CJ5ZXu78YeavmKzmGHg=; b=NzCbhZHl46xVL9+j4wTBidZ0slA4X3U+tAtD1+fP7tpcMBZl9AcgHB2X4EN83m87Oz d0Gg37lWqPCgzgkZo1dHcCkPDu2Cvc27jOjLiRJ0loN8wN5//yRbEGyf1t6HohCwlxqj lmuKB329927b0+aoBZOwYGvorRn1/FnPD1qSM5yXhysTEbDk+pE/sFWlvWuiFpKS2a2P ruuh5EZ2m9eub2fqlUKSE+jnMC0UrJRPT4l6Ba9cskficnY/Vs5nCiKLQqC0hlMpEX+v nYlaOoiAfjFjCBw1AGzvCbOpoNkPcnHPTUp+s+4i8Ivi2A6MmHrIt8AVI2DCSOtbW/F1 ITNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722822442; x=1723427242; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WwJabViyOwOqlsyuvl72Ko23CJ5ZXu78YeavmKzmGHg=; b=ZPQdrZowkxm9Uzc3FIFAvwZtEIyVZ0i7IYlsvwCnC5pixY0dvK6ui5JnXnkcSZteZD e/n0YTLvkEN3da2B/EV9/KQenptJfxIMM39T0n8zdLRZb21PUQkLrgccsTYWVAv72VGi bGhdEO9IgP6N1+wqiYNVtErxVSVgAhgHAkiLdISgYkBnzctxXuCfBEN4ztnwaxHhYoeu qsVVJZnuiVC8SBGRp7qEOR7Fuxmc+4oSCHG9PxnjOKmhB/EhVTYMpW7BLGfn6V7f4GDO wlKB26655EkB3YtG/A3cN5Ok+WYCGDgZx23kWzpCOU+V38lyLqz4fOAi7Vji9ZIAVD0I kOhQ== X-Gm-Message-State: AOJu0Yw4b5HRCvcrJ65qbr1NWImRWzDsWp1UF7ZbA4kmoP0fmaKZ0fxV xLWZECPbqlOB73d/79CVc7smPwM3aBW6bQjoCfFQRKhkuFjslrKa X-Google-Smtp-Source: AGHT+IGqwFPnuoOcmLqV0N/ujzd8JY77yP2Twv7LpGxD6AnhEF82wcYDFjWQijLX+wgx8uEDkpH7hg== X-Received: by 2002:a17:902:db0b:b0:1ff:6715:70f7 with SMTP id d9443c01a7336-1ff67158218mr47347265ad.28.1722822442416; Sun, 04 Aug 2024 18:47:22 -0700 (PDT) Received: from dtor-ws.sjc.corp.google.com ([2620:15c:9d:2:22e4:17a:28a:7497]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ff59295790sm55836015ad.261.2024.08.04.18.47.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Aug 2024 18:47:22 -0700 (PDT) From: Dmitry Torokhov To: Haojian Zhuang , Daniel Mack , Robert Jarzmik , Arnd Bergmann , Linus Walleij , soc@kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org Subject: [PATCH 1/5] Input: matrix_keypad - remove support for clustered interrupt Date: Sun, 4 Aug 2024 18:47:04 -0700 Message-ID: <20240805014710.1961677-2-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.46.0.rc2.264.g509ed76dc8-goog In-Reply-To: <20240805014710.1961677-1-dmitry.torokhov@gmail.com> References: <20240805014710.1961677-1-dmitry.torokhov@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240804_184723_588813_634C5D60 X-CRM114-Status: GOOD ( 20.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org There are no users of this functionality in the mainline kernel (it was only available to boards using platform data and not device tree). Remove it to simplify the code. Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/matrix_keypad.c | 61 ++++++++++---------------- 1 file changed, 22 insertions(+), 39 deletions(-) diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c index 7a56f3d3aacd..604e90d13ed0 100644 --- a/drivers/input/keyboard/matrix_keypad.c +++ b/drivers/input/keyboard/matrix_keypad.c @@ -29,7 +29,6 @@ struct matrix_keypad { unsigned int row_shift; unsigned int row_irqs[MATRIX_MAX_ROWS]; - unsigned int num_row_irqs; DECLARE_BITMAP(wakeup_enabled_irqs, MATRIX_MAX_ROWS); uint32_t last_key_state[MATRIX_MAX_COLS]; @@ -88,7 +87,7 @@ static void enable_row_irqs(struct matrix_keypad *keypad) { int i; - for (i = 0; i < keypad->num_row_irqs; i++) + for (i = 0; i < keypad->pdata->num_row_gpios; i++) enable_irq(keypad->row_irqs[i]); } @@ -96,7 +95,7 @@ static void disable_row_irqs(struct matrix_keypad *keypad) { int i; - for (i = 0; i < keypad->num_row_irqs; i++) + for (i = 0; i < keypad->pdata->num_row_gpios; i++) disable_irq_nosync(keypad->row_irqs[i]); } @@ -225,7 +224,8 @@ static void matrix_keypad_enable_wakeup(struct matrix_keypad *keypad) { int i; - for_each_clear_bit(i, keypad->wakeup_enabled_irqs, keypad->num_row_irqs) + for_each_clear_bit(i, keypad->wakeup_enabled_irqs, + keypad->pdata->num_row_gpios) if (enable_irq_wake(keypad->row_irqs[i]) == 0) __set_bit(i, keypad->wakeup_enabled_irqs); } @@ -234,7 +234,8 @@ static void matrix_keypad_disable_wakeup(struct matrix_keypad *keypad) { int i; - for_each_set_bit(i, keypad->wakeup_enabled_irqs, keypad->num_row_irqs) { + for_each_set_bit(i, keypad->wakeup_enabled_irqs, + keypad->pdata->num_row_gpios) { disable_irq_wake(keypad->row_irqs[i]); __clear_bit(i, keypad->wakeup_enabled_irqs); } @@ -302,48 +303,30 @@ static int matrix_keypad_init_gpio(struct platform_device *pdev, gpio_direction_input(pdata->row_gpios[i]); } - if (pdata->clustered_irq > 0) { + for (i = 0; i < pdata->num_row_gpios; i++) { + irq = gpio_to_irq(pdata->row_gpios[i]); + if (irq < 0) { + err = irq; + dev_err(&pdev->dev, + "Unable to convert GPIO line %i to irq: %d\n", + pdata->row_gpios[i], err); + return err; + } + err = devm_request_any_context_irq(&pdev->dev, - pdata->clustered_irq, + irq, matrix_keypad_interrupt, - pdata->clustered_irq_flags, + IRQF_TRIGGER_RISING | + IRQF_TRIGGER_FALLING, "matrix-keypad", keypad); if (err < 0) { dev_err(&pdev->dev, - "Unable to acquire clustered interrupt\n"); + "Unable to acquire interrupt for GPIO line %i\n", + pdata->row_gpios[i]); return err; } - keypad->row_irqs[0] = pdata->clustered_irq; - keypad->num_row_irqs = 1; - } else { - for (i = 0; i < pdata->num_row_gpios; i++) { - irq = gpio_to_irq(pdata->row_gpios[i]); - if (irq < 0) { - err = irq; - dev_err(&pdev->dev, - "Unable to convert GPIO line %i to irq: %d\n", - pdata->row_gpios[i], err); - return err; - } - - err = devm_request_any_context_irq(&pdev->dev, - irq, - matrix_keypad_interrupt, - IRQF_TRIGGER_RISING | - IRQF_TRIGGER_FALLING, - "matrix-keypad", keypad); - if (err < 0) { - dev_err(&pdev->dev, - "Unable to acquire interrupt for GPIO line %i\n", - pdata->row_gpios[i]); - return err; - } - - keypad->row_irqs[i] = irq; - } - - keypad->num_row_irqs = pdata->num_row_gpios; + keypad->row_irqs[i] = irq; } /* initialized as disabled - enabled by input->open */