From patchwork Wed Jul 20 14:48:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mattijs Korpershoek X-Patchwork-Id: 592274 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2752BC433EF for ; Wed, 20 Jul 2022 14:48:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235197AbiGTOso (ORCPT ); Wed, 20 Jul 2022 10:48:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235140AbiGTOsm (ORCPT ); Wed, 20 Jul 2022 10:48:42 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 317FD51A3A for ; Wed, 20 Jul 2022 07:48:41 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id bk26so26455204wrb.11 for ; Wed, 20 Jul 2022 07:48:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:date:subject:mime-version:content-transfer-encoding:message-id :references:in-reply-to:to:cc; bh=bLWM+s+iR5LdVaHPuafu7iCm3mwz2NHAzkIzkY8xmTY=; b=3o97zfA5+8dQXwtwy7pQ9pIIsD5FJ3qzv88L5rTytIICFhHWbxdWnJ9vUD26bICVLZ b4WQu8J+7rgfsC3O53slfyN9BObsbC0xNBezoPWL6JvxhPsCac/td0xgxZAAV2A6TtyA 4fLEJ1TIJRgwWxfwo+JPQdzaQiqGUbTZbTFh57fmlNNc7wH3Am48OgcX1yT5GO2Ph5ep jLuFQRALqw50jBJQb7SNOjZbTZkmbsZP7i7I2SZ8jlE20tl3ya59X7uUoVYLB/OxgXWY YVKnie59wwIK2I5VIWeQ+ESe12NplRAeK0z7sxIO0TGu4ZME7CKjxHvvEgNtfeuQeO2c 1JMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:date:subject:mime-version :content-transfer-encoding:message-id:references:in-reply-to:to:cc; bh=bLWM+s+iR5LdVaHPuafu7iCm3mwz2NHAzkIzkY8xmTY=; b=RQR93RAtSOfUxwiW7XoXL+wJO4/Kc8WQTlkKP8V0dTKSwSJYjX+Jn0utPYE7a4rRpX unn8HMiUar2iRr7ChP54VXbk4oM7idyigm7OwChbfLoOJ7abcozLtTYueqsiiStKZwAE Ft13kRHWxlVrgaNj1/HW8z9Y9xVZZQaMPshUXvpWJsnOZAlNmpq5wZ+cCLmesufbvFvh ndirIsAIUZoW38SCfy0kyvdNJLAtpU2QrJ4NWqVqh781tLBQk+qR+SrRthhyIbeTMC8S RaNbs/hN2RRX+fs8Ux6JbzsB1zI0ysIeScporV3xJAsamgkdLoqoJ8MDxP1dXkZD30Kj 5TBw== X-Gm-Message-State: AJIora/BTAXMhA/A/C08NLHaxcwvi4rl2WTB119IQhp5i//l5eL7PuXz 1xiw9c08jcyU/pAMSc9zL3vm1A== X-Google-Smtp-Source: AGRyM1uqyELZOTi1y1+BWMg0rNkGod1uVK9t35VqzqBXcj/DigJ522rSj8SmtDKiiJo4GtoMoIymsA== X-Received: by 2002:a5d:6110:0:b0:21e:4fe4:f7ba with SMTP id v16-20020a5d6110000000b0021e4fe4f7bamr727919wrt.69.1658328519755; Wed, 20 Jul 2022 07:48:39 -0700 (PDT) Received: from [127.0.1.1] ([2a01:cb19:85e6:1900:c639:22f8:bed9:44dd]) by smtp.gmail.com with ESMTPSA id f8-20020a05600c4e8800b003a31673515bsm3321121wmq.7.2022.07.20.07.48.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Jul 2022 07:48:39 -0700 (PDT) From: Mattijs Korpershoek Date: Wed, 20 Jul 2022 16:48:37 +0200 Subject: [PATCH v1 1/6] MAINTAINERS: input: add mattijs for mt6779-keypad MIME-Version: 1.0 Message-Id: <20220720-mt8183-keypad-v1-1-ef9fc29dbff4@baylibre.com> References: <20220720-mt8183-keypad-v1-0-ef9fc29dbff4@baylibre.com> In-Reply-To: <20220720-mt8183-keypad-v1-0-ef9fc29dbff4@baylibre.com> To: Rob Herring , Krzysztof Kozlowski , Mattijs Korpershoek , Dmitry Torokhov , Matthias Brugger Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, Fabien Parent , devicetree@vger.kernel.org, linux-mediatek@lists.infradead.org, Fabien Parent , linux-arm-kernel@lists.infradead.org X-Mailer: b4 0.10.0-dev-54fef Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org As stated in [1]: Fengping has no longer interest and time to maintain this driver so he agreed to transfer maintainership over to me. Add a dedicated maintainer entry as well for the driver to make sure that I can help with patch reviews. [1] https://lore.kernel.org/r/20220421140255.2781505-1-mkorpershoek@baylibre.com Signed-off-by: Mattijs Korpershoek diff --git a/MAINTAINERS b/MAINTAINERS index 264e7a72afd6..f7a0bae74dc8 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -12771,6 +12771,12 @@ S: Supported F: Documentation/devicetree/bindings/media/mediatek-jpeg-*.yaml F: drivers/media/platform/mediatek/jpeg/ +MEDIATEK KEYPAD DRIVER +M: Mattijs Korpershoek +S: Supported +F: Documentation/devicetree/bindings/input/mediatek,mt6779-keypad.yaml +F: drivers/input/keyboard/mt6779-keypad.c + MEDIATEK MDP DRIVER M: Minghsiu Tsai M: Houlong Wei From patchwork Wed Jul 20 14:48:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mattijs Korpershoek X-Patchwork-Id: 592272 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08DB5CCA480 for ; Wed, 20 Jul 2022 14:48:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237308AbiGTOs4 (ORCPT ); Wed, 20 Jul 2022 10:48:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237346AbiGTOsv (ORCPT ); Wed, 20 Jul 2022 10:48:51 -0400 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F2FF5004D for ; Wed, 20 Jul 2022 07:48:44 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id z13so6895319wro.13 for ; Wed, 20 Jul 2022 07:48:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:date:subject:mime-version:content-transfer-encoding:message-id :references:in-reply-to:to:cc; bh=gQDJGZNgsqUtHpgMiFLZZA7/paFhPF+yVUYXcvVHSs4=; b=jWvb+ECCiickXJZCiLpfv+eAtXoL6RKmAzIinxV0NAV2ZFpFUzjSQMTGWH/ioJk54c WM+yJ0qYotLbZ7Ab3S4p4q5VPrOKdDw0IPyh6RKGkePFugxfcSfoLCKKVrhhZdLIbHYA YuKYzPBjY3Mo/28Q0U8+5FNBFkMy9YFyHVaDl+wjUAR267zKJlGW7I0dpgzcvYvvaQz6 hKNBJz+CjbSJIp08nXtstVcxHE9BbQoA0WHlxZ9RWMEnCJlNY1tEMvAlfQIIJs31Khos witQDQ4775d0nxnh1BEviyI9PFhUz0t+fYPBaaO8a3avTfMXnpfMB0fvNGG5w2/id6yg JkMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:date:subject:mime-version :content-transfer-encoding:message-id:references:in-reply-to:to:cc; bh=gQDJGZNgsqUtHpgMiFLZZA7/paFhPF+yVUYXcvVHSs4=; b=SJb2lQBXj1GBXFgOKNJBH04ejSknwYpTV90vGee91XtKdtetk2I8WKU2AUJrE4Mp2x e1ludK2iYLDuhOvdIjbD8TC181PpqnmvEBvDQqhWze9MOHkcYBRo4uOk7ovjKlE5yVlS OpQ5qbBAfHlP1oLy1pqXc1buxUjn4jpIi8T+RzZlpBUfm5PMI1Ye6RjPV6wmRhWgc6nF RXAvCWM2KhVwhT5wIKwJvxP9Ryb9fgcO35uYATsrvfgnwJ3S5pC37iBK87YLQTXQKAbF xSsVxKkR/iqUr184w5nQuaKUVOu0XlHwSUsQFkqSIQQGgplqhDh+zqfpgPg/nyNMrFb1 cxqA== X-Gm-Message-State: AJIora9gexnFzrX5Q7CrxXoNJBDnRzqIiEiou8iIEyq9ka0bJPeKyTOE ZcdtYM2xZSFmGTItWAWup+TT+Q== X-Google-Smtp-Source: AGRyM1vhz6wly+GUBEO58Zqu+ASDQ0cB1MEncpppa77b4G7K6pbiuEC/CLbU03zVZ2Y8w2dFJns6HA== X-Received: by 2002:a5d:64e2:0:b0:21d:38e8:2497 with SMTP id g2-20020a5d64e2000000b0021d38e82497mr29420012wri.142.1658328522069; Wed, 20 Jul 2022 07:48:42 -0700 (PDT) Received: from [127.0.1.1] ([2a01:cb19:85e6:1900:c639:22f8:bed9:44dd]) by smtp.gmail.com with ESMTPSA id f8-20020a05600c4e8800b003a31673515bsm3321121wmq.7.2022.07.20.07.48.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Jul 2022 07:48:41 -0700 (PDT) From: Mattijs Korpershoek Date: Wed, 20 Jul 2022 16:48:40 +0200 Subject: [PATCH v1 4/6] Input: mt6779-keypad - support double keys matrix MIME-Version: 1.0 Message-Id: <20220720-mt8183-keypad-v1-4-ef9fc29dbff4@baylibre.com> References: <20220720-mt8183-keypad-v1-0-ef9fc29dbff4@baylibre.com> In-Reply-To: <20220720-mt8183-keypad-v1-0-ef9fc29dbff4@baylibre.com> To: Rob Herring , Krzysztof Kozlowski , Mattijs Korpershoek , Dmitry Torokhov , Matthias Brugger Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, Fabien Parent , devicetree@vger.kernel.org, linux-mediatek@lists.infradead.org, Fabien Parent , linux-arm-kernel@lists.infradead.org X-Mailer: b4 0.10.0-dev-54fef Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org MediaTek keypad has 2 modes of detecting key events: - single key: each (row, column) can detect one key - double key: each (row, column) is a group of 2 keys Double key support exists to minimize cost, since it reduces the number of pins required for physical keys. Double key is configured by setting BIT(0) of the KP_SEL register. Enable double key matrix support based on the mediatek,double-keys device tree property. Signed-off-by: Mattijs Korpershoek diff --git a/drivers/input/keyboard/mt6779-keypad.c b/drivers/input/keyboard/mt6779-keypad.c index bf447bf598fb..9a5dbd415dac 100644 --- a/drivers/input/keyboard/mt6779-keypad.c +++ b/drivers/input/keyboard/mt6779-keypad.c @@ -18,6 +18,7 @@ #define MTK_KPD_DEBOUNCE_MASK GENMASK(13, 0) #define MTK_KPD_DEBOUNCE_MAX_MS 256 #define MTK_KPD_SEL 0x0020 +#define MTK_KPD_SEL_DOUBLE_KP_MODE BIT(0) #define MTK_KPD_SEL_COL GENMASK(15, 10) #define MTK_KPD_SEL_ROW GENMASK(9, 4) #define MTK_KPD_SEL_COLMASK(c) GENMASK((c) + 9, 10) @@ -31,6 +32,7 @@ struct mt6779_keypad { struct clk *clk; u32 n_rows; u32 n_cols; + bool double_keys; DECLARE_BITMAP(keymap_state, MTK_KPD_NUM_BITS); }; @@ -67,8 +69,13 @@ static irqreturn_t mt6779_keypad_irq_handler(int irq, void *dev_id) continue; key = bit_nr / 32 * 16 + bit_nr % 32; - row = key / 9; - col = key % 9; + if (keypad->double_keys) { + row = key / 13; + col = (key % 13) / 2; + } else { + row = key / 9; + col = key % 9; + } scancode = MATRIX_SCAN_CODE(row, col, row_shift); /* 1: not pressed, 0: pressed */ @@ -150,6 +157,8 @@ static int mt6779_keypad_pdrv_probe(struct platform_device *pdev) wakeup = device_property_read_bool(&pdev->dev, "wakeup-source"); + keypad->double_keys = device_property_read_bool(&pdev->dev, "mediatek,double-keys"); + dev_dbg(&pdev->dev, "n_row=%d n_col=%d debounce=%d\n", keypad->n_rows, keypad->n_cols, debounce); @@ -166,6 +175,10 @@ static int mt6779_keypad_pdrv_probe(struct platform_device *pdev) regmap_write(keypad->regmap, MTK_KPD_DEBOUNCE, (debounce * (1 << 5)) & MTK_KPD_DEBOUNCE_MASK); + if (keypad->double_keys) + regmap_update_bits(keypad->regmap, MTK_KPD_SEL, + MTK_KPD_SEL_DOUBLE_KP_MODE, MTK_KPD_SEL_DOUBLE_KP_MODE); + regmap_update_bits(keypad->regmap, MTK_KPD_SEL, MTK_KPD_SEL_ROW, MTK_KPD_SEL_ROWMASK(keypad->n_rows)); regmap_update_bits(keypad->regmap, MTK_KPD_SEL, MTK_KPD_SEL_COL, From patchwork Wed Jul 20 14:48:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mattijs Korpershoek X-Patchwork-Id: 592273 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7ACCEC43334 for ; Wed, 20 Jul 2022 14:48:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237229AbiGTOsu (ORCPT ); Wed, 20 Jul 2022 10:48:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236076AbiGTOsr (ORCPT ); Wed, 20 Jul 2022 10:48:47 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D97152883 for ; Wed, 20 Jul 2022 07:48:43 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id u5so3417919wrm.4 for ; Wed, 20 Jul 2022 07:48:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:date:subject:mime-version:content-transfer-encoding:message-id :references:in-reply-to:to:cc; bh=VGUb9DmOvoGv8nh5rqV1xHbR9kL6IKYbqd/qwv1q+CA=; b=jRL5JcT9oKaeo7HwZrYobK/YmXLf7T2OTvQbB+5Tt4Ej73xiicgN2WuAV9zlw2rEKj gBD1wR+vAFAyQ36BarOC42aGFh0Z+CUVKmoz8jocS+Sr1oFSoZdpIpLnfx+p6ZO2A1ou AAcutHoNxH3HiLedSavddURbO+/DeoJdbuK1UKbsYvq/AEfupOK/Luj7ZiWHbwkOSZy2 aHRgAVTfYYziWX4EbaYfxDteMDi0fDZibAkzqfnGLqb6TtdUDY9XJZimypikQHHkA/RS HwXgTHe4cGSkZD6UzZkh/rw9pNfYj2qyAa5Grv7CnZLvskr1FGDTqRsjvNQ4XaQ9hQ0Y SVRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:date:subject:mime-version :content-transfer-encoding:message-id:references:in-reply-to:to:cc; bh=VGUb9DmOvoGv8nh5rqV1xHbR9kL6IKYbqd/qwv1q+CA=; b=16R22Bc9EoTib3usRGnSfLVYudoPeF0xkr8K2ccm856dXGlQ0tl9hACM+XmVL+l4aZ znhJ2r+4gGfy8AwP6pwKoqHMM6T6r8SbDj+YqUvH0DuyIX5o2g9tQ29kZLCH8mG1UuBX poSv6K6ul4+Ym9ZjgwEoe49JdoOFvjzLqqpPT5VejLUH45umEHMA0gUuBGV+7v0WqcjH NQDDCW5S7tXNsR2ZQc0HFXx7Jdn1/EP7Vq9F52VqPdsfHoe5PfDVbFtKIDUpFr3Gv2MI Tdp5njmGQCSpTCxvfK0byeQZlMVDAOOIk4orTtEgWRjE2KEwtG5ZLRYnDHboGJNxUj7B /G2Q== X-Gm-Message-State: AJIora+jjRhDukkQt8Hnag7r+EJLMjdOqdQAYqorfxxeD1nVcbCCvd4j TeGJbPGF764sofGiHS4FzNRP9g== X-Google-Smtp-Source: AGRyM1vTy640y2iV3Q5noFGBYMKVc349uYWye3eyUbUhWj27qZA/i9aPmd4vKm57vaVf4wNmnxmupw== X-Received: by 2002:a5d:648a:0:b0:21d:b684:9c76 with SMTP id o10-20020a5d648a000000b0021db6849c76mr30956265wri.463.1658328522794; Wed, 20 Jul 2022 07:48:42 -0700 (PDT) Received: from [127.0.1.1] ([2a01:cb19:85e6:1900:c639:22f8:bed9:44dd]) by smtp.gmail.com with ESMTPSA id f8-20020a05600c4e8800b003a31673515bsm3321121wmq.7.2022.07.20.07.48.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Jul 2022 07:48:42 -0700 (PDT) From: Mattijs Korpershoek Date: Wed, 20 Jul 2022 16:48:41 +0200 Subject: [PATCH v1 5/6] arm64: dts: mediatek: mt8183: add keyboard node MIME-Version: 1.0 Message-Id: <20220720-mt8183-keypad-v1-5-ef9fc29dbff4@baylibre.com> References: <20220720-mt8183-keypad-v1-0-ef9fc29dbff4@baylibre.com> In-Reply-To: <20220720-mt8183-keypad-v1-0-ef9fc29dbff4@baylibre.com> To: Rob Herring , Krzysztof Kozlowski , Mattijs Korpershoek , Dmitry Torokhov , Matthias Brugger Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, Fabien Parent , devicetree@vger.kernel.org, linux-mediatek@lists.infradead.org, Fabien Parent , linux-arm-kernel@lists.infradead.org X-Mailer: b4 0.10.0-dev-54fef Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org From: Fabien Parent MT8183 has an on-SoC keyboard controller commonly used for volume up/down buttons. List it in the SoC dts so that boards can enable/use it. Signed-off-by: Fabien Parent Signed-off-by: Mattijs Korpershoek diff --git a/arch/arm64/boot/dts/mediatek/mt8183.dtsi b/arch/arm64/boot/dts/mediatek/mt8183.dtsi index 9d32871973a2..9d8fdebaabe3 100644 --- a/arch/arm64/boot/dts/mediatek/mt8183.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8183.dtsi @@ -943,6 +943,15 @@ pwrap: pwrap@1000d000 { clock-names = "spi", "wrap"; }; + keyboard: keyboard@10010000 { + compatible = "mediatek,mt6779-keypad"; + reg = <0 0x10010000 0 0x1000>; + interrupts = ; + clocks = <&clk26m>; + clock-names = "kpd"; + status = "disabled"; + }; + scp: scp@10500000 { compatible = "mediatek,mt8183-scp"; reg = <0 0x10500000 0 0x80000>,