platform/kernel/linux-starfive.git
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
3 years agodrm/panel: s6e63m0: Fix init sequence
Linus Walleij [Tue, 17 Nov 2020 17:56:21 +0000 (18:56 +0100)]
drm/panel: s6e63m0: Fix init sequence

The init sequence consist of a number of unknown settings
for the display controller. This patch achieves two things:

- Fix an error that must have happened when the driver was
  converted from the backlight subsystem: the 0xb8
  configuration command was lost and added as a tail to
  the previous command.

- Update some minor settings in some bytes here and there
  according to changes in the Samsung GT-I9070 and
  Samsung GT-S7710 code dumps. Since two other devices use
  these settings they probably reflect trimmings later
  found to be better for the display rather than
  customizations for these devices.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Guido Günther <agx@sigxcpu.org>
Cc: Stephan Gerhold <stephan@gerhold.net>
Cc: Paweł Chmiel <pawel.mikolaj.chmiel@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201117175621.870085-3-linus.walleij@linaro.org
3 years agodrm/panel: s6e63m0: Implement 28 backlight levels
Linus Walleij [Tue, 17 Nov 2020 17:56:20 +0000 (18:56 +0100)]
drm/panel: s6e63m0: Implement 28 backlight levels

A later version of the s6e63m0 driver in the Samsung
GT-I9070 vendor tree provides 28 different backlight
levels making use of elaborate control of the ACL
and ELVSS regulator. Implement this more fine-grained
backlight control.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Guido Günther <agx@sigxcpu.org>
Cc: Stephan Gerhold <stephan@gerhold.net>
Cc: Paweł Chmiel <pawel.mikolaj.chmiel@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201117175621.870085-2-linus.walleij@linaro.org
3 years agodrm/panel: s6e63m0: Fix and extend MCS table
Linus Walleij [Tue, 17 Nov 2020 17:56:19 +0000 (18:56 +0100)]
drm/panel: s6e63m0: Fix and extend MCS table

Fix up the format of the manufacturer command set table
to be TAB-indented and lowercase. Add the MCS_TEMP_SWIRE
command that we will make use of.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Guido Günther <agx@sigxcpu.org>
Cc: Stephan Gerhold <stephan@gerhold.net>
Cc: Paweł Chmiel <pawel.mikolaj.chmiel@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201117175621.870085-1-linus.walleij@linaro.org
3 years agodrm: Pass the full state to connectors atomic functions
Maxime Ripard [Wed, 18 Nov 2020 09:47:58 +0000 (10:47 +0100)]
drm: Pass the full state to connectors atomic functions

The current atomic helpers have either their object state being passed as
an argument or the full atomic state.

The former is the pattern that was done at first, before switching to the
latter for new hooks or when it was needed.

Now that the CRTCs have been converted, let's move forward with the
connectors to provide a consistent interface.

The conversion was done using the coccinelle script below, and built tested
on all the drivers.

@@
identifier connector, connector_state;
@@

 struct drm_connector_helper_funcs {
...
struct drm_encoder* (*atomic_best_encoder)(struct drm_connector *connector,
-    struct drm_connector_state *connector_state);
+    struct drm_atomic_state *state);
...
}

@@
identifier connector, connector_state;
@@

 struct drm_connector_helper_funcs {
...
void (*atomic_commit)(struct drm_connector *connector,
-       struct drm_connector_state *connector_state);
+       struct drm_atomic_state *state);
...
}

@@
struct drm_connector_helper_funcs *FUNCS;
identifier state;
identifier connector, connector_state;
identifier f;
@@

 f(..., struct drm_atomic_state *state, ...)
 {
<+...
- FUNCS->atomic_commit(connector, connector_state);
+ FUNCS->atomic_commit(connector, state);
...+>
 }

@@
struct drm_connector_helper_funcs *FUNCS;
identifier state;
identifier connector, connector_state;
identifier var, f;
@@

 f(struct drm_atomic_state *state, ...)
 {
<+...
- var = FUNCS->atomic_best_encoder(connector, connector_state);
+ var = FUNCS->atomic_best_encoder(connector, state);
...+>
 }

