Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1191204rbb; Mon, 26 Feb 2024 01:21:53 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVDQBgJvM+5+AAo9Gb6UYh7dNJq9gjspaJGP6cdV86t1rVuGmc01i2LbZ3A9WJN0xKWbzQcyNIfevvIdlz70pbTNnQ6zF2d4KoUiERIkA== X-Google-Smtp-Source: AGHT+IF8XRZ0wlpXzGt2Yk4nLihbEw+b9YjawaeovivEZA1DVqlWgy4HdPaoOgIwZgLPg+2x1YOt X-Received: by 2002:a17:90a:6448:b0:299:4a15:4a36 with SMTP id y8-20020a17090a644800b002994a154a36mr5224433pjm.35.1708939313265; Mon, 26 Feb 2024 01:21:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708939313; cv=pass; d=google.com; s=arc-20160816; b=hQiG7j/5ZvH0QrOmyuXlp9OvxKH2K3jrpG74NVXxrII5D9r9cc/VEV9O9SSBGdEwJp xX+hIv0mV+xYNDP81RERUNt6IS94twQhzY7CqB+eCYkKy8EkL5npOG+VBQ22+5Bbj51p tAnikUw6Kby1VfPCZwn9xRMDzG+hVgK1GZ1DFo8B5nYZd3dygvPzQPkROW3psozUIZfs biHqASgO97Cq91XxJXUhaM99cwfC1vlBubK+hvmcwu2j23/yoJ5U6bIpqI3wu5AB2uAX GLpqsG3q6JOUzErwEjo2qlt0TeTBs+W1LYtsBhsbbhZ7YXnRrEQ7kpgcQ9cBMHpMKQQO TdaQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:to:from; bh=oW6Td+yZdBcswzs4YbvV1IwkuphzT6dkcHAjG42TM4c=; fh=ufiESpW7Hvn5oNmN0l6/qCUiQrKfLLrOwb5uR1Dftds=; b=Ct8644p1cBYIFVRcsXoT7Gd5Woyo3luM1tasXtE4Dfi1zTwkCG/8iP9fcq5tBUvvC3 4Zgf7vq92wSSElxzexOs/zdkmR6Bjus4izzRYE4oRz+lcBrOt/A3+mKqz/ddVDyoqfXw I4TyloSwHEEBtlvbnHE1zTBxdM+gq5+eowtW1q+4xHuAS4pF9vTNEn1qLHrBdn+PYznD X/BNz7r+W08dkUG4h6dtaD9Ee2W0qaWJtWp1DfTMF+1XR/P3MrztU1UYoR8v9LjqKHiz OVKDbSrezaW6nDYgAjHHV8MK0kIUrPq+tp82UknPjLvwbPDxvuc93etkobDtU+Ym1lHy Dmlw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel+bounces-80931-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80931-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id bg3-20020a17090b0d8300b00290349120dfsi5274631pjb.129.2024.02.26.01.21.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 01:21:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-80931-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel+bounces-80931-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80931-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id D42D0283CF1 for ; Mon, 26 Feb 2024 09:21:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 68F4955772; Mon, 26 Feb 2024 08:44:22 +0000 (UTC) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B483C54656; Mon, 26 Feb 2024 08:44:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=92.121.34.21 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708937061; cv=none; b=iahNkp+jiIYV5og8ewVV/ecUG2+T+elaPGdWJeK9l5E8PdS4sAtbrPuFJjV7VN0pQ3dw7tS0dRGih/eQJ5iUk9GR9Zl3PIfAq0TT+BqFUDMlXvZ5yKGExRoXAMlJmp0nq3BEgUMCwGriKhifiYT7grzoelsBacLHHUB4OAvQ9yg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708937061; c=relaxed/simple; bh=ImzNxqs0xkj2U6J7gTa9sJdI5GGIwkLF3v5xPj/nHYQ=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References; b=nWfXJTgqHOoL6QmskJtfp653WfqZ9asDbkFOo+s7eYcVLRmZvOFf/bOQJMD70qPgqy1S9N2kFSzalSdVKhiMR1Z1lFrjE+G/bZ00W9bxaY9rei7KpQIFcHh3/3T+VAxY/dPJufYrF9t/dbFP1G/+3CPnGc42Nph8uPG8secfHNU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; arc=none smtp.client-ip=92.121.34.21 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 25EA0201108; Mon, 26 Feb 2024 09:44:17 +0100 (CET) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id AA57020011D; Mon, 26 Feb 2024 09:44:16 +0100 (CET) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id 9DB49183AD16; Mon, 26 Feb 2024 16:44:14 +0800 (+08) From: Shengjiu Wang To: hverkuil@xs4all.nl, sakari.ailus@iki.fi, tfiga@chromium.org, m.szyprowski@samsung.com, mchehab@kernel.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, shengjiu.wang@gmail.com, Xiubo.Lee@gmail.com, festevam@gmail.com, nicoleotsuka@gmail.com, lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH v13 05/16] ASoC: fsl_asrc: register m2m platform device Date: Mon, 26 Feb 2024 16:28:18 +0800 Message-Id: <1708936109-11587-6-git-send-email-shengjiu.wang@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1708936109-11587-1-git-send-email-shengjiu.wang@nxp.com> References: <1708936109-11587-1-git-send-email-shengjiu.wang@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Register m2m platform device, that user can use M2M feature. Defined platform data structure and platform driver name. Signed-off-by: Shengjiu Wang Acked-by: Mark Brown --- include/sound/fsl_asrc_common.h | 23 +++++++++++++++++++++++ sound/soc/fsl/fsl_asrc.c | 18 ++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/include/sound/fsl_asrc_common.h b/include/sound/fsl_asrc_common.h index 3b53d366182f..c709b8906929 100644 --- a/include/sound/fsl_asrc_common.h +++ b/include/sound/fsl_asrc_common.h @@ -71,6 +71,7 @@ struct fsl_asrc_pair { * @dma_params_rx: DMA parameters for receive channel * @dma_params_tx: DMA parameters for transmit channel * @pdev: platform device pointer + * @m2m_pdev: m2m platform device pointer * @regmap: regmap handler * @paddr: physical address to the base address of registers * @mem_clk: clock source to access register @@ -103,6 +104,7 @@ struct fsl_asrc { struct snd_dmaengine_dai_dma_data dma_params_rx; struct snd_dmaengine_dai_dma_data dma_params_tx; struct platform_device *pdev; + struct platform_device *m2m_pdev; struct regmap *regmap; unsigned long paddr; struct clk *mem_clk; @@ -139,6 +141,27 @@ struct fsl_asrc { void *private; }; +/** + * struct fsl_asrc_m2m_pdata - platform data + * @asrc: pointer to struct fsl_asrc + * @fmt_in: input sample format + * @fmt_out: output sample format + * @chan_min: minimum channel number + * @chan_max: maximum channel number + * @rate_min: minimum rate + * @rate_max: maximum rete + */ +struct fsl_asrc_m2m_pdata { + struct fsl_asrc *asrc; + u64 fmt_in; + u64 fmt_out; + int chan_min; + int chan_max; + int rate_min; + int rate_max; +}; + +#define M2M_DRV_NAME "fsl_asrc_m2m" #define DRV_NAME "fsl-asrc-dai" extern struct snd_soc_component_driver fsl_asrc_component; diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c index 7d8643ee0ba0..5ecb5d869607 100644 --- a/sound/soc/fsl/fsl_asrc.c +++ b/sound/soc/fsl/fsl_asrc.c @@ -1187,6 +1187,7 @@ static int fsl_asrc_runtime_suspend(struct device *dev); static int fsl_asrc_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; + struct fsl_asrc_m2m_pdata m2m_pdata; struct fsl_asrc_priv *asrc_priv; struct fsl_asrc *asrc; struct resource *res; @@ -1368,6 +1369,18 @@ static int fsl_asrc_probe(struct platform_device *pdev) goto err_pm_get_sync; } + m2m_pdata.asrc = asrc; + m2m_pdata.fmt_in = FSL_ASRC_FORMATS; + m2m_pdata.fmt_out = FSL_ASRC_FORMATS | SNDRV_PCM_FMTBIT_S8; + m2m_pdata.rate_min = 5512; + m2m_pdata.rate_max = 192000; + m2m_pdata.chan_min = 1; + m2m_pdata.chan_max = 10; + asrc->m2m_pdev = platform_device_register_data(&pdev->dev, + M2M_DRV_NAME, + PLATFORM_DEVID_AUTO, + &m2m_pdata, + sizeof(m2m_pdata)); return 0; err_pm_get_sync: @@ -1380,6 +1393,11 @@ static int fsl_asrc_probe(struct platform_device *pdev) static void fsl_asrc_remove(struct platform_device *pdev) { + struct fsl_asrc *asrc = dev_get_drvdata(&pdev->dev); + + if (asrc->m2m_pdev && !IS_ERR(asrc->m2m_pdev)) + platform_device_unregister(asrc->m2m_pdev); + pm_runtime_disable(&pdev->dev); if (!pm_runtime_status_suspended(&pdev->dev)) fsl_asrc_runtime_suspend(&pdev->dev); -- 2.34.1