Commit graph

871336 commits

Author SHA1 Message Date
Li Xu
eb65ccdb08
ASoC: wm_adsp: Expose mixer control API
Expose mixer control API for reading and writing controls from the kernel.
This API can be used by ALSA kernel drivers with ADSP support to
read and write firmware-defined memory regions.

Signed-off-by: Li Xu <li.xu@cirrus.com>
Signed-off-by: David Rhodes <david.rhodes@cirrus.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/1573847653-17094-2-git-send-email-david.rhodes@cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-18 16:12:07 +00:00
Lucas Stach
e48fdb53bd
ASoC: tlv320aic31xx: configure output common-mode voltage
The tlv320aic31xx devices allow to adjust the output common-mode voltage
for best analog performance. The datasheet states that the common mode
voltage should be set to be <= AVDD/2.

This changes allows to configure the output common-mode voltage via a DT
property. If the property is absent the voltage is automatically chosen
as the highest voltage below/equal to AVDD/2.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Link: https://lore.kernel.org/r/20191118151207.28576-1-l.stach@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-18 16:11:47 +00:00
Liam Girdwood
653c28afa7
ASoC: SOF: Intel: Fix CFL and CML FW nocodec binary names.
The manifest information is different between CNL, CML and CFL platforms
hence we need to load different files.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191111222901.19892-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-18 16:07:25 +00:00
Peter Ujfalusi
79f6c108c8
ASoC: pcm3168a: Add support for optional RST gpio handling
In case the RST line is connected to a GPIO line it needs to be pulled high
when the driver probes to be able to use the codec.

Add support also for cases when more than one codec is is controlled by the
same GPIO line by requesting the gpio with GPIOD_FLAGS_BIT_NONEXCLUSIVE.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>

Link: https://lore.kernel.org/r/20191113124734.27984-3-peter.ujfalusi@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-18 13:09:22 +00:00
Peter Ujfalusi
cdacc761da
ASoC: pcm3168a: Document optional RST gpio
On boards where the RST line is not pulled up, but it is connected to a
GPIO line this property must present in order to be able to enable the
codec.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Link: https://lore.kernel.org/r/20191113124734.27984-2-peter.ujfalusi@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-18 13:09:13 +00:00
Chuhong Yuan
b1176bbb70
ASoC: wm5100: add missed pm_runtime_disable
The driver forgets to call pm_runtime_disable in remove and
probe failure.
Add the calls to fix it.

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20191118073707.28298-1-hslester96@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-18 13:02:37 +00:00
Chuhong Yuan
2dab09be49
ASoC: wm2200: add missed operations in remove and probe failure
This driver misses calls to pm_runtime_disable and regulator_bulk_disable
in remove and a call to free_irq in probe failure.
Add the calls to fix it.

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Link: https://lore.kernel.org/r/20191118073633.28237-1-hslester96@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-18 13:02:36 +00:00
Vinod Koul
baddcee989
ASoC: qcom: q6asm-dai: add support to flac decoder
Qualcomm DSPs also support the flac decoder, so add support for FLAC
decoder and convert the snd_dec_flac params to qdsp format.

Co-developed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Link: https://lore.kernel.org/r/20191115102705.649976-4-vkoul@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-18 13:02:35 +00:00
Srinivas Kandagatla
51d2584a98
ASoC: qcom: q6asm: add support to flac config
Qualcomm DSPs expect flac config to be set for flac decoders, so add the
API to program the flac config to the DSP

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Link: https://lore.kernel.org/r/20191115102705.649976-3-vkoul@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-18 13:02:34 +00:00
Vinod Koul
d2522335c9
ALSA: compress: add flac decoder params
The current design of sending codec parameters assumes that decoders
will have parsers so they can parse the encoded stream for parameters
and configure the decoder.

But this assumption may not be universally true and we know some DSPs
which do not contain the parsers so additional parameters are required
to be passed.

So add these parameters starting with FLAC decoder. The size of
snd_codec_options is still 120 bytes after this change (due to this
being a union)

