Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: Frank Li <Frank.li@nxp.com>
To: Laurentiu Mihalcea <laurentiumihalcea111@gmail.com>
Cc: Bard Liao <yung-chuan.liao@linux.intel.com>,
	Daniel Baluta <daniel.baluta@nxp.com>,
	Iuliana Prodan <iuliana.prodan@nxp.com>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	Mark Brown <broonie@kernel.org>,
	linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org,
	imx@lists.linux.dev
Subject: Re: [PATCH v2 2/8] ASoC: SOF: imx8: use common imx chip interface
Date: Thu, 6 Feb 2025 11:11:05 -0500	[thread overview]
Message-ID: <Z6TfGZNAnCEhm6Fa@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20250205203022.2754-3-laurentiumihalcea111@gmail.com>

On Wed, Feb 05, 2025 at 03:30:16PM -0500, Laurentiu Mihalcea wrote:
> From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
>
> The common interface for imx chips (defined in imx-common.c) contains the
> definitions for a lot of functions required by the SOF core. As such, the
> platform driver can just use the common definitions instead of duplicating
> code by re-defining aforementioned functions.
>
> Make the transition to the new common interface. This consists of:
>
>   1) Removing unneeded functions, which are already defined in the
>   common interface.
>
>   2) Defining some chip-specific operations/structures required by the
>   interface to work.
>
>   3) Dropping structure definitions that are no longer needed.
>
>   4) Adapting some existing functions to the new interface.
>
> Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
> ---
>  sound/soc/sof/imx/imx8.c | 522 +++++----------------------------------
>  1 file changed, 65 insertions(+), 457 deletions(-)
>
> diff --git a/sound/soc/sof/imx/imx8.c b/sound/soc/sof/imx/imx8.c
> index 1e7bf00d7c46..25e3296a1e5e 100644
> --- a/sound/soc/sof/imx/imx8.c
> +++ b/sound/soc/sof/imx/imx8.c
> @@ -1,6 +1,6 @@

...
>  static int imx8x_run(struct snd_sof_dev *sdev)
>  {
> -	struct imx8_priv *dsp_priv = sdev->pdata->hw_pdata;
>  	int ret;
>
> -	ret = imx_sc_misc_set_control(dsp_priv->sc_ipc, IMX_SC_R_DSP,
> +	ret = imx_sc_misc_set_control(get_chip_pdata(sdev), IMX_SC_R_DSP,
>  				      IMX_SC_C_OFS_SEL, 1);
>  	if (ret < 0) {
>  		dev_err(sdev->dev, "Error system address offset source select\n");
>  		return ret;
>  	}
>
> -	ret = imx_sc_misc_set_control(dsp_priv->sc_ipc, IMX_SC_R_DSP,
> +	ret = imx_sc_misc_set_control(get_chip_pdata(sdev), IMX_SC_R_DSP,
>  				      IMX_SC_C_OFS_AUDIO, 0x80);
>  	if (ret < 0) {
>  		dev_err(sdev->dev, "Error system address offset of AUDIO\n");
>  		return ret;
>  	}
>
> -	ret = imx_sc_misc_set_control(dsp_priv->sc_ipc, IMX_SC_R_DSP,
> +	ret = imx_sc_misc_set_control(get_chip_pdata(sdev), IMX_SC_R_DSP,
>  				      IMX_SC_C_OFS_PERIPH, 0x5A);

Not related with patch change, Can you define such magic number 0x5A,
0x80, 0x51? You can improve it later.

Reviewed-by: Frank Li <Frank.Li@nxp.com>

>  	if (ret < 0) {
>  		dev_err(sdev->dev, "Error system address offset of PERIPH %d\n",
> @@ -142,14 +70,14 @@ static int imx8x_run(struct snd_sof_dev *sdev)
>  		return ret;
>  	}
>
...
>  	.ipc_supported_mask	= BIT(SOF_IPC_TYPE_3),
>  	.ipc_default		= SOF_IPC_TYPE_3,
>  	.default_fw_path = {
> @@ -666,6 +273,7 @@ static struct sof_dev_desc sof_of_imx8qm_desc = {
>  	},
>  	.nocodec_tplg_filename = "sof-imx8-nocodec.tplg",
>  	.ops = &sof_imx8_ops,
> +	.ops_init = imx8_ops_init,
>  };
>
>  static const struct of_device_id sof_of_imx8_ids[] = {
> --
> 2.34.1
>

  reply	other threads:[~2025-02-06 16:11 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-05 20:30 [PATCH v2 0/8] Refactor imx drivers and introduce support for imx95 Laurentiu Mihalcea
2025-02-05 20:30 ` [PATCH v2 1/8] ASoC: SOF: imx: introduce more common structures and functions Laurentiu Mihalcea
2025-02-06 16:05   ` Frank Li
2025-02-05 20:30 ` [PATCH v2 2/8] ASoC: SOF: imx8: use common imx chip interface Laurentiu Mihalcea
2025-02-06 16:11   ` Frank Li [this message]
2025-02-05 20:30 ` [PATCH v2 3/8] ASoC: SOF: imx8: use IMX_SOF_* macros Laurentiu Mihalcea
2025-02-06 16:13   ` Frank Li
2025-02-05 20:30 ` [PATCH v2 4/8] ASoC: SOF: imx8: shuffle structure and function definitions Laurentiu Mihalcea
2025-02-06 16:18   ` Frank Li
2025-02-06 17:28     ` Mark Brown
2025-02-05 20:30 ` [PATCH v2 5/8] ASoC: SOF: imx8: drop unneeded/unused macros/header includes Laurentiu Mihalcea
2025-02-06 16:18   ` Frank Li
2025-02-05 20:30 ` [PATCH v2 6/8] ASoC: SOF: imx: merge imx8 and imx8m drivers Laurentiu Mihalcea
2025-02-06 16:26   ` Frank Li
2025-02-05 20:30 ` [PATCH v2 7/8] ASoC: SOF: imx: merge imx8 and imx8ulp drivers Laurentiu Mihalcea
2025-02-06 16:28   ` Frank Li
2025-02-05 20:30 ` [PATCH v2 8/8] ASoC: SOF: imx: add driver for the imx95 chip Laurentiu Mihalcea
2025-02-06 16:29   ` Frank Li
2025-02-10 16:30 ` (subset) [PATCH v2 0/8] Refactor imx drivers and introduce support for imx95 Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z6TfGZNAnCEhm6Fa@lizhi-Precision-Tower-5810 \
    --to=frank.li@nxp.com \
    --cc=broonie@kernel.org \
    --cc=daniel.baluta@nxp.com \
    --cc=imx@lists.linux.dev \
    --cc=iuliana.prodan@nxp.com \
    --cc=laurentiumihalcea111@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    --cc=yung-chuan.liao@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox