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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Add judgment on SR_MBF and FSR_RXCOUNT.

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

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

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

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

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

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

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

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

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

Fix the Coverity warning "divide_by_zero".

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Clean-up in mxc_jpeg_qbuf.

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

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

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

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

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

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

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

Fix memory leak from print_nbuf_to_eoi, when !mxc_jpeg_tracing.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Add function mxc_jpeg_set_l_endian.

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

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

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

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

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

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

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

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

Fix proposed by Bing Song.

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

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

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

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

Support run time pm

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

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

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

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

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

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

move dma_free_coherence function to buf_cleanup

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

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

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

v2: Split patches, added copyright

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

This virtual i2c driver depends on CONFIG_I2C and CONFIG_RPMSG.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

This patch adds IT6263 video support.

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

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

s/in pratical/in practice

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

6 years agoMLK-17022 drm/panel: panel-simple: Correct JDI TX26D202VM0BWA panel display timing...
Liu Ying [Wed, 29 Nov 2017 06:10:16 +0000 (14:10 +0800)]
MLK-17022 drm/panel: panel-simple: Correct JDI TX26D202VM0BWA panel display timing flags

The JDI TX26D202VM0BWA panel works in data enable(DE) mode.
Apparently, the panel's data enable signal is active high
according to the panel spec.  This patch corrects the DE
signal polarity from active low to active high.

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

6 years agoMLK-16973-2 drm/panel: simple: Add support for JDI TX26D202VM0BWA panel
Liu Ying [Mon, 20 Nov 2017 07:40:19 +0000 (15:40 +0800)]
MLK-16973-2 drm/panel: simple: Add support for JDI TX26D202VM0BWA panel

This patch adds support for Japan Display Inc. 10.1" TX26D202VM0BWA
WUXGA(1920x1200) TFT LCD panel with LVDS interface.
The panel has dual LVDS channels.

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

6 years agoMLK-20486 drm/imx: ldb: Cleanup enc&conn in ->unbind() if necessary
Liu Ying [Wed, 28 Nov 2018 08:54:08 +0000 (16:54 +0800)]
MLK-20486 drm/imx: ldb: Cleanup enc&conn in ->unbind() if necessary

When the master imx-drm-core binding fails, component_bind_all()
in imx-drm-core ->bind() callback will unbind all bound components
first and then call drm_mode_config_cleanup().  Since the encoder
and connector(located in imx_ldb.imx_ldb_channel) are freed after
the ldb ->unbind() callback, drm_mode_config_cleanup() would
accidentally access the freed encoder and connector again.  To fix
this issue, we should cleanup the encoder and connector, i.e.,
remove them from the global encoder and connector lists, in the
->unbind() callback, so that, drm_mode_config_cleanup() won't find
them again in the lists.  However, we have to make sure they exist
before the cleanup in the ->unbind() callback, because imx-drm-core
->unbind() calls drm_mode_config_cleanup() first and then unbinds
all components via component_unbind_all().  Moreover, the connector
isn't created at the first place if a bridge exists, so the check
before the cleanup makes sense for this reason as well.

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

6 years agoMLK-20287 drm/imx: ldb: Check retval of sc_misc_set_control in ldb_pixel_link_init
Liu Ying [Thu, 8 Nov 2018 09:01:56 +0000 (17:01 +0800)]
MLK-20287 drm/imx: ldb: Check retval of sc_misc_set_control in ldb_pixel_link_init

The return value of sc_misc_set_control() should be checked in
ldb_pixel_link_init(), instead of being ignored.  This patch
fixes this issue.

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

6 years agoMLK-20152 drm/imx: ldb: Correct ch0/1_mode for variants without mux
Liu Ying [Tue, 6 Nov 2018 07:46:40 +0000 (15:46 +0800)]
MLK-20152 drm/imx: ldb: Correct ch0/1_mode for variants without mux