Co-developed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Link: https://lore.kernel.org/r/20191115102705.649976-2-vkoul@kernel.org
Acked-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-18 13:02:25 +00:00
kbuild test robot
a3b9ed5577
ASoC: rt5677: rt5677_check_hotword() can be static
Fixes: 21c00e5df4 ("ASoC: rt5677: Enable jack detect while DSP is running")
Signed-off-by: kbuild test robot <lkp@intel.com>
Link: https://lore.kernel.org/r/20191114153304.n4pyix7qadu76tx4@4978f4969bb8
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-18 12:55:59 +00:00
Peter Ujfalusi
f0c97131b9
ASoC: ti: davinci-mcasp: Use dma_request_chan() directly for channel request
dma_request_slave_channel_reason() is:
#define dma_request_slave_channel_reason(dev, name) \
	dma_request_chan(dev, name)

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Link: https://lore.kernel.org/r/20191113095445.3211-3-peter.ujfalusi@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-15 12:03:16 +00:00
Peter Ujfalusi
de8cf95231
ASoC: dmaengine: Use dma_request_chan() directly for channel request
dma_request_slave_channel_reason() is:
#define dma_request_slave_channel_reason(dev, name) \
	dma_request_chan(dev, name)

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Link: https://lore.kernel.org/r/20191113095445.3211-2-peter.ujfalusi@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-15 12:02:58 +00:00
Kuninori Morimoto
ce21401c9d
ASoC: soc-core: care card_probed at soc_cleanup_card_resources()
soc_cleanup_card_resources() will call card->remove(), but it should be
called if card->probe() or card->late_probe() are called.
snd_soc_bind_card() might be error before calling
card->probe() / card->late_probe().
In that time, card->remove() will be called.
This patch adds card_probed parameter to judge it.

Fixes: bfce78a559 ("ASoC: soc-core: tidyup soc_init_dai_link()")
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Link: https://lore.kernel.org/r/87o8xg4ltr.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-15 12:02:39 +00:00
Kuninori Morimoto
2cc1afcfc6
ASoC: soc-core: move snd_soc_unbind_card() next to snd_soc_bind_card()
To makes code readable, this patch moves snd_soc_unbind_card() next
to snd_soc_bind_card().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87pnhw4lu5.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-15 12:02:21 +00:00
Kuninori Morimoto
2a6f0892bd
ASoC: soc-core: call snd_soc_dapm_shutdown() at soc_cleanup_card_resources()
It is easy to read code if it is cleanly using paired function/naming,
like start <-> stop, register <-> unregister, etc, etc.
But, current ALSA SoC code is very random, unbalance, not paired, etc.
It is easy to create bug at the such code, and it will be difficult to
debug.

snd_soc_bind_card() is calling snd_soc_dapm_init() for both
card and component.
Let's call paired snd_soc_dapm_shutdown() at paired
soc_cleanup_card_resources().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87r22c4lub.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-15 12:02:02 +00:00
Colin Ian King
b26eb5173c
ASoC: tas2770: clean up an indentation issue
There is a block that is indented too deeply, remove
the extraneous tabs.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20191112190218.282337-1-colin.king@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-15 12:01:43 +00:00
Rob Herring
5cff6fddb8
dt-bindings: vendor-prefixes: Add 'fsi[ab]' to the list of non-vendor prefixes
'fsia' and 'fsib' property prefixes were added as schema in commit
2f52475bac ("ASoC: fsi: switch to yaml base Documentation").
Unfortunately to do checks on actual vendor prefixes, we have to track
the handful of prefixes which are not vendors like 'fsia' and 'fsib'.

Fixes: 2f52475bac ASoC: fsi: switch to yaml base Documentation
Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20191108153538.11970-1-robh@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-12 19:17:06 +00:00
Kuninori Morimoto
74bd3f92d0
ASoC: soc-core: tidyup soc_probe_aux_devices()
snd_soc_bind_card() is calling many initialize functions
for each card / link / dai / aux etc, etc, etc...
When error happen, the message is indicated at snd_soc_bind_card(),
not at each functions.
But, only soc_probe_aux_devices() case is indicating error at functions,
not at snd_soc_bind_card().
It is not an issue, but unbalanced.

This patch moves error message to snd_soc_bind_card().
Also avoids deep-nested code.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87lfsthkw9.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-12 18:42:03 +00:00
Kuninori Morimoto
ed90c013a7
ASoC: soc-core: merge snd_soc_bind_card() and snd_soc_instantiate_card()
having both soc_bind_card() and snd_soc_instantiate_card() is
very confusable. Let's merge these.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87mud9hkwj.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-12 18:28:59 +00:00
Kuninori Morimoto
c6619b7298
ASoC: soc-core: merge soc_remove_component() and soc_cleanup_component()
having both soc_remove_component() and soc_cleanup_component() is
very confusable. Let's merge these.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87o8xphkwt.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-12 18:28:02 +00:00
Kuninori Morimoto
da704f26ba
ASoC: soc-core: merge snd_soc_remove_dai_link() and soc_unbind_dai_link()
We don't need to separete snd_soc_remove_dai_link() and
soc_unbind_dai_link() anymore. Let's merge these.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87pni5hkx1.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-12 18:27:43 +00:00
Kuninori Morimoto
63dc47da1f
ASoC: soc-core: merge snd_soc_add_dai_link() and soc_bind_dai_link()
We don't need to separete snd_soc_add_dai_link() and
soc_bind_dai_link() anymore. Let's merge these.

