platform/kernel/linux-rpi.git
3 years agoASoC: Intel: Fix a typo
Bhaskar Chowdhury [Mon, 22 Mar 2021 06:49:09 +0000 (12:19 +0530)]
ASoC: Intel: Fix a typo

s/struture/structure/

Signed-off-by: Bhaskar Chowdhury <unixbhaskar@gmail.com>
Link: https://lore.kernel.org/r/20210322064909.4189290-1-unixbhaskar@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: dt-bindings: ak5558: Add compatible string for ak5552
Shengjiu Wang [Wed, 31 Mar 2021 07:44:46 +0000 (15:44 +0800)]
ASoC: dt-bindings: ak5558: Add compatible string for ak5552

Add compatible string "asahi-kasei,ak5552" for ak5552

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Acked-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/1617176686-25528-2-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: ak5558: Add support for ak5552
Viorel Suman [Wed, 31 Mar 2021 07:44:45 +0000 (15:44 +0800)]
ASoC: ak5558: Add support for ak5552

AK5552 is a 32-bit 2ch ADC and has the same register
map as AK5558.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1617176686-25528-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: Intel: bytcr_rt5640: Add quirk for the Chuwi Hi8 tablet
Hans de Goede [Thu, 25 Mar 2021 22:10:54 +0000 (23:10 +0100)]
ASoC: Intel: bytcr_rt5640: Add quirk for the Chuwi Hi8 tablet

The Chuwi Hi8 tablet is using an analog mic on IN1 and has its
jack-detect connected to JD2_IN4N, instead of using the default
IN3 for its internal mic and JD1_IN4P for jack-detect.

It also only has 1 speaker.

Add a quirk applying the correct settings for this configuration.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20210325221054.22714-1-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: dt-bindings: nvidia, tegra210-ahub: Add missing child nodes
Rob Herring [Fri, 26 Mar 2021 19:50:03 +0000 (13:50 -0600)]
ASoC: dt-bindings: nvidia, tegra210-ahub: Add missing child nodes

The nvidia,tegra210-ahub binding is missing schema for child nodes. This
results in warnings if 'additionalProperties: false' is set (or when the
tools implement 'unevaluatedProperties' support). Add the child nodes
and reference their schema if one exists.

Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Jonathan Hunter <jonathanh@nvidia.com>
Cc: Sameer Pujar <spujar@nvidia.com>
Cc: alsa-devel@alsa-project.org
Cc: linux-tegra@vger.kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>
Acked-by: Thierry Reding <treding@nvidia.com>
Acked-by: Sameer Pujar <spujar@nvidia.com>
Link: https://lore.kernel.org/r/20210326195003.3756394-1-robh@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: q6afe-clocks: fix reprobing of the driver
Dmitry Baryshkov [Sat, 27 Mar 2021 09:28:57 +0000 (12:28 +0300)]
ASoC: q6afe-clocks: fix reprobing of the driver

Q6afe-clocks driver can get reprobed. For example if the APR services
are restarted after the firmware crash. However currently Q6afe-clocks
driver will oops because hw.init will get cleared during first _probe
call. Rewrite the driver to fill the clock data at runtime rather than
using big static array of clocks.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: Stephen Boyd <sboyd@kernel.org>
Fixes: 520a1c396d19 ("ASoC: q6afe-clocks: add q6afe clock controller")
Link: https://lore.kernel.org/r/20210327092857.3073879-1-dmitry.baryshkov@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: Intel: add max98390 echo reference support
Mac Chiang [Fri, 26 Mar 2021 11:21:29 +0000 (19:21 +0800)]
ASoC: Intel: add max98390 echo reference support

load new topology file with speaker capture pipeline.

Signed-off-by: Mac Chiang <mac.chiang@intel.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/1616757689-22014-1-git-send-email-mac.chiang@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: mediatek: mt6359: Fix spelling mistake "reate" -> "create"
Colin Ian King [Tue, 30 Mar 2021 08:47:10 +0000 (09:47 +0100)]
ASoC: mediatek: mt6359: Fix spelling mistake "reate" -> "create"

There is a spelling mistake in a dev_err error message. Fix it.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20210330084710.997731-1-colin.king@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoMerge series "Add mediatek MT6359 ASoC accdet jack driver" from Argus Lin <argus...
Mark Brown [Mon, 29 Mar 2021 19:30:51 +0000 (20:30 +0100)]
Merge series "Add mediatek MT6359 ASoC accdet jack driver" from Argus Lin <argus.lin@mediatek.com>:

All of 3-pole and 4-pole jack are supported.

change since v2:
  - fixs missing blank at Kconfig.
  - fixs comment format and spelling mistake.
  - changes private structure mt6359_accdet to mt6359-accdet.h and uses this
    data as function parameter.
  - removes compatible string declaration.
  - uses regmap_read_poll_timeout as polling timer.
  - simplify jack detection and key detection report function.
  - adds mt6359_accdet_enable_jack_detect for sound card jack initialization.

change since v1:
  - adds mt6359 accdet binding document
  - adds mt6359 accdet driver

*** BLURB HERE ***

Argus Lin (2):
  dt-bindings: mediatek: mt6359: add ASoC mt6359 ASoC accdet jack
    document
  ASoC: mediatek: mt6359: add MT6359 accdet jack driver

 .../bindings/sound/mt6359-accdet.yaml         |  164 ++
 sound/soc/codecs/Kconfig                      |    8 +
 sound/soc/codecs/Makefile                     |    2 +
 sound/soc/codecs/mt6359-accdet.c              | 1080 ++++++++++
 sound/soc/codecs/mt6359-accdet.h              |  128 ++
 sound/soc/codecs/mt6359.h                     | 1864 ++++++++++++++++-
 6 files changed, 3139 insertions(+), 107 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/mt6359-accdet.yaml
 create mode 100644 sound/soc/codecs/mt6359-accdet.c
 create mode 100644 sound/soc/codecs/mt6359-accdet.h

--
2.18.0

3 years agoASoC: SOF: match SSP config with pcm hw params
Jaska Uimonen [Fri, 26 Mar 2021 16:51:50 +0000 (18:51 +0200)]
ASoC: SOF: match SSP config with pcm hw params

This patch adds a function to find a match between pcm hw params and SSP
DAI config. Config is matched against sample rate and if match is found
current config is set. If match isn't found last matched config is left
as current i.e. current config is not touched. Functionality for SSP
DAIs with 1 config remains the same as before.

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20210326165150.255533-3-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: SOF: Intel: HDA: add hw params callback for SSP DAIs
Jaska Uimonen [Fri, 26 Mar 2021 16:51:49 +0000 (18:51 +0200)]
ASoC: SOF: Intel: HDA: add hw params callback for SSP DAIs

Currently SSP DAIs don't have hw params callback function as there
wasn't anything to setup after initial topology loading. After enabling
multiple DAI configs the current config can be sent in the callback.

This patch changes the way SSP config ipc is sent to the dsp. Before it
was only sent once in topology loading, but now it will be additionally
sent always when stream is opened. Mechanism is similar as with HDA
DAIs.

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20210326165150.255533-2-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: SOF: parse multiple SSP DAI and hw configs
Jaska Uimonen [Fri, 26 Mar 2021 16:51:48 +0000 (18:51 +0200)]
ASoC: SOF: parse multiple SSP DAI and hw configs

ASoC parses multiple hw_configs defined in topology. However currently
in SOF only the first config is used and others are discarded. First
change SOF driver to parse and save possible multiple configs in ssp
case. Also save the default config value provided by ASoC. Functionality
with only one defined config stays the same.

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20210326165150.255533-1-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: fsl_rpmsg: initialise pointers to NULL
Shengjiu Wang [Mon, 29 Mar 2021 03:34:28 +0000 (11:34 +0800)]
ASoC: fsl_rpmsg: initialise pointers to NULL

This fixes the following sparse warnings:

sound/soc/fsl/fsl_rpmsg.c:45:45: sparse: sparse: Using plain integer as NULL pointer
sound/soc/fsl/fsl_rpmsg.c:45:56: sparse: sparse: Using plain integer as NULL pointer

Fixes: b73d9e6225e8 ("ASoC: fsl_rpmsg: Add CPU DAI driver for audio base on rpmsg")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/r/1616988868-971-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: amd: fix acpi dependency kernel warning
Vijendar Mukunda [Fri, 26 Mar 2021 16:44:31 +0000 (22:14 +0530)]
ASoC: amd: fix acpi dependency kernel warning

Fix ACPI dependency kernel warning produced by powerpc
allyesconfig.

sound/soc/amd/acp-da7219-max98357a.c:684:28: warning:
'cz_rt5682_card' defined but not used [-Wunused-variable]

sound/soc/amd/acp-da7219-max98357a.c:671:28: warning: 'cz_card'
defined but not used [-Wunused-variable]

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://lore.kernel.org/r/1616777074-5151-2-git-send-email-Vijendar.Mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: amd: update spdx license for acp machine driver
Vijendar Mukunda [Fri, 26 Mar 2021 16:44:30 +0000 (22:14 +0530)]
ASoC: amd: update spdx license for acp machine driver

update SPDX license for acp machine driver.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://lore.kernel.org/r/1616777074-5151-1-git-send-email-Vijendar.Mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: dwc: Fix -Wmissing-prototypes warnings
YueHaibing [Mon, 29 Mar 2021 15:05:24 +0000 (23:05 +0800)]
ASoC: dwc: Fix -Wmissing-prototypes warnings

while CONFIG_SND_DESIGNWARE_PCM is not set, building with W=1 shows this:

sound/soc/dwc/local.h:127:6: warning: no previous prototype for ‘dw_pcm_push_tx’ [-Wmissing-prototypes]
 void dw_pcm_push_tx(struct dw_i2s_dev *dev) { }
      ^~~~~~~~~~~~~~
sound/soc/dwc/local.h:128:6: warning: no previous prototype for ‘dw_pcm_pop_rx’ [-Wmissing-prototypes]
 void dw_pcm_pop_rx(struct dw_i2s_dev *dev) { }
      ^~~~~~~~~~~~~
sound/soc/dwc/local.h:129:5: warning: no previous prototype for ‘dw_pcm_register’ [-Wmissing-prototypes]
 int dw_pcm_register(struct platform_device *pdev)
     ^~~~~~~~~~~~~~~

