linux.git
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>
6 years agoMLK-19470: drm: imx: dcss: enable CTXLD only if not already in use
Laurentiu Palcu [Tue, 11 Sep 2018 12:21:43 +0000 (15:21 +0300)]
MLK-19470: drm: imx: dcss: enable CTXLD only if not already in use

Currently, it may happen to enable CTXLD if it's already in use. This
can lead to unpredictable behavior (green screen can be one).

This patch will check if CTXLD is already in use, before enabling it
again.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
6 years agoMLK-19500: drm: imx: dcss: fix tracing function
Laurentiu Palcu [Fri, 7 Sep 2018 07:14:57 +0000 (10:14 +0300)]
MLK-19500: drm: imx: dcss: fix tracing function

kzalloc with GFP_KERNEL argument, may sleep. dcss_trace_write() is
called also from interrupt context and sleeping is not acceptable.

This patch will make kzalloc() call atomic.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
6 years agoMLK-18848-2: drm: imx: dcss: swap vblank and ctxld_kick interrupts
Laurentiu Palcu [Tue, 4 Sep 2018 10:57:10 +0000 (13:57 +0300)]
MLK-18848-2: drm: imx: dcss: swap vblank and ctxld_kick interrupts

During boot time, the interrupt latency can reach 20ms due to UART
holding the interrupts disabled. If, during this time, VBLANK (LINE_0)
and CTXLD_KICK (LINE_1) are triggered, the handlers will be called in
the order of the irq_steer lines (vblank handler first and ctxld_kick
second). This may lead to "vblank wait timed out" warning messages from
DRM core, because the 50ms wait time is exceeded. Especially when
display is lower than 30fps.

Swapping the interrupt lines will have the ctxld_kick interrupt handler
always be called first, kicking the context loader ON before VBLANK
notification is sent to userspace.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
6 years agoMLK-18848-1: drm: imx: dcss: do not turn off DTG LINE0/1 interrupts
Laurentiu Palcu [Fri, 31 Aug 2018 14:00:01 +0000 (17:00 +0300)]
MLK-18848-1: drm: imx: dcss: do not turn off DTG LINE0/1 interrupts

DTG registers are double bufferred. Hence, enabling LINE0/1 interrupts
in DTG in frame 0 will actually activate them in frame 1. Hence, the
LINE0/1 interrupts (vblank and ctxld kick) will be missed in frame 0.

This patch will permanently activate the LINE0/1 interrupts in DTG and
only mask/unmask them at irq_steer controller level (disable_irq/enable_irq).

While at it, do the same change for DPR completion interrupts. Since, these are
only used for tracing purposes, the change is not supposed to affect
driver functionality in any way.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
6 years agoMLK-19460-2: drm: imx: dcss: remove PM_QoS
Laurentiu Palcu [Wed, 5 Sep 2018 13:20:10 +0000 (16:20 +0300)]
MLK-19460-2: drm: imx: dcss: remove PM_QoS

This patch removes PM_QoS request from DCSS driver. This will allow the
A-53 cores to go idle even when DCSS is used.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
6 years agoMLK-19460-1: drm: imx: dcss: lower CTXLD trigger IRQ threshold
Laurentiu Palcu [Wed, 5 Sep 2018 13:12:41 +0000 (16:12 +0300)]
MLK-19460-1: drm: imx: dcss: lower CTXLD trigger IRQ threshold

Currently, the CTXLD IRQ trigger interrupt is set to 98% of the total
vertical frame lines.  This leaves little room for interrupt handling
since the DB trigger point is set to 99%.

This patch moves the CTXLD IRQ trigger to 95%. Hence, if PM_QoS is
disabled, and A-53 cores are allowed to go to idle (hence slightly
bigger interrupt servicing time), we have enough time to handle the
interrupt and arm the CTLXD, before DB trigger point.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
6 years agoMLK-19542: HDP: Fix iMX8QM 4Kp60 failed work with HDR10 TV
Sandor Yu [Tue, 11 Sep 2018 08:11:12 +0000 (16:11 +0800)]
MLK-19542: HDP: Fix iMX8QM 4Kp60 failed work with HDR10 TV

HDP diver force output 10bit YUV420 for HDR10 TV.
But iMX8QM didn't support such function.
So add SOC version check only enable the function for iMX8MQ.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
6 years agoMLK-19518-2: HDP API: continues running set mode function if ddc failed
Sandor Yu [Mon, 10 Sep 2018 10:27:43 +0000 (18:27 +0800)]
MLK-19518-2: HDP API: continues running set mode function if ddc failed

Continues running set mode function to support
edid read failed case.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
6 years agoMLK-19518-1: HDP: Set no_edid flag when edid read failed
Sandor Yu [Mon, 10 Sep 2018 10:25:09 +0000 (18:25 +0800)]
MLK-19518-1: HDP: Set no_edid flag when edid read failed