Unlike i.MX6qdl and i.MX53 LDB variants, the i.MX8 LDB variants(i.MX8qxp
and i.MX8qm) in existence don't have frontend mux, thus, we should split
the logic to program the ch0/1_mode for variants w/wo the mux.  It turns
out LDB_CH0_MODE_EN_TO_DI0 can be used for channel0 in both LDB single
mode and LDB split mode for the i.MX8 LDB variants.  However, based on
test results, for i.MX8qm LDB channel1, LDB_CH1_MODE_EN_TO_DI1 has to be
used in single mode, while, i.MX8qxp may work with LDB_CH1_MODE_EN_TO_DI0
or LDB_CH1_MODE_EN_TO_DI1.  With LDB_CH1_MODE_EN_TO_DI0, i.MX8qm LDB
channel1 would output wrong image in single mode(it looks like color
is wrong based on test results).  The i.MX8 LDB variants channel1 mode
can still be LDB_CH1_MODE_EN_TO_DI0 in split mode(the patch doesn't
touch this).  In essence, this patch fixes the channel1 single mode for
i.MX8qm LDB by correcting the ch1_mode, while all other features
should work as before.  Note that due to hardware issue, we didn't test
the channel1 single mode for i.MX8qm.  We need to populate several
resistors to enable the connectors driven by channel1 in single mode
for either ARM2 platform or MEK board.  Tests are done with IT6263
LVDS to HDMI transmitter driven by LDB0 channel1 after r206, r207, r208
and r209 are populated on the i.MX8qm MEK board.

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

6 years agoMLK-18576-3 drm/imx: ldb: Add dual channel mode support for i.MX8dx/dxp/qxp
Liu Ying [Thu, 4 Apr 2019 03:32:01 +0000 (11:32 +0800)]
MLK-18576-3 drm/imx: ldb: Add dual channel mode support for i.MX8dx/dxp/qxp

i.MX8dx/dxp/qxp use two LDBs(one primary, one auxiliary) to support
dual channel mode.  This patch adds the dual channel mode support
for i.MX8dx/dxp/qxp.  Note that the drivers contain specific sequence
needed by this mode - LDB VSYNC polarity and channel selection settings
should be configured into the register a bit earlier in ->atomic_mode_set
instead of in ->enable, and DC subsystem pixel link enablement is moved
from the DPU driver to the LDB driver to make sure it happens later
than LDB clocks enablement in ->enable.

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

6 years agoMLK-18576-1 dt-bindings: display: imx: ldb: Add aux prop descriptions
Liu Ying [Tue, 12 Jun 2018 07:18:12 +0000 (15:18 +0800)]
MLK-18576-1 dt-bindings: display: imx: ldb: Add aux prop descriptions

i.MX8qxp uses two LDB(one primary, one auxiliary) to support dual
channel mode.  This patch adds DT property descriptions for those
properties needed by this case.

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

6 years agoMLK-17023 drm/imx: ldb: Align HSYNC and VSYNC polarities with PHY in DE mode
Liu Ying [Wed, 29 Nov 2017 06:19:46 +0000 (14:19 +0800)]
MLK-17023 drm/imx: ldb: Align HSYNC and VSYNC polarities with PHY in DE mode

When an external display device works in data enable(DE) mode,
it usually provides video mode(s) without HSYNC and VSYNC
polarities via display flags.  In this case, the controller(LDB)
and the LVDS PHY still need to align the two signal polarities
with each other respectively.  Otherwise, polarities generated
by default register values may cause mismatch polarities and
display artifacts.  With the DE mode JDI TX26D202VM0BWA panel,
we see vertical lines(very likely, only one) at the left boundary
are missing sometimes, which is caused by this mismatch.  This
patch replaces the default polarity status with explicit active
high in DE mode to fix the issue.

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

6 years agoMLK-16812 drm/imx: ldb: Let system PM behave properly when we are unbinded
Liu Ying [Tue, 14 Nov 2017 05:28:41 +0000 (13:28 +0800)]
MLK-16812 drm/imx: ldb: Let system PM behave properly when we are unbinded

The system power management operations should get correct driver data
before going on to further handling.  When the component is unbinded,
driver data should be set to NULL so that the system power management
may be bypassed(return early).  This way, we may prevent the system power
management from using any invalid driver data.

Fixes: 915ac0ad7369 ("MLK-16581-7 drm/imx: ldb: Add system power management support")
Signed-off-by: Liu Ying <victor.liu@nxp.com>
(cherry picked from commit 91033d8707a92e089fbe0b9cb48565d2c8581659)

