platform/kernel/linux-starfive.git
3 years agoASoC: codec: Omit superfluous error message in jz4760_codec_probe()
Tang Bin [Tue, 2 Mar 2021 13:56:30 +0000 (21:56 +0800)]
ASoC: codec: Omit superfluous error message in jz4760_codec_probe()

The function devm_platform_ioremap_resource has already contained
error message, so remove the redundant dev_err here.

Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
Acked-by: Paul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20210302135630.11456-1-tangbin@cmss.chinamobile.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoMerge series "ASoC: Intel: soc-acpi: remove unused TigerLake configurations" from...
Mark Brown [Tue, 2 Mar 2021 14:50:45 +0000 (14:50 +0000)]
Merge series "ASoC: Intel: soc-acpi: remove unused TigerLake configurations" from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

Remove two machine descriptors which were added for development on
Intel RVPs but are no longer used or productized. This will not have
any impact on end-users. The corresponding cleanup was applied in the
SOF topologies.

Pierre-Louis Bossart (2):
  ASoC: Intel: soc-acpi: remove unused TGL table with rt5682 only
  ASoC: Intel: soc-acpi: remove TGL RVP mixed SoundWire/TDM config

 .../intel/common/soc-acpi-intel-tgl-match.c   | 23 -------------------
 1 file changed, 23 deletions(-)

--
2.25.1

3 years agoMerge series "Add I2S-MCC support for Microchip's SAMA7G5" from Codrin Ciubotariu...
Mark Brown [Tue, 2 Mar 2021 14:50:44 +0000 (14:50 +0000)]
Merge series "Add I2S-MCC support for Microchip's SAMA7G5" from Codrin Ciubotariu <codrin.ciubotariu@microchip.com>:

SAMA7G5 includes an updated version of I2S-MCC, found previously on
SAM9X60. This controller includes 8 data pins, 4 for playback and 4 for
capture. For I2S and LEFT_J formats, these pins can be used to
send/receive up to 8 audio channels. For DSP_A, with TDM, any pins pair
(DIN/DOUT) from these 4 can be selected to send/receive data. This
version also includes 2 FIFOs (send and receive).
This patch set starts by moving the driver's bindings to yaml and
continues with adding a new compatible for the SAMA7G5 variant, followed
by the changes needed for I2S/LEFT_J support, TDM pin pair selection and
FIFO support, exclusively for SAMA7G5.

Changes in v2:
- moved DT binding conversion patch from the beginning to the end of the
  patch serieses
- patches that update the DT binding are modified to change .txt file
  instead of .yaml

Codrin Ciubotariu (7):
  dt-bindings: mchp,i2s-mcc: Add SAMA7G5 to binding
  ASoC: mchp-i2s-mcc: Add compatible for SAMA7G5
  ASoC: mchp-i2s-mcc: Add multi-channel support for I2S and LEFT_J
    formats
  dt-bindings: mchp,i2s-mcc: Add property to specify pin pair for TDM
  ASoC: mchp-i2s-mcc: Add support to select TDM pins
  ASoC: mchp-i2s-mcc: Add FIFOs support
  ASoC: convert Microchip I2SMCC binding to yaml

 .../bindings/sound/mchp,i2s-mcc.yaml          | 108 ++++++++++++
 .../bindings/sound/mchp-i2s-mcc.txt           |  43 -----
 sound/soc/atmel/Kconfig                       |   3 +
 sound/soc/atmel/mchp-i2s-mcc.c                | 161 +++++++++++++++---
 4 files changed, 252 insertions(+), 63 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/mchp,i2s-mcc.yaml
 delete mode 100644 Documentation/devicetree/bindings/sound/mchp-i2s-mcc.txt

--
2.27.0

3 years agoASoC: SOF: Intel: hda: enable async suspend
Ranjani Sridharan [Mon, 1 Mar 2021 17:01:57 +0000 (09:01 -0800)]
ASoC: SOF: Intel: hda: enable async suspend

The skylake driver disabled async suspend to prevent disabling
the DSP before the card was suspended during system suspend.
This code was carried over to the SOF driver. But, there is no
risk of the DSP getting disabled before the card is suspended
with the SOF driver. Therefore, it is safe to enable async suspend
and thereby optimize the system resume time.

Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20210301170157.36584-1-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: wm8524: Do not print probe defer error
Fabio Estevam [Mon, 1 Mar 2021 19:33:28 +0000 (16:33 -0300)]
ASoC: wm8524: Do not print probe defer error

On an imx8mq-evk the following error is seen:

[    1.375809] wm8524-codec audio-codec: Failed to get mute line: -517

It happens because the codec driver may probe prior to the imx gpio
driver, which causes a probe defer.

Change to dev_err_probe() to avoid printing this error.

Reported-by: Chris Healy <cphealy@gmail.com>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
Link: https://lore.kernel.org/r/20210301193328.2123511-1-festevam@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: Intel: atom: fix kernel-doc
Pierre-Louis Bossart [Mon, 1 Mar 2021 16:53:47 +0000 (10:53 -0600)]
ASoC: Intel: atom: fix kernel-doc

v5.12-rc1 flags new warnings with make W=1, fix missing or broken
function descriptors.

sound/soc/intel/atom/sst/sst_loader.c:85: warning: expecting prototype
for sst_start_merrifield(). Prototype was for sst_start_mrfld()
instead

sound/soc/intel/atom/sst/sst_acpi.c:339: warning: expecting prototype
for intel_sst_remove(). Prototype was for sst_acpi_remove() instead

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210301165349.114952-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: soc-dai: fix kernel-doc
Pierre-Louis Bossart [Mon, 1 Mar 2021 17:46:59 +0000 (11:46 -0600)]
ASoC: soc-dai: fix kernel-doc

v5.12-rc1 flags new warnings with make W=1, fix missing or broken
function descriptors.

sound/soc/soc-dai.c:167: warning: expecting prototype for
snd_soc_xlate_tdm_slot(). Prototype was for
snd_soc_xlate_tdm_slot_mask() instead

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210301174659.117122-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: codecs: nau8825: fix kernel-doc
Pierre-Louis Bossart [Mon, 1 Mar 2021 17:46:39 +0000 (11:46 -0600)]
ASoC: codecs: nau8825: fix kernel-doc

v5.12-rc1 flags new warnings with make W=1, fix missing or broken
function descriptors.

sound/soc/codecs/nau8825.c:298: warning: wrong kernel-doc identifier
on line:
 * Ramp up the headphone volume change gradually to target level.

sound/soc/codecs/nau8825.c:358: warning: expecting prototype for This
func(). Prototype was for nau8825_intlog10_dec3() instead

sound/soc/codecs/nau8825.c:411: warning: wrong kernel-doc identifier
on line:
 * computes cross talk suppression sidetone gain.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210301174639.117017-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: Intel: soc-acpi: remove TGL RVP mixed SoundWire/TDM config
Pierre-Louis Bossart [Mon, 1 Mar 2021 23:56:37 +0000 (17:56 -0600)]
ASoC: Intel: soc-acpi: remove TGL RVP mixed SoundWire/TDM config

The TGL RVP can be configured in many ways. We initially supported a
mixed configuration with RT711 in SoundWire mode and RT1308 in
TDM mode.

However Intel teams no longer have any hardware with this
configuration and there are no commercially-available devices using it
either, so let's remove this entry. The corresponding topology will
also be removed from the SOF tree.

This patch partially reverts Commit d985d208bf8f ("ASoC: Intel: common: add match tables for TGL w/ SoundWire")

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Bard Liao <bard.liao@intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Link: https://lore.kernel.org/r/20210301235637.1177525-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: Intel: soc-acpi: remove unused TGL table with rt5682 only
Pierre-Louis Bossart [Mon, 1 Mar 2021 23:56:36 +0000 (17:56 -0600)]
ASoC: Intel: soc-acpi: remove unused TGL table with rt5682 only

This patch partially reverts Commit 095ee71907ea ("ASoC: Intel: common: add match table for TGL RT5682 SoundWire driver").

This commit was added as an enabling patch before the Maxim98373 codec
driver was available. This codec is now fully functional and the
topology with only RT5682 no longer maintained or used.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Bard Liao <bard.liao@intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Link: https://lore.kernel.org/r/20210301235637.1177525-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: mchp, i2s-mcc: Add property to specify pin pair for TDM
Codrin Ciubotariu [Mon, 1 Mar 2021 17:09:02 +0000 (19:09 +0200)]
ASoC: mchp, i2s-mcc: Add property to specify pin pair for TDM

SAMA7G5's I2S-MCC has 4 pairs of DIN/DOUT pins. Since TDM only uses a
single pair of pins for synchronous capture and playback, the controller
needs to be told which of the pair is connected. This can be mentioned
using the new "microchip,tdm-data-pair" property. The property is optional,
needed only if TDM is used, and if it's missing DIN/DOUT 0 pins will be
used by default.

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Link: https://lore.kernel.org/r/20210301170905.835091-5-codrin.ciubotariu@microchip.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: mchp,i2s-mcc: Add SAMA7G5 to binding
Codrin Ciubotariu [Mon, 1 Mar 2021 17:08:59 +0000 (19:08 +0200)]
ASoC: mchp,i2s-mcc: Add SAMA7G5 to binding

SAMA7G5 includes an updated version of the I2S-MCC driver, that includes
3 more DIN/DOUT pin pairs for multi-channel.

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Link: https://lore.kernel.org/r/20210301170905.835091-2-codrin.ciubotariu@microchip.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: mchp-i2s-mcc: Add FIFOs support
Codrin Ciubotariu [Mon, 1 Mar 2021 17:09:04 +0000 (19:09 +0200)]
ASoC: mchp-i2s-mcc: Add FIFOs support

I2S-MCC found on SAMA7G5 includes 2 FIFOs (capture and playback). When
FIFOs are enabled, bits I2SMCC_ISRA.TXLRDYx and I2SMCC_ISRA.TXRRDYx must
not be used. Bits I2SMCC_ISRB.TXFFRDY and I2SMCC_ISRB.RXFFRDY must be used
instead.

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Link: https://lore.kernel.org/r/20210301170905.835091-7-codrin.ciubotariu@microchip.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: mchp-i2s-mcc: Add support to select TDM pins
Codrin Ciubotariu [Mon, 1 Mar 2021 17:09:03 +0000 (19:09 +0200)]
ASoC: mchp-i2s-mcc: Add support to select TDM pins

SAMA7G5's I2S-MCC has 4 pairs of DIN/DOUT pins. Since TDM only uses a
single pair of pins for synchronous capture and playback, the controller
needs to be told which of the pair is connected. This can be mentioned
using the "microchip,tdm-data-pair" property from DT. The property is
optional, useful only if TDM is used. If it's missing, DIN/DOUT 0 pins
will be used by default.

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Link: https://lore.kernel.org/r/20210301170905.835091-6-codrin.ciubotariu@microchip.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: mchp-i2s-mcc: Add multi-channel support for I2S and LEFT_J formats
Codrin Ciubotariu [Mon, 1 Mar 2021 17:09:01 +0000 (19:09 +0200)]
ASoC: mchp-i2s-mcc: Add multi-channel support for I2S and LEFT_J formats

