2019-05-29 21:12:36 +07:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2010-12-15 04:14:24 +07:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2012 Red Hat
|
|
|
|
*
|
|
|
|
* based in parts on udlfb.c:
|
|
|
|
* Copyright (C) 2009 Roberto De Ioris <roberto@unbit.it>
|
|
|
|
* Copyright (C) 2009 Jaya Kumar <jayakumar.lkml@gmail.com>
|
|
|
|
* Copyright (C) 2009 Bernie Thompson <bernie@plugable.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef UDL_DRV_H
|
|
|
|
#define UDL_DRV_H
|
|
|
|
|
2019-07-16 13:42:09 +07:00
|
|
|
#include <linux/mm_types.h>
|
2010-12-15 04:14:24 +07:00
|
|
|
#include <linux/usb.h>
|
2019-07-16 13:42:09 +07:00
|
|
|
|
|
|
|
#include <drm/drm_device.h>
|
|
|
|
#include <drm/drm_framebuffer.h>
|
2014-09-23 20:46:53 +07:00
|
|
|
#include <drm/drm_gem.h>
|
2019-12-10 15:48:58 +07:00
|
|
|
#include <drm/drm_simple_kms_helper.h>
|
2019-07-16 13:42:09 +07:00
|
|
|
|
|
|
|
struct drm_mode_create_dumb;
|
2010-12-15 04:14:24 +07:00
|
|
|
|
|
|
|
#define DRIVER_NAME "udl"
|
|
|
|
#define DRIVER_DESC "DisplayLink"
|
|
|
|
#define DRIVER_DATE "20120220"
|
|
|
|
|
|
|
|
#define DRIVER_MAJOR 0
|
|
|
|
#define DRIVER_MINOR 0
|
|
|
|
#define DRIVER_PATCHLEVEL 1
|
|
|
|
|
|
|
|
struct udl_device;
|
|
|
|
|
|
|
|
struct urb_node {
|
|
|
|
struct list_head entry;
|
|
|
|
struct udl_device *dev;
|
|
|
|
struct delayed_work release_urb_work;
|
|
|
|
struct urb *urb;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct urb_list {
|
|
|
|
struct list_head list;
|
|
|
|
spinlock_t lock;
|
|
|
|
struct semaphore limit_sem;
|
|
|
|
int available;
|
|
|
|
int count;
|
|
|
|
size_t size;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct udl_device {
|
2019-04-05 10:17:15 +07:00
|
|
|
struct drm_device drm;
|
2010-12-15 04:14:24 +07:00
|
|
|
struct device *dev;
|
2014-08-29 17:12:45 +07:00
|
|
|
struct usb_device *udev;
|
2019-12-10 15:48:58 +07:00
|
|
|
|
|
|
|
struct drm_simple_display_pipe display_pipe;
|
2010-12-15 04:14:24 +07:00
|
|
|
|
2018-03-27 15:23:54 +07:00
|
|
|
struct mutex gem_lock;
|
|
|
|
|
2010-12-15 04:14:24 +07:00
|
|
|
int sku_pixel_limit;
|
|
|
|
|
|
|
|
struct urb_list urbs;
|
|
|
|
|
|
|
|
char mode_buf[1024];
|
|
|
|
uint32_t mode_buf_len;
|
|
|
|
};
|
|
|
|
|
2019-04-05 10:17:15 +07:00
|
|
|
#define to_udl(x) container_of(x, struct udl_device, drm)
|
2019-04-05 10:17:14 +07:00
|
|
|
|
2010-12-15 04:14:24 +07:00
|
|
|
/* modeset */
|
|
|
|
int udl_modeset_init(struct drm_device *dev);
|
|
|
|
void udl_modeset_cleanup(struct drm_device *dev);
|
2019-12-10 15:48:57 +07:00
|
|
|
struct drm_connector *udl_connector_init(struct drm_device *dev);
|
2010-12-15 04:14:24 +07:00
|
|
|
|
|
|
|
struct urb *udl_get_urb(struct drm_device *dev);
|
|
|
|
|
|
|
|
int udl_submit_urb(struct drm_device *dev, struct urb *urb, size_t len);
|
|
|
|
void udl_urb_completion(struct urb *urb);
|
|
|
|
|
2019-04-05 10:17:15 +07:00
|
|
|
int udl_init(struct udl_device *udl);
|
|
|
|
void udl_fini(struct drm_device *dev);
|
2010-12-15 04:14:24 +07:00
|
|
|
|
2018-06-03 21:41:00 +07:00
|
|
|
int udl_render_hline(struct drm_device *dev, int log_bpp, struct urb **urb_ptr,
|
2010-12-15 04:14:24 +07:00
|
|
|
const char *front, char **urb_buf_ptr,
|
2019-12-06 15:59:49 +07:00
|
|
|
u32 byte_offset, u32 device_byte_offset, u32 byte_width);
|
2010-12-15 04:14:24 +07:00
|
|
|
|
2019-11-07 16:43:05 +07:00
|
|
|
struct drm_gem_object *udl_driver_gem_create_object(struct drm_device *dev,
|
|
|
|
size_t size);
|
2010-12-15 04:14:24 +07:00
|
|
|
|
|
|
|
int udl_drop_usb(struct drm_device *dev);
|
|
|
|
|
|
|
|
#define CMD_WRITE_RAW8 "\xAF\x60" /**< 8 bit raw write command. */
|
|
|
|
#define CMD_WRITE_RL8 "\xAF\x61" /**< 8 bit run length command. */
|
|
|
|
#define CMD_WRITE_COPY8 "\xAF\x62" /**< 8 bit copy command. */
|
|
|
|
#define CMD_WRITE_RLX8 "\xAF\x63" /**< 8 bit extended run length command. */
|
|
|
|
|
|
|
|
#define CMD_WRITE_RAW16 "\xAF\x68" /**< 16 bit raw write command. */
|
|
|
|
#define CMD_WRITE_RL16 "\xAF\x69" /**< 16 bit run length command. */
|
|
|
|
#define CMD_WRITE_COPY16 "\xAF\x6A" /**< 16 bit copy command. */
|
|
|
|
#define CMD_WRITE_RLX16 "\xAF\x6B" /**< 16 bit extended run length command. */
|
|
|
|
|
2019-12-10 15:49:00 +07:00
|
|
|
/* On/Off for driving the DisplayLink framebuffer to the display */
|
|
|
|
#define UDL_REG_BLANK_MODE 0x1f
|
|
|
|
|
|
|
|
#define UDL_BLANK_MODE_ON 0x00 /* hsync and vsync on, visible */
|
|
|
|
#define UDL_BLANK_MODE_BLANKED 0x01 /* hsync and vsync on, blanked */
|
|
|
|
#define UDL_BLANK_MODE_VSYNC_OFF 0x03 /* vsync off, blanked */
|
|
|
|
#define UDL_BLANK_MODE_HSYNC_OFF 0x05 /* hsync off, blanked */
|
|
|
|
#define UDL_BLANK_MODE_POWERDOWN 0x07 /* powered off; requires modeset */
|
|
|
|
|
2010-12-15 04:14:24 +07:00
|
|
|
#endif
|