linux.git
6 years agoMLK-18182: ASoC: fsl_asrc: increase the retry times
Shengjiu Wang [Mon, 17 Dec 2018 08:19:32 +0000 (16:19 +0800)]
MLK-18182: ASoC: fsl_asrc: increase the retry times

When 3 asrc pair are working in parallel, there will be
error log randomly

output DMA task timeout
fsl-asrc 2034000.asrc: Pair B: failed to process buffer: -62

The reason is that the initialization is not finished for
some pair, the prefill data is failed to be input in FIFO.

The patch is to increase the retry times to make sure that
initialization is success.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 85e0a5be4c11c9efeccc893e4c0e1f6b4e90fa01)

6 years agoMLK-15061-2: ASoC: fsl_asrc_m2m: fix asrc m2m can't work in imx8
Shengjiu Wang [Mon, 12 Jun 2017 07:19:42 +0000 (15:19 +0800)]
MLK-15061-2: ASoC: fsl_asrc_m2m: fix asrc m2m can't work in imx8

Power domain need to be enabled when asrc m2m start to work, and
disabled when it stop.
Switch back to use the pm_runtime_get_sync and pm_runtime_put_sync
for which is removed in commit 1a3d82e08fa2 ("ASoC: fsl: refine
the asrc driver for imx8qm").

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit 602f4f47e454e371f80f55e4e79a3bdfd09ce7d5)

6 years agoMLK-20096: ASoC: fsl_asrc_m2m: fix noise issue for 8k5c to 176k5c conversion
Shengjiu Wang [Wed, 12 Dec 2018 11:14:21 +0000 (19:14 +0800)]
MLK-20096: ASoC: fsl_asrc_m2m: fix noise issue for 8k5c to 176k5c conversion

Compare with imx6, the conversion of 8kHz 5channel to 176kHz is ok.
And compare the output we found that about every 48K bytes, there will be
additional data be added, which cause noise.

In this case, there will be two sg_nodes, for the maxmum output size exceed
the ASRC_MAX_BUFFER_SIZE, each size is ASRC_MAX_BUFFER_SIZE, it is 49152.
the value can't be exact divided by channel * word_with * watermark = 40.
So the EDMA can't finish the copy with correct size.

There is limitation of EMDA described in commit 3519b67ac01c
("MLK-19151: ASoC: fsl_asrc: fix dma timeout issue for imx8qxp")

EDMA just copy 49120 bytes, there will 32 bytes wrong data.

According to this limitation, this commit is to change the maxburst to 1
for EDMA case, then EDMA can do what we expect correctly.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 3ed46932710cd8c15d7fa79555935be04d768e40)

6 years agoMLK-19151: ASoC: fsl_asrc: fix dma timeout issue for imx8qxp
Shengjiu Wang [Tue, 7 Aug 2018 07:02:34 +0000 (15:02 +0800)]
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>
(cherry picked from commit 46008056908bc2f7f9305381112f058d1ae52437)

6 years agoMLK-20613: ASoC: fsl_asrc: add limitation for non ideal ratio mode
Shengjiu Wang [Tue, 18 Dec 2018 08:08:14 +0000 (16:08 +0800)]
MLK-20613: ASoC: fsl_asrc: add limitation for non ideal ratio mode

for non ideal ratio mode, the clock rate should divide the sample rate
with no remainder, and the quotient should be less than 1024.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit f1459e0be38a89230f9c4831d6d7c0021b1ffc48)

6 years agoMLK-13945-3: ASoC: fsl_asrc: support two asrc devices
Shengjiu Wang [Wed, 5 Jul 2017 07:29:40 +0000 (15:29 +0800)]
MLK-13945-3: ASoC: fsl_asrc: support two asrc devices

In imx8qm, there is two asrc devices, so using global structure
"miscdevice" will cause error. Each instance should have their
own structure.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
(cherry picked from commit f70f67b04b5351fe6d0d288f62f8050932cf5085)
(cherry picked from commit 8c533278e6f62185b976d6d49f039d87620a4c0e)

6 years agoMLK-17089-2: ASoC: fsl_esai: support suspend & resume for imx8
Shengjiu Wang [Wed, 6 Dec 2017 03:40:31 +0000 (11:40 +0800)]
MLK-17089-2: ASoC: fsl_esai: 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>
(cherry picked from commit f78c1564e501eaca142cd606df991abe92ff8461)

6 years agoMLK-17089-1: ASoC: fsl_sai: support suspend & resume for imx8
Shengjiu Wang [Wed, 6 Dec 2017 03:40:20 +0000 (11:40 +0800)]
MLK-17089-1: ASoC: fsl_sai: 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>
(cherry picked from commit 6398e9efcae3a2aa102689797c9b63e260a06cdd)

6 years agoarm64: dts: adjust AUDMIX configuration with upstream
Viorel Suman [Tue, 9 Apr 2019 15:23:02 +0000 (18:23 +0300)]
arm64: dts: adjust AUDMIX configuration with upstream

Adjust AUDMIX configuration with upstream version.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
6 years agoASoC: imx-audmix: fix object reference leaks in probe
Viorel Suman [Tue, 9 Apr 2019 10:43:05 +0000 (13:43 +0300)]
ASoC: imx-audmix: fix object reference leaks in probe

Release the reference to the underlying device taken
by of_find_device_by_node() call.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reported-by: Julia Lawall <Julia.Lawall@lip6.fr>
6 years agodt-bindings: fsl,audmix: remove "model" attribute
Viorel Suman [Tue, 9 Apr 2019 09:43:55 +0000 (12:43 +0300)]
dt-bindings: fsl,audmix: remove "model" attribute

Remove "model" attribute.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
6 years agoASoC: fsl_audmix: remove "model" attribute
Viorel Suman [Tue, 9 Apr 2019 10:38:23 +0000 (13:38 +0300)]
ASoC: fsl_audmix: remove "model" attribute

Use "of_device_id.data" to specify the machine driver
instead of "model" DTS attribute.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
6 years agoARM64: defconfig: replace AMIX with AUDMIX
Viorel Suman [Tue, 9 Apr 2019 14:53:21 +0000 (17:53 +0300)]
ARM64: defconfig: replace AMIX with AUDMIX

Sync the config option with upsream version

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
6 years agoASoC: fsl: fix spelling mistake: "missign" -> "missing"
Colin Ian King [Thu, 28 Mar 2019 09:28:16 +0000 (09:28 +0000)]
ASoC: fsl: fix spelling mistake: "missign" -> "missing"

There is a spelling mistake in a dev_err message. Fix this.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
Acked-by: Viorel Suman <viorel.suman@nxp.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit de70b2a581125a8a627db6fdc1d7f9c05536fe84)

6 years agoASoC: fsl_audmix: Fix kbuild failure
Viorel Suman [Wed, 27 Mar 2019 09:29:38 +0000 (09:29 +0000)]
ASoC: fsl_audmix: Fix kbuild failure

The format in dev_dbg function must be a constant.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit 5fb94d46c3179cb7afd805a5a9252111316a926f)

6 years agoASoC: fsl: Add Audio Mixer machine driver
Viorel Suman [Tue, 22 Jan 2019 11:14:30 +0000 (11:14 +0000)]
ASoC: fsl: Add Audio Mixer machine driver

This patch implements Audio Mixer machine driver for NXP iMX8 SOCs.
It connects together Audio Mixer and related SAI instances.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit b86ef5367761603df5f66ce08fb014b991f6b51d)

6 years agoASoC: add fsl_audmix DT binding documentation
Viorel Suman [Tue, 22 Jan 2019 11:14:27 +0000 (11:14 +0000)]
ASoC: add fsl_audmix DT binding documentation

Add the DT binding documentation for NXP Audio Mixer
CPU DAI driver.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit d0d9071b724123ebde89bdf6b52b86c3289abe85)

6 years agoASoC: fsl: Add Audio Mixer CPU DAI driver
Viorel Suman [Tue, 22 Jan 2019 11:14:26 +0000 (11:14 +0000)]
ASoC: fsl: Add Audio Mixer CPU DAI driver

