162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 262306a36Sopenharmony_ci 362306a36Sopenharmony_ci#ifndef UDL_PROTO_H 462306a36Sopenharmony_ci#define UDL_PROTO_H 562306a36Sopenharmony_ci 662306a36Sopenharmony_ci#include <linux/bits.h> 762306a36Sopenharmony_ci 862306a36Sopenharmony_ci#define UDL_MSG_BULK 0xaf 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ci/* Register access */ 1162306a36Sopenharmony_ci#define UDL_CMD_WRITEREG 0x20 /* See register constants below */ 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ci/* Framebuffer access */ 1462306a36Sopenharmony_ci#define UDL_CMD_WRITERAW8 0x60 /* 8 bit raw write command. */ 1562306a36Sopenharmony_ci#define UDL_CMD_WRITERL8 0x61 /* 8 bit run length command. */ 1662306a36Sopenharmony_ci#define UDL_CMD_WRITECOPY8 0x62 /* 8 bit copy command. */ 1762306a36Sopenharmony_ci#define UDL_CMD_WRITERLX8 0x63 /* 8 bit extended run length command. */ 1862306a36Sopenharmony_ci#define UDL_CMD_WRITERAW16 0x68 /* 16 bit raw write command. */ 1962306a36Sopenharmony_ci#define UDL_CMD_WRITERL16 0x69 /* 16 bit run length command. */ 2062306a36Sopenharmony_ci#define UDL_CMD_WRITECOPY16 0x6a /* 16 bit copy command. */ 2162306a36Sopenharmony_ci#define UDL_CMD_WRITERLX16 0x6b /* 16 bit extended run length command. */ 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_ci/* Color depth */ 2462306a36Sopenharmony_ci#define UDL_REG_COLORDEPTH 0x00 2562306a36Sopenharmony_ci#define UDL_COLORDEPTH_16BPP 0 2662306a36Sopenharmony_ci#define UDL_COLORDEPTH_24BPP 1 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_ci/* Display-mode settings */ 2962306a36Sopenharmony_ci#define UDL_REG_XDISPLAYSTART 0x01 3062306a36Sopenharmony_ci#define UDL_REG_XDISPLAYEND 0x03 3162306a36Sopenharmony_ci#define UDL_REG_YDISPLAYSTART 0x05 3262306a36Sopenharmony_ci#define UDL_REG_YDISPLAYEND 0x07 3362306a36Sopenharmony_ci#define UDL_REG_XENDCOUNT 0x09 3462306a36Sopenharmony_ci#define UDL_REG_HSYNCSTART 0x0b 3562306a36Sopenharmony_ci#define UDL_REG_HSYNCEND 0x0d 3662306a36Sopenharmony_ci#define UDL_REG_HPIXELS 0x0f 3762306a36Sopenharmony_ci#define UDL_REG_YENDCOUNT 0x11 3862306a36Sopenharmony_ci#define UDL_REG_VSYNCSTART 0x13 3962306a36Sopenharmony_ci#define UDL_REG_VSYNCEND 0x15 4062306a36Sopenharmony_ci#define UDL_REG_VPIXELS 0x17 4162306a36Sopenharmony_ci#define UDL_REG_PIXELCLOCK5KHZ 0x1b 4262306a36Sopenharmony_ci 4362306a36Sopenharmony_ci/* On/Off for driving the DisplayLink framebuffer to the display */ 4462306a36Sopenharmony_ci#define UDL_REG_BLANKMODE 0x1f 4562306a36Sopenharmony_ci#define UDL_BLANKMODE_ON 0x00 /* hsync and vsync on, visible */ 4662306a36Sopenharmony_ci#define UDL_BLANKMODE_BLANKED 0x01 /* hsync and vsync on, blanked */ 4762306a36Sopenharmony_ci#define UDL_BLANKMODE_VSYNC_OFF 0x03 /* vsync off, blanked */ 4862306a36Sopenharmony_ci#define UDL_BLANKMODE_HSYNC_OFF 0x05 /* hsync off, blanked */ 4962306a36Sopenharmony_ci#define UDL_BLANKMODE_POWERDOWN 0x07 /* powered off; requires modeset */ 5062306a36Sopenharmony_ci 5162306a36Sopenharmony_ci/* Framebuffer address */ 5262306a36Sopenharmony_ci#define UDL_REG_BASE16BPP_ADDR2 0x20 5362306a36Sopenharmony_ci#define UDL_REG_BASE16BPP_ADDR1 0x21 5462306a36Sopenharmony_ci#define UDL_REG_BASE16BPP_ADDR0 0x22 5562306a36Sopenharmony_ci#define UDL_REG_BASE8BPP_ADDR2 0x26 5662306a36Sopenharmony_ci#define UDL_REG_BASE8BPP_ADDR1 0x27 5762306a36Sopenharmony_ci#define UDL_REG_BASE8BPP_ADDR0 0x28 5862306a36Sopenharmony_ci 5962306a36Sopenharmony_ci#define UDL_BASE_ADDR0_MASK GENMASK(7, 0) 6062306a36Sopenharmony_ci#define UDL_BASE_ADDR1_MASK GENMASK(15, 8) 6162306a36Sopenharmony_ci#define UDL_BASE_ADDR2_MASK GENMASK(23, 16) 6262306a36Sopenharmony_ci 6362306a36Sopenharmony_ci/* Lock/unlock video registers */ 6462306a36Sopenharmony_ci#define UDL_REG_VIDREG 0xff 6562306a36Sopenharmony_ci#define UDL_VIDREG_LOCK 0x00 6662306a36Sopenharmony_ci#define UDL_VIDREG_UNLOCK 0xff 6762306a36Sopenharmony_ci 6862306a36Sopenharmony_ci#endif 69