platform/kernel/linux-starfive.git
5 years agoASoC: pcm3168a: Retain the independence of DAC and ADC side of the codec
Peter Ujfalusi [Mon, 12 Aug 2019 09:52:25 +0000 (12:52 +0300)]
ASoC: pcm3168a: Retain the independence of DAC and ADC side of the codec

The DAC and ADC path of the codec is independent, have dedicated LRCK (FS)
and BCK for DAC/ADC.

They can be configured to use different format, TDM slots and slot_width if
needed.

Move these parameters under dedicated io_params structure and manage them
independently based on the dai.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Link: https://lore.kernel.org/r/20190812095226.18870-2-peter.ujfalusi@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: Intel: skl-hda-dsp-generic: add dmic dapm widget and route
Keyon Jie [Fri, 9 Aug 2019 23:22:36 +0000 (18:22 -0500)]
ASoC: Intel: skl-hda-dsp-generic: add dmic dapm widget and route

Adding DAPM MIC endpoint widget "SoC DMIC" and route, to enable
DMIC DAPM support with hda generic machine.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190809232236.21182-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: Intel: skl-hda-dsp-generic: add dependency to dmic driver
Keyon Jie [Fri, 9 Aug 2019 23:22:35 +0000 (18:22 -0500)]
ASoC: Intel: skl-hda-dsp-generic: add dependency to dmic driver

The hda generic machine actually has dependency on the dmic driver,
select SND_SOC_DMIC at the machine selected to fix it.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190809232236.21182-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: Intel: boards: Match Product Family instead of product
Sathya Prakash M R [Fri, 9 Aug 2019 23:22:33 +0000 (18:22 -0500)]
ASoC: Intel: boards: Match Product Family instead of product

The generic machine driver of sof_rt5682
supports more platforms of same product family.
hence match the product family instead of product name.

Signed-off-by: Sathya Prakash M R <sathya.prakash.m.r@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190809232236.21182-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: dapm: Invalidate only paths reachable for a given stream
Szymon Mielczarek [Fri, 9 Aug 2019 08:40:34 +0000 (10:40 +0200)]
ASoC: dapm: Invalidate only paths reachable for a given stream

By resetting the cached number of endpoints for all card's widgets we may
overwrite previously cached values for other streams. The situation may
happen especially when running streams simultaneously.

Signed-off-by: Szymon Mielczarek <szymonx.mielczarek@linux.intel.com>
Link: https://lore.kernel.org/r/20190809084034.26220-1-szymonx.mielczarek@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: topology: use set_get_data in process load
Jaska Uimonen [Fri, 9 Aug 2019 23:17:14 +0000 (18:17 -0500)]
ASoC: SOF: topology: use set_get_data in process load

Currently when loading sof process components there's a check if binary
control data is associated with it. If found the data is extracted to be
part of component loading and initialization. If binary data exceeds the
ipc max size, loading fails with error as large message support is only
implemented in set_get_data method. So make the process loading use
set_get_data to enable large parameters in component initialization.

Also refactor the process component loading function as it digs out 3
times almost identical information of related controls. This is
redundant, looks ugly and makes it difficult to understand the
mechanism. So make a function out of fetching the control data and use
it in process loading.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190809231714.20874-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: fsl_esai: Add new compatible string for imx6ull
Shengjiu Wang [Fri, 9 Aug 2019 10:27:47 +0000 (18:27 +0800)]
ASoC: fsl_esai: Add new compatible string for imx6ull

Add new compatible string "fsl,imx6ull-esai" in the binding document.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Link: https://lore.kernel.org/r/1565346467-5769-2-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: fsl_esai: Add compatible string for imx6ull
Shengjiu Wang [Fri, 9 Aug 2019 10:27:46 +0000 (18:27 +0800)]
ASoC: fsl_esai: Add compatible string for imx6ull

Add compatible string for imx6ull, from imx6ull platform,
the issue of channel swap after xrun is fixed in hardware.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Link: https://lore.kernel.org/r/1565346467-5769-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: rt5677: Revert remove superfluous set
Curtis Malainey [Fri, 9 Aug 2019 21:59:51 +0000 (14:59 -0700)]
ASoC: rt5677: Revert remove superfluous set

Commit 4dc057a786dc23 ("ASoC: rt5677: remove superfluous set") was an
attempted code cleanup but was incorrectly tested before sent and
actually breaks the interrupt since it never resets the value on each
loop now. The breakage is most testable when hotwording code is added
and also uses the interrupt.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20190809215952.155660-1-cujomalainey@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: remove w90x900/nuc900 platform drivers
Arnd Bergmann [Fri, 9 Aug 2019 20:27:36 +0000 (22:27 +0200)]
ASoC: remove w90x900/nuc900 platform drivers

The ARM w90x900 platform is getting removed, so this driver is obsolete.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20190809202749.742267-9-arnd@arndb.de
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-core: add for_each_xxx macro for aux_dev
Kuninori Morimoto [Thu, 8 Aug 2019 05:54:44 +0000 (14:54 +0900)]
ASoC: soc-core: add for_each_xxx macro for aux_dev

To be more readable code, this patch adds
new for_each_xxx() macro for aux_dev.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87ftmc6w8s.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: mediatek: mt8183-mt6358-ts3a227-max98357: use snd_soc_dai_link_component for...
Kuninori Morimoto [Thu, 8 Aug 2019 05:53:52 +0000 (14:53 +0900)]
ASoC: mediatek: mt8183-mt6358-ts3a227-max98357: use snd_soc_dai_link_component for aux_dev

We can use snd_soc_dai_link_component to specify aux_dev.
Let's use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87sgqc6wa8.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: max9850: remove unused variable 'max9850_reg'
YueHaibing [Thu, 8 Aug 2019 14:35:07 +0000 (22:35 +0800)]
ASoC: max9850: remove unused variable 'max9850_reg'

sound/soc/codecs/max9850.c:31:33: warning:
 max9850_reg defined but not used [-Wunused-const-variable=]

