14b11cb7fSPaul Cercueil /* SPDX-License-Identifier: GPL-2.0 */ 24b11cb7fSPaul Cercueil // 34b11cb7fSPaul Cercueil // Ingenic JZ47xx KMS driver - Register definitions and private API 44b11cb7fSPaul Cercueil // 54b11cb7fSPaul Cercueil // Copyright (C) 2020, Paul Cercueil <paul@crapouillou.net> 64b11cb7fSPaul Cercueil 74b11cb7fSPaul Cercueil #ifndef DRIVERS_GPU_DRM_INGENIC_INGENIC_DRM_H 84b11cb7fSPaul Cercueil #define DRIVERS_GPU_DRM_INGENIC_INGENIC_DRM_H 94b11cb7fSPaul Cercueil 104b11cb7fSPaul Cercueil #include <linux/bitops.h> 11fc1acf31SPaul Cercueil #include <linux/types.h> 124b11cb7fSPaul Cercueil 134b11cb7fSPaul Cercueil #define JZ_REG_LCD_CFG 0x00 144b11cb7fSPaul Cercueil #define JZ_REG_LCD_VSYNC 0x04 154b11cb7fSPaul Cercueil #define JZ_REG_LCD_HSYNC 0x08 164b11cb7fSPaul Cercueil #define JZ_REG_LCD_VAT 0x0C 174b11cb7fSPaul Cercueil #define JZ_REG_LCD_DAH 0x10 184b11cb7fSPaul Cercueil #define JZ_REG_LCD_DAV 0x14 194b11cb7fSPaul Cercueil #define JZ_REG_LCD_PS 0x18 204b11cb7fSPaul Cercueil #define JZ_REG_LCD_CLS 0x1C 214b11cb7fSPaul Cercueil #define JZ_REG_LCD_SPL 0x20 224b11cb7fSPaul Cercueil #define JZ_REG_LCD_REV 0x24 234b11cb7fSPaul Cercueil #define JZ_REG_LCD_CTRL 0x30 244b11cb7fSPaul Cercueil #define JZ_REG_LCD_STATE 0x34 254b11cb7fSPaul Cercueil #define JZ_REG_LCD_IID 0x38 264b11cb7fSPaul Cercueil #define JZ_REG_LCD_DA0 0x40 274b11cb7fSPaul Cercueil #define JZ_REG_LCD_SA0 0x44 284b11cb7fSPaul Cercueil #define JZ_REG_LCD_FID0 0x48 294b11cb7fSPaul Cercueil #define JZ_REG_LCD_CMD0 0x4C 304b11cb7fSPaul Cercueil #define JZ_REG_LCD_DA1 0x50 314b11cb7fSPaul Cercueil #define JZ_REG_LCD_SA1 0x54 324b11cb7fSPaul Cercueil #define JZ_REG_LCD_FID1 0x58 334b11cb7fSPaul Cercueil #define JZ_REG_LCD_CMD1 0x5C 343c9bea4eSPaul Cercueil #define JZ_REG_LCD_OSDC 0x100 353c9bea4eSPaul Cercueil #define JZ_REG_LCD_OSDCTRL 0x104 363c9bea4eSPaul Cercueil #define JZ_REG_LCD_OSDS 0x108 373c9bea4eSPaul Cercueil #define JZ_REG_LCD_BGC 0x10c 383c9bea4eSPaul Cercueil #define JZ_REG_LCD_KEY0 0x110 393c9bea4eSPaul Cercueil #define JZ_REG_LCD_KEY1 0x114 403c9bea4eSPaul Cercueil #define JZ_REG_LCD_ALPHA 0x118 413c9bea4eSPaul Cercueil #define JZ_REG_LCD_IPUR 0x11c 423c9bea4eSPaul Cercueil #define JZ_REG_LCD_XYP0 0x120 433c9bea4eSPaul Cercueil #define JZ_REG_LCD_XYP1 0x124 443c9bea4eSPaul Cercueil #define JZ_REG_LCD_SIZE0 0x128 453c9bea4eSPaul Cercueil #define JZ_REG_LCD_SIZE1 0x12c 464b11cb7fSPaul Cercueil 474b11cb7fSPaul Cercueil #define JZ_LCD_CFG_SLCD BIT(31) 484b11cb7fSPaul Cercueil #define JZ_LCD_CFG_PS_DISABLE BIT(23) 494b11cb7fSPaul Cercueil #define JZ_LCD_CFG_CLS_DISABLE BIT(22) 504b11cb7fSPaul Cercueil #define JZ_LCD_CFG_SPL_DISABLE BIT(21) 514b11cb7fSPaul Cercueil #define JZ_LCD_CFG_REV_DISABLE BIT(20) 524b11cb7fSPaul Cercueil #define JZ_LCD_CFG_HSYNCM BIT(19) 534b11cb7fSPaul Cercueil #define JZ_LCD_CFG_PCLKM BIT(18) 544b11cb7fSPaul Cercueil #define JZ_LCD_CFG_INV BIT(17) 554b11cb7fSPaul Cercueil #define JZ_LCD_CFG_SYNC_DIR BIT(16) 564b11cb7fSPaul Cercueil #define JZ_LCD_CFG_PS_POLARITY BIT(15) 574b11cb7fSPaul Cercueil #define JZ_LCD_CFG_CLS_POLARITY BIT(14) 584b11cb7fSPaul Cercueil #define JZ_LCD_CFG_SPL_POLARITY BIT(13) 594b11cb7fSPaul Cercueil #define JZ_LCD_CFG_REV_POLARITY BIT(12) 604b11cb7fSPaul Cercueil #define JZ_LCD_CFG_HSYNC_ACTIVE_LOW BIT(11) 614b11cb7fSPaul Cercueil #define JZ_LCD_CFG_PCLK_FALLING_EDGE BIT(10) 624b11cb7fSPaul Cercueil #define JZ_LCD_CFG_DE_ACTIVE_LOW BIT(9) 634b11cb7fSPaul Cercueil #define JZ_LCD_CFG_VSYNC_ACTIVE_LOW BIT(8) 644b11cb7fSPaul Cercueil #define JZ_LCD_CFG_18_BIT BIT(7) 654b11cb7fSPaul Cercueil #define JZ_LCD_CFG_PDW (BIT(5) | BIT(4)) 664b11cb7fSPaul Cercueil 674b11cb7fSPaul Cercueil #define JZ_LCD_CFG_MODE_GENERIC_16BIT 0 684b11cb7fSPaul Cercueil #define JZ_LCD_CFG_MODE_GENERIC_18BIT BIT(7) 694b11cb7fSPaul Cercueil #define JZ_LCD_CFG_MODE_GENERIC_24BIT BIT(6) 704b11cb7fSPaul Cercueil 714b11cb7fSPaul Cercueil #define JZ_LCD_CFG_MODE_SPECIAL_TFT_1 1 724b11cb7fSPaul Cercueil #define JZ_LCD_CFG_MODE_SPECIAL_TFT_2 2 734b11cb7fSPaul Cercueil #define JZ_LCD_CFG_MODE_SPECIAL_TFT_3 3 744b11cb7fSPaul Cercueil 754b11cb7fSPaul Cercueil #define JZ_LCD_CFG_MODE_TV_OUT_P 4 764b11cb7fSPaul Cercueil #define JZ_LCD_CFG_MODE_TV_OUT_I 6 774b11cb7fSPaul Cercueil 784b11cb7fSPaul Cercueil #define JZ_LCD_CFG_MODE_SINGLE_COLOR_STN 8 794b11cb7fSPaul Cercueil #define JZ_LCD_CFG_MODE_SINGLE_MONOCHROME_STN 9 804b11cb7fSPaul Cercueil #define JZ_LCD_CFG_MODE_DUAL_COLOR_STN 10 814b11cb7fSPaul Cercueil #define JZ_LCD_CFG_MODE_DUAL_MONOCHROME_STN 11 824b11cb7fSPaul Cercueil 834b11cb7fSPaul Cercueil #define JZ_LCD_CFG_MODE_8BIT_SERIAL 12 844b11cb7fSPaul Cercueil #define JZ_LCD_CFG_MODE_LCM 13 854b11cb7fSPaul Cercueil 864b11cb7fSPaul Cercueil #define JZ_LCD_VSYNC_VPS_OFFSET 16 874b11cb7fSPaul Cercueil #define JZ_LCD_VSYNC_VPE_OFFSET 0 884b11cb7fSPaul Cercueil 894b11cb7fSPaul Cercueil #define JZ_LCD_HSYNC_HPS_OFFSET 16 904b11cb7fSPaul Cercueil #define JZ_LCD_HSYNC_HPE_OFFSET 0 914b11cb7fSPaul Cercueil 924b11cb7fSPaul Cercueil #define JZ_LCD_VAT_HT_OFFSET 16 934b11cb7fSPaul Cercueil #define JZ_LCD_VAT_VT_OFFSET 0 944b11cb7fSPaul Cercueil 954b11cb7fSPaul Cercueil #define JZ_LCD_DAH_HDS_OFFSET 16 964b11cb7fSPaul Cercueil #define JZ_LCD_DAH_HDE_OFFSET 0 974b11cb7fSPaul Cercueil 984b11cb7fSPaul Cercueil #define JZ_LCD_DAV_VDS_OFFSET 16 994b11cb7fSPaul Cercueil #define JZ_LCD_DAV_VDE_OFFSET 0 1004b11cb7fSPaul Cercueil 1014b11cb7fSPaul Cercueil #define JZ_LCD_CTRL_BURST_4 (0x0 << 28) 1024b11cb7fSPaul Cercueil #define JZ_LCD_CTRL_BURST_8 (0x1 << 28) 1034b11cb7fSPaul Cercueil #define JZ_LCD_CTRL_BURST_16 (0x2 << 28) 1044b11cb7fSPaul Cercueil #define JZ_LCD_CTRL_RGB555 BIT(27) 1054b11cb7fSPaul Cercueil #define JZ_LCD_CTRL_OFUP BIT(26) 1064b11cb7fSPaul Cercueil #define JZ_LCD_CTRL_FRC_GRAYSCALE_16 (0x0 << 24) 1074b11cb7fSPaul Cercueil #define JZ_LCD_CTRL_FRC_GRAYSCALE_4 (0x1 << 24) 1084b11cb7fSPaul Cercueil #define JZ_LCD_CTRL_FRC_GRAYSCALE_2 (0x2 << 24) 1094b11cb7fSPaul Cercueil #define JZ_LCD_CTRL_PDD_MASK (0xff << 16) 1104b11cb7fSPaul Cercueil #define JZ_LCD_CTRL_EOF_IRQ BIT(13) 1114b11cb7fSPaul Cercueil #define JZ_LCD_CTRL_SOF_IRQ BIT(12) 1124b11cb7fSPaul Cercueil #define JZ_LCD_CTRL_OFU_IRQ BIT(11) 1134b11cb7fSPaul Cercueil #define JZ_LCD_CTRL_IFU0_IRQ BIT(10) 1144b11cb7fSPaul Cercueil #define JZ_LCD_CTRL_IFU1_IRQ BIT(9) 1154b11cb7fSPaul Cercueil #define JZ_LCD_CTRL_DD_IRQ BIT(8) 1164b11cb7fSPaul Cercueil #define JZ_LCD_CTRL_QDD_IRQ BIT(7) 1174b11cb7fSPaul Cercueil #define JZ_LCD_CTRL_REVERSE_ENDIAN BIT(6) 1184b11cb7fSPaul Cercueil #define JZ_LCD_CTRL_LSB_FISRT BIT(5) 1194b11cb7fSPaul Cercueil #define JZ_LCD_CTRL_DISABLE BIT(4) 1204b11cb7fSPaul Cercueil #define JZ_LCD_CTRL_ENABLE BIT(3) 1214b11cb7fSPaul Cercueil #define JZ_LCD_CTRL_BPP_1 0x0 1224b11cb7fSPaul Cercueil #define JZ_LCD_CTRL_BPP_2 0x1 1234b11cb7fSPaul Cercueil #define JZ_LCD_CTRL_BPP_4 0x2 1244b11cb7fSPaul Cercueil #define JZ_LCD_CTRL_BPP_8 0x3 1254b11cb7fSPaul Cercueil #define JZ_LCD_CTRL_BPP_15_16 0x4 1264b11cb7fSPaul Cercueil #define JZ_LCD_CTRL_BPP_18_24 0x5 127*bb857605SPaul Cercueil #define JZ_LCD_CTRL_BPP_30 0x7 1284b11cb7fSPaul Cercueil #define JZ_LCD_CTRL_BPP_MASK (JZ_LCD_CTRL_RGB555 | 0x7) 1294b11cb7fSPaul Cercueil 1304b11cb7fSPaul Cercueil #define JZ_LCD_CMD_SOF_IRQ BIT(31) 1314b11cb7fSPaul Cercueil #define JZ_LCD_CMD_EOF_IRQ BIT(30) 1324b11cb7fSPaul Cercueil #define JZ_LCD_CMD_ENABLE_PAL BIT(28) 1334b11cb7fSPaul Cercueil 1344b11cb7fSPaul Cercueil #define JZ_LCD_SYNC_MASK 0x3ff 1354b11cb7fSPaul Cercueil 1364b11cb7fSPaul Cercueil #define JZ_LCD_STATE_EOF_IRQ BIT(5) 1374b11cb7fSPaul Cercueil #define JZ_LCD_STATE_SOF_IRQ BIT(4) 1384b11cb7fSPaul Cercueil #define JZ_LCD_STATE_DISABLED BIT(0) 1394b11cb7fSPaul Cercueil 1403c9bea4eSPaul Cercueil #define JZ_LCD_OSDC_OSDEN BIT(0) 1413c9bea4eSPaul Cercueil #define JZ_LCD_OSDC_F0EN BIT(3) 1423c9bea4eSPaul Cercueil #define JZ_LCD_OSDC_F1EN BIT(4) 1433c9bea4eSPaul Cercueil 1443c9bea4eSPaul Cercueil #define JZ_LCD_OSDCTRL_IPU BIT(15) 1453c9bea4eSPaul Cercueil #define JZ_LCD_OSDCTRL_RGB555 BIT(4) 1463c9bea4eSPaul Cercueil #define JZ_LCD_OSDCTRL_CHANGE BIT(3) 1473c9bea4eSPaul Cercueil #define JZ_LCD_OSDCTRL_BPP_15_16 0x4 1483c9bea4eSPaul Cercueil #define JZ_LCD_OSDCTRL_BPP_18_24 0x5 1493c9bea4eSPaul Cercueil #define JZ_LCD_OSDCTRL_BPP_30 0x7 1503c9bea4eSPaul Cercueil #define JZ_LCD_OSDCTRL_BPP_MASK (JZ_LCD_OSDCTRL_RGB555 | 0x7) 1513c9bea4eSPaul Cercueil 1523c9bea4eSPaul Cercueil #define JZ_LCD_OSDS_READY BIT(0) 1533c9bea4eSPaul Cercueil 1543c9bea4eSPaul Cercueil #define JZ_LCD_IPUR_IPUREN BIT(31) 1553c9bea4eSPaul Cercueil #define JZ_LCD_IPUR_IPUR_LSB 0 1563c9bea4eSPaul Cercueil 1573c9bea4eSPaul Cercueil #define JZ_LCD_XYP01_XPOS_LSB 0 1583c9bea4eSPaul Cercueil #define JZ_LCD_XYP01_YPOS_LSB 16 1593c9bea4eSPaul Cercueil 1603c9bea4eSPaul Cercueil #define JZ_LCD_SIZE01_WIDTH_LSB 0 1613c9bea4eSPaul Cercueil #define JZ_LCD_SIZE01_HEIGHT_LSB 16 1623c9bea4eSPaul Cercueil 163fc1acf31SPaul Cercueil struct device; 164fc1acf31SPaul Cercueil struct drm_plane; 165fc1acf31SPaul Cercueil struct drm_plane_state; 166fc1acf31SPaul Cercueil struct platform_driver; 167fc1acf31SPaul Cercueil 168fc1acf31SPaul Cercueil void ingenic_drm_plane_config(struct device *dev, 169fc1acf31SPaul Cercueil struct drm_plane *plane, u32 fourcc); 170fc1acf31SPaul Cercueil void ingenic_drm_plane_disable(struct device *dev, struct drm_plane *plane); 171fc1acf31SPaul Cercueil 17237054fc8SPaul Cercueil void ingenic_drm_sync_data(struct device *dev, 17337054fc8SPaul Cercueil struct drm_plane_state *old_state, 17437054fc8SPaul Cercueil struct drm_plane_state *state); 17537054fc8SPaul Cercueil 176fc1acf31SPaul Cercueil extern struct platform_driver *ingenic_ipu_driver_ptr; 177fc1acf31SPaul Cercueil 1784b11cb7fSPaul Cercueil #endif /* DRIVERS_GPU_DRM_INGENIC_INGENIC_DRM_H */ 179