aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/udl
Commit message (Collapse)AuthorAgeFilesLines
* drm/udl: Set error code in udl_init()Dan Carpenter2025-04-171-0/+1
| | | | | | | | | | Return -ENOMEM if udl_alloc_urb_list() fails. Don't return success. Fixes: fb10144ba426 ("drm/udl: Support adapters without firmware descriptor") Signed-off-by: Dan Carpenter <[email protected]> Reviewed-by: Thomas Zimmermann <[email protected]> Signed-off-by: Thomas Zimmermann <[email protected]> Link: https://lore.kernel.org/r/[email protected]
* drm/udl: Support adapters without firmware descriptorThomas Zimmermann2025-04-141-16/+21
| | | | | | | | | | | | | | | | | Set default limit on the number of pixels for adapters without vendor firmware descriptor. The devices work as expected, they just don't provide any description. If parsing the vendor firmware descriptor fails, the device falls back to the given default limits. Failing to allocate memory is still an error. v2: - fix typo in constant (Patrik) Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Patrik Jakobsson <[email protected]> Link: https://lore.kernel.org/r/[email protected]
* drm/udl: Validate length in vendor-descriptor parserThomas Zimmermann2025-04-141-26/+51
| | | | | | | | | | | | | | | | | | | | | | | | | Rewrite the parser for the vendor firmware descriptor with the following improvements. - Validate the key-value length given in a vendor descriptor against the length of the descriptor. The current code fails to do this and might read more bytes than available. This can lead to out-of-bounds reads of the allocated buffer. - Read raw data with helpers for unaligned data. This allows the code to run on platforms that do now support unaligned memory access by default. - Validate the pixel limit against a default value. The default comes from real-world devices. If the reported number of pixels is significantly above the limit, it is likely invalid. - Drop the obsolete print macros. There is still a warning about invalid firmware descriptors. The rest of the output is bogus. Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Patrik Jakobsson <[email protected]> Link: https://lore.kernel.org/r/[email protected]
* drm/udl: Treat vendor descriptor as u8Thomas Zimmermann2025-04-141-8/+8
| | | | | | | | | The vendor descriptor is an array of unsigned bytes. It is raw data that is not to be modified. Declare it as 'const u8'. Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Patrik Jakobsson <[email protected]> Link: https://lore.kernel.org/r/[email protected]
* drm/udl: Return error if vendor descriptor is too shortThomas Zimmermann2025-04-141-31/+31
| | | | | | | | | | | | | | | | | | There need to be least 5 bytes in the vendor descriptor. Return an error otherwise. Also change the branching to early-out on the error. Adjust indention of the rest of the parser function. The original length test expected more than 5 bytes in the vendor descriptor. As a descriptor with no key-value pairs has exactly 5 bytes and is still valid, change the test to accept this case as well. v2 - clarify changes to length test in commit description (Patrik) Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Patrik Jakobsson <[email protected]> Link: https://lore.kernel.org/r/[email protected]
* drm/udl: Handle errors from usb_get_descriptor()Thomas Zimmermann2025-04-141-10/+14
| | | | | | | | | | | Reading the vendor descriptor from the udl device can fail with an error, which the current code fails to capture. Store the return value in an integer and test for the error. Abort parsing on errors or treat the value as length on success. Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Patrik Jakobsson <[email protected]> Link: https://lore.kernel.org/r/[email protected]
* drm/udl: The number of pixels is always positiveThomas Zimmermann2025-04-141-2/+2
| | | | | | | | | Store sku_pixel_limit as type unsigned long instead of int. The number of pixels available is always positive. Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Patrik Jakobsson <[email protected]> Link: https://lore.kernel.org/r/[email protected]
* drm/udl: Improve type safety when using struct udl_deviceThomas Zimmermann2025-04-145-36/+37
| | | | | | | | | | Push upcasts from struct drm_device to struct udl_device outwards in the call chain; cast earlier and call functions with the upcasted value. Improves type safety. Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Patrik Jakobsson <[email protected]> Link: https://lore.kernel.org/r/[email protected]
* drm/udl: Remove unused field gem_lock from struct udl_deviceThomas Zimmermann2025-04-142-4/+0
| | | | | | | | | Reduce the size of struct udl_device by removing the unused field gem_lock. Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Patrik Jakobsson <[email protected]> Link: https://lore.kernel.org/r/[email protected]
* drm/udl: Remove unused field dev from struct udl_deviceThomas Zimmermann2025-04-141-1/+0
| | | | | | | | | Reduce the size of struct udl_device by removing the unused field dev. Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Patrik Jakobsson <[email protected]> Link: https://lore.kernel.org/r/[email protected]
* drm/udl: Switch poll helpers to managed cleanupThomas Zimmermann2025-03-243-3/+1
| | | | | | | | | Call drmm_kms_helper_poll_init() to set up managed cleanup for connector polling. Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Patrik Jakobsson <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
* drm/udl: Unregister device before cleaning up on disconnectThomas Zimmermann2025-03-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Disconnecting a DisplayLink device results in the following kernel error messages [ 93.041748] [drm:udl_urb_completion [udl]] *ERROR* udl_urb_completion - nonzero write bulk status received: -115 [ 93.055299] [drm:udl_submit_urb [udl]] *ERROR* usb_submit_urb error fffffffe [ 93.065363] [drm:udl_urb_completion [udl]] *ERROR* udl_urb_completion - nonzero write bulk status received: -115 [ 93.078207] [drm:udl_submit_urb [udl]] *ERROR* usb_submit_urb error fffffffe coming from KMS poll helpers. Shutting down poll helpers runs them one final time when the USB device is already gone. Run drm_dev_unplug() first in udl's USB disconnect handler. Udl's polling code already handles disconnects gracefully if the device has been marked as unplugged. Signed-off-by: Thomas Zimmermann <[email protected]> Fixes: b1a981bd5576 ("drm/udl: drop drm_driver.release hook") Cc: [email protected] Cc: <[email protected]> # v5.8+ Reviewed-by: Patrik Jakobsson <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
* drm/udl: Set struct drm_device.dma_devThomas Zimmermann2025-03-123-25/+7
| | | | | | | | | Set the dma_dev field provided by the DRM device. Required for PRIME dma-buf import. Remove the driver's implementation. Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Jani Nikula <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
* drm: remove driver date from struct drm_driver and all driversJani Nikula2024-12-052-2/+0
| | | | | | | | | | | | | | | | | | | | | | We stopped using the driver initialized date in commit 7fb8af6798e8 ("drm: deprecate driver date") and (eventually) started returning "0" for drm_version ioctl instead. Finish the job, and remove the unused date member from struct drm_driver, its initialization from drivers, along with the common DRIVER_DATE macros. v2: Also update drivers/accel (kernel test robot) Reviewed-by: Javier Martinez Canillas <[email protected]> Acked-by: Alex Deucher <[email protected]> Acked-by: Simon Ser <[email protected]> Acked-by: Jeffrey Hugo <[email protected]> Acked-by: Lucas De Marchi <[email protected]> Acked-by: Dmitry Baryshkov <[email protected]> # msm Reviewed-by: Thomas Zimmermann <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/1f2bf2543aed270a06f6c707fd6ed1b78bf16712.1733322525.git.jani.nikula@intel.com Signed-off-by: Jani Nikula <[email protected]>
* drm/client: Move public client header to clients/ subdirectoryThomas Zimmermann2024-11-151-1/+1
| | | | | | | | | Move the public header file drm_client_setup.h to the clients/ subdirectory and update all drivers. No functional changes. Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Jocelyn Falempe <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
* Merge tag 'drm-misc-next-2024-09-26' of ↵Dave Airlie2024-10-092-1/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://gitlab.freedesktop.org/drm/misc/kernel into drm-next drm-misc-next for v6.13: UAPI Changes: - panthor: Add realtime group priority and priority query. Cross-subsystem Changes: - Add Vivek Kasireddy as udmabuf maintainer. - Assorted udmabuf changes. - Device tree binding updates. - dmabuf documentation fixes. - Move drm_rect to drm core module from kms helper. Core Changes: - Update scheduler documentation and concurrency fixes. - drm/ci updates. - Add memory-agnostic fbdev client and client-agnostic setup helper. - Huge driver conversion for using the above. Driver Changes: - Assorted fixes to imx, panel/nt35510, sti, accel/ivpu, v3d, vkms, host1x. - Add panel quirks for AYA NEO panels. - Make module autoloading work for bridge/it6505 and mcde. - Add huge page support to v3d using a custom shmfs. Signed-off-by: Dave Airlie <[email protected]> From: Maarten Lankhorst <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
| * drm/udl: Run DRM default client setupThomas Zimmermann2024-09-262-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Call drm_client_setup() to run the kernel's default client setup for DRM. Set fbdev_probe in struct drm_driver, so that the client setup can start the common fbdev client. v5: - select DRM_CLIENT_SELECTION Signed-off-by: Thomas Zimmermann <[email protected]> Cc: Dave Airlie <[email protected]> Cc: Sean Paul <[email protected]> Cc: Thomas Zimmermann <[email protected]> Acked-by: Javier Martinez Canillas <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
* | move asm/unaligned.h to linux/unaligned.hAl Viro2024-10-021-1/+1
|/ | | | | | | | | | | | | | | | | | | asm/unaligned.h is always an include of asm-generic/unaligned.h; might as well move that thing to linux/unaligned.h and include that - there's nothing arch-specific in that header. auto-generated by the following: for i in `git grep -l -w asm/unaligned.h`; do sed -i -e "s/asm\/unaligned.h/linux\/unaligned.h/" $i done for i in `git grep -l -w asm-generic/unaligned.h`; do sed -i -e "s/asm-generic\/unaligned.h/linux\/unaligned.h/" $i done git mv include/asm-generic/unaligned.h include/linux/unaligned.h git mv tools/include/asm-generic/unaligned.h tools/include/linux/unaligned.h sed -i -e "/unaligned.h/d" include/asm-generic/Kbuild sed -i -e "s/__ASM_GENERIC/__LINUX/" include/linux/unaligned.h tools/include/linux/unaligned.h
* drm: use mem_is_zero() instead of !memchr_inv(s, 0, n)Jani Nikula2024-08-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Use the mem_is_zero() helper where possible. Conversion done using cocci: | @@ | expression PTR; | expression SIZE; | @@ | | <... | ( | - memchr_inv(PTR, 0, SIZE) == NULL | + mem_is_zero(PTR, SIZE) | | | - !memchr_inv(PTR, 0, SIZE) | + mem_is_zero(PTR, SIZE) | | | - memchr_inv(PTR, 0, SIZE) | + !mem_is_zero(PTR, SIZE) | ) | ...> Reviewed-by: Kees Cook <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Jani Nikula <[email protected]>
* drm: add missing MODULE_DESCRIPTION() macrosJeff Johnson2024-06-101-0/+1
| | | | | | | | | | | | | | | | | | | | | | On x86, make allmodconfig && make W=1 C=1 reports: WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/gpu/drm/gud/gud.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/gpu/drm/drm_panel_orientation_quirks.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/gpu/drm/drm_mipi_dbi.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/gpu/drm/i915/kvmgt.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/gpu/drm/udl/udl.o Add the missing invocation of the MODULE_DESCRIPTION() macro to all files which have a MODULE_LICENSE(). For consistency this includes drivers/gpu/drm/drm_simple_kms_helper.c since it contains a MODULE_LICENSE() even though it isn't built as a separate module -- it is always built as part of drm_kms_helper and drm_kms_helper_common.c already provides a MODULE_DESCRIPTION for that module. Signed-off-by: Jeff Johnson <[email protected]> Signed-off-by: Maxime Ripard <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
* drm/udl: Remove struct udl_connectorThomas Zimmermann2024-05-132-48/+11
| | | | | | | | | | | | | Udl's struct udl_connector is an empty wrapper around struct drm_connector. Remove it. Allocate the connector as part of struct udl_device and inline the init function into its only caller. v2: - fix return value in udl_modeset_init() (Dan) Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Jani Nikula <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
* drm/udl: Untangle .get_modes() and .detect_ctx()Thomas Zimmermann2024-05-135-73/+115
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Provide separate implementations of .get_modes() and .detect_ctx() from struct drm_connector. Switch to struct drm_edid. Udl's .detect() helper used to fetch the EDID from the adapter and the .get_modes() helper provided display modes from the data. But this relied on the DRM helpers to call the functions in the correct order. When no EDID could be retrieved, .detect() regularly printed a warning to the kernel log. Switching to the new helpers around struct drm_edid separates both from each other. The .get_modes() helper now fetches the EDID by itself and the .detect_ctx() helper only tests for its presence. The patch does a number of things to implement this. - Move udl_get_edid_block() to udl_edid.c and rename it to udl_read_edid_block(). Then use the helper to implement probing in udl_probe_edid() and reading in udl_edid_read(). The latter helper is build on top of DRM helpers. - Replace the existing code in .get_modes() and .detect() with udl's new EDID helpers. The new code behaves like DRM's similar DDC-based helpers. Instead of .detect(), udl now implements .detect_ctx(). - Remove the edid data from struct udl_connector. The field cached the EDID data between calls to .detect() and .get_modes(), but is now unused. v3: - implement udl_probe_edid() with memchr_inv() (Jani) v2: - implement udl_probe_edid() within udl - reword commit description Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Jani Nikula <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
* drm/udl: Clean up MakefileThomas Zimmermann2024-05-131-1/+6
| | | | | | | | | Clean up Makefile before listing new object files. No functional changes. Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Jani Nikula <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
* drm/udl: Move drm_dev_{enter, exit}() into udl_get_edid_block()Thomas Zimmermann2024-05-131-9/+11
| | | | | | | | | | | | | | | | Protect the code in udl_get_edid_block() with drm_dev_enter() and drm_dev_exit(), so that all callers automatically invoke it. The function uses hardware resources, which can be hot-unplugged at any time. The other code in udl_connector_detect() does not use the resources of the hardware device and therefore does not require protection. This change will allow to use udl_get_edid_block() in various contexts easily. Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Jani Nikula <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
* drm/udl: Remove DRM_CONNECTOR_POLL_HPDThomas Zimmermann2024-05-131-2/+1
| | | | | | | | | | | | | | | | | | DisplayLink devices do not generate hotplug events. Remove the poll flag DRM_CONNECTOR_POLL_HPD, as it may not be specified together with DRM_CONNECTOR_POLL_CONNECT or DRM_CONNECTOR_POLL_DISCONNECT. Signed-off-by: Thomas Zimmermann <[email protected]> Fixes: afdfc4c6f55f ("drm/udl: Fixed problem with UDL adpater reconnection") Reviewed-by: Jani Nikula <[email protected]> Cc: Robert Tarasov <[email protected]> Cc: Alex Deucher <[email protected]> Cc: Dave Airlie <[email protected]> Cc: Sean Paul <[email protected]> Cc: Thomas Zimmermann <[email protected]> Cc: [email protected] Cc: <[email protected]> # v4.15+ Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
* drm/udl: Use fbdev-shmemThomas Zimmermann2024-05-021-2/+2
| | | | | | | | | | | | Implement fbdev emulation with fbdev-shmem. Avoids the overhead of fbdev-generic's additional shadow buffering. No functional changes. Signed-off-by: Thomas Zimmermann <[email protected]> Cc: Dave Airlie <[email protected]> Cc: Sean Paul <[email protected]> Cc: Thomas Zimmermann <[email protected]> Reviewed-by: Javier Martinez Canillas <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
* drm/plane-helper: Move drm_plane_helper_atomic_check() into udlThomas Zimmermann2023-12-061-2/+17
| | | | | | | | | | | | | The udl driver is the only caller of drm_plane_helper_atomic_check(). Move the function into the driver. No functional changes. v2: * fix documenation (Sui) Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Acked-by: Sui Jingfeng <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
* drm/udl: Convert to drm_crtc_helper_atomic_check()Geert Uytterhoeven2023-07-291-11/+2
| | | | | | | | | | | Use the drm_crtc_helper_atomic_check() helper instead of open-coding the same operation. Signed-off-by: Geert Uytterhoeven <[email protected]> Reviewed-by: Thomas Zimmermann <[email protected]> Reviewed-by: Sui Jingfeng <[email protected]> Signed-off-by: Javier Martinez Canillas <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/dcb09c0c7bed1baee39a72caba098a399ce7f063.1689599767.git.geert+renesas@glider.be
* drm/udl: delete dead codeDan Carpenter2023-05-031-1/+1
| | | | | | | | | | | | | | | | | | | The "unode" pointer cannot be NULL here and checking for it causes Smatch warnings: drivers/gpu/drm/udl/udl_main.c:259 udl_get_urb_locked() warn: can 'unode' even be NULL? Fortunately, it's just harmless dead code which can be removed. It's left over from commit c5c354a3a472 ("drm/udl: Fix inconsistent urbs.count value during udl_free_urb_list()"). Reported-by: kernel test robot <[email protected]> Signed-off-by: Dan Carpenter <[email protected]> Reviewed-by: Thomas Zimmermann <[email protected]> Reviewed-by: Takashi Iwai <[email protected]> Signed-off-by: Thomas Zimmermann <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
* drm/udl: Remove unnecessary include statements for drm_crtc_helper.hThomas Zimmermann2023-01-182-2/+1
| | | | | | | | | | | | | | | Several source files include drm_crtc_helper.h without needing it or only to get its transitive include statements; leading to unnecessary compile-time dependencies. Directly include required headers and drop drm_crtc_helper.h where possible. Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Sam Ravnborg <[email protected]> Acked-by: Jani Nikula <[email protected]> Acked-by: Alex Deucher <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
* drm/fb-helper: Move generic fbdev emulation into separate source fileThomas Zimmermann2022-11-051-1/+1
| | | | | | | | | | | | | | | | Move the generic fbdev implementation into its own source and header file. Adapt drivers. No functional changes, but some of the internal helpers have been renamed to fit into the drm_fbdev_ naming scheme. v3: * rename drm_fbdev.{c,h} to drm_fbdev_generic.{c,h} * rebase onto vmwgfx changes * rebase onto xlnx changes * fix include statements in amdgpu Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Javier Martinez Canillas <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
* drm/atomic-helper: Replace drm_atomic_helper_check_crtc_state()Thomas Zimmermann2022-10-081-1/+4
| | | | | | | | | | | | | | | | | Rename the atomic helper function drm_atomic_helper_check_crtc_state() to drm_atomic_helper_check_crtc_primary_plane() and only check for an attached primary plane. Adapt callers. Instead of having one big function to check for various CRTC state conditions, we rather want smaller functions that drivers can pick individually. v5: * rebase on top of udl changes Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Javier Martinez Canillas <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
* drm/udl: Add constants for commandsThomas Zimmermann2022-10-074-20/+28
| | | | | | | | | | Add constants for the various commands that the driver can send to the device and update the respective helper functions. No functional changes. Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Javier Martinez Canillas <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
* drm/udl: Add register constants for framebuffer scanout addressesThomas Zimmermann2022-10-072-9/+38
| | | | | | | | | | | | | Add register constants for the framebuffer scanout addresses and update the related helper functions. No functional changes. v2: * extract address bytes with helper macros (Javier) * fix comments Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Javier Martinez Canillas <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
* drm/udl: Add register constants for video locksThomas Zimmermann2022-10-072-2/+7
| | | | | | | | Add register constants for the video lock. No functional changes. Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Javier Martinez Canillas <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
* drm/udl: Add register constants for color depthThomas Zimmermann2022-10-072-1/+4
| | | | | | | | | Add the register constants for setting the color depth. The driver only uses 16bpp. No functional changes. Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Javier Martinez Canillas <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
* drm/udl: Add constants for display-mode registersThomas Zimmermann2022-10-072-69/+46
| | | | | | | | | | Add constants for the registers the contain various display-mode parameters and update the mode-setting function. No functional changes. Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Javier Martinez Canillas <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
* drm/udl: Move register constants to udl_proto.hThomas Zimmermann2022-10-073-15/+21
| | | | | | | | | Move the existing register constants to a new file in preparation of adding more of them. Renaming is intentional. No functional changes. Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Javier Martinez Canillas <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
* drm/udl: Use damage iteratorThomas Zimmermann2022-10-071-21/+21
| | | | | | | | | | | | | | | | | | | Use a damage iterator to process damage areas individually. Merging damage areas can result in large updates of unchanged framebuffer regions. As USB is rather slow, it's better to process damage areas individually and hence minimize USB-transfered data. As part of the change, move drm_gem_fb_{begin,end}_cpu_access() into the plane's atomic_update helper. To avoid overhead and intermediate writers, we want to synchronize buffers and reserve access only once before copying damage areas of the framebuffer. v2: * clarify commit message (Javier) Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Javier Martinez Canillas <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
* drm/udl: Support DRM hot-unpluggingThomas Zimmermann2022-10-071-6/+37
| | | | | | | | | | | Add drm_dev_enter() and drm_dev_exit() to the various modesetting functions that interact with the device. After hot-unplugging the device, these functions will return early. So far, the udl driver relied on USB interfaces to handle unplugging of the device. Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Javier Martinez Canillas <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
* drm/udl: Simplify modesetting in CRTC's enable functionThomas Zimmermann2022-10-072-50/+14
| | | | | | | | | | Inline a modesetting helper in the CRTC's enable function. Build the command set directly in the USB URB's buffer and drop an intermediate buffer. No functional changes. Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Javier Martinez Canillas <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
* drm/udl: Convert to atomic-modesetting helpersThomas Zimmermann2022-10-072-54/+112
| | | | | | | | | | | | | | | | | Replace simple-KMS helpers with regular atomic-modesetting helpers. The simple-KMS helpers introduce a mid-layer abstraction without added functionality. Using regular atomic helpers makes the driver's implementation more discoverable and simplifies code sharing. The conversion effectively open-codes the simple-KMS functions and data structure within udl. No functional changes. v2: * don't use the atomic_disable plane helper Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Javier Martinez Canillas <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
* drm/udl: Remove udl_simple_display_pipe_mode_valid()Thomas Zimmermann2022-10-071-8/+0
| | | | | | | | | Remove the empty function udl_simple_display_pipe_mode_valid() and let simple-KMS helpers accept the modes. No functional changes. Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Javier Martinez Canillas <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
* drm/udl: Move connector to modesetting codeThomas Zimmermann2022-10-075-154/+134
| | | | | | | | | Move the connector next to the rest of the modesetting code. No functional changes. Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Javier Martinez Canillas <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
* drm/udl: Various improvements to the connectorThomas Zimmermann2022-10-071-24/+40
| | | | | | | | | | Add style fixes, better error handling and reporting, and minor clean-up changes to the connector code before moving the code to the rest of the modesetting pipeline. Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Javier Martinez Canillas <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
* drm/udl: Use USB timeout constant when reading EDIDThomas Zimmermann2022-10-071-1/+1
| | | | | | | | | | Set the USB control-message timeout to the USB default of 5 seconds. Done for consistency with other uses of usb_control_msg() in udl and other drivers. Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Javier Martinez Canillas <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
* drm/udl: Test pixel limit in mode-config's mode-valid functionThomas Zimmermann2022-10-072-14/+14
| | | | | | | | | | The sku_pixel_limit is a per-device property, similar to the amount of available video memory. Move the respective mode-valid test from the connector to the mode-config structure. Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Javier Martinez Canillas <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
* drm/udl: Rename struct udl_drm_connector to struct udl_connectorThomas Zimmermann2022-10-072-16/+13
| | | | | | | | | Remove the _drm_ infix from struct udl_drm_connector and introduce a macro for upcasting from struct drm_connector. No functional changes. Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Javier Martinez Canillas <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
* drm/udl: Sync pending URBs at the end of suspendTakashi Iwai2022-09-104-8/+10
| | | | | | | | | | | | | | | It's better to perform the sync at the very last of the suspend instead of the pipe-disable function, so that we can catch all pending URBs (if any). While we're at it, drop the error code from udl_sync_pending_urb() since we basically ignore it; instead, give a clear error message indicating a problem. Acked-by: Thomas Zimmermann <[email protected]> Signed-off-by: Takashi Iwai <[email protected]> Signed-off-by: Thomas Zimmermann <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
* drm/udl: Don't re-initialize stuff at retrying the URB list allocationTakashi Iwai2022-09-101-4/+3
| | | | | | | | | | | | udl_alloc_urb_list() retires the allocation if there is no enough room left, and it reinitializes the stuff unnecessarily such as the linked list head and the waitqueue, which could be harmful. Those should be outside the retry loop. Acked-by: Thomas Zimmermann <[email protected]> Signed-off-by: Takashi Iwai <[email protected]> Signed-off-by: Thomas Zimmermann <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]