1
0
Fork 0
Commit Graph

28727 Commits (redonkable)

Author SHA1 Message Date
Cosmin-Gabriel Samoila 4160d0939f MLK-19936-3: sound: asoc: add rate in machine driver hw_params func
Add rate when calling dai sysclk so we can set rate after
we change the pdm_src parrent.

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2018-10-29 11:10:38 +08:00
Cosmin-Gabriel Samoila e8cb2e2f40 MLK-19936-1 : sound: asoc: add support for different sample rates
At this moment, using audio_pll1 offers accurate clock for 48KHz only
and audio_pll2 offers accurate clock for 44.1KHz only.
With this patch, we dynamically switch between audio PLL1 and audio
PLL2 to support both 48KHz and 44.1KHZ rates.

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2018-10-29 11:10:38 +08:00
Daniel Baluta 33f3c39a40 MLK-19949: ASoC: dsp: Fix codec libraries search path
Old implementation uses /usr/lib/imx-mm/audio-codec
to look for codec libraries.

Also this is the patch where Yocto rootfs stores the codec
libraries. So until we align Yocto with the kernel lets
change the driver to use the old path.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2018-10-29 11:10:38 +08:00
Shengjiu Wang 3600d74cba MLK-19854-1: ASoC: imx-wm8960: fix error when m4 image is not loaded
With rpmsg sound, when the m4 image is not loaded. There is error log

[ 46.275223] imx-wm8960 sound-rpmsg-wm8960: ASoC: CODEC DAI rpmsg-wm8960-hifi not registered
[ 46.284543] imx-wm8960 sound-rpmsg-wm8960: snd_soc_register_card failed (-517)

The issue is caused by that codec is not registered, the sound
card registration will fail

So add check in probe function for codec dai is ready or not.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2018-10-29 11:10:38 +08:00
Shengjiu Wang d4eb8ab263 MLK-19854-1: ASoC: imx-cs42888: fix error when m4 image is not loaded
With rpmsg sound, when the m4 image is not loaded. There is error log

[ 46.257647] imx-cs42888 sound-rpmsg-cs42888: ASoC: CODEC DAI cs42888 not registered
[ 46.265413] imx-cs42888 sound-rpmsg-cs42888: snd_soc_register_card failed (-517)

The issue is that codec is not register, the sound registeration will fail

So add check in probe function for codec dai ready or not.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2018-10-29 11:10:38 +08:00
Daniel Baluta a0cffd9a92 MLK-18497-13: ASoC: fsl: dsp: Skip SDRAM section update if fw is already loaded
If the DSP firmware binary is already loaded it is wrong to update
SDRAM located sections because we will overwrite and data stored there.

This makes suspend/resume work.

Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2018-10-29 11:10:38 +08:00
Daniel Baluta 5e49abd2a3 MLK-18497-12: ASoC: fsl: imx-dsp: Add DSP machine driver
Finally! We register DSP as a sound card.

Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2018-10-29 11:10:38 +08:00
Daniel Baluta b1b39c3b3c MLK-18497-11: ASoC: fsl: compress: Introduce compress implemenation
Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2018-10-29 11:10:38 +08:00
Daniel Baluta 894ec89380 MLK-18497-10: ASoC: fsl: dsp: Refactor fsl_dsp_{open|close}
DSP driver now supports two interfaces. Old ioctl chardev based
interface and ALSA compress inteface.

Because some part of the open/close code is common introduce
two new functions which encapsulate the common functionality.

Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2018-10-29 11:10:38 +08:00
Daniel Baluta 454123b0c9 MLK-18497-9: ASoC: fsl: dsp: Export xf_client_alloc
While at it add include guard to dsp.h

Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2018-10-29 11:10:38 +08:00
Daniel Baluta da20ca1f54 MLK-18497-8: ASoC: fsl: dsp: Add DSP audio platform driver
Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2018-10-29 11:10:38 +08:00
Daniel Baluta 6f3c7e2478 MLK-18497-7: ASoC: fsl: xaf_afi: Introduce component API
This is based on Xtensa Audio framework
userspace implemention API.

Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2018-10-29 11:10:38 +08:00
Daniel Baluta 34e8fd6971 MLK-18497-6: ASoC: fsl: dsp: Add Xtensa library handling API
This is based on RF-2016.4-linux package received from Cadence
and introduce the API for loading shared libraries into memory.

Based on this we create xf_load_lib/xf_load_unlib functions
which are used to tell DSP framework that codec libraries
are mapped in memory and it can start using them.

Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2018-10-29 11:10:38 +08:00
Daniel Baluta 21fa331157 MLK-18497-5: ASoC: fsl: dsp_proxy: Introduce client API
This will allow DSP driver to create/destroy a client on
DSP audio-framework proxy.

Registering a client on remote DSP proxy means creating
a component.

The implementation is similar with userspace application
proxy implementation.

Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2018-10-29 11:10:38 +08:00
Daniel Baluta c9594348db MLK-18497-4: ASoC: fsl: dsp: Add message buffer pool API
Memory is allocated to clients from memory pools. A memory pool
allocation is requested to DSP framework via XF_ALLOC command and
freed via XF_FREE.

Memory pool allocation API offers two functions:
	* xf_pool_alloc, allocate a number of buffers of given length
	* xf_pool_free, free memory area allocated for a pool.

