linux.git
6 years agoMLK-20191-2: media: mxc: fix potential null pointer dereferencing
Guoniu.Zhou [Wed, 3 Apr 2019 08:21:56 +0000 (16:21 +0800)]
MLK-20191-2: media: mxc: fix potential null pointer dereferencing

CID 17797 and 3275140: fix potential null pointer dereferencing.

Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
6 years agoMLK-20191-1: media: mxc: fix unsigned compare
Guoniu.Zhou [Wed, 3 Apr 2019 08:13:44 +0000 (16:13 +0800)]
MLK-20191-1: media: mxc: fix unsigned compare

Fix coverity CID 17388, 17389 and 17363 issue
Because the type of variable is unsigned, so compare with zero is no
effect

Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
6 years agoMLK-21317 drm/imx: core: fix dangling pointer use of 'drm_device'
Fancy Fang [Wed, 3 Apr 2019 07:57:34 +0000 (15:57 +0800)]
MLK-21317 drm/imx: core: fix dangling pointer use of 'drm_device'

When any fail happens during master's '>bind()' function, the
drm_device' pointer data which is set to the device driver data
will be put and freed. But if later, system suspend is called,
the freed 'drm_device' pointer will be used again.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
6 years agoMLK-21309: dma: engine: sdma: add uart rom script
Robin Gong [Tue, 2 Apr 2019 07:19:43 +0000 (15:19 +0800)]
MLK-21309: dma: engine: sdma: add uart rom script

For syncing with unstreaming kernel on UART driver from 4.19 changed
to rom script for uart rx path, and the compatiblity of legacy kernel
using ram script, add both uart rom and ram script support, so add
rom script address.

ram script:
uart_2_mcu_fix_addr
uartsh_2_mcu_fix_addr /* through spba bus */
rom script:
uart_2_mcu_addr
uartsh_2_mcu_addr /* through spba bus */

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
6 years agoMLK-21252 drm/bridge: sec-dsim: resolve OVERFLOW_BEFORE_WIDEN warns
Fancy Fang [Sat, 30 Mar 2019 14:47:54 +0000 (22:47 +0800)]
MLK-21252 drm/bridge: sec-dsim: resolve OVERFLOW_BEFORE_WIDEN warns

Coverity reports the 'OVERFLOW_BEFORE_WIDEN' warns which can
cause potential expression overflow for multiplying two 32bit
integers and assign the result to a 64bit integer, since no
automatic integer type promotion exists before the multiply
operation, so requires explicit type casting for either one
of operands.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
6 years agoMLK-21299 ARM64: dts: imx8mm-evk: add interrupt support for ADV7535
Fancy Fang [Fri, 29 Mar 2019 12:31:59 +0000 (20:31 +0800)]
MLK-21299 ARM64: dts: imx8mm-evk: add interrupt support for ADV7535

Add interrupt and related pinctrl properties for ADV7535,
the interrupt can be used for hotplug, edid ready and etc
in the adv bridge driver.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
6 years agoASoC: fsl_spdif: add missing PLL initialization part
Viorel Suman [Tue, 2 Apr 2019 06:59:46 +0000 (09:59 +0300)]
ASoC: fsl_spdif: add missing PLL initialization part

Add missing PLL initialization part in probe.

Fixes: bbbb22d49397774e1a009f1023e6b66e72e5ccf7
Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
6 years agoMLK-18574: ASoC: fsl_spdif: support 192kHz for rx in imx8
Shengjiu Wang [Mon, 11 Jun 2018 07:54:03 +0000 (15:54 +0800)]
MLK-18574: ASoC: fsl_spdif: support 192kHz for rx in imx8

The ipg clock is higher enough to support 192kHz in imx8

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit 8b43702a18134ce837e36650d6b6e4ddffd12cea)

6 years agoMLK-18574: ASoC: fsl_spdif: specify the spdif in imx8mm
Shengjiu Wang [Tue, 12 Jun 2018 07:46:27 +0000 (15:46 +0800)]
MLK-18574: ASoC: fsl_spdif: specify the spdif in imx8mm

specify the spdif in imx8mm for the ipg clock is higher that
it can support 192kHz

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit bfae9cfe49f5176ad816bf98d076ba7b0fc95593)

6 years agoMLK-17089-4: ASoC: fsl_spdif: support suspend & resume for imx8
Shengjiu Wang [Wed, 6 Dec 2017 02:42:30 +0000 (10:42 +0800)]
MLK-17089-4: ASoC: fsl_spdif: support suspend & resume for imx8

Base on latest power management design in MLK-17074, every driver
need to enter runtime suspend state in suspend, so the driver should
call the pm_runtime_force_suspend in suspend. with this implementation
the suspend function almost same as runtime suspend function. so remove
the suspend function, just use pm_runtime_force_suspend instead.

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

6 years agoASoC: fsl: micfil: use component API
Viorel Suman [Mon, 1 Apr 2019 14:15:33 +0000 (17:15 +0300)]
ASoC: fsl: micfil: use component API

Use component API.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
6 years agoMLKU-24 ASoC: micfil: fix identation issue
Cosmin-Gabriel Samoila [Thu, 13 Dec 2018 13:09:46 +0000 (15:09 +0200)]
MLKU-24 ASoC: micfil: fix identation issue

Fix identation issue.

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit f6869d289a3d1bbbb38eefaf79e458fb620f887d)

6 years agoMLKU-24-10 sound: asoc: change License comment to SPDX format
Cosmin-Gabriel Samoila [Wed, 21 Nov 2018 09:20:33 +0000 (11:20 +0200)]
MLKU-24-10 sound: asoc: change License comment to SPDX format

Change source and header License comment to SPDX format.

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
(cherry picked from commit a0953e2a808fc3dbdacdfb959f121d24d7ddf4c2)

6 years agoMLKU-24-9 sound: soc: fix unused warning
Cosmin-Gabriel Samoila [Tue, 20 Nov 2018 12:21:45 +0000 (14:21 +0200)]
MLKU-24-9 sound: soc: fix unused warning

When CONFIG_PM is not defined, the runtime suspend and resume
are unused so we should use __maybe_unused attribute.

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
(cherry picked from commit 2d68f7ccaae4e787072724445af3a46e51aba3ad)

6 years agoMLKU-24-8 sound:asoc: change soc_enum array to single enums
Cosmin-Gabriel Samoila [Wed, 14 Nov 2018 12:50:26 +0000 (14:50 +0200)]
MLKU-24-8 sound:asoc: change soc_enum array to single enums

It is error prone to use soc_enum array for controls because introducing
new controls must always be done at the end of array or it will add
offset to existing controls.

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
(cherry picked from commit 08004f69efadd4b0631c2759a171811885ac8bbd)

6 years agoMLKU-24-7 sound:asoc: fix checkpatch paranthesis error
Cosmin-Gabriel Samoila [Wed, 14 Nov 2018 13:09:31 +0000 (15:09 +0200)]
MLKU-24-7 sound:asoc: fix checkpatch paranthesis error

Remove paranthesis that are not needed.

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
(cherry picked from commit 24f3cee476a47145a30b2d1bf5ac315ae803c176)

6 years agoMLKU-24-6 sound:asoc: remove comented code
Cosmin-Gabriel Samoila [Wed, 14 Nov 2018 13:07:06 +0000 (15:07 +0200)]
MLKU-24-6 sound:asoc: remove comented code

Remove unused commented code.

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
(cherry picked from commit 16ffacb71902f787af4e6195d2c0877fa39a1501)

6 years agoMLKU-24-5 sound:asoc: remove multiple empty rows
Cosmin-Gabriel Samoila [Wed, 14 Nov 2018 13:06:10 +0000 (15:06 +0200)]
MLKU-24-5 sound:asoc: remove multiple empty rows