@ connector_atomic_func @
identifier helpers;
identifier func;
@@

(
static struct drm_connector_helper_funcs helpers = {
...,
.atomic_best_encoder = func,
...,
};
|
static struct drm_connector_helper_funcs helpers = {
...,
.atomic_commit = func,
...,
};
)

@@
identifier connector_atomic_func.func;
identifier connector;
symbol state;
@@

 func(struct drm_connector *connector,
-      struct drm_connector_state *state
+      struct drm_connector_state *connector_state
      )
 {
...
- state
+ connector_state
  ...
 }

@ ignores_state @
identifier connector_atomic_func.func;
identifier connector, connector_state;
@@

 func(struct drm_connector *connector,
      struct drm_connector_state *connector_state)
{
... when != connector_state
}

@ adds_state depends on connector_atomic_func && !ignores_state @
identifier connector_atomic_func.func;
identifier connector, connector_state;
@@

 func(struct drm_connector *connector, struct drm_connector_state *connector_state)
 {
+ struct drm_connector_state *connector_state = drm_atomic_get_new_connector_state(state, connector);
...
 }

@ depends on connector_atomic_func @
identifier connector_atomic_func.func;
identifier connector_state;
identifier connector;
@@

 func(struct drm_connector *connector,
-     struct drm_connector_state *connector_state
+     struct drm_atomic_state *state
   )
 { ... }

@ include depends on adds_state @
@@

 #include <drm/drm_atomic.h>

@ no_include depends on !include && adds_state @
@@

+ #include <drm/drm_atomic.h>
  #include <drm/...>

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Reviewed-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Cc: Leo Li <sunpeng.li@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Cc: Melissa Wen <melissa.srw@gmail.com>
Cc: Haneen Mohammed <hamohammed.sa@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201118094758.506730-1-maxime@cerno.tech
3 years agodrm: document drm_mode_modeinfo
Simon Ser [Fri, 20 Nov 2020 09:46:28 +0000 (09:46 +0000)]
drm: document drm_mode_modeinfo

This allows `struct drm_mode_modeinfo` references to be linkified.

Some descriptions are borrowed from struct drm_display_mode.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/BBtyuxgs3DvcrMtbRyb7KBEWUviGy1dtWO61eB4@cp3-web-016.plabs.ch
3 years agodrm: document drm_mode_get_connector
Simon Ser [Fri, 20 Nov 2020 08:57:33 +0000 (08:57 +0000)]
drm: document drm_mode_get_connector

Document how to perform a GETCONNECTOR ioctl. Document the various
struct fields. Also document how to perform a forced probe, and when
should user-space do it.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Pekka Paalanen <ppaalanen@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/4NxrTtynzPiPX4SOCzxmA1sRB8fVLfeiabVpi5j3Y@cp7-web-041.plabs.ch
3 years agodrm/virtio: rename sync_seq and last_seq
Gurchetan Singh [Thu, 19 Nov 2020 01:08:09 +0000 (17:08 -0800)]
drm/virtio: rename sync_seq and last_seq

To be clearer about our intentions to associate sequence numbers
and fence IDs, let's rename these variables.

Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Anthoine Bourgeois <anthoine.bourgeois@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20201119010809.528-5-gurchetansingh@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agodrm/virtio: use fence_id when processing fences
Gurchetan Singh [Thu, 19 Nov 2020 01:08:08 +0000 (17:08 -0800)]
drm/virtio: use fence_id when processing fences

Currently, the fence ID, which can be used to identify a
virtgpu fence, is the same as the fence sequence number.

Let's use the fence_id name to clearly signal this.

Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Anthoine Bourgeois <anthoine.bourgeois@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20201119010809.528-4-gurchetansingh@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agovirtio-gpu api: Add a comment on VIRTIO_GPU_SHM_ID_HOST_VISIBLE
Anthoine Bourgeois [Thu, 19 Nov 2020 01:08:07 +0000 (17:08 -0800)]
virtio-gpu api: Add a comment on VIRTIO_GPU_SHM_ID_HOST_VISIBLE