Once a buffer pool is allocated users can handle buffers using the
following API:
	* xf_buffer_get(pool), gets a buffer from a pool
	* xf_buffer_put(buf), puts back a buffer into its pool

Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2018-10-29 11:10:38 +08:00
Daniel Baluta cc72baf6bd MLK-18497-3: ASoC: fsl: dsp_proxy: Add new send/recv helpers
This commit adds 3 new function helpers for sending
messages to DSP framework and waiting for response.

While at it cleanup spaces around struct client fields.

Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2018-10-29 11:10:38 +08:00
Daniel Baluta 2817467173 MLK-18497-2: ASoC: fsl: dsp_proxy: Add missing xf_unlock
xf_cmd_send_recv function returns with a lock taken
in case of success. Fix this, now!

This bug is present since the beginning of time and it didn't
show up because no one used xd_cmd_alloc/xf_cmd_free.

Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2018-10-29 11:10:38 +08:00
Daniel Baluta de0fb4c5d3 MLK-18497-1: ASoC: fsl: dsp_proxy: Fix license headers
This is a cleanup patch to have all the headers style
consistent across DSP driver.

Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2018-10-29 11:10:38 +08:00
Daniel Baluta 262f1f4a07 MLK-19063: ASoC: fsl_dsp: Fix use after free
Move client freeing later when no one needs it.
This fixes Coverity Issue 3344686.

Note that this also fixes a potential memory leak, if proxy happens to
be NULL.

Reported-by: Ioan-alexandru Palalau <ioan-alexandru.palalau@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit a0bb3e2d5a0517e46bdf1eb35eb94ff46fd5b709)
2018-10-29 11:10:38 +08:00
Cosmin-Gabriel Samoila 456406762c MLK-19797 sound: asoc: fix clk_div computed value
When clk_div is computed, the K factor from documentation is ignored.
It happened to work on medium quality because the K factor was 1.
Now the clk_div is computed accordingly to the documentation.

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2018-10-29 11:10:38 +08:00
Cosmin-Gabriel Samoila 51c16110d5 MLK-19716-2 sound: asoc: fix quality select switch
Value read from register was shifted and compared
with a non-shifted val and the behaviour was that
it allways went on the default branch.

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2018-10-29 11:10:38 +08:00
Shengjiu Wang 0b8df30dce MLK-15975-3: ASoC: fsl_sai: The offset of fifo_off is changed
Commit 786c8bd56324 ("MLK-19734-3: dmaengine: imx-sdma: change
fifo offset of fifo_num") change the offset of fifo_off, so
the sai driver need to be updated.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit c94ce8776e01f1f40a866d4da89603ab042dde0f)
2018-10-29 11:10:38 +08:00
Shengjiu Wang 6630deaa50 MLK-15975-1: ASoC: fsl_ssi: support multi fifo script
With dual fifo enabled, the case recording mono sound
in the background, playback sound twice in parallal,
the second time playback sound may distort, the possible
reason is using dual fifo to playback mono sound is not
recommended.