Fix checkpatch error by removin extra empty rows.

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
(cherry picked from commit ac19946a883a754f65143f40b448719c9d4b1164)

6 years agoMLKU-24-4 sound:asoc: fix checkpatch braces error
Cosmin-Gabriel Samoila [Wed, 14 Nov 2018 13:04:31 +0000 (15:04 +0200)]
MLKU-24-4 sound:asoc: fix checkpatch braces error

Braces {} are not necessary for single statement blocks.

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
(cherry picked from commit 70bb5d3352894c145f3aa8959963a061d023c769)

6 years agoMLKU-24-3 sound:asoc: fix missing space after if checkpatch errors
Cosmin-Gabriel Samoila [Wed, 14 Nov 2018 13:01:23 +0000 (15:01 +0200)]
MLKU-24-3 sound:asoc: fix missing space after if checkpatch errors

In order to upstream the micfil driver, we need to fix
missing space after if errors and warnings reported
by checkpatch.

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
(cherry picked from commit d24e03b63cd428e0ba1e79f617f48106d11bb3db)

6 years agoMLKU-24-2 sound:asoc: fix line over 80 char errors
Cosmin-Gabriel Samoila [Wed, 14 Nov 2018 12:58:46 +0000 (14:58 +0200)]
MLKU-24-2 sound:asoc: fix line over 80 char errors

In order to upstream the micfil driver, we need to fix
line over 80 characters errors and warnings reported
by checkpatch.

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
(cherry picked from commit 5c09dded509ff579cba4897db336765de795196b)

6 years agoMLKU-24-1 sound:asoc: fix alignment and code indent errors
Cosmin-Gabriel Samoila [Wed, 14 Nov 2018 12:55:15 +0000 (14:55 +0200)]
MLKU-24-1 sound:asoc: fix alignment and code indent errors

In order to upstream the micfil driver, we need to fix allignment
and code indent errors and warnings reported by checkpatch.

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
(cherry picked from commit b044c83f592617b2d3011a1759db90f378ccd645)

6 years agoMLK-20308 sound:asoc: fix re-enablement bug
Cosmin-Gabriel Samoila [Tue, 13 Nov 2018 12:34:36 +0000 (14:34 +0200)]
MLK-20308 sound:asoc: fix re-enablement bug

When hwvad is enabled, if you try to re-enable it again, it should fail.
However, we were also double setting state to OFF on fail, which is
wrong because it resets the state and allows the second retry to enable
even if it wasn't disabled before.
Now we only return EBUSY.

Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
(cherry picked from commit 1ef8c4696c0b0c1e4a0f384dd7300d4dab293f3b)

6 years agoMLK-20189 sound: asoc: fix unsigned compared against 0
Cosmin-Gabriel Samoila [Tue, 13 Nov 2018 12:05:56 +0000 (14:05 +0200)]
MLK-20189 sound: asoc: fix unsigned compared against 0

An unsigned value can never be negative, so this test will always
evaluate the same way.

Fixes Coverity issue CID3618200

Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
(cherry picked from commit 3055c2dfd959a72464efcc225861e398f666c4dd)

6 years agoMLK-20189 sound: asoc: fix dereference before null check
Cosmin-Gabriel Samoila [Tue, 13 Nov 2018 11:35:45 +0000 (13:35 +0200)]
MLK-20189 sound: asoc: fix dereference before null check

There may be a null pointer dereference, or else the comparison against
null is unnecessary.

Fixes Coverity issue CID5327850

Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
(cherry picked from commit 5e9a805edcd8e07d3587480ffb89a27ad5bc0248)

6 years agoMLK-20253 sound: asoc: remove verbose messages from micfil
Cosmin-Gabriel Samoila [Tue, 6 Nov 2018 11:34:46 +0000 (13:34 +0200)]
MLK-20253 sound: asoc: remove verbose messages from micfil

Enable and disable procedures contain info and warn prints. This
introduces delay in initialization / disablement procedures and we have
kept only the necessary prints in case of error.

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 2ca09a02c25c72b6aa47fab90d4a91b07d5694e6)

6 years agoMLK-20100 sound: asoc: make hwvad work after system suspend/resume
Cosmin-Gabriel Samoila [Wed, 31 Oct 2018 15:00:02 +0000 (17:00 +0200)]
MLK-20100 sound: asoc: make hwvad work after system suspend/resume

Implemented system suspend resume functions to call hwvad enable/disable
then do runtime_force_suspend/resume.
Since hwvad can run independently, when user calls enable/disable, we
will have to increment/decrement usage counter by calling
runtime_*_sync but to avoid doing this when disable/enable is called
from system_suspend/resume since we called pm_runtime functions - this
is why we have added the sync parameter in enable/disable_hwvad.
However, we ignore the busy flag because the module wasn't designed to
work with arecord and hwvad in parralel and we only print a warning.
Since hwvad and recording share the same clock and initialization
procedures require module to be disabled, the busy flag will be set
when having both features enabled.

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
(cherry picked from commit a73d9054a42b159e68b56b93f8834b121e82cde5)

6 years agoMLK-20102 sound: asoc: fix VAD channel select
Cosmin-Gabriel Samoila [Tue, 30 Oct 2018 11:54:11 +0000 (13:54 +0200)]
MLK-20102 sound: asoc: fix VAD channel select

The documentation specifies that VADCHSEL is used to select
the channel number on which hwvad detector will work. However,
we have used this field wrong (similar to the recording where
you can enable, disable multiple channels at the time).
This patch fixes hwvad and you can enable it by writing 0 to 7
in /sys/devices/platform/30080000.micfil/hwvad/enable or any
other number to disable it.

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
(cherry picked from commit 4fdc1ca670db2f93362e8abde2707d98a7e450ff)

6 years agoMLK-19662 sound: asoc: add support for recording and hwvad in parallel
Cosmin-Gabriel Samoila [Mon, 29 Oct 2018 12:15:05 +0000 (14:15 +0200)]
MLK-19662 sound: asoc: add support for recording and hwvad in parallel

Remove all clock disable from driver suspend/hwvad_disable
to avoid crashing one or another when recording stops or
voice is detected and hwvad is disabled.
Another change done to make this work is to remove atomic
variables that guard mutual exclusion between recording and
VAD.
We have also added a restriction such that recording rate
should be the same as hwvad rate when hwvad is enabled to
avoid changing the mclk rate.
However, the hwvad can be enabled before or after recording
but not when recording is done. On the other hand, recording
can be triggered at any time.
I am not sure we are supposed to support recording and hwvad
in parallel since micfil documentation requires PDM to be
disabled when any initialization or reconfiguration of hwvad
is done. An workaround to make this working is never disabling
the pdm module from hwvad functions and this seems to work,
even we are not following the whole reconfiguration procedure.

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit bd0c73a0b4367be6a204667aa9c261a23b13516e)

6 years agoMLK-19936-4: sound: asoc:add clock source control in alsa mixer
Cosmin-Gabriel Samoila [Tue, 16 Oct 2018 12:08:59 +0000 (15:08 +0300)]
MLK-19936-4: sound: asoc:add clock source control in alsa mixer

Add control to select clock source from alasamixer or select
auto mode where clock source is automatically selected.

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
(cherry picked from commit 8e8f2fb3abf0375b4329f989490bf6cf9c308fc4)

6 years agoMLK-19936-1 : sound: asoc: add support for different sample rates
Cosmin-Gabriel Samoila [Mon, 15 Oct 2018 12:16:49 +0000 (15:16 +0300)]
MLK-19936-1 : sound: asoc: add support for different sample rates

