openwrt/staging/blogic.git
6 years agoASoC: remove unneeded static set .owner field in platform_driver
zhong jiang [Wed, 12 Sep 2018 03:41:49 +0000 (11:41 +0800)]
ASoC: remove unneeded static set .owner field in platform_driver

platform_driver_register will set the .owner field. So it is safe
to remove the redundant assignment.

The issue is detected with the help of Coccinelle.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: rockchip: add missing INTERLEAVED PCM attribute
Katsuhiro Suzuki [Mon, 10 Sep 2018 16:39:32 +0000 (01:39 +0900)]
ASoC: rockchip: add missing INTERLEAVED PCM attribute

This patch adds SNDRV_PCM_INFO_INTERLEAVED into PCM hardware info.

Signed-off-by: Katsuhiro Suzuki <katsuhiro@katsuster.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: soc-core: remove unused num_dai_links
Kuninori Morimoto [Tue, 11 Sep 2018 06:59:01 +0000 (06:59 +0000)]
ASoC: soc-core: remove unused num_dai_links

ALSA SoC is counting card->dai_link_list user,
but no-one is using it.
Let's remove it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: soc-core: avoid nested code on soc_remove_dai()
Kuninori Morimoto [Tue, 11 Sep 2018 06:54:26 +0000 (06:54 +0000)]
ASoC: soc-core: avoid nested code on soc_remove_dai()

Nested code is not readable.
This patch avoid it on soc_remove_dai().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: rt5668: remove empty rt5668_i2c_remove()
Kuninori Morimoto [Tue, 11 Sep 2018 07:02:04 +0000 (07:02 +0000)]
ASoC: rt5668: remove empty rt5668_i2c_remove()

rt5668_i2c_remove() is empty, and no longer needed.
Let's remove it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: Fix UBSAN warning at snd_soc_get/put_volsw_sx()
Rohit kumar [Tue, 11 Sep 2018 09:29:21 +0000 (14:59 +0530)]
ASoC: Fix UBSAN warning at snd_soc_get/put_volsw_sx()

In functions snd_soc_get_volsw_sx() or snd_soc_put_volsw_sx(),
if the result of (min + max) is negative, then fls() returns
signed integer with value as 32. This leads to signed integer
overflow as complete operation is considered as signed integer.

UBSAN: Undefined behaviour in sound/soc/soc-ops.c:382:50
signed integer overflow:
-2147483648 - 1 cannot be represented in type 'int'
Call trace:
[<ffffff852f746fe4>] __dump_stack lib/dump_stack.c:15 [inline]
[<ffffff852f746fe4>] dump_stack+0xec/0x158 lib/dump_stack.c:51
[<ffffff852f7b5f3c>] ubsan_epilogue+0x18/0x50 lib/ubsan.c:164
[<ffffff852f7b6840>] handle_overflow+0xf8/0x130 lib/ubsan.c:195
[<ffffff852f7b68f0>] __ubsan_handle_sub_overflow+0x34/0x44 lib/ubsan.c:211
[<ffffff85307971a0>] snd_soc_get_volsw_sx+0x1a8/0x1f8 sound/soc/soc-ops.c:382

Typecast the operation to unsigned int to fix the issue.

Signed-off-by: Rohit kumar <rohitkr@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoMerge branch 'asoc-4.19' into asoc-4.20 Cirrus conflict
Mark Brown [Mon, 10 Sep 2018 17:55:12 +0000 (18:55 +0100)]
Merge branch 'asoc-4.19' into asoc-4.20 Cirrus conflict

6 years agoASoC: pxa: switch to new ac97 bus support
Robert Jarzmik [Sat, 25 Aug 2018 08:46:18 +0000 (10:46 +0200)]
ASoC: pxa: switch to new ac97 bus support

Switch to the new ac97 bus support in sound/ac97 instead of the legacy
snd_ac97 one.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: AMD: Fix simultaneous playback and capture on different channel
Akshu Agrawal [Mon, 10 Sep 2018 17:20:27 +0000 (22:50 +0530)]
ASoC: AMD: Fix simultaneous playback and capture on different channel

If capture and playback are started on different channel (I2S/BT)
there is a possibilty that channel information passed from machine driver
is overwritten before the configuration is done in dma driver.
Example:
113.597588: cz_max_startup: ---playback sets BT channel
113.597694: cz_dmic1_startup: ---capture sets I2S channel
113.597979: acp_dma_hw_params: ---configures capture for I2S channel
113.598114: acp_dma_hw_params: ---configures playback for I2S channel

This is fixed by having 2 separate instance for playback and capture.

Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: cs4265: fix MMTLR Data switch control
Sébastien Szymanski [Thu, 6 Sep 2018 09:16:00 +0000 (11:16 +0200)]
ASoC: cs4265: fix MMTLR Data switch control

The MMTLR bit is in the CS4265_SPDIF_CTL2 register at address 0x12 bit 0
and not at address 0x0 bit 1. Fix this.

Signed-off-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
6 years agoASoC: dapm: Add missing return value check for snd_soc_dapm_new_dai
Charles Keepax [Mon, 10 Sep 2018 14:28:39 +0000 (15:28 +0100)]
ASoC: dapm: Add missing return value check for snd_soc_dapm_new_dai

snd_soc_dapm_new_dai may return an error pointer and currently this
isn't checked for in dapm_connect_dai_link_widgets. Add code to check
the return value and not add routes in that case.

Fixes: 778ff5bb8689 ("ASoC: dapm: Move connection of CODEC to CODEC DAIs")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: skl-topology: Use kmemdup to replace kzalloc + memcpy
zhong jiang [Sat, 8 Sep 2018 08:36:20 +0000 (16:36 +0800)]
ASoC: skl-topology: Use kmemdup to replace kzalloc + memcpy

kmemdup has implemented the function that kzalloc() + memcpy() will
do. and we prefer to kmemdup rather than the open coded implementation.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: q6core: Use kmemdup to replace kzalloc + memcpy
zhong jiang [Sat, 8 Sep 2018 08:36:19 +0000 (16:36 +0800)]
ASoC: q6core: Use kmemdup to replace kzalloc + memcpy

kmemdup has implemented the function that kzalloc() + memcpy() will
do. and we prefer to use the kmemdup rather than the open coded implementation.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: txx9: use devm_snd_soc_register_component()
Kuninori Morimoto [Fri, 7 Sep 2018 01:03:53 +0000 (01:03 +0000)]
ASoC: txx9: use devm_snd_soc_register_component()

Now we have devm_snd_soc_register_component().
Let's use it instead of snd_soc_register_component().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: sh: use devm_snd_soc_register_component()
Kuninori Morimoto [Fri, 7 Sep 2018 01:03:25 +0000 (01:03 +0000)]
ASoC: sh: use devm_snd_soc_register_component()

Now we have devm_snd_soc_register_component().
Let's use it instead of snd_soc_register_component().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: omap: use devm_snd_soc_register_component()
Kuninori Morimoto [Fri, 7 Sep 2018 01:02:54 +0000 (01:02 +0000)]
ASoC: omap: use devm_snd_soc_register_component()