The latest I2S-MCC available in SAMA7G5 supports multi-channel for I2S and
Left-Justified formats. For this, the new version uses 8 (4 * 2) input and
output pins, with each pin being responsible for 2 channels. This sums up
to a total of 8 channels for synchronous capture and playback.

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Link: https://lore.kernel.org/r/20210301170905.835091-4-codrin.ciubotariu@microchip.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: mchp-i2s-mcc: Add compatible for SAMA7G5
Codrin Ciubotariu [Mon, 1 Mar 2021 17:09:00 +0000 (19:09 +0200)]
ASoC: mchp-i2s-mcc: Add compatible for SAMA7G5

Microchip's new SAMA7G5 includes an updated I2S-MCC compatible with the
previous version found on SAM9X60. The new controller includes 8 (4 * 2)
input and output data pins for up to 8 channels for I2S and Left-Justified
formats.

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Link: https://lore.kernel.org/r/20210301170905.835091-3-codrin.ciubotariu@microchip.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoMerge series "ASoC: rsnd: cleanup ppcheck warning for Renesas sound driver" from...
Mark Brown [Mon, 1 Mar 2021 23:31:55 +0000 (23:31 +0000)]
Merge series "ASoC: rsnd: cleanup ppcheck warning for Renesas sound driver" from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:

Hi Mark, Pierre-Louis

These patches are based on below patch-set which from Pierre-Louis,
and cleanup cppcheck warnings for Rensas sound driver.
[3/5] has Reported-by Pierre-Louis tag.

Subject: [PATCH 0/8] ASoC: sh: remove cppcheck warnings
Date: Fri, 19 Feb 2021 17:16:27 -0600

Kuninori Morimoto (5):
  ASoC: rsnd: cleanup ppcheck warning for ssiu.c
  ASoC: rsnd: cleanup ppcheck warning for ssi.c
  ASoC: rsnd: cleanup ppcheck warning for core.c
  ASoC: rsnd: cleanup ppcheck warning for cmd.c
  ASoC: rsnd: cleanup ppcheck warning for adg.c

 sound/soc/sh/rcar/adg.c  | 15 +++++++-------
 sound/soc/sh/rcar/cmd.c  | 15 +++++++-------
 sound/soc/sh/rcar/core.c | 32 +++++++++++++---------------
 sound/soc/sh/rcar/ssi.c  | 45 ++++++++++++++++++++--------------------
 sound/soc/sh/rcar/ssiu.c | 22 +++++++++++---------
 5 files changed, 64 insertions(+), 65 deletions(-)

--
2.25.1

3 years agoMerge series "drop unneeded snd_soc_dai_set_drvdata" from Julia Lawall <Julia.Lawall...
Mark Brown [Mon, 1 Mar 2021 23:31:53 +0000 (23:31 +0000)]
Merge series "drop unneeded snd_soc_dai_set_drvdata" from Julia Lawall <Julia.Lawall@inria.fr>:

snd_soc_dai_set_drvdata is not needed when the set data comes from
snd_soc_dai_get_drvdata or dev_get_drvdata.

---

 sound/soc/fsl/fsl_micfil.c  |    2 --
 sound/soc/fsl/fsl_sai.c     |    2 --
 sound/soc/fsl/fsl_xcvr.c    |    1 -
 sound/soc/mxs/mxs-saif.c    |   10 ----------
 sound/soc/pxa/mmp-sspa.c    |    1 -
 sound/soc/sunxi/sun4i-i2s.c |    2 --
 6 files changed, 18 deletions(-)

3 years agoMerge series "ASoC: sh: remove cppcheck warnings" from Pierre-Louis Bossart <pierre...
Mark Brown [Mon, 1 Mar 2021 23:31:52 +0000 (23:31 +0000)]
Merge series "ASoC: sh: remove cppcheck warnings" from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

No functional changes except for patch 4 where a missing error check
was added for consistency.

Pierre-Louis Bossart (8):
  ASoC: sh: dma-sh7760: remove unused variable
  ASoC: sh: rcar: align function prototypes
  ASoC: sh: rcar: simplify return
  ASoC: sh: rcar: core: rename shadowing variables
  ASoC: sh: rcar: ctu: add  missing error check
  ASoC: sh: rcar: ssi: remove redundant assignment
  ASoC: sh: siu_pcm: remove useless assignment
  ASoC: sh: siu_pcm: remove unused variable

 sound/soc/sh/dma-sh7760.c |  1 -
 sound/soc/sh/rcar/core.c  | 14 +++++++-------
 sound/soc/sh/rcar/ctu.c   |  2 ++
 sound/soc/sh/rcar/rsnd.h  |  6 +++---
 sound/soc/sh/rcar/ssi.c   |  1 -
 sound/soc/sh/siu_pcm.c    |  6 +-----
 6 files changed, 13 insertions(+), 17 deletions(-)

--
2.25.1

3 years agoMerge series "ASoC: core: remove cppcheck warnings" from Pierre-Louis Bossart <pierre...
Mark Brown [Mon, 1 Mar 2021 23:31:51 +0000 (23:31 +0000)]
Merge series "ASoC: core: remove cppcheck warnings" from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

This is the first batch of cleanups to make cppcheck more usable,
currently we have way too many warnings that drown real issues.

Pierre-Louis Bossart (6):
  ASoC: soc-ops: remove useless assignment
  ASoC: soc-pcm: remove redundant assignment
  ASoC: soc-pcm: remove shadowing variable
  ASoC: soc-pcm: add error log
  ASoC: soc-topology: clarify expression
  ASoC: generic: simple-card-utils: remove useless assignment

 sound/soc/generic/simple-card-utils.c |  2 +-
 sound/soc/soc-ops.c                   |  2 +-
 sound/soc/soc-pcm.c                   |  4 ++--
 sound/soc/soc-topology.c              | 16 ++++++++--------
 4 files changed, 12 insertions(+), 12 deletions(-)

--
2.25.1

3 years agoMerge series "ASoC: samsung: remove cppcheck warnings" from Pierre-Louis Bossart...
Mark Brown [Mon, 1 Mar 2021 23:31:50 +0000 (23:31 +0000)]
Merge series "ASoC: samsung: remove cppcheck warnings" from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

No functional changes except for patch 2 and 3 where missing error
checks were added for consistency.

Pierre-Louis Bossart (6):
  ASoC: samsung: i2s: remove unassigned variable
  ASoC: samsung: s3c24xx_simtec: add missing error check
  ASoC: samsung: smdk_wm8994: add missing return
  ASoC: samsung: snow: remove useless test
  ASoC: samsung: tm2_wm5110: check of_parse return value
  ASoC: samsung: tm2_wm5510: remove shadowing variable

 sound/soc/samsung/i2s.c            | 3 +--
 sound/soc/samsung/s3c24xx_simtec.c | 5 +++++
 sound/soc/samsung/smdk_wm8994.c    | 1 +
 sound/soc/samsung/snow.c           | 5 +----
 sound/soc/samsung/tm2_wm5110.c     | 3 +--
 5 files changed, 9 insertions(+), 8 deletions(-)

--
2.25.1

3 years agoMerge series "soc-pcm: tidyup snd_pcm_hardware setup for FE/BE" from Kuninori Morimot...
Mark Brown [Mon, 1 Mar 2021 23:31:49 +0000 (23:31 +0000)]
Merge series "soc-pcm: tidyup snd_pcm_hardware setup for FE/BE" from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:

Hi Mark

These patches tidyup snd_pcm_hardware setup for FE/BE.
[1/5] changes behavior, but I think it is bug-fix.

Kuninori Morimoto (5):
  ASoC: soc-pcm: remove strange format storing
  ASoC: soc-pcm: unpack dpcm_init_runtime_hw()
  ASoC: soc-pcm: add dpcm_runtime_setup_fe()
  ASoC: soc-pcm: add dpcm_runtime_setup()
  ASoC: soc-pcm: unpack dpcm_set_fe_runtime()

 sound/soc/soc-pcm.c | 79 +++++++++++++++++++++------------------------
 1 file changed, 36 insertions(+), 43 deletions(-)

--
2.25.1

3 years agoMerge series "ASoC: fsl: remove cppcheck warnings" from Pierre-Louis Bossart <pierre...
Mark Brown [Mon, 1 Mar 2021 23:31:48 +0000 (23:31 +0000)]
Merge series "ASoC: fsl: remove cppcheck warnings" from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

Nothing critical and no functional changes.

The only change that needs attention if the 'fsl_ssi: remove
unnecessary tests' patch, where variables are to zero, then tested to
set register fields. Either the tests are indeed redundant or the
entire programming sequence is incorrect.

Pierre-Louis Bossart (9):
  ASoC: fsl: fsl_asrc: remove useless assignment
  ASoC: fsl: fsl_dma: remove unused variable
  ASoC: fsl: fsl_easrc: remove useless assignments
  ASoC: fsl: fsl_esai: clarify expression
  ASoC: fsl: fsl_ssi: remove unnecessary tests
  ASoC: fsl: imx-hdmi: remove unused structure members
  ASoC: fsl: mpc5200: signed parameter in snprintf format
  ASoC: fsl: mpc8610: remove useless assignment
  ASoC: fsl: p1022_ds: remove useless assignment

 sound/soc/fsl/fsl_asrc.c     | 2 +-
 sound/soc/fsl/fsl_dma.c      | 3 ---
 sound/soc/fsl/fsl_easrc.c    | 6 +++---
 sound/soc/fsl/fsl_esai.c     | 2 +-
 sound/soc/fsl/fsl_ssi.c      | 5 ++---
 sound/soc/fsl/imx-hdmi.c     | 4 ----
 sound/soc/fsl/mpc5200_dma.c  | 2 +-
 sound/soc/fsl/mpc8610_hpcd.c | 2 +-
 sound/soc/fsl/p1022_ds.c     | 2 +-
 9 files changed, 10 insertions(+), 18 deletions(-)

--
2.25.1

3 years agoMerge series "ASoC: rt*: Constify static structs" from Rikard Falkeborn <rikard.falke...
Mark Brown [Mon, 1 Mar 2021 23:31:47 +0000 (23:31 +0000)]
Merge series "ASoC: rt*: Constify static structs" from Rikard Falkeborn <rikard.falkeborn@gmail.com>:

Constify a number of static structs that are never modified in RealTek
codecs. The most important patches are the first two, which constifies
snd_soc_dai_ops and sdw_slave_ops, both which contain function pointers.
The other two patches are for good measure, since I was already touching
the code there.

When doing this, I discovered sound/soc/codecs/rt1016.c is not in a
Makefile, so there is not really any way to build it (I added locally to
the Makefile to compile-test my changes). Is this expected or an oversight?

Rikard Falkeborn (4):
  ASoC: rt*: Constify static struct sdw_slave_ops
  ASoC: rt*: Constify static struct snd_soc_dai_ops
  ASoC: rt*: Constify static struct acpi_device_id
  ASoc: rt5631: Constify static struct coeff_clk_div

 sound/soc/codecs/rt1011.c     | 2 +-
 sound/soc/codecs/rt1015.c     | 4 ++--
 sound/soc/codecs/rt1016.c     | 4 ++--
 sound/soc/codecs/rt1305.c     | 2 +-
 sound/soc/codecs/rt1308-sdw.c | 2 +-
 sound/soc/codecs/rt1308.c     | 2 +-
 sound/soc/codecs/rt5631.c     | 2 +-
 sound/soc/codecs/rt5682-sdw.c | 4 ++--
 sound/soc/codecs/rt700-sdw.c  | 2 +-
 sound/soc/codecs/rt700.c      | 2 +-
 sound/soc/codecs/rt711-sdw.c  | 2 +-
 sound/soc/codecs/rt711.c      | 2 +-
 sound/soc/codecs/rt715-sdw.c  | 2 +-
 sound/soc/codecs/rt715.c      | 2 +-
 14 files changed, 17 insertions(+), 17 deletions(-)