This provides a description of how the kernel driver uses the
shmid to determine capabilities.

Signed-off-by: Anthoine Bourgeois <anthoine.bourgeois@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20201119010809.528-3-gurchetansingh@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agodrm/virtio: fix a file name comment reference
Anthoine Bourgeois [Thu, 19 Nov 2020 01:08:06 +0000 (17:08 -0800)]
drm/virtio: fix a file name comment reference

Easier to find where declarations are implemented.

Signed-off-by: Anthoine Bourgeois <anthoine.bourgeois@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20201119010809.528-2-gurchetansingh@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agodrm/virtio: suffix create blob call with _ioctl like any ioctl
Anthoine Bourgeois [Thu, 19 Nov 2020 01:08:05 +0000 (17:08 -0800)]
drm/virtio: suffix create blob call with _ioctl like any ioctl

For coherency, all ioctls are suffixed

Signed-off-by: Anthoine Bourgeois <anthoine.bourgeois@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20201119010809.528-1-gurchetansingh@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agodrm: improve kernel-docs in drm_mode.h
Simon Ser [Thu, 19 Nov 2020 10:03:20 +0000 (10:03 +0000)]
drm: improve kernel-docs in drm_mode.h

- Remove duplicate doc-comments for struct members
- Add missing @member markers for in-line member comments

Signed-off-by: Simon Ser <contact@emersion.fr>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/grZIqIAOSUM7eNL0PurBsaWoILFwN2hEKd40Ylgzg@cp7-web-041.plabs.ch
3 years agodrm/ttm: fix DMA32 handling in the global page pool
Christian König [Tue, 17 Nov 2020 15:50:45 +0000 (16:50 +0100)]
drm/ttm: fix DMA32 handling in the global page pool

When we have mixed DMA32 and non DMA32 device in one system
it could otherwise happen that the DMA32 device gets pages
it can't work with.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Link: https://patchwork.freedesktop.org/patch/401317/
3 years agomm: introduce vma_set_file function v5
Christian König [Mon, 14 Sep 2020 13:09:33 +0000 (15:09 +0200)]
mm: introduce vma_set_file function v5

Add the new vma_set_file() function to allow changing
vma->vm_file with the necessary refcount dance.

v2: add more users of this.
v3: add missing EXPORT_SYMBOL, rebase on mmap cleanup,
    add comments why we drop the reference on two occasions.
v4: make it clear that changing an anonymous vma is illegal.
v5: move vma_set_file to mm/util.c

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> (v2)
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Acked-by: Andrew Morton <akpm@linux-foundation.org>
Link: https://patchwork.freedesktop.org/patch/399360/
3 years agomm: mmap: fix fput in error path v2
Christian König [Fri, 9 Oct 2020 13:08:55 +0000 (15:08 +0200)]
mm: mmap: fix fput in error path v2

Patch "495c10cc1c0c CHROMIUM: dma-buf: restore args..."
adds a workaround for a bug in mmap_region.

As the comment states ->mmap() callback can change
vma->vm_file and so we might call fput() on the wrong file.

Revert the workaround and proper fix this in mmap_region.

v2: drop the extra if in dma_buf_mmap as well

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Acked-by: Andrew Morton <akpm@linux-foundation.org>
Link: https://patchwork.freedesktop.org/patch/399359/
3 years agochar/agp: Disable frontend without CONFIG_DRM_LEGACY
Daniel Vetter [Tue, 17 Nov 2020 21:40:29 +0000 (22:40 +0100)]
char/agp: Disable frontend without CONFIG_DRM_LEGACY

It's probably full of bugs ready for exploiting by userspace. And
there's not going to be any userspace for this without any of the drm
legacy drivers enabled too. So just couple it together.

Note that the frontend is only the /dev/agp ioctl interface, which per
Adam is only used by the i810 userspace drivers. All other drivers go
through the drm bufmap agp handling abstraction apparently.

v2: Augment commit message a bit from m-l feedback.