This patch is to provide a option to use multi fifo script,
which can be dynamically configured as one fifo or two fifo
mode.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 9d71068cf7d1fc1ec36e5fb34a321c1bdbaad324)
2018-10-29 11:10:38 +08:00
Shengjiu Wang d3d61caefd MLK-19760: ASoC: imx-pcm-rpmsg: fix resume back quickly after resume
With LPA mode, if the period size is small, the timer for query
buffer pointer will be triggered immediately after suspend, the MU
interrupt will resume the system quickly.
This patch is to disable timer when suspend.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 9c5e78cf50855bd73f2b5c3dc8bc48f8a0907b39)
2018-10-29 11:10:38 +08:00
Shengjiu Wang 3e0cf4ff75 MLK-19733-3: ASoC: imx-wm8958: Remove duplicate jack kcontrol
We first add the jack kcontrol in commit c2c7959e3af3 ("MLK-11479-09
pulseaudio5.0 mute Headphone volume when Headphone plugged")

After that there is change in kernel by commit f63e8581e2 ("ASoC: jack:
create kctls according to jack pins info"), the jack kcontrol will be
created with snd_soc_jack_add_pins.

So our change for jack kcontrol in machine driver is not need now, for
driver already call imx_wm8958_gpio_init -> snd_soc_card_jack_new ->
snd_soc_jack_add_pins. otherwise the jack kcontrol will be created twice.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2018-10-29 11:10:38 +08:00
Shengjiu Wang b34a7d269a MLK-19733-2: ASoC: imx-wm8962: Remove duplicate jack kcontrol
We first add the jack kcontrol in commit c2c7959e3af3 ("MLK-11479-09
pulseaudio5.0 mute Headphone volume when Headphone plugged")

After that there is change in kernel by commit f63e8581e2 ("ASoC: jack:
create kctls according to jack pins info"), the jack kcontrol will be
created with snd_soc_jack_add_pins.

So our change for jack kcontrol in machine driver is not need now, for
driver already call imx_wm8962_gpio_init -> snd_soc_card_jack_new ->
snd_soc_jack_add_pins. otherwise the jack kcontrol will be created twice.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2018-10-29 11:10:38 +08:00
Shengjiu Wang 7194acaa0d MLK-19733-1: ASoC: imx-wm8960: Remove duplicate jack kcontrol
We first add the jack kcontrol in commit c2c7959e3af3 ("MLK-11479-09
pulseaudio5.0 mute Headphone volume when Headphone plugged")

After that there is change in kernel by commit f63e8581e2 ("ASoC: jack:
create kctls according to jack pins info"), the jack kcontrol will be
created with snd_soc_jack_add_pins.

So our change for jack kcontrol in machine driver is not need now, for
driver already call imx_wm8960_gpio_init -> snd_soc_card_jack_new ->
snd_soc_jack_add_pins. otherwise the jack kcontrol will be created twice.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2018-10-29 11:10:38 +08:00
Cosmin-Gabriel Samoila 828607601b MLK-19743 sound: asoc: fix micfill sleep in interrupt context
There is a problem when an interrupt is handled by hwvad_isr
since it calls kobject_uevent_env which can sleep.
Solved it by doing the kobject_uevent_env in a threaded_irq
function.

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2018-10-29 11:10:38 +08:00
Cosmin-Gabriel Samoila 3d435e80a3 MLK-19741 sound: asoc: add micfil hwvad alsamixer rate selection
Add alsamixer control for selecting the default voice activity detection
rate. This is a prerequisite for supporting hwvad and recording in parallel
or you will restrict the user to do the recording only at the hardcoded
hwvad rate (when hwvad is enabled).

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2018-10-29 11:10:38 +08:00
Cosmin-Gabriel Samoila 56f6e22088 MLK-19716 sound: asoc: fix div by zero
Fix issue reported by coverity where get_pdm_clk function returns 0.
This only happens when user selects the N/A quality from alsamixer
and now we are returning negative div and warning that quality
select is not valid.

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
2018-10-29 11:10:38 +08:00
Cosmin-Gabriel Samoila 7d27ba1bb0 MLK-19617 sound: asoc: fix amixer output gain control
This bitfield represents a signed value gain and 0-7 represents +0 to +7
bits shift for output gain and 8-15 represents -8 to -1 bits shift for
output gain. Before this fix 0-47% was translated into 0 to +100% and
47% - 100% was translated into -100% to 0%.
We have added gain controls that remaps the each channel gain values
such that we go from lowest volume to highest.

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2018-10-29 11:10:38 +08:00
Cosmin-Gabriel Samoila a634fe4289 MLK-18655-7 sound: asoc: add micfil irq functions
Micfil modules have 4 IRQs:
- 44: Dgital Microphone interface voice activity detector event interrupt
- 45: Digital Microphone interface voice activity detector error
  interrupt
- 109: Digital Microphone interface interrupt
- 110: Digital Microphone interface error interrupt

This patch adds different functions to treat each IRQ listed before.

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2018-10-29 11:10:38 +08:00
Shengjiu Wang fa486c8e3d MLK-18655-6 sound: asoc: correct hwvad bug
Correct hwvad initialization procedure bugs:
- VADCHSEL was set to N instead of ((1 << N) - 1)
- IE set before ERIE
- voice detected interrupt line was used wrong

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2018-10-29 11:10:38 +08:00
Cosmin-Gabriel Samoila 3afb3d9fc6 MLK-19616 sound: asoc: fix quality selection bug
The quality selection bitfield is represented as following:
 * Medium»      0 0 0
 * High»»       0 0 1
 * Very Low 2»  1 0 0
 * Very Low 1»  1 0 1
 * Very Low 0»  1 1 0
 * Low» »       1 1 1

One might notice that from High to Very Low 2 quality there is
a gap of 2 (010 and 011) are missing. In the previous implementation
of amixer control, when you are selecting other quality than
the default mode, the value will always jump from High to Low
with a 2 step and will not be able to go back to a previous value.
The solution was to add two "N/A" undefined values in the
selection texts since those two values are marked as reserved
in the micfil RM.
The alternative was to write custom get and put functions to
only do the translation but the aproach in this patch is easier
to understand and less error prone.

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
(cherry picked from commit 976f005b20ddc12c7fe0ce60edd99e5fb9400d21)
2018-10-29 11:10:38 +08:00
Cosmin-Gabriel Samoila bb24f099aa MLK-18655-5 sound: asoc: add hwvad noise decimation amixer control
Add control for Voice Activity Detector Noise OR Enable.
Enables a OR logic in the output of minimum noise estimator block. For
more information see Filter Result Gain Setting on page 71 - micfil
reference manual:
0b - Noise input is not decimated.
1b - Noise input is decimated.

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
(cherry picked from commit 317d2226fcfbbd8ae91eac9f685d71663227ae2a)
2018-10-29 11:10:38 +08:00
Cosmin-Gabriel Samoila 428583fd8a MLK-18655-4 sound: asoc: add micfil hwvad amixer controls
Add amixer controls for the following hardware voice activity
detection parameters: initialization mode, initialization time,
frame time, high-pass filter mode, input gain, sound gain, noise
gain, noise filter adjustment, zero-crossing detector(zcd)
enablement, zcd threshold, zcd auto-threshold, zcd filter adjustment
All of those parameters are now saved into micfil private data and
used when hardware voice detection is enabled.

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
(cherry picked from commit 79972452e553f9a18cc57a89383f3be93a202c05)
2018-10-29 11:10:38 +08:00
Cosmin-Gabriel Samoila 2bc23e9c1d MLK-18655-2 sound: asoc: add micfil hardware voice active detection
Hardware Voice Activity Detector (HWVAD) is a block responsible for
detect voice activity in a channel selected by the user and it can be
configured in Envelope-based or Energy-based mode. Optionally, a
Zero-Crossing Detector can be enabled to improve the voice detection.
To enable hwvad from userspace there is a interface and you should write
the number of channels in /sys/devices/platform/30080000.micfil/hwvad/enable
to enable the hardware voice activity detection for micfil or 0
to disable it.
When voice activity is detected, an udev event will be generated:
"EVENT=PDM_VOICE_DETECT" and hwvad will be disabled afterwards.

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
(cherry picked from commit 06495dd0cb0d0e2de225e32251b78edafa473406)
2018-10-29 11:10:38 +08:00
Cosmin-Gabriel Samoila 9be4b802d6 MLK-18655-1 sound: asoc: fix regmap caching for micfil
Remove regmap_cache_only from probe since this should be done
in suspend/resume or when hwvad is enabled/disabled. If regmap
is cached in probe, all volatile registers cannot be read/write
until caching is set to false (which in our case was done only
in resume function).

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
(cherry picked from commit 4cf9ddee84c995e02931be9de5448cb162130862)
2018-10-29 11:10:38 +08:00
Viorel Suman 91ae9419ef MLK-19573-3: ASoC: imx-ak4458: enable DSD playback
Enable DSD playback.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit 351177200e66b980deae67b9d571d378f5b128a2)
2018-10-29 11:10:38 +08:00
Viorel Suman f54daa0a6f MLK-19573-2: ASoC: ak4458: enable DSD playback
Enable AK4458 DSD playback.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit 2faade4b12f12e1fd33d20cda885ed6ddac0fd5e)
2018-10-29 11:10:38 +08:00
Viorel Suman 28a915a1b7 MLK-19573-1: ASoC: fsl: dsd: make fsl_get_pins_state inline
Make fsl_get_pins_state function inline.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit badcb97ebd8c0aae89f76e979bcc801be35c7400)
2018-10-29 11:10:38 +08:00
Shengjiu Wang ccafcb3463 MLK-19581-4: ASoC: imx-pcm-rpmsg: support rpmsg_ak4497
register the codec when needed.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 241b6b3275924f3dc63be26d1442b55b80ac53ef)
2018-10-29 11:10:38 +08:00
Shengjiu Wang ee959e2c9b MLK-19581-3: ASoC: fsl_rpmsg_i2s: support multipul rate and DSD format
The Ak4497 support large range rate and DSD format, so increase
the supported scope of cpu dai.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 29155a9161bfb9985918ed9130aebafc2293c734)
2018-10-29 11:10:38 +08:00
Shengjiu Wang ba7a7dedf9 MLK-19581-2: ASoC: imx-rpmsg: support rpmsg_ak4497
For ak4497, the dai fmt should be SND_SOC_DAIFMT_CBS_CFS.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit ecd184c46e2916d2bcdde8db9b2281b89e8b0189)
2018-10-29 11:10:38 +08:00
Shengjiu Wang 370f617ac3 MLK-19581-1: ASoC: rpmsg_ak4497: support ak4497 over rpmsg
The difference of rpmsg_ak4497 and ak4497 driver is first one
will send command through rpmsg, second one send command through
i2c.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 337f70c4ea5278db28abe1e6eaefbf2d0082aec5)
2018-10-29 11:10:38 +08:00
Shengjiu Wang b9f8333303 MLK-19565-1: ASoC: fsl_rpmsg_i2s: support rpmsg on imx8qm
On imx8qm mek, the cs42888 is connected with i2c in cm41 domain,
but wm8960 is connected with i2c1, which is not in m4 domain.
So we only need to eable rpmsg for cs42888.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 9d2368aef40e4d107e4deee1a2c7e191c1afe644)
2018-10-29 11:10:38 +08:00
Florent Tomasin 50eeeac169 MLK-18170-1: ASoC: imx-wm8960: use API jack functions
Fix the build when IMX_WM8960 machine driver is compiled as module:
CONFIG_SND_SOC_IMX_WM8960=m

