alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: ew.kim@samsung.com, s.nawrocki@samsung.com, lgirdwood@gmail.com,
	broonie@kernel.org, perex@perex.cz, tiwai@suse.com
Cc: linux-sound@vger.kernel.org, alsa-devel@alsa-project.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ASoC: samsung: Implement abox generic structure
Date: Wed, 9 Jul 2025 15:57:38 +0200	[thread overview]
Message-ID: <7d2401d6-d897-49d7-a3be-50de0727b037@kernel.org> (raw)
In-Reply-To: <20250709001002.378246-1-ew.kim@samsung.com>

On 09/07/2025 02:10, ew.kim@samsung.com wrote:
> +/**
> + * @cnotice
> + * @prdcode
> + * @Sub_SW_Component{abox generic}
> + * @ALM_Link {work item url}
> + * @purpose "Disbaling the abox generic"
> + * @logic "Disbale the abox generic"
> + * \image html
> + * @params
> + * @param{in, pdev->dev, struct::device, !NULL}
> + * @endparam
> + * @noret
> + */
> +static void samsung_abox_generic_remove(struct platform_device *pdev)
> +{
> +	struct device *dev = &pdev->dev;
> +	struct abox_generic_data *data = dev_get_drvdata(dev);
> +
> +	dev_info(dev, "%s\n", __func__);

This is just poor code. Clean it up from all such oddities popular in
downstream. Look at upstream code. Do you see such code there? No.

> +
> +	if (!data) {
> +		dev_err(dev, "%s: Invalid abox generic data\n", __func__);
> +		return;
> +	}
> +	return;
> +}
> +
> +/**
> + * @cnotice
> + * @prdcode
> + * @Sub_SW_Component{abox generic}
> + * @ALM_Link {work item url}
> + * @purpose "shutdown of the abox generic"
> + * @logic "Disbale the abox hardware by calling the following function
> + * pm_runtime_disable(dev)"
> + * \image html
> + * @params
> + * @param{in, pdev->dev, struct:: device, !NULL}
> + * @endparam
> + * @noret
> + */
> +static void samsung_abox_generic_shutdown(struct platform_device *pdev)
> +{
> +	struct device *dev = &pdev->dev;
> +	struct abox_generic_data *data = dev_get_drvdata(dev);
> +
> +	if (!data) {
> +		dev_err(dev, "%s: Invalid abox generic data\n", __func__);
> +		return;
> +	}
> +	return;
> +}
> +
> +static const struct of_device_id samsung_abox_generic_match[] = {
> +	{
> +		.compatible = "samsung,abox_generic",
> +	},
> +	{},
> +};
> +MODULE_DEVICE_TABLE(of, samsung_abox_generic_match);
> +
> +static const struct dev_pm_ops samsung_abox_generic_pm = {
> +	SET_SYSTEM_SLEEP_PM_OPS(abox_generic_suspend, abox_generic_resume)
> +};
> +
> +struct platform_driver samsung_abox_generic_driver = {
> +	.probe  = samsung_abox_generic_probe,
> +	.remove = samsung_abox_generic_remove,
> +	.shutdown = samsung_abox_generic_shutdown,
> +	.driver = {
> +		.name = "samsung-abox-generic",
> +		.owner = THIS_MODULE,

So that's indeed 2013 code you upstream. We really want you to clean it
up before you post some ancient stuff like that.


> +		.of_match_table = of_match_ptr(samsung_abox_generic_match),
> +		.pm = &samsung_abox_generic_pm,
> +	},
> +};
> +
> +module_platform_driver(samsung_abox_generic_driver);
> +/* Module information */

Useless comment.

> +MODULE_AUTHOR("Eunwoo Kim, <ew.kim@samsung.com>");
> +MODULE_DESCRIPTION("Samsung ASoC A-Box Generic Driver");
> +MODULE_ALIAS("platform:samsung-abox-generic");

No, drop. This was raised so many times already...

> +MODULE_LICENSE("GPL v2");
> +
> diff --git a/sound/soc/samsung/auto_abox/generic/include/abox_generic.h b/sound/soc/samsung/auto_abox/generic/include/abox_generic.h
> new file mode 100644
> index 000000000000..1c954272e2b5
> --- /dev/null
> +++ b/sound/soc/samsung/auto_abox/generic/include/abox_generic.h
> @@ -0,0 +1,87 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + * ALSA SoC - Samsung ABOX Share Function and Data structure
> + * for Exynos specific extensions
> + *
> + * Copyright (C) 2013-2020 Samsung Electronics Co., Ltd.
> + *
> + * EXYNOS - sound/soc/samsung/abox/include/abox_generic.h

