linux.git
6 years agoregulator: add regulator_desc_list_voltage_linear_range
Matti Vaittinen [Thu, 14 Feb 2019 09:38:05 +0000 (11:38 +0200)]
regulator: add regulator_desc_list_voltage_linear_range

Add regulator_desc_list_voltage_linear_range which can be used
by drivers for getting the voltages before regulator is registered.
This may be useful for drivers which need to fetch the voltage
selectors at device-tree parsing callback.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Acked-by: Mark Brown <broonie@kernel.org>
Tested-by: Angus Ainslie <angus@akkea.ca>
Reviewed-by: Angus Ainslie <angus@akkea.ca>
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit 6a47b4da551a762217215aeeda22e46469c5868a)

6 years agodevicetree: bindings: bd718x7: document HW state related ROHM specific properties
Matti Vaittinen [Thu, 14 Feb 2019 09:34:50 +0000 (11:34 +0200)]
devicetree: bindings: bd718x7: document HW state related ROHM specific properties

Add ROHM BD71837 / BD71847 specific device tree bindings for
controlling the PMIC shutdown/reset states and voltages for
different HW states. The PMIC was designed to be used with NXP
i.MX8 SoC and it supports SNVS low power state which seems to
be typical for NXP i.MX SoCs. However, when SNVS is used we must
not allow SW to control enabling/disabling those regulators which
are crucial for system to boot as there is a HW limitation which
causes SW controlled regulators to be kept shut down after SNVS
reset.

Allow setting the SNVS to be used as reset target state and allow
marking those regulators which are critical for boot.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Tested-by: Angus Ainslie <angus@akkea.ca>
Reviewed-by: Angus Ainslie <angus@akkea.ca>
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit f43d1b388f9be4aa47ed42c33659243a675c5c76)

6 years agoregulator: bd718x7: Constify regulator_ops
Axel Lin [Thu, 24 Jan 2019 10:02:08 +0000 (18:02 +0800)]
regulator: bd718x7: Constify regulator_ops

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit 704c5c01ce6e0d322e2c9555490b39c41e729383)

6 years agoregulator: bd718x7: Change next state after poweroff to ready
Matti Vaittinen [Wed, 7 Nov 2018 13:41:26 +0000 (15:41 +0200)]
regulator: bd718x7: Change next state after poweroff to ready

BD71837 and BD71847 have a HW functionality which leave power
rails OFF after powerof state:
- if they have been controlled by SW.
- if state transition from poweroff is done to SNVS

BD71837 can after reset transition from power-off to SNVS or
READY state depending on reset reason. By default only wathcdog
reset changes state from poweroff to ready. Change PMIC
configuration to always transition to READY in order to avoid
crucial power rails being OFF after reset.

If SNVS is required the crucial power rails should not be
controlled by SW - eg corresponding regulator control register
should have SEL bit kept zero. Currently the driver assumes all
regulators to be controlled by SW so it sets all SEL bits to 1.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit e770b18bbbaecebfb37389b45bf82974a17488d7)

6 years agoregulator: bd718x7: Use regulator_map_voltage_ascend for buck5 and buck7
Axel Lin [Sat, 10 Nov 2018 03:50:03 +0000 (11:50 +0800)]
regulator: bd718x7: Use regulator_map_voltage_ascend for buck5 and buck7

The voltages in bd718xx_3rd_nodvs_buck_volts are in ascendant order, so use
regulator_map_voltage_ascend.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit 2e61286dc6ce10ebce17825cd61031c5fd0289db)

6 years agoregulator: bd718x7: add missing linux/of.h inclusion (deja-vu)
Matti Vaittinen [Mon, 29 Oct 2018 12:16:30 +0000 (14:16 +0200)]
regulator: bd718x7: add missing linux/of.h inclusion (deja-vu)

0-Day tests found compilation error on x86.
Driver won't compile on x86_64 as "of_match_ptr" is
not found. Add missing include <linux/of.h>

At some point this fix was lost. So re-apply it.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit 9cce72448364675ed5d4c793cf546023c003fdd6)

6 years agoregulator: bd718x7: Remove double indirection for bd718xx_pmic_inits.rdatas
Geert Uytterhoeven [Sun, 28 Oct 2018 16:09:22 +0000 (17:09 +0100)]
regulator: bd718x7: Remove double indirection for bd718xx_pmic_inits.rdatas