Signed-off-by: Florent Tomasin <florent.tomasin@nxp.com>
Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 233f1db5c861034acb29ade544d05604d08ef040)
2018-10-29 11:10:38 +08:00
Shengjiu Wang feb958c742 MLK-19312: ASoC: hdmi-codec: fix error log for hdmi audio
There is error log:

[   31.988272] hdmi-audio-codec hdmi-audio-codec.1: Not able to map channels to speakers (-22)
[   31.996659] hdmi-audio-codec hdmi-audio-codec.1: ASoC: can't set i2s-hifi hw params: -22

which is caused by the channel map read from device don't match
with current channel number.

Orignal method is just return error, but this channel number is
supported by device, so we think should not return error directly,
the playback can ongoing with UNKNOWN channel map.

This issue happen on some TV set (SUMSUNG UA40KUF30EJXXZ).

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2018-10-29 11:10:38 +08:00
Shengjiu Wang 647fbaaa1c MLK-13208: ASoC: fsl_asrc_m2m: change the return value for signal_pending
There is error log after suspend resume with asrc alsa plugin.

"fsl-asrc 2034000.asrc: Pair A: failed to process buffer: -16"

"asrc_pair_convert_s16: Convert ASRC pair 0 failed,
[0x989410][440][0x9895d0][1764]"

