aboutsummaryrefslogtreecommitdiff
path: root/drivers/video
AgeCommit message (Collapse)AuthorFilesLines
2024-05-22Merge tag 'backlight-next-6.10' of ↵Gravatar Linus Torvalds 33-310/+121
git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight Pull backlight updates from Lee Jones: "Fix-ups: - FB Backlight interaction overhaul - Remove superfluous code and simplify overall - Constify various structs and struct attributes Bug Fixes: - Repair LED flickering - Fix signedness bugs" * tag 'backlight-next-6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight: (42 commits) backlight: sky81452-backlight: Remove unnecessary call to of_node_get() backlight: mp3309c: Fix LEDs flickering in PWM mode backlight: otm3225a: Drop driver owner assignment backlight: lp8788: Drop support for platform data backlight: lcd: Make lcd_class constant backlight: Make backlight_class constant backlight: mp3309c: Fix signedness bug in mp3309c_parse_fwnode() const_structs.checkpatch: add lcd_ops fbdev: omap: lcd_ams_delta: Constify lcd_ops fbdev: imx: Constify lcd_ops fbdev: clps711x: Constify lcd_ops HID: picoLCD: Constify lcd_ops backlight: tdo24m: Constify lcd_ops backlight: platform_lcd: Constify lcd_ops backlight: otm3225a: Constify lcd_ops backlight: ltv350qv: Constify lcd_ops backlight: lms501kf03: Constify lcd_ops backlight: lms283gf05: Constify lcd_ops backlight: l4f00242t03: Constify lcd_ops backlight: jornada720_lcd: Constify lcd_ops ...
2024-05-20Merge tag 'asm-generic-6.10' of ↵Gravatar Linus Torvalds 1-1/+1
git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic Pull asm-generic cleanups from Arnd Bergmann: "These are a few cross-architecture cleanup patches: - separate out fbdev support from the asm/video.h contents that may be used by either the old fbdev drivers or the newer drm display code (Thomas Zimmermann) - cleanups for the generic bitops code and asm-generic/bug.h (Thorsten Blum) - remove the orphaned include/asm-generic/page.h header that used to be included by long-removed mmu-less architectures (me)" * tag 'asm-generic-6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic: arch: Fix name collision with ACPI's video.o bug: Improve comment asm-generic: remove unused asm-generic/page.h arch: Rename fbdev header and source files arch: Remove struct fb_info from video helpers arch: Select fbdev helpers with CONFIG_VIDEO bitops: Change function return types from long to int
2024-05-15Merge tag 'fbdev-for-6.10-rc1' of ↵Gravatar Linus Torvalds 16-56/+35
git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev Pull fbdev updates from Helge Deller: "Code cleanups for offb, shmobile, sisfb, savage, au1200fb, uvesafb, omap2 and sh7760fb, as well as the addition of some HAS_IOPORT dependencies and adjustment of generated logo file to make build reproducible" * tag 'fbdev-for-6.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev: fbdev: offb: replace of_node_put with __free(device_node) fbdev: savage: Handle err return when savagefb_check_var failed video: hdmi: prefer length specifier in format over string copying fbdev: uvesafb: replace deprecated strncpy with strscpy_pad fbdev: au1200fb: replace deprecated strncpy with strscpy fbdev: fsl-diu-fb: replace deprecated strncpy with strscpy_pad video: logo: Drop full path of the input filename in generated file fbdev: add HAS_IOPORT dependencies fbdev: sh7760fb: allow modular build fbdev: sisfb: hide unused variables fbdev: shmobile: fix snprintf truncation fbdev: omap2: replace of_graph_get_next_endpoint()
2024-05-10backlight: sky81452-backlight: Remove unnecessary call to of_node_get()Gravatar Shresth Prasad 1-6/+2
`dev->of_node` already has a reference to the device_node and calling of_node_get on it is unnecessary. All conresponding calls to of_node_put are also removed. Signed-off-by: Shresth Prasad <shresthprasad7@gmail.com> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240502172121.8695-2-shresthprasad7@gmail.com Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-10backlight: mp3309c: Fix LEDs flickering in PWM modeGravatar Flavio Suligoi 1-5/+0
The mp3309 has two configuration registers, named according to their address (0x00 and 0x01). In the second register (0x01), the bit DIMS (Dimming Mode Select) must be always 0 (zero), in both analog (via I2C commands) and PWM dimming mode. In the initial driver version, the DIMS bit was set in PWM mode and reset in analog mode. But if the DIMS bit is set in pwm dimming mode and other devices are connected on the same I2C bus, every I2C commands on the bus generates a flickering on the LEDs powered by the mp3309c. This change concerns the chip initialization and does not impact any existing device-tree configuration. Signed-off-by: Flavio Suligoi <f.suligoi@asem.it> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240417153105.1794134-2-f.suligoi@asem.it Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-10backlight: otm3225a: Drop driver owner assignmentGravatar Krzysztof Kozlowski 1-1/+0
Core in spi_register_driver() already sets the .owner, so driver does not need to. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240327174714.519577-1-krzysztof.kozlowski@linaro.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-10backlight: lp8788: Drop support for platform dataGravatar Uwe Kleine-König 1-143/+8
The backlight driver supports getting passed platform data. However this isn't used. This allows to remove quite some dead code from the driver because bl->pdata is always NULL, and so bl->mode is always LP8788_BL_REGISTER_ONLY. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240329133839.550065-2-u.kleine-koenig@pengutronix.de Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-10backlight: lcd: Make lcd_class constantGravatar Ricardo B. Marliere 1-10/+13
Since commit 43a7206b0963 ("driver core: class: make class_register() take a const *"), the driver core allows for struct class to be in read-only memory, so move the lcd_class structure to be declared at build time placing it into read-only memory, instead of having to be dynamically allocated at boot time. Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/2024032809-enchanted-conducive-3677@gregkh Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-10backlight: Make backlight_class constantGravatar Ricardo B. Marliere 1-13/+16
Since commit 43a7206b0963 ("driver core: class: make class_register() take a const *"), the driver core allows for struct class to be in read-only memory, so move the backlight_class structure to be declared at build time placing it into read-only memory, instead of having to be dynamically allocated at boot time. Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240305-class_cleanup-backlight-v1-1-c0e15cc25be1@marliere.net Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-10backlight: mp3309c: Fix signedness bug in mp3309c_parse_fwnode()Gravatar Dan Carpenter 1-1/+2
The "num_levels" variable is used to store error codes from device_property_count_u32() so it needs to be signed. This doesn't cause an issue at runtime because devm_kcalloc() won't allocate negative sizes. However, it's still worth fixing. Fixes: b54c828bdba9 ("backlight: mp3309c: Make use of device properties") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Tested-by: Flavio Suligoi <f.suligoi@asem.it> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/74347f67-360d-4513-8939-595e3c4764fa@moroto.mountain Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-10Merge branches 'ib-backlight-auxdisplay-staging-omap-6.9', ↵Gravatar Lee Jones 26-84/+59
'ib-backlight-auxdisplay-hid-fb-6.9' and 'ib-backlight-hid-fbdev-lcd-scripts-6.10' into ibs-for-backlight-merged
2024-05-03arch: Remove struct fb_info from video helpersGravatar Thomas Zimmermann 1-1/+1
The per-architecture video helpers do not depend on struct fb_info or anything else from fbdev. Remove it from the interface and replace fb_is_primary_device() with video_is_primary_device(). The new helper is similar in functionality, but can operate on non-fbdev devices. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com> Cc: Helge Deller <deller@gmx.de> Cc: "David S. Miller" <davem@davemloft.net> Cc: Andreas Larsson <andreas@gaisler.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: Borislav Petkov <bp@alien8.de> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: x86@kernel.org Cc: "H. Peter Anvin" <hpa@zytor.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2024-05-03fbdev: omap: lcd_ams_delta: Constify lcd_opsGravatar Krzysztof Kozlowski 1-1/+1
'struct lcd_ops' is not modified by core backlight code, so it can be made const for increased code safety. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de> Link: https://lore.kernel.org/r/20240424-video-backlight-lcd-ops-v2-18-1aaa82b07bc6@kernel.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-03fbdev: imx: Constify lcd_opsGravatar Krzysztof Kozlowski 1-1/+1
'struct lcd_ops' is not modified by core backlight code, so it can be made const for increased code safety. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Peng Fan <peng.fan@nxp.com> Link: https://lore.kernel.org/r/20240424-video-backlight-lcd-ops-v2-17-1aaa82b07bc6@kernel.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-03fbdev: clps711x: Constify lcd_opsGravatar Krzysztof Kozlowski 1-1/+1
'struct lcd_ops' is not modified by core backlight code, so it can be made const for increased code safety. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de> Link: https://lore.kernel.org/r/20240424-video-backlight-lcd-ops-v2-16-1aaa82b07bc6@kernel.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-03backlight: tdo24m: Constify lcd_opsGravatar Krzysztof Kozlowski 1-1/+1
'struct lcd_ops' is not modified by core backlight code, so it can be made const for increased code safety. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240424-video-backlight-lcd-ops-v2-14-1aaa82b07bc6@kernel.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-03backlight: platform_lcd: Constify lcd_opsGravatar Krzysztof Kozlowski 1-1/+1
'struct lcd_ops' is not modified by core backlight code, so it can be made const for increased code safety. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240424-video-backlight-lcd-ops-v2-13-1aaa82b07bc6@kernel.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-03backlight: otm3225a: Constify lcd_opsGravatar Krzysztof Kozlowski 1-1/+1
'struct lcd_ops' is not modified by core backlight code, so it can be made const for increased code safety. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240424-video-backlight-lcd-ops-v2-12-1aaa82b07bc6@kernel.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-03backlight: ltv350qv: Constify lcd_opsGravatar Krzysztof Kozlowski 1-1/+1
'struct lcd_ops' is not modified by core backlight code, so it can be made const for increased code safety. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240424-video-backlight-lcd-ops-v2-11-1aaa82b07bc6@kernel.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-03backlight: lms501kf03: Constify lcd_opsGravatar Krzysztof Kozlowski 1-1/+1
'struct lcd_ops' is not modified by core backlight code, so it can be made const for increased code safety. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240424-video-backlight-lcd-ops-v2-10-1aaa82b07bc6@kernel.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-03backlight: lms283gf05: Constify lcd_opsGravatar Krzysztof Kozlowski 1-1/+1
'struct lcd_ops' is not modified by core backlight code, so it can be made const for increased code safety. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240424-video-backlight-lcd-ops-v2-9-1aaa82b07bc6@kernel.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-03backlight: l4f00242t03: Constify lcd_opsGravatar Krzysztof Kozlowski 1-1/+1
'struct lcd_ops' is not modified by core backlight code, so it can be made const for increased code safety. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240424-video-backlight-lcd-ops-v2-8-1aaa82b07bc6@kernel.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-03backlight: jornada720_lcd: Constify lcd_opsGravatar Krzysztof Kozlowski 1-1/+1
'struct lcd_ops' is not modified by core backlight code, so it can be made const for increased code safety. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240424-video-backlight-lcd-ops-v2-7-1aaa82b07bc6@kernel.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-03backlight: ili9320: Constify lcd_opsGravatar Krzysztof Kozlowski 1-1/+1
'struct lcd_ops' is not modified by core backlight code, so it can be made const for increased code safety. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240424-video-backlight-lcd-ops-v2-6-1aaa82b07bc6@kernel.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-03backlight: ili922x: Constify lcd_opsGravatar Krzysztof Kozlowski 1-1/+1
'struct lcd_ops' is not modified by core backlight code, so it can be made const for increased code safety. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240424-video-backlight-lcd-ops-v2-5-1aaa82b07bc6@kernel.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-03backlight: hx8357: Constify lcd_opsGravatar Krzysztof Kozlowski 1-1/+1
'struct lcd_ops' is not modified by core backlight code, so it can be made const for increased code safety. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240424-video-backlight-lcd-ops-v2-4-1aaa82b07bc6@kernel.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-03backlight: corgi_lcd: Constify lcd_opsGravatar Krzysztof Kozlowski 1-1/+1
'struct lcd_ops' is not modified by core backlight code, so it can be made const for increased code safety. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240424-video-backlight-lcd-ops-v2-3-1aaa82b07bc6@kernel.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-03backlight: ams369fg06: Constify lcd_opsGravatar Krzysztof Kozlowski 1-1/+1
'struct lcd_ops' is not modified by core backlight code, so it can be made const for increased code safety. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240424-video-backlight-lcd-ops-v2-2-1aaa82b07bc6@kernel.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-03backlight: lcd: Constify lcd_opsGravatar Krzysztof Kozlowski 1-2/+2
'struct lcd_ops' passed in lcd_device_register() is not modified by core backlight code, so it can be made const for code safety. This allows drivers to also define the structure as const. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240424-video-backlight-lcd-ops-v2-1-1aaa82b07bc6@kernel.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-04-29Merge v6.9-rc6 into drm-nextGravatar Daniel Vetter 1-1/+1
Thomas needs the defio fixes, Maíra needs the vkms fixes and Joonas has some fun with i915-gem conflicts. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2024-04-25fbdev: offb: replace of_node_put with __free(device_node)Gravatar Abdulrasaq Lawani 1-2/+1
Replaced instance of of_node_put with __free(device_node) to simplify code and protect against any memory leaks due to future changes in the control flow. Suggested-by: Julia Lawall <julia.lawall@inria.fr> Signed-off-by: Abdulrasaq Lawani <abdulrasaqolawani@gmail.com> Signed-off-by: Helge Deller <deller@gmx.de>
2024-04-25fbdev: savage: Handle err return when savagefb_check_var failedGravatar Cai Xinchen 1-1/+4
The commit 04e5eac8f3ab("fbdev: savage: Error out if pixclock equals zero") checks the value of pixclock to avoid divide-by-zero error. However the function savagefb_probe doesn't handle the error return of savagefb_check_var. When pixclock is 0, it will cause divide-by-zero error. Fixes: 04e5eac8f3ab ("fbdev: savage: Error out if pixclock equals zero") Signed-off-by: Cai Xinchen <caixinchen1@huawei.com> Cc: stable@vger.kernel.org Signed-off-by: Helge Deller <deller@gmx.de>
2024-04-25video: hdmi: prefer length specifier in format over string copyingGravatar Justin Stitt 1-8/+2
strncpy() is deprecated for use on NUL-terminated destination strings [1] and as such we should prefer more robust and less ambiguous string interfaces. It looks like the main use of strncpy() here is to limit the amount of bytes printed from hdmi_log() by using a tmp buffer and limiting the number of bytes copied. Really, we should use the %.<len>s format qualifier to achieve this. Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html Link: https://github.com/KSPP/linux/issues/90 Cc: linux-hardening@vger.kernel.org Signed-off-by: Justin Stitt <justinstitt@google.com> Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Helge Deller <deller@gmx.de>
2024-04-25fbdev: uvesafb: replace deprecated strncpy with strscpy_padGravatar Justin Stitt 1-1/+1
strncpy() is deprecated for use on NUL-terminated destination strings [1] and as such we should prefer more robust and less ambiguous string interfaces. We expect v86d_path to be NUL-terminated based on its use with the C-string format specifier in printf-likes: | pr_err("failed to execute %s\n", v86d_path); and | return snprintf(buf, PAGE_SIZE, "%s\n", v86d_path); Let's also opt to pad v86d_path since it may get used in and around userspace: | return call_usermodehelper(v86d_path, argv, envp, UMH_WAIT_PROC); Considering the above, strscpy_pad() is the best replacement as it guarantees both NUL-termination and NUL-padding on the destination buffer. Note that this patch relies on the _new_ 2-argument versions of strscpy() and strscpy_pad() introduced in Commit e6584c3964f2f ("string: Allow 2-argument strscpy()"). Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html Link: https://github.com/KSPP/linux/issues/90 Cc: linux-hardening@vger.kernel.org Signed-off-by: Justin Stitt <justinstitt@google.com> Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Helge Deller <deller@gmx.de>
2024-04-25fbdev: au1200fb: replace deprecated strncpy with strscpyGravatar Justin Stitt 1-1/+1
strncpy() is deprecated for use on NUL-terminated destination strings [1] and as such we should prefer more robust and less ambiguous string interfaces. Let's use the new 2-argument strscpy() which guarantees NUL-termination on the destination buffer while also simplifying the syntax. Note that strscpy() will not NUL-pad the destination buffer like strncpy() does. However, the NUL-padding behavior of strncpy() is not required since fbdev is already NUL-allocated from au1200fb_drv_probe() -> frameuffer_alloc(), rendering any additional NUL-padding redundant. | p = kzalloc(fb_info_size + size, GFP_KERNEL); Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2] Link: https://github.com/KSPP/linux/issues/90 Cc: linux-hardening@vger.kernel.org Signed-off-by: Justin Stitt <justinstitt@google.com> Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Helge Deller <deller@gmx.de>
2024-04-25fbdev: fsl-diu-fb: replace deprecated strncpy with strscpy_padGravatar Justin Stitt 1-1/+1
strncpy() is deprecated for use on NUL-terminated destination strings [1] and as such we should prefer more robust and less ambiguous string interfaces. A better alternative is strscpy() as it guarantees NUL-termination on the destination buffer. Since we are eventually copying over to userspace, let's ensure we NUL-pad the destination buffer by using the pad variant of strscpy. - core/fb_chrdev.c: 234 | err = copy_to_user(&fix32->id, &fix->id, sizeof(fix32->id)); Furthermore, we can use the new 2-argument variants of strscpy() and strscpy_pad() introduced by Commit e6584c3964f2f ("string: Allow 2-argument strscpy()") to simplify the syntax even more. Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2] Link: https://github.com/KSPP/linux/issues/90 Cc: linux-hardening@vger.kernel.org Signed-off-by: Justin Stitt <justinstitt@google.com> Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Helge Deller <deller@gmx.de>
2024-04-24fbdev: fix incorrect address computation in deferred IOGravatar Nam Cao 1-1/+1
With deferred IO enabled, a page fault happens when data is written to the framebuffer device. Then driver determines which page is being updated by calculating the offset of the written virtual address within the virtual memory area, and uses this offset to get the updated page within the internal buffer. This page is later copied to hardware (thus the name "deferred IO"). This offset calculation is only correct if the virtual memory area is mapped to the beginning of the internal buffer. Otherwise this is wrong. For example, if users do: mmap(ptr, 4096, PROT_WRITE, MAP_FIXED | MAP_SHARED, fd, 0xff000); Then the virtual memory area will mapped at offset 0xff000 within the internal buffer. This offset 0xff000 is not accounted for, and wrong page is updated. Correct the calculation by using vmf->pgoff instead. With this change, the variable "offset" will no longer hold the exact offset value, but it is rounded down to multiples of PAGE_SIZE. But this is still correct, because this variable is only used to calculate the page offset. Reported-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com> Closes: https://lore.kernel.org/linux-fbdev/271372d6-e665-4e7f-b088-dee5f4ab341a@oracle.com Fixes: 56c134f7f1b5 ("fbdev: Track deferred-I/O pages in pageref struct") Cc: <stable@vger.kernel.org> Signed-off-by: Nam Cao <namcao@linutronix.de> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de> Tested-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Link: https://patchwork.freedesktop.org/patch/msgid/20240423115053.4490-1-namcao@linutronix.de
2024-04-10video: logo: Drop full path of the input filename in generated fileGravatar Lucas Stach 1-2/+0
Avoid this Yocto build warning to make build reproducible: WARNING: linux-foo-6.8-r0 do_package_qa: QA Issue: File /usr/src/debug/linux-foo/6.8-r0/drivers/video/logo/logo_linux_clut224.c in package linux-foo-src contains reference to TMPDIR Helge modified the patch to drop the whole line. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Helge Deller <deller@gmx.de>
2024-04-10fbdev: add HAS_IOPORT dependenciesGravatar Niklas Schnelle 1-11/+11
In a future patch HAS_IOPORT=n will disable inb()/outb() and friends at compile time. We thus need to add HAS_IOPORT as dependency for those drivers using them. Co-developed-by: Arnd Bergmann <arnd@kernel.org> Signed-off-by: Arnd Bergmann <arnd@kernel.org> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com> Signed-off-by: Helge Deller <deller@gmx.de>
2024-04-10fbdev: sh7760fb: allow modular buildGravatar Randy Dunlap 1-2/+2
There is no reason to prohibit sh7760fb from being built as a loadable module as suggested by Geert, so change the config symbol from bool to tristate to allow that and change the FB dependency as needed. Fixes: f75f71b2c418 ("fbdev/sh7760fb: Depend on FB=y") Suggested-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Cc: Thomas Zimmermann <tzimmermann@suse.de> Cc: Javier Martinez Canillas <javierm@redhat.com> Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Helge Deller <deller@gmx.de> Cc: linux-fbdev@vger.kernel.org Cc: dri-devel@lists.freedesktop.org Acked-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> Acked-by: Javier Martinez Canillas <javierm@redhat.com> Signed-off-by: Helge Deller <deller@gmx.de>
2024-04-05Merge tag 'drm-misc-next-2024-03-28' of ↵Gravatar Dave Airlie 1-0/+6
https://gitlab.freedesktop.org/drm/misc/kernel into drm-next Two misc-next in one. drm-misc-next for v6.10-rc1: The deal of a lifetime! You get ALL of the previous drm-misc-next-2024-03-21-1 tag!! But WAIT, there's MORE! Cross-subsystem Changes: - Assorted DT binding updates. Core Changes: - Clarify how optional wait_hpd_asserted is. - Shuffle Kconfig names around. Driver Changes: - Assorted build fixes for panthor, imagination, - Add AUO B120XAN01.0 panels. - Assorted small fixes to panthor, panfrost. drm-misc-next for v6.10: UAPI Changes: - Move some nouveau magic constants to uapi. Cross-subsystem Changes: - Move drm-misc to gitlab and freedesktop hosting. - Add entries for panfrost. Core Changes: - Improve placement for TTM bo's in idle/busy handling. - Improve drm/bridge init ordering. - Add CONFIG_DRM_WERROR, and use W=1 for drm. - Assorted documentation updates. - Make more (drm and driver) headers self-contained and add header guards. - Grab reservation lock in pin/unpin callbacks. - Fix reservation lock handling for vmap. - Add edp and edid panel matching, use it to fix a nearly identical panel. Driver Changes: - Add drm/panthor driver and assorted fixes. - Assorted small fixes to xlnx, panel-edp, tidss, ci, nouveau, panel and bridge drivers. - Add Samsung s6e3fa7, BOE NT116WHM-N44, CMN N116BCA-EA1, CrystalClear CMT430B19N00, Startek KD050HDFIA020-C020A, powertip PH128800T006-ZHC01 panels. - Fix console for omapdrm. Signed-off-by: Dave Airlie <airlied@redhat.com> From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/bea310a6-6ff6-477e-9363-f9f053cfd12a@linux.intel.com
2024-04-03fbdev: sisfb: hide unused variablesGravatar Arnd Bergmann 1-2/+1
Building with W=1 shows that a couple of variables in this driver are only used in certain configurations: drivers/video/fbdev/sis/init301.c:239:28: error: 'SiS_Part2CLVX_6' defined but not used [-Werror=unused-const-variable=] 239 | static const unsigned char SiS_Part2CLVX_6[] = { /* 1080i */ | ^~~~~~~~~~~~~~~ drivers/video/fbdev/sis/init301.c:230:28: error: 'SiS_Part2CLVX_5' defined but not used [-Werror=unused-const-variable=] 230 | static const unsigned char SiS_Part2CLVX_5[] = { /* 750p */ | ^~~~~~~~~~~~~~~ drivers/video/fbdev/sis/init301.c:211:28: error: 'SiS_Part2CLVX_4' defined but not used [-Werror=unused-const-variable=] 211 | static const unsigned char SiS_Part2CLVX_4[] = { /* PAL */ | ^~~~~~~~~~~~~~~ drivers/video/fbdev/sis/init301.c:192:28: error: 'SiS_Part2CLVX_3' defined but not used [-Werror=unused-const-variable=] 192 | static const unsigned char SiS_Part2CLVX_3[] = { /* NTSC, 525i, 525p */ | ^~~~~~~~~~~~~~~ drivers/video/fbdev/sis/init301.c:184:28: error: 'SiS_Part2CLVX_2' defined but not used [-Werror=unused-const-variable=] 184 | static const unsigned char SiS_Part2CLVX_2[] = { | ^~~~~~~~~~~~~~~ drivers/video/fbdev/sis/init301.c:176:28: error: 'SiS_Part2CLVX_1' defined but not used [-Werror=unused-const-variable=] 176 | static const unsigned char SiS_Part2CLVX_1[] = { | ^~~~~~~~~~~~~~~ This started showing up after the definitions were moved into the source file from the header, which was not flagged by the compiler. Move the definition into the appropriate #ifdef block that already exists next to them. Fixes: 5908986ef348 ("video: fbdev: sis: avoid mismatched prototypes") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Helge Deller <deller@gmx.de>
2024-03-28backlight: Remove fb_blank from struct backlight_propertiesGravatar Thomas Zimmermann 6-7/+0
Remove the field fb_blank from struct backlight_properties and remove all code that still sets or reads it. Backlight blank status is now tracked exclusively in struct backlight_properties.state. The core backlight code keeps the fb_blank and state fields in sync, but doesn't do anything else with fb_blank. Several drivers initialize fb_blank to FB_BLANK_UNBLANK to enable the backlight. This is already the default for the state field. So we can delete the fb_blank code from core and drivers and rely on the state field. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Cc: Flavio Suligoi <f.suligoi@asem.it> Cc: Nicolas Ferre <nicolas.ferre@microchip.com> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com> Cc: Claudiu Beznea <claudiu.beznea@tuxon.dev> Tested-by: Flavio Suligoi <f.suligoi@asem.it> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/r/20240319093915.31778-7-tzimmermann@suse.de Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-28fbdev: omap2/omapfb: Replace use of fb_blank with backlight helpersGravatar Thomas Zimmermann 2-12/+3
Replace the use of struct backlight_properties.fb_blank with backlight helpers. This effects testing if the backlight is blanked and reading the backlight's brightness level. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/r/20240319093915.31778-5-tzimmermann@suse.de Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-28backlight: omap1: Replace FB_BLANK_ states with simple on/offGravatar Thomas Zimmermann 1-25/+18
The backlight is on for fb_blank eq FB_BLANK_UNBLANK, or off for any other value in fb_blank. But the field fb_blank in struct backlight_properties is deprecated and should not be used any longer. Replace the test for fb_blank in omap's backlight code with a simple boolean parameter and push the test into the update_status helper. Instead of reading fb_blank directly, decode the backlight device's status with backlight_is_blank(). Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240319093915.31778-4-tzimmermann@suse.de Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-28backlight: omap1: Remove unused struct omap_backlight_config.set_powerGravatar Thomas Zimmermann 1-3/+0
The callback set_power in struct omap_backlight_config is not implemented anywhere. Remove it from the structure and driver. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/r/20240319093915.31778-3-tzimmermann@suse.de Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-28backlight: Add controls_device callback to struct backlight_opsGravatar Thomas Zimmermann 4-19/+19
Replace check_fb with controls_device in struct backlight_ops. The new callback interface takes a Linux device instead of a framebuffer. Resolves one of the dependencies of backlight.h on fb.h. The few drivers that had custom implementations of check_fb can easily use the framebuffer's Linux device instead. Update them accordingly. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://lore.kernel.org/r/20240305162425.23845-11-tzimmermann@suse.de Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-28fbdev: ssd1307fb: Remove struct backlight_ops.check_fbGravatar Thomas Zimmermann 1-7/+0
The driver sets struct fb_info.bl_dev to the correct backlight device. Thus rely on the backlight core code to match backlight and framebuffer devices, and remove the extra check_fb function from struct backlight_ops. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://lore.kernel.org/r/20240305162425.23845-10-tzimmermann@suse.de Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-28fbdev: ssd1307fb: Init backlight before registering framebufferGravatar Thomas Zimmermann 1-13/+11
For drivers that support backlight, LCD and fbdev devices, fbdev has to be initialized last. See documentation for struct fbinfo.bl_dev. The backlight name's index number comes from register_framebuffer(), which now happens after initializing the backlight device. So like in all other backlight drivers, we now give the backlight device a generic name without the fbdev index. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://lore.kernel.org/r/20240305162425.23845-9-tzimmermann@suse.de Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-28fbdev: sh_mobile_lcdc_fb: Remove struct backlight_ops.check_fbGravatar Thomas Zimmermann 1-7/+0
The driver sets struct fb_info.bl_dev to the correct backlight device. Thus rely on the backlight core code to match backlight and framebuffer devices, and remove the extra check_fb function from struct backlight_ops. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://lore.kernel.org/r/20240305162425.23845-8-tzimmermann@suse.de Signed-off-by: Lee Jones <lee@kernel.org>