Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp463055imi; Fri, 22 Jul 2022 02:57:57 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uraZV6E7AbyWUccm5SoU61ctRAr4A361CS4/ncKGV3kWdCfPWgg6wZVZ7PeHJw4sEP2mqJ X-Received: by 2002:a05:6402:370c:b0:435:cb14:9aa8 with SMTP id ek12-20020a056402370c00b00435cb149aa8mr2688105edb.35.1658483877526; Fri, 22 Jul 2022 02:57:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658483877; cv=none; d=google.com; s=arc-20160816; b=hrHzF3MP1m0vw8JCq1HFOZElp2/13gQb8kzOYuCfy/8jjnbZA3xvh+jOpWZcOuqhYr /MA+F9FF1HW3YaKjLLnwJv5ofK0AGaecnNM1YmxIsgHV5stzXfyXmF34O2wiy1S8W9Td TBi6A9tzq31a83YBzzBvwFhirXsEhuT4KD5p0Ix3seO8WFzjF4ukREWomAaPulPLW3MA WWx6bb3MluQAL/VGc4WEyjMGKVwY17VlqRYbxTNcacrAWQ95bu8HWuSjSxnUC/AyWWWx Pkko7wIIQAKjLA/J4NOEiKR8XUXh2EMFgLnbxf+jOE3jgFb3CIzWj/8WjpNU65+9B5J4 Gzfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=RqguWUk1rJeah6sayFgpV4hCcMGCEveOejOkfdvaauI=; b=Cbz7X8r+4pVu4m5n+ibJTfpFvJpsdIF8yIxKeHNWRABKgT96YZ2W0LhxR/0dCCAmND n5jzWZHgH4zY1QAz0r/inrfpodGTB40rGtFHX4bnmD9BlSkM/fc15vVe26Uwq24rJh8f pHnD4ow6Hp7sAnPvs7bsjUDXRGc1nOqWU7zFpnCxgIfEqGYCBKQKkEjamgOJrTmCqpva Cgws26/tyVa/P303Hmhgawd2xZLN2tBwhtamyrsffzOxqTuyMvRodU78U3o/cyy0tIJp ig6OlY0N2Cpu9eA/MPYE5zNWZKhfWmv1Xjmaw6shF94g8h0rsjtOth8uxTEChPfv+Bg7 oVHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=WXJYmOr2; 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=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cy16-20020a0564021c9000b0043aba611926si4424184edb.181.2022.07.22.02.57.32; Fri, 22 Jul 2022 02:57:57 -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=@cirrus.com header.s=PODMain02222019 header.b=WXJYmOr2; 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=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234624AbiGVJua (ORCPT + 99 others); Fri, 22 Jul 2022 05:50:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235432AbiGVJuG (ORCPT ); Fri, 22 Jul 2022 05:50:06 -0400 Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92C79D1 for ; Fri, 22 Jul 2022 02:49:01 -0700 (PDT) Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 26M5Vgns024448; Fri, 22 Jul 2022 04:48:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=PODMain02222019; bh=RqguWUk1rJeah6sayFgpV4hCcMGCEveOejOkfdvaauI=; b=WXJYmOr26IMQ/c/8qoDhCKkRgnDcdsn0o3x0IWMIEW2bwOfsP6KBm5a/Fr5+F905Hb88 udC2qq4EStnbvpYh4+JP8Php7wcMbTmPxdrnGWhU4mEmujfRKB2QPtWRg9h09bw/0Fkg jVMuQeDwDuBuHoQDKsX4GOoDzHlJw0lO0/zUZQ+5NMW3QzeaDVtVpRU36JHeZYmHWDPx lmey11RTpKGeOGBemc5Mj8x4ejqAx9U4DhNU3zBZHdn+HkovXaoXesnJL5iztxhVbUJ0 W1UNzZ07g1rH/LlqLj3EvJhzNMtBiI2t5hATG/kdDfF0i3UioDwPwHtEFsLQgvOaHh3A 4w== Received: from ediex02.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3hdrqfm7mt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 22 Jul 2022 04:48:53 -0500 Received: from ediex01.ad.cirrus.com (198.61.84.80) by ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.9; Fri, 22 Jul 2022 04:48:51 -0500 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by anon-ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.2.1118.9 via Frontend Transport; Fri, 22 Jul 2022 04:48:51 -0500 Received: from algalon.ad.cirrus.com (algalon.ad.cirrus.com [198.90.251.122]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 9BC8146B; Fri, 22 Jul 2022 09:48:51 +0000 (UTC) From: Charles Keepax To: CC: , , , Subject: [PATCH 1/2] firmware: cs_dsp: Add pre_stop callback Date: Fri, 22 Jul 2022 10:48:50 +0100 Message-ID: <20220722094851.92521-1-ckeepax@opensource.cirrus.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: 0IoHYEQNb1QF9zb0f0-Z1f0CO81vWuai X-Proofpoint-GUID: 0IoHYEQNb1QF9zb0f0-Z1f0CO81vWuai X-Proofpoint-Spam-Reason: safe X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 The code already has a post_stop callback, add a matching pre_stop callback to the client_ops that is called before execution is stopped. This callback provides a convenient place for the client code to communicate with the DSP before it is stopped. Signed-off-by: Charles Keepax --- drivers/firmware/cirrus/cs_dsp.c | 3 +++ include/linux/firmware/cirrus/cs_dsp.h | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/cirrus/cs_dsp.c b/drivers/firmware/cirrus/cs_dsp.c index 7dad6f57d9704..b402f841d72cf 100644 --- a/drivers/firmware/cirrus/cs_dsp.c +++ b/drivers/firmware/cirrus/cs_dsp.c @@ -2725,6 +2725,9 @@ void cs_dsp_stop(struct cs_dsp *dsp) mutex_lock(&dsp->pwr_lock); + if (dsp->client_ops->pre_stop) + dsp->client_ops->pre_stop(dsp); + dsp->running = false; if (dsp->ops->stop_core) diff --git a/include/linux/firmware/cirrus/cs_dsp.h b/include/linux/firmware/cirrus/cs_dsp.h index 30055706cce21..6ab230218df0e 100644 --- a/include/linux/firmware/cirrus/cs_dsp.h +++ b/include/linux/firmware/cirrus/cs_dsp.h @@ -189,7 +189,8 @@ struct cs_dsp { * @control_remove: Called under the pwr_lock when a control is destroyed * @pre_run: Called under the pwr_lock by cs_dsp_run() before the core is started * @post_run: Called under the pwr_lock by cs_dsp_run() after the core is started - * @post_stop: Called under the pwr_lock by cs_dsp_stop() + * @pre_stop: Called under the pwr_lock by cs_dsp_stop() before the core is stopped + * @post_stop: Called under the pwr_lock by cs_dsp_stop() after the core is stopped * @watchdog_expired: Called when a watchdog expiry is detected * * These callbacks give the cs_dsp client an opportunity to respond to events @@ -200,6 +201,7 @@ struct cs_dsp_client_ops { void (*control_remove)(struct cs_dsp_coeff_ctl *ctl); int (*pre_run)(struct cs_dsp *dsp); int (*post_run)(struct cs_dsp *dsp); + void (*pre_stop)(struct cs_dsp *dsp); void (*post_stop)(struct cs_dsp *dsp); void (*watchdog_expired)(struct cs_dsp *dsp); }; -- 2.30.2