Geert Uytterhoeven
1e0b9b4466
Revert "drm: Switch DRM_DISPLAY_DP_AUX_BUS to depends on"
...
This reverts commit 4d15125d7f , as helper
code should always be selected by the driver that needs it, for the
convenience of the final user configuring a kernel.
The user who configures a kernel should not need to know which helpers
are needed for the driver he is interested in. Making a driver depend
on helper code means that the user needs to know which helpers to enable
first, which is very user-unfriendly.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be >
Acked-by: Arnd Bergmann <arnd@arndb.de >
Link: https://patchwork.freedesktop.org/patch/msgid/79824fec01eb9ab0673b9409f9b39cc8b5cc338d.1713780345.git.geert+renesas@glider.be
Signed-off-by: Maxime Ripard <mripard@kernel.org >
2024-05-02 17:58:22 +02:00
Geert Uytterhoeven
7fe302ae19
Revert "drm: Switch DRM_DISPLAY_DP_HELPER to depends on"
...
This reverts commit 0323287de8 , as helper
code should always be selected by the driver that needs it, for the
convenience of the final user configuring a kernel.
The user who configures a kernel should not need to know which helpers
are needed for the driver he is interested in. Making a driver depend
on helper code means that the user needs to know which helpers to enable
first, which is very user-unfriendly.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be >
Acked-by: Arnd Bergmann <arnd@arndb.de >
Link: https://patchwork.freedesktop.org/patch/msgid/89ac456805746b6d0c888f10c5120b11aacd3319.1713780345.git.geert+renesas@glider.be
Signed-off-by: Maxime Ripard <mripard@kernel.org >
2024-05-02 17:58:21 +02:00
Thomas Zimmermann
0992284b4f
drm/mediatek: Use fbdev-dma
...
Implement fbdev emulation with fbdev-dma. Fbdev-dma now supports
damage handling, which is required by ingenic. Avoids the overhead of
fbdev-generic's additional shadow buffering. No functional changes.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de >
Cc: Chun-Kuang Hu <chunkuang.hu@kernel.org >
Cc: Philipp Zabel <p.zabel@pengutronix.de >
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20240419083331.7761-27-tzimmermann@suse.de
2024-05-02 11:33:24 +02:00
Dave Airlie
2236a61bd4
Merge tag 'mediatek-drm-next-6.10' of https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux into drm-next
...
Mediatek DRM Next for Linux 6.10
1. Use devm_platform_get_and_ioremap_resource() in mtk_hdmi_ddc_probe()
2. Add GAMMA 12-bit LUT support for MT8188
3. Add 0 size check to mtk_drm_gem_obj
4. Init `ddp_comp` with devm_kcalloc()
5. Rename mtk_drm_* to mtk_*
6. Drop driver owner initialization
7. Fix mtk_dp_aux_transfer return value
8. Correct calculation formula of PHY Timing
Signed-off-by: Dave Airlie <airlied@redhat.com >
From: Chun-Kuang Hu <chunkuang.hu@kernel.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20240425153859.3579-1-chunkuang.hu@kernel.org
2024-04-26 14:32:09 +10:00
Kent Overstreet
0069455bcb
fix missing vmalloc.h includes
...
Patch series "Memory allocation profiling", v6.
Overview:
Low overhead [1] per-callsite memory allocation profiling. Not just for
debug kernels, overhead low enough to be deployed in production.
Example output:
root@moria-kvm:~# sort -rn /proc/allocinfo
127664128 31168 mm/page_ext.c:270 func:alloc_page_ext
56373248 4737 mm/slub.c:2259 func:alloc_slab_page
14880768 3633 mm/readahead.c:247 func:page_cache_ra_unbounded
14417920 3520 mm/mm_init.c:2530 func:alloc_large_system_hash
13377536 234 block/blk-mq.c:3421 func:blk_mq_alloc_rqs
11718656 2861 mm/filemap.c:1919 func:__filemap_get_folio
9192960 2800 kernel/fork.c:307 func:alloc_thread_stack_node
4206592 4 net/netfilter/nf_conntrack_core.c:2567 func:nf_ct_alloc_hashtable
4136960 1010 drivers/staging/ctagmod/ctagmod.c:20 [ctagmod] func:ctagmod_start
3940352 962 mm/memory.c:4214 func:alloc_anon_folio
2894464 22613 fs/kernfs/dir.c:615 func:__kernfs_new_node
...
Usage:
kconfig options:
- CONFIG_MEM_ALLOC_PROFILING
- CONFIG_MEM_ALLOC_PROFILING_ENABLED_BY_DEFAULT
- CONFIG_MEM_ALLOC_PROFILING_DEBUG
adds warnings for allocations that weren't accounted because of a
missing annotation
sysctl:
/proc/sys/vm/mem_profiling
Runtime info:
/proc/allocinfo
Notes:
[1]: Overhead
To measure the overhead we are comparing the following configurations:
(1) Baseline with CONFIG_MEMCG_KMEM=n
(2) Disabled by default (CONFIG_MEM_ALLOC_PROFILING=y &&
CONFIG_MEM_ALLOC_PROFILING_BY_DEFAULT=n)
(3) Enabled by default (CONFIG_MEM_ALLOC_PROFILING=y &&
CONFIG_MEM_ALLOC_PROFILING_BY_DEFAULT=y)
(4) Enabled at runtime (CONFIG_MEM_ALLOC_PROFILING=y &&
CONFIG_MEM_ALLOC_PROFILING_BY_DEFAULT=n && /proc/sys/vm/mem_profiling=1)
(5) Baseline with CONFIG_MEMCG_KMEM=y && allocating with __GFP_ACCOUNT
(6) Disabled by default (CONFIG_MEM_ALLOC_PROFILING=y &&
CONFIG_MEM_ALLOC_PROFILING_BY_DEFAULT=n) && CONFIG_MEMCG_KMEM=y
(7) Enabled by default (CONFIG_MEM_ALLOC_PROFILING=y &&
CONFIG_MEM_ALLOC_PROFILING_BY_DEFAULT=y) && CONFIG_MEMCG_KMEM=y
Performance overhead:
To evaluate performance we implemented an in-kernel test executing
multiple get_free_page/free_page and kmalloc/kfree calls with allocation
sizes growing from 8 to 240 bytes with CPU frequency set to max and CPU
affinity set to a specific CPU to minimize the noise. Below are results
from running the test on Ubuntu 22.04.2 LTS with 6.8.0-rc1 kernel on
56 core Intel Xeon:
kmalloc pgalloc
(1 baseline) 6.764s 16.902s
(2 default disabled) 6.793s (+0.43%) 17.007s (+0.62%)
(3 default enabled) 7.197s (+6.40%) 23.666s (+40.02%)
(4 runtime enabled) 7.405s (+9.48%) 23.901s (+41.41%)
(5 memcg) 13.388s (+97.94%) 48.460s (+186.71%)
(6 def disabled+memcg) 13.332s (+97.10%) 48.105s (+184.61%)
(7 def enabled+memcg) 13.446s (+98.78%) 54.963s (+225.18%)
Memory overhead:
Kernel size:
text data bss dec diff
(1) 26515311 18890222 17018880 62424413
(2) 26524728 19423818 16740352 62688898 264485
(3) 26524724 19423818 16740352 62688894 264481
(4) 26524728 19423818 16740352 62688898 264485
(5) 26541782 18964374 16957440 62463596 39183
Memory consumption on a 56 core Intel CPU with 125GB of memory:
Code tags: 192 kB
PageExts: 262144 kB (256MB)
SlabExts: 9876 kB (9.6MB)
PcpuExts: 512 kB (0.5MB)
Total overhead is 0.2% of total memory.
Benchmarks:
Hackbench tests run 100 times:
hackbench -s 512 -l 200 -g 15 -f 25 -P
baseline disabled profiling enabled profiling
avg 0.3543 0.3559 (+0.0016) 0.3566 (+0.0023)
stdev 0.0137 0.0188 0.0077
hackbench -l 10000
baseline disabled profiling enabled profiling
avg 6.4218 6.4306 (+0.0088) 6.5077 (+0.0859)
stdev 0.0933 0.0286 0.0489
stress-ng tests:
stress-ng --class memory --seq 4 -t 60
stress-ng --class cpu --seq 4 -t 60
Results posted at: https://evilpiepirate.org/~kent/memalloc_prof_v4_stress-ng/
[2] https://lore.kernel.org/all/20240306182440.2003814-1-surenb@google.com/
This patch (of 37):
The next patch drops vmalloc.h from a system header in order to fix a
circular dependency; this adds it to all the files that were pulling it in
implicitly.
[kent.overstreet@linux.dev: fix arch/alpha/lib/memcpy.c]
Link: https://lkml.kernel.org/r/20240327002152.3339937-1-kent.overstreet@linux.dev
[surenb@google.com: fix arch/x86/mm/numa_32.c]
Link: https://lkml.kernel.org/r/20240402180933.1663992-1-surenb@google.com
[kent.overstreet@linux.dev: a few places were depending on sizes.h]
Link: https://lkml.kernel.org/r/20240404034744.1664840-1-kent.overstreet@linux.dev
[arnd@arndb.de: fix mm/kasan/hw_tags.c]
Link: https://lkml.kernel.org/r/20240404124435.3121534-1-arnd@kernel.org
[surenb@google.com: fix arc build]
Link: https://lkml.kernel.org/r/20240405225115.431056-1-surenb@google.com
Link: https://lkml.kernel.org/r/20240321163705.3067592-1-surenb@google.com
Link: https://lkml.kernel.org/r/20240321163705.3067592-2-surenb@google.com
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev >
Signed-off-by: Suren Baghdasaryan <surenb@google.com >
Signed-off-by: Arnd Bergmann <arnd@arndb.de >
Reviewed-by: Pasha Tatashin <pasha.tatashin@soleen.com >
Tested-by: Kees Cook <keescook@chromium.org >
Cc: Alexander Viro <viro@zeniv.linux.org.uk >
Cc: Alex Gaynor <alex.gaynor@gmail.com >
Cc: Alice Ryhl <aliceryhl@google.com >
Cc: Andreas Hindborg <a.hindborg@samsung.com >
Cc: Benno Lossin <benno.lossin@proton.me >
Cc: "Björn Roy Baron" <bjorn3_gh@protonmail.com >
Cc: Boqun Feng <boqun.feng@gmail.com >
Cc: Christoph Lameter <cl@linux.com >
Cc: Dennis Zhou <dennis@kernel.org >
Cc: Gary Guo <gary@garyguo.net >
Cc: Miguel Ojeda <ojeda@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Tejun Heo <tj@kernel.org >
Cc: Vlastimil Babka <vbabka@suse.cz >
Cc: Wedson Almeida Filho <wedsonaf@gmail.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2024-04-25 20:55:49 -07:00
Shuijing Li
417d8c4727
drm/mediatek: dsi: Correct calculation formula of PHY Timing
...
This patch correct calculation formula of PHY timing.
The spec define HS-PREPARE should be from 40ns+4*UI(44ns) to
85ns+6*UI(91ns). But current duration is 88ns and is near the boundary.
So this patch make the duration to 64ns so it is near the safe range.
Signed-off-by: Shuijing Li <shuijing.li@mediatek.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240412031208.30688-1-shuijing.li@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2024-04-22 13:40:34 +00:00
Wojciech Macek
8431fff9e0
drm/mediatek: dp: Fix mtk_dp_aux_transfer return value
...
In case there is no DP device attached to the port the
transfer function should return IO error, similar to what
other drivers do.
In case EAGAIN is returned then any read from /dev/drm_dp_aux
device ends up in an infinite loop as the upper layers
constantly repeats the transfer request.
Fixes: f70ac097a2 ("drm/mediatek: Add MT8195 Embedded DisplayPort driver")
Signed-off-by: Wojciech Macek <wmacek@chromium.org >
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240417103819.990512-1-wmacek@chromium.org/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2024-04-22 13:29:07 +00:00
Krzysztof Kozlowski
499eb5197d
drm/mediatek: padding: drop driver owner initialization
...
Core in platform_driver_register() already sets the .owner, so driver
does not need to. Whatever is set here will be anyway overwritten by
main driver calling platform_driver_register().
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240330-b4-module-owner-drm-mediatek-v1-11-fd5c4b8d633e@linaro.org/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2024-04-04 13:35:49 +00:00
Krzysztof Kozlowski
f741a2c97b
drm/mediatek: mdp_rdma: drop driver owner initialization
...
Core in platform_driver_register() already sets the .owner, so driver
does not need to. Whatever is set here will be anyway overwritten by
main driver calling platform_driver_register().
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240330-b4-module-owner-drm-mediatek-v1-10-fd5c4b8d633e@linaro.org/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2024-04-04 13:34:11 +00:00
Krzysztof Kozlowski
e30814aa8c
drm/mediatek: ethdr: drop driver owner initialization
...
Core in platform_driver_register() already sets the .owner, so driver
does not need to. Whatever is set here will be anyway overwritten by
main driver calling platform_driver_register().
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240330-b4-module-owner-drm-mediatek-v1-9-fd5c4b8d633e@linaro.org/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2024-04-04 13:33:21 +00:00
Krzysztof Kozlowski
1dd13de2ca
drm/mediatek: rdma: drop driver owner initialization
...
Core in platform_driver_register() already sets the .owner, so driver
does not need to. Whatever is set here will be anyway overwritten by
main driver calling platform_driver_register().
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240330-b4-module-owner-drm-mediatek-v1-8-fd5c4b8d633e@linaro.org/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2024-04-04 13:32:39 +00:00
Krzysztof Kozlowski
5b52977be5
drm/mediatek: ovl_adaptor: drop driver owner initialization
...
Core in platform_driver_register() already sets the .owner, so driver
does not need to. Whatever is set here will be anyway overwritten by
main driver calling platform_driver_register().
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240330-b4-module-owner-drm-mediatek-v1-7-fd5c4b8d633e@linaro.org/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2024-04-04 13:31:52 +00:00
Krzysztof Kozlowski
39e19ae743
drm/mediatek: ovl: drop driver owner initialization
...
Core in platform_driver_register() already sets the .owner, so driver
does not need to. Whatever is set here will be anyway overwritten by
main driver calling platform_driver_register().
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240330-b4-module-owner-drm-mediatek-v1-6-fd5c4b8d633e@linaro.org/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2024-04-04 13:31:06 +00:00
Krzysztof Kozlowski
c439d9779e
drm/mediatek: merge: drop driver owner initialization
...
Core in platform_driver_register() already sets the .owner, so driver
does not need to. Whatever is set here will be anyway overwritten by
main driver calling platform_driver_register().
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240330-b4-module-owner-drm-mediatek-v1-5-fd5c4b8d633e@linaro.org/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2024-04-04 13:30:20 +00:00
Krzysztof Kozlowski
704d6a254c
drm/mediatek: gamma: drop driver owner initialization
...
Core in platform_driver_register() already sets the .owner, so driver
does not need to. Whatever is set here will be anyway overwritten by
main driver calling platform_driver_register().
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240330-b4-module-owner-drm-mediatek-v1-4-fd5c4b8d633e@linaro.org/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2024-04-04 13:29:34 +00:00
Krzysztof Kozlowski
4b2b61fd94
drm/mediatek: color: drop driver owner initialization
...
Core in platform_driver_register() already sets the .owner, so driver
does not need to. Whatever is set here will be anyway overwritten by
main driver calling platform_driver_register().
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240330-b4-module-owner-drm-mediatek-v1-3-fd5c4b8d633e@linaro.org/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2024-04-04 13:28:51 +00:00
Krzysztof Kozlowski
4c591e97bf
drm/mediatek: ccorr: drop driver owner initialization
...
Core in platform_driver_register() already sets the .owner, so driver
does not need to. Whatever is set here will be anyway overwritten by
main driver calling platform_driver_register().
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240330-b4-module-owner-drm-mediatek-v1-2-fd5c4b8d633e@linaro.org/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2024-04-04 13:27:44 +00:00
Krzysztof Kozlowski
10b4dd281f
drm/mediatek: aal: drop driver owner initialization
...
Core in platform_driver_register() already sets the .owner, so driver
does not need to. Whatever is set here will be anyway overwritten by
main driver calling platform_driver_register().
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240330-b4-module-owner-drm-mediatek-v1-1-fd5c4b8d633e@linaro.org/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2024-04-04 13:26:29 +00:00
Hsiao Chien Sung
278640d4d7
drm/mediatek: Rename mtk_ddp_comp functions
...
Rename functions of mtk_ddp_comp:
- To align the naming rule
- To reduce the code size
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.corp-partner.google.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240322091232.26387-15-shawn.sung@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2024-04-01 15:37:16 +00:00
Hsiao Chien Sung
535960b95f
drm/mediatek: Rename files "mtk_drm_gem.c" to "mtk_gem.c"
...
Rename files mtk_drm_gem.c to mtk_gem.c.
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.corp-partner.google.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240322091232.26387-14-shawn.sung@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2024-04-01 15:35:43 +00:00
Hsiao Chien Sung
f2468165f7
drm/mediatek: Rename files "mtk_drm_gem.h" to "mtk_gem.h"
...
Rename files mtk_drm_gem.h to mtk_gem.h.
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.corp-partner.google.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240322091232.26387-13-shawn.sung@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2024-04-01 15:33:52 +00:00
Hsiao Chien Sung
543571d424
drm/mediatek: Rename files "mtk_drm_plane.c" to "mtk_plane.c"
...
Rename files mtk_drm_plane.c to mtk_plane.c and
modify the Makefile accordingly.
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.corp-partner.google.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240322091232.26387-12-shawn.sung@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2024-04-01 15:32:11 +00:00
Hsiao Chien Sung
9f2997ab49
drm/mediatek: Rename files "mtk_drm_plane.h" to "mtk_plane.h"
...
Rename files mtk_drm_plane.h to mtk_plane.h.
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.corp-partner.google.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240322091232.26387-11-shawn.sung@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2024-04-01 15:30:26 +00:00
Hsiao Chien Sung
d0950cc103
drm/mediatek: Rename files "mtk_drm_ddp_comp.c" to "mtk_ddp_comp.c"
...
Rename files mtk_drm_ddp_comp.c to mtk_ddp_comp.c and
modify the Makefile accordingly.
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.corp-partner.google.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240322091232.26387-10-shawn.sung@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2024-04-01 15:28:38 +00:00
Hsiao Chien Sung
7026ee0b3d
drm/mediatek: Rename files "mtk_drm_ddp_comp.h" to "mtk_ddp_comp.h"
...
Rename files mtk_drm_ddp_comp.h to mtk_ddp_comp.h.
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.corp-partner.google.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240322091232.26387-9-shawn.sung@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2024-04-01 15:26:45 +00:00
Hsiao Chien Sung
9d5036eb05
drm/mediatek: Rename files "mtk_drm_crtc.c" to "mtk_crtc.c"
...
Rename files mtk_drm_crtc.c to mtk_crtc.c and
modify the Makefile accordingly.
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.corp-partner.google.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240322091232.26387-8-shawn.sung@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2024-04-01 15:24:47 +00:00
Hsiao Chien Sung
f5214df8d6
drm/mediatek: Rename files "mtk_drm_crtc.h" to "mtk_crtc.h"
...
Rename files mtk_drm_crtc.h to mtk_crtc.h.
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.corp-partner.google.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240322091232.26387-7-shawn.sung@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2024-04-01 15:21:09 +00:00
Hsiao Chien Sung
4bda3ca572
drm/mediatek: Rename "mtk_drm_hdmi" to "mtk_hdmi"
...
Rename all "mtk_drm_hdmi" to "mtk_hdmi":
- To align the naming rule
- To reduce the code size
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.corp-partner.google.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240322091232.26387-6-shawn.sung@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2024-04-01 15:18:17 +00:00
Hsiao Chien Sung
40024b82c2
drm/mediatek: Rename "mtk_drm_gem" to "mtk_gem"
...
Rename all "mtk_drm_gem" to "mtk_gem":
- To align the naming rule
- To reduce the code size
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.corp-partner.google.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240322091232.26387-5-shawn.sung@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2024-04-01 15:15:48 +00:00
Hsiao Chien Sung
56d4c998e9
drm/mediatek: Rename "mtk_drm_plane" to "mtk_plane"
...
Rename all "mtk_drm_plane" to "mtk_plane":
- To align the naming rule
- To reduce the code size
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.corp-partner.google.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240322091232.26387-4-shawn.sung@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2024-04-01 15:12:16 +00:00
Hsiao Chien Sung
b7919e8e18
drm/mediatek: Rename "mtk_drm_ddp_comp" to "mtk_ddp_comp"
...
Rename all "mtk_drm_ddp_comp" to "mtk_ddp_comp":
- To align the naming rule
- To reduce the code size
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.corp-partner.google.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240322091232.26387-3-shawn.sung@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2024-04-01 15:09:07 +00:00
Hsiao Chien Sung
9e14987903
drm/mediatek: Rename "mtk_drm_crtc" to "mtk_crtc"
...
Rename all "mtk_drm_crtc" to "mtk_crtc" due to the following benefits:
- Lower the matches when searching the native drm_crtc* codes
- Reduce the code size
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.corp-partner.google.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240322091232.26387-2-shawn.sung@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2024-04-01 15:05:32 +00:00
Douglas Anderson
01a2c5123e
drm/mediatek: Init ddp_comp with devm_kcalloc()
...
In the case where `conn_routes` is true we allocate an extra slot in
the `ddp_comp` array but mtk_drm_crtc_create() never seemed to
initialize it in the test case I ran. For me, this caused a later
crash when we looped through the array in mtk_drm_crtc_mode_valid().
This showed up for me when I booted with `slub_debug=FZPUA` which
poisons the memory initially. Without `slub_debug` I couldn't
reproduce, presumably because the later code handles the value being
NULL and in most cases (not guaranteed in all cases) the memory the
allocator returned started out as 0.
It really doesn't hurt to initialize the array with devm_kcalloc()
since the array is small and the overhead of initting a handful of
elements to 0 is small. In general initting memory to zero is a safer
practice and usually it's suggested to only use the non-initting alloc
functions if you really need to.
Let's switch the function to use an allocation function that zeros the
memory. For me, this avoids the crash.
Fixes: 01389b324c ("drm/mediatek: Add connector dynamic selection capability")
Signed-off-by: Douglas Anderson <dianders@chromium.org >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240328092248.1.I2e73c38c0f264ee2fa4a09cdd83994e37ba9f541@changeid/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2024-04-01 14:56:57 +00:00
Justin Green
1e4350095e
drm/mediatek: Add 0 size check to mtk_drm_gem_obj
...
Add a check to mtk_drm_gem_init if we attempt to allocate a GEM object
of 0 bytes. Currently, no such check exists and the kernel will panic if
a userspace application attempts to allocate a 0x0 GBM buffer.
Tested by attempting to allocate a 0x0 GBM buffer on an MT8188 and
verifying that we now return EINVAL.
Fixes: 119f517362 ("drm/mediatek: Add DRM Driver for Mediatek SoC MT8173.")
Signed-off-by: Justin Green <greenjustin@chromium.org >
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240307180051.4104425-1-greenjustin@chromium.org/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2024-04-01 14:52:31 +00:00
Jason-JH.Lin
60cb97cc91
drm/mediatek: Add gamma support for MT8195
...
Since MT8195 compatible is in the single enum group, we have to add its
compatible into mediatek-drm component binding table to ensure that
it can be bound as a ddp_comp.
Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com >
Reviewed-by: AngeloGioacchino Del Regno <angelogiaocchino.delregno@collabora.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240229144844.1688-4-jason-jh.lin@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2024-04-01 14:45:55 +00:00
Markus Elfring
d64e9d0fb6
drm/mediatek: Use devm_platform_get_and_ioremap_resource() in mtk_hdmi_ddc_probe()
...
A wrapper function is available since the commit 890cc39a87
("drivers: provide devm_platform_get_and_ioremap_resource()").
Thus reuse existing functionality instead of keeping duplicate
source code.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net >
Link: https://patchwork.kernel.org/project/dri-devel/patch/2a4ecf78-20e7-4678-a67d-0d66956b07cc@web.de/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2024-04-01 14:02:19 +00:00
Maxime Ripard
0323287de8
drm: Switch DRM_DISPLAY_DP_HELPER to depends on
...
Most of our helpers have relied on being selected so far through
Kconfig, but that creates issues when we have multiple layers of helpers
with some depending on others.
Indeed, select doesn't select a dependency's dependencies, and thus
isn't super intuitive. Depends on however doesn't have that limitation,
so we can just switch all the drivers that were selecting
DRM_DISPLAY_DP_HELPER to depend on it.
Reviewed-by: Jani Nikula <jani.nikula@intel.com >
Link: https://lore.kernel.org/r/20240327-kms-kconfig-helpers-v3-10-eafee11b84b3@kernel.org
Signed-off-by: Maxime Ripard <mripard@kernel.org >
2024-03-28 11:26:51 +01:00
Maxime Ripard
4d15125d7f
drm: Switch DRM_DISPLAY_DP_AUX_BUS to depends on
...
Most of our helpers have relied on being selected so far through
Kconfig, but that creates issues when we have multiple layers of helpers
with some depending on others.
Indeed, select doesn't select a dependency's dependencies, and thus
isn't super intuitive. Depends on however doesn't have that limitation,
so we can just switch all the drivers that were selecting
DRM_DISPLAY_DP_AUX_BUS to depend on it.
Reviewed-by: Jani Nikula <jani.nikula@intel.com >
Link: https://lore.kernel.org/r/20240327-kms-kconfig-helpers-v3-9-eafee11b84b3@kernel.org
Signed-off-by: Maxime Ripard <mripard@kernel.org >
2024-03-28 11:26:50 +01:00
Maxime Ripard
e075e496f5
drm: Switch DRM_DISPLAY_HELPER to depends on
...
Most of our helpers have relied on being selected so far through
Kconfig, but that creates issues when we have multiple layers of helpers
with some depending on others.
Indeed, select doesn't select a dependency's dependencies, and thus
isn't super intuitive. Depends on however doesn't have that limitation,
so we can just switch all the drivers that were selecting
DRM_DISPLAY_HELPER to depend on it.
Reviewed-by: Jani Nikula <jani.nikula@intel.com >
Link: https://lore.kernel.org/r/20240327-kms-kconfig-helpers-v3-8-eafee11b84b3@kernel.org
Signed-off-by: Maxime Ripard <mripard@kernel.org >
2024-03-28 11:26:49 +01:00
Maxime Ripard
671b6c9e76
drm/display: Make DisplayPort AUX bus Kconfig name consistent
...
While most display helpers Kconfig symbols have the DRM_DISPLAY prefix,
the DisplayPort AUX bus implementation uses DRM_DP_AUX_BUS.
Since the number of users is limited and it's a selected symbol, we can
easily rename it to make it consistent.
Reviewed-by: Jani Nikula <jani.nikula@intel.com >
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com >
Link: https://lore.kernel.org/r/20240327-kms-kconfig-helpers-v3-1-eafee11b84b3@kernel.org
Signed-off-by: Maxime Ripard <mripard@kernel.org >
2024-03-28 11:26:36 +01:00
Dave Airlie
017da39e9c
Merge tag 'mediatek-drm-next-6.9' of https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux into drm-next
...
Mediatek DRM Next for Linux 6.9
1. Add display driver for MT8188 VDOSYS1
2. DSI driver cleanups
3. Filter modes according to hardware capability
4. Fix a null pointer crash in mtk_drm_crtc_finish_page_flip
Signed-off-by: Dave Airlie <airlied@redhat.com >
From: Chun-Kuang Hu <chunkuang.hu@kernel.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20240229162143.28957-1-chunkuang.hu@kernel.org
2024-03-01 19:14:33 +10:00
Hsin-Yi Wang
c958e86e9c
drm/mediatek: Fix a null pointer crash in mtk_drm_crtc_finish_page_flip
...
It's possible that mtk_crtc->event is NULL in
mtk_drm_crtc_finish_page_flip().
pending_needs_vblank value is set by mtk_crtc->event, but in
mtk_drm_crtc_atomic_flush(), it's is not guarded by the same
lock in mtk_drm_finish_page_flip(), thus a race condition happens.
Consider the following case:
CPU1 CPU2
step 1:
mtk_drm_crtc_atomic_begin()
mtk_crtc->event is not null,
step 1:
mtk_drm_crtc_atomic_flush:
mtk_drm_crtc_update_config(
!!mtk_crtc->event)
step 2:
mtk_crtc_ddp_irq ->
mtk_drm_finish_page_flip:
lock
mtk_crtc->event set to null,
pending_needs_vblank set to false
unlock
pending_needs_vblank set to true,
step 2:
mtk_crtc_ddp_irq ->
mtk_drm_finish_page_flip called again,
pending_needs_vblank is still true
//null pointer
Instead of guarding the entire mtk_drm_crtc_atomic_flush(), it's more
efficient to just check if mtk_crtc->event is null before use.
Fixes: 119f517362 ("drm/mediatek: Add DRM Driver for Mediatek SoC MT8173.")
Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240223212404.3709690-1-hsinyi@chromium.org/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2024-02-29 16:15:28 +00:00
Hsiao Chien Sung
5306b3fe57
drm/mediatek: Filter modes according to hardware capability
...
We found a stability issue on MT8188 when connecting an external monitor
in 2560x1440@144Hz mode. Checked with the designer, there is a function
called "prefetch" which is working during VBP (triggered by VSYNC).
If the duration of VBP is too short, the throughput requirement could
increase more than 3 times and lead to stability issues.
The mode settings that VDOSYS supports are mainly affected by clock
rate and throughput, display driver should filter these settings
according to the SoC's limitation to avoid unstable conditions.
Since currently the mode filter is only available on MT8195 and MT8188
and they share the same compatible name, the reference number (8250)
is hard coded instead of in the driver data.
Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.corp-partner.google.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240220093711.20546-2-shawn.sung@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2024-02-27 00:02:55 +00:00
AngeloGioacchino Del Regno
e14cba94bc
drm/mediatek: dsi: Use mipi_dsi_pixel_format_to_bpp() helper function
...
Instead of open coding, use the mipi_dsi_pixel_format_to_bpp() helper
function from drm_mipi_dsi.h in mtk_dsi_poweron() and for validation
in mtk_dsi_bridge_mode_valid().
Note that this function changes the behavior of this driver: previously,
in case of unknown formats, it would (wrongly) assume that it should
account for a 24-bits format - now it will return an error and refuse
to set clocks and/or enable the DSI.
This is done because setting the wrong data rate will only produce a
garbage output that the display will misinterpret both because this
driver doesn't actually provide any extra-spec format support and/or
because the data rate (hence, the HS clock) will be wrong.
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com >
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240215085316.56835-10-angelogioacchino.delregno@collabora.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2024-02-19 14:49:51 +00:00
AngeloGioacchino Del Regno
2aa9514adf
drm/mediatek: dsi: Compress of_device_id entries and add sentinel
...
All entries fit in 82 columns, which is acceptable: compress all of
the mtk_dsi_of_match[] entries to a single line for each.
While at it, also add the usual sentinel comment to the last entry.
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com >
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240215085316.56835-9-angelogioacchino.delregno@collabora.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2024-02-19 14:48:22 +00:00
AngeloGioacchino Del Regno
5c985686d8
drm/mediatek: dsi: Simplify with dev_err_probe and remove gotos
...
Most of the functions that are called in the probe callback are
devm managed, or all but mipi_dsi_host_register(): simplify the probe
function's error paths with dev_err_probe() and remove the lonely
instance of `goto err_unregister_host` by just directly calling the
mipi_dsi_host_unregister() function in the devm_request_irq() error
path, allowing to also remove the same label.
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com >
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240215085316.56835-8-angelogioacchino.delregno@collabora.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2024-02-19 14:46:46 +00:00
AngeloGioacchino Del Regno
e4732b590a
drm/mediatek: dsi: Register DSI host after acquiring clocks and PHY
...
Registering the dsi host with its ops before getting dsi->regs is
simply wrong: even though there's nothing (for now) asynchronously
calling those ops before the end of the probe function, installing
ops that are using iospace(s) and clocks before even initializing
those is too fragile.
Register the DSI host after getting clocks, iospace and PHY.
This wil also allow to simplify the error paths in a later commit.
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com >
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240215085316.56835-7-angelogioacchino.delregno@collabora.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2024-02-19 14:45:06 +00:00
AngeloGioacchino Del Regno
ff4e452146
drm/mediatek: dsi: Replace open-coded instance of HZ_PER_MHZ
...
In mtk_dsi_phy_timconfig(), we're dividing the `data_rate` variable,
expressed in Hz to retrieve a value in MHz: instead of open-coding,
use the HZ_PER_MHZ definition, available in linux/units.h.
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240215085316.56835-6-angelogioacchino.delregno@collabora.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2024-02-19 14:43:30 +00:00
AngeloGioacchino Del Regno
aaeb9335fb
drm/mediatek: dsi: Use bitfield macros where useful
...
Instead of open coding bitshifting for various register fields,
use the bitfield macro FIELD_PREP(): this allows to enhance the
human readability, decrease likeliness of mistakes (and register
field overflowing) and also to simplify the code.
The latter is especially seen in mtk_dsi_rxtx_control(), where
it was possible to change a switch to a short for loop and to
also remove the need to check for maximum DSI lanes == 4 thanks
to the FIELD_PREP macro masking the value.
While at it, also add the missing DA_HS_SYNC bitmask, used in
mtk_dsi_phy_timconfig().
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240215085316.56835-5-angelogioacchino.delregno@collabora.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2024-02-19 14:42:01 +00:00
AngeloGioacchino Del Regno
5c6186a8f0
drm/mediatek: dsi: Cleanup functions mtk_dsi_ps_control{_vact}()
...
Function mtk_dsi_ps_control() is a subset of mtk_dsi_ps_control_vact():
merge the two in one mtk_dsi_ps_control() function by adding one
function parameter `config_vact` which, when true, writes the VACT
related registers.
Reviewed-by: Fei Shao <fshao@chromium.org >
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com >
Reviewed-by: CK Hu <ck.hu@mediatek.com >
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240215085316.56835-4-angelogioacchino.delregno@collabora.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org >
2024-02-19 14:36:19 +00:00