It is not used since commit 068416620c0d ("ASoC:
max9850: Convert to direct regmap API usage")

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20190808143507.66788-1-yuehaibing@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: max98926: remove two unused variables
YueHaibing [Thu, 8 Aug 2019 14:32:15 +0000 (22:32 +0800)]
ASoC: max98926: remove two unused variables

sound/soc/codecs/max98926.c:28:26: warning:
 max98926_dai_txt defined but not used [-Wunused-const-variable=]
sound/soc/codecs/max98926.c:23:27: warning:
 max98926_boost_current_txt defined but not used [-Wunused-const-variable=]

They are never used, so can be removd.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20190808143215.65904-1-yuehaibing@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-core: remove legacy style of aux_dev
Kuninori Morimoto [Thu, 8 Aug 2019 05:54:39 +0000 (14:54 +0900)]
ASoC: soc-core: remove legacy style of aux_dev

Now all drivers are using snd_soc_dai_link_component for aux_dev.
Let's remove legacy style

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87h86s6w8x.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: ti: rx51: use snd_soc_dai_link_component for aux_dev
Kuninori Morimoto [Thu, 8 Aug 2019 05:54:30 +0000 (14:54 +0900)]
ASoC: ti: rx51: use snd_soc_dai_link_component for aux_dev

We can use snd_soc_dai_link_component to specify aux_dev.
Let's use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Link: https://lore.kernel.org/r/87imr86w96.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: sunxi: sun4i-codec: use snd_soc_dai_link_component for aux_dev
Kuninori Morimoto [Thu, 8 Aug 2019 05:54:25 +0000 (14:54 +0900)]
ASoC: sunxi: sun4i-codec: use snd_soc_dai_link_component for aux_dev

We can use snd_soc_dai_link_component to specify aux_dev.
Let's use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87k1bo6w9b.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: samsung: tm2_wm5110: use snd_soc_dai_link_component for aux_dev
Kuninori Morimoto [Thu, 8 Aug 2019 05:54:20 +0000 (14:54 +0900)]
ASoC: samsung: tm2_wm5110: use snd_soc_dai_link_component for aux_dev

We can use snd_soc_dai_link_component to specify aux_dev.
Let's use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://lore.kernel.org/r/87lfw46w9g.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: samsung: speyside: use snd_soc_dai_link_component for aux_dev
Kuninori Morimoto [Thu, 8 Aug 2019 05:54:15 +0000 (14:54 +0900)]
ASoC: samsung: speyside: use snd_soc_dai_link_component for aux_dev

We can use snd_soc_dai_link_component to specify aux_dev.
Let's use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://lore.kernel.org/r/87mugk6w9l.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: samsung: neo1973_wm8753: use snd_soc_dai_link_component for aux_dev
Kuninori Morimoto [Thu, 8 Aug 2019 05:54:10 +0000 (14:54 +0900)]
ASoC: samsung: neo1973_wm8753: use snd_soc_dai_link_component for aux_dev

We can use snd_soc_dai_link_component to specify aux_dev.
Let's use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://lore.kernel.org/r/87o9106w9p.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: rockchip: rockchip_max98090: use snd_soc_dai_link_component for aux_dev
Kuninori Morimoto [Thu, 8 Aug 2019 05:54:05 +0000 (14:54 +0900)]
ASoC: rockchip: rockchip_max98090: use snd_soc_dai_link_component for aux_dev

We can use snd_soc_dai_link_component to specify aux_dev.
Let's use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87pnlg6w9v.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: meson: axg-card: use snd_soc_dai_link_component for aux_dev
Kuninori Morimoto [Thu, 8 Aug 2019 05:53:59 +0000 (14:53 +0900)]
ASoC: meson: axg-card: use snd_soc_dai_link_component for aux_dev

We can use snd_soc_dai_link_component to specify aux_dev.
Let's use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87r25w6wa1.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: mediatek: mt8183-da7219-max98357: use snd_soc_dai_link_component for aux_dev
Kuninori Morimoto [Thu, 8 Aug 2019 05:53:45 +0000 (14:53 +0900)]
ASoC: mediatek: mt8183-da7219-max98357: use snd_soc_dai_link_component for aux_dev

We can use snd_soc_dai_link_component to specify aux_dev.
Let's use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87tvas6waf.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: intel: cht_bsw_max98090_ti: use snd_soc_dai_link_component for aux_dev
Kuninori Morimoto [Thu, 8 Aug 2019 05:53:33 +0000 (14:53 +0900)]
ASoC: intel: cht_bsw_max98090_ti: use snd_soc_dai_link_component for aux_dev

We can use snd_soc_dai_link_component to specify aux_dev.
Let's use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87v9v86war.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: simple-card: use snd_soc_dai_link_component for aux_dev
Kuninori Morimoto [Thu, 8 Aug 2019 05:52:47 +0000 (14:52 +0900)]
ASoC: simple-card: use snd_soc_dai_link_component for aux_dev

We can use snd_soc_dai_link_component to specify aux_dev.
Let's use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87wofo6wc1.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-core: support snd_soc_dai_link_component for aux_dev
Kuninori Morimoto [Thu, 8 Aug 2019 05:52:33 +0000 (14:52 +0900)]
ASoC: soc-core: support snd_soc_dai_link_component for aux_dev

To find aux_dev, ASoC is using .name, codec_name, codec_of_node.
Here, .name is used to fallback in case of no codec.

But, we already have this kind of component finding method by
snd_soc_dai_link_component and soc_find_component().
We shouldn't have duplicated implementation to do same things.
This patch adds snd_soc_dai_link_component support to finding aux_dev.

Now, no driver is using only .name.
All drivers are using codec_name and/or codec_of_node.
This means no driver is finding component from .name so far.
(Actually almost all drivers are using .name as just "device name",
 not for finding component...)

This patch
1) add snd_soc_dai_link_component support for aux_dev. legacy style will
   be removed if all drivers are switched to new style.
2) try to find component via snd_soc_dai_link_component.
   Then, it doesn't try to find via .name, because no driver is using
   it so far.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87y3046wcf.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Intel: byt: Refactor fw ready / mem windows creation
Daniel Baluta [Wed, 7 Aug 2019 15:02:01 +0000 (10:02 -0500)]
ASoC: SOF: Intel: byt: Refactor fw ready / mem windows creation

There is a lot of duplicate code when processing IPC firmware ready
notification and creating memory windows.

First step in reducing the code duplication is to introduce generic
functions:
* sof_get_windows
* sof_fw_ready
that will replace, in the first step, the specific implementation related
to baytrail related platforms:
* byt_get_windows
* byt_fw_ready

So we are basically moving code from intel/byt.c to loader.c keeping
in mind that mbox_offset is a per platform constant so we need to
use newly introduced snd_sof_dsp_get_mailbox_offset /
snd_sof_dsp_get_window_offset in order to get the correct
mbox offset / window offset value.

Also, bar is a per platform constant so we use snd_sof_dsp_get_bar_index
instead of the hardcoded BYT_DSP_BAR.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190807150203.26359-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Introduce snd_sof_dsp_get_window_offset
Daniel Baluta [Wed, 7 Aug 2019 15:02:00 +0000 (10:02 -0500)]
ASoC: SOF: Introduce snd_sof_dsp_get_window_offset

This will allow us to export the offset for a memory window.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190807150203.26359-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Introduce snd_sof_dsp_get_mailbox_offset
Daniel Baluta [Wed, 7 Aug 2019 15:01:59 +0000 (10:01 -0500)]
ASoC: SOF: Introduce snd_sof_dsp_get_mailbox_offset

This will allow us to export mailbox offset in order to
read the fw_ready message from.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190807150203.26359-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Intel: hda: Use generic function for fw ready / mem windows creation
Daniel Baluta [Wed, 7 Aug 2019 15:02:03 +0000 (10:02 -0500)]
ASoC: SOF: Intel: hda: Use generic function for fw ready / mem windows creation