Which is caused by the return value is -EBUSY when signal_pending, in this
case we can use the -ERESTARTSYS to instead, that system will recall the
convert function after resume.

Fixes commit e1e9de8e9369 ("MLK-10048-2: ASoC: fsl_asrc: change
the return value")

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2018-10-29 11:10:38 +08:00
Shengjiu Wang 7a97b10d79 MLK-18979-2: ASoC: fsl_asrc: add initial check in resume
If the initialization is not finished, then we input data to
the FIFO will fail, which still cause the error

"output dma task timeout"

So we need to ad initial check in the resume.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2018-10-29 11:10:38 +08:00
Shengjiu Wang 7268718ae3 MLK-18979-1: ASoC: fsl_asrc: add resume function for asrc_m2m
There will be "output DMA task timeout" after suspend and resume.
The reason is there is not enough data in the input FIFO.

In the fsl_asrc_start_pair function we initialize the FIFO with
zero data after pair is enabled, it looks like we add more data
to input FIFO. For example if the input buffer length is 100,
but the actual length is 100 + channel*4. so we need to do same
work in resume for the asrc pair is disabled in suspend, the
input FIFO is cleared.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2018-10-29 11:10:38 +08:00
Russell King 85bc0f08ea ASoC: hdmi-codec: fix routing
Commit 943fa02282 ("ASoC: hdmi-codec: Use different name for playback
streams") broke hdmi-codec's routing between it's output "TX" widget
and the S/PDIF or I2S streams by renaming the streams.

Whether an error occurs or not is dependent on whether there is another
widget called "Playback" registered by some other component - if there
is, that widget will be (incorrectly) bound to the HDMI codec's "TX"
output widget.  If we end up connecting "TX" incorrectly, it can result
in components not being started, causing no audio output.

Since the I2S and S/PDIF streams now have different names, we can't
use a static route at component level to describe the relationship, so
arrange to dynamically create the route when the DAI driver is probed.

Fixes: 943fa02282 ("ASoC: hdmi-codec: Use different name for playback streams")
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit d30e23d699)
2018-10-29 11:10:38 +08:00
Viorel Suman ffe7fc83c9 MLK-19432-1: ASoC: imx-ak5558: limit max rate as function of sample bits
According to AK5558 MCLK frequence must not exceed 36.864 MHz.
Limit maximum supported rate as function of max MCLK frequency,
sample bits and number of slots.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 236796cad225daa39d5b77d763a1d964dd4de4c9)
2018-10-29 11:10:38 +08:00
Viorel Suman 0dcb8e0814 MLK-18898-2: ASoC: imx-ak4458: refine mclk rate calculation
The existing implementation calculates mclk rate as function
of audio sample rate multiplied to multiplier taken from Table 5.
However this is not accurate for Manual Setting Mode - tables 3 & 4 from
AK4458 RM defines rate (LRCK/FS) and frame width (MCLK/16fs..1152fs) ranges
as parameters to calculate mclk frequency. Aside of this - adjust
bclk:mclk ratio from machine driver as function of "compatible" id.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit 527b8b7032dcb75c14bb2790330ab96743d83b16)
2018-10-29 11:10:38 +08:00
Viorel Suman d12e16a817 MLK-18898-1: ASoC: fsl_sai: select pinctrl state as function of bitclock rate
Similar to DSD512 case we need a PCM pinctrl state option to map SAI BCLK
to codec MCLK pin. Given that bitclock rate is function of slots number and
slot width - pass bclk rate as parameter value from SAI driver.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit 826caeae32713cff7ad50de8ebc9915de975edd9)
2018-10-29 11:10:38 +08:00
Viorel Suman 12dc0b57e2 MLK-19154-5: ASoC: fsl_spdif: refine PLL switch handling
Allow PLL switch for playback stream only and remove
PLL switch guard with regard to capture stream as the
clock for capture stream is provided externally.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit c8213da5fbcd370acb4d764bef5df5981a517c11)
2018-10-29 11:10:38 +08:00
Viorel Suman 007808c2a9 MLK-19154-4: ASoC: imx_spdif: set SPDIF ROOT clock freq as function of rate
Set SPDIF master clock frequency as function of rate.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit 407430a03994e4acff508afe8c9772680558c1c5)
2018-10-29 11:10:38 +08:00
Viorel Suman b527b121b7 MLK-19154-3: ASoC: fsl_spdif: Add support for PLL switch at runtime.
iMX8 platforms typically have 2 AUDIO PLLs being configured to handle
8k and 11k audio rates. The patch implements the functionality to
select at runtime the appropriate AUDIO PLL as function of audio
file rate.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit 3a29374cfbe0bfaf1785fa66163ffd3b9e30aca3)
2018-10-29 11:10:38 +08:00
Viorel Suman 6ffc5e383d MLK-19154-2: ASoC: fsl_spdif: keep all 7 TxClk sources
Use txclk array to keep all 7 TxClk sources instead of keeping clocks per
rate - need to do this in order to avoid multiple prepare_enable /
disable_unprepare of the same clock during suspend/resume.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit 61bc5c83af0713a09b520486051a2efcbe852763)
2018-10-29 11:10:38 +08:00
Viorel Suman ce4c086195 MLK-19154-1: ASoC: fsl_spdif: fix TXCLK_DF mask
According to RM SPDIF TXCLK_DF mask is 7-bit wide.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit 206d61281dfd245898c5971f8cbb3fbd6b1c1ef7)
2018-10-29 11:10:38 +08:00
Shengjiu Wang a8df3bcefc MLK-19168-7: ASoC: imx-wm8960: support codec over rpmsg
support codec over rpmsg

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 0b2238d0b88b19a1134aee54706b64a322c6e51b)
2018-10-29 11:10:38 +08:00
Shengjiu Wang 60462b7813 MLK-19168-6: ASoC: imx-rpmsg: update the rpmsg codec name
update the rpmsg codec name

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 6130b919df97b127fafe319f0c2ff601ebc6bed2)
2018-10-29 11:10:38 +08:00
Shengjiu Wang 41a69a3d02 MLK-19168-5: ASoC: imx-cs42888: support codec through rpmsg
support codec through rpmsg

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 8585d67e54c4c3607990a792718992de8be8fe58)
2018-10-29 11:10:38 +08:00
Shengjiu Wang 5d0f71ff1d MLK-19168-4: ASoC: fsl_rpmsg_i2s: support more codec
support more codecs, codec is specified by compatible string

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 7c92a75fcf83ec0aa3fe6773e4cb5f5e88a1ff09)
2018-10-29 11:10:38 +08:00
Shengjiu Wang 7ffb08f0c5 MLK-19168-3: ASoC: imx-pcm-rpmsg: register rpmsg wm8960 and cs42xx8 codec
register rpmsg wm8960 and cs42xx8 codec

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit c49f8d20c6fd4479ad45d76290bb5c57d4800d9e)
2018-10-29 11:10:38 +08:00
Shengjiu Wang 719d90983e MLK-19168-2: ASoC: rpmsg_cs42xx8: support cs42xx8 over rpmsg
The difference of rpmsg_cs42xx8 and cs42xx8 driver is previous one
will send command through rpmsg, others are same.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit dda40ff395bb1d86fc75920bb2bc2ea99099ed4b)
2018-10-29 11:10:38 +08:00
Shengjiu Wang 2338374c73 MLK-19168-1: ASoC: rpmsg_wm8960: port all function from wm8960
The difference of rpmsg_wm8960 and wm8960 driver is previous one
will send command through rpmsg, others are same.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 094521755ae806a572fd841455371b23408c36d1)
2018-10-29 11:10:38 +08:00
Shengjiu Wang 88b8db3e9f MLK-19155: ASoC: fsl_rpmsg: fix the volume is low for S24_LE
The format send to M4 through rpmsg is wrong, that make the
driver treat the data as S32_LE, it looks like data is right
shift 8 bit.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 508550b70e80339d3d49594ffc23946dd80b0c82)
2018-10-29 11:10:38 +08:00
Shengjiu Wang 442046b6dc MLK-19118-3: ASoC: AK5558: add regulators for ak5558
add regulators for ak5558

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 914f117ffb4233ba630515d8426d30006a82794f)
2018-10-29 11:10:38 +08:00
Shengjiu Wang 4aa06711d8 MLK-19118-2: ASoC: AK4497: add regulators for ak4497
add regulators for ak4497

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit c33df8b3f4a05ff9a6f12bb66ac9b5f6fcaaaf3e)
2018-10-29 11:10:38 +08:00
Shengjiu Wang 3792d032f8 MLK-19118-1: ASoC: AK4458: add regulator for ak4458
add regulator for ak4458

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 6b9f1e42e6d4f59ad2c66c0d327fc6d63572147f)
2018-10-29 11:10:38 +08:00
Shengjiu Wang 38f079dd2c MLK-19067-1: ASoC: imx-rpmsg: differentiate input and output direction
Some platform the rpmsg device only support playback or record. So
Add a property to differentiate them.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit aa8b9304d207e5f00cca8a41772c130dd4c6944b)
2018-10-29 11:10:38 +08:00
Shengjiu Wang 5bf122904c MLK-19042-4: ASoC: imx-rpmsg: dummy codec support in imx8mm
In imx8mm, there is no controls for wm8524, so we use the
dummy codec instead.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit 43bcd3a8e9f4c1b2af9974f2082a34beacfba4a1)
2018-10-29 11:10:38 +08:00
Shengjiu Wang 919ba48a55 MLK-19042-3: ASoC: rpmsg_wm8960: changes for receive message
Update the read and write function for the send_message function
changes

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit 4610826f39ee4124588b818e5589c25448aa3dba)
2018-10-29 11:10:38 +08:00
Shengjiu Wang a18282bc1e MLK-19042-2: ASoC: imx-pcm-rpmsg: support low power audio
Add ack function, which is to info M4 side how many data
has been writen to buffer.

