platform/kernel/linux-starfive.git
3 years agovideo: fbdev: s3c-fb: Fix kernel-doc and set but not used warnings
Sam Ravnborg [Sat, 28 Nov 2020 22:41:10 +0000 (23:41 +0100)]
video: fbdev: s3c-fb: Fix kernel-doc and set but not used warnings

Fix several W=1 warnings
- Updated kernel-doc as needed
- Deleted unused local variable, it was assigned but never used

v2:
  - Updated subject (Lee)

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Jingoo Han <jingoohan1@gmail.com>
Cc: linux-fbdev@vger.kernel.org
Cc: Lee Jones <lee.jones@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201128224114.1033617-25-sam@ravnborg.org
3 years agovideo: fbdev: omapfb: Fix set but not used warnings in dsi
Sam Ravnborg [Sat, 28 Nov 2020 22:41:08 +0000 (23:41 +0100)]
video: fbdev: omapfb: Fix set but not used warnings in dsi

Fix several W=1 warnings.
This removes unused code and avoids an assignment by moving
the use inside the conditional block.

The register read FLD_GET(r, 15, 8) could be dropped as it was done a
few lines before too.

v2:
  - Updated subject (Lee)

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Aditya Pakki <pakki001@umn.edu>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Lee Jones <lee.jones@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201128224114.1033617-23-sam@ravnborg.org
3 years agodrm/kmb: fix array bounds warning
Arnd Bergmann [Sun, 29 Nov 2020 20:09:08 +0000 (21:09 +0100)]
drm/kmb: fix array bounds warning

gcc warns about an out-of-bounds access when the using nonzero
values for 'plane_id' on kmb->plane_status:

drivers/gpu/drm/kmb/kmb_plane.c: In function 'kmb_plane_atomic_disable':
drivers/gpu/drm/kmb/kmb_plane.c:128:20: warning: array subscript 3 is above array bounds of 'struct layer_status[1]' [-Warray-bounds]
  128 |   kmb->plane_status[plane_id].ctrl = LCD_CTRL_GL2_ENABLE;
      |   ~~~~~~~~~~~~~~~~~^~~~~~~~~~
drivers/gpu/drm/kmb/kmb_plane.c:125:20: warning: array subscript 2 is above array bounds of 'struct layer_status[1]' [-Warray-bounds]
  125 |   kmb->plane_status[plane_id].ctrl = LCD_CTRL_GL1_ENABLE;
      |   ~~~~~~~~~~~~~~~~~^~~~~~~~~~
drivers/gpu/drm/kmb/kmb_plane.c:122:20: warning: array subscript 1 is above array bounds of 'struct layer_status[1]' [-Warray-bounds]
  122 |   kmb->plane_status[plane_id].ctrl = LCD_CTRL_VL2_ENABLE;

Having the array truncated to one entry seems intentional, so add
a range check before indexing it to make it clearer what is going
on and shut up the warning.

I received the warning from the kernel test robot after a private
patch that turns on Warray-bounds unconditionally.

Fixes: 7f7b96a8a0a1 ("drm/kmb: Add support for KeemBay Display")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Anitha Chrisanthus <anitha.chrisanthus@intel.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201129200927.1854104-1-arnd@kernel.org
3 years agodrm: panel: add flags to BOE NV110WTM-N61
Douglas Anderson [Tue, 1 Dec 2020 20:56:11 +0000 (12:56 -0800)]
drm: panel: add flags to BOE NV110WTM-N61

I forgot to add these when posting up the support for BOE
NV110WTM-N61.  Add them now.

Fixes: a96ee0f6b58d ("drm: panel: simple: Add BOE NV110WTM-N61")
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Cc: Douglas Anderson <dianders@chromium.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201201125554.v2.1.I8a7bfc0966e803ab91001c9e6d01a736950c4981@changeid
3 years agodrm: panel: Fully transition panel_desc kerneldoc to inline style
Douglas Anderson [Tue, 1 Dec 2020 20:59:12 +0000 (12:59 -0800)]
drm: panel: Fully transition panel_desc kerneldoc to inline style