Change these to inline functions to fix the warnings.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20210329150524.18184-1-yuehaibing@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: mediatek: mt6359: add MT6359 accdet jack driver
Argus Lin [Wed, 10 Mar 2021 13:33:06 +0000 (21:33 +0800)]
ASoC: mediatek: mt6359: add MT6359 accdet jack driver

MT6359 audio codec supports jack detection feature, adds MT6359
accdet driver to support jack plugged detection and key detection.

Signed-off-by: Argus Lin <argus.lin@mediatek.com>
Link: https://lore.kernel.org/r/1615383186-18500-3-git-send-email-argus.lin@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: mt6359: add ASoC mt6359 ASoC accdet jack document
Argus Lin [Wed, 10 Mar 2021 13:33:05 +0000 (21:33 +0800)]
ASoC: mt6359: add ASoC mt6359 ASoC accdet jack document

This patch adds MediaTek MT6359 ASoC accdet jack document.

Signed-off-by: Argus Lin <argus.lin@mediatek.com>
Link: https://lore.kernel.org/r/1615383186-18500-2-git-send-email-argus.lin@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoMerge series "Add audio driver base on rpmsg on i.MX platform" from Shengjiu Wang...
Mark Brown [Thu, 25 Mar 2021 17:32:00 +0000 (17:32 +0000)]
Merge series "Add audio driver base on rpmsg on i.MX platform" from Shengjiu Wang <shengjiu.wang@nxp.com>:

On Asymmetric multiprocessor, there is Cortex-A core and Cortex-M core,
Linux is running on A core, RTOS is running on M core.
The audio hardware device can be controlled by Cortex-M device,
So audio playback/capture can be handled by M core.

Rpmsg is the interface for sending and receiving msg to and from M
core, that we can create a virtual sound on Cortex-A core side.

A core will tell the Cortex-M core sound format/rate/channel,
where is the data buffer, what is the period size, when to start,
when to stop and when suspend or resume happen, each of this behavior
there is defined rpmsg command.

Especially we designed the low power audio case, that is to
allocate a large buffer and fill the data, then Cortex-A core can go
to sleep mode, Cortex-M core continue to play the sound, when the
buffer is consumed, Cortex-M core will trigger the Cortex-A core to
wakeup to fill data.

changes in v5:
- remove unneeded property in binding doc and driver
- update binding doc according to Rob's comments.
- Fix link issue reported by kernel test robot

changes in v4:
- remove the sound card node, merge the property to cpu dai node
  according to Rob's comments.
- sound card device will be registered by cpu dai driver.
- Fix do_div issue reported by kernel test robot

changes in v3:
- add local refcount for clk enablement in hw_params()
- update the document according Rob's comments

changes in v2:
- update codes and comments according to Mark's comments

Shengjiu Wang (6):
  ASoC: soc-component: Add snd_soc_pcm_component_ack
  ASoC: fsl_rpmsg: Add CPU DAI driver for audio base on rpmsg
  ASoC: dt-bindings: fsl_rpmsg: Add binding doc for rpmsg audio device
  ASoC: imx-audio-rpmsg: Add rpmsg_driver for audio channel
  ASoC: imx-pcm-rpmsg: Add platform driver for audio base on rpmsg
  ASoC: imx-rpmsg: Add machine driver for audio base on rpmsg

 .../devicetree/bindings/sound/fsl,rpmsg.yaml  | 108 +++
 include/sound/soc-component.h                 |   3 +
 sound/soc/fsl/Kconfig                         |  30 +
 sound/soc/fsl/Makefile                        |   6 +
 sound/soc/fsl/fsl_rpmsg.c                     | 279 ++++++
 sound/soc/fsl/fsl_rpmsg.h                     |  35 +
 sound/soc/fsl/imx-audio-rpmsg.c               | 140 +++
 sound/soc/fsl/imx-pcm-rpmsg.c                 | 918 ++++++++++++++++++
 sound/soc/fsl/imx-pcm-rpmsg.h                 | 512 ++++++++++
 sound/soc/fsl/imx-rpmsg.c                     | 150 +++
 sound/soc/soc-component.c                     |  14 +
 sound/soc/soc-pcm.c                           |   2 +
 12 files changed, 2197 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/fsl,rpmsg.yaml
 create mode 100644 sound/soc/fsl/fsl_rpmsg.c
 create mode 100644 sound/soc/fsl/fsl_rpmsg.h
 create mode 100644 sound/soc/fsl/imx-audio-rpmsg.c
 create mode 100644 sound/soc/fsl/imx-pcm-rpmsg.c
 create mode 100644 sound/soc/fsl/imx-pcm-rpmsg.h
 create mode 100644 sound/soc/fsl/imx-rpmsg.c

--
2.27.0

3 years agoMerge series "ASoC: soc.h: small cleanups" from Kuninori Morimoto <kuninori.morimoto...
Mark Brown [Thu, 25 Mar 2021 17:31:59 +0000 (17:31 +0000)]
Merge series "ASoC: soc.h: small cleanups" from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:

Hi Mark

These are small cleanups for soc.h

Kuninori Morimoto (3):
  ASoC: soc.h: add asoc_link_to_cpu/codec/platform() macro
  ASoC: soc.h: fixup return timing for snd_soc_fixup_dai_links_platform_name()
  ASoC: soc.h: return error if multi platform at snd_soc_fixup_dai_links_platform_name()

 include/sound/soc.h | 34 ++++++++++++++++++++++++++++------
 1 file changed, 28 insertions(+), 6 deletions(-)

--
2.25.1

Thank you for your help !!

Best regards
---
Kuninori Morimoto

3 years agoASoC: wm8960: Remove bitclk relax condition in wm8960_configure_sysclk
Shengjiu Wang [Wed, 3 Mar 2021 03:07:42 +0000 (11:07 +0800)]
ASoC: wm8960: Remove bitclk relax condition in wm8960_configure_sysclk

The call sequence in wm8960_configure_clocking is

   ret = wm8960_configure_sysclk();
   if (ret >= 0)
        goto configure_clock;

   ....

   ret = wm8960_configure_pll();

configure_clock:
   ...

wm8960_configure_sysclk is called before wm8960_configure_pll, as
there is bitclk relax on both functions, so wm8960_configure_sysclk
always return success, then wm8960_configure_pll() never be called.

With this case:
aplay -Dhw:0,0 -d 5 -r 48000 -f S24_LE -c 2 audio48k24b2c.wav
the required bitclk is 48000 * 24 * 2 = 2304000, bitclk got from
wm8960_configure_sysclk is 3072000, but if go to wm8960_configure_pll.
it can get correct bitclk 2304000.

So bitclk relax condition should be removed in wm8960_configure_sysclk,
then wm8960_configure_pll can be called, and there is also bitclk relax
function in wm8960_configure_pll.

Fixes: 3c01b9ee2ab9 ("ASoC: codec: wm8960: Relax bit clock computation")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/1614740862-30196-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: bindings: fsl-asoc-card: add compatible string for WM8958 codec
Shengjiu Wang [Wed, 17 Mar 2021 13:05:03 +0000 (21:05 +0800)]
ASoC: bindings: fsl-asoc-card: add compatible string for WM8958 codec

The WM8958 codec is used on i.MX7D val board.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1615986303-27959-2-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: fsl-asoc-card: Add support for WM8958 codec
Shengjiu Wang [Wed, 17 Mar 2021 13:05:02 +0000 (21:05 +0800)]
ASoC: fsl-asoc-card: Add support for WM8958 codec

WM8958 codec is used on some i.MX based platform.
So add it support in this generic driver.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1615986303-27959-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: max98373: Added controls for autorestart config
Ryan Lee [Thu, 25 Mar 2021 03:35:55 +0000 (20:35 -0700)]
ASoC: max98373: Added controls for autorestart config

3 new controls are added.
"OVC Autorestart Switch" : controls whether or not the speaker amplifier
automatically re-enables after an overcurrent fault condition.
"THERM Autorestart Switch" : controls whether or not the device
automatically resumes playback when the die temperature recovers from
thermal shutdown.
"CMON Autorestart Switch" : controls whether or not the device
automatically resumes playback when the clock returns after stopping.

Above Auto Restart functions are enabled by default.

Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
Link: https://lore.kernel.org/r/20210325033555.29377-3-ryans.lee@maximintegrated.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: rt1015: Add bclk detection and dc detection
Jack Yu [Mon, 22 Mar 2021 05:50:53 +0000 (13:50 +0800)]
ASoC: rt1015: Add bclk detection and dc detection

Add bclk detection and dc detection before playback.

Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/20210322055053.31797-1-jack.yu@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agospi: imx: Use of_device_get_match_data() helper
Tian Tao [Mon, 22 Mar 2021 03:57:56 +0000 (11:57 +0800)]
spi: imx: Use of_device_get_match_data() helper

Use the of_device_get_match_data() helper instead of open coding.

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Link: https://lore.kernel.org/r/1616385476-53327-1-git-send-email-tiantao6@hisilicon.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: soc.h: return error if multi platform at snd_soc_fixup_dai_links_platform_name()
Kuninori Morimoto [Mon, 22 Mar 2021 02:48:54 +0000 (11:48 +0900)]
ASoC: soc.h: return error if multi platform at snd_soc_fixup_dai_links_platform_name()

snd_soc_fixup_dai_links_platform_name() is assuming it is single platform.
return error if multi platforms.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/871rc7aoo9.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: soc.h: fixup return timing for snd_soc_fixup_dai_links_platform_name()
Kuninori Morimoto [Mon, 22 Mar 2021 02:48:40 +0000 (11:48 +0900)]
ASoC: soc.h: fixup return timing for snd_soc_fixup_dai_links_platform_name()

Current snd_soc_fixup_dai_links_platform_name() creates name first (A),
and checks setup target pointer (B), and set it (C).
We should check target pointer first IMO.
This patch exchange the order to (B) -> (A) -> (C).