We can use generic sof_fw_ready function and reduce code duplication.
Careful here that we need to provide the implementation for
get_mailbox_offset and get_window_offset.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190807150203.26359-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Intel: bdw: Use generic function for fw ready / mem windows creation
Daniel Baluta [Wed, 7 Aug 2019 15:02:02 +0000 (10:02 -0500)]
ASoC: SOF: Intel: bdw: Use generic function for fw ready / mem windows creation

bdw_get_windows / bdw_fw_ready is identical with the generic
implementation introduced in a previous patch.

So remove bdw_get_windows / bdw_fw_ready and use the generic
sof_get_windows version.

Do not forget to implement get_mailbox_offset/get_window_offset
so that we export the correct mailbox/memory window offset to
the outside world.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190807150203.26359-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Remove call to snd_sof_dsp_mailbox_init
Daniel Baluta [Wed, 7 Aug 2019 15:01:58 +0000 (10:01 -0500)]
ASoC: SOF: Remove call to snd_sof_dsp_mailbox_init

This is reserved for some historical reason, we didn't enable memory
windows for byt/bdw at the beginning, to make it compatible, we get
those mailbox offsets from fw_ready struct firstly, and then update them
if they existed in the following memory windows, to make sure the
mailbox still can be used if no memory windows are created.

With this change all platforms have the same implementation for
xxx_fw_ready function so that we can refactor it in a common file.

Suggested-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190807150203.26359-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: ml26124: remove unused variable 'ngth'
YueHaibing [Fri, 9 Aug 2019 08:24:40 +0000 (16:24 +0800)]
ASoC: ml26124: remove unused variable 'ngth'

In file included from ./include/sound/tlv.h:10:0,
                 from sound/soc/codecs/ml26124.c:19:
sound/soc/codecs/ml26124.c:59:35: warning: ngth defined but not used [-Wunused-const-variable=]
 static const DECLARE_TLV_DB_SCALE(ngth, -7650, 150, 0);
                                   ^
./include/uapi/sound/tlv.h:64:15: note: in definition of macro SNDRV_CTL_TLVD_DECLARE_DB_SCALE
  unsigned int name[] = { \
               ^~~~
sound/soc/codecs/ml26124.c:59:14: note: in expansion of macro DECLARE_TLV_DB_SCALE
 static const DECLARE_TLV_DB_SCALE(ngth, -7650, 150, 0);
              ^~~~~~~~~~~~~~~~~~~~

It is never used, so can be removed.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20190809082440.67412-1-yuehaibing@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: mt6351: remove unused variable 'mt_lineout_control'
YueHaibing [Fri, 9 Aug 2019 08:02:34 +0000 (16:02 +0800)]
ASoC: mt6351: remove unused variable 'mt_lineout_control'

sound/soc/codecs/mt6351.c:1070:38: warning:
 mt_lineout_control defined but not used [-Wunused-const-variable=]

It is never used, so can be removed.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20190809080234.23332-1-yuehaibing@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Intel: Add missing include file hdac_hda.h
YueHaibing [Fri, 9 Aug 2019 11:01:00 +0000 (19:01 +0800)]
ASoC: SOF: Intel: Add missing include file hdac_hda.h

Building with SND_SOC_SOF_HDA_AUDIO_CODEC fails:

sound/soc/sof/intel/hda-bus.c: In function sof_hda_bus_init:
sound/soc/sof/intel/hda-bus.c:16:25: error: implicit declaration of function
 snd_soc_hdac_hda_get_ops; did you mean snd_soc_jack_add_gpiods? [-Werror=implicit-function-declaration]
 #define sof_hda_ext_ops snd_soc_hdac_hda_get_ops()

Reported-by: Hulk Robot <hulkci@huawei.com>
Suggested-by: Takashi Iwai <tiwai@suse.de>
Fixes: d4ff1b3917a5 ('ASoC: SOF: Intel: Initialize hdaudio bus properly")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20190809110100.71236-1-yuehaibing@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoMerge branch 'topic/hda-bus-ops-cleanup' of https://git.kernel.org/pub/scm/linux...
Mark Brown [Fri, 9 Aug 2019 11:37:12 +0000 (12:37 +0100)]
Merge branch 'topic/hda-bus-ops-cleanup' of https://git./linux/kernel/git/tiwai/sound into asoc-5.4

5 years agoALSA: hda: readl/writel need linux/io.h
Stephen Rothwell [Fri, 9 Aug 2019 02:54:58 +0000 (12:54 +1000)]
ALSA: hda: readl/writel need linux/io.h

Fixes: 19abfefd4c76 ("ALSA: hda: Direct MMIO accesses")
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoMerge branch 'topic/hda-bus-ops-cleanup' of https://git.kernel.org/pub/scm/linux...
Mark Brown [Thu, 8 Aug 2019 22:20:45 +0000 (23:20 +0100)]
Merge branch 'topic/hda-bus-ops-cleanup' of https://git./linux/kernel/git/tiwai/sound into asoc-5.4

5 years agoASoC: sof: Fix warning when IPC flood test is not enabled
Mark Brown [Thu, 8 Aug 2019 22:15:54 +0000 (23:15 +0100)]
ASoC: sof: Fix warning when IPC flood test is not enabled

dentry is only used when the flood test is done so move the declaration
of the variable inside the ifdef for the flood test.

Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoMerge branch 'topic/hda-dmic' of https://git.kernel.org/pub/scm/linux/kernel/git...
Mark Brown [Thu, 8 Aug 2019 22:10:35 +0000 (23:10 +0100)]
Merge branch 'topic/hda-dmic' of https://git./linux/kernel/git/tiwai/sound into asoc-5.4

5 years agoASoC: Intel: Skylake: large_config_get overhaul
Cezary Rojewski [Thu, 8 Aug 2019 18:15:49 +0000 (20:15 +0200)]
ASoC: Intel: Skylake: large_config_get overhaul

LARGE_CONFIG_GET is mainly used to retrieve requested module parameters
but it may also carry TX payload with them. Update its implementation to
account for both TX and RX data.
First reply.header carries total payload size within data_off_sizefield.
Make use of reply.header to realloc returned buffer with correct size.

Failure of IPC request is permissive - error-payload may be returned, an
informative data why GET for given param failed - and thus function
should not collapse before entire processing is finished. Caller is
responsible for checking returned payload and bytes parameters.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20190808181549.12521-3-cezary.rojewski@intel.com
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: Intel: Skylake: Limit large_config_get to single frame
Cezary Rojewski [Thu, 8 Aug 2019 18:15:48 +0000 (20:15 +0200)]
ASoC: Intel: Skylake: Limit large_config_get to single frame

Reply for the very first LARGE_CONFIG_GET request contains total size of
payload to be retrieved by host.
From then on, each subsequent reply carries buffer offset instead. As
looping is not covered by any real-life example, remove it and cleanup
the function for followup overhaul.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20190808181549.12521-2-cezary.rojewski@intel.com
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: intel: skl_hda_dsp_common: create HDMI jack kctl
Libin Yang [Thu, 8 Aug 2019 19:27:34 +0000 (14:27 -0500)]
ASoC: intel: skl_hda_dsp_common: create HDMI jack kctl

This patch call snd_jack_add_new_kctl() to create the HDMI jack kctls.
Userspace needs these kctls to detect the hdmi monitor hotplug.

In /usr/share/alsa/ucm, the config file needs to assign a jack kctl to
"JackControl" to let PA get the jack hotplug status.

Signed-off-by: Libin Yang <libin.yang@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190808192734.18286-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: tscs454: remove unused variable 'PLL_48K_RATE'
YueHaibing [Thu, 8 Aug 2019 03:25:52 +0000 (11:25 +0800)]
ASoC: tscs454: remove unused variable 'PLL_48K_RATE'

The global variable 'PLL_48K_RATE' is never used
so just remove it.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20190808032552.45360-1-yuehaibing@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-core: fix module_put() warning in soc_cleanup_component
Pierre-Louis Bossart [Thu, 8 Aug 2019 02:51:31 +0000 (21:51 -0500)]
ASoC: soc-core: fix module_put() warning in soc_cleanup_component

The recent changes introduce warnings in the SOF load/unload module
tests. The code does not seem balanced with a confusion between
_close() and _remove() macros. Using _remove() fixes the issue and
removes the warning.

Suggested-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Fixes: 4a81e8f30d0b4 ('ASoC: soc-component: add snd_soc_component_get/put()')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20190808025131.32482-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-core: dai_link check under soc_dpcm_debugfs_add()
Kuninori Morimoto [Wed, 7 Aug 2019 01:31:36 +0000 (10:31 +0900)]
ASoC: soc-core: dai_link check under soc_dpcm_debugfs_add()

soc_dpcm_debugfs_add(rtd) is checking rtd->dai_link pointer,
but, rtd->dai_link->dynamic have been already checked before calling it.

static int soc_probe_link_dais(...) {
dai_link = rtd->dai_link;
...
=> if (dai_link->dynamic)
=> soc_dpcm_debugfs_add(rtd);
...
}

void soc_dpcm_debugfs_add(rtd)
{
=> if (!rtd->dai_link)
return;
...
}

These pointer checks are strange/pointless.
This patch checks dai_link->dynamic under soc_dpcm_debugfs_add().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/874l2tahnq.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-core: define soc_dpcm_debugfs_add() for non CONFIG_DEBUG_FS
Kuninori Morimoto [Wed, 7 Aug 2019 01:31:31 +0000 (10:31 +0900)]
ASoC: soc-core: define soc_dpcm_debugfs_add() for non CONFIG_DEBUG_FS

soc_dpcm_debugfs_add() is implemented at soc-pcm.c under CONFIG_DEBUG_FS.
Thus, soc-core.c which is only user of it need to use CONFIG_DEBUG_FS, too.

This patch defines soc_dpcm_debugfs_add() for non CONFIG_DEBUG_FS case.
Then, we can remove #ifdef CONFIG_DEBUG_FS from soc-core.c

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/875zn9ahnv.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-core: tidyup for card->deferred_resume_work
Kuninori Morimoto [Wed, 7 Aug 2019 01:31:24 +0000 (10:31 +0900)]
ASoC: soc-core: tidyup for card->deferred_resume_work

card->deferred_resume_work is used if CONFIG_PM_SLEEP was defined.
but
1) It is defined even though CONFIG_PM_SLEEP was not defined
2) random ifdef code is difficult to read.
This patch tidyup these issues.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/877e7paho1.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-core: remove unneeded list_empty() check for snd_soc_try_rebind_card()
Kuninori Morimoto [Wed, 7 Aug 2019 01:31:19 +0000 (10:31 +0900)]
ASoC: soc-core: remove unneeded list_empty() check for snd_soc_try_rebind_card()

