From patchwork Thu Jun 29 07:43:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?VHJldm9yIFd1ICjlkLPmlofoia8p?= X-Patchwork-Id: 114195 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp9468304vqr; Thu, 29 Jun 2023 00:59:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4d8HTqx1WFsGRjePXau7oiyQjEt49cu9wXLbit8EgeJW07yTMNf+7WHOFT5ugiqmuj513D X-Received: by 2002:a05:6a21:3394:b0:126:aa77:a11f with SMTP id yy20-20020a056a21339400b00126aa77a11fmr17399987pzb.6.1688025566786; Thu, 29 Jun 2023 00:59:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688025566; cv=none; d=google.com; s=arc-20160816; b=grli18XchUyC4Omw8hIgq8sG4aOfNQDAr3U2j0cqS6Vhd19garl9UnMgURbis9NSaj H2x0flepOkEp37i7HxRg1/+kjGv98siMPRsnPpvItfRArV2oHthJ8InUddikY5WkWw6i X8+J7YoDmubcZxDaSwd6qWG7hVesQXujy0XZnGkk/DdcW7lw+C8S7zNc3w5WNxyjKJ3V OHIcDORIvb8ZmgBJAseTelSNrLbnNesQK+AiREakVaBd4Fd8xoJsyO8r/kyld57dlcMc RNm06kptCTOSK7sekmTsy8lKwo+cgppMhYF1cptcolfqz/74A0WMqxuA8w/uSrS0Zcip GRQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Qi3pNvb+/UkgZQSIW/v9NFWhcRMbBNVFPD0l1h5cxDs=; fh=fD5PLFgXMAn94c6JjmtlzmNtW4+P0HOaYOoUfLuytxU=; b=kHzSf1KCBWbFqHIcIpPXVkpITASO1tGvuKisNhQi3OpKjAD7oQ9aThLCfWZQymL9sW 0yCwZlSf3IHsBzec20PFPVtQSz1ewnkBstgyPIDRh5pg1lnMtS1br5Czvqz2YDWUlwS3 3mrvynlJfhOzhxK/IVbaVRYq+WTwuuBWfMyzNG53Z6xlu0hkJC6cXdsHbfXFG/gIvzyZ +ZchFEcIFupEf3n2eX1C+ZE5y6P6lwikROSJJ8wWrIWyLDRGzHnmpkCAvewCbR9sVElB pNQKp+THwHw1d/lzfn0eVgJI2fZNXpeXmMlNimSqO10pMLklTYMuxqPiruIpj4lBJc9z 5PIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=DXyTuPap; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f11-20020a170902f38b00b001b7e6528c77si8924955ple.144.2023.06.29.00.59.12; Thu, 29 Jun 2023 00:59:26 -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=DXyTuPap; 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 S232139AbjF2HoQ (ORCPT + 99 others); Thu, 29 Jun 2023 03:44:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231897AbjF2HoG (ORCPT ); Thu, 29 Jun 2023 03:44:06 -0400 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BBDE2705; Thu, 29 Jun 2023 00:43:58 -0700 (PDT) X-UUID: b0d78776165011eeb20a276fd37b9834-20230629 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=Qi3pNvb+/UkgZQSIW/v9NFWhcRMbBNVFPD0l1h5cxDs=; b=DXyTuPapGTU55a71yIdWpBJ+OwowXJLlcLwB7QwB+KqOr9gkZeltHuiZW/FIoFINTZ5G893zRsSDGmaim5VkFV+m4X9T6YpKMhy8niIgvI5lrecFGFNKOtWQDFEVCtoN7e0hNUwPLivXGwPId3AJAxeue07uyzdetIJpi+r1DN8=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.27,REQID:3936ce5e-bd6d-4d7c-8690-543c67918ce7,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:95 X-CID-INFO: VERSION:1.1.27,REQID:3936ce5e-bd6d-4d7c-8690-543c67918ce7,IP:0,URL :0,TC:0,Content:0,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTION :quarantine,TS:95 X-CID-META: VersionHash:01c9525,CLOUDID:a89e5e0d-26a8-467f-b838-f99719a9c083,B ulkID:2306291543523Z2PV2AW,BulkQuantity:2,Recheck:0,SF:48|38|29|28|17|19,T C:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil,Bulk:40,QS:nil,BEC:nil,COL:0, OSI:0,OSA:0,AV:0,LES:1,SPR:NO X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_FSD,TF_CID_SPAM_SNR,TF_CID_SPAM_SDM,TF_CID_SPAM_ASC, TF_CID_SPAM_FAS X-UUID: b0d78776165011eeb20a276fd37b9834-20230629 Received: from mtkmbs14n2.mediatek.inc [(172.21.101.76)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 637585350; Thu, 29 Jun 2023 15:43:51 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Thu, 29 Jun 2023 15:43:50 +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; Thu, 29 Jun 2023 15:43:50 +0800 From: Trevor Wu To: , , , , , , , , CC: , , , , , Subject: [PATCH 1/2] ASoC: mediatek: mt8188: add memory-region support Date: Thu, 29 Jun 2023 15:43:47 +0800 Message-ID: <20230629074348.21670-2-trevor.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230629074348.21670-1-trevor.wu@mediatek.com> References: <20230629074348.21670-1-trevor.wu@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=no 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770023097185352123?= X-GMAIL-MSGID: =?utf-8?q?1770023097185352123?= In certain projects, it is necessary to utilize the reserved memory region for audio dma. The patch takes into account the dts property 'memory-region', allowing for the specification of memory for afe memif through device tree. Signed-off-by: Trevor Wu --- sound/soc/mediatek/mt8188/mt8188-afe-pcm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sound/soc/mediatek/mt8188/mt8188-afe-pcm.c b/sound/soc/mediatek/mt8188/mt8188-afe-pcm.c index 6a24b339444b..5e14655c5617 100644 --- a/sound/soc/mediatek/mt8188/mt8188-afe-pcm.c +++ b/sound/soc/mediatek/mt8188/mt8188-afe-pcm.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -3193,11 +3194,15 @@ static int mt8188_afe_pcm_dev_probe(struct platform_device *pdev) { struct mtk_base_afe *afe; struct mt8188_afe_private *afe_priv; - struct device *dev; + struct device *dev = &pdev->dev; struct reset_control *rstc; struct regmap *infra_ao; int i, irq_id, ret; + ret = of_reserved_mem_device_init(dev); + if (ret) + dev_dbg(dev, "failed to assign memory region: %d\n", ret); + ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(33)); if (ret) return ret; @@ -3213,7 +3218,6 @@ static int mt8188_afe_pcm_dev_probe(struct platform_device *pdev) afe_priv = afe->platform_priv; afe->dev = &pdev->dev; - dev = afe->dev; afe->base_addr = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(afe->base_addr))