]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/udl: Add constants for commands
authorThomas Zimmermann <tzimmermann@suse.de>
Thu, 6 Oct 2022 09:53:55 +0000 (11:53 +0200)
committerThomas Zimmermann <tzimmermann@suse.de>
Fri, 7 Oct 2022 11:47:40 +0000 (13:47 +0200)
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 <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221006095355.23579-17-tzimmermann@suse.de
drivers/gpu/drm/udl/udl_drv.h
drivers/gpu/drm/udl/udl_modeset.c
drivers/gpu/drm/udl/udl_proto.h
drivers/gpu/drm/udl/udl_transfer.c

index 580989087c54f2dc900754b886a6af42700e082b..282ebd6c02fdaa41a192a7ae93c65de8821ce315 100644 (file)
@@ -102,14 +102,4 @@ int udl_render_hline(struct drm_device *dev, int log_bpp, struct urb **urb_ptr,
 int udl_drop_usb(struct drm_device *dev);
 int udl_select_std_channel(struct udl_device *udl);
 
-#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. */
-
 #endif
index 4462653e6736e4ef9c4c3dfa00d002d67c4044ed..3a25f3fc2b22af84c363d58e47193ac46d7ca3cd 100644 (file)
 #include "udl_proto.h"
 
 /*
- * All DisplayLink bulk operations start with 0xAF, followed by specific code
- * All operations are written to buffers which then later get sent to device
+ * All DisplayLink bulk operations start with 0xaf (UDL_MSG_BULK), followed by
+ * a specific command code. All operations are written to a command buffer, which
+ * the driver sends to the device.
  */
 static char *udl_set_register(char *buf, u8 reg, u8 val)
 {
-       *buf++ = 0xAF;
-       *buf++ = 0x20;
+       *buf++ = UDL_MSG_BULK;
+       *buf++ = UDL_CMD_WRITEREG;
        *buf++ = reg;
        *buf++ = val;
+
        return buf;
 }
 
@@ -179,8 +181,8 @@ static char *udl_set_display_mode(char *buf, struct drm_display_mode *mode)
 
 static char *udl_dummy_render(char *wrptr)
 {
-       *wrptr++ = 0xAF;
-       *wrptr++ = 0x6A; /* copy */
+       *wrptr++ = UDL_MSG_BULK;
+       *wrptr++ = UDL_CMD_WRITECOPY16;
        *wrptr++ = 0x00; /* from addr */
        *wrptr++ = 0x00;
        *wrptr++ = 0x00;
@@ -235,7 +237,7 @@ static int udl_handle_damage(struct drm_framebuffer *fb,
                /* Send partial buffer remaining before exiting */
                int len;
                if (cmd < (char *)urb->transfer_buffer + urb->transfer_buffer_length)
-                       *cmd++ = 0xAF;
+                       *cmd++ = UDL_MSG_BULK;
                len = cmd - (char *)urb->transfer_buffer;
                ret = udl_submit_urb(dev, urb, len);
        } else {
index 8f143e75e7975c98451ddd0974109a1131dda086..c92d2109584cdf44f687d7f8dc4e58bdc2368308 100644 (file)
@@ -5,6 +5,21 @@
 
 #include <linux/bits.h>
 
+#define UDL_MSG_BULK           0xaf
+
+/* Register access */
+#define UDL_CMD_WRITEREG       0x20 /* See register constants below */
+
+/* Framebuffer access */
+#define UDL_CMD_WRITERAW8      0x60 /* 8 bit raw write command. */
+#define UDL_CMD_WRITERL8       0x61 /* 8 bit run length command. */
+#define UDL_CMD_WRITECOPY8     0x62 /* 8 bit copy command. */
+#define UDL_CMD_WRITERLX8      0x63 /* 8 bit extended run length command. */
+#define UDL_CMD_WRITERAW16     0x68 /* 16 bit raw write command. */
+#define UDL_CMD_WRITERL16      0x69 /* 16 bit run length command. */
+#define UDL_CMD_WRITECOPY16    0x6a /* 16 bit copy command. */
+#define UDL_CMD_WRITERLX16     0x6b /* 16 bit extended run length command. */
+
 /* Color depth */
 #define UDL_REG_COLORDEPTH             0x00
 #define UDL_COLORDEPTH_16BPP           0
index b57844632dbd74ce69c3fe79d46d63c38c952cfc..5ff1037a34536d0de6380a2b31c3d5549312dbc1 100644 (file)
@@ -10,6 +10,7 @@
 #include <asm/unaligned.h>
 
 #include "udl_drv.h"
+#include "udl_proto.h"
 
 #define MAX_CMD_PIXELS         255
 
@@ -89,8 +90,8 @@ static void udl_compress_hline16(
                const u8 *cmd_pixel_start, *cmd_pixel_end = NULL;
                uint16_t pixel_val16;
 
-               *cmd++ = 0xaf;
-               *cmd++ = 0x6b;
+               *cmd++ = UDL_MSG_BULK;
+               *cmd++ = UDL_CMD_WRITERLX16;
                *cmd++ = (uint8_t) ((dev_addr >> 16) & 0xFF);
                *cmd++ = (uint8_t) ((dev_addr >> 8) & 0xFF);
                *cmd++ = (uint8_t) ((dev_addr) & 0xFF);
@@ -152,7 +153,7 @@ static void udl_compress_hline16(
        if (cmd_buffer_end <= MIN_RLX_CMD_BYTES + cmd) {
                /* Fill leftover bytes with no-ops */
                if (cmd_buffer_end > cmd)
-                       memset(cmd, 0xAF, cmd_buffer_end - cmd);
+                       memset(cmd, UDL_MSG_BULK, cmd_buffer_end - cmd);
                cmd = (uint8_t *) cmd_buffer_end;
        }