From patchwork Mon Jul 11 15:40:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 12913935 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D55C1C433EF for ; Mon, 11 Jul 2022 15:41:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tk6loMAJv8GHhY0/zvxHRll9mei9nucXlEHAC9yih8I=; b=TJ54EhwgveXZWE EgqZzItWfG0CVCZ2DqolfwX4ryRo3sotvog22ebx2tlbXRTyrZ9iiMTHWwD3UyWbQ//omH+5EjwY9 IgbtzQxvweImC8rB5/uWCTxZIEi4vxvybP8fB8nx6GpD/5PKGh6bjfqe+USZhgKSEGus6WC71qoHd 6SiLXgcyty28QcKwVR4dgtt6d4hKptYwJK8ypNvZUMsYuIVw/zrdSPbv9Zuusyl0o2sWXv5LwPGQW oaFNV5vIbth+YrlyzUA8LeXPTkbB1Tp2di8Nfvui8XnDDsPaTJIu3r1zj9CVYSddT4BJDHLZd9i68 iLQS0y2YfmbCWEMgQixQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oAvWl-002vP5-63; Mon, 11 Jul 2022 15:40:51 +0000 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oAvWZ-002vJ1-PH for linux-arm-kernel@lists.infradead.org; Mon, 11 Jul 2022 15:40:41 +0000 Received: by mail-wr1-x430.google.com with SMTP id a5so7526143wrx.12 for ; Mon, 11 Jul 2022 08:40:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bYnBr/wNjLJrIFyLmT5Q7G4SeBDinWfBMSvyzlXXgSQ=; b=eiokIFpp+GOJ5ReQxNwA54jx2zNuEr8L0Fp07BWZP3GPRzFl+mADVnpKKAvW16RfHU unIV/OgTCpRUScck8bBY72mCqa/PRWMXen+NHQuQrhPqpNLEMtkJm5lwhkxEZ/8JaNr2 EsRjTIYXL8PIQjxdiN3GNDUm6dsWNZOTiGsTUIhBFGpCtmPO6X2LzZrIPtsldpB7g06B YkZeCygpo5hdxhjUrnYYoWw2wRtS8xkw5+cT2xX1cwsj8+agYu0NWMQlk+sAqI3azT2w c0ahYC0VoAcUtgx8sUskxV8bNPP0ycSxYz1kArDLPGUL9cHQVebJEDO4pWJE85O/4JXH Jj+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bYnBr/wNjLJrIFyLmT5Q7G4SeBDinWfBMSvyzlXXgSQ=; b=4X1wsxPQwSVN7vApci4+tcKqOolZ7DIHw0WT+p0zWmhh5j60Wo1PexSwl0WhV9hhC8 7eoWao6NJy+zA3HL26xBVP1bWBCUApbb8cAF7AoT7Cmpi0GB9pa860egEmNY4Akn6MrQ 5gB06NwsJKFbsxR+LMYsW8C5gPsCSE6YI0IfO1HNJG/lFZVzKXp4oYXxTEp/l59bHaRm W/q11hDCIM72nTabtKL/O2J0CBzOtiaIrcT1F5VDSgEwt7JWosLM1wLMr2+d0bO/c9b0 H984zA4gWkVf7orXOibdfDYQ/m7ozKx2hhQxIbkh7OMkSiHrfGVhvWDB0wutUoFEgOON 2KTg== X-Gm-Message-State: AJIora8oOBQ13VKylj9rj3SsoNCXDCEH8HohF+qWZT3vdOcKWEjLPRyF IqCrEDhlheQCJ0xWLylIpFQ= X-Google-Smtp-Source: AGRyM1seQ4TfQNSOKZKXsHAuGRJRBTFM1o9VOYZKGqyYG+h23bFo8N8pfa8aquk8RpdK5rTpunaSsw== X-Received: by 2002:a5d:4a0c:0:b0:21d:78c9:c5d3 with SMTP id m12-20020a5d4a0c000000b0021d78c9c5d3mr17490933wrq.42.1657554036880; Mon, 11 Jul 2022 08:40:36 -0700 (PDT) Received: from localhost (p200300e41f12c800f22f74fffe1f3a53.dip0.t-ipconnect.de. [2003:e4:1f12:c800:f22f:74ff:fe1f:3a53]) by smtp.gmail.com with ESMTPSA id c8-20020a5d4148000000b0021d8b1656dfsm6109291wrq.93.2022.07.11.08.40.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 08:40:36 -0700 (PDT) From: Thierry Reding To: Thierry Reding , Jon Hunter Cc: JC Kuo , Marc Zyngier , linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/3] soc/tegra: pmc: Add support for simple wake events Date: Mon, 11 Jul 2022 17:40:30 +0200 Message-Id: <20220711154031.689715-2-thierry.reding@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220711154031.689715-1-thierry.reding@gmail.com> References: <20220711154031.689715-1-thierry.reding@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220711_084039_838670_A0370EFB X-CRM114-Status: GOOD ( 17.09 ) 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 From: Thierry Reding Simple wake events are neither mapped to GIC interrupts nor have an associated GPIO line. They are close to GPIO-backed wake events in that the IRQ hierarchy processing needs to stop at the PMC level, but since there is no dedicated GPIO line for them, let's turn them into a separate type. Signed-off-by: Thierry Reding --- drivers/soc/tegra/pmc.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c index 0e87fdb90a4a..48286bc59f46 100644 --- a/drivers/soc/tegra/pmc.c +++ b/drivers/soc/tegra/pmc.c @@ -296,6 +296,17 @@ struct tegra_wake_event { } gpio; }; +#define TEGRA_WAKE_SIMPLE(_name, _id) \ + { \ + .name = _name, \ + .id = _id, \ + .irq = 0, \ + .gpio = { \ + .instance = UINT_MAX, \ + .pin = UINT_MAX, \ + }, \ + } + #define TEGRA_WAKE_IRQ(_name, _id, _irq) \ { \ .name = _name, \ @@ -2239,6 +2250,7 @@ static int tegra_pmc_irq_alloc(struct irq_domain *domain, unsigned int virq, for (i = 0; i < soc->num_wake_events; i++) { const struct tegra_wake_event *event = &soc->wake_events[i]; + /* IRQ and simple wake events */ if (fwspec->param_count == 2) { struct irq_fwspec spec; @@ -2251,6 +2263,12 @@ static int tegra_pmc_irq_alloc(struct irq_domain *domain, unsigned int virq, if (err < 0) break; + /* simple hierarchies stop at the PMC level */ + if (event->irq == 0) { + err = irq_domain_disconnect_hierarchy(domain->parent, virq); + break; + } + spec.fwnode = &pmc->dev->of_node->fwnode; spec.param_count = 3; spec.param[0] = GIC_SPI; @@ -2263,6 +2281,7 @@ static int tegra_pmc_irq_alloc(struct irq_domain *domain, unsigned int virq, break; } + /* GPIO wake events */ if (fwspec->param_count == 3) { if (event->gpio.instance != fwspec->param[0] || event->gpio.pin != fwspec->param[1])