With gcc 4.1:

    drivers/regulator/bd718x7-regulator.c: In function ‘bd718xx_probe’:
    drivers/regulator/bd718x7-regulator.c:1020: warning: initialization from incompatible pointer type
    drivers/regulator/bd718x7-regulator.c:1024: warning: initialization from incompatible pointer type

Apparently this old compiler can't handle the obscure double
indirection.

However, there is no need for a double indirection.  Just store a
pointer to the array instead, like other drivers tend to do.

Fixes: 494edd266b945f36 ("regulator/mfd: Support ROHM BD71847 power management IC")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit de226ebda96cafa981b9c0fef56888931668b671)

6 years agoregulator: bd718x7: Remove struct bd718xx_pmic
Axel Lin [Thu, 4 Oct 2018 07:25:58 +0000 (15:25 +0800)]
regulator: bd718x7: Remove struct bd718xx_pmic

All the fields in struct bd718xx_pmic are not really necessary.
Remove struct bd718xx_pmic to simplify the code.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit bcb047ebf28453da56f0265aeeb9edc52b797ea7)

6 years agoregulator: bd718xx: fix build warning on x86_64
Matti Vaittinen [Tue, 2 Oct 2018 07:16:50 +0000 (10:16 +0300)]
regulator: bd718xx: fix build warning on x86_64

Casting address to unsigned int causes a warning on some 64 bit
architectures. Fix the cast.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit eb108c3611dd21d5d058cee25fec1c29baf5b0c9)

6 years agoregulator: bd718xx: rename bd71837 to 718xx
Matti Vaittinen [Fri, 14 Sep 2018 08:34:02 +0000 (11:34 +0300)]
regulator: bd718xx: rename bd71837 to 718xx

rename bd71837-regulator.c to bd718x7-regulator.c to reflect the
fact that also BD71847 is now supported by the driver.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit 2ece646c90c5b45dd76c76ea207a3f3459f2c472)

6 years agoregulator: bd718XX use pickable ranges
Matti Vaittinen [Fri, 14 Sep 2018 08:33:11 +0000 (11:33 +0300)]
regulator: bd718XX use pickable ranges

Few regulators in BD71837 and BD71847 can output voltages from
different voltage ranges. Register interface is arranged so that
used range is selected by toggling bits which are not next to actual
voltage selection bits. Then the voltage inside selected range is
determined by voltage selection bits (as usual). Support BD71837
and BD71847 selectible range voltages using new pickable ranges
helpers.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit a4bfc2c28a21f4d5274d813b20fd015a9dc9bcfa)

6 years agoregulator/mfd: bd718xx: rename bd71837/bd71847 common instances
Matti Vaittinen [Fri, 14 Sep 2018 08:32:26 +0000 (11:32 +0300)]
regulator/mfd: bd718xx: rename bd71837/bd71847 common instances

Rename parts of code that support both BD71837 and BD71847 to BD718XX.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit dd2be639f4a918b335818bf22a937956e552b957)

6 years agomfd: dt bindings: add BD71847 device-tree binding documentation
Matti Vaittinen [Fri, 14 Sep 2018 08:30:58 +0000 (11:30 +0300)]
mfd: dt bindings: add BD71847 device-tree binding documentation

Add ROHM BD71847 Power Management IC MFD binding information to
device-tree binding documents.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit 01e17e5d8004f53044c6c9062e04ca118c420512)

6 years agoregulator: Support regulators where voltage ranges are selectable
Matti Vaittinen [Fri, 14 Sep 2018 08:31:36 +0000 (11:31 +0300)]
regulator: Support regulators where voltage ranges are selectable

For example ROHM BD71837 and ROHM BD71847 Power management ICs have
regulators which provide multiple linear ranges. Ranges can be
selected by individual non contagious bit in vsel register. Add
regmap helper functions for selecting ranges.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit 18e4b55fbd2069cee51ef9660b35c65ec13bee6d)

6 years agoregulator: dt bindings: add BD71847 device-tree binding documentation
Matti Vaittinen [Fri, 14 Sep 2018 08:30:06 +0000 (11:30 +0300)]
regulator: dt bindings: add BD71847 device-tree binding documentation

Add ROHM BD71847 Power Management IC regulator binding information to
device-tree binding documents.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit 12fc309a956b82e75db2a19fd36074266bff9413)

6 years agoregulator/mfd: Support ROHM BD71847 power management IC
Matti Vaittinen [Fri, 14 Sep 2018 08:27:46 +0000 (11:27 +0300)]
regulator/mfd: Support ROHM BD71847 power management IC

