1
0
Fork 0
Commit Graph

1610 Commits (redonkable)

Author SHA1 Message Date
Dong Aisheng 8d66f9b461 Merge remote-tracking branch 'origin/audio/ssi' into audio/next
* origin/audio/ssi:
  LF-106: ASoC: fsl_ssi: request BUS_FREQ_AUDIO
  MLK-15975-1: ASoC: fsl_ssi: support multi fifo script
2019-12-02 18:00:44 +08:00
Dong Aisheng 635de10e16 Merge remote-tracking branch 'origin/audio/spdif' into audio/next
* origin/audio/spdif: (20 commits)
  LF-106: ASoC: fsl_spdif: request BUS_FREQ_HIGH
  ASoC: fsl_spdif:Support multi power domains
  ASoC: fsl_spdif: Add pm_runtime_enable in probe
  MLK-21484-2: ASoC: fsl_spdif: ensure clk is unprepared before reparent
  MLK-19154-5: ASoC: fsl_spdif: refine PLL switch handling
  ...
2019-12-02 18:00:44 +08:00
Dong Aisheng b7f8883066 Merge remote-tracking branch 'origin/audio/sof' into audio/next
* origin/audio/sof: (21 commits)
  ASoC: SOF: Read tplg filename from board descriptor
  ASoC: SOF: Update fw_filename from board description
  ASoC: SOF: Allow probe to continue when we have an actual codec
  ASoC: SOF: Hardcode ignore_machine
  ASoC: fsl: Add generic DAI driver
  ...
2019-12-02 18:00:44 +08:00
Dong Aisheng 2a635fc846 Merge remote-tracking branch 'origin/audio/sai' into audio/next
* origin/audio/sai: (65 commits)
  LF-106: ASoC: fsl_sai: request BUS_FREQ_AUDIO
  ASoC: fsl_sai: Mark cache dirty at resume
  MLK-21876-4 ASoC: fsl: sai: fix build for next-20190524 upgrade
  ASoC: fsl: sai: fix build failture due to 5.1 RC7 upgrade
  ASoC: fsl_sai: support multi power domain
  ...
2019-12-02 18:00:43 +08:00
Dong Aisheng d7ba9dc826 Merge remote-tracking branch 'origin/audio/rpmsg' into audio/next
* origin/audio/rpmsg: (59 commits)
  LF-215: ASoC: fsl_rpmsg_i2s: Enable WQ_FREEZABLE for workqueue
  ASoC: imx-pcm-rpmsg: Remove the prtd
  ASoC: imx-pcm-rpmsg: Fix writecombine/wc build error
  ASoC: rpmsg_ak4497: ignore suspend with DAPM
  Revert "ASoC: soc-pcm: remove soc_rtdcom_ack()"
  ...
2019-12-02 18:00:43 +08:00
Dong Aisheng f543f63f55 Merge remote-tracking branch 'origin/audio/micfil' into audio/next
* origin/audio/micfil:
  MLK-22598: ASoC: fsl_micfil: Reset channel output data Flag
  ASoC: fsl_micfil: Merge the changes from imx_4.19.y
2019-12-02 18:00:42 +08:00
Dong Aisheng af11fb98c2 Merge remote-tracking branch 'origin/audio/hdmi' into audio/next
* origin/audio/hdmi: (22 commits)
  ASoC: imx-hdmi: Fix compile error
  ASoC: imx-hdmi-dma: Fix issue with dma_alloc_coherent
  ASoC: imx-hdmi-dma: replace platform to component
  ASoC: imx-cdnhdmi: Fix compile error
  MLK-20183-2: ASoC: imx-cdnhdmi: reconfigure the mclk for HDMI on imx8mq
  ...
2019-12-02 18:00:42 +08:00
Dong Aisheng 25d4beddff Merge remote-tracking branch 'origin/audio/fm' into audio/next
* origin/audio/fm: (8 commits)
  MLK-11429-21: ASoC: fsl: port si476x machine driver from imx_3.10.y
  MLK-11305 radio-si476x: support set V4L2_CID_AUDIO_MUTE CTRL
  MLK-22355: mfd: si476x: Use system_freezable_wq instead of system_wq
  MLK-10055-2: mfd: si476x-i2c: sound is registered when no FM module attached
  MLK-10038-1: mfd: si476x-i2c: Add support of si476x-rev4.0 board
  ...
2019-12-02 18:00:41 +08:00
Dong Aisheng 845f67dda2 Merge remote-tracking branch 'origin/audio/esai' into audio/next
* origin/audio/esai: (7 commits)
  LF-276: ASoC: fsl_easi: constrain period size for edma case
  ASoC: fsl_esai: Remove the tasklet
  ASoC: fsl_esai: Add spin lock to protect reset, stop and start
  ASoC: fsl_esai: Remove expensive print in irq handler
  ASoC: fsl_esai: support multi power domain
  ...
2019-12-02 18:00:40 +08:00
Dong Aisheng 5d9b52c341 Merge remote-tracking branch 'origin/audio/dsp' into audio/next
* origin/audio/dsp: (78 commits)
  MLK-22815-1: ASoC: fsl: dsp: Expand parameter msg size
  MLK-21144 ASoC: fsl: Fix crash with multiple open/close
  ASoC: fsl_dsp: Use new compatible string for FSL DSP
  ASoC: fsl: dsp: remove unused types.h
  MLK-21985-6 ASoC: imx-dsp: fix build for next 20190607 upgrade
  ...
2019-12-02 18:00:40 +08:00
Dong Aisheng d40375dbf7 Merge remote-tracking branch 'origin/audio/dma' into audio/next
* origin/audio/dma: (14 commits)
  ASoC: imx-pcm-dma-v2: Fix writecombine/wc build error
  ASoC: imx-pcm-dma-v2: Add component name
  ASoC: imx: fix build failture
  MLK-16224-2: ASoC: dmaengine_pcm: add fifo_num to snd_dmaengine_dai_dma_data
  MLK-18947: ASoC: imx-pcm-dma: alloc buffer from IRAM
  ...
2019-12-02 18:00:39 +08:00
Dong Aisheng 2e5482f337 Merge remote-tracking branch 'origin/audio/card' into audio/next
* origin/audio/card: (127 commits)
  ASoC: imx-pdm: Fix compile issue
  ASoC: imx-wm8524: remove unused audio route
  ASoC: imx-ak5558: remove unused audio route
  ASoC: imx-wm8962: change cpu-dai to audio-cpu
  ASoC: imx-sii902x: Fix compile error
  ...
2019-12-02 18:00:38 +08:00
Dong Aisheng bbeadc6b01 Merge remote-tracking branch 'origin/audio/audmix' into audio/next
* origin/audio/audmix:
  ASoC: fsl_audmix: Add spin lock to protect tdms
2019-12-02 18:00:37 +08:00
Shengjiu Wang 125bad112c LF-276: ASoC: fsl_easi: constrain period size for edma case
There is limitaion for EDMA, which can only accept the period bytes
that can be divided by maxburst with no remainder. Otherwise EDMA
will not copy the left data in the end, and it will cause noise.
so add constraint for these chips.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-12-02 15:33:20 +08:00
Shengjiu Wang dfb874e95e LF-215: ASoC: fsl_rpmsg_i2s: Enable WQ_FREEZABLE for workqueue
In the end of playback, when the suspend happen, there will be error
in m4 side.

RTM_SaiSdmaAdapter_SetParam: Tx in wrong state 2!
SRTM_SaiSdmaAdapter_SetBuf: Tx in wrong state 2!
SRTM_SaiSdmaAdapter_Start: Tx in wrong state 2!

The reason is that the I2S_TX_TERMINATE happen in the middle of
I2S_TX_SUSPEND and I2S_TX_RESUME, this sequence is not allowed.

So we make the rpmsg message workqueue enter freeze in suspend
to avoid such issue. that the command sequence will be
I2S_TX_SUSPEND->I2S_TX_RESUME->I2S_TX_TERMINATE

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-29 16:15:08 +08:00
Daniel Baluta 925ad97abd ASoC: fsl: Add generic DAI driver
On i.MX8 platforms that have a DSP the DAI handling is taken care
of by two entities:
	* Application Processor (AP), which runs Linux
	* DSP, which runs a firmware (typically Sound Open Firmware)

The DSP has access to DAI IP registers, but it cannot easily handle
resources like:
	* clock
	* power domain management
	* pinctrl.

For this reason we introduce a generic FSL DAI driver which will take
care of the resources above.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-28 23:16:40 +02:00
Daniel Baluta 78570725ce Revert "ASoC: fsl: Add generic DAI driver"
This reverts commit 9aca4d89de.
Reverting this because the patch suffered a lot of changes and
I don't want to do a first push. This should be squasehd
with 9aca4d89de.
2019-11-28 23:15:41 +02:00
Daniel Baluta 9aca4d89de ASoC: fsl: Add generic DAI driver
On i.MX8 platforms that have a DSP the DAI handling is taken care
of by two entities:
	* Application Processor (AP), which runs Linux
	* DSP, which runs a firmware (typically Sound Open Firmware)

The DSP has access to DAI IP registers, but it cannot easily handle
resources like:
	* clock
	* power domain management
	* pinctrl.

For this reason we introduce a generic FSL DAI driver which will take
care of the resources above.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-27 21:56:10 +02:00
Shengjiu Wang fcfc4be154 MLK-11429-21: ASoC: fsl: port si476x machine driver from imx_3.10.y
cherry-pick below patch from imx_3.14.y
ENGR00330403-3: ASoC: fsl: port si476x machine driver from imx_3.10.y

