platform/kernel/linux-starfive.git
4 years agoASoC: fsl_asrc: Set ASR76K and ASR56K based on processing clock
Shengjiu Wang [Tue, 12 May 2020 10:22:59 +0000 (18:22 +0800)]
ASoC: fsl_asrc: Set ASR76K and ASR56K based on processing clock

The processing clock is different for platforms, so it is better
to set ASR76K and ASR56K based on processing clock, rather than
hard coding the value for them.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Mihai Serban <mihai.serban@nxp.com>
Link: https://lore.kernel.org/r/1589278979-31008-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: Intel: bytcr_rt5640: Add quirk for Toshiba Encore WT8-A tablet
Hans de Goede [Mon, 18 May 2020 07:24:16 +0000 (09:24 +0200)]
ASoC: Intel: bytcr_rt5640: Add quirk for Toshiba Encore WT8-A tablet

The Toshiba Encore WT8-A tablet almost fully works with the default
settings for non-CR Bay Trail devices. The only problem is that its
jack-detect switch is not inverted (it is active high instead of
the normal active low).

Add a quirk for this model using the default settings +
BYT_RT5640_JD_NOT_INV.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200518072416.5348-1-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoMerge series "ASoC: SOF: Intel and IMX updates for 5.8" from Kai Vehmanen <kai.vehman...
Mark Brown [Mon, 18 May 2020 15:43:50 +0000 (16:43 +0100)]
Merge series "ASoC: SOF: Intel and IMX updates for 5.8" from Kai Vehmanen <kai.vehmanen@linux.intel.com>:

Hi,

here's a series of minor fixes and improvements to SOF. Add support
for smart amplifier component type. Cover more systems by relaxing
match rules for the generic Soundwire machine driver. Fix issues with
driver unload and address a few compiler warnings.

Daniel Baluta (2):
  ASoC: SOF: Do nothing when DSP PM callbacks are not set
  ASoC: SOF: define INFO_ flags in dsp_ops

Keyon Jie (1):
  ASoC: SOF: topology: add support to smart amplifier

Marcin Rajwa (2):
  ASoC: SOF: add a power_down_notify method
  ASoC: SOF: inform DSP that driver is going to be removed

Pierre-Louis Bossart (2):
  ASoC: SOF: imx: make dsp_ops static
  ASoC: SOF: imx: make imx8m_dsp_ops static

randerwang (1):
  ASoC: SOF: Intel: sdw: relax sdw machine select constraints

 include/sound/sof/topology.h |  2 ++
 sound/soc/sof/core.c         |  6 ++++++
 sound/soc/sof/imx/imx8.c     |  2 +-
 sound/soc/sof/imx/imx8m.c    |  8 +++++++-
 sound/soc/sof/intel/hda.c    | 10 +++++++++-
 sound/soc/sof/pm.c           | 19 +++++++++++++++++--
 sound/soc/sof/sof-priv.h     |  1 +
 sound/soc/sof/topology.c     |  1 +
 8 files changed, 44 insertions(+), 5 deletions(-)

--
2.26.0

4 years agoMerge series "ASoC: cleanup DAI/Component activity" from Kuninori Morimoto <kuninori...
Mark Brown [Mon, 18 May 2020 15:43:49 +0000 (16:43 +0100)]
Merge series "ASoC: cleanup DAI/Component activity" from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:

Hi Mark

These are v3 of DAI/Component activity cleanup.

This patch-set exchanges soc-dapm.c :: snd_soc_dai_link_event_xxx()
behavior which updates dai->active but not cares other actives.
But I think original code was wrong.
So, I believe these works correctly, but maybe need some tests or deep review.

v1 -> v2
- function naming "activity" -> "active"

v2 -> v3
- macro -> inline function
- added Reviewed-by from Ranjani, Acked-by from Peter

Link: https://lore.kernel.org/r/875zd39frp.wl-kuninori.morimoto.gx@renesas.com
Link: https://lore.kernel.org/r/87blmq9alx.wl-kuninori.morimoto.gx@renesas.com
Kuninori Morimoto (21):
  ASoC: soc-pcm: replace snd_soc_runtime_activate()/deactivate() to macro
  ASoC: soc-dai: add snd_soc_dai_action()
  ASoC: soc-dapm: use snd_soc_dai_activate()/deactivate()
  ASoC: soc-dai: add snd_soc_dai_active()
  ASoC: soc-component: add snd_soc_component_active()
  ASoC: soc-dai: add snd_soc_dai_stream_active()
  ASoC: use snd_soc_xxx_active()
  ASoC: atomel: use snd_soc_xxx_active()
  ASoC: bcm: use snd_soc_xxx_active()
  ASoC: cirrus: use snd_soc_xxx_active()
  ASoC: codecs: use snd_soc_xxx_active()
  ASoC: fsl: use snd_soc_xxx_active()
  ASoC: intel: use snd_soc_xxx_active()
  ASoC: jz4740: use snd_soc_xxx_active()
  ASoC: mediatek: use snd_soc_xxx_active()
  ASoC: meson: use snd_soc_xxx_active()
  ASoC: pxa: use snd_soc_xxx_active()
  ASoC: ti: use snd_soc_xxx_active()
  ASoC: uniphier: use snd_soc_xxx_active()
  ASoC: dwc: use snd_soc_xxx_active()
  ASoC: cleanup dai / component active code

 include/sound/soc-component.h                |  6 +-
 include/sound/soc-dai.h                      | 21 +++++-
 include/sound/soc.h                          | 15 ++++-
 sound/soc/atmel/atmel_ssc_dai.c              |  4 +-
 sound/soc/bcm/bcm2835-i2s.c                  |  6 +-
 sound/soc/bcm/cygnus-ssp.c                   |  4 +-
 sound/soc/cirrus/ep93xx-i2s.c                |  4 +-
 sound/soc/codecs/adav80x.c                   |  4 +-
 sound/soc/codecs/arizona.c                   |  2 +-
 sound/soc/codecs/cs4271.c                    |  4 +-
 sound/soc/codecs/madera.c                    |  2 +-
 sound/soc/codecs/max98090.c                  |  6 +-
 sound/soc/codecs/tlv320aic23.c               |  2 +-
 sound/soc/codecs/tlv320dac33.c               |  2 +-
 sound/soc/codecs/uda1380.c                   |  2 +-
 sound/soc/codecs/wl1273.c                    |  2 +-
 sound/soc/codecs/wm8711.c                    |  2 +-
 sound/soc/codecs/wm8753.c                    |  4 +-
 sound/soc/dwc/dwc-i2s.c                      |  2 +-
 sound/soc/fsl/fsl_esai.c                     |  2 +-
 sound/soc/fsl/fsl_spdif.c                    |  4 +-
 sound/soc/intel/atom/sst-mfld-platform-pcm.c | 14 ++--
 sound/soc/jz4740/jz4740-i2s.c                |  8 +--
 sound/soc/mediatek/mt8173/mt8173-afe-pcm.c   |  8 +--
 sound/soc/meson/axg-tdm-interface.c          |  2 +-
 sound/soc/pxa/pxa-ssp.c                      |  8 +--
 sound/soc/pxa/pxa2xx-i2s.c                   |  2 +-
 sound/soc/soc-compress.c                     |  4 +-
 sound/soc/soc-core.c                         | 11 +--
 sound/soc/soc-dai.c                          | 23 +++++++
 sound/soc/soc-dapm.c                         |  8 +--
 sound/soc/soc-pcm.c                          | 70 +++++++-------------
 sound/soc/ti/davinci-mcasp.c                 |  2 +-
 sound/soc/ti/omap-dmic.c                     |  4 +-
 sound/soc/ti/omap-mcbsp.c                    |  4 +-
 sound/soc/ti/omap-mcpdm.c                    |  8 +--
 sound/soc/uniphier/aio-cpu.c                 |  4 +-
 37 files changed, 155 insertions(+), 125 deletions(-)

--
2.17.1