int snd_soc_fixup_dai_links_platform_name(...)
{
...
/* set platform name for each dailink */
for_each_card_prelinks(card, i, dai_link) {
(A) name = devm_kstrdup(...);
if (!name)
return -ENOMEM;

(B) if (!dai_link->platforms)
return -EINVAL;

/* only single platform is supported for now */
(C) dai_link->platforms->name = name;
}

return 0;
}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/8735wnaoon.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: soc.h: add asoc_link_to_cpu/codec/platform() macro
Kuninori Morimoto [Mon, 22 Mar 2021 02:48:15 +0000 (11:48 +0900)]
ASoC: soc.h: add asoc_link_to_cpu/codec/platform() macro

We shouldn't use dai_link->cpus/codecs/platforms directly,
because these are array now to supporting multi CPU/Codec/Platform.
This patch adds asoc_link_to_xxx() macro for it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/874kh3aopc.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: imx-rpmsg: Add machine driver for audio base on rpmsg
Shengjiu Wang [Fri, 12 Mar 2021 02:38:45 +0000 (10:38 +0800)]
ASoC: imx-rpmsg: Add machine driver for audio base on rpmsg

The platform device is not registered by device tree or
cpu dai driver, it is registered by the rpmsg channel,
So add a dedicated machine driver to handle this case.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1615516725-4975-7-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: imx-pcm-rpmsg: Add platform driver for audio base on rpmsg
Shengjiu Wang [Fri, 12 Mar 2021 02:38:44 +0000 (10:38 +0800)]
ASoC: imx-pcm-rpmsg: Add platform driver for audio base on rpmsg

Platform driver based on rpmsg is the interface for sending and
receiving rpmsg to and from M core. It will tell the Cortex-M core
sound format/rate/channel, where is the data buffer, where is
the period size, when to start, when to stop and when suspend
or resume happen, each this behavior there is defined rpmsg
command.

Especially we designed the low power audio case, that is to
allocate a large buffer and fill the data, then Cortex-A core can go
to sleep mode, Cortex-M core continue to play the sound, when the
buffer is consumed, Cortex-M core will trigger the Cortex-A core to
wake up.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1615516725-4975-6-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: imx-audio-rpmsg: Add rpmsg_driver for audio channel
Shengjiu Wang [Fri, 12 Mar 2021 02:38:43 +0000 (10:38 +0800)]
ASoC: imx-audio-rpmsg: Add rpmsg_driver for audio channel

This driver is used to accept the message from rpmsg audio
channel, and if this driver is probed, it will help to register
the platform driver, the platform driver will use this
audio channel to send and receive messages to and from Cortex-M
core.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1615516725-4975-5-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: dt-bindings: fsl_rpmsg: Add binding doc for rpmsg audio device
Shengjiu Wang [Fri, 12 Mar 2021 02:38:42 +0000 (10:38 +0800)]
ASoC: dt-bindings: fsl_rpmsg: Add binding doc for rpmsg audio device

fsl_rpmsg is a virtual audio device. Mapping to real hardware
devices are SAI, DMA controlled by Cortex M core. What we see from
Linux side is a device which provides audio service by rpmsg channel.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1615516725-4975-4-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: fsl_rpmsg: Add CPU DAI driver for audio base on rpmsg
Shengjiu Wang [Fri, 12 Mar 2021 02:38:41 +0000 (10:38 +0800)]
ASoC: fsl_rpmsg: Add CPU DAI driver for audio base on rpmsg

This is a cpu dai driver for rpmsg audio use case,
which is mainly used for getting the user's configuration
from devicetree and configure the clocks which is used by
Cortex-M core.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1615516725-4975-3-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: soc-component: Add snd_soc_pcm_component_ack
Shengjiu Wang [Fri, 12 Mar 2021 02:38:40 +0000 (10:38 +0800)]
ASoC: soc-component: Add snd_soc_pcm_component_ack

Add snd_soc_pcm_component_ack back, which can be used to get an
updated buffer pointer in the platform driver.
On Asymmetric multiprocessor, this pointer can be sent to Cortex-M
core for audio processing.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1615516725-4975-2-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoMerge series "MFD/extcon/ASoC: Rework arizona codec jack-detect support" from Hans...
Mark Brown [Wed, 24 Mar 2021 23:29:33 +0000 (23:29 +0000)]
Merge series "MFD/extcon/ASoC: Rework arizona codec jack-detect support" from Hans de Goede <hdegoede@redhat.com>:

Hi All,

Here is v4 of my series to rework the arizona codec jack-detect support
to use the snd_soc_jack helpers instead of direct extcon reporting.

As discussed before here is a resend rebased on 5.12-rc2, making sure that
all patches this depends on are in place.

Lee, can you pick-up patches 1-6 through the MFD tree and then send a
pull-req to Mark so that Mark can merge the Asoc parts throught the ASoC
tree ?

Patches 2-6 touch drivers/extcon, these all have an Ack from Chanwoo Choi
for merging these through the MFD tree.

Here is some more generic info on this series from the previous
cover-letter:

This is done by reworking the extcon driver into an arizona-jackdet
library and then modifying the codec drivers to use that directly,
replacing the old separate extcon child-devices and extcon-driver.

This brings the arizona-codec jack-detect handling inline with how
all other ASoC codec driver do this. This was developed and tested on
a Lenovo Yoga Tablet 1051L with a WM5102 codec.

This was also tested by Charles Keepax, one of the Cirrus Codec folks.

Regards,

Hans

Hans de Goede (13):
  mfd: arizona: Drop arizona-extcon cells
  extcon: arizona: Fix some issues when HPDET IRQ fires after the jack
    has been unplugged
  extcon: arizona: Fix various races on driver unbind
  extcon: arizona: Fix flags parameter to the gpiod_get("wlf,micd-pol")
    call
  extcon: arizona: Always use pm_runtime_get_sync() when we need the
    device to be awake
  ASoC/extcon: arizona: Move arizona jack code to
    sound/soc/codecs/arizona-jack.c
  ASoC: arizona-jack: Move jack-detect variables to struct arizona_priv
  ASoC: arizona-jack: Use arizona->dev for runtime-pm
  ASoC: arizona-jack: convert into a helper library for codec drivers
  ASoC: arizona-jack: Use snd_soc_jack to report jack events
  ASoC: arizona-jack: Cleanup logging
  ASoC: arizona: Make the wm5102, wm5110, wm8997 and wm8998 drivers use
    the new jack library
  ASoC: Intel: bytcr_wm5102: Add jack detect support

 MAINTAINERS                                   |   3 +-
 drivers/extcon/Kconfig                        |   8 -
 drivers/extcon/Makefile                       |   1 -
 drivers/mfd/arizona-core.c                    |  20 -
 sound/soc/codecs/Makefile                     |   2 +-
 .../soc/codecs/arizona-jack.c                 | 577 +++++++-----------
 sound/soc/codecs/arizona.h                    |  44 ++
 sound/soc/codecs/wm5102.c                     |  12 +-
 sound/soc/codecs/wm5110.c                     |  12 +-
 sound/soc/codecs/wm8997.c                     |  14 +-
 sound/soc/codecs/wm8998.c                     |   9 +
 sound/soc/intel/boards/bytcr_wm5102.c         |  28 +-
 12 files changed, 325 insertions(+), 405 deletions(-)
 rename drivers/extcon/extcon-arizona.c => sound/soc/codecs/arizona-jack.c (76%)

--
2.30.1

3 years agoASoC: Intel: bytcr_wm5102: Add jack detect support
Hans de Goede [Sun, 7 Mar 2021 15:18:07 +0000 (16:18 +0100)]
ASoC: Intel: bytcr_wm5102: Add jack detect support

Add jack detect support by creating a jack and calling
snd_soc_component_set_jack to register the created jack
with the codec.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20210307151807.35201-14-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: arizona: Make the wm5102, wm5110, wm8997 and wm8998 drivers use the new jack...
Hans de Goede [Sun, 7 Mar 2021 15:18:06 +0000 (16:18 +0100)]
ASoC: arizona: Make the wm5102, wm5110, wm8997 and wm8998 drivers use the new jack library

Make all arizona codec drivers for which drivers/mfd/arizona-core.c used
to instantiate a "arizona-extcon" child-device use the new arizona-jack.c
library for jack-detection.

This has been tested on a Lenovo Yoga Tablet 2 1051L with a WM5102 codec.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Tested-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20210307151807.35201-13-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: arizona-jack: Cleanup logging
Hans de Goede [Sun, 7 Mar 2021 15:18:05 +0000 (16:18 +0100)]
ASoC: arizona-jack: Cleanup logging

Cleanup the use of dev_foo functions used for logging:

1. Many of these are unnecessarily split over multiple lines
2. Use dev_err_probe() in cases where we might get a -EPROBE_DEFER
   return value

Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Tested-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20210307151807.35201-12-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: arizona-jack: Use snd_soc_jack to report jack events
Hans de Goede [Sun, 7 Mar 2021 15:18:04 +0000 (16:18 +0100)]
ASoC: arizona-jack: Use snd_soc_jack to report jack events

Use the snd_soc_jack code to report jack events, instead of using extcon
for reporting the cable-type + an input_dev for reporting the button
presses.

The snd_soc_jack code will report the cable-type through both input_dev
events and through ALSA controls and the button-presses through input_dev
events.

Note that this means that when the codec drivers are moved over to use
the new arizona-jack.c library code instead of having a separate MFD
extcon cell with the extcon-arizona.c driver, we will no longer report
extcon events to userspace for cable-type changes. This should not be
a problem since "standard" Linux distro userspace does not (and has
never) used the extcon class interface for this. Android does have
support for the extcon class interface, but that was introduced in
the same release as support for input_dev cable-type events, so this
should not be a problem for Android either.

Note this also reduces ARIZONA_MAX_MICD_RANGE from 8 to 6, this is
ok to do since this info is always provided through pdata (or defaults)
and cannot be overridden from devicetree. All in-kernel users of the
pdata (and the fallback defaults) define 6 or less buttons/ranges.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Tested-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20210307151807.35201-11-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: arizona-jack: convert into a helper library for codec drivers
Hans de Goede [Sun, 7 Mar 2021 15:18:03 +0000 (16:18 +0100)]
ASoC: arizona-jack: convert into a helper library for codec drivers

Convert the arizona extcon driver into a helper library for direct use
from the arizona codec-drivers, rather then being bound to a separate
MFD cell.