Port si476x machine dirver for i.MX series SoC and binding doc from imx_3.10.y

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:54:34 +08:00
Shengjiu Wang f25a242346 LF-106: ASoC: fsl_ssi: request BUS_FREQ_AUDIO
request BUS_FREQ_AUDIO

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:54:27 +08:00
Shengjiu Wang 24a3bee2e1 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)
2019-11-25 15:54:27 +08:00
Shengjiu Wang c7dad700c4 LF-106: ASoC: fsl_spdif: request BUS_FREQ_HIGH
request BUS_FREQ_HIGH

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:54:25 +08:00
Shengjiu Wang bd7b26036e ASoC: fsl_spdif:Support multi power domains
Support multi power domains

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:54:24 +08:00
Shengjiu Wang 2d2076c4d0 ASoC: fsl_spdif: Add pm_runtime_enable in probe
Add pm_runtime_enable in probe

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:54:24 +08:00
Viorel Suman ccea8f42a7 MLK-21484-2: ASoC: fsl_spdif: ensure clk is unprepared before reparent
On recent kernels clks which are marked with CLK_SET_RATE_GATE are
"protected" against further changes at clk_prepare time, including clk
reparent. Wrap clk set_parent and set_rate operations with
disable_unprepare and prepare_enable.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:54:23 +08:00
Viorel Suman 8e013fb268 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)
2019-11-25 15:54:22 +08:00
Viorel Suman 084c2ca345 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)
2019-11-25 15:54:22 +08:00
Viorel Suman 960f3f4848 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)
2019-11-25 15:54:21 +08:00
Viorel Suman 1b48437219 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)
2019-11-25 15:54:21 +08:00
Viorel Suman fff54ed842 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)
2019-11-25 15:54:20 +08:00
Viorel Suman 83fbe12324 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)
2019-11-25 15:54:20 +08:00
Shengjiu Wang e3e48111d9 MLK-18574: ASoC: fsl_spdif: specify the spdif in imx8mm
specify the spdif in imx8mm for the ipg clock is higher that
it can support 192kHz

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:54:19 +08:00
Shengjiu Wang 590ec64bb5 MLK-18574: ASoC: fsl_spdif: support 192kHz for rx in imx8
The ipg clock is higher enough to support 192kHz in imx8

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:54:18 +08:00
Shengjiu Wang 70e9a07d29 MLK-17089-4: ASoC: fsl_spdif: support suspend & resume for imx8
Base on latest power management design in MLK-17074, every driver
need to enter runtime suspend state in suspend, so the driver should
call the pm_runtime_force_suspend in suspend. with this implementation
the suspend function almost same as runtime suspend function. so remove
the suspend function, just use pm_runtime_force_suspend instead.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:54:18 +08:00
Shengjiu Wang c4f6be48fd MLK-17034-6: ASoC: fsl_spdif: Move clock operation to pm runtime function
In imx8 when systerm enter suspend state, the power of subsystem will be
off, the clock enable state will be lost after resume, but the runtime
resume function will be called after resume by pm, so need to move clock
enablement to runtime resume and clock disablement to runtime suspend.
Then after resume the clock enable state can be recovered.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:54:17 +08:00
Shengjiu Wang c84933c819 MLK-15960-3: ASoC: fsl_spdif: refine pm runtime function
In imx8qm/imx8qxp, the power domain of IP is enabled when
pm_runtime_get_sync() is called, and disabled when pm_runtime
_put_sync() is called. when power domain is disabled, the value
of registers will lost, so we need to use the regcache_sync()
to restore the registers in fsl_spdif_runtime_resume.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:54:17 +08:00
Shengjiu Wang 38f89d3ce1 MLK-13947: ASoC: fsl_spdif: introduce SoC specific data
Introduce a SoC data struct which contains the differences between
the different SoCs this driver supports. This makes it easy to support
more differences without having to introduce a new switch/case each
time.
And in imx8qm, the spdif has two interrupt numbers and the burst size
should be 2 for EDMA limitation to support dual FIFO.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:54:16 +08:00
Shengjiu Wang 610e75569e MLK-12722: ASoC: fsl_spdif: clear the validity bit for TX
Validity bit is set in default, which means the data is not reliable,
The receive device may drop this data. So clear it in default, and
provide a mixer interface for user to control this bit.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:54:15 +08:00
Shengjiu Wang 54cf07dcaf MLK-10903-2: ASoC: imx_spdif: add snd_soc_pm_ops
Add snd_soc_pm_ops in machine driver to make the trigger suspend/resume
be called in suspend/resume. Remove platform_set_drvdata for redundance,
When register card, it has been called.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit fe21119eed18804b2bc7c47216b6f4478de0268d)
2019-11-25 15:54:15 +08:00
Shengjiu Wang f675fa3778 MLK-10903-1: ASoC: fsl_spdif: remove cache only in suspend/resume
In imx6qp, there is no mega fast. After suspend, but before resume,
there will be spdif interrupt, if set cache only in suspend, then we
can't clear the interrupt, because regmap_write only write to cache.
So the system will hang for the interrupt can't be cleared.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit 2a6a522c86d6c0fe80023c4327ca7ce4792035c8)
2019-11-25 15:54:14 +08:00
Shengjiu Wang 15bbc61393 MLK-11429-1: ASoC: fsl_spdif: don't change the root clock rate of spdif in driver
cherry-pick below patch from imx_3.14.y
ENGR00331799-2 ASoC: fsl_spdif: don't change the root clock rate of spdif in driver