Add timer, which is to get the position of hw pointer in m4.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit 0fd349fbab28d97f8c5501ec635bff053e3b1470)
2018-10-29 11:10:38 +08:00
Shengjiu Wang 3fef6fb095 MLK-19042-1: ASoC: fsl_rpmsg_i2s: support low power audio
Add two new message command I2S_TX_POINTER and I2S_RX_POINTER,
which are used to get the hw pointer in m4 side. For in low
power audio mode, m4 won't send notification every period, the
notification only be sent when hw pointer reach end of buffer,
so we need these command to get the position of hw pointer,
user can use it to calculate the timestamp.

Restructure send message and recv message together for i2s_rpmsg,
that every send message has a recv message. so the
i2s_send_message can store the recv message indepedently. one
reason is that the receive message is async withe send message.

The low power audio is disabled in default, user need to enabled
it by add "fsl,enable-lpa" in dts.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit 753e7b819609ad4791e32069a124d4411c720947)
2018-10-29 11:10:38 +08:00
Shengjiu Wang 33d997b7d5 MLK-18947: ASoC: fsl_sai: fix volatile function
The FSL_SAI_VERID and FSL_SAI_PARAM only available
when reg_offset is 8

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 0a0695672dc7ecf07a7642ff6f99f0b9d3a26b32)
2018-10-29 11:10:38 +08:00
Shengjiu Wang e4a97e60b7 MLK-18947: ASoC: imx-pcm-dma: alloc buffer from IRAM
In some platform, the low power audio playback should be
supported, which need the audio buffer allocated from
OCRAM/IRAM. So move the buffer allocation to .open
function at that time the dma chan is allocated.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 85c59acfc5c8d17aa0f369dbe30e4a5fb128c25f)
2018-10-29 11:10:38 +08:00
Viorel Suman e356298015 MLK-19211: ASoC: ak4458: enable 352800 and 705600 rates
Add missing 352800 and 705600 rates.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
(cherry picked from commit 7cc5154895b4f8d644a446719427b432c5e2ed9d)
2018-10-29 11:10:38 +08:00
Daniel Baluta 9a096415af MLK-17481-4: ASoC: fsl: Don't bail out on OFS_PERIPH error
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit b6fa30e239da2f38cf31508e98a405ef697e233b)
2018-10-29 11:10:38 +08:00
Daniel Baluta 584c308b99 MLK-17481-3: ASoC: fsl: Fix DSP memory mappings
We load DSP firmware from the ARM side at 0x556e8000 but because the
compiler generated memory layout starts at 0x596e8000 we need to do
some fixups.