At this moment, using audio_pll1 offers accurate clock for 48KHz only
and audio_pll2 offers accurate clock for 44.1KHz only.
With this patch, we dynamically switch between audio PLL1 and audio
PLL2 to support both 48KHz and 44.1KHZ rates.

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
(cherry picked from commit b7971ed41fd9d230706062638e5262b4658e9b5a)

6 years agoMLK-16784-6 arm64: config: add micfil in defconfig
Cosmin-Gabriel Samoila [Thu, 31 May 2018 11:40:01 +0000 (14:40 +0300)]
MLK-16784-6 arm64: config: add micfil in defconfig

Add IMX_MICFIL in arm64 defconfig.

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
(cherry picked from commit bf5db2a332b104cae740796f5d07ddb627015fec)

6 years agoMLK-19936-3: sound: asoc: add rate in machine driver hw_params func
Cosmin-Gabriel Samoila [Mon, 15 Oct 2018 12:21:55 +0000 (15:21 +0300)]
MLK-19936-3: sound: asoc: add rate in machine driver hw_params func

Add rate when calling dai sysclk so we can set rate after
we change the pdm_src parrent.

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
(cherry picked from commit d9c88e7babb604f07f0dcf099b3f523a839ed20e)

6 years agoMLK-16784-5 sound: asoc: add machine driver for micfil in iMX8MM
Cosmin-Gabriel Samoila [Thu, 31 May 2018 07:40:57 +0000 (10:40 +0300)]
MLK-16784-5 sound: asoc: add machine driver for micfil in iMX8MM

Add machine driver for micfill IP in iMX8MM.

Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
(cherry picked from commit 3c788dfc51a44bde546572e519cac8cfca3d8f2d)

6 years agoMLK-21209 ARM: dts: imx7s: remove duplicated timer node
Anson Huang [Mon, 1 Apr 2019 01:21:45 +0000 (09:21 +0800)]
MLK-21209 ARM: dts: imx7s: remove duplicated timer node

Remove duplicated timer node to make linux kernel boot up
successfully.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Bai Ping <ping.bai@nxp.com>
6 years agoMLK-20546-2: drm/imx/dcss: check status bit when handling interrupts
Laurentiu Palcu [Mon, 25 Mar 2019 12:29:17 +0000 (14:29 +0200)]
MLK-20546-2: drm/imx/dcss: check status bit when handling interrupts

Double check that the DTG IRQ STATUS register bit is set when handling
the vblank and CTXLD kick interrupts to make sure we avoid spurious
interrupts and kick the CTXLD in a bad moment.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
6 years agoMLK-20546-1: drm/imx/dcss: fix crtc enable/disable completion signalling
Laurentiu Palcu [Fri, 18 Jan 2019 07:15:40 +0000 (09:15 +0200)]
MLK-20546-1: drm/imx/dcss: fix crtc enable/disable completion signalling

Using one completion variable is not feasible as we can hit corner cases like
enabling and then quickly disabling DCSS where we end up signaling that DTG was
correctly disabled when, in fact, a VBLANK interrupt was received.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
6 years agoMLK-21249: drm/imx/hdp: do not set BT2020 colorimetry for 8bit color depth
Laurentiu Palcu [Thu, 21 Mar 2019 07:02:53 +0000 (09:02 +0200)]
MLK-21249: drm/imx/hdp: do not set BT2020 colorimetry for 8bit color depth

Currently, we set the colorimetry to BT.2020 even if the color-depth is
8 bit. This is not according to HDMI specification.

This patch makes sure we follow the specs.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
CC: Sandor Yu <sandor.yu@nxp.com>
Reviewed-by: Sandor Yu <sandor.yu@nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
6 years agoMLK-20195-2 hdp: fix dead code error
Oliver Brown [Fri, 22 Mar 2019 19:42:55 +0000 (14:42 -0500)]
MLK-20195-2 hdp: fix dead code error

Fixed a dead code error reported by Coverity.
CID 1826265: Logically dead code

Signed-off-by: Oliver Brown <oliver.brown@nxp.com>
6 years agoMLK-20195-1 hdp: fix uninitialized variables
Oliver Brown [Fri, 22 Mar 2019 19:42:18 +0000 (14:42 -0500)]
MLK-20195-1 hdp: fix uninitialized variables

Fixed two issues resported by Coverity:
CID 343354: Uninitialized scalar variable
CID 343355: Uninitialized scalar variable

Signed-off-by: Oliver Brown <oliver.brown@nxp.com>
6 years agoMLK-20209 hdmi: fixed unsigned compare against less than zero
Oliver Brown [Fri, 22 Mar 2019 18:38:20 +0000 (13:38 -0500)]
MLK-20209 hdmi: fixed unsigned compare against less than zero

Fixed CID 17375, Unsigned compared against 0. Removed code with no effect.

Signed-off-by: Oliver Brown <oliver.brown@nxp.com>
6 years agoMLK-20217-2 drm/imx: imx-tve: Fix build warning
Oliver Brown [Sat, 23 Mar 2019 18:59:49 +0000 (13:59 -0500)]
MLK-20217-2 drm/imx: imx-tve: Fix build warning

Fixed a build warning for uninitialized variable.

Signed-off-by: Oliver Brown <oliver.brown@nxp.com>
6 years agoMLK-20217 drm/imx: imx-tve: Fix potential divide by zero
Oliver Brown [Fri, 22 Mar 2019 17:41:47 +0000 (12:41 -0500)]
MLK-20217 drm/imx: imx-tve: Fix potential divide by zero

Coverity reported a potential divide by zero. Adding a check to prevent
a divide by zero.

Signed-off-by: Oliver Brown <oliver.brown@nxp.com>
6 years agoMLK-21227: drm: imx: hdp: imx8: Change link rate message
Oliver Brown [Fri, 22 Mar 2019 13:29:01 +0000 (08:29 -0500)]
MLK-21227: drm: imx: hdp: imx8: Change link rate message

Changing error message "Link rate is too high - forcing link to lower rate"
to a debug message "Lowering DP link rate from <old rate> to <new rate>".

Signed-off-by: Oliver Brown <oliver.brown@nxp.com>
6 years agoMLK-21169: HDP: Fix CDN_API_DPTX_ForceLanes_blocking hang issue
Sandor Yu [Mon, 18 Mar 2019 07:58:24 +0000 (15:58 +0800)]
MLK-21169: HDP: Fix CDN_API_DPTX_ForceLanes_blocking hang issue

Error implement in function CDN_API_DPTX_ForceLanes_blocking,
it should call function CDN_API_DPTX_ForceLanes.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
6 years agoMLK-21028-1 drm/imx: dcss-kms: Use a work queue of it's own for nonblock commits
Liu Ying [Fri, 15 Mar 2019 03:18:18 +0000 (11:18 +0800)]
MLK-21028-1 drm/imx: dcss-kms: Use a work queue of it's own for nonblock commits

DPU KMS would use a freezable and unbound work queue for nonblock commits
to prevent stall from happening during the system suspend operations in the
coming commits.  In order to make sure DCSS KMS has the same nonblock commit
behaviour as before, the two drivers may have a work queue of their own
respectively.  So, let's make the work queues be driver specific.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
6 years agoMLK-21093 gpu: imx: dcss: remove "error" from informative message
Oliver Brown [Thu, 14 Mar 2019 14:53:14 +0000 (09:53 -0500)]
MLK-21093 gpu: imx: dcss: remove "error" from informative message

Change the log message to report "difference is" instead of "error is" to
avoid confusion. This message is just reports the actual pixel clock for
informational purposes. It is not an actual error.

Signed-off-by: Oliver Brown <oliver.brown@nxp.com>
6 years agoMLK-21046-2 drm: imx: hdp: imx8qm: Change the HDMI TX clocks.
Oliver Brown [Mon, 4 Mar 2019 22:30:37 +0000 (16:30 -0600)]
MLK-21046-2 drm: imx: hdp: imx8qm: Change the HDMI TX clocks.