4 years agoMerge series "ASoC: codecs: rt*-sdw: memory leaks and simplifications" from Pierre...
Mark Brown [Mon, 18 May 2020 15:43:48 +0000 (16:43 +0100)]
Merge series "ASoC: codecs: rt*-sdw: memory leaks and simplifications" from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

While debugging unrelated memory corruption errors, I detected issues
related to the interaction with the SoundWire and ASoC cores, here are
3 small patches to fix all this.

Pierre-Louis Bossart (3):
  ASoC: codecs: rt*-sdw: don't assign slave_ops
  ASoC: codecs: rt*-sdw: fix memory leak in set_sdw_stream()
  ASoC: codecs: rt1308-sdw: remove duplicate allocation

 sound/soc/codecs/rt1308-sdw.c | 11 +++--------
 sound/soc/codecs/rt5682-sdw.c |  3 ---
 sound/soc/codecs/rt5682.c     |  3 +++
 sound/soc/codecs/rt700-sdw.c  |  3 ---
 sound/soc/codecs/rt700.c      |  3 +++
 sound/soc/codecs/rt711-sdw.c  |  3 ---
 sound/soc/codecs/rt711.c      |  3 +++
 sound/soc/codecs/rt715-sdw.c  |  3 ---
 sound/soc/codecs/rt715.c      |  3 +++
 9 files changed, 15 insertions(+), 20 deletions(-)

base-commit: d731c1a0f935dbebf4a851e072f8c7309eb2b8c5
--
2.20.1

4 years agoMerge series "ASoC: Intel: minor fixes to machine drivers" from Pierre-Louis Bossart...
Mark Brown [Mon, 18 May 2020 15:43:46 +0000 (16:43 +0100)]
Merge series "ASoC: Intel: minor fixes to machine drivers" from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

Minor button remap changes, inspired by recent Chromebook patches,
typo in component string reported by Jaroslav and driver name change
not submitted in last wm8804 contribution.

Pierre-Louis Bossart (5):
  ASoC: Intel: soc-acpi: change machine driver name for WM8804 platforms
  ASoC: Intel: sof_sdw: fix typo in components string
  ASoC: Intel: sof_sdw_rt711: remap buttons
  ASoC: Intel: sof_sdw_rt700: remap buttons
  ASoC: Intel: cht_bsw_nau8824: remap BTN_0 as KEY_PLAYPAUSE

 sound/soc/intel/boards/cht_bsw_nau8824.c          | 4 ++--
 sound/soc/intel/boards/sof_sdw.c                  | 2 +-
 sound/soc/intel/boards/sof_sdw_rt700.c            | 8 ++++----
 sound/soc/intel/boards/sof_sdw_rt711.c            | 8 ++++----
 sound/soc/intel/common/soc-acpi-intel-bxt-match.c | 2 +-
 5 files changed, 12 insertions(+), 12 deletions(-)

base-commit: d731c1a0f935dbebf4a851e072f8c7309eb2b8c5
--
2.20.1

4 years agoMerge series "ASoC: da7213: support for usage with simple-card" from Sebastian Reiche...
Mark Brown [Mon, 18 May 2020 15:43:45 +0000 (16:43 +0100)]
Merge series "ASoC: da7213: support for usage with simple-card" from Sebastian Reichel <sebastian.reichel@collabora.com>:

Hi,

This extends the da7213 driver to be used with simple-audio-card in
combination with a fixed clock. Here is a snippet of the downstream
board's DT, that is supposed to be supported by this patchset.

---------------------------------------------------------------------
/ {
sound {
compatible = "simple-audio-card";
simple-audio-card,name = "audio-card";
simple-audio-card,format = "i2s";
simple-audio-card,bitclock-master = <&dailink_master>;
simple-audio-card,frame-master = <&dailink_master>;

simple-audio-card,widgets = "Speaker", "Ext Spk";
simple-audio-card,audio-routing = "Ext Spk", "LINE";

simple-audio-card,cpu {
sound-dai = <&ssi1>;
};

dailink_master: simple-audio-card,codec {
sound-dai = <&codec>;
};
};

clk_ext_audio_codec: clock-codec {
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <12288000>;
};
};

&i2c1 {
codec: audio-codec@1a {
compatible = "dlg,da7212";
reg = <0x1a>;
#sound-dai-cells = <0>;
VDDA-supply = <&reg_2v5_audio>;
VDDSP-supply = <&reg_5v0_audio>;
VDDMIC-supply = <&reg_3v3_audio>;
VDDIO-supply = <&reg_3v3_audio>;
clocks = <&clk_ext_audio_codec>;
clock-names = "mclk";
};
};
---------------------------------------------------------------------

This is mostly a resend of PATCHv2. There was quite a bit of discussion
for the last patch. As far as I can see no better solution was found and
the patch is fine as is. Sorry for the delay in sending another revision.

Changes since PATCHv2:
 * https://lore.kernel.org/alsa-devel/20191120152406.2744-1-sebastian.reichel@collabora.com/
 * dropped patch converting DA7213 into selectable Kconfig option (merged)
 * fix compatible string in patch 1 (DT binding) as pointed out by Adam Thomson
 * collected Reviewed-by from Adam Thomson for patch 2-4

Changes since PATCHv1:
 * https://lore.kernel.org/alsa-devel/20191108174843.11227-1-sebastian.reichel@collabora.com/
 * add patch adding da7212 compatible to DT bindings
 * update regulator patch, so that VDDA is enabled together with VDDIO
   while the device is enabled to avoid device reset
 * update clock patch, so that automatic PLL handling is not enabled
   when PLL is configured manually
 * update clock patch, so that automatic PLL is disabled when the device
   is suspended
 * update clock patch, so that automatic PLL is configured into bypass
   mode when possible

-- Sebastian

Sebastian Reichel (5):
  ASoC: da7213: Add da7212 DT compatible
  ASoC: da7213: Add regulator support
  ASoC: da7213: move set_sysclk to codec level
  ASoC: da7213: move set_pll to codec level
  ASoC: da7213: add default clock handling

 .../devicetree/bindings/sound/da7213.txt      |   8 +-
 sound/soc/codecs/da7213.c                     | 172 ++++++++++++++++--
 sound/soc/codecs/da7213.h                     |  11 ++
 3 files changed, 175 insertions(+), 16 deletions(-)

--
2.26.2

4 years agoASoC: fsl_micfil: Fix unused assignment in fsl_set_clock_params()
Tang Bin [Mon, 18 May 2020 11:00:40 +0000 (19:00 +0800)]
ASoC: fsl_micfil: Fix unused assignment in fsl_set_clock_params()

Delete unused initialized value of 'ret', because it will
be assigned by the function fsl_micfil_set_mclk_rate().

Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
Link: https://lore.kernel.org/r/20200518110040.18036-1-tangbin@cmss.chinamobile.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: amd: raven: Make the driver name consistent across files
Akshu Agrawal [Mon, 18 May 2020 04:39:05 +0000 (10:09 +0530)]
ASoC: amd: raven: Make the driver name consistent across files

This fixes the issue of driver not getting auto loaded with
MODULE_ALIAS.

With this patch:
$find /sys/devices -name modalias -print0 | xargs -0 grep -i acp3x
/sys/devices/pci0000:00/0000:00:08.1/0000:03:00.5/acp3x_i2s_playcap.2/
modalias:platform:acp3x_i2s_playcap
/sys/devices/pci0000:00/0000:00:08.1/0000:03:00.5/acp3x_i2s_playcap.0/
modalias:platform:acp3x_i2s_playcap
/sys/devices/pci0000:00/0000:00:08.1/0000:03:00.5/acp3x_rv_i2s_dma.0/
modalias:platform:acp3x_rv_i2s_dma
/sys/devices/pci0000:00/0000:00:08.1/0000:03:00.5/acp3x_i2s_playcap.1/
modalias:platform:acp3x_i2s_playcap

Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com>
Link: https://lore.kernel.org/r/20200518043913.40646-1-akshu.agrawal@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: fsl_micfil: Fix indentation to put on one line affected code
Tang Bin [Mon, 18 May 2020 10:59:51 +0000 (18:59 +0800)]
ASoC: fsl_micfil: Fix indentation to put on one line affected code