One note is that before this patch, it adds list (A)
eventhough if it had dai_link->ignore (1), or already bounded dai_link (2).
But I guess it is wrong. This patch also solve this issue.

/* BEFORE */
	int soc_bind_dai_link(...)
	{
		...
(1)		if (dai_link->ignore)
			return 0;

(2)		if (soc_is_dai_link_bound(...))
			return 0;
		...
	}

	int snd_soc_add_dai_link(...)
	{
		...
=>		ret = soc_bind_dai_link(...);
=>		if (ret < 0)
=>			return ret;

(A)		list_add_tail(&dai_link->list, &card->dai_link_list);
		...
	}

/* AFTER */

	int snd_soc_add_dai_link(...)
	{
		...
(1)		if (dai_link->ignore)
			return 0;

(2)		if (soc_is_dai_link_bound(...))
			return 0;
		...
(A)		list_add_tail(&dai_link->list, &card->dai_link_list);
		return 0;
	}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87r22lhkx8.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-12 18:27:24 +00:00
Kuninori Morimoto
ffdbca0be6
ASoC: soc-core: merge snd_soc_unregister_dai() and soc_del_dai()
We don't need to separete snd_soc_unregister_dai() and
soc_del_dai() anymore. Let's merge these

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87sgn1hkxg.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-12 18:22:56 +00:00
Kuninori Morimoto
7ca24386a7
ASoC: soc-core: merge snd_soc_register_dai() and soc_add_dai()
We don't need to separete snd_soc_register_dai() and
soc_add_dai() anymore. Let's merge these

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87tv7hhkxm.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-12 18:22:37 +00:00
Kuninori Morimoto
0d18a7caa6
ASoC: soc-core: remove soc_is_dai_link_bound()
Because complex separeted "card pre-listed component" and
"topology added component" duplicated operation is now
becoming simple, we don't need to check already bound dai_link
which is not exist anymore.
This patch removes soc_is_dai_link_bound().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87v9rxhkxw.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-12 18:22:18 +00:00
Dragos Tarcatu
1b4efdaf6d
ASoC: SOF: topology: free kcontrol memory on error
The volume and bytes kcontrols are currently not freeing their
memory on initialization failures. When an error occurs, all the
widgets loaded so far are unloaded via sof_widget_unload().
But this only happens for the widgets that got successfully loaded.

Fix that by kfree()-ing the allocated memory on load error.

Fixes: 311ce4fe76 ("ASoC: SOF: Add support for loading topologies")
Reviewed-by: Paul Olaru <paul.olaru@nxp.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Dragos Tarcatu <dragos_tarcatu@mentor.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191111222039.19651-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-12 17:12:27 +00:00
Keyon Jie
5e35d5f422
ASoC: SOF: PM: only suspend to D0I3 when needed
We should suspend audio to D3 by default, for the sake of power saving,
change the condition of D0I3 suspending here to that when there is
stream with suspend_ignored specified.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191111223343.19986-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-12 12:10:59 +00:00
Keyon Jie
a77e5d573f
ASoC: SOF: add helper to check if we should enter d0i3 suspend
Add helper to check if the DSP should be put in D0i3. This function
returns true if a stream has ignored the SUSPEND trigger to keep the
pipelines running in the DSP.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191111223343.19986-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-12 12:10:40 +00:00
Keyon Jie
58a972efd2
ASoC: SOF: PM: add check before setting d0_substate
Add check before seeting d0_substate and return success if Audio DSP is
already in the target substate.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191111223343.19986-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-12 12:10:21 +00:00
Keyon Jie
74b4dd04b1
ASoC: SOF: PM: add state machine to comments
Add Audio DSP state machine with comments. Note that the
'D0<-->runtime D0I3' part is not implemented yet.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191111223343.19986-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-12 12:10:03 +00:00
Pierre-Louis Bossart
0af237d51a
ASoC: SOF: Intel: hda: use fallback for firmware name
We have platforms such as CFL with no known I2S codec being used, and
the ACPI tables are currently empty, so fall-back to using the
firmware filename used in nocodec mode

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191111222901.19892-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-12 12:09:54 +00:00
Pierre-Louis Bossart
1f24d93c4f
ASoC: Intel: acpi-match: split CNL tables in three
Due to firmware manifest/signature differences, we have to use
different firmware names, so split CNL machine table in three (CNL,
CFL, CML).