Now we have devm_snd_soc_register_component().
Let's use it instead of snd_soc_register_component().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: nuc900: use devm_snd_soc_register_component()
Kuninori Morimoto [Fri, 7 Sep 2018 01:02:38 +0000 (01:02 +0000)]
ASoC: nuc900: use devm_snd_soc_register_component()

Now we have devm_snd_soc_register_component().
Let's use it instead of snd_soc_register_component().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: tscs454: use devm_snd_soc_register_component()
Kuninori Morimoto [Fri, 7 Sep 2018 01:01:50 +0000 (01:01 +0000)]
ASoC: tscs454: use devm_snd_soc_register_component()

Now we have devm_snd_soc_register_component().
Let's use it instead of snd_soc_register_component().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: rt5668: use devm_snd_soc_register_component()
Kuninori Morimoto [Fri, 7 Sep 2018 01:01:34 +0000 (01:01 +0000)]
ASoC: rt5668: use devm_snd_soc_register_component()

Now we have devm_snd_soc_register_component().
Let's use it instead of snd_soc_register_component().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: hdac_hda: use devm_snd_soc_register_component()
Kuninori Morimoto [Fri, 7 Sep 2018 01:01:19 +0000 (01:01 +0000)]
ASoC: hdac_hda: use devm_snd_soc_register_component()

Now we have devm_snd_soc_register_component().
Let's use it instead of snd_soc_register_component().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: bcm: use devm_snd_soc_register_component()
Kuninori Morimoto [Fri, 7 Sep 2018 01:00:49 +0000 (01:00 +0000)]
ASoC: bcm: use devm_snd_soc_register_component()

Now we have devm_snd_soc_register_component().
Let's use it instead of snd_soc_register_component().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: atmel_ssc_dai: use devm_snd_soc_register_component()
Kuninori Morimoto [Fri, 7 Sep 2018 01:00:15 +0000 (01:00 +0000)]
ASoC: atmel_ssc_dai: use devm_snd_soc_register_component()

Now we have devm_snd_soc_register_component().
Let's use it instead of snd_soc_register_component().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: AMD: Ensure reset bit is cleared before configuring
Akshu Agrawal [Mon, 10 Sep 2018 08:06:30 +0000 (13:36 +0530)]
ASoC: AMD: Ensure reset bit is cleared before configuring

HW register descriptions says:
"DMA Channel Reset...Software must confirm that this bit is
cleared before reprogramming any of the channel configuration registers."
There could be cases where dma stop errored out leaving dma channel
in reset state. We need to ensure that before the start of another dma,
channel is out of the reset state.

Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: qdsp6: q6asm-dai: clean up a return
Dan Carpenter [Mon, 10 Sep 2018 08:40:48 +0000 (11:40 +0300)]
ASoC: qdsp6: q6asm-dai: clean up a return

Smatch complains that if both "psubstream" and "csubstream" are NULL
then "ret" is uninitialized.  That probably can't happen, but it's
cleaner to just return zero anyway so let's do that.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: dapm: Fix a couple uninitialized ret variables
Dan Carpenter [Fri, 7 Sep 2018 19:40:33 +0000 (22:40 +0300)]
ASoC: dapm: Fix a couple uninitialized ret variables

Smatch complains that these variables could be uninitialized.  The first
one in snd_soc_dai_link_event() is probably a false positive, because
probably we know the lists are not empty.  I would normally ignore the
warning, but GCC complains here as well so I just silenced the warning.
The "ret" in snd_soc_dapm_new_dai() does need to be initialized or it
leads to a bogus dereference in the caller.

Fixes: 3bbf5d34fd4a ("ASoC: dapm: Move error handling to snd_soc_dapm_new_control_unlocked")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: max98373: usleep_range() needs include/delay.h
Grant Grundler [Fri, 7 Sep 2018 00:27:28 +0000 (17:27 -0700)]
ASoC: max98373: usleep_range() needs include/delay.h

Commit ca917f9fe1a0fab added use of usleep_range() but not
the corresponding "include <linux/delay.h>". The result is
with Chrome OS won't build because warnings are forced
to be errors:
mnt/host/source/src/third_party/kernel/v4.4/sound/soc/codecs/max98373.c:734:2: error: implicit declaration of function 'usleep_range' [-Werror,-Wimplicit-function-declaration]
        usleep_range(10000, 11000);
        ^

Including delay.h "fixes" this.

Signed-off-by: Grant Grundler <grundler@chromium.org>
Reviewed-by: Benson Leung <bleung@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: Intel: hdac_hdmi: Limit sampling rates at dai creation
Yong Zhi [Tue, 7 Aug 2018 17:19:16 +0000 (12:19 -0500)]
ASoC: Intel: hdac_hdmi: Limit sampling rates at dai creation

Playback of 44.1Khz contents with HDMI plugged returns
"Invalid pipe config" because HDMI paths in the FW
topology are configured to operate at 48Khz.

This patch filters out sampling rates not supported
at hdac_hdmi_create_dais() to let user space SRC
to do the converting.

Signed-off-by: Yong Zhi <yong.zhi@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: dapm: Avoid uninitialised variable warning
Charles Keepax [Thu, 6 Sep 2018 16:41:55 +0000 (17:41 +0100)]
ASoC: dapm: Avoid uninitialised variable warning

