Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4763965rwl; Mon, 3 Apr 2023 09:14:43 -0700 (PDT) X-Google-Smtp-Source: AKy350bRrqVDYiezeTnjypWSGcmkmDAxdYx9sAudoxuy7zkMKNuC+JqYq+kigodRKU9pdK5Cvgq3 X-Received: by 2002:a05:6a20:8ed5:b0:d9:896b:8c0f with SMTP id m21-20020a056a208ed500b000d9896b8c0fmr18984127pzk.24.1680538483191; Mon, 03 Apr 2023 09:14:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680538483; cv=none; d=google.com; s=arc-20160816; b=Etl/Sbm3PzWhYEKHmbAbaHbonr6ITMqX+ducFeEafk/JGhLEHYWPWV2wz7eIQ5nGCG vDN3E6VIoPGUMZKC6Ol0h9GONcAo5gyIzlvpSVZD6PLTGMXkwJrdGLEp5dKO79+CRt8i FYxPaFMFNMYdT2sGpTIMbC25YAoiz0yMoOBzoZnkRVIOmHVC+hAsAn60AhwPrLgTrmdS 39Vc6MzuBoFVCr+o/c4eVOQP5M1lACIBs/r/c6wEh8rNwPahfLUML2JROUqJahWm4WA2 flUO753azmihzDFRxsA9O0/h4b9MM7WMNz5zxhKG3XVNX+8HY3v4MLoLpXjyfyQW96nI amyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=9lMo44qc1wp5y60MDEm+5G+GPoPRAIxgxJdskUD6fbk=; b=0EimRzHfvAVeGVyDG9GlRuYi8Ww0sGTw2x7AE3qPZQ9Qzrup5bWFzyMFS6XIlJVDLj +/QNiMNHU7uT/h+X+G7pfbGHzrU89ljxj2nYUqGOwrt8pXqZz5AZAfIe39bF1XSSkYbM 3dNyEmCa4jAql3IYVD3pC2dpfV8TtSL1GUj1r+XgLZAP0MIkKazb2t8uWvwoJqpHAoc4 U6vF6sFwtU3zjQ04XcU1c6CZ6yZb9IZfFoWQHSm1j8AUkfiPza8bQcjpL734hpjRzHiR h5SyvB72hzvMiv5szbk3Btue59MrzzBA2Eas+skL1zj+jCce2J7eS+wmgFs6Av7b+e8P PQgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=C9GkqTYA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b2-20020aa79502000000b0062b90348402si8540627pfp.106.2023.04.03.09.14.30; Mon, 03 Apr 2023 09:14:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=C9GkqTYA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232726AbjDCQGz (ORCPT + 99 others); Mon, 3 Apr 2023 12:06:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232831AbjDCQGu (ORCPT ); Mon, 3 Apr 2023 12:06:50 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4F62423A; Mon, 3 Apr 2023 09:06:17 -0700 (PDT) Received: from [192.168.2.163] (109-252-124-32.nat.spd-mgts.ru [109.252.124.32]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: dmitry.osipenko) by madras.collabora.co.uk (Postfix) with ESMTPSA id 62445660313D; Mon, 3 Apr 2023 17:06:15 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1680537976; bh=51DH+WEXRTwye3bL60EML5+n6ov/nUbID+1syBtvpVc=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=C9GkqTYAX09V3aIvsoWtqW3YPmEWj7zFP3HggswnZ4se7DeHa3lkiNFh+heVl0M8r SMS5ViZbdpkfsdTECVba356upLtrBCtf/hNI9XsK/zgOjLro2s7iXKpiHBPbtwebTl KmGe4nw/TN92clBXluiu6KIIxxbc6dDRGFReFqMARCrijGVwoRa4ZJilHlovsJDHDo j+sCM4MDZKBJqgndI3A4ms85H9GC6k1totnOzsXmlIM9oNQ+l6D08COyCBlP7K9d9N lzCUdaIjaMrO122v9zron59ycQAJAJwca0VO36KRO8MSvgkXEdy+iizwUIUlWzs4uH PbHYXc3qx29gw== Message-ID: Date: Mon, 3 Apr 2023 19:06:12 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH v2] soc/tegra: pmc: Support software wake-up for SPE Content-Language: en-US To: Petlozu Pravareshwar , thierry.reding@gmail.com, jonathanh@nvidia.com, p.zabel@pengutronix.de, ulf.hansson@linaro.org, kkartik@nvidia.com, cai.huoqing@linux.dev, spatra@nvidia.com, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Viswanath L References: <20230330170621.258068-1-petlozup@nvidia.com> From: Dmitry Osipenko In-Reply-To: <20230330170621.258068-1-petlozup@nvidia.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/30/23 20:06, Petlozu Pravareshwar wrote: > The Sensor Processing Engine(SPE) can trigger a software wake-up of > the device. To support this wake-up for the SPE, set SR_CAPTURE_EN > bit in WAKE_AOWAKE_CNTRL register associated with the wake-up for > the SPE. This SR capturing logic is expected to be enabled for wakes > with short pulse signalling requirements. > > Signed-off-by: Viswanath L > Signed-off-by: Petlozu Pravareshwar > --- > v1->v2: > * Rebase the change on latest code. > --- > drivers/soc/tegra/pmc.c | 24 +++++++++++++++++++++++- > 1 file changed, 23 insertions(+), 1 deletion(-) > > diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c > index cf4cfbf9f7c5..2a2342eff622 100644 > --- a/drivers/soc/tegra/pmc.c > +++ b/drivers/soc/tegra/pmc.c > @@ -3,7 +3,7 @@ > * drivers/soc/tegra/pmc.c > * > * Copyright (c) 2010 Google, Inc > - * Copyright (c) 2018-2022, NVIDIA CORPORATION. All rights reserved. > + * Copyright (c) 2018-2023, NVIDIA CORPORATION. All rights reserved. > * > * Author: > * Colin Cross > @@ -177,6 +177,7 @@ > /* Tegra186 and later */ > #define WAKE_AOWAKE_CNTRL(x) (0x000 + ((x) << 2)) > #define WAKE_AOWAKE_CNTRL_LEVEL (1 << 3) > +#define WAKE_AOWAKE_CNTRL_SR_CAPTURE_EN (1 << 1) > #define WAKE_AOWAKE_MASK_W(x) (0x180 + ((x) << 2)) > #define WAKE_AOWAKE_MASK_R(x) (0x300 + ((x) << 2)) > #define WAKE_AOWAKE_STATUS_W(x) (0x30c + ((x) << 2)) > @@ -191,6 +192,8 @@ > #define WAKE_AOWAKE_CTRL 0x4f4 > #define WAKE_AOWAKE_CTRL_INTR_POLARITY BIT(0) > > +#define SW_WAKE_ID 83 /* wake83 */ > + > /* for secure PMC */ > #define TEGRA_SMC_PMC 0xc2fffe00 > #define TEGRA_SMC_PMC_READ 0xaa > @@ -355,6 +358,7 @@ struct tegra_pmc_soc { > void (*setup_irq_polarity)(struct tegra_pmc *pmc, > struct device_node *np, > bool invert); > + void (*set_wake_filters)(struct tegra_pmc *pmc); > int (*irq_set_wake)(struct irq_data *data, unsigned int on); > int (*irq_set_type)(struct irq_data *data, unsigned int type); > int (*powergate_set)(struct tegra_pmc *pmc, unsigned int id, > @@ -2416,6 +2420,17 @@ static int tegra210_pmc_irq_set_type(struct irq_data *data, unsigned int type) > return 0; > } > > +static void tegra186_pmc_set_wake_filters(struct tegra_pmc *pmc) > +{ > + u32 value; > + > + /* SW Wake (wake83) needs SR_CAPTURE filter to be enabled */ > + value = readl(pmc->wake + WAKE_AOWAKE_CNTRL(SW_WAKE_ID)); > + value |= WAKE_AOWAKE_CNTRL_SR_CAPTURE_EN; > + writel(value, pmc->wake + WAKE_AOWAKE_CNTRL(SW_WAKE_ID)); > + dev_dbg(pmc->dev, "WAKE_AOWAKE_CNTRL_83 = 0x%x\n", value); > +} To me this needs to be moved to the SPE driver, which should get the PMC regmap handle and enable wake only when needed, similarly how it's done by USB Tegra drivers that also need to configure PMC. Otherwise this looks like a hack/workaround. -- Best regards, Dmitry