Acked-by: Adam Jackson <ajax@redhat.com>
Acked-by: Christian König <christian.koenig@amd.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Adam Jackson <ajax@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201117214029.591896-1-daniel.vetter@ffwll.ch
3 years agodrm/via: fix assignment in if condition
Bernard Zhao [Wed, 18 Nov 2020 11:40:19 +0000 (03:40 -0800)]
drm/via: fix assignment in if condition

Fix check_patch.pl warning:
ERROR: do not use assignment in if condition
+                       if ((HALCYON_HEADER2 == (cmd = *buf)) &&

ERROR: do not use assignment in if condition
+                       if (HALCYON_HEADER2 == (cmd = *buf))

Signed-off-by: Bernard Zhao <bernard@vivo.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20201118114021.105502-1-bernard@vivo.com
3 years agodrm/amdgpu: Fix missing prototype warning
Luben Tuikov [Tue, 10 Nov 2020 05:15:48 +0000 (00:15 -0500)]
drm/amdgpu: Fix missing prototype warning

Fix a missing prototype warning for function
amdgpu_info_ioctl(),

drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c:482:5: warning: no previous prototype for 'amdgpu_info_ioctl' [-Wmissing-prototypes]

Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
Reported-by: kernel test robot <lkp@intel.com>
Reviewed-by: Souptick Joarder <jrdr.linux@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201110051548.685725-1-luben.tuikov@amd.com
3 years agodrm/amdgpu: fix check order in amdgpu_bo_move
Christian König [Mon, 16 Nov 2020 19:12:03 +0000 (20:12 +0100)]
drm/amdgpu: fix check order in amdgpu_bo_move

Reorder the code to fix checking if blitting is available.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Link: https://patchwork.freedesktop.org/patch/401019/
3 years agodrm/docs: Fix todo.rst
Daniel Vetter [Wed, 18 Nov 2020 07:36:37 +0000 (08:36 +0100)]
drm/docs: Fix todo.rst

I didnt' format the thing correctly :-(

Fixes: 39aead8373b3 ("fbcon: Disable accelerated scrolling")
Reviewed-by: Simon Ser <contact@emersion.fr>
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201118073637.597206-1-daniel.vetter@ffwll.ch
3 years agoinclude/drm/drm_atomic: Make use of 'new_crtc_state'
Lee Jones [Mon, 16 Nov 2020 17:41:12 +0000 (17:41 +0000)]
include/drm/drm_atomic: Make use of 'new_crtc_state'

In the macro for_each_oldnew_crtc_in_state() 'crtc_state' is provided
as a container for state->crtcs[i].new_state, but is not utilised in
some use-cases, so we fake-use it instead.

Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/imx/ipuv3-plane.c: In function ‘ipu_planes_assign_pre’:
 drivers/gpu/drm/imx/ipuv3-plane.c:746:42: warning: variable ‘crtc_state’ set but not used [-Wunused-but-set-variable]

Cc: Philipp Zabel <p.zabel@pengutronix.de>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: NXP Linux Team <linux-imx@nxp.com>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20201116174112.1833368-43-lee.jones@linaro.org
3 years agodrm/vc4/vc4_debugfs: Demote non-conformant kernel-doc headers
Lee Jones [Mon, 16 Nov 2020 17:41:10 +0000 (17:41 +0000)]
drm/vc4/vc4_debugfs: Demote non-conformant kernel-doc headers

Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/vc4/vc4_debugfs.c:25: warning: Function parameter or member 'minor' not described in 'vc4_debugfs_init'
 drivers/gpu/drm/vc4/vc4_debugfs.c:62: warning: Function parameter or member 'dev' not described in 'vc4_debugfs_add_file'
 drivers/gpu/drm/vc4/vc4_debugfs.c:62: warning: Function parameter or member 'name' not described in 'vc4_debugfs_add_file'
 drivers/gpu/drm/vc4/vc4_debugfs.c:62: warning: Function parameter or member 'show' not described in 'vc4_debugfs_add_file'
 drivers/gpu/drm/vc4/vc4_debugfs.c:62: warning: Function parameter or member 'data' not described in 'vc4_debugfs_add_file'

Cc: Eric Anholt <eric@anholt.net>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20201116174112.1833368-41-lee.jones@linaro.org