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: 12229691 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 11856C433ED for ; Wed, 28 Apr 2021 16:43:16 +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 5F70B613FF for ; Wed, 28 Apr 2021 16:43:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5F70B613FF 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-mediatek-bounces+linux-mediatek=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=puVv4yDBGc5tTG5tEN4Um5DU+yRd9Xh1n0spNI1Nl0M=; b=YrWzkiR0Pscy5b0mu3W2/J3h8 oOS/vflErtdChrJAZuTIItaYzVFCCXgQf4qMznlQMju+eyBtcUehZtAzeX4ywENx+X3K1mbOCy3K9 JsVkFVKLIGKada6tytEDBJdDGZuW0DHwf/0nH0iGT9b3btm25jOPo9Y5gGlrkcAviOZz0u4xCkjlM LbkuySsbk0jweNCjFtDS97UzWxA+Y71y3PX2M8aIDaPbYjoMayXGWZc/Yo9pr4hK+AbO1Zl0SF6cT dJ+QDe23SCjuy1np1GMXfd6TETGf3HnbrH+SfYTcXjdFOGWOpgbyyT4jJu1LUsjJjNB1KvEcRDckX 36aXH0Pzw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbnH9-003rLU-Nl; Wed, 28 Apr 2021 16:42:59 +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-003rGj-Lc for linux-mediatek@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-0001db-HA for linux-mediatek@lists.infradead.org; Wed, 28 Apr 2021 16:42:30 +0000 Received: by mail-wm1-x329.google.com with SMTP id l189-20020a1cbbc60000b0290140319ad207so7233466wmf.2 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=UIBlECl/r3Tnn0c/2JnsEKh8VvvE1NE0YXn1K5pSfUi8iYdEy86Ns56u9sEae7evO4 3jkwEKk7gpxOiz/FtaE0cmRcHUfnbbHPHp7j0zNuX/LQNeBZV4YZ72S7FiRzH27nagel dKnzd5Oen8FI/m3Rxm1xBjEpQ/bbn18ui8fVI08RCqzhawDMZSJbLKmkwJm3lbL1yuiZ xX/AcxWlg/b6gTemZqz7lx2PpbUfhBRtboGp2U57knxZQHwJ+UmezOH56VDOCg6US08E WrRZflv8WLEufq85ApA8X5WTBf0cPwdJwXVs9rVpZRMKL6L8k3oaYWxLDfDutXRVZiQf m4sA== X-Gm-Message-State: AOAM530fZ3ih2R2JZeMilF1w6pWEDCf/6BquZp+ONaNsmcSUzcc2N63Z dvhzMAI/0rFsWvm9fRNueI7qvNwgC7Mb6w== 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_585845_B87B66F7 X-CRM114-Status: GOOD ( 12.58 ) X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=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: 12229693 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 C48EAC433B4 for ; Wed, 28 Apr 2021 16:43:27 +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 0C56C613FF for ; Wed, 28 Apr 2021 16:43:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0C56C613FF 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-mediatek-bounces+linux-mediatek=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=YR8mhfCT6WOmW6L60t5jxRTBfU45BYoDzYm/bpIho2I=; b=bPNppJki977OLucI9cJSlQwa/ GgxN9rcBi4ItVN+rnRswM8zVsu+fQeNc0brfC39kkfvy8y0qWu4X+N23eArWdX+jjaiND8UUcl7g9 m1KQR8uP54YMSDzZ96+/k04tYg60VOnGfKGhZsewYc4yC+oXG2NJuR2574G6PCNYtVJNZ1igKZMTY sHsCVBJOx6BXsfVHFJ8cBeVOEKGIZ7QKRsKwFATgnrJ0RqjJmARxQzQOEefnMUF/ChSQN4c3VXy33 UNOaOxkdxBcfhe8I6VVMpdmmRxOblEwOGdgPhYRdZqFucm4qTcPsQX7PWVvGfGqeEqYy5yDPn0IHw uDeRHvViw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbnHM-003rPO-HU; Wed, 28 Apr 2021 16:43:12 +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-003rGV-Ke for linux-mediatek@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-x32d.google.com ([2a00:1450:4864:20::32d]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbnGe-0001e3-Mh for linux-mediatek@lists.infradead.org; Wed, 28 Apr 2021 16:42:30 +0000 Received: by mail-wm1-x32d.google.com with SMTP id a22-20020a05600c2256b029014294520f18so4854839wmm.1 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=FX8ggTGSFUvSmkJOCQ1C4lBE0on1yh22lmjU+tTvHXVSWYVi69yJsIBBu89mdW/kOV uAeEjJkL42jXN1zYqReFdCjnfrV7GWV3XCwyco0Ozw4I3CUmzrFi37GjAUR9g2FsIfn9 jUO/iui0mLrtUnOd/6UaUN94o08EqIxmhqjiblRGNnStoqaUyPfInI8RlzAy/IhzzJNQ 2EyjOetaOrVR/TJkTZxEjWRJ4Kq7mHsyFBbAA+rn9CL4FmwrRXQo7MEUhFeLLxN4MPN9 jcIQD+FsYvaKpz8MhiJhw+9cws17MZNY+6KMnjt5C7tvKbF6OrbveaOqMyGzE/4/mY9j xB4A== X-Gm-Message-State: AOAM531/02n6MHOnAK9fVqAl+BA74gVRIsyR7O1ffhYZOdHOecHLqCJl u0e9BiGOwddl/QrH3Gg3RRV6dA== 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_745078_47F7A53D X-CRM114-Status: UNSURE ( 9.08 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=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: 12229701 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 9F6EBC433B4 for ; Wed, 28 Apr 2021 16:44:35 +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 E0878613FF for ; Wed, 28 Apr 2021 16:44:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E0878613FF 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-mediatek-bounces+linux-mediatek=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=QlQh9PsRUqXuFmomB2E2NDN0x2dQS3ZUtEvg94JGqbA=; b=d0bGL66lfyu7tlwN8FvFOL2Ww TKLfD8v2LzI3jWk7iR5xzSk0OBdjVJizUyckxLMcWOnd2X5gAQ00GZa2OHh/Yiowtl2syZSR3AgXS t7N+chn5jTfOzVoKL+oMVCgDebyOahPCHKeYP6FPFFH7hol+AUwX/N6gCmelwGrOXOAJ1q9yaIBvj 0NkVuDEcgL34nCdBobXRNl798MpdR3R/4fkXltrtFuT9z6BtTp6CoV6zeJiNu8uQH1Yxlgd5knspD xgcKPdZ9HvJo0amoNSz+nMlppN1HqSNu7dzMbc+hzM4bNJbSG0i2NvNyz76RwMXqwE4TWh7JiagK3 pLDeIXNlQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbnIS-003rsh-GA; Wed, 28 Apr 2021 16:44:20 +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-003rH3-So for linux-mediatek@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=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-x32c.google.com ([2a00:1450:4864:20::32c]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbnGf-0001eV-S9 for linux-mediatek@lists.infradead.org; Wed, 28 Apr 2021 16:42:31 +0000 Received: by mail-wm1-x32c.google.com with SMTP id l189-20020a1cbbc60000b0290140319ad207so7233538wmf.2 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=DmKIT6l7oTvrKyXhedvHKO0dRZXvnnHXhfmb/dNkwEPreKINzh7NyXsB1ZWvVmTek6 B2CTbSJ9ZbKoHqEh1DWy9xtmsgoRkeTyRdr1tpVNDxc91RjWrUIg0I2GJkbnUjtnYGRe sYjAruGhUXY1OEMQve8W0kh8W+un40yWXWaCuSMU2VBDpAredJZysEbEPodjPPnJ5E5v grknULLq+l2yUVn8pT0YJs1vb1mOBjX/oyvwH/BFxUpgZHs+qzAY8294ZVHW6ckS2DXU U+gTpi6bE1a1Tv+M4yas+uwIgEaNf0pb1M8Y+4gjLFzYFS2Kr207nBsEY00/oZQScJ4R v1xg== X-Gm-Message-State: AOAM5305sM0oO7I1aeO26SaiFXUln3Ewd4KoXkcJfFmw/18y1r7PiHXk Dfyg5CUPpPcsS2bM0ef/uu+Gew== 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_916709_1D1825A1 X-CRM114-Status: GOOD ( 14.91 ) X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=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: 12229699 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 EBA50C433ED for ; Wed, 28 Apr 2021 16:43:53 +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 3DE6A60E08 for ; Wed, 28 Apr 2021 16:43:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3DE6A60E08 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-mediatek-bounces+linux-mediatek=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=jR/Asm16lNFGlthGIwb4k2OXNADyLrSxkl4pWh26ZE4=; b=IH+WlsFI0z9TqyteXK1jEc5B6 tVue8afh+jvvaogUEgJDuFY1hUZe0GfmAo39sv0TayjHrv25dX5b9/yvb5+Ea28Zs+Y/yN1lnfgM5 R9doA7Czi5Szc/aLo+EdFkGGk30lJVseLRY2z128PfYvqvyelfLPE9Aj+z0FaDCePsxHpdn8Md4wo Pv60gsbNw+WARVTxZm7OZ0aWPz4RibUjOW9eVJimnMOyH1wj+DUZxIdcfkzKCCqMjUQ3pu/ye7S1N aGI7rtCYZGqNlAiaznzICUB1s36ao+IKFGAv8lFXiCXgOZIoswz3bgonjpuGD+Gki8Z1Fi1t8IyQc 6tKfPbfvA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbnHr-003rZD-2V; Wed, 28 Apr 2021 16:43:43 +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-003rH6-Da for linux-mediatek@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-x429.google.com ([2a00:1450:4864:20::429]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbnGg-0001f7-Uk for linux-mediatek@lists.infradead.org; Wed, 28 Apr 2021 16:42:32 +0000 Received: by mail-wr1-x429.google.com with SMTP id e5so35109304wrg.7 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=oh/GlnksJySm/lmzT76RK2Ubd1xxSgfZYmlmvdRUz52t547eoo4LX0/3ysooN3JXyF 3KtjF+z5Umiv2WlyRRgQVrrrTR8qPmO3ZExc3oQwbxOSFVRXZ/EsAlH2hTmte7J1pf1S xVU09C4eVIdVsArTa+xjeY6vd94Kh8zavlg3SxoL8fyJW0Hq2eIxuTjtY16xjO5qfCQm 9z58p42EK38Lz3eFQhCcktOxcNV9y/yWidwz9NZeUa5s43zY0dESfUTbQmsHEjVE+Jzd yOLTGLm6nWeZVOgldjwD6NEBOMMpRDA1Ug9+rBVxoo/OrGA70dkx12M9ME65KecptCis aP3Q== X-Gm-Message-State: AOAM533RPWuDFZYwJR/ynXzFKhjfJJw28fLY2tq5x+ilJBOVjd0PvmaO Wega0gYcM7dWLsD5qLRmrjNDqg== 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_995246_2F91BD0A X-CRM114-Status: GOOD ( 12.20 ) X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=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: 12229695 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 24445C433B4 for ; Wed, 28 Apr 2021 16:43:40 +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 65E0061400 for ; Wed, 28 Apr 2021 16:43:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 65E0061400 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-mediatek-bounces+linux-mediatek=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=10OmsOy0R92PQJ+210563tFAZF7JLKpsSskTXl/JhHM=; b=m8xMg9jYLAMqYaC+SkcQij2CA 6i2PiJOXv8AQUksZTfVCy/yQZjUrf0E6PmOUwiOhkxBSKE6XVpoeuuLXpvef+qM2JMjVmZLQhRO5G IAu86Km9AwaqAr4jkiL/IEjv5eLybs5QfbqLm7zmtneMUHPWTGjUCOzYKi1XD+edo4/4IjHcnhwyj +pPzaHypPhPkVGXFaTyI49JIeGwzTS9QabTtWol+O5NW39vsOzr098A4bMGs7nBJ1I4BXg1nXhM+F piBi9CXU/5k6byt+ldoDPXEM2i0CvsuC5mQIljpPn4ZLX7CmJOUyGW2/67/EbX/KKyaG+WZ2qaTnA zgwyBIwAQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbnHd-003rTJ-3f; Wed, 28 Apr 2021 16:43:29 +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-003rH8-U3 for linux-mediatek@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-x330.google.com ([2a00:1450:4864:20::330]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbnGh-0001ft-Aj for linux-mediatek@lists.infradead.org; Wed, 28 Apr 2021 16:42:32 +0000 Received: by mail-wm1-x330.google.com with SMTP id l189-20020a1cbbc60000b0290140319ad207so7233588wmf.2 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=IuwLjcXeBifoS5AzMnhpHvv96SG0oLeQfM9WbNlsGVNRTh/aYuzXCOOkPwOs+RbMfQ p3eK3/yUQgSP84QyrDNsdCGwXJYjeZTixyWs4D+FhRyDB1Szmfb06Hbf48pUCNAOp1sC zELQAxrRM6+n6oH9oUF3wtmpXYFY/TCvFw/iC/lfwSTmx7gmVZKhtIyv6rX6l55o/D7n Uy5d8HinlRpxFLogYQDk3VvkVyYx8wng7HvIqXXBnbANqjmqsW3LvnVymEBoNOPgFy3o qWD5jnuUKK5sVbYulTQccWrR2vB6+nqY1MMuzmSdp9qQCK06UF8htFIU5yg3U65Fy8c8 3b8Q== X-Gm-Message-State: AOAM531boqk6tXj/SKPYBE6i2ttq3adkEDHJ5RDW7CgxLL7dRZGh4EAF Yu44e7WX0TmZAXVDsJ36+IJEfw== 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_094231_393720_042E3CB6 X-CRM114-Status: GOOD ( 18.95 ) X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=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: 12229697 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 685F9C433B4 for ; Wed, 28 Apr 2021 16:43: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 AA716613FF for ; Wed, 28 Apr 2021 16:43:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AA716613FF 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-mediatek-bounces+linux-mediatek=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=pc9UWxOOqEivBF5j7wlag192V5lqEZpXiGC2ZwgPUvo=; b=aVQcMTaXo4CQ0BJixXErJzcVe PRND59bSP9S/VjrU7o+/B9Ixu9lYwnvSyzfJulDumNat+7eugHFfGwFS2qmwekG70ay8JglzzRAc2 soYRSASip22Ok6JXcmY7LwZWOu6/tuAnN3/b+pgFoCkaKp+n90pna40m4t91aQreqGQa9+5CZFprv mf6HFFJ3U5JRaDo7hBofmCjWs/XhphZPUbgKApdCZ6qtPIkFg8H0MToNdEjBfkS2kP5pfHDf5OgQb Nr931L7OIlnR8o07QlJLAc/meBkMPGqBgLoGHXwUHMqBUjgw6n+H0tTbkXsn/Yuqi4VG11AnMTU3Q yem2NSZ3w==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbnHv-003raO-Hu; Wed, 28 Apr 2021 16:43: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 1lbnGk-003rHC-U6 for linux-mediatek@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-x32d.google.com ([2a00:1450:4864:20::32d]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbnGi-0001gn-Dh for linux-mediatek@lists.infradead.org; Wed, 28 Apr 2021 16:42:33 +0000 Received: by mail-wm1-x32d.google.com with SMTP id g65so5044701wmg.2 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=QS0947JsDT5Geh1I0UtY3RXWFMUy/whHRuesnN2woF+sA4RthBZzrVDDtrzo0iflyW 6xceHZWWQ9oZyNj0K/nFMme4YyGaKzNBZquVw4XfOlVBA5lQ+bFmlSl/YbX67S6Mjq9R 7mkEBxSHQUfjVBNZkiWlbmXiQ0sOfGbh5VxiXJ5RIIMFR96X5avdYOgnTHzVgrx6vbs7 pOb9XkM+udXwfkHfftYMsQdjLlNi1nQJjk2XHOD7zpVKKJAqL7ELECTVn1lcf2PmPu6h YatKIN/OUJi3w6aS43DwFRRxHg0bk2emXIuvwBlGxfcW0a/YLJv2RL0UCW/iwi89FC67 4x8A== X-Gm-Message-State: AOAM530iuJXKkf8AULZZZmd008P5JpVIBVMtdFX6ozX0kuHBtT0Mj5tG +JeJ/+jstUpn1Z2+/X2UqOj/fQ== 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_486997_3F0B8957 X-CRM114-Status: GOOD ( 10.93 ) X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=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: 12229703 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 E7F28C433B4 for ; Wed, 28 Apr 2021 16:44:54 +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 41E9B613FF for ; Wed, 28 Apr 2021 16:44:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 41E9B613FF 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-mediatek-bounces+linux-mediatek=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=l/JZXUW5+JP21iSZ8qgzbn9Jk+OnXjidPdiyvfI0A2Y=; b=rLnGlncv7DPtaT68JWvJDEnYo lW+ZiSyJWAfsrJjjn4mTwJfGek8gpC4uov+bpxUu/wm/1hDkj4TtkcVq4LXKCECAJXNK7Tt2iKMEV nHU7AVAkeqYNQsOW0ReyKiCUXIf/d/dPhcmyLJoNs5F2OrE0K4R/n4io8HFx+FuWZKIdxpRHK5Gp+ 1eAGH2igsf3RRYQVpDRqRZ+vfSqcDNashAe2N9g3T+/HFTTbCSMLxMZvnpEwzeCHNzZKCDtzGxegM kQmdcBDBzSV7vLXvscCh0bVldX7YKps802fnwRaQkH6ihZ+MyonW2R2P+bKG/72a7brAV810qOjiQ tPC3N2ZzQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbnIk-003s2R-U0; Wed, 28 Apr 2021 16:44:39 +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-003rHG-T1 for linux-mediatek@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-x335.google.com ([2a00:1450:4864:20::335]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbnGj-0001hX-E9 for linux-mediatek@lists.infradead.org; Wed, 28 Apr 2021 16:42:34 +0000 Received: by mail-wm1-x335.google.com with SMTP id i129so7235542wma.3 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=ivPyBgeeKdc/066f1ghBHSQZpXR+s4GLKjgmmSSQoY36RIrxPoNOHVrfMwqRe34aCc /8FcFptWKpT7bnF4GDxOTxj1RadPuTiIhy4DLN2GXjavwEx7JlHPKYy5jGzUoArnEGim wYLdJWBQuvyZFTkA+tHQh3qAw+BHdnWSBB8WBHunRaanIkDJPYzkN/+dnUn3vchFwj/5 l6cABHBAfGdgrlrCi2ZhLDzIQUcSkJTDr8TPjSbtBEbUOYB2X8YT5J+1g17yiDuu1g69 dwzlCEocInUUil/20Rahe0KNVGKPdFRahl/pnE0npt4ywiW34FCB5Mx0MXHrA9qCsFmY n1JQ== X-Gm-Message-State: AOAM533c3yxnzIV+vidKWyMTj12vyVoI7xuyri8/RbPE4R8fWwIVt4/c jU7iYOMzv943a2WQgTaydOdXRQ== 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_527713_ACB15C5E X-CRM114-Status: GOOD ( 10.35 ) X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=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 = ; + }; + }; }; };