Since the eink panel will not be re-initialized after exit DSM(deep sleep mode),
it will depend on the last update content so we need keep the associated working
buffer content during DSM. The patch moves the initialization of working buffer
to probe() function and ensure it's just be initialized once and thus its
content will be kept.
The patch shall fix the following issue:
The codes as follows in unit test for clearing screen does not take effect
when enter/exit DSM.
---
printf("Blank screen\n");
memset(fb, 0xFE, screen_info.xres_virtual*screen_info.yres*screen_info.bits_per_pixel/8);
update_to_display(0, 0, screen_info.xres, screen_info.yres,
wave_mode, TRUE, 0);
---
Signed-off-by: Robby Cai <robby.cai@nxp.com>
(cherry picked from commit 87ba6d771e028f7482019a3003965b029ec08c65)
Refine the 'fb_info' field in 'mxsfb_info' that change this
field to be a pointer which can reduce the 'mxsfb_info' size.
Besides, store the 'host' data to fb_info->par to replace the
unnecessary 'to_imxfb_host' macro.
Signed-off-by: Fancy Fang <chen.fang@nxp.com>
The function 'platform_set_drvdata' will be called twice
during the probing stage. And the second calling is not
good and not necessary.
Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Missing the 'break' will cause the function return failure
when the 'bits_per_pixel' is 32 which should be supported.
Signed-off-by: Fancy Fang <chen.fang@nxp.com>
The default bpp should be set to a proper value if it is
not set yet during mipi panel display initialization.
Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Since the lcdif uses RGB interface to transfer image data to
mipi dsi, video mode should be used to transfer the image data.
So, the commands transfer should also use video mode to avoid
unnecessary mode switches.
Signed-off-by: Fancy Fang <chen.fang@nxp.com>
The assert gpio comes from 'gpio_spi' module, so the framebuffer
depends on the 'gpio_spi' driver loading. And in the case that
the framebuffer driver is loaded earlier than the 'gpio_spi'
driver, the gpio asserting will fail. So handle this gpio in
the framebuffer driver and add deferred probed support.
Signed-off-by: Fancy Fang <chen.fang@nxp.com>
The 'otm8018b' is the Source Driver IC which is used
by 'TFT3P5079E' panel. This patch is adding the build
support for the 'otm8018b' kernel driver.
Signed-off-by: Fancy Fang <chen.fang@nxp.com>
The 'otm8018b' is the Source Driver IC for 'TFT3P5079E'
mipi panel. This patch is the kernel driver for 'otm8018b'.
No backlight brightness adjustment function, since this is
not supported by imx7d sdb revb board.
Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Signed-off-by: Frank Li <frank.li@nxp.com>
restore the pinmux when resume from LPSR mode in suspend.
Signed-off-by: Robby Cai <r63905@freescale.com>
(cherry picked from commit 0462eb2cb8b64508260d9c6daa9f163d68ea6be0)
Conflicts:
drivers/video/mxsfb.c
(cherry picked from commit 8ddaa850df8cc9fe4dda4f505053eaa3f704ef69)
The 'timings' is allocated by 'of_get_display_timings()'
dynamically. So it should be freed when it is not used
anymore.
Signed-off-by: Fancy Fang <chen.fang@nxp.com>
l2c210_flush_all, the underlying implementation of outer_flush_all() has the
constraint on 4.1 kernel that, it can not be called under interrupt context.
However the EPDC driver can not guarantee this condition at calling point, thus
it could cause kernel dump. This has been observed on i.MX6SL, and theorically
on other platforms like i.MX6DL (using PL310 L2 cache). So use outer_flush_range
to fix it.
Although we don't have such issue on i.MX7D (not PL310 L2), we still prefer to
use outer_flush_range() for legacy software dithering support and for easy
maintenance. Then we do the change in both EPDC driver.
------------[ cut here ]------------
Kernel BUG at 800204d8 [verbose debug info unavailable]
Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
Modules linked in: galcore(O) evbug
CPU: 0 PID: 842 Comm: kworker/u3:1 Tainted: G O 4.1.8-1.0.0+ge352a0b #1
Hardware name: Freescale i.MX6 SoloLite (Device Tree)
Workqueue: EPDC Submit epdc_submit_work_func
task: a8a8f900 ti: a92a4000 task.ti: a92a4000
PC is at l2c210_flush_all+0x5c/0x60
LR is at epdc_submit_work_func+0x684/0xbf8
pc : [<800204d8>] lr : [<8030702c>] psr: 600b0013
sp : a92a5e90 ip : a9150c8c fp : a8480518
r10: a84a28c0 r9 : 00000008 r8 : a9150644
r7 : a91512e0 r6 : 0000012c r5 : a91512e0 r4 : a91512dc
r3 : a00b0013 r2 : 80b184a0 r1 : 701fe019 r0 : f4a02000
Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment kernel
Control: 10c53c7d Table: a943404a DAC: 00000015
Process kworker/u3:1 (pid: 842, stack limit = 0xa92a4210)
Stack: (0xa92a5e90 to 0xa92a6000)
5e80: a92a5ed0 8005d058 0000bbc2 a851d4c0
5ea0: 00000000 a9150000 a8480000 a8480440 00000190 00000193 55555556 a84a28c0
5ec0: a8480518 a8500000 80b18088 a94f3900 00000000 00000000 00000190 0000012c
5ee0: a94f3900 a8480518 a87e8d80 a8479000 a845a200 00000020 00000000 a8479000
5f00: a8479000 80046458 a92a4000 a8479000 a8479014 a8479000 a87e8d98 a8479014
...
Signed-off-by: Robby Cai <robby.cai@nxp.com>
We have implemented only two states for blank which are FB_BLANK_UNBLANK and
FB_BLANK_POWERDOWN. Let's map all the other blank states(FB_BLANK_NORMAL,
FB_BLANK_VSYNC_SUSPEND and FB_BLANK_HSYNC_SUSPEND) to FB_BLANK_POWERDOWN,
since all of them make the screen be blanked. This may avoid blanking a blanked
screen by setting the state to different non-zero values.
Signed-off-by: Liu Ying <victor.liu@nxp.com>
There's a GPIO pin to enable epdc signals on some platform like i.MX7D SDB.
However, it's changed from active-low to active-high on i.MX7D SDB RevB board.
Enhance the driver to handle the active level automatically,
then only need to adjust gpio as well as active level in dts file if necessary.
Signed-off-by: Robby Cai <robby.cai@nxp.com>
When enable CONFIG_FB_MXC_MIPI_DSI, meet following compiling error.
drivers/video/fbdev/mxc/mipi_dsi_samsung.o: In function `mipi_dsi_pkt_write':
mipi_dsi_samsung.c:(.text+0x818): multiple definition of `mipi_dsi_pkt_write'
drivers/video/fbdev/mxc/mipi_dsi.o:mipi_dsi.c:(.text+0xa74): first defined here
drivers/video/fbdev/mxc/mipi_dsi_samsung.o: In function `mipi_dsi_pkt_read':
mipi_dsi_samsung.c:(.text+0x9d8): multiple definition of `mipi_dsi_pkt_read'
drivers/video/fbdev/mxc/mipi_dsi.o:mipi_dsi.c:(.text+0xc5c): first defined here
drivers/video/fbdev/mxc/mipi_dsi_samsung.o: In function `mipi_dsi_dcs_cmd':
mipi_dsi_samsung.c:(.text+0xa88): multiple definition of `mipi_dsi_dcs_cmd'
drivers/video/fbdev/mxc/mipi_dsi.o:mipi_dsi.c:(.text+0xdb0): first defined here
make[4]: *** [drivers/video/fbdev/mxc/built-in.o] Error 1
make[3]: *** [drivers/video/fbdev/mxc] Error 2
make[2]: *** [drivers/video/fbdev] Error 2
make[1]: *** [drivers/video] Error 2
move three dsi packet related functions to mipi_dsi_info
structure. This will avoid the multiple definition compiling
issue. This is what the commit f54c7527895575a2e474b17a4752724977b898ea does
in 3.14.y
Signed-off-by: Robby Cai <robby.cai@nxp.com>
The resolution of an overlay framebuffer could be at most the same to the
one of the relevant background framebuffer. However, the resolution of a
HDMI monitor could be changed at runtime. Thus, when we unblank the overlay
framebuffer, we should check it's resolution and start position in case it
exceeds the boundary of the background framebuffer. This patch replaces
mxcfb_set_par() with fb_set_var() to implement the unblank operation so that
the logic contains the ->fb_check_var() path.
Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
When HDCP running in repeater mode,
HDCP software workaround "HW_WA_HDCP_DC0" is working in
HDCP keepout window stop state.
It will cause HDCP compliance test 1B-01A failed.
So active HDCP keepout widows and 1B-01A is passed.
Signed-off-by: Sandor Yu <R01008@freescale.com>
We don't have to touch fbi->modelist in ldb_init(), because mxcfb_register()
may initialize the list and add a video mode to the list for us.
This patch fixes the following issue reported by Coverity:
INIT_LIST_HEAD(&fbi->modelist);
Uninitialized scalar variable (UNINIT)
uninit_use_in_call: Using uninitialized value fb_vm. Field fb_vm.name is
uninitialized when calling fb_add_videomode.
fb_add_videomode(&fb_vm, &fbi->modelist);
fb_videomode_to_var(&fbi->var, &fb_vm);
Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
The function fbi_to_pixfmt() could access the pointer fbi->device provided
by it's input parameter fbi, so let's make sure the pointer isn't dangling.
This patch fixes the following issue reported by Coverity:
Uninitialized pointer read (UNINIT)
uninit_use_in_call: Using uninitialized value tmp_fbi.device when calling
fbi_to_pixfmt.
switch (fbi_to_pixfmt(&tmp_fbi, true)) {
case IPU_PIX_FMT_YUV420P2:
case IPU_PIX_FMT_YVU420P:
Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
Resources(kmem and DMA) should be freed correctly in the bailout path of
ioctrl FBIO_ALLOC. We should also delete mem->list from fb_alloc_list
in the bailout path if necessary.
The kmem leakage issue is reported by Coverity:
if (get_user(size, argp))
Resource leak (RESOURCE_LEAK)
leaked_storage: Variable mem going out of scope leaks the storage it points to.
return -EFAULT;
Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
It has to be successful to find a relevant background framebuffer for a
foreground framebuffer. So, we should return error code if it happens
to fail.
This patch fixes the following issue reported by Coverity:
Dereference after null check (FORWARD_NULL)
var_deref_op: Dereferencing null pointer fbi_tmp.
if (fbi_tmp->var.vmode & FB_VMODE_INTERLACED)
var->vmode |= FB_VMODE_INTERLACED;
else
var->vmode &= ~FB_VMODE_INTERLACED;
Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
The driver takes the pointer fbi as the driver data, so fbi cannot be a NULL
pointer in ->remove(). Let's remove the unnecessary NULL pointer check on
fbi.
This patch fixes the following issue reported by Coverity:
deref_ptr: Directly dereferencing pointer fbi.
struct mxcfb_info *mxc_fbi = fbi->par;
Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking fbi suggests that it may be null, but it has
already been dereferenced on all paths leading to the check.
if (!fbi)
return 0;
Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
When a framebuffer is blanked, the user may call the MXCFB_SET_PREFETCH ioctrl
to enable or disable the prefetch engine. After sanity check, the cached
->prefetch should reflect the user's intention for next unblank operation
any way instead of checking ->cur_prefetch first.
Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
The previous fb buffer management has two problems:
1. After reallocate a bigger buffer and free the old buffer,
user space app doesn't know this and may continue accessing
the old buffer.
2. The freed buffer contents will be lost.
So, this patch allocates a big enough fb buffer(32MB) from the
beginning and never reallocates it.
Signed-off-by: Fancy Fang <chen.fang@freescale.com>
(cherry picked from commit c76a37e342369675aa9ef2efde6373d288c2f013)
Conflicts:
drivers/video/mxsfb.c
The 'CONFIG_PM_RUNTIME' has been eliminated and all the users
should use 'CONFIG_PM' directly. So do this change for epdc and
epdc-v2.
Signed-off-by: Fancy Fang <chen.fang@freescale.com>
The 'CONFIG_PM_RUNTIME' has been eliminated and all the users
should use 'CONFIG_PM' directly. So do this change for mxsfb.
Signed-off-by: Fancy Fang <chen.fang@freescale.com>
The fb_pan_display() return value should be corrected
according to the wait_for_completion_timeout() return
value.
Signed-off-by: Fancy Fang <chen.fang@freescale.com>
(cherry picked from commit 459d01cbda39e51029c55e583909ef645037b7f3)
Conflicts:
drivers/video/mxsfb.c
Remove the timestamp usage in the 'MXCFB_WAIT_FOR_VSYNC'
ioctl handler, since the 64 bit timestamp would cause
data overflow when writing it to user memory.
Signed-off-by: Fancy Fang <chen.fang@freescale.com>
(cherry picked from commit 4bfbf67a384f1292d217769b77858c08f38fe658)
Conflicts:
drivers/video/mxsfb.c
In order to workaround the PRE SoC bug recorded by errata ERR009624, the
software cannot write the PRE_CTRL register when the PRE writes the PRE_CTRL
register automatically to set the ENABLE bit(bit0) to 1 in the PRE repeat mode.
Instead of setting the PRE_CTRL register any time we want to do on-the-fly
switch(PRE keeps working before and after the switch), we change to set the
register in the on-the-fly configuration interrupt(EOF) handler. This way,
we may avoid encountering the problematic PRE automatic writing cycle for sure.
Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
(cherry picked from commit 6218cbcf34f5fb7910a824a8d31cc58819d0bd00)
In order to workaround the PRE SoC bug recorded by errata ERR009624, the
software cannot write the PRE_CTRL register when the PRE writes the PRE_CTRL
register automatically to set the ENABLE bit(bit0) to 1 in the PRE repeat mode.
The software mechanism to set the PRE_CTRL register is different for PRE Y
resolution higher than 9 lines and lower than or equal to 9 lines.
For cases in which Y resolution is higher than 9 lines, before we update PRE
shadow, we just need to wait until the PRE store engine status runs out of
the problematic PRE automatic writing window.
While for cases in which Y resolutin is lower than or equal to 9 lines, we
have to update PRE shadow in the buffer flip interrupt handler.
Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
(cherry picked from commit bd9c14e24aaf67926dfd31bd819ab0c87129fe4b)
In order to workaround the PRE SoC bug recorded by errata ERR009624, the
software cannot write the PRE_CTRL register when the PRE writes the PRE_CTRL
register automatically to set the ENABLE bit(bit0) to 1 in the PRE repeat mode.
This patch exports a function to set the PRE_CTRL register so that it could be
used by the software when the PRE automatic writing doesn't happen for sure.
Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
(cherry picked from commit e64bbcd9243a17f9eba9cb3abb6f2c1939eae110)
There could be frame drop issue when we do pan display if we update PRE next
buffer address before waiting for the flip completion, because we may hold
the flip completion already and then two continuous pan display operations may
happen quickly within one active period of frame scanning - the first PRE next
buffer address is overriden. To fix this issue, this patch updates the buffer
address after the flip completion.
Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
(cherry picked from commit d0126e42f46f6dad9ae8c6aa390b0e1bea76492e)
This parameter bypass count is used to make sure the mipi
dsi be initialized correctly without any display error.
In the mipi dsi initialization, it requires the first
two parameter setting operations should be done really.
Signed-off-by: Fancy Fang <chen.fang@freescale.com>
(cherry picked from commit 969122c2f4363dee4cf489b87984c4d85dcd89ce)
Conflicts:
drivers/video/mxsfb.c
The pm power's usage_count should be first added by
one before putting it into suspend state. Otherwise
the usage_count will be negative and the power cannot
be put into suspend state correctly.
Signed-off-by: Fancy Fang <chen.fang@freescale.com>
(cherry picked from commit a48460b41399112f5d3ae03b30e3f9e885346ff7)
Conflicts:
drivers/video/mxsfb.c