In the function fsl_micfil_startup(), the two lines of dev_err()
can be shortened to one line.

Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
Link: https://lore.kernel.org/r/20200518105951.19200-1-tangbin@cmss.chinamobile.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: cleanup dai / component active code
Kuninori Morimoto [Fri, 15 May 2020 00:48:02 +0000 (09:48 +0900)]
ASoC: cleanup dai / component active code

No one is using dai->active, snd_soc_component_is_active().
Let's remove these.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87imgy58hp.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: dwc: use snd_soc_xxx_active()
Kuninori Morimoto [Fri, 15 May 2020 00:47:57 +0000 (09:47 +0900)]
ASoC: dwc: use snd_soc_xxx_active()

We have snd_soc_dai/dai_stream/component_active() macro
This patch uses it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87k11e58hu.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: uniphier: use snd_soc_xxx_active()
Kuninori Morimoto [Fri, 15 May 2020 00:47:53 +0000 (09:47 +0900)]
ASoC: uniphier: use snd_soc_xxx_active()

We have snd_soc_dai/dai_stream/component_active() macro
This patch uses it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87lflu58hy.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: ti: use snd_soc_xxx_active()
Kuninori Morimoto [Fri, 15 May 2020 00:47:48 +0000 (09:47 +0900)]
ASoC: ti: use snd_soc_xxx_active()

We have snd_soc_dai/dai_stream/component_active() macro
This patch uses it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Link: https://lore.kernel.org/r/87mu6a58i3.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: pxa: use snd_soc_xxx_active()
Kuninori Morimoto [Fri, 15 May 2020 00:47:41 +0000 (09:47 +0900)]
ASoC: pxa: use snd_soc_xxx_active()

We have snd_soc_dai/dai_stream/component_active() macro
This patch uses it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87o8qq58ia.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: meson: use snd_soc_xxx_active()
Kuninori Morimoto [Fri, 15 May 2020 00:47:36 +0000 (09:47 +0900)]
ASoC: meson: use snd_soc_xxx_active()

We have snd_soc_dai/dai_stream/component_active() macro
This patch uses it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87pnb658if.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: mediatek: use snd_soc_xxx_active()
Kuninori Morimoto [Fri, 15 May 2020 00:47:31 +0000 (09:47 +0900)]
ASoC: mediatek: use snd_soc_xxx_active()

We have snd_soc_dai/dai_stream/component_active() macro
This patch uses it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87r1vm58ik.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: jz4740: use snd_soc_xxx_active()
Kuninori Morimoto [Fri, 15 May 2020 00:47:27 +0000 (09:47 +0900)]
ASoC: jz4740: use snd_soc_xxx_active()

We have snd_soc_dai/dai_stream/component_active() macro
This patch uses it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87sgg258io.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: intel: use snd_soc_xxx_active()
Kuninori Morimoto [Fri, 15 May 2020 00:47:22 +0000 (09:47 +0900)]
ASoC: intel: use snd_soc_xxx_active()

We have snd_soc_dai/dai_stream/component_active() macro
This patch uses it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87tv0i58it.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: fsl: use snd_soc_xxx_active()
Kuninori Morimoto [Fri, 15 May 2020 00:47:17 +0000 (09:47 +0900)]
ASoC: fsl: use snd_soc_xxx_active()

We have snd_soc_dai/dai_stream/component_active() macro
This patch uses it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87v9ky58iy.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: codecs: use snd_soc_xxx_active()
Kuninori Morimoto [Fri, 15 May 2020 00:47:11 +0000 (09:47 +0900)]
ASoC: codecs: use snd_soc_xxx_active()

We have snd_soc_dai/dai_stream/component_active() macro
This patch uses it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87wo5e58j4.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: cirrus: use snd_soc_xxx_active()
Kuninori Morimoto [Fri, 15 May 2020 00:47:05 +0000 (09:47 +0900)]
ASoC: cirrus: use snd_soc_xxx_active()

We have snd_soc_dai/dai_stream/component_active() macro
This patch uses it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87y2pu58ja.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: bcm: use snd_soc_xxx_active()
Kuninori Morimoto [Fri, 15 May 2020 00:47:01 +0000 (09:47 +0900)]
ASoC: bcm: use snd_soc_xxx_active()

We have snd_soc_dai/dai_stream/component_active() macro
This patch uses it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87zhaa58je.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: atomel: use snd_soc_xxx_active()
Kuninori Morimoto [Fri, 15 May 2020 00:46:56 +0000 (09:46 +0900)]
ASoC: atomel: use snd_soc_xxx_active()

We have snd_soc_dai/dai_stream/component_active() macro
This patch uses it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/871rnm6n3z.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: use snd_soc_xxx_active()
Kuninori Morimoto [Fri, 15 May 2020 00:46:51 +0000 (09:46 +0900)]
ASoC: use snd_soc_xxx_active()

We have snd_soc_dai/dai_stream/component_active() macro
This patch uses it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/8736826n44.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: soc-dai: add snd_soc_dai_stream_active()
Kuninori Morimoto [Fri, 15 May 2020 00:46:47 +0000 (09:46 +0900)]
ASoC: soc-dai: add snd_soc_dai_stream_active()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/874ksi6n48.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: soc-component: add snd_soc_component_active()
Kuninori Morimoto [Fri, 15 May 2020 00:46:42 +0000 (09:46 +0900)]
ASoC: soc-component: add snd_soc_component_active()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/875zcy6n4d.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: soc-dai: add snd_soc_dai_active()
Kuninori Morimoto [Fri, 15 May 2020 00:46:37 +0000 (09:46 +0900)]
ASoC: soc-dai: add snd_soc_dai_active()

Current snd_soc_dai_action() is updating
dai->stream_active for Playback/Capture (A),
dai->active        for DAI (B)

        void snd_soc_dai_action(struct snd_soc_dai *dai,
                                int stream, int action)
        {
(A)             dai->stream_active[stream]      += action;
(B)             dai->active                     += action;
                dai->component->active          += action;
        }

But, these are very verbose, because we can calculate
DAI active from stream_active.

This patch adds snd_soc_dai_active() which calculate
DAI active from DAI stream_active.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/877dxe6n4i.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: soc-dapm: use snd_soc_dai_activate()/deactivate()
Kuninori Morimoto [Fri, 15 May 2020 00:46:33 +0000 (09:46 +0900)]
ASoC: soc-dapm: use snd_soc_dai_activate()/deactivate()

soc-dapm.c :: snd_soc_dai_link_event_pre_pmu() / snd_soc_dai_link_event()
are directly updating dai->active without caring about
stream_active / component->active.
It is breaking xxx_active count balance.
This patch uses snd_soc_dai_action() for it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/878shu6n4n.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: soc-dai: add snd_soc_dai_action()
Kuninori Morimoto [Fri, 15 May 2020 00:46:27 +0000 (09:46 +0900)]
ASoC: soc-dai: add snd_soc_dai_action()

snd_soc_runtime_action() updates DAI's xxx_active.
We should update these in the same time, and
it can be implemented at soc-dai.c.
This patch adds snd_soc_dai_action() for it.
This is prepare for xxx_active cleanup.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87a72a6n4s.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: soc-pcm: replace snd_soc_runtime_activate()/deactivate() to macro
Kuninori Morimoto [Fri, 15 May 2020 00:46:21 +0000 (09:46 +0900)]
ASoC: soc-pcm: replace snd_soc_runtime_activate()/deactivate() to macro

snd_soc_runtime_activate()/deactivate() are implemented by global function
which are just calling snd_soc_runtime_action().
We can replace it to macro, and this patch do it.
This patch is prepare for xxx_active cleanup.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87blmq6n4y.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: da7213: move set_pll to codec level
Sebastian Reichel [Mon, 11 May 2020 13:25:43 +0000 (15:25 +0200)]
ASoC: da7213: move set_pll to codec level

