From nobody Sun Sep 22 05:42:58 2024 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C41F3C433F5 for ; Fri, 22 Apr 2022 05:58:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233109AbiDVGAz (ORCPT ); Fri, 22 Apr 2022 02:00:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232920AbiDVGAX (ORCPT ); Fri, 22 Apr 2022 02:00:23 -0400 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E0164F9EE for ; Thu, 21 Apr 2022 22:57:25 -0700 (PDT) X-UUID: a5f8ab1f86c24250a29536920915568b-20220422 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.4,REQID:d2152398-c1d3-4725-803b-95f4c2d56d51,OB:0,LO B:0,IP:0,URL:0,TC:0,Content:-20,EDM:0,RT:0,SF:0,FILE:0,RULE:Release_Ham,AC TION:release,TS:-20 X-CID-META: VersionHash:faefae9,CLOUDID:e7d992f0-da02-41b4-b6df-58f4ccd36682,C OID:IGNORED,Recheck:0,SF:nil,TC:nil,Content:0,EDM:-3,File:nil,QS:0,BEC:nil X-UUID: a5f8ab1f86c24250a29536920915568b-20220422 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 15665764; Fri, 22 Apr 2022 13:57:18 +0800 Received: from mtkexhb02.mediatek.inc (172.21.101.103) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 22 Apr 2022 13:57:17 +0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkexhb02.mediatek.inc (172.21.101.103) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 22 Apr 2022 13:57:15 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 22 Apr 2022 13:57:15 +0800 From: Tinghan Shen To: Pierre-Louis Bossart , Liam Girdwood , Ranjani Sridharan , Kai Vehmanen , Daniel Baluta , Mark Brown , Jaroslav Kysela , Takashi Iwai , Matthias Brugger , YC Hung , Allen-KH Cheng , Tinghan Shen , =?UTF-8?q?P=C3=A9ter=20Ujfalusi?= , "Geert Uytterhoeven" CC: , , , , , Subject: [PATCH v1 4/4] ASoC: SOF: mediatek: Add DSP system PM callback for mt8186 Date: Fri, 22 Apr 2022 13:56:59 +0800 Message-ID: <20220422055659.8738-5-tinghan.shen@mediatek.com> X-Mailer: git-send-email 2.15.GIT In-Reply-To: <20220422055659.8738-1-tinghan.shen@mediatek.com> References: <20220422055659.8738-1-tinghan.shen@mediatek.com> MIME-Version: 1.0 X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add DSP system PM callback for suspend and resume Signed-off-by: Allen-KH Cheng Signed-off-by: Tinghan Shen Reviewed-by: Ranjani Sridharan Reviewed-by: Yaochun Hung Reviewed-by: Pierre-Louis Bossart --- sound/soc/sof/mediatek/mt8186/mt8186.c | 28 ++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/sound/soc/sof/mediatek/mt8186/mt8186.c b/sound/soc/sof/mediate= k/mt8186/mt8186.c index a04cea77bd4d..c8faa63497c6 100644 --- a/sound/soc/sof/mediatek/mt8186/mt8186.c +++ b/sound/soc/sof/mediatek/mt8186/mt8186.c @@ -304,6 +304,30 @@ static int mt8186_dsp_remove(struct snd_sof_dev *sdev) return 0; } =20 +static int mt8186_dsp_suspend(struct snd_sof_dev *sdev, u32 target_state) +{ + sof_hifixdsp_shutdown(sdev); + adsp_sram_power_off(sdev); + adsp_clock_off(sdev); + + return 0; +} + +static int mt8186_dsp_resume(struct snd_sof_dev *sdev) +{ + int ret; + + ret =3D adsp_clock_on(sdev); + if (ret) { + dev_err(sdev->dev, "adsp_clock_on fail!\n"); + return ret; + } + + adsp_sram_power_on(sdev); + + return ret; +} + /* on mt8186 there is 1 to 1 match between type and BAR idx */ static int mt8186_get_bar_index(struct snd_sof_dev *sdev, u32 type) { @@ -338,6 +362,10 @@ static struct snd_sof_dsp_ops sof_mt8186_ops =3D { /* Firmware ops */ .dsp_arch_ops =3D &sof_xtensa_arch_ops, =20 + /* PM */ + .suspend =3D mt8186_dsp_suspend, + .resume =3D mt8186_dsp_resume, + /* ALSA HW info flags */ .hw_info =3D SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | --=20 2.18.0