OSDN Git Service

uclinux-h8/linux.git
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: 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>
3 years agoASoC: cs42l42: Fix channel width support
Lucas Tanure [Fri, 5 Mar 2021 17:34:29 +0000 (17:34 +0000)]
ASoC: cs42l42: Fix channel width support

Remove the hard coded 32 bits width and replace with the correct width
calculated by params_width.

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

The driver was setting bit clock polarity opposite to intended polarity.
Also simplify the code by grouping ADC and DAC clock configurations into
a single field.

Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210305173442.195740-2-tanureal@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: soc-core: Prevent warning if no DMI table is present
Jon Hunter [Wed, 3 Mar 2021 11:55:26 +0000 (11:55 +0000)]
ASoC: soc-core: Prevent warning if no DMI table is present

Many systems do not use ACPI and hence do not provide a DMI table. On
non-ACPI systems a warning, such as the following, is printed on boot.

 WARNING KERN tegra-audio-graph-card sound: ASoC: no DMI vendor name!

The variable 'dmi_available' is not exported and so currently cannot be
used by kernel modules without adding an accessor. However, it is
possible to use the function is_acpi_device_node() to determine if the
sound card is an ACPI device and hence indicate if we expect a DMI table
to be present. Therefore, call is_acpi_device_node() to see if we are
using ACPI and only parse the DMI table if we are booting with ACPI.

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Link: https://lore.kernel.org/r/20210303115526.419458-1-jonathanh@nvidia.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: SOF: Intel: unregister DMIC device on probe error
Pierre-Louis Bossart [Tue, 2 Mar 2021 00:34:10 +0000 (18:34 -0600)]
ASoC: SOF: Intel: unregister DMIC device on probe error

We only unregister the platform device during the .remove operation,
but if the probe fails we will never reach this sequence.

Suggested-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Fixes: dd96daca6c83e ("ASoC: SOF: Intel: Add APL/CNL HW DSP support")
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Link: https://lore.kernel.org/r/20210302003410.1178535-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoMerge series "AsoC: rt5640/rt5651: Volume control fixes" from Hans de Goede <hdegoede...
Mark Brown [Mon, 1 Mar 2021 23:31:40 +0000 (23:31 +0000)]
Merge series "AsoC: rt5640/rt5651: Volume control fixes" from Hans de Goede <hdegoede@redhat.com>:

Hi All,

Here is a series of rt5640/rt5651 volume-control fixes which I wrote
while working on a bytcr-rt5640 UCM profile patch-series adding
hardware-volume control to devices using this UCM profile.

The UCM series will also work on older kernels, but it works best on
kernels with this series applied, giving e.g. finer grained volume
control and support for hardware muting the outputs.

Regards,

Hans

Hans de Goede (5):
  ASoC: rt5640: Fix dac- and adc- vol-tlv values being off by a factor
    of 10
  ASoC: rt5651: Fix dac- and adc- vol-tlv values being off by a factor
    of 10
  ASoC: rt5640: Add emulated 'DAC1 Playback Switch' control
  ASoC: rt5640: Rename 'Mono DAC Playback Volume' to 'DAC2 Playback
    Volume'
  ASoC: Intel: bytcr_rt5640: Add used AIF to the components string

 sound/soc/codecs/rt5640.c             | 106 +++++++++++++++++++++++---
 sound/soc/codecs/rt5640.h             |   4 +
 sound/soc/codecs/rt5651.c             |   4 +-
 sound/soc/intel/boards/bytcr_rt5640.c |  11 ++-
 4 files changed, 111 insertions(+), 14 deletions(-)

--
2.30.1

3 years agoASoC: es8316: Simplify adc_pga_gain_tlv table
Hans de Goede [Sun, 28 Feb 2021 16:04:41 +0000 (17:04 +0100)]
ASoC: es8316: Simplify adc_pga_gain_tlv table

Most steps in this table are steps of 3dB (300 centi-dB), so we can
simplify the table.