Change the default HDMI clocks to 800 MHz for DPLL, 200 MHz for
core,  and 100MHz for bus.

Signed-off-by: Oliver Brown <oliver.brown@nxp.com>
6 years agoMLK-21032-2: DP: Add DP link status check
Sandor Yu [Mon, 4 Mar 2019 07:12:39 +0000 (15:12 +0800)]
MLK-21032-2: DP: Add DP link status check

DP driver will hang if driver initialized in un-linked status.
Add DP link status check to avoid system hang.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
6 years agoMLK-21032-1: DP: return correct read size for DPCD read function
Sandor Yu [Mon, 4 Mar 2019 07:53:28 +0000 (15:53 +0800)]
MLK-21032-1: DP: return correct read size for DPCD read function

DPCD read function should return actual read size.
msg->size is the requested read size
so replaced it with read_resp.size.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
6 years agoMLK-20995-2: hdmi: fix avi info frame failed when hdmi in 4kp30
Sandor Yu [Wed, 27 Feb 2019 07:02:14 +0000 (15:02 +0800)]
MLK-20995-2: hdmi: fix avi info frame failed when hdmi in 4kp30

AVI info frame will failed work when hdmi in 4kp30/24/25.
It is caused by the data is overwritten by hdmi vendor info frame.
Change the hdmi vendor info frame to different address.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
6 years agoMLK-20995-1: hdmi: Remove return value check for hdmi_vendor_info function
Sandor Yu [Wed, 27 Feb 2019 06:50:10 +0000 (14:50 +0800)]
MLK-20995-1: hdmi: Remove return value check for hdmi_vendor_info function

hdmi_vendor_info function only valid for HDMI1.4 4K video mode,
remove return value check.
Remove dumplicate hdmi_avi_info_set function call.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
6 years agoMLK-20994: hdmi: Add max tmds clock check in deep color mode
Sandor Yu [Wed, 27 Feb 2019 06:44:37 +0000 (14:44 +0800)]
MLK-20994: hdmi: Add max tmds clock check in deep color mode

Add max tmds clock check in deep color mode.
Make sure tmds clock is not excess hdmi sink capability.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
6 years agoMMFMWK-8413: video/hdmi: Fix DRM info-frame packing
Laurentiu Palcu [Fri, 22 Feb 2019 10:41:19 +0000 (12:41 +0200)]
MMFMWK-8413: video/hdmi: Fix DRM info-frame packing

The hdmi_drm_infoframe_pack() was wrongly packing the HDR metadata. It
was setting the x display primaries followed by the y display primaries.
Instead, in the specifications, each x display primary should be
followed by the corresponding y display primary.

Also, byte 8 of the frame payload was being skipped. Fixed that too.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
Reported-by: Jared Hu <jared.hu@nxp.com>
6 years agoMLK-20961 drm: imx: hdp: Check the content protection property first.
Oliver Brown [Thu, 21 Feb 2019 12:44:01 +0000 (06:44 -0600)]
MLK-20961 drm: imx: hdp: Check the content protection property first.

Need to check the content protection property first in
imx_hdp_imx_encoder_enable. The function may return if
drm_hdmi_infoframe_set_hdr_metadata returns an error. This was preventing
iMX8QM from enabling content protection.

Signed-off-by: Oliver Brown <oliver.brown@nxp.com>
6 years agoMLK-20931: drm/imx/dcss: Add scaler 5 tap filter back for YUV
Laurentiu Palcu [Thu, 14 Feb 2019 08:39:21 +0000 (10:39 +0200)]
MLK-20931: drm/imx/dcss: Add scaler 5 tap filter back for YUV

The following commit:

459a5fac54d - MLK-20263: drm/imx/dcss: fix channel-0 line shift

removed the 5 tap filter for vertical luma/chroma when YUV formats were
used.

Problem is that when the 7 tap filter is used for vertical luma/chroma,
artifacts can be seen on screen when scaling.

RGB can, however, function correctly with only 7 tap filter.

This patch partially reverts the above patch and also does some cosmetic
changes when calling the dcss_scaler_filter_design() using false/true
instead of 0/1 for use_5_taps argument.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
6 years agoMLK-20892-2 drm: imx: hdp: Add support for HDCP
Oliver Brown [Tue, 5 Feb 2019 01:10:01 +0000 (03:10 +0200)]
MLK-20892-2 drm: imx: hdp: Add support for HDCP

Adding support for HDCP 1.4 and 2.2 based upon upstream 4.19 kernel
use of "Content Protection" connector property.

Signed-off-by: Oliver Brown <oliver.brown@nxp.com>
6 years agoMLK-20892-1 mxc: hdp: Fixing coding style in HDCP API functions
Oliver Brown [Tue, 5 Feb 2019 01:10:00 +0000 (03:10 +0200)]
MLK-20892-1 mxc: hdp: Fixing coding style in HDCP API functions

Cleaning up HDCP code to remove coding errors and warnings in calling
functions. Also, removed printk's from HDCP APIs.

Signed-off-by: Oliver Brown <oliver.brown@nxp.com>
6 years agoMLK-17537-10: drm/imx: dcss: Add support for mode_valid
Robert Chiras [Thu, 7 Feb 2019 13:09:30 +0000 (15:09 +0200)]
MLK-17537-10: drm/imx: dcss: Add support for mode_valid

Implement the mode_valid in dcss-crtc to filter-out unsupported modes.
In dcss-crtc, just use the mode_valid and mode_fixup functions from
dcss-dtg.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
6 years agoMLK-17537-9: gpu/imx: dcss: Add support for mode_valid
Robert Chiras [Thu, 7 Feb 2019 13:04:53 +0000 (15:04 +0200)]
MLK-17537-9: gpu/imx: dcss: Add support for mode_valid

Implement mode_valid and mode_fixup functions for the dcss-crtc
driver so that DCSS can filter-out unsupported modes and save the
configuration for the supported ones.
Use mode_fixup to apply the saved configuration of a supported mode.
The mechanism to determine if a mode is supported or not is made in
dcss-dtg.

Also, add 2 new clocks:
- pll: this is the video PLL that provides the pixel clock; it's rate
  needs to be set such that the pixel clock can be achieved
- pll_src*: this is an oscillator that can be used as source clock for
  the video pll; currently, there are possible maximum 3 pll sources,
  defined as pll_src1, pll_src2 and pll_src3. The actual clocks that
  can be used as pll source are: CLK_25M, CLK_27M and CLK_PHY_27MHZ

Removed the pdiv_clk and pout_clk and replaced them with pix_clk,
since out of those two only one was used: pdiv_clk, representing the pixel
clock.

In dcss-dtg, each mode is tested and if we can achieve it's pixel
clock we save this mode configuration into an internal list and apply this
configuration later on when mode_fixup is called.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
6 years agoMLK-20788: drm/imx/dcss: fix issue with some HDMI sinks
Laurentiu Palcu [Fri, 25 Jan 2019 12:43:13 +0000 (14:43 +0200)]
MLK-20788: drm/imx/dcss: fix issue with some HDMI sinks

Apparently, there are HDMI sinks out there that advertise Rec.2020
support in the Colorimetry Data Block but are not HDR capable devices.
In this case, there's no HDR Static metadata data block and EOTF is 0.

This patch will allow setting up the DCSS output pipe non-linearity to
Rec.2020, irrespective of sink's supported EOTF in HDR static metadata.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
6 years agoMLK-20777-3: hdp: Enable HDMI2.0 when TMDS character rate > 340MHz
Sandor Yu [Fri, 18 Jan 2019 09:13:52 +0000 (17:13 +0800)]
MLK-20777-3: hdp: Enable HDMI2.0 when TMDS character rate > 340MHz