Thus, each address (in DSP local memory) generated by the compiler
needs to be substracted an offset = 0x596e8000 - 0x556e8000 = 0x4000000.

Because this only happens on QM we will use dts to specify the offset.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 8d4518d2a5d956549e829470af15003d7adff841)
2018-10-29 11:10:38 +08:00
Viorel Suman d3598f73bc MLK-18863-2: ASoC: fsl: move imx-cdnhdmi to end of the list
Move imx-cdnhdmi to end of the list.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit dfbe056fa8cc366d05aa051bf9cf7503ee2914cd)
2018-10-29 11:10:38 +08:00
Viorel Suman 54030792d9 MLK-19115-2: ASoC: fsl_spdif: add support for enabling raw capture mode
Since i.MX8 MQ SPDIF interface is able to capture raw data.
Add support in SPDIF driver for this functionality.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit e13a302391f56a6bb547ff89e3fac73941cee429)
2018-10-29 11:10:38 +08:00
Viorel Suman 0baa258af1 MLK-19115-1: ASoC: fsl_spdif: use snd_ctl_boolean_mono_info
Remove redundant code and use snd_ctl_boolean_mono_info
instead.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit 6ae5e1bf20eeff7e5ec821d96958329170359ce8)
2018-10-29 11:10:38 +08:00
Shengjiu Wang 3519b67ac0 MLK-19151: ASoC: fsl_asrc: fix dma timeout issue for imx8qxp
In the imx8qxp, the DMA is EDMA, which require the buffer size
should be divided by burst size with no remainder, otherwise
the remainder is not transferred by EDMA, so the input buffer
is not consumed by ASRC, then there will be dma output timeout
issue. This behavior is different with SDMA.

This patch is to change the input burst size to be 1 to avoid
the issue, and refine the last_period_size for output buffer.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2018-10-29 11:10:38 +08:00
Shengjiu Wang 4776ecdc90 MLK-19063: ASoC: fsl_hdmi: fix null pointer dereference issue
This issue is reported by coverity (4022712).

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2018-10-29 11:10:38 +08:00
Shengjiu Wang cddbaf363e MLK-18874: ASoC: fsl_asrc: fix noise issue with 5 channel conversion
The dma_len is the size that how many data dma should transmit. As
the asrc use channel as unit, so the dma_len should also in channel unit.
Otherwise the output data is not align in channel, there will be noise.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
2018-10-29 11:10:38 +08:00
Shengjiu Wang 30450fec9f MLK-18971: ASoC: fsl_asrc: fix record sound distortion issue
Fixes commit feb06839682c ("MLK-16839-1: ASoC: fsl_asrc: selec
a proper clock source from the clock list")

When inclk is INCLK_ASRCK1_CLK, the driver will config module
to be non ideal ration mode, But the divider should be less
than 1024 and exact division. otherwise there will be distortion.

If the divider larger than 1024 or it is not exact division, asrc
should switch to ideal ratio mode, which don't care about the
divider.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
2018-10-29 11:10:38 +08:00
Shengjiu Wang 173129d829 MLK-18875: ASoC: fsl_asrc_m2m: refine the last period size
The output size of asrc for a dedicate input is uncertain.

For example, if the input size is 1k, the output ratio is
2, so the output size should be 2k. but the actual output
size is not 2k,  is less than 2k. if we set the dma size
to be 2k, the dma can't get enough data that can't finish
the transmission, then there will be

"output DMA task timeout"

So we need to set the dma size a proper value but we don't know
how many data less than expected. so we defined the last period
size for assumption of reduced size.

The last period size should not be too large, if it is large
there will be

"input DMA task timeout"

The reason is the output FIFO is full, which will block the
input data comsumption.

In this patch, the last period size is set to the difference
of configured buffer size and the expected output size, plus
a fix size.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
2018-10-29 11:10:38 +08:00
Viorel Suman caef1a0a43 MLK-18863: ASoC: fsl: reorder the list of objects
Reorder the list of objects in attempt to get
a predictible audio card probe sequence.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit 7c6ba2719353accad88a9331c75185b7c08e1bce)
2018-10-29 11:10:38 +08:00
Viorel Suman 7365b8f353 MLK-18955-3: ASoC: fsl_spdif: restore arate type
Changing "arate" type to u64 makes 32-bit kernel build to fail,
so restore the previous type.