Note the probe (and remove) sequence is split into 2 parts:

1. The arizona_jack_codec_dev_probe() function inits a bunch of
jack-detect specific variables in struct arizona_priv and tries to get
a number of resources where getting them may fail with -EPROBE_DEFER.

2. Then once the machine driver has create a snd_sock_jack through
snd_soc_card_jack_new() it calls snd_soc_component_set_jack() on
the codec component, which will call the new arizona_jack_set_jack(),
which sets up jack-detection and requests the IRQs.

This split is necessary, because the IRQ handlers need access to the
arizona->dapm pointer and the snd_sock_jack which are not available
when the codec-driver's probe function runs.

Note this requires that machine-drivers for codecs which are converted
to use the new helper functions from arizona-jack.c are modified to
create a snd_soc_jack through snd_soc_card_jack_new() and register
this jack with the codec through snd_soc_component_set_jack().

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Tested-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20210307151807.35201-10-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: arizona-jack: Use arizona->dev for runtime-pm
Hans de Goede [Sun, 7 Mar 2021 15:18:02 +0000 (16:18 +0100)]
ASoC: arizona-jack: Use arizona->dev for runtime-pm

Drivers for MFD child-devices such as the arizona codec drivers
and the arizona-extcon driver can choose to either make
runtime_pm_get/_put calls on their own child-device, which will
then be propagated to their parent; or they can make them directly
on their MFD parent-device.

The arizona-extcon code was using runtime_pm_get/_put calls on
its own child-device where as the codec drivers are using
runtime_pm_get/_put calls on their parent.

The arizona-extcon MFD cell/child-device has been removed and this
commit is part of refactoring the arizona-extcon code into a library
to be used directly from the codec drivers.

Specifically this commit moves the code over to make
runtime_pm_get/_put calls on the parent device (on arizona->dev)
bringing the code inline with how the codec drivers do this.

Note this also removes the pm_runtime_enable/_disable calls
as pm_runtime support has already been enabled on the parent-device
by the arizona MFD driver.

This is part of a patch series converting the arizona extcon driver into
a helper library for letting the arizona codec-drivers directly report
jack state through the standard sound/soc/soc-jack.c functions.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Tested-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20210307151807.35201-9-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: arizona-jack: Move jack-detect variables to struct arizona_priv
Hans de Goede [Sun, 7 Mar 2021 15:18:01 +0000 (16:18 +0100)]
ASoC: arizona-jack: Move jack-detect variables to struct arizona_priv

Move all the jack-detect variables from struct arizona_extcon_info to
struct arizona_priv.

This is part of a patch series converting the arizona extcon driver into
a helper library for letting the arizona codec-drivers directly report jack
state through the standard sound/soc/soc-jack.c functions.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Tested-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20210307151807.35201-8-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: fsl_micfil: Don't use devm_regmap_init_mmio_clk
Shengjiu Wang [Wed, 24 Mar 2021 09:58:48 +0000 (17:58 +0800)]
ASoC: fsl_micfil: Don't use devm_regmap_init_mmio_clk

When there is power domain bind with ipg_clk clock,

The call flow:
devm_regmap_init_mmio_clk
   - clk_prepare()
      - clk_pm_runtime_get()

cause the power domain of clock always be enabled after
regmap_init(). which impact the power consumption.

So use devm_regmap_init_mmio instead of
devm_regmap_init_mmio_clk,but explicitly enable
clock when it is used.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
Link: https://lore.kernel.org/r/1616579928-22428-7-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: fsl_audmix: Don't use devm_regmap_init_mmio_clk
Shengjiu Wang [Wed, 24 Mar 2021 09:58:47 +0000 (17:58 +0800)]
ASoC: fsl_audmix: Don't use devm_regmap_init_mmio_clk

When there is power domain bind with ipg clock,

The call flow:
devm_regmap_init_mmio_clk
   - clk_prepare()
       - clk_pm_runtime_get()

cause the power domain of clock always be enabled after
regmap_init(). which impact the power consumption.

So use devm_regmap_init_mmio instead of
devm_regmap_init_mmio_clk,but explicitly enable
clock when it is used.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1616579928-22428-6-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: fsl_easrc: Don't use devm_regmap_init_mmio_clk
Shengjiu Wang [Wed, 24 Mar 2021 09:58:46 +0000 (17:58 +0800)]
ASoC: fsl_easrc: Don't use devm_regmap_init_mmio_clk

When there is power domain bind with mem clock,

The call flow:
devm_regmap_init_mmio_clk
  - clk_prepare()
      - clk_pm_runtime_get()

cause the power domain of clock always be enabled after
regmap_init(). which impact the power consumption.

So use devm_regmap_init_mmio instead of
devm_regmap_init_mmio_clk,but explicitly enable
clock when it is used.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1616579928-22428-5-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: fsl_asrc: Don't use devm_regmap_init_mmio_clk
Shengjiu Wang [Wed, 24 Mar 2021 09:58:45 +0000 (17:58 +0800)]
ASoC: fsl_asrc: Don't use devm_regmap_init_mmio_clk

When there is power domain bind with mem clock,

The call flow:
devm_regmap_init_mmio_clk
   - clk_prepare()
       - clk_pm_runtime_get()

cause the power domain of clock always be enabled after
regmap_init(). which impact the power consumption.

So use devm_regmap_init_mmio instead of
devm_regmap_init_mmio_clk,but explicitly enable
clock when it is used.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1616579928-22428-4-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: fsl_spdif: Don't use devm_regmap_init_mmio_clk
Shengjiu Wang [Wed, 24 Mar 2021 09:58:44 +0000 (17:58 +0800)]
ASoC: fsl_spdif: Don't use devm_regmap_init_mmio_clk

When there is power domain bind with core clock,

The call flow:
devm_regmap_init_mmio_clk
   - clk_prepare()
       - clk_pm_runtime_get()

cause the power domain of clock always be enabled after
regmap_init(). which impact the power consumption.

So use devm_regmap_init_mmio instead of
devm_regmap_init_mmio_clk,but explicitly enable
clock when it is used.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1616579928-22428-3-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: fsl_esai: Don't use devm_regmap_init_mmio_clk
Shengjiu Wang [Wed, 24 Mar 2021 09:58:43 +0000 (17:58 +0800)]
ASoC: fsl_esai: Don't use devm_regmap_init_mmio_clk

When there is power domain bind with bus clock,

The call flow:
devm_regmap_init_mmio_clk
    - clk_prepare()
       - clk_pm_runtime_get()

cause the power domain of clock always be enabled after
regmap_init(). which impact the power consumption.

So use devm_regmap_init_mmio instead of
devm_regmap_init_mmio_clk,but explicitly enable
clock when it is used.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1616579928-22428-2-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoMerge tag 'ib-mfd-extcon-v5.13' of git://git.kernel.org/pub/scm/linux/kernel/git...
Mark Brown [Tue, 23 Mar 2021 22:13:35 +0000 (22:13 +0000)]
Merge tag 'ib-mfd-extcon-v5.13' of git://git./linux/kernel/git/lee/mfd into asoc-5.13

Immutable branch between MFD and Extcon due for the v5.13 merge window

3 years agoASoC: SOF: Intel: hda: drop display power on/off in D0i3 flows
Kai Vehmanen [Mon, 22 Mar 2021 14:38:30 +0000 (16:38 +0200)]
ASoC: SOF: Intel: hda: drop display power on/off in D0i3 flows

Controller needs to ensure display power is enabled only for
HDA controller reset. Drop the display power-up/down calls from
D0i3 entry/exit paths.

