Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3745388rwd; Mon, 22 May 2023 20:05:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6z4fm0WJQaWw9y7QHpK0LSbghIGQyPViGNekWJrhHm8GgNfeu+cXO9PI50rDQpsnL8/eXy X-Received: by 2002:a17:902:ef82:b0:1a5:3319:12f7 with SMTP id iz2-20020a170902ef8200b001a5331912f7mr12616663plb.50.1684811139601; Mon, 22 May 2023 20:05:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684811139; cv=none; d=google.com; s=arc-20160816; b=l2N07P6TQrp8jV7hQyOUanMmP8eAR7Mm+wLTvdGhLdHyJrGpRZwLaHRYXBF9uUJCo2 RIOG7DPjWTGn3R5NC2/GxWAgBD+JpGRcqFXNo4dI1pr8w3cyOFtcauVTq9mcMxu0wPxH KT6zYK/rVUW2J9Xqj37yJhTDgmKVyeoiDYCvnPL6vhy0EpiIzf32TmrhHYACjV438Zn8 NSyafEUerLGRwpw8eDUXuX1vtknoiaUJ9KekUrJO9koumkn3gcG7PzrSXx3s/IkbPrVp CSF+N2Y/wv8cKN1PPtudpWuXx+BsbKpDa7zf1VE5y1xrgJUztTz3ouuhjgpRDgnaG+wU tM1Q== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7HMIGvCD+aOZDLrsQizWYm0Y51qXJCJHHQPRwoRRYCE=; b=UW81ebYPqk17Ca0nhzsyoWkpbuXm/Ncs0eH4q9xe/vgdDqo3wIvvD2p6xTP19pQU4u HCjZmotWs6QL3B7ESs5df8Pf8pI8Ar1qFO3YlG5iTm69rZv81K9MtH3Ee9indlh9q4LX oLyqshRsPp5ALeJ6VszdYlv9rYskh/VKaGE3vUdj7bfNTxXsNjSVhmBYspLnchUQcJzm +RJEhnOMp6pwluXRT2lQHHKENeFJu+d8SYCuc/nQ+yQt3BGjpqovdP8YpkBQcNCkwh6j Ahrhr1Kux8BBllS3vLe92Rxj3U/dcSHzWSKK1JX+Hs/lguCduW7IyNSJhFHCXZhW+wQb PfIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=IwvoBkKR; 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=mediatek.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s12-20020a170902ea0c00b001aade54f986si1121328plg.249.2023.05.22.20.05.27; Mon, 22 May 2023 20:05:39 -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=@mediatek.com header.s=dk header.b=IwvoBkKR; 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=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229587AbjEWDAZ (ORCPT + 99 others); Mon, 22 May 2023 23:00:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234956AbjEWC7m (ORCPT ); Mon, 22 May 2023 22:59:42 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 711ECCD for ; Mon, 22 May 2023 19:59:41 -0700 (PDT) X-UUID: d98338daf91511ed9cb5633481061a41-20230523 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=7HMIGvCD+aOZDLrsQizWYm0Y51qXJCJHHQPRwoRRYCE=; b=IwvoBkKROHuUjH27ma0DRPV0Kaxe+ZAmwCmXdROojFrtoLYH+LjAbf6RTXxALdOBPzfPFGGHEgzijb99igv+nUyX17AakW82i7EnN+AzO8Et0CRvbX35ZYhSW83wplcTChXUz/IuViLVBGCjSXwIS7QIYWVtOXxqQzV4psSR1tc=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.25,REQID:3800f729-4111-47a5-90b5-fd0899450448,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-25 X-CID-META: VersionHash:d5b0ae3,CLOUDID:464b083c-de1e-4348-bc35-c96f92f1dcbb,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-UUID: d98338daf91511ed9cb5633481061a41-20230523 Received: from mtkmbs11n2.mediatek.inc [(172.21.101.187)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1336574284; Tue, 23 May 2023 10:59:35 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by mtkmbs13n2.mediatek.inc (172.21.101.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Tue, 23 May 2023 10:59:34 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Tue, 23 May 2023 10:59:34 +0800 From: Trevor Wu To: , , , , , , , , , , , CC: , , , , , , , Subject: [PATCH v2 2/2] ASoC: SOF: mediatek: add adsp debug dump Date: Tue, 23 May 2023 10:59:33 +0800 Message-ID: <20230523025933.30494-3-trevor.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230523025933.30494-1-trevor.wu@mediatek.com> References: <20230523025933.30494-1-trevor.wu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,URIBL_BLOCKED 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 Add mt8188 and mt8186 .dbg_dump callback to print some information when DSP panic occurs. Signed-off-by: Trevor Wu Reviewed-by: Pierre-Louis Bossart Reviewed-by: Yaochun Hung Reviewed-by: Péter Ujfalusi --- sound/soc/sof/mediatek/mt8186/mt8186.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/sound/soc/sof/mediatek/mt8186/mt8186.c b/sound/soc/sof/mediatek/mt8186/mt8186.c index cc91c2928fb6..3e0ea0e109e2 100644 --- a/sound/soc/sof/mediatek/mt8186/mt8186.c +++ b/sound/soc/sof/mediatek/mt8186/mt8186.c @@ -24,6 +24,7 @@ #include "../../sof-of-dev.h" #include "../../sof-audio.h" #include "../adsp_helper.h" +#include "../mtk-adsp-common.h" #include "mt8186.h" #include "mt8186-clk.h" @@ -473,6 +474,26 @@ static snd_pcm_uframes_t mt8186_pcm_pointer(struct snd_sof_dev *sdev, return pos; } +static void mt8186_adsp_dump(struct snd_sof_dev *sdev, u32 flags) +{ + u32 dbg_pc, dbg_data, dbg_inst, dbg_ls0stat, dbg_status, faultinfo; + + /* dump debug registers */ + dbg_pc = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PDEBUGPC); + dbg_data = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PDEBUGDATA); + dbg_inst = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PDEBUGINST); + dbg_ls0stat = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PDEBUGLS0STAT); + dbg_status = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PDEBUGSTATUS); + faultinfo = snd_sof_dsp_read(sdev, DSP_REG_BAR, DSP_PFAULTINFO); + + dev_info(sdev->dev, "adsp dump : pc %#x, data %#x, dbg_inst %#x,", + dbg_pc, dbg_data, dbg_inst); + dev_info(sdev->dev, "ls0stat %#x, status %#x, faultinfo %#x", + dbg_ls0stat, dbg_status, faultinfo); + + mtk_adsp_dump(sdev, flags); +} + static struct snd_soc_dai_driver mt8186_dai[] = { { .name = "SOF_DL1", @@ -555,6 +576,7 @@ static struct snd_sof_dsp_ops sof_mt8186_ops = { .num_drv = ARRAY_SIZE(mt8186_dai), /* Debug information */ + .dbg_dump = mt8186_adsp_dump, .debugfs_add_region_item = snd_sof_debugfs_add_region_item_iomem, /* PM */ -- 2.18.0