This patch implements Audio Mixer CPU DAI driver for NXP iMX8 SOCs.
The Audio Mixer is a on-chip functional module that allows mixing of
two audio streams into a single audio stream.

Audio Mixer datasheet is available here:
https://www.nxp.com/docs/en/reference-manual/IMX8DQXPRM.pdf

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit be1df61cf06efb355c90702e46b8d46f055acb4e)

6 years agoRevert "MLK-13975: ASoC: fsl: add AMIX device driver"
Viorel Suman [Tue, 9 Apr 2019 14:26:57 +0000 (17:26 +0300)]
Revert "MLK-13975: ASoC: fsl: add AMIX device driver"

This reverts commit 1a6856077fd7dfdbbd226b84d02d3edbc5fc6948.

6 years agoRevert "MLK-13975: ASoC: fsl: add AMIX machine driver"
Viorel Suman [Tue, 9 Apr 2019 14:26:52 +0000 (17:26 +0300)]
Revert "MLK-13975: ASoC: fsl: add AMIX machine driver"

This reverts commit 7e13522706d3fe3bee0f653752cc71b345a00124.

6 years agoMLK-21416: ARM: dts: imx6q: correct SDMA script for ecspi5
Robin Gong [Tue, 9 Apr 2019 08:14:12 +0000 (16:14 +0800)]
MLK-21416: ARM: dts: imx6q: correct SDMA script for ecspi5

Revert below upstreaming patch which broke SPI5 dma since ram
script used for ecspi to workaroud ERR009165 and spi driver
changed to XCH mode instead of SMC.

Revert "ARM: dts: imx6q: Use correct SDMA script for SPI5 core"

This reverts commit df07101e1c4a29e820df02f9989a066988b160e6.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
6 years agoMLK-21403 ARM: dts: imx6dl: update opp table for auto part
Anson Huang [Mon, 8 Apr 2019 07:17:05 +0000 (15:17 +0800)]
MLK-21403 ARM: dts: imx6dl: update opp table for auto part

Update i.MX6DL opp table according to i.MX6DL automotive
datasheet Rev.9, 11/2018, it adds 996MHz set-point as below:

LDO enabled(min value):
996MHz: VDDARM: 1.275V, VDDSOC: 1.175V;
792MHz: VDDARM: 1.150V, VDDSOC: 1.150V;
396MHz: VDDARM: 1.125V, VDDSOC: 1.150V;

Adding 25mV to cover board IR drop, for LDO enabled
mode of 996MHz, as the max value of LDO output can NOT
exceed 1.3V, so 25mV is NOT added for VDDARM.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Bai Ping <ping.bai@nxp.com>
(cherry picked from commit e79b4005aa709932bc070d641701b929e7072683)

6 years agoMLK-21407 gpu: imx: dpu: tcon: Assign tcon id
Liu Ying [Mon, 8 Apr 2019 09:08:16 +0000 (17:08 +0800)]
MLK-21407 gpu: imx: dpu: tcon: Assign tcon id

We should assign dedicated id for every tcon instance.
This makes us be able to figure out bewteen master and
slave tcon.  Only side-by-side display mode is likely
impacted.  Based on tests, no functional change is
observed before or after this patch is applied.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
(cherry picked from commit e181d9e56b096bbdc919f65b223d1bde413df1bb)

6 years agoMLK-21398 i2c: lpi2c: add compatible string for imx8qm
Clark Wang [Mon, 8 Apr 2019 05:52:22 +0000 (13:52 +0800)]
MLK-21398 i2c: lpi2c: add compatible string for imx8qm

Add compatible string for i.MX8QM's LPI2C module. Some i2c device nodes
in dts file only use "fsl,imx8qm-lpi2c" now.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
6 years agoMLK-16220 lpi2c: imx8: improve i2c driver probe priority
Gao Pan [Thu, 10 Aug 2017 09:32:39 +0000 (17:32 +0800)]
MLK-16220 lpi2c: imx8: improve i2c driver probe priority

use subsys_initcall for i2c driver to improve i2c driver probe priority

Signed-off-by: Gao Pan <pandy.gao@nxp.com>
(cherry picked from commit 3661eef81a308dab2bfae3790c045ae2d2fd3f49)

6 years agoMLK-21402 drm/imx: dpu: kms: Trivial typo fix to remove a superfluous ";"
Liu Ying [Mon, 8 Apr 2019 07:14:37 +0000 (15:14 +0800)]
MLK-21402 drm/imx: dpu: kms: Trivial typo fix to remove a superfluous ";"

This patch fixes a trivial typo to remove a superfluous ";".

Fixes: 5bed4df1a154 ("MLK-21397 drm/imx: dpu: kms: Put possible pipe states properly")
Signed-off-by: Liu Ying <victor.liu@nxp.com>
6 years agoMLK-21397 drm/imx: dpu: kms: Put possible pipe states properly
Liu Ying [Mon, 8 Apr 2019 05:44:24 +0000 (13:44 +0800)]
MLK-21397 drm/imx: dpu: kms: Put possible pipe states properly

We should put possible pipe states after we've finished assigning
resources for all pipes.  This makes sure the pipe states which
should be put are all eventually put.  Without this patch, disabled
crtc(s) or enabled crtc(s) without any plane upon will be accidentally
left in the atomic state when commit operations only happen for other
pipe(s), because we skip the put operations when we see the relevant
active plane number is zero.  It's good to put pipe states for those
crtcs, otherwise, we'll depend on atomic helper core behavior to
handle the crtcs.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
6 years agoMLK-21393 soc: imx: update SCFW API
Anson Huang [Mon, 8 Apr 2019 04:39:31 +0000 (12:39 +0800)]
MLK-21393 soc: imx: update SCFW API

This patch updates SCFW API to v1.7, based on below commit:

252281d48647 ("SCF-105: Update wiki.")

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Bai Ping <ping.bai@nxp.com>
(cherry picked from commit d62625563213b516c6238e970f31d07d20bbe19e)

6 years agoMLK-21287 soc: imx: keep resource power ON if subdomain is wakeup source
Anson Huang [Wed, 27 Mar 2019 09:23:32 +0000 (17:23 +0800)]
MLK-21287 soc: imx: keep resource power ON if subdomain is wakeup source

The power mode operation ONLY checks whether the resource being
powered OFF is a wakeup source, and skip power OFF operation if
it is a wakeup source, but it does NOT consider the power tree
status, if any of its children is a wakeup source, it needs to
be kept powered ON for its children's wakeup capability.

For example, on i.MX8QXP, CAN1 shares CAN0's power, if CAN1 is
enabled as wakeup source, CAN0's power needs to be ON even it
is NOT a wakeup source, this patch adds support for such scenario.

As it uses recursion, to avoid overhead during runtime power
management, introduce a variable to make sure this logic is ONLY
enabled during suspend/resume.

The generic power domain framework for handling device power
according to wakeup status does NOT consider the virtual devices,
e.g., if debug uart is enabled as wakeup source, the device wakeup
capability check for uart device returns false, ONLY the ttydev has
wakeup capability, that will cause resume_needed() return false
and uart device power will be OFF even its child device "ttydev" is
enabeld as wakeup source.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Tested-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Reviewed-by: Bai Ping <ping.bai@nxp.com>
(cherry picked from commit 459db9c5f53735f33753a7a60232784b3d09d261)

6 years agoMLK-21313 spi: lpspi: add missing complete in abort func at dma mode
Clark Wang [Tue, 2 Apr 2019 11:51:49 +0000 (19:51 +0800)]
MLK-21313 spi: lpspi: add missing complete in abort func at dma mode

Add the missing complete operations for dma_completion to fix the
problem of blocking at the wait_for_completion_interruptible()
function in some situations.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
(cherry picked from commit a19a00c51df5c3ead4d64ea3136f5bce60b2e6af)