BD71847 is reduced version of BD71837. DVS bucks 3 and 4 are
removed as is LDO7. Voltage ranges of some regulators are
expanded.

Add initial support for BD71847 with BD71837 driver.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit 494edd266b945f36908184433dd36eda1719cdb0)

6 years agoregulator: regmap helpers - support overlapping linear ranges
Matti Vaittinen [Wed, 22 Aug 2018 09:53:27 +0000 (12:53 +0300)]
regulator: regmap helpers - support overlapping linear ranges

Don't give up voltage mapping if first range with suitable min/max uV
does not provide the wanted voltage.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit e7d80b6b848b4b5f83d3fbee9fd042d036ede9c6)

6 years agoregulator: bd71837: Remove duplicate assignment for n_voltages of LDO2
Axel Lin [Fri, 24 Aug 2018 11:16:12 +0000 (19:16 +0800)]
regulator: bd71837: Remove duplicate assignment for n_voltages of LDO2

Set it once is enough.
Also move n_voltages close to volt_table for better readability.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit 61b2e6741e81226c29a5ed92fd886f11efb78e98)

6 years agoMLK-21388-1 arm64: dts: imx8qxp-mek: Mark pca9646 compatible with nxp,pca9546
Leonard Crestez [Thu, 11 Apr 2019 09:09:34 +0000 (12:09 +0300)]
MLK-21388-1 arm64: dts: imx8qxp-mek: Mark pca9646 compatible with nxp,pca9546

Looking at the datasheet for both parts no special handling is required
in software so upstream support for nxp,pca9546 is acceptable.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Acked-by: Dong Aisheng <aisheng.dong@nxp.com>
6 years agoMLK-21432 clk: imx: only enable clocks for earlycon/earlyprintk port
Fugang Duan [Wed, 10 Apr 2019 10:05:48 +0000 (18:05 +0800)]
MLK-21432 clk: imx: only enable clocks for earlycon/earlyprintk port

Only enable clocks for earlycon or earlyprintk uart port.

For communication uart port, clock enable will break clock
paraent and rate switch by commit 9461f7b33d11 (clk: fix
CLK_SET_RATE_GATE with clock rate protection)

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
6 years agoMLK-21431 arm: dts: imx6sx: remove the dumplicated ocram_s node
Fugang Duan [Wed, 10 Apr 2019 10:14:47 +0000 (18:14 +0800)]
MLK-21431 arm: dts: imx6sx: remove the dumplicated ocram_s node

Remove the dumplicated ocram_s node.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
6 years agoMLK-21430 ARM: clk: imx6sx: remove the duplicated code to set uart clock source
Fugang Duan [Wed, 10 Apr 2019 10:11:15 +0000 (18:11 +0800)]
MLK-21430 ARM: clk: imx6sx: remove the duplicated code to set uart clock source

Remove the duplicated code to set UART clock source that is
introduced by commit 4880bfc5fded (MLK-11414-1 ARM: imx: add
clk return check for imx6sx).

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
6 years agoMLK-21434 ARM64: dts: change the imx8 usdhc compatible properity
Haibo Chen [Wed, 10 Apr 2019 08:53:58 +0000 (16:53 +0800)]
MLK-21434 ARM64: dts: change the imx8 usdhc compatible properity

Change all the iMX8MM/iMX8QXP/iMX8QM usdhc compatible properity
to "fsl,imx8qxp-usdhc", so that it can support eMMC V5.1

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
6 years agommc: sdhci-esdhc-imx: add HS400_ES support for i.MX8QXP
BOUGH CHEN [Mon, 7 Jan 2019 10:11:32 +0000 (10:11 +0000)]
mmc: sdhci-esdhc-imx: add HS400_ES support for i.MX8QXP

Add an new esdhc_soc_data for i.MX8QXP, and add HS400_ES mode
support.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
[Ulf: Rebased on top of latest changes]
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit 029e2476f9e6755ca6cc91922d1d75e856c0820a)

6 years agoMLK-21435 mmc: sdhci: fix the cherry-pick conflicts issue.
Haibo Chen [Wed, 10 Apr 2019 08:05:09 +0000 (16:05 +0800)]
MLK-21435 mmc: sdhci: fix the cherry-pick conflicts issue.

