History log of /linux-master/sound/soc/fsl/imx-audmux.c
Revision Date Author Comments
# 340d79a1 06-Oct-2023 Rob Herring <robh@kernel.org>

ASoC: Explicitly include correct DT includes

The DT of_device.h and of_platform.h date back to the separate
of_platform_bus_type before it was merged into the regular platform bus.
As part of that merge prepping Arm DT support 13 years ago, they
"temporarily" include each other. They also include platform_device.h
and of.h. As a result, there's a pretty much random mix of those include
files used throughout the tree. In order to detangle these headers and
replace the implicit includes with struct declarations, users need to
explicitly include the correct includes.

Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev> # for at91
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20231006-dt-asoc-header-cleanups-v3-1-13a4f0f7fee6@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 51451f46 15-Mar-2023 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

ASoC: fsl: imx-audmux: Convert to platform remove callback returning void

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Link: https://lore.kernel.org/r/20230315150745.67084-77-u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>


# a39bc7cf 05-Dec-2022 ye xingchen <ye.xingchen@zte.com.cn>

ASoC: imx-audmux: use sysfs_emit() to instead of scnprintf()

Follow the advice of the Documentation/filesystems/sysfs.rst and show()
should only use sysfs_emit() or sysfs_emit_at() when formatting the
value to be returned to user space.

Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
Link: https://lore.kernel.org/r/202212051943476482106@zte.com.cn
Signed-off-by: Mark Brown <broonie@kernel.org>


# 142d4562 05-Jun-2022 Minghao Chi <chi.minghao@zte.com.cn>

ASoC: imx-audmux: remove unnecessary check of clk_disable_unprepare/clk_prepare_enable

Because clk_disable_unprepare/clk_prepare_enable already checked NULL clock
parameter, so the additional checks are unnecessary, just remove them.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com>
Link: https://lore.kernel.org/r/20220606033705.291048-1-chi.minghao@zte.com.cn
Signed-off-by: Mark Brown <broonie@kernel.org>


# 2f4a8171 25-May-2022 Fabio Estevam <festevam@gmail.com>

ASoC: imx-audmux: Silence a clang warning

Change the of_device_get_match_data() cast to (uintptr_t)
to silence the following clang warning:

sound/soc/fsl/imx-audmux.c:301:16: warning: cast to smaller integer type 'enum imx_audmux_type' from 'const void *' [-Wvoid-pointer-to-enum-cast]

Reported-by: kernel test robot <lkp@intel.com>
Fixes: 6a8b8b582db1 ("ASoC: imx-audmux: Remove unused .id_table")
Signed-off-by: Fabio Estevam <festevam@gmail.com>
Link: https://lore.kernel.org/r/20220526010543.1164793-1-festevam@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 6a8b8b58 23-Nov-2020 Fabio Estevam <festevam@gmail.com>

ASoC: imx-audmux: Remove unused .id_table

Since 5.10-rc1 i.MX is a devicetree-only platform and the existing
.id_table support in this driver was only useful for old non-devicetree
platforms.

Get rid of the .id_table since it is no longer used.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
Link: https://lore.kernel.org/r/20201123200917.16447-1-festevam@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 1ce8f643 18-Jul-2020 Alexander A. Klimov <grandmaster@al2klimov.de>

ASoC: fsl: Replace HTTP links with HTTPS ones

Rationale:
Reduces attack surface on kernel devs opening the links for MITM
as HTTPS traffic is much harder to manipulate.

Deterministic algorithm:
For each file:
If not .svg:
For each line:
If doesn't contain `\bxmlns\b`:
For each link, `\bhttp://[^# \t\r\n]*(?:\w|/)`:
If neither `\bgnu\.org/license`, nor `\bmozilla\.org/MPL\b`:
If both the HTTP and HTTPS versions
return 200 OK and serve the same content:
Replace HTTP with HTTPS.

Signed-off-by: Alexander A. Klimov <grandmaster@al2klimov.de>
Link: https://lore.kernel.org/r/20200718111209.11760-1-grandmaster@al2klimov.de
Signed-off-by: Mark Brown <broonie@kernel.org>


# 8661ab5b 15-Aug-2019 Shengjiu Wang <shengjiu.wang@nxp.com>

ASoC: imx-audmux: Add driver suspend and resume to support MEGA Fast

For i.MX6 SoloX, there is a mode of the SoC to shutdown all power
source of modules during system suspend and resume procedure.
Thus, AUDMUX needs to save all the values of registers before the
system suspend and restore them after the system resume.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1565931794-7218-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# d003e308 27-Jul-2019 YueHaibing <yuehaibing@huawei.com>