list_for_each_entry_safe() will do nothing if it was empty list.
This patch removes unneeded list_empty() check for
list_for_each_entry_safe().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/878ss5aho6.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-core: call snd_soc_dapm_debugfs_init() at soc_init_card_debugfs()
Kuninori Morimoto [Wed, 7 Aug 2019 01:31:14 +0000 (10:31 +0900)]
ASoC: soc-core: call snd_soc_dapm_debugfs_init() at soc_init_card_debugfs()

We have 2 soc_init_card_debugfs() implementations for with/without DEBUG_FS.
But, snd_soc_instantiate_card() calls snd_soc_dapm_debugfs_init() under
ifdef DEBUG_FS after soc_init_card_debugfs(). This is very strange.
We can call snd_soc_dapm_debugfs_init() under soc_init_card_debugfs().

#ifdef CONFIG_DEBUG_FS
=> static void soc_init_card_debugfs(...)
{
...
}
...
#else
=> static inline void soc_init_card_debugfs(...)
{
...
}
#endif

static int snd_soc_instantiate_card(struct snd_soc_card *card)
{
...
=> soc_init_card_debugfs(card);

* #ifdef CONFIG_DEBUG_FS
* snd_soc_dapm_debugfs_init(&card->dapm, card->debugfs_card_root);
* #endif
}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87a7clahob.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-core: tidyup for snd_soc_add_card_controls()
Kuninori Morimoto [Wed, 7 Aug 2019 01:31:08 +0000 (10:31 +0900)]
ASoC: soc-core: tidyup for snd_soc_add_card_controls()

snd_soc_add_card_controls() registers controls by using
for(... i < num; ...). If controls was NULL, num should be zero.
Thus, we don't need to check about controls pointer.
This patch also cares missing return value.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87blx1ahoi.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-core: tidyup for snd_soc_dapm_add_routes()
Kuninori Morimoto [Wed, 7 Aug 2019 01:31:03 +0000 (10:31 +0900)]
ASoC: soc-core: tidyup for snd_soc_dapm_add_routes()

snd_soc_dapm_add_routes() registers routes by using
for(... i < num; ...). If routes was NULL, num should be zero.
Thus, we don't need to check about route pointer.
This patch also cares missing return value.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87d0hhahon.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-core: tidyup for snd_soc_add_component_controls()
Kuninori Morimoto [Wed, 7 Aug 2019 01:30:58 +0000 (10:30 +0900)]
ASoC: soc-core: tidyup for snd_soc_add_component_controls()

snd_soc_add_component_controls() registers controls by using
for(... i < num; ...). If controls was NULL, num should be zero.
Thus, we don't need to check about controls pointer.
This patch also cares missing return value.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87ef1xahor.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Intel: Initialize hdaudio bus properly
Takashi Iwai [Wed, 7 Aug 2019 18:50:50 +0000 (20:50 +0200)]
ASoC: SOF: Intel: Initialize hdaudio bus properly

