mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-24 00:10:10 +07:00
fcd70cd36b
Having the probe helper stuff (which pretty much everyone needs) in the drm_crtc_helper.h file (which atomic drivers should never need) is confusing. Split them out. To make sure I actually achieved the goal here I went through all drivers. And indeed, all atomic drivers are now free of drm_crtc_helper.h includes. v2: Make it compile. There was so much compile fail on arm drivers that I figured I'll better not include any of the acks on v1. v3: Massive rebase because i915 has lost a lot of drmP.h includes, but not all: Through drm_crtc_helper.h > drm_modeset_helper.h -> drmP.h there was still one, which this patch largely removes. Which means rolling out lots more includes all over. This will also conflict with ongoing drmP.h cleanup by others I expect. v3: Rebase on top of atomic bochs. v4: Review from Laurent for bridge/rcar/omap/shmob/core bits: - (re)move some of the added includes, use the better include files in other places (all suggested from Laurent adopted unchanged). - sort alphabetically v5: Actually try to sort them, and while at it, sort all the ones I touch. v6: Rebase onto i915 changes. v7: Rebase once more. Acked-by: Harry Wentland <harry.wentland@amd.com> Acked-by: Sam Ravnborg <sam@ravnborg.org> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Jani Nikula <jani.nikula@linux.intel.com> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Acked-by: Benjamin Gaignard <benjamin.gaignard@linaro.org> Acked-by: Jani Nikula <jani.nikula@intel.com> Acked-by: Neil Armstrong <narmstrong@baylibre.com> Acked-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com> Acked-by: CK Hu <ck.hu@mediatek.com> Acked-by: Alex Deucher <alexander.deucher@amd.com> Acked-by: Sam Ravnborg <sam@ravnborg.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Liviu Dudau <liviu.dudau@arm.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: linux-arm-kernel@lists.infradead.org Cc: virtualization@lists.linux-foundation.org Cc: etnaviv@lists.freedesktop.org Cc: linux-samsung-soc@vger.kernel.org Cc: intel-gfx@lists.freedesktop.org Cc: linux-mediatek@lists.infradead.org Cc: linux-amlogic@lists.infradead.org Cc: linux-arm-msm@vger.kernel.org Cc: freedreno@lists.freedesktop.org Cc: nouveau@lists.freedesktop.org Cc: spice-devel@lists.freedesktop.org Cc: amd-gfx@lists.freedesktop.org Cc: linux-renesas-soc@vger.kernel.org Cc: linux-rockchip@lists.infradead.org Cc: linux-stm32@st-md-mailman.stormreply.com Cc: linux-tegra@vger.kernel.org Cc: xen-devel@lists.xen.org Link: https://patchwork.freedesktop.org/patch/msgid/20190117210334.13234-1-daniel.vetter@ffwll.ch
141 lines
3.5 KiB
C
141 lines
3.5 KiB
C
/*
|
|
* Copyright (C) 2012 Red Hat
|
|
*
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
* License v2. See the file COPYING in the main directory of this archive for
|
|
* more details.
|
|
*/
|
|
|
|
#include <linux/module.h>
|
|
#include <drm/drmP.h>
|
|
#include <drm/drm_crtc_helper.h>
|
|
#include <drm/drm_probe_helper.h>
|
|
#include "udl_drv.h"
|
|
|
|
static int udl_usb_suspend(struct usb_interface *interface,
|
|
pm_message_t message)
|
|
{
|
|
struct drm_device *dev = usb_get_intfdata(interface);
|
|
|
|
drm_kms_helper_poll_disable(dev);
|
|
return 0;
|
|
}
|
|
|
|
static int udl_usb_resume(struct usb_interface *interface)
|
|
{
|
|
struct drm_device *dev = usb_get_intfdata(interface);
|
|
|
|
drm_kms_helper_poll_enable(dev);
|
|
udl_modeset_restore(dev);
|
|
return 0;
|
|
}
|
|
|
|
static const struct vm_operations_struct udl_gem_vm_ops = {
|
|
.fault = udl_gem_fault,
|
|
.open = drm_gem_vm_open,
|
|
.close = drm_gem_vm_close,
|
|
};
|
|
|
|
static const struct file_operations udl_driver_fops = {
|
|
.owner = THIS_MODULE,
|
|
.open = drm_open,
|
|
.mmap = udl_drm_gem_mmap,
|
|
.poll = drm_poll,
|
|
.read = drm_read,
|
|
.unlocked_ioctl = drm_ioctl,
|
|
.release = drm_release,
|
|
.compat_ioctl = drm_compat_ioctl,
|
|
.llseek = noop_llseek,
|
|
};
|
|
|
|
static struct drm_driver driver = {
|
|
.driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME,
|
|
.load = udl_driver_load,
|
|
.unload = udl_driver_unload,
|
|
|
|
/* gem hooks */
|
|
.gem_free_object_unlocked = udl_gem_free_object,
|
|
.gem_vm_ops = &udl_gem_vm_ops,
|
|
|
|
.dumb_create = udl_dumb_create,
|
|
.dumb_map_offset = udl_gem_mmap,
|
|
.fops = &udl_driver_fops,
|
|
|
|
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
|
|
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
|
|
.gem_prime_export = udl_gem_prime_export,
|
|
.gem_prime_import = udl_gem_prime_import,
|
|
|
|
.name = DRIVER_NAME,
|
|
.desc = DRIVER_DESC,
|
|
.date = DRIVER_DATE,
|
|
.major = DRIVER_MAJOR,
|
|
.minor = DRIVER_MINOR,
|
|
.patchlevel = DRIVER_PATCHLEVEL,
|
|
};
|
|
|
|
static int udl_usb_probe(struct usb_interface *interface,
|
|
const struct usb_device_id *id)
|
|
{
|
|
struct usb_device *udev = interface_to_usbdev(interface);
|
|
struct drm_device *dev;
|
|
int r;
|
|
|
|
dev = drm_dev_alloc(&driver, &interface->dev);
|
|
if (IS_ERR(dev))
|
|
return PTR_ERR(dev);
|
|
|
|
r = drm_dev_register(dev, (unsigned long)udev);
|
|
if (r)
|
|
goto err_free;
|
|
|
|
usb_set_intfdata(interface, dev);
|
|
DRM_INFO("Initialized udl on minor %d\n", dev->primary->index);
|
|
|
|
return 0;
|
|
|
|
err_free:
|
|
drm_dev_put(dev);
|
|
return r;
|
|
}
|
|
|
|
static void udl_usb_disconnect(struct usb_interface *interface)
|
|
{
|
|
struct drm_device *dev = usb_get_intfdata(interface);
|
|
|
|
drm_kms_helper_poll_disable(dev);
|
|
udl_fbdev_unplug(dev);
|
|
udl_drop_usb(dev);
|
|
drm_dev_unplug(dev);
|
|
}
|
|
|
|
/*
|
|
* There are many DisplayLink-based graphics products, all with unique PIDs.
|
|
* So we match on DisplayLink's VID + Vendor-Defined Interface Class (0xff)
|
|
* We also require a match on SubClass (0x00) and Protocol (0x00),
|
|
* which is compatible with all known USB 2.0 era graphics chips and firmware,
|
|
* but allows DisplayLink to increment those for any future incompatible chips
|
|
*/
|
|
static const struct usb_device_id id_table[] = {
|
|
{.idVendor = 0x17e9, .bInterfaceClass = 0xff,
|
|
.bInterfaceSubClass = 0x00,
|
|
.bInterfaceProtocol = 0x00,
|
|
.match_flags = USB_DEVICE_ID_MATCH_VENDOR |
|
|
USB_DEVICE_ID_MATCH_INT_CLASS |
|
|
USB_DEVICE_ID_MATCH_INT_SUBCLASS |
|
|
USB_DEVICE_ID_MATCH_INT_PROTOCOL,},
|
|
{},
|
|
};
|
|
MODULE_DEVICE_TABLE(usb, id_table);
|
|
|
|
static struct usb_driver udl_driver = {
|
|
.name = "udl",
|
|
.probe = udl_usb_probe,
|
|
.disconnect = udl_usb_disconnect,
|
|
.suspend = udl_usb_suspend,
|
|
.resume = udl_usb_resume,
|
|
.id_table = id_table,
|
|
};
|
|
module_usb_driver(udl_driver);
|
|
MODULE_LICENSE("GPL");
|