Fixes: bb7d18078220 ("MLK-18955-2: ASoC: fsl_spdif: fix sysclk_df type")

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Leonard Crestez <leonard.crestez@nxp.com>
(cherry picked from commit 5250b586a5975d27efe73a5b4ca8d8e9c27cc6ab)
2018-10-29 11:10:38 +08:00
Viorel Suman cd33c7c041 MLK-18955-2: ASoC: fsl_spdif: fix sysclk_df type
According to SPDIF spec STC SYSCLK_DF field is 9 bits width, values
being in 0..511 range. So use a proper type to handle sysclk_df.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit bb7d180782208d5546a6ff6f89fb55180c1ba721)
2018-10-29 11:10:38 +08:00
Shengjiu Wang dcd6cc5352 MLK-18866: ASoC: imx-pcm-dma-v2: refine the callback function
The commit 7f3ff14b7e ("dmaengine: imx-sdma: add 1ms delay
to ensure SDMA channel is stopped") add 1ms delay may cause
the audio underrun/overrun.

But ESAI has an hardware issue in older version which work abnormal
after underrun/overrun, especially there will be channel swap.
To workaround this issue, the ESAI need to be reset. in
imx-pcm-dma.c we include a new callback function for DMA interrupt
which will check the state of cpu dai and reset it in necessary.

So inport same function to imx-pcm-dma-v2.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2018-10-29 11:10:38 +08:00
Viorel Suman a464d15efd MLK-18737: move 'pair_streams' to 'struct fsl_asrc_pair'
For multi p2p instance an ASRC device cannot be closed successfully
when two threads plays streams simultaneously on same ASRC device.
'pair_streams' variable shall be moved to 'struct fsl_asrc_pair'
for multi p2p instance in order to handle pair release properly.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Suggested-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2018-10-29 11:10:38 +08:00
Viorel Suman 48ea41e7ab MLK-18682-6: ASoC: imx-ak4497: refine 1:1 bclk:mclk ratio support
Use a specific compatible string for 850D in order to limit DSD MCLK
frequency for platforms newer than 850D.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2018-10-29 11:10:38 +08:00
Viorel Suman 7e796b7827 MLK-18682-3: ASoC: imx-ak: enable both 8k and 11k range of rates
SAI interface now is able to change at runtime the pll parent of the
master clock, so enable both 8k and 11k range of rates for AK codecs.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2018-10-29 11:10:38 +08:00
Viorel Suman 1a8609acd9 MLK-18682-2: ASoC: fsl: sai: allow dynamic pll switching
Currently SAI master clock derives from an audio pll that cannot be
changed at runtime. iMX8 SoC has 2 audio plls usually configured to support
either 8000Hz (8k,16k,32k,48k,etc) or 11025Hz (11k,22k,44.1k,88.2k,etc)
ranges of rates - thus at runtime a SAI interface is able to play only one
range of rates. The patch allows dynamic SAI master clock reparenting to
the appropriate audio pll as function of the audio stream rate to be
played/recorded.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2018-10-29 11:10:38 +08:00
Viorel Suman f1e7a0dbfa MLK-18682-1: ASoC: fsl: sai: use set_bclk_ratio to calculate BCLK freq
ALSA API has a standard way to configure DAI BCLK by calling
"snd_soc_dai_set_bclk_ratio" function. So use it to set BCLK ratio
and calculate SAI BCLK frequency.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2018-10-29 11:10:38 +08:00
Viorel Suman 4911bb5938 MLK-18691: ASoC: imx-xtor: don't add ASRC audio routes if node is missing
ASRC audio routes introduce aditional log noise if ASRC
OF node is missing in DTS, so add them if ASRC node is present only.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2018-10-29 11:10:38 +08:00
Viorel Suman b8e022fb03 MLK-18691: ASoC: imx-xtor: let DAI calculate SYSCLK freq needed
Currently SAI interface sets MCLK rate if provisioned
externally from machine driver through set_sysclk. Let
SAI manage clock frequency without interfering from machine driver.
Aside of this use channels number to set TDM tx and rx masks.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2018-10-29 11:10:38 +08:00