In commit 131f909ad55f ("drm: panel: simple: Fixup the struct
panel_desc kernel doc") I transitioned the more deeply nested
kerneldoc comments into the inline style.  Apparently it is desirable
to continue the job and move _everything_ in this struct to inline.
Let's do it.

While doing this, we also add a short summary for the whole struct to
fix a warning when we run with extra warnings, AKA:
  scripts/kernel-doc -v -rst drivers/gpu/drm/panel/panel-simple.c

The warning was:
  drivers/gpu/drm/panel/panel-simple.c:42: warning: missing initial short description on line:
   * struct panel_desc

Suggested-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Cc: Douglas Anderson <dianders@chromium.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201201125822.1.I3c4191336014bd57364309439e56f600c94bb12b@changeid
3 years agodrm: Remove drmm_add_final_kfree() declaration from public headers
Laurent Pinchart [Fri, 4 Dec 2020 09:29:32 +0000 (11:29 +0200)]
drm: Remove drmm_add_final_kfree() declaration from public headers

The drmm_add_final_kfree() function is declared in the
include/drm/drm_managed.h public header, but has become an internal API
not exposed to drivers. Drop it from drm_managed.h as it's already
declared in drm_internal.h.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201204092932.21636-1-laurent.pinchart+renesas@ideasonboard.com
3 years agodrm/hisilicon: Delete the entire file hibmc_ttm.c
Tian Tao [Fri, 4 Dec 2020 01:23:18 +0000 (09:23 +0800)]
drm/hisilicon: Delete the entire file hibmc_ttm.c

Delete the entire file hibmc_ttm.c. drmm_vram_helper_init() can be
called directly from hibmc_load(). hibmc_dumb_create() and
hibmc_mode_funcs can go to hibmc_drm_drv.c

v2:
change Deletted to Delete

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/1607044999-47666-13-git-send-email-tiantao6@hisilicon.com
3 years agodrm/hisilicon: Use managed VRAM-helper initialization
Tian Tao [Thu, 3 Dec 2020 03:09:13 +0000 (11:09 +0800)]
drm/hisilicon: Use managed VRAM-helper initialization

updated to use drmm_vram_helper_init()

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/1606964953-24309-1-git-send-email-tiantao6@hisilicon.com
3 years agodrm/ingenic: depend on COMMON_CLK to fix compile tests
Krzysztof Kozlowski [Mon, 16 Nov 2020 17:53:01 +0000 (18:53 +0100)]
drm/ingenic: depend on COMMON_CLK to fix compile tests

The Ingenic DRM uses Common Clock Framework thus it cannot be built on
platforms without it (e.g. compile test on MIPS with RALINK and
SOC_RT305X):

    /usr/bin/mips-linux-gnu-ld: drivers/gpu/drm/ingenic/ingenic-drm-drv.o: in function `ingenic_drm_bind.isra.0':
    ingenic-drm-drv.c:(.text+0x1600): undefined reference to `clk_get_parent'
    /usr/bin/mips-linux-gnu-ld: ingenic-drm-drv.c:(.text+0x16b0): undefined reference to `clk_get_parent'

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20201116175301.402787-2-krzk@kernel.org
3 years agodrm/fb-helper: Add missed unlocks in setcmap_legacy()
Chuhong Yuan [Thu, 3 Dec 2020 14:42:48 +0000 (22:42 +0800)]
drm/fb-helper: Add missed unlocks in setcmap_legacy()

setcmap_legacy() does not call drm_modeset_unlock_all() in some exits,
add the missed unlocks with goto to fix it.

Fixes: 964c60063bff ("drm/fb-helper: separate the fb_setcmap helper into atomic and legacy paths")
Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20201203144248.418281-1-hslester96@gmail.com
3 years agogma500: clean up error handling in init
Dan Carpenter [Thu, 3 Dec 2020 08:40:48 +0000 (11:40 +0300)]
gma500: clean up error handling in init

The main problem with this error handling was that it didn't clean up if
i2c_add_numbered_adapter() failed.  This code is pretty old, and doesn't
match with today's checkpatch.pl standards so I took the opportunity to
tidy it up a bit.  I changed the NULL comparison, and removed the
WARNING message if kzalloc() fails and updated the label names.

Fixes: 1b082ccf5901 ("gma500: Add Oaktrail support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/X8ikkAqZfnDO2lu6@mwanda
3 years agodrm/hisilicon: Use the new api devm_drm_irq_install
Tian Tao [Wed, 2 Dec 2020 09:26:52 +0000 (17:26 +0800)]
drm/hisilicon: Use the new api devm_drm_irq_install

Use devm_drm_irq_install to register interrupts so that
drm_irq_uninstall is not called when hibmc is removed.

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/1606901212-8214-4-git-send-email-tiantao6@hisilicon.com
3 years agodrm/irq: Add the new api to install irq
Tian Tao [Wed, 2 Dec 2020 09:26:51 +0000 (17:26 +0800)]
drm/irq: Add the new api to install irq

Add new api devm_drm_irq_install() to register interrupts,
no need to call drm_irq_uninstall() when the drm module is removed.

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/1606901212-8214-3-git-send-email-tiantao6@hisilicon.com
3 years agodrm/hisilicon: Code refactoring for hibmc_drm_drv
Tian Tao [Wed, 2 Dec 2020 09:26:50 +0000 (17:26 +0800)]
drm/hisilicon: Code refactoring for hibmc_drm_drv

Use the devm_drm_dev_alloc provided by the drm framework to alloc
a structure hibmc_drm_private.

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/1606901212-8214-2-git-send-email-tiantao6@hisilicon.com
3 years agodrm: document that user-space should force-probe connectors
Simon Ser [Mon, 30 Nov 2020 16:26:12 +0000 (16:26 +0000)]
drm: document that user-space should force-probe connectors

It seems like we can't have nice things, so let's just document the
disappointing behaviour instead.

The previous version assumed the kernel would perform the probing work
when appropriate, however this is not the case today. Update the
documentation to reflect reality.

v2:

- Improve commit message to explain why this change is made (Pekka)
- Keep the bit about flickering (Daniel)
- Explain when user-space should force-probe, and when it shouldn't (Daniel)

Signed-off-by: Simon Ser <contact@emersion.fr>
Fixes: 2ac5ef3b2362 ("drm: document drm_mode_get_connector")
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/AxqLnTAsFCRishOVB5CLsqIesmrMrm7oytnOVB7oPA@cp7-web-043.plabs.ch
3 years agodrm/virtio: consider dma-fence context when signaling
Gurchetan Singh [Tue, 1 Dec 2020 02:16:23 +0000 (18:16 -0800)]
drm/virtio: consider dma-fence context when signaling

This an incremental refactor towards multiple dma-fence contexts
in virtio-gpu.  Since all fences are still allocated using
&virtio_gpu_fence_driver.context, nothing should break and every
processed fence will be signaled.

The overall idea is every 3D context can allocate a number of
dma-fence contexts.  Each dma-fence context refers to it's own
timeline.

For example, consider the following case where virgl submits
commands to the GPU (fence ids 1, 3) and does a metadata query with
the CPU (fence id 5).  In a different process, gfxstream submits
commands to the GPU (fence ids 2, 4).

fence_id (&dma_fence.seqno)       | 1 2 3 4 5
----------------------------------|-----------
fence_ctx 0 (virgl gpu)           | 1   3
fence_ctx 1 (virgl metadata query)|         5
fence_ctx 2 (gfxstream gpu)       |   2   4

With multiple fence contexts, we can wait for the metadata query
to finish without waiting for the virgl gpu to finish.  virgl gpu
does not have to wait for gfxstream gpu.  The fence id still is the
monotonically increasing sequence number, but it's only revelant to
the specific dma-fence context.

To fully enable this feature, we'll need to:
  - have each 3d context allocate a number of fence contexts. Not
    too hard with explicit context initialization on the horizon.
  - have guest userspace specify fence context when performing
    ioctls.
  - tag each fence emitted to the host with the fence context
    information.  virtio_gpu_ctrl_hdr has padding + flags available,
    so that should be easy.

This change goes in the direction specified above, by:
  - looking up the virtgpu_fence given a fence_id
  - signalling all prior fences in a given context
  - signalling current fence

v2: fix grammar in comment
v3: add r-b tags

Reviewed-by: Anthoine Bourgeois <anthoine.bourgeois@gmail.com>
Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20201201021623.619-3-gurchetansingh@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agodrm/virtio: rework virtio_fence_signaled
Gurchetan Singh [Tue, 1 Dec 2020 02:16:22 +0000 (18:16 -0800)]
drm/virtio: rework virtio_fence_signaled

virtio_gpu_fence_event_process sets the last_fence_id and
subsequently calls dma_fence_signal_locked(..).

dma_fence_signal_locked(..) sets DMA_FENCE_FLAG_SIGNALED_BIT,
which is actually checked before &dma_fence_ops.(*signaled) is
called.

The check for last_fence_id is therefore a bit redundant, and
it will not be sufficient to check the last_fence_id for multiple
synchronization timelines.  Remove it.

v3: add r-b tags

Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Anthoine Bourgeois <anthoine.bourgeois@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20201201021623.619-2-gurchetansingh@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agodrm/virtio: virtio_{blah} --> virtio_gpu_{blah}
Gurchetan Singh [Tue, 1 Dec 2020 02:16:21 +0000 (18:16 -0800)]
drm/virtio: virtio_{blah} --> virtio_gpu_{blah}

virtio_gpu typically uses the prefix virtio_gpu, but there are
a few places where the virtio prefix is used.  Modify this for
consistency.

v3: add r-b tags

Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Anthoine Bourgeois <anthoine.bourgeois@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20201201021623.619-1-gurchetansingh@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agodrm/ttm: stop destroying pinned ghost object
Christian König [Tue, 1 Dec 2020 13:27:34 +0000 (14:27 +0100)]
drm/ttm: stop destroying pinned ghost object

Daniel added a warning for this, but we were abusing that behavior here.

Signed-off-by: Christian König <christian.koenig@amd.com>
Fixes: 57fcd550eb15 ("drm/ttm: Warn on pinning without holding a reference")
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/series/84456/
3 years agodrm/nouveau: Drop mutex_lock_nested for atomic
Daniel Vetter [Fri, 27 Nov 2020 16:35:28 +0000 (17:35 +0100)]
drm/nouveau: Drop mutex_lock_nested for atomic

Purely conjecture, but I think the original locking inversion with the
legacy page flip code between flipping and ttm's bo move function
shoudn't exist anymore with atomic: With atomic the bo pinning and
actual modeset commit is completely separated in the code patsh.

This annotation was originally added in

commit 060810d7abaabcab282e062c595871d661561400
Author: Ben Skeggs <bskeggs@redhat.com>
Date:   Mon Jul 8 14:15:51 2013 +1000

    drm/nouveau: fix locking issues in page flipping paths

due to

commit b580c9e2b7ba5030a795aa2fb73b796523d65a78
Author: Maarten Lankhorst <m.b.lankhorst@gmail.com>
Date:   Thu Jun 27 13:48:18 2013 +0200

    drm/nouveau: make flipping lockdep safe

Acked-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Maarten Lankhorst <m.b.lankhorst@gmail.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Dave Airlie <airlied@gmail.com>
Cc: nouveau@lists.freedesktop.org
Link: https://patchwork.freedesktop.org/patch/msgid/20201127163528.2221671-1-daniel.vetter@ffwll.ch
3 years agodrm/gma500: Fix error return code in psb_driver_load()
Jialin Zhang [Mon, 30 Nov 2020 02:02:16 +0000 (10:02 +0800)]
drm/gma500: Fix error return code in psb_driver_load()

Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.

Fixes: 5c49fd3aa0ab ("gma500: Add the core DRM files and headers")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jialin Zhang <zhangjialin11@huawei.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20201130020216.1906141-1-zhangjialin11@huawei.com
3 years agodrm/ttm/drivers: remove unecessary ttm_module.h include v2
Christian König [Tue, 17 Nov 2020 14:44:07 +0000 (15:44 +0100)]
drm/ttm/drivers: remove unecessary ttm_module.h include v2

ttm_module.h deals with internals of TTM and should never
be include outside of it.

v2: also move the file around

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/404885/
3 years agovideo: fbdev: nvidia: Fix set but not used warnings
Sam Ravnborg [Sat, 28 Nov 2020 22:41:06 +0000 (23:41 +0100)]
video: fbdev: nvidia: Fix set but not used warnings

Fix warnings by deleting unused code. The register reads are
kept as it is unknown if there are any hidden side-effects.

v2:
  - Update subject (Lee)

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Antonino Daplas <adaplas@gmail.com>
Cc: linux-fbdev@vger.kernel.org
Cc: Lee Jones <lee.jones@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201128224114.1033617-21-sam@ravnborg.org
3 years agovideo: fbdev: neofb: Fix set but not used warning for CursorMem
Sam Ravnborg [Sat, 28 Nov 2020 22:41:01 +0000 (23:41 +0100)]
video: fbdev: neofb: Fix set but not used warning for CursorMem

Fix W=1 warnings by removing unused code

v2:
  - Updated subject (Lee)

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Evgeny Novikov <novikov@ispras.ru>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Lee Jones <lee.jones@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201128224114.1033617-16-sam@ravnborg.org
3 years agovideo: fbdev: sstfb: Updated logging to fix set but not used warnings
Sam Ravnborg [Sat, 28 Nov 2020 22:41:05 +0000 (23:41 +0100)]
video: fbdev: sstfb: Updated logging to fix set but not used warnings

Fix set but not used warnings by introducing no_printk variants
for the internal logging system for this driver.

Fix a new warning that popped up now that logging was checked for
correct printf format strings.

A more invasive fix had been to replace all the internal logging with
standard logging primitives - thats for another day.

v2:
  - Update subject (Lee)

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Alex Dewar <alex.dewar90@gmail.com>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: linux-fbdev@vger.kernel.org
Cc: Lee Jones <lee.jones@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201128224114.1033617-20-sam@ravnborg.org
3 years agovideo: fbdev: mx3fb: Fix kernel-doc, set but not used and string warnings
Sam Ravnborg [Sat, 28 Nov 2020 22:41:04 +0000 (23:41 +0100)]
video: fbdev: mx3fb: Fix kernel-doc, set but not used and string warnings

Fix W=1 warnings:
- Fix kernel-doc
- Drop unused code/variables
- Use memcpy to copy a string without zero-termination
  strncpy() generates a warning

v2:
  - Updated subject (Lee)

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Xiaofei Tan <tanxiaofei@huawei.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Lee Jones <lee.jones@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201128224114.1033617-19-sam@ravnborg.org
3 years agovideo: fbdev: tgafb: Fix kernel-doc and set but not used warnings
Sam Ravnborg [Sat, 28 Nov 2020 22:41:03 +0000 (23:41 +0100)]
video: fbdev: tgafb: Fix kernel-doc and set but not used warnings

Fix W=1 warnings:
- Fix kernel-doc
- Drop unused code

v2:
  - Updated subject (Lee)

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Joe Perches <joe@perches.com>
Cc: Lee Jones <lee.jones@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201128224114.1033617-18-sam@ravnborg.org
3 years agovideo: fbdev: pm2fb: Fix kernel-doc warnings
Sam Ravnborg [Sat, 28 Nov 2020 22:41:00 +0000 (23:41 +0100)]
video: fbdev: pm2fb: Fix kernel-doc warnings

Fixed a few kernel-doc issues to fix the warnings.

v2:
  - Updated subject (Lee)

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Lee Jones <lee.jones@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201128224114.1033617-15-sam@ravnborg.org
3 years agovideo: fbdev: riva: Fix kernel-doc and set but not used warnings
Sam Ravnborg [Sat, 28 Nov 2020 22:40:59 +0000 (23:40 +0100)]
video: fbdev: riva: Fix kernel-doc and set but not used warnings

Fix W=1 warnings:
- Fix kernel-doc
- Drop unused variables/code

v2:
  - Updated subject (Lee)

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Antonino Daplas <adaplas@gmail.com>
Cc: linux-fbdev@vger.kernel.org
Cc: Lee Jones <lee.jones@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201128224114.1033617-14-sam@ravnborg.org
3 years agovideo: fbdev: tdfx: Fix set but not used warning in att_outb()
Sam Ravnborg [Sat, 28 Nov 2020 22:40:58 +0000 (23:40 +0100)]
video: fbdev: tdfx: Fix set but not used warning in att_outb()

The tmp variable was assigned but the result was never used,
so delete the tmp variable.

v2:
  - Update subject (Lee)

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Lee Jones <lee.jones@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201128224114.1033617-13-sam@ravnborg.org
3 years agovideo: fbdev: via: Fix set but not used warning for mode_crt_table
Sam Ravnborg [Sat, 28 Nov 2020 22:40:57 +0000 (23:40 +0100)]
video: fbdev: via: Fix set but not used warning for mode_crt_table

Fix warning by deleting the variable. The function call
viafb_get_best_mode() was verified to have no side-effects,
and thus could be dropped too.

v2:
  - Update subject (Lee)

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: linux-fbdev@vger.kernel.org
Cc: Lee Jones <lee.jones@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201128224114.1033617-12-sam@ravnborg.org
3 years agovideo: fbdev: sis: Fix set but not used warnings in sis_main
Sam Ravnborg [Sat, 28 Nov 2020 22:40:56 +0000 (23:40 +0100)]
video: fbdev: sis: Fix set but not used warnings in sis_main

Fix warnings by dropping unused variable and the
unused assignments.

v2:
  - Update subject (Lee)

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Thomas Winischhofer <thomas@winischhofer.net>
Cc: Lee Jones <lee.jones@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201128224114.1033617-11-sam@ravnborg.org
3 years agovideo: fbdev: sis: Fix set but not used warnings in init.c
Sam Ravnborg [Sat, 28 Nov 2020 22:40:55 +0000 (23:40 +0100)]
video: fbdev: sis: Fix set but not used warnings in init.c

Fix "set but not used" warnings by removing the code the assign the
variables and the definition of the variables.
A register read is kept as it may have unknown side-effects.

This removes a lot of unused code - which is always a good thing to do.

v2:
  - Updated subject (Lee)

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Thomas Winischhofer <thomas@winischhofer.net>
Cc: Lee Jones <lee.jones@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201128224114.1033617-10-sam@ravnborg.org
3 years agovideo: fbdev: sis: Fix defined but not used warning of SiS_TVDelay
Sam Ravnborg [Sat, 28 Nov 2020 22:40:54 +0000 (23:40 +0100)]
video: fbdev: sis: Fix defined but not used warning of SiS_TVDelay

Fix W=1 warning by commenting unused SiS_TVDelay* variables.

The SiS_TVDelay* variables seem to contain some magic numbers
so looks like data worth keeping around but not as code we build.

v2:
  - Update subject (Lee)

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Thomas Winischhofer <thomas@winischhofer.net>
Cc: Lee Jones <lee.jones@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201128224114.1033617-9-sam@ravnborg.org
3 years agovideo: fbdev: sis: Fix defined but not used warnings
Sam Ravnborg [Sat, 28 Nov 2020 22:40:53 +0000 (23:40 +0100)]
video: fbdev: sis: Fix defined but not used warnings

init.h defines static symbols, so it should only be included
once. Drop the include from sis.h as it is not needed.
This fixes a lot of warnings seen with a W=1 build.

v2:
  - Update subject (Lee)

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Thomas Winischhofer <thomas@winischhofer.net>
Cc: Lee Jones <lee.jones@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201128224114.1033617-8-sam@ravnborg.org
3 years agovideo: fbdev: aty: Fix set but not used warnings in mach64_ct
Sam Ravnborg [Sat, 28 Nov 2020 22:40:52 +0000 (23:40 +0100)]
video: fbdev: aty: Fix set but not used warnings in mach64_ct

Fix W=1 warnings about variables assigned but never used.
- One variable is only used when CONFIG_FB_ATY_GENERIC_LCD is defined
  Fix so variable is only defined with CONFIG_FB_ATY_GENERIC_LCD
- Several variables was only assigned by a call to aty_ld_le32().
  Drop the variables but keep the call to aty_ld_le32() as it may
  have unexpected side-effects.

v2:
  - Updated subject (Lee)

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Lee Jones <lee.jones@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201128224114.1033617-7-sam@ravnborg.org
3 years agovideo: fbdev: aty: Fix set but not used warnings
Sam Ravnborg [Sat, 28 Nov 2020 22:40:51 +0000 (23:40 +0100)]
video: fbdev: aty: Fix set but not used warnings

Fix W=1 warnings about variables assigned but never used.

- Drop variables that were set but never used
- Make variable definition conditional on ATARI

v2:
  - Fix m68k build error (kernel test robot)
  - Improve subject (Lee Jones)

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Reported-by: kernel test robot <lkp@intel.com> # m68k build fix
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Joe Perches <joe@perches.com>
Cc: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Cc: Jason Yan <yanaijie@huawei.com>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201128224114.1033617-6-sam@ravnborg.org
3 years agovideo: fbdev: aty: Delete unused variable in radeon_monitor
Sam Ravnborg [Sat, 28 Nov 2020 22:40:50 +0000 (23:40 +0100)]
video: fbdev: aty: Delete unused variable in radeon_monitor

Fix warning about variable that is asssigned a value but never used.
The variable was indeed never used so delete it.

Keep the call to radeon_probe_i2c_connector() as it may have
side-effects. It is unlikely but I could not verify that is was safe to
drop the call.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: linux-fbdev@vger.kernel.org
Link: https://patchwork.freedesktop.org/patch/msgid/20201128224114.1033617-5-sam@ravnborg.org
3 years agodrm/prime: split array import functions v4
Christian König [Thu, 8 Oct 2020 10:57:32 +0000 (12:57 +0200)]
drm/prime: split array import functions v4

Mapping the imported pages of a DMA-buf into an userspace process
doesn't work as expected.

But we have reoccurring requests on this approach, so split the
functions for this and  document that dma_buf_mmap() needs to be used
instead.

v2: split it into two functions
v3: rebased on latest changes
v4: update commit message a bit

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/403838/
3 years agodrm/ttm: nuke ttm_dma_tt_init
Christian König [Mon, 23 Nov 2020 13:56:49 +0000 (14:56 +0100)]
drm/ttm: nuke ttm_dma_tt_init

Not used any more.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/403837/
3 years agodrm/qxl: switch to ttm_sg_tt_init
Christian König [Mon, 23 Nov 2020 13:54:36 +0000 (14:54 +0100)]
drm/qxl: switch to ttm_sg_tt_init

The function qxl_gem_prime_import_sg_table is not fully implemented.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/403833/
3 years agodrm/vmwgfx: switch to ttm_sg_tt_init
Christian König [Mon, 23 Nov 2020 13:53:05 +0000 (14:53 +0100)]
drm/vmwgfx: switch to ttm_sg_tt_init

According to Daniel VMWGFX doesn't support DMA-buf anyway.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/403834/
3 years agodrm/nouveau: stop using pages with drm_prime_sg_to_page_addr_arrays v2
Christian König [Fri, 9 Oct 2020 13:44:48 +0000 (15:44 +0200)]
drm/nouveau: stop using pages with drm_prime_sg_to_page_addr_arrays v2

This is deprecated, also drop the comment about faults.

v2: also use ttm_sg_tt_init to avoid allocating the page array.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/403835/
3 years agodrm/amdgpu: stop using pages with drm_prime_sg_to_page_addr_arrays
Christian König [Thu, 8 Oct 2020 11:02:06 +0000 (13:02 +0200)]
drm/amdgpu: stop using pages with drm_prime_sg_to_page_addr_arrays

This is deprecated.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/403836/
3 years agodrm/radeon: stop using pages with drm_prime_sg_to_page_addr_arrays v2
Christian König [Thu, 8 Oct 2020 11:01:35 +0000 (13:01 +0200)]
drm/radeon: stop using pages with drm_prime_sg_to_page_addr_arrays v2

This is deprecated.

v2: also use ttm_sg_tt_init to avoid allocating the page array.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/403832/
3 years agodrm/cma-helper: Implement mmap as GEM CMA object functions
Thomas Zimmermann [Mon, 23 Nov 2020 11:56:46 +0000 (12:56 +0100)]
drm/cma-helper: Implement mmap as GEM CMA object functions

The new GEM object function drm_gem_cma_mmap() sets the VMA flags
and offset as in the old implementation and immediately maps in the
buffer's memory pages.

Changing CMA helpers to use the GEM object function allows for the
removal of the special implementations for mmap and gem_prime_mmap
callbacks. The regular functions drm_gem_mmap() and drm_gem_prime_mmap()
are now used.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Maxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201123115646.11004-3-tzimmermann@suse.de
3 years agodrm/cma-helper: Remove prime infix from GEM object functions
Thomas Zimmermann [Mon, 23 Nov 2020 11:56:45 +0000 (12:56 +0100)]
drm/cma-helper: Remove prime infix from GEM object functions

These functions are not directly related to PRIME interfaces any
longer, but are now GEM object functions. Rename them accordingly
and fix the docs.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Maxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201123115646.11004-2-tzimmermann@suse.de
3 years agodrm: panel: simple: Add BOE NV110WTM-N61
Douglas Anderson [Tue, 10 Nov 2020 01:00:58 +0000 (17:00 -0800)]
drm: panel: simple: Add BOE NV110WTM-N61

Add support for the BOE NV110WTM-N61 panel.  The EDID lists two modes
(one for 60 Hz refresh rate and one for 40 Hz), so we'll list both of
them here.

Note that the panel datasheet requires 80 ms between HPD asserting and
the backlight power being turned on.  We'll use the new timing
constraints structure to do this cleanly.  This assumes that the
backlight will be enabled _after_ the panel enable finishes.  This is
how it works today and seems a sane assumption.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201109170018.v4.4.I71b2118dfc00fd7b43b02d28e7b890081c2acfa2@changeid
3 years agodt-bindings: dt-bindings: display: simple: Add BOE NV110WTM-N61
Douglas Anderson [Tue, 10 Nov 2020 01:00:59 +0000 (17:00 -0800)]
dt-bindings: dt-bindings: display: simple: Add BOE NV110WTM-N61

Add yet another eDP panel.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201109170018.v4.5.I28d9e32b3cc0aae980ecc39d364263a3f9871298@changeid
3 years agodrm: panel: simple: Allow specifying the delay from prepare to enable
Douglas Anderson [Tue, 10 Nov 2020 01:00:57 +0000 (17:00 -0800)]
drm: panel: simple: Allow specifying the delay from prepare to enable

On the panel I'm looking at, there's an 80 ms minimum time between HPD
being asserted by the panel and setting the backlight enable GPIO.
While we could just add an 80 ms "enable" delay, this is not ideal.
Link training is allowed to happen in parallel with this delay so the
fixed 80 ms delay over-delays.

We'll support this by logging the time at the end of prepare and then
delaying in enable if enough time hasn't passed.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201109170018.v4.3.Ib9ce3c6482f464bf594161581521ced46bbd54ed@changeid
3 years agodrm: panel: simple: Defer unprepare delay till next prepare to shorten it
Douglas Anderson [Tue, 10 Nov 2020 01:00:56 +0000 (17:00 -0800)]
drm: panel: simple: Defer unprepare delay till next prepare to shorten it

It is believed that all of the current users of the "unprepare" delay
don't actually need to wait the amount of time specified directly in
the unprepare phase.  The purpose of the delay that's specified is to
allow the panel to fully power off so that we don't try to power it
back on before it's managed to full power down.

Let's use this observation to avoid the fixed delay that we currently
have.  Instead of delaying, we'll note the current time when the
unprepare happens.  If someone then tries to prepare the panel later
and not enough time has passed, we'll do the delay before starting the
prepare phase.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201109170018.v4.2.I06a95d83e7fa1bd919c8edd63dacacb5436e495a@changeid
3 years agodrm: panel: simple: Fixup the struct panel_desc kernel doc
Douglas Anderson [Tue, 10 Nov 2020 01:00:55 +0000 (17:00 -0800)]
drm: panel: simple: Fixup the struct panel_desc kernel doc

When I run:
  scripts/kernel-doc -rst drivers/gpu/drm/panel/panel-simple.c

I see that several of the kernel-doc entries aren't showing up because
they don't specify the full path down the hierarchy.  Let's fix that
and also move to inline kernel docs.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201109170018.v4.1.Icaa86f0a4ca45a9a7184da4bc63386b29792d613@changeid
3 years agodrm/kmb: Remove an unnecessary NULL check
Dan Carpenter [Tue, 17 Nov 2020 07:21:37 +0000 (10:21 +0300)]
drm/kmb: Remove an unnecessary NULL check

The NULL checking isn't done consistently in this function and it leads
to a static checker warning:

    drivers/gpu/drm/kmb/kmb_drv.c:561 kmb_pm_suspend()
    error: we previously assumed 'drm' could be null (see line 559)

Fortunately "drm" cannot be NULL at this point so the check can just be
removed.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Anitha Chrisanthus <anitha.chrisanthus@intel.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201117072137.GB1111239@mwanda
3 years agoomapfb: fbcon: remove trailing semicolon in macro definition
Tom Rix [Fri, 27 Nov 2020 19:05:08 +0000 (11:05 -0800)]
omapfb: fbcon: remove trailing semicolon in macro definition

The macro use will already have a semicolon.

Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201127190508.2842786-1-trix@redhat.com
3 years agovideo: fbdev: s1d13xxxfb: Fix kernel-doc and set but not used warnings
Sam Ravnborg [Sat, 28 Nov 2020 22:41:14 +0000 (23:41 +0100)]
video: fbdev: s1d13xxxfb: Fix kernel-doc and set but not used warnings

Fix following W=1 warnings:
- Fix set but not used variables that were used only for logging.
  Fixed by introducing no_printk() to trick compiler to think variables
  are used
- Fix kernel-doc warning by deleting an empty comment line

v3:
  - Fix grammar in commit message (Thomas)
v2:
  - Subject updated (Lee)

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Kristoffer Ericson <kristoffer.ericson@gmail.com>
Cc: Lee Jones <lee.jones@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201128224114.1033617-29-sam@ravnborg.org
3 years agovideo: fbcon: Fix warnings by using pr_debug() in fbcon
Sam Ravnborg [Sat, 28 Nov 2020 22:40:48 +0000 (23:40 +0100)]
video: fbcon: Fix warnings by using pr_debug() in fbcon

Replacing DPRINTK() statements with pr_debug fixes set but not used
warnings.  And moves to a more standard logging setup at the same time.

v2:
  - Fix indent (Joe)

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Joe Perches <joe@perches.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Jiri Slaby <jirislaby@kernel.org>
Cc: Peilin Ye <yepeilin.cs@gmail.com>
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: George Kennedy <george.kennedy@oracle.com>
Cc: Nathan Chancellor <natechancellor@gmail.com>
Cc: Peter Rosin <peda@axentia.se>
Link: https://patchwork.freedesktop.org/patch/msgid/20201128224114.1033617-3-sam@ravnborg.org
3 years agovideo: Fix kernel-doc warnings in of_display_timing + of_videomode
Sam Ravnborg [Sat, 28 Nov 2020 22:40:47 +0000 (23:40 +0100)]
video: Fix kernel-doc warnings in of_display_timing + of_videomode

Fix kernel-doc warnings reported when using W=1.

v3:
  - Do not replace '-' with ':' (Thomas)

v2:
  - Improve subject (Lee)

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: linux-fbdev@vger.kernel.org
Link: https://patchwork.freedesktop.org/patch/msgid/20201128224114.1033617-2-sam@ravnborg.org
3 years agodrm/rockchip: fix typo in Kconfig 's/HDMI/dsi/'
Dafna Hirschfeld [Mon, 16 Nov 2020 14:16:08 +0000 (15:16 +0100)]
drm/rockchip: fix typo in Kconfig 's/HDMI/dsi/'

In the help of ROCKCHIP_DW_MIPI_DSI it said
it is a HDMI driver instead of a dsi driver.

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20201116141609.26719-1-dafna.hirschfeld@collabora.com
3 years agodrm/rockchip: for error print, use the correct device pointer
Dafna Hirschfeld [Mon, 16 Nov 2020 14:16:09 +0000 (15:16 +0100)]
drm/rockchip: for error print, use the correct device pointer

There is a use of DRM_DEV_ERROR(dsi->dev,..)
which should be replaced with DRM_DEV_ERROR(dev, ..)
since dsi->dev is set later

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20201116141609.26719-2-dafna.hirschfeld@collabora.com
3 years agodrm/rockchip: dw_hdmi: fix incorrect clock in vpll clock error message
Jonathan Liu [Sat, 24 Oct 2020 03:53:21 +0000 (14:53 +1100)]
drm/rockchip: dw_hdmi: fix incorrect clock in vpll clock error message

Error message incorrectly refers to grf clock instead of vpll clock.

Signed-off-by: Jonathan Liu <net147@gmail.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20201024035321.4898-1-net147@gmail.com
3 years agodrm/ingenic: Add basic PM support
Paul Cercueil [Sat, 28 Nov 2020 17:16:06 +0000 (17:16 +0000)]
drm/ingenic: Add basic PM support

Call drm_mode_config_helper_suspend() and
drm_mode_config_helper_resume() on suspend and resume, respectively.

This makes sure that the display stack is properly disabled when the
hardware is put to sleep.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201128171606.132830-1-paul@crapouillou.net
3 years agodrm/ttm: Warn on pinning without holding a reference
Daniel Vetter [Wed, 28 Oct 2020 11:31:20 +0000 (12:31 +0100)]
drm/ttm: Warn on pinning without holding a reference

Not technically a problem for ttm, but very likely a driver bug and
pretty big time confusing for reviewing code.

So warn about it, both at cleanup time (so we catch these for sure)
and at pin/unpin time (so we know who's the culprit).

Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Christian Koenig <christian.koenig@amd.com>
Cc: Huang Rui <ray.huang@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201028113120.3641237-1-daniel.vetter@ffwll.ch
3 years agofbdev: aty: SPARC64 requires FB_ATY_CT
Randy Dunlap [Fri, 27 Nov 2020 03:17:52 +0000 (19:17 -0800)]
fbdev: aty: SPARC64 requires FB_ATY_CT

It looks like SPARC64 requires FB_ATY_CT to build without errors,
so have FB_ATY select FB_ATY_CT if both SPARC64 and PCI are enabled
instead of using "default y if SPARC64 && PCI", which is not strong
enough to prevent build errors.

As it currently is, FB_ATY_CT can be disabled, resulting in build
errors:

ERROR: modpost: "aty_postdividers" [drivers/video/fbdev/aty/atyfb.ko] undefined!
ERROR: modpost: "aty_ld_pll_ct" [drivers/video/fbdev/aty/atyfb.ko] undefined!

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Fixes: f7018c213502 ("video: move fbdev to drivers/video/fbdev")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: sparclinux@vger.kernel.org
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: dri-devel@lists.freedesktop.org
Cc: linux-fbdev@vger.kernel.org
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: David Airlie <airlied@linux.ie>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20201127031752.10371-1-rdunlap@infradead.org
3 years agovia/via_irq: use __func__ to replace string function name
Bernard Zhao [Thu, 19 Nov 2020 07:29:55 +0000 (23:29 -0800)]
via/via_irq: use __func__ to replace string function name

This change also fix checkpatch.pl warning:
WARNING: Prefer using '"%s...", __func__' to using
'via_driver_irq_postinstall', this function's name, in a string
+ DRM_DEBUG("via_driver_irq_postinstall\n");

Signed-off-by: Bernard Zhao <bernard@vivo.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20201119072957.108941-1-bernard@vivo.com
3 years agodrm/radeon: fix check order in radeon_bo_move
Christian König [Wed, 25 Nov 2020 14:32:23 +0000 (15:32 +0100)]
drm/radeon: fix check order in radeon_bo_move

Reorder the code to fix checking if blitting is available.

Signed-off-by: Christian König <christian.koenig@amd.com>
Fixes: 28a68f828266 ("drm/radeon/ttm: use multihop")
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/403847/
3 years agodrm/imx/dcss: allow using nearest neighbor interpolation scaling
Laurentiu Palcu [Thu, 5 Nov 2020 14:50:18 +0000 (16:50 +0200)]
drm/imx/dcss: allow using nearest neighbor interpolation scaling

This patch adds support for using NN interpolation scaling by setting the
SCALING_FILTER plane property to 1. Otherwise, the default method is used.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20201105145018.27255-1-laurentiu.palcu@oss.nxp.com
3 years agodrm/imx/dcss: fix coccinelle warning
Laurentiu Palcu [Thu, 5 Nov 2020 14:01:26 +0000 (16:01 +0200)]
drm/imx/dcss: fix coccinelle warning

This small patch fixes a warning that I got while running coccinelle:

  CHECK   drivers/gpu/drm/imx/dcss/dcss-plane.c
  drivers/gpu/drm/imx/dcss/dcss-plane.c:107:21-23: WARNING !A || A && B is equivalent to !A || B

Fixes: 9021c317b770 ("drm/imx: Add initial support for DCSS on iMX8MQ")
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20201105140127.25249-3-laurentiu.palcu@oss.nxp.com
3 years agodrm/imx/dcss: fix rotations for Vivante tiled formats
Laurentiu Palcu [Thu, 5 Nov 2020 14:01:25 +0000 (16:01 +0200)]
drm/imx/dcss: fix rotations for Vivante tiled formats

DCSS supports 90/180/270 degree rotations for Vivante tiled and super-tiled
formats. Unfortunately, with the current code, they didn't work properly.

This simple patch makes the rotations work by fixing the way the scaler is set
up for 90/270 degree rotations. In this particular case, the source width and
height need to be swapped since DPR is sending the buffer to scaler already
rotated.

Also, make sure to allow full rotations for DRM_FORMAT_MOD_VIVANTE_SUPER_TILED.

Fixes: 9021c317b770 ("drm/imx: Add initial support for DCSS on iMX8MQ")
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20201105140127.25249-2-laurentiu.palcu@oss.nxp.com
3 years agodrm/mcde: fix masking and bitwise-or on variable val
Colin Ian King [Tue, 24 Nov 2020 12:15:28 +0000 (12:15 +0000)]
drm/mcde: fix masking and bitwise-or on variable val

The masking of val with ~MCDE_CRX1_CLKSEL_MASK is currently being
ignored because there seems to be a missing bitwise-or of val in the
following statement.  Fix this by replacing the assignment of val
with a bitwise-or.

Fixes: d795fd322063 ("drm/mcde: Support DPI output")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Addresses-Coverity: ("Unused valued")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201124121528.395681-1-colin.king@canonical.com
3 years agodma-buf/dma-resv: Respect num_fences when initializing the shared fence list.
Maarten Lankhorst [Tue, 24 Nov 2020 11:57:07 +0000 (12:57 +0100)]
dma-buf/dma-resv: Respect num_fences when initializing the shared fence list.

We hardcode the maximum number of shared fences to 4, instead of
respecting num_fences. Use a minimum of 4, but more if num_fences
is higher.

This seems to have been an oversight when first implementing the
api.

Fixes: 04a5faa8cbe5 ("reservation: update api and add some helpers")
Cc: <stable@vger.kernel.org> # v3.17+
Reported-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201124115707.406917-1-maarten.lankhorst@linux.intel.com
3 years agopanel-simple: add Innolux N125HCE-GN1
Lukas F. Hartmann [Tue, 24 Nov 2020 17:26:04 +0000 (18:26 +0100)]
panel-simple: add Innolux N125HCE-GN1

The Innolux N125HCE-GN1 display is used in the MNT Reform 2.0 laptop,
attached via eDP to a SN65DSI86 MIPI-DSI to eDP bridge.

Signed-off-by: Lukas F. Hartmann <lukas@mntre.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201124172604.981746-1-lukas@mntre.com
3 years agodt-bindings: display/panel: add Innolux N125HCE-GN1
Lukas F. Hartmann [Tue, 24 Nov 2020 17:26:06 +0000 (18:26 +0100)]
dt-bindings: display/panel: add Innolux N125HCE-GN1

The Innolux N125HCE-GN1 display is used in the MNT Reform 2.0 laptop,
attached via eDP to a SN65DSI86 MIPI-DSI to eDP bridge. This patch
contains the DT binding for "innolux,n125hce-gn1".

Signed-off-by: Lukas F. Hartmann <lukas@mntre.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
[reorder so comments comes before the compatible]
Link: https://patchwork.freedesktop.org/patch/msgid/20201124172604.981746-2-lukas@mntre.com
3 years agodrm: fix kernel-doc warnings for SCALING_FILTER
Simon Ser [Fri, 20 Nov 2020 11:06:22 +0000 (11:06 +0000)]
drm: fix kernel-doc warnings for SCALING_FILTER

This patch fixes the following kernel-doc warnings:

    /home/simon/src/linux/Documentation/gpu/drm-kms:466: ./drivers/gpu/drm/drm_crtc.c:236: WARNING: Unexpected indentation.
    /home/simon/src/linux/Documentation/gpu/drm-kms:466: ./drivers/gpu/drm/drm_crtc.c:237: WARNING: Block quote ends without a blank line; unexpected unindent.
    /home/simon/src/linux/Documentation/gpu/drm-kms:472: ./drivers/gpu/drm/drm_blend.c:203: WARNING: Unexpected indentation.
    /home/simon/src/linux/Documentation/gpu/drm-kms:472: ./drivers/gpu/drm/drm_blend.c:204: WARNING: Block quote ends without a blank line; unexpected unindent.

Signed-off-by: Simon Ser <contact@emersion.fr>
Fixes: 5c759eda9b04 ("drm: Introduce plane and CRTC scaling filter properties")
Cc: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Uma Shankar <uma.shankar@intel.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/zJEUxNx4GwiY4FnqlVsuXdAWuH624SQ9VfN54NeH5E@cp7-web-043.plabs.ch
3 years agodrm/fb-helper: Acquire modeset lock around shadow-buffer flushing
Thomas Zimmermann [Fri, 20 Nov 2020 10:25:45 +0000 (11:25 +0100)]
drm/fb-helper: Acquire modeset lock around shadow-buffer flushing

Flushing the fbdev's shadow buffer requires vmap'ing the BO memory, which
in turn requires pinning the BO. While being pinned, the BO cannot be moved
into VRAM for scanout. Consequently, a concurrent modeset operation that
involves the fbdev framebuffer would likely fail.

Resolve this problem be acquiring the modeset lock of the planes that use
the fbdev framebuffer. On non-atomic drivers, also acquire the mode-config
lock. This serializes the flushing of the framebuffer with concurrent
modeset operations.

v2:
* only acquire struct drm_fb_helper.lock in damage blitter (Daniel,
  Christian)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Maxime Ripard <mripard@kernel.org>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201120102545.4047-11-tzimmermann@suse.de
3 years agodrm/fb-helper: Copy dma-buf map before flushing shadow fb
Thomas Zimmermann [Fri, 20 Nov 2020 10:25:44 +0000 (11:25 +0100)]
drm/fb-helper: Copy dma-buf map before flushing shadow fb

Copy the vmap()'ed instance of struct dma_buf_map before modifying it,
in case the implementation of vunmap() depends on the exact address.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Maxime Ripard <mripard@kernel.org>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201120102545.4047-10-tzimmermann@suse.de
3 years agodrm/fb-helper: Restore damage area upon errors
Thomas Zimmermann [Fri, 20 Nov 2020 10:25:43 +0000 (11:25 +0100)]
drm/fb-helper: Restore damage area upon errors

If the damage handling fails, restore the damage area. The next invocation
of the damage worker will then perform the update.

v3:
* Use drm_WARN_ONCE() with an error message to print warning
v2:
* print a single warning if dirty callback fails (Daniel, Sebastian)
* update comment

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Maxime Ripard <mripard@kernel.org>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201120102545.4047-9-tzimmermann@suse.de
3 years agodrm/fb-helper: Move damage blit code and its setup into separate routine
Thomas Zimmermann [Fri, 20 Nov 2020 10:25:42 +0000 (11:25 +0100)]
drm/fb-helper: Move damage blit code and its setup into separate routine

Introduce a separate function for the blit code and its vmap setup. Done
in preparation of additional changes. No functional changes are made.

v3:
* Use drm_WARN_ONCE() with an error message to print warning
v2:
* print a single warning if damage blitter fails

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Maxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201120102545.4047-8-tzimmermann@suse.de
3 years agodrm/fb-helper: Separate shadow-buffer flushing and calling dirty callback
Thomas Zimmermann [Fri, 20 Nov 2020 10:25:41 +0000 (11:25 +0100)]
drm/fb-helper: Separate shadow-buffer flushing and calling dirty callback

Flushing the shadow framebuffer and invoking the dirty callback are two
separate operations, so do them separately. The flush operation is paired
with calls to vmap and vunmap. They are not needed for the dirty callback,
which performs its own invocations if necessary.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Maxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201120102545.4047-7-tzimmermann@suse.de
3 years agodrm/fb-helper: Return early in damage worker
Thomas Zimmermann [Fri, 20 Nov 2020 10:25:40 +0000 (11:25 +0100)]
drm/fb-helper: Return early in damage worker

Returning early in the damage worker if no update is required. Makes the
code more readable. No functional changes are being made.

v3:
* s/dirty/damage in commit message (Sam)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Maxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201120102545.4047-6-tzimmermann@suse.de
3 years agodrm/fb-helper: Rename dirty worker to damage worker
Thomas Zimmermann [Fri, 20 Nov 2020 10:25:39 +0000 (11:25 +0100)]
drm/fb-helper: Rename dirty worker to damage worker

The dirty worker handles all damage updates, instead of just calling
the framebuffer's dirty callback. Rename it to damage worker. Also
rename related variables accordingly. No functional changes are made.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Maxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201120102545.4047-5-tzimmermann@suse.de
3 years agodrm/client: Depend on GEM object kmap ref-counting
Thomas Zimmermann [Fri, 20 Nov 2020 10:25:38 +0000 (11:25 +0100)]
drm/client: Depend on GEM object kmap ref-counting

DRM client's vmap/vunmap functions don't allow for multiple vmap
operations. Calling drm_client_buffer_vmap() twice returns the same
mapping, then calling drm_client_buffer_vunmap() twice already unmaps
on the first call. This leads to unbalanced vmap refcounts. Fix this
by calling drm_gem_vmap() unconditionally in drm_client_buffer_vmap().

All drivers that support DRM clients have to implement correct ref-
counting for their vmap operations, or not vunmap at all. This is the
case for drivers that use CMA, SHMEM and VRAM helpers, and QXL. Other
drivers are not affected.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Maxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201120102545.4047-4-tzimmermann@suse.de
3 years agodrm/fb-helper: Unmap client buffer during shutdown
Thomas Zimmermann [Fri, 20 Nov 2020 10:25:37 +0000 (11:25 +0100)]
drm/fb-helper: Unmap client buffer during shutdown

The fbdev helper's generic probe function establishes a mapping for
framebuffers without shadow buffer. The clean-up function did not unmap
the buffer object. Add the unmap operation.

As fbdev devices are usally released during system shutdown, this has
not been a problem in practice.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Maxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201120102545.4047-3-tzimmermann@suse.de
3 years agodrm/fb-helper: Call dirty helper after writing to fbdev
Thomas Zimmermann [Fri, 20 Nov 2020 10:25:36 +0000 (11:25 +0100)]
drm/fb-helper: Call dirty helper after writing to fbdev

If fbdev uses a shadow framebuffer, call the damage handler. Otherwise
the update might not make it to the screen.

v2:
* mark virtual screen as dirty (Ville)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Fixes: 222ec45f4c69 ("drm/fb_helper: Support framebuffers in I/O memory")
Acked-by: Maxime Ripard <mripard@kernel.org>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: dri-devel@lists.freedesktop.org
Cc: virtualization@lists.linux-foundation.org
Link: https://patchwork.freedesktop.org/patch/msgid/20201120102545.4047-2-tzimmermann@suse.de
3 years agodrm/shmem-helper: Removed drm_gem_shmem_create_object_cached()
Thomas Zimmermann [Tue, 17 Nov 2020 13:31:56 +0000 (14:31 +0100)]
drm/shmem-helper: Removed drm_gem_shmem_create_object_cached()

Cached page mappings are now the default for SHMEM GEM objects. Remove
the obsolete create function for cached mappings.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Maxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201117133156.26822-3-tzimmermann@suse.de
3 years agodrm/shmem-helper: Use cached mappings by default
Thomas Zimmermann [Tue, 17 Nov 2020 13:31:55 +0000 (14:31 +0100)]
drm/shmem-helper: Use cached mappings by default

SHMEM-buffer backing storage is allocated from system memory; which is
typically cachable. The default mode for SHMEM objects is writecombine
though.

Unify SHMEM semantics by defaulting to cached mappings. The exception
is pages imported via dma-buf. DMA memory is usually not cached.

DRM drivers that require write-combined mappings set the map_wc flag
in struct drm_gem_shmem_object to true. This currently affects lima,
panfrost and v3d.

The drivers mgag200, udl, virtio and vkms continue to use default
shmem mappings.

The drivers cirrus and gm12u320 change caching flags. Both used
writecombine and now switch over to shmem defaults. Both drivers use
SHMEM objects as shadow buffers for internal video memory, so cached
mappings will not affect them negatively.

v3:
* set value of shmem pointer before dereferencing it in
  __drm_gem_shmem_create() (Dan, kernel test robot)
v2:
* recreate patch on top of latest SHMEM helpers
* update lima, panfrost, v3d to select writecombine (Daniel, Rob)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Maxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201117133156.26822-2-tzimmermann@suse.de
3 years agodrm/mcde: Fix uninitialized value
Linus Walleij [Thu, 19 Nov 2020 14:07:07 +0000 (15:07 +0100)]
drm/mcde: Fix uninitialized value

"val" isn't initialized on the default: errorpath.
Just return from the function if this happens.

Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201119140707.1008407-1-linus.walleij@linaro.org
3 years agodrm/mcde: Support DPI output
Linus Walleij [Thu, 12 Nov 2020 14:29:25 +0000 (15:29 +0100)]
drm/mcde: Support DPI output

This implements support for DPI output using the port node
in the device tree to connect a DPI LCD display to the
MCDE. The block also supports TV-out but we leave that
for another day when we have a hardware using it.

We implement parsing and handling of the "port" node,
and follow that to the DPI endpoint.

The clock divider used by the MCDE to divide down the
"lcdclk" (this has been designed for TV-like frequencies)
is represented by an ordinary clock provider internally
in the MCDE. This idea was inspired by the PL111 solution
by Eric Anholt: the divider also works very similar to
the Pl111 clock divider.

We take care to clear up some errors regarding the number
of available formatters and their type. We have 6 DSI
formatters and 2 DPI formatters.

Tested on the Samsung GT-I9070 Janice mobile phone.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephan Gerhold <stephan@gerhold.net>
Cc: phone-devel@vger.kernel.org
Cc: upstreaming@lists.sr.ht
Link: https://patchwork.freedesktop.org/patch/msgid/20201112142925.2571179-2-linus.walleij@linaro.org
3 years agodrm/mcde: Break out DSI set-up routine
Linus Walleij [Thu, 12 Nov 2020 14:29:24 +0000 (15:29 +0100)]
drm/mcde: Break out DSI set-up routine

To be able to support DPI without messing things up we
first break out the DSI set-up to a separate function.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephan Gerhold <stephan@gerhold.net>
Cc: phone-devel@vger.kernel.org
Cc: upstreaming@lists.sr.ht
Link: https://patchwork.freedesktop.org/patch/msgid/20201112142925.2571179-1-linus.walleij@linaro.org
3 years agodrm/mcde: Fix RGB/BGR bug
Linus Walleij [Tue, 17 Nov 2020 17:54:13 +0000 (18:54 +0100)]
drm/mcde: Fix RGB/BGR bug

I was confused when the graphics came out with blue
penguins on the DPI panel.

It turns out that the so-called "packed RGB666" mode
on the DSI formatter is incorrect: this mode is the
actual RGB888 mode, and the mode called RGB888 is
BGR888.

The claims that the MCDE had inverse RGB/BGR buffer
formats was wrong, so correct this and the buggy
register and everything is much more consistent, and
graphics look good on all targets, both DPI and
DSI.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Cc: phone-devel@vger.kernel.org
Cc: Stephan Gerhold <stephan@gerhold.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20201117175413.869871-1-linus.walleij@linaro.org
3 years agovideo: fbdev: pm2fb: Fix fall-through warnings for Clang
Gustavo A. R. Silva [Fri, 20 Nov 2020 18:40:38 +0000 (12:40 -0600)]
video: fbdev: pm2fb: Fix fall-through warnings for Clang

In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning
by explicitly adding a fallthrough pseudo-keyword.

Link: https://github.com/KSPP/linux/issues/115
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/0eedb3972a0032da4997a2a47cf0665fbe9c56ca.1605896060.git.gustavoars@kernel.org
3 years agovideo: fbdev: lxfb_ops: Fix fall-through warnings for Clang
Gustavo A. R. Silva [Fri, 20 Nov 2020 18:40:32 +0000 (12:40 -0600)]
video: fbdev: lxfb_ops: Fix fall-through warnings for Clang

In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning
by explicitly adding a break statement instead of letting the code fall
through to the next case.

Link: https://github.com/KSPP/linux/issues/115
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/9c1dcb12aae7c7ff0907ffb99ffd227656cbe444.1605896060.git.gustavoars@kernel.org
3 years agodrm/via: Fix fall-through warnings for Clang
Gustavo A. R. Silva [Fri, 20 Nov 2020 18:35:54 +0000 (12:35 -0600)]
drm/via: Fix fall-through warnings for Clang

In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning
by explicitly adding a break statement instead of letting the code fall
through to the next case.

Link: https://github.com/KSPP/linux/issues/115
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/c21a588bf9e222826f6b138db91de26a2b21df33.1605896060.git.gustavoars@kernel.org
3 years agodrm: Fix fall-through warnings for Clang
Gustavo A. R. Silva [Fri, 20 Nov 2020 18:35:17 +0000 (12:35 -0600)]
drm: Fix fall-through warnings for Clang

In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning
by explicitly adding a break statement instead of letting the code fall
through to the next case.

Link: https://github.com/KSPP/linux/issues/115
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/111e9d3d55c686892357aa5269022024b4d48330.1605896059.git.gustavoars@kernel.org
3 years agodma-buf: system_heap: Allocate higher order pages if available
John Stultz [Sat, 21 Nov 2020 23:50:02 +0000 (23:50 +0000)]
dma-buf: system_heap: Allocate higher order pages if available

While the system heap can return non-contiguous pages,
try to allocate larger order pages if possible.

This will allow slight performance gains and make implementing
page pooling easier.

Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Liam Mark <lmark@codeaurora.org>
Cc: Laura Abbott <labbott@kernel.org>
Cc: Brian Starkey <Brian.Starkey@arm.com>
Cc: Hridya Valsaraju <hridya@google.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Sandeep Patil <sspatil@google.com>
Cc: Daniel Mentz <danielmentz@google.com>
Cc: Chris Goldsworthy <cgoldswo@codeaurora.org>
Cc: Ørjan Eide <orjan.eide@arm.com>
Cc: Robin Murphy <robin.murphy@arm.com>
Cc: Ezequiel Garcia <ezequiel@collabora.com>
Cc: Simon Ser <contact@emersion.fr>
Cc: James Jones <jajones@nvidia.com>
Cc: linux-media@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Brian Starkey <brian.starkey@arm.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201121235002.69945-6-john.stultz@linaro.org
3 years agodma-buf: heaps: Skip sync if not mapped
John Stultz [Sat, 21 Nov 2020 23:50:01 +0000 (23:50 +0000)]
dma-buf: heaps: Skip sync if not mapped

This patch is basically a port of Ørjan Eide's similar patch for ION
 https://lore.kernel.org/lkml/20200414134629.54567-1-orjan.eide@arm.com/

Only sync the sg-list of dma-buf heap attachment when the attachment
is actually mapped on the device.

dma-bufs may be synced at any time. It can be reached from user space
via DMA_BUF_IOCTL_SYNC, so there are no guarantees from callers on when
syncs may be attempted, and dma_buf_end_cpu_access() and
dma_buf_begin_cpu_access() may not be paired.

Since the sg_list's dma_address isn't set up until the buffer is used
on the device, and dma_map_sg() is called on it, the dma_address will be
NULL if sync is attempted on the dma-buf before it's mapped on a device.

Before v5.0 (commit 55897af63091 ("dma-direct: merge swiotlb_dma_ops
into the dma_direct code")) this was a problem as the dma-api (at least
the swiotlb_dma_ops on arm64) would use the potentially invalid
dma_address. How that failed depended on how the device handled physical
address 0. If 0 was a valid address to physical ram, that page would get
flushed a lot, while the actual pages in the buffer would not get synced
correctly. While if 0 is an invalid physical address it may cause a
fault and trigger a crash.

In v5.0 this was incidentally fixed by commit 55897af63091 ("dma-direct:
merge swiotlb_dma_ops into the dma_direct code"), as this moved the
dma-api to use the page pointer in the sg_list, and (for Ion buffers at
least) this will always be valid if the sg_list exists at all.

But, this issue is re-introduced in v5.3 with
commit 449fa54d6815 ("dma-direct: correct the physical addr in
dma_direct_sync_sg_for_cpu/device") moves the dma-api back to the old
behaviour and picks the dma_address that may be invalid.

dma-buf core doesn't ensure that the buffer is mapped on the device, and
thus have a valid sg_list, before calling the exporter's
begin_cpu_access.

Logic and commit message originally by: Ørjan Eide <orjan.eide@arm.com>

Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Liam Mark <lmark@codeaurora.org>
Cc: Laura Abbott <labbott@kernel.org>
Cc: Brian Starkey <Brian.Starkey@arm.com>
Cc: Hridya Valsaraju <hridya@google.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Sandeep Patil <sspatil@google.com>
Cc: Daniel Mentz <danielmentz@google.com>
Cc: Chris Goldsworthy <cgoldswo@codeaurora.org>
Cc: Ørjan Eide <orjan.eide@arm.com>
Cc: Robin Murphy <robin.murphy@arm.com>
Cc: Ezequiel Garcia <ezequiel@collabora.com>
Cc: Simon Ser <contact@emersion.fr>
Cc: James Jones <jajones@nvidia.com>
Cc: linux-media@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Brian Starkey <brian.starkey@arm.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201121235002.69945-5-john.stultz@linaro.org
3 years agodma-buf: heaps: Remove heap-helpers code
John Stultz [Sat, 21 Nov 2020 23:50:00 +0000 (23:50 +0000)]
dma-buf: heaps: Remove heap-helpers code

The heap-helpers code was not as generic as initially hoped
and it is now not being used, so remove it from the tree.

Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Liam Mark <lmark@codeaurora.org>
Cc: Laura Abbott <labbott@kernel.org>
Cc: Brian Starkey <Brian.Starkey@arm.com>
Cc: Hridya Valsaraju <hridya@google.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Sandeep Patil <sspatil@google.com>
Cc: Daniel Mentz <danielmentz@google.com>
Cc: Chris Goldsworthy <cgoldswo@codeaurora.org>
Cc: Ørjan Eide <orjan.eide@arm.com>
Cc: Robin Murphy <robin.murphy@arm.com>
Cc: Ezequiel Garcia <ezequiel@collabora.com>
Cc: Simon Ser <contact@emersion.fr>
Cc: James Jones <jajones@nvidia.com>
Cc: linux-media@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Brian Starkey <brian.starkey@arm.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201121235002.69945-4-john.stultz@linaro.org
3 years agodma-buf: heaps: Move heap-helper logic into the cma_heap implementation
John Stultz [Sat, 21 Nov 2020 23:49:59 +0000 (23:49 +0000)]
dma-buf: heaps: Move heap-helper logic into the cma_heap implementation

Since the heap-helpers logic ended up not being as generic as
hoped, move the heap-helpers dma_buf_ops implementations into
the cma_heap directly.

This will allow us to remove the heap_helpers code in a following
patch.

Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Liam Mark <lmark@codeaurora.org>
Cc: Laura Abbott <labbott@kernel.org>
Cc: Brian Starkey <Brian.Starkey@arm.com>
Cc: Hridya Valsaraju <hridya@google.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Sandeep Patil <sspatil@google.com>
Cc: Daniel Mentz <danielmentz@google.com>
Cc: Chris Goldsworthy <cgoldswo@codeaurora.org>
Cc: Ørjan Eide <orjan.eide@arm.com>
Cc: Robin Murphy <robin.murphy@arm.com>
Cc: Ezequiel Garcia <ezequiel@collabora.com>
Cc: Simon Ser <contact@emersion.fr>
Cc: James Jones <jajones@nvidia.com>
Cc: linux-media@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Brian Starkey <brian.starkey@arm.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201121235002.69945-3-john.stultz@linaro.org
3 years agodma-buf: system_heap: Rework system heap to use sgtables instead of pagelists
John Stultz [Sat, 21 Nov 2020 23:49:58 +0000 (23:49 +0000)]
dma-buf: system_heap: Rework system heap to use sgtables instead of pagelists

In preparation for some patches to optmize the system
heap code, rework the dmabuf exporter to utilize sgtables rather
then pageslists for tracking the associated pages.

This will allow for large order page allocations, as well as
more efficient page pooling.

In doing so, the system heap stops using the heap-helpers logic
which sadly is not quite as generic as I was hoping it to be, so
this patch adds heap specific implementations of the dma_buf_ops
function handlers.

Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Liam Mark <lmark@codeaurora.org>
Cc: Laura Abbott <labbott@kernel.org>
Cc: Brian Starkey <Brian.Starkey@arm.com>
Cc: Hridya Valsaraju <hridya@google.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Sandeep Patil <sspatil@google.com>
Cc: Daniel Mentz <danielmentz@google.com>
Cc: Chris Goldsworthy <cgoldswo@codeaurora.org>
Cc: Ørjan Eide <orjan.eide@arm.com>
Cc: Robin Murphy <robin.murphy@arm.com>
Cc: Ezequiel Garcia <ezequiel@collabora.com>
Cc: Simon Ser <contact@emersion.fr>
Cc: James Jones <jajones@nvidia.com>
Cc: linux-media@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Brian Starkey <brian.starkey@arm.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201121235002.69945-2-john.stultz@linaro.org
3 years agodrm/meson: dw-hdmi: Enable the iahb clock early enough
Marc Zyngier [Fri, 20 Nov 2020 09:42:05 +0000 (09:42 +0000)]
drm/meson: dw-hdmi: Enable the iahb clock early enough

Instead of moving meson_dw_hdmi_init() around which breaks existing
platform, let's enable the clock meson_dw_hdmi_init() depends on.
This means we don't have to worry about this clock being enabled or
not, depending on the boot-loader features.

Fixes: b33340e33acd ("drm/meson: dw-hdmi: Ensure that clocks are enabled before touching the TOP registers")
Reported-by: "kernelci.org bot" <bot@kernelci.org>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Tested-by: Guillaume Tucker <guillaume.tucker@collabora.com>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
[narmstrong: changed reported by to kernelci.org bot]
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201120094205.525228-3-maz@kernel.org
3 years agodrm/meson: dw-hdmi: Disable clocks on driver teardown
Marc Zyngier [Fri, 20 Nov 2020 09:42:04 +0000 (09:42 +0000)]
drm/meson: dw-hdmi: Disable clocks on driver teardown

The HDMI driver request clocks early, but never disable them, leaving
the clocks on even when the driver is removed.

Fix it by slightly refactoring the clock code, and register a devm
action that will eventually disable/unprepare the enabled clocks.

Signed-off-by: Marc Zyngier <maz@kernel.org>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201120094205.525228-2-maz@kernel.org