6 years agospi: lpspi: fsl_lpspi_runtime_resume() can be static
kbuild test robot [Tue, 19 Mar 2019 01:46:33 +0000 (09:46 +0800)]
spi: lpspi: fsl_lpspi_runtime_resume() can be static

Fixes: 944c01a889d9 ("spi: lpspi: enable runtime pm for lpspi")
Signed-off-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit 04f7ee7c9e9b9e0aad42001c0bae54af3997297c)

6 years agoMLK-21173 ARM64: dts: fix imx8qxp-pinctrl iomuxc error
Clark Wang [Tue, 19 Mar 2019 06:50:14 +0000 (14:50 +0800)]
MLK-21173 ARM64: dts: fix imx8qxp-pinctrl iomuxc error

Because we add the partition reboot function, and assign all flexcan
pins to M4, A core cannot access flexcan pins for now.

LPUART3 uses flexcan pins before, so disable it to avoid this error:
imx8qxp-pinctrl iomuxc: pin_config_set op failed for pin 110

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
(cherry picked from commit be821a84c44f6d8cf6e9a2573d214de91739dfdf)

6 years agoMLK-21153-2 ARM64: dts: add lpspi dma support for 8qxp
Clark Wang [Fri, 15 Mar 2019 06:07:39 +0000 (14:07 +0800)]
MLK-21153-2 ARM64: dts: add lpspi dma support for 8qxp

Add dma support for lpspi0 and lpspi2 modules on i.MX8QXP board.

Ensure the lpspi does not use cs-gpio in slave mode.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
(cherry picked from commit 7f69223a715301c69f02fbac8cc6096215e500de)

6 years agoMLK-21153-1 spi: lpspi: fix the dataloss when slave is in PIO mode
Clark Wang [Fri, 15 Mar 2019 05:05:22 +0000 (13:05 +0800)]
MLK-21153-1 spi: lpspi: fix the dataloss when slave is in PIO mode