This was previously not possible as codec drivers could not resume the
links, and instead controller kept the reference to display power. The
state of display power had be maintained in the D0i3 entry/exit code.
With commit 87fc20e4a0cb ("ASoC: SOF: Intel: hda: use hdac_ext
fine-grained link management"), this is no longer needed and the code
can be cleaned up.

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/20210322143830.3880293-1-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: intel: sof_rt5682: use the topology mclk
Keyon Jie [Fri, 19 Mar 2021 12:49:50 +0000 (14:49 +0200)]
ASoC: intel: sof_rt5682: use the topology mclk

We should use the topology configured mclk if it existed, which can make
sure we are aligned with the FW side about the mclk usage.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20210319124950.3853994-2-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: SOF: add a helper to get topology configured mclk
Keyon Jie [Fri, 19 Mar 2021 12:49:49 +0000 (14:49 +0200)]
ASoC: SOF: add a helper to get topology configured mclk

Add helper sof_dai_ssp_mclk to get the topology configured MCLK from a
pcm_runtime, return 0 if it is not available, and error if the dai type
is not SSP at the moment.

Export the helper for external use, e.g. from machine drivers.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20210319124950.3853994-1-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: fsl_sai: Don't use devm_regmap_init_mmio_clk
Shengjiu Wang [Fri, 19 Mar 2021 08:06:43 +0000 (16:06 +0800)]
ASoC: fsl_sai: Don't use devm_regmap_init_mmio_clk

When there is power domain bind with bus clock,

The call flow:
devm_regmap_init_mmio_clk
   - clk_prepare()
      - clk_pm_runtime_get()

cause the power domain of clock always be enabled after
regmap_init(). which impact the power consumption.

So use devm_regmap_init_mmio instead of
devm_regmap_init_mmio_clk, then explicitly enable clock when
using by pm_runtime_get(), if CONFIG_PM=n, then
fsl_sai_runtime_resume will be explicitly called.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Link: https://lore.kernel.org/r/1616141203-13344-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: amd: Add support for RT5682 codec in machine driver
Vijendar Mukunda [Fri, 19 Mar 2021 01:40:42 +0000 (07:10 +0530)]
ASoC: amd: Add support for RT5682 codec in machine driver

Add support for RT5682 codec in machine driver.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://lore.kernel.org/r/1616118056-5506-1-git-send-email-Vijendar.Mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoMerge series "ASoC: tidyup error message timing" from Kuninori Morimoto <kuninori...
Mark Brown [Fri, 19 Mar 2021 16:31:39 +0000 (16:31 +0000)]
Merge series "ASoC: tidyup error message timing" from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:

Hi Mark

Indicating error message when failed case is very useful for debuging.
In many case, it uses below style.

int function(...)
{
...
return ret;
}

int caller(...)
{
...
ret = function(...);
if (ret < 0)
dev_err(...)
...
}

This is not so bad, but in this style *each caller* needs to indicate
duplicate same error message, and some caller is forgetting to do it.
And caller can't indicate detail function() error information.

I know many people have many opinion, but if function() indicates error
message, we can get same and detail information without forgot, and it is better.
This patch-set tidyup to do it.

int function(...)
{
...
if (ret < 0)
dev_err(...)

return ret;
}

int caller(...)
{
...
ret = function(...);
...
}

Kuninori Morimoto (14):
  ASoC: soc-pcm: indicate error message at soc_pcm_open()
  ASoC: soc-pcm: indicate error message at soc_pcm_hw_params()
  ASoC: soc-pcm: indicate error message at soc_pcm_prepare()
  ASoC: soc-pcm: indicate error message at dpcm_path_get()
  ASoC: soc-pcm: indicate error message at dpcm_be_dai_trigger()
  ASoC: soc-pcm: indicate error message at dpcm_apply_symmetry()
  ASoC: soc-pcm: indicate error message at dpcm_run_update_startup/shutdown()
  ASoC: soc-pcm: indicate error message at dpcm_fe/be_dai_startup()
  ASoC: soc-pcm: indicate error message at dpcm_fe/be_dai_hw_params()
  ASoC: soc-pcm: indicate error message at dpcm_fe/be_dai_prepare()
  ASoC: soc-pcm: don't indicate error message for soc_pcm_hw_free()
  ASoC: soc-pcm: don't indicate error message for dpcm_be_dai_hw_free()
  ASoC: don't indicate error message for snd_soc_[pcm_]dai_xxx()
  ASoC: don't indicate error message for snd_soc_[pcm_]component_xxx()

 include/sound/soc-dpcm.h |   2 +-
 sound/soc/soc-compress.c |   9 +-
 sound/soc/soc-core.c     |  22 +----
 sound/soc/soc-dapm.c     |  24 ++---
 sound/soc/soc-pcm.c      | 197 +++++++++++++++++++--------------------
 5 files changed, 108 insertions(+), 146 deletions(-)

--
2.25.1

3 years agoASoC: rt1019: make symbol 'rt1019_i2c_driver' static
Wei Yongjun [Fri, 19 Mar 2021 09:41:02 +0000 (09:41 +0000)]
ASoC: rt1019: make symbol 'rt1019_i2c_driver' static

The sparse tool complains as follows:

sound/soc/codecs/rt1019.c:927:19: warning:
 symbol 'rt1019_i2c_driver' was not declared. Should it be static?

This symbol is not used outside of rt1019.c, so this
commit marks it static.

Fixes: 7ec79d3850d0 ("ASoC: rt1019: add rt1019 amplifier driver")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Link: https://lore.kernel.org/r/20210319094102.4185096-1-weiyongjun1@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: don't indicate error message for snd_soc_[pcm_]component_xxx()
Kuninori Morimoto [Mon, 15 Mar 2021 00:58:41 +0000 (09:58 +0900)]
ASoC: don't indicate error message for snd_soc_[pcm_]component_xxx()

All snd_soc_component_xxx() and snd_soc_pcm_component_xxx() itself
indicate error message if failed.
Its caller doesn't need to indicate duplicated error message.
This patch removes it.

All snd_soc_component_xxx() indicate error message if failed.
Its caller doesn't need to indicate duplicated error message.
This patch removes it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/878s6puta6.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: don't indicate error message for snd_soc_[pcm_]dai_xxx()
Kuninori Morimoto [Mon, 15 Mar 2021 00:58:37 +0000 (09:58 +0900)]
ASoC: don't indicate error message for snd_soc_[pcm_]dai_xxx()

All snd_soc_dai_xxx() and snd_soc_pcm_dai_xxx() itself
indicate error message if failed.
Its caller doesn't need to indicate duplicated error message.
This patch removes it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87a6r5utaa.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: soc-pcm: don't indicate error message for dpcm_be_dai_hw_free()
Kuninori Morimoto [Mon, 15 Mar 2021 00:58:32 +0000 (09:58 +0900)]
ASoC: soc-pcm: don't indicate error message for dpcm_be_dai_hw_free()

dpcm_be_dai_hw_free() never fail, error message is not needed.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87blblutaf.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: soc-pcm: don't indicate error message for soc_pcm_hw_free()
Kuninori Morimoto [Mon, 15 Mar 2021 00:58:28 +0000 (09:58 +0900)]
ASoC: soc-pcm: don't indicate error message for soc_pcm_hw_free()

soc_pcm_hw_free() never fail, error message is not needed.
We can't use void function for it, because it is used
part of struct snd_pcm_ops :: hw_free.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87czw1utaj.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: soc-pcm: indicate error message at dpcm_fe/be_dai_prepare()
Kuninori Morimoto [Mon, 15 Mar 2021 00:58:22 +0000 (09:58 +0900)]
ASoC: soc-pcm: indicate error message at dpcm_fe/be_dai_prepare()

Indicating error message when failed case is very useful for debuging.
In many case, its style is like below.

int function(...)
{
...
return ret;
}

int caller(...)
{
...
ret = function(...);
if (ret < 0)
dev_err(...)
...
}

This is not so bad, but in this style *each caller* needs to indicate
duplicate same error message, and some caller is forgetting to do it.
And caller can't indicate detail function() error information.

If function() indicates error message, we can get same and
detail information without forgot.

int function(...)
{
...
if (ret < 0)
dev_err(...)

return ret;
}

int caller(...)
{
...
ret = function(...);
...
}

This patch follow above style at dpcm_fe/be_dai_prepare()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87eeghutap.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: soc-pcm: indicate error message at dpcm_fe/be_dai_hw_params()
Kuninori Morimoto [Mon, 15 Mar 2021 00:58:18 +0000 (09:58 +0900)]
ASoC: soc-pcm: indicate error message at dpcm_fe/be_dai_hw_params()

Indicating error message when failed case is very useful for debuging.
In many case, its style is like below.

int function(...)
{
...
return ret;
}

int caller(...)
{
...
ret = function(...);
if (ret < 0)
dev_err(...)
...
}

This is not so bad, but in this style *each caller* needs to indicate
duplicate same error message, and some caller is forgetting to do it.
And caller can't indicate detail function() error information.

If function() indicates error message, we can get same and
detail information without forgot.

int function(...)
{
...
if (ret < 0)
dev_err(...)

return ret;
}

int caller(...)
{
...
ret = function(...);
...
}

This patch follow above style at dpcm_fe/be_dai_hw_params()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87ft0xutat.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: soc-pcm: indicate error message at dpcm_fe/be_dai_startup()
Kuninori Morimoto [Mon, 15 Mar 2021 00:58:13 +0000 (09:58 +0900)]
ASoC: soc-pcm: indicate error message at dpcm_fe/be_dai_startup()

Indicating error message when failed case is very useful for debuging.
In many case, its style is like below.

int function(...)
{
...
return ret;
}

int caller(...)
{
...
ret = function(...);
if (ret < 0)
dev_err(...)
...
}

This is not so bad, but in this style *each caller* needs to indicate
duplicate same error message, and some caller is forgetting to do it.
And caller can't indicate detail function() error information.

If function() indicates error message, we can get same and
detail information without forgot.

int function(...)
{
...
if (ret < 0)
dev_err(...)

return ret;
}

int caller(...)
{
...
ret = function(...);
...
}

This patch follow above style at dpcm_fe/be_dai_startup().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87h7ldutay.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: soc-pcm: indicate error message at dpcm_run_update_startup/shutdown()
Kuninori Morimoto [Mon, 15 Mar 2021 00:58:08 +0000 (09:58 +0900)]
ASoC: soc-pcm: indicate error message at dpcm_run_update_startup/shutdown()

Indicating error message when failed case is very useful for debuging.
In many case, its style is like below.

int function(...)
{
...
return ret;
}

int caller(...)
{
...
ret = function(...);
if (ret < 0)
dev_err(...)
...
}

This is not so bad, but in this style *each caller* needs to indicate
duplicate same error message, and some caller is forgetting to do it.
And caller can't indicate detail function() error information.

If function() indicates error message, we can get same and
detail information without forgot.

int function(...)
{
...
if (ret < 0)
dev_err(...)

return ret;
}

int caller(...)
{
...
ret = function(...);
...
}

This patch also
do below to dpcm_run_update_startup()
1) remove duplicated ret = -EINVAL
2) remove blank line
do below to dpcm_run_update_shutdown()
1) remove unused ret

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87im5tutb3.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: soc-pcm: indicate error message at dpcm_apply_symmetry()
Kuninori Morimoto [Mon, 15 Mar 2021 00:58:02 +0000 (09:58 +0900)]
ASoC: soc-pcm: indicate error message at dpcm_apply_symmetry()

Indicating error message when failed case is very useful for debuging.
In many case, its style is like below.

int function(...)
{
...
return ret;
}

int caller(...)
{
...
ret = function(...);
if (ret < 0)
dev_err(...)
...
}

This is not so bad, but in this style *each caller* needs to indicate
duplicate same error message, and some caller is forgetting to do it.
And caller can't indicate detail function() error information.

If function() indicates error message, we can get same and
detail information without forgot.

int function(...)
{
...
if (ret < 0)
dev_err(...)

return ret;
}

int caller(...)
{
...
ret = function(...);
...
}

This patch follow above style at dpcm_apply_symmetry(...)

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87k0q9utb9.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: soc-pcm: indicate error message at dpcm_be_dai_trigger()
Kuninori Morimoto [Mon, 15 Mar 2021 00:57:57 +0000 (09:57 +0900)]
ASoC: soc-pcm: indicate error message at dpcm_be_dai_trigger()

Indicating error message when failed case is very useful for debuging.
In many case, its style is like below.

int function(...)
{
...
return ret;
}

int caller(...)
{
...
ret = function(...);
if (ret < 0)
dev_err(...)
...
}

This is not so bad, but in this style *each caller* needs to indicate
duplicate same error message, and some caller is forgetting to do it.
And caller can't indicate detail function() error information.

If function() indicates error message, we can get same and
detail information without forgot.