Commit 4a75aae17b2a ("ASoC: dapm: Add support for multi-CODEC
CODEC to CODEC links") adds loops that iterate over multiple
CODECs in snd_soc_dai_link_event. This also introduced a compiler
warning for a potentially uninitialised variable in the case
no CODECs are present. This should never be the case as the
DAI link must by definition contain at least 1 CODEC however
probably best to avoid the compiler warning by initialising ret
to zero.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: rsnd: Add device tree binding for r8a77990
Hiroyuki Yokoyama [Thu, 6 Sep 2018 13:28:33 +0000 (22:28 +0900)]
ASoC: rsnd: Add device tree binding for r8a77990

This patch adds the device tree binding of the r8a77990 SoC.

Signed-off-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: sgtl5000: avoid division by zero if lo_vag is zero
Colin Ian King [Thu, 6 Sep 2018 10:41:52 +0000 (11:41 +0100)]
ASoC: sgtl5000: avoid division by zero if lo_vag is zero

In the case where lo_vag <= SGTL5000_LINE_OUT_GND_BASE, lo_vag
is set to zero and later vol_quot is computed by dividing by
lo_vag causing a division by zero error.  Fix this by avoiding
a zero division and set vol_quot to zero in this specific case
so that the lowest setting for i is correctly set.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: rsnd: don't use %p for dev_dbg()
Kuninori Morimoto [Thu, 6 Sep 2018 03:22:01 +0000 (03:22 +0000)]
ASoC: rsnd: don't use %p for dev_dbg()

rsnd driver sometimes want to know which address is used when debugging.
But it will indicate "(____ptrval____)" if it used "%p" on dev_dbg().
Let's use "%pa" or "%px" for it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: rsnd: don't fallback to PIO mode when -EPROBE_DEFER
Kuninori Morimoto [Thu, 6 Sep 2018 03:21:47 +0000 (03:21 +0000)]
ASoC: rsnd: don't fallback to PIO mode when -EPROBE_DEFER

Current rsnd driver will fallback to PIO mode if it can't get DMA
handler. But, DMA might return -EPROBE_DEFER when probe timing.
This driver always fallback to PIO mode especially from
commit ac6bbf0cdf4206c ("iommu: Remove IOMMU_OF_DECLARE") because
of this reason.

The DMA driver will be probed later, but sound driver might be
probed as PIO mode in such case. This patch fixup this issue.
Then, -EPROBE_DEFER is not error. Thus, let's don't indicate error
message in such case.
And it needs to call rsnd_adg_remove() individually if probe failed,
because it registers clk which should be unregister.

Maybe PIO fallback feature itself is not needed,
but let's keep it so far.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: rsnd: adg: care clock-frequency size
Kuninori Morimoto [Thu, 6 Sep 2018 03:21:33 +0000 (03:21 +0000)]
ASoC: rsnd: adg: care clock-frequency size

ADG has buffer over flow bug if DT has more than 3 clock-frequency.
This patch fixup this issue, and uses first 2 values.

clock-frequency = <x y>; /* this is OK */
clock-frequency = <x y z>; /* this is NG */

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: rsnd: gen: use tab instead of white-space
Kuninori Morimoto [Thu, 6 Sep 2018 03:21:16 +0000 (03:21 +0000)]
ASoC: rsnd: gen: use tab instead of white-space

commit 8c9d75033340 ("ASoC: rsnd: ssiu: Support BUSIF
other than BUSIF0") added new SSIU registers.
But it is using white-space for it.
This patch fixup it to use tab.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: hdac_hdmi: remove redundant check for !port condition
Colin Ian King [Thu, 6 Sep 2018 09:39:01 +0000 (10:39 +0100)]
ASoC: hdac_hdmi: remove redundant check for !port condition

The !port check is redundant as it being performed in the following
check. Remove it.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: dapm: Move CODEC to CODEC params from the widget to the runtime
Charles Keepax [Wed, 5 Sep 2018 14:21:02 +0000 (15:21 +0100)]
ASoC: dapm: Move CODEC to CODEC params from the widget to the runtime

Larger CODECs may contain many several hundred widgets and which set of
parameters is selected only needs to be recorded on a per DAI basis. As
such move the selected CODEC to CODEC link params to be stored in the
runtime rather than the DAPM widget, to save some memory.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: dapm: Add support for multi-CODEC CODEC to CODEC links
Charles Keepax [Wed, 5 Sep 2018 14:21:01 +0000 (15:21 +0100)]
ASoC: dapm: Add support for multi-CODEC CODEC to CODEC links

Currently multi-CODEC is not supported on CODEC to CODEC links.
There are common applications where this would be useful, such
as connecting two mono amplifiers to an audio CODEC. Adding
support simply requires an update of snd_soc_dai_link_event
to loop over the attached CODEC DAIs.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: dapm: Move connection of CODEC to CODEC DAIs
Charles Keepax [Wed, 5 Sep 2018 14:21:00 +0000 (15:21 +0100)]
ASoC: dapm: Move connection of CODEC to CODEC DAIs

Currently, snd_soc_dapm_connect_dai_link_widgets connects up the routes
representing normal DAIs, however CODEC to CODEC links are hooked up
through separate infrastructure in soc_link_dai_widgets. Improve the
consistency of the code by using snd_soc_dapm_connect_dai_link for both
types of DAIs.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: dapm: Cosmetic tidy up of snd_soc_dapm_new_control
Charles Keepax [Wed, 5 Sep 2018 14:20:59 +0000 (15:20 +0100)]
ASoC: dapm: Cosmetic tidy up of snd_soc_dapm_new_control

Move the function snd_soc_dapm_new_control to be next to
snd_soc_dapm_new_controls and add some kernel doc for it.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: dapm: Move error handling to snd_soc_dapm_new_control_unlocked
Charles Keepax [Wed, 5 Sep 2018 14:20:58 +0000 (15:20 +0100)]
ASoC: dapm: Move error handling to snd_soc_dapm_new_control_unlocked

Currently DAPM has a lot of similar code to handle errors from
snd_soc_dapm_new_control_unlocked, and much of this code does
not really accurately reflect what the function returns.

Firstly, most places will check for a return value of
-EPROBE_DEFER and silence any error messages in that case. The
one notable exception here being dapm_kcontrol_data_alloc
which does currently print any error messages in the case
of snd_soc_dapm_new_control_unlocked returning NULL or an
error. Additionally the error prints being silenced in these
case are redundant as snd_soc_dapm_new_control_unlocked can
only return -EPROBE_DEFER or NULL when failing.

Secondly, most places will treat a return value of NULL as
an -ENOMEM.  This is not correct either since any error except
EPROBE_DEFER will cause a return value of NULL from
snd_soc_dapm_new_control_unlocked.

Centralise this handling and the error messages within
snd_soc_dapm_new_control_unlocked and update the callers
to simply check IS_ERR and return. Note that this update is
slightly simpler in the case of dapm_kcontrol_data_alloc where
that is fairly close to the handling that was already in place.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: uniphier: change status to orphan
Katsuhiro Suzuki [Wed, 5 Sep 2018 08:31:37 +0000 (17:31 +0900)]
ASoC: uniphier: change status to orphan

Since I'm leaving from Socionext, I'll unable to access specification
documents of this hardware (these are not public). So change the
state to orphan until someone will maintain this driver.

Signed-off-by: Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: add for_each_rtd_codec_dai() macro
Kuninori Morimoto [Mon, 3 Sep 2018 02:12:56 +0000 (02:12 +0000)]
ASoC: add for_each_rtd_codec_dai() macro

ALSA SoC snd_soc_pcm_runtime has snd_soc_dai array for codec_dai.
To be more readable code, this patch adds
new for_each_rtd_codec_dai() macro, and replace existing code to it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: add for_each_link_codecs() macro
Kuninori Morimoto [Mon, 3 Sep 2018 02:12:40 +0000 (02:12 +0000)]
ASoC: add for_each_link_codecs() macro

ALSA SoC snd_soc_dai_link has snd_soc_dai_link_component array
for codecs.
To be more readable code, this patch adds
new for_each_link_codecs() macro, and replace existing code to it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: tlv320aic31xx: Add overflow detection support
Andrew F. Davis [Tue, 4 Sep 2018 15:36:17 +0000 (10:36 -0500)]
ASoC: tlv320aic31xx: Add overflow detection support

Similar to short circuit detection, when the ADC/DAC is saturated and
overflows poor audio quality can result and should be reported to the
user. This device support Automatic Dynamic Range Compression (DRC)
to reduce this but it is not enabled currently in this driver.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: core: Don't schedule DAPM work if already in target state
Jon Hunter [Fri, 17 Aug 2018 15:35:43 +0000 (16:35 +0100)]
ASoC: core: Don't schedule DAPM work if already in target state

When dapm_power_widgets() is called, the dapm_pre_sequence_async() and
dapm_post_sequence_async() functions are scheduled for all DAPM contexts
(apart from the card DAPM context) regardless of whether the DAPM
context is already in the desired state. The overhead of this is not
insignificant and the more DAPM contexts there are the more overhead
there is.

For example, on the Tegra124 Jetson TK1, when profiling the time taken
to execute the dapm_power_widgets() the following times were observed.

  Times for function dapm_power_widgets() are (us):
     Min 23, Ave 190, Max 434, Count 39

Here 'Count' is the number of times that dapm_power_widgets() has been
called. Please note that the above time were measured using ktime_get()
to log the time on entry and exit from dapm_power_widgets(). So it
should be noted that these times may not be purely the time take to
execute this function if it is preempted. However, after applying this
patch and measuring the time taken to execute dapm_power_widgets() again
a significant improvement is seen as shown below.

  Times for function dapm_power_widgets() are (us):
     Min 4, Ave 16, Max 82, Count 39

Therefore, optimise the dapm_power_widgets() function by only scheduling
the dapm_pre/post_sequence_async() work if the DAPM context is not in
the desired state.

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: mikroe-proto: dt-bindings: add DT bindings for PROTO board
Codrin Ciubotariu [Fri, 31 Aug 2018 17:14:36 +0000 (20:14 +0300)]
ASoC: mikroe-proto: dt-bindings: add DT bindings for PROTO board

DT binding documentation for this new ASoC driver.

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: Add driver for PROTO Audio CODEC (with a WM8731)
Codrin Ciubotariu [Fri, 31 Aug 2018 17:14:35 +0000 (20:14 +0300)]
ASoC: Add driver for PROTO Audio CODEC (with a WM8731)

Add support for the MikroElektronika PROTO audio codec board.

URL to the audio chip:
http://www.mikroe.com/add-on-boards/audio-voice/audio-codec-proto/

Signed-off-by: Florian Meier <florian.meier@koalo.de>
Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: rsnd: merge .nolock_start and .prepare
Kuninori Morimoto [Mon, 3 Sep 2018 07:09:17 +0000 (07:09 +0000)]
ASoC: rsnd: merge .nolock_start and .prepare

Main purpose of .nolock_start is we need to call
some function without spinlock.
OTOH we have .prepare which main purpose is
called under atomic context.
Then, it is called without spinlock.

In summary, our main callback init/quit, and start/stop
are called under "atomic context and with spinlock".
And some function need to be called under
"non-atomic context or without spinlock".
Let's merge .nolock_start and prepare to be more clear code.
Then, let's rename nolock_stop to cleanup

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoMerge branch 'asoc-4.19' into asoc-4.20 for rcar dep
Mark Brown [Mon, 3 Sep 2018 13:37:28 +0000 (14:37 +0100)]
Merge branch 'asoc-4.19' into asoc-4.20 for rcar dep

6 years agoASoC: rsnd: ssiu: Support to init different BUSIF instance
Jiada Wang [Mon, 3 Sep 2018 07:08:37 +0000 (07:08 +0000)]
ASoC: rsnd: ssiu: Support to init different BUSIF instance

Currently ssiu's .init is only called once during audio stream.
But SSIU with different BUSIF, shall be initialized each time,
even they are used in the same audio stream.

This patch introduces ssiu_status for BUSIF0 to BUSIF7 in rsnd_ssiu,
to make sure same .init for different BUSIF can always be executed.

To avoid the first stopped stream to stop the whole SSIU,
which may still has other BUSIF instance running, use usrcnt to count
the usage of SSIU, only the last user of SSIU can stop the whole SSIU.

Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
[Kuninori: tidyup for upstream]
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: rsnd: ssiu: Support BUSIF other than BUSIF0
Jiada Wang [Mon, 3 Sep 2018 07:08:20 +0000 (07:08 +0000)]
ASoC: rsnd: ssiu: Support BUSIF other than BUSIF0

Currently only BUSIF0 is supported by SSIU, all register setting
is done only for BUSIF.

Since BUSIF1 ~ BUSIF7 has been supported, so also support
these BUSIF from SSIU.

One note is that we can't support SSI9-4/5/6/7 so far,
because its address is out of calculation rule.

Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
[Kuninori: tidyup for upstream]
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoc: rsnd: dma: Calculate PDMACHCRE with consider of BUSIF
Jiada Wang [Mon, 3 Sep 2018 07:08:00 +0000 (07:08 +0000)]
ASoc: rsnd: dma: Calculate PDMACHCRE with consider of BUSIF

PDMACHCR setting for SSI only considers BUSIF0 so far.
But BUSIF1 ~ BUSIF7 also maybe used, in the future.

This patch updates table gen2_id_table_ssiu, to also consider
BUSIF number used by SSI.

Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
[kuninori: adjust to upstreaming]
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoc: rsnd: dma: Calculate dma address with consider of BUSIF
Jiada Wang [Mon, 3 Sep 2018 07:07:43 +0000 (07:07 +0000)]
ASoc: rsnd: dma: Calculate dma address with consider of BUSIF

DMA address calculated by rsnd_dma_addr() only considers BUSIF0 so far.
But BUSIF1 ~ BUSIF7 also maybe used, in the future.

This patch updates DMA address calculations, to also consider
BUSIF number used by SSI.

One note is that we can't support SSI9-4/5/6/7 so far,
because its address is out of calculation rule.

Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
[kuninori: adjust to upstreaming]
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: rsnd: ssi: Check runtime channel number rather than hw_params
Jiada Wang [Mon, 3 Sep 2018 07:07:26 +0000 (07:07 +0000)]
ASoC: rsnd: ssi: Check runtime channel number rather than hw_params

The number of channel handled by SSI maybe differs from the one set
in hw_params, currently SSI checks hw_params's channel number,
and constrains to use same channel number, when it is being
used by multiple clients.

This patch corrects to check runtime channel number rather
than channel number set in hw_params.

Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
[kuninori: adjust to upstreaming]
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: rsnd: ssi: Fix issue in dma data address assignment
Jiada Wang [Mon, 3 Sep 2018 07:07:07 +0000 (07:07 +0000)]
ASoC: rsnd: ssi: Fix issue in dma data address assignment

Same SSI device may be used in different dai links,
by only having one dma struct in rsnd_ssi, after the first
instance's dma config be initilized, the following instances
can no longer configure dma, this causes issue, when their
dma data address are different from the first instance.

Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
[Kuninori: tidyup for upstream]
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: rsnd: remove is_play parameter from hw_rule function
Jiada Wang [Mon, 3 Sep 2018 07:06:50 +0000 (07:06 +0000)]
ASoC: rsnd: remove is_play parameter from hw_rule function

Currently rsnd_dai_stream *io is set to either &rdai->playback or
&rdai->capture based on whether it is a playback or capture stream,
in __rsnd_soc_hw_rule_* functions, but this is not necessary,
rsnd_dai_stream *io handler can be get from rule->private.

This patch removes 'is_play' parameter from hw_rule function.

Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
[Kuninori: tidyup for upstream]
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: rsnd: add support for 8 bit S8 format
Dragos Tarcatu [Mon, 3 Sep 2018 07:06:29 +0000 (07:06 +0000)]
ASoC: rsnd: add support for 8 bit S8 format

This patch adds support for SNDRV_PCM_FMTBIT_S8 format.

Signed-off-by: Dragos Tarcatu <dragos_tarcatu@mentor.com>
Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
[Kuninori: tidyup for upstream]
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: rsnd: add support for the DSP_A/DSP_B formats
Dragos Tarcatu [Mon, 3 Sep 2018 07:06:01 +0000 (07:06 +0000)]
ASoC: rsnd: add support for the DSP_A/DSP_B formats

Signed-off-by: Dragos Tarcatu <dragos_tarcatu@mentor.com>
Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
[Kuninori: tidyup for upstream]
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: rsnd: add support for 16/24 bit slot widths
Dragos Tarcatu [Mon, 3 Sep 2018 07:05:42 +0000 (07:05 +0000)]
ASoC: rsnd: add support for 16/24 bit slot widths

The slot width (system word length) was fixed at 32 bits.
This patch allows also setting it to 16 or 24 bits.

Signed-off-by: Dragos Tarcatu <dragos_tarcatu@mentor.com>
Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
[Kuninori: tidyup for upstream]
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: rsnd: add warning message to rsnd_kctrl_accept_runtime()
Jiada Wang [Mon, 3 Sep 2018 07:05:11 +0000 (07:05 +0000)]
ASoC: rsnd: add warning message to rsnd_kctrl_accept_runtime()

Add warning message to rsnd_kctrl_accept_runtime(), when kctrl
update is rejected due to corresponding dai-link is idle.
So that user can notice the reason of kctrl update failure.

Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
[kuninori: adjust to upstream]
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: rsnd: fixup not to call clk_get/set under non-atomic
Jiada Wang [Mon, 3 Sep 2018 07:08:58 +0000 (07:08 +0000)]
ASoC: rsnd: fixup not to call clk_get/set under non-atomic

Clocking operations clk_get/set_rate, are non-atomic,
they shouldn't be called in soc_pcm_trigger() which is atomic.

Following issue was found due to execution of clk_get_rate() causes
sleep in soc_pcm_trigger(), which shouldn't be blocked.

We can reproduce this issue by following
> enable CONFIG_DEBUG_ATOMIC_SLEEP=y
> compile, and boot
> mount -t debugfs none /sys/kernel/debug
> while true; do cat /sys/kernel/debug/clk/clk_summary > /dev/null; done &
> while true; do aplay xxx; done

This patch adds support to .prepare callback, and moves non-atomic
clocking operations to it. As .prepare is non-atomic, it is always
called before trigger_start/trigger_stop.

BUG: sleeping function called from invalid context at kernel/locking/mutex.c:620
in_atomic(): 1, irqs_disabled(): 128, pid: 2242, name: aplay
INFO: lockdep is turned off.
irq event stamp: 5964
hardirqs last enabled at (5963): [<ffff200008e59e40>] mutex_lock_nested+0x6e8/0x6f0
hardirqs last disabled at (5964): [<ffff200008e623f0>] _raw_spin_lock_irqsave+0x24/0x68
softirqs last enabled at (5502): [<ffff200008081838>] __do_softirq+0x560/0x10c0
softirqs last disabled at (5495): [<ffff2000080c2e78>] irq_exit+0x160/0x25c
Preemption disabled at:[ 62.904063] [<ffff200008be4d48>] snd_pcm_stream_lock+0xb4/0xc0
CPU: 2 PID: 2242 Comm: aplay Tainted: G B C 4.9.54+ #186
Hardware name: Renesas Salvator-X board based on r8a7795 (DT)
Call trace:
[<ffff20000808fe48>] dump_backtrace+0x0/0x37c
[<ffff2000080901d8>] show_stack+0x14/0x1c
[<ffff2000086f4458>] dump_stack+0xfc/0x154
[<ffff2000081134a0>] ___might_sleep+0x57c/0x58c
[<ffff2000081136b8>] __might_sleep+0x208/0x21c
[<ffff200008e5980c>] mutex_lock_nested+0xb4/0x6f0
[<ffff2000087cac74>] clk_prepare_lock+0xb0/0x184
[<ffff2000087cb094>] clk_core_get_rate+0x14/0x54
[<ffff2000087cb0f4>] clk_get_rate+0x20/0x34
[<ffff20000113aa00>] rsnd_adg_ssi_clk_try_start+0x158/0x4f8 [snd_soc_rcar]
[<ffff20000113da00>] rsnd_ssi_init+0x668/0x7a0 [snd_soc_rcar]
[<ffff200001133ff4>] rsnd_soc_dai_trigger+0x4bc/0xcf8 [snd_soc_rcar]
[<ffff200008c1af24>] soc_pcm_trigger+0x2a4/0x2d4

Fixes: e7d850dd10f4 ("ASoC: rsnd: use mod base common method on SSI-parent")
Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
[Kuninori: tidyup for upstream]
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
6 years agoASoC: tlv320aic31xx: Add short circuit detection support
Andrew F. Davis [Fri, 31 Aug 2018 18:24:31 +0000 (13:24 -0500)]
ASoC: tlv320aic31xx: Add short circuit detection support

These devices support detecting and reporting short circuits across
the output stages. Add support for reporting these issue. Do this
by registering an interrupt if available and enabling this error
to trigger that interrupt in the device.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: fix soc-core.c kernel-doc warning
Randy Dunlap [Mon, 3 Sep 2018 02:38:10 +0000 (19:38 -0700)]
ASoC: fix soc-core.c kernel-doc warning

Fix kernel-doc warning:

../sound/soc/soc-core.c:2918: warning: Excess function parameter 'legacy_dai_naming' description in 'snd_soc_register_dais'

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: q6routing: initialize data correctly
Srinivas Kandagatla [Mon, 3 Sep 2018 11:07:47 +0000 (12:07 +0100)]
ASoC: q6routing: initialize data correctly

Some of the router data fields are left as default zeros which are
valid dai ids, so initialize these to invalid value of -1.

Without intializing these correctly get_session_from_id() can return
incorrect session resulting in not closing the opened copp and messing
up with the copp ref count.

Fixes: e3a33673e845 ("ASoC: qdsp6: q6routing: Add q6routing driver")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: tas6424: Add channel fault reporting
Andrew F. Davis [Fri, 31 Aug 2018 15:14:07 +0000 (10:14 -0500)]
ASoC: tas6424: Add channel fault reporting

The TAS6426 has a register that reports channel faults such as
overcurrent and continuous DC output. Add reporting of this here.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoMerge branch 'asoc-4.19' into asoc-4.20 tas dependency
Mark Brown [Fri, 31 Aug 2018 15:23:43 +0000 (16:23 +0100)]
Merge branch 'asoc-4.19' into asoc-4.20 tas dependency

6 years agoASoC: tas6424: Save last fault register even when clear
Andrew F. Davis [Fri, 31 Aug 2018 15:14:05 +0000 (10:14 -0500)]
ASoC: tas6424: Save last fault register even when clear

When there is no fault bit set in a fault register we skip the fault
reporting section for that register. This also skips over saving that
registers value. We save the value so we will not double report an
error, but if an error clears then returns we will also not report it
as we did not save the all cleared register value. Fix this by saving
the fault register value in the all clear path.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
6 years agoASoC: tas6424: Print full register name in error message
Andrew F. Davis [Fri, 31 Aug 2018 15:14:06 +0000 (10:14 -0500)]
ASoC: tas6424: Print full register name in error message

The current short version of the register name may be
ambiguous when another fault register detection is added.
Use the full name.

While here fix comment about clearing faults, the CLEAR_FAULT
register actually only clears sticky bits, which are only
warnings, fault bits can only cleared by resolving the fault.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: simple-card-util: remove dai_link compatible code for platform
Kuninori Morimoto [Fri, 31 Aug 2018 03:11:25 +0000 (03:11 +0000)]
ASoC: simple-card-util: remove dai_link compatible code for platform

Now no simple/audio cards are using legacy dai_link style for platform.
Let's remove compatible code.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: audio-graph-scu-card: support snd_soc_dai_link_component style for platform
Kuninori Morimoto [Fri, 31 Aug 2018 03:11:12 +0000 (03:11 +0000)]
ASoC: audio-graph-scu-card: support snd_soc_dai_link_component style for platform

Current ASoC is supporting snd_soc_dai_link_component for binding,
it is more useful than current legacy style.
Currently only codec is supporting it as multicodec (= codecs).
CPU will support multi style in the future.
We want to have it on Platform too in the future.

If all Codec/CPU/Platform are replaced into snd_soc_dai_link_component
style, we can remove legacy complex style.
This patch supports snd_soc_dai_link_component style
for audio-graph-scu-card for platform.

[current]
struct snd_soc_dai_link {
...
*cpu_name;
*cpu_of_node;
*cpu_dai_name;

*codec_name;
*codec_of_node;
*codec_dai_name;
*codecs;
num_codecs;

*platform_name;
*platform_of_node;
...
}

[in the future]
struct snd_soc_dai_link {
...
*cpus
num_cpus;

*codecs;
num_codecs;

*platform;
...
}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: audio-graph-card: support snd_soc_dai_link_component style for platform
Kuninori Morimoto [Fri, 31 Aug 2018 03:10:58 +0000 (03:10 +0000)]
ASoC: audio-graph-card: support snd_soc_dai_link_component style for platform

Current ASoC is supporting snd_soc_dai_link_component for binding,
it is more useful than current legacy style.
Currently only codec is supporting it as multicodec (= codecs).
CPU will support multi style in the future.
We want to have it on Platform too in the future.

If all Codec/CPU/Platform are replaced into snd_soc_dai_link_component
style, we can remove legacy complex style.
This patch supports snd_soc_dai_link_component style
for audio-graph-card for platform.

[current]
struct snd_soc_dai_link {
...
*cpu_name;
*cpu_of_node;
*cpu_dai_name;

*codec_name;
*codec_of_node;
*codec_dai_name;
*codecs;
num_codecs;

*platform_name;
*platform_of_node;
...
}

[in the future]
struct snd_soc_dai_link {
...
*cpus
num_cpus;

*codecs;
num_codecs;

*platform;
...
}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: simple-scu-card: support snd_soc_dai_link_component style for platform
Kuninori Morimoto [Fri, 31 Aug 2018 03:10:46 +0000 (03:10 +0000)]
ASoC: simple-scu-card: support snd_soc_dai_link_component style for platform

Current ASoC is supporting snd_soc_dai_link_component for binding,
it is more useful than current legacy style.
Currently only codec is supporting it as multicodec (= codecs).
CPU will support multi style in the future.
We want to have it on Platform too in the future.

If all Codec/CPU/Platform are replaced into snd_soc_dai_link_component
style, we can remove legacy complex style.
This patch supports snd_soc_dai_link_component style
for simple-scu-card for platform.

[current]
struct snd_soc_dai_link {
...
*cpu_name;
*cpu_of_node;
*cpu_dai_name;

*codec_name;
*codec_of_node;
*codec_dai_name;
*codecs;
num_codecs;

*platform_name;
*platform_of_node;
...
}

[in the future]
struct snd_soc_dai_link {
...
*cpus
num_cpus;

*codecs;
num_codecs;

*platform;
...
}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: simple-card: support snd_soc_dai_link_component style for platform
Kuninori Morimoto [Fri, 31 Aug 2018 03:10:33 +0000 (03:10 +0000)]
ASoC: simple-card: support snd_soc_dai_link_component style for platform

Current ASoC is supporting snd_soc_dai_link_component for binding,
it is more useful than current legacy style.
Currently only codec is supporting it as multicodec (= codecs).
CPU will support multi style in the future.
We want to have it on Platform too in the future.

If all Codec/CPU/Platform are replaced into snd_soc_dai_link_component
style, we can remove legacy complex style.
This patch supports snd_soc_dai_link_component style
for simple-card for platform.

[current]
struct snd_soc_dai_link {
...
*cpu_name;
*cpu_of_node;
*cpu_dai_name;

*codec_name;
*codec_of_node;
*codec_dai_name;
*codecs;
num_codecs;

*platform_name;
*platform_of_node;
...
}

[in the future]
struct snd_soc_dai_link {
...
*cpus
num_cpus;

*codecs;
num_codecs;

*platform;
...
}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: simple-card-util: support snd_soc_dai_link_component style for platform
Kuninori Morimoto [Fri, 31 Aug 2018 03:10:20 +0000 (03:10 +0000)]
ASoC: simple-card-util: support snd_soc_dai_link_component style for platform

Current ASoC is supporting snd_soc_dai_link_component for binding,
it is more useful than current legacy style.
Currently only codec is supporting it as multicodec (= codecs).
CPU will support multi style in the future.
We want to have it on Platform too in the future.

If all Codec/CPU/Platform are replaced into snd_soc_dai_link_component
style, we can remove legacy complex style.
This patch supports snd_soc_dai_link_component style
for simple-card-util for platform.

[current]
struct snd_soc_dai_link {
...
*cpu_name;
*cpu_of_node;
*cpu_dai_name;

*codec_name;
*codec_of_node;
*codec_dai_name;
*codecs;
num_codecs;

*platform_name;
*platform_of_node;
...
}

[in the future]
struct snd_soc_dai_link {
...
*cpus
num_cpus;

*codecs;
num_codecs;

*platform;
...
}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: soc-core: use snd_soc_dai_link_component for platform
Kuninori Morimoto [Fri, 31 Aug 2018 03:10:08 +0000 (03:10 +0000)]
ASoC: soc-core: use snd_soc_dai_link_component for platform

Current struct snd_soc_dai_link is supporting multicodec,
and it is supporting legacy style of
codec_name
codec_of_node
code_dai_name
This is handled as single entry of multicodec.

We don't have multicpu support yet, but in the future we will.
In such case, we can use snd_soc_dai_link_component for both
cpu/codec. Then the code will be more simple and readble.

As next step, we want to use it for platform, too.
This patch adds snd_soc_dai_link_component style for platform.
We might have multiplatform support in the future, but we
don't know yet. To avoid un-known issue / complex code,
this patch supports just single-platform as 1st step.

If we could use snd_soc_dai_link_component for all CPU/Codec/Platform,
we will switch to new style, and remove legacy code.
This is prepare for it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: simple-card-util: remove dai_link compatible code for codec
Kuninori Morimoto [Fri, 31 Aug 2018 03:09:47 +0000 (03:09 +0000)]
ASoC: simple-card-util: remove dai_link compatible code for codec

Now no simple/audio cards are using legacy dai_link style for codec.
Let's remove compatible code.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: audio-graph-scu-card: support snd_soc_dai_link_component style for codec
Kuninori Morimoto [Fri, 31 Aug 2018 03:09:33 +0000 (03:09 +0000)]
ASoC: audio-graph-scu-card: support snd_soc_dai_link_component style for codec

Current ASoC is supporting snd_soc_dai_link_component for binding,
it is more useful than current legacy style.
Currently only codec is supporting it as multicodec (= codecs).
CPU will support multi style in the future.
We want to have it on Platform too in the future.

If all Codec/CPU/Platform are replaced into snd_soc_dai_link_component
style, we can remove legacy complex style.
This patch supports snd_soc_dai_link_component style
for audio-graph-scu-card for codec.

[current]
struct snd_soc_dai_link {
...
*cpu_name;
*cpu_of_node;
*cpu_dai_name;

*codec_name;
*codec_of_node;
*codec_dai_name;
*codecs;
num_codecs;

*platform_name;
*platform_of_node;
...
}

[in the future]
struct snd_soc_dai_link {
...
*cpus
num_cpus;

*codecs;
num_codecs;

*platform;
...
}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: audio-graph-scu-card: use simple_dai_props
Kuninori Morimoto [Fri, 31 Aug 2018 03:09:20 +0000 (03:09 +0000)]
ASoC: audio-graph-scu-card: use simple_dai_props

audi-graph-card and audio-graph-scu-card are very similar driver,
but using different feature. Thus we are keeping synchronization
on these 2 drivers style, because it is easy to confirm / check.

Current big difference between these 2 drivers are "dai_props" on
graph_card_data (= priv).
It will be difficult to keep synchronize if we will add new feature
on audio-graph-scu-card. Thus, this patch synchronize it.

[audio-graph]
struct graph_card_data {
...
struct graph_dai_props {
...
} *dai_props;
...
};

[audio-graph-scu]
struct graph_card_data {
...
struct asoc_simple_dai *dai_props;
...
};

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: audio-graph-card: support snd_soc_dai_link_component style for codec
Kuninori Morimoto [Fri, 31 Aug 2018 03:09:05 +0000 (03:09 +0000)]
ASoC: audio-graph-card: support snd_soc_dai_link_component style for codec

Current ASoC is supporting snd_soc_dai_link_component for binding,
it is more useful than current legacy style.
Currently only codec is supporting it as multicodec (= codecs).
CPU will support multi style in the future.
We want to have it on Platform too in the future.

If all Codec/CPU/Platform are replaced into snd_soc_dai_link_component
style, we can remove legacy complex style.
This patch supports snd_soc_dai_link_component style
for audio-graph-card for codec.

[current]
struct snd_soc_dai_link {
...
*cpu_name;
*cpu_of_node;
*cpu_dai_name;

*codec_name;
*codec_of_node;
*codec_dai_name;
*codecs;
num_codecs;

*platform_name;
*platform_of_node;
...
}

[in the future]
struct snd_soc_dai_link {
...
*cpus
num_cpus;

*codecs;
num_codecs;

*platform;
...
}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: simple-scu-card: support snd_soc_dai_link_component style for codec
Kuninori Morimoto [Fri, 31 Aug 2018 03:08:51 +0000 (03:08 +0000)]
ASoC: simple-scu-card: support snd_soc_dai_link_component style for codec

Current ASoC is supporting snd_soc_dai_link_component for binding,
it is more useful than current legacy style.
Currently only codec is supporting it as multicodec (= codecs).
CPU will support multi style in the future.
We want to have it on Platform too in the future.

If all Codec/CPU/Platform are replaced into snd_soc_dai_link_component
style, we can remove legacy complex style.
This patch supports snd_soc_dai_link_component style
for simple-scu-card for codec.

[current]
struct snd_soc_dai_link {
...
*cpu_name;
*cpu_of_node;
*cpu_dai_name;

*codec_name;
*codec_of_node;
*codec_dai_name;
*codecs;
num_codecs;

*platform_name;
*platform_of_node;
...
}

[in the future]
struct snd_soc_dai_link {
...
*cpus
num_cpus;

*codecs;
num_codecs;

*platform;
...
}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: simple-scu-card: use simple_dai_props
Kuninori Morimoto [Fri, 31 Aug 2018 03:08:38 +0000 (03:08 +0000)]
ASoC: simple-scu-card: use simple_dai_props

simple-card and simple-scu-card are very similar driver,
but using different feature. Thus we are keeping synchronization
on these 2 drivers style, because it is easy to confirm / check.

Current big difference between these 2 drivers are "dai_props" on
simple_card_data (= priv).
It will be difficult to keep synchronize if we will add new feature
on simple-scu-card. Thus, this patch synchronize it.

[simple]
struct simple_card_data {
...
struct simple_dai_props {
...
} *dai_props;
...
};

[simple scu]
struct simple_card_data {
...
struct asoc_simple_dai *dai_props;
...
};

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: simple-card: support snd_soc_dai_link_component style for codec
Kuninori Morimoto [Fri, 31 Aug 2018 03:08:24 +0000 (03:08 +0000)]
ASoC: simple-card: support snd_soc_dai_link_component style for codec

Current ASoC is supporting snd_soc_dai_link_component for binding,
it is more useful than current legacy style.
Currently only codec is supporting it as multicodec (= codecs).
CPU will support multi style in the future.
We want to have it on Platform too in the future.

If all Codec/CPU/Platform are replaced into snd_soc_dai_link_component
style, we can remove legacy complex style.
This patch supports snd_soc_dai_link_component style
for simple-card for codec.

[current]
struct snd_soc_dai_link {
...
*cpu_name;
*cpu_of_node;
*cpu_dai_name;

*codec_name;
*codec_of_node;
*codec_dai_name;
*codecs;
num_codecs;

*platform_name;
*platform_of_node;
...
}

[in the future]
struct snd_soc_dai_link {
...
*cpus
num_cpus;

*codecs;
num_codecs;

*platform;
...
}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: simple_card_utils: support snd_soc_dai_link_component style for codec
Kuninori Morimoto [Fri, 31 Aug 2018 03:08:09 +0000 (03:08 +0000)]
ASoC: simple_card_utils: support snd_soc_dai_link_component style for codec

Current ASoC is supporting snd_soc_dai_link_component for binding,
it is more useful than current legacy style.
Currently only codec is supporting it as multicodec (= codecs).
CPU will support multi style in the future.
We want to have it on Platform too in the future.

If all Codec/CPU/Platform are replaced into snd_soc_dai_link_component
style, we can remove legacy complex style.
This patch supports snd_soc_dai_link_component style
for simple_card_utils for codec.

[current]
struct snd_soc_dai_link {
...
*cpu_name;
*cpu_of_node;
*cpu_dai_name;

*codec_name;
*codec_of_node;
*codec_dai_name;
*codecs;
num_codecs;

*platform_name;
*platform_of_node;
...
}

[in the future]
struct snd_soc_dai_link {
...
*cpus
num_cpus;

*codecs;
num_codecs;

*platform;
...
}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: cs4265: Add a S/PDIF enable switch
Matt Flax [Wed, 29 Aug 2018 23:38:02 +0000 (09:38 +1000)]
ASoC: cs4265: Add a S/PDIF enable switch

This patch adds a S/PDIF enable switch as a SOC_SINGLE.

Signed-off-by: Matt Flax <flatmax@flatmax.org>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: cs4265: Add native 32bit I2S transport
Matt Flax [Wed, 29 Aug 2018 23:38:01 +0000 (09:38 +1000)]
ASoC: cs4265: Add native 32bit I2S transport

The cs4265 uses 32 bit transport on the I2S bus. This patch enables native
32 bit mode for machine drivers which use this sound card driver.

Signed-off-by: Matt Flax <flatmax@flatmax.org>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: cs4265: SOC_SINGLE register value error fix
Matt Flax [Wed, 29 Aug 2018 23:38:00 +0000 (09:38 +1000)]
ASoC: cs4265: SOC_SINGLE register value error fix

The cs4265 driver declares the "MMTLR Data Switch" register setting with
a 0 register value rather then the 0x12 register (CS4265_SPDIF_CTL2).
This incorrect value causes alsamixer to fault with the output :
cannot load mixer controls: Input/output error

This patch corrects the register value. alsamixer now runs.

Signed-off-by: Matt Flax <flatmax@flatmax.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: codecs: tas5720: add TAS5722 TDM slot width setting support
Andreas Dannenberg [Fri, 31 Aug 2018 14:47:14 +0000 (09:47 -0500)]
ASoC: codecs: tas5720: add TAS5722 TDM slot width setting support

Unlike the TAS5720, the TAS5722 can be configured to utilize 16-bit wide
slots in TDM mode. This can help easing audio clocking/frequency
requirements.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: codecs: tas5720: add TAS5722 specific volume control
Andreas Dannenberg [Fri, 31 Aug 2018 14:47:13 +0000 (09:47 -0500)]
ASoC: codecs: tas5720: add TAS5722 specific volume control

The TAS5722 supports modifying volume in 0.25dB steps (as opposed to
0.5dB steps on the TAS5720). Introduce a custom mixer control that
allows taking advantage of this finer output volume granularity.

Also add custom getters/setters for access as the TAS5722 digital volume
controls are split over two registers.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: davinci-mcasp: Add support for FIFO usage caused delay reporting
Peter Ujfalusi [Fri, 31 Aug 2018 08:24:56 +0000 (11:24 +0300)]
ASoC: davinci-mcasp: Add support for FIFO usage caused delay reporting

McASP have write and read FIFO, each 64 words deep.

From the WFIFOS/RFIFOS registers we can read the amount of data currently
in the FIFO which can be directly reported as delay.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoMerge tag 'hda-codec-h-move' into asoc-4.20
Mark Brown [Thu, 30 Aug 2018 14:46:15 +0000 (15:46 +0100)]
Merge tag 'hda-codec-h-move' into asoc-4.20

ALSA: Move hda_codec.h to include/sound

For easier sharing with ASoC.

6 years agoALSA: hda: move hda_codec.h to include/sound
Pierre-Louis Bossart [Wed, 22 Aug 2018 20:24:57 +0000 (15:24 -0500)]
ALSA: hda: move hda_codec.h to include/sound

As suggested by Takashi, move this header file to make it easier
to include from e.g. the Intel Skylake driver in follow-up patches

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: meson: add axg pdm input
Jerome Brunet [Wed, 29 Aug 2018 15:00:51 +0000 (17:00 +0200)]
ASoC: meson: add axg pdm input

Add pdm input driver for the device found on the amlogic AXG SoC family

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: meson: add axg pdm input DT binding documentation
Jerome Brunet [Wed, 29 Aug 2018 15:00:50 +0000 (17:00 +0200)]
ASoC: meson: add axg pdm input DT binding documentation

Add the DT binding documentation for axg's PDM input

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: dmic: add DT module alias
Jerome Brunet [Wed, 29 Aug 2018 15:00:49 +0000 (17:00 +0200)]
ASoC: dmic: add DT module alias

Before this patch the only alias provided by the dmic module is:
alias:          platform:dmic-codec

Device instantiated from DT will not probe automatically with this

After this patch, here is the new alias list:
alias:          platform:dmic-codec
alias:          of:N*T*Cdmic-codecC*
alias:          of:N*T*Cdmic-codec

Now the dmic codec probes automatically when instantiated from DT.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: dmic: add Kconfig prompt for the generic dmic codec.
Jerome Brunet [Wed, 29 Aug 2018 15:00:48 +0000 (17:00 +0200)]
ASoC: dmic: add Kconfig prompt for the generic dmic codec.

Add Kconfig prompt for the generic digital mic to make it configurable
through menuconfig

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: adau17x1: Unused exported functions changed to internal
Robert Rosengren [Mon, 13 Aug 2018 07:33:58 +0000 (09:33 +0200)]
ASoC: adau17x1: Unused exported functions changed to internal

adau17x1_setup_firmware and adau17x1_has_dsp is only used internally, so
making them static instead of exported.

Signed-off-by: Robert Rosengren <robertr@axis.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: pcm3060: Improve legibility of if-statements
Kirill Marinushkin [Tue, 28 Aug 2018 21:42:31 +0000 (23:42 +0200)]
ASoC: pcm3060: Improve legibility of if-statements

Modified some if-statements to make them more clear

Signed-off-by: Kirill Marinushkin <kmarinushkin@birdec.tech>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: pcm3060: Improve stylistics of file comments
Kirill Marinushkin [Tue, 28 Aug 2018 21:42:30 +0000 (23:42 +0200)]
ASoC: pcm3060: Improve stylistics of file comments

Modified the complete file comments in C++ style, to make them look more
intentional

Signed-off-by: Kirill Marinushkin <kmarinushkin@birdec.tech>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: atmel: tse850: switch to SPDX license identifier
Peter Rosin [Mon, 20 Aug 2018 10:14:09 +0000 (12:14 +0200)]
ASoC: atmel: tse850: switch to SPDX license identifier

Convert to // comments in the leading comment, drop the boilerplate
license text and use the correct MODULE_LICENSE.

Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: AMD: Change MCLK to 48Mhz
Akshu Agrawal [Tue, 21 Aug 2018 06:59:43 +0000 (12:29 +0530)]
ASoC: AMD: Change MCLK to 48Mhz

25Mhz MCLK which was earlier used was of spread type.
Thus, we were not getting accurate rate. The 48Mhz system
clk is of non-spread type and we are changing to it to get
accurate rate.

Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>