Related issues have been fixed by (e0e542aeb46a MLK-20060-1 spi: lpspi:
fix wrong transmission when don't use CONT). However, the delay between
sending and receiving in slave mode. This causes the value of
FSR_RXCOUNT cannot reflect whether there is still data not sent timely.
So do this judgement by FSR_TXCOUNT.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
(cherry picked from commit 1a260d13aa3724b9919a2d8e2f53b4ad26ccf372)

6 years agoMLK-21017 ARM64: dts: disable CAN related regulators to fix CAN issue in M4
Clark Wang [Fri, 1 Mar 2019 07:00:53 +0000 (15:00 +0800)]
MLK-21017 ARM64: dts: disable CAN related regulators to fix CAN issue in M4

These CAN related regulators will be handled when kernel boots. However,
these regulators which aren't used by any devices will be disabled by the
regulator framework. So, the pins in these regulators will be non-active
status. This causes the CAN module cannot be used in M4 side.

So, disable these regualtors for 8QM/QXP, and let M4 handles these.

Suggested-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
(cherry picked from commit 5c40db9cb2074c0c148d677acda55b0637c0c764)

6 years agoMLK-20940-4 ARM64: defconfig: Add RPBUS and RPMSG config
Clark Wang [Mon, 18 Feb 2019 09:20:40 +0000 (17:20 +0800)]
MLK-20940-4 ARM64: defconfig: Add RPBUS and RPMSG config

Enable RPBUS(i2c-rpmsg-imx.c) and RPMSG functions.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
(cherry picked from commit f47caf1254b93ffe7caca003f5d8f60f5b9070a0)

6 years agoMLK-20940-3 codecs: cs42xx8: use single read/write to send i2c msg
Clark Wang [Mon, 18 Feb 2019 09:14:19 +0000 (17:14 +0800)]
MLK-20940-3 codecs: cs42xx8: use single read/write to send i2c msg

cs42xx8 will call regcache_sync to refresh its register cache. However,
it will send a long msg which length is greater than the max buffer size
of virtual i2c driver. It will cause the regcache_sync operation failed.
So, use the single read/write to send i2c msg in regcache functions.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
(cherry picked from commit 0153e60c26a0fdcf463fb16b090511da7e52df0c)

6 years agoMLK-20212 lpspi: Coverity: Add the missing NULL check
Clark Wang [Wed, 16 Jan 2019 06:27:17 +0000 (14:27 +0800)]
MLK-20212 lpspi: Coverity: Add the missing NULL check

The spi_transfer *t will be used in one transfer whatever. If t is NULL,
there has no need to try sending data, so add an error return here.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
Acked-by: Fugang Duan <Fugang.duan@nxp.com>
(cherry picked from commit 68b253138f23754706d3ec16007f2327e1910654)

6 years agoMLK-20060-5 dts: lpspi: add dma mode support
Clark Wang [Thu, 3 Jan 2019 09:36:45 +0000 (17:36 +0800)]
MLK-20060-5 dts: lpspi: add dma mode support

Add dma configurations in dts files, for imx7ulp and imx8qm.

There is no "edma0" node in fsl-imx8qm-mek(or lpddr4-arm2)-domu.dts.
lpspi0 node has been deleted in these dts files, so delete lpspi3 node.

Add edma0a and edma0d for lpspi0 and lpspi3, and enable lpspi0/3 for xen.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
Acked-by: Fugang Duan <Fugang.duan@nxp.com>
(cherry picked from commit d256a5005243efb4557c9acee0c8a42f07b99ff2)

6 years agoMLK-20060-4 spi: lpspi: add dma mode support
Clark Wang [Tue, 15 Jan 2019 08:45:02 +0000 (16:45 +0800)]
MLK-20060-4 spi: lpspi: add dma mode support

Add dma mode support for LPSPI. Any frame longer than half txfifosize will
be sent by dma mode.

For now, there are some limits:
1. The maximum transfer speed in master mode depends on the slave device,
   at least 40MHz(tested by spi-nor on 8qm-lpddr4-arm2 base board);
2. The maximum transfer speed in slave mode is 15MHz(imx7ulp),
   22MHz(8qm/qxp).

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
Acked-by: Fugang Duan <Fugang.duan@nxp.com>
(cherry picked from commit 1693fd1628108e47fa7700218fc2b3aa1e9b83ee)

6 years agoMLK-20060-3 spi: lpspi: use the core way to implement cs-gpio function
Clark Wang [Tue, 15 Jan 2019 08:08:30 +0000 (16:08 +0800)]
MLK-20060-3 spi: lpspi: use the core way to implement cs-gpio function

Use the default implementation of transfer_one_msg/chipselect/setup
functions in spi core to implement cs-gpio control.
Use fsl_lpspi_prepare_message to init the cs_gpio pin.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
Acked-by: Fugang Duan <Fugang.duan@nxp.com>
(cherry picked from commit 8f0f0df824fc113eade82f929e3e78b8f4d2ac55)

6 years agoMLK-20060-2 spi: lpspi: add the error info of transfer speed setting
Clark Wang [Thu, 3 Jan 2019 07:26:46 +0000 (15:26 +0800)]
MLK-20060-2 spi: lpspi: add the error info of transfer speed setting

Add a error info when set a speed which greater than half of per-clk of
spi module.

The minimum SCK period is 2 cycles(CCR[SCKDIV]). So the maximum transfer
speed is half of spi per-clk.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
Acked-by: Fugang Duan <Fugang.duan@nxp.com>
(cherry picked from commit d13f9515c1378d778e82a72c24a99892389710c4)

6 years agoMLK-20060-1 spi: lpspi: fix wrong transmission when don't use CONT
Clark Wang [Thu, 3 Jan 2019 06:26:28 +0000 (14:26 +0800)]
MLK-20060-1 spi: lpspi: fix wrong transmission when don't use CONT

Add judgment on SR_MBF and FSR_RXCOUNT.

In PIO mode, if don't use CONT to keep cs selected in one transfer, the
transfer will go wrong. FCIE will be set after one frame transfer
finish. If use CONT, the frame refer to the whole data in one transfer.
If don't use CONT, the frame refer to one byte of whole data. This will
cause the transfer ending early.

This patch add a register reading in isr function, it might lead to a
slight decrease in the max transmission speed in PIO mode.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
Acked-by: Fugang Duan <Fugang.duan@nxp.com>
(cherry picked from commit 0e31af06088acb5751e0ecfef4ae2acc38f6c749)

6 years agoMLK-20773 i2c-imx: add a limit of maximum transfer speed for imx7d
Clark Wang [Fri, 18 Jan 2019 04:00:16 +0000 (12:00 +0800)]
MLK-20773 i2c-imx: add a limit of maximum transfer speed for imx7d

According the e7805 in Errata, the SCK low level period should be less
than 1.3us.

The other series platform use this same IP can match the errata, and
ensure the low level period longer than 1.3us when the speed set to
400KHz. However, only at imx7d platform, the low level period is less
than 1.3us in the same situation.

Therefore, limit the maximum transfer speed to 384KHz when probe at
imx7d platform.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
(cherry picked from commit 19f553846e872b5c379b37ed029132b79566cab0)

6 years agoMLK-20234 isl29023: fix Coverity warning
Clark Wang [Fri, 11 Jan 2019 08:43:34 +0000 (16:43 +0800)]
MLK-20234 isl29023: fix Coverity warning

Fix the Coverity warning "divide_by_zero".

If "rext" is incorrectly set as zero in dts file, "divide_by_zero" will
happen at line 960. So add a judgment condition here, and let "rext" uses
default value when it is equal to zero.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
(cherry picked from commit 999f94e0d7524640381eb4b3f6590f213533679e)

6 years agoMLK-20441-1 spi: lpspi: Add cs-gpio feature to support spi-nor
Clark Wang [Wed, 28 Nov 2018 09:14:42 +0000 (17:14 +0800)]
MLK-20441-1 spi: lpspi: Add cs-gpio feature to support spi-nor

Add cs-gpio feature. Use fsl_lpspi_prepare_message() and
fsl_lpspi_unprepare_message() to enable and control cs line.
These two functions will be only called at the beginning and the ending
of a message transfer.

Still can use the mode without cs-gpio. The two ways can refer to
fsl-imx8qm-lpddr4-arm2-lpspi.dts for setting the lpspi configration in
dts file.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
(cherry picked from commit 245d353cdf0a461ddcd2dcc36793571aae1069b0)

6 years agoMLK-20753: mxc-jpeg: Switch from single to multi-planar v4l2 buffers
Mirela Rabulea [Thu, 10 Jan 2019 11:51:30 +0000 (13:51 +0200)]
MLK-20753: mxc-jpeg: Switch from single to multi-planar v4l2 buffers

Adjust the driver to use the "mplane" flavor of v4l2 structures:
"mplane" flavor ioctls for format negotiation in mxc_jpeg_ioctl_ops,
V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE instead of V4L2_BUF_TYPE_VIDEO_CAPTURE,
V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE instead of V4L2_BUF_TYPE_VIDEO_OUTPUT,
V4L2_CAP_VIDEO_M2M_MPLANE instead of V4L2_CAP_VIDEO_M2M,
pix_mp member of struct v4l2_format, instead of pix (previously, the
pix_mp was sometimes used wrongly for single-plane).

Adjust the sizeimage & bytesperline members of mxc_jpeg_q_data
as MXC_JPEG_MAX_PLANES elements arrays, to accommodate maximum 2 planes.

In case of YUV420, which is the only multi-planar format supported,
use the first plane address as buf_base0 and the second plane address
as buf_base1, to configure the CAST IP. Previously, the buf_base1 was
calculated as an offset to buf_base0, in mxc_jpeg_addrs.

After decoding, set the payload for both planes via vb2_set_plane_payload.

Multi-planar support current status:
-gst-launch with filesink & fbdevsink always pass
-gst-launch with waylandsink & kmssink sometimes fail for resolutions
where height is multiple of 256 (1024 x 256, 1024 x 512).

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
6 years agoMLK-20889: mxc-jpeg: Jpeg decoder gets stuck with gplay & short yuv422 mjpeg video
Mirela Rabulea [Wed, 13 Feb 2019 15:29:56 +0000 (17:29 +0200)]
MLK-20889: mxc-jpeg: Jpeg decoder gets stuck with gplay & short yuv422 mjpeg video

Unlock hw_lock before calling v4l2_m2m_job_finish to avoid deadlock:
v4l2_m2m_job_finish -> v4l2_m2m_try_schedule -> job_ready locks hw_lock
v4l2_m2m_job_finish -> v4l2_m2m_try_run -> device_run locks hw_lock

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
6 years agoMLK-20755: mxc-jpeg: gst-launch only shows the first frame of an yu422 video
Mirela Rabulea [Mon, 14 Jan 2019 16:03:43 +0000 (18:03 +0200)]
MLK-20755: mxc-jpeg: gst-launch only shows the first frame of an yu422 video

Make sure V4L2_EVENT_SOURCE_CHANGE is only sent at init phase.
It was wrongly sent for every frame, causing gst-launch to DQBUF
only for the first frame.

Removed a dev_dbg from mxc_jpeg_try_fmt, too many prints with gst.

Fix for "Driver bug detected, stride (%d) is too small for the width (%d)"
warning in gst-launch. Fixed by providing the stride in bytesperline, in
mxc_jpeg_g_fmt_vid_cap function.

Clean-up in mxc_jpeg_qbuf.

Tested with gst-launch and v4l2video0jpegdec plugin:
gst-launch-1.0 filesrc location=mjpeg_64x64_4frames.avi ! jpegparse
! v4l2video0jpegdec ! waylandsink

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
6 years agoMLK-20756: mxc-jpeg: gst-launch does not exit after displaying jpeg image with jpeg-dec
Mirela Rabulea [Mon, 14 Jan 2019 14:39:07 +0000 (16:39 +0200)]
MLK-20756: mxc-jpeg: gst-launch does not exit after displaying jpeg image with jpeg-dec

Add notify_eos function to enqueue V4L2_EVENT_EOS for the application.
Call notify_eos after V4L2_DEC_CMD_STOP was received,
or, if there still are source buffers to process, later in dqbuf.
Add mxc_jpeg_dqbuf and send V4L2_EVENT_EOS if needed.

Fix for "Driver should never set v4l2_buffer.field to ANY" warning in
gst-launch, by setting V4L2_FIELD_NONE in mxc_jpeg_dqbuf.

Tested with gst-launch and v4l2video0jpegdec plugin:
gst-launch-1.0 filesrc location=<image.jpg> ! jpegparse ! v4l2video5jpegdec
        ! waylandsink

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
6 years agoMLK-20466: mxc-jpeg: Fix coverity issues
Mirela Rabulea [Thu, 20 Dec 2018 14:44:23 +0000 (16:44 +0200)]
MLK-20466: mxc-jpeg: Fix coverity issues

Return int from get_sof (-1 for error), the result is later on
compared with -1 literal.

Fix memory leak from print_nbuf_to_eoi, when !mxc_jpeg_tracing.

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
6 years agoMLK-19942: mxc-jpeg: Workaround for "Instance released before end of transaction"
Mirela Rabulea [Thu, 22 Nov 2018 14:22:28 +0000 (16:22 +0200)]
MLK-19942: mxc-jpeg: Workaround for "Instance released before end of transaction"

The context is released after FRM_DONE interrupt is received,
but for some small images, after FRM_DONE, a HALF_BUF interrupt
keeps coming, and cannot be cleared.
A soft reset helps (resets only the decoder internal state, not registers).

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
6 years agoMLK-20289: mxc-jpeg: Add module parameter for debug purpose
Mirela Rabulea [Thu, 22 Nov 2018 11:34:31 +0000 (13:34 +0200)]
MLK-20289: mxc-jpeg: Add module parameter for debug purpose

Add debug function print_nbuf_to_eoi, to print the decoder input frame.
Add module parameter mxc_jpeg_tracing.

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@nxp.com, Robert Chiras <robert.chiras@nxp.com>
6 years agoMLK-20289: mxc-jpeg: Fix jpeg-dec for use with gst-launch-1.0 & v4l2video5jpegdec
Mirela Rabulea [Thu, 22 Nov 2018 11:19:53 +0000 (13:19 +0200)]
MLK-20289: mxc-jpeg: Fix jpeg-dec for use with gst-launch-1.0 & v4l2video5jpegdec

Set allow_zero_bytesused, to let gst-launch work, this lead to the need
to implement V4L2_DEC_CMD_STOP, dummy for now.

Implement g_fmt_vid_cap, called by gst-launch before queuing any capture
buffers, this also required some fixes in jpeg_parse and buf_queue,
which wrongly assumed capture buffers are enqueued before output buffers.
So, import the resolution and pixel-format from the output queue,
if the capture queue is not set-up yet.

Add release_active_buffers and use it in stop_streaming to properly
clean-up active buffers, this fixes warning at gst-launch stop with Ctrl+C

Check for decoding/encoding error in interrupt handler and print CAST IP
error status, found some yuv422 images with errors in SOS marker.

Partially implemented subscribe_event, V4L2_EVENT_EOS is not working yet,
will be addressed in a subsequent fix.

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@nxp.com, Robert Chiras <robert.chiras@nxp.com>
6 years agoMLK-19605: mxc-jpeg: RGB format in jpeg can't be decoded by mxc-jpeg driver
Mirela Rabulea [Fri, 12 Oct 2018 10:23:44 +0000 (13:23 +0300)]
MLK-19605: mxc-jpeg: RGB format in jpeg can't be decoded by mxc-jpeg driver

Validate the component ID's when parsing the jpeg headers,
print error and don't continue the decoding, avoid getting stuck.

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
6 years agoMLK-19247: mxc-jpeg: Remove jpeg-encoder hardcoding to 64x64 yuv422
Mirela Rabulea [Tue, 25 Sep 2018 12:49:38 +0000 (15:49 +0300)]
MLK-19247: mxc-jpeg: Remove jpeg-encoder hardcoding to 64x64 yuv422

Remove hardcodings for encoder (configuration stream especially).
This fix also requires a fixed version of the test applications,
encoder_test.out/decoder_test.out (linux-test repo).

Also fixed MLK-19453: Add support for YUV420 format in jpeg decoder
YUV420 is generally working on encoder/decoder,
but for some particular small files the decoder enters infinite error:
"Instance released before the end of transaction".
RGB24 is working, but the colors are strange in jpeg.
Since YUV444 and RGB24 have the same subsampling,
a RGB24 raw file can be encoded/decoded as YUV444 with the same results.
Fixes for invalid pixel formats.
Full battery of tests run.

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
6 years agoMLK-18451: mxc-jpeg: Fix jpeg encoder output
Mirela Rabulea [Wed, 8 Aug 2018 14:45:02 +0000 (17:45 +0300)]
MLK-18451: mxc-jpeg: Fix jpeg encoder output

Use two chained descriptors for encoder (config desc & encode desc),
they are set-up in new function mxc_jpeg_config_enc_desc.

Refactor function mxc_jpeg_enc_config, in order for the encoder to
function correctly, the CAST_MODE register needs to be written after
the descriptor(s) are ready.

Set-up decoder descriptor in new function mxc_jpeg_config_dec_desc,
this was previously done in mxc_jpeg_device_run, which is
leaner & cleaner now.

Function mxc_jpeg_go cannot be used both for encoder and decoder, because
the CAST IP control registers are different, the decoder has CTRL
(offset 0x34) while the encoder has MODE register (offset 0x0).
So, have two functions instead: mxc_jpeg_go_enc and mxc_jpeg_go_dec.

Function mxc_jpeg_reset had no purpose anymore, instead use
mxc_jpeg_sw_reset, for soft reset.

Add function mxc_jpeg_set_l_endian.

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
6 years agoMLK-18451: mxc-jpeg: Fix encoder stuck on second run
Mirela Rabulea [Sat, 21 Jul 2018 10:26:42 +0000 (13:26 +0300)]
MLK-18451: mxc-jpeg: Fix encoder stuck on second run

Do a soft reset before job run.
Encoder now runs succesivelly without crash or stuck, but outputs 0.

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
6 years agoMLK-18450: mxc-jpeg: Fix JPEG decoder crash
Mirela Rabulea [Wed, 27 Jun 2018 16:43:33 +0000 (19:43 +0300)]
MLK-18450: mxc-jpeg: Fix JPEG decoder crash

Fixed decoder crasher by creating a structure to encompass the descriptors
and associated it to the jpeg device, one for each slot.
Removed mxc_jpeg_buf, as writing to its fields was causing
memory corruption sometimes (depending on how src_buf & dst_buf
got allocated, writing to one was overwriting the other).

For now, only slot 0 is used (no regression here, just a TODO).

Note that the decoded image looks ok only on QXP B0, not A0.

The decoder_test application will be patched in linux-test,
the old one should work too, but needed cleanup.

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
6 years agoMLK-18998: mxc-jpeg: Fix jpeg format for gstreamer
Mirela Rabulea [Fri, 20 Jul 2018 17:21:02 +0000 (20:21 +0300)]
MLK-18998: mxc-jpeg: Fix jpeg format for gstreamer

Fix proposed by Bing Song.

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
6 years agoMLK-18493: mxc-jpeg: Use image settings from jpeg markers inside jpeg decoder
Mirela Rabulea [Mon, 11 Jun 2018 16:48:20 +0000 (19:48 +0300)]
MLK-18493: mxc-jpeg: Use image settings from jpeg markers inside jpeg decoder

Image information can be extracted from the JPEG SOH marker:
image format (YUV444/YUV420/YUV422/Gray), width & height, precision.
Use that information and apply it to the JPEG-DEC_WRP control registers.
Also fixed the decoder for non-square images.
Replace pr_*() and printk() calls with dev_*().

Currently working image formats: YUV444, YUV422, Gray
Not working formats: YUV420

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>, Sandor Yu <sandor.yu@nxp.com>
6 years agoMLK-16701 JPEG: add rum time pm support
Frank Li [Thu, 26 Oct 2017 15:58:53 +0000 (10:58 -0500)]
MLK-16701 JPEG: add rum time pm support

Support run time pm

Signed-off-by: Frank Li <Frank.Li@nxp.com>
Acked-by: Sandor Yu <sandor.yu@nxp.com>
6 years agoMLK-16688 driver: media: mxc_jpeg: Remove the unused function to kill the build warnnings
Jason Liu [Tue, 24 Oct 2017 22:29:19 +0000 (06:29 +0800)]
MLK-16688 driver: media: mxc_jpeg: Remove the unused function to kill the build warnnings

The patch fixes the following build warnnings by removing unused function:

drivers/media/platform/imx8/mxc-jpeg.c:228:13: warning: ‘print_output’ defined
but not used [-Wunused-function]
 static void print_output(void *addr)
             ^~~~~~~~~~~~

This patch also does the minor clean up by removing some commented-out code

Signed-off-by: Jason Liu <jason.hui.liu@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
6 years agoMLK-16645-4 JPEG: Encode: fix wrong use dma descriptor address
Frank Li [Fri, 20 Oct 2017 21:47:30 +0000 (16:47 -0500)]
MLK-16645-4 JPEG: Encode: fix wrong use dma descriptor address

Signed-off-by: Frank Li <Frank.Li@nxp.com>
Acked-by: Sandor Yu <sandor.yu@nxp.com>
6 years agoMLK-16645-3 JPEG: fixed crash caused by call dma_free_coherence in irq
Frank Li [Fri, 20 Oct 2017 21:34:37 +0000 (16:34 -0500)]
MLK-16645-3 JPEG: fixed crash caused by call dma_free_coherence in irq

move dma_free_coherence function to buf_cleanup

Signed-off-by: Frank Li <Frank.Li@nxp.com>
Acked-by: Sandor Yu <sandor.yu@nxp.com>
6 years agoMLK-16359-3: Added i.MX8 CAST IP JPEG Encoder/Decoder Linux V4L2 driver v2
Zhengyu Shen [Mon, 18 Sep 2017 19:34:52 +0000 (14:34 -0500)]
MLK-16359-3: Added i.MX8 CAST IP JPEG Encoder/Decoder Linux V4L2 driver v2

mxc-jpeg driver creates two v4l2 file handles in /dev/ which allows them to be used
by v4l2 programs. Supports encode and decode of various formats.

Note: Output data is not correct but matches validation result because IP Bug
TKT340836

v2: Split patches, added copyright

Signed-off-by: Zhengyu Shen <zhengyu.shen_1@nxp.com>
Reviewed-by: Sandor Yu <sandor.yu@nxp.com>
6 years agoMLK21112: arm64: defconfig: enable CAAM driver
Iuliana Prodan [Thu, 4 Apr 2019 09:11:51 +0000 (12:11 +0300)]
MLK21112: arm64: defconfig: enable CAAM driver

Because MLK21112 was resolved, now CAAM can be enabled
in defconfig.
Also enable CAAM SECVIO driver.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Reviewed-by: Horia Geanta <horia.geanta@nxp.com>
6 years agocrypto: caam - weak key checking for cbc des, 3des
Iuliana Prodan [Mon, 1 Apr 2019 14:12:14 +0000 (17:12 +0300)]
crypto: caam - weak key checking for cbc des, 3des

Modify setkey callback for cbc des and 3des to check for weak keys.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Reviewed-by: Horia Geantă <horia.geanta@nxp.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
(cherry picked from commit cf64e495fe221479866c1ea7c6f5cd9698d8a3af)
Reviewed-by: Horia Geanta <horia.geanta@nxp.com>
6 years agocrypto: caam - add ecb(*) support
Iuliana Prodan [Mon, 1 Apr 2019 14:01:47 +0000 (17:01 +0300)]
crypto: caam - add ecb(*) support

Add ecb mode support for aes, des, 3des and arc4 ciphers.
ecb(*) reuses existing skcipher implementation, updating it with support
for no IV.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Reviewed-by: Horia Geantă <horia.geanta@nxp.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
(cherry picked from commit eaed71a44ad9369a2b2205cedcb9d5d894c733fa)

Kept the BSP compatibility by using the ablkcipher API instead of
the upstream skcipher API.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Reviewed-by: Horia Geanta <horia.geanta@nxp.com>
6 years agocrypto: export arc4 defines
Iuliana Prodan [Mon, 1 Apr 2019 12:45:48 +0000 (15:45 +0300)]
crypto: export arc4 defines

Some arc4 cipher algorithm defines show up in two places:
crypto/arc4.c and drivers/crypto/bcm/cipher.h.
Let's export them in a common header and update their users.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Reviewed-by: Horia Geantă <horia.geanta@nxp.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
(cherry picked from commit bd30cf533b77420b7c504c09cef5ba26b0c9dcb4)
Reviewed-by: Horia Geanta <horia.geanta@nxp.com>
6 years agocrypto: caam - use mapped_{src,dst}_nents for job descriptor
Iuliana Prodan [Mon, 1 Apr 2019 12:36:12 +0000 (15:36 +0300)]
crypto: caam - use mapped_{src,dst}_nents for job descriptor

The mapped_{src,dst}_nents _returned_ from the dma_map_sg call (which
could be less than src/dst_nents) have to be used to generate the aead,
skcipher job descriptors.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Reviewed-by: Horia Geantă <horia.geanta@nxp.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
(cherry picked from commit ba4cf71b6f1b0165f34888b17fe44f4235dd0132)
Reviewed-by: Horia Geanta <horia.geanta@nxp.com>
6 years agocrypto: caaam - Revert ecb(*) support from BSP
Iuliana Prodan [Mon, 1 Apr 2019 12:00:22 +0000 (15:00 +0300)]
crypto: caaam - Revert ecb(*) support from BSP

This reverts commits:
825831cf1292 ("MLK-19365: drivers: crypto: caamalg: ecb(aes) does not use
IV")
84f5e22194c6 ("MA-9807: Fix ecb(aes) use without an IV")
fbaedad36527 ("MLK-14611 Add DES key complexity validation")
618df7f4726f ("MLK-9769-19 Add ARC4-ECB support for CAAM in i.MX6
family")
70b88340e5c1 ("MLK-9769-18 Add 3DES-ECB-EDE support for CAAM in i.MX6
family")
10c402ef6918 ("MLK-9769-17 Add AES-ECB support for CAAM in i.MX6
family")
10736b155c05 ("MLK-9769-16 Add DES-ECB support for CAAM in i.MX6
family")

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Reviewed-by: Horia Geanta <horia.geanta@nxp.com>
6 years agoMLK-20639: drivers: crypto: caam: pkc: RSA test fails as struct uses wrong type
Franck LENORMAND [Mon, 21 Jan 2019 12:51:43 +0000 (13:51 +0100)]
MLK-20639: drivers: crypto: caam: pkc: RSA test fails as struct uses wrong type

When creating the job descriptor, it uses the size of the structure which
is composed of dma_addr_t. On IMX8, this structrue is 64bit like the DMA
however the CAAM only receives 32 bit addresses. It result in a job
descriptor and more precisely the start index to point to invalid
location when it should point to the "command operation".

This patch changes the dma_addr_t to caam_dma_addr_t which is the correct
one for the rsa_priv_f2_pdb and rsa_priv_f3_pdb types as rsa_pub_pdb and
rsa_priv_f1_pdb already had this change.

Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
Reviewed-by: Horia Geanta <horia.geanta@nxp.com>
6 years agocrypto: caam - make 4.14 commit 335ae6c845da4 complete again :)
Horia Geantă [Fri, 22 Mar 2019 16:26:35 +0000 (18:26 +0200)]
crypto: caam - make 4.14 commit 335ae6c845da4 complete again :)

Commit 335ae6c845da ("MLK-18082: crypto: caam: Minimal fix for QX panic")
has not been ported completely, add missing bits.

Fixes: ebc02cc3be42 ("MLK-18082: crypto: caam: Minimal fix for QX panic")
Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
6 years agoASoC: ak5558: remove redundand includes
Viorel Suman [Thu, 4 Apr 2019 12:51:31 +0000 (15:51 +0300)]
ASoC: ak5558: remove redundand includes

Remove redundant includes keeping the code as close as possible
to upstream version.

Fixes commit 6d8b9d13605c ("MLK-19118-3: ASoC: AK5558: add regulators for
ak5558")
Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
6 years agoASoC: ak4458: fix various issues
Viorel Suman [Thu, 4 Apr 2019 11:51:25 +0000 (14:51 +0300)]
ASoC: ak4458: fix various issues

Fix various issues keeping the code as close
as possible to upstream version.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
6 years agoASoC: ak4458: fix commit 1996407879b8
Viorel Suman [Thu, 4 Apr 2019 11:02:17 +0000 (14:02 +0300)]
ASoC: ak4458: fix commit 1996407879b8

Fixes commit 1996407879b8 ("MLK-15033: ASoC: codecs: Add TDM support for AK4458")
Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
6 years agoASoC: ak4458: fix commit 21e81dfed90c
Viorel Suman [Thu, 4 Apr 2019 10:41:25 +0000 (13:41 +0300)]
ASoC: ak4458: fix commit 21e81dfed90c

Fixes commit 21e81dfed90c ("MLK-19573-2: ASoC: ak4458: enable DSD playback")
Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
6 years agoMLK-21106: ASoC: imx-ak4458: Fix channel not supported in tdm & daisy chain
Shengjiu Wang [Wed, 13 Mar 2019 08:29:45 +0000 (16:29 +0800)]
MLK-21106: ASoC: imx-ak4458: Fix channel not supported in tdm & daisy chain

The channel num (9 - 15) should not be supported in tdm & daisy chain
mode for there is two dataline, this channel number can't be
symmetrically distributed on two dataline (the first one is fixed to
be 8 channel)

Fixes commit 8d29874365c3 ("MLK-17817-2: ASoC: imx-ak4458: enable 16
channels in TDM mode")

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 0bc47b31660efd3dbbeee7e51fca6f75e7ecb69f)

6 years agoMLK-21383 drm/bridge: sec-dsim: fix maybe-uninitialized build warnings
Fancy Fang [Thu, 4 Apr 2019 09:19:23 +0000 (17:19 +0800)]
MLK-21383 drm/bridge: sec-dsim: fix maybe-uninitialized build warnings

If enable CONFIG_DYNAMIC_DEBUG, below maybe-uninitialized build
warnings happen:

"
In file included from ./include/linux/printk.h:336:0,
                 from ./include/linux/kernel.h:14,
                 from ./include/linux/unaligned/access_ok.h:5,
                 from ./include/asm-generic/unaligned.h:13,
                 from ./arch/arm64/include/generated/asm/unaligned.h:1,
                 from drivers/gpu/drm/bridge/sec-dsim.c:17:
drivers/gpu/drm/bridge/sec-dsim.c: In function ‘sec_mipi_dsim_calc_pmsk’:
./include/linux/dynamic_debug.h:135:3: warning: ‘best_s’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   __dynamic_dev_dbg(&descriptor, dev, fmt, \
   ^
drivers/gpu/drm/bridge/sec-dsim.c:1149:27: note: ‘best_s’ was declared here
  uint32_t best_p, best_m, best_s;
                           ^
In file included from ./include/linux/printk.h:336:0,
                 from ./include/linux/kernel.h:14,
                 from ./include/linux/unaligned/access_ok.h:5,
                 from ./include/asm-generic/unaligned.h:13,
                 from ./arch/arm64/include/generated/asm/unaligned.h:1,
                 from drivers/gpu/drm/bridge/sec-dsim.c:17:
./include/linux/dynamic_debug.h:135:3: warning: ‘best_m’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   __dynamic_dev_dbg(&descriptor, dev, fmt, \
   ^
drivers/gpu/drm/bridge/sec-dsim.c:1149:19: note: ‘best_m’ was declared here
  uint32_t best_p, best_m, best_s;
                   ^
In file included from ./include/linux/printk.h:336:0,
                 from ./include/linux/kernel.h:14,
                 from ./include/linux/unaligned/access_ok.h:5,
                 from ./include/asm-generic/unaligned.h:13,
                 from ./arch/arm64/include/generated/asm/unaligned.h:1,
                 from drivers/gpu/drm/bridge/sec-dsim.c:17:
./include/linux/dynamic_debug.h:135:3: warning: ‘best_p’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   __dynamic_dev_dbg(&descriptor, dev, fmt, \
   ^
drivers/gpu/drm/bridge/sec-dsim.c:1149:11: note: ‘best_p’ was declared here
  uint32_t best_p, best_m, best_s;
           ^
"

Although this is a spurious warning according to the code logic, it
is better to give 'best_p', 'best_m' and 'best_s' initial values to
suppress the warnings.

Reported-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Fancy Fang <chen.fang@nxp.com>
6 years agoMLK-21381 arm64: defconfig: Build in drivers to support i.MX8qm/qxp DPU KMS via IT6263
Liu Ying [Thu, 4 Apr 2019 07:45:48 +0000 (15:45 +0800)]
MLK-21381 arm64: defconfig: Build in drivers to support i.MX8qm/qxp DPU KMS via IT6263

This patch builds in some drivers to support i.MX8qm/qxp DPU KMS via IT6263
LVDS to HDMI transmitter.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
6 years agoMLK-21377 arm64: fsl-imx8qm-device.dtsi: Change i2c1_lvds0/1 compatible strings
Liu Ying [Thu, 4 Apr 2019 07:04:06 +0000 (15:04 +0800)]
MLK-21377 arm64: fsl-imx8qm-device.dtsi: Change i2c1_lvds0/1 compatible strings

Add "fsl,imx7ulp-lpi2c" to the compatible strings, as the i2c driver
has only got the compatible string for imx7ulp.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
6 years agoMLK-21376 arm64: fsl-imx8dx.dtsi: Change i2c0_mipi_lvds0/1 compatible strings
Liu Ying [Thu, 4 Apr 2019 05:40:59 +0000 (13:40 +0800)]
MLK-21376 arm64: fsl-imx8dx.dtsi: Change i2c0_mipi_lvds0/1 compatible strings

Replace "fsl,imx8qm-lpi2c" with "fsl,imx7ulp-lpi2c", as the i2c driver
has only got the compatible string for imx7ulp.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
6 years agoMLK-21140 i2c: rpmsg: ensure received bus_id and addr is same as sent
Clark Wang [Thu, 14 Mar 2019 07:28:59 +0000 (15:28 +0800)]
MLK-21140 i2c: rpmsg: ensure received bus_id and addr is same as sent

For some chips may need long time to get the response from M4 sometimes,
enlarge timeout to 500ms.

Add a judgement to check if the received data is the current transfer
wanted.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
(cherry picked from commit 222e201b520cbd01b611fc45ae2f6b2f0b9d73a1)

6 years agoMLK-21023 i2c: rpmsg-imx: add mutex lock when transfer i2c messages
Clark Wang [Tue, 5 Mar 2019 06:56:55 +0000 (14:56 +0800)]
MLK-21023 i2c: rpmsg-imx: add mutex lock when transfer i2c messages

I2c_lock_bus function in i2c-core-base will not stop the transfer to
different devices on different buses at the same time.

Since the multiple rpmsg i2c buses share one rpmsg channel, so it has to
add mutex to protect rpmsg resource accessing.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
(cherry picked from commit d592afe9018e193f675b8c710fb1e66e44851ec8)

6 years agoMLK-20993 i2c: rpmsg: add a BUG_ON to catch alias id issue
Peng Fan [Wed, 27 Feb 2019 01:35:35 +0000 (09:35 +0800)]
MLK-20993 i2c: rpmsg: add a BUG_ON to catch alias id issue

The alias ID must be defined in device tree, because
that will be used as BUS ID to Cortex M4. If the alias ID
not defined, linux kernel will automatically allocate one
ID which might not be the same number used in Cortex M4 and
Cortex M4 will not send msg to I2C controller.

So let's add BUG_ON to catch issue as earlier as possible to avoid
wasting efforts.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Clark Wang <xiaoning.wang@nxp.com>
(cherry picked from commit b9ff20355040d4bece8357a0af31bc5fca191cee)

6 years agoMLK-20940-1 i2c: busses: Add virtual i2c driver based on rpmsg
Clark Wang [Mon, 18 Feb 2019 08:55:09 +0000 (16:55 +0800)]
MLK-20940-1 i2c: busses: Add virtual i2c driver based on rpmsg

Add virtual i2c driver to send SRTM i2c messages to M4.
Each virtual I2C bus has a specal bus id, which is abstracted by M4.
Each SRTM message include a bus id for the bus which the device is on.

Virtual i2c rpmsg bus will bind rpbus nodes with compatible string
"fsl,i2c-rpbus". And "rpmsg-i2c-channel" will probe only one rpmsg
channel for all rpbuses.

This virtual i2c driver depends on CONFIG_I2C and CONFIG_RPMSG.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
(cherry picked from commit 9feeac93a7d91ce67537a8a6c67e624eb7986a01)

6 years agoMLK-21279 drm/bridge: it6263: Staticize it6263_mode_valid()
Liu Ying [Thu, 28 Mar 2019 09:44:49 +0000 (17:44 +0800)]
MLK-21279 drm/bridge: it6263: Staticize it6263_mode_valid()

It is only used in this file, so staticize it.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
(cherry picked from commit e293f8671509ed54c83a51b40da53da3bdf216f5)

6 years agoMLK-21027 drm/bridge: it6263: Reset LVDS some times to wait for in-video stable
Liu Ying [Tue, 5 Mar 2019 07:30:41 +0000 (15:30 +0800)]
MLK-21027 drm/bridge: it6263: Reset LVDS some times to wait for in-video stable

Unstable/low quality input video signal is likely to cause the transmitter
to fail to wait for input video stable, and thus, no HDMI/DVI video output.
It turns out resetting LVDS part logics may help prevent the issue from
happening.

Cc: Sandor Yu <Sandor.yu@nxp.com>
Cc: Jason Liu <jason.hui.liu@nxp.com>
Signed-off-by: Liu Ying <victor.liu@nxp.com>
(cherry picked from commit 5d09098ed14b1199fd1983be8824517c843d46b2)

6 years agoMLK-19485 drm/bridge: it6263: Change LVDS I2C device to be dummy
Liu Ying [Mon, 10 Sep 2018 05:54:37 +0000 (13:54 +0800)]
MLK-19485 drm/bridge: it6263: Change LVDS I2C device to be dummy

The it6263 bridge contains two I2C devices on the same I2C bus
to control HDMI and LVDS modules respectively.  However, they
have different I2C addresses.  Thus, one of the two devices should
be registered as dummy device and bound with dummy driver.  This
is what the helper i2c_new_dummy() is designed for.  The HDMI I2C
device is normally registered as a real I2C device and bound with
a real driver, so the LVDS I2C device should be dummy.

This patch fixes the issue to access the LVDS I2C device's sys nodes,
like /sys/kernel/debug/regmap/2-0033/name.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
(cherry picked from commit f6b3131538de3f25e60a25d85d05d99a4fda680a)

6 years agoMLK-18507 drm/bridge: it6263: Filter out known bad display modes
Liu Ying [Thu, 14 Jun 2018 09:41:58 +0000 (17:41 +0800)]
MLK-18507 drm/bridge: it6263: Filter out known bad display modes

It turns out the following display modes are not well supported
by the bridge - 1600x900@60, 1280x1024@60, 1280x720@30/25/24
and 1152x864@75.  Fortunately, they are not that widely used.
So, list them as the known bad display modes and filter them out
in ->mode_valid().

Signed-off-by: Liu Ying <victor.liu@nxp.com>
(cherry picked from commit c44ed03cf3b85d7f5bc8325ffeec9fd07f66aa87)
(cherry picked from commit 20e29dd98823a19ec3e38fbdcf86b6983268c657)

6 years agoMLK-18297 drm/bridge: it6263: Sleep between status reads in connector detect
Leonard Crestez [Mon, 14 May 2018 03:24:30 +0000 (11:24 +0800)]
MLK-18297 drm/bridge: it6263: Sleep between status reads in connector detect

There are some issues with the HDMI connection on it6263 being slow to
come up. There is a hack there which reads the register multiple times
but it doesn't seem to be sufficient. This is particularly a problem
when inside a xen guest.

Improve this workaround by reading the status multiple times every few
5-10ms and returning connector_status_connected if any of those reads
sees HPDETECT.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit 699ccad27c5476746e0b2c5da25c5a98e6ffab3f)

6 years agoMLK-17275-2: drm/bridge: it6263: Add support for OF_DYNAMIC
Robert Chiras [Thu, 21 Dec 2017 09:04:22 +0000 (11:04 +0200)]
MLK-17275-2: drm/bridge: it6263: Add support for OF_DYNAMIC

When CONFIG_OF_DYNAMIC is used, and this driver is enabled in
devicetree, but fails to probe a physical i2c client, it should disable
it's remote endpoint, so that the DRM master device won't fail to bind
the other available devices.
Usually, the remote endpoint of this device is a DRM encoder. If a DRM
encoder fails to bind, the DRM master device will also fail to bind.
This is why, we should disable the encoder node dynamically in
devicetree.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
(cherry picked from commit de618474e2edebad2c35df322057b6267cd1685b)

6 years agoMLK-16524 drm/bridge: it6263: Fix incorrect colors
Oliver Brown [Thu, 21 Sep 2017 12:39:18 +0000 (07:39 -0500)]
MLK-16524 drm/bridge: it6263: Fix incorrect colors

This addresses a problem with colors that are sometimes incorrect after
startup. Now the AVI packet is initialized with RGB color space rather
than relying on the default.

Signed-off-by: Oliver Brown <oliver.brown@nxp.com>
(cherry picked from commit c1f73434f6d1ab4421020350ef0524d3ac30c703)

6 years agoMLK-16240 drm/bridge: it6263: Don't use freed edid structure in ->get_modes()
Liu Ying [Tue, 22 Aug 2017 07:54:57 +0000 (15:54 +0800)]
MLK-16240 drm/bridge: it6263: Don't use freed edid structure in ->get_modes()

We call the helper drm_detect_hdmi_monitor() to check if the EDID blob read
from a monitor indicates the monitor is connected via HDMI or not.  We pass
an edid structure to the helper.  However, the structure has been freed
before we use it.  This patch moves the helper up before the structure is
freed to fix the issue.

Fixes: a5c01aa91842 ("MLK-15001-25 drm/bridge: Add ITE IT6263 LVDS to HDMI transmitter support")
Signed-off-by: Liu Ying <victor.liu@nxp.com>
(cherry picked from commit 3522359b02888370d910aa59646bac5824f7a0d3)

6 years agoMLK-16207-2 drm/bridge: it6263: 2nd time to workaround cable detection failure
Liu Ying [Thu, 17 Aug 2017 05:55:53 +0000 (13:55 +0800)]
MLK-16207-2 drm/bridge: it6263: 2nd time to workaround cable detection failure

There is cable detection failure issue on i.MX8qxp MEK platform at boot
time when we use single LVDS to HDMI display.  The workaround is to read
the cable detection status for even more times.  Based on experiments, it
looks reading for 90 times works.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
(cherry picked from commit 5ac4dfb7b6b2a75f1167cf773e4cef00ed49124a)

6 years agoMLK-16207-1 drm/bridge: it6263: Add gpio reset support
Liu Ying [Tue, 15 Aug 2017 07:59:44 +0000 (15:59 +0800)]
MLK-16207-1 drm/bridge: it6263: Add gpio reset support

A low pulse whose width is at least 40ms on pin SYSRSTN
may reset the bridge, according to the chip maker.
This patch adds gpio reset support for the bridge.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
(cherry picked from commit 2e120abcef4da663bc63f42a017697c937205598)

6 years agoMLK-16183 drm/bridge: it6263: Workaround cable detection failure at boot time
Liu Ying [Thu, 10 Aug 2017 07:26:09 +0000 (15:26 +0800)]
MLK-16183 drm/bridge: it6263: Workaround cable detection failure at boot time

There is cable detection failure issue on i.MX8qxp arm2 platform
at boot time when we avoid imx-drm deferral probe entirely(i2c
bus driver probe needs to be before the it6263 driver probe).
The workaround is to read the cable detection status multiple
times.  Based on experiments, it looks reading for 40 times works.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
(cherry picked from commit fb719c95e4b7e157c48022eb0295ef517166d944)

6 years agoMLK-15001-25 drm/bridge: Add ITE IT6263 LVDS to HDMI transmitter support
Liu Ying [Mon, 27 Mar 2017 09:26:59 +0000 (17:26 +0800)]
MLK-15001-25 drm/bridge: Add ITE IT6263 LVDS to HDMI transmitter support

This patch adds IT6263 video support.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
(cherry picked from commit bf1acefa6ef424caa4c0b37ae022d25c1028984f)

6 years agoMLK-20702 drm/panel: simple: Fix a minor typo in a piece of comment
Liu Ying [Wed, 9 Jan 2019 02:40:45 +0000 (10:40 +0800)]
MLK-20702 drm/panel: simple: Fix a minor typo in a piece of comment

s/in pratical/in practice

Signed-off-by: Liu Ying <victor.liu@nxp.com>
(cherry picked from commit 15bcff90136b55cc91678ff6e92de6ee1cc3e884)