Add scdc tmds config function.
Enable HDMI2.0 when TMDS character rate > 340MHz.
Enable HDMI2.0 when LTE_340Mcsc_scramble bit set in EDID.

This patch can fix 4Kp60 YUV420 failed to work in some TV.
That TV cann't support scramble mode
when TMDS character rate low than 340MHz.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
6 years agoMLK-20777-2: hdp api: Remove scdc tmds config
Sandor Yu [Fri, 18 Jan 2019 09:11:31 +0000 (17:11 +0800)]
MLK-20777-2: hdp api: Remove scdc tmds config

Remove scdc tmds config in api function.
This function will move to hdmi driver.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
6 years agoMLK-20707 gpu: imx: dcss: Change the pixel clock reference at runtime
Oliver Brown [Tue, 8 Jan 2019 22:42:01 +0000 (16:42 -0600)]
MLK-20707 gpu: imx: dcss: Change the pixel clock reference at runtime

The clock referenece for the video pll 2 needs to be changed at runtime.
The HDMI/DP PHY reference clock is not available during module initialization
so the reference clock should be changed when the mode is set.

Signed-off-by: Oliver Brown <oliver.brown@nxp.com>
6 years agoMLK-20522: HDP API: Merge CDN_1_0_40 API release
Sandor Yu [Wed, 5 Dec 2018 05:46:36 +0000 (13:46 +0800)]
MLK-20522: HDP API: Merge CDN_1_0_40 API release

From release notes:
30 Nov 2018
v1.0.40
Added functions for performing arbitrary I2C-over-AUX transactions.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
6 years agoMLK-20474 gpu: dcss: Switch back the dcss to the newly added SCCG pll clock
Abel Vesa [Tue, 27 Nov 2018 09:36:27 +0000 (11:36 +0200)]
MLK-20474 gpu: dcss: Switch back the dcss to the newly added SCCG pll clock

Now that there is a generic SCCG clock added, it can also
be used by the DCSS. The HDMI_PHY_27M_CLK ref sel is hardcoded as parent
to VIDEO_PLL2 in dts.

Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
6 years agoMLK-20518: hdp: Fix memory out of bounds access
Sandor Yu [Tue, 4 Dec 2018 07:21:01 +0000 (15:21 +0800)]
MLK-20518: hdp: Fix memory out of bounds access

Fix memory out of bounds access.
Change arry type for functopn avi info frame,
Align the arry type and its length.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
6 years agoMLK-20481: hdp: change hdmi keep-alive check mechanism
Sandor Yu [Wed, 28 Nov 2018 07:06:17 +0000 (15:06 +0800)]
MLK-20481: hdp: change hdmi keep-alive check mechanism

The current keep-alive check mechanism uses a static variable
that is initialized to 0. When the function is first called, it may
happen to catch the 8-bit keep-alive counter right when it
overflows, hence returning BUSY.

This patch will keep checking the counter for 10us, every 1us,
but it will immediately return if the keep-alive counter changed.

Signed-off-by: Laurentiu Palcu<laurentiu.palcu@nxp.com>
Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
6 years agoMA-12939: drm/imx/dcss: check source plane size
Laurentiu Palcu [Fri, 23 Nov 2018 12:50:02 +0000 (14:50 +0200)]
MA-12939: drm/imx/dcss: check source plane size

DCSS has some minimum requirements for the source buffer size that need
to be respected in order to not freeze DPR and/or scaler.

This patch will add the checks and return an error if source plane size
is not allowed. Userspace will need to gracefully handle this.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
6 years agoMLK-20415: drm: imx: hdp: Adjust HDMI Vswing
Sandor Yu [Tue, 20 Nov 2018 01:59:03 +0000 (09:59 +0800)]
MLK-20415: drm: imx: hdp: Adjust HDMI Vswing

The iMX8QM HDMI voltage swing needs to be increased for HDMI compliance.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
6 years agoMLK-20216-2: drm/imx/dcss: remove dead code
Laurentiu Palcu [Wed, 14 Nov 2018 12:48:25 +0000 (14:48 +0200)]
MLK-20216-2: drm/imx/dcss: remove dead code

This fixes Coverity issue since enable is always true.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
6 years agoMLK-20216-1: drm/imx/dcss: fix suspicious sign extension
Laurentiu Palcu [Wed, 14 Nov 2018 12:43:13 +0000 (14:43 +0200)]
MLK-20216-1: drm/imx/dcss: fix suspicious sign extension

This addresses Coverity issues related to "Suspicious sign extension"
when an u16 is promoted to int (32bit signed) and then to u64. If the
resulting int is greater than 0x7fffffff the upper bits of the u64 will
all be 1.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
6 years agoMLK-20332 drm: imx hdp: Display version information for HDMI/DP firmware
Oliver Brown [Mon, 12 Nov 2018 14:46:55 +0000 (08:46 -0600)]
MLK-20332 drm: imx hdp: Display version information for HDMI/DP firmware

The HDMI/DP firmware verison will now be displayed.
Moved firmware handling to common file for HDMI and DisplayPort.

Signed-off-by: Oliver Brown <oliver.brown@nxp.com>
6 years agoMLK-20117 drm/imx/dcss: fix color issue when Adobe_ARGB gamut is used
Laurentiu Palcu [Tue, 13 Nov 2018 09:01:36 +0000 (11:01 +0200)]
MLK-20117 drm/imx/dcss: fix color issue when Adobe_ARGB gamut is used

Adobe ARGB gamut was selected even if the output pipe pixel encoding was
YUV. That produced a pink tint on the screen.

This patch will make sure the Adobe ARGB gamut is selected only when the
output pipe pixel encoding is RGB.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
6 years agoMLK-20304-2 imx/drm/dcss: get the hdmi controller CS from private_flags
Laurentiu Palcu [Fri, 9 Nov 2018 07:08:54 +0000 (09:08 +0200)]
MLK-20304-2 imx/drm/dcss: get the hdmi controller CS from private_flags

DCSS HDR10 output pipe is always 10-bit. All we need to know to better
setup the LUTs and/or CSC matrices is the output colorspace.

This patch will fetch the CS from adjusted_mode's private_flags, as
indicated in the connector's mode_fixup phase.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
6 years agoMLK-20304-1 drm/imx/hdp: add mode_fixup hook and better handling of DC and CS
Laurentiu Palcu [Fri, 9 Nov 2018 06:49:28 +0000 (08:49 +0200)]
MLK-20304-1 drm/imx/hdp: add mode_fixup hook and better handling of DC and CS

The HDMI sink may support different color depths for RGB and/or YUV
colorspaces. Currently, for mscale, 10-bit YUV420 is used only for
2160p@60. For the rest of modes 8-bit RGB is used.

This patch will add a mode_fixup() hook in the hdp_ops struct, allowing
each platform to perform a better handling of the various color depths
and colorspaces.

With the current patch, the RGB output will always be preferred to YUV
colorspaces, given the same color depth, since YUV colorspaces perform
UV subsampling, producing less quality. Also, whenever possible, better
color depth will be preferred (12-bit, 10-bit and, lastly, 8-bit).

The chosen colorspace and color depth will always be based on EDID's
Capability Map Data Block and YUV420 Video Data Block, as well as on
HDMI controller's known clock constraints.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
6 years agoMLK-20263: drm/imx/dcss: fix channel-0 line shift
Dzung Hoang [Wed, 7 Nov 2018 10:57:04 +0000 (12:57 +0200)]
MLK-20263: drm/imx/dcss: fix channel-0 line shift

If an RGB buffer is fed to channel-0, the output will have one line
shifted down, with the last line appearing on top.