ASoC: imx-audmux: use devm_platform_ioremap_resource() to simplify code

Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20190727150738.54764-8-yuehaibing@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 227ab8ba 14-Jun-2019 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ASoC: fsl: no need to check return value of debugfs_create functions

When calling debugfs functions, there is no need to ever check the
return value. The function can work or not, but the code logic should
never do something different based on this.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 47bbcbfe 05-Apr-2019 Andra Danciu <andradanciu1997@gmail.com>

ASoC: imx-audmux: Switch to SPDX identifier

Adopt the SPDX license identifier headers to ease license compliance
management.

Signed-off-by: Andra Danciu <andradanciu1997@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# c407cd00 14-Jan-2019 Silvio Cesare <silvio.cesare@gmail.com>

ASoC: imx-audmux: change snprintf to scnprintf for possible overflow

Change snprintf to scnprintf. There are generally two cases where using
snprintf causes problems.

1) Uses of size += snprintf(buf, SIZE - size, fmt, ...)
In this case, if snprintf would have written more characters than what the
buffer size (SIZE) is, then size will end up larger than SIZE. In later
uses of snprintf, SIZE - size will result in a negative number, leading
to problems. Note that size might already be too large by using
size = snprintf before the code reaches a case of size += snprintf.

2) If size is ultimately used as a length parameter for a copy back to user
space, then it will potentially allow for a buffer overflow and information
disclosure when size is greater than SIZE. When the size is used to index
the buffer directly, we can have memory corruption. This also means when
size = snprintf... is used, it may also cause problems since size may become
large. Copying to userspace is mitigated by the HARDENED_USERCOPY kernel
configuration.

The solution to these issues is to use scnprintf which returns the number of
characters actually written to the buffer, so the size variable will never
exceed SIZE.

Signed-off-by: Silvio Cesare <silvio.cesare@gmail.com>
Cc: Timur Tabi <timur@kernel.org>
Cc: Nicolin Chen <nicoleotsuka@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Xiubo Li <Xiubo.Lee@gmail.com>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 06d15a2e 07-Aug-2017 Rob Herring <robh@kernel.org>

ASoC: fsl: Convert to using %pOF instead of full_name

Now that we have a custom printf format specifier, convert users of
full_name to use %pOF instead. This is preparation to remove storing
of the full path string for each node.

Signed-off-by: Rob Herring <robh@kernel.org>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# e51cebf7 01-May-2015 Krzysztof Kozlowski <krzk@kernel.org>

ASoC: fsl: Constify platform_device_id

The platform_device_id is not modified by the driver and core uses it as
const.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 8cb636b1 20-Oct-2014 Wolfram Sang <wsa@kernel.org>

ASoC: fsl: drop owner assignment from platform_drivers

A platform_driver does not need to set an owner, it will be populated by the
driver core.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>


# e5f89768 01-Aug-2014 Mark Brown <broonie@linaro.org>

ASoC: imx-audmux: Use uintptr_t for port numbers

Since we pass the port number through file private data for debugfs we cast
it to and from a pointer so use uintptr_t in order to ensure that the
types are compatible, avoiding warnings on 64 bit platforms where pointers
are 64 bit and unsigned integers 32 bit.

Signed-off-by: Mark Brown <broonie@linaro.org>


# b8909783 24-Apr-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: imx-audmux: Fix section mismatch

audmux_debugfs_init() is marked as __init, but is called from imx_audmux_probe()
which is not marked as __init. This creates a section mismatch and a potential
runtime crash (if imx_audmux_probe() is called after the .init section was
dropped). This patch removes the __init annotation from audmux_debugfs_init(),
which fixes the following warning:
WARNING: sound/soc/built-in.o(.text+0x86960): Section mismatch in reference
from the function imx_audmux_probe() to the function
.init.text:audmux_debugfs_init()

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 1b3ed70a 12-Oct-2013 Felipe Pena <felipensp@gmail.com>

ASoC: fsl: Fix memory leak in imx-audmux.c

When audmux_clk is used and clk_prepare_enable function succeed,
the memory alloc'd to buf variable is leaked

Signed-off-by: Felipe Pena <felipensp@gmail.com>
Reviewed-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# bae35992 03-Sep-2013 Fabio Estevam <fabio.estevam@freescale.com>

ASoC: fsl: imx-audmux: Do not call imx_audmux_parse_dt_defaults() on non-dt kernel

Booting a mx51babbage board with a non-dt kernel leads to the following crash:

Unable to handle kernel NULL pointer dereference at virtual address 0000001c
pgd = 80004000
[0000001c] *pgd=00000000
Internal error: Oops: 5 [#1] SMP ARM
Modules linked in:
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.11.0-next-20130903 #287
task: 9f860000 ti: 9f862000 task.ti: 9f862000
PC is at of_get_next_available_child+0x5c/0x68
LR is at of_get_next_available_child+0x1c/0x68
pc : [<8043ea58>] lr : [<8043ea18>] psr: 60000193
sp : 9f863d58 ip : 00000000 fp : 9f863d74
r10: 9f89a010 r9 : 9f862000 r8 : 807bb26c
r7 : 80615d5c r6 : 00000000 r5 : 60000113 r4 : 00000000
r3 : 00000000 r2 : 808770a4 r1 : 00000011 r0 : 60000113
Flags: nZCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment kernel
Control: 10c5387d Table: 90004019 DAC: 00000017
Process swapper/0 (pid: 1, stack limit = 0x9f862240)
Stack: (0x9f863d58 to 0x9f864000)

This is caused by commit 8548a464b9 (ASoC: imx-audmux: Read default
configuration from devicetree).

In order to fix this, add a check for 'of_id' so that
imx_audmux_parse_dt_defaults() only gets called when a dt kernel is running.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 9c0aeaa3 10-Aug-2013 Markus Pargmann <mpa@pengutronix.de>

ASoC: imx-audmux: default configuration parser fixups

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 8548a464 27-Jul-2013 Markus Pargmann <mpa@pengutronix.de>

ASoC: imx-audmux: Read default configuration from devicetree

Adds a function to parse a default port configuration from devicetree.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 72192366 21-Jul-2013 Fabio Estevam <fabio.estevam@freescale.com>

ASoC: fsl: imx-audmux: Check the return value from clk_prepare_enable()

clk_prepare_enable() may fail, so let's check its return value and propagate it
in the case of error.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 436947fc 06-May-2013 Fabio Estevam <fabio.estevam@freescale.com>

ASoC: fsl: imx-audmux: Let device core handle pinctrl

Since commit ab78029 (drivers/pinctrl: grab default handles from device core),
we can rely on device core for handling pinctrl.

So remove devm_pinctrl_get_select_default() from the driver.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 127c5cad 12-Mar-2013 Fabio Estevam <fabio.estevam@freescale.com>

ASoC: fsl: imx-audmux: Use devm_clk_get()

By using devm_clk_get() we can save a call to clk_put().

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# a10807ae 11-Feb-2013 Fabio Estevam <fabio.estevam@freescale.com>

ASoC: fsl: imx-audmux: Fix sparse warning

Fix the following sparse warning:

sound/soc/fsl/imx-audmux.c:182:3: warning: symbol 'audmux_type' was not declared. Should it be static?

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# b25b5aa0 21-Jan-2013 Thierry Reding <thierry.reding@avionic-design.de>

ASoC: Convert to devm_ioremap_resource()

Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit
error messages can be removed from the failure code paths.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Liam Girdwood <lrg@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# a0a3d518 07-Dec-2012 Bill Pemberton <wfp5p@virginia.edu>

ASoC: fsl: remove __dev* attributes

CONFIG_HOTPLUG is going away as an option. As result the __dev*
markings will be going away.

Remove use of __devinit, __devexit_p, __devinitdata, __devinitconst,
and __devexit.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# f3a50c95 18-Sep-2012 Richard Zhao <richard.zhao@freescale.com>

ASoC: imx-audmux: remove null check of audmux_base in audmux_read_file

When audmux_read_file is called, it means the driver is already
initialised successfully, so we don't need to check audmux_base.

It also fix smatch warning:
sound/soc/fsl/imx-audmux.c:78 audmux_read_file() warn: possible memory leak of 'buf'

Signed-off-by: Richard Zhao <richard.zhao@freescale.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 409b78cc 18-Jul-2012 Torben Hohn <torbenh@linutronix.de>

ASoC imx-audmux: add MX31_AUDMUX_PORT7_SSI_PINS_7 define

The MX31 Audmux also has 7 Ports.
This patch adds the missing define, and makes the debugfs code iterate
over that port too.

Signed-off-by: Torben Hohn <torbenh@linutronix.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# a1c85ec0 03-Jun-2012 Richard Zhao <richard.zhao@freescale.com>

ASoC: imx-audmux: add pinctrl support

Signed-off-by: Richard Zhao <richard.zhao@freescale.com>
Acked-by: Dong Aisheng <dong.aisheng@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# a23dc694 16-Mar-2012 Shawn Guo <shawn.guo@linaro.org>

ASoC: imx: merge sound/soc/imx into sound/soc/fsl

Freescale PowerPC and ARM/IMX families share the same SSI IP block.
The patch merges sound/soc/imx into sound/soc/fsl, so that the possible
code sharing and consolidation can happen.

This is a plain merge, except that menuconfig SND_POWERPC_SOC is added
in Kconfig for PowerPC platform as a correspondence to SND_IMX_SOC for
IMX platform.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Timur Tabi <timur@freescale.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>