Commit Graph

17 Commits

Author SHA1 Message Date
Arnaud Pouliquen d05d862ead ASoC: STI: Fix null ptr deference in IRQ handler
With RTlinux a race condition has been found that leads to NULL ptr crash:
- On CPU 0: uni_player_irq_handler is called to treat XRUN
 "(player->state == UNIPERIF_STATE_STOPPED)" is FALSE so status is checked,
 dev_err(player->dev, "FIFO underflow error detected") is printed
and then snd_pcm_stream_lock should be called to lock stream for stopping.
- On CPU 1: application stop and close the stream.
Issue is that the stop and shutdown functions are executed while
"FIFO underflow error detected" is printed.
So when CPU 0 calls snd_pcm_stream_lock, player->substream is already null.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-04-06 19:29:07 +01:00
Arnaud Pouliquen 4c88f89f9c ASoC: sti: reset refactoring
Reset is common to player and reader, migrate function in sti_uniperif.c

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-10-26 11:41:11 +01:00
Arnaud Pouliquen 5a4326d1c2 ASoC: sti: suppress inappropriate DT fields
Update to suppress some DT nodes that can be handled in driver
using compatible string.
"dai-name", "st,version"and "st,mode" are suppressed
"st,tdm-mode" is added to handle TDM mode.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-14 18:15:05 +01:00
Moise Gergaud 3ee15cac90 ASoC: sti: select player for I2S/TDM TX bus
By default, player#0 is connected to I2S/TDM TX bus.
This patch connects player#1 to I2S/TDM TX bus.

Signed-off-by: Moise Gergaud <moise.gergaud@st.com>
Acked-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-18 11:04:55 +01:00
Moise Gergaud 8d8b1e2edd ASoC: sti: unip player tdm mode
here are the changes to enable player tdm mode:
- When TDM_ENABLE is set to 1, the i2s format should be automatically
configured. Unfortunately this is not the case (HW bug). Then, we shall
force DATA_SIZE setting.
- Compute the transfer size for tdm mode: transfer size = user frame size
- Manage tdm slots configuration given in DT.
- Don't use mclk-fs when unip in tdm mode; use tdm slot config to compute
frame size and to set mclk rate.
- Refine the hw param (channels & format) according to tdm slot config.

Signed-off-by: Moise Gergaud <moise.gergaud@st.com>
Acked-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-12 04:59:09 +01:00
Moise Gergaud 7219978766 ASoC: sti: helper functions to fix tdm runtime params
Signed-off-by: Moise Gergaud <moise.gergaud@st.com>
Acked-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-12 04:59:09 +01:00
Moise Gergaud 44f948bdb1 ASoC: sti: helper functions for unip tdm slots configuration
- sti_uniperiph_set_tdm_slot: store tdm slot config in unip context
- sti_uniperiph_get_tdm_word_pos: configure unip tdm slots pos regs

Signed-off-by: Moise Gergaud <moise.gergaud@st.com>
Acked-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-12 04:59:09 +01:00
Moise Gergaud 9a00a3e9fe ASoC: sti: define tdm type & default tdm hw config
Signed-off-by: Moise Gergaud <moise.gergaud@st.com>
Acked-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-12 02:58:59 +01:00
Moise Gergaud 5295a0dc31 ASoC: sti: rename unip player type into common player & reader type
Signed-off-by: Moise Gergaud <moise.gergaud@st.com>
Acked-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-12 02:58:59 +01:00
Moise Gergaud 38535e8e69 ASoC: sti: macro for uniperif tdm regs access
Signed-off-by: Moise Gergaud <moise.gergaud@st.com>
Acked-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-12 02:58:59 +01:00
Moise Gergaud 5ba10dd4a1 ASoC: sti: correct typo errors
Signed-off-by: Moise Gergaud <moise.gergaud@st.com>
Acked-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-03-31 15:59:26 -07:00
Lars-Peter Clausen b917abb406 ASoC: uniperf: Add missing __iomem annotation
base referes to a iomem region, so it should have the __iomem annotation.
Fixes the following warnings from sparse:

	sound/soc/sti/sti_uniperif.c:169:19: warning: incorrect type in
		assignment (different address spaces)
	sound/soc/sti/sti_uniperif.c:169:19:    expected void *base
	sound/soc/sti/sti_uniperif.c:169:19:    got void [noderef] <asn:2>*
	sound/soc/sti/uniperif_player.c:104:18: warning: incorrect type in
		argument 1 (different address spaces)
	sound/soc/sti/uniperif_player.c:104:18:    expected void const volatile
		[noderef] <asn:2>*addr
	sound/soc/sti/uniperif_player.c:104:18:    got void *
	[...]

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-29 15:07:05 +01:00
Arnaud Pouliquen fa050796b3 ASoC: sti: Add clock adjustement control
Add capability to adjust player clock, for clocks drift management.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-16 21:38:24 +01:00
Arnaud Pouliquen f3bd847eb0 ASoC: sti: Add uniperipheral dai driver
ASoc uniperipheral dai driver that manages uniperipheral DAIs and registers
associated generic dma engine platform.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-16 21:38:23 +01:00
Arnaud Pouliquen c3a0003aaf ASoC: sti: Add CPU DAI driver for capture
Add code to manage Uniperipheral reader IP instances.
These DAIs are dedicated to capture and support I2S and IEC modes.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-16 21:38:23 +01:00
Arnaud Pouliquen 76c2145ded ASoC: sti: Add CPU DAI driver for playback
Add code to manage Uniperipheral player IP instances.
These DAIs are dedicated to playback and support I2S and IEC modes.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-10 18:36:26 +01:00
Arnaud Pouliquen e1ecace6a6 ASoC: sti: Add uniperipheral header file
Add the Uniperipheral header file for uniperipheral IPs registers definition.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-10 18:36:26 +01:00