Using the 7-tap filter will fix the issue. The 5-tap filter code will be
removed completely.

Signed-off-by: Dzung Hoang <dzung.hoang@nxp.com>
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
6 years agoMLK-20242: drm/imx/dcss: fix brightness for REC.709
Laurentiu Palcu [Tue, 6 Nov 2018 11:35:40 +0000 (13:35 +0200)]
MLK-20242: drm/imx/dcss: fix brightness for REC.709

The brightness, when REC709 was used in the configuration of the pipes,
was lower than expected.

The reason was the HDR10 configuration application that was used to
create the tables had a parameter that was wrongly set.

The tables were re-generated with the proper setting.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
6 years agoMLK-20272: hdp: Correct copyright
Sandor Yu [Thu, 8 Nov 2018 02:12:34 +0000 (10:12 +0800)]
MLK-20272: hdp: Correct copyright

Cadence allow customer release these source code as followed copyright.

 * Copyright (C) 2016-2017 Cadence Design Systems, Inc.
 * All rights reserved worldwide.
 *
 * Redistribution and use in source and binary forms, with or without modification,
 * are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 * this list of conditions and the following disclaimer in the documentation and/or
 * other materials provided with the distribution.
 *
 * 3. Neither the name of the copyright holder nor the names of its contributors
 * may be used to endorse or promote products derived from this software without
 * specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
 * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
6 years agoMLK-20098-2: imx/drm/dcss: fix uninitialized spinlock
Laurentiu Palcu [Fri, 26 Oct 2018 08:52:10 +0000 (11:52 +0300)]
MLK-20098-2: imx/drm/dcss: fix uninitialized spinlock

After activating CONFIG_DEBUG_SPINLOCK, the following warning was thrown
in kernel log:

[    1.261079] BUG: spinlock bad magic on CPU#0, kworker/0:2/1285
[    1.266928]  lock: 0xffff8000b92f0190, .magic: 00000000, .owner: <none>/-1, .owner_cpu: 0
[    1.275113] CPU: 0 PID: 1285 Comm: kworker/0:2 Not tainted 4.14.62-05296-gd695a5b #460
[    1.283032] Hardware name: Freescale i.MX8MQ EVK (DT)
[    1.288094] Workqueue: pm pm_runtime_work
[    1.292111] Call trace:
[    1.294567] [<ffff00000808a7d0>] dump_backtrace+0x0/0x3d8
[    1.299974] [<ffff00000808abbc>] show_stack+0x14/0x20
[    1.305032] [<ffff000008dccd40>] dump_stack+0x8c/0xac
[    1.310091] [<ffff000008119858>] spin_dump+0x70/0x90
[    1.315060] [<ffff000008119978>] do_raw_spin_lock+0xc0/0x108
[    1.320726] [<ffff000008de6380>] _raw_spin_lock_irqsave+0x28/0x38
[    1.326825] [<ffff000008677434>] dcss_ctxld_kick+0x2c/0x200
[    1.332402] [<ffff000008677a3c>] dcss_ctxld_suspend+0x1c/0xa0
[    1.338153] [<ffff000008676648>] dcss_runtime_suspend+0x18/0x68
[    1.344079] [<ffff0000086f3740>] pm_generic_runtime_suspend+0x28/0x40
[    1.350523] [<ffff0000086f6558>] __rpm_callback+0xe0/0x268
[    1.356015] [<ffff0000086f6700>] rpm_callback+0x20/0x80
[    1.361246] [<ffff0000086f56ec>] rpm_suspend+0xf4/0x4b8
[    1.366474] [<ffff0000086f5cac>] rpm_idle+0x124/0x168
[    1.371531] [<ffff0000086f70b8>] pm_runtime_work+0xa0/0xb8
[    1.377025] [<ffff0000080ec874>] process_one_work+0x1d4/0x360
[    1.382774] [<ffff0000080eca48>] worker_thread+0x48/0x478
[    1.388180] [<ffff0000080f2e10>] kthread+0x138/0x140
[    1.393151] [<ffff000008084f48>] ret_from_fork+0x10/0x18

The reason was an uninitialized spinlock.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
6 years agoMLK-20098-1: imx/drm/dcss: Fix potential sleep in IRQ context
Laurentiu Palcu [Fri, 26 Oct 2018 08:50:13 +0000 (11:50 +0300)]
MLK-20098-1: imx/drm/dcss: Fix potential sleep in IRQ context

Activating CONFIG_SLEEP_ATOMIC_SLEEP detected a couple of potential sleeps
inside IRQ context:

[   23.609203] BUG: sleeping function called from invalid context at kernel/irq/manage.c:112
[   23.617437] in_atomic(): 1, irqs_disabled(): 128, pid: 0, name: swapper/2
[   23.624229] CPU: 2 PID: 0 Comm: swapper/2 Tainted: G        W 4.14.62-05295-gf2fa7e6 #454
[   23.632927] Hardware name: Freescale i.MX8MQ EVK (DT)
[   23.637980] Call trace:
[   23.640433] [<ffff00000808a360>] dump_backtrace+0x0/0x3d8
[   23.645834] [<ffff00000808a74c>] show_stack+0x14/0x20
[   23.650891] [<ffff000008dba640>] dump_stack+0x9c/0xbc
[   23.655946] [<ffff0000080f70d4>] ___might_sleep+0xf4/0x118
[   23.661433] [<ffff0000080f7148>] __might_sleep+0x50/0x88
[   23.666750] [<ffff00000811f218>] synchronize_irq+0x30/0x98
[   23.672237] [<ffff00000811f6e8>] disable_irq+0x20/0x30
[   23.677378] [<ffff00000866edb8>] dcss_dpr_irq_enable+0x78/0x98
[   23.683211] [<ffff00000866f798>] dcss_dtg_vblank_irq_enable+0x40/0x78
[   23.689652] [<ffff00000866c79c>] dcss_vblank_irq_enable+0xc/0x18
[   23.695661] [<ffff0000086d3048>] dcss_disable_vblank+0x30/0x50
[   23.701496] [<ffff0000086aaa2c>] drm_vblank_disable_and_save+0xd4/0xe8
[   23.708023] [<ffff0000086aaac8>] vblank_disable_fn+0x88/0xa8
[   23.713685] [<ffff00000813513c>] call_timer_fn.isra.5+0x24/0x80
[   23.719603] [<ffff00000813523c>] expire_timers+0xa4/0xb0
[   23.724914] [<ffff000008135300>] run_timer_softirq+0xb8/0x170
[   23.730660] [<ffff000008081bcc>] __do_softirq+0x12c/0x228
[   23.736062] [<ffff0000080d57bc>] irq_exit+0xc4/0x100
[   23.741025] [<ffff00000811e528>] __handle_domain_irq+0x60/0xb8
[   23.746857] [<ffff000008081998>] gic_handle_irq+0x78/0x17c

These sleep warnings were generated because disable_irq() may sleep. Use
disable_irq_nosync() instead.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
6 years agoMLK-20064 drm: imx: dp: Add link training check for DisplayPort
Oliver Brown [Wed, 24 Oct 2018 18:18:40 +0000 (13:18 -0500)]
MLK-20064 drm: imx: dp: Add link training check for DisplayPort

After link train completes the link status needs to be checked.
If the link is not "good", then link training must be retried.

Signed-off-by: Oliver Brown <oliver.brown@nxp.com>
6 years agoMLK-20063 drm: imx: dp: Correct iMX8M PHY initialization
Oliver Brown [Wed, 24 Oct 2018 17:47:08 +0000 (12:47 -0500)]
MLK-20063 drm: imx: dp: Correct iMX8M PHY initialization

The DisplayPort PHY initialization does not need the additional
loop gain enabled.

