Tzung-Bi Shih [Mon, 14 Oct 2019 10:20:14 +0000 (18:20 +0800)]
ASoC: cros_ec_codec: refactor I2S RX
Refactor by the following items:
- reformat copyright declaration
- use more specific name "i2s rx"
- use verbose symbol names to separate namespaces
- make some short functions inline
- remove unused TDM-related code
Shuming Fan [Wed, 16 Oct 2019 08:58:45 +0000 (16:58 +0800)]
ASoC: rt1011: Read and apply r0 and temperature device property
Typically, the r0 (calibration data) and temperature were measured in the factory.
This information is written into the non-volatile area
where keeps data whether factory reset or OS update.
In Chromium OS case, the coreboot will read the info from VPD and create
the device property for each rt1011.
Shuming Fan [Wed, 16 Oct 2019 11:56:17 +0000 (19:56 +0800)]
ASoC: dt-bindings: rt1011: add r0 and temperature device property
Typically, the r0 (calibration data) and temperature were measured in the factory.
This information is written into the non-volatile area
where keeps data whether factory reset or OS update.
Peter Ujfalusi [Tue, 15 Oct 2019 09:00:37 +0000 (12:00 +0300)]
ASoC: pcm3168a: Fix serial mode dependent format support
fmt 0 is perfectly valid (PCM3168A_FMT_I2S). Remove the return in case
fmt == 0.
Fixes: ("ASoC: pcm3168a: Use fixup instead of constraint for channels and formats") Reported-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Link: https://lore.kernel.org/r/20191015090037.23271-1-peter.ujfalusi@ti.com Signed-off-by: Mark Brown <broonie@kernel.org>
linux/include/sound/sof/header.h:125:2: error: unknown type name ‘uint32_t’uint32_t size;
linux/include/sound/sof/header.h:136:2: error: unknown type name ‘uint32_t’uint32_t size;
linux/include/sound/sof/header.h:137:2: error: unknown type name ‘uint32_t’uint32_t cmd;
...
linux/include/sound/sof/dai-imx.h:18:2: error: unknown type name ‘uint16_t’uint16_t reserved1;
linux/include/sound/sof/dai-imx.h:30:2: error: unknown type name ‘uint16_t’uint16_t tdm_slot_width;
linux/include/sound/sof/dai-imx.h:31:2: error: unknown type name ‘uint16_t’uint16_t reserved2;
YueHaibing [Mon, 14 Oct 2019 09:13:08 +0000 (17:13 +0800)]
ASoC: SOF: Fix randbuild error
When LEDS_TRIGGER_AUDIO is m and SND_SOC_SOF is y,
sound/soc/sof/control.o: In function `snd_sof_switch_put':
control.c:(.text+0x587): undefined reference to `ledtrig_audio_set'
control.c:(.text+0x593): undefined reference to `ledtrig_audio_set'
Reported-by: Hulk Robot <hulkci@huawei.com> Fixes: 5d43001ae436 ("ASoC: SOF: acpi led support for switch controls") Signed-off-by: YueHaibing <yuehaibing@huawei.com> Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20191014091308.23688-1-yuehaibing@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
ASoC: SOF: topology: check errors when parsing LED tokens
sof_parse_tokens() returns a value that is checked on every call
except for LED tokens, fix with explicit test.
Detected with cppcheck warning:
sound/soc/sof/topology.c:973:6: style: Variable 'ret' is assigned a
value that is never used. [unreadVariable]
ret = sof_parse_tokens(scomp, &scontrol->led_ctl, led_tokens,
^
Olivier Moysan [Fri, 11 Oct 2019 08:48:16 +0000 (10:48 +0200)]
ASoC: stm32: spdifrx: retry synchronization in sync state
When STM32 SPDIFRX is in sync state, allow multiple
synchro attempts, instead of exiting on first unsuccessful
trial. This is useful when spdif signal is not immediately
available on input. This also allows Pulseaudio to check
iec capture device availability when no signal is present.
Jaska Uimonen [Tue, 8 Oct 2019 16:44:43 +0000 (11:44 -0500)]
ASoC: SOF: acpi led support for switch controls
Currently sof doesn't support acpi leds with mute switches. So implement
acpi leds following quite shamelessly existing HDA implementation by
Takashi Iwai.
Mute leds can be enabled in topology by adding led and direction token
in switch control private data.
One of the usages for this debug parameter to disable pm_runtime,
which can be useful for platform bringup, or keep the parent device
active while enabling pm_runtime for child devices (e.g. with
SoundWire or MFD). This can also be useful to measure suspend-resume
latencies or child devices.
One of the usages for this debug parameter to disable pm_runtime,
which can be useful for platform bringup, or keep the parent device
active while enabling pm_runtime for child devices (e.g. with
SoundWire or MFD). This can also be useful to measure suspend-resume
latencies or child devices.
Jaska Uimonen [Tue, 8 Oct 2019 16:44:41 +0000 (11:44 -0500)]
ASoC: SOF: enable dual control for pga
Currently sof pga element supports only 1 kcontrol and you can't create
for example a mixer element with combined volume slider and mute switch.
So enable sof pga to have more than 1 kcontrol associated with it. Also
check for possible NULL tlv pointer as switch element might not have it.
Kai Vehmanen [Tue, 8 Oct 2019 16:44:35 +0000 (11:44 -0500)]
ASoC: SOF: enable sync_write in hdac_bus
Align SOF HDA implementation with snd-hda-intel driver and enable
sync_write flag for all supported Intel platforms in SOF. When set,
a sync is issued after each verb write.
Sync after write has helped to overcome intermittent delays in
system resume flow on Intel Coffee Lake systems, and most recently
probe errors related to the HDMI codec on Ice Lake systems.
Matches the snd-hda-intel driver change done in commit 2756d9143aa5
("ALSA: hda - Fix intermittent CORB/RIRB stall on Intel chips").
This patch adds support for the 8 channel PDM-to-I2S/TDM converter. The
ADAU7118 converts four stereo pulse density modulation (PDM) bitstreams
into one pulse code modulation (PCM) output stream. The source for the PDM
data can be eight microphones or other PDM sources. The PCM audio data is
output on a serial audio interface port in either inter-IC serial (I2S) or
time domain multiplexed (TDM) format.
ASoC: fsl: fsl_dma: don't use snd_soc_rtdcom_lookup()
snd_soc_rtdcom_lookup() will be removed.
It is used at fsl_dma_isr(), but it is just for dev_err(dev..).
rtd->dev is very enough for it.
This patch replace component->dev to rtd->dev
snd_pcm_ops is no longer needed.
Let's use component driver callback.
*Note*
Only Intel skl-pcm has .get_time_info implementation, but ALSA SoC
framework doesn't call it so far.
To keep its implementation, this patch keeps .get_time_info,
but it is still not called.
Intel guy need to support it in the future.
ASoC: soc-core: add new pcm_construct/pcm_destruct
Current snd_soc_component_driver has pcm_new/pcm_free, but,
it doesn't have "component" at parameter.
Thus, each callback can't know it is called for which component.
Each callback currently is getting "component" by using
snd_soc_rtdcom_lookup() with driver name.
It works today, but, will not work in the future if we support multi
CPU/Codec/Platform, because 1 rtd might have multiple same driver
name component.
To solve this issue, each callback need to be called with component.
This patch adds new pcm_construct/pcm_destruct with "component"
parameter.
ASoC: soc-core: merge snd_pcm_ops member to component driver
Current snd_soc_component_driver has snd_pcm_ops, and each driver can
have callback via it (1).
But, it is mainly created for ALSA, thus, it doesn't have "component"
as parameter for ALSA SoC (1)(2).
Thus, each callback can't know it is called for which component.
Thus, each callback currently is getting "component" by using
snd_soc_rtdcom_lookup() with driver name (3).
It works today, but, will not work in the future if we support multi
CPU/Codec/Platform, because 1 rtd might have multiple components which
have same driver name.
To solve this issue, each callback needs to be called with component.
We already have many component driver callback.
This patch copies each snd_pcm_ops member under component driver,
and having "component" as parameter.
Only Intel skl-pcm has .get_time_info implementation, but ALSA SoC
framework doesn't call it so far.
To keep its implementation, this patch keeps .get_time_info,
but it is still not called.
Intel guy need to support it in the future.
Peter Ujfalusi [Tue, 8 Oct 2019 11:57:20 +0000 (14:57 +0300)]
ASoC: pcm3168a: Use fixup instead of constraint for channels and formats
The snd_pcm_hw_constraint_minmax() works fine when a single codec is
connected to a single CPU DAI, but in multicodec or DPCM setup the
constraints placed by the driver will apply to the whole PCM stream (FE
included) and thus prevents more than 8 playback channels for example.
For cases where an interface can be pin-muxed, we need to assess at
probe time which configuration should be used. In cases such as
SoundWire, we need to maintain an alternate list of machines and walk
through them when the primary detection based on ACPI _HID fails.
When interfaces can be pin-muxed, static information from ACPI might
not be enough. Add information on which links needs to be enabled by
hardware/firmware for a specific machine driver to be selected.
When walking through the list of possible machines, links will be
checked, which implies that configurations where multiple links are
required need to be checked first.
Additional criteria will be needed later, such as which SoundWire
Slave devices are actually enabled, but for now this helps detect
between basic configurations.
According the documentation for snd_soc_update_bits the API
will return a 1 if the update was successful with a value change,
a 0 if the update was successful with no value change or a negative
if the command just failed.
So the value of return in the driver needs to be checked for being less
then 0 or the caller may indicate failure when the value actually
changed.
Dan Murphy [Mon, 7 Oct 2019 17:11:57 +0000 (12:11 -0500)]
ASoc: tas2770: Remove unused defines and variables
Remove unused defines and structure variables that are not
referenced by the code. If these are needed for future
enhancements then they should be added at that time.
Dan Carpenter [Fri, 4 Oct 2019 10:22:09 +0000 (13:22 +0300)]
ASoC: fsl_mqs: Fix error handling in probe
There are several problems in the error handling in fsl_mqs_probe().
1) "ret" isn't initialized on some paths. GCC has a feature which
warns about uninitialized variables but the code initializes "ret"
to zero at the start of the function so the checking is turned off.
2) "gpr_np" is a pointer so initializing it to zero is confusing and
generates a Sparse warning.
3) of_parse_phandle() doesn't return error pointers on error, it returns
NULL.
4) If devm_snd_soc_register_component() fails then the function should
free the "gpr_np".
Fixes: 9e28f6532c61 ("ASoC: fsl_mqs: Add MQS component driver") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/20191004102208.GB823@mwanda Signed-off-by: Mark Brown <broonie@kernel.org>
YueHaibing [Sun, 6 Oct 2019 10:55:22 +0000 (18:55 +0800)]
ASoC: fsl_mqs: remove set but not used variable 'bclk'
Fixes gcc '-Wunused-but-set-variable' warning:
sound/soc/fsl/fsl_mqs.c: In function fsl_mqs_hw_params:
sound/soc/fsl/fsl_mqs.c:54:6: warning: variable bclk set but not used [-Wunused-but-set-variable]
YueHaibing [Sun, 6 Oct 2019 10:46:31 +0000 (18:46 +0800)]
ASoc: tas2770: Fix build error without GPIOLIB
If GPIOLIB is not set, building fails:
sound/soc/codecs/tas2770.c: In function tas2770_reset:
sound/soc/codecs/tas2770.c:38:3: error: implicit declaration of function gpiod_set_value_cansleep; did you mean gpio_set_value_cansleep? [-Werror=implicit-function-declaration]
gpiod_set_value_cansleep(tas2770->reset_gpio, 0);
^~~~~~~~~~~~~~~~~~~~~~~~
gpio_set_value_cansleep
sound/soc/codecs/tas2770.c: In function tas2770_i2c_probe:
sound/soc/codecs/tas2770.c:749:24: error: implicit declaration of function devm_gpiod_get_optional; did you mean devm_regulator_get_optional? [-Werror=implicit-function-declaration]
tas2770->reset_gpio = devm_gpiod_get_optional(tas2770->dev,
^~~~~~~~~~~~~~~~~~~~~~~
devm_regulator_get_optional
sound/soc/codecs/tas2770.c:751:13: error: GPIOD_OUT_HIGH undeclared (first use in this function); did you mean GPIOF_INIT_HIGH?
GPIOD_OUT_HIGH);
^~~~~~~~~~~~~~
GPIOF_INIT_HIGH
Reported-by: Hulk Robot <hulkci@huawei.com> Fixes: 1a476abc723e ("tas2770: add tas2770 smart PA kernel driver") Suggested-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: YueHaibing <yuehaibing@huawei.com> Link: https://lore.kernel.org/r/20191006104631.60608-1-yuehaibing@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
Stephen Boyd [Fri, 4 Oct 2019 21:43:31 +0000 (14:43 -0700)]
ASoC: jz4740: Use of_device_get_match_data()
This probe function is only called if the device is backed by a DT node,
so switch this call to of_device_get_match_data() to reduce code size
and simplify a bit. This also avoids needing to reference a potentially
undefined variable because of_device_get_match_data() doesn't need to
know anything beyond the struct device to find the match table.
Cc: Arnd Bergmann <arnd@arndb.de> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Paul Cercueil <paul@crapouillou.net> Cc: Liam Girdwood <lgirdwood@gmail.com> Cc: Mark Brown <broonie@kernel.org> Cc: Jaroslav Kysela <perex@perex.cz> Cc: Takashi Iwai <tiwai@suse.com> Cc: Rob Herring <robh+dt@kernel.org> Cc: Frank Rowand <frowand.list@gmail.com> Cc: <alsa-devel@alsa-project.org> Signed-off-by: Stephen Boyd <swboyd@chromium.org> Link: https://lore.kernel.org/r/20191004214334.149976-8-swboyd@chromium.org Signed-off-by: Mark Brown <broonie@kernel.org>
ASoC: soc-core: use devm_xxx for component related resource
dai / component related resources are created when component is
registered, and it will be freed when component was unregistered.
These resources are not re-used after that.
This means, we can use devm_xxx for dai / component, without
thinking about kfree().
This patch uses devm_xxx for these.
It is easy to read code if it is cleanly using paired function/naming,
like start <-> stop, register <-> unregister, etc, etc.
But, current ALSA SoC code is very random, unbalance, not paired, etc.
It is easy to create bug at the such code, and it will be difficult to
debug.
soc_cleanup_card_resources() (a) which is paired function of
snd_soc_instantiate_card() (A) is calling soc_remove_dai_links() (*)
to remove card related resources, but it is breaking
add/remove balance (B)(b)(C)(c)(D)(d), in other words
these should be called from soc_cleanup_card_resources() (a)
from balance point of view.
More headacke is that it is using original removing method for
dai_link even though we already have snd_soc_remove_dai_link()
which is the function for it (d).
This patch removes snd_soc_remove_dai_links() and balance up code.
for_each_card_links_safe(card, link, _link) {
...
/* it should use snd_soc_remove_dai_link() here */
(d) list_del(&link->list);
}
}
(a) static int soc_cleanup_card_resources(...)
{
...
/* remove and free each DAI */
(*) soc_remove_dai_links(card);
...
}
(A) static int snd_soc_instantiate_card(struct snd_soc_card *card)
{
...
/* add predefined DAI links to the list */
for_each_card_prelinks(card, i, dai_link)
(B) snd_soc_add_dai_link(card, dai_link);
...
/* probe all components used by DAI links on this card */
(C) ret = soc_probe_link_components(card);
...
/* probe all DAI links on this card */
(D) ret = soc_probe_link_dais(card);
...
}
Current rtd, rtd->dev, rtd->codec_dais are created by normal kzalloc(),
but we want to use devm_kzalloc() as much as possible.
Created rtd->dev is registered by device_register() at
soc_new_pcm_runtime(), and it will be freed at
soc_free_pcm_runtime() by device_unregister().
This means, if we can use devm_kzalloc(rtd->dev, xxx) for
rtd / rtd->codec_dais, all these are automatically freed
via soc_free_pcm_runtime().
This patch uses devm_kzalloc(rtd->dev, xxx) for rtd / rtd->codec_dais.
Fixes: 1a476abc723e ("tas2770: add tas2770 smart PA kernel driver") CC: Frank Shi <shifu0704@thundersoft.com> Signed-off-by: kbuild test robot <lkp@intel.com> Link: https://lore.kernel.org/r/20191001175504.ufhyxh66psrht42k@332d0cec05f4 Signed-off-by: Mark Brown <broonie@kernel.org>