Move set_pll function to component level, so that it can be used at
both component and DAI level.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Reviewed-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Link: https://lore.kernel.org/r/20200511132544.82364-5-sebastian.reichel@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: da7213: move set_sysclk to codec level
Sebastian Reichel [Mon, 11 May 2020 13:25:42 +0000 (15:25 +0200)]
ASoC: da7213: move set_sysclk to codec level

Move set_sysclk function to component level, so that it can be used at
both component and DAI level.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Reviewed-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Link: https://lore.kernel.org/r/20200511132544.82364-4-sebastian.reichel@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: da7213: Add regulator support
Sebastian Reichel [Mon, 11 May 2020 13:25:41 +0000 (15:25 +0200)]
ASoC: da7213: Add regulator support

This adds support for most regulators of da7212 for improved
power management. The only thing skipped was the speaker supply,
which has some undocumented dependencies. It's supposed to be
either always-enabled or always-disabled.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Reviewed-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Link: https://lore.kernel.org/r/20200511132544.82364-3-sebastian.reichel@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: da7213: Add da7212 DT compatible
Sebastian Reichel [Mon, 11 May 2020 13:25:40 +0000 (15:25 +0200)]
ASoC: da7213: Add da7212 DT compatible

This adds a compatible for da7212. It's handled exactly the
same way as DA7213 and follows the ACPI bindings.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Link: https://lore.kernel.org/r/20200511132544.82364-2-sebastian.reichel@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: Intel: cht_bsw_nau8824: remap BTN_0 as KEY_PLAYPAUSE
Pierre-Louis Bossart [Fri, 15 May 2020 21:07:31 +0000 (16:07 -0500)]
ASoC: Intel: cht_bsw_nau8824: remap BTN_0 as KEY_PLAYPAUSE

Use same mapping as in all other machine drivers:

BTN_0 : KEY_PLAYPAUSE
BTN_1 : KEY_VOICECOMMAND
BTN_2 : KEY_VOLUMEUP
BTN_3 : KEY_VOLUMEDOWN

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Link: https://lore.kernel.org/r/20200515210731.10942-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: Intel: sof_sdw_rt700: remap buttons
Pierre-Louis Bossart [Fri, 15 May 2020 21:07:30 +0000 (16:07 -0500)]
ASoC: Intel: sof_sdw_rt700: remap buttons

Use same mapping as in all other machine drivers:

BTN_0 : KEY_PLAYPAUSE
BTN_1 : KEY_VOICECOMMAND
BTN_2 : KEY_VOLUMEUP
BTN_3 : KEY_VOLUMEDOWN

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Link: https://lore.kernel.org/r/20200515210731.10942-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: Intel: sof_sdw_rt711: remap buttons
Pierre-Louis Bossart [Fri, 15 May 2020 21:07:29 +0000 (16:07 -0500)]
ASoC: Intel: sof_sdw_rt711: remap buttons

Use same mapping as in all other machine drivers:

BTN_0 : KEY_PLAYPAUSE
BTN_1 : KEY_VOICECOMMAND
BTN_2 : KEY_VOLUMEUP
BTN_3 : KEY_VOLUMEDOWN

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Link: https://lore.kernel.org/r/20200515210731.10942-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: Intel: sof_sdw: fix typo in components string
Pierre-Louis Bossart [Fri, 15 May 2020 21:07:28 +0000 (16:07 -0500)]
ASoC: Intel: sof_sdw: fix typo in components string

The component string attributes are separated by spaces, not commas.

Fixes: b1ca2f63e20b4 ("ASoC: Intel: sof_sdw: add amp number in components string for ucm")
Reported-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200515210731.10942-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: Intel: soc-acpi: change machine driver name for WM8804 platforms
Pierre-Louis Bossart [Fri, 15 May 2020 21:07:27 +0000 (16:07 -0500)]
ASoC: Intel: soc-acpi: change machine driver name for WM8804 platforms

Remove obsolete reference to Broxton since the machine driver will be
reused on other platforms, e.g. Up Extreme.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20200515210731.10942-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: imx: make imx8m_dsp_ops static
Pierre-Louis Bossart [Fri, 15 May 2020 13:59:58 +0000 (16:59 +0300)]
ASoC: SOF: imx: make imx8m_dsp_ops static

This was in the SOF tree but lost in upstream contributions.

Fixes: afb93d716533dd ("ASoC: SOF: imx: Add i.MX8M HW support")
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200515135958.17511-9-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: imx: make dsp_ops static
Pierre-Louis Bossart [Fri, 15 May 2020 13:59:57 +0000 (16:59 +0300)]
ASoC: SOF: imx: make dsp_ops static

This was in the SOF tree but lost in upstream contributions

Fixes: 202acc565a1f05 ("ASoC: SOF: imx: Add i.MX8 HW support")
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200515135958.17511-8-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: define INFO_ flags in dsp_ops
Daniel Baluta [Fri, 15 May 2020 13:59:56 +0000 (16:59 +0300)]
ASoC: SOF: define INFO_ flags in dsp_ops

In the past, the INFO_ flags such as PAUSE/NO_PERIOD_WAKEUP were
defined in the SOF PCM core, but that was changed since
commit 27e322fabd508b ("ASoC: SOF: define INFO_ flags in dsp_ops")

Now these flags must be set in DSP ops.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20200515135958.17511-7-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: Intel: sdw: relax sdw machine select constraints
randerwang [Fri, 15 May 2020 13:59:55 +0000 (16:59 +0300)]
ASoC: SOF: Intel: sdw: relax sdw machine select constraints

On some platforms such as Up Extreme all links are enabled but only one
link can be used by external codec. Instead of exact match of two masks,
first check whether link_mask of mach is subset of link_mask supported
by hw and then go on searching link_adr.

Signed-off-by: randerwang <rander.wang@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Link: https://lore.kernel.org/r/20200515135958.17511-6-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: topology: add support to smart amplifier
Keyon Jie [Fri, 15 May 2020 13:59:54 +0000 (16:59 +0300)]
ASoC: SOF: topology: add support to smart amplifier

Add smart amplifier component support, which is designed as another new
type of process component and used for speaker protection algorithm
integration.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200515135958.17511-5-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: inform DSP that driver is going to be removed
Marcin Rajwa [Fri, 15 May 2020 13:59:53 +0000 (16:59 +0300)]
ASoC: SOF: inform DSP that driver is going to be removed

This patch invokes the DSP power down notifier to inform
DSP that driver is going to be removed.
The module removal entails DSP power down, disabling of
IRQs and more. Therefore it is highly recommended to inform
the DSP about this upcoming event.

Due to hardware limitations on some Intel platforms it is necessary
to power gate all LPSRAM banks that were enabled prior to controller
reset. Otherwise, an attempt to write LPSRAM control registers may
have no effect.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20200515135958.17511-4-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: add a power_down_notify method
Marcin Rajwa [Fri, 15 May 2020 13:59:52 +0000 (16:59 +0300)]
ASoC: SOF: add a power_down_notify method

This patch adds a snd_sof_dsp_power_down_notify() method which aims to
prepare the DSP for the upcoming power down.
This new function make use of SOF_IPC_PM_CTX_SAVE message.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20200515135958.17511-3-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: Do nothing when DSP PM callbacks are not set
Daniel Baluta [Fri, 15 May 2020 13:59:51 +0000 (16:59 +0300)]
ASoC: SOF: Do nothing when DSP PM callbacks are not set

This provides a better separation between runtime and PM sleep
callbacks.

Only do nothing if given runtime flag is set and calback is not set.

With the current implementation, if PM sleep callback is set but runtime
callback is not set then at runtime resume we reload the firmware even
if we do not support runtime resume callback.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20200515135958.17511-2-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: codecs: rt1308-sdw: remove duplicate allocation
Pierre-Louis Bossart [Fri, 15 May 2020 21:15:31 +0000 (16:15 -0500)]
ASoC: codecs: rt1308-sdw: remove duplicate allocation