The CFL table is currently empty since all known platforms use
HDaudio, but let's plan ahead.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191111222901.19892-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-12 12:09:36 +00:00
Michael Walle
13409d27cb
ASoC: wm8904: configure sysclk/FLL automatically
This adds a new mode WM8904_CLK_AUTO which automatically enables the FLL
if a frequency different than the MCLK is set.

These additions make the codec work with the simple-card driver in
general and especially in systems where the MCLK doesn't match the
required clock.

Signed-off-by: Michael Walle <michael@walle.cc>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20191108203152.19098-1-michael@walle.cc
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-11 19:42:56 +00:00
Yu-Hsuan Hsu
e2db787bdc
ASoC: Intel: kbl_rt5663_rt5514_max98927: Add dmic format constraint
On KBL platform, the microphone is attached to external codec(rt5514)
instead of PCH. However, TDM slot between PCH and codec is 16 bits only.
In order to avoid setting wrong format, we should add a constraint to
force to use 16 bits format forever.

Signed-off-by: Yu-Hsuan Hsu <yuhsuan@chromium.org>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190923162940.199580-1-yuhsuan@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-11 19:42:34 +00:00
Sebastian Reichel
36da67630d
ASoC: Add DA7213 audio codec as selectable option
This commit adds the Dialog DA7213 audio codec as a selectable option
in the kernel config. Currently the driver can only be selected for
Intel Baytrail/Cherrytrail devices or if SND_SOC_ALL_CODECS is enabled.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Link: https://lore.kernel.org/r/20191108174843.11227-3-sebastian.reichel@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-11 19:42:23 +00:00
Curtis Malainey
9da776ba78
ASoC: rt5677: Wait for DSP to boot before loading firmware
Wait for hardware to startup. If we load before hardware is ready we
could end up corrupting the firmware.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20191106011335.223061-12-cujomalainey@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-11 13:02:07 +00:00
Curtis Malainey
ba0b3a977e
ASoC: rt5677: Set ADC clock to use PLL and enable ASRC
Use the PLL to kept the correct 24M clock rate so frequency shift does
not occur when using the DSP VAD.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20191106011335.223061-11-cujomalainey@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-11 13:02:06 +00:00
Curtis Malainey
55229597a9
ASoC: bdw-rt5677: Turn on MCLK1 for DSP via DAPM
The RT5677 DSP needs the I2S MCLK1 to run its DSP. Add a dapm route to
SSP0 CODEC IN so the clock is turned on automatically when the DSP is
turned on.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20191106011335.223061-10-cujomalainey@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-11 13:02:06 +00:00
Curtis Malainey
395f02ef21
ASoC: rt5677: Allow VAD to be shut on/off at all times
Due to limitations of the clocking configuration, we have no way of
scheduling our hibernation before the bdw dsp hibernates. This causes
issues when the system suspends with an open stream. We need userspace
to toggle the kcontrol before we are suspended so that any writes on
suspend are not lost and we don't corrupt the regmap.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20191106011335.223061-9-cujomalainey@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-11 13:02:05 +00:00
Ben Zhang
ee0be4a99d
ASoC: rt5677: Disable irq at suspend
The irq is disabled at suspend to avoid running the threaded irq
handler after the codec has been powered off. At resume, codec irq is
re-enabled and the interrupt status register is checked to see if
headphone has been pluggnd/unplugged while the device is suspended.

There is still a chance that the headphone gets enabled or disabled
after the codec is suspended. disable_irq syncs the threaded irq
handler, but soc-jack's threaded irq handler schedules a delayed
work to poll gpios (for debounce). This is still OK. The codec won't
be powered back on again because all audio paths have been suspended,
and there are no force enabled supply widgets (MICBIAS1 is disabled).
The gpio status read after codec power off could be wrong, so the
gpio values are checked again after resume.

Signed-off-by: Ben Zhang <benzh@chromium.org>
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20191106011335.223061-8-cujomalainey@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-11 13:02:04 +00:00
Ben Zhang
3f81068dc8
ASoC: rt5677: Stop and restart DSP over suspend/resume
MCLK1 gets disabled at suspend and re-enabled at resume. Before
MCLK1 is re-enabled, if the DSP is already on (either the DSP was
left on during suspend, or the DSP is turned on early at resume),
i2c register read returns garbage and corrupts the regmap cache.

This patch stops the DSP before suspend and restarts it after
resume with a dalay to ensure MCLK is on while loading firmware.