Signed-off-by: Oliver Brown <oliver.brown@nxp.com>
6 years agoMLK-19989 drivers: mxc: hdp-cec: make the hdp-cec kernel thread freezeable
Jason Liu [Thu, 25 Oct 2018 02:32:08 +0000 (10:32 +0800)]
MLK-19989 drivers: mxc: hdp-cec: make the hdp-cec kernel thread freezeable

the hdp-cec kernel thread should be freezeable during system suspend phase,
othwerwise, it will cause issues(hang) since it will still try to access
some resources such as clocks which are off during system suspend process.

Signed-off-by: Jason Liu <jason.hui.liu@nxp.com>
Cc: Sandor Yu <sandor.yu@nxp.com>
Cc: Laurentiu Palcu <laurentiu.palcu@nxp.com>
Acked-by: Sandor Yu <sandor.yu@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
6 years agoMLK-19689 drm/imx/dcss: Fix scaler freeze on channel-0
Laurentiu Palcu [Wed, 17 Oct 2018 08:28:36 +0000 (11:28 +0300)]
MLK-19689 drm/imx/dcss: Fix scaler freeze on channel-0

For channel 0 if 1920x1080@NV12 was used when setting a mode would
freeze the scaler. That's because the chroma vertical size was set to
540 (1920 / 2) instead of 544 (which is divisible to 8).

This patch makes sure we round up the chroma vertical size for channel-0
properly.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
6 years agoMLK-19961 drm/imx/dcss: Fix 27MHz pixel clock platform freeze
Laurentiu Palcu [Wed, 17 Oct 2018 08:20:34 +0000 (11:20 +0300)]
MLK-19961 drm/imx/dcss: Fix 27MHz pixel clock platform freeze

When the VIDEO_PLL2 clock code was moved to the DCSS driver, a
regression was introduced and any mode requiring a 27MHz pixel clock
would instantly freeze the platform.

It turns out, after setting the clocks in bypass mode, PLL_CLKE was
never set. Hence, DCSS was not getting any clock. Without a valid clock,
any attempt to access DTG registers will freeze the system.

This patch:
 * sets PLL_CLKE when bypass is used;
 * simplifies the pll code a little;
 * increases the atomic CRTC enable timeout to 500ms to accommodate the
   delay after which the clock is available when bypass is used;

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
CC: Oliver Brown <oliver.brown@nxp.com>
6 years agoMLK-19021: drm/imx/dcss: fix RTRM clock reference
Laurentiu Palcu [Fri, 12 Oct 2018 08:07:47 +0000 (11:07 +0300)]
MLK-19021: drm/imx/dcss: fix RTRM clock reference

RTRM clock reference was saved in apb_clk, instead of rtrm_clk. Hence,
when blanking and clocks go off, APB clock counter was 2, instead of 1.

Because IRQ_STEER controller uses APB clock as well, the APB clock ref
counter will never go to 0. Unless DCSS is never used.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
6 years agoMLK-19906: drm/imx/dcss: lower CTXLD trigger threshold
Laurentiu Palcu [Fri, 12 Oct 2018 07:24:16 +0000 (10:24 +0300)]
MLK-19906: drm/imx/dcss: lower CTXLD trigger threshold

After PM_QoS was removed by this commit:

f889273 - MLK-19460-2: drm: imx: dcss: remove PM_QoS

interrupt latency increased. Hence, any video playback using tiled
compressed formats will be affected because DTRC uses CTXLD to switch
its register banks. If CTXLD is not armed, at the right time, the DB
trigger moment will be missed. This leads to DTRC not switch to the other
register bank and scaler will be starved, leading to a channel freeze.

This patch will lower the CTXLD trigger time to 90% of frame trace
allowing some more time between arming the context loader and DB trigger
time, in case the latency is too big.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
6 years agoMLK-19845: drm/imx/dcss: fix suspend/resume issue
Laurentiu Palcu [Tue, 9 Oct 2018 05:50:42 +0000 (08:50 +0300)]
MLK-19845: drm/imx/dcss: fix suspend/resume issue

While running suspend/resume tests it may happen to go to suspend while
CTXLD still has entries to be commited. Currently, when this happens,
the scaler freezes.

This patch will fire up context loader just before going to suspend,
thus commiting everything to DCSS before cutting off the clocks.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
6 years agoMLK-19673-2: drm/imx/dcss: protect against concurent commits
Laurentiu Palcu [Fri, 5 Oct 2018 13:06:35 +0000 (16:06 +0300)]
MLK-19673-2: drm/imx/dcss: protect against concurent commits

The current DCSS driver uses the generic drm_atomic_helper_commit().
But, this helper offers no protection against concurent commits by
userspace apps that may not wait for flip_done events.

This patch customizes the atomic_commit() callback by reusing the
drm_atomic_helper_commit() helper and adding a spinlock that will not
allow for another commit to go through if one is already pending.

Since we'll be calling the dcss_drm_atomic_commit_tail() ourselves,
there's no need for drm_mode_config_helper_funcs anymore. So, remove it.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
6 years agoMLK-19673-1: drm/imx/core: add a workqueue and a commit object
Laurentiu Palcu [Fri, 5 Oct 2018 12:35:54 +0000 (15:35 +0300)]
MLK-19673-1: drm/imx/core: add a workqueue and a commit object

This change adds a workqueue and a commit object that can be used by the
drivers to protect pending commits (non-blocking ones) from concurent
commits using legacy API (for example).

A non-blocking commit will defer the work to a workqueue and it may wait
for fences to be cleared. Waiting for fences to be cleared is
interruptible. Hence, if a SETPLANE IOCTL is performed (to disable a
plane), it may preempt the current commit and will mess up the atomic
states.  When the legacy calls finish, the non-blocking commit worker
will resume, but the crtc and/or FBs of some planes are already NULL.
Hence, the non-blocking commit will crash in
drm_atomic_helper_commit_planes() with NULL pointer dereference.

This particular patch does not affect existing drivers in any way.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
CC: Ying Liu <victor.liu@nxp.com>
CC: Fancy Fang <chen.fang@nxp.com>
6 years agoMLK-19807 drm: imx: dp: Fix NULL pointer dereference if EDID read fails
Oliver Brown [Wed, 3 Oct 2018 19:30:53 +0000 (14:30 -0500)]
MLK-19807 drm: imx: dp: Fix NULL pointer dereference if EDID read fails

Added a check to see if the EDID read fails before copying the EDID.
Added a check to see if buf parameter is NULL.

Signed-off-by: Oliver Brown <oliver.brown@nxp.com>
6 years agoMLK-19746-1 drm: imx: hdp: Add basic DPCD support for DisplayPort
Oliver Brown [Wed, 26 Sep 2018 23:29:27 +0000 (18:29 -0500)]
MLK-19746-1 drm: imx: hdp: Add basic DPCD support for DisplayPort

Adding support to use the DRM helper for DPCD query
removed some warnings from checkpatch.

Signed-off-by: Oliver Brown <oliver.brown@nxp.com>
6 years agoMLK-19745 drm: imx: hdp: Add PHY clock shutdown/startup for DP mode change
Oliver Brown [Wed, 26 Sep 2018 22:40:01 +0000 (17:40 -0500)]
MLK-19745 drm: imx: hdp: Add PHY clock shutdown/startup for DP mode change

The PHY specification recommends stopping/starting the PHY clocks during a
video mode change.

Signed-off-by: Oliver Brown <oliver.brown@nxp.com>
6 years agoMLK-18895: hdmi: Reset HDMI PHY when enable/disable HDCP function
Sandor Yu [Thu, 27 Sep 2018 06:28:58 +0000 (14:28 +0800)]
MLK-18895: hdmi: Reset HDMI PHY when enable/disable HDCP function

