1 /* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * 4 * HDF is dual licensed: you can use it either under the terms of 5 * the GPL, or the BSD license, at your option. 6 * See the LICENSE file in the root of this repository for complete details. 7 */ 8 9 #ifndef MIPI_JDI_GT911_H 10 #define MIPI_JDI_GT911_H 11 12 #include <drm/drm_mipi_dsi.h> 13 #include <uapi/drm/drm_mode.h> 14 #include <drm/drm_modes.h> 15 #include <linux/backlight.h> 16 #include <linux/of.h> 17 #include <linux/regulator/consumer.h> 18 #include <linux/gpio/consumer.h> 19 #include "hdf_disp.h" 20 21 struct panel_hw_delay { 22 uint32_t prepare_delay; 23 uint32_t hpd_absent_delay; 24 uint32_t enable_delay; 25 uint32_t disable_delay; 26 uint32_t unprepare_delay; 27 uint32_t reset_delay; 28 uint32_t init_delay; 29 }; 30 31 struct panel_jdi_gt911_dev { 32 bool prepared; 33 bool power_invert; 34 struct PanelData panel; 35 struct mipi_dsi_device *dsiDev; 36 struct regulator *supply; 37 struct gpio_desc *enable_gpio; 38 struct gpio_desc *reset_gpio; 39 struct gpio_desc *hpd_gpio; 40 struct panel_hw_delay hw_delay; 41 }; 42 43 /* panel on command payload */ 44 static uint8_t g_payLoad0[] = { 0x11 }; 45 static uint8_t g_payLoad1[] = { 0x29 }; 46 47 static struct DsiCmdDesc g_panelOnCode[] = { 48 { 0x05, 0x78, sizeof(g_payLoad0), g_payLoad0 }, 49 { 0x05, 0x05, sizeof(g_payLoad1), g_payLoad1 }, 50 }; 51 52 /* panel off command payload */ 53 static uint8_t g_offpayLoad0[] = { 0x28 }; 54 static uint8_t g_offpayLoad1[] = { 0x10 }; 55 56 static struct DsiCmdDesc g_panelOffCode[] = { 57 { 0x05, 0x00, sizeof(g_offpayLoad0), g_offpayLoad0 }, 58 { 0x05, 0x78, sizeof(g_offpayLoad1), g_offpayLoad1 }, 59 }; 60 61 #endif 62