This not only reduces the amount of space it takes inside the kernel,
this also makes alsa-lib's mixer code actually accept the table, where
as before this change alsa-lib saw the "ADC PGA Gain" control as a
control without a dB scale.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20210228160441.241110-1-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: sgtl5000: set DAP_AVC_CTRL register to correct default value on probe
Benjamin Rood [Fri, 19 Feb 2021 18:33:08 +0000 (13:33 -0500)]
ASoC: sgtl5000: set DAP_AVC_CTRL register to correct default value on probe

According to the SGTL5000 datasheet [1], the DAP_AVC_CTRL register has
the following bit field definitions:

| BITS  | FIELD       | RW | RESET | DEFINITION                        |
| 15    | RSVD        | RO | 0x0   | Reserved                          |
| 14    | RSVD        | RW | 0x1   | Reserved                          |
| 13:12 | MAX_GAIN    | RW | 0x1   | Max Gain of AVC in expander mode  |
| 11:10 | RSVD        | RO | 0x0   | Reserved                          |
| 9:8   | LBI_RESP    | RW | 0x1   | Integrator Response               |
| 7:6   | RSVD        | RO | 0x0   | Reserved                          |
| 5     | HARD_LMT_EN | RW | 0x0   | Enable hard limiter mode          |
| 4:1   | RSVD        | RO | 0x0   | Reserved                          |
| 0     | EN          | RW | 0x0   | Enable/Disable AVC                |

The original default value written to the DAP_AVC_CTRL register during
sgtl5000_i2c_probe() was 0x0510.  This would incorrectly write values to
bits 4 and 10, which are defined as RESERVED.  It would also not set
bits 12 and 14 to their correct RESET values of 0x1, and instead set
them to 0x0.  While the DAP_AVC module is effectively disabled because
the EN bit is 0, this default value is still writing invalid values to
registers that are marked as read-only and RESERVED as well as not
setting bits 12 and 14 to their correct default values as defined by the
datasheet.

The correct value that should be written to the DAP_AVC_CTRL register is
0x5100, which configures the register bits to the default values defined
by the datasheet, and prevents any writes to bits defined as
'read-only'.  Generally speaking, it is best practice to NOT attempt to
write values to registers/bits defined as RESERVED, as it generally
produces unwanted/undefined behavior, or errors.

Also, all credit for this patch should go to my colleague Dan MacDonald
<dmacdonald@curbellmedical.com> for finding this error in the first
place.

[1] https://www.nxp.com/docs/en/data-sheet/SGTL5000.pdf

Signed-off-by: Benjamin Rood <benjaminjrood@gmail.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Link: https://lore.kernel.org/r/20210219183308.GA2117@ubuntu-dev
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: rt5651: Fix dac- and adc- vol-tlv values being off by a factor of 10
Hans de Goede [Fri, 26 Feb 2021 14:38:14 +0000 (15:38 +0100)]
ASoC: rt5651: Fix dac- and adc- vol-tlv values being off by a factor of 10

The adc_vol_tlv volume-control has a range from -17.625 dB to +30 dB,
not -176.25 dB to + 300 dB. This wrong scale is esp. a problem in userspace
apps which translate the dB scale to a linear scale. With the logarithmic
dB scale being of by a factor of 10 we loose all precision in the lower
area of the range when apps translate things to a linear scale.

E.g. the 0 dB default, which corresponds with a value of 47 of the
0 - 127 range for the control, would be shown as 0/100 in alsa-mixer.

Since the centi-dB values used in the TLV struct cannot represent the
0.375 dB step size used by these controls, change the TLV definition
for them to specify a min and max value instead of min + stepsize.