Set no_edid flag when edid read failed.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
6 years agoMLK-19496-3: HDP: max pixel clock support rate 297MHz for no edid case
Sandor Yu [Mon, 10 Sep 2018 07:40:57 +0000 (15:40 +0800)]
MLK-19496-3: HDP: max pixel clock support rate 297MHz for no edid case

Generally DDC function is not work with no edid.
Add max pixel clock support rate 297MHz for no edid case.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
6 years agoMLK-19496-2: HDP: Enable 4Kp60 support for i.MX8QM
Sandor Yu [Mon, 10 Sep 2018 01:16:58 +0000 (09:16 +0800)]
MLK-19496-2: HDP: Enable 4Kp60 support for i.MX8QM

Pixel combiner function is ready in patch set for MLK-19413.
Remove variable is_4kp60 from driver.
4Kp60 are supported for all platforms.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
6 years agoMLK-19496-1: HDP API: skip DDC write for iMX8QM A0 soc version
Sandor Yu [Mon, 10 Sep 2018 01:13:30 +0000 (09:13 +0800)]
MLK-19496-1: HDP API: skip DDC write for iMX8QM A0 soc version

DDC function is not ready for iMX8QM A0 soc version.
Skip DDC write.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
6 years agoMLK-19495: hdp: Add vendor infoframe
Sandor Yu [Fri, 7 Sep 2018 08:51:21 +0000 (16:51 +0800)]
MLK-19495: hdp: Add vendor infoframe

VIC code check is introduced in 4.14.y,
if a mode is found in HDMI 1.4b 4K modes.
HDMI driver should send its VIC in vendor infoframes.
Add vendor infoframe setting.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
6 years agoMLK-19399: HDP API: Merge CDN_1_0_38 API release
Sandor Yu [Thu, 30 Aug 2018 06:55:37 +0000 (14:55 +0800)]
MLK-19399: HDP API: Merge CDN_1_0_38 API release

Merge CDN_1_0_38 release to HDP API.
v1_0_38 release notes:
DP: Added functionality for setting own PHY register values related to
voltage swing and pre-emphasis.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
6 years agoMLK-19468: drm: imx: dcss: fix blkctl setting for B1 silicon
Laurentiu Palcu [Fri, 7 Sep 2018 06:42:38 +0000 (09:42 +0300)]
MLK-19468: drm: imx: dcss: fix blkctl setting for B1 silicon

B1 silicon has a new ID and we need to handle it properly.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
6 years agoMLK-19413-30 drm/imx: hdp: Add dual mode support
Liu Ying [Thu, 30 Aug 2018 08:21:39 +0000 (16:21 +0800)]
MLK-19413-30 drm/imx: hdp: Add dual mode support

This patch adds dual mode support in the i.MX HDP driver.
The single mode and dual mode can be switched dynamically
according to the input video mode(pixel clock rate and
active horizontal display width).

Signed-off-by: Liu Ying <victor.liu@nxp.com>
6 years agoMLK-19419: drm: imx: dcss: Add linear modifier support for all formats
Laurentiu Palcu [Fri, 31 Aug 2018 10:58:01 +0000 (13:58 +0300)]
MLK-19419: drm: imx: dcss: Add linear modifier support for all formats

Tiled formats are supported only for YUV420 semi-planar formats.
However, the other formats should support at least the LINEAR modifier.
Some userspace app may pass on framebuffers with the linear modifier
attached and, currently, this is rejected for YUV422 and RGB formats.

This patch fixes that.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
Reported-by: Jared Hu <jared.hu@nxp.com>
6 years agoMLK-19227-5: hdp: Add mutex for register access function
Sandor Yu [Tue, 28 Aug 2018 07:40:03 +0000 (15:40 +0800)]
MLK-19227-5: hdp: Add mutex for register access function

Both CEC and HPD thread will access HDP register read/write
function, add mutex to support mulit-thread access.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
(cherry picked from commit 7e62bd0ad4b5d3187a3d1c0f2258c1d4e3ba66a6)

6 years agoMLK-19227-4: HDMI: edid function is not supported by i.MX8QM A0 chip
Sandor Yu [Wed, 15 Aug 2018 09:57:45 +0000 (17:57 +0800)]
MLK-19227-4: HDMI: edid function is not supported by i.MX8QM A0 chip

EDID function is not supported by i.MX8QM A0 SOC chip.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
(cherry picked from commit 6aeff3508919d584c6ce5661b14fadf3187298e7)

6 years agoMLK-19227-2: hdmi: Replace is_edid with no_edid
Sandor Yu [Wed, 15 Aug 2018 09:19:17 +0000 (17:19 +0800)]
MLK-19227-2: hdmi: Replace is_edid with no_edid

EDID function are default supported for all platform.
Remove is_edid variable.
Add no_edid for specific case.
such as EDID function is not supported
on iMX8QM ARM2 board with DP-HDMI converter.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
(cherry picked from commit 69d015ba610040cc0397b0c1335ef0e941f99d98)

6 years agoMA-12411 Enable in-fence function for DRM driver on IMX8 platform.
ivan.liu [Thu, 16 Aug 2018 06:54:34 +0000 (14:54 +0800)]
MA-12411 Enable in-fence function for DRM driver on IMX8 platform.