commit 4a26e955522a ("MLK-14539 mmc: sdhci: make no-1-8-v also work
for DDR52 mode") cherry picked by mentor has some conflicts, and they
wrongly handle the conflicts, this patch fix it.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
6 years agommc: sdhci-esdhc-imx: clear the HALT bit when enable CQE
BOUGH CHEN [Wed, 27 Feb 2019 08:24:48 +0000 (08:24 +0000)]
mmc: sdhci-esdhc-imx: clear the HALT bit when enable CQE

After system suspend, CQE is in cqhci_off state, which set the HALT bit, make
CQE in HALT state. If the SoC do not power down the USDHC module, then when
system resume back, this bit keep the same, still set. Though there is a
sdhci reset during sdhci_resume_host(), but this reset do not impact the
CQE part, so need to clear this bit when enable CQE, otherwise CQE will
stuck in the first CMDQ request after system resume back.

Find this issue on NXP i.MX845s-mek board

[  105.919862] mmc2: cqhci: timeout for tag 6
[  105.923965] mmc2: cqhci: ============ CQHCI REGISTER DUMP ===========
[  105.930407] mmc2: cqhci: Caps:      0x0000310a | Version:  0x00000510
[  105.936847] mmc2: cqhci: Config:    0x00001001 | Control:  0x00000001
[  105.943286] mmc2: cqhci: Int stat:  0x00000000 | Int enab: 0x00000006
[  105.949725] mmc2: cqhci: Int sig:   0x00000006 | Int Coal: 0x00000000
[  105.956164] mmc2: cqhci: TDL base:  0x7809b000 | TDL up32: 0x00000000
[  105.962604] mmc2: cqhci: Doorbell:  0x00000040 | TCN:      0x00000000
[  105.969043] mmc2: cqhci: Dev queue: 0x00000000 | Dev Pend: 0x00000000
[  105.975483] mmc2: cqhci: Task clr:  0x00000000 | SSC1:     0x00011000
[  105.981922] mmc2: cqhci: SSC2:      0x00000001 | DCMD rsp: 0x00000000
[  105.988362] mmc2: cqhci: RED mask:  0xfdf9a080 | TERRI:    0x00000000
[  105.994801] mmc2: cqhci: Resp idx:  0x00000000 | Resp arg: 0x00000000
[  106.001240] mmc2: sdhci: ============ SDHCI REGISTER DUMP ===========
[  106.007680] mmc2: sdhci: Sys addr:  0xb2b37800 | Version:  0x00000002
[  106.014120] mmc2: sdhci: Blk size:  0x00000200 | Blk cnt:  0x00000001
[  106.020560] mmc2: sdhci: Argument:  0x00010000 | Trn mode: 0x00000013
[  106.026999] mmc2: sdhci: Present:   0x01f88008 | Host ctl: 0x00000030
[  106.033439] mmc2: sdhci: Power:     0x00000002 | Blk gap:  0x00000080
[  106.039878] mmc2: sdhci: Wake-up:   0x00000008 | Clock:    0x0000000f
[  106.046318] mmc2: sdhci: Timeout:   0x0000008f | Int stat: 0x00000000
[  106.052757] mmc2: sdhci: Int enab:  0x107f4000 | Sig enab: 0x107f4000
[  106.059196] mmc2: sdhci: AC12 err:  0x00000000 | Slot int: 0x00000502
[  106.065635] mmc2: sdhci: Caps:      0x07eb0000 | Caps_1:   0x8000b407
[  106.072075] mmc2: sdhci: Cmd:       0x00000d1a | Max curr: 0x00ffffff
[  106.078514] mmc2: sdhci: Resp[0]:   0x00000900 | Resp[1]:  0x31360181
[  106.084954] mmc2: sdhci: Resp[2]:   0x44473430 | Resp[3]:  0x00450100
[  106.091392] mmc2: sdhci: Host ctl2: 0x00000008
[  106.095836] mmc2: sdhci: ADMA Err:  0x00000000 | ADMA Ptr: 0x7804b208
[  106.102274] mmc2: sdhci: ============================================
[  106.108785] mmc2: running CQE recovery

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit 85236d2be844ade0bd8b34e3626fc3e36498cd85)

6 years agommc: sdhci-esdhc-imx: clear ESDHC_STD_TUNING_EN for manual tuning method
BOUGH CHEN [Thu, 20 Dec 2018 11:57:41 +0000 (11:57 +0000)]
mmc: sdhci-esdhc-imx: clear ESDHC_STD_TUNING_EN for manual tuning method

The bit ESDHC_STD_TUNING_EN may be configed by bootloader code if it
choose to use standard tuning method. So on linux side, if choose to
use manual tuning method, need to clear the bit ESDHC_STD_TUNING_EN,
remove the impact of bootloader code.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit a98c557e2af3e12e38dee6019a5cf210156d629e)