The spdif root clock may be used by other module or defined with
CLK_SET_RATE_GATE, so we can't change the clock rate in driver.
In this patch remove the clk_set_rate and clk_round_rate to protect the
clock.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit c77170b2c9a9737f6fd61a5ea85a43b90e8ef02b)
[ Aisheng: fix incorrectly removing u64 rate_actual ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:54:14 +08:00
Shengjiu Wang 801e2a74c5 LF-106: ASoC: fsl_sai: request BUS_FREQ_AUDIO
request BUS_FREQ_AUDIO

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:54:12 +08:00
Daniel Baluta 61e5cc7288 ASoC: fsl_sai: Mark cache dirty at resume
This is needed so that at resume will restore the
correct SAI registers.

Looks like the call to regcache_mark_dirty was missed when
porting commit 760bd6187413e37c8 ("MLK-15960-2: ASoC: fsl_sai: refine
the pm runtime function")

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:54:12 +08:00
Dong Aisheng 21ab6ea993 MLK-21876-4 ASoC: fsl: sai: fix build for next-20190524 upgrade
In file included from ../sound/soc/fsl/fsl_sai.c:15:0:
../sound/soc/fsl/fsl_sai.c: In function ‘fsl_sai_startup’:
../sound/soc/fsl/fsl_sai.c:957:51: error: ‘offset’ undeclared (first use in this function)
  regmap_update_bits(sai->regmap, FSL_SAI_xCR3(tx, offset),
                                                   ^
../include/linux/regmap.h:77:31: note: in definition of macro ‘regmap_update_bits’
  regmap_update_bits_base(map, reg, mask, val, NULL, false, false)
                               ^
../sound/soc/fsl/fsl_sai.h:84:37: note: in expansion of macro ‘FSL_SAI_TCR3’
 #define FSL_SAI_xCR3(tx, off) (tx ? FSL_SAI_TCR3(off) : FSL_SAI_RCR3(off))
                                     ^
../sound/soc/fsl/fsl_sai.c:957:34: note: in expansion of macro ‘FSL_SAI_xCR3’
  regmap_update_bits(sai->regmap, FSL_SAI_xCR3(tx, offset),
                                  ^
../sound/soc/fsl/fsl_sai.c:957:51: note: each undeclared identifier is reported only once for each function it appears in
  regmap_update_bits(sai->regmap, FSL_SAI_xCR3(tx, offset),
                                                   ^
../include/linux/regmap.h:77:31: note: in definition of macro ‘regmap_update_bits’
  regmap_update_bits_base(map, reg, mask, val, NULL, false, false)
                               ^
../sound/soc/fsl/fsl_sai.h:84:37: note: in expansion of macro ‘FSL_SAI_TCR3’
 #define FSL_SAI_xCR3(tx, off) (tx ? FSL_SAI_TCR3(off) : FSL_SAI_RCR3(off))
                                     ^
../sound/soc/fsl/fsl_sai.c:957:34: note: in expansion of macro ‘FSL_SAI_xCR3’
  regmap_update_bits(sai->regmap, FSL_SAI_xCR3(tx, offset),

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:54:11 +08:00
Dong Aisheng 63de0c0232 ASoC: fsl: sai: fix build failture due to 5.1 RC7 upgrade
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:54:11 +08:00
Shengjiu Wang 53915e7ea9 ASoC: fsl_sai: support multi power domain
support multi power domain

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:54:10 +08:00
Shengjiu Wang c43c341752 ASoC: fsl_sai: Support -EPROBE_DEFER
Support -EPROBE_DEFER for the resource is not ready in time

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:54:09 +08:00
Viorel Suman e138a5378b MLK-20328-1: ASoC: fsl_sai: map number of pins to dataline masks
The patch enable mapping the number of pins required to play or record
a specific number of channels to a specific dataline mask.

Three consequent elements in "fsl,dataline" and "fsl,dataline,dsd" defines a
particular mapping, for instance for: fsl,dataline = "0 0xff 0xff 2 0x11 0x11"
there are two mappings defined:

default (0 pins) "rx" and "tx" dataline masks: 0 0xff 0xff
         2 pins  "rx" and "tx" dataline masks: 2 0x11 0x11

In case if property is missing, then default value "0 0x1 0x1" is considered.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:54:09 +08:00
Viorel Suman 34ef089c73 MLK-20189-8: ASoC: fsl_sai: use signed offset variable
Both dataline_off and dataline_off_dsd fields are unsigned,
thus checking negative values make no sense. Use a signed
variable to calculate offset instead.

This fixes Coverity issue: CID1899299

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:54:08 +08:00
Shengjiu Wang f2fa8b69e5 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)
2019-11-25 15:54:06 +08:00
Viorel Suman a9534c8c98 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)
2019-11-25 15:54:05 +08:00
Viorel Suman f3d96d45f6 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)
2019-11-25 15:54:02 +08:00
Shengjiu Wang ddf3ffebf9 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)
2019-11-25 15:54:01 +08:00
Viorel Suman 244757cda2 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>
2019-11-25 15:54:01 +08:00
Viorel Suman 4bc2390d93 MLK-18682-1: ASoC: fsl: sai: use set_bclk_ratio to calculate BCLK freq (part 1)
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>
[ Aisheng: split machine imx-pdm changes ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:54:00 +08:00
Viorel Suman 06131f164d MLK-18534-1: ASoC: fsl: sai: introduce 1:1 bclk:mclk ratio support
Since IP version 3.01 (845s) SAI has support for 1:1
bclk:mclk ratio.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:54:00 +08:00
Viorel Suman f228945168 MLK-17531-1: ASoC: fsl: sai: add support for SAI v3.01
a) Add support for new SAI (VERID, PARAM, MCTL, MDIV) registers
   available in i.MX 850d (SAI v3.00) and i.MX 845s (SAI v3.01).
b) Handle SAI MCLK register as function of SAI IP version.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:53:59 +08:00
Viorel Suman cf1d61356c MLK-17580: ASoC: fsl: sai: check for pinctrl status
For some cases (like AMIX) pinctrl may be null - this
breaks SAI functionality. Enforce pinctrl null pointer
checking prior calling any function which involves
pins state changes.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:53:58 +08:00
Viorel Suman 0e084ed83d MLK-17580: ASoC: fsl: sai: Use DSD helper
Replace DSD related code with calls to DSD helper functions.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com
2019-11-25 15:53:58 +08:00
Viorel Suman 6e286195f6 MLK-17580: ASoC: fsl: dsd: Add DSD utilities helper
Add DSD utilities helper.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com
2019-11-25 15:53:57 +08:00
Cosmin-Gabriel Samoila 8f88f5a166 Sound: Soc: fsl: Set SAI Channel Mode to Output Mode
Transmit data pins will output zero when slots are masked or channels
are disabled. In CHMOD TDM mode, transmit data pins are tri-stated when
slots are masked or channels are disabled. When data pins are tri-stated,
there is noise on some channels when FS clock value is high and data is
read while fsclk is transitioning from high to low.

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:53:56 +08:00
Shengjiu Wang 24e96cb548 MLK-17156-1: ASoC: fsl_sai: update register offset for ULP B0
ULP B0 integrate the latest SAI IP, there is version id and
parameter id register in the beginning, so update the offset
for ULP B0

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:53:55 +08:00
Viorel Suman 868ead7e7e MLK-17528-3: ASoC: fsl_sai: Set clock rate in "set_sysclk" API
Set the requested clock rate in "set_sysclk" for specified clock id.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Suggested-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:53:55 +08:00
Viorel Suman c5f603a927 MLK-17528-1: ASoC: fsl_sai: Introduce FSL_SAI_CLK_BIT clock id
Introduce FSL_SAI_CLK_BIT clock id in order to distinguish
the bit clock and master clocks in "set_sysclk" API.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Suggested-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:53:54 +08:00
Shengjiu Wang af5446166b MLK-17566: ASoC: fsl_sai: fix register definition
The register definition is not completed for SAI support
8 transmit data register and 8 receive data register.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:53:53 +08:00
Daniel Baluta 7713dcdb9f MLK-17485: ASoC: fsl_sai: Specify supported rate_min and rate_max
Because fsl_sai_dai rates doesn't have a specific set of
rate values (.rates = SNDRV_PCM_RATE_KNOT) we need to provide
rate_min and rate_max otherwise functions trying to get
supported parameters will get confused and return an error.

Fixes:  1b6f0496e013 ("MLK-17428-8: ASoC: fsl_sai: support 768KHz sample rate")
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:53:53 +08:00
Shengjiu Wang c31b8ab22e MLK-17428-8: ASoC: fsl_sai: support 768KHz sample rate
support 768Hz sample rate and 2.8MHz for DSD

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:53:52 +08:00
Viorel Suman 086dcbc6a9 MLK-16224-6: ASoC: fsl_sai: fix DSD suspend/resume
With the existing implementation the SAI pinctrl state is restored to
default after resume - this breaks DSD playback after resume.
Restore DSD pinctrl state in snd_soc_dai_driver resume callback.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:53:52 +08:00
Shengjiu Wang 27fdb7856d MLK-17467: ASoC: fsl_sai: fix typo for fsl_sai
Fix build warning

sound/soc/fsl/fsl_sai.c: In function ‘fsl_sai_trigger’:
sound/soc/fsl/fsl_sai.c:736:3: warning: this ‘while’ clause does not guard... [-Wmisleading-indentation]
   while (tx && i < channels)
   ^~~~~
sound/soc/fsl/fsl_sai.c:742:4: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘while’
    j++;
    ^
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:53:52 +08:00
Shengjiu Wang 15e50be363 MLK-16224-4: ASoC: fsl_sai: support multi fifo and DSD
The codec always mux the LRCLK pin to DSD data line, so when
we want to support DSD, the pinmux is different. For two channel
DSD, the DSDL is mapped to TX0, but the DSDR is mapped to TX4,
there is address offset for the fifo address of TX0 and TX4, TX4's
fifo is not adjacent to TX0's.

Usually, if mapping is TX0 and TX1, that will be easy for SAI
and SDMA to handle, that SAI can use the FIFO combine mode, SDMA
can use the normal script.

so for DSD:
1. The SDMA should use the multi-fifo script, and SAI can't
use the FIFO combine mode.
2. driver should to check the dts configuration(fsl,dataline) for
which dataline is used corrently
3. maxburst is the multiply of datalines
4. each channel of DSD occupy one data lane
5. according to data lane, set TRCE bits

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:53:50 +08:00
Shengjiu Wang 82a7f067a1 MLK-17442: ASoC: fsl: fix wrong usage of filter_data (part 1)
The filter_data should be used for dma_filter_fn function,
but we used the filter_data wrongly for dma channel name.
This patch is to fix the issue.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviwed-by: Daniel Baluta <daniel.baluta@nxp.com>
[ Aisheng: split out esai and pcm changes ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:53:49 +08:00
Shengjiu Wang c49d1d073a MLK-16929-1: ASoC: fsl_sai: add bitclk_freq
Allow set SAI bit clock frequency trough snd_soc_dai_set_sysclk
function call on machine sound drivers.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Adrian Alonso <adrian.alonso@nxp.com>
2019-11-25 15:53:49 +08:00
Viorel Suman 300eef7d06 MLK-13946-8: ASoC: fsl_sai: use min(channels,slots) for xMR setting
xMR setting must be set as min(channels,slots) since
both "channels < slots" and "channels > slots" scenarios
are possible.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:53:49 +08:00
Shengjiu Wang 0da2560aff MLK-13946-3: ASoC: fsl_sai: fix the xMR setting
When there is multi data line enabled, the xMR setting is
wrong if according to the channel number. which should
according to the slot number

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:53:48 +08:00
Shengjiu Wang 4b73b084ba MLK-16130-1: ASoC: fsl_sai: enable TCE/RCE according to input channels
If there is only two channels input and slots is 2, then enable one
port is enough for data transfer. so enable the TCE/RCE according to
the input channels and slots configuration.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:53:48 +08:00
Viorel Suman be7bf0faa8 MLK-13975: ASoC: fsl_sai: Refine master flag handling
The patch introduces the master flag handling
as function of direction and the option to provide
the flag value from DTS.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:53:47 +08:00
Shengjiu Wang c709ebd035 MLK-15960-2: ASoC: fsl_sai: refine the pm runtime function
In imx8qm/imx8qxp, the power domain of IP is enabled when
pm_runtime_get_sync() is called, and disabled when pm_runtime
_put_sync() is called. when power domain is disabled, the value
of registers will lost, so we need to use the regcache_sync()
to restore the registers in fsl_sai_runtime_resume.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:53:47 +08:00
Shengjiu Wang f4a5a72887 MLK-15960-1: ASoC: fsl_sai: update fifo_depth for different platform
The fifo_depth is changed to 64 in imx8qm/imx8qxp, in imx8mq, the
fifo_depth is 128. which is mentioned in their ADD.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:53:46 +08:00
Mihai Serban 90efe83b6e MLK-15927-1: ASoC: fsl_sai: Fix noise when using EDMA
EDMA requires the period size to be multiple of maxburst. Otherwise the
remaining bytes are not transferred and thus noise is produced.

We can handle this issue by adding a constraint on
SNDRV_PCM_HW_PARAM_PERIOD_SIZE to be multiple of tx/rx maxburst value.

This is based on a similar patch we have for ESAI:
commit bd3f3eb2a37c
("MLK-15109-2: ASoC: fsl_esai: add constrain_period_size")

Signed-off-by: Mihai Serban <mihai.serban@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:53:45 +08:00
Shengjiu Wang 62bd14531e MLK-15140-1: ASoC: fsl_sai: support latest sai module
The version of sai is upgrate in imx8mq, which add two register
in beginning, there is VERID and PARAM. the driver need to be
update

Signed-off-by: Mihai Serban <mihai.serban@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:53:45 +08:00
Mihai Serban f3f09671c6 MLK-14935: ASoC: fsl_sai: Fix mixing initialization data with actual audio samples
When starting a playback the initialization data used to reduce underruns
was send to the transmit data register after the DMA requests were enabled.
This patch moves the initialization phase before enabling the DMA so the
data is transmitted in correct order.

Signed-off-by: Mihai Serban <mihai.serban@nxp.com>
2019-11-25 15:53:44 +08:00
Daniel Baluta 35c3e9f7fe MLK-14870: ASoC: fsl_sai: Remove support for S20_3LE
With current clock configuration we cannot derive bitclk for S20_3LE
format in SAI master mode. There was an attempt to fix this in commit
65e6b5f1b4a7 ("MLK-14536: ASoC: wm8960: Fix playback in CPU DAI master mode")
but this broke codec-master mode, thus the patch was partially reverted in
96f0d36e420 ("MLK-14798: arm: dts: imx6ul: Fix wm8960 codec master mode")

So, remove S20_3LE support for SAI master mode. Clients using this
feature should use codec master mode, which is the default one in the
dts anyway.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:53:44 +08:00
Mihai Serban 3d1fa75a96 MLK-14847: Revert "ASoC: fsl-sai: set xCR4/xCR5/xMR for SAI master mode"
This reverts commit c768ed336bba ("ASoC: fsl-sai: set xCR4/xCR5/xMR for
SAI master mode")

This change was already introduced by commit 51659ca069 ("ASoC: fsl-sai:
set xCR4/xCR5/xMR for SAI master mode") from upstream.

Manually adjust the code to match the changes introduced by subsequent
commit b2936555bb38 ("MLK-13609: ASoC: fsl_sai: fix for synchronize mode")
by removing updates to FSL_SAI_TMR/FSL_SAI_RMR registers.

Signed-off-by: Mihai Serban <mihai.serban@nxp.com>
2019-11-25 15:53:42 +08:00
Viorel Suman 56507d35db ASoC: fsl: add imx-pcm-dma v2 platform driver (part 2)
which don't request the dma channel in the probe, but request
dma channel when needed. for the dma channel of cpu dai in BE
can be reused by the FE.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
[ Aisheng: split PCM changes ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:53:42 +08:00
Viorel Suman cbd9903c62 ASoC: fsl_sai: set specific fmt for I2S XTOR
Set specific fmt, for i2s xtor receiver is
in slave mode and i2s xtor transmitter is in master mode.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:53:42 +08:00
Viorel Suman cd3f08ca64 ASoC: fsl_sai: handle slave mode per TX/RX direction
The SAI interface can be a clock supplier or consummer
as function of stream direction, ie when interacting
with I2S XTOR. Removed FSL_SAI_RFR define as it is now
referred as FSL_SAI_RFR0.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:53:40 +08:00
Viorel Suman 606e962127 ASoC: fsl_(e)sai: introduce "shared-interrupt" DT flag (part 2)
SAI & ESAI interfaces may share the same interrupt with EDMA,
so that we need a flag to trigger proper shared interrupt
handling. For compatibility the same DT flag, "shared-interrupt",
is introduced as the one used in drivers/dma/fsl-edma-v3.c.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
[ Aisheng: split easi changes ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:53:39 +08:00
Shengjiu Wang e03d9fa698 MLK-13609: ASoC: fsl_sai: fix for synchronize mode
TX synchronous with receiver: the RMR should not be changed and
the RCSR.RE should be set in playback.
RX synchronous with transmitter: the TMR should not be changed and
the TCSR.TE should be set in recording.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:53:39 +08:00
Shengjiu Wang da84851398 MLK-13574-2: ASoC: fsl_sai: refine driver for ip upgrade
In imx7ulp1, the sai can support two TX channel and two RX
channels, So the usage need to be updated.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:53:39 +08:00
Shengjiu Wang 2bb7f96ef1 MLK-12786-2: ASoC: fsl_sai: correct the clock source for mclk0
mclk0 is assigned through the device tree.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:53:38 +08:00
Shengjiu Wang 6099503aa3 MLK-12374: ASoC: fsl_sai: Change the dev_warn to dev_dbg
When audio stop, it will first stop dma, then stop cpu_dai.
If there is delay between dma stop and cpu dai stop, there
will be underrun error, the print will cost time, then will
cause another underrun error, it is a infinite loop.
Which will cause the cpu dai can't stop.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:53:37 +08:00
Zidan Wang 583b9f7b09 ASoC: fsl-sai: set xCR4/xCR5/xMR for SAI master mode
For SAI master mode, when Tx(Rx) sync with Rx(Tx) clock, Rx(Tx) will
generate bclk and frame clock for Tx(Rx), we should set RCR4(TCR4),
RCR5(TCR5) and RMR(TMR) for playback(capture), or there will be sync
error sometimes.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit 51659ca069)
2019-11-25 15:53:37 +08:00
Zidan Wang bf40b0c9ad MLK-11628 ASoC: fsl_sai: add initial value for is_slave_mode
After playback audio with sai<->wm8960 sound card, is_slave_mode
will be set, but it will not be cleared. So playback audio with
sai<->sii902x sound card will have no voice.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
2019-11-25 15:53:36 +08:00
Zidan Wang 90248ae954 MLK-10611-1 ASoC: fsl-sai: Just one device can playback(captrue) when using the same SAI
Just one device can playback(captrue) when using the same SAI.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
(cherry picked from commit 7981a488c4da440db21f0544b519b44636a0cabb)
2019-11-25 15:53:35 +08:00
Shengjiu Wang 9401ad6c72 MLK-9974: ASoC: fsl_sai: There is underrun detected in the beginning sometimes
Write initial words to SAI FIFO to reduce underrun error

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit 7ba8ae883d84540fac5ed4147d124399537bc0b3)
(cherry picked from commit f4435f35aa2a97551d2c4a12ca316c354a880f85)
2019-11-25 15:53:35 +08:00
Dong Aisheng a7e3a722ed Revert "ASoC: fsl_sai: add of_match data"
This reverts commit 89c9679f69.
2019-11-25 15:53:34 +08:00
Dong Aisheng 252b2a0d9e Revert "ASoC: fsl_sai: derive TX FIFO watermark from FIFO depth"
This reverts commit bd517707d8.
2019-11-25 15:53:34 +08:00
Dong Aisheng 0df4d8e7c7 Revert "ASoC: fsl_sai: mark regmap as fast_io"
This reverts commit 6d19d8a3ce.
2019-11-25 15:53:33 +08:00
Dong Aisheng f337340c23 Revert "ASoC: Remove dev_err() usage after platform_get_irq()"
This reverts commit cf9441adb1.
2019-11-25 15:53:33 +08:00
Dong Aisheng ab150b3f7c Revert "ASoC: fsl_sai: Add registers definition for multiple datalines"
This reverts commit 5f0ac20ed6.
2019-11-25 15:53:32 +08:00
Dong Aisheng d992f25c8a Revert "ASoC: fsl_sai: Update Tx/Rx channel enable mask"
This reverts commit b84f50b0fc.
2019-11-25 15:53:32 +08:00
Dong Aisheng 0f43cd8a07 Revert "ASoC: fsl_sai: Add support for SAI new version"
This reverts commit 4f7a0728b5.
2019-11-25 15:53:31 +08:00
Dong Aisheng 119c5ea09b Revert "ASoC: fsl_sai: Add support for imx7ulp/imx8mq"
This reverts commit a860fac420.
2019-11-25 15:53:31 +08:00
Leonard Crestez 0476bb82fb Revert "ASoC: fsl_sai: Add support for imx8qm"
This reverts commit 6eeb60be5e.
2019-11-25 15:53:31 +08:00
Leonard Crestez b47e849752 Revert "ASoC: fsl_sai: Implement set_bclk_ratio"
This reverts commit 63d1a3488f.
2019-11-25 15:53:30 +08:00
Leonard Crestez 1ea30a6341 Revert "ASoC: fsl_sai: Fix noise when using EDMA"
This reverts commit e75f4940e8.
2019-11-25 15:53:29 +08:00
Shengjiu Wang 50b229c2d5 ASoC: imx-pcm-rpmsg: Remove the prtd
prtd is not needed by this driver.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:53:25 +08:00
Leonard Crestez 6eb375e54d ASoC: imx-pcm-rpmsg: Fix writecombine/wc build error
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-11-25 15:53:23 +08:00
Shengjiu Wang 26e4c3d80f ASoC: fsl_rpmsg: Merge changes from imx_4.19.y
77be7d36a525 ("MLK-22400-1: ASoC: fsl_rpmsg_i2s: Add rpmsg i2s for imx8mn")
31d5dfa44c20 ("MLK-22340-5: ASoC: imx-pcm-rpmsg: enable ignore_suspend for LPA")
c5c41138d5c8 ("MLK-22340-4: ASoC: fsl_rpmsg_i2s: add lock to protect the resource")
adb4b596d2ba ("MLK-22340-3: ASoC: imx-pcm-rpmsg: refine the timer")
a5e80bf012c3 ("MLK-22340-2: ASoC: imx-pcm-rpmsg: drop the cmd I2S_TX_POINTER")
404367d9316b ("MLK-21980: ASoC: imx-pcm-rpmsg: add debugfs_prefix for platform")
971faf095246 ("MLK-21450: ASoC: fsl_rpmsg: fix timer issue for updating to 4.19")
edbbcdc07bf1 ("MLK-21461: ASoC: fsl_rpmsg_i2s: clear buffer pointer in i2s_send_message")
f5f2f38018d8 ("MLK-21447: ASoC: fsl_rpmsg_i2s: underrun in m4 for msg delayed")
d9410ace757f ("MLK-21307: ASoC: fsl_rpmsg_i2s: optimize the message sent to m4")
98633a4cd35b ("MLK-21440-1: ASoC: fsl_rpmsg_i2s: init spin lock")
7bf6d3131863 ("MLK-21107-1: ASoC: Fix timer wake up system after suspend")
eb422681ffa4 ("MLK-20661: ASoC: imx-pcm-rpmsg: remove the nonblock constraint")
e36957e97ca9 ("MLK-21002-1: ASoC: imx-pcm-rpmsg: fix data consumed faster with pause")
bc828e61693f ("MLK-19565-1: ASoC: fsl_rpmsg_i2s: support rpmsg on imx8qm")
e56bedf71ae4 ("MLK-21107-2: ASoC: Drop msg if msg queue is full")

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 31def064871336af7780d01a6ed8c5ed075b7e48)
2019-11-25 15:53:20 +08:00
Shengjiu Wang b3b38fea22 MLK-21440-1: ASoC: fsl_rpmsg_i2s: init spin lock
With CONFIG_LOCKDEP=y, there will kernel dump

[   55.305563] INFO: trying to register non-static key.
[   55.310540] the code is fine but needs lockdep annotation.
[   55.316027] turning off the locking correctness validator.
[   55.321520] CPU: 0 PID: 32 Comm: kworker/0:1 Tainted: G        W       4.14.78-00007-g524e1b1f0b3f #18
[   55.330827] Hardware name: FSL i.MX8MM EVK board (DT)
[   55.335892] Workqueue: events rpmsg_work_handler
[   55.340515] Call trace:
[   55.342971] [<ffff00000808c438>] dump_backtrace+0x0/0x270
[   55.348375] [<ffff00000808c6cc>] show_stack+0x24/0x30
[   55.353433] [<ffff000009078f38>] dump_stack+0xb8/0xf0
[   55.358490] [<ffff000008150404>] register_lock_class+0x364/0x548
[   55.364501] [<ffff000008153544>] __lock_acquire+0x7c/0x18a8
[   55.370077] [<ffff0000081555e8>] lock_acquire+0xc8/0x290
[   55.375394] [<ffff00000909422c>] _raw_spin_lock_irqsave+0x54/0x70
[   55.381493] [<ffff000008d80888>] i2s_rpmsg_cb+0xe8/0x1b0
[   55.386810] [<ffff000008d01dc4>] rpmsg_recv_done+0x144/0x210
[   55.392476] [<ffff000008713f44>] vring_interrupt+0x44/0x78
[   55.397966] [<ffff000008d025d4>] imx_mu_rpmsg_callback+0x6c/0x80
[   55.403977] [<ffff000008111f44>] notifier_call_chain+0x5c/0x98
[   55.409813] [<ffff0000081124f8>] __blocking_notifier_call_chain+0x58/0xa0
[   55.416605] [<ffff00000811257c>] blocking_notifier_call_chain+0x3c/0x50
[   55.423223] [<ffff000008d029a0>] rpmsg_work_handler+0x88/0xe8
[   55.428974] [<ffff000008108380>] process_one_work+0x290/0x738
[   55.434723] [<ffff000008108880>] worker_thread+0x58/0x460
[   55.440127] [<ffff000008110084>] kthread+0x104/0x130
[   55.445096] [<ffff000008085a4c>] ret_from_fork+0x10/0x1c

The reason is that the spin lock is not initilized.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 0e98ac55f17f6505f92c515c3c04581039e21865)
(cherry picked from commit 314ef30b1bc75971c3e59f5ab9919586495ca556)
2019-11-25 15:53:20 +08:00
Shengjiu Wang 49822e0e11 MLK-21440-2: ASoC: imx-rpmsg: Remove snd_soc_find_dai
Previously we add snd_soc_find_dai to check if the codec is probed or
not, but this bring kernel dump issue when CONFIG_LOCKDEP=y.

[    2.823379] WARNING: CPU: 2 PID: 1 at sound/soc/soc-core.c:1016 snd_soc_find_dai+0x144/0x150
[    2.831827] Modules linked in:
[    2.834907] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 4.14.78-00007-g524e1b1f0b3f #18
[    2.842748] Hardware name: FSL i.MX8MM EVK board (DT)
[    2.847811] task: ffff8000624f0000 task.stack: ffff000008078000
[    2.853745] PC is at snd_soc_find_dai+0x144/0x150
[    2.858462] LR is at snd_soc_find_dai+0x140/0x150

...

[    3.469675] Call trace:
[    3.472135] Exception stack(0xffff00000807ba40 to 0xffff00000807bb80)
[    3.478590] ba40: 0000000000000000 00000000ffffffff 0000000000000000 0000000000000002
[    3.4864333.596564] [<ffff00000883f2a8>] bus_add_driver+0x110/0x230
[    3.602149] [<ffff0000088412e8>] driver_register+0x68/0x100
[    3.607735] [<ffff0000088426dc>] __platform_driver_register+0x54/0x60
[    3.614191] [<ffff0000097e4cc8>] imx_rpmsg_driver_init+0x20/0x28
[    3.620213] [<ffff0000080844c4>] do_one_initcall+0x44/0x130
[    3.625801] [<ffff000009760ef8>] kernel_init_freeable+0x1e0/0x280
[    3.631909] [<ffff00000908c3f8>] kernel_init+0x18/0x110
[    3.637148] [<ffff000008085a4c>] ret_from_fork+0x10/0x1c

So we could't resolve the warning "snd_soc_register_card failed (-517)".

Fixes: 75632b22a332 ("MLK-20247: ASoC: imx-rpmsg: fix error when
m4 image is not loaded")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>

(cherry picked from commit bbc1868d1c3ec448301d76606e7199f74aa35581)
(cherry picked from commit ebf3fc59b84503a8da40a8e54a92e6de60e01dce)
2019-11-25 15:53:16 +08:00
Dong Aisheng 75b0218811 ASoC: fsl: fix SND_SOC_FSL_RPMSG_I2S dependency issue
IMX RPMSG is still not ready.

In file included from ../sound/soc/codecs/rpmsg_wm8960.c:27:0:
../sound/soc/codecs/../fsl/fsl_rpmsg_i2s.h:278:29: fatal error: linux/imx_rpmsg.h: No such file or directory
 #include <linux/imx_rpmsg.h>
                             ^
compilation terminated.
../scripts/Makefile.build:278: recipe for target 'sound/soc/codecs/rpmsg_wm8960.o' failed
make[4]: *** [sound/soc/codecs/rpmsg_wm8960.o] Error 1
make[4]: *** Waiting for unfinished jobs....
  AR      arch/arm/mach-imx/built-in.a
In file included from ../sound/soc/codecs/rpmsg_cs42xx8.c:25:0:
../sound/soc/codecs/../fsl/fsl_rpmsg_i2s.h:278:29: fatal error: linux/imx_rpmsg.h: No such file or directory
 #include <linux/imx_rpmsg.h>

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:53:15 +08:00
Shengjiu Wang 0f97f661f2 MLK-19168-5: ASoC: imx-cs42888: support codec through rpmsg (part 2)
support codec through rpmsg

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 8585d67e54c4c3607990a792718992de8be8fe58)
[ Aisheng: split card imx-cs42888 changes ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:53:15 +08:00
Shengjiu Wang a6f50f7227 MLK-20661: ASoC: imx-pcm-rpmsg: remove the nonblock constraint
we can call the snd_pcm_period_elapsed in timer's callback
to achieve pseudo period wake up, so the nonblock constraint
can be removed

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:53:14 +08:00
Shengjiu Wang 270158aedd MLK-20434: ASoC: fsl_rpmsg_i2s: add more rates in constraint list
add more rates in constraint list, Fixes commit ee959e2c9b18
("MLK-19581-3: ASoC: fsl_rpmsg_i2s: support multipul rate and DSD format")

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:53:14 +08:00
Shengjiu Wang f59723a50d MLK-20357-1: ASoC: imx-rpmsg: add audio routing for wm8960
The rpmsg wm8960 codec driver is completed to support
full function, not only the volume control. which cause
an issue that there is no sound when recording, the reason
is that the MIC Bias not enabled, and it should be enabled
through audio routing.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:53:13 +08:00
Shengjiu Wang ce1d0f858c MLK-20247: ASoC: imx-rpmsg: fix error when m4 image is not loaded
The reason is same as commit d4eb8ab26399 ("MLK-19854-1: ASoC:
imx-cs42888: fix error when m4 image is not loaded")

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:53:13 +08:00
Shengjiu Wang cabb2debdc MLK-20277-3: ASoC: imx-pcm-rpmsg: change the state of substream in resume
In LPA mode, the system will be resumed by audio notification, when the
period size is small, there will be occasion that when notification
the underrun is happen, but the substream runtime state is not running
so the aplay won't trigger stop first, then start. just only trigger
the start, which don't comply with the convention.
So in this patch, we change the substream runtime state to running, when
the notification happened at resume.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:53:12 +08:00
Shengjiu Wang aa4833ef35 MLK-20277-1: ASoC: imx-pcm-rpmsg: reset the period index at stop
With the case that underrun happened, the aplay will trigger
stop and start, if the period index is not reset at stop, the
counter of period will be wrong

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:53:10 +08:00
Shengjiu Wang 4fd0f03d0b 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)
2019-11-25 15:53:10 +08:00
Shengjiu Wang 6ef9128b30 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)
2019-11-25 15:53:09 +08:00
Shengjiu Wang ace16c55c8 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)
2019-11-25 15:53:09 +08:00
Shengjiu Wang 1744cad4ec 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)
2019-11-25 15:53:08 +08:00
Shengjiu Wang 713549b367 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)
2019-11-25 15:53:07 +08:00
Shengjiu Wang 6414b94c42 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)
2019-11-25 15:53:06 +08:00
Shengjiu Wang 08cf70aa23 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)
2019-11-25 15:53:05 +08:00
Shengjiu Wang 997f8ece23 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)
2019-11-25 15:53:05 +08:00
Shengjiu Wang 6b270ced20 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)
2019-11-25 15:53:03 +08:00
Shengjiu Wang 610f643cd3 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)
2019-11-25 15:53:03 +08:00
Shengjiu Wang 95f35f84fe 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)
2019-11-25 15:53:02 +08:00
Shengjiu Wang c17407c2dd 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)
2019-11-25 15:53:01 +08:00
Shengjiu Wang 093cb51e6f 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)
2019-11-25 15:53:00 +08:00
Shengjiu Wang b9156dc3c1 MLK-17156-7: ASoC: imx-rpmsg: use rpmsg codec instead the dummy
use the rpmsg_wm8960 codec instead of the dummy codec

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:53:00 +08:00
Shengjiu Wang 35c675bc63 MLK-17156-6: ASoC: imx-pcm-rpmsg: fix get codec data failed
Receive message is only used when the type is B. originally
we copy the receive message to revg_msg all the time, when
the message type is C, which will overide the revg_msg, which
cause the get codec data command return wrong value.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:52:59 +08:00
Shengjiu Wang f823c83ef9 MLK-17156-5: ASoC: imx-pcm-rpmsg: register rpmsg codec
register rpmsg codec after the rpmsg-audio-channel is
ready.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:52:58 +08:00
Shengjiu Wang c98b293c40 MLK-17156-3: ASoC: fs_rpmsg_i2s: update the protocol for i2c message
rpmsg provide command for A7 side to set the codec value and get
codec value by i2c. In this case, the A7 can control the codec.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:52:57 +08:00
Viorel Suman 53039092de MLK-17220: ASoC: fsl_rpmsg_i2s: restore original lock context
Restore original lock context and unlock the mutex in case if
info->rpdev is uninitialized.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:52:56 +08:00
Viorel Suman ccb2d1a994 MLK-17220: ASoC: fsl_rpmsg_i2s: unlock mutex on error
Mutex must be unlocked when i2s_send_message method
fails.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:52:55 +08:00
Shengjiu Wang 214ddc0e96 MLK-14989: ASoC: fsl_rpmsg_i2s: enable pm_qos for audio
with "echo 1 > /sys/class/graphics/fb0/blank", and there is no
usb connected on board, the system may enter low power mode,
then audio playback will be failed. use pm_qos to prevent A7
core enter low power mode during audio playback and recording.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:52:55 +08:00
Daniel Baluta 7fadff23ce MLK-14528: ASoC: sdma: Update period/segment max bytes (part 2)
Commit 665ced16cf044 ("MLK-10050 dma: imx-sdma: add support for sdma
memory copy") enforces maximum SDMA buffer descriptor length at 65532,
but doesn't update period_bytes_max or max_segment size in DMA drivers.

Thus, resulting in the following bug:

$ arecord -Dhw:0,0 -r 192000 -f S20_3LE -c 1 -d 10 audio192k20b1c.wav
imx-sdma: SDMA channel 5: maximum period size exceeded: 65534 > 65532

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
[ Aisheng: split asrc change ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:52:54 +08:00
Shengjiu Wang 14e0dcede5 MLK-14582: ASoC: imx-pcm-rpmsg: fix audio noise issue with pulseaudio
The pulse audio will set a wrong buffer size which is not the integral
multiple of period size, it will cause the DMA can't work correctly in
M4 side.
The reason is that we always need to add a constraint for
SNDRV_PCM_HW_PARAM_PERIODS, which make it integer.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit 54a10a6c2130a69aca4c1923dac3a15137911146)
2019-11-25 15:52:54 +08:00
Shengjiu Wang ce2f05d271 MLK-14372: ASoC: fsl_rpmsg_i2s: remove unsupported sample rate
RTOS for M4 core in imx7ulp don't support 32kHz and 44kHz

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:52:53 +08:00
Shengjiu Wang 5d8c7ea7ce MLK-14258: ASoC: imx-pcm-rpmsg: sync sample rate with tx and rx
In suspend and resume, the M4 side will reset hw parameter for tx
and rx, when only tx is working, the parameter of rx is a old value,
which will cause the parameter is not sync with tx and rx.
currently the M4 audio can only work in sync mode, so set both
parameter in same time.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:52:53 +08:00
Shengjiu Wang c040763b30 MLK-14254: ASoC: imx_pcm_rpmsg: fix cmd dropped by work queue
The test case is to playback a bitstream, then repeat ctrl+z and fg,
several times later, the playback is failed to continue.

The reason is if the work is pending in work queue, send second time
of this work, the second work is dropped by work queue. so use one
work for one cmd is not fit for audio case. use a work loop for audio
cmd to fix this issue.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:52:52 +08:00
Shengjiu Wang 45aa9064e2 MLK-14007: ASoC: fsl_rpmsg_i2s: remove mono for M4 don't support it
Currently the M4 audio driver don't support mono channel, so remove it.
After mono channel is supported in M4 os, this commit should be reverted.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:52:51 +08:00
Shengjiu Wang c5ffd857b5 MLK-13992: ASoC: fsl_rpmsg_i2s: add flush workqueue
some cmd is sent by workqueue, others are sent by call send message
function directly, for workqueue may have delay, so there is occasion
that cmd is not sent in order.
Add flush_workqueue before the CLOSE and SUSPEND to make sure previous
cmd is finished in that time.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:52:50 +08:00
Shengjiu Wang aa0cc6695a MLK-13991: ASoC: fsl_rpmsg_i2s: remove unsupported rate
The M4 audio driver only support 8k/16k/32k/44k/48kHz sample rate.
so remove other rate in supported list.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:52:50 +08:00
Shengjiu Wang 92dd31be5b MLK-13980: ASoC: fsl_rpmsg_i2s: fix wrong cmd sent to M4 in suspend
This typo issue will cause that wrong cmd send to M4 side.

Fixes: 3e13a631aee0 ("MLK-13904-1: ASoC: fsl: add audio cpu dai driver base on rpmsg")

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:52:50 +08:00
Shengjiu Wang 6e155db640 MLK-13904-3: ASoC: fsl: add audio machine driver base on rpmsg
Add machine driver, which is using the dummy codec.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Acked-by: Robin Gong <yibin.gong@nxp.com>
[ Aisheng: clean for a new base ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:52:49 +08:00
Shengjiu Wang 118fc234d5 MLK-13904-2: ASoC: fsl: add audio platform driver base on rpmsg
Add platform driver, each step like set hw param, trigger start
trigger stop, and so on, will call the rpmsg api.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Acked-by: Robin Gong <yibin.gong@nxp.com>
[Aisheng: clean for a new base ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:52:48 +08:00
Shengjiu Wang a019e7b415 MLK-13904-1: ASoC: fsl: add audio cpu dai driver base on rpmsg (part 1)
Add the cpu dai driver, as the rpmsg_send api can't be used in
atomic context, so using the workqueue instead of calling
rpmsg_send() directly.
The detail communication stack is defined in header file.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Acked-by: Robin Gong <yibin.gong@nxp.com>
[ Aisheng: split out imx-pcm.h changes ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:52:48 +08:00
Shengjiu Wang e12b0060cd MLK-22598: ASoC: fsl_micfil: Reset channel output data Flag
With the case below, there is issue that after recording with
8 channels, the recording of 1 channel will fail.

arecord -Dhw:2,0 -r 32000 -f S16_LE -c 8 -d 5 -t raw /tmp/test1.pcm
arecord -Dhw:2,0 -r 32000 -f S16_LE -c 1 -d 5 -t raw /tmp/test2.pcm
arecord: pcm_read:2143: read error: Input/output error

The reason is that we need to reset channel output data Flag before
we start the recording

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 45ea3acd0c0c67a7b33faee9818401c6fbcc8c96)
2019-11-25 15:52:44 +08:00
Shengjiu Wang 7ac5c8b94a ASoC: fsl_micfil: Merge the changes from imx_4.19.y
Merge the changes from imx_4.19.y

The top commit is:
b5472e3f3dd1 ("MLK-21775-4: ASoC: fsl_micfil: synchronize HWVAD enable/disable")

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:52:43 +08:00
Shengjiu Wang 1e852d94e0 ASoC: imx-hdmi: Fix compile error
API change due to:
adb76b5b9c ("ASoC: soc-core: remove legacy style dai_link")

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:52:40 +08:00
Shengjiu Wang e9623c8a83 ASoC: imx-hdmi-dma: Fix issue with dma_alloc_coherent
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:52:40 +08:00
Vipul Kumar 0ee873881b ASoC: imx-hdmi-dma: replace platform to component
As per commit 4cb1ea925e ("ASoC: fsl: dma: replace platform to
component"), replace platform to component.

Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:52:39 +08:00
Shengjiu Wang 716fc277a2 ASoC: imx-cdnhdmi: Fix compile error
API change due to:
adb76b5b9c ("ASoC: soc-core: remove legacy style dai_link")

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:52:39 +08:00
Shengjiu Wang 10fa83ab64 MLK-20183-2: ASoC: imx-cdnhdmi: reconfigure the mclk for HDMI on imx8mq
In order to support 44kHz and 48kHz sample rate together, we need to
reconfigure the parent clock of mclk.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:52:38 +08:00
Shengjiu Wang 139e0453a0 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>
2019-11-25 15:52:37 +08:00
Shengjiu Wang 31e6c7140d MLK-18105: ASoC: imx-hdmi: fix no sound card issue
The codec dai name is changed in 4.14,so the machine driver need to
be updated

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:52:37 +08:00
Shengjiu Wang 6a7c25fc00 MLK-18833: ASoC: imx-cdnhdmi: fix no sound card issue
The codec dai name is changed in 4.14,so the machine driver need to
be updated

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:52:36 +08:00
Shengjiu Wang 67b21f3a87 MLK-18368-2: ASoC: fsl: support hdmi rx in machine driver
support hdmi rx in machine driver

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:52:35 +08:00
Shengjiu Wang 1e3b64e110 MLK-17794: ASoC: fsl: Add SND_SOC_IMX_CDNHDMI back
The FB_MX8_HDMI is removed, the dependency is changed
to DRM_IMX_HDP.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Sandor Yu <sandor.yu@nxp.com>
2019-11-25 15:52:35 +08:00
Shengjiu Wang 3c4981dfe0 MLK-17620-2: ASoC: imx-cdnhdmi: switch to generic hdmi codec
switch to generic hdmi codec, which provide the api for get
the edid information.
Add snd controls which is the interface for user to query
the HDMI capibility. ( channels, rates, formats)

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25 15:52:33 +08:00
Shengjiu Wang 7ffc2895ef MLK-17344-1: ASoC: imx-cdnhdmi: get constraint rate from dts
Constraint rate depends on the clock rata of cpu dai, which is
defined in dts, so we add constraint-rate property in dts, then
driver can get it.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:52:33 +08:00
Shengjiu Wang d16ae6be35 MLK-13946-4: ASoC: imx-cdnhdmi: refine machine driver for api changes
Since commit 3f5780eb4520 ("MLK-16538-2: hdmi api: Relocate hdmi api
soure code") change the api. And hdmi video driver provide a new api
for hdmi audio. Machine driver need to be updated accrodingly

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:52:32 +08:00
Sandor Yu e2c81bccd1 MLK-16538-2: hdmi api: Relocate hdmi api soure code
-Relocate hdmi api source code from drivers/video/fbdev/mxc/cdn_hdp
to drivers/mxc/hdp.
-Add displayport and hdcp api function.
-Move t28hpc_hdmitx function from api source code folder
to hdmi fb driver folder.
-Update imx8 hdmi fb driver according api source code change.
-Sync api source code with CDN_API_1_0_33 release.

Acked-by: Robby Cai <robby.cai@nxp.com>
Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
2019-11-25 15:52:32 +08:00
Shengjiu Wang 64bc534268 MLK-16159: ASoC: imx_cdnhdmi: refine the N value selection
According the HDMI spec, the N value depends on the TMDS
rate, and sample rate. As we set the vic mode in dts file,
use the vic_table to get the TMDS rate, then choose the
proper N value.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Reviewed-by: Sandor Yu <sandor.yu@nxp.com>
2019-11-25 15:52:31 +08:00
Shengjiu Wang 2e02a9402d MLK-16130-2: ASoC: fsl: add machine driver for cadence hdmi
The machine driver will call the API which is provided by
the cadence to configure the audio features.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
[ Aisheng: clean for a new base ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:52:30 +08:00
Mihai Serban 323210035c MLK-13799: ASoC: fsl: Add ASoC generic hdmi audio codec support
Use the new ASoC hdmi-codec infrastructure.

Signed-off-by: Mihai Serban <mihai.serban@nxp.com>
2019-11-25 15:52:30 +08:00
Shengjiu Wang 5dc1865131 MLK-13224: ASoC: imx-hdmi-dma: fix glitch noise issue in long time playback
The calculation "runtime->status->hw_ptr * (runtime->frame_bits / 8)" may
exceed the integer scope, then appl_bytes is no correct.
This patch is to fix this issue.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25 15:52:29 +08:00
Shengjiu Wang f1b5df313e MLK-9731 ASoC: imx-hdmi-dma: audio output is noisy in long time playback
In the frame_to_bytes(), when hw_ptr*frame_bits exceed the maxmum of unsigned
long, the return value is saturated, so the appl_bytes is wrong.
This patch is to correct the usage of frame_to_bytes().

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit 9e66132d9c96305b65aa5fa3ba8a35271a04ded9)
2019-11-25 15:52:29 +08:00
Shengjiu Wang ef0a172403 MLK-11530-01 ASoC: fsl_hdmi: port hdmi audio driver
cherry-pick below patch from v3.14.y:
ENGR00330403-2: ASoC: fsl_hdmi: port hdmi audio driver from imx_3.10.y

Port HDMI audio driver (CPU driver, machine driver, platform driver) from
imx_3.10.y.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>

During 4.14 rebase converted from snd_pcm_ops.copy to copy_user because
copy was removed by upstream

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
[ Aisheng: fix conflicts for a clean base and merge MLK-12244
file onwership change ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:52:28 +08:00
Shengjiu Wang 2bbe95fe6c ASoC: fsl_esai: Remove the tasklet
Remove tasklet for it may cause the xrun interrupt not be
handled immediately, that will be endless interrupt.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:52:26 +08:00
Shengjiu Wang ff66736b87 ASoC: fsl_esai: Add spin lock to protect reset, stop and start
xrun may happen at the end of stream, the
trigger->fsl_esai_trigger_stop maybe called in the middle of
fsl_esai_hw_reset, this may cause esai in wrong state
after stop, and there may be endless xrun interrupt.

This issue may also happen with trigger->fsl_esai_trigger_start.

So Add spin lock to lock those functions.

Fixes: 7ccafa2b38 ("ASoC: fsl_esai: recover the channel swap after xrun")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Link: https://lore.kernel.org/r/52e92c4221a83e39a84a6cd92fc3d5479b44894c.1572252321.git.shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-25 15:52:26 +08:00
Shengjiu Wang 53115815b4 ASoC: fsl_esai: Remove expensive print in irq handler
When stopping audio, ASoC will first stop DMA then CPU DAI.
Sometimes there is a delay between DMA stop and CPU DAI stop, which
triggers an underrun error. Now, because of the delay introduced
by dev_err another underrun error will occur causing a vicious circle
making impossible to stop CPU DAI.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:52:25 +08:00
Shengjiu Wang 4058ef0bb8 ASoC: fsl_esai: support multi power domain
support multi power domain

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:52:25 +08:00
Shengjiu Wang 63458262c8 MLK-19750-1: ASoC: fsl_esai: enhance async mode (part 1)
With this patch, esai driver can support tx and rx in
different master/slave mode.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
[ Aisheng: split codec cs42xx8 changes ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:52:24 +08:00
Viorel Suman f3b448d4e4 ASoC: fsl_(e)sai: introduce "shared-interrupt" DT flag (part 1)
SAI & ESAI interfaces may share the same interrupt with EDMA,
so that we need a flag to trigger proper shared interrupt
handling. For compatibility the same DT flag, "shared-interrupt",
is introduced as the one used in drivers/dma/fsl-edma-v3.c.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
[ Aisheng: split SAI changes ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:52:23 +08:00
Zhang Peng 21f3df8506 MLK-22815-1: ASoC: fsl: dsp: Expand parameter msg size
Modified parameter msg in dsp, make sure still can transfer right msg
between DSP and user, modified parameter msg in kernel.

Signed-off-by: Zhang Peng <peng_zhang_8@nxp.com>
2019-11-25 15:52:21 +08:00
Daniel Baluta 6bfa0c442b MLK-21144 ASoC: fsl: Fix crash with multiple open/close
Because we are re-initializing the proxy at close it might
happen that work is still pending which causes the following crash:

[   94.699835] Unable to handle kernel NULL pointer dereference at virtual address 00000008
[   94.707923] Mem abort info:
[   94.710722]   Exception class = DABT (current EL), IL = 32 bits
[   94.716637]   SET = 0, FnV = 0
[   94.719686]   EA = 0, S1PTW = 0
[   94.722822] Data abort info:
[   94.725698]   ISV = 0, ISS = 0x00000005
[   94.729530]   CM = 0, WnR = 0
[   94.732504] user pgtable: 4k pages, 48-bit VAs, pgd = ffff8008d9ba3000
[   94.739035] [0000000000000008] *pgd=0000000938419003, *pud=0000000000000000
[   94.746015] Internal error: Oops: 96000005 [#1] PREEMPT SMP
[   94.751589] Modules linked in:
[   94.754652] CPU: 0 PID: 2068 Comm: kworker/0:2 Not tainted 4.14.98-dirty #75
[   94.761700] Hardware name: Freescale i.MX8QM MEK (DT)
[   94.766768] task: ffff8008f23ae200 task.stack: ffff000014378000
[   94.772705] PC is at process_one_work+0x34/0x414
[   94.777325] LR is at process_one_work+0x1e0/0x414

In order to fix this, we make sure that no work is pending before starting
the re-initialization.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 2c00c24be5f8b63636e3f9005e15a3de42058438)
2019-11-25 15:52:20 +08:00
Daniel Baluta 940d9baeca ASoC: fsl_dsp: Use new compatible string for FSL DSP
In order to support in parallel FSL DSP and SOF Linux drivers
we will need to use different compatible strings for DSP nodes.

Use fsl,imx8qxp-dsp-v1 for FSL DSP driver. Note that our goal is
to only support SOF Linux driver, so FSL DSP driver will be deprecated.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:52:20 +08:00
Dong Aisheng 129c45f837 ASoC: fsl: dsp: remove unused types.h
types.h has been moved into rsrc.h

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:52:19 +08:00
Dong Aisheng 3a3aba569a MLK-21985-6 ASoC: imx-dsp: fix build for next 20190607 upgrade
API change due to:
adb76b5b9c ("ASoC: soc-core: remove legacy style dai_link")

../sound/soc/fsl/imx-dsp.c: In function ‘imx_dsp_audio_probe’:
../sound/soc/fsl/imx-dsp.c:123:14: error: ‘struct snd_soc_dai_link’ has no member named ‘codec_dai_name’
  data->dai[0].codec_dai_name = "snd-soc-dummy-dai";
              ^
../sound/soc/fsl/imx-dsp.c:124:14: error: ‘struct snd_soc_dai_link’ has no member named ‘codec_name’
  data->dai[0].codec_name = "snd-soc-dummy";
              ^
../sound/soc/fsl/imx-dsp.c:125:14: error: ‘struct snd_soc_dai_link’ has no member named ‘cpu_dai_name’
  data->dai[0].cpu_dai_name = dev_name(&cpu_pdev->dev);
              ^
../sound/soc/fsl/imx-dsp.c:126:14: error: ‘struct snd_soc_dai_link’ has no member named ‘cpu_of_node’
  data->dai[0].cpu_of_node = cpu_np;
              ^
../sound/soc/fsl/imx-dsp.c:127:14: error: ‘struct snd_soc_dai_link’ has no member named ‘platform_of_node’
  data->dai[0].platform_of_node = platform_np;
              ^
../sound/soc/fsl/imx-dsp.c:140:14: error: ‘struct snd_soc_dai_link’ has no member named ‘codec_dai_name’
  data->dai[1].codec_dai_name = "cs42888";
              ^
../sound/soc/fsl/imx-dsp.c:141:14: error: ‘struct snd_soc_dai_link’ has no member named ‘codec_of_node’
  data->dai[1].codec_of_node = codec_np;
              ^
../sound/soc/fsl/imx-dsp.c:142:14: error: ‘struct snd_soc_dai_link’ has no member named ‘cpu_dai_name’
  data->dai[1].cpu_dai_name = "snd-soc-dummy-dai";
              ^
../sound/soc/fsl/imx-dsp.c:143:14: error: ‘struct snd_soc_dai_link’ has no member named ‘cpu_name’
  data->dai[1].cpu_name = "snd-soc-dummy";
              ^
../sound/soc/fsl/imx-dsp.c:144:14: error: ‘struct snd_soc_dai_link’ has no member named ‘platform_name’
  data->dai[1].platform_name = "snd-soc-dummy";

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:52:19 +08:00
Shengjiu Wang 4de686476a MLK-20793: ASoC: fsl_dsp: remove error message
With non fsl-imx8qxp-mek-dsp.dts, the clock is not assigned
to dsp node, which cause error message when kernel boot up.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:52:18 +08:00
Shengjiu Wang 87850fce95 ASoC: fsl_dsp: support multi power domain
support multi power domain

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:52:17 +08:00
Shengjiu Wang badc4f7be2 MLK-20693-3: ASoC: fsl_dsp: Add clocks for peripheral devices
Add clocks for peripheral devices

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:52:17 +08:00
Shengjiu Wang 248f112adb MLK-20693-2: ASoC: fsl_dsp_cpu: remove the clock operation
Remove the clock operation in cpu dai, all clock will be
moved to platform driver.
The reason is that the suspend and resume of dsp is handled in
platform driver, if the clock is disabled before the suspend,
the dsp framework can't access the registers of device in suspend.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:52:16 +08:00
Shengjiu Wang e8d93a7218 MLK-20693-1: ASoC: fsl_dsp: remove this workaround of skip sections
Revert "MLK-18497-13: ASoC: fsl: dsp: Skip SDRAM section update if
fw is already loaded"

This reverts commit a0cffd9a9299362f2b3a4d24b78a8574b736fdfa.

This is just to avoid reconfigure the edma isr handler in dsp
framework, which should be handled by dsp framework.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:52:15 +08:00
Daniel Baluta 4ef3575026 MLK-20095-4: ASoC: fsl: Use hardwired system address offset source select for QM
We set system address offset select to 0 on QM because of the following reasons:
	* SC_C_OFS_PERIPH, it is not available for QM
	* SC_C_OFS_AUDIO, it is not used
	* SC_C_OFS_IRQ, needs to get outside of the VPU.

A simplified version of the code is:

if (dsp_priv->dsp_board_type == DSP_IMX8QXP_TYPE) {
	sc_misc_set_control(ipcHndl, SC_R_DSP, SC_C_OFS_SEL, 1);
	sc_misc_set_control(ipcHndl, SC_R_DSP, SC_C_OFS_PERIPH, 0x5A);
	sc_misc_set_control(ipcHndl, SC_R_DSP, SC_C_OFS_IRQ, 0x51);
	sc_misc_set_control(ipcHndl, SC_R_DSP, SC_C_OFS_AUDIO, 0x80);
	}
} else {
	sc_misc_set_control(ipcHndl, SC_R_DSP, SC_C_OFS_SEL, 0);
}

Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:52:15 +08:00
Daniel Baluta b35ac86e87 MLK-20095-3: ASoC: fsl: Differentiate between QXP and QM
On QM the DSP is inside the VPU subsystem while in QXP
it is inside the Audio DMA subsystem. For this reason
there are "subtle" differences.

Introduce new compatible string for QM to help us correctly
configure the DSP depending on the board they run.

dsp_mem_msg structure is shared with the DSP, so by introducing
new member dsp_board_type we can let DSP know on which target it runs.

Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:52:15 +08:00
Daniel Baluta b9668d7af2 MLK-20095-3: ASoC: fsl: dsp: Add ASRC clocks
We enable the ASRC clocks from CPU side. We only need
the following clocks: "mem", "ipg" and "asrc0..3".

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25 15:52:14 +08:00
Daniel Baluta 1ac4dce34c MLK-20189-10: ASoC: fsl: dsp: Avoid unnecessary check
strtab is always non-null so remove unnecessary check.

This is a follow up of patch
167a6d79f ("ASoC: fsl: Skip checking for string section type")
and finally fixes CID3901026

Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:52:14 +08:00
Daniel Baluta 4bff2e7204 MLK-20189-6: ASoC: fsl: Skip checking for string section type
e_shstrndx already contains the section header index, so
shdr->sh_type will always be SHT_STRTAB.

Remove this redundant check and make Coverity happy.

Fixes: CID3901026
Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:52:13 +08:00
Daniel Baluta f5f13e4c2c MLK-20189-5: ASoC: fsl: dsp_proxy: Unlock proxy->lock on error path
xf_cmd_send_recv returns with lock taken if waiting was
interrupted by a signal.

This fixes Coverity issues: CID5233120 / CID5233060

Reviewed-by: S.j. Wang <shengjiu.wang@nxp.com>
Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:52:12 +08:00
Daniel Baluta 13bc9cfb13 MLK-20189-4: ASoC: fsl: library_load: Check return value for kernel_read
Bail out if kernel_read returns an error.

Fixes: CID1477415

Reviewed-by: S.j. Wang <shengjiu.wang@nxp.com>
Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:52:12 +08:00
Daniel Baluta a314e4fe32 MLK-20189-3: ASoC: fsl: library_load: Remove dead code
At this point err is always 0. So, just remove the check.

Fixes: CID1477380

Reviewed-by: S.j. Wang <shengjiu.wang@nxp.com>
Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:52:11 +08:00
Daniel Baluta 4130b46451 MLK-20189-2: ASoC: dsp: Replace atomic_dec_return with atomic_dec
Return value is not used so better use atomic_dec.
This also silences coverity warning CID3344689.

Reviewed-by: S.j. Wang <shengjiu.wang@nxp.com>
Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:52:11 +08:00
Daniel Baluta 20a12565f1 MLK-20189-1: ASoC: fsl: dsp: Unlock proxy->lock on error path
xf_cmd_recv will return with lock taken in two cases:
	* msg was received
	* waiting for msg was interrupted by a signal

Make sure we unlock proxy->lock in both cases.

This fixes Coverity issue: CID3335482.

Reviewed-by: S.j. Wang <shengjiu.wang@nxp.com>
Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-11-25 15:52:08 +08:00
Ranjani Vaidyanathan fc803f2425 MLK-20222-4 sound: Update SCFW API
Update SCFW API to the following commit:
"
   ("430d1e3646fbe75e339e18abf2330565eac906e0")
   Author: Chuck Cannon <chuck.cannon@nxp.com>
   Date:   Fri Nov 2 15:25:45 2018 -0500

   SCF-105: RN updates.
"

Signed-off-by: Ranjani Vaidyanathan <Ranjani.Vaidyanathan@nxp.com>
2019-11-25 15:52:06 +08:00