dcss_drm_atomic_commit and dpu_drm_atomic_commit will overide the in-fence.
Remove the common code from the driver to make in-fence can work.
And call pepare_fb() to do the same thing of set dma_buf fence.
The only difference is pepare_fb() won't set dma_buf fence if in-fence exists.

Change-Id: Idbaf3a765321e6d049aa9e39695a450eb0c760f0
Signed-off-by: ivan.liu <xiaowen.liu@nxp.com>
Reviewed-by: Liu Ying <victor.liu@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
6 years agoMLK-19328-2: hdp: add channel map for hdmi audio
Shengjiu Wang [Wed, 29 Aug 2018 02:04:57 +0000 (10:04 +0800)]
MLK-19328-2: hdp: add channel map for hdmi audio

Add channel map for hdmi audio, originally it is in
audio info frame function, but removed by
commit 6b97462b6407 ("MLK-18690-3: hdp api: Remove
info frame API function")

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
6 years agoMLK-19328-1: hdp: fix no sound output in second time
Shengjiu Wang [Wed, 29 Aug 2018 01:57:23 +0000 (09:57 +0800)]
MLK-19328-1: hdp: fix no sound output in second time

Fixes commit 6b97462b6407 ("MLK-18690-3: hdp api: Remove
info frame API function")

The info frame API is removed, so the maximum of state->tmp
is 8.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
6 years agoMLK-18995 drm/imx: hdp: Set pixel link vld and sync ctrl in enc->enable/disable
Liu Ying [Tue, 24 Jul 2018 16:26:24 +0000 (00:26 +0800)]
MLK-18995 drm/imx: hdp: Set pixel link vld and sync ctrl in enc->enable/disable

The pixel link validation and sync ctrl enablement should be the last
step to enable the display pipeline which involves the HDP encoder.
So, let's move the pixel link operations from initialization stage to
enc->enable/disable.  Also, the pixel_link_init/deinit hooks are replaced
with pixel_link_validate/invalidate and pixel_link_sync_ctrl_enable/disable,
since the display controller driver has already initialized the pixel link
at the driver probe stage.

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

6 years agoMLK-18992-2 drm/imx: hdp: Don't set pixel link MST address
Liu Ying [Fri, 20 Jul 2018 08:18:52 +0000 (16:18 +0800)]
MLK-18992-2 drm/imx: hdp: Don't set pixel link MST address

The pixel link MST address is set by the display controller driver,
so let's remove the redundant setting from the hdp driver.

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

6 years agoMLK-17795: drm: imx: hdp: Fix 10-bit to 8-bit color depth switch on iMX8MQ
Laurentiu Palcu [Fri, 24 Aug 2018 08:17:19 +0000 (11:17 +0300)]
MLK-17795: drm: imx: hdp: Fix 10-bit to 8-bit color depth switch on iMX8MQ

When switching from a 10-bit to an 8-bit color depth, the PHY pixel engine
simply stops functioning correctly 90% of the time. This results in the
HDMI sink not detecting any signal.

This patch will reset the PHY pixel engine after the pipe clocks are ON,
in the bridge enable callback. This will make the pixel engine work
correctly when BPC changes. Resetting the pixel engine before all the pipe
clocks are on, produces no results.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
(cherry picked from commit 72246ac9ccfa2074f4f575292af10d19a58c95c4)

6 years agoMLK-19310: drm: imx: hdp: Add support for 4K50
Oliver Brown [Wed, 22 Aug 2018 14:20:14 +0000 (09:20 -0500)]
MLK-19310: drm: imx: hdp: Add support for 4K50

4K@50 does not currently work. This patch will enable the scambler for
VIC96@50Hz.

Signed-off-by: Oliver Brown <oliver.brown@nxp.com>
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
(cherry picked from commit 0f13947a2fb72673b19c9f154eb202a9be916c4f)

6 years agoMLK-19274: drm: imx: dcss: add rotation functionality
Laurentiu Palcu [Mon, 20 Aug 2018 08:27:29 +0000 (11:27 +0300)]
MLK-19274: drm: imx: dcss: add rotation functionality

This patch will allow userspace to rotate planes by setting the
'rotation' property. Generally, 0 and 180 rotations are allowed for
pretty much all 8-bit xRGB and 2-plane YUV420 formats. 90/270 rotations
can be performed only for non-compressed tiled GPU xRGB formats. Tiled
YUV420 formats do not allow rotations at all because these formats need
DTRC for de-tiling and DTRC has no rotation support.

For more info, consult the DPR Features chapter in the reference manual.

Test example:

modetest -M imx-drm -w 27:rotation:4 -w 32:rotation:33 -w 27:alpha:30 -s
42@31:3840x2160-60@XR24 -P 32@31:3840x2160@NV21

The above will perform:
 * 180 degree rotation of primary plane (XR24);
 * vertical flip of first overlay plane (rotate-0 | reflect-y);
 * set primary plane alpha to 30;

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>