The SOF HD-audio bus has its house-made initialization code.  It's
supposedly for making the code independent from HD-audio bus drivers.
However, this is error-prone, and above all, the SOF driver has
already dependency on HD-audio bus driver when CONFIG_SND_SOF_HDA is
set.  That is, if this Kconfig is set, there is no reason to avoid the
call to the proper bus init function.

Also, the ext_ops that is set at bus initialization can be better
handled inside sof_hda_bus_init().  We don't need to refer this
outside the bus initialization.

So this patch addresses these issues:
- sof_hda_bus_init() calls nothing but snd_hdac_ext_bus_init()
  when CONFIG_SND_SOF_HDA is set.  Otherwise some fields are
  initialized locally like before for avoiding the dependency.
- ext_ops is referred inside sof_hda_bus_init().  The ext_ops argument
  of snd_hda_bus_init() is dropped.

Acked-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda: Direct MMIO accesses
Takashi Iwai [Wed, 7 Aug 2019 18:32:08 +0000 (20:32 +0200)]
ALSA: hda: Direct MMIO accesses

HD-audio drivers access to the mmio registers indirectly via the
corresponding bus->io_ops callbacks.  This is because some platform
(notably Tegra SoC) requires the word-aligned access.  But it's rather
a rare case, and other platforms suffer from the penalties by indirect
calls unnecessarily.

This patch is an attempt to optimize and cleanup for this situation.
Now the special aligned access is used only when a new kconfig
CONFIG_SND_HDA_ALIGNED_MMIO is set.  And the HD-audio core itself
provides the aligned MMIO access helpers instead of the driver side.
If Kconfig isn't set (as default), the standard helpers like readl()
or writel() are used directly.

A couple of places in ASoC Intel drivers have the access via io_ops
reg_writel(), and they are replaced with the direct writel() calls.

And now with this patch, the whole bus->io_ops becomes empty, so it's
dropped completely.  The bus initialization functions are changed
accordingly as well to drop the whole bus->io_ops.

Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda: Remove page allocation redirection
Takashi Iwai [Wed, 7 Aug 2019 18:02:31 +0000 (20:02 +0200)]
ALSA: hda: Remove page allocation redirection

The HD-audio core allocates and releases pages via driver's specific
dma_alloc_pages and dma_free_pages ops defined in bus->io_ops.  This
was because some platforms require the uncached pages and the handling
of page flags had to be done locally in the driver code.

Since the recent change in ALSA core memory allocator, we can simply
pass SNDRV_DMA_TYPE_DEV_UC for the uncached pages, and the only
difference became about this type to be passed to the core allocator.
That is, it's good time for cleaning up the mess.

This patch changes the allocation code in HD-audio core to call the
core allocator directly so that we get rid of dma_alloc_pages and
dma_free_pages io_ops.  If a driver needs the uncached pages, it has
to set bus->dma_type right after the bus initialization.

This is merely a code refactoring and shouldn't bring any behavior
changes.

Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoASoC: fsl_sai: Add support for imx7ulp/imx8mq
Daniel Baluta [Tue, 6 Aug 2019 15:12:13 +0000 (18:12 +0300)]
ASoC: fsl_sai: Add support for imx7ulp/imx8mq

SAI module on imx7ulp/imx8m features 2 new registers (VERID and PARAM)
at the beginning of register address space.

On imx7ulp FIFOs can held up to 16 x 32 bit samples.
On imx8mq FIFOs can held up to 128 x 32 bit samples.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Link: https://lore.kernel.org/r/20190806151214.6783-5-daniel.baluta@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: fsl_sai: Add support for SAI new version
Daniel Baluta [Tue, 6 Aug 2019 15:12:12 +0000 (18:12 +0300)]
ASoC: fsl_sai: Add support for SAI new version

New IP version introduces Version ID and Parameter registers
and optionally added Timestamp feature.

VERID and PARAM registers are placed at the top of registers
address space and some registers are shifted according to
the following table:

Tx/Rx data registers and Tx/Rx FIFO registers keep their
addresses, all other registers are shifted by 8.

SAI Memory map is described in chapter 13.10.4.1.1 I2S Memory map
of the Reference Manual [1].

In order to make as less changes as possible we attach an offset
to each register offset to each changed register definition. The
offset is read from each board private data.

[1]https://cache.nxp.com/secured/assets/documents/en/reference-manual/IMX8MDQLQRM.pdf?__gda__=1563728701_38bea7f0f726472cc675cb141b91bec7&fileExt=.pdf

Signed-off-by: Mihai Serban <mihai.serban@nxp.com>
[initial coding in the NXP internal tree]
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
[bugfixing and cleanups]
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
[adapted to linux-next]
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Link: https://lore.kernel.org/r/20190806151214.6783-4-daniel.baluta@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: fsl_sai: Update Tx/Rx channel enable mask
Daniel Baluta [Tue, 6 Aug 2019 15:12:11 +0000 (18:12 +0300)]
ASoC: fsl_sai: Update Tx/Rx channel enable mask

Tx channel enable (TCE) / Rx channel enable (RCE) bits
enable corresponding data channel for Tx/Rx operation.

Because SAI supports up the 8 channels TCE/RCE occupy
up the 8 bits inside TCR3/RCR3 registers we need to extend
the mask to reflect this.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Link: https://lore.kernel.org/r/20190806151214.6783-3-daniel.baluta@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: fsl_sai: Add registers definition for multiple datalines
Daniel Baluta [Tue, 6 Aug 2019 15:12:10 +0000 (18:12 +0300)]
ASoC: fsl_sai: Add registers definition for multiple datalines

SAI IP supports up to 8 data lines. The configuration of
supported number of data lines is decided at SoC integration
time.

This patch adds definitions for all related data TX/RX registers:
* TDR0..7, Transmit data register
* TFR0..7, Transmit FIFO register
* RDR0..7, Receive data register
* RFR0..7, Receive FIFO register

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Link: https://lore.kernel.org/r/20190806151214.6783-2-daniel.baluta@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: Intel: Update request-reply IPC model
Cezary Rojewski [Tue, 23 Jul 2019 14:43:40 +0000 (16:43 +0200)]
ASoC: Intel: Update request-reply IPC model

struct ipc_message contains fields: header, tx_data and tx_size which
represent TX i.e. request while RX is represented by rx_data and rx_size
with reply's header equivalent missing.

Reply header may contain some vital information including, but not
limited to, received payload size. Some IPCs have entire payload found
within RX header instead. Content and value of said header is context
dependent and may vary between firmware versions and target platform.
Current model does not allow such IPCs to function at all.

Rather than appending yet another parameter to an already long list of
such for sst_ipc_tx_message_XXXs, declare message container in form of
struct sst_ipc_message and add them to parent's ipc_message declaration.

Align haswell, baytrail and skylake with updated request-reply model and
modify their reply processing functions to save RX header within message
container. Despite the range of changes, status quo is achieved.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20190723144341.21339-2-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-core: tidyup for snd_soc_dapm_new_controls()
Kuninori Morimoto [Wed, 7 Aug 2019 01:30:53 +0000 (10:30 +0900)]
ASoC: soc-core: tidyup for snd_soc_dapm_new_controls()