Signed-off-by: Ben Zhang <benzh@chromium.org>
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20191106011335.223061-7-cujomalainey@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-11 13:02:03 +00:00
Ben Zhang
eabf424f7b
ASoC: rt5677: Mark reg RT5677_PWR_ANLG2 as volatile
The codec dies when RT5677_PWR_ANLG2(MX-64h) is set to 0xACE1
while it's streaming audio over SPI. The DSP firmware turns
on PLL2 (MX-64 bit 8) when SPI streaming starts.  However regmap
does not believe that register can change by itself. When
BST1 (bit 15) is turned on with regmap_update_bits(), it doesn't
read the register first before write, so PLL2 power bit is
cleared by accident.

Marking MX-64h as volatile in regmap solved the issue.

Signed-off-by: Ben Zhang <benzh@chromium.org>
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20191106011335.223061-6-cujomalainey@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-11 13:02:02 +00:00
Ben Zhang
29073ae40c
ASoC: rt5677: Add DAPM audio path for hotword stream
Add a DAPM audio path from "DMIC L1" to "DSP Buffer" so that
when hotwording is enabled, DAPM does not power off the codec
with SND_SOC_BIAS_OFF.

Signed-off-by: Ben Zhang <benzh@chromium.org>
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20191106011335.223061-5-cujomalainey@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-11 13:02:01 +00:00
Ben Zhang
21c00e5df4
ASoC: rt5677: Enable jack detect while DSP is running
Before a hotword is detected, GPIO1 pin is configured as IRQ
output so that jack detect works. When a hotword is detected,
the DSP firmware configures the GPIO1 pin as GPIO1 and
drives a 1. rt5677_irq() is called after a rising edge on
the GPIO1 pin, due to either jack detect event or hotword
event, or both. All possible events are checked and handled
in rt5677_irq() where GPIO1 pin is configured back to IRQ
output if a hotword is detected.

Signed-off-by: Ben Zhang <benzh@chromium.org>
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20191106011335.223061-4-cujomalainey@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-11 13:02:00 +00:00
Ben Zhang
157b006f6b
ASoC: bdw-rt5677: Add a DAI link for rt5677 SPI PCM device
This link is needed for the RT5677 DSP to do hotwording

Signed-off-by: Ben Zhang <benzh@chromium.org>
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20191106011335.223061-3-cujomalainey@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-11 13:01:59 +00:00
Ben Zhang
461c623270
ASoC: rt5677: Load firmware via SPI using delayed work
The firmware rt5677_elf_vad is an ELF binary obtained from
request_firmware(). Sections of the ELF are loaded to
the DSP via SPI. A model (e.g. en_us.mmap) can optionally be
loaded to the DSP at RT5677_MODEL_ADDR to overwrite the
baked-in model in rt5677_elf_vad.

Then we switch to DSP mode, load firmware, and let DSP run.
When a hotword is detected, an interrupt is fired and
rt5677_irq() is called. When 'DSP VAD Switch' is turned off,
the codec is set back to normal mode.

The kcontrol 'DSP VAD Switch' is automatically enabled/disabled
when the hotwording PCM stream is opened/closed.

Signed-off-by: Ben Zhang <benzh@chromium.org>
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20191106011335.223061-2-cujomalainey@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-11 13:01:59 +00:00
Shengjiu Wang
fe965096c9
ASoC: fsl_audmix: Add spin lock to protect tdms
Audmix support two substream, When two substream start
to run, the trigger function may be called by two substream
in same time, that the priv->tdms may be updated wrongly.

The expected priv->tdms is 0x3, but sometimes the
result is 0x2, or 0x1.

Fixes: be1df61cf0 ("ASoC: fsl: Add Audio Mixer CPU DAI driver")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Link: https://lore.kernel.org/r/1e706afe53fdd1fbbbc79277c48a98f8416ba873.1573458378.git.shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: <stable@vger.kernel.org>
2019-11-11 13:01:37 +00:00
Keyon Jie
16299326a0
ASoC: SOF: Intel: hda: set L1SEN on S0ix suspend
Set L1SEN to make sure the system can enter S0ix, and restore it on
resume.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191101170916.26517-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-08 12:10:08 +00:00
Keyon Jie
8cd73ce7ba
ASoC: SOF: topology: fix missing NULL pointer check
Add check to avoid possible NULL pointer dereference issue.

This issue was reported by static analysis tools, we didn't face this
issue but we can't rule it out either as a false positive.

Reported-by: Keqiao Zhang <keqiao.zhang@intel.com>
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191101170916.26517-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-08 12:09:49 +00:00