6 years agoASoC: fsl: imx-wm8962: Fix error path
Fabio Estevam [Thu, 18 Jul 2013 18:07:48 +0000 (15:07 -0300)]
ASoC: fsl: imx-wm8962: Fix error path

If the 'failed to find codec platform device' error path is executed, it should
jump to 'fail' label instead of returning an error immediately.

'fail' label will then free the ssi_np and codec_np previously acquired nodes.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit d8a14e302ffeecc312186b8b9b0efc8963cec83b)

6 years agoMLK-21107-1: ASoC: Fix timer wake up system after suspend
Shengjiu Wang [Thu, 7 Mar 2019 03:09:17 +0000 (11:09 +0800)]
MLK-21107-1: ASoC: Fix timer wake up system after suspend

Fixes commit 4028bd0f76fd ("MLK-21002-2: ASoC: imx-pcm-rpmsg: don't
remove timer at suspend")

if the timer isn't removed at suspend, there will be interrupt
from M4 side when the period size is small to wake up system quickly
So we need to revert the previous fix and add timer in resume state

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

6 years agoMLK-20661: ASoC: imx-pcm-rpmsg: remove the nonblock constraint
Shengjiu Wang [Thu, 27 Dec 2018 06:48:06 +0000 (14:48 +0800)]
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>
(cherry picked from commit 545031216a5a7b91f1a50e2f8e39f9672e76c8f8)

6 years agoMLK-21002-1: ASoC: imx-pcm-rpmsg: fix data consumed faster with pause
Shengjiu Wang [Wed, 27 Feb 2019 05:58:26 +0000 (13:58 +0800)]
MLK-21002-1: ASoC: imx-pcm-rpmsg: fix data consumed faster with pause

In LPA, we use the timer to simulate the interrupt, if the period time
is 1s, the timer is 500ms, which means the interrupt is more frequent
than actual.

With pause ALSA will update the hw_ptr_jiffies, because the interrupt
is more frequent, so sometimes in snd_pcm_update_hw_ptr0, the condition
delta > new_hw_ptr will be true, then the new_hw_ptr will be added whole
buffer_size, which cause the whole buffer be flushed.

if (in_interrupt) {
/* we know that one period was processed */
/* delta = "expected next hw_ptr" for in_interrupt != 0 */
delta = runtime->hw_ptr_interrupt + runtime->period_size;
if (delta > new_hw_ptr) {
/* check for double acknowledged interrupts */
hdelta = curr_jiffies - runtime->hw_ptr_jiffies;
if (hdelta > runtime->hw_ptr_buffer_jiffies/2 + 1) {
hw_base += runtime->buffer_size;
if (hw_base >= runtime->boundary) {
hw_base = 0;
crossed_boundary++;
}
new_hw_ptr = hw_base + pos;
goto __delta;
}
}
}

So even we use the timer to simulate the interrupt, the timer should
be same as the period time, otherwise will cause issue.

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

6 years agoMLK-20183-2: ASoC: imx-cdnhdmi: reconfigure the mclk for HDMI on imx8mq
Shengjiu Wang [Fri, 2 Nov 2018 09:47:51 +0000 (17:47 +0800)]
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>
(cherry picked from commit 3bc7e6bcca6613e43b7dab98b5a16d2c8097d29e)

6 years agoMLK-19565-1: ASoC: fsl_rpmsg_i2s: support rpmsg on imx8qm
Shengjiu Wang [Thu, 13 Sep 2018 05:07:47 +0000 (13:07 +0800)]
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)
(cherry picked from commit dd108f1dd88feb55cd9a31f135ae6481b8e6774b)

6 years agoMLK-21107-2: ASoC: Drop msg if msg queue is full
Shengjiu Wang [Thu, 7 Mar 2019 03:01:06 +0000 (11:01 +0800)]
MLK-21107-2: ASoC: Drop msg if msg queue is full

We designed length of msg queue to be 0x18, which is too
small if the period size = 512bytes, sometimes the queue
will be full, which cause the msg is replaced by new one.
which is not acceptable.

So we need to enlarge the length of msg queue and add
protection when msg queue is full, if the msg queue is full
with the cmd (START, STOP, PAUSE...), driver will return
error,  with the cmd (I2S_TX_POINTER, I2S_TX_PERIOD_DONE)
driver will drop the cmd.

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

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>