snd_soc_dapm_new_controls() registers controls by using
for(... i < num; ...). It means if widget was NULL, num should be zero.
Thus, we don't need to check about widget pointer.
This patch also cares missing return value.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87ftmdahow.wl-kuninori.morimoto.gx@renesas.com
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-core: reuse rtdcom at snd_soc_rtdcom_add()
Kuninori Morimoto [Wed, 7 Aug 2019 01:30:47 +0000 (10:30 +0900)]
ASoC: soc-core: reuse rtdcom at snd_soc_rtdcom_add()

snd_soc_rtdcom_add() is using both "rtdcom" and "new_rtdcom" as
variable name, but these are not used at same time.
Let's reuse rtdcom.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87h86tahp2.wl-kuninori.morimoto.gx@renesas.com
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-core: don't use for_each_card_links_safe() at snd_soc_find_dai_link()
Kuninori Morimoto [Wed, 7 Aug 2019 01:30:41 +0000 (10:30 +0900)]
ASoC: soc-core: don't use for_each_card_links_safe() at snd_soc_find_dai_link()

It doesn't removes list during loop at snd_soc_find_dai_link().
We don't need to use _safe loop.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87imr9ahp9.wl-kuninori.morimoto.gx@renesas.com
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-core: check return value of snd_soc_add_dai_link()
Kuninori Morimoto [Wed, 7 Aug 2019 01:30:36 +0000 (10:30 +0900)]
ASoC: soc-core: check return value of snd_soc_add_dai_link()

snd_soc_add_dai_link() might return error, we need to check it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87k1bpahpd.wl-kuninori.morimoto.gx@renesas.com
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-core: add comment for for_each_xxx
Kuninori Morimoto [Wed, 7 Aug 2019 01:30:31 +0000 (10:30 +0900)]
ASoC: soc-core: add comment for for_each_xxx

soc-core has many for_each_xxx, but it is a little bit
difficult to know which list is relead to which for_each_xxx.
This patch adds missing comment for it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87lfw5ahpj.wl-kuninori.morimoto.gx@renesas.com
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-core: set component->debugfs_root NULL
Kuninori Morimoto [Wed, 7 Aug 2019 01:30:13 +0000 (10:30 +0900)]
ASoC: soc-core: set component->debugfs_root NULL

To be more safety code, let's set NULL to component->debugfs_root
when it was cleanuped.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87muglahq0.wl-kuninori.morimoto.gx@renesas.com
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: dt-bindings: Introduce compatible strings for 7ULP and 8MQ
Daniel Baluta [Tue, 6 Aug 2019 15:12:14 +0000 (18:12 +0300)]
ASoC: dt-bindings: Introduce compatible strings for 7ULP and 8MQ

For i.MX7ULP and i.MX8MQ register map is changed. Add two new compatbile
strings to differentiate this.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Link: https://lore.kernel.org/r/20190806151214.6783-6-daniel.baluta@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: SOF: Intel: hda: fix MSI handling
Pierre-Louis Bossart [Tue, 6 Aug 2019 17:06:03 +0000 (12:06 -0500)]
ASoC: SOF: Intel: hda: fix MSI handling

The addition of a kernel module parameter to optionally disable MSI
had the side effect of permanently disabling it.

The return value of pci_alloc_irq_vectors() is the number of allocated
vectors or a negative number on error, so testing with the ! operator
is not quite right. It was one optimization too far.

Restore previous behavior to use MSI by default, unless the user
selects not to do so or the allocation of irq_vectors fails.

Fixes: 672ff5e3596ee ('ASoC: SOF: Intel: hda: add a parameter to disable MSI')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190806170603.10815-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: rt1011: Add a flag for the R0 calibration test
Shuming Fan [Tue, 6 Aug 2019 09:14:59 +0000 (17:14 +0800)]
ASoC: rt1011: Add a flag for the R0 calibration test

The factory test needs to know whether the calibration completed.
This flag helps to confirm the calibration completed or not.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20190806091459.14382-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: rt1011: Add R0 temperature and TDM1 ADC2DAT Swap control
Shuming Fan [Tue, 6 Aug 2019 09:14:35 +0000 (17:14 +0800)]
ASoC: rt1011: Add R0 temperature and TDM1 ADC2DAT Swap control

- The user level application could set the R0 temperature after booting system.
  The degree Celsius of R0 temperature store in the non-volatile space
  when doing R0 calibration.
- TDM1 ADC2DAT Swap controls use to control TDM slot2/3 data

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20190806091435.14329-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-component: add snd_soc_pcm_component_pcm_free()
Kuninori Morimoto [Fri, 26 Jul 2019 04:52:12 +0000 (13:52 +0900)]
ASoC: soc-component: add snd_soc_pcm_component_pcm_free()

Current ALSA SoC is directly using component->driver->xxx,
thus, the code nested deeply, and it makes code difficult to read,
and is not good for encapsulation.

We want to implement component related function at soc-component.c,
but, some of them need to care whole snd_soc_pcm_runtime (= rtd)
connected component.

Let's call component related function which need to care with
for_each_rtdcom() loop as snd_soc_pcm_component_xxx().
This patch adds new snd_soc_pcm_component_pcm_free() and use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87k1c54czu.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-component: add snd_soc_pcm_component_pcm_new()
Kuninori Morimoto [Fri, 26 Jul 2019 04:52:08 +0000 (13:52 +0900)]
ASoC: soc-component: add snd_soc_pcm_component_pcm_new()

Current ALSA SoC is directly using component->driver->xxx,
thus, the code nested deeply, and it makes code difficult to read,
and is not good for encapsulation.

We want to implement component related function at soc-component.c,
but, some of them need to care whole snd_soc_pcm_runtime (= rtd)
connected component.

Let's call component related function which need to care with
for_each_rtdcom() loop as snd_soc_pcm_component_xxx().
This patch adds new snd_soc_pcm_component_pcm() and use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87lfwl4czy.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-component: add snd_soc_pcm_component_mmap()
Kuninori Morimoto [Fri, 26 Jul 2019 04:52:04 +0000 (13:52 +0900)]
ASoC: soc-component: add snd_soc_pcm_component_mmap()

Current ALSA SoC is directly using component->driver->ops->xxx,
thus, the code nested deeply, and it makes code difficult to read,
and is not good for encapsulation.

We want to implement component related function at soc-component.c,
but, some of them need to care whole snd_soc_pcm_runtime (= rtd)
connected component.

Let's call component related function which need to care with
for_each_rtdcom() loop as snd_soc_pcm_component_xxx().
This patch adds new snd_soc_pcm_component_mmap() and use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87muh14d02.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-component: add snd_soc_pcm_component_page()
Kuninori Morimoto [Fri, 26 Jul 2019 04:52:00 +0000 (13:52 +0900)]
ASoC: soc-component: add snd_soc_pcm_component_page()

