platform/kernel/linux-starfive.git
4 years agodrm/ttm: new TT backend allocation pool v3
Christian König [Thu, 22 Oct 2020 16:26:58 +0000 (18:26 +0200)]
drm/ttm: new TT backend allocation pool v3

This replaces the spaghetti code in the two existing page pools.

First of all depending on the allocation size it is between 3 (1GiB) and
5 (1MiB) times faster than the old implementation.

It makes better use of buddy pages to allow for larger physical contiguous
allocations which should result in better TLB utilization at least for
amdgpu.

Instead of a completely braindead approach of filling the pool with one
CPU while another one is trying to shrink it we only give back freed
pages.

This also results in much less locking contention and a trylock free MM
shrinker callback, so we can guarantee that pages are given back to the
system when needed.

Downside of this is that it takes longer for many small allocations until
the pool is filled up. We could address this, but I couldn't find an use
case where this actually matters. We also don't bother freeing large
chunks of pages any more since the CPU overhead in that path isn't really
that important.

The sysfs files are replaced with a single module parameter, allowing
users to override how many pages should be globally pooled in TTM. This
unfortunately breaks the UAPI slightly, but as far as we know nobody ever
depended on this.

Zeroing memory coming from the pool was handled inconsistently. The
alloc_pages() based pool was zeroing it, the dma_alloc_attr() based one
wasn't. For now the new implementation isn't zeroing pages from the pool
either and only sets the __GFP_ZERO flag when necessary.

The implementation has only 768 lines of code compared to the over 2600
of the old one, and also allows for saving quite a bunch of code in the
drivers since we don't need specialized handling there any more based on
kernel config.

Additional to all of that there was a neat bug with IOMMU, coherent DMA
mappings and huge pages which is now fixed in the new code as well.

v2: make ttm_pool_apply_caching static as reported by the kernel bot, add
    some more checks
v3: fix some more checkpatch.pl warnings

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Madhav Chauhan <madhav.chauhan@amd.com>
Tested-by: Huang Rui <ray.huang@amd.com>
Link: https://patchwork.freedesktop.org/patch/397080/?series=83051&rev=1
4 years agodrm: xlnx: Use dma_request_chan for DMA channel request
Peter Ujfalusi [Fri, 23 Oct 2020 09:46:02 +0000 (12:46 +0300)]
drm: xlnx: Use dma_request_chan for DMA channel request

There is no need to use the of_dma_request_slave_channel() directly as
dma_request_chan() is going to try to get the channel via OF as well.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Hyun Kwon <hyun.kwon@xilinx.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201023094602.5630-1-peter.ujfalusi@ti.com
4 years agoFonts: Make font size unsigned in font_desc
Peilin Ye [Wed, 28 Oct 2020 10:56:47 +0000 (06:56 -0400)]
Fonts: Make font size unsigned in font_desc

`width` and `height` are defined as unsigned in our UAPI font descriptor
`struct console_font`. Make them unsigned in our kernel font descriptor
`struct font_desc`, too.

Also, change the corresponding printk() format identifiers from `%d` to
`%u`, in sti_select_fbfont().

Signed-off-by: Peilin Ye <yepeilin.cs@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20201028105647.1210161-1-yepeilin.cs@gmail.com
4 years agofbdev/atafb: Remove unused extern variables
Peilin Ye [Tue, 27 Oct 2020 16:31:08 +0000 (12:31 -0400)]
fbdev/atafb: Remove unused extern variables

Remove 6 unused extern variables to reduce confusion. It is worth
mentioning that lib/fonts/font_8x8.c and lib/fonts/font_8x16.c also
declare `fontdata_8x8` and `fontdata_8x16` respectively, and this file
has nothing to do with them.

Signed-off-by: Peilin Ye <yepeilin.cs@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/cb5bb49a33ff54fef41e719ee9d301a6a73c5f9c.1603788512.git.yepeilin.cs@gmail.com
Link: https://patchwork.freedesktop.org/patch/msgid/20201028105647.1210161-1-yepeilin.cs@gmail.com
4 years agodrm/tilcdc: avoid 'make W=2' build failure
Arnd Bergmann [Mon, 26 Oct 2020 19:41:01 +0000 (20:41 +0100)]
drm/tilcdc: avoid 'make W=2' build failure

The -Wmissing-field-initializer warning when building with W=2
turns into an error because tilcdc is built with -Werror:

drm/tilcdc/tilcdc_drv.c:431:33: error: missing field 'data' initializer [-Werror,-Wmissing-field-initializers] { "regs", tilcdc_regs_show, 0 },
drm/tilcdc/tilcdc_drv.c:432:33: error: missing field 'data' initializer [-Werror,-Wmissing-field-initializers] { "mm",   tilcdc_mm_show,   0 },

Add the missing field initializers to address the warning.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jyri Sarha <jsarha@ti.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201026194110.3817470-1-arnd@kernel.org
4 years agodrm/doc: Document legacy_cursor_update better
Daniel Vetter [Fri, 23 Oct 2020 12:39:25 +0000 (14:39 +0200)]
drm/doc: Document legacy_cursor_update better

It's the horror and shouldn't be used. Realized we're not clear on
this in a discussion with Rob about what msm is doing to better
support async commits.

v2: Refine existing todo item to include this (Thomas)

Cc: Sean Paul <sean@poorly.run>
Cc: Rob Clark <robdclark@gmail.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20201023123925.2374863-3-daniel.vetter@ffwll.ch
4 years agomatroxfb: avoid -Warray-bounds warning
Arnd Bergmann [Mon, 26 Oct 2020 19:39:55 +0000 (20:39 +0100)]
matroxfb: avoid -Warray-bounds warning

The open-coded list_for_each_entry() causes a harmless warning:

drivers/video/fbdev/matrox/matroxfb_base.c: In function 'matroxfb_register_driver':
include/linux/kernel.h:856:3: warning: array subscript -98 is outside array bounds of 'struct list_head[1]' [-Warray-bounds]

Use the normal list_for_each_entry instead.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20201026194010.3817166-1-arnd@kernel.org
4 years agodrm: deprecate DRM_FORMAT_MOD_NONE
Simon Ser [Mon, 26 Oct 2020 13:12:30 +0000 (14:12 +0100)]
drm: deprecate DRM_FORMAT_MOD_NONE

DRM_FORMAT_MOD_NONE is in the list of vendors, which is pretty
confusing. We already have DRM_FORMAT_MOD_VENDOR_NONE. Move it down in
the list of format modifiers.

DRM_FORMAT_MOD_NONE is an alias for DRM_FORMAT_MOD_LINEAR, however the
name is confusing: NONE doesn't mean that the modifier is implicit,
instead it means that the layout is linear. Deprecate it.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/a2j8KTgc26k5QniSAhDSTgCw4XWZhmsNHwG8UVa6U@cp4-web-014.plabs.ch
4 years agodrm/ttm: merge ttm_dma_tt back into ttm_tt
Christian König [Wed, 21 Oct 2020 12:06:49 +0000 (14:06 +0200)]
drm/ttm: merge ttm_dma_tt back into ttm_tt

It makes no difference to kmalloc if the structure
is 48 or 64 bytes in size.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/396950/
4 years agodrm/ttm: make num_pages uint32_t
Christian König [Tue, 20 Oct 2020 18:10:39 +0000 (20:10 +0200)]
drm/ttm: make num_pages uint32_t

We can still allocate 16TiB with that.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/396946/
4 years agodrm/ttm: move swapin out of page alloc backend
Christian König [Mon, 19 Oct 2020 16:56:45 +0000 (18:56 +0200)]
drm/ttm: move swapin out of page alloc backend

This is not related to allocating the backing store in any way.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/396947/
4 years agodrm/ttm: nuke ttm_tt_set_(un)populated again
Christian König [Mon, 19 Oct 2020 16:49:27 +0000 (18:49 +0200)]
drm/ttm: nuke ttm_tt_set_(un)populated again

Neither page allocation backend nor the driver should mess with that.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Madhav Chauhan <madhav.chauhan@amd.com>
Link: https://patchwork.freedesktop.org/patch/396948/
4 years agodrm/komeda: Convert to DEFINE_SHOW_ATTRIBUTE
Qinglang Miao [Thu, 17 Sep 2020 12:39:49 +0000 (20:39 +0800)]
drm/komeda: Convert to DEFINE_SHOW_ATTRIBUTE

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Acked-by: Liviu Dudau <liviu.dudau@arm.com>
Tested-by: Carsten Haitzler <carsten.haitzler@foss.arm.com>
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200917123949.101925-1-miaoqinglang@huawei.com
4 years agovideo: fbdev: fix divide error in fbcon_switch
Saeed Mirzamohammadi [Wed, 21 Oct 2020 23:57:58 +0000 (16:57 -0700)]
video: fbdev: fix divide error in fbcon_switch