--
2.30.1

3 years agoMerge series "ASoC: qcom: remove cppcheck warnings" from Pierre-Louis Bossart <pierre...
Mark Brown [Mon, 1 Mar 2021 23:31:46 +0000 (23:31 +0000)]
Merge series "ASoC: qcom: remove cppcheck warnings" from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

Second batch of cleanups for Qualcomm SOCs and codecs. The only
functional change is the addition of a missing error check in the last
patch.

Pierre-Louis Bossart (10):
  ASoC: qcom: lpass-hdmi: remove useless return
  ASoC: qcom: lpass-platform: remove useless assignment
  ASoC: qcom: q6dsp-dai: clarify expression
  ASoC: qcom: q6afe: remove useless assignments
  ASoC: qcom: q6afe: align function prototype
  ASoC: qcom: q6asm: align function prototypes
  ASoC: wcd-clsh-v2: align function prototypes
  ASoC: wcd9335: clarify return value
  ASoC: wcd934x: remove useless return
  ASoC: lpass-wsa-macro: add missing test

 sound/soc/codecs/lpass-wsa-macro.c | 2 ++
 sound/soc/codecs/wcd-clsh-v2.h     | 6 +++---
 sound/soc/codecs/wcd9335.c         | 2 +-
 sound/soc/codecs/wcd934x.c         | 2 --
 sound/soc/qcom/lpass-hdmi.c        | 4 ----
 sound/soc/qcom/lpass-platform.c    | 2 +-
 sound/soc/qcom/qdsp6/q6afe-dai.c   | 2 +-
 sound/soc/qcom/qdsp6/q6afe.c       | 5 ++---
 sound/soc/qcom/qdsp6/q6afe.h       | 2 +-
 sound/soc/qcom/qdsp6/q6asm.h       | 6 +++---
 10 files changed, 14 insertions(+), 19 deletions(-)

--
2.25.1

3 years agoASoC: rt1316: Add RT1316 SDCA vendor-specific driver
Shuming Fan [Tue, 23 Feb 2021 09:07:59 +0000 (17:07 +0800)]
ASoC: rt1316: Add RT1316 SDCA vendor-specific driver

This is the initial amplifier driver for rt1316 SDCA version.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20210223090759.15323-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: Intel: Skylake: Compile when any configuration is selected
Cezary Rojewski [Mon, 25 Jan 2021 11:54:41 +0000 (12:54 +0100)]
ASoC: Intel: Skylake: Compile when any configuration is selected

Skylake is dependent on SND_SOC_INTEL_SKYLAKE (aka "all SST platforms")
whereas selecting specific configuration such as KBL-only will not
cause driver code to compile. Switch to SND_SOC_INTEL_SKYLAKE_COMMON
dependency so selecting any configuration causes the driver to be built.

Reported-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Suggested-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Fixes: 35bc99aaa1a3 ("ASoC: Intel: Skylake: Add more platform granularity")
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20210125115441.10383-1-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: fsl_xcvr: move reset assert into runtime_resume
Viorel Suman [Mon, 22 Feb 2021 09:09:50 +0000 (17:09 +0800)]
ASoC: fsl_xcvr: move reset assert into runtime_resume

Move reset assert into runtime_resume since we
cannot rely on reset assert state when the device
is put out from suspend.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1613984990-5534-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: SOF: Intel: hda: turn off display power in resume
Kai Vehmanen [Wed, 24 Feb 2021 14:15:41 +0000 (16:15 +0200)]
ASoC: SOF: Intel: hda: turn off display power in resume