Same with paths. Do you see them anywhere in the kernel?

> + */
> +
> +#ifndef __SND_SOC_ABOX_GENERIC_BASE_H
> +#define __SND_SOC_ABOX_GENERIC_BASE_H
> +
> +#define ABOX_GENERIC_DATA		abox_generic_get_abox_generic_data();
> +
> +struct snd_soc_pcm_runtime;
> +
> +enum abox_soc_ioctl_cmd {
> +	ABOX_SOC_IOCTL_GET_NUM_OF_RDMA,
> +	ABOX_SOC_IOCTL_GET_NUM_OF_WDMA,
> +	ABOX_SOC_IOCTL_GET_NUM_OF_UAIF,
> +	ABOX_SOC_IOCTL_GET_SOC_TIMER,
> +	ABOX_SOC_IOCTL_SET_DMA_BUFFER,
> +	ABOX_SOC_IOCTL_SET_PP_POINTER,
> +	ABOX_SOC_IOCTL_SET_PERF_PERIOD,
> +	ABOX_SOC_IOCTL_CHECK_TIME_MUTEX,
> +	ABOX_SOC_IOCTL_CHECK_TIME_NO_MUTEX,
> +	ABOX_SOC_IOCTL_PCM_DUMP_INTR,
> +	ABOX_SOC_IOCTL_PCM_DUMP_CLOSE,
> +	ABOX_SOC_IOCTL_PCM_DUMP_ADD_CONTROL,
> +	ABOX_SOC_IOCTL_MAX
> +};
> +
> +typedef int (*SOC_IOCTL)(struct device *soc_dev, enum abox_soc_ioctl_cmd cmd, void *data);

Follow coding style.

> +
> +struct abox_generic_data {
> +	struct platform_device *pdev;
> +	struct platform_device **pdev_pcm_playback;
> +	struct platform_device **pdev_pcm_capture;
> +	unsigned int num_of_pcm_playback;
> +	unsigned int num_of_pcm_capture;
> +	unsigned int num_of_i2s_dummy;
> +	unsigned int num_of_rdma;
> +	unsigned int num_of_wdma;
> +	unsigned int num_of_uaif;
> +	struct device *soc_dev;
> +	SOC_IOCTL soc_ioctl;
> +};
> +
> +
> +/************ Internal API ************/

Then why do you expose it via header?

> +
> +struct abox_generic_data *abox_generic_get_abox_generic_data(void);
> +
> +int abox_generic_set_dma_buffer(struct device *pcm_dev);
> +
> +int abox_generic_request_soc_ioctl(struct device *generic_dev, enum abox_soc_ioctl_cmd cmd,
> +	void *data);
> +
> +int abox_generic_set_pp_pointer(struct device *pcm_dev);
> +
> +
> +
> +
> +/************ External API ************/
> +
> +extern struct device *abox_generic_find_fe_dev_from_rtd(struct snd_soc_pcm_runtime *be);

You cannot have external API. All API is internal first.

> +
> +extern struct platform_device *abox_generic_get_pcm_platform_dev(int pcm_id,
> +	int stream_type);
> +
Best regards,
Krzysztof

  parent reply	other threads:[~2025-07-09 13:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20250709002150epcas2p467416bdbc16754726599a0cacb1feecc@epcas2p4.samsung.com>
2025-07-09  0:10 ` [PATCH] ASoC: samsung: Implement abox generic structure ew.kim
2025-07-09  8:46   ` Mark Brown
2025-07-10  7:07     ` 김은우
2025-07-09 13:57   ` Krzysztof Kozlowski [this message]
2025-07-10  7:13     ` 김은우
2025-07-10  7:17       ` Krzysztof Kozlowski
2025-07-09 18:10   ` Christophe JAILLET
2025-07-10  7:19     ` 김은우

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=7d2401d6-d897-49d7-a3be-50de0727b037@kernel.org \
    --to=krzk@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=ew.kim@samsung.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=s.nawrocki@samsung.com \
    --cc=tiwai@suse.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;
as well as URLs for NNTP newsgroup(s).