This patch fixes the issue due to:

[   89.572883] divide_error: 0000 [#1] SMP KASAN PTI
[   89.572897] CPU: 3 PID: 16083 Comm: repro Not tainted 5.9.0-rc7.20200930.rc1.allarch-19-g3e32d0d.syzk #5
[   89.572902] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 0.5.1 01/01/2011
[   89.572934] RIP: 0010:cirrusfb_check_var+0x84/0x1260

The error happens when the pixels value is calculated before performing the sanity checks on bits_per_pixel.
A bits_per_pixel set to zero causes divide by zero error.

This patch moves the calculation after the sanity check.

Signed-off-by: Saeed Mirzamohammadi <saeed.mirzamohammadi@oracle.com>
Tested-by: Saeed Mirzamohammadi <saeed.mirzamohammadi@oracle.com>
Reviewed-by: Thomas Zimemrmann <tzimmermann@suse.de>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20201021235758.59993-1-saeed.mirzamohammadi@oracle.com
4 years agodrm/ttm: remove overlapping memcpy support
Dave Airlie [Thu, 22 Oct 2020 03:11:52 +0000 (13:11 +1000)]
drm/ttm: remove overlapping memcpy support

remove the overlapping memcp support as it's never used.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201022031152.1916925-1-airlied@gmail.com
4 years agodrm/vc4: dsi: Only register our component once a DSI device is attached
Maxime Ripard [Tue, 7 Jul 2020 10:19:12 +0000 (12:19 +0200)]
drm/vc4: dsi: Only register our component once a DSI device is attached

If the DSI driver is the last to probe, component_add will try to run all
the bind callbacks straight away and return the error code.

However, since we depend on a power domain, we're pretty much guaranteed to
be in that case on the BCM2711, and are just lucky on the previous SoCs
since the v3d also depends on that power domain and is further in the probe
order.

In that case, the DSI host will not stick around in the system: the DSI
bind callback will be executed, will not find any DSI device attached and
will return EPROBE_DEFER, and we will then remove the DSI host and ask to
be probed later on.

But since that host doesn't stick around, DSI devices like the RaspberryPi
touchscreen whose probe is not linked to the DSI host (unlike the usual DSI
devices that will be probed through the call to mipi_dsi_host_register)
cannot attach to the DSI host, and we thus end up in a situation where the
DSI host cannot probe because the panel hasn't probed yet, and the panel
cannot probe because the DSI host hasn't yet.

In order to break this cycle, let's wait until there's a DSI device that
attaches to the DSI host to register the component and allow to progress
further.

Acked-by: Eric Anholt <eric@anholt.net>
Suggested-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20200707101912.571531-1-maxime@cerno.tech
4 years agodrm: document that user-space should avoid parsing EDIDs
Simon Ser [Thu, 22 Oct 2020 10:34:44 +0000 (10:34 +0000)]
drm: document that user-space should avoid parsing EDIDs

User-space should avoid parsing EDIDs for metadata already exposed via
other KMS interfaces and properties. For instance, user-space should not
try to extract a list of modes from the EDID: the kernel might mutate
the mode list (because of link capabilities or quirks for instance).

Other metadata not exposed by KMS can be parsed by user-space. This
includes for instance monitor identification (make/model/serial) and
supported color-spaces.

v2: add short explanation why user-space shouldn't do this (Brian)

Signed-off-by: Simon Ser <contact@emersion.fr>
Suggested-by: Daniel Vetter <daniel.vetter@intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Brian Starkey <brian.starkey@arm.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/V_APW3gKRhljvcmT28tGV3JkP7qW9Z7h45I-s2wiJvYhaaveCpYpg3tztZPsZVV2KV1NC7rUx08IUUgCJXzdRrWCsEGB0czq4ZozpdyVFLs=@emersion.fr
4 years agodrm/ttm: replace last move_notify with delete_mem_notify
Dave Airlie [Wed, 21 Oct 2020 04:40:29 +0000 (14:40 +1000)]
drm/ttm: replace last move_notify with delete_mem_notify

The move notify callback is only used in one place, this should
be removed in the future, but for now just rename it to the use
case which is to notify the driver that the GPU memory is to be
deleted.

Drivers can be cleaned up after this separately.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201021044031.1752624-2-airlied@gmail.com
4 years agodrm/ttm: ttm_bo_mem_placement doesn't need ctx parameter.
Dave Airlie [Wed, 21 Oct 2020 04:40:30 +0000 (14:40 +1000)]
drm/ttm: ttm_bo_mem_placement doesn't need ctx parameter.

Removed unused parameter.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201021044031.1752624-3-airlied@gmail.com
4 years agodrm: Give irq_by_busid drm_legacy_ prefix
Daniel Vetter [Thu, 8 Oct 2020 14:29:27 +0000 (16:29 +0200)]
drm: Give irq_by_busid drm_legacy_ prefix

It's the only ioctl handler purely for legacy drivers that didn't have
this yet.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201008142927.2819321-1-daniel.vetter@ffwll.ch
4 years agodrm/ttm: move last binding into the drivers.
Dave Airlie [Tue, 20 Oct 2020 01:03:19 +0000 (11:03 +1000)]
drm/ttm: move last binding into the drivers.

This moves the call to tt binding into the driver move,
and drops the driver callback.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201020010319.1692445-8-airlied@gmail.com
4 years agodrm/ttm: drop move notify around move.
Dave Airlie [Tue, 20 Oct 2020 01:03:18 +0000 (11:03 +1000)]
drm/ttm: drop move notify around move.

The drivers now do this in the move callback.

move_notify is still needed in the destroy path.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201020010319.1692445-7-airlied@gmail.com
4 years agodrm/ttm: remove move to new and inline into remainging place.
Dave Airlie [Tue, 20 Oct 2020 01:03:17 +0000 (11:03 +1000)]
drm/ttm: remove move to new and inline into remainging place.

This show the remaining bind callback, which my next series of
patches will aim to remove.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201020010319.1692445-6-airlied@gmail.com
4 years agodrm/ttm: drop unbind callback.
Dave Airlie [Tue, 20 Oct 2020 01:03:16 +0000 (11:03 +1000)]
drm/ttm: drop unbind callback.

The drivers now control this, so drop unbinding.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201020010319.1692445-5-airlied@gmail.com
4 years agodrm/ttm: add move to system into drivers
Dave Airlie [Tue, 20 Oct 2020 01:03:15 +0000 (11:03 +1000)]
drm/ttm: add move to system into drivers

This moves the to system move into the drivers, and moves all
the unbinds in the move path under driver control

Note: radeon/nouveau already wait so don't duplicate it.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201020010319.1692445-4-airlied@gmail.com
4 years agodrm/ttm: minor cleanup to move to system
Dave Airlie [Tue, 20 Oct 2020 01:03:14 +0000 (11:03 +1000)]
drm/ttm: minor cleanup to move to system

resource free already sets the domain to system, and old_mem
isn't really needed.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201020010319.1692445-3-airlied@gmail.com
4 years agodrm/ttm: move some move binds into the drivers
Dave Airlie [Tue, 20 Oct 2020 01:03:13 +0000 (11:03 +1000)]
drm/ttm: move some move binds into the drivers

This just gives the driver control over some of the bind paths.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201020010319.1692445-2-airlied@gmail.com
4 years agodrm/fourcc: Add AXBXGXRX106106106106 format
Matteo Franchin [Mon, 12 Oct 2020 16:40:43 +0000 (17:40 +0100)]
drm/fourcc: Add AXBXGXRX106106106106 format

Add ABGR format with 10-bit components packed in 64-bit per pixel.
This format can be used to handle
VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16 on little-endian
architectures.

Signed-off-by: Matteo Franchin <matteo.franchin@arm.com>
Reviewed-by: Brian Starkey <brian.starkey@arm.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201012164043.23630-1-matteo.franchin@arm.com
4 years agodrm/komeda: Drop local dma_parms
Robin Murphy [Thu, 3 Sep 2020 20:36:13 +0000 (21:36 +0100)]
drm/komeda: Drop local dma_parms

Since commit 9495b7e92f71 ("driver core: platform: Initialize dma_parms
for platform devices"), struct platform_device already provides a
dma_parms structure, so we can save allocating another one.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Reviewed-by: James Qian Wang <james.qian.wang@arm.com>
[replaced DMA_BIT_MASK(32) with U32_MAX]
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/8de297b5b916628c77b99068fb5aac1a69eed6f5.1599164796.git.robin.murphy@arm.com
4 years agodrm/vkms: fbdev emulation support
Daniel Vetter [Fri, 9 Oct 2020 23:21:56 +0000 (01:21 +0200)]
drm/vkms: fbdev emulation support

Hooray for generic fbdev support, making this a oneliner. We just
needed to fix preferred_depth fixed and the vmap support added first.

This is useful for testing fbdev testcases in igt. Right now we only
have a simple one in the fbdev testcases, which passes both info and
mmap subtests.

v2: Augment commit message as suggested by Melissa.

Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Melissa Wen <melissa.srw@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Cc: Melissa Wen <melissa.srw@gmail.com>
Cc: Haneen Mohammed <hamohammed.sa@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20201009232156.3916879-3-daniel.vetter@ffwll.ch
4 years agodrm/ttm: drop ttm_bo_move_ttm wrapper
Dave Airlie [Mon, 19 Oct 2020 07:13:14 +0000 (17:13 +1000)]
drm/ttm: drop ttm_bo_move_ttm wrapper

The apis to move old/new are in place everywhere so this is no
longer needed.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201019071314.1671485-6-airlied@gmail.com
4 years agodrm/ttm: add move old to system to drivers.
Dave Airlie [Mon, 19 Oct 2020 07:13:13 +0000 (17:13 +1000)]
drm/ttm: add move old to system to drivers.

Uninline ttm_bo_move_ttm. Eventually want to unhook the unbind out.

Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201019071314.1671485-5-airlied@gmail.com
4 years agodrm/ttm: use new move interface for known system->ttm moves
Dave Airlie [Mon, 19 Oct 2020 07:13:12 +0000 (17:13 +1000)]
drm/ttm: use new move interface for known system->ttm moves

In all 3 drivers there is a case where the driver knows the
bo is in SYSTEM so don't call the api that checks that.

Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201019071314.1671485-4-airlied@gmail.com
4 years agodrm/ttm: split out the move to system from move ttm code
Dave Airlie [Mon, 19 Oct 2020 07:13:11 +0000 (17:13 +1000)]
drm/ttm: split out the move to system from move ttm code

Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201019071314.1671485-3-airlied@gmail.com
4 years agodrm/ttm: refactor out common code to setup a new tt backed resource
Dave Airlie [Mon, 19 Oct 2020 07:13:10 +0000 (17:13 +1000)]
drm/ttm: refactor out common code to setup a new tt backed resource

This factors out the code to setup non-system tt.

The same code was used twice in the move paths.

Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201019071314.1671485-2-airlied@gmail.com
4 years agodrm: panel: add TDO tl070wsh30 panel driver
Neil Armstrong [Tue, 15 Sep 2020 12:19:12 +0000 (14:19 +0200)]
drm: panel: add TDO tl070wsh30 panel driver

This adds support for the TDO TL070WSH30 TFT-LCD panel module.
The panel has a 1024×600 resolution and uses 24 bit RGB per pixel.
It provides a MIPI DSI interface to the host, a built-in LED backlight
and touch controller.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200915121912.4347-5-narmstrong@baylibre.com
4 years agodt-bindings: display: panel-simple-dsi: add TDO TL070WSH30 DSI panel bindings
Neil Armstrong [Tue, 15 Sep 2020 12:19:11 +0000 (14:19 +0200)]
dt-bindings: display: panel-simple-dsi: add TDO TL070WSH30 DSI panel bindings

This add the bindings for the 1024x600 TFT LCD TL070WSH30 DSI panel to panel-simple-dsi.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Rob Herring <robh@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200915121912.4347-4-narmstrong@baylibre.com
4 years agodt-bindings: display: panel-simple-dsi: add optional reset gpio
Neil Armstrong [Tue, 15 Sep 2020 12:19:10 +0000 (14:19 +0200)]
dt-bindings: display: panel-simple-dsi: add optional reset gpio

Simple DSI panels can also have a reset GPIO signal in addition/instead of an
enable GPIO signal.

This adds an optional reset-gpios property.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Rob Herring <robh@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200915121912.4347-3-narmstrong@baylibre.com
4 years agodt-bindings: vendor-prefixes: Add Shanghai Top Display Optolelectronics vendor prefix
Neil Armstrong [Tue, 15 Sep 2020 12:19:09 +0000 (14:19 +0200)]
dt-bindings: vendor-prefixes: Add Shanghai Top Display Optolelectronics vendor prefix

Shanghai Top Display Optolelectronics Co., Ltd  is a display manufacturer
from Shanghai.
Web site of the company: http://www.shtdo.com/

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Rob Herring <robh@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200915121912.4347-2-narmstrong@baylibre.com
4 years agodrm/ttm: drop free old node wrapper.
Dave Airlie [Wed, 23 Sep 2020 00:25:08 +0000 (10:25 +1000)]
drm/ttm: drop free old node wrapper.

This isn't really used anymore, if drivers needs it later,
just add back an inline wrapper.

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200924051845.397177-13-airlied@gmail.com
4 years agodrm/hisilicon: Use the same style of variable type in hibmc_drm_drv
Tian Tao [Fri, 16 Oct 2020 00:38:31 +0000 (08:38 +0800)]
drm/hisilicon: Use the same style of variable type in hibmc_drm_drv

Consistently Use the same style of variable type in hibmc_drm_drv.c and
hibmc_drm_drv.h.

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/1602808711-65193-3-git-send-email-tiantao6@hisilicon.com
4 years agodrm/hisilicon: Use the same style of variable type in hibmc_drm_de
Tian Tao [Fri, 16 Oct 2020 00:38:30 +0000 (08:38 +0800)]
drm/hisilicon: Use the same style of variable type in hibmc_drm_de

Consistently Use the same style of variable type in hibmc_drm_de.c.

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/1602808711-65193-2-git-send-email-tiantao6@hisilicon.com
4 years agodrm/via: reduce no need mutex_lock area
Bernard Zhao [Fri, 14 Aug 2020 08:30:19 +0000 (01:30 -0700)]
drm/via: reduce no need mutex_lock area

In function via_mem_alloc`s error branch, DRM_ERROR is protected
in the mutex_lock(&dev->struct_mutex) area.
>From the code, we see that DRM_ERROR is just an error log print
without any struct element, there is no need to protect this.

Signed-off-by: Bernard Zhao <bernard@vivo.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200814083021.8962-1-bernard@vivo.com
4 years agodrm/tve200: Fix handling of platform_get_irq() error
Krzysztof Kozlowski [Thu, 27 Aug 2020 07:11:07 +0000 (09:11 +0200)]
drm/tve200: Fix handling of platform_get_irq() error

platform_get_irq() returns -ERRNO on error.  In such case comparison
to 0 would pass the check.

Fixes: 179c02fe90a4 ("drm/tve200: Add new driver for TVE200")
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200827071107.27429-2-krzk@kernel.org
4 years agodrm/mcde: Fix handling of platform_get_irq() error
Krzysztof Kozlowski [Thu, 27 Aug 2020 07:11:06 +0000 (09:11 +0200)]
drm/mcde: Fix handling of platform_get_irq() error

platform_get_irq() returns -ERRNO on error.  In such case comparison
to 0 would pass the check.

Fixes: 5fc537bfd000 ("drm/mcde: Add new driver for ST-Ericsson MCDE")
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200827071107.27429-1-krzk@kernel.org
4 years agodrm/panel: simple: Add YTC700TLAG-05-201C
Jagan Teki [Fri, 4 Sep 2020 18:08:21 +0000 (23:38 +0530)]
drm/panel: simple: Add YTC700TLAG-05-201C

Add panel timings for YTC700TLAG-05-201C 7" TFT LCD panel from
Yes Optoelectronics Co.,Ltd.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200904180821.302194-3-jagan@amarulasolutions.com
4 years agodt-bindings: display: simple: Add YTC700TLAG-05-201C
Jagan Teki [Fri, 4 Sep 2020 18:08:20 +0000 (23:38 +0530)]
dt-bindings: display: simple: Add YTC700TLAG-05-201C

Add dt-bindings for YTC700TLAG-05-201C 7" TFT LCD panel from
Yes Optoelectronics Co.,Ltd.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200904180821.302194-2-jagan@amarulasolutions.com
4 years agodt-bindings: vendor-prefixes: Add Yes Optoelectronics
Jagan Teki [Fri, 4 Sep 2020 18:08:19 +0000 (23:38 +0530)]
dt-bindings: vendor-prefixes: Add Yes Optoelectronics

Add vendor dt-bindings for Yes Optoelectronics Co.,Ltd.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200904180821.302194-1-jagan@amarulasolutions.com
4 years agovideo: fbdev: fsl-diu-fb: remove unneeded variable 'res'
Jason Yan [Thu, 10 Sep 2020 14:05:58 +0000 (22:05 +0800)]
video: fbdev: fsl-diu-fb: remove unneeded variable 'res'

Eliminate the following coccicheck warning:

drivers/video/fbdev/fsl-diu-fb.c:1428:5-8: Unneeded variable: "res".
Return "0" on line 1450

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Acked-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200910140558.1191423-1-yanaijie@huawei.com
4 years agovideo: fbdev: sis: remove unneeded semicolon
Jason Yan [Thu, 10 Sep 2020 14:05:36 +0000 (22:05 +0800)]
video: fbdev: sis: remove unneeded semicolon

Eliminate the following coccicheck warning:

drivers/video/fbdev/sis/sis_accel.h:143:72-73: Unneeded semicolon
drivers/video/fbdev/sis/sis_accel.h:144:72-73: Unneeded semicolon
drivers/video/fbdev/sis/sis_accel.h:145:72-73: Unneeded semicolon
drivers/video/fbdev/sis/sis_accel.h:273:75-76: Unneeded semicolon
drivers/video/fbdev/sis/sis_accel.h:274:75-76: Unneeded semicolon
drivers/video/fbdev/sis/sis_accel.h:275:73-74: Unneeded semicolon
drivers/video/fbdev/sis/sis_accel.h:276:75-76: Unneeded semicolon

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200910140536.1191150-1-yanaijie@huawei.com
4 years agodrm/panel: st7703: Make jh057n00900_panel_desc static
Jason Yan [Sat, 12 Sep 2020 03:38:09 +0000 (11:38 +0800)]
drm/panel: st7703: Make jh057n00900_panel_desc static

This eliminates the following sparse warning:

drivers/gpu/drm/panel/panel-sitronix-st7703.c:156:26: warning: symbol
'jh057n00900_panel_desc' was not declared. Should it be static?

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Reviewed-by: Guido Günther <agx@sigxcpu.org>
[Use static const]
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200912033809.142773-1-yanaijie@huawei.com
4 years agodrm: bridge: adv7511: make adv7511_hdmi_hw_params() static
Jason Yan [Sat, 12 Sep 2020 03:38:26 +0000 (11:38 +0800)]
drm: bridge: adv7511: make adv7511_hdmi_hw_params() static

This eliminates the following sparse warning:

drivers/gpu/drm/bridge/adv7511/adv7511_audio.c:58:5: warning: symbol
'adv7511_hdmi_hw_params' was not declared. Should it be static?

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200912033826.142923-1-yanaijie@huawei.com
4 years agodrm/bridge: analogix_dp: make analogix_dp_start_aux_transaction() static
Jason Yan [Sat, 12 Sep 2020 03:38:43 +0000 (11:38 +0800)]
drm/bridge: analogix_dp: make analogix_dp_start_aux_transaction() static

This eliminates the following sparse warning:

drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c:527:5: warning: symbol
'analogix_dp_start_aux_transaction' was not declared. Should it be
static?

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200912033843.143240-1-yanaijie@huawei.com
4 years agodrm/panel: simplify the return expression of rb070d30_panel_enable()
Liu Shixin [Tue, 15 Sep 2020 03:26:23 +0000 (11:26 +0800)]
drm/panel: simplify the return expression of rb070d30_panel_enable()

Simplify the return expression.

Signed-off-by: Liu Shixin <liushixin2@huawei.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200915032623.1772361-1-liushixin2@huawei.com
4 years agoomapfb: connector-dvi: simplify the return expression of dvic_connect()
Liu Shixin [Tue, 15 Sep 2020 03:26:27 +0000 (11:26 +0800)]
omapfb: connector-dvi: simplify the return expression of dvic_connect()

Simplify the return expression.

Signed-off-by: Liu Shixin <liushixin2@huawei.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200915032627.1772517-1-liushixin2@huawei.com
4 years agoomapfb: use devm_platform_ioremap_resource_byname
Qilong Zhang [Wed, 16 Sep 2020 11:13:53 +0000 (19:13 +0800)]
omapfb: use devm_platform_ioremap_resource_byname

Use the devm_platform_ioremap_resource_byname() helper instead of
calling platform_get_resource_byname() and devm_ioremap_resource()
separately.

Signed-off-by: Qilong Zhang <zhangqilong3@huawei.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
[fixed warning - unused variable]
[fixed checkpatch warning - fixed indent]
Link: https://patchwork.freedesktop.org/patch/msgid/20200916111353.105914-1-zhangqilong3@huawei.com
4 years agofbdev: nvidia: use for_each_child_of_node() macro
Qinglang Miao [Wed, 16 Sep 2020 06:21:23 +0000 (14:21 +0800)]
fbdev: nvidia: use for_each_child_of_node() macro

Use for_each_child_of_node() macro instead of open coding it.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200916062123.190636-1-miaoqinglang@huawei.com
4 years agodrm/bridge: anx7625: Add anx7625 MIPI DSI/DPI to DP
Xin Ji [Fri, 18 Sep 2020 10:24:18 +0000 (18:24 +0800)]
drm/bridge: anx7625: Add anx7625 MIPI DSI/DPI to DP

The ANX7625 is an ultra-low power 4K Mobile HD Transmitter designed
for portable device. It converts MIPI DSI/DPI to DisplayPort 1.3 4K.

Signed-off-by: Xin Ji <xji@analogixsemi.com>
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/528b76c1a4f7b6ea85371bfae4bde389aec4bb24.1600423932.git.xji@analogixsemi.com
4 years agodt-bindings: drm/bridge: anx7625: MIPI to DP transmitter DT schema
Xin Ji [Fri, 18 Sep 2020 10:22:57 +0000 (18:22 +0800)]
dt-bindings: drm/bridge: anx7625: MIPI to DP transmitter DT schema

anx7625: MIPI to DP transmitter DT schema

Signed-off-by: Xin Ji <xji@analogixsemi.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/bafa02aa50c5c29b3336ca6930c406150a3c60d2.1600423932.git.xji@analogixsemi.com
4 years agoomapfb: simplify the return expression of hdmi_pll_enable
Qinglang Miao [Mon, 21 Sep 2020 13:11:12 +0000 (21:11 +0800)]
omapfb: simplify the return expression of hdmi_pll_enable

Simplify the return expression.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200921131112.93411-1-miaoqinglang@huawei.com
4 years agoomapfb: panel-sony-acx565akm: simplify the return expression of acx565akm_connect()
Qinglang Miao [Mon, 21 Sep 2020 13:10:52 +0000 (21:10 +0800)]
omapfb: panel-sony-acx565akm: simplify the return expression of acx565akm_connect()

Simplify the return expression.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200921131052.92707-1-miaoqinglang@huawei.com
4 years agoomapfb: connector-hdmi: simplify the return expression of hdmic_connect
Qinglang Miao [Mon, 21 Sep 2020 13:10:51 +0000 (21:10 +0800)]
omapfb: connector-hdmi: simplify the return expression of hdmic_connect

Simplify the return expression.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org> # dropped gpio-cs5535.c changes
Link: https://patchwork.freedesktop.org/patch/msgid/20200921131051.92661-1-miaoqinglang@huawei.com
4 years agoomapfb: connector-analog-tv: simplify the return expression of tvc_connect()
Qinglang Miao [Mon, 21 Sep 2020 13:10:49 +0000 (21:10 +0800)]
omapfb: connector-analog-tv: simplify the return expression of tvc_connect()

Simplify the return expression.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200921131049.92616-1-miaoqinglang@huawei.com
4 years agoomapfb: simplify the return expression of tpo_td043_connect
Liu Shixin [Mon, 21 Sep 2020 08:24:45 +0000 (16:24 +0800)]
omapfb: simplify the return expression of tpo_td043_connect

Simplify the return expression.

Signed-off-by: Liu Shixin <liushixin2@huawei.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200921082445.2591825-1-liushixin2@huawei.com
4 years agoomapfb: simplify the return expression of sharp_ls_connect
Liu Shixin [Mon, 21 Sep 2020 08:24:44 +0000 (16:24 +0800)]
omapfb: simplify the return expression of sharp_ls_connect

Simplify the return expression.

Signed-off-by: Liu Shixin <liushixin2@huawei.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200921082444.2591773-1-liushixin2@huawei.com
4 years agoomapfb: simplify the return expression of panel_dpi_connect
Liu Shixin [Mon, 21 Sep 2020 08:24:43 +0000 (16:24 +0800)]
omapfb: simplify the return expression of panel_dpi_connect

Simplify the return expression.

Signed-off-by: Liu Shixin <liushixin2@huawei.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200921082443.2591721-1-liushixin2@huawei.com
4 years agodrm/bridge: lvds-codec: Add support for regulator
Biju Das [Tue, 22 Sep 2020 10:55:26 +0000 (13:55 +0300)]
drm/bridge: lvds-codec: Add support for regulator

Add the support for enabling optional regulator that may be used as VCC
source.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
[Replaced 'error' variable with 'ret']
[Renamed regulator from 'vcc' to 'power']
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200922105526.5252-1-laurent.pinchart+renesas@ideasonboard.com
4 years agovideo: use kobj_to_dev()
Wang Qing [Tue, 22 Sep 2020 12:14:24 +0000 (20:14 +0800)]
video: use kobj_to_dev()

Use kobj_to_dev() instead of container_of()

Signed-off-by: Wang Qing <wangqing@vivo.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/1600776867-24226-1-git-send-email-wangqing@vivo.com
4 years agovideo: Remove set but not used variable
Li Heng [Thu, 24 Sep 2020 14:18:26 +0000 (22:18 +0800)]
video: Remove set but not used variable

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/video/fbdev/sis/300vtbl.h:1064:28: warning:
‘SiS300_CHTVVCLKSONTSC’ defined but not used [-Wunused-const-variable=]

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Li Heng <liheng40@huawei.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/1600957106-13741-1-git-send-email-liheng40@huawei.com
4 years agodrm/panel: rm68200: fix mode to 50fps
Yannick Fertre [Fri, 25 Sep 2020 14:16:18 +0000 (16:16 +0200)]
drm/panel: rm68200: fix mode to 50fps

Compute new timings to get a framerate of 50fps with a pixel clock
@54Mhz.

Signed-off-by: Yannick Fertre <yannick.fertre@st.com>
Tested-by: Philippe Cornu <philippe.cornu@st.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200925141618.12097-1-yannick.fertre@st.com
4 years agodrm/bridge: ti-sn65dsi86: remove redundant null check
Xu Wang [Wed, 30 Sep 2020 08:18:59 +0000 (08:18 +0000)]
drm/bridge: ti-sn65dsi86: remove redundant null check

Because clk_disable_unprepare already checked NULL clock parameter,
so the additional checks are unnecessary, just remove it

Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200930081859.52431-1-vulab@iscas.ac.cn
4 years agodrm/bridge: ti-sn65dsi86: Add retries for link training
Douglas Anderson [Fri, 2 Oct 2020 21:03:51 +0000 (14:03 -0700)]
drm/bridge: ti-sn65dsi86: Add retries for link training

On some panels hooked up to the ti-sn65dsi86 bridge chip we found that
link training was failing.  Specifically, we'd see:

  ti_sn65dsi86 2-002d: [drm:ti_sn_bridge_enable] *ERROR* Link training failed, link is off (-5)

The panel was hooked up to a logic analyzer and it was found that, as
part of link training, the bridge chip was writing a 0x1 to DPCD
address 00600h and the panel responded NACK.  As can be seen in header
files, the write of 0x1 to DPCD address 0x600h means we were trying to
write the value DP_SET_POWER_D0 to the register DP_SET_POWER.  The
panel vendor says that a NACK in this case is not unexpected and means
"not ready, try again".

In testing, we found that this panel would respond with a NACK in
about 1/25 times.  Adding the retry logic worked fine and the most
number of tries needed was 3.  Just to be safe, we'll add 10 tries
here and we'll add a little blurb to the logs if we ever need more
than 5.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Tested-By: Steev Klimaszewski <steev@kali.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201002135920.1.I2adbc90b2db127763e2444bd5a4e5bf30e1db8e5@changeid
4 years agodt-binding: display: Require two resets on mantix panel
Guido Günther [Tue, 13 Oct 2020 10:32:48 +0000 (12:32 +0200)]
dt-binding: display: Require two resets on mantix panel

We need to reset both for the panel to show an image.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/15d3dc7eb4e031f380be1298ed3ac9085626f26b.1602584953.git.agx@sigxcpu.org
4 years agodrm/panel: mantix: Fix panel reset
Guido Günther [Tue, 13 Oct 2020 10:32:47 +0000 (12:32 +0200)]
drm/panel: mantix: Fix panel reset

The mantix panel needs two reset lines (RESX and TP_RSTN) deasserted to
output an image. Only deasserting RESX is not enough and the display
will stay blank. Deassert in prepare() and assert in unprepare() to keep
device held in reset when off.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/ba71a8ab010d263a8058dd4f711e3bcd95877bf2.1602584953.git.agx@sigxcpu.org
4 years agodrm/panel: mantix: Don't dereference NULL mode
Guido Günther [Tue, 13 Oct 2020 10:32:46 +0000 (12:32 +0200)]
drm/panel: mantix: Don't dereference NULL mode

Don't dereference mode which was just NULL checked.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/659158549f3c6cc1c71ceed0943e760e861c1206.1602584953.git.agx@sigxcpu.org
4 years agovideo: fbdev: sh_mobile_lcdcfb: Remove redundant null check before clk_prepare_enable...
Xu Wang [Wed, 14 Oct 2020 08:57:22 +0000 (08:57 +0000)]
video: fbdev: sh_mobile_lcdcfb: Remove redundant null check before clk_prepare_enable/clk_disable_unprepare

Because clk_prepare_enable() and clk_disable_unprepare() already checked
NULL clock parameter, so the additional checks are unnecessary, just
remove them.

Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20201014085722.26069-1-vulab@iscas.ac.cn
4 years agoomapfb/dss: Remove redundant null check before clk_prepare_enable/clk_disable_unprepare
Xu Wang [Wed, 14 Oct 2020 08:49:20 +0000 (08:49 +0000)]
omapfb/dss: Remove redundant null check before clk_prepare_enable/clk_disable_unprepare

Because clk_prepare_enable() and clk_disable_unprepare() already checked
NULL clock parameter, so the additional checks are unnecessary, just
remove them.

Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20201014084920.25813-1-vulab@iscas.ac.cn
4 years agodrm/vkms: Switch to shmem helpers
Daniel Vetter [Tue, 13 Oct 2020 11:10:27 +0000 (13:10 +0200)]
drm/vkms: Switch to shmem helpers

Inspired by a patch by Chris Wilson for vgem. Plus this gives us vmap
at the gem bo level, which we need for generic fbdev emulation.

Luckily shmem also tracks ->vaddr, so we just need to adjust the code
all over a bit to make this fit.

Also wire up handle_to_fd, dunno why that was missing.

v2:
- Drop now unused container_of #define (Melissa)
- Make sure we keep creating cached objects, this is for testing
  (Thomas)

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Cc: Melissa Wen <melissa.srw@gmail.com>
Cc: Haneen Mohammed <hamohammed.sa@gmail.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Melissa Wen <melissa.srw@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201013111027.375999-1-daniel.vetter@ffwll.ch
4 years agodrm/vkms: Set preferred depth correctly
Daniel Vetter [Fri, 9 Oct 2020 23:21:54 +0000 (01:21 +0200)]
drm/vkms: Set preferred depth correctly

The only thing we support is xrgb8888.

Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Melissa Wen <melissa.srw@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Cc: Melissa Wen <melissa.srw@gmail.com>
Cc: Haneen Mohammed <hamohammed.sa@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20201009232156.3916879-1-daniel.vetter@ffwll.ch
4 years agodma-buf: Clarify that dma-buf sg lists are page aligned
Jianxin Xiong [Wed, 14 Oct 2020 16:16:01 +0000 (09:16 -0700)]
dma-buf: Clarify that dma-buf sg lists are page aligned

The dma-buf API have been used under the assumption that the sg lists
returned from dma_buf_map_attachment() are fully page aligned. Lots of
stuff can break otherwise all over the place. Clarify this in the
documentation and add a check when DMA API debug is enabled.

Signed-off-by: Jianxin Xiong <jianxin.xiong@intel.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/1602692161-107096-1-git-send-email-jianxin.xiong@intel.com
4 years agodrm/dp_aux_dev: check aux_dev before use in drm_dp_aux_dev_get_by_minor()
Zwane Mwaikambo [Tue, 13 Oct 2020 05:59:14 +0000 (22:59 -0700)]
drm/dp_aux_dev: check aux_dev before use in drm_dp_aux_dev_get_by_minor()

I observed this when unplugging a DP monitor whilst a computer is asleep
and then waking it up. This left DP chardev nodes still being present on
the filesystem and accessing these device nodes caused an oops because
drm_dp_aux_dev_get_by_minor() assumes a device exists if it is opened.
This can also be reproduced by creating a device node with mknod(1) and
issuing an open(2)

[166164.933198] BUG: kernel NULL pointer dereference, address: 0000000000000018
[166164.933202] #PF: supervisor read access in kernel mode
[166164.933204] #PF: error_code(0x0000) - not-present page
[166164.933205] PGD 0 P4D 0
[166164.933208] Oops: 0000 [#1] PREEMPT SMP NOPTI
[166164.933211] CPU: 4 PID: 99071 Comm: fwupd Tainted: G        W
5.8.0-rc6+ #1
[166164.933213] Hardware name: LENOVO 20RD002VUS/20RD002VUS, BIOS R16ET25W
(1.11 ) 04/21/2020
[166164.933232] RIP: 0010:drm_dp_aux_dev_get_by_minor+0x29/0x70
[drm_kms_helper]
[166164.933234] Code: 00 0f 1f 44 00 00 55 48 89 e5 41 54 41 89 fc 48 c7
c7 60 01 a4 c0 e8 26 ab 30 d7 44 89 e6 48 c7 c7 80 01 a4 c0 e8 47 94 d6 d6
<8b> 50 18 49 89 c4 48 8d 78 18 85 d2 74 33 8d 4a 01 89 d0 f0 0f b1
[166164.933236] RSP: 0018:ffffb7d7c41cbbf0 EFLAGS: 00010246
[166164.933237] RAX: 0000000000000000 RBX: ffff8a90001fe900 RCX: 0000000000000000
[166164.933238] RDX: 0000000000000000 RSI: 0000000000000003 RDI: ffffffffc0a40180
[166164.933239] RBP: ffffb7d7c41cbbf8 R08: 0000000000000000 R09: ffff8a93e157d6d0
[166164.933240] R10: 0000000000000000 R11: ffffffffc0a40188 R12: 0000000000000003
[166164.933241] R13: ffff8a9402200e80 R14: ffff8a90001fe900 R15: 0000000000000000
[166164.933244] FS:  00007f7fb041eb00(0000) GS:ffff8a9411500000(0000)
knlGS:0000000000000000
[166164.933245] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[166164.933246] CR2: 0000000000000018 CR3: 00000000352c2003 CR4: 00000000003606e0
[166164.933247] Call Trace:
[166164.933264]  auxdev_open+0x1b/0x40 [drm_kms_helper]
[166164.933278]  chrdev_open+0xa7/0x1c0
[166164.933282]  ? cdev_put.part.0+0x20/0x20
[166164.933287]  do_dentry_open+0x161/0x3c0
[166164.933291]  vfs_open+0x2d/0x30
[166164.933297]  path_openat+0xb27/0x10e0
[166164.933306]  ? atime_needs_update+0x73/0xd0
[166164.933309]  do_filp_open+0x91/0x100
[166164.933313]  ? __alloc_fd+0xb2/0x150
[166164.933316]  do_sys_openat2+0x210/0x2d0
[166164.933318]  do_sys_open+0x46/0x80
[166164.933320]  __x64_sys_openat+0x20/0x30
[166164.933328]  do_syscall_64+0x52/0xc0
[166164.933336]  entry_SYSCALL_64_after_hwframe+0x44/0xa9

(gdb) disassemble drm_dp_aux_dev_get_by_minor+0x29
Dump of assembler code for function drm_dp_aux_dev_get_by_minor:
   0x0000000000017b10 <+0>:     callq  0x17b15 <drm_dp_aux_dev_get_by_minor+5>
   0x0000000000017b15 <+5>:     push   %rbp
   0x0000000000017b16 <+6>:     mov    %rsp,%rbp
   0x0000000000017b19 <+9>:     push   %r12
   0x0000000000017b1b <+11>:    mov    %edi,%r12d
   0x0000000000017b1e <+14>:    mov    $0x0,%rdi
   0x0000000000017b25 <+21>:    callq  0x17b2a <drm_dp_aux_dev_get_by_minor+26>
   0x0000000000017b2a <+26>:    mov    %r12d,%esi
   0x0000000000017b2d <+29>:    mov    $0x0,%rdi
   0x0000000000017b34 <+36>:    callq  0x17b39 <drm_dp_aux_dev_get_by_minor+41>
   0x0000000000017b39 <+41>:    mov    0x18(%rax),%edx <=========
   0x0000000000017b3c <+44>:    mov    %rax,%r12
   0x0000000000017b3f <+47>:    lea    0x18(%rax),%rdi
   0x0000000000017b43 <+51>:    test   %edx,%edx
   0x0000000000017b45 <+53>:    je     0x17b7a <drm_dp_aux_dev_get_by_minor+106>
   0x0000000000017b47 <+55>:    lea    0x1(%rdx),%ecx
   0x0000000000017b4a <+58>:    mov    %edx,%eax
   0x0000000000017b4c <+60>:    lock cmpxchg %ecx,(%rdi)
   0x0000000000017b50 <+64>:    jne    0x17b76 <drm_dp_aux_dev_get_by_minor+102>
   0x0000000000017b52 <+66>:    test   %edx,%edx
   0x0000000000017b54 <+68>:    js     0x17b6d <drm_dp_aux_dev_get_by_minor+93>
   0x0000000000017b56 <+70>:    test   %ecx,%ecx
   0x0000000000017b58 <+72>:    js     0x17b6d <drm_dp_aux_dev_get_by_minor+93>
   0x0000000000017b5a <+74>:    mov    $0x0,%rdi
   0x0000000000017b61 <+81>:    callq  0x17b66 <drm_dp_aux_dev_get_by_minor+86>
   0x0000000000017b66 <+86>:    mov    %r12,%rax
   0x0000000000017b69 <+89>:    pop    %r12
   0x0000000000017b6b <+91>:    pop    %rbp
   0x0000000000017b6c <+92>:    retq
   0x0000000000017b6d <+93>:    xor    %esi,%esi
   0x0000000000017b6f <+95>:    callq  0x17b74 <drm_dp_aux_dev_get_by_minor+100>
   0x0000000000017b74 <+100>:   jmp    0x17b5a <drm_dp_aux_dev_get_by_minor+74>
   0x0000000000017b76 <+102>:   mov    %eax,%edx
   0x0000000000017b78 <+104>:   jmp    0x17b43 <drm_dp_aux_dev_get_by_minor+51>
   0x0000000000017b7a <+106>:   xor    %r12d,%r12d
   0x0000000000017b7d <+109>:   jmp    0x17b5a <drm_dp_aux_dev_get_by_minor+74>
End of assembler dump.

(gdb) list *drm_dp_aux_dev_get_by_minor+0x29
0x17b39 is in drm_dp_aux_dev_get_by_minor (drivers/gpu/drm/drm_dp_aux_dev.c:65).
60      static struct drm_dp_aux_dev *drm_dp_aux_dev_get_by_minor(unsigned index)
61      {
62              struct drm_dp_aux_dev *aux_dev = NULL;
63
64              mutex_lock(&aux_idr_mutex);
65              aux_dev = idr_find(&aux_idr, index);
66              if (!kref_get_unless_zero(&aux_dev->refcount))
67                      aux_dev = NULL;
68              mutex_unlock(&aux_idr_mutex);
69
(gdb) p/x &((struct drm_dp_aux_dev *)(0x0))->refcount
$8 = 0x18

Looking at the caller, checks on the minor are pushed down to
drm_dp_aux_dev_get_by_minor()

static int auxdev_open(struct inode *inode, struct file *file)
{
    unsigned int minor = iminor(inode);
    struct drm_dp_aux_dev *aux_dev;

    aux_dev = drm_dp_aux_dev_get_by_minor(minor); <====
    if (!aux_dev)
        return -ENODEV;

    file->private_data = aux_dev;
    return 0;
}

Fixes: e94cb37b34eb ("drm/dp: Add a drm_aux-dev module for reading/writing dpcd registers.")
Cc: <stable@vger.kernel.org> # v4.6+
Signed-off-by: Zwane Mwaikambo <zwane@yosper.io>
Reviewed-by: Lyude Paul <lyude@redhat.com>
[added Cc to stable]
Signed-off-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/alpine.DEB.2.21.2010122231070.38717@montezuma.home
4 years agodrm/ttm: nuke caching placement flags
Christian König [Wed, 30 Sep 2020 14:44:16 +0000 (16:44 +0200)]
drm/ttm: nuke caching placement flags

Changing the caching on the fly never really worked
flawlessly.

So stop this completely and just let drivers specific the
desired caching in the tt or bus object.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Link: https://patchwork.freedesktop.org/patch/394256/
4 years agodrm/ttm: use caching instead of placement for ttm_io_prot
Christian König [Wed, 30 Sep 2020 13:56:53 +0000 (15:56 +0200)]
drm/ttm: use caching instead of placement for ttm_io_prot

Instead of the placement flags use the caching of the bus
mapping or tt object for the page protection flags.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Link: https://patchwork.freedesktop.org/patch/394255/
4 years agodrm/ttm: add caching state to ttm_bus_placement
Christian König [Wed, 30 Sep 2020 09:17:44 +0000 (11:17 +0200)]
drm/ttm: add caching state to ttm_bus_placement

And implement setting it up correctly in the drivers.

This allows getting rid of the placement flags for this.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Link: https://patchwork.freedesktop.org/patch/394254/
4 years agodrm/ttm: set the tt caching state at creation time
Christian König [Wed, 30 Sep 2020 08:38:48 +0000 (10:38 +0200)]
drm/ttm: set the tt caching state at creation time

All drivers can determine the tt caching state at creation time,
no need to do this on the fly during every validation.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Link: https://patchwork.freedesktop.org/patch/394253/
4 years agodrm: panel: Add novatek nt36672a panel driver
Sumit Semwal [Wed, 2 Sep 2020 06:44:07 +0000 (12:14 +0530)]
drm: panel: Add novatek nt36672a panel driver

Novatek NT36672a is a generic DSI IC that drives command and video mode
panels. Add the driver for it.

Right now adding support for some Poco F1 phones that have an LCD panel
from Tianma connected with this IC, with a resolution of 1080x2246 that
operates in DSI video mode.

During testing, Benni Steini <bennisteinir@gmail.com> helped us fix
the reset sequence timing (from 10ms to 20ms), to get the bootanimation
to work on Android.

With current AOSP, we need to increase it to 200ms - this seems to be a
safe high value to avoid a white screen occasionally.

Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Benni Steini <bennisteinir@gmail.com>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200902064407.30712-3-sumit.semwal@linaro.org
4 years agodt-bindings: display: panel: Add bindings for Novatek nt36672a
Sumit Semwal [Wed, 2 Sep 2020 06:44:06 +0000 (12:14 +0530)]
dt-bindings: display: panel: Add bindings for Novatek nt36672a

Novatek nt36672a is a display driver IC that can drive DSI panel. It
is also present in the Tianma video mode panel, which is a FHD+ panel
with a resolution of 1080x2246 and 6.18 inches size. It is found in
some of the Poco F1 phones.

This patch adds the display driver for the IC, with support added for
this tianma fhd video mode panel.

Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200902064407.30712-2-sumit.semwal@linaro.org
4 years agodrm/virtio: Use UUID API for importing the UUID
Andy Shevchenko [Tue, 13 Oct 2020 13:27:14 +0000 (16:27 +0300)]
drm/virtio: Use UUID API for importing the UUID

There is import_uuid() function which imports u8 array to the uuid_t.
Use it instead of open coding variant.

This allows to hide the uuid_t internals.

Reviewed-by: David Stevens <stevensd@chromium.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20201013132714.70973-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
4 years agodrm: shmobile: Reduce include dependencies
Andy Shevchenko [Wed, 22 Apr 2020 12:51:55 +0000 (15:51 +0300)]
drm: shmobile: Reduce include dependencies

This file doesn't need anything provided by <linux/kernel.h>.
All it needs are some types, which are provided by <drm/drm_mode.h>.

Drop unneeded <linux/kernel.h> completely.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200422125201.37618-1-andriy.shevchenko@linux.intel.com
4 years agoMAINTAINERS: Add myself as a maintainer for vc4
Maxime Ripard [Fri, 9 Oct 2020 07:49:52 +0000 (09:49 +0200)]
MAINTAINERS: Add myself as a maintainer for vc4

Eric isn't working on vc4 anymore and I've been working on it, as well as
merging patches for it, recently so let's make it official so I don't miss
patches.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Reviewed-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20201009074952.11345-1-maxime@cerno.tech
4 years agodrm/aspeed: Fix Kconfig warning & subsequent build errors
Randy Dunlap [Sun, 11 Oct 2020 23:01:31 +0000 (16:01 -0700)]
drm/aspeed: Fix Kconfig warning & subsequent build errors

Kernel test robot reported build errors (undefined references)
that didn't make much sense. After reproducing them, there is also
a Kconfig warning that is the root cause of the build errors, so
fix that Kconfig problem.

Fixes this Kconfig warning:
WARNING: unmet direct dependencies detected for CMA
  Depends on [n]: MMU [=n]
  Selected by [m]:
  - DRM_ASPEED_GFX [=m] && HAS_IOMEM [=y] && DRM [=m] && OF [=y] && (COMPILE_TEST [=y] || ARCH_ASPEED) && HAVE_DMA_CONTIGUOUS [=y]

and these dependent build errors:
(.text+0x10c8c): undefined reference to `start_isolate_page_range'
microblaze-linux-ld: (.text+0x10f14): undefined reference to `test_pages_isolated'
microblaze-linux-ld: (.text+0x10fd0): undefined reference to `undo_isolate_page_range'

Fixes: 76356a966e33 ("drm: aspeed: Clean up Kconfig options")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Cc: Joel Stanley <joel@jms.id.au>
Cc: Andrew Jeffery <andrew@aj.id.au>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Mike Rapoport <rppt@linux.ibm.com>
Cc: linux-mm@kvack.org
Cc: linux-aspeed@lists.ozlabs.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Joel Stanley <joel@jms.id.au>
Link: https://patchwork.freedesktop.org/patch/msgid/20201011230131.4922-1-rdunlap@infradead.org
Signed-off-by: Joel Stanley <joel@jms.id.au>
4 years agodrm/tilcdc: Remove tilcdc_crtc_max_width(), use private data
Jyri Sarha [Sat, 10 Oct 2020 17:00:59 +0000 (20:00 +0300)]
drm/tilcdc: Remove tilcdc_crtc_max_width(), use private data

We already have a private data member for maximum display width so
let's use it and get rid of the redundant tilcdc_crtc_max_width().

The LCDC version probing is moved to before reading the device tree
properties so that the version information is available when private
data maximum width is initialized, if "max-width" property is not
found.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Link: https://patchwork.freedesktop.org/patch/msgid/73683d2ce151cffb811a756595b02892eeac3d84.1602349100.git.jsarha@ti.com
4 years agodrm/tilcdc: Do not keep vblank interrupts enabled all the time
Jyri Sarha [Sat, 10 Oct 2020 17:00:58 +0000 (20:00 +0300)]
drm/tilcdc: Do not keep vblank interrupts enabled all the time

END_OF_FRAME interrupts have been enabled all the time since the
beginning of this driver. It is about time to add this feature.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://patchwork.freedesktop.org/patch/msgid/fb87adebaffe8c7cb4fe7e909a45d47af08d7c6e.1602349100.git.jsarha@ti.com
4 years agodrm/fourcc: document modifier uniqueness requirements
Simon Ser [Wed, 24 Jun 2020 13:01:31 +0000 (13:01 +0000)]
drm/fourcc: document modifier uniqueness requirements

There have suggestions to bake pitch alignment, address alignment,
contiguous memory or other placement (hidden VRAM, GTT/BAR, etc)
constraints into modifiers. Last time this was brought up it seemed
like the consensus was to not allow this. Document this in drm_fourcc.h.

There are several reasons for this.

- Encoding all of these constraints in the modifiers would explode the
  search space pretty quickly (we only have 64 bits to work with).
- Modifiers need to be unambiguous: a buffer can only have a single
  modifier.
- Modifier users aren't expected to parse modifiers (except drivers).

v2: add paragraph about aliases (Daniel)

v3: fix unrelated changes sent with the patch

v4: disambiguate users between driver and higher-level programs (Brian,
Daniel)

v5: fix AFBC example (Brian, Daniel)

v6: remove duplicated paragraph (Daniel)

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Brian Starkey <brian.starkey@arm.com>
Cc: Daniel Stone <daniel@fooishbar.org>
Cc: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Cc: Dave Airlie <airlied@gmail.com>
Cc: Marek Olšák <maraeo@gmail.com>
Cc: Alex Deucher <alexdeucher@gmail.com>
Cc: Neil Armstrong <narmstrong@baylibre.com>
Cc: Michel Dänzer <michel@daenzer.net>
Link: https://patchwork.freedesktop.org/patch/msgid/MGwgeXojKNdNXjCxuMhRlwcJM4vdYph_WJcMeGPPGMcRKtHV41XAXlh2tCc-pPJZCAhS3gwbWMWTd8f03NBA2ZYKfr0QxLhcPivpopr5c6M=@emersion.fr
4 years agodrm/aspeed: Set driver CMA functions with DRM_GEM_CMA_DRIVER_OPS
Thomas Zimmermann [Fri, 22 May 2020 13:52:29 +0000 (15:52 +0200)]
drm/aspeed: Set driver CMA functions with DRM_GEM_CMA_DRIVER_OPS

DRM_GEM_CMA_DRIVER_OPS sets the functions in struct drm_driver
to their defaults. No functional changes are made.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Joel Stanley <joel@jms.id.au>
Link: https://patchwork.freedesktop.org/patch/msgid/20200603083132.4610-5-tzimmermann@suse.de
4 years agodrm/atomic: Pass the full state to CRTC atomic enable/disable
Maxime Ripard [Thu, 8 Oct 2020 12:44:08 +0000 (14:44 +0200)]
drm/atomic: Pass the full state to CRTC atomic enable/disable

If the CRTC driver ever needs to access the full DRM state, it can't do so
at atomic_enable / atomic_disable time since drm_atomic_helper_swap_state
will have cleared the pointer from the struct drm_crtc_state to the struct
drm_atomic_state before calling those hooks.

In order to allow that, let's pass the full DRM state to atomic_enable and
atomic_disable. The conversion was done using the coccinelle script below,
built tested on all the drivers and actually tested on vc4.

virtual report

@@
struct drm_crtc_helper_funcs *FUNCS;
identifier dev, state;
identifier crtc, crtc_state;
@@

 disable_outputs(struct drm_device *dev, struct drm_atomic_state *state)
 {
  <...
- FUNCS->atomic_disable(crtc, crtc_state);
+ FUNCS->atomic_disable(crtc, state);
  ...>
 }

@@
struct drm_crtc_helper_funcs *FUNCS;
identifier dev, state;
identifier crtc, crtc_state;
@@

 drm_atomic_helper_commit_modeset_enables(struct drm_device *dev, struct drm_atomic_state *state)
 {
  <...
- FUNCS->atomic_enable(crtc, crtc_state);
+ FUNCS->atomic_enable(crtc, state);
  ...>
 }

@@
identifier crtc, old_state;
@@

 struct drm_crtc_helper_funcs {
...
- void (*atomic_enable)(struct drm_crtc *crtc, struct drm_crtc_state *old_state);
+ void (*atomic_enable)(struct drm_crtc *crtc, struct drm_atomic_state *state);
...
- void (*atomic_disable)(struct drm_crtc *crtc, struct drm_crtc_state *old_state);
+ void (*atomic_disable)(struct drm_crtc *crtc, struct drm_atomic_state *state);
...
}

@ crtc_atomic_func @
identifier helpers;
identifier func;
@@

(
static struct drm_crtc_helper_funcs helpers = {
...,
.atomic_enable = func,
...,
};
|
static struct drm_crtc_helper_funcs helpers = {
...,
.atomic_disable = func,
...,
};
)

@ ignores_old_state @
identifier crtc_atomic_func.func;
identifier crtc, old_state;
@@

void func(struct drm_crtc *crtc,
struct drm_crtc_state *old_state)
{
... when != old_state
}

@ adds_old_state depends on crtc_atomic_func && !ignores_old_state @
identifier crtc_atomic_func.func;
identifier crtc, old_state;
@@

void func(struct drm_crtc *crtc, struct drm_crtc_state *old_state)
{
+ struct drm_crtc_state *old_state = drm_atomic_get_old_crtc_state(state, crtc);
...
}

@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
expression E;
type T;
@@

void func(...)
{
...
- T state = E;
+ T crtc_state = E;
<+...
- state
+ crtc_state
...+>

}

@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
type T;
@@

void func(...)
{
...
- T state;
+ T crtc_state;
<+...
- state
+ crtc_state
...+>

}

@ depends on crtc_atomic_func @
identifier crtc_atomic_func.func;
identifier old_state;
identifier crtc;
@@

void func(struct drm_crtc *crtc,
-        struct drm_crtc_state *old_state
+        struct drm_atomic_state *state
       )
{ ... }

@ include depends on adds_old_state @
@@

 #include <drm/drm_atomic.h>

@ no_include depends on !include && adds_old_state @
@@

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

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/845aa10ef171fc0ea060495efef142a0c13f7870.1602161031.git-series.maxime@cerno.tech
4 years agodrm: aspeed: Fix GENMASK misuse
Ondrej Jirman [Sat, 22 Feb 2020 23:51:52 +0000 (00:51 +0100)]
drm: aspeed: Fix GENMASK misuse

Arguments to GENMASK should be msb >= lsb.

Signed-off-by: Ondrej Jirman <megous@megous.com>
Reviewed-by: Andrew Jeffery <andrew@aj.id.au>
Signed-off-by: Joel Stanley <joel@jms.id.au>
Link: https://patchwork.freedesktop.org/patch/msgid/20200222235152.242816-1-megous@megous.com
4 years agodrm/aspeed: Add sysfs for output settings
Joel Stanley [Wed, 16 Sep 2020 08:34:13 +0000 (18:04 +0930)]
drm/aspeed: Add sysfs for output settings

These settings are used by an ASPEED BMC to determine when the host is
trying to drive the display over PCIe (vga_pw) and to switch the
output between PCIe and the internal graphics device (dac_mux).

The valid values for the dac mux are:

 00: VGA mode (default, aka PCIe)
 01: Graphics CRT (aka BMC internal graphics, this driver)
 10: Pass through mode from video input port A
 11: Pass through mode from video input port B

Values for the read-only vga password register are:

 1: Host driving the display
 0: Host not driving the display

Signed-off-by: Joel Stanley <joel@jms.id.au>
Reviewed-by: Andrew Jeffery <andrew@aj.id.au>
Link: https://patchwork.freedesktop.org/patch/msgid/20200916083413.777307-1-joel@jms.id.au
4 years agodma-buf: use struct_size macro
Christian König [Thu, 8 Oct 2020 08:03:22 +0000 (10:03 +0200)]
dma-buf: use struct_size macro

Instead of manually calculating the structure size.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/394252/
4 years agodrm/panfrost: Fix job timeout handling
Boris Brezillon [Fri, 2 Oct 2020 12:25:06 +0000 (14:25 +0200)]
drm/panfrost: Fix job timeout handling

If more than two jobs end up timeout-ing concurrently, only one of them
(the one attached to the scheduler acquiring the lock) is fully handled.
The other one remains in a dangling state where it's no longer part of
the scheduling queue, but still blocks something in scheduler, leading
to repetitive timeouts when new jobs are queued.

Let's make sure all bad jobs are properly handled by the thread
acquiring the lock.

v3:
- Add Steven's R-b
- Don't take the sched_lock when stopping the schedulers

v2:
- Fix the subject prefix
- Stop the scheduler before returning from panfrost_job_timedout()
- Call cancel_delayed_work_sync() after drm_sched_stop() to make sure
  no timeout handlers are in flight when we reset the GPU (Steven Price)
- Make sure we release the reset lock before restarting the
  schedulers (Steven Price)

Fixes: f3ba91228e8e ("drm/panfrost: Add initial panfrost driver")
Cc: <stable@vger.kernel.org>
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Steven Price <steven.price@arm.com>
Signed-off-by: Steven Price <steven.price@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201002122506.1374183-1-boris.brezillon@collabora.com