Current ALSA SoC is directly using component->driver->ops->xxx,
thus, the code nested deeply, and it makes code difficult to read,
and is not good for encapsulation.

We want to implement component related function at soc-component.c,
but, some of them need to care whole snd_soc_pcm_runtime (= rtd)
connected component.

Let's call component related function which need to care with
for_each_rtdcom() loop as snd_soc_pcm_component_xxx().
This patch adds new snd_soc_pcm_component_page() and use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87o91h4d06.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-component: add snd_soc_pcm_component_copy_user()
Kuninori Morimoto [Fri, 26 Jul 2019 04:51:56 +0000 (13:51 +0900)]
ASoC: soc-component: add snd_soc_pcm_component_copy_user()

Current ALSA SoC is directly using component->driver->ops->xxx,
thus, the code nested deeply, and it makes code difficult to read,
and is not good for encapsulation.

We want to implement component related function at soc-component.c,
but, some of them need to care whole snd_soc_pcm_runtime (= rtd)
connected component.

Let's call component related function which need to care with
for_each_rtdcom() loop as snd_soc_pcm_component_xxx().
This patch adds new snd_soc_pcm_component_copy_user() and use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87pnlx4d0a.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-component: add snd_soc_pcm_component_ioctrl()
Kuninori Morimoto [Fri, 26 Jul 2019 04:51:51 +0000 (13:51 +0900)]
ASoC: soc-component: add snd_soc_pcm_component_ioctrl()

Current ALSA SoC is directly using component->driver->ops->xxx,
thus, the code nested deeply, and it makes code difficult to read,
and is not good for encapsulation.

We want to implement component related function at soc-component.c,
but, some of them need to care whole snd_soc_pcm_runtime (= rtd)
connected component.

Let's call component related function which need to care with
for_each_rtdcom() loop as snd_soc_pcm_component_xxx().
This patch adds new snd_soc_pcm_component_ioctrl() and use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87r26d4d0f.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-component: add snd_soc_pcm_component_pointer()
Kuninori Morimoto [Fri, 26 Jul 2019 04:51:47 +0000 (13:51 +0900)]
ASoC: soc-component: add snd_soc_pcm_component_pointer()

Current ALSA SoC is directly using component->driver->ops->xxx,
thus, the code nested deeply, and it makes code difficult to read,
and is not good for encapsulation.

We want to implement component related function at soc-component.c,
but, some of them need to care whole snd_soc_pcm_runtime (= rtd)
connected component.

Let's call component related function which need to care with
for_each_rtdcom() loop as snd_soc_pcm_component_xxx().
This patch adds new snd_soc_pcm_component_pointer() and use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87sgqt4d0j.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-component: move snd_soc_component_set_bias_level()
Kuninori Morimoto [Fri, 26 Jul 2019 04:51:43 +0000 (13:51 +0900)]
ASoC: soc-component: move snd_soc_component_set_bias_level()

Current soc-dapm / soc-core are using a long way round to call
.set_bias_level.

if (driver->set_bias_level)
dapm->set_bias_level = ...;
...
if (dapm->set_bias_level)
ret = dapm->set_bias_level(...);

We can directly call it via driver->set_bias_level.
One note here is that both Card and Component have dapm,
but, Card's dapm doesn't have dapm->component.
We need to check it.

This patch moves snd_soc_component_set_bias_level() to soc-component.c
and updates parameters.
dapm->set_bias_level is no longer needed

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87tvb94d0n.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-component: move snd_soc_component_stream_event()
Kuninori Morimoto [Fri, 26 Jul 2019 04:51:39 +0000 (13:51 +0900)]
ASoC: soc-component: move snd_soc_component_stream_event()

Current soc-dapm / soc-core are using a long way round to call
.stream_event.

if (driver->stream_event)
dapm->stream_event = ...;
...
if (dapm->stream_event)
ret = dapm->stream_event(...);

We can directly call it via driver->stream_event.
One note here is that both Card and Component have dapm,
but, Card's dapm doesn't have dapm->component.
We need to check it.

This patch moves snd_soc_component_stream_event() to soc-component.c
and updates parameters.
dapm->stream_event is no longer needed

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87v9vp4d0r.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-component: move snd_soc_component_seq_notifier()
Kuninori Morimoto [Fri, 26 Jul 2019 04:51:35 +0000 (13:51 +0900)]
ASoC: soc-component: move snd_soc_component_seq_notifier()

Current soc-dapm / soc-core are using a long way round to call
.seq_notifier.

if (driver->seq_notifier)
dapm->seq_notifier = ...;
...
if (dapm->seq_notifier)
ret = dapm->seq_notifier(...);

We can directly call it via driver->seq_notifier.
One note here is that both Card and Component have dapm,
but, Card's dapm doesn't have dapm->component.
We need to check it.

This patch moves snd_soc_component_seq_notifier() to soc-component.c,
and updates parameters.
dapm->seq_notifier is no longer needed

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87wog54d0v.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-component: add snd_soc_component_of_xlate_dai_name()
Kuninori Morimoto [Fri, 26 Jul 2019 04:51:31 +0000 (13:51 +0900)]
ASoC: soc-component: add snd_soc_component_of_xlate_dai_name()

Current ALSA SoC is directly using component->driver->xxx,
thus, it is deep nested, and makes code difficult to read,
and is not good for encapsulation.
This patch adds new snd_soc_component_of_xlate_dai_name() and use it

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87y30l4d0z.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-component: add snd_soc_component_of_xlate_dai_id()
Kuninori Morimoto [Fri, 26 Jul 2019 04:51:26 +0000 (13:51 +0900)]
ASoC: soc-component: add snd_soc_component_of_xlate_dai_id()

Current ALSA SoC is directly using component->driver->xxx,
thus, it is deep nested, and makes code difficult to read,
and is not good for encapsulation.
This patch adds new snd_soc_component_of_xlate_dai_id() and use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87zhl14d14.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-component: add snd_soc_component_remove()
Kuninori Morimoto [Fri, 26 Jul 2019 04:51:22 +0000 (13:51 +0900)]
ASoC: soc-component: add snd_soc_component_remove()

Current ALSA SoC is directly using component->driver->xxx,
thus, it is deep nested, and makes code difficult to read,
and is not good for encapsulation.
This patch adds new snd_soc_component_remove() and use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/871ryd5rlo.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-component: add snd_soc_component_probe()
Kuninori Morimoto [Fri, 26 Jul 2019 04:51:17 +0000 (13:51 +0900)]
ASoC: soc-component: add snd_soc_component_probe()

Current ALSA SoC is directly using component->driver->xxx,
thus, it is deep nested, and makes code difficult to read,
and is not good for encapsulation.
This patch adds new snd_soc_component_probe() and use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/8736it5rlt.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-component: add snd_soc_component_is_suspended()
Kuninori Morimoto [Fri, 26 Jul 2019 04:51:13 +0000 (13:51 +0900)]
ASoC: soc-component: add snd_soc_component_is_suspended()

