ASoC: samsung: Implement abox generic structure
Subsystems (3)
A message that is not in the archive (sent off-list or not yet received): CGME20250709002150epcas2p467416bdbc16754726599a0cacb1feecc@epcas2p4.samsung.com
PATCH 1/1 ASoC: samsung: Implement abox generic structure
From: ew kim <[email protected]>
Implemet basic abox generic drivers.
This driver is a management driver for the generic drivers used in Automotive Abox, connecting them to SOC drivers.
It supports various Exynos Automotive SOCs.
--- sound/soc/samsung/Kconfig | 2 + sound/soc/samsung/Makefile | 1 + sound/soc/samsung/auto_abox/Kconfig | 14 + sound/soc/samsung/auto_abox/generic/Kbuild | 12 + .../samsung/auto_abox/generic/abox_generic.c | 568 ++++++++++++++++++ .../auto_abox/generic/include/abox_generic.h | 87 +++ 6 files changed, 684 insertions(+) create mode 100644 sound/soc/samsung/auto_abox/Kconfig create mode 100644 sound/soc/samsung/auto_abox/generic/Kbuild create mode 100644 sound/soc/samsung/auto_abox/generic/abox_generic.c create mode 100644 sound/soc/samsung/auto_abox/generic/include/abox_generic.h
sound/soc/samsung/Kconfig +2 -0
@@ -148,4 +148,6 @@ config SND_SOC_SAMSUNG_MIDAS_WM1811 help Say Y if you want to add support for SoC audio on the Midas boards. +source "sound/soc/samsung/auto_abox/Kconfig" + endif #SND_SOC_SAMSUNG
sound/soc/samsung/Makefile +1 -0
@@ -42,3 +42,4 @@ obj-$(CONFIG_SND_SOC_ARNDALE) += snd-soc-arndale.o obj-$(CONFIG_SND_SOC_SAMSUNG_TM2_WM5110) += snd-soc-tm2-wm5110.o obj-$(CONFIG_SND_SOC_SAMSUNG_ARIES_WM8994) += snd-soc-aries-wm8994.o obj-$(CONFIG_SND_SOC_SAMSUNG_MIDAS_WM1811) += snd-soc-midas-wm1811.o +obj-$(CONFIG_SND_SOC_SAMSUNG_AUTO_ABOX) += auto_abox/generic/
sound/soc/samsung/auto_abox/Kconfig new file +14 -0
@@ -0,0 +1,14 @@ +#: SPDX-License-Identifier: GPL-2.0-only + +menu "Exynosauto Automotive Abox Modules Options" + +config SND_SOC_SAMSUNG_AUTO_ABOX + tristate "ASoC support for Samsung Exynosauto Automotive ABOX Audio" + select SND_SOC_COMPRESS + help + Say Y or M if you want to add support for codecs attached to + the Samsung SoC Auto ABOX interface. You will also need to + select the audio interfaces to support below. + +endmenu +
sound/soc/samsung/auto_abox/generic/Kbuild new file +12 -0
@@ -0,0 +1,12 @@ +# SPDX-License-Identifier: GPL-2.0 +# Exynosauto Automotive Abox Driver Support + +snd-soc-samsung-abox-generic-$(CONFIG_SND_SOC_SAMSUNG_AUTO_ABOX) := \ + abox_generic.o + +ccflags-y += -I./include + +obj-$(CONFIG_SND_SOC_SAMSUNG_AUTO_ABOX) += \ + snd-soc-samsung-abox-generic.o + +
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +568 -0
568 lines not on this page · raw message
sound/soc/samsung/auto_abox/generic/include/abox_generic.h new file +87 -0
87 lines not on this page · raw message
Signature · 1 line
2.25.1
Mark Brown
maintainerQuoted 6 lines · On Wed, Jul 09, 2025 at 09:10:02AM +0900, [email protected] wrote:
From: ew kim <[email protected]>
Implemet basic abox generic drivers.
This driver is a management driver for the generic drivers used in Automotive Abox, connecting them to SOC drivers.
It supports various Exynos Automotive SOCs.
I can't really tell what the driver is supposed to do from this - what is abox? Looking at the code I'm not really much clearer, to a large extent because it doesn't seem to integrate with the subsystem (or other kernel subsystems) at all. It looks like this might be intended to control a DSP offload system, but it's not 100% clear, and it seems like there's an ioctl() interface which it looks like it's exposing internal abstractions to userspace. This needs to be some combination of much more clearly explained and better integrated with the existing kernel subsystems, right now I can't really review it effectively because it's hard for me to tell what the code is trying to do.
I've got a few very supreficial comments below but really there's a structural problem that needs to be addressed first.
sound/soc/samsung/auto_abox/generic/abox_generic.c line 4
Quoted 6 lines
+++
b/sound/soc/samsung/auto_abox/generic/abox_generic.csound/soc/samsung/auto_abox/generic/abox_generic.c new file +4
-0@@ -0,0 +1,568 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (c) 2020 Samsung Electronics Co., Ltd. +* http://www.samsung.com/
It's now 2025...
Please also make the entire comment a C++ one so things look more intentional.
sound/soc/samsung/auto_abox/generic/abox_generic.c line 9
Quoted 1 line
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +1
-0+//#define DEBUG
Just delete this, it can be added if needed.
Quoted 12 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +12
-0+#include <linux/clk.h> +#include <linux/io.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/of_address.h> +#include <linux/of_platform.h> +#include <linux/delay.h> +#include <linux/suspend.h> +#include <sound/soc.h> +#include <sound/soc-dapm.h> +#include <sound/pcm_params.h> +#include <linux/of_reserved_mem.h>
sound/soc/samsung/auto_abox/generic/abox_generic.c line 31
Quoted 10 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +10
-0+#include <linux/types.h> +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/sched/clock.h> +#include <linux/ktime.h> +#include <linux/iommu.h> +#include <linux/clk-provider.h> +#include <linux/kmod.h> +#include <linux/umh.h> +#include <linux/string.h>
Do you really need all these headers?
sound/soc/samsung/auto_abox/generic/abox_generic.c line 35
Quoted 1 line
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +1
-0+static struct abox_generic_data *g_abox_generic_data;
This isn't really the kernel style - neither the g_ naming, nor the concept of having a global for a driver.
sound/soc/samsung/auto_abox/generic/abox_generic.c line 49
Quoted 13 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +13
-0+/** +* @cnotice +* @prdcode +* @Sub_SW_Component{abox_generic} +* @ALM_Link {work item url} +* @purpose "get value from virtual address" +* @logic "return global abox_generic_data" +* \image html +* @params +* @param{in, -, -, -} +* @endparam +* @retval {-, struct *abox_generic_data, !NULL, NULL} +*/
This is not the style for kernel comments, and doesn't seem to make terribly much sense.
Thank you for your detailed review.
We will proceed to remove unnecessary logs and code, as well as make changes to some APIs accordingly.
Based on the feedback provided during your review, we will revise our work and submit it again upon completion.
Quoted 92 lines
-----Original Message-----
From: Mark Brown <[email protected]>
Sent: Wednesday, July 9, 2025 5:47 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH] ASoC: samsung: Implement abox generic structureQuoted 6 lines · On Wed, Jul 09, 2025 at 09:10:02AM +0900, [email protected] wrote:
From: ew kim <[email protected]>
Implemet basic abox generic drivers.
This driver is a management driver for the generic drivers used in Automotive Abox, connecting them to SOC drivers.
It supports various Exynos Automotive SOCs.I can't really tell what the driver is supposed to do from this - what is abox? Looking at the code I'm not really much clearer, to a large extent because it doesn't seem to integrate with the subsystem (or other kernel subsystems) at all. It looks like this might be intended to control a DSP offload system, but it's not 100% clear, and it seems like there's an
ioctl()interface which it looks like it's exposing internal abstractions to userspace. This needs to be some combination of much more clearly explained and better integrated with the existing kernel subsystems, right now I can't really review it effectively because it's hard for me to tell what the code is trying to do.I've got a few very supreficial comments below but really there's a structural problem that needs to be addressed first.
sound/soc/samsung/auto_abox/generic/abox_generic.c line 4
Quoted 6 lines
+++
b/sound/soc/samsung/auto_abox/generic/abox_generic.csound/soc/samsung/auto_abox/generic/abox_generic.c new file +4
-0@@ -0,0 +1,568 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (c) 2020 Samsung Electronics Co., Ltd. +* http://www.samsung.com/ It's now 2025...
Please also make the entire comment a C++ one so things look more intentional.
sound/soc/samsung/auto_abox/generic/abox_generic.c line 9
Quoted 1 line
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +1
-0+//#define DEBUG Just delete this, it can be added if needed.
Quoted 12 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +12
-0+#include <linux/clk.h> +#include <linux/io.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/of_address.h> +#include <linux/of_platform.h> +#include <linux/delay.h> +#include <linux/suspend.h> +#include <sound/soc.h> +#include <sound/soc-dapm.h> +#include <sound/pcm_params.h> +#include <linux/of_reserved_mem.h> sound/soc/samsung/auto_abox/generic/abox_generic.c line 31
Quoted 10 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +10
-0+#include <linux/types.h> +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/sched/clock.h> +#include <linux/ktime.h> +#include <linux/iommu.h> +#include <linux/clk-provider.h> +#include <linux/kmod.h> +#include <linux/umh.h> +#include <linux/string.h> Do you really need all these headers?
sound/soc/samsung/auto_abox/generic/abox_generic.c line 35
Quoted 1 line
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +1
-0+static struct abox_generic_data *g_abox_generic_data;This isn't really the kernel style - neither the g_ naming, nor the concept of having a global for a driver.
sound/soc/samsung/auto_abox/generic/abox_generic.c
Quoted 12 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +12
-0+/** +* @cnotice +* @prdcode +* @Sub_SW_Component{abox_generic} +* @ALM_Link {work item url} +* @purpose "get value from virtual address" +* @logic "return global abox_generic_data" +* \image html +* @params +* @param{in, -, -, -} +* @endparam +* @retval {-, struct *abox_generic_data, !NULL, NULL} */ This is not the style for kernel comments, and doesn't seem to make terribly much sense.
Quoted 9 lines · On 09/07/2025 02:10, [email protected] wrote:
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +9
-0+/** +* @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
sound/soc/samsung/auto_abox/generic/abox_generic.c line 503
Quoted 10 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +10
-0+* @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.
Quoted 43 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +43
-0+ +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 = {
sound/soc/samsung/auto_abox/generic/abox_generic.c line 556
Quoted 10 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +10
-0+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.
sound/soc/samsung/auto_abox/generic/abox_generic.c line 563
Quoted 7 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +7
-0+ .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.
sound/soc/samsung/auto_abox/generic/abox_generic.c line 566
Quoted 3 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +3
-0+MODULE_AUTHOR ("Eunwoo Kim, <[email protected]>" ); +MODULE_DESCRIPTION ("Samsung ASoC A-Box Generic Driver" ); +MODULE_ALIAS ("platform:samsung-abox-generic" );
No, drop. This was raised so many times already...
Quoted 8 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +2
-0+MODULE_LICENSE ("GPL v2" ); +sound/soc/samsung/auto_abox/generic/include/abox_generic.h new file +0
-0
sound/soc/samsung/auto_abox/generic/include/abox_generic.h line 8
Quoted 8 lines
sound/soc/samsung/auto_abox/generic/include/abox_generic.h new file +8
-0@@ -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?
Quoted 16 lines
sound/soc/samsung/auto_abox/generic/include/abox_generic.h new file +16
-0+*/ + +#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,
sound/soc/samsung/auto_abox/generic/include/abox_generic.h line 34
Quoted 10 lines
sound/soc/samsung/auto_abox/generic/include/abox_generic.h new file +10
-0+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.
Quoted 7 lines
sound/soc/samsung/auto_abox/generic/include/abox_generic.h new file +7
-0+ +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;
sound/soc/samsung/auto_abox/generic/include/abox_generic.h line 51
Quoted 10 lines
sound/soc/samsung/auto_abox/generic/include/abox_generic.h new file +10
-0+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?
Quoted 6 lines
sound/soc/samsung/auto_abox/generic/include/abox_generic.h new file +6
-0+ +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,
sound/soc/samsung/auto_abox/generic/include/abox_generic.h line 67
Quoted 10 lines
sound/soc/samsung/auto_abox/generic/include/abox_generic.h new file +10
-0+ 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.
sound/soc/samsung/auto_abox/generic/include/abox_generic.h line 71
Quoted 4 lines
sound/soc/samsung/auto_abox/generic/include/abox_generic.h new file +4
-0+ +extern struct platform_device *abox_generic_get_pcm_platform_dev (int pcm_id, +int stream_type); +
Best regards,
Krzysztof
Thank you for your review.
We will proceed to remove unnecessary Doxygen comments and logs as suggested.
Based on the feedback provided, we will revise the work accordingly and resubmit it for further review.
Quoted 208 lines
-----Original Message-----
From: Krzysztof Kozlowski <[email protected]>
Sent: Wednesday, July 9, 2025 10:58 PM
To: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH] ASoC: samsung: Implement abox generic structureQuoted 9 lines · On 09/07/2025 02:10, [email protected] wrote:
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +9
-0+/** +* @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 sound/soc/samsung/auto_abox/generic/abox_generic.c line 503
Quoted 10 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +10
-0+* @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.
Quoted 44 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +44
-0+ +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 = {sound/soc/samsung/auto_abox/generic/abox_generic.c line 556
Quoted 10 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +10
-0+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.
sound/soc/samsung/auto_abox/generic/abox_generic.c line 563
Quoted 7 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +7
-0+ .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.
sound/soc/samsung/auto_abox/generic/abox_generic.c line 566
Quoted 3 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +3
-0+MODULE_AUTHOR ("Eunwoo Kim, <[email protected]>" ); +MODULE_DESCRIPTION ("Samsung ASoC A-Box Generic Driver" ); +MODULE_ALIAS ("platform:samsung-abox-generic" );No, drop. This was raised so many times already...
Quoted 10 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +2
-0+MODULE_LICENSE ("GPL v2" ); +diff --git
a/sound/soc/samsung/auto_abox/generic/include/abox_generic.hb/sound/soc/samsung/auto_abox/generic/include/abox_generic.hnew file mode 100644
index 000000000000..1c954272e2b5sound/soc/samsung/auto_abox/generic/include/abox_generic.h line 8
Quoted 8 lines
sound/soc/samsung/auto_abox/generic/include/abox_generic.h new file +8
-0@@ -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?
sound/soc/samsung/auto_abox/generic/include/abox_generic.h line 14
Quoted 6 lines
sound/soc/samsung/auto_abox/generic/include/abox_generic.h new file +6
-0+*/ + +#ifndef __SND_SOC_ABOX_GENERIC_BASE_H#define +__SND_SOC_ABOX_GENERIC_BASE_H + +#define ABOX_GENERIC_DATA abox_generic_get_abox_generic_data();Quoted 11 lines
sound/soc/samsung/auto_abox/generic/include/abox_generic.h new file +11
-0+ +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 ,sound/soc/samsung/auto_abox/generic/include/abox_generic.h
Quoted 10 lines
sound/soc/samsung/auto_abox/generic/include/abox_generic.h new file +10
-0+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.
Quoted 7 lines
sound/soc/samsung/auto_abox/generic/include/abox_generic.h new file +7
-0+ +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;sound/soc/samsung/auto_abox/generic/include/abox_generic.h line 51
Quoted 10 lines
sound/soc/samsung/auto_abox/generic/include/abox_generic.h new file +10
-0+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?
sound/soc/samsung/auto_abox/generic/include/abox_generic.h
Quoted 6 lines
sound/soc/samsung/auto_abox/generic/include/abox_generic.h new file +6
-0+ +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_cmdcmd,sound/soc/samsung/auto_abox/generic/include/abox_generic.h
Quoted 11 lines
sound/soc/samsung/auto_abox/generic/include/abox_generic.h new file +11
-0+ 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.
sound/soc/samsung/auto_abox/generic/include/abox_generic.h line 71
Quoted 2 lines
sound/soc/samsung/auto_abox/generic/include/abox_generic.h new file +2
-0+ +extern struct platform_device *abox_generic_get_pcm_platform_dev(int
pcm_id,sound/soc/samsung/auto_abox/generic/include/abox_generic.h line 73
Quoted 2 lines
sound/soc/samsung/auto_abox/generic/include/abox_generic.h new file +2
-0+ int stream_type); +Best regards,
Krzysztof
Quoted 2 lines · 김은우
Thank you for your review.
We will proceed to remove unnecessary Doxygen comments and logs as suggested.
Only these, but what about all other comments? Please implement all comments and do a thorough internal review cleaning all the downstream stuff from here. Your patchset is also not correctly threaded, so please read submitting patches or just use b4.
Please avoid top-posting.
Quoted 3 lines
Based on the feedback provided, we will revise the work accordingly and resubmit it for further review.
Best regards,
Krzysztof
Le 09/07/2025 à 02:10, [email protected] a écrit :
Quoted 3 lines
From: ew kim <[email protected]>
Implemet basic abox generic drivers.
Implement.
Quoted 4 lines
This driver is a management driver for the generic drivers used in Automotive Abox, connecting them to SOC drivers.
It supports various Exynos Automotive SOCs.
...
sound/soc/samsung/auto_abox/generic/abox_generic.c line 114
Quoted 6 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +6
-0+int abox_generic_attach_soc_callback (struct device *soc_dev, +SOC_IOCTL soc_ioctl) +{ +struct abox_generic_data *generic_data =ABOX_GENERIC_DATA ; + +dev_info (soc_dev,"%s(%d) Attach SoC IOCTL\n" , __func__, __LINE__);
__LINE__ is only used in this function. Maybe it is a bit too much?
Quoted 19 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +19
-0+if (!generic_data) { +dev_err (soc_dev,"%s Generic Drv is not ready\n" , __func__); +return -ENODATA ; + } + generic_data->soc_dev = soc_dev; + generic_data->soc_ioctl = soc_ioctl; + + generic_data->num_of_rdma = generic_data->soc_ioctl (generic_data->soc_dev, +ABOX_SOC_IOCTL_GET_NUM_OF_RDMA ,NULL ); + generic_data->num_of_wdma = generic_data->soc_ioctl (generic_data->soc_dev, +ABOX_SOC_IOCTL_GET_NUM_OF_WDMA ,NULL ); + generic_data->num_of_uaif = generic_data->soc_ioctl (generic_data->soc_dev, +ABOX_SOC_IOCTL_GET_NUM_OF_UAIF ,NULL ); +dev_info (soc_dev,"%s(%d) num_of_rdma:%d\n" , __func__, __LINE__, generic_data->num_of_rdma); +dev_info (soc_dev,"%s(%d) num_of_wdma:%d\n" , __func__, __LINE__, generic_data->num_of_wdma); +dev_info (soc_dev,"%s(%d) num_of_uaif:%d\n" , __func__, __LINE__, generic_data->num_of_uaif); + +return 0 ; +}
...
sound/soc/samsung/auto_abox/generic/abox_generic.c line 242
Quoted 6 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +6
-0+struct device *abox_generic_find_fe_dev_from_rtd (struct snd_soc_pcm_runtime *be) +{ +struct abox_generic_data *generic_data =ABOX_GENERIC_DATA ; +struct snd_soc_dpcm *dpcm =NULL ; +struct snd_soc_pcm_runtime *fe =NULL ; +int stream_type =0 ;
Unneeded and unusual init
Quoted 10 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +10
-0+ +if (!generic_data) +return NULL ; + +for (stream_type =0 ; stream_type <=SNDRV_PCM_STREAM_LAST ; stream_type++) { +int cmpnt_index =0 ; +struct snd_soc_component *component =NULL ; + +for_each_dpcm_fe (be, stream_type, dpcm) { + fe = dpcm->fe;
sound/soc/samsung/auto_abox/generic/abox_generic.c line 262
Quoted 10 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +10
-0+if (fe) +break ; + } +if (!fe) +continue ; + +for_each_rtd_components (fe, cmpnt_index, component) { +struct platform_device **pdev =NULL ; +int num_of_pcm_dev =0 ; +int i =0 ;
Unneeded and unusual init
Quoted 16 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +16
-0+ +if (stream_type ==SNDRV_PCM_STREAM_PLAYBACK ) { + num_of_pcm_dev = generic_data->num_of_pcm_playback; + pdev = generic_data->pdev_pcm_playback; + }else { + num_of_pcm_dev = generic_data->num_of_pcm_capture; + pdev = generic_data->pdev_pcm_capture; + } +for (i =0 ; i < num_of_pcm_dev; i++) +if (pdev[i] && component->dev == &pdev[i]->dev) +return component->dev; + } + } + +return NULL ; +}
...
sound/soc/samsung/auto_abox/generic/abox_generic.c line 342
Quoted 7 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +7
-0+static int abox_generic_resume (struct device *dev) +{ +struct abox_generic_data *data =dev_get_drvdata (dev); +int ret =0 ; + +dev_info (dev,"%s start\n" , __func__); +if (!data) {
I don't think this can happen. (same for the suspend function)
sound/soc/samsung/auto_abox/generic/abox_generic.c line 320
Quoted 6 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +6
-0+dev_err (dev,"%s: Invalid abox generic data\n" , __func__); +return -ENODATA ; + } + +dev_info (dev,"%s end\n" , __func__); +return ret;
return 0; to be more explicit?
Quoted 1 line
+}
...
Quoted 12 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +12
-0+static int abox_generic_read_property_from_dt (struct device *dev,struct abox_generic_data *data) +{ +struct device_node *np = dev->of_node; +int ret =0 ; + + ret =of_property_read_u32 (np,"samsung,num-of-pcm_playback" , &data->num_of_pcm_playback); +if (ret <0 ) { +dev_err (dev,"%s property reading fail\n" ,"samsung,num-of-pcm_playback" ); +return ret; + } + ret =of_property_read_u32 (np,"samsung,num-of-pcm_capture" , &data->num_of_pcm_capture); +if (ret <0 ) {
sound/soc/samsung/auto_abox/generic/abox_generic.c line 393
Quoted 10 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +10
-0+dev_err (dev,"%s property reading fail\n" ,"samsung,num-of-pcm_capture" ); +return ret; + } + ret =of_property_read_u32 (np,"samsung,num-of-i2s-dummy-backend" , &data->num_of_i2s_dummy); +if (ret <0 ) { +dev_err (dev,"%s property reading fail\n" ,"samsung,num-of-i2s-dummy-backend" ); +return ret; + } + +return ret;
return 0; to be more explicit?
Quoted 11 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +11
-0+} + +/** +* @cnotice +* @prdcode +* @Sub_SW_Component{abox generic} +* @ALM_Link {work item url} +* @purpose "Allocate memory for abox generic" +* @logic +* \image html +* @params
sound/soc/samsung/auto_abox/generic/abox_generic.c line 414
Quoted 10 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +10
-0+* @param{in, dev, struct:: device *, !NULL} +* @param{in, data, struct:: abox_gneric_data, !NULL} +* @param{out, data->pdev_pcm_playback, struct:: platform_device, !NULL} +* @param{out, data->pdev_pcm_capture, struct:: platform_device, !NULL} +* @endparam +* @retval{ret, int, 0, 0, > 0} +*/ +static int abox_generic_allocate_memory (struct device *dev,struct abox_generic_data *data) +{ +int ret =0 ;
Unneeded (see below)
sound/soc/samsung/auto_abox/generic/abox_generic.c line 416
Quoted 2 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +2
-0+ + data->pdev_pcm_playback = devm_kzalloc(dev,
devm_kcalloc()?
sound/soc/samsung/auto_abox/generic/abox_generic.c line 421
Quoted 5 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +5
-0+ sizeof(struct platform_device *) * data->num_of_pcm_playback, GFP_KERNEL); +if (!data->pdev_pcm_playback) { +dev_err (dev,"%s Can't allocate memory for pdev_pcm_playback\n" , __func__); + ret = -ENOMEM ; +return ret;
Not need for ret. return -ENOMEM; is less verbose.
Review
Quoted 2 lines
(quoted diff) +2
-0+ } + data->pdev_pcm_capture = devm_kzalloc(dev,
devm_kcalloc()?
sound/soc/samsung/auto_abox/generic/abox_generic.c line 428
Quoted 5 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +5
-0+ sizeof(struct platform_device *) * data->num_of_pcm_capture, GFP_KERNEL); +if (!data->pdev_pcm_capture) { +dev_err (dev,"%s Can't allocate memory for pdev_pcm_capture\n" , __func__); + ret = -ENOMEM ; +return ret;
Not need for ret. return -ENOMEM; is less verbose.
sound/soc/samsung/auto_abox/generic/abox_generic.c line 88
Quoted 3 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +3
-0+ } + +return ret;
return 0; to be more explicit?
Quoted 18 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +18
-0+} + +/** +* @cnotice +* @prdcode +* @Sub_SW_Component{abox generic} +* @ALM_Link {work item url} +* @purpose "Probing the abox generic" +* @logic +* \image html +* @params +* @param{in, pdev, struct platform_device *, !NULL} +* @param{in, pdev->dev, struct:: device, !NULL} +* @endparam +* @retval{ret, int, 0, 0, > 0} +*/ +static int samsung_abox_generic_probe (struct platform_device *pdev) +{
sound/soc/samsung/auto_abox/generic/abox_generic.c line 459
Quoted 10 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +10
-0+struct device *dev = &pdev->dev; +struct device_node *np = dev->of_node; +struct abox_generic_data *data; +int ret =0 ; + +dev_info (dev,"%s\n" , __func__); + data =devm_kzalloc (dev,sizeof (*data),GFP_KERNEL ); +if (!data) { +return -ENOMEM ; + }
Extra { } not needed.
checkpatch.pl or maybe checkpatch.pl --strict should catech it.
sound/soc/samsung/auto_abox/generic/abox_generic.c line 464
Quoted 5 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +5
-0+ + data->pdev = pdev; + ret =abox_generic_read_property_from_dt (dev, data); +if (ret <0 ) { +dev_err (dev,"%s Failed to read property. ret:%d\n" , __func__, ret);
Using dev_err_probe() here and below would be less verbose.
sound/soc/samsung/auto_abox/generic/abox_generic.c line 469
Quoted 5 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +5
-0+return ret; + } + ret =abox_generic_allocate_memory (dev, data); +if (ret <0 ) { +dev_err (dev,"%s Failed to allocate memory. ret:%d\n" , __func__, ret);
dev_err() is already called in abox_generic_allocate_memory().
sound/soc/samsung/auto_abox/generic/abox_generic.c line 482
Quoted 13 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +13
-0+return ret; + } + g_abox_generic_data = data; +platform_set_drvdata (pdev, data); + +platform_register_drivers (abox_generic_sub_drivers,ARRAY_SIZE (abox_generic_sub_drivers)); + ret =of_platform_populate (np,NULL ,NULL , dev); +if (ret <0 ) { +dev_err (dev,"Failed to populate sub-platform_devices. ret:%d\n" , ret); +return ret; + } + +return ret;
return 0; to be more explicit?
Quoted 13 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +13
-0+} + +/** +* @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
sound/soc/samsung/auto_abox/generic/abox_generic.c line 505
Quoted 10 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +10
-0+* @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__); + +if (!data) {
This can not happen. data is set if the probe succeeds.
sound/soc/samsung/auto_abox/generic/abox_generic.c line 509
Quoted 4 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +4
-0+dev_err (dev,"%s: Invalid abox generic data\n" , __func__); +return ; + } +return ;
Not needed.
Quoted 16 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +16
-0+} + +/** +* @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 +*/
sound/soc/samsung/auto_abox/generic/abox_generic.c line 535
Quoted 10 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +10
-0+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 ;
Not needed.
sound/soc/samsung/auto_abox/generic/abox_generic.c line 542
Quoted 7 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +7
-0+} + +static const struct of_device_id samsung_abox_generic_match[] = { + { + .compatible ="samsung,abox_generic" , + }, + {},
Trailing comma can be removed after a terminator.
sound/soc/samsung/auto_abox/generic/abox_generic.c line 548
Quoted 6 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +6
-0+}; +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) +};
...
CJ
Thank you for your review.
We will proceed to remove unnecessary initializations and defensive code as suggested.
Additionally, we will take into account the other comments provided and rework the content accordingly before submitting it again for further review.
Quoted 381 lines
-----Original Message-----
From: Christophe JAILLET <[email protected]>
Sent: Thursday, July 10, 2025 3:10 AM
To: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH] ASoC: samsung: Implement abox generic structureQuoted 3 lines · Le 09/07/2025 à 02:10, [email protected] a écrit :
From: ew kim <[email protected]>
Implemet basic abox generic drivers.
Implement.
Quoted 4 lines
This driver is a management driver for the generic drivers used in Automotive Abox, connecting them to SOC drivers.
It supports various Exynos Automotive SOCs....
sound/soc/samsung/auto_abox/generic/abox_generic.c line 114
Quoted 6 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +6
-0+int abox_generic_attach_soc_callback (struct device *soc_dev, +SOC_IOCTL soc_ioctl) +{ +struct abox_generic_data *generic_data =ABOX_GENERIC_DATA ; + +dev_info (soc_dev,"%s(%d) Attach SoC IOCTL\n" , __func__, __LINE__);
__LINE__is only used in this function. Maybe it is a bit too much?Quoted 15 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +8
-0+if (!generic_data) { +dev_err (soc_dev,"%s Generic Drv is not ready\n" , __func__); +return -ENODATA ; + } + generic_data->soc_dev = soc_dev; + generic_data->soc_ioctl = soc_ioctl; + + generic_data->num_of_rdma = generic_data->soc_ioctl(generic_data-
soc_dev,(quoted diff) +2
-0+ ABOX_SOC_IOCTL_GET_NUM_OF_RDMA, NULL); + generic_data->num_of_wdma = generic_data->soc_ioctl(generic_data-
soc_dev,(quoted diff) +2
-0+ ABOX_SOC_IOCTL_GET_NUM_OF_WDMA, NULL); + generic_data->num_of_uaif = generic_data->soc_ioctl(generic_data-
soc_dev,Review
Quoted 2 lines
(quoted diff) +2
-0+ ABOX_SOC_IOCTL_GET_NUM_OF_UAIF, NULL); + dev_info(soc_dev, "%s(%d) num_of_rdma:%d\n", __func__, __LINE__,
generic_data->num_of_rdma);Review
Quoted 1 line
(quoted diff) +1
-0+ dev_info(soc_dev, "%s(%d) num_of_wdma:%d\n", __func__, __LINE__,
generic_data->num_of_wdma);Quoted 5 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +5
-0+dev_info (soc_dev,"%s(%d) num_of_uaif:%d\n" , __func__, __LINE__, +generic_data->num_of_uaif); + +return 0 ; +}...
sound/soc/samsung/auto_abox/generic/abox_generic.c line 242
Quoted 6 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +6
-0+struct device *abox_generic_find_fe_dev_from_rtd (struct +snd_soc_pcm_runtime *be) { +struct abox_generic_data *generic_data =ABOX_GENERIC_DATA ; +struct snd_soc_dpcm *dpcm =NULL ; +struct snd_soc_pcm_runtime *fe =NULL ; +int stream_type =0 ;Unneeded and unusual init
sound/soc/samsung/auto_abox/generic/abox_generic.c
Quoted 5 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +5
-0+ +if (!generic_data) +return NULL ; + + for (stream_type = 0; stream_type <= SNDRV_PCM_STREAM_LAST;stream_type++) {
Quoted 5 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +5
-0+int cmpnt_index =0 ; +struct snd_soc_component *component =NULL ; + +for_each_dpcm_fe (be, stream_type, dpcm) { + fe = dpcm->fe;sound/soc/samsung/auto_abox/generic/abox_generic.c line 262
Quoted 10 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +10
-0+if (fe) +break ; + } +if (!fe) +continue ; + +for_each_rtd_components (fe, cmpnt_index, component) { +struct platform_device **pdev =NULL ; +int num_of_pcm_dev =0 ; +int i =0 ;Unneeded and unusual init
Quoted 18 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +3
-0+ +if (stream_type ==SNDRV_PCM_STREAM_PLAYBACK ) { + num_of_pcm_dev = generic_data-
num_of_pcm_playback;sound/soc/samsung/auto_abox/generic/abox_generic.c new file +3
-0+ pdev = generic_data->pdev_pcm_playback; + }else { + num_of_pcm_dev = generic_data-
num_of_pcm_capture;sound/soc/samsung/auto_abox/generic/abox_generic.c new file +10
-0+ pdev = generic_data->pdev_pcm_capture; + } +for (i =0 ; i < num_of_pcm_dev; i++) +if (pdev[i] && component->dev == &pdev[i]->dev) +return component->dev; + } + } + +return NULL ; +}...
sound/soc/samsung/auto_abox/generic/abox_generic.c line 313
Quoted 6 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +6
-0+static int abox_generic_resume (struct device *dev) { +struct abox_generic_data *data =dev_get_drvdata (dev); +int ret =0 ; + +dev_info (dev,"%s start\n" , __func__); +if (!data) {I don't think this can happen. (same for the suspend function)
sound/soc/samsung/auto_abox/generic/abox_generic.c line 320
Quoted 6 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +6
-0+dev_err (dev,"%s: Invalid abox generic data\n" , __func__); +return -ENODATA ; + } + +dev_info (dev,"%s end\n" , __func__); +return ret;return 0; to be more explicit?
Quoted 1 line
+}
...
sound/soc/samsung/auto_abox/generic/abox_generic.c
Quoted 6 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +6
-0+static int abox_generic_read_property_from_dt (struct device *dev, +struct abox_generic_data *data) { +struct device_node *np = dev->of_node; +int ret =0 ; + + ret = of_property_read_u32(np, "samsung,num-of-pcm_playback",
&data->num_of_pcm_playback);Review
Quoted 2 lines
(quoted diff) +2
-0+ if (ret < 0) { + dev_err(dev, "%s property reading fail\n", "samsung,num-of-
pcm_playback");Review
Quoted 6 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +3
-0+return ret; + } + ret = of_property_read_u32(np, "samsung,num-of-pcm_capture", &data-
num_of_pcm_capture);(quoted diff) +2
-0+ if (ret < 0) { + dev_err(dev, "%s property reading fail\n", "samsung,num-of-
pcm_capture");sound/soc/samsung/auto_abox/generic/abox_generic.c
Quoted 3 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +3
-0+return ret; + } + ret = of_property_read_u32(np, "samsung,num-of-i2s-dummy-backend",
&data->num_of_i2s_dummy);Review
Quoted 2 lines
(quoted diff) +2
-0+ if (ret < 0) { + dev_err(dev, "%s property reading fail\n", "samsung,num-of-i2s-dummy-backend");
sound/soc/samsung/auto_abox/generic/abox_generic.c line 106
Quoted 4 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +4
-0+return ret; + } + +return ret;return 0; to be more explicit?
Quoted 13 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +13
-0+} + +/** +* @cnotice +* @prdcode +* @Sub_SW_Component{abox generic} +* @ALM_Link {work item url} +* @purpose "Allocate memory for abox generic" +* @logic +* \image html +* @params +* @param{in, dev, struct:: device *, !NULL} +* @param{in, data, struct:: abox_gneric_data, !NULL} sound/soc/samsung/auto_abox/generic/abox_generic.c line 414
Quoted 10 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +10
-0+* @param{out, data->pdev_pcm_playback, struct:: platform_device, +!NULL} +* @param{out, data->pdev_pcm_capture, struct:: platform_device, +!NULL} +* @endparam +* @retval{ret, int, 0, 0, > 0} +*/ +static int abox_generic_allocate_memory (struct device *dev,struct +abox_generic_data *data) { +int ret =0 ;Unneeded (see below)
sound/soc/samsung/auto_abox/generic/abox_generic.c line 416
Quoted 2 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +2
-0+ + data->pdev_pcm_playback = devm_kzalloc(dev,
devm_kcalloc()?Review
Quoted 1 line
(quoted diff) +1
-0+ sizeof(struct platform_device *) * data->num_of_pcm_playback,
GFP_KERNEL);Review
Quoted 2 lines
(quoted diff) +2
-0+ if (!data->pdev_pcm_playback) { + dev_err(dev, "%s Can't allocate memory forpdev_pcm_playback\n",
__func__);Review
Quoted 2 lines
(quoted diff) +2
-0+ ret = -ENOMEM; + return ret;Not need for ret. return
-ENOMEM; is less verbose.Review
Quoted 2 lines
(quoted diff) +2
-0+ } + data->pdev_pcm_capture = devm_kzalloc(dev,
devm_kcalloc()?Review
Quoted 1 line
(quoted diff) +1
-0+ sizeof(struct platform_device *) * data->num_of_pcm_capture,
GFP_KERNEL);Review
Quoted 2 lines
(quoted diff) +2
-0+ if (!data->pdev_pcm_capture) { + dev_err(dev, "%s Can't allocate memory forpdev_pcm_capture\n",
__func__);Review
Quoted 2 lines
(quoted diff) +2
-0+ ret = -ENOMEM; + return ret;Not need for ret. return
-ENOMEM; is less verbose.sound/soc/samsung/auto_abox/generic/abox_generic.c line 88
Quoted 3 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +3
-0+ } + +return ret;return 0; to be more explicit?
Quoted 17 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +17
-0+} + +/** +* @cnotice +* @prdcode +* @Sub_SW_Component{abox generic} +* @ALM_Link {work item url} +* @purpose "Probing the abox generic" +* @logic +* \image html +* @params +* @param{in, pdev, struct platform_device *, !NULL} +* @param{in, pdev->dev, struct:: device, !NULL} +* @endparam +* @retval{ret, int, 0, 0, > 0} +*/ +static int samsung_abox_generic_probe (struct platform_device *pdev) {sound/soc/samsung/auto_abox/generic/abox_generic.c line 459
Quoted 10 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +10
-0+struct device *dev = &pdev->dev; +struct device_node *np = dev->of_node; +struct abox_generic_data *data; +int ret =0 ; + +dev_info (dev,"%s\n" , __func__); + data =devm_kzalloc (dev,sizeof (*data),GFP_KERNEL ); +if (!data) { +return -ENOMEM ; + }Extra { } not needed.
checkpatch.pl or maybe checkpatch.pl --strict should catech it.sound/soc/samsung/auto_abox/generic/abox_generic.c
Quoted 5 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +5
-0+ + data->pdev = pdev; + ret =abox_generic_read_property_from_dt (dev, data); +if (ret <0 ) { + dev_err(dev, "%s Failed to read property. ret:%d\n",
__func__,Quoted 1 line
+ret);
Using
dev_err_probe()here and below would be less verbose.sound/soc/samsung/auto_abox/generic/abox_generic.c
Quoted 5 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +5
-0+return ret; + } + ret =abox_generic_allocate_memory (dev, data); +if (ret <0 ) { + dev_err(dev, "%s Failed to allocate memory. ret:%d\n",
__func__,Quoted 1 line
+ret);
dev_err()is already called inabox_generic_allocate_memory().sound/soc/samsung/auto_abox/generic/abox_generic.c
Quoted 6 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +6
-0+return ret; + } + g_abox_generic_data = data; +platform_set_drvdata (pdev, data); + + platform_register_drivers(abox_generic_sub_drivers,
ARRAY_SIZE(abox_generic_sub_drivers));sound/soc/samsung/auto_abox/generic/abox_generic.c
Quoted 3 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +3
-0+ ret =of_platform_populate (np,NULL ,NULL , dev); +if (ret <0 ) { + dev_err(dev, "Failed to populate sub-platform_devices.ret:%d\n", ret);
sound/soc/samsung/auto_abox/generic/abox_generic.c line 106
Quoted 4 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +4
-0+return ret; + } + +return ret;return 0; to be more explicit?
Quoted 13 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +13
-0+} + +/** +* @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 sound/soc/samsung/auto_abox/generic/abox_generic.c line 505
Quoted 10 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +10
-0+* @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__); + +if (!data) {This can not happen. data is set if the probe succeeds.
sound/soc/samsung/auto_abox/generic/abox_generic.c line 509
Quoted 4 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +4
-0+dev_err (dev,"%s: Invalid abox generic data\n" , __func__); +return ; + } +return ;Not needed.
Quoted 17 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +17
-0+} + +/** +* @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 +*/ sound/soc/samsung/auto_abox/generic/abox_generic.c line 535
Quoted 10 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +10
-0+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 ;Not needed.
sound/soc/samsung/auto_abox/generic/abox_generic.c line 542
Quoted 7 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +7
-0+} + +static const struct of_device_id samsung_abox_generic_match[] = { + { + .compatible ="samsung,abox_generic" , + }, + {},Trailing comma can be removed after a terminator.
sound/soc/samsung/auto_abox/generic/abox_generic.c line 548
Quoted 6 lines
sound/soc/samsung/auto_abox/generic/abox_generic.c new file +6
-0+}; +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) +};...
CJ