Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp332328pxb; Thu, 26 Aug 2021 04:22:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzn3/NJLkj77Tg/wWb0lRbnI546XZ0ZRnPHpBhmrs/tayfisHiMt+g31jt7R47YADXv8LWQ X-Received: by 2002:a92:c841:: with SMTP id b1mr2348189ilq.300.1629976938267; Thu, 26 Aug 2021 04:22:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629976938; cv=none; d=google.com; s=arc-20160816; b=PiRbziU80YJH2G8o91BZlwmAn/51NXQkSdAYx73Q+wIvh67elAcsxxhqlknY2+geHP X6pDd1ck9a8rg6U0fafj2Yu5uDnDx0SSTEQPpe27TwOpLoW1A90lVwULdHfAJ785g9hE DeJKhpBbq99TNLLnAC/XWfaKO+ALds2nNOBHg5Xw5/+54FBuJe3x0fzeMy4mvTutVRHM O4/9rc6O148Kl9jcEjDIO1oSMPXV8S+VK6pWPra4nV51tmgTk1TM+L9ey+OI90H0+E8a GGZ2k+ZKnXZn5S9NXlwEvs92CrpDAZCAuy8r/26cNFHLofJiPMmCZ7NAiPSgu/uzYotr ni4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=uH2tJdPfttok/tC0QkR8k3ZCrMcAM/Rvpo8N3urEmsk=; b=EqA7/VOg8WxO7YZkbfdmaWvV/nMMtAHviqr9LVkbZxLMaLc+VtKwqV4o23heuCTGd/ qLgqgN80duJz/LCVoO+Y7tPMSkYmQIZjCIpOerkVzVP7sY6IiX7j61XES13B14v2nMWC gxHLUKyrMK0vr2udVxfMs88P7/CoLzRxljv9GAURV9i31JnIiL6k4Qle2gAHCdGTLALA kr+w/IF71PujWForUHbzfFLi8PWg1TvgnQfxzhNg/Y9HWT2eYnyMUIPXQlYjY0btm5Z6 r8a5nZCgcjXKE5dCDlGCduzKxcB7jCzGN6q4XGtlrNYwa2NikqHi+ehavEysXBf5zJIH 6Pjw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m11si2809403jaj.5.2021.08.26.04.21.57; Thu, 26 Aug 2021 04:22:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241887AbhHZLUl (ORCPT + 99 others); Thu, 26 Aug 2021 07:20:41 -0400 Received: from inva020.nxp.com ([92.121.34.13]:51004 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234292AbhHZLUl (ORCPT ); Thu, 26 Aug 2021 07:20:41 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 1FE111A18EA; Thu, 26 Aug 2021 13:19:53 +0200 (CEST) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id B162E1A0C92; Thu, 26 Aug 2021 13:19:52 +0200 (CEST) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id 4BC9D183AC8B; Thu, 26 Aug 2021 19:19:51 +0800 (+08) From: Shengjiu Wang To: timur@kernel.org, nicoleotsuka@gmail.com, Xiubo.Lee@gmail.com, festevam@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] ASoC: fsl_rpmsg: add soc specific data structure Date: Thu, 26 Aug 2021 18:57:40 +0800 Message-Id: <1629975460-17990-1-git-send-email-shengjiu.wang@nxp.com> X-Mailer: git-send-email 2.7.4 X-Virus-Scanned: ClamAV using ClamSMTP Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Each platform has different supported rates and formats, so add soc specific data for each platform. This soc specific data is attached with compatible string. Signed-off-by: Shengjiu Wang --- sound/soc/fsl/fsl_rpmsg.c | 47 +++++++++++++++++++++++++++++++++++---- sound/soc/fsl/fsl_rpmsg.h | 12 ++++++++++ 2 files changed, 55 insertions(+), 4 deletions(-) diff --git a/sound/soc/fsl/fsl_rpmsg.c b/sound/soc/fsl/fsl_rpmsg.c index d60f4dac6c1b..bda6cc96071d 100644 --- a/sound/soc/fsl/fsl_rpmsg.c +++ b/sound/soc/fsl/fsl_rpmsg.c @@ -138,11 +138,42 @@ static const struct snd_soc_component_driver fsl_component = { .name = "fsl-rpmsg", }; +static const struct fsl_rpmsg_soc_data imx7ulp_data = { + .rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 | + SNDRV_PCM_RATE_48000, + .formats = SNDRV_PCM_FMTBIT_S16_LE, +}; + +static const struct fsl_rpmsg_soc_data imx8mm_data = { + .rates = SNDRV_PCM_RATE_KNOT, + .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE | + SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_DSD_U8 | + SNDRV_PCM_FMTBIT_DSD_U16_LE | SNDRV_PCM_FMTBIT_DSD_U32_LE, +}; + +static const struct fsl_rpmsg_soc_data imx8mn_data = { + .rates = SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | + SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | + SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_176400 | + SNDRV_PCM_RATE_192000, + .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE | + SNDRV_PCM_FMTBIT_S32_LE, +}; + +static const struct fsl_rpmsg_soc_data imx8mp_data = { + .rates = SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | + SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | + SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_176400 | + SNDRV_PCM_RATE_192000, + .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE | + SNDRV_PCM_FMTBIT_S32_LE, +}; + static const struct of_device_id fsl_rpmsg_ids[] = { - { .compatible = "fsl,imx7ulp-rpmsg-audio"}, - { .compatible = "fsl,imx8mm-rpmsg-audio"}, - { .compatible = "fsl,imx8mn-rpmsg-audio"}, - { .compatible = "fsl,imx8mp-rpmsg-audio"}, + { .compatible = "fsl,imx7ulp-rpmsg-audio", .data = &imx7ulp_data}, + { .compatible = "fsl,imx8mm-rpmsg-audio", .data = &imx8mm_data}, + { .compatible = "fsl,imx8mn-rpmsg-audio", .data = &imx8mn_data}, + { .compatible = "fsl,imx8mp-rpmsg-audio", .data = &imx8mp_data}, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, fsl_rpmsg_ids); @@ -157,6 +188,14 @@ static int fsl_rpmsg_probe(struct platform_device *pdev) if (!rpmsg) return -ENOMEM; + rpmsg->soc_data = of_device_get_match_data(&pdev->dev); + if (rpmsg->soc_data) { + fsl_rpmsg_dai.playback.rates = rpmsg->soc_data->rates; + fsl_rpmsg_dai.capture.rates = rpmsg->soc_data->rates; + fsl_rpmsg_dai.playback.formats = rpmsg->soc_data->formats; + fsl_rpmsg_dai.capture.formats = rpmsg->soc_data->formats; + } + if (of_property_read_bool(np, "fsl,enable-lpa")) { rpmsg->enable_lpa = 1; rpmsg->buffer_size = LPA_LARGE_BUFFER_SIZE; diff --git a/sound/soc/fsl/fsl_rpmsg.h b/sound/soc/fsl/fsl_rpmsg.h index 4f5b49eb18d8..b04086fbf828 100644 --- a/sound/soc/fsl/fsl_rpmsg.h +++ b/sound/soc/fsl/fsl_rpmsg.h @@ -6,6 +6,16 @@ #ifndef __FSL_RPMSG_H #define __FSL_RPMSG_H +/* + * struct fsl_rpmsg_soc_data + * @rates: supported rates + * @formats: supported formats + */ +struct fsl_rpmsg_soc_data { + int rates; + u64 formats; +}; + /* * struct fsl_rpmsg - rpmsg private data * @@ -15,6 +25,7 @@ * @pll8k: parent clock for multiple of 8kHz frequency * @pll11k: parent clock for multiple of 11kHz frequency * @card_pdev: Platform_device pointer to register a sound card + * @soc_data: soc specific data * @mclk_streams: Active streams that are using baudclk * @force_lpa: force enable low power audio routine if condition satisfy * @enable_lpa: enable low power audio routine according to dts setting @@ -27,6 +38,7 @@ struct fsl_rpmsg { struct clk *pll8k; struct clk *pll11k; struct platform_device *card_pdev; + const struct fsl_rpmsg_soc_data *soc_data; unsigned int mclk_streams; int force_lpa; int enable_lpa; -- 2.17.1