The .read_prop callback is supposed to be called by the SoundWire core
only. Calling it again from this driver results in an additional
memory allocation for no good reason.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Cc: Oder Chiou <oder_chiou@realtek.com>
Cc: Shuming Fan <shumingf@realtek.com>
Cc: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/20200515211531.11416-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: codecs: rt*-sdw: fix memory leak in set_sdw_stream()
Pierre-Louis Bossart [Fri, 15 May 2020 21:15:30 +0000 (16:15 -0500)]
ASoC: codecs: rt*-sdw: fix memory leak in set_sdw_stream()

Now that the sdw_stream is allocated in machine driver,
set_sdw_stream() is also called with a NULL argument during the
dailink shutdown.

In this case, the drivers should not allocate any memory, and just
return.

Detected with KASAN/kmemleak.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Cc: Oder Chiou <oder_chiou@realtek.com>
Cc: Shuming Fan <shumingf@realtek.com>
Cc: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/20200515211531.11416-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: codecs: rt*-sdw: don't assign slave_ops
Pierre-Louis Bossart [Fri, 15 May 2020 21:15:29 +0000 (16:15 -0500)]
ASoC: codecs: rt*-sdw: don't assign slave_ops

The SoundWire bus core already assigns the slave ops, no need to set
them a second time manually in each driver.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Cc: Oder Chiou <oder_chiou@realtek.com>
Cc: Shuming Fan <shumingf@realtek.com>
Cc: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/20200515211531.11416-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoMerge series "ASoC: fsl_esai: Add support for imx8qm" from Shengjiu Wang <shengjiu...
Mark Brown [Fri, 15 May 2020 10:56:53 +0000 (11:56 +0100)]
Merge series "ASoC: fsl_esai: Add support for imx8qm" from Shengjiu Wang <shengjiu.wang@nxp.com>:

Add support for imx8qm.

Shengjiu Wang (2):
  ASoC: fsl_esai: introduce SoC specific data
  ASoC: fsl_esai: Add new compatible string for imx8qm

Changes in v2
- drop the 0002 patch in v1, the dma relate limitation should
  be done in dma driver, or define a new DMA API for it.

 .../devicetree/bindings/sound/fsl,esai.txt    |  1 +
 sound/soc/fsl/fsl_esai.c                      | 46 +++++++++++++++----
 2 files changed, 38 insertions(+), 9 deletions(-)

--
2.21.0

4 years agoASoC: cros_ec_codec: switch to library API for SHA-256
Ard Biesheuvel [Fri, 15 May 2020 10:03:09 +0000 (12:03 +0200)]
ASoC: cros_ec_codec: switch to library API for SHA-256

The CrOS EC codec driver uses SHA-256 explicitly, and not in a
performance critical manner, so there is really no point in using
the SHASH crypto API here. Let's switch to the library API instead.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Tzung-Bi Shih <tzungbi@google.com>
Cc: Cheng-Yi Chiang <cychiang@chromium.org>
Cc: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Cc: Guenter Roeck <groeck@chromium.org>
Cc: Benson Leung <bleung@chromium.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Eric Biggers <ebiggers@kernel.org>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20200515100309.20795-1-ardb@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: fsl_esai: Add new compatible string for imx8qm
Shengjiu Wang [Fri, 15 May 2020 10:10:51 +0000 (18:10 +0800)]
ASoC: fsl_esai: Add new compatible string for imx8qm

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

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Acked-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/fade597f6fb7e0ef9eb1185b491eaa46a9d287e3.1589537601.git.shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: fsl_esai: introduce SoC specific data
Shengjiu Wang [Fri, 15 May 2020 10:10:50 +0000 (18:10 +0800)]
ASoC: fsl_esai: introduce SoC specific data

Introduce a SoC specific data structure which contains the
differences between the different SoCs.
This makes it easier to support more differences without having
to introduce a new if/else each time.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Link: https://lore.kernel.org/r/c188279975bd216995904f9bf8a84c7887b759a0.1589537601.git.shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoMerge branch 'for-5.7' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie...
Mark Brown [Thu, 14 May 2020 17:37:31 +0000 (18:37 +0100)]
Merge branch 'for-5.7' of https://git./linux/kernel/git/broonie/sound into asoc-5.8

4 years agoASoC: tlv320adcx140: Configure PDM sampling edge
Dan Murphy [Thu, 14 May 2020 12:33:38 +0000 (07:33 -0500)]
ASoC: tlv320adcx140: Configure PDM sampling edge

Configure the PDM sampling edges based on the values from the firmware.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200514123338.20392-3-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: tlv320adcx140: Add device tree property for PDM edges
Dan Murphy [Thu, 14 May 2020 12:33:37 +0000 (07:33 -0500)]
ASoC: tlv320adcx140: Add device tree property for PDM edges

Add a device tree property to configure the PDM sampling edge for each
digital microphone.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
CC: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20200514123338.20392-2-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: tlv320adcx140: Add controls for PDM clk
Dan Murphy [Thu, 14 May 2020 12:33:36 +0000 (07:33 -0500)]
ASoC: tlv320adcx140: Add controls for PDM clk

Add ALSA controls to configure the PDM clocks.
The clocks need to be configurable to accommodate various microphones
that use clocks for low power/low resolution modes to high power/high
resolution modes.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200514123338.20392-1-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: tlv320adcx140: Fix bias config values
Dan Murphy [Wed, 13 May 2020 14:28:07 +0000 (09:28 -0500)]
ASoC: tlv320adcx140: Fix bias config values

The device tree binding declares the ti,mic-bias-source and the
ti,vref-source properties as u32.  The code reads them as u8 which is
incorrect.  Since the device tree binding indicates them as u32 the
conde needs to be updated to read u32.

In addition the bias source needs to be shifted 4 bits to
correctly write the register.

driver family")