int function(...)
{
...
if (ret < 0)
dev_err(...)

return ret;
}

int caller(...)
{
...
ret = function(...);
...
}

Now, dpcm_be_dai_trigger() user uses it like below.

err = dpcm_be_dai_trigger(...);
if (err < 0)
dev_err(..., "ASoC: trigger FE failed %d\n", err);

But we can get more detail information if dpcm_be_dai_trigger() itself
had dev_err(). And above error message is confusable,
failed is *BE*, not *FE*.

This patch indicates error message at dpcm_be_dai_trigger().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87lfaputbe.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: soc-pcm: indicate error message at dpcm_path_get()
Kuninori Morimoto [Mon, 15 Mar 2021 00:57:52 +0000 (09:57 +0900)]
ASoC: soc-pcm: indicate error message at dpcm_path_get()

Indicating error message when failed case is very useful for debuging.
In many case, its style is like below.

int function(...)
{
...
return ret;
}

int caller(...)
{
...
ret = function(...);
if (ret < 0)
dev_err(...)
...
}

This is not so bad, but in this style *each caller* needs to indicate
duplicate same error message, and some caller is forgetting to do it.
And caller can't indicate detail function() error information.

If function() indicates error message, we can get same and
detail information without forgot.

int function(...)
{
...
if (ret < 0)
dev_err(...)

return ret;
}

int caller(...)
{
...
ret = function(...);
...
}

Now, many place uses dpcm_path_get() like below

ret = dpcm_path_get(...);
if (ret < 0)
goto error;
(A) else if (ret == 0)
dev_dbg(...)

But here, (A) part can be indicated at dpcm_path_get() not caller.
It is simple and readable code.

This patch do it.
Small detail behaviors will be exchanged by this patch.

1) indicates debug info (= path numbers) if path > 0 case only
   (It was *always* indicated).
2) soc_dpcm_fe_runtime_update() is indicating error message
   for paths < 0 case, but it is already done at dpcm_path_get().
   Thus just remove it. but dev_dbg() vs dev_warn() is exchanged.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87mtv5utbj.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: soc-pcm: indicate error message at soc_pcm_prepare()
Kuninori Morimoto [Mon, 15 Mar 2021 00:57:48 +0000 (09:57 +0900)]
ASoC: soc-pcm: indicate error message at soc_pcm_prepare()

Indicating error message when failed case is very useful for debuging.
In many case, its style is like below.

int function(...)
{
...
return ret;
}

int caller(...)
{
...
ret = function(...);
if (ret < 0)
dev_err(...)
...
}

This is not so bad, but in this style *each caller* needs to indicate
duplicate same error message, and some caller is forgetting to do it.
And caller can't indicate detail function() error information.

If function() indicates error message, we can get same and
detail information without forgot.

int function(...)
{
...
if (ret < 0)
dev_err(...)

return ret;
}

int caller(...)
{
...
ret = function(...);
...
}

This patch follow above style at soc_pcm_prepare().

By this patch, dpcm_fe/be_dai_prepare(...)
temporary lacks FE/BE error info, but it will reborn soon.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87o8flutbn.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: soc-pcm: indicate error message at soc_pcm_hw_params()
Kuninori Morimoto [Mon, 15 Mar 2021 00:57:42 +0000 (09:57 +0900)]
ASoC: soc-pcm: indicate error message at soc_pcm_hw_params()

Indicating error message when failed case is very useful for debuging.
In many case, its style is like below.

int function(...)
{
...
return ret;
}

int caller(...)
{
...
ret = function(...);
if (ret < 0)
dev_err(...)
...
}

This is not so bad, but in this style *each caller* needs to indicate
duplicate same error message, and some caller is forgetting to do it.
And caller can't indicate detail function() error information.

If function() indicates error message, we can get same and
detail information without forgot.

int function(...)
{
...
if (ret < 0)
dev_err(...)

return ret;
}

int caller(...)
{
...
ret = function(...);
...
}

This patch follow above style at soc_pcm_hw_params().

By this patch, dpcm_fe/be_dai_hw_params(...)
temporary lacks FE/BE error info, but it will reborn soon.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87pn01utbt.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: soc-pcm: indicate error message at soc_pcm_open()
Kuninori Morimoto [Mon, 15 Mar 2021 00:57:37 +0000 (09:57 +0900)]
ASoC: soc-pcm: indicate error message at soc_pcm_open()

Indicating error message when failed case is very useful for debuging.
In many case, its style is like below.

int function(...)
{
...
return ret;
}

int caller(...)
{
...
ret = function(...);
if (ret < 0)
dev_err(...)
...
}

This is not so bad, but in this style *each caller* needs to indicate
duplicate same error message, and some caller is forgetting to do it.
And caller can't indicate detail function() error information.

If function() indicates error message, we can get same and
detail information without forgot.

int function(...)
{
...
if (ret < 0)
dev_err(...)

return ret;
}

int caller(...)
{
...
ret = function(...);
...
}

This patch follow above style at soc_pcm_open().

By this patch, dpcm_fe/be_dai_startup(...)
temporary lacks FE/BE error info, but it will reborn soon.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87r1khutby.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoMerge series "ASoC: codecs: remove cppcheck warnings" from Pierre-Louis Bossart ...
Mark Brown [Thu, 18 Mar 2021 17:52:22 +0000 (17:52 +0000)]
Merge series "ASoC: codecs: remove cppcheck warnings" from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

Lots of small fixes in various codec drivers that should have no
functional impact.

Pierre-Louis Bossart (23):
  ASoC: ab8500-codec: remove useless structure
  ASoC: ad1836: remove useless return
  ASoC: adau1977: remove useless return
  ASoC: cros_ec_codec: remove null pointer dereference warning
  ASoC: cx2070x: remove useless assignment
  ASoC: cx2070x: remove duplicate else branch
  ASoC: da7219-aad: remove useless initialization
  ASoC: hdac_hdmi: remove useless initializations
  ASoC: hdac_hdmi: align function arguments
  ASoC: hdmi-codec: remove useless initialization
  ASoC: hdmi-codec: remove unused spk_mask member
  ASoC: max98090: remove useless assignment
  ASoC: mt6358: remove useless initializations
  ASoC: mt6359: remove useless assignment
  ASoC: nau8825: remove useless assignment
  ASoC: pcm1681: remove useless assignment
  ASoC: sigmadsp: align function prototype
  ASoC: sti-sas: remove unused struct members
  ASoC: tas2562: remove useless assignment
  ASoC: tas2562: remove warning on return value
  ASoC: tas2770: remove useless initialization
  ASoC: tlv320dac33: clarify expression
  ASoC: tscs454: remove useless test on PLL disable

 sound/soc/codecs/ab8500-codec.c  |  7 -------
 sound/soc/codecs/ad1836.c        |  2 --
 sound/soc/codecs/adau1977.c      |  2 --
 sound/soc/codecs/cros_ec_codec.c |  2 +-
 sound/soc/codecs/cx2072x.c       | 11 ++++-------
 sound/soc/codecs/da7219-aad.c    |  2 +-
 sound/soc/codecs/hdac_hdmi.c     | 14 +++++++-------
 sound/soc/codecs/hdac_hdmi.h     |  2 +-
 sound/soc/codecs/hdmi-codec.c    |  3 +--
 sound/soc/codecs/max98090.c      |  2 +-
 sound/soc/codecs/mt6358.c        |  4 ++--
 sound/soc/codecs/mt6359.c        |  4 ++--
 sound/soc/codecs/nau8825.c       |  2 +-
 sound/soc/codecs/pcm1681.c       |  2 +-
 sound/soc/codecs/sigmadsp.h      |  2 +-
 sound/soc/codecs/sti-sas.c       |  3 ---
 sound/soc/codecs/tas2562.c       |  3 +--
 sound/soc/codecs/tas2770.c       |  2 +-
 sound/soc/codecs/tlv320dac33.c   |  2 +-
 sound/soc/codecs/tscs454.c       |  7 ++++++-
 20 files changed, 32 insertions(+), 46 deletions(-)

--
2.25.1

3 years agoMerge series "Fix reset controls and RPM of NVIDIA Tegra ASoC drivers" from Dmitry...
Mark Brown [Thu, 18 Mar 2021 17:52:21 +0000 (17:52 +0000)]
Merge series "Fix reset controls and RPM of NVIDIA Tegra ASoC drivers" from Dmitry Osipenko <digetx@gmail.com>:

Hi,

This series adds missing hardware reset controls to I2S and AC97 drivers,
corrects runtime PM usage and drivers probe/remove order. Currently drivers
happen to work properly because reset is implicitly deasserted by tegra-clk
driver, but clk driver shouldn't touch the resets and we need to fix it
because this breaks other Tegra drivers. Previously we fixed the resets of
the AHUB and HDMI codec drivers, but turned out that we missed the I2C and
AC97 drivers.

Thanks to Paul Fertser for testing the pending clk patches and finding
that audio got broken on Tegra20 AC100 netbook because of the missing I2S
reset.

Changelog:

v5: - After taking another look at the drivers I noticed couple more
      things that could be improved. These new patches correct runtime PM
      and probe/remove order of the drivers:

        ASoC: tegra20: spdif: Correct driver removal order
        ASoC: tegra20: spdif: Remove handing of disabled runtime PM
        ASoC: tegra20: i2s: Add system level suspend-resume callbacks
        ASoC: tegra20: i2s: Correct driver removal order
        ASoC: tegra20: i2s: Use devm_clk_get()
        ASoC: tegra20: i2s: Remove handing of disabled runtime PM
        ASoC: tegra30: i2s: Correct driver removal order
        ASoC: tegra30: i2s: Use devm_clk_get()
        ASoC: tegra30: i2s: Remove handing of disabled runtime PM
        ASoC: tegra30: ahub: Reset global variable
        ASoC: tegra30: ahub: Correct suspend-resume callbacks
        ASoC: tegra30: ahub: Remove handing of disabled runtime PM

v4: - Added missing prototype for reset_control_bulk_put().

v3: - Fixed reset stubs for !CONFIG_RESET_CONTROLLER.