Current ALSA SoC is directly using component->xxx,
But, it is not good for encapsulation.
This patch adds new snd_soc_component_is_suspended() and use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/874l395rlx.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-component: add snd_soc_component_resume()
Kuninori Morimoto [Fri, 26 Jul 2019 04:51:08 +0000 (13:51 +0900)]
ASoC: soc-component: add snd_soc_component_resume()

Current ALSA SoC is directly using component->driver->xxx,
thus, it is deep nested, and makes code difficult to read,
and is not good for encapsulation.
This patch adds new snd_soc_component_resume() and use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/875znp5rm2.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-component: add snd_soc_component_suspend()
Kuninori Morimoto [Fri, 26 Jul 2019 04:50:34 +0000 (13:50 +0900)]
ASoC: soc-component: add snd_soc_component_suspend()

Current ALSA SoC is directly using component->driver->xxx,
thus, it is deep nested, and makes code difficult to read,
and is not good for encapsulation.
This patch adds new snd_soc_component_suspend() and use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/877e855rn0.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-component: add snd_soc_component_trigger()
Kuninori Morimoto [Fri, 26 Jul 2019 04:50:29 +0000 (13:50 +0900)]
ASoC: soc-component: add snd_soc_component_trigger()

Current ALSA SoC is directly using component->driver->ops->xxx,
thus, it is deep nested, and makes code difficult to read,
and is not good for encapsulation.
This patch adds new snd_soc_component_trigger() and use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/878ssl5rn5.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-component: add snd_soc_component_hw_free()
Kuninori Morimoto [Fri, 26 Jul 2019 04:50:24 +0000 (13:50 +0900)]
ASoC: soc-component: add snd_soc_component_hw_free()

Current ALSA SoC is directly using component->driver->ops->xxx,
thus, it is deep nested, and makes code difficult to read,
and is not good for encapsulation.
This patch adds new snd_soc_component_hw_free() and use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87a7d15rna.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-component: add snd_soc_component_hw_params()
Kuninori Morimoto [Fri, 26 Jul 2019 04:50:19 +0000 (13:50 +0900)]
ASoC: soc-component: add snd_soc_component_hw_params()

Current ALSA SoC is directly using component->driver->ops->xxx,
thus, it is deep nested, and makes code difficult to read,
and is not good for encapsulation.
This patch adds new snd_soc_component_hw_params() and use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87blxh5rnf.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-component: add snd_soc_component_prepare()
Kuninori Morimoto [Fri, 26 Jul 2019 04:50:13 +0000 (13:50 +0900)]
ASoC: soc-component: add snd_soc_component_prepare()

Current ALSA SoC is directly using component->driver->ops->xxx,
thus, it is deep nested, and makes code difficult to read,
and is not good for encapsulation.
This patch adds new snd_soc_component_prepare() and use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87d0hx5rnm.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-component: add snd_soc_component_close()
Kuninori Morimoto [Fri, 26 Jul 2019 04:50:07 +0000 (13:50 +0900)]
ASoC: soc-component: add snd_soc_component_close()

Current ALSA SoC is directly using component->driver->ops->xxx,
thus, it is deep nested, and makes code difficult to read,
and is not good for encapsulation.
This patch adds new snd_soc_component_close() and use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87ef2d5rnr.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-component: add snd_soc_component_open()
Kuninori Morimoto [Fri, 26 Jul 2019 04:50:01 +0000 (13:50 +0900)]
ASoC: soc-component: add snd_soc_component_open()

Current ALSA SoC is directly using component->driver->ops->xxx,
thus, it is deep nested, and makes code difficult to read,
and is not good for encapsulation.
This patch adds new snd_soc_component_open() and use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87ftmt5rnx.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-component: add snd_soc_component_get/put()
Kuninori Morimoto [Fri, 26 Jul 2019 04:49:54 +0000 (13:49 +0900)]
ASoC: soc-component: add snd_soc_component_get/put()

ALSA SoC is calling try_module_get()/module_put() based on
component->driver->module_get_upon_open.
To keep simple and readable code, we should create its function.
This patch adds new snd_soc_component_get/put().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87h8795ro4.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: add soc-component.c
Kuninori Morimoto [Fri, 26 Jul 2019 04:49:48 +0000 (13:49 +0900)]
ASoC: add soc-component.c

ALSA SoC has many snd_soc_component_xxx(), but these are randomly
located in many files. Because of it, code is difficult to read.
This patch creates new soc-component.c, and moves existing
snd_soc_component_xxx() into it.
But not yet fully. We need more cleanup it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87imrp5roa.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-pcm: remove soc_fill_silence()
Kuninori Morimoto [Fri, 26 Jul 2019 04:49:43 +0000 (13:49 +0900)]
ASoC: soc-pcm: remove soc_fill_silence()

No ALSA SoC driver has .fill_silence at component->driver->ops.
We can revive it if some-driver want to use it, but let's remove it
so far to avoid maintaining complex code

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87k1c55rof.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-pcm: remove soc_rtdcom_copy_kernel()
Kuninori Morimoto [Fri, 26 Jul 2019 04:49:29 +0000 (13:49 +0900)]
ASoC: soc-pcm: remove soc_rtdcom_copy_kernel()

No ALSA SoC driver has .copy_kernel at component->driver->ops.
We can revive it if some-driver want to use it, but let's remove it
so far to avoid maintaining complex code

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87lfwl5rot.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: soc-pcm: remove soc_rtdcom_ack()
Kuninori Morimoto [Fri, 26 Jul 2019 04:49:23 +0000 (13:49 +0900)]
ASoC: soc-pcm: remove soc_rtdcom_ack()

No ALSA SoC driver has .ack at component->driver->ops.
We can revive it if some-driver want to use it, but let's remove it
so far to avoid maintaining complex code

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87muh15roz.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: Remove dev_err() usage after platform_get_irq()
Stephen Boyd [Tue, 30 Jul 2019 18:15:49 +0000 (11:15 -0700)]
ASoC: Remove dev_err() usage after platform_get_irq()

We don't need dev_err() messages when platform_get_irq() fails now that
platform_get_irq() prints an error message itself when something goes
wrong. Let's remove these prints with a simple semantic patch.

// <smpl>
@@
expression ret;
struct platform_device *E;
@@

ret =
(
platform_get_irq(E, ...)
|
platform_get_irq_byname(E, ...)
);

if ( \( ret < 0 \| ret <= 0 \) )
{
(
-if (ret != -EPROBE_DEFER)
-{ ...
-dev_err(...);
-... }
|
...
-dev_err(...);
)
...
}
// </smpl>

While we're here, remove braces on if statements that only have one
statement (manually).

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: alsa-devel@alsa-project.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Link: https://lore.kernel.org/r/20190730181557.90391-50-swboyd@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>