Turn off display power at the end of controller resume flow. This is now
possible with the changes done in commit 87fc20e4a0cb ("ASoC: SOF:
Intel: hda: use hdac_ext fine-grained link management"). As codec driver
is able to request the HDA link to be brought back up, the controller
no longer needs to blindly keep display power enabled.

Co-developed-by: Sathyanarayana Nujella <sathyanarayana.nujella@intel.com>
Signed-off-by: Sathyanarayana Nujella <sathyanarayana.nujella@intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Keyon Jie <yang.jie@intel.com>
Link: https://lore.kernel.org/r/20210224141541.3331254-1-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: Intel: boards: sof-wm8804: add check for PLL setting
Colin Ian King [Fri, 26 Feb 2021 18:56:53 +0000 (18:56 +0000)]
ASoC: Intel: boards: sof-wm8804: add check for PLL setting

Currently the return from snd_soc_dai_set_pll is not checking for
failure, this is the only driver in the kernel that ignores this,
so it probably should be added for sake of completeness.  Fix this
by adding an error return check.

Addresses-Coverity: ("Unchecked return value")
Fixes: f139546fb7d4 ("ASoC: Intel: boards: sof-wm8804: support for Hifiberry Digiplus boards")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210226185653.1071321-1-colin.king@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: codecs: lpass-rx-macro: remove redundant initialization of variable hph_pwr_mode
Colin Ian King [Mon, 15 Feb 2021 20:05:01 +0000 (20:05 +0000)]
ASoC: codecs: lpass-rx-macro: remove redundant initialization of variable hph_pwr_mode

The variable hph_pwr_mode is being initialized with a value that is
never read and it is being updated later with a new value.  The
initialization is redundant and can be removed.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210215200501.90697-1-colin.king@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: fsl_sai: Add pm qos cpu latency support
Shengjiu Wang [Mon, 22 Feb 2021 08:40:20 +0000 (16:40 +0800)]
ASoC: fsl_sai: Add pm qos cpu latency support

On SoCs such as i.MX7ULP, cpuidle has some levels which
may disable system/bus clocks, so need to add pm_qos to
prevent cpuidle from entering low level idles and make sure
system/bus clocks are enabled when sai is active.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1613983220-5373-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: uniphier: Simplify the return expression of uniphier_aio_startup
dingsenjie [Wed, 24 Feb 2021 08:54:07 +0000 (16:54 +0800)]
ASoC: uniphier: Simplify the return expression of uniphier_aio_startup

Simplify the return expression in the aio-cpu.c.

Signed-off-by: dingsenjie <dingsenjie@yulong.com>
Link: https://lore.kernel.org/r/20210224085407.22120-1-dingsenjie@163.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: constify of_phandle_args in snd_soc_get_dai_name()
Krzysztof Kozlowski [Sun, 21 Feb 2021 15:30:24 +0000 (16:30 +0100)]
ASoC: constify of_phandle_args in snd_soc_get_dai_name()

The pointer to of_phandle_args passed to snd_soc_get_dai_name() and
of_xlate_dai_name() implementations is not modified.  Since it is being
used only to translate passed OF node to a DAI name, it should not be
modified, so mark it as const for correctness and safer code.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://lore.kernel.org/r/20210221153024.453583-1-krzk@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: rsnd: cleanup ppcheck warning for adg.c
Kuninori Morimoto [Thu, 25 Feb 2021 00:25:23 +0000 (09:25 +0900)]
ASoC: rsnd: cleanup ppcheck warning for adg.c

This patch cleanups below ppcheck warning.

sound/soc/sh/rcar/adg.c:67:9: style: The scope of the variable 'ratio' can be reduced. [variableScope]
 int i, ratio;
        ^
sound/soc/sh/rcar/adg.c:114:6: style: The scope of the variable 'idx' can be reduced. [variableScope]
 int idx, sel, div, step;
     ^
sound/soc/sh/rcar/adg.c:114:21: style: The scope of the variable 'step' can be reduced. [variableScope]
 int idx, sel, div, step;
                    ^
sound/soc/sh/rcar/adg.c:397:14: style: The scope of the variable 'clk' can be reduced. [variableScope]
 struct clk *clk;
             ^

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87ft1lro24.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: rsnd: cleanup ppcheck warning for cmd.c
Kuninori Morimoto [Thu, 25 Feb 2021 00:25:19 +0000 (09:25 +0900)]
ASoC: rsnd: cleanup ppcheck warning for cmd.c

This patch cleanups below ppcheck warning.

sound/soc/sh/rcar/cmd.c:46:20: style: The scope of the variable 'src' can be reduced. [variableScope]
  struct rsnd_mod *src;
                   ^
sound/soc/sh/rcar/cmd.c:47:27: style: The scope of the variable 'tio' can be reduced. [variableScope]
  struct rsnd_dai_stream *tio;
                          ^
sound/soc/sh/rcar/cmd.c:145:13: style: The scope of the variable 'ret' can be reduced. [variableScope]
 int i, nr, ret;
            ^

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87h7m1ro28.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: rsnd: cleanup ppcheck warning for core.c
Kuninori Morimoto [Thu, 25 Feb 2021 00:25:14 +0000 (09:25 +0900)]
ASoC: rsnd: cleanup ppcheck warning for core.c

This patch cleanups below ppcheck warning.

sound/soc/sh/rcar/core.c:233:26: style: The scope of the variable 'io' can be reduced. [variableScope]
 struct rsnd_dai_stream *io;
                         ^
sound/soc/sh/rcar/core.c:489:19: style: The scope of the variable 'mod' can be reduced. [variableScope]
 struct rsnd_mod *mod;
                  ^
sound/soc/sh/rcar/core.c:1064:9: style: The scope of the variable 'j' can be reduced. [variableScope]
 int i, j;
        ^
sound/soc/sh/rcar/core.c:1143:19: style: The scope of the variable 'mod' can be reduced. [variableScope]
 struct rsnd_mod *mod;
                  ^
sound/soc/sh/rcar/core.c:1261:22: style: The scope of the variable 'playback' can be reduced. [variableScope]
 struct device_node *playback, *capture;
                     ^
sound/soc/sh/rcar/core.c:1261:33: style: The scope of the variable 'capture' can be reduced. [variableScope]
 struct device_node *playback, *capture;
                                ^
sound/soc/sh/rcar/core.c:1419:29: style: The scope of the variable 'be_params' can be reduced. [variableScope]
  struct snd_pcm_hw_params *be_params;
                            ^
sound/soc/sh/rcar/core.c:1369:22: style: Local variable 'rdai' shadows outer variable [shadowVariable]
    struct rsnd_dai *rdai = rsnd_rdai_get(priv, dai_i);
                     ^
sound/soc/sh/rcar/core.c:1338:19: note: Shadowed declaration
 struct rsnd_dai *rdai;
                  ^
sound/soc/sh/rcar/core.c:1369:22: note: Shadow variable
    struct rsnd_dai *rdai = rsnd_rdai_get(priv, dai_i);
                     ^
sound/soc/sh/rcar/core.c:1380:22: style: Local variable 'rdai' shadows outer variable [shadowVariable]
    struct rsnd_dai *rdai = rsnd_rdai_get(priv, dai_i);
                     ^

Reported-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87im6hro2d.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: rsnd: cleanup ppcheck warning for ssi.c
Kuninori Morimoto [Thu, 25 Feb 2021 00:25:08 +0000 (09:25 +0900)]
ASoC: rsnd: cleanup ppcheck warning for ssi.c

This patch cleanups below ppcheck warning.

sound/soc/sh/rcar/ssi.c:170:19: style: The scope of the variable 'mod' can be reduced. [variableScope]
 struct rsnd_mod *mod;
                  ^
sound/soc/sh/rcar/ssi.c:535:6: style: The scope of the variable 'i' can be reduced. [variableScope]
 int i;
     ^
sound/soc/sh/rcar/ssi.c:1212:19: style: The scope of the variable 'mod' can be reduced. [variableScope]
 struct rsnd_mod *mod;
                  ^
sound/soc/sh/rcar/ssi.c:328:16: portability: Shifting signed 32-bit value by 31 bits is implementation-defined behaviour [shiftTooManyBitsSigned]
 ssi->cr_clk = FORCE | rsnd_rdai_width_to_swl(rdai) |
               ^
sound/soc/sh/rcar/ssi.c:387:12: portability: Shifting signed 32-bit value by 31 bits is implementation-defined behaviour [shiftTooManyBitsSigned]
 cr_own |= FORCE | rsnd_rdai_width_to_swl(rdai);
           ^

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87k0qxro2j.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: rsnd: cleanup ppcheck warning for ssiu.c
Kuninori Morimoto [Thu, 25 Feb 2021 00:25:02 +0000 (09:25 +0900)]
ASoC: rsnd: cleanup ppcheck warning for ssiu.c

This patch cleanups below ppcheck warning.

sound/soc/sh/rcar/ssiu.c:212:10: style: The scope of the variable 'shift' can be reduced. [variableScope]
  int i, shift;
         ^
sound/soc/sh/rcar/ssiu.c:337:19: style: The scope of the variable 'mod' can be reduced. [variableScope]
 struct rsnd_mod *mod;
                  ^
sound/soc/sh/rcar/ssiu.c:362:22: style: The scope of the variable 'np' can be reduced. [variableScope]
 struct device_node *np;
                     ^
sound/soc/sh/rcar/ssiu.c:363:19: style: The scope of the variable 'mod' can be reduced. [variableScope]
 struct rsnd_mod *mod;
                  ^
sound/soc/sh/rcar/ssiu.c:366:6: style: The scope of the variable 'i' can be reduced. [variableScope]
 int i;
     ^
sound/soc/sh/rcar/ssiu.c:397:13: style: The scope of the variable 'ret' can be reduced. [variableScope]
 int i, nr, ret;
            ^

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87lfbdro2p.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: fsl: drop unneeded snd_soc_dai_set_drvdata
Julia Lawall [Sat, 13 Feb 2021 10:19:07 +0000 (11:19 +0100)]
ASoC: fsl: drop unneeded snd_soc_dai_set_drvdata

snd_soc_dai_set_drvdata is not needed when the set data comes from
snd_soc_dai_get_drvdata or dev_get_drvdata.  The problem was fixed
usingthe following semantic patch: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression x,y,e;
@@
x = dev_get_drvdata(y->dev)
... when != x = e
- snd_soc_dai_set_drvdata(y,x);

@@
expression x,y,e;
@@
x = snd_soc_dai_get_drvdata(y)
... when != x = e
- snd_soc_dai_set_drvdata(y,x);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Link: https://lore.kernel.org/r/20210213101907.1318496-5-Julia.Lawall@inria.fr
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: sun4i-i2s: drop unneeded snd_soc_dai_set_drvdata
Julia Lawall [Sat, 13 Feb 2021 10:19:06 +0000 (11:19 +0100)]
ASoC: sun4i-i2s: drop unneeded snd_soc_dai_set_drvdata

snd_soc_dai_set_drvdata is not needed when the set data comes from
snd_soc_dai_get_drvdata or dev_get_drvdata.  The problem was fixed
usingthe following semantic patch: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression x,y,e;
@@
x = dev_get_drvdata(y->dev)
... when != x = e
- snd_soc_dai_set_drvdata(y,x);

@@
expression x,y,e;
@@
x = snd_soc_dai_get_drvdata(y)
... when != x = e
- snd_soc_dai_set_drvdata(y,x);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Link: https://lore.kernel.org/r/20210213101907.1318496-4-Julia.Lawall@inria.fr
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: mxs-saif: drop unneeded snd_soc_dai_set_drvdata
Julia Lawall [Sat, 13 Feb 2021 10:19:05 +0000 (11:19 +0100)]
ASoC: mxs-saif: drop unneeded snd_soc_dai_set_drvdata

snd_soc_dai_set_drvdata is not needed when the set data comes from
snd_soc_dai_get_drvdata or dev_get_drvdata.  The problem was fixed
usingthe following semantic patch: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression x,y,e;
@@
x = dev_get_drvdata(y->dev)
... when != x = e
- snd_soc_dai_set_drvdata(y,x);

@@
expression x,y,e;
@@
x = snd_soc_dai_get_drvdata(y)
... when != x = e
- snd_soc_dai_set_drvdata(y,x);
// </smpl>

In this case, the whole probe function then does nothing, so drop it.

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Link: https://lore.kernel.org/r/20210213101907.1318496-3-Julia.Lawall@inria.fr
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: mmp-sspa: drop unneeded snd_soc_dai_set_drvdata
Julia Lawall [Sat, 13 Feb 2021 10:19:04 +0000 (11:19 +0100)]
ASoC: mmp-sspa: drop unneeded snd_soc_dai_set_drvdata

snd_soc_dai_set_drvdata is not needed when the set data comes from
snd_soc_dai_get_drvdata or dev_get_drvdata.  The problem was fixed
usingthe following semantic patch: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression x,y,e;
@@
x = dev_get_drvdata(y->dev)
... when != x = e
- snd_soc_dai_set_drvdata(y,x);

@@
expression x,y,e;
@@
x = snd_soc_dai_get_drvdata(y)
... when != x = e
- snd_soc_dai_set_drvdata(y,x);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Link: https://lore.kernel.org/r/20210213101907.1318496-2-Julia.Lawall@inria.fr
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: sh: siu_pcm: remove unused variable
Pierre-Louis Bossart [Fri, 19 Feb 2021 23:16:35 +0000 (17:16 -0600)]
ASoC: sh: siu_pcm: remove unused variable

cppcheck warning:

sound/soc/sh/siu_pcm.c:225:8: style: Variable 'virt' is assigned a
value that is never used. [unreadVariable]

  virt = PERIOD_OFFSET(rt->dma_area,
       ^

It's not clear what this variable was needed for, remove it.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210219231635.5749-9-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: sh: siu_pcm: remove useless assignment
Pierre-Louis Bossart [Fri, 19 Feb 2021 23:16:34 +0000 (17:16 -0600)]
ASoC: sh: siu_pcm: remove useless assignment

cppcheck warning:

sound/soc/sh/siu_pcm.c:375:5: style: Redundant initialization for
'rt'. The initialized value is overwritten before it is
read. [redundantInitialization]

 rt = siu_stream->substream->runtime;
    ^
sound/soc/sh/siu_pcm.c:366:30: note: rt is initialized
 struct snd_pcm_runtime  *rt = ss->runtime;
                             ^
sound/soc/sh/siu_pcm.c:375:5: note: rt is overwritten
 rt = siu_stream->substream->runtime;
    ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210219231635.5749-8-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: sh: rcar: ssi: remove redundant assignment
Pierre-Louis Bossart [Fri, 19 Feb 2021 23:16:33 +0000 (17:16 -0600)]
ASoC: sh: rcar: ssi: remove redundant assignment

cppcheck warning:

sound/soc/sh/rcar/ssi.c:403:6: style: Redundant initialization for
'wsr'. The initialized value is overwritten before it is
read. [redundantInitialization]
 wsr = ssi->wsr;
     ^
sound/soc/sh/rcar/ssi.c:372:11: note: wsr is initialized
 u32 wsr  = ssi->wsr;
          ^
sound/soc/sh/rcar/ssi.c:403:6: note: wsr is overwritten
 wsr = ssi->wsr;
     ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210219231635.5749-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: sh: rcar: ctu: add missing error check
Pierre-Louis Bossart [Fri, 19 Feb 2021 23:16:32 +0000 (17:16 -0600)]
ASoC: sh: rcar: ctu: add missing error check

cppcheck warning:

sound/soc/sh/rcar/ctu.c:212:6: style: Variable 'ret' is reassigned a
value before the old one has been used. [redundantAssignment]
 ret = rsnd_kctrl_new_m(mod, io, rtd, "CTU SV0",
     ^
sound/soc/sh/rcar/ctu.c:205:6: note: ret is assigned
 ret = rsnd_kctrl_new_m(mod, io, rtd, "CTU Pass",
     ^
sound/soc/sh/rcar/ctu.c:212:6: note: ret is overwritten
 ret = rsnd_kctrl_new_m(mod, io, rtd, "CTU SV0",
     ^

All the kcontrol creations are checked for errors, except for one. Add
the missing error check.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210219231635.5749-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: sh: rcar: simplify return
Pierre-Louis Bossart [Fri, 19 Feb 2021 23:16:30 +0000 (17:16 -0600)]
ASoC: sh: rcar: simplify return

cppcheck warning:

sound/soc/sh/rcar/core.c:219:9: warning: Identical condition and
return expression 'ret', return value is always 0
[identicalConditionAfterEarlyExit]
 return ret;
        ^
sound/soc/sh/rcar/core.c:210:6: note: If condition 'ret' is true, the
function will return/exit
 if (ret)
     ^
sound/soc/sh/rcar/core.c:219:9: note: Returning identical expression
'ret'
 return ret;
        ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210219231635.5749-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: sh: rcar: align function prototypes
Pierre-Louis Bossart [Fri, 19 Feb 2021 23:16:29 +0000 (17:16 -0600)]
ASoC: sh: rcar: align function prototypes

cppcheck warnings:

sound/soc/sh/rcar/adg.c:208:51: style:inconclusive: Function
'rsnd_adg_set_cmd_timsel_gen2' argument 1 names different: declaration
'mod' definition 'cmd_mod'. [funcArgNamesDifferent]
int rsnd_adg_set_cmd_timsel_gen2(struct rsnd_mod *cmd_mod,
                                                  ^
sound/soc/sh/rcar/rsnd.h:608:51: note: Function
'rsnd_adg_set_cmd_timsel_gen2' argument 1 names different: declaration
'mod' definition 'cmd_mod'.
int rsnd_adg_set_cmd_timsel_gen2(struct rsnd_mod *mod,
                                                  ^
sound/soc/sh/rcar/adg.c:208:51: note: Function
'rsnd_adg_set_cmd_timsel_gen2' argument 1 names different: declaration
'mod' definition 'cmd_mod'.
int rsnd_adg_set_cmd_timsel_gen2(struct rsnd_mod *cmd_mod,
                                                  ^
sound/soc/sh/rcar/adg.c:322:44: style:inconclusive: Function
'rsnd_adg_ssi_clk_stop' argument 1 names different: declaration 'mod'
definition 'ssi_mod'. [funcArgNamesDifferent]
int rsnd_adg_ssi_clk_stop(struct rsnd_mod *ssi_mod)
                                           ^
sound/soc/sh/rcar/rsnd.h:600:44: note: Function
'rsnd_adg_ssi_clk_stop' argument 1 names different: declaration 'mod'
definition 'ssi_mod'.
int rsnd_adg_ssi_clk_stop(struct rsnd_mod *mod);
                                           ^
sound/soc/sh/rcar/adg.c:322:44: note: Function 'rsnd_adg_ssi_clk_stop'
argument 1 names different: declaration 'mod' definition 'ssi_mod'.
int rsnd_adg_ssi_clk_stop(struct rsnd_mod *ssi_mod)
                                           ^
sound/soc/sh/rcar/adg.c:329:49: style:inconclusive: Function
'rsnd_adg_ssi_clk_try_start' argument 1 names different: declaration
'mod' definition 'ssi_mod'. [funcArgNamesDifferent]
int rsnd_adg_ssi_clk_try_start(struct rsnd_mod *ssi_mod, unsigned int rate)
                                                ^
sound/soc/sh/rcar/rsnd.h:601:49: note: Function
'rsnd_adg_ssi_clk_try_start' argument 1 names different: declaration
'mod' definition 'ssi_mod'.
int rsnd_adg_ssi_clk_try_start(struct rsnd_mod *mod, unsigned int rate);
                                                ^
sound/soc/sh/rcar/adg.c:329:49: note: Function
'rsnd_adg_ssi_clk_try_start' argument 1 names different: declaration
'mod' definition 'ssi_mod'.
int rsnd_adg_ssi_clk_try_start(struct rsnd_mod *ssi_mod, unsigned int rate)
                                                ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210219231635.5749-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: sh: dma-sh7760: remove unused variable
Pierre-Louis Bossart [Fri, 19 Feb 2021 23:16:28 +0000 (17:16 -0600)]
ASoC: sh: dma-sh7760: remove unused variable

cppcheck warning:

sound/soc/sh/dma-sh7760.c:180:6: style: Unused variable: ret
[unusedVariable]
 int ret;
     ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210219231635.5749-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: generic: simple-card-utils: remove useless assignment
Pierre-Louis Bossart [Thu, 18 Feb 2021 22:19:21 +0000 (16:19 -0600)]
ASoC: generic: simple-card-utils: remove useless assignment

cppcheck warning:

sound/soc/generic/simple-card-utils.c:258:10: style: Variable 'ret' is
assigned a value that is never used. [unreadVariable]
 int ret = 0;
         ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210218221921.88991-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: soc-topology: clarify expression
Pierre-Louis Bossart [Thu, 18 Feb 2021 22:19:20 +0000 (16:19 -0600)]
ASoC: soc-topology: clarify expression

cppcheck warning:

sound/soc/soc-topology.c:1676:52: style: Clarify calculation
precedence for '&' and '?'. [clarifyCalculation]
   flags & SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_RATES ? 1 : 0;
                                                   ^
sound/soc/soc-topology.c:1680:55: style: Clarify calculation
precedence for '&' and '?'. [clarifyCalculation]
   flags & SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_CHANNELS ?
                                                      ^
sound/soc/soc-topology.c:1685:57: style: Clarify calculation
precedence for '&' and '?'. [clarifyCalculation]
   flags & SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_SAMPLEBITS ?
                                                        ^
sound/soc/soc-topology.c:1768:52: style: Clarify calculation
precedence for '&' and '?'. [clarifyCalculation]
   flags & SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_RATES ? 1 : 0;
                                                   ^
sound/soc/soc-topology.c:1772:55: style: Clarify calculation
precedence for '&' and '?'. [clarifyCalculation]
   flags & SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_CHANNELS ?
                                                      ^
sound/soc/soc-topology.c:1777:57: style: Clarify calculation
precedence for '&' and '?'. [clarifyCalculation]
   flags & SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_SAMPLEBITS ?
                                                        ^
sound/soc/soc-topology.c:1782:48: style: Clarify calculation
precedence for '&' and '?'. [clarifyCalculation]
  flags & SND_SOC_TPLG_LNK_FLGBIT_VOICE_WAKEUP ?
                                               ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210218221921.88991-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: soc-pcm: add error log
Pierre-Louis Bossart [Thu, 18 Feb 2021 22:19:19 +0000 (16:19 -0600)]
ASoC: soc-pcm: add error log

cppcheck warning:

sound/soc/soc-pcm.c:1907:6: style: Variable 'err' is assigned a value
that is never used. [unreadVariable]
 err = dpcm_be_dai_hw_free(fe, stream);
     ^

it's not clear why dpcm_be_dai_hw_free() is sometimes called without
testing the error status, and sometimes an error message is provided.

When in doubt, add an error message for consistency. This may have to
be revisited.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210218221921.88991-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: soc-pcm: remove shadowing variable
Pierre-Louis Bossart [Thu, 18 Feb 2021 22:19:18 +0000 (16:19 -0600)]
ASoC: soc-pcm: remove shadowing variable

cppcheck warning:

sound/soc/soc-pcm.c:1718:7: style: Local variable 'i' shadows outer
variable [shadowVariable]
  int i;
      ^
sound/soc/soc-pcm.c:1696:6: note: Shadowed declaration
 int i;
     ^
sound/soc/soc-pcm.c:1718:7: note: Shadow variable
  int i;
      ^

the second variable seems totally unnecessary.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210218221921.88991-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: soc-pcm: remove redundant assignment
Pierre-Louis Bossart [Thu, 18 Feb 2021 22:19:17 +0000 (16:19 -0600)]
ASoC: soc-pcm: remove redundant assignment

cppcheck warning:

sound/soc/soc-pcm.c:2398:7: style: Variable 'ret' is reassigned a
value before the old one has been used. [redundantAssignment]
  ret = -EINVAL;
      ^
sound/soc/soc-pcm.c:2395:7: note: ret is assigned
  ret = -EINVAL;
      ^
sound/soc/soc-pcm.c:2398:7: note: ret is overwritten
  ret = -EINVAL;
      ^

This looks like a copy/paste or git merge issue.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210218221921.88991-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: soc-ops: remove useless assignment
Pierre-Louis Bossart [Thu, 18 Feb 2021 22:19:16 +0000 (16:19 -0600)]
ASoC: soc-ops: remove useless assignment

cppcheck warning:

sound/soc/soc-ops.c:410:35: style: Variable 'val2' is assigned a value
that is never used. [unreadVariable]
 unsigned int val, val_mask, val2 = 0;
                                  ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210218221921.88991-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: samsung: snow: remove useless test
Pierre-Louis Bossart [Fri, 19 Feb 2021 23:09:16 +0000 (17:09 -0600)]
ASoC: samsung: snow: remove useless test

cppcheck warning:

sound/soc/samsung/snow.c:112:2: style:inconclusive: Found duplicate
branches for 'if' and 'else'. [duplicateBranch]
 if (rtd->num_codecs > 1)
 ^
sound/soc/samsung/snow.c:114:2: note: Found duplicate branches for
'if' and 'else'.
 else
 ^
sound/soc/samsung/snow.c:112:2: note: Found duplicate branches for
'if' and 'else'.
 if (rtd->num_codecs > 1)
 ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Fixes: 7de6b6bc1a58 ("ASoC: samsung: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer")
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://lore.kernel.org/r/20210219230918.5058-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: samsung: smdk_wm8994: add missing return
Pierre-Louis Bossart [Fri, 19 Feb 2021 23:09:15 +0000 (17:09 -0600)]
ASoC: samsung: smdk_wm8994: add missing return

cppcheck warning:

sound/soc/samsung/smdk_wm8994.c:179:6: style: Variable 'ret' is
reassigned a value before the old one has been
used. [redundantAssignment]
 ret = devm_snd_soc_register_card(&pdev->dev, card);
     ^
sound/soc/samsung/smdk_wm8994.c:166:8: note: ret is assigned
   ret = -EINVAL;
       ^
sound/soc/samsung/smdk_wm8994.c:179:6: note: ret is overwritten
 ret = devm_snd_soc_register_card(&pdev->dev, card);
     ^

The initial authors bothered to set ret to -EINVAL and throw a
dev_err() message, so it looks like there is a missing return to avoid
continuing if the property is missing.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://lore.kernel.org/r/20210219230918.5058-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: samsung: s3c24xx_simtec: add missing error check
Pierre-Louis Bossart [Fri, 19 Feb 2021 23:09:14 +0000 (17:09 -0600)]
ASoC: samsung: s3c24xx_simtec: add missing error check

cppcheck warning:

sound/soc/samsung/s3c24xx_simtec.c:191:7: style: Variable 'ret' is
assigned a value that is never used. [unreadVariable]
  ret = snd_soc_dai_set_clkdiv(cpu_dai, S3C24XX_DIV_PRESCALER,
      ^

Looking at the code, it's not clear why the return value is checked in
the two other cases but not here, so mirror the behavior and add a
check.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://lore.kernel.org/r/20210219230918.5058-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: samsung: i2s: remove unassigned variable
Pierre-Louis Bossart [Fri, 19 Feb 2021 23:09:13 +0000 (17:09 -0600)]
ASoC: samsung: i2s: remove unassigned variable

cppcheck warning:

sound/soc/samsung/i2s.c:1159:18: style: Variable 'dai' is not assigned
a value. [unassignedVariable]
 struct i2s_dai *dai;
                 ^

This variable is only used for a sizeof(*dai).

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://lore.kernel.org/r/20210219230918.5058-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: soc-pcm: unpack dpcm_set_fe_runtime()
Kuninori Morimoto [Mon, 22 Feb 2021 00:47:36 +0000 (09:47 +0900)]
ASoC: soc-pcm: unpack dpcm_set_fe_runtime()

dpcm_fe_dai_startup() (= A) calls dpcm_set_fe_runtime() (= B) to setup
DPCM runtime. From *naming point of view*, it sounds like setup function
for FE.

(A) static int dpcm_fe_dai_startup(...)
{
...
(B) dpcm_set_fe_runtime(...);
...
}

But in dpcm_set_fe_runtime() (= B),
It  setups FE by dpcm_runtime_setup_fe() (= X),
and setups BE by dpcm_runtime_merge_xxx() (= Y).

(B) static void dpcm_set_fe_runtime(...)
{
...
(X) dpcm_runtime_setup_fe(...);

 ^ dpcm_runtime_setup_be_format(...);
(Y) dpcm_runtime_setup_be_chan(...);
 v dpcm_runtime_setup_be_rate(...);
}

These means that the function which is called as xxx_fe_xxx()
is setups both FE and BE. This is confusable and can be hot bed for bug.

Now dpcm_set_fe_runtime() (= B) is simple enough and confusable naming,
let's unpack it at dpcm_fe_dai_startup().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87mtvxvsgn.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: soc-pcm: add dpcm_runtime_setup()
Kuninori Morimoto [Mon, 22 Feb 2021 00:47:34 +0000 (09:47 +0900)]
ASoC: soc-pcm: add dpcm_runtime_setup()

dpcm_fe_dai_startup() (= A) calls dpcm_set_fe_runtime() (= B) to setup
DPCM runtime. From *naming point of view*, it sounds like setup function
for FE.

(A) static int dpcm_fe_dai_startup(...)
{
...
(B) dpcm_set_fe_runtime(...);
...
}

But in dpcm_set_fe_runtime() (= B),
It  setups FE by dpcm_runtime_setup_fe() (= X),
and setups BE by dpcm_runtime_merge_xxx() (= Y).

(B) static void dpcm_set_fe_runtime(...)
{
...
(X) dpcm_runtime_setup_fe(...);

 ^ dpcm_runtime_merge_format(...);
(Y) dpcm_runtime_merge_chan(...);
 v dpcm_runtime_merge_rate(...);
}

These means that the function which is called as xxx_fe_xxx()
is setups both FE and BE. This is confusable and can be hot bed for bug.

This patch renames unclear dpcm_runtime_merge_xxx() (= Y) to
more clear dpcm_runtime_setup_be_xxx().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87o8gdvsgr.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: soc-pcm: add dpcm_runtime_setup_fe()
Kuninori Morimoto [Mon, 22 Feb 2021 00:47:26 +0000 (09:47 +0900)]
ASoC: soc-pcm: add dpcm_runtime_setup_fe()

dpcm_fe_dai_startup() (= A) calls dpcm_set_fe_runtime() (= B) to setup
DPCM runtime. From *naming point of view*, it sounds like setup function
for FE.

(A) static int dpcm_fe_dai_startup(...)
{
...
(B) dpcm_set_fe_runtime(...);
...
}

But in dpcm_set_fe_runtime() (= B),
It  setups FE by for_each loop (= X),
and setups BE by dpcm_runtime_merge_xxx() (= Y).

(B) static void dpcm_set_fe_runtime(...)
{
...
 ^ for_each_rtd_cpu_dais(...) {
 | ...
(X) soc_pcm_hw_update_rate(...);
 | soc_pcm_hw_update_chan(...);
 | soc_pcm_hw_update_format(...);
 v }

 ^ dpcm_runtime_merge_format(...);
(Y) dpcm_runtime_merge_chan(...);
 v dpcm_runtime_merge_rate(...);
}

These means that the function which is called as xxx_fe_xxx()
is setups both FE and BE. This is confusable and can be hot bed for bug.

To tidyup it, as 1st step, this patch adds new dpcm_runtime_setup_fe()
for (X).

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87pn0tvsgx.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: soc-pcm: unpack dpcm_init_runtime_hw()
Kuninori Morimoto [Mon, 22 Feb 2021 00:47:19 +0000 (09:47 +0900)]
ASoC: soc-pcm: unpack dpcm_init_runtime_hw()

dpcm_init_runtime_hw() is now just verbose function.
This patch unpacks it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87r1l9vsh4.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: soc-pcm: remove strange format storing
Kuninori Morimoto [Mon, 22 Feb 2021 00:46:57 +0000 (09:46 +0900)]
ASoC: soc-pcm: remove strange format storing

dpcm_init_runtime_hw() (= A) is used from dpcm_set_fe_runtime() (= B)
with for_each_rtd_cpu_dais() loop (= C), and it checks formats (= D).

(A) static void dpcm_init_runtime_hw(...)
{
...
 ^ if (runtime->hw.formats)
 | (D1) runtime->hw.formats &= stream->formats;
(D) else
 | (D2) runtime->hw.formats = stream->formats;
 v }

(B) static void dpcm_set_fe_runtime(...)
{
...
(C) for_each_rtd_cpu_dais(rtd, i, cpu_dai) {
...
(A) dpcm_init_runtime_hw(...);
}
}

If this for_each_rtd_cpu_dais() loop (= C) calls
dpcm_init_runtime_hw() (= A) multiple times, this means it is Multi-CPU.

If we focus to format operation at (D), using mask (= D1) is understandable
because it restricts unsupported format.
But, enabling format when zero format case (= D2) is very strange,
because it might enables unsupported format.

This runtime->hw.formats is initialized by ULLONG_MAX at soc_pcm_hw_init(),
thus becoming zero format means it can't use such format.
And doing this strange format operation is only here.

This patch removes strange format operation (= D2), and use standard
soc_pcm_hw_update_format() for it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87sg5pvshq.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: fsl: p1022_ds: remove useless assignment
Pierre-Louis Bossart [Fri, 19 Feb 2021 23:29:37 +0000 (17:29 -0600)]
ASoC: fsl: p1022_ds: remove useless assignment

cppcheck warning:

sound/soc/fsl/p1022_ds.c:344:6: style: Redundant initialization for
'ret'. The initialized value is overwritten before it is
read. [redundantInitialization]
 ret = fsl_asoc_get_dma_channel(np, "fsl,playback-dma", &mdata->dai[0],
     ^
sound/soc/fsl/p1022_ds.c:203:10: note: ret is initialized
 int ret = -ENODEV;
         ^
sound/soc/fsl/p1022_ds.c:344:6: note: ret is overwritten
 ret = fsl_asoc_get_dma_channel(np, "fsl,playback-dma", &mdata->dai[0],
     ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210219232937.6440-10-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: fsl: mpc8610: remove useless assignment
Pierre-Louis Bossart [Fri, 19 Feb 2021 23:29:36 +0000 (17:29 -0600)]
ASoC: fsl: mpc8610: remove useless assignment

cppcheck warning:

sound/soc/fsl/mpc8610_hpcd.c:333:6: style: Redundant initialization
for 'ret'. The initialized value is overwritten before it is
read. [redundantInitialization]
 ret = fsl_asoc_get_dma_channel(np, "fsl,playback-dma",
     ^
sound/soc/fsl/mpc8610_hpcd.c:193:10: note: ret is initialized
 int ret = -ENODEV;
         ^
sound/soc/fsl/mpc8610_hpcd.c:333:6: note: ret is overwritten
 ret = fsl_asoc_get_dma_channel(np, "fsl,playback-dma",
     ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210219232937.6440-9-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: fsl: mpc5200: signed parameter in snprintf format
Pierre-Louis Bossart [Fri, 19 Feb 2021 23:29:35 +0000 (17:29 -0600)]
ASoC: fsl: mpc5200: signed parameter in snprintf format

cppcheck warning:

sound/soc/fsl/mpc5200_dma.c:414:2: warning: %u in format
string (no. 1) requires 'unsigned int' but the argument type is
'signed int'. [invalidPrintfArgType_uint]
 snprintf(psc_dma->name, sizeof psc_dma->name, "PSC%u", psc_dma->id);
 ^

Also fix sizeof use, missing parentheses reported by checkpatch.pl

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210219232937.6440-8-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: fsl: imx-hdmi: remove unused structure members
Pierre-Louis Bossart [Fri, 19 Feb 2021 23:29:34 +0000 (17:29 -0600)]
ASoC: fsl: imx-hdmi: remove unused structure members

cppcheck warning:

sound/soc/fsl/imx-hdmi.c:21:16: style: struct member
'cpu_priv::sysclk_freq' is never used. [unusedStructMember]
 unsigned long sysclk_freq[2];
               ^

Additional checks show the sysclk_dir member is also not used.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210219232937.6440-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: fsl: fsl_ssi: remove unnecessary tests
Pierre-Louis Bossart [Fri, 19 Feb 2021 23:29:33 +0000 (17:29 -0600)]
ASoC: fsl: fsl_ssi: remove unnecessary tests

cppcheck warnings:

sound/soc/fsl/fsl_ssi.c:767:34: style: Condition 'div2' is always
false [knownConditionTrueFalse]
 stccr = SSI_SxCCR_PM(pm + 1) | (div2 ? SSI_SxCCR_DIV2 : 0) |
                                 ^
sound/soc/fsl/fsl_ssi.c:722:9: note: Assignment 'div2=0', assigned value is 0
 div2 = 0;
        ^
sound/soc/fsl/fsl_ssi.c:767:34: note: Condition 'div2' is always false
 stccr = SSI_SxCCR_PM(pm + 1) | (div2 ? SSI_SxCCR_DIV2 : 0) |
                                 ^
sound/soc/fsl/fsl_ssi.c:768:4: style: Condition 'psr' is always false
[knownConditionTrueFalse]
  (psr ? SSI_SxCCR_PSR : 0);
   ^
sound/soc/fsl/fsl_ssi.c:721:8: note: Assignment 'psr=0', assigned
value is 0
 psr = 0;
       ^
sound/soc/fsl/fsl_ssi.c:768:4: note: Condition 'psr' is always false
  (psr ? SSI_SxCCR_PSR : 0);
   ^

Upon further analysis, the variables 'div2' and 'psr' are set to zero
and never modified. All the tests can be removed.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210219232937.6440-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: fsl: fsl_esai: clarify expression
Pierre-Louis Bossart [Fri, 19 Feb 2021 23:29:32 +0000 (17:29 -0600)]
ASoC: fsl: fsl_esai: clarify expression

cppcheck warning:

sound/soc/fsl/fsl_esai.c:307:16: style: Clarify calculation precedence
for '%' and '?'. [clarifyCalculation]
    clk_id % 2 ? "extal" : "fsys");
               ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210219232937.6440-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: fsl: fsl_easrc: remove useless assignments
Pierre-Louis Bossart [Fri, 19 Feb 2021 23:29:31 +0000 (17:29 -0600)]
ASoC: fsl: fsl_easrc: remove useless assignments

cppcheck warnings:

sound/soc/fsl/fsl_easrc.c:751:53: style: Variable 'st2_mem_alloc' is
assigned a value that is never used. [unreadVariable]
 int st1_chanxexp, st1_mem_alloc = 0, st2_mem_alloc = 0;
                                                    ^
sound/soc/fsl/fsl_easrc.c:1331:11: style: Variable 'size' is assigned
a value that is never used. [unreadVariable]
 int size = 0;
          ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210219232937.6440-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: fsl: fsl_dma: remove unused variable
Pierre-Louis Bossart [Fri, 19 Feb 2021 23:29:30 +0000 (17:29 -0600)]
ASoC: fsl: fsl_dma: remove unused variable

cppcheck warning:

sound/soc/fsl/fsl_dma.c:411:10: style: Variable 'channel' is assigned
a value that is never used. [unreadVariable]

 channel = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? 0 : 1;
         ^

Removing this line shows the variable isn't needed any longer so
remove declaration as well.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210219232937.6440-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: fsl: fsl_asrc: remove useless assignment
Pierre-Louis Bossart [Fri, 19 Feb 2021 23:29:29 +0000 (17:29 -0600)]
ASoC: fsl: fsl_asrc: remove useless assignment

cppcheck warning:

sound/soc/fsl/fsl_asrc.c:613:8: style: Variable 'i' is assigned a
value that is never used. [unreadVariable]
 int i = 0, j = 0;
       ^

The same issue occurs for the 'j' variable.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210219232937.6440-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoc: rt5631: Constify static struct coeff_clk_div
Rikard Falkeborn [Wed, 24 Feb 2021 21:19:18 +0000 (22:19 +0100)]
ASoc: rt5631: Constify static struct coeff_clk_div

coeff_div is only read from, so make it const to show the intent.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Link: https://lore.kernel.org/r/20210224211918.39109-5-rikard.falkeborn@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: rt*: Constify static struct acpi_device_id
Rikard Falkeborn [Wed, 24 Feb 2021 21:19:17 +0000 (22:19 +0100)]
ASoC: rt*: Constify static struct acpi_device_id

These are never modified, so make them const to allow the compiler to
put them in read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Link: https://lore.kernel.org/r/20210224211918.39109-4-rikard.falkeborn@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: rt*: Constify static struct snd_soc_dai_ops
Rikard Falkeborn [Wed, 24 Feb 2021 21:19:16 +0000 (22:19 +0100)]
ASoC: rt*: Constify static struct snd_soc_dai_ops

The only usage of them is to assign their address to the ops field in
the snd_soc_dai_driver struct, which is a pointer to const. Make them
const to allow the compiler to put them in read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Link: https://lore.kernel.org/r/20210224211918.39109-3-rikard.falkeborn@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: rt*: Constify static struct sdw_slave_ops
Rikard Falkeborn [Wed, 24 Feb 2021 21:19:15 +0000 (22:19 +0100)]
ASoC: rt*: Constify static struct sdw_slave_ops

The only usage of these is to assign their address to the ops field in
the sdw_driver struct, which is a pointer to const. Make them const to
allow the compiler to put them in read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Link: https://lore.kernel.org/r/20210224211918.39109-2-rikard.falkeborn@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: lpass-wsa-macro: add missing test
Pierre-Louis Bossart [Thu, 18 Feb 2021 22:29:16 +0000 (16:29 -0600)]
ASoC: lpass-wsa-macro: add missing test

cppcheck warning:

sound/soc/codecs/lpass-wsa-macro.c:958:6: style: Variable 'ret' is
reassigned a value before the old one has been
used. [redundantAssignment]
 ret = wsa_macro_set_prim_interpolator_rate(dai, (u8) rate_val, sample_rate);
     ^
sound/soc/codecs/lpass-wsa-macro.c:946:6: note: ret is assigned
 ret = wsa_macro_set_mix_interpolator_rate(dai, (u8) rate_val, sample_rate);
     ^
sound/soc/codecs/lpass-wsa-macro.c:958:6: note: ret is overwritten
 ret = wsa_macro_set_prim_interpolator_rate(dai, (u8) rate_val, sample_rate);
     ^

set_mix_interpolator_rate can return -EINVAL, add a test and bail on error.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210218222916.89809-11-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: wcd934x: remove useless return
Pierre-Louis Bossart [Thu, 18 Feb 2021 22:29:15 +0000 (16:29 -0600)]
ASoC: wcd934x: remove useless return

cppcheck warning:

sound/soc/codecs/wcd934x.c:1571:9: warning: Identical condition and
return expression 'ret', return value is always 0
[identicalConditionAfterEarlyExit]
 return ret;
        ^
sound/soc/codecs/wcd934x.c:1568:6: note: If condition 'ret' is true,
the function will return/exit
 if (ret)
     ^
sound/soc/codecs/wcd934x.c:1571:9: note: Returning identical
expression 'ret'
 return ret;
        ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210218222916.89809-10-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: wcd9335: clarify return value
Pierre-Louis Bossart [Thu, 18 Feb 2021 22:29:14 +0000 (16:29 -0600)]
ASoC: wcd9335: clarify return value

cppcheck warning:

sound/soc/codecs/wcd9335.c:5216:9: warning: Identical condition and
return expression 'ret', return value is always 0
[identicalConditionAfterEarlyExit]
 return ret;
        ^
sound/soc/codecs/wcd9335.c:5211:6: note: If condition 'ret' is true,
the function will return/exit
 if (ret)
     ^
sound/soc/codecs/wcd9335.c:5216:9: note: Returning identical
expression 'ret'
 return ret;
        ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210218222916.89809-9-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: wcd-clsh-v2: align function prototypes
Pierre-Louis Bossart [Thu, 18 Feb 2021 22:29:13 +0000 (16:29 -0600)]
ASoC: wcd-clsh-v2: align function prototypes

cppcheck warnings:

sound/soc/codecs/wcd-clsh-v2.c:523:28: style:inconclusive: Function
'wcd_clsh_ctrl_set_state' argument 2 names different: declaration
'event' definition 'clsh_event'. [funcArgNamesDifferent]
       enum wcd_clsh_event clsh_event,
                           ^
sound/soc/codecs/wcd-clsh-v2.h:45:28: note: Function
'wcd_clsh_ctrl_set_state' argument 2 names different: declaration
'event' definition 'clsh_event'.
       enum wcd_clsh_event event,
                           ^
sound/soc/codecs/wcd-clsh-v2.c:523:28: note: Function
'wcd_clsh_ctrl_set_state' argument 2 names different: declaration
'event' definition 'clsh_event'.
       enum wcd_clsh_event clsh_event,
                           ^
sound/soc/codecs/wcd-clsh-v2.c:524:12: style:inconclusive: Function
'wcd_clsh_ctrl_set_state' argument 3 names different: declaration
'state' definition 'nstate'. [funcArgNamesDifferent]
       int nstate,
           ^
sound/soc/codecs/wcd-clsh-v2.h:46:12: note: Function
'wcd_clsh_ctrl_set_state' argument 3 names different: declaration
'state' definition 'nstate'.
       int state,
           ^
sound/soc/codecs/wcd-clsh-v2.c:524:12: note: Function
'wcd_clsh_ctrl_set_state' argument 3 names different: declaration
'state' definition 'nstate'.
       int nstate,
           ^
sound/soc/codecs/wcd-clsh-v2.c:557:69: style:inconclusive: Function
'wcd_clsh_ctrl_alloc' argument 1 names different: declaration
'component' definition 'comp'. [funcArgNamesDifferent]
struct wcd_clsh_ctrl *wcd_clsh_ctrl_alloc(struct snd_soc_component *comp,
                                                                    ^
sound/soc/codecs/wcd-clsh-v2.h:40:31: note: Function
'wcd_clsh_ctrl_alloc' argument 1 names different: declaration
'component' definition 'comp'.
    struct snd_soc_component *component,
                              ^
sound/soc/codecs/wcd-clsh-v2.c:557:69: note: Function
'wcd_clsh_ctrl_alloc' argument 1 names different: declaration
'component' definition 'comp'.
struct wcd_clsh_ctrl *wcd_clsh_ctrl_alloc(struct snd_soc_component *comp,
                                                                    ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210218222916.89809-8-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: qcom: q6asm: align function prototypes
Pierre-Louis Bossart [Thu, 18 Feb 2021 22:29:12 +0000 (16:29 -0600)]
ASoC: qcom: q6asm: align function prototypes

cppcheck warnings:

sound/soc/qcom/qdsp6/q6asm.c:502:16: style:inconclusive: Function
'q6asm_map_memory_regions' argument 4 names different: declaration
'bufsz' definition 'period_sz'. [funcArgNamesDifferent]
        size_t period_sz, unsigned int periods)
               ^
sound/soc/qcom/qdsp6/q6asm.h:150:16: note: Function
'q6asm_map_memory_regions' argument 4 names different: declaration
'bufsz' definition 'period_sz'.
        size_t bufsz, unsigned int bufcnt);
               ^
sound/soc/qcom/qdsp6/q6asm.c:502:16: note: Function
'q6asm_map_memory_regions' argument 4 names different: declaration
'bufsz' definition 'period_sz'.
        size_t period_sz, unsigned int periods)
               ^
sound/soc/qcom/qdsp6/q6asm.c:502:40: style:inconclusive: Function
'q6asm_map_memory_regions' argument 5 names different: declaration
'bufcnt' definition 'periods'. [funcArgNamesDifferent]
        size_t period_sz, unsigned int periods)
                                       ^
sound/soc/qcom/qdsp6/q6asm.h:150:36: note: Function
'q6asm_map_memory_regions' argument 5 names different: declaration
'bufcnt' definition 'periods'.
        size_t bufsz, unsigned int bufcnt);
                                   ^
sound/soc/qcom/qdsp6/q6asm.c:502:40: note: Function
'q6asm_map_memory_regions' argument 5 names different: declaration
'bufcnt' definition 'periods'.
        size_t period_sz, unsigned int periods)
                                       ^
sound/soc/qcom/qdsp6/q6asm.c:823:47: style:inconclusive: Function
'q6asm_get_session_id' argument 1 names different: declaration 'ac'
definition 'c'. [funcArgNamesDifferent]
int q6asm_get_session_id(struct audio_client *c)
                                              ^
sound/soc/qcom/qdsp6/q6asm.h:146:47: note: Function
'q6asm_get_session_id' argument 1 names different: declaration 'ac'
definition 'c'.
int q6asm_get_session_id(struct audio_client *ac);
                                              ^
sound/soc/qcom/qdsp6/q6asm.c:823:47: note: Function
'q6asm_get_session_id' argument 1 names different: declaration 'ac'
definition 'c'.
int q6asm_get_session_id(struct audio_client *c)
                                              ^
sound/soc/qcom/qdsp6/q6asm.c:1573:52: style:inconclusive: Function
'q6asm_write_async' argument 6 names different: declaration 'flags'
definition 'wflags'. [funcArgNamesDifferent]
        uint32_t msw_ts, uint32_t lsw_ts, uint32_t wflags)
                                                   ^
sound/soc/qcom/qdsp6/q6asm.h:100:52: note: Function
'q6asm_write_async' argument 6 names different: declaration 'flags'
definition 'wflags'.
        uint32_t msw_ts, uint32_t lsw_ts, uint32_t flags);
                                                   ^
sound/soc/qcom/qdsp6/q6asm.c:1573:52: note: Function
'q6asm_write_async' argument 6 names different: declaration 'flags'
definition 'wflags'.
        uint32_t msw_ts, uint32_t lsw_ts, uint32_t wflags)
                                                   ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210218222916.89809-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: qcom: q6afe: align function prototype
Pierre-Louis Bossart [Thu, 18 Feb 2021 22:29:11 +0000 (16:29 -0600)]
ASoC: qcom: q6afe: align function prototype

cppcheck warning:

sound/soc/qcom/qdsp6/q6afe.c:1101:63: style:inconclusive: Function
'q6afe_set_lpass_clock' argument 3 names different: declaration
'clk_src' definition 'attri'. [funcArgNamesDifferent]
int q6afe_set_lpass_clock(struct device *dev, int clk_id, int attri,
                                                              ^
sound/soc/qcom/qdsp6/q6afe.h:236:63: note: Function
'q6afe_set_lpass_clock' argument 3 names different: declaration
'clk_src' definition 'attri'.
int q6afe_set_lpass_clock(struct device *dev, int clk_id, int clk_src,
                                                              ^
sound/soc/qcom/qdsp6/q6afe.c:1101:63: note: Function
'q6afe_set_lpass_clock' argument 3 names different: declaration
'clk_src' definition 'attri'.
int q6afe_set_lpass_clock(struct device *dev, int clk_id, int attri,
                                                              ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210218222916.89809-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: qcom: q6afe: remove useless assignments
Pierre-Louis Bossart [Thu, 18 Feb 2021 22:29:10 +0000 (16:29 -0600)]
ASoC: qcom: q6afe: remove useless assignments

cppcheck warnings:

sound/soc/qcom/qdsp6/q6afe.c:848:25: note: Assignment 'p=NULL',
assigned value is 0
 struct q6afe_port *p = NULL;
                        ^
sound/soc/qcom/qdsp6/q6afe.c:854:7: note: Null pointer dereference
  if (p->token == token) {
      ^
sound/soc/qcom/qdsp6/q6afe.c:939:8: style: Redundant initialization
for 'wait'. The initialized value is overwritten before it is
read. [redundantInitialization]
  wait = &port->wait;
       ^
sound/soc/qcom/qdsp6/q6afe.c:933:26: note: wait is initialized
 wait_queue_head_t *wait = &port->wait;
                         ^
sound/soc/qcom/qdsp6/q6afe.c:939:8: note: wait is overwritten
  wait = &port->wait;
       ^
sound/soc/qcom/qdsp6/q6afe.c:1191:10: style: Redundant initialization
for 'port_id'. The initialized value is overwritten before it is
read. [redundantInitialization]
 port_id = port->id;
         ^
sound/soc/qcom/qdsp6/q6afe.c:1186:14: note: port_id is initialized
 int port_id = port->id;
             ^
sound/soc/qcom/qdsp6/q6afe.c:1191:10: note: port_id is overwritten
 port_id = port->id;
         ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210218222916.89809-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: qcom: q6dsp-dai: clarify expression
Pierre-Louis Bossart [Thu, 18 Feb 2021 22:29:09 +0000 (16:29 -0600)]
ASoC: qcom: q6dsp-dai: clarify expression

cppcheck warning:

sound/soc/qcom/qdsp6/q6afe-dai.c:264:35: style: Clarify calculation
precedence for '&' and '?'. [clarifyCalculation]
  tdm->slot_mask = (dai->id & 0x1 ? tx_mask : rx_mask) & cap_mask;
                                  ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210218222916.89809-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: qcom: lpass-platform: remove useless assignment
Pierre-Louis Bossart [Thu, 18 Feb 2021 22:29:08 +0000 (16:29 -0600)]
ASoC: qcom: lpass-platform: remove useless assignment

cppcheck warning:

sound/soc/qcom/lpass-platform.c:791:10: style: Variable 'ret' is
assigned a value that is never used. [unreadVariable]
 int ret = -EINVAL;
         ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210218222916.89809-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: qcom: lpass-hdmi: remove useless return
Pierre-Louis Bossart [Thu, 18 Feb 2021 22:29:07 +0000 (16:29 -0600)]
ASoC: qcom: lpass-hdmi: remove useless return

cppcheck warning:

sound/soc/qcom/lpass-hdmi.c:189:9: warning: Identical condition and
return expression 'ret', return value is always 0
[identicalConditionAfterEarlyExit]
 return ret;
        ^
sound/soc/qcom/lpass-hdmi.c:186:6: note: If condition 'ret' is true,
the function will return/exit
 if (ret)
     ^
sound/soc/qcom/lpass-hdmi.c:189:9: note: Returning identical
expression 'ret'
 return ret;
        ^
sound/soc/qcom/lpass-hdmi.c:206:9: warning: Identical condition and
return expression 'ret', return value is always 0
[identicalConditionAfterEarlyExit]
 return ret;
        ^
sound/soc/qcom/lpass-hdmi.c:203:6: note: If condition 'ret' is true,
the function will return/exit
 if (ret)
     ^
sound/soc/qcom/lpass-hdmi.c:206:9: note: Returning identical
expression 'ret'
 return ret;
        ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210218222916.89809-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoMerge series "ASoC: sdm845: array out of bound issues" from Srinivas Kandagatla ...
Mark Brown [Tue, 9 Mar 2021 19:04:28 +0000 (19:04 +0000)]
Merge series "ASoC: sdm845: array out of bound issues" from Srinivas Kandagatla <srinivas.kandagatla@linaro.org>:

During testing John Stultz and Amit reported few array our bound issues
after enabling bound sanitizer

This patch series attempts to fix those!

changes since v1:
- make sure the wcd is not de-referenced without intialization

Srinivas Kandagatla (3):
  ASoC: qcom: sdm845: Fix array out of bounds access
  ASoC: qcom: sdm845: Fix array out of range on rx slim channels
  ASoC: codecs: wcd934x: add a sanity check in set channel map

 sound/soc/codecs/wcd934x.c | 6 ++++++
 sound/soc/qcom/sdm845.c    | 6 +++---
 2 files changed, 9 insertions(+), 3 deletions(-)

--
2.21.0

3 years agoASoC: SOF: intel: fix wrong poll bits in dsp power down
Pan Xiuli [Tue, 9 Mar 2021 00:41:27 +0000 (18:41 -0600)]
ASoC: SOF: intel: fix wrong poll bits in dsp power down

The ADSPCS_SPA is Set Power Active bit. To check if DSP is powered
down, we need to check ADSPCS_CPA, the Current Power Active bit.

Fixes: 747503b1813a3 ("ASoC: SOF: Intel: Add Intel specific HDA DSP HW operations")
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210309004127.4940-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: codecs: wcd934x: add a sanity check in set channel map
Srinivas Kandagatla [Tue, 9 Mar 2021 14:21:29 +0000 (14:21 +0000)]
ASoC: codecs: wcd934x: add a sanity check in set channel map

set channel map can be passed with a channel maps, however if
the number of channels that are passed are more than the actual
supported channels then we would be accessing array out of bounds.

So add a sanity check to validate these numbers!

Fixes: a61f3b4f476e ("ASoC: wcd934x: add support to wcd9340/wcd9341 codec")
Reported-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210309142129.14182-4-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: qcom: sdm845: Fix array out of range on rx slim channels
Srinivas Kandagatla [Tue, 9 Mar 2021 14:21:28 +0000 (14:21 +0000)]
ASoC: qcom: sdm845: Fix array out of range on rx slim channels

WCD934x has only 13 RX SLIM ports however we are setting it as 16
in set_channel_map, this will lead to array out of bounds error!

Orignally caught by enabling USBAN array out of bounds check:

Fixes: 5caf64c633a3 ("ASoC: qcom: sdm845: add support to DB845c and Lenovo Yoga")
Reported-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210309142129.14182-3-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: qcom: sdm845: Fix array out of bounds access
Srinivas Kandagatla [Tue, 9 Mar 2021 14:21:27 +0000 (14:21 +0000)]
ASoC: qcom: sdm845: Fix array out of bounds access

Static analysis Coverity had detected a potential array out-of-bounds
write issue due to the fact that MAX AFE port Id was set to 16 instead
of using AFE_PORT_MAX macro.

Fix this by properly using AFE_PORT_MAX macro.

Fixes: 1b93a8843147 ("ASoC: qcom: sdm845: handle soundwire stream")
Reported-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210309142129.14182-2-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoMerge series "Report jack and button detection + Capture Support" from Lucas Tanure...
Mark Brown [Mon, 8 Mar 2021 16:03:32 +0000 (16:03 +0000)]
Merge series "Report jack and button detection + Capture Support" from Lucas Tanure <tanureal@opensource.cirrus.com>:

Hi All,

Here is a patch series for reporting to user space jack and button events and
add the support for Capture. With some cleanups and fixes along the way.

Regards,

Lucas Tanure

Lucas Tanure (12):
  ASoC: cs42l42: Fix Bitclock polarity inversion
  ASoC: cs42l42: Fix channel width support
  ASoC: cs42l42: Fix mixer volume control
  ASoC: cs42l42: Don't enable/disable regulator at Bias Level
  ASoC: cs42l42: Always wait at least 3ms after reset
  ASoC: cs42l42: Remove power if the driver is being removed
  ASoC: cs42l42: Disable regulators if probe fails
  ASoC: cs42l42: Provide finer control on playback path
  ASoC: cs42l42: Set clock source for both ways of stream
  ASoC: cs42l42: Add Capture Support
  ASoC: cs42l42: Report jack and button detection
  ASoC: cs42l42: Use bclk from hw_params if set_sysclk was not called

Richard Fitzgerald (3):
  ASoC: cs42l42: Wait at least 150us after writing SCLK_PRESENT
  ASoC: cs42l42: Only start PLL if it is needed
  ASoC: cs42l42: Wait for PLL to lock before switching to it

 sound/soc/codecs/cs42l42.c | 437 +++++++++++++++++++++----------------
 sound/soc/codecs/cs42l42.h |  41 +++-
 2 files changed, 282 insertions(+), 196 deletions(-)

--
2.30.1

3 years agoASoC: remove remnants of sirf prima/atlas audio codec
Peter Robinson [Sun, 7 Mar 2021 16:23:37 +0000 (16:23 +0000)]
ASoC: remove remnants of sirf prima/atlas audio codec

In 61fbeb5 the sirf prima/atlas drivers were removed. This cleans
up a stray header and some Kconfig entries for the codec that
were missed in the process.

Fixes: 61fbeb5dcb3d (ASoC: remove sirf prima/atlas drivers)
Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Mark Brown <broonie@kernel.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20210307162338.1160604-1-pbrobinson@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: codecs: lpass-wsa-macro: fix RX MIX input controls
Jonathan Marek [Fri, 5 Mar 2021 00:50:48 +0000 (19:50 -0500)]
ASoC: codecs: lpass-wsa-macro: fix RX MIX input controls

Attempting to use the RX MIX path at 48kHz plays at 96kHz, because these
controls are incorrectly toggling the first bit of the register, which
is part of the FS_RATE field.

Fix the problem by using the same method used by the "WSA RX_MIX EC0_MUX"
control, which is to use SND_SOC_NOPM as the register and use an enum in
the shift field instead.

Fixes: 2c4066e5d428 ("ASoC: codecs: lpass-wsa-macro: add dapm widgets and route")
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210305005049.24726-1-jonathan@marek.ca
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: codecs: lpass-va-macro: mute/unmute all active decimators
Jonathan Marek [Thu, 4 Mar 2021 21:56:46 +0000 (16:56 -0500)]
ASoC: codecs: lpass-va-macro: mute/unmute all active decimators

An interface can have multiple decimators enabled, so loop over all active
decimators. Otherwise only one channel will be unmuted, and other channels
will be zero. This fixes recording from dual DMIC as a single two channel
stream.

Also remove the now unused "active_decimator" field.

Fixes: 908e6b1df26e ("ASoC: codecs: lpass-va-macro: Add support to VA Macro")
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210304215646.17956-1-jonathan@marek.ca
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: cs42l42: Always wait at least 3ms after reset
Lucas Tanure [Fri, 5 Mar 2021 17:34:32 +0000 (17:34 +0000)]
ASoC: cs42l42: Always wait at least 3ms after reset

This delay is part of the power-up sequence defined in the datasheet.
A runtime_resume is a power-up so must also include the delay.

Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210305173442.195740-6-tanureal@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: cs42l42: Don't enable/disable regulator at Bias Level
Lucas Tanure [Fri, 5 Mar 2021 17:34:31 +0000 (17:34 +0000)]
ASoC: cs42l42: Don't enable/disable regulator at Bias Level

dev_pm_ops already enable/disable the codec if not in use

Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210305173442.195740-5-tanureal@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: cs42l42: Fix mixer volume control
Lucas Tanure [Fri, 5 Mar 2021 17:34:30 +0000 (17:34 +0000)]
ASoC: cs42l42: Fix mixer volume control

The minimum value is 0x3f (-63dB), which also is mute

Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210305173442.195740-4-tanureal@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>