Note this mirrors commit 3f31f7d9b540 ("ASoC: rt5670: Fix dac- and adc-
vol-tlv values being off by a factor of 10") which made the exact same
change to the rt5670 codec driver.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20210226143817.84287-3-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: rt5640: Fix dac- and adc- vol-tlv values being off by a factor of 10
Hans de Goede [Fri, 26 Feb 2021 14:38:13 +0000 (15:38 +0100)]
ASoC: rt5640: Fix dac- and adc- vol-tlv values being off by a factor of 10

The adc_vol_tlv volume-control has a range from -17.625 dB to +30 dB,
not -176.25 dB to + 300 dB. This wrong scale is esp. a problem in userspace
apps which translate the dB scale to a linear scale. With the logarithmic
dB scale being of by a factor of 10 we loose all precision in the lower
area of the range when apps translate things to a linear scale.

E.g. the 0 dB default, which corresponds with a value of 47 of the
0 - 127 range for the control, would be shown as 0/100 in alsa-mixer.

Since the centi-dB values used in the TLV struct cannot represent the
0.375 dB step size used by these controls, change the TLV definition
for them to specify a min and max value instead of min + stepsize.

Note this mirrors commit 3f31f7d9b540 ("ASoC: rt5670: Fix dac- and adc-
vol-tlv values being off by a factor of 10") which made the exact same
change to the rt5670 codec driver.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20210226143817.84287-2-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: Intel: bytcr_rt5640: Fix HP Pavilion x2 10-p0XX OVCD current threshold
Hans de Goede [Wed, 24 Feb 2021 10:50:52 +0000 (11:50 +0100)]
ASoC: Intel: bytcr_rt5640: Fix HP Pavilion x2 10-p0XX OVCD current threshold

When I added the quirk for the "HP Pavilion x2 10-p0XX" I copied the
byt_rt5640_quirk_table[] entry for the HP Pavilion x2 10-k0XX / 10-n0XX
models since these use almost the same settings.

While doing this I accidentally also copied and kept the non-standard
OVCD_TH_1500UA setting used on those models. This too low threshold is
causing headsets to often be seen as headphones (without a headset-mic)
and when correctly identified it is causing ghost play/pause
button-presses to get detected.

Correct the HP Pavilion x2 10-p0XX quirk to use the default OVCD_TH_2000UA
setting, fixing these problems.

Fixes: fbdae7d6d04d ("ASoC: Intel: bytcr_rt5640: Fix HP Pavilion x2 Detachable quirks")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210224105052.42116-1-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoMerge series "ASoC: rt5670: Various kcontrol fixes" from Hans de Goede <hdegoede...
Mark Brown [Wed, 24 Feb 2021 16:28:50 +0000 (16:28 +0000)]
Merge series "ASoC: rt5670: Various kcontrol fixes" from Hans de Goede <hdegoede@redhat.com>:

Hi All,

While working on adding hardware-volume control support to the UCM
profile for the rt5672 and on adding LED trigger support to the
rt5670 codec driver. I hit / noticed a couple of issues this series
fixes these issues.

Regards,

Hans

Hans de Goede (4):
  ASoC: rt5670: Remove 'OUT Channel Switch' control
  ASoC: rt5670: Remove 'HP Playback Switch' control
  ASoC: rt5670: Remove ADC vol-ctrl mute bits poking from Sto1 ADC mixer
    settings
  ASoC: rt5670: Add emulated 'DAC1 Playback Switch' control

 sound/soc/codecs/rt5670.c | 110 +++++++++++++++++++++++++++++++++-----
 sound/soc/codecs/rt5670.h |   9 ++--
 2 files changed, 101 insertions(+), 18 deletions(-)

--
2.30.1

3 years agoASoC: ak5558: Add MODULE_DEVICE_TABLE
Shengjiu Wang [Wed, 24 Feb 2021 06:57:52 +0000 (14:57 +0800)]
ASoC: ak5558: Add MODULE_DEVICE_TABLE

Add missed MODULE_DEVICE_TABLE for the driver can be loaded
automatically at boot.

Fixes: 920884777480 ("ASoC: ak5558: Add support for AK5558 ADC driver")
Cc: <stable@vger.kernel.org>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1614149872-25510-2-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: ak4458: Add MODULE_DEVICE_TABLE
Shengjiu Wang [Wed, 24 Feb 2021 06:57:51 +0000 (14:57 +0800)]
ASoC: ak4458: Add MODULE_DEVICE_TABLE

Add missed MODULE_DEVICE_TABLE for the driver can be loaded
automatically at boot.

Fixes: 08660086eff9 ("ASoC: ak4458: Add support for AK4458 DAC driver")
Cc: <stable@vger.kernel.org>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1614149872-25510-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: rt5670: Add emulated 'DAC1 Playback Switch' control
Hans de Goede [Mon, 15 Feb 2021 14:21:18 +0000 (15:21 +0100)]
ASoC: rt5670: Add emulated 'DAC1 Playback Switch' control

For reliable output-mute LED control we need a "DAC1 Playback Switch"
control. The "DAC Playback volume" control is the only control in the
path from the DAC1 data input to the speaker output, so the UCM profile
for the speaker output will have its PlaybackMixerElem set to "DAC1".

But userspace (pulseaudio) will set the "DAC1 Playback Volume" control to
its softest setting (which is not fully muted) while still showing the
speaker as being enabled at a low volume in the UI.

If we were to set the SNDRV_CTL_ELEM_ACCESS_SPK_LED on the "DAC1 Playback
Volume" control, this would mean then what pressing KEY_VOLUMEDOWN the
speaker-mute LED (embedded in the volume-mute toggle key) would light
while the UI is still showing the speaker as being enabled at a low
volume, meaning that the UI and the LED are out of sync.

Only after an _extra_ KEY_VOLUMEDOWN press would the UI show the
speaker as being muted.

The path from DAC1 data input to the speaker output does have
a digital mixer with DAC1's data as one of its inputs direclty after
the "DAC1 Playback Volume" control.

This commit adds an emulated "DAC1 Playback Switch" control by:

1. Declaring the enable flag for that mixers DAC1 input as well as the
"DAC1 Playback Switch" control both as SND_SOC_NOPM controls.

2. Storing the settings of both controls as driver-private data

3. Only clearing the mute flag for the DAC1 input of that mixer if the
stored values indicate both controls are enabled.

This is a preparation patch for adding "audio-mute" LED trigger support.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20210215142118.308516-5-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: rt5670: Remove ADC vol-ctrl mute bits poking from Sto1 ADC mixer settings
Hans de Goede [Mon, 15 Feb 2021 14:21:17 +0000 (15:21 +0100)]
ASoC: rt5670: Remove ADC vol-ctrl mute bits poking from Sto1 ADC mixer settings

The SND_SOC_DAPM_MIXER declaration for "Sto1 ADC MIXL" and "Sto1 ADC MIXR"
was using the mute bits from the RT5670_STO1_ADC_DIG_VOL control as mixer
master mute bits.

But these bits are already exposed to userspace as controls as part of the
"ADC Capture Volume" / "ADC Capture Switch" control pair:

        SOC_DOUBLE("ADC Capture Switch", RT5670_STO1_ADC_DIG_VOL,
                RT5670_L_MUTE_SFT, RT5670_R_MUTE_SFT, 1, 1),
        SOC_DOUBLE_TLV("ADC Capture Volume", RT5670_STO1_ADC_DIG_VOL,
                        RT5670_L_VOL_SFT, RT5670_R_VOL_SFT,
                        127, 0, adc_vol_tlv),

Both the fact that the mute bits belong to the same reg as the vol-ctrl
and the "Digital Mixer Path" diagram in the datasheet clearly shows that
these mute bits are not part of the mixer and having 2 separate controls
poking at the same bits is a bad idea.

Remove the master-mute bits settings from the  "Sto1 ADC MIXL" and
"Sto1 ADC MIXR" DAPM widget declarations, avoiding these bits getting
poked from 2 different places.

This should not cause any issues for userspace. AFAICT the rt567x codecs
are only used on x86/ACPI devices and the UCM profiles used there already
set the "ADC Capture Switch" as needed.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20210215142118.308516-4-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: rt5670: Remove 'HP Playback Switch' control
Hans de Goede [Mon, 15 Feb 2021 14:21:16 +0000 (15:21 +0100)]
ASoC: rt5670: Remove 'HP Playback Switch' control

The RT5670_L_MUTE_SFT and RT5670_R_MUTE_SFT bits (bits 15 and 7) of the
RT5670_HP_VOL register are set / unset by the headphones deplop code
run by rt5670_hp_event() on SND_SOC_DAPM_POST_PMU / SND_SOC_DAPM_PRE_PMD.

So we should not also export a control to userspace which toggles these
same bits.

This should not cause any issues for userspace. AFAICT the rt567x codecs
are only used on x86/ACPI devices and the UCM profiles used there do not
use the "HP Playback Switch" control.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20210215142118.308516-3-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: rt5670: Remove 'OUT Channel Switch' control
Hans de Goede [Mon, 15 Feb 2021 14:21:15 +0000 (15:21 +0100)]
ASoC: rt5670: Remove 'OUT Channel Switch' control

The "OUT Channel Switch" control is a left over from code copied from
thr rt5640 codec driver.

With the rt5640 codec driver the output volume controls have 2 pairs of
mute bits:
bit 7, 15: Mute Control for Spk/Headphone/Line Output Port
bit 6, 14: Mute Control for Spk/Headphone/Line Volume Channel

Bits 7 and 15 are normal mute bits on the rt5670/5672 which are
controlled by 2 dapm widgets:
SND_SOC_DAPM_SWITCH("LOUT L Playback", SND_SOC_NOPM, 0, 0,
    &lout_l_enable_control),
SND_SOC_DAPM_SWITCH("LOUT R Playback", SND_SOC_NOPM, 0, 0,
    &lout_r_enable_control),

But on the 5670/5672 bit 6 is always reserved, where as bit 14 is
"LOUT Differential Mode" on the 5670 and also reserved on the 5672.

So the "OUT Channel Switch" control which is controlling bits 6+14
of the "LINE Output Control" register is bogus -> remove it.

This should not cause any issues for userspace. AFAICT the rt567x codecs
are only used on x86/ACPI devices and the UCM profiles used there do not
use the "OUT Channel Switch" control.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20210215142118.308516-2-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: fsl_ssi: Fix TDM slot setup for I2S mode
Alexander Shiyan [Tue, 16 Feb 2021 11:42:21 +0000 (14:42 +0300)]
ASoC: fsl_ssi: Fix TDM slot setup for I2S mode

When using the driver in I2S TDM mode, the _fsl_ssi_set_dai_fmt()
function rewrites the number of slots previously set by the
fsl_ssi_set_dai_tdm_slot() function to 2 by default.
To fix this, let's use the saved slot count value or, if TDM
is not used and the slot count is not set, proceed as before.

Fixes: 4f14f5c11db1 ("ASoC: fsl_ssi: Fix number of words per frame for I2S-slave mode")
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Link: https://lore.kernel.org/r/20210216114221.26635-1-shc_work@mail.ru
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: codecs: lpass-rx-macro: Fix uninitialized variable ec_tx
Colin Ian King [Mon, 15 Feb 2021 16:33:13 +0000 (16:33 +0000)]
ASoC: codecs: lpass-rx-macro: Fix uninitialized variable ec_tx

There is potential read of the uninitialized variable ec_tx if the call
to snd_soc_component_read fails or returns an unrecognized w->name. To
avoid this corner case, initialize ec_tx to -1 so that it is caught
later when ec_tx is bounds checked.

Addresses-Coverity: ("Uninitialized scalar variable")
Fixes: 4f692926f562 ("ASoC: codecs: lpass-rx-macro: add dapm widgets and route")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20210215163313.84026-1-colin.king@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: rt1015: enable BCLK detection after calibration
Jack Yu [Mon, 22 Feb 2021 09:00:57 +0000 (17:00 +0800)]
ASoC: rt1015: enable BCLK detection after calibration

Enable BCLK detection after calibration.

Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/20210222090057.29532-2-jack.yu@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: rt1015: fix i2c communication error
Jack Yu [Mon, 22 Feb 2021 09:00:56 +0000 (17:00 +0800)]
ASoC: rt1015: fix i2c communication error

Remove 0x100 cache re-sync to solve i2c communication error.

Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/20210222090057.29532-1-jack.yu@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoLinux 5.12-rc2
Linus Torvalds [Sat, 6 Mar 2021 01:33:41 +0000 (17:33 -0800)]
Linux 5.12-rc2