Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2)  * Copyright (c) 2006-2009 Red Hat Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Copyright (c) 2006-2008 Intel Corporation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * Copyright (c) 2007 Dave Airlie <airlied@linux.ie>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * DRM framebuffer helper functions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  * Permission to use, copy, modify, distribute, and sell this software and its
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  * documentation for any purpose is hereby granted without fee, provided that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  * the above copyright notice appear in all copies and that both that copyright
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  * notice and this permission notice appear in supporting documentation, and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  * that the name of the copyright holders not be used in advertising or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  * publicity pertaining to distribution of the software without specific,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  * written prior permission.  The copyright holders make no representations
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  * about the suitability of this software for any purpose.  It is provided "as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)  * is" without express or implied warranty.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)  * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  * OF THIS SOFTWARE.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)  * Authors:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)  *      Dave Airlie <airlied@linux.ie>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)  *      Jesse Barnes <jesse.barnes@intel.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) #ifndef DRM_FB_HELPER_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) #define DRM_FB_HELPER_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) struct drm_fb_helper;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) #include <drm/drm_client.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) #include <drm/drm_crtc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) #include <drm/drm_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) #include <linux/kgdb.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) #include <linux/vgaarb.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) enum mode_set_atomic {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	LEAVE_ATOMIC_MODE_SET,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	ENTER_ATOMIC_MODE_SET,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47)  * struct drm_fb_helper_surface_size - describes fbdev size and scanout surface size
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48)  * @fb_width: fbdev width
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49)  * @fb_height: fbdev height
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50)  * @surface_width: scanout buffer width
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51)  * @surface_height: scanout buffer height
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52)  * @surface_bpp: scanout buffer bpp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53)  * @surface_depth: scanout buffer depth
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55)  * Note that the scanout surface width/height may be larger than the fbdev
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56)  * width/height.  In case of multiple displays, the scanout surface is sized
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57)  * according to the largest width/height (so it is large enough for all CRTCs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58)  * to scanout).  But the fbdev width/height is sized to the minimum width/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59)  * height of all the displays.  This ensures that fbcon fits on the smallest
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60)  * of the attached displays. fb_width/fb_height is used by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61)  * drm_fb_helper_fill_info() to fill out the &fb_info.var structure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) struct drm_fb_helper_surface_size {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	u32 fb_width;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	u32 fb_height;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	u32 surface_width;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	u32 surface_height;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	u32 surface_bpp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	u32 surface_depth;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73)  * struct drm_fb_helper_funcs - driver callbacks for the fbdev emulation library
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75)  * Driver callbacks used by the fbdev emulation helper library.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) struct drm_fb_helper_funcs {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	 * @fb_probe:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	 * Driver callback to allocate and initialize the fbdev info structure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	 * Furthermore it also needs to allocate the DRM framebuffer used to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	 * back the fbdev.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	 * This callback is mandatory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	 * RETURNS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	 * The driver should return 0 on success and a negative error code on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	 * failure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	int (*fb_probe)(struct drm_fb_helper *helper,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 			struct drm_fb_helper_surface_size *sizes);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97)  * struct drm_fb_helper - main structure to emulate fbdev on top of KMS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98)  * @fb: Scanout framebuffer object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99)  * @dev: DRM device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)  * @funcs: driver callbacks for fb helper
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)  * @fbdev: emulated fbdev device info struct
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)  * @pseudo_palette: fake palette of 16 colors
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)  * @dirty_clip: clip rectangle used with deferred_io to accumulate damage to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)  *              the screen buffer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)  * @dirty_lock: spinlock protecting @dirty_clip
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)  * @dirty_work: worker used to flush the framebuffer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107)  * @resume_work: worker used during resume if the console lock is already taken
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)  * This is the main structure used by the fbdev helpers. Drivers supporting
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)  * fbdev emulation should embedded this into their overall driver structure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)  * Drivers must also fill out a &struct drm_fb_helper_funcs with a few
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)  * operations.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) struct drm_fb_helper {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	 * @client:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	 * DRM client used by the generic fbdev emulation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	struct drm_client_dev client;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	 * @buffer:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	 * Framebuffer used by the generic fbdev emulation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	struct drm_client_buffer *buffer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	struct drm_framebuffer *fb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	struct drm_device *dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	const struct drm_fb_helper_funcs *funcs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	struct fb_info *fbdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	u32 pseudo_palette[17];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	struct drm_clip_rect dirty_clip;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	spinlock_t dirty_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	struct work_struct dirty_work;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	struct work_struct resume_work;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	 * @lock:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	 * Top-level FBDEV helper lock. This protects all internal data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	 * structures and lists, such as @connector_info and @crtc_info.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	 * FIXME: fbdev emulation locking is a mess and long term we want to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	 * protect all helper internal state with this lock as well as reduce
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	 * core KMS locking as much as possible.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	struct mutex lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	 * @kernel_fb_list:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	 * Entry on the global kernel_fb_helper_list, used for kgdb entry/exit.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	struct list_head kernel_fb_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	 * @delayed_hotplug:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	 * A hotplug was received while fbdev wasn't in control of the DRM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	 * device, i.e. another KMS master was active. The output configuration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	 * needs to be reprobe when fbdev is in control again.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	bool delayed_hotplug;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	 * @deferred_setup:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	 * If no outputs are connected (disconnected or unknown) the FB helper
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	 * code will defer setup until at least one of the outputs shows up.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	 * This field keeps track of the status so that setup can be retried
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	 * at every hotplug event until it succeeds eventually.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	 * Protected by @lock.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	bool deferred_setup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	 * @preferred_bpp:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	 * Temporary storage for the driver's preferred BPP setting passed to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	 * FB helper initialization. This needs to be tracked so that deferred
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	 * FB helper setup can pass this on.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	 * See also: @deferred_setup
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	int preferred_bpp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) static inline struct drm_fb_helper *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) drm_fb_helper_from_client(struct drm_client_dev *client)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	return container_of(client, struct drm_fb_helper, client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198)  * define DRM_FB_HELPER_DEFAULT_OPS - helper define for drm drivers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200)  * Helper define to register default implementations of drm_fb_helper
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201)  * functions. To be used in struct fb_ops of drm drivers.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) #define DRM_FB_HELPER_DEFAULT_OPS \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	.fb_check_var	= drm_fb_helper_check_var, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	.fb_set_par	= drm_fb_helper_set_par, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 	.fb_setcmap	= drm_fb_helper_setcmap, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	.fb_blank	= drm_fb_helper_blank, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 	.fb_pan_display	= drm_fb_helper_pan_display, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 	.fb_debug_enter = drm_fb_helper_debug_enter, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	.fb_debug_leave = drm_fb_helper_debug_leave, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 	.fb_ioctl	= drm_fb_helper_ioctl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) #ifdef CONFIG_DRM_FBDEV_EMULATION
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) void drm_fb_helper_prepare(struct drm_device *dev, struct drm_fb_helper *helper,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 			   const struct drm_fb_helper_funcs *funcs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) int drm_fb_helper_init(struct drm_device *dev, struct drm_fb_helper *helper);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) void drm_fb_helper_fini(struct drm_fb_helper *helper);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) int drm_fb_helper_blank(int blank, struct fb_info *info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) int drm_fb_helper_pan_display(struct fb_var_screeninfo *var,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 			      struct fb_info *info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) int drm_fb_helper_set_par(struct fb_info *info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) int drm_fb_helper_check_var(struct fb_var_screeninfo *var,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 			    struct fb_info *info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) int drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) struct fb_info *drm_fb_helper_alloc_fbi(struct drm_fb_helper *fb_helper);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) void drm_fb_helper_unregister_fbi(struct drm_fb_helper *fb_helper);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) void drm_fb_helper_fill_info(struct fb_info *info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 			     struct drm_fb_helper *fb_helper,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 			     struct drm_fb_helper_surface_size *sizes);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) void drm_fb_helper_deferred_io(struct fb_info *info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 			       struct list_head *pagelist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) ssize_t drm_fb_helper_sys_read(struct fb_info *info, char __user *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 			       size_t count, loff_t *ppos);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) ssize_t drm_fb_helper_sys_write(struct fb_info *info, const char __user *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 				size_t count, loff_t *ppos);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) void drm_fb_helper_sys_fillrect(struct fb_info *info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 				const struct fb_fillrect *rect);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) void drm_fb_helper_sys_copyarea(struct fb_info *info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 				const struct fb_copyarea *area);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) void drm_fb_helper_sys_imageblit(struct fb_info *info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 				 const struct fb_image *image);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) void drm_fb_helper_cfb_fillrect(struct fb_info *info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 				const struct fb_fillrect *rect);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) void drm_fb_helper_cfb_copyarea(struct fb_info *info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 				const struct fb_copyarea *area);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) void drm_fb_helper_cfb_imageblit(struct fb_info *info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 				 const struct fb_image *image);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) void drm_fb_helper_set_suspend(struct drm_fb_helper *fb_helper, bool suspend);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) void drm_fb_helper_set_suspend_unlocked(struct drm_fb_helper *fb_helper,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 					bool suspend);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) int drm_fb_helper_ioctl(struct fb_info *info, unsigned int cmd,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 			unsigned long arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) int drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper, int bpp_sel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) int drm_fb_helper_debug_enter(struct fb_info *info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) int drm_fb_helper_debug_leave(struct fb_info *info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) void drm_fb_helper_lastclose(struct drm_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) void drm_fb_helper_output_poll_changed(struct drm_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) void drm_fbdev_generic_setup(struct drm_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) 			     unsigned int preferred_bpp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) static inline void drm_fb_helper_prepare(struct drm_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 					struct drm_fb_helper *helper,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 					const struct drm_fb_helper_funcs *funcs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) static inline int drm_fb_helper_init(struct drm_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 		       struct drm_fb_helper *helper)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 	/* So drivers can use it to free the struct */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) 	helper->dev = dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) 	dev->fb_helper = helper;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) static inline void drm_fb_helper_fini(struct drm_fb_helper *helper)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 	if (helper && helper->dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) 		helper->dev->fb_helper = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) static inline int drm_fb_helper_blank(int blank, struct fb_info *info)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) static inline int drm_fb_helper_pan_display(struct fb_var_screeninfo *var,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) 					    struct fb_info *info)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) static inline int drm_fb_helper_set_par(struct fb_info *info)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) static inline int drm_fb_helper_check_var(struct fb_var_screeninfo *var,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) 					  struct fb_info *info)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) static inline int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) static inline struct fb_info *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) drm_fb_helper_alloc_fbi(struct drm_fb_helper *fb_helper)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) 	return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) static inline void drm_fb_helper_unregister_fbi(struct drm_fb_helper *fb_helper)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) static inline void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) drm_fb_helper_fill_info(struct fb_info *info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) 			struct drm_fb_helper *fb_helper,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) 			struct drm_fb_helper_surface_size *sizes)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) static inline int drm_fb_helper_setcmap(struct fb_cmap *cmap,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) 					struct fb_info *info)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) static inline int drm_fb_helper_ioctl(struct fb_info *info, unsigned int cmd,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) 				      unsigned long arg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) static inline void drm_fb_helper_deferred_io(struct fb_info *info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) 					     struct list_head *pagelist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) static inline int drm_fb_helper_defio_init(struct drm_fb_helper *fb_helper)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) 	return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) static inline ssize_t drm_fb_helper_sys_read(struct fb_info *info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) 					     char __user *buf, size_t count,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) 					     loff_t *ppos)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) 	return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) static inline ssize_t drm_fb_helper_sys_write(struct fb_info *info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) 					      const char __user *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) 					      size_t count, loff_t *ppos)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) 	return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) static inline void drm_fb_helper_sys_fillrect(struct fb_info *info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) 					      const struct fb_fillrect *rect)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) static inline void drm_fb_helper_sys_copyarea(struct fb_info *info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) 					      const struct fb_copyarea *area)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) static inline void drm_fb_helper_sys_imageblit(struct fb_info *info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) 					       const struct fb_image *image)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) static inline void drm_fb_helper_cfb_fillrect(struct fb_info *info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) 					      const struct fb_fillrect *rect)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) static inline void drm_fb_helper_cfb_copyarea(struct fb_info *info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) 					      const struct fb_copyarea *area)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) static inline void drm_fb_helper_cfb_imageblit(struct fb_info *info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) 					       const struct fb_image *image)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) static inline void drm_fb_helper_set_suspend(struct drm_fb_helper *fb_helper,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) 					     bool suspend)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) static inline void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) drm_fb_helper_set_suspend_unlocked(struct drm_fb_helper *fb_helper, bool suspend)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) static inline int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) static inline int drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) 					       int bpp_sel)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) static inline int drm_fb_helper_debug_enter(struct fb_info *info)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) static inline int drm_fb_helper_debug_leave(struct fb_info *info)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) static inline void drm_fb_helper_lastclose(struct drm_device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) static inline void drm_fb_helper_output_poll_changed(struct drm_device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) static inline void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) drm_fbdev_generic_setup(struct drm_device *dev, unsigned int preferred_bpp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455)  * drm_fb_helper_remove_conflicting_framebuffers - remove firmware-configured framebuffers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456)  * @a: memory range, users of which are to be removed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457)  * @name: requesting driver name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458)  * @primary: also kick vga16fb if present
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460)  * This function removes framebuffer devices (initialized by firmware/bootloader)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461)  * which use memory range described by @a. If @a is NULL all such devices are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462)  * removed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) static inline int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) drm_fb_helper_remove_conflicting_framebuffers(struct apertures_struct *a,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) 					      const char *name, bool primary)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) #if IS_REACHABLE(CONFIG_FB)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) 	return remove_conflicting_framebuffers(a, name, primary);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476)  * drm_fb_helper_remove_conflicting_pci_framebuffers - remove firmware-configured framebuffers for PCI devices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477)  * @pdev: PCI device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478)  * @name: requesting driver name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480)  * This function removes framebuffer devices (eg. initialized by firmware)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481)  * using memory range configured for any of @pdev's memory bars.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483)  * The function assumes that PCI device with shadowed ROM drives a primary
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484)  * display and so kicks out vga16fb.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) static inline int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) drm_fb_helper_remove_conflicting_pci_framebuffers(struct pci_dev *pdev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) 						  const char *name)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) 	int ret = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) 	 * WARNING: Apparently we must kick fbdev drivers before vgacon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) 	 * otherwise the vga fbdev driver falls over.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) #if IS_REACHABLE(CONFIG_FB)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) 	ret = remove_conflicting_pci_framebuffers(pdev, name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) 	if (ret == 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) 		ret = vga_remove_vgacon(pdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) #endif