v2: - After some more testing I found that I2S control logic doesn't require
      I2S clock to be enabled for resetting. Hence it's fine to have I2S to
      be reset by parent AHUB driver, so I dropped "tegra30: i2s: Add reset
      control" patch.

    - While I was double-checking resets on Tegra30, I found that that
      Tegra30 I2S driver has a broken runtime PM which doesn't restore
      hardware state on resume and it's lost after AHUB RPM-resume.
      Thus, added this new patch "tegra30: i2s: Restore hardware state
      on runtime PM resume".

    - Added new patches which switch AHUB driver to use reset-bulk API.
      I took the RFC patch from Philipp Zabel, fixed it and added
      devm_reset_control_bulk_optional_get_exclusive_released() that
      will be useful for further Tegra GPU patches. This is a minor
      improvement which makes code cleaner.

Dmitry Osipenko (16):
  ASoC: tegra20: ac97: Add reset control
  ASoC: tegra20: i2s: Add reset control
  ASoC: tegra30: i2s: Restore hardware state on runtime PM resume
  ASoC: tegra30: ahub: Switch to use reset-bulk API
  ASoC: tegra20: spdif: Correct driver removal order
  ASoC: tegra20: spdif: Remove handing of disabled runtime PM
  ASoC: tegra20: i2s: Add system level suspend-resume callbacks
  ASoC: tegra20: i2s: Correct driver removal order
  ASoC: tegra20: i2s: Use devm_clk_get()
  ASoC: tegra20: i2s: Remove handing of disabled runtime PM
  ASoC: tegra30: i2s: Correct driver removal order
  ASoC: tegra30: i2s: Use devm_clk_get()
  ASoC: tegra30: i2s: Remove handing of disabled runtime PM
  ASoC: tegra30: ahub: Reset global variable
  ASoC: tegra30: ahub: Correct suspend-resume callbacks
  ASoC: tegra30: ahub: Remove handing of disabled runtime PM

Philipp Zabel (1):
  reset: Add reset_control_bulk API

 drivers/reset/core.c            | 215 ++++++++++++++++++++++
 include/linux/reset.h           | 315 ++++++++++++++++++++++++++++++++
 sound/soc/tegra/tegra20_ac97.c  |  21 +++
 sound/soc/tegra/tegra20_ac97.h  |   1 +
 sound/soc/tegra/tegra20_i2s.c   |  60 +++---
 sound/soc/tegra/tegra20_i2s.h   |   1 +
 sound/soc/tegra/tegra20_spdif.c |  16 +-
 sound/soc/tegra/tegra30_ahub.c  | 168 ++++++-----------
 sound/soc/tegra/tegra30_ahub.h  |   5 +-
 sound/soc/tegra/tegra30_i2s.c   |  65 ++-----
 10 files changed, 667 insertions(+), 200 deletions(-)

--
2.30.2

base-commit: a38fd8748464831584a19438cbb3082b5a2dab15

3 years agoASoC: Intel: sof_rt5682: Add ALC1015Q-VB speaker amp support
Brent Lu [Wed, 17 Mar 2021 11:08:24 +0000 (19:08 +0800)]
ASoC: Intel: sof_rt5682: Add ALC1015Q-VB speaker amp support

This patch adds jsl_rt5682_rt1015p which supports the RT5682 headset
codec and ALC1015Q-VB speaker amplifier combination on JasperLake
platform.

This driver also supports ALC1015Q-CG if running in auto-mode.
Following table shows the audio interface support of the two
amplifiers.

          | ALC1015Q-CG | ALC1015Q-VB
=====================================
I2C       | Yes         | No
Auto-mode | 48K, 64fs   | 16k, 32fs
                        | 48k, 32fs
                        | 48k, 64fs

Signed-off-by: Brent Lu <brent.lu@intel.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210317110824.20814-1-brent.lu@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: rt1019: add rt1019 amplifier driver
Jack Yu [Thu, 11 Mar 2021 02:58:09 +0000 (10:58 +0800)]
ASoC: rt1019: add rt1019 amplifier driver

This is initial amplifier driver for rt1019.

Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/20210311025809.31852-1-jack.yu@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: Fix a typo in the file rt5682.txt
Bhaskar Chowdhury [Sat, 13 Mar 2021 23:18:50 +0000 (04:48 +0530)]
ASoC: Fix a typo in the file rt5682.txt

s/drving/driving/

Signed-off-by: Bhaskar Chowdhury <unixbhaskar@gmail.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Link: https://lore.kernel.org/r/20210313231850.17278-1-unixbhaskar@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: Intel: Skylake: skl-topology: fix -frame-larger-than
Nick Desaulniers [Mon, 15 Mar 2021 01:39:08 +0000 (18:39 -0700)]
ASoC: Intel: Skylake: skl-topology: fix -frame-larger-than

sound/soc/intel/skylake/skl-topology.c:3613:13: warning: stack frame
size of 1304 bytes in function 'skl_tplg_complete'
[-Wframe-larger-than=]

struct snd_ctl_elem_value is 1224 bytes in my configuration.

Heap allocate it, then free it within the current frame.

Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Nick Desaulniers <nick.desaulniers@gmail.com>
Link: https://lore.kernel.org/r/20210315013908.217219-1-nick.desaulniers@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: tscs454: remove useless test on PLL disable
Pierre-Louis Bossart [Fri, 12 Mar 2021 18:22:46 +0000 (12:22 -0600)]
ASoC: tscs454: remove useless test on PLL disable

cppcheck warning:

sound/soc/codecs/tscs454.c:730:37: style: Same value in both branches
of ternary operator. [duplicateValueTernary]
  val = pll1 ? FV_PLL1CLKEN_DISABLE : FV_PLL2CLKEN_DISABLE;
                                    ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210312182246.5153-24-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: tlv320dac33: clarify expression
Pierre-Louis Bossart [Fri, 12 Mar 2021 18:22:45 +0000 (12:22 -0600)]
ASoC: tlv320dac33: clarify expression

cppcheck warning:

sound/soc/codecs/tlv320dac33.c:1074:43: style: Clarify calculation
precedence for '%' and '?'. [clarifyCalculation]
    (dac33->alarm_threshold % period_size ?
                                          ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210312182246.5153-23-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: tas2770: remove useless initialization
Pierre-Louis Bossart [Fri, 12 Mar 2021 18:22:44 +0000 (12:22 -0600)]
ASoC: tas2770: remove useless initialization

cppcheck warning:

sound/soc/codecs/tas2770.c:109: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/20210312182246.5153-22-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: tas2562: remove warning on return value
Pierre-Louis Bossart [Fri, 12 Mar 2021 18:22:43 +0000 (12:22 -0600)]
ASoC: tas2562: remove warning on return value

cppcheck warning:

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

Fix with return 0

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210312182246.5153-21-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: tas2562: remove useless assignment
Pierre-Louis Bossart [Fri, 12 Mar 2021 18:22:42 +0000 (12:22 -0600)]
ASoC: tas2562: remove useless assignment

cppcheck throws a warning:

sound/soc/codecs/tas2562.c:203:4: style: Assignment of function
parameter has no effect outside the function. [uselessAssignmentArg]
   tx_mask &= ~(1 << right_slot);
   ^

This assignment seems to come from a copy/paste but the value is
indeed not used. Let's remove it.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210312182246.5153-20-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: sti-sas: remove unused struct members
Pierre-Louis Bossart [Fri, 12 Mar 2021 18:22:41 +0000 (12:22 -0600)]
ASoC: sti-sas: remove unused struct members

cppcheck warnings:

sound/soc/codecs/sti-sas.c:54:25: style: struct member
'sti_dac_audio::field' is never used. [unusedStructMember]
 struct regmap_field  **field;
                        ^

sound/soc/codecs/sti-sas.c:55:24: style: struct member
'sti_dac_audio::rst' is never used. [unusedStructMember]
 struct reset_control *rst;
                       ^

sound/soc/codecs/sti-sas.c:61:25: style: struct member
'sti_spdif_audio::field' is never used. [unusedStructMember]
 struct regmap_field  **field;
                        ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210312182246.5153-19-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: sigmadsp: align function prototype
Pierre-Louis Bossart [Fri, 12 Mar 2021 18:22:40 +0000 (12:22 -0600)]
ASoC: sigmadsp: align function prototype

cppcheck warning:

sound/soc/codecs/sigmadsp.c:736:60: style:inconclusive: Function
'sigmadsp_setup' argument 2 names different: declaration 'rate'
definition 'samplerate'. [funcArgNamesDifferent]
int sigmadsp_setup(struct sigmadsp *sigmadsp, unsigned int samplerate)
                                                           ^

sound/soc/codecs/sigmadsp.h:62:60: note: Function 'sigmadsp_setup'
argument 2 names different: declaration 'rate' definition
'samplerate'.
int sigmadsp_setup(struct sigmadsp *sigmadsp, unsigned int rate);
                                                           ^

sound/soc/codecs/sigmadsp.c:736:60: note: Function 'sigmadsp_setup'
argument 2 names different: declaration 'rate' definition
'samplerate'.
int sigmadsp_setup(struct sigmadsp *sigmadsp, unsigned int samplerate)
                                                           ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210312182246.5153-18-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: pcm1681: remove useless assignment
Pierre-Louis Bossart [Fri, 12 Mar 2021 18:22:39 +0000 (12:22 -0600)]
ASoC: pcm1681: remove useless assignment

cppcheck warning:

sound/soc/codecs/pcm1681.c:87:8: style: Variable 'i' is assigned a
value that is never used. [unreadVariable]
 int i = 0, val = -1, enable = 0;
       ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210312182246.5153-17-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: nau8825: remove useless assignment
Pierre-Louis Bossart [Fri, 12 Mar 2021 18:22:38 +0000 (12:22 -0600)]
ASoC: nau8825: remove useless assignment

cppcheck warning:

sound/soc/codecs/nau8825.c:2113: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/20210312182246.5153-16-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: mt6359: remove useless assignment
Pierre-Louis Bossart [Fri, 12 Mar 2021 18:22:37 +0000 (12:22 -0600)]
ASoC: mt6359: remove useless assignment

cppcheck warning:

sound/soc/codecs/mt6359.c:242:19: style: Variable 'stage' is assigned a value that is never used. [unreadVariable]
 int i = 0, stage = 0;
                  ^
sound/soc/codecs/mt6359.c:260:19: style: Variable 'stage' is assigned a value that is never used. [unreadVariable]
 int i = 0, stage = 0;
                  ^
sound/soc/codecs/mt6359.c:274:8: style: Variable 'i' is assigned a value that is never used. [unreadVariable]
 int i = 0, stage = 0;
       ^
sound/soc/codecs/mt6359.c:274:19: style: Variable 'stage' is assigned a value that is never used. [unreadVariable]
 int i = 0, stage = 0;
                  ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210312182246.5153-15-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: mt6358: remove useless initializations
Pierre-Louis Bossart [Fri, 12 Mar 2021 18:22:36 +0000 (12:22 -0600)]
ASoC: mt6358: remove useless initializations

cppcheck warnings:

sound/soc/codecs/mt6358.c:334:19: style: Variable 'stage' is assigned
a value that is never used. [unreadVariable]
 int i = 0, stage = 0;
                  ^
sound/soc/codecs/mt6358.c:350:19: style: Variable 'stage' is assigned
a value that is never used. [unreadVariable]
 int i = 0, stage = 0;
                  ^
185/930 files checked 25% done
Checking sound/soc/codecs/mt6359.c ...
sound/soc/codecs/mt6359.c:274:8: style: Variable 'i' is assigned a
value that is never used. [unreadVariable]
 int i = 0, stage = 0;
       ^
sound/soc/codecs/mt6359.c:274:19: style: Variable 'stage' is assigned
a value that is never used. [unreadVariable]
 int i = 0, stage = 0;
                  ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210312182246.5153-14-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: max98090: remove useless assignment
Pierre-Louis Bossart [Fri, 12 Mar 2021 18:22:35 +0000 (12:22 -0600)]
ASoC: max98090: remove useless assignment

cppcheck warning:

sound/soc/codecs/max98090.c:1835:16: style: Variable 'test_diff' is
assigned a value that is never used. [unreadVariable]
 int test_diff = INT_MAX;
               ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210312182246.5153-13-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: hdmi-codec: remove unused spk_mask member
Pierre-Louis Bossart [Fri, 12 Mar 2021 18:22:34 +0000 (12:22 -0600)]
ASoC: hdmi-codec: remove unused spk_mask member

fix cppcheck warning:

sound/soc/codecs/hdmi-codec.c:25:16: style: struct member
'hdmi_codec_channel_map_table::spk_mask' is never
used. [unusedStructMember]
 unsigned long spk_mask;  /* speaker position bit mask */
               ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210312182246.5153-12-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: hdmi-codec: remove useless initialization
Pierre-Louis Bossart [Fri, 12 Mar 2021 18:22:33 +0000 (12:22 -0600)]
ASoC: hdmi-codec: remove useless initialization

Fix cppcheck warning:

sound/soc/codecs/hdmi-codec.c:745:5: style: Redundant initialization
for 'cf'. The initialized value is overwritten before it is
read. [redundantInitialization]
 cf = dai->playback_dma_data;
    ^
sound/soc/codecs/hdmi-codec.c:738:31: note: cf is initialized
 struct hdmi_codec_daifmt *cf = dai->playback_dma_data;
                              ^
sound/soc/codecs/hdmi-codec.c:745:5: note: cf is overwritten
 cf = dai->playback_dma_data;
    ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210312182246.5153-11-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: hdac_hdmi: align function arguments
Pierre-Louis Bossart [Fri, 12 Mar 2021 18:22:32 +0000 (12:22 -0600)]
ASoC: hdac_hdmi: align function arguments

cppcheck warning:

sound/soc/codecs/hdac_hdmi.c:1882:54: style:inconclusive: Function
'hdac_hdmi_jack_init' argument 2 names different: declaration 'pcm'
definition 'device'. [funcArgNamesDifferent]
int hdac_hdmi_jack_init(struct snd_soc_dai *dai, int device,
                                                     ^
sound/soc/codecs/hdac_hdmi.h:5:54: note: Function
'hdac_hdmi_jack_init' argument 2 names different: declaration 'pcm'
definition 'device'.
int hdac_hdmi_jack_init(struct snd_soc_dai *dai, int pcm,
                                                     ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210312182246.5153-10-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: hdac_hdmi: remove useless initializations
Pierre-Louis Bossart [Fri, 12 Mar 2021 18:22:31 +0000 (12:22 -0600)]
ASoC: hdac_hdmi: remove useless initializations

Cppcheck complains a lot about possible null pointer dereferences but
it's again a case of useless initializations to NULL.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210312182246.5153-9-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: da7219-aad: remove useless initialization
Pierre-Louis Bossart [Fri, 12 Mar 2021 18:22:30 +0000 (12:22 -0600)]
ASoC: da7219-aad: remove useless initialization

cppcheck warning:

sound/soc/codecs/da7219-aad.c:118:22: style: Variable 'ret' is
assigned a value that is never used. [unreadVariable]
 int report = 0, ret = 0;
                     ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Acked-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Link: https://lore.kernel.org/r/20210312182246.5153-8-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: cx2070x: remove duplicate else branch
Pierre-Louis Bossart [Fri, 12 Mar 2021 18:22:29 +0000 (12:22 -0600)]
ASoC: cx2070x: remove duplicate else branch

cppcheck warning:

sound/soc/codecs/cx2072x.c:1436:10: style:inconclusive: Found
duplicate branches for 'if' and 'else'. [duplicateBranch]
  } else if (type & 0x4) {
         ^
sound/soc/codecs/cx2072x.c:1439:5: note: Found duplicate branches for
'if' and 'else'.
  } else {
    ^
sound/soc/codecs/cx2072x.c:1436:10: note: Found duplicate branches for
'if' and 'else'.
  } else if (type & 0x4) {
         ^

The last two branches do the same thing and can be collapsed together.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20210312182246.5153-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: cx2070x: remove useless assignment
Pierre-Louis Bossart [Fri, 12 Mar 2021 18:22:28 +0000 (12:22 -0600)]
ASoC: cx2070x: remove useless assignment

Cppcheck warning:

sound/soc/codecs/cx2072x.c:830:26: style: Variable
'reg1.r.rx_data_one_line' is reassigned a value before the old one has
been used. [redundantAssignment]

 reg1.r.rx_data_one_line = 1;
                         ^

sound/soc/codecs/cx2072x.c:782:26: note: reg1.r.rx_data_one_line is
assigned
 reg1.r.rx_data_one_line = 1;
                         ^

sound/soc/codecs/cx2072x.c:830:26: note: reg1.r.rx_data_one_line is
overwritten
 reg1.r.rx_data_one_line = 1;
                         ^

sound/soc/codecs/cx2072x.c:831:26: style: Variable
'reg1.r.tx_data_one_line' is reassigned a value before the old one has
been used. [redundantAssignment]
 reg1.r.tx_data_one_line = 1;
                         ^
sound/soc/codecs/cx2072x.c:783:26: note: reg1.r.tx_data_one_line is
assigned
 reg1.r.tx_data_one_line = 1;
                         ^

sound/soc/codecs/cx2072x.c:831:26: note: reg1.r.tx_data_one_line is
overwritten
 reg1.r.tx_data_one_line = 1;
                         ^

Likely copy/paste.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20210312182246.5153-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: cros_ec_codec: remove null pointer dereference warning
Pierre-Louis Bossart [Fri, 12 Mar 2021 18:22:27 +0000 (12:22 -0600)]
ASoC: cros_ec_codec: remove null pointer dereference warning

Cppcheck complains of a possible issue:

sound/soc/codecs/cros_ec_codec.c:98:10: warning: Possible null pointer
dereference: in [nullPointer]
  memcpy(in, msg->data, insize);
         ^
sound/soc/codecs/cros_ec_codec.c:162:34: note: Calling function
'send_ec_host_command', 5th argument 'NULL' value is 0
       (uint8_t *)&p, sizeof(p), NULL, 0);
                                 ^
sound/soc/codecs/cros_ec_codec.c:98:10: note: Null pointer dereference
  memcpy(in, msg->data, insize);
         ^

In practice the access to the pointer is protected by another
argument, but this is likely to fool other static analysis tools. Add
a test to avoid doing the memcpy if the pointer is NULL or the size is
zero.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Acked-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Link: https://lore.kernel.org/r/20210312182246.5153-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: adau1977: remove useless return
Pierre-Louis Bossart [Fri, 12 Mar 2021 18:22:26 +0000 (12:22 -0600)]
ASoC: adau1977: remove useless return

Cppcheck warning:

sound/soc/codecs/adau1977.c:242:9: warning: Identical condition and
return expression 'ret', return value is always 0
[identicalConditionAfterEarlyExit]

 return ret;
        ^
sound/soc/codecs/adau1977.c:239:6: note: If condition 'ret' is true,
the function will return/exit

 if (ret)
     ^
sound/soc/codecs/adau1977.c:242: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/20210312182246.5153-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: ad1836: remove useless return
Pierre-Louis Bossart [Fri, 12 Mar 2021 18:22:25 +0000 (12:22 -0600)]
ASoC: ad1836: remove useless return

Cppcheck warning:

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

Likely copy/paste between adc and dac cases.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210312182246.5153-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: ab8500-codec: remove useless structure
Pierre-Louis Bossart [Fri, 12 Mar 2021 18:22:24 +0000 (12:22 -0600)]
ASoC: ab8500-codec: remove useless structure

Cppcheck warnings:

sound/soc/codecs/ab8500-codec.c:117:20: style: struct member 'ab8500_codec_drvdata_dbg::vaud' is never used. [unusedStructMember]
 struct regulator *vaud;
                   ^
sound/soc/codecs/ab8500-codec.c:118:20: style: struct member 'ab8500_codec_drvdata_dbg::vamic1' is never used. [unusedStructMember]
 struct regulator *vamic1;
                   ^
sound/soc/codecs/ab8500-codec.c:119:20: style: struct member 'ab8500_codec_drvdata_dbg::vamic2' is never used. [unusedStructMember]
 struct regulator *vamic2;
                   ^
sound/soc/codecs/ab8500-codec.c:120:20: style: struct member 'ab8500_codec_drvdata_dbg::vdmic' is never used. [unusedStructMember]
 struct regulator *vdmic;
                   ^

The structure is never used, remove.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210312182246.5153-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>