Fixes: 37bde5acf040 ("ASoC: tlv320adcx140: Add the tlv320adcx140 codec
Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200513142807.11802-1-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: wm8962: Use force clear for WM8962_SYSCLK_ENA after reset
Shengjiu Wang [Wed, 13 May 2020 05:30:35 +0000 (13:30 +0800)]
ASoC: wm8962: Use force clear for WM8962_SYSCLK_ENA after reset

When CLOCKING2 is non-volatile register, we need force clear
the WM8962_SYSCLK_ENA bit after reset, for the value in cache
maybe 0 but in hardware it is 1. Otherwise there will issue
as below statement in driver.

/* SYSCLK defaults to on; make sure it is off so we can safely
 * write to registers if the device is declocked.

Fixes: c38b608504aa ("ASoC: wm8962: set CLOCKING2 as non-volatile register")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/1589347835-20554-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: mmp-sspa: Set appropriate bus format for given bit width
Lubomir Rintel [Mon, 11 May 2020 21:01:32 +0000 (23:01 +0200)]
ASoC: mmp-sspa: Set appropriate bus format for given bit width

The values set by set_dai_fmt() and hw_params() seem to be tailored only
for 32-bit formats. Negotiate the correct ones in hw_params() callback
instead.

This was essentially copied from the OLPC kernel driver and tested to
fix wrong audio output for non-32bit formats. The documentation is not
available.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Link: https://lore.kernel.org/r/20200511210134.1224532-10-lkundrak@v3.sk
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: mmp-sspa: Add support for the runtime power management
Lubomir Rintel [Mon, 11 May 2020 21:01:31 +0000 (23:01 +0200)]
ASoC: mmp-sspa: Add support for the runtime power management

Only turn on the Audio island when it's in use.

This requires keeping track of control register contents instead of
reloading them back from hardware, because they're lost when the power is
off.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Link: https://lore.kernel.org/r/20200511210134.1224532-9-lkundrak@v3.sk
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: mmp-sspa: Prepare/unprepare the clocks
Lubomir Rintel [Mon, 11 May 2020 21:01:30 +0000 (23:01 +0200)]
ASoC: mmp-sspa: Prepare/unprepare the clocks

The driver enables the clocks without preparing them and disables
without unpreparing afterwards. Fix that.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Link: https://lore.kernel.org/r/20200511210134.1224532-8-lkundrak@v3.sk
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: mmp-sspa: Remove the embedded struct ssp_device
Lubomir Rintel [Mon, 11 May 2020 21:01:29 +0000 (23:01 +0200)]
ASoC: mmp-sspa: Remove the embedded struct ssp_device

The "serial port" it represents is actually a SPI controller -- it's not
clear why would the audio serial interface embed it. We're only using
the mmio_base and clk fields.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Link: https://lore.kernel.org/r/20200511210134.1224532-7-lkundrak@v3.sk
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: mmp-sspa: Add support for soc-generic-dmaengine-pcm
Lubomir Rintel [Mon, 11 May 2020 21:01:28 +0000 (23:01 +0200)]
ASoC: mmp-sspa: Add support for soc-generic-dmaengine-pcm

This makes the driver usable with the mmp_tdma drier via
soc-generic-dmaengine-pcm. This is conditionalized on DT node (support
for DT is added by a later patch).

A custom mmap callback that creates a NC mapping is used instead of the
default WC one, because with write-combining some bytes don't seem to
make it through for reasons unknown to me.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Link: https://lore.kernel.org/r/20200511210134.1224532-6-lkundrak@v3.sk
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: mmp-sspa: Get rid of dma_params and phys_base
Lubomir Rintel [Mon, 11 May 2020 21:01:27 +0000 (23:01 +0200)]
ASoC: mmp-sspa: Get rid of dma_params and phys_base

This makes things simpler. There's no reason not to just embed the struct
snd_dmaengine_dai_dma_data in struct sspa_priv and do away with an
unnecessary kmalloc(). While at that, we can initialize the
snd_dmaengine_dai_dma_data structures earlier.

Let's also stop offsetting the source/destination of the DMA transfer by
phys_base. Firstly, it's never set and is always zero. Secondly, the
hardware actually ignores it, at least on a MMP2 and MMP3.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Link: https://lore.kernel.org/r/20200511210134.1224532-5-lkundrak@v3.sk
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: mmp-sspa: A trivial typo fix
Lubomir Rintel [Mon, 11 May 2020 21:01:26 +0000 (23:01 +0200)]
ASoC: mmp-sspa: A trivial typo fix

"Transmit", not "Tansmit".

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Link: https://lore.kernel.org/r/20200511210134.1224532-4-lkundrak@v3.sk
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: ti: omap-mcbsp: Fix an error handling path in 'asoc_mcbsp_probe()'
Christophe JAILLET [Tue, 12 May 2020 13:43:25 +0000 (15:43 +0200)]
ASoC: ti: omap-mcbsp: Fix an error handling path in 'asoc_mcbsp_probe()'

If an error occurs after the call to 'omap_mcbsp_init()', the reference to
'mcbsp->fclk' must be decremented, as already done in the remove function.

This can be achieved easily by using the devm_ variant of 'clk_get()'
when the reference is taken in 'omap_mcbsp_init()'

This fixes the leak in the probe and has the side effect to simplify both
the error handling path of 'omap_mcbsp_init()' and the remove function.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Peter Ujfalusi <peter.ujflausi@ti.com>
Link: https://lore.kernel.org/r/20200512134325.252073-1-christophe.jaillet@wanadoo.fr
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: Intel: Skylake: Update description for HDaudio kconfig
Cezary Rojewski [Wed, 6 May 2020 21:21:14 +0000 (23:21 +0200)]
ASoC: Intel: Skylake: Update description for HDaudio kconfig

With 'ASoC: Intel: Skylake: Fix HDaudio and Dmic' series applied,
warning is no longer true. Remove it and update the description.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20200506212114.8502-1-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: rockchip-i2s: add description for rk3308
Johan Jonker [Thu, 7 May 2020 11:32:38 +0000 (13:32 +0200)]
ASoC: rockchip-i2s: add description for rk3308

The description below is already in use for rk3308.dtsi,
but was somehow never added to a document, so add
"rockchip,rk3308-i2s", "rockchip,rk3066-i2s"
for i2s nodes on a rk3308 platform to rockchip-i2s.yaml.
One of the rk3308 i2s nodes also has a different dma layout,
so change that as well.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Link: https://lore.kernel.org/r/20200507113238.7904-1-jbx6244@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: ux500: mop500: Fix some refcounted resources issues
Christophe JAILLET [Tue, 12 May 2020 10:07:05 +0000 (12:07 +0200)]
ASoC: ux500: mop500: Fix some refcounted resources issues

There are 2 issues here:
   - if one of the 'of_parse_phandle' fails, calling 'mop500_of_node_put()'
     is a no-op because the 'mop500_dai_links' structure has not been
     initialized yet, so the referenced are not decremented
   - The reference stored in 'mop500_dai_links[i].codecs' is refcounted
     only once in the probe and must be decremented only once.

Fixes: 39013bd60e79 ("ASoC: Ux500: Dispose of device nodes correctly")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/20200512100705.246349-1-christophe.jaillet@wanadoo.fr
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: Intel: Skylake: Replace zero-length array with flexible-array
Gustavo A. R. Silva [Mon, 11 May 2020 17:46:47 +0000 (12:46 -0500)]
ASoC: Intel: Skylake: Replace zero-length array with flexible-array

The current codebase makes use of the zero-length array language
extension to the C90 standard, but the preferred mechanism to declare
variable-length types such as these ones is a flexible array member[1][2],
introduced in C99:

struct foo {
        int stuff;
        struct boo array[];
};

By making use of the mechanism above, we will get a compiler warning
in case the flexible array does not occur last in the structure, which
will help us prevent some kind of undefined behavior bugs from being
inadvertently introduced[3] to the codebase from now on.

Also, notice that, dynamic memory allocations won't be affected by
this change:

"Flexible array members have incomplete type, and so the sizeof operator
may not be applied. As a quirk of the original implementation of
zero-length arrays, sizeof evaluates to zero."[1]

sizeof(flexible-array-member) triggers a warning because flexible array
members have incomplete type[1]. There are some instances of code in
which the sizeof operator is being incorrectly/erroneously applied to
zero-length arrays and the result is zero. Such instances may be hiding
some bugs. So, this work (flexible-array member conversions) will also
help to get completely rid of those sorts of issues.

This issue was found with the help of Coccinelle.

[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] https://github.com/KSPP/linux/issues/21
[3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour")

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Acked-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20200511174647.GA17318@embeddedor
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoMerge branch 'for-5.7' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie...
Mark Brown [Tue, 12 May 2020 15:12:47 +0000 (16:12 +0100)]
Merge branch 'for-5.7' of https://git./linux/kernel/git/broonie/sound into asoc-5.8

4 years agoASoC: mmp-sspa: Drop S20_3LE case
Lubomir Rintel [Mon, 11 May 2020 21:01:25 +0000 (23:01 +0200)]
ASoC: mmp-sspa: Drop S20_3LE case

It does nothing, because the corresponding bit s not flipped on in .formats
and the audio SRAM DMA engine is not able to handle 20-bit transfers
anyway.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Link: https://lore.kernel.org/r/20200511210134.1224532-3-lkundrak@v3.sk
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: mmp-sspa: Flip SNDRV_PCM_FMTBIT_S24_3LE on
Lubomir Rintel [Mon, 11 May 2020 21:01:24 +0000 (23:01 +0200)]
ASoC: mmp-sspa: Flip SNDRV_PCM_FMTBIT_S24_3LE on

The hw_params() callback handles the 3-byte format, not
SNDRV_PCM_FMTBIT_S24_LE.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Link: https://lore.kernel.org/r/20200511210134.1224532-2-lkundrak@v3.sk
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: Intel: Use readq to read 64 bit registers
Amadeusz Sławiński [Thu, 7 May 2020 13:34:05 +0000 (09:34 -0400)]
ASoC: Intel: Use readq to read 64 bit registers

In order to fix issue described in:
"ASoC: Intel: sst: ipc command timeout"
https://patchwork.kernel.org/patch/11482829/

use readq function, which is meant to read 64 bit values from registers.
On 32 bit platforms it falls back to two readl calls.

Reported-by: Brent Lu <brent.lu@intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Tested-by: Brent Lu <brent.lu@intel.com>
Acked-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20200507133405.32251-2-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: Intel: baytrail: Fix register access
Amadeusz Sławiński [Thu, 7 May 2020 13:34:04 +0000 (09:34 -0400)]
ASoC: Intel: baytrail: Fix register access

Baytrail has 64 bit registers, so we should use *read64* to read from it
and then use proper mask values to check status.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Tested-by: Brent Lu <brent.lu@intel.com>
Acked-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20200507133405.32251-1-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoSoC: rsnd: add interrupt support for SSI BUSIF buffer
Yongbo Zhang [Tue, 12 May 2020 09:30:03 +0000 (17:30 +0800)]
SoC: rsnd: add interrupt support for SSI BUSIF buffer

SSI BUSIF buffer is possible to overflow or underflow, especially in a
hypervisor environment. If there is no interrupt support, it will eventually
lead to errors in pcm data.
This patch adds overflow and underflow interrupt support for SSI BUSIF buffer.

Reported-by: Chen Li <licheng0822@thundersoft.com>
Signed-off-by: Yongbo Zhang <giraffesnn123@gmail.com>
Tested-by: Chen Li <licheng0822@thundersoft.com>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20200512093003.28332-1-giraffesnn123@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: core: fix error return code in sof_probe_continue()
Wei Yongjun [Sat, 9 May 2020 09:33:37 +0000 (09:33 +0000)]
ASoC: SOF: core: fix error return code in sof_probe_continue()

Fix to return negative error code -ENOMEM from the IPC init error
handling case instead of 0, as done elsewhere in this function.

Fixes: c16211d6226d ("ASoC: SOF: Add Sound Open Firmware driver core")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Link: https://lore.kernel.org/r/20200509093337.78897-1-weiyongjun1@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: mediatek: mt8183-da7219: set headset button maps
Tzung-Bi Shih [Mon, 11 May 2020 04:40:00 +0000 (12:40 +0800)]
ASoC: mediatek: mt8183-da7219: set headset button maps

Sets headset button maps.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20200511044000.86161-1-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: cros_ec_codec: allocate shash_desc dynamically
Arnd Bergmann [Thu, 7 May 2020 21:33:51 +0000 (23:33 +0200)]
ASoC: cros_ec_codec: allocate shash_desc dynamically

The wov_hotword_model_put() function has multiple large variables on
its stack, the largest of which is the result of SHASH_DESC_ON_STACK().
In total, this exceeds the warning limit for 32-bit architectures:

sound/soc/codecs/cros_ec_codec.c:776:12: error: stack frame size of 1152 bytes in function 'wov_hotword_model_put' [-Werror,-Wframe-larger-than=]

The function already has a dynamic crypto_alloc_shash() allocation, so
using kmalloc() for the descriptor is correct as well and does not
introduce any additional failure scenarios. With this, the stack usage
of wov_hotword_model_put() gets reduced to 480 bytes in my test
configuration.

Fixes: b6bc07d4360d ("ASoC: cros_ec_codec: support WoV")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20200507213405.1869430-1-arnd@arndb.de
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: soc-core: Replace zero-length array with flexible-array
Gustavo A. R. Silva [Thu, 7 May 2020 19:22:28 +0000 (14:22 -0500)]
ASoC: soc-core: Replace zero-length array with flexible-array

The current codebase makes use of the zero-length array language
extension to the C90 standard, but the preferred mechanism to declare
variable-length types such as these ones is a flexible array member[1][2],
introduced in C99:

struct foo {
        int stuff;
        struct boo array[];
};

By making use of the mechanism above, we will get a compiler warning
in case the flexible array does not occur last in the structure, which
will help us prevent some kind of undefined behavior bugs from being
inadvertently introduced[3] to the codebase from now on.

Also, notice that, dynamic memory allocations won't be affected by
this change:

"Flexible array members have incomplete type, and so the sizeof operator
may not be applied. As a quirk of the original implementation of
zero-length arrays, sizeof evaluates to zero."[1]

sizeof(flexible-array-member) triggers a warning because flexible array
members have incomplete type[1]. There are some instances of code in
which the sizeof operator is being incorrectly/erroneously applied to
zero-length arrays and the result is zero. Such instances may be hiding
some bugs. So, this work (flexible-array member conversions) will also
help to get completely rid of those sorts of issues.

This issue was found with the help of Coccinelle.

[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] https://github.com/KSPP/linux/issues/21
[3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour")

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/20200507192228.GA16355@embeddedor
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: Intel: Fix unused variable warning
YueHaibing [Thu, 7 May 2020 07:27:35 +0000 (15:27 +0800)]
ASoC: SOF: Intel: Fix unused variable warning

When CONFIG_SND_SOC_SOF_BAYTRAIL is not set, gcc warns:

sound/soc/sof/intel/byt.c:85:41: warning: ‘cht_debugfs’ defined but not used [-Wunused-const-variable=]
 static const struct snd_sof_debugfs_map cht_debugfs[] = {
                                         ^~~~~~~~~~~
Move the variable inside #ifdef

Reported-by: Hulk Robot <hulkci@huawei.com>
Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20200507072735.16588-1-yuehaibing@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agosoc: fsl_asrc: Make some functions static
ChenTao [Thu, 7 May 2020 02:29:59 +0000 (10:29 +0800)]
soc: fsl_asrc: Make some functions static

Fix the following warning:

sound/soc/fsl/fsl_asrc.c:157:5: warning:
symbol 'fsl_asrc_request_pair' was not declared. Should it be static?
sound/soc/fsl/fsl_asrc.c:200:6: warning:
symbol 'fsl_asrc_release_pair' was not declared. Should it be static?

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: ChenTao <chentao107@huawei.com>
Link: https://lore.kernel.org/r/20200507022959.183739-1-chentao107@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: rt1016: Add the devicetree file for the rt1016
Oder Chiou [Thu, 7 May 2020 02:15:39 +0000 (10:15 +0800)]
ASoC: rt1016: Add the devicetree file for the rt1016

The patch adds the devicetree file for the rt1016.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Link: https://lore.kernel.org/r/20200507021539.7133-2-oder_chiou@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: rt1016: Add the rt1016 support
Oder Chiou [Thu, 7 May 2020 02:15:38 +0000 (10:15 +0800)]
ASoC: rt1016: Add the rt1016 support

The patch adds the rt1016 support.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Link: https://lore.kernel.org/r/20200507021539.7133-1-oder_chiou@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: rt5677: Use devm_snd_soc_register_component()
Wei Yongjun [Thu, 7 May 2020 09:43:35 +0000 (09:43 +0000)]
ASoC: rt5677: Use devm_snd_soc_register_component()

Using devm_snd_soc_register_component() can make the code
shorter and cleaner.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Link: https://lore.kernel.org/r/20200507094335.14302-1-weiyongjun1@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: mediatek: mt8183: fix error handling of platform_get_irq()
Tzung-Bi Shih [Thu, 7 May 2020 01:54:42 +0000 (09:54 +0800)]
ASoC: mediatek: mt8183: fix error handling of platform_get_irq()

platform_get_irq() returns negative value on error instead of 0.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20200507015442.191336-1-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: mediatek: Fix error handling
Tang Bin [Wed, 6 May 2020 14:30:09 +0000 (22:30 +0800)]
ASoC: mediatek: Fix error handling

If the function platform_get_irq() failed, the negative value
returned will not be detected here. So fix error handling in
mt6797_afe_pcm_dev_probe(). And when get irq failed, the function
platform_get_irq() logs an error message, so remove redundant
message here.

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
Link: https://lore.kernel.org/r/20200506143009.13368-1-tangbin@cmss.chinamobile.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: amd :High hw_level while simultaneous capture
Akshu Agrawal [Wed, 6 May 2020 10:26:00 +0000 (15:56 +0530)]
ASoC: amd :High hw_level while simultaneous capture

Simultaneous capture on dmic and headset mic is having
issue with high hw_level being reported.

Issue Can be reproduced by:
arecord -D hw:2,0 -f dat -d 60 /tmp/test0 &
arecord -D hw:2,2 -f dat -d 60 /tmp/test1 &
cat /proc/asound/card2/pcm?c/sub0/status

Actual issue is :
When we open one capture stream on one instance lets say I2S_SP and then
once again if we open other capture on other instance lets say I2S_BT while
first capture is in progress and when we try to read the status of both
running instances by below command cat /proc/asound/card2/pcm?c/sub0/status
we observe that avail_max is being doubled on first opened
capture(I2S_SP in the example).

This is because our previous implementation was like when any instance is
opened it gets initialized in dma_open irrespective of on what instance it
called open.

For example:
First I2S_SP called opened it initializes both SP/BT capture streams
irrespective of on which instance the stream opened.next time I2S_BT
called opened and it initializes both SP/BT this corrupts the behaviour .

So with this patch the stream gets initialized only on specific instance
when ever it gets opened calls hw_params.

This rectifies the issue.

Signed-off-by: Ravulapati Vishnu vardhan rao <Vishnuvardhanrao.Ravulapati@amd.com>
Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com>
Link: https://lore.kernel.org/r/20200506102602.140790-1-akshu.agrawal@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: qcom: lpass-cpu: Make I2S SD lines configurable
Stephan Gerhold [Sat, 25 Apr 2020 18:46:57 +0000 (20:46 +0200)]
ASoC: qcom: lpass-cpu: Make I2S SD lines configurable

The LPASS hardware allows configuring the MI2S SD lines to use
when playing/recording audio. However, at the moment the lpass-cpu
driver has SD0 hard-coded for mono/stereo (or additional fixed
SD lines for more channels).

For weird reasons there seems to be hardware that uses one of the
other SD lines for mono/stereo. For example, some Samsung devices
use an external Speaker amplifier connected to Quaternary MI2S.
For some reason, the SD line for audio playback was connected to
SD1 rather than SD0. (I have no idea why...)
At the moment, the lpass-cpu driver cannot be configured to work
for the Speaker on these devices.

The q6afe driver already allows configuring the MI2S SD lines
through the "qcom,sd-lines" device tree property, but this works
only when routing audio through the ADSP.

This commit adds a very similar configuration for the lpass-cpu driver.
It is now possible to add additional subnodes to the lpass device in
the device tree, to configure the SD lines for playback and/or capture.
E.g. for the Samsung devices mentioned above:

&lpass {
dai@3 {
reg = <MI2S_QUATERNARY>;
qcom,playback-sd-lines = <1>;
};
};

qcom,playback/capture-sd-lines takes a list of SD lines (0-3)
in the same format as the q6afe driver. (The difference here is that
q6afe has separate DAIs for playback/capture, while lpass-cpu has one
for both...)

For backwards compatibility with older device trees, the lpass-cpu driver
defaults to LPAIF_I2SCTL_MODE_8CH if the subnode for a DAI is missing.
This is equivalent to the previous behavior: Up to 8 channels can be
configured, and SD0/QUAT01 will be chosen when setting up a stream
with fewer channels.

This allows the speaker to work on Samsung MSM8916 devices
that use an external speaker amplifier.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20200425184657.121991-2-stephan@gerhold.net
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agodt-bindings: sound: lpass-cpu: Document DAI subnodes
Stephan Gerhold [Sat, 25 Apr 2020 18:46:56 +0000 (20:46 +0200)]
dt-bindings: sound: lpass-cpu: Document DAI subnodes

The lpass-cpu driver now allows configuring the MI2S SD lines
by defining subnodes for one of the DAIs.

Document this in the device tree bindings.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Link: https://lore.kernel.org/r/20200425184657.121991-1-stephan@gerhold.net
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: wm8524: Add support S32_LE
Shengjiu Wang [Fri, 22 Nov 2019 10:30:13 +0000 (18:30 +0800)]
ASoC: wm8524: Add support S32_LE

Allow 32bit sample with this codec.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/cff745cc041c5208910821f0740f988926af8a66.1574418380.git.shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: qcom: Use the defined variable to simplify code
Tang Bin [Mon, 4 May 2020 06:59:47 +0000 (14:59 +0800)]
ASoC: qcom: Use the defined variable to simplify code

Use the defined variable "dev" to make the code cleaner.

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
Link: https://lore.kernel.org/r/20200504065947.12172-1-tangbin@cmss.chinamobile.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: rt1015: Add condition to prevent SoC providing bclk in ratio of 50 times of...
Jack Yu [Mon, 4 May 2020 11:20:13 +0000 (19:20 +0800)]
ASoC: rt1015: Add condition to prevent SoC providing bclk in ratio of 50 times of sample rate.

Add condition to prevent SoC providing bclk in ratio of 50 times of sample rate.

Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/20200504112013.2499-1-jack.yu@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: rl6231: Add the K bypass for the PLL parameters
Oder Chiou [Mon, 4 May 2020 07:40:07 +0000 (15:40 +0800)]
ASoC: rl6231: Add the K bypass for the PLL parameters

The patch adds the K bypass for the PLL parameters.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Link: https://lore.kernel.org/r/20200504074007.13002-2-oder_chiou@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: adau7118: Mark the ADAU7118 reset register as volatile
Chris Garren [Mon, 4 May 2020 13:43:20 +0000 (09:43 -0400)]
ASoC: adau7118: Mark the ADAU7118 reset register as volatile

Without this the previously written value was written to this reg,
which caused the different configuration registers to be reset.

Signed-off-by: Chris Garren <cdgarren@indesign-llc.com>
Link: https://lore.kernel.org/r/1588599820-57994-1-git-send-email-cdgarren@indesign-llc.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: codecs: max9768: update contact email
Wolfram Sang [Sat, 2 May 2020 14:26:46 +0000 (16:26 +0200)]
ASoC: codecs: max9768: update contact email

The 'pengutronix' address is defunct for years. Use the proper contact
address.

Signed-off-by: Wolfram Sang <wsa@kernel.org>
Link: https://lore.kernel.org/r/20200502142646.19033-1-wsa@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: max98373: reorder max98373_reset() in resume
Yong Zhi [Fri, 1 May 2020 23:44:21 +0000 (18:44 -0500)]
ASoC: max98373: reorder max98373_reset() in resume

During S3 test, the following error was observed:

[ 726.174237] i2c_designware i2c_designware.0: platform_pm_resume+0x0/0x3d returned 0 after 0 usecs
[ 726.184187] max98373 i2c-MX98373:00: calling max98373_resume+0x0/0x30 [snd_soc_max98373] @ 12698, parent: i2c-11
[ 726.195589] max98373 i2c-MX98373:00: Reset command failed. (ret:-16)

When calling regmap_update_bits(), since map->reg_update_bits is NULL,
_regmap_read() is entered with the following logic:

if (!map->cache_bypass) {
ret = regcache_read(map, reg, val);
if (ret == 0)
return 0;
}

if (map->cache_only)
return -EBUSY;

regcache_read() hits -EINVAL because MAX98373_R2000_SW_RESET is volatile,
as map->cache_only is set by codec suspend, thus -EBUSY is returned.
Fix by moving max98373_reset() after cache_only set to false in max98373_resume().

Signed-off-by: Yong Zhi <yong.zhi@intel.com>
Link: https://lore.kernel.org/r/1588376661-29799-1-git-send-email-yong.zhi@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>