Some HDMI Sink may failed to work when running HDCP enable/disable
stress test. HDMI sink may not support change HDCP state on the fly.
So reset HDMI PHY and controller to resolve the issue.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
6 years agoMLK-19265: drm: imx: dcss: ignore invisible planes
Laurentiu Palcu [Tue, 18 Sep 2018 07:05:35 +0000 (10:05 +0300)]
MLK-19265: drm: imx: dcss: ignore invisible planes

Right now, an error is returned in the atomic_check callback if a plane
is not visible. However, this can lead to warnings when removing
framebuffers after connector is removed. That's because display's width
and height becomes 0 and, technically, the plane becomes invisible. Any
attempt to remove a plane will also perform an atomic_commit() on the
remaining, still active, planes. Since they are invisible, the following
warning will be shown:

[  161.623590] atomic remove_fb failed with -22
[  161.628099] ------------[ cut here ]------------
[  161.632727] WARNING: CPU: 0 PID: 95 at /usr/src/kernel/drivers/gpu/drm/drm_framebuffer.c:924 drm_framebuffer_remove+0x3b8/0x3e0
[  161.644200] Modules linked in: 8021q garp stp mrp qca6174(O) crc32_ce crct10dif_ce galcore(O) ipv6
[  161.653175] CPU: 0 PID: 95 Comm: kworker/0:1 Tainted: G           O 4.14.62-imx_4.14.y+gef7acf9 #1
[  161.662391] Hardware name: Freescale i.MX8MQ EVK (DT)
[  161.667443] Workqueue: events drm_mode_rmfb_work_fn
[  161.672319] task: ffff8000b8973600 task.stack: ffff000009ee0000
[  161.678237] PC is at drm_framebuffer_remove+0x3b8/0x3e0
[  161.683460] LR is at drm_framebuffer_remove+0x3b8/0x3e0
[  161.688683] pc : [<ffff00000867f5d0>] lr : [<ffff00000867f5d0>] pstate: 40000145
[  161.696075] sp : ffff000009ee3d10
[  161.699388] x29: ffff000009ee3d10 x28: 0000000000000000
[  161.704701] x27: 0000000000000000 x26: ffff8000b8fda000
[  161.710013] x25: ffff0000080e8c60 x24: ffff00001999bc90
[  161.715324] x23: 00000000ffffffea x22: ffff8000bdf63580
[  161.720636] x21: ffff8000b45d6280 x20: ffff8000b5fd2800
[  161.725947] x19: ffff00001999bc90 x18: 0000000000000010
[  161.731258] x17: 0000ffff9d121910 x16: ffff000008231398
[  161.736570] x15: ffffffffffffffff x14: ffff0000895c144f
[  161.741881] x13: ffff0000095c145d x12: ffff000009429df8
[  161.747193] x11: ffff000008616e40 x10: ffff000009ee3a20
[  161.752504] x9 : 0000000000000006 x8 : 6961662062665f65
[  161.757816] x7 : 766f6d6572206369 x6 : 00000000000002ba
[  161.763127] x5 : 0000000000000000 x4 : 0000000000000000
[  161.768438] x3 : 0000000000000000 x2 : ffff8000bdf5fef0
[  161.773749] x1 : ffff8000b8973600 x0 : 0000000000000020
[  161.779061] Call trace:
[  161.781507] Exception stack(0xffff000009ee3bd0 to 0xffff000009ee3d10)
[  161.787946] 3bc0:                                   0000000000000020 ffff8000b8973600
[  161.795774] 3be0: ffff8000bdf5fef0 0000000000000000 0000000000000000 0000000000000000
[  161.803601] 3c00: 00000000000002ba 766f6d6572206369 6961662062665f65 0000000000000006
[  161.811430] 3c20: ffff000009ee3a20 ffff000008616e40 ffff000009429df8 ffff0000095c145d
[  161.819258] 3c40: ffff0000895c144f ffffffffffffffff ffff000008231398 0000ffff9d121910
[  161.827086] 3c60: 0000000000000010 ffff00001999bc90 ffff8000b5fd2800 ffff8000b45d6280
[  161.834914] 3c80: ffff8000bdf63580 00000000ffffffea ffff00001999bc90 ffff0000080e8c60
[  161.842743] 3ca0: ffff8000b8fda000 0000000000000000 0000000000000000 ffff000009ee3d10
[  161.850571] 3cc0: ffff00000867f5d0 ffff000009ee3d10 ffff00000867f5d0 0000000040000145
[  161.858399] 3ce0: 0000000000000000 ffff8000b8973600 ffffffffffffffff ffff00000867cfb4
[  161.866226] 3d00: ffff000009ee3d10 ffff00000867f5d0
[  161.871103] [<ffff00000867f5d0>] drm_framebuffer_remove+0x3b8/0x3e0
[  161.877369] [<ffff00000867f638>] drm_mode_rmfb_work_fn+0x40/0x58
[  161.883375] [<ffff0000080e8aec>] process_one_work+0x1d4/0x348
[  161.889120] [<ffff0000080e8ea4>] worker_thread+0x244/0x470
[  161.894606] [<ffff0000080eefac>] kthread+0x12c/0x130
[  161.899571] [<ffff000008084ed8>] ret_from_fork+0x10/0x18
[  161.904880] ---[ end trace 489a96a125920066 ]---

To avoid this, we simply return 0 in the atomic_check() callback and do
not perform any update on the plane in the atomic_update().
Since the plane is invisible, it's perfectly fine.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
6 years agoMLK-19420-3 drm: imx: dcss: Add video pll 2 support
Oliver Brown [Fri, 31 Aug 2018 15:24:10 +0000 (10:24 -0500)]
MLK-19420-3 drm: imx: dcss: Add video pll 2 support

Moving video pll2 control to the display driver to allow more flexibility
for setting rates.

Signed-off-by: Oliver Brown <oliver.brown@nxp.com>
6 years agoMLK-19577: dp: Correct vsync and hsync polarity
Oliver Brown [Thu, 13 Sep 2018 21:27:27 +0000 (16:27 -0500)]
MLK-19577: dp: Correct vsync and hsync polarity

The hsync and vsync polarity is inverted for display port.
Removes test code that was forcing the vsync and hsync polarity
incorrectly.

Signed-off-by: Oliver Brown <oliver.brown@nxp.com>
6 years agoMLK-18848-3: drm: imx: dcss: split vblank irq enable routine
Laurentiu Palcu [Fri, 14 Sep 2018 05:33:01 +0000 (08:33 +0300)]
MLK-18848-3: drm: imx: dcss: split vblank irq enable routine

Currently, when enabling/disabling vblank interrupt, we also
enable/disable the CTXLD kick interrupt. Most of the time this is fine,
because when vblank gets disabled user-space does not submit any buffers
and CTXLD kick interrupt is not needed.

There is one case when we actually need to be able to have the CTXLD
kick interrupt enabled: when disabling CRTC. Vblank interrupt, in this
case, is disabled before the crtc_atomic_disable routine is called.
However, we still need CTXLD to push the changes to SUBSAM and DTG.

This patch will create a routine just for enabling/disabling CTXLD kick
interrupt and move the code from vblank routine to the new one.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
6 years agoMLK-19560: drm: imx: hdp: Display Port PHY reference needs to be enabled
Oliver Brown [Thu, 13 Sep 2018 02:26:39 +0000 (21:26 -0500)]
MLK-19560: drm: imx: hdp: Display Port PHY reference needs to be enabled

The pixel_clock_set_rate function must be called before enabling the pixel clock.
This will enable the PHY reference clock for DisplayPort mode.

Signed-off-by: Oliver Brown <oliver.brown@nxp.com>