1 /* $OpenBSD: rkdrm.h,v 1.5 2024/08/21 11:24:12 jsg Exp $ */ 2 /* $NetBSD: rk_drm.h,v 1.1 2019/11/09 23:30:14 jmcneill Exp $ */ 3 /*- 4 * Copyright (c) 2019 Jared D. McNeill <jmcneill@invisible.ca> 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 */ 28 29 #ifndef _ARM_RK_DRM_H 30 #define _ARM_RK_DRM_H 31 32 #include <dev/wscons/wsconsio.h> 33 #include <dev/wscons/wsdisplayvar.h> 34 #include <dev/rasops/rasops.h> 35 36 #include <drm/drm_framebuffer.h> 37 #include <drm/drm_fb_helper.h> 38 #include <drm/drm_fourcc.h> 39 #include <drm/drm_gem_dma_helper.h> 40 41 #define DRIVER_AUTHOR "Jared McNeill" 42 43 #define DRIVER_NAME "rk" 44 #define DRIVER_DESC "Rockchip Display Subsystem" 45 #define DRIVER_DATE "20191109" 46 47 #define DRIVER_MAJOR 1 48 #define DRIVER_MINOR 0 49 #define DRIVER_PATCHLEVEL 0 50 51 #define RK_DRM_MAX_CRTC 2 52 53 struct rkdrm_vblank { 54 void *priv; 55 void (*enable_vblank)(void *); 56 void (*disable_vblank)(void *); 57 uint32_t (*get_vblank_counter)(void *); 58 }; 59 60 struct rkdrm_softc { 61 struct device sc_dev; 62 struct drm_device sc_ddev; 63 64 bus_space_tag_t sc_iot; 65 bus_dma_tag_t sc_dmat; 66 67 int sc_node; 68 69 struct rkdrm_vblank sc_vbl[RK_DRM_MAX_CRTC]; 70 71 void (*switchcb)(void *, int, int); 72 void *switchcbarg; 73 void *switchcookie; 74 struct task switchtask; 75 struct rasops_info ro; 76 int console; 77 int primary; 78 79 struct drm_fb_helper helper; 80 }; 81 82 struct rkdrm_framebuffer { 83 struct drm_framebuffer base; 84 struct drm_gem_dma_object *obj; 85 }; 86 87 #define to_rkdrm_framebuffer(x) container_of(x, struct rkdrm_framebuffer, base) 88 89 #endif /* _ARM_RK_DRM_H */ 90