From patchwork Wed Apr 28 16:42:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mattijs Korpershoek X-Patchwork-Id: 12229667 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.0 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,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 8DDA2C43460 for ; Wed, 28 Apr 2021 16:44:37 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 E68B1613FF for ; Wed, 28 Apr 2021 16:44:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E68B1613FF 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=desiato.20200630; 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=dMaNJZr3R2hPxwaEPg+JzgC8kbOvAG7x6kYA1rTKzrM=; b=Dc0L9pnrFHQ0QhIYOFJWqLJpD Z3UZ4vhXO8BP1mIpVXT1ZtaZzFkaEIjmoywgejY6KAaDpNaqRtqVbL+1i5Zgf2fI+PdPQZFBOk6Fo fnF1gE7mNszIxYhRW/ZJz/47vcNfWNg3KHa/N8vNI5wc+tLV3lfXrXvMbTTk6JAVa7y+CwFwBTSnT ISKBQJWQCMGBUzDEKGKds0A6GUIZHRul6B16FDnbJ+JJZV0VSaAa8fjZKHWh6loxluntCReuNf/DH jKivhqHC188kSORVDdLAZQiX24Vh1+cwR5HSDVSsu3QyfhZA9olD2FLuPMSiZJ+OMG7PoNb4A8o/N dZYjiDRQA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbnGx-003rJh-NI; Wed, 28 Apr 2021 16:42:47 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbnGh-003rF3-HZ for linux-arm-kernel@desiato.infradead.org; Wed, 28 Apr 2021 16:42:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=1Npsra9lTv9v4xN59JKhYP3YKsTPHiSIJ0ifDE3Owq0=; b=250FTZRSx04DgTLeGDznxrc08w Qg5b6VVgSxBu0P6nJAyWOdKbqRjU+BKGEXdWto9MVrbaKR3jcDKv0OmOCKzTEjsLLt7y3hn5kpedq g7PI9349OxWkSgHrh265gwKIZHGVokT3bRN1zYKB2n/DNdb4TaE7oqEGfMdO+WDrA6SR0vmoqad6e YyvGpG7r03YwpsnjKFg/cfHVa/DhR5ErbUS9LF99RpFdYxVriRu2gKmMQMlTzEIi8Pfc8LUZOsR2S WNmRFGYArp9g6QZBdE15sPPyE+AVs+ck1wM47hLTFhA4ELR4rwVAXPTDfk5yxpKgi30qJ9UCKRgLR JHxb691Q==; Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbnGd-0001da-H3 for linux-arm-kernel@lists.infradead.org; Wed, 28 Apr 2021 16:42:30 +0000 Received: by mail-wm1-x329.google.com with SMTP id f15-20020a05600c4e8fb029013f5599b8a9so7616930wmq.1 for ; Wed, 28 Apr 2021 09:42: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=1Npsra9lTv9v4xN59JKhYP3YKsTPHiSIJ0ifDE3Owq0=; b=zUDZjIL2usIB5WXxK/ye4NbuH9+DXS1SfA9xQTM8vq1Dg0Otmpvz9GfHi2opbHEsnK FtLetrva6yDTWEssMBaO0U1BGKu97PDRbGkJBJCDLlUCeISqVJmyWvx1rcNZPpd1+en+ o0onKxEcPszCkG9gC2SOsLJOxZZReh10HmEK7H/qlFs7ED2RMTn2SlGocO3l3cHc8XbZ KK/dK54ZXBxKYeRoYlLePgwqmFjTe1BapwtnFKBapqOxVM5xOokZITRx2tA6uypu+T0G 1jbos3guoOsApl4T+3WXTPmXArr5SGKpUxcJlQ1rxIydrMJX8rMpHjkeit0G9StsQ1bq Wkew== 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=1Npsra9lTv9v4xN59JKhYP3YKsTPHiSIJ0ifDE3Owq0=; b=YblpvRY6DTe8DQokG/Cg+3doEtNCHgrMg6Oan3g530D4/TfVG1G4qzz9h3VcvY2cFJ h46B76MshEPc0z07QlKFqaMjByxsN5dQCl/0iPAgdVpbGgAhz3/E9jbH3zo9JNAEzvpe 9hqvtUmdiGKUjgjHJ/59tRpneNFi+Is9C/RBfJRPiAE0ZINNSU/xrSFpfs8tJfIf7n8I rYxsBnyk4mPG6qu1LZnRaF6H62vDEsY4BeIutu8etjCMrvJKjThwmG16KbQ2efA8B/Ii TWS807/Nn9F6RPnXMeVBPeJmtigbddzwqZ2x+88XvHWvVWmrUOpyPne5BDF4fM2NbDPy B4kg== X-Gm-Message-State: AOAM530qqto2BLwvgshOWDTA5qY0apIDwf4RuUi+oxcemvQU0Or1fNB9 D6nVkNuaOyDZ5OMLa5W98imM1g== X-Google-Smtp-Source: ABdhPJyWnC5LYX8PDdAFYQdLJOpHsPJILkQ2WJwopTaZ8WFEeAxhvmHUVeqf21SzpLPRGkU+Tw2Sow== X-Received: by 2002:a1c:f708:: with SMTP id v8mr5666235wmh.133.1619628145900; Wed, 28 Apr 2021 09:42:25 -0700 (PDT) Received: from groot.home ([2a01:cb19:826e:8e00:5864:ddd1:d623:f912]) by smtp.gmail.com with ESMTPSA id o10sm351299wrx.35.2021.04.28.09.42.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 09:42:25 -0700 (PDT) From: Mattijs Korpershoek To: Dmitry Torokhov , Matthias Brugger Cc: fparent@baylibre.com, Mattijs Korpershoek , linux-input@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/7] Input: mtk-pmic-keys - check for NULL on of_match_device() Date: Wed, 28 Apr 2021 18:42:13 +0200 Message-Id: <20210428164219.1115537-2-mkorpershoek@baylibre.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210428164219.1115537-1-mkorpershoek@baylibre.com> References: <20210428164219.1115537-1-mkorpershoek@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210428_094227_584448_82BE1DD5 X-CRM114-Status: GOOD ( 13.93 ) 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 mtk-pmic-keys being a child device of mt6397, it will always get probed when mt6397_probe() is called. This also happens when we have no device tree node matching mediatek,mt6397-keys. In that case, the mfd core warns us: [ 0.352175] mtk-pmic-keys: Failed to locate of_node [id: -1] Check return value from call to of_match_device() in order to prevent a NULL pointer dereference. In case of NULL print error message and return -ENODEV Signed-off-by: Mattijs Korpershoek --- drivers/input/keyboard/mtk-pmic-keys.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c index 62391d6c7da6..12c449eed026 100644 --- a/drivers/input/keyboard/mtk-pmic-keys.c +++ b/drivers/input/keyboard/mtk-pmic-keys.c @@ -247,6 +247,9 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev) const struct of_device_id *of_id = of_match_device(of_mtk_pmic_keys_match_tbl, &pdev->dev); + if (!of_id) + return -ENODEV; + keys = devm_kzalloc(&pdev->dev, sizeof(*keys), GFP_KERNEL); if (!keys) return -ENOMEM; From patchwork Wed Apr 28 16:42:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mattijs Korpershoek X-Patchwork-Id: 12229669 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.0 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,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 9FE97C433B4 for ; Wed, 28 Apr 2021 16:44:44 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 EFFD060E08 for ; Wed, 28 Apr 2021 16:44:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EFFD060E08 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=desiato.20200630; 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=5Ukd717Ahy4bQm5sR8Yl8A8SAod5rxfmqXhC/ExIR7g=; b=esi5xKO2wYtjWn8RG2KOr6pTX SQBq9/WN9sVV6qA6EsEz3XwAdhrKaddhBZ3nKNFJGS/7FaveA3VZliHaIglch3gnkBd71V1jtC3yV 9RmGVYs5GDkH9G+XKfsjEBiYhxAh4zTPGNoXnZjm7w8U++qHyOuEdSf0Txeu7COhxazL4FPm1zTYJ P9HZcIH/IyMwYyjpN8dhOP8/k3dPeKdSMt5z+eW0PBYKZRIe36l+8xMcUJPJUg9FRtFcd0DxQri4I JV7UotnECSphMdB9+C1dxg/ToPep9dCF27qO/9CtSW1TX8GWNJWAV3rsFxoH8ybgVfR9m1Du9RvLh leFgk4tYA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbnHB-003rLp-Kx; Wed, 28 Apr 2021 16:43:01 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbnGh-003rG3-KF for linux-arm-kernel@desiato.infradead.org; Wed, 28 Apr 2021 16:42:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=KSF6Pij+oCZWv8GIdJGXO9GyJLWrt789k7MQt6XyiRs=; b=P7sg0AD3gjLpicvnLMJdy9maR+ Ex+z3hs8SdLZV1/kHb33NzxC/sk/Qf9Tkz1IazLEBI8BzhTTyngMwuMJC80PtqrznapwlfQqGlA8H pSagKGz5gHzyBn7ghWOMSpjv2p4xGdymCNxRaQHUk/DeC9bT+C4k1VoGS/8QNFeUKpUpdv1r1WOsm m5P3okPD5ULVGGKAxlwhf6YpokFHqzNQIGgI40RIzdPHfCC2WC8rCOHqtZag6hWszs0GhVt6bZ72D ZoLKIBjJO7MfHZwYQzsNdxqC7qUn2I9+HnyhBLmgsih/Q8Fq/+q5pDPaLovsezW1Bd6l9Gq4aEFel RiC/571w==; Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbnGe-0001e2-LO for linux-arm-kernel@lists.infradead.org; Wed, 28 Apr 2021 16:42:30 +0000 Received: by mail-wm1-x332.google.com with SMTP id p6-20020a05600c3586b029014131bbe5c7so6398490wmq.3 for ; Wed, 28 Apr 2021 09:42: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=KSF6Pij+oCZWv8GIdJGXO9GyJLWrt789k7MQt6XyiRs=; b=OQOO4MY6aSibgH++lNkvFpbOmvNXA7h9sW8y6dafOcjjjW1+d6WJP3VgTNCRmFVG3W nRGU4J90kEj+nRDYYxk74wirKyfsHKxJf6qYuScw4/b8WKyeSFP+jyTIeRgZI2EufLvU 7pR7yKWfFsbYo5y3KQxC4USfsByJuNPnGVRlyv6oa+fZX/EZumWGOih904DSSWVzC21W maaxVK1Kp4+ZqUvRybJ9hHrR9Ugs4ewdv5u/7zjPxLWqnsML7vB/i7DIK7hISSreCEPv Gc9PW/z2fcc2alytzLatTnrdZSQUF7EpkTiRdCnhA5XhHKYZJtHCPiVw8uY5RDPiRCqj hE8w== 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=KSF6Pij+oCZWv8GIdJGXO9GyJLWrt789k7MQt6XyiRs=; b=fAyPlCCsNEvQknutThIeXnXd5P56HQQ9sGtO8gWHUX4L67ldfAvuJrnmB83JWPV3Ib 4fCDYm+BfjfrNcvvFM7PwjTLrmCEDfYEcBEXqCzCZz/0IAD1CLZNVFSsJ9ChRcXc+SR/ YKUEvPlW9urmUCSIFqdzg5elUzupXvKmpxiHJczl7uz/jp+8Fs7GLZTnerRuGqiZgTFw mrGhHdj0TE7tImq+PRwIQylR0ZDSX1uPmYbiNPwaqpJ7IAhxsIl5IGytfjOhNEUJVPDV 9I3T4EZY1/eOY1SXgCjoYltKFT4sz2TqNWMhC3b84e/xw6lhynYrkL6BluQxfie80Qsw XNlA== X-Gm-Message-State: AOAM533hfT969aJ28gbnI+Bvqkv6nve/rckbhCcA/ntfyzUufaOb/A9p nmrOarp77rgQp1TWZPY63bYQBQ== X-Google-Smtp-Source: ABdhPJyVSmNvzgpTISSckOFTwPe4BMSsBwptn//otLjLQhK4nnPGDJcuWxnqMK5HD5OOqGqB/b8sVg== X-Received: by 2002:a7b:c156:: with SMTP id z22mr5652648wmi.86.1619628146887; Wed, 28 Apr 2021 09:42:26 -0700 (PDT) Received: from groot.home ([2a01:cb19:826e:8e00:5864:ddd1:d623:f912]) by smtp.gmail.com with ESMTPSA id o10sm351299wrx.35.2021.04.28.09.42.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 09:42:26 -0700 (PDT) From: Mattijs Korpershoek To: Lee Jones , Matthias Brugger Cc: fparent@baylibre.com, Mattijs Korpershoek , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/7] mfd: mt6397: add mt6358 register definitions for power key Date: Wed, 28 Apr 2021 18:42:14 +0200 Message-Id: <20210428164219.1115537-3-mkorpershoek@baylibre.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210428164219.1115537-1-mkorpershoek@baylibre.com> References: <20210428164219.1115537-1-mkorpershoek@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210428_094228_715580_E475AA3B X-CRM114-Status: GOOD ( 10.43 ) 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 In order to support power/home key detection, add definitions for two more MT6358 PMIC registers: - TOPSTATUS: homekey and powerkey debounce status - TOP_RST_MISC: controls homekey,powerkey long press reset time Signed-off-by: Mattijs Korpershoek --- include/linux/mfd/mt6358/registers.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/mfd/mt6358/registers.h b/include/linux/mfd/mt6358/registers.h index 2ad0b312aa28..201139b12140 100644 --- a/include/linux/mfd/mt6358/registers.h +++ b/include/linux/mfd/mt6358/registers.h @@ -8,6 +8,8 @@ /* PMIC Registers */ #define MT6358_SWCID 0xa +#define MT6358_TOPSTATUS 0x28 +#define MT6358_TOP_RST_MISC 0x14c #define MT6358_MISC_TOP_INT_CON0 0x188 #define MT6358_MISC_TOP_INT_STATUS0 0x194 #define MT6358_TOP_INT_STATUS0 0x19e From patchwork Wed Apr 28 16:42:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mattijs Korpershoek X-Patchwork-Id: 12229671 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.0 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,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 3E778C433B4 for ; Wed, 28 Apr 2021 16:44:47 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 94DA160E08 for ; Wed, 28 Apr 2021 16:44:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 94DA160E08 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=desiato.20200630; 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=m08ub+CAezSUcKdFHeUZX/Nc6yUJRwjejbEiSwad9sg=; b=GFjpcImMRPl5xbfRW2bgTEQt1 cyuhM7BC3yeKFBhIe/RnDdHy4EJ04OdN2fY761zj9OmuuvZX5Nko0YvOydP6FENo/wmIUEQjcXnj9 hn6tPgJ+yRhnGb5vRCPv7CGchv3ksre4bguLAfokWCW19731lAq9bs5XCTf9Hgavy5rSjzXyTo+Cq gyw5+t99P6vEpwErKu26uzzChcExllNHkDQ1/UGpWQH9taZs5vOsStQ/Y+jbIrQp+oDuGB8GVmq57 xnzo/mlSeGchTxTzlSXzD/Mx9Y0QnFLOvz6aujVNxjzAjkUOJClI/0zWAdxABbgJZXXE+aBQrNfck I3f4O0taA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbnHO-003rPr-Sm; Wed, 28 Apr 2021 16:43:15 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbnGi-003rGl-DH for linux-arm-kernel@desiato.infradead.org; Wed, 28 Apr 2021 16:42:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=aE6tbol598vm7TcSOWd/ixIJR/NZPP5/XzZKCEl8Zf8=; b=x6YM2b96kZ8bdCiW9wSviMA8jD 0quXOC8Asd/ZS1Nz4TvWoO8nTjr0BQQSyoV0pp4A9/2H5UmyBeTLperPKZ4YjCdLvAiprTthRKTcv rjtdBca2cWPyk3dH3sIU1iC8XnAEFABtTEc/A2ye/pw9q/4litPSolneC1nddxd7FxTLo8owfENJA OYhPGCrOprINetKhmjUbpR13LwH8fjUnsra/JZ5VeGPKRKCZP9KyXh6Xhj7OtoFUFr40UzSfpMzML Yx+VmxA2RgvvSCGzIrJhFxSzkEPGdy0qXw+vJ1EtiYpFKISWzl66LYpANgG04aNv/TiHpgvhCE3sf 32/IoZUg==; Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbnGf-0001eW-RQ for linux-arm-kernel@lists.infradead.org; Wed, 28 Apr 2021 16:42:31 +0000 Received: by mail-wm1-x330.google.com with SMTP id i129so7235437wma.3 for ; Wed, 28 Apr 2021 09:42:29 -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=aE6tbol598vm7TcSOWd/ixIJR/NZPP5/XzZKCEl8Zf8=; b=J4dqcVhdcBzsqgSFLeh+i1+i5o0SxHlpn8OGQobH8KV71ucEb/6O56IXT8ve1pcz4F 4VKoRxjcAAUGn+wTtkxSK+khCRvmSVVstBfHNcxI3I8ikMuMvedh6k54p84Ee3nOmlUX 10ddhHbR2H1KqB2Q+YU+knIDw/qNWId1at7U/vK5K7LbV/2IYmO3Qdp+xUBsaro9qc7s yI8E9KY6rJGj/CpuP/xcz56ui3AnHXxkW/NTVr9C3h83kt2XnJfv++P7DNQY6qaSBbc4 NTuwPTxqFnTRJ8G37M9Gr00xh0SmAi0p69hTXdcC0BGQmSxbC/noKyP85oM/DgNhWXSP yfiw== 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=aE6tbol598vm7TcSOWd/ixIJR/NZPP5/XzZKCEl8Zf8=; b=Pacup5eSZz5jXBo374RC4kqlTdiWIokROIWeBQDxOIfw3Qcyywj7iM1veBpVd/XMWL P3T2NIMWt4vCKcRTQcmRVRElcyMW6Yu+BmwAaMb6ZsX1hnfUm/PbTod4jix79kk5CXrn tSUbYdk8upmjVzk0NOxjiRKVNhXRkV0/QVmZZX6a1UMgBn3kHXnohw4yHOQf/gOIlfvU 5iwD50sKR+gb/nQEWmpmmHVOvmSsW/5rUpEBzod7eGfAX0YV98zBH9kelYlFeg5Wi3dh y51tixezUqKInzNfj2fAsj9vLFc63osa7voDCwSBSvba5gTUWEvgMKGeiAguShntXcXy Euww== X-Gm-Message-State: AOAM533Nq8Rii3DVc68iksxMCojKWCGQhIcP4jB05FZK2Z5OOVBY+fO0 jxPDN6uiH3aUEblyZAbh1CSnjQ== X-Google-Smtp-Source: ABdhPJyVYbQkgOcOPhTj6Vjo77V2V6rBqhdeMpvSmiZrGZE7iyBdjx+zJuPQ8eC1m25VyF+WiKW55A== X-Received: by 2002:a1c:740c:: with SMTP id p12mr13689713wmc.112.1619628147980; Wed, 28 Apr 2021 09:42:27 -0700 (PDT) Received: from groot.home ([2a01:cb19:826e:8e00:5864:ddd1:d623:f912]) by smtp.gmail.com with ESMTPSA id o10sm351299wrx.35.2021.04.28.09.42.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 09:42:27 -0700 (PDT) From: Mattijs Korpershoek To: Dmitry Torokhov , Matthias Brugger , Lee Jones Cc: fparent@baylibre.com, Mattijs Korpershoek , linux-input@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/7] mfd: mt6397: keys: use named IRQs instead of index Date: Wed, 28 Apr 2021 18:42:15 +0200 Message-Id: <20210428164219.1115537-4-mkorpershoek@baylibre.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210428164219.1115537-1-mkorpershoek@baylibre.com> References: <20210428164219.1115537-1-mkorpershoek@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210428_094229_911047_9633FB1B X-CRM114-Status: GOOD ( 16.26 ) 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 For some compatible pmics (such as MT6358), there are two IRQs per physical key: one for press event, another for release event. Currently, 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. Note: The keys_resources are not part of the device-tree bindings so this won't break any DT schemas. Signed-off-by: Mattijs Korpershoek --- drivers/input/keyboard/mtk-pmic-keys.c | 7 +++++-- drivers/mfd/mt6397-core.c | 8 ++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c index 12c449eed026..b877bf98db38 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; @@ -271,7 +272,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; } @@ -279,7 +281,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; diff --git a/drivers/mfd/mt6397-core.c b/drivers/mfd/mt6397-core.c index 7518d74c3b4c..8738b5524783 100644 --- a/drivers/mfd/mt6397-core.c +++ b/drivers/mfd/mt6397-core.c @@ -46,13 +46,13 @@ static const struct resource mt6397_rtc_resources[] = { }; static const struct resource mt6323_keys_resources[] = { - DEFINE_RES_IRQ(MT6323_IRQ_STATUS_PWRKEY), - DEFINE_RES_IRQ(MT6323_IRQ_STATUS_FCHRKEY), + DEFINE_RES_IRQ_NAMED(MT6323_IRQ_STATUS_PWRKEY, "powerkey"), + DEFINE_RES_IRQ_NAMED(MT6323_IRQ_STATUS_FCHRKEY, "homekey"), }; static const struct resource mt6397_keys_resources[] = { - DEFINE_RES_IRQ(MT6397_IRQ_PWRKEY), - DEFINE_RES_IRQ(MT6397_IRQ_HOMEKEY), + DEFINE_RES_IRQ_NAMED(MT6397_IRQ_PWRKEY, "powerkey"), + DEFINE_RES_IRQ_NAMED(MT6397_IRQ_HOMEKEY, "homekey"), }; static const struct resource mt6323_pwrc_resources[] = { From patchwork Wed Apr 28 16:42:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mattijs Korpershoek X-Patchwork-Id: 12229677 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.0 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,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 9DD77C433B4 for ; Wed, 28 Apr 2021 16:46:07 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 EC7EC613FF for ; Wed, 28 Apr 2021 16:46:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EC7EC613FF 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=desiato.20200630; 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=DfgReUrTitcQxkK+qv4dA8GCilGLoyvbJN2UUE4fwew=; b=dERN9cFKquLlqaT3cKAkNsuDA 16kkUn42dh3Gitm43Ftv89h7KGAtcuXT9aXUkBekuqoW8fG5nGXhQzie3dOzPlda29EyDXFlEU/RZ VXLjs4w3e+iQNuFjbyMcdQECZzDwVhHvkYGd48I5aXOsFsFcpX/edz7++xDko6gpYMnASnOI/hKTl YVTfL98bvQTApiXOKqm2oSvLa8Ek7RPsq8Vzcsf0JFdepx5NZuKugTOyQQ5hDQJWzVmaQpjIDqDVb MsU+vdftDrxZE9epZtJdd9yk5UrzDfx2Tmd32RfQsfyxPoTmU9RxUcRCoLn+Vc1lbwBdwJeBa/r0u PIMJubaHQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbnID-003rji-MF; Wed, 28 Apr 2021 16:44:06 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbnGj-003rH4-9z for linux-arm-kernel@desiato.infradead.org; Wed, 28 Apr 2021 16:42:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=4iBEXnR1nc8SuK9x0RI0HjJCZgNJ4KQ0iJTuPJeZHB8=; b=eUDqxx5mDv/pxbYDXuRKy+KqdI XhdWD87Pdtqb7fRYUlyvGz8MuEr9OcW1U6XK4ZEhurfdgzFuv/03kuf7QYXAqUq9VA8UOeNj5/HHJ 3xp6vVSd1eDf+MjK1+GM0LmkK3x+SpK0ZepB+xZ4R4DVPFkFb9ujxNiMhGzQB5lpGqNqPTXAaQkUI Bb3tVzMrCrnYamUIw8UTw5HcPojen1myisY8RPJudx0c8aAxeWQ5f3AGH3PtmWucUhANdSSjrLwBS TrY7+XlXpNZhDAXOOqcUTgr0Oxp8vahErljSWZagXXStAFKzKLebVpxMIzPN0cZRuGbuy9f9oWi7x mjlydMoQ==; Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbnGg-0001f6-TJ for linux-arm-kernel@lists.infradead.org; Wed, 28 Apr 2021 16:42:32 +0000 Received: by mail-wr1-x42d.google.com with SMTP id h15so11513166wre.11 for ; Wed, 28 Apr 2021 09:42:30 -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=4iBEXnR1nc8SuK9x0RI0HjJCZgNJ4KQ0iJTuPJeZHB8=; b=Rq3J38Zqc6gI2+zGNcT7zWRQ3/6wkLaHH1GGf4GEoRqnzFASs7CFrP1Wl6jtxARL9i 3aj23YNgSI3EhVwxyms52vAUEQpyh4ze9anBmJ+Q5V3CahksOV0j6GN/AcTVzP2RqaYI wyi9JoFEQ/WNvw4tR2ifYYBpuQxd//Xs5iNbxGIhZZZcJPib+HdGBlmtbLOVkiPMt7Bo /JEv+93o3OsoP4IdJqHymAfa2Cb9ani1n1MKEPZKL2CwJrmlWcuGZpZz/p01H0MspOya ULpfKTHN06cenKhTc8jYQqtDRVZcQxCkEJ1zxYVrHfNk6WyV9iBi38nwEggGi3unmtjn mhIg== 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=4iBEXnR1nc8SuK9x0RI0HjJCZgNJ4KQ0iJTuPJeZHB8=; b=V2/Qcr1QZELI5/LJHephubXoJ71Nb1q4LX3aJx+UlhHv19QWqP191B1hlu1Hc9h3wC m4rRv0YsdUF75Zi4GYlF907OFlQr+PP9kI2qipFdXSwK/c6Nnj5Hkm8hOAp1ENMB21Z6 gl4o7hL+hxOIDXnGhw1SefrN0FoTdihwvfiOHbu+ImeOtCiubEmBQ+1/7rdGbJh55LUk h4g64V/j/9wu/uz/53Vz4mKn7/tEy8LG4EC7UIoM1X5nMlgwN9gFKMV9+6Rjcoww9lhI HjW7PauAUFVKP9a4AzmTxVppiN0BQfIvBNZyjcK1uhoi8tELE9XpH1Ch/FRUad2t7SLG pBRQ== X-Gm-Message-State: AOAM530Mp19JN1NeDmgc/MB9q3qnQcN4VPUXlKVf7kxLKDKWbOLUZ4Kj clGK36wMr25ZJ6lq4MFUNyfEeA== X-Google-Smtp-Source: ABdhPJyWEwmUF9T2p2cho3eW1dDUOfY2IOjaly14N2nUuESPRrAaxGB0L8uVg8DlnkNWW8vpNPDdaQ== X-Received: by 2002:a5d:6648:: with SMTP id f8mr16158946wrw.396.1619628149075; Wed, 28 Apr 2021 09:42:29 -0700 (PDT) Received: from groot.home ([2a01:cb19:826e:8e00:5864:ddd1:d623:f912]) by smtp.gmail.com with ESMTPSA id o10sm351299wrx.35.2021.04.28.09.42.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 09:42:28 -0700 (PDT) From: Mattijs Korpershoek To: Dmitry Torokhov , Rob Herring , Matthias Brugger Cc: fparent@baylibre.com, Mattijs Korpershoek , 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 Subject: [PATCH 4/7] dt-bindings: input: mtk-pmic-keys: add MT6358 binding definition Date: Wed, 28 Apr 2021 18:42:16 +0200 Message-Id: <20210428164219.1115537-5-mkorpershoek@baylibre.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210428164219.1115537-1-mkorpershoek@baylibre.com> References: <20210428164219.1115537-1-mkorpershoek@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210428_094230_962970_BA049960 X-CRM114-Status: GOOD ( 13.55 ) 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 Wed Apr 28 16:42:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mattijs Korpershoek X-Patchwork-Id: 12229673 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.0 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,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 D2AB6C433ED for ; Wed, 28 Apr 2021 16:44:57 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 37BA261400 for ; Wed, 28 Apr 2021 16:44:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 37BA261400 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=desiato.20200630; 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=5NZlFq36RQ28DjU8Sd+Q2bVThfmbKl+ghWNvfR/ugjA=; b=F1VICEer7FilFeE/5mpYFN+j6 +kSd0fDE2Fs+Ljf8RrJImxY1qGoTwWfBo1jn1gow2Nc1NeaxlusrIN8T7Wg04p61uTjiTNJA1HoF/ O33BOzTMlg+ZlbjAIcM+ZTq1V2EzIud332ff6o2cXqNe9qbj4bDssFE62HWjkHAOVujBsBU6WYZnn g7d5gPIYNeyej+pKfiuoe6S7MV7zKZZCs8SRjVzXNQT5pa79FqRm7ECh5NtAIZV+mBCNbTBtr8/1o a+kEI1lQ5fzXdPAEAiC9Tp4xbDyZ2fOsJAUJP/3JcMfNt3MOEXLZexteTVvzcd7LOSwUBALgXeJJ/ 8EUkd0nlQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbnHg-003rUV-4U; Wed, 28 Apr 2021 16:43:32 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbnGk-003rHA-KG for linux-arm-kernel@desiato.infradead.org; Wed, 28 Apr 2021 16:42:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=8MBBaDUhre2srLQsKuOsbdZLzzPzjDADAo7LfYVNdh0=; b=mtMuVsv3RK78xY17A8FTSoTLVd psvrmk/Y1Dly7uk0KNjNjpNw4TOkCEqeANYLJ2WJPKRXJ7ZwfyiBHb94qGBEQrRZT8ePvJdUqYkAc cjYRxUlbwMTniXRgoGymfn5WT4JCX3PZWKs7NM993o2+AacHHwDFPiSxE6XoNmk5NTrXfp5n5hSPJ b2E1uEKln+S/rZ2Lq60uYezFKlOou6Oc2LyKIX+XUv7hMJWY1wGZzf6gSMWWkptmv5lQonry8OYUJ 5nzodG1urVKuHmqLfRKpUl4n/dW0lv9GrGqUxufPkpZvohsTKTNN528b1UO/3CMwjb1U2HyDEiqFx eWbCJLkA==; Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbnGh-0001fu-WA for linux-arm-kernel@lists.infradead.org; Wed, 28 Apr 2021 16:42:33 +0000 Received: by mail-wm1-x331.google.com with SMTP id a22-20020a05600c2256b029014294520f18so4854933wmm.1 for ; Wed, 28 Apr 2021 09:42:31 -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=8MBBaDUhre2srLQsKuOsbdZLzzPzjDADAo7LfYVNdh0=; b=dMf2Rf068EIMcUbF86uGcl7y+VrBjvrEi4miS1537sNXIbP9JquFm7dJ5IeYmFN76Z pGvXL3FrZO4lrlvufUenqE3iR66VJuHsxG6s8CYAd8JqLwKK8J6vtXO2JvN6a3UsPNB2 5z26JFooDrce9sSy0NcayH18fKq18fogX8pAclxHfsf3f2jjC36M3nMpCwU8mbSYG5Y3 Fu1OSc3ft1OuyDI7B2ulWyAHtJ4EwVE+QPl+nVw8ZYZsnxicGM+BxJsSAko3JvYJbgbl a/72V4mirXmmtfDg94OEWEjpjKeD+z7QOHkYiRIf9OOu0elrDUw1F84Z3llTyfLmntSh lbHQ== 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=8MBBaDUhre2srLQsKuOsbdZLzzPzjDADAo7LfYVNdh0=; b=ThkehfKHjuWUGnpOCRLwGdmkzHTz4h4r8mKa8KzbF+Lz4nXd2FcjsJ8ganww+jUqnO wPaQPg+eHgD2JoLLpMoFZuRwp+6pD9CcGtGjV9psNgIlLcRxXIPX1Uo0LEjchP2tjIkS Zj3t75pKd6KoDo59M8OhNGi+swQ3ZdcZhasBp/EtfcfCiHQecGPJfoJ1j9hNT1wD8XuK FhtpKZiWAy4/CFw6DK2rw9AlHO2bnyoxkqEWuRNeO8FPx4G/3jIU/CWwj1nLWcKZknEb 8yj+38y7caQAzIebUw7newq2xo8FEr+gZMJluaPX+NSbG8l84QdIW/Ufs7GsdBX6WPUT uRhQ== X-Gm-Message-State: AOAM533ze84MgLkgJelyYFtBfWWdHrnf/MyVn+QIZC1GUENBSeFgz4ME wcaGgT6handTQONOYXdSQpB7dg== X-Google-Smtp-Source: ABdhPJzqx+5Jrn6TxR9YemEiPetOXDFd1ci6biCyGonApUTwl6FfBsvBadevq0hrO5ugKbb/NwxzKA== X-Received: by 2002:a1c:c918:: with SMTP id f24mr33059054wmb.12.1619628150175; Wed, 28 Apr 2021 09:42:30 -0700 (PDT) Received: from groot.home ([2a01:cb19:826e:8e00:5864:ddd1:d623:f912]) by smtp.gmail.com with ESMTPSA id o10sm351299wrx.35.2021.04.28.09.42.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 09:42:29 -0700 (PDT) From: Mattijs Korpershoek To: Dmitry Torokhov , Matthias Brugger Cc: fparent@baylibre.com, Mattijs Korpershoek , linux-input@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/7] Input: mtk-pmic-keys - add support for MT6358 Date: Wed, 28 Apr 2021 18:42:17 +0200 Message-Id: <20210428164219.1115537-6-mkorpershoek@baylibre.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210428164219.1115537-1-mkorpershoek@baylibre.com> References: <20210428164219.1115537-1-mkorpershoek@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210428_094232_046729_5E6D8F59 X-CRM114-Status: GOOD ( 20.30 ) 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 b877bf98db38..c635d612bd44 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; @@ -288,6 +323,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 Wed Apr 28 16:42:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mattijs Korpershoek X-Patchwork-Id: 12229675 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.0 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,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 6054DC433ED for ; Wed, 28 Apr 2021 16:45:21 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 95B8360E08 for ; Wed, 28 Apr 2021 16:45:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 95B8360E08 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=desiato.20200630; 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=s9iCTpAITYE5e3QHp7DIKMowbD25GUV12zifn4PHMkA=; b=M22UnYJjuzKtWHyAwEgw5DzgE oiB4myzYtJxLKwi+L70Do4IVyQ+Zu/MkeNuxUKwlgCIZBl+bRttDvJFsoaeXrpNFZUES4M1waaBN0 b7c9wJIXInsM/DyRmTxh3vtb5J9/OalcPDF1gqRiQYoWw7Eeg8e6N7hNIbm/THRn3drDn23YsU7iW lMkOjhgw9RToCVaD4xDs/CgtcwNlC3y5aW4lPUn05IJv6H3eHU8hKw5hJdV7ZicCXSI3MgJWHAUhd R+O3p6rByIWbG4GCfYDAQTLu1bBq67GFi/bZFdjM57uS0StrWbywR8PdCspnVIpqpWrCAGrysBxOA bf9mlOinA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbnHy-003rbE-IH; Wed, 28 Apr 2021 16:43:51 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbnGk-003rHB-Rn for linux-arm-kernel@desiato.infradead.org; Wed, 28 Apr 2021 16:42:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=GXfkThm6aq9/u6OAWtarhuCMLfUI31qoTKi2l6tIb1k=; b=xEfizALaVAfFssYa2E2irTQ6Y9 7pgKQ6Wpg5LEm5iYmI+bzdhErDvk60iY8mRjS1NNGnxdR5rTkS80iKaP5EZtTnqSng6LCyyy70qpZ Fsj7hha/3nzg6gdQ/2b8zjvnblzYTal4r6xfENH/Xrm94HWEZiYnF8CrXDT6y24H+sn8KfCvYvgnz EmJEzi6hXjx8VQE9XISvdx8sG+qT3Xm980ftS2TL1F/dwEAik4df0eDtflVgesQ5uD1yy+8mFnHgs Ij0ZbEfQlk+MMsj/AtYdbOR/X3vkPqaF7Kl5VZ2ZloMmAUP7SnIpmI1T6aSZLtzqS74QXukJ/K6nL uOj8nDkA==; Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbnGi-0001gm-Di for linux-arm-kernel@lists.infradead.org; Wed, 28 Apr 2021 16:42:33 +0000 Received: by mail-wm1-x331.google.com with SMTP id f15-20020a05600c4e8fb029013f5599b8a9so7617092wmq.1 for ; Wed, 28 Apr 2021 09:42:32 -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=GXfkThm6aq9/u6OAWtarhuCMLfUI31qoTKi2l6tIb1k=; b=xmU+qrHv7iCFgEre0umPEDJpoZFKUJz6PeWoEJP7kgqcPPnt2GlvfbWlgxgRcRoW5m Hlbp1sBTPIZTSY3NmfBfy9a97mH1Ry/9oJ5dcLzE9476WrKmNNJgX89m+k5t8oVi5Dms 2qAK3qEAH2yE5ZjhCOHOHK4iWR8MUoPxkBT+AQeDHe8vTVmaktGMpJ5A/41cO1LvIa7Y Z5ROiKowdVjW+OqMPGsyQVbM1GmAIGwBNOv8zs0gxF+14n4x2xFcNadLaVm3n3zmQbz5 EZXHsua4uW1IXTUQ3N4/HYs5Lj5SNmLVLVmkbVejPCblZfW/+wdQQmgGssV+YiLqRcbn 8rBw== 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=GXfkThm6aq9/u6OAWtarhuCMLfUI31qoTKi2l6tIb1k=; b=ufo2IpD896ZTplHW1l+ffxS4MCoTndgmX4d2ZJZBj8E2OcEtXMHF734tYr7JPxD6HQ vsquLbQRTTLJxKJ2JezXLFROjHOZm345hNNuR0lpzAyTTIpb26G2jNPmC3ThsJMvjhRJ Lpmb+UoVz15GkkwKrx72OURQxq2m1a37I7mj98Cpnv9JQpybaoDRjg3/XHR4ADjPKgog bJ0fgRTmJHsbD2zwiGZzM/RVoiC5KkA7sD/o6gm0QXL9cDUN2/jc3F1GyQzcNBPgfmri tKZaXfKgfYIKVmNACLXxQyjlCz9GLxDS7SnhjSuvP5QeQm3KDljMAGK1aH/HIUBNcdRF 6gtw== X-Gm-Message-State: AOAM5305/M4HAmor+GqqI/J77DfVRGR13DIYbTsF5fVW7nB/X2T0Knr0 QW1SYSVDFb1C613WjFxNaw0jQQ== X-Google-Smtp-Source: ABdhPJzejFayeWt08Qeq2ENMXWRVl7HiK9xF6puIKoeU6c94FV5RAzpo0AXm6LqYCBzjp3xJke7duA== X-Received: by 2002:a1c:398a:: with SMTP id g132mr5691770wma.114.1619628151214; Wed, 28 Apr 2021 09:42:31 -0700 (PDT) Received: from groot.home ([2a01:cb19:826e:8e00:5864:ddd1:d623:f912]) by smtp.gmail.com with ESMTPSA id o10sm351299wrx.35.2021.04.28.09.42.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 09:42:30 -0700 (PDT) From: Mattijs Korpershoek To: Lee Jones , Matthias Brugger Cc: fparent@baylibre.com, Mattijs Korpershoek , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 6/7] mfd: mt6397: Add PMIC keys for MT6358 Date: Wed, 28 Apr 2021 18:42:18 +0200 Message-Id: <20210428164219.1115537-7-mkorpershoek@baylibre.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210428164219.1115537-1-mkorpershoek@baylibre.com> References: <20210428164219.1115537-1-mkorpershoek@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210428_094232_482872_A65CBA41 X-CRM114-Status: GOOD ( 12.28 ) 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 patch adds compatible strings and interrupts for pmic keys which serves as child device of MFD. MT6358 has two interrupts per key: one for press, another one for release (_R) Signed-off-by: Mattijs Korpershoek --- drivers/mfd/mt6397-core.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/mfd/mt6397-core.c b/drivers/mfd/mt6397-core.c index 8738b5524783..13a5e15e9dd6 100644 --- a/drivers/mfd/mt6397-core.c +++ b/drivers/mfd/mt6397-core.c @@ -45,6 +45,13 @@ static const struct resource mt6397_rtc_resources[] = { DEFINE_RES_IRQ(MT6397_IRQ_RTC), }; +static const struct resource mt6358_keys_resources[] = { + DEFINE_RES_IRQ_NAMED(MT6358_IRQ_PWRKEY, "powerkey"), + DEFINE_RES_IRQ_NAMED(MT6358_IRQ_HOMEKEY, "homekey"), + DEFINE_RES_IRQ_NAMED(MT6358_IRQ_PWRKEY_R, "powerkey_r"), + DEFINE_RES_IRQ_NAMED(MT6358_IRQ_HOMEKEY_R, "homekey_r"), +}; + static const struct resource mt6323_keys_resources[] = { DEFINE_RES_IRQ_NAMED(MT6323_IRQ_STATUS_PWRKEY, "powerkey"), DEFINE_RES_IRQ_NAMED(MT6323_IRQ_STATUS_FCHRKEY, "homekey"), @@ -96,6 +103,11 @@ static const struct mfd_cell mt6358_devs[] = { }, { .name = "mt6358-sound", .of_compatible = "mediatek,mt6358-sound" + }, { + .name = "mtk-pmic-keys", + .num_resources = ARRAY_SIZE(mt6358_keys_resources), + .resources = mt6358_keys_resources, + .of_compatible = "mediatek,mt6358-keys" }, }; From patchwork Wed Apr 28 16:42:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mattijs Korpershoek X-Patchwork-Id: 12229679 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.0 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,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 DADEDC433ED for ; Wed, 28 Apr 2021 16:46:45 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 33ACC613FF for ; Wed, 28 Apr 2021 16:46:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 33ACC613FF 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=desiato.20200630; 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=VbAj6EJSf4wb+AMR98bBLdWci uso/UsUj54mzzNhx/a5ZktGrbO2IJw7tQ9lSotoxFONFNCl/o5GREGrCIOc1KQHAQ1cHmQXPVeGHn zrSfZFR5+xPhQQdcQRu2fKmpIkfB9fPiC1mHpG9p7ZxNlRyV1lQK3kgXFInyc0ML0JEAPse7fv8Ae KAlwZmlTjMn41WMR9ndBTpjHz4jaOeW4trCi0Cit4pzMFlMNlXzeVj9AFv/2ygbMRWx7yYudznJPj GpVOqbC41m8y5g+fnCVCCiBZAp0okIzqVuHmOllNwY8+zvfghHO/0YJ5iE9e+5bPPF3bJbrdZ7KVp HwiBgavuw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbnIW-003ru4-Uu; Wed, 28 Apr 2021 16:44:25 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbnGl-003rHH-T8 for linux-arm-kernel@desiato.infradead.org; Wed, 28 Apr 2021 16:42:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=rEhU8Um5f0JiN5UeHBJI5GyHDmhvUyYTxNlEBkR3UOo=; b=AMzfovCPC2BK24AGM5MGpPruxn 4qkVEBHXtodFnvp5hKAmB7BnuWPmRUojnejg7srMShJWDd7i4StR/JcFzOyeO0K0BzIcZWK6EDe7Z YTxTGl+T1hO4fPGSwxW3wbiiVNnBfilV7iT2sTW9I7DdFNMj76+MqycGb8qRgwRpQ/FFQMOAoEWMx 3cBcvzQFhmRKmGUR7DXJ/ZCk51cjO9ErFLWXELIhaae1a4hfYve85lu/bAgaCQjyQWZNJaCnO8910 bzYaOZTo8+qtSqO6SiCH54tVcGBRSCMSLUBOzVCaV34FjnrCTot+onZYI8iDAYknDSr0XS8ySFGdI dujvyQ6A==; Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbnGj-0001hY-Et for linux-arm-kernel@lists.infradead.org; Wed, 28 Apr 2021 16:42:34 +0000 Received: by mail-wm1-x329.google.com with SMTP id n127so22378345wmb.5 for ; Wed, 28 Apr 2021 09:42:33 -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=VANfQzQ0qON+/3vbMLMeo4ASaKFeXcGWMD6nIW0LD8DjR1bqi4cUiu4gKKeaLke52p qIEKuNpnOiXnFStis487cvxwy75vIEhnZF79j6c+Q5ahIwL+kzfAT7nTBXd5/HxTSdZi QqgCB138YLKciSWvIYZjC7A0qhuIk30UR5sjlYySEmRH1PrnbMdP9YSkE+V9amPfgN7R AXkAk5vkO9Ium1n1CU3J6s8MQTXDVaaN7pxpwVAZJnt8+UfamsBUWFB/DswEgxNwaSHV aQtt21fZi05Tu0+0dIIOpug4QInjppHkAZ7KtIueLir5KFpei5pMLKyBuRUKPElfOmzU +U0w== 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=MTsfmSIv0SQHTtwIepplC0RYKU21Sk88LqqkHzsmiY/yVkpbwjH0C3B58XDGloup6K oBHaHmrqvgtqWLebS+ZgJGA/gYQ6NY3ZSJsB1aSMdPVx7UHV8UYKzaZrUYs9hFnioVBu IVueSnNBx8J/SPyrzL0M+EtcPnPv+nd1+QG7oJVdL47HytQfwWLEcLZEec77JI9DrFDe dZmIcLA2Q14aIwpgvpUO7OaLnHglYxNIMkcMvIItM0TBJvGPzg1+2556Ru8/QrJdyZoN MWmkzSZbcz0Mak6ALEQG0dbcy92l2KV9TzwsAV9iVy+ueA3GTPRPGzp2pgOotIHUaIJQ hUUQ== X-Gm-Message-State: AOAM532NR3UK92ly6ecsY1FMQBaItx3iS9wkFvIGaJ1UM5Cx78KL0mTO s3/wqfP19lfGeVRmyRiXpwqPUQ== X-Google-Smtp-Source: ABdhPJxng5RPhsw/McvY8XrJYzLmH7UXgx8AS7ZgIpJmZ5h8u3Ww/Ds6Rad8TOErgiFInrsHrO7P3g== X-Received: by 2002:a05:600c:2cd6:: with SMTP id l22mr25791567wmc.160.1619628152274; Wed, 28 Apr 2021 09:42:32 -0700 (PDT) Received: from groot.home ([2a01:cb19:826e:8e00:5864:ddd1:d623:f912]) by smtp.gmail.com with ESMTPSA id o10sm351299wrx.35.2021.04.28.09.42.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 09:42:31 -0700 (PDT) From: Mattijs Korpershoek To: Rob Herring , Matthias Brugger Cc: fparent@baylibre.com, Mattijs Korpershoek , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 7/7] arm64: dts: mt6358: add mt6358-keys node Date: Wed, 28 Apr 2021 18:42:19 +0200 Message-Id: <20210428164219.1115537-8-mkorpershoek@baylibre.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210428164219.1115537-1-mkorpershoek@baylibre.com> References: <20210428164219.1115537-1-mkorpershoek@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210428_094233_527275_0A76A359 X-CRM114-Status: GOOD ( 11.70 ) 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 = ; + }; + }; }; };