The video mode tmp_m, as a local variable in tcon_cfg_videomode(),
is uninitialized and used to store a copy instance from the real
video mode. tcon_cfg_videomode() would change the timing of it if
side_by_side mode is enabled. Theoretically, there should be no
problem even if we don't initialize tmp_m. However, coverity
reports that tmp_m is an uninitialized scalar variable when the copy
is being done(CID 5233067: Uninitialized scalar variable (UNINIT)).
This patch fixes the issue reported by coverity.
Signed-off-by: Liu Ying <victor.liu@nxp.com>
The logic in function h/vscaler_pixengcfg_dynamic_src_sel() to avoid
overrunning array src_sel[i][j] is wrong. The correct one is to check
on the index i which should be less than the array size of h/vs_id_array[].
This patch fixes the potential array overrunning issue, that is,
out-of-bounds array read issue. The issue is reported by coverity -
CID 1477349 and CID 1477345.
Signed-off-by: Liu Ying <victor.liu@nxp.com>
alloc_contig_range easily return -EBUSY when try to isolate pages,
there are lots of messages with PFNs busy when run GPU tests.
[ 622.370671] alloc_contig_range: [4ea70, 4ea7c) PFNs busy
[ 626.518072] alloc_contig_range: [4ea90, 4ea9c) PFNs busy
these problems are related wht CMA migration for fragments,
need enlarge GPU reserved size to reduce CMA fragments.
Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
The callers of dpu_{unit}_init() might provide an invalid id as
the parameter, it may cause overrunning dpu->{unit}_priv[] and
cf_shdlreqs[] arrays and out-of-bound array access. Although
the current only caller is dpu_submodules_init() and it always
provides valid ids, it would be good to fix the potential issue.
This patch fixes several issues reported by coverity - CID 1477330,
CID 1477335, CID 1477348, CID 1477346, CID 3298619, CID 1477347,
CID 5233021 and CID 1477321.
Signed-off-by: Liu Ying <victor.liu@nxp.com>
The function get_xval() returns the C_XVAL and L_XVAL fields of
the CURPIXELCNT and LASTPIXELCNT registers. They are 16bit and
sit in the low 16bit of the registers. This patch fixes the way
we mask the register and read the fields out.
Signed-off-by: Liu Ying <victor.liu@nxp.com>
e_shstrndx already contains the section header index, so
shdr->sh_type will always be SHT_STRTAB.
Remove this redundant check and make Coverity happy.
Fixes: CID3901026
Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
The dts file was removed but makefile was not updated so build broke.
Fix by removing from makefile.
Fixes: a9c2aa010d ("MLK-20252 ARM64: dts: correct imx8mm root memory")
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
The layerblend units don't contain the CONTROLWORD, CURPIXELCNT,
LASTPIXELCNT and PERFCOUNTER registers, so let's remove them
and their wrappers(no one is calling them), which were introduced
accidentally.
Signed-off-by: Liu Ying <victor.liu@nxp.com>
xf_cmd_send_recv returns with lock taken if waiting was
interrupted by a signal.
This fixes Coverity issues: CID5233120 / CID5233060
Reviewed-by: S.j. Wang <shengjiu.wang@nxp.com>
Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Bail out if kernel_read returns an error.
Fixes: CID1477415
Reviewed-by: S.j. Wang <shengjiu.wang@nxp.com>
Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
At this point err is always 0. So, just remove the check.
Fixes: CID1477380
Reviewed-by: S.j. Wang <shengjiu.wang@nxp.com>
Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Return value is not used so better use atomic_dec.
This also silences coverity warning CID3344689.
Reviewed-by: S.j. Wang <shengjiu.wang@nxp.com>
Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
xf_cmd_recv will return with lock taken in two cases:
* msg was received
* waiting for msg was interrupted by a signal
Make sure we unlock proxy->lock in both cases.
This fixes Coverity issue: CID3335482.
Reviewed-by: S.j. Wang <shengjiu.wang@nxp.com>
Reviewed-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
The reason is same as commit d4eb8ab263 ("MLK-19854-1: ASoC:
imx-cs42888: fix error when m4 image is not loaded")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Add rtc pl031 and a dummy clock node.
The pl031 is emulated by XEN, the address and interrupt is fixed in XEN.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Flynn xu <flynn.xu@nxp.com>
Correct the memory for root linux.
Because rpmsg reserved memory, we could not support 2nd Linux now with
the new memory. So remove the support for 2nd linux.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Flynn xu <flynn.xu@nxp.com>
In LPA mode, the system will be resumed by audio notification, when the
period size is small, there will be occasion that when notification
the underrun is happen, but the substream runtime state is not running
so the aplay won't trigger stop first, then start. just only trigger
the start, which don't comply with the convention.
So in this patch, we change the substream runtime state to running, when
the notification happened at resume.
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
For the LPA mode, when the system enter suspend, the M4 will
continue to play the data, but for normal ALSA case, the digital
mute should be called at suspend, so the codec will be mute,
which conflict with the requirement of LPA.
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
With the case that underrun happened, the aplay will trigger
stop and start, if the period index is not reset at stop, the
counter of period will be wrong
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
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>
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>
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>
Currently, the enable of the axi clock return status is ignored, causing
issues when the enable fails then we try to disable it. Therefore, it is
better to check the return status and disable it only when enable
succeeded.
Also, remove the helper functions around clk_axi, since we can directly
use the clk API function for enable/disable the clock. Those functions
are already checking for NULL clk and returning 0 if that's the case.
Signed-off-by: Robert Chiras <robert.chiras@nxp.com>i
Acked-by: Leonard Crestez <leonard.crestez@nxp.com>
Currently, the adma_lcdif clocks are wrong. Correct these clocks.
Fix suggestion received from:
Ranjani Vaidyanathan <ranjani.vaidyanathan@nxp.com>
Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
Acked-by: Leonard Crestez <leonard.crestez@nxp.com>
Patches related to suspend/resume have been backported from upstream
kernel, therefore some of the mxsfb_drm_private members are no longer
needed, so remove them, among with the code around them.
Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
Acked-by: Leonard Crestez <leonard.crestez@nxp.com>
The lcdif block is only powered on when display is active so plane
updates when not enabled are not valid. Writing to an unpowered IP block
is mostly ignored but can trigger bus errors on some chips.
Prevent this situation by switching to drm_atomic_helper_commit_tail_rpm
and having the drm core ensure atomic_plane_update is only called while
the crtc is active. This avoids having to keep track of "enabled" bits
inside the mxsfb driver.
This also requires handling the vblank event for disable from
mxsfb_pipe_disable.
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Suggested-by: Stefan Agner <stefan@agner.ch>
Reviewed-by: Stefan Agner <stefan@agner.ch>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Stefan Agner <stefan@agner.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/c19c0c00ed42e8e8f7965aa4821ac295abc5cd05.1537191359.git.leonard.crestez@nxp.com
Add drm_mode_config_helper_suspend/resume() which takes care of
atomic modeset suspend/resume for simple use cases.
The suspend state is stored in struct drm_mode_config.
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20171106191812.38927-3-noralf@tronnes.org
drm_fb_helper is *the* way of doing fbdev emulation so add a pointer to
struct drm_device. This makes it possible to add callback helpers for
.last_close and .output_poll_changed further reducing fbdev emulation
footprint in drivers. The pointer is set by drm_fb_helper_init() and
cleared by drm_fb_helper_fini().
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20171030153951.56269-3-noralf@tronnes.org
Adding lcdif nodes to a power domain currently results in
black/corrupted screens or hangs because power is not correctly enabled
when required.
Ensure power is on when display is active by adding
pm_runtime_get/put_sync to mxsfb_pipe_enable/disable.
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: Stefan Agner <stefan@agner.ch>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Stefan Agner <stefan@agner.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/ee88148399c63494cda4129b05444b0ac331b7a7.1537191359.git.leonard.crestez@nxp.com
LCDIF will repeatedly display data from CUR_BUF and set CUR_BUF to
NEXT_BUF when done. Since we are only ever writing to NEXT_BUF the
display will show an initial corrupt frame.
Fix by writing the FB paddr to both CUR_BUF and NEXT_BUF when
activating the CRTC.
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Tested-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Stefan Agner <stefan@agner.ch>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Stefan Agner <stefan@agner.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/7cdac9c064cc2b8a3d237934f186da98cefe6cb3.1537191359.git.leonard.crestez@nxp.com
The main axi clk is disabled at the end of mxsfb_crtc_mode_set_nofb and
immediately reenabled in mxsfb_enable_controller.
Avoid this by moving the handling of axi clk one level up to
mxsfb_crtc_enable. Do the same for mxsfb_crtc_disable for symmetry.
This shouldn't have any functional effect.
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: Stefan Agner <stefan@agner.ch>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Stefan Agner <stefan@agner.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/985c1f1cad250bd9ca154b3e4b3f913c310eeabd.1537191359.git.leonard.crestez@nxp.com
Enable and disable procedures contain info and warn prints. This
introduces delay in initialization / disablement procedures and we have
kept only the necessary prints in case of error.
Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
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>
i2c2 and i2c3 are work at 100KHz, so no need to set the pad to fast
slew rate, slow slew rate is enough.
This patch can also fix the synaptics_dsx touch work unstable issue.
When config the i2c bus pad to fast slew rate, synaptics_dsx touch
sometimes can't be recognized through i2c bus. Seems this touch
i2c slave device sensitive to the pad slew rate setting.
Acked-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Fix 'Division or modulo by zero' coverity issue(CID-4159438).
In fact, no need to call set_ramp_delay() in case of ramp_disable
is true, hence, ramp_delay never be 0 while set_ramp_delay() called.
Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: Anson Huang <Anson.Huang@nxp.com>