6 years agoMLK-16581-7 drm/imx: ldb: Add system power management support
Liu Ying [Fri, 13 Oct 2017 05:22:16 +0000 (13:22 +0800)]
MLK-16581-7 drm/imx: ldb: Add system power management support

This patch adds system power management support for imx-ldb drm driver
by proper PHY power/exit/init handling where necessary and pixel link
re-initialization in the resume operation.  The driver depends on the
imx-drm core driver to handle ldb bridge power management operations.

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

6 years agoMLK-16581-3 drm/imx: ldb: Get bypass & pixel clock rates before setting their rates
Liu Ying [Fri, 13 Oct 2017 04:30:46 +0000 (12:30 +0800)]
MLK-16581-3 drm/imx: ldb: Get bypass & pixel clock rates before setting their rates

Due to i.MX8 clock issue, we need to get bypass and pixel clock rates
before setting their rates when system resumes back from PM sleep mode,
otherwise, we'll fail to set the clock rates.  So, this is a workaround
and it can be removed when the clock issue is properly fixed.

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

6 years agoMLK-16036 drm/imx: ldb: Avoid early return when getting aux PHY in dual mode
Liu Ying [Thu, 20 Jul 2017 02:19:43 +0000 (10:19 +0800)]
MLK-16036 drm/imx: ldb: Avoid early return when getting aux PHY in dual mode

In dual mode, we return too early from ->bind when we get
the auxiliary channel's PHY.  This causes we miss the logics
to set driver data, get ldb alias id and initialize pixel
link(if necessary).  This patch fixes the issue here by
tweaking the driver logic to do component binding properly.

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

6 years agoMLK-16015-6 drm/imx: ldb: Add pixel link validate/invalidate logics
Liu Ying [Tue, 18 Jul 2017 07:10:55 +0000 (15:10 +0800)]
MLK-16015-6 drm/imx: ldb: Add pixel link validate/invalidate logics

To enable or disable a display safely, we need to validate pixel link
after the relevant ldb channel is enabled and invalidate pixel link
before the channel is disabled.  These operations are recommended
by the design team.

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

6 years agoMLK-16015-5 drm/imx: ldb: Specify pixel link quirks to be initialization related
Liu Ying [Tue, 18 Jul 2017 07:19:16 +0000 (15:19 +0800)]
MLK-16015-5 drm/imx: ldb: Specify pixel link quirks to be initialization related

This patch specifies the existing pixel link quirks is initialization related.
This may help us distinguish between the pixel link quirks and another one
up-coming which is validation and invalidation related.

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

6 years agoMLK-17750: drm/imx: ldb: Fix build on imx6/7
Leonard Crestez [Fri, 9 Feb 2018 14:54:55 +0000 (16:54 +0200)]
MLK-17750: drm/imx: ldb: Fix build on imx6/7

This code is enabled in upstream imx_v6_v7_defconfig but fails to build
because of sc api calls. Fix this by adding ifdef checks to pixel_link
code.

Check for CONFIG_HAVE_IMX8_SOC becuase it is selected by both 8qm and
8qx.

These calls are already guarded at runtime with checks for devtype
pixel_link_valid_quirks so the empty ifdefed functions will never get
called anyway.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
It might make sense to add a dedicated config option for SC api
like CONFIG_HAVE_IMX_SCU, right now drivers/soc/imx/sc is guarded by
CONFIG_ARCH_FSL_IMX8QM which means you can't build 8qxp separately.

(cherry picked from commit a928239dffb3bf5232340eeb24fb583e4b2635b6)

6 years agoMLK-15001-23 drm/imx: ldb: Add i.MX8qxp LDB support
Liu Ying [Mon, 12 Jun 2017 05:34:26 +0000 (13:34 +0800)]
MLK-15001-23 drm/imx: ldb: Add i.MX8qxp LDB support

This patch adds i.MX8qxp LDB support.
Logics are added to make i.MX8qxp LDB cope with Mixel LVDS combo PHY.
Also, logics are added to handle pixel link quirks for i.MX8qxp LDB.

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

6 years agoMLK-15001-21 drm/imx: ldb: Add i.MX8qm LDB support
Liu Ying [Fri, 2 Jun 2017 09:46:12 +0000 (17:46 +0800)]
MLK-15001-21 drm/imx: ldb: Add i.MX8qm LDB support

This patch adds i.MX8qm LDB support.
Logics are added to make i.MX8qm LDB cope with Mixel LVDS PHY.
Also, logics are added to handle pixel link padding quirks for i.MX8qm LDB.

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

6 years agoRevert "drm/imx: imx-ldb: disable LDB on driver bind"
Jason Liu [Mon, 29 Oct 2018 02:50:30 +0000 (10:50 +0800)]
Revert "drm/imx: imx-ldb: disable LDB on driver bind"

This reverts commit a43eac2d855be9f441b0c6e277bdaf878b07a370.
This patch break the i.MX8, revert it firstly.

(cherry picked from commit a1bfd5b69de88fad01de507c09e69e9a5c590f40)

6 years agoMLK-16581-2 phy: mixel-lvds-combo: Get PHY clock rate before setting it's rate
Liu Ying [Fri, 13 Oct 2017 03:47:51 +0000 (11:47 +0800)]
MLK-16581-2 phy: mixel-lvds-combo: Get PHY clock rate before setting it's rate

Due to i.MX8 clock issue, we need to get PHY clock rate
before setting it's rate when system resumes back from
PM sleep mode, otherwise, we'll fail to set the clock rate.
So, this is a workaround and it can be removed when
the clock issue is properly fixed.

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

6 years agoMLK-16581-1 phy: mixel-lvds: Get PHY clock rate before setting it's rate
Liu Ying [Fri, 13 Oct 2017 03:37:18 +0000 (11:37 +0800)]
MLK-16581-1 phy: mixel-lvds: Get PHY clock rate before setting it's rate

Due to i.MX8 clock issue, we need to get PHY clock rate
before setting it's rate when system resumes back from
PM sleep mode, otherwise, we'll fail to set the clock rate.
So, this is a workaround and it can be removed when
the clock issue is properly fixed.

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

6 years agoMLK-21378-5 gpu: imx: Add dpu KMS support
Liu Ying [Wed, 3 Apr 2019 07:36:25 +0000 (15:36 +0800)]
MLK-21378-5 gpu: imx: Add dpu KMS support

Fast-forward dpu KMS driver from imx_4.14.y.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
6 years agoMLK-21378-4 gpu: imx: Add dpu common support
Liu Ying [Wed, 3 Apr 2019 07:13:43 +0000 (15:13 +0800)]
MLK-21378-4 gpu: imx: Add dpu common support

Fast-forward dpu common driver from imx_4.14.y.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
6 years agoMLK-21378-3 gpu: imx: Add imx8_pc support
Liu Ying [Wed, 3 Apr 2019 07:06:12 +0000 (15:06 +0800)]
MLK-21378-3 gpu: imx: Add imx8_pc support

Fast-forward imx8_pc driver from imx_4.14.y.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
6 years agoMLK-21378-2 gpu: imx: Add imx8_dprc support
Liu Ying [Wed, 3 Apr 2019 06:48:39 +0000 (14:48 +0800)]
MLK-21378-2 gpu: imx: Add imx8_dprc support

Fast-forward imx8_dprc driver from imx_4.14.y.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
6 years agoMLK-21378-1 gpu: imx: Add imx8_prg support
Liu Ying [Wed, 3 Apr 2019 06:13:10 +0000 (14:13 +0800)]
MLK-21378-1 gpu: imx: Add imx8_prg support

Fast-forward imx8_prg driver from imx_4.14.y.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
6 years agoMLK-21296 clk: imx8mm: Remove CLK_SET_RATE_GATE from arm_a53_div
Leonard Crestez [Tue, 2 Apr 2019 12:39:15 +0000 (15:39 +0300)]
MLK-21296 clk: imx8mm: Remove CLK_SET_RATE_GATE from arm_a53_div

On recent kernels clks which are marked with CLK_SET_RATE_GATE are
"protected" against further changes at clk_prepare time. This
clk_core_rate_protect propagates up the clk tree and causes cpufreq
switches to fail later on.

See drivers/clk/clk.c around line 770.

Fix this by removing the CLK_SET_RATE_GATE flag for this specific clk.
This is safe because a53 clks are always only manipulated through
cpufreq.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: Bai Ping <ping.bai@nxp.com>
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>