From patchwork Fri Jul 2 13:43:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mattijs Korpershoek X-Patchwork-Id: 12356129 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 542F1C11F68 for ; Fri, 2 Jul 2021 13:45:46 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 289CE6142B for ; Fri, 2 Jul 2021 13:45:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 289CE6142B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=HW9gMFmQQhrWfTo4YBVQfM8uvws4cVSDxECtah3A+4o=; b=Zv5FxZWlkadME4 KZjsc1JwwO2x97GsLJjrkwl+B2u82+rHHdBugOw+sVnrdnEZLeTFPF+MzlJQZVKEDWn9A+ZcTmDpR ctLBB1Htyz7RVow5uKlMmmuwlox5a/gk10+JdJ3N4kD5tvvsd0hClSmHJRcHEtnIMT1m9mBu70c5U MCazivp6v4ejDGIb+4Jm5zQWP6cD6lfFF91ILHbpHg5kbfsF3UQA97Sk+onWbb1GI5wPd4klLBTb6 DbqKxllTaThzDkMCoKxtaZMw6ltWt/O5G3z74BlVZws+5XjpLFeKpGGE+KhbiYZ0sbu7Tt5INty06 GSZeNp1Sve2IvFAFIpkQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lzJSH-00398r-Eu; Fri, 02 Jul 2021 13:43:41 +0000 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lzJS1-00392D-Eu for linux-arm-kernel@lists.infradead.org; Fri, 02 Jul 2021 13:43:29 +0000 Received: by mail-wm1-x335.google.com with SMTP id r3so6725665wmq.1 for ; Fri, 02 Jul 2021 06:43:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=oW516jzYudrgPpoHV87MKKEstdKadYWrqHFNhZ2YbXA=; b=way0cvmvpUF//pESK1MSlN8gcdEsyHAj69bCaL8IEYc/LJFan9v4vW+vRFvWi/g8WP J7gizRBnYmsPfmvIxK2d8dYdAiE+nK4MsM0CkehKQICDARLSSkWPhMNtOrq/6sk0h411 Tq/PqhIeQheLbehlGW03RwZhuWTFvIH6cAnHv/DcsvmgsgJsXX98CXH+Wl77SohHEXzn e9XGyeBgy2RwEAYENMlHA/oIzzz0Y7iBj73tYeMXYhDEp9Y8kwNspNTjN25SrY1MTZVk NDxg/Z1i9V44vzjr7iAxiAmP+8YOHRbl6NxRwvzY11V2AtrEQ6/QrCKqOMSzS7gNpLOp ivlw== 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:mime-version:content-transfer-encoding; bh=oW516jzYudrgPpoHV87MKKEstdKadYWrqHFNhZ2YbXA=; b=hDVGGm8l0G3p2SZ8j8cHrOLoNZKTIfqLU7WND6LRWIgiIV2eGdrzHPEbe/6mvtDeRm 4BEVRZca4S1uLmajYrDg1nbJ13yVDzXd+jUB7AC8pMpipNEtF3DnjleCNXvfRlORqtaC SmBGIO5zcy4jZF/4IkIHFOIE2H8nISovPHzElsfGIuVfQUWks31cM7kwclDzdGRVZsNR 3TaSKc2FnDDlWnDzlRcWrb+obk18+FbFOm8cUOlVg8Hdir3yR0zT0I3SUoC76JVCvtl1 fZ6MouviNPkqljEIKdO1Fs1KQXPL+2ioymEsMz94oPe5Q4Sc2l4NAQWNljwZeUVask6Y 7lvQ== X-Gm-Message-State: AOAM530UkW2twdR5Hno1IvZoxXL7r2JWUoFmy4FcYaVh39+MxDe3W8Kj fu/Lt9qJP1y5lZlsbzTRm6mStA== X-Google-Smtp-Source: ABdhPJxnTvB/oQhCVJWoCiwXtj3UUFWvJwpbiwNjlYhBG7D/FteEWRxC1TD81lekqvYBm7ouvzta9A== X-Received: by 2002:a7b:c3ca:: with SMTP id t10mr16781680wmj.74.1625233403909; Fri, 02 Jul 2021 06:43:23 -0700 (PDT) Received: from groot.home ([2a01:cb19:826e:8e00:c5f3:6ae:eaf:87a2]) by smtp.gmail.com with ESMTPSA id s1sm12595512wmj.8.2021.07.02.06.43.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jul 2021 06:43:23 -0700 (PDT) From: Mattijs Korpershoek To: Dmitry Torokhov , Matthias Brugger , Rob Herring Cc: Fabien Parent , linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, Mattijs Korpershoek Subject: [PATCH v3 1/4] Input: mtk-pmic-keys - use get_irq_byname() instead of index Date: Fri, 2 Jul 2021 15:43:07 +0200 Message-Id: <20210702134310.3451560-2-mkorpershoek@baylibre.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210702134310.3451560-1-mkorpershoek@baylibre.com> References: <20210702134310.3451560-1-mkorpershoek@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210702_064325_555401_92EFD363 X-CRM114-Status: GOOD ( 15.94 ) 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 Some pmics of the mt6397 family (such as MT6358), have two IRQs per physical key: one for press event, another for release event. The mtk-pmic-keys driver assumes that each key only has one IRQ. The key index and the RES_IRQ resource index have a 1/1 mapping. This won't work for MT6358, as we have multiple resources (2) for one key. To prepare mtk-pmic-keys to support MT6358, retrieve IRQs by name instead of by index. Signed-off-by: Mattijs Korpershoek --- drivers/input/keyboard/mtk-pmic-keys.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c index 62391d6c7da6..d1abf95d5701 100644 --- a/drivers/input/keyboard/mtk-pmic-keys.c +++ b/drivers/input/keyboard/mtk-pmic-keys.c @@ -241,6 +241,7 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev) unsigned int keycount; struct mt6397_chip *pmic_chip = dev_get_drvdata(pdev->dev.parent); struct device_node *node = pdev->dev.of_node, *child; + static const char *const irqnames[] = { "powerkey", "homekey" }; struct mtk_pmic_keys *keys; const struct mtk_pmic_regs *mtk_pmic_regs; struct input_dev *input_dev; @@ -268,7 +269,8 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev) input_dev->id.version = 0x0001; keycount = of_get_available_child_count(node); - if (keycount > MTK_PMIC_MAX_KEY_COUNT) { + if (keycount > MTK_PMIC_MAX_KEY_COUNT || + keycount > ARRAY_SIZE(irqnames)) { dev_err(keys->dev, "too many keys defined (%d)\n", keycount); return -EINVAL; } @@ -276,7 +278,8 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev) for_each_child_of_node(node, child) { keys->keys[index].regs = &mtk_pmic_regs->keys_regs[index]; - keys->keys[index].irq = platform_get_irq(pdev, index); + keys->keys[index].irq = + platform_get_irq_byname(pdev, irqnames[index]); if (keys->keys[index].irq < 0) { of_node_put(child); return keys->keys[index].irq; From patchwork Fri Jul 2 13:43:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mattijs Korpershoek X-Patchwork-Id: 12356127 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1FE3C11F69 for ; Fri, 2 Jul 2021 13:45:37 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 81C836142C for ; Fri, 2 Jul 2021 13:45:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 81C836142C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ucVZpiXTgxSqOzrtNQ9elu/J2LHfZPQyVg3lLcswpEE=; b=FcF6LY8qiQXVjo KctQwagQWLxSdM5RsBcrSwB89WuPsSMBkv7452PXTEF2wZs8n8tjFATyrXhOwU5TQKS6jBDVuE9xe 8gwY1l3nnxt86mB95x3g+x/yQeO06LubXviIFxfr0ezsFHx+DaWbHFgo4zLKtZZsV9QqJP18niczx UvrcQ7sAl5l3uB4HdjiD7YCMhdebN0HeCAQBWCMqUNSg50eTVok0htUvV6cwApE0KLDCYbY8YsCJ2 qAzDXsTuTs42qUnVqzB/DxgjGfPTYqn60YdUFug5Hyq0VF+t2by+t4gMRgshBGMQUSBgh0QSAXCON K4Zitf7EVNJswrclqLSg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lzJSS-0039Bv-Mh; Fri, 02 Jul 2021 13:43:52 +0000 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lzJS1-00392F-Rp for linux-arm-kernel@lists.infradead.org; Fri, 02 Jul 2021 13:43:29 +0000 Received: by mail-wm1-x32b.google.com with SMTP id k16-20020a05600c1c90b02901f4ed0fcfe7so5300746wms.5 for ; Fri, 02 Jul 2021 06:43:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lzfTe4NYom6dNO0HLbV+l/ZlHA7iI3yej9+BU8sy+1w=; b=cDfr1NhQHx+he4+TgITm2BjN8MbmS2ZamBiuVsRrRnghInJTxPq5GVK7592n3bMasM Gwt19Fm9bD6lKrUrLAbkoNsPO2e3K6qaODEPEfRFgOvV8tWWbdsexZ2N/uUBRr+siLCl WO3j5j9yvB2OxqcHcCjxTbW3pqqjWyr9BuPdNtWaFMNIL4QXBUqV4fUz18Wo6cd7fits DFtLGE6KXnN++YkAkAvgOFB17NeNptuQjy0KH9Z+Reetr6CFMnhI7LVOXdE7Xdey9JRv affpusSNYDn/3E2TE3wdm/r7p3168EFhTG4o3rCRawEFHA3f1Fd01n25IZSFHgJ/Isz1 QXrg== 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:mime-version:content-transfer-encoding; bh=lzfTe4NYom6dNO0HLbV+l/ZlHA7iI3yej9+BU8sy+1w=; b=CxbB3c5vEvAe8Lx5jDFoSw49vZ9jPbRCqGQ399EQCktp4Kd5zyRkGp/JgK0X7tT5LN fET/9Oih+hV5cHgjiG7/ApYYYaQuxQIDB0gRltF+RRi9u605i/Kw3SKQXqzQ3IMgWEM5 JL1B+WhdzcfoITL1o6VKgWqf37wMg+8FbzYXMHblBuSi4FswjZbqcpaFJTgIowak9liZ BnftO6h6cnMTb8aoCNc5dtTJ5e5v9H0Yefd+Xlo2UBZ9nhIEGwtKOpoXl7CbiMdL0nvb CGtEKk/28EPYHHdJx4DPDXjVzWFKIQWQLL4R4z192lzB5JMvJ4GGdCnZzi/V7UGOhO8U ZMLQ== X-Gm-Message-State: AOAM530kGX11F1ue3z/GZEq+xkE0eOlNwTtljPrQlczt7lygbxfdGQKr SgCZ3ZrRMPhENJSiPOFbgt/kEQ== X-Google-Smtp-Source: ABdhPJzQFXRzS5N554NDfExUbHLoRNV22Hjo5b5QbL+c0xKE76ZXSzmuNLVKNHtW5oiQNSxHSQYGxQ== X-Received: by 2002:a1c:7204:: with SMTP id n4mr16962591wmc.7.1625233404663; Fri, 02 Jul 2021 06:43:24 -0700 (PDT) Received: from groot.home ([2a01:cb19:826e:8e00:c5f3:6ae:eaf:87a2]) by smtp.gmail.com with ESMTPSA id s1sm12595512wmj.8.2021.07.02.06.43.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jul 2021 06:43:24 -0700 (PDT) From: Mattijs Korpershoek To: Dmitry Torokhov , Matthias Brugger , Rob Herring Cc: Fabien Parent , linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, Mattijs Korpershoek , Rob Herring Subject: [PATCH v3 2/4] dt-bindings: input: mtk-pmic-keys: add MT6358 binding definition Date: Fri, 2 Jul 2021 15:43:08 +0200 Message-Id: <20210702134310.3451560-3-mkorpershoek@baylibre.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210702134310.3451560-1-mkorpershoek@baylibre.com> References: <20210702134310.3451560-1-mkorpershoek@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210702_064325_941154_3733DADD X-CRM114-Status: GOOD ( 13.58 ) 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 Add the binding documentation of the mtk-pmic-keys for the MT6358 PMICs. MT6358 is a little different since it used separate IRQs for the release key (_r) event Signed-off-by: Mattijs Korpershoek Acked-by: Rob Herring --- Documentation/devicetree/bindings/input/mtk-pmic-keys.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/input/mtk-pmic-keys.txt b/Documentation/devicetree/bindings/input/mtk-pmic-keys.txt index 535d92885372..9d00f2a8e13a 100644 --- a/Documentation/devicetree/bindings/input/mtk-pmic-keys.txt +++ b/Documentation/devicetree/bindings/input/mtk-pmic-keys.txt @@ -9,7 +9,10 @@ For MT6397/MT6323 MFD bindings see: Documentation/devicetree/bindings/mfd/mt6397.txt Required properties: -- compatible: "mediatek,mt6397-keys" or "mediatek,mt6323-keys" +- compatible: Should be one of: + - "mediatek,mt6397-keys" + - "mediatek,mt6323-keys" + - "mediatek,mt6358-keys" - linux,keycodes: See Documentation/devicetree/bindings/input/input.yaml Optional Properties: From patchwork Fri Jul 2 13:43:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mattijs Korpershoek X-Patchwork-Id: 12356131 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09C2FC11F68 for ; Fri, 2 Jul 2021 13:45:52 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id CA51B6142B for ; Fri, 2 Jul 2021 13:45:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CA51B6142B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=J48D9/u9aJ5plSaqAJPR9iahshti02Skf0fRyJogOwE=; b=ufaIn3if7oxten bHAkQNi1+MaKOyhLCsrirUyLkZ9D6QDBE1fIwp2LNBVh8NCdTz5EwArJltA5hqBQcTmaOhB/aHoI7 C3LADTrEy32YYpcjMzVW+97mAr19xlkMNukF9kLeA03WpPwMXLz6Smwg1TytNzwdr+sdLEsAkbefJ 9XF4V5qQh0gprIJgZ68WCi60pYg5JhbnAa7yOE1EvF+UIH7YGcKFuYXhfV+NW7fMbKWTNmZvIQJn8 EzOOIXrXk9CvGsDgJiB8TaoGMLfFJQNn5XLgfwPNF0M7zOMM4NWjcKPmYwzbERNGE+zrASxUyJIT0 KRh5WCDHxuP5vAHgMYhA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lzJSe-0039EX-2Z; Fri, 02 Jul 2021 13:44:04 +0000 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lzJS3-00393A-0z for linux-arm-kernel@lists.infradead.org; Fri, 02 Jul 2021 13:43:29 +0000 Received: by mail-wr1-x42f.google.com with SMTP id f14so12167884wrs.6 for ; Fri, 02 Jul 2021 06:43:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IEDSCcz9DuURhhNfs/tK0QYp1lnSjVV5pxew10G8dSk=; b=oww/EIcYIkkGjYZeUZhdFMuaI/3hIzPWI+E0BV41zo/upZHpHgjKSmWv/rt8AcOayF p1OcudJNb6uX5mfCUjL+BLpj3pk+0oeRyUbDoEZz0YOAgU6mPUtMw6Qpm4Fpe4Ab6VMe AvYm/b9U3vkmB/LcPaf00sRbmqOunnJbmsi2fADxIqQGhZE7+IXUqnBuQqqxwmMneEhz Y+tBt7uihF3lYsN1j4O+8oJZJ9eahTis77T1N3tTXkza1yq5XC8YOia71tlG5XUCuDSG TfXOWyhklJidLU/YHElIXmJ4YhnBzMx7h/nlYbH8KLELC/X2RQZMlmvHxZFfPXcVlpfx 9SEw== 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:mime-version:content-transfer-encoding; bh=IEDSCcz9DuURhhNfs/tK0QYp1lnSjVV5pxew10G8dSk=; b=M2AUcqZWu6rqO/1QE9dHZbxsAPMVrGJ+ZSUCRtRf3Y6dHJ38ZO7p9thA8tzQUk4B3H j7f2VKq+tzAPGMC7P44YDGZNKsntWqTkgAqXGFhCx8oSDtCXzPkWk1HxXvIUsUgefHTO UV1cJSoqDOCLSFpFKGiOZ0CXFMPQcFKcaHR6JO9hFjDFcASHSDaFFisNnW9saNM6lxGG NxLyFSS1G6JCkbchLqApMaoaGY1/tbq88JIfPHWk9p1UbpKTJnSsyNL+vwb5YoomgHJH lbInF/qIISyuBo+qStkrXhkLZ6adJzEDfWLdEv/DTEqFwrarSoCTuOUeNVi1kKOTS+ph ijNg== X-Gm-Message-State: AOAM531qM2CF3Ac/y5hiXx4eFT9c+kFCfCk4Xz4enJs2KcAiSWmfL2Ts sbvJg7eDq6dzVyMQBF1O7pivpg== X-Google-Smtp-Source: ABdhPJw2So7Imsur+MFkTU8FDDV/9iBuIT90pZGEkhPsGPQkJRg76z1mW/l4fUwTrTI5R3Q6dIn5DQ== X-Received: by 2002:adf:cd85:: with SMTP id q5mr6032107wrj.214.1625233405464; Fri, 02 Jul 2021 06:43:25 -0700 (PDT) Received: from groot.home ([2a01:cb19:826e:8e00:c5f3:6ae:eaf:87a2]) by smtp.gmail.com with ESMTPSA id s1sm12595512wmj.8.2021.07.02.06.43.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jul 2021 06:43:25 -0700 (PDT) From: Mattijs Korpershoek To: Dmitry Torokhov , Matthias Brugger , Rob Herring Cc: Fabien Parent , linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, Mattijs Korpershoek Subject: [PATCH v3 3/4] Input: mtk-pmic-keys - add support for MT6358 Date: Fri, 2 Jul 2021 15:43:09 +0200 Message-Id: <20210702134310.3451560-4-mkorpershoek@baylibre.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210702134310.3451560-1-mkorpershoek@baylibre.com> References: <20210702134310.3451560-1-mkorpershoek@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210702_064327_108457_1471DFD6 X-CRM114-Status: GOOD ( 21.25 ) 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 MT6358 pmic keys behave differently than mt6397 and mt6323: there are two interrupts per key: one for press, the other one for release (_r) Signed-off-by: Mattijs Korpershoek --- drivers/input/keyboard/mtk-pmic-keys.c | 49 ++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c index d1abf95d5701..5496a7020104 100644 --- a/drivers/input/keyboard/mtk-pmic-keys.c +++ b/drivers/input/keyboard/mtk-pmic-keys.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -74,11 +75,22 @@ static const struct mtk_pmic_regs mt6323_regs = { .pmic_rst_reg = MT6323_TOP_RST_MISC, }; +static const struct mtk_pmic_regs mt6358_regs = { + .keys_regs[MTK_PMIC_PWRKEY_INDEX] = + MTK_PMIC_KEYS_REGS(MT6358_TOPSTATUS, + 0x2, MT6358_PSC_TOP_INT_CON0, 0x5), + .keys_regs[MTK_PMIC_HOMEKEY_INDEX] = + MTK_PMIC_KEYS_REGS(MT6358_TOPSTATUS, + 0x8, MT6358_PSC_TOP_INT_CON0, 0xa), + .pmic_rst_reg = MT6358_TOP_RST_MISC, +}; + struct mtk_pmic_keys_info { struct mtk_pmic_keys *keys; const struct mtk_pmic_keys_regs *regs; unsigned int keycode; int irq; + int irq_r; /* optional: release irq if different */ bool wakeup:1; }; @@ -188,6 +200,19 @@ static int mtk_pmic_key_setup(struct mtk_pmic_keys *keys, return ret; } + if (info->irq_r > 0) { + ret = devm_request_threaded_irq( + keys->dev, info->irq_r, NULL, + mtk_pmic_keys_irq_handler_thread, + IRQF_ONESHOT | IRQF_TRIGGER_HIGH, "mtk-pmic-keys", + info); + if (ret) { + dev_err(keys->dev, "Failed to request IRQ_r: %d: %d\n", + info->irq, ret); + return ret; + } + } + input_set_capability(keys->input_dev, EV_KEY, info->keycode); return 0; @@ -199,8 +224,11 @@ static int __maybe_unused mtk_pmic_keys_suspend(struct device *dev) int index; for (index = 0; index < MTK_PMIC_MAX_KEY_COUNT; index++) { - if (keys->keys[index].wakeup) + if (keys->keys[index].wakeup) { enable_irq_wake(keys->keys[index].irq); + if (keys->keys[index].irq_r > 0) + enable_irq_wake(keys->keys[index].irq_r); + } } return 0; @@ -212,8 +240,11 @@ static int __maybe_unused mtk_pmic_keys_resume(struct device *dev) int index; for (index = 0; index < MTK_PMIC_MAX_KEY_COUNT; index++) { - if (keys->keys[index].wakeup) + if (keys->keys[index].wakeup) { disable_irq_wake(keys->keys[index].irq); + if (keys->keys[index].irq_r > 0) + disable_irq_wake(keys->keys[index].irq_r); + } } return 0; @@ -229,6 +260,9 @@ static const struct of_device_id of_mtk_pmic_keys_match_tbl[] = { }, { .compatible = "mediatek,mt6323-keys", .data = &mt6323_regs, + }, { + .compatible = "mediatek,mt6358-keys", + .data = &mt6358_regs, }, { /* sentinel */ } @@ -242,6 +276,7 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev) struct mt6397_chip *pmic_chip = dev_get_drvdata(pdev->dev.parent); struct device_node *node = pdev->dev.of_node, *child; static const char *const irqnames[] = { "powerkey", "homekey" }; + static const char *const irqnames_r[] = { "powerkey_r", "homekey_r" }; struct mtk_pmic_keys *keys; const struct mtk_pmic_regs *mtk_pmic_regs; struct input_dev *input_dev; @@ -285,6 +320,16 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev) return keys->keys[index].irq; } + if (of_device_is_compatible(node, "mediatek,mt6358-keys")) { + keys->keys[index].irq_r = platform_get_irq_byname( + pdev, irqnames_r[index]); + + if (keys->keys[index].irq_r < 0) { + of_node_put(child); + return keys->keys[index].irq_r; + } + } + error = of_property_read_u32(child, "linux,keycodes", &keys->keys[index].keycode); if (error) { From patchwork Fri Jul 2 13:43:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mattijs Korpershoek X-Patchwork-Id: 12356133 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46932C11F68 for ; Fri, 2 Jul 2021 13:45:57 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 1325A6142B for ; Fri, 2 Jul 2021 13:45:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1325A6142B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=azymuGWrIjKOVkbsk8SXmA3SgCmTMVewMlsVnlaAzVE=; b=NZp/chYcQAG1/N xK2eQcaclQatrqyDeFBsn4Y8FxR1tLkAupKJCmtlRaYsCxuYhOf/Zy3UQDgv6uL/5mFJKMZjYIzhB b0EsaAoFBem5gqVDKluu344MHswzA8yP4wmvrRXbW00f2MX5lW5fIZG7u8mN2pSIBktnU6U9TiVVl jn0gpLEO/sH6UlQ5Y5mnMa4KH69oi2nbuDMxUb5ZQ6rizLKAhSBKp3vJcaZd0Gxw/AOr8rDSSdqIM xYqkNaoTUaylfoD9i/VtpUlOiaK4v8u0utmmTy2++GFf2NDgznnCW8v6TFr5yQExpJAppigwbn9FI UfgCpuCz6jdKSTq3YtOg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lzJSs-0039Ia-Fk; Fri, 02 Jul 2021 13:44:18 +0000 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lzJS3-00393f-Nq for linux-arm-kernel@lists.infradead.org; Fri, 02 Jul 2021 13:43:30 +0000 Received: by mail-wm1-x32f.google.com with SMTP id r9-20020a7bc0890000b02901f347b31d55so6249354wmh.2 for ; Fri, 02 Jul 2021 06:43:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rEhU8Um5f0JiN5UeHBJI5GyHDmhvUyYTxNlEBkR3UOo=; b=Olhx4UlCuIfRvcxRt/0zqVPZpQnQBNItBR/JKERv+Eev5CLysDIlTi2lcWT6kpawpK x4pfq3AcH7YHbC2ZTTdraCay59JnayrekmOCc0cCcIeD7fjGqlx2xLsxOx9Krx1l6KY8 6kvCL5XcrRNOdqUoApmmPUUtebmR41JiiBlnnVFPeB/sY86Hhbun+gEZgyq0br9EXPS7 dI8YRus3MYM3+Xsn8UPe0JQqN5Qspc1iExCcbKHHNVakYOe4m0OLpD5+kqXk4Plr+4n+ 9+ApgSFKmBEcpYkbN8qJZohcCL2+1yx5ZjENIwqKds/9oaV0casBgsmQMXtnD8QQWPx8 sGmA== 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:mime-version:content-transfer-encoding; bh=rEhU8Um5f0JiN5UeHBJI5GyHDmhvUyYTxNlEBkR3UOo=; b=ZCyz8KE7r6htbUXdP0qO4/5fS9igGPmAysbQ3+Jhr9TgXElBDg0x2H+2p5LgkQitUz XYpHzQYOmP0O5KmwSVn7FBxygS7rO/56XDOYVh3aPvCZtp01Gg41ddNMCEh6cpZTbVpv 8y6lpi+RUEzx5f6m7snSdS9WwfkICDe06UTNuOMP754DQhs9Bvec1gL4Q9Bb5CJpzY/T 2Dl4ttOlWEXboMpzu4uIOntIWUnh99Va1sTrY3RTShpH0gE3PbhBF1gVZE12lBQ1Nyxy TAGvC5WDZoOfS7dLq7Uznc1Guj45pKq2t6oojVjhNWZQduuQON5USOZL57y98aI9CJGC 9plw== X-Gm-Message-State: AOAM530yp/zGTn+AV47GgSKfDGpDR7AsLYzDh2mjuHVYFTDFxood/+gR fFNWAhBQhyy89tTJnSN5p4BK/w== X-Google-Smtp-Source: ABdhPJwnStGuaizhehaJ7yHxKMwHfg61nZmXZITfuPGPqNtQIfKaLtBLZH0EDnMdLDGsESkAkkkrww== X-Received: by 2002:a05:600c:1c8f:: with SMTP id k15mr5646909wms.91.1625233406190; Fri, 02 Jul 2021 06:43:26 -0700 (PDT) Received: from groot.home ([2a01:cb19:826e:8e00:c5f3:6ae:eaf:87a2]) by smtp.gmail.com with ESMTPSA id s1sm12595512wmj.8.2021.07.02.06.43.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jul 2021 06:43:25 -0700 (PDT) From: Mattijs Korpershoek To: Dmitry Torokhov , Matthias Brugger , Rob Herring Cc: Fabien Parent , linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, Mattijs Korpershoek Subject: [PATCH v3 4/4] arm64: dts: mt6358: add mt6358-keys node Date: Fri, 2 Jul 2021 15:43:10 +0200 Message-Id: <20210702134310.3451560-5-mkorpershoek@baylibre.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210702134310.3451560-1-mkorpershoek@baylibre.com> References: <20210702134310.3451560-1-mkorpershoek@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210702_064327_851323_9610B9FB X-CRM114-Status: GOOD ( 12.18 ) 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 This enables the power,home keys on MediaTek boards with a mt6358 pmic. Signed-off-by: Mattijs Korpershoek --- arch/arm64/boot/dts/mediatek/mt6358.dtsi | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/arm64/boot/dts/mediatek/mt6358.dtsi b/arch/arm64/boot/dts/mediatek/mt6358.dtsi index fa159b20379e..a1b017a6a751 100644 --- a/arch/arm64/boot/dts/mediatek/mt6358.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt6358.dtsi @@ -2,6 +2,7 @@ /* * Copyright (c) 2020 MediaTek Inc. */ +#include &pwrap { pmic: mt6358 { @@ -356,5 +357,16 @@ mt6358_vsim2_reg: ldo_vsim2 { mt6358rtc: mt6358rtc { compatible = "mediatek,mt6358-rtc"; }; + + mt6358keys: mt6358keys { + compatible = "mediatek,mt6358-keys"; + power { + linux,keycodes = ; + wakeup-source; + }; + home { + linux,keycodes = ; + }; + }; }; };