![]() |
|
|||
0001 /* 0002 * Copyright (C) 2013, NVIDIA Corporation. All rights reserved. 0003 * 0004 * Permission is hereby granted, free of charge, to any person obtaining a 0005 * copy of this software and associated documentation files (the "Software"), 0006 * to deal in the Software without restriction, including without limitation 0007 * the rights to use, copy, modify, merge, publish, distribute, sub license, 0008 * and/or sell copies of the Software, and to permit persons to whom the 0009 * Software is furnished to do so, subject to the following conditions: 0010 * 0011 * The above copyright notice and this permission notice (including the 0012 * next paragraph) shall be included in all copies or substantial portions 0013 * of the Software. 0014 * 0015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 0016 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 0017 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 0018 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 0019 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 0020 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 0021 * DEALINGS IN THE SOFTWARE. 0022 */ 0023 0024 #ifndef __DRM_PANEL_H__ 0025 #define __DRM_PANEL_H__ 0026 0027 #include <linux/err.h> 0028 #include <linux/errno.h> 0029 #include <linux/list.h> 0030 0031 struct backlight_device; 0032 struct dentry; 0033 struct device_node; 0034 struct drm_connector; 0035 struct drm_device; 0036 struct drm_panel; 0037 struct display_timing; 0038 0039 enum drm_panel_orientation; 0040 0041 /** 0042 * struct drm_panel_funcs - perform operations on a given panel 0043 * 0044 * The .prepare() function is typically called before the display controller 0045 * starts to transmit video data. Panel drivers can use this to turn the panel 0046 * on and wait for it to become ready. If additional configuration is required 0047 * (via a control bus such as I2C, SPI or DSI for example) this is a good time 0048 * to do that. 0049 * 0050 * After the display controller has started transmitting video data, it's safe 0051 * to call the .enable() function. This will typically enable the backlight to 0052 * make the image on screen visible. Some panels require a certain amount of 0053 * time or frames before the image is displayed. This function is responsible 0054 * for taking this into account before enabling the backlight to avoid visual 0055 * glitches. 0056 * 0057 * Before stopping video transmission from the display controller it can be 0058 * necessary to turn off the panel to avoid visual glitches. This is done in 0059 * the .disable() function. Analogously to .enable() this typically involves 0060 * turning off the backlight and waiting for some time to make sure no image 0061 * is visible on the panel. It is then safe for the display controller to 0062 * cease transmission of video data. 0063 * 0064 * To save power when no video data is transmitted, a driver can power down 0065 * the panel. This is the job of the .unprepare() function. 0066 * 0067 * Backlight can be handled automatically if configured using 0068 * drm_panel_of_backlight() or drm_panel_dp_aux_backlight(). Then the driver 0069 * does not need to implement the functionality to enable/disable backlight. 0070 */ 0071 struct drm_panel_funcs { 0072 /** 0073 * @prepare: 0074 * 0075 * Turn on panel and perform set up. 0076 * 0077 * This function is optional. 0078 */ 0079 int (*prepare)(struct drm_panel *panel); 0080 0081 /** 0082 * @enable: 0083 * 0084 * Enable panel (turn on back light, etc.). 0085 * 0086 * This function is optional. 0087 */ 0088 int (*enable)(struct drm_panel *panel); 0089 0090 /** 0091 * @disable: 0092 * 0093 * Disable panel (turn off back light, etc.). 0094 * 0095 * This function is optional. 0096 */ 0097 int (*disable)(struct drm_panel *panel); 0098 0099 /** 0100 * @unprepare: 0101 * 0102 * Turn off panel. 0103 * 0104 * This function is optional. 0105 */ 0106 int (*unprepare)(struct drm_panel *panel); 0107 0108 /** 0109 * @get_modes: 0110 * 0111 * Add modes to the connector that the panel is attached to 0112 * and returns the number of modes added. 0113 * 0114 * This function is mandatory. 0115 */ 0116 int (*get_modes)(struct drm_panel *panel, 0117 struct drm_connector *connector); 0118 0119 /** 0120 * @get_orientation: 0121 * 0122 * Return the panel orientation set by device tree or EDID. 0123 * 0124 * This function is optional. 0125 */ 0126 enum drm_panel_orientation (*get_orientation)(struct drm_panel *panel); 0127 0128 /** 0129 * @get_timings: 0130 * 0131 * Copy display timings into the provided array and return 0132 * the number of display timings available. 0133 * 0134 * This function is optional. 0135 */ 0136 int (*get_timings)(struct drm_panel *panel, unsigned int num_timings, 0137 struct display_timing *timings); 0138 0139 /** 0140 * @debugfs_init: 0141 * 0142 * Allows panels to create panels-specific debugfs files. 0143 */ 0144 void (*debugfs_init)(struct drm_panel *panel, struct dentry *root); 0145 }; 0146 0147 /** 0148 * struct drm_panel - DRM panel object 0149 */ 0150 struct drm_panel { 0151 /** 0152 * @dev: 0153 * 0154 * Parent device of the panel. 0155 */ 0156 struct device *dev; 0157 0158 /** 0159 * @backlight: 0160 * 0161 * Backlight device, used to turn on backlight after the call 0162 * to enable(), and to turn off backlight before the call to 0163 * disable(). 0164 * backlight is set by drm_panel_of_backlight() or 0165 * drm_panel_dp_aux_backlight() and drivers shall not assign it. 0166 */ 0167 struct backlight_device *backlight; 0168 0169 /** 0170 * @funcs: 0171 * 0172 * Operations that can be performed on the panel. 0173 */ 0174 const struct drm_panel_funcs *funcs; 0175 0176 /** 0177 * @connector_type: 0178 * 0179 * Type of the panel as a DRM_MODE_CONNECTOR_* value. This is used to 0180 * initialise the drm_connector corresponding to the panel with the 0181 * correct connector type. 0182 */ 0183 int connector_type; 0184 0185 /** 0186 * @list: 0187 * 0188 * Panel entry in registry. 0189 */ 0190 struct list_head list; 0191 0192 /** 0193 * @dsc: 0194 * 0195 * Panel DSC pps payload to be sent 0196 */ 0197 struct drm_dsc_config *dsc; 0198 }; 0199 0200 void drm_panel_init(struct drm_panel *panel, struct device *dev, 0201 const struct drm_panel_funcs *funcs, 0202 int connector_type); 0203 0204 void drm_panel_add(struct drm_panel *panel); 0205 void drm_panel_remove(struct drm_panel *panel); 0206 0207 int drm_panel_prepare(struct drm_panel *panel); 0208 int drm_panel_unprepare(struct drm_panel *panel); 0209 0210 int drm_panel_enable(struct drm_panel *panel); 0211 int drm_panel_disable(struct drm_panel *panel); 0212 0213 int drm_panel_get_modes(struct drm_panel *panel, struct drm_connector *connector); 0214 0215 #if defined(CONFIG_OF) && defined(CONFIG_DRM_PANEL) 0216 struct drm_panel *of_drm_find_panel(const struct device_node *np); 0217 int of_drm_get_panel_orientation(const struct device_node *np, 0218 enum drm_panel_orientation *orientation); 0219 #else 0220 static inline struct drm_panel *of_drm_find_panel(const struct device_node *np) 0221 { 0222 return ERR_PTR(-ENODEV); 0223 } 0224 0225 static inline int of_drm_get_panel_orientation(const struct device_node *np, 0226 enum drm_panel_orientation *orientation) 0227 { 0228 return -ENODEV; 0229 } 0230 #endif 0231 0232 #if IS_ENABLED(CONFIG_DRM_PANEL) && (IS_BUILTIN(CONFIG_BACKLIGHT_CLASS_DEVICE) || \ 0233 (IS_MODULE(CONFIG_DRM) && IS_MODULE(CONFIG_BACKLIGHT_CLASS_DEVICE))) 0234 int drm_panel_of_backlight(struct drm_panel *panel); 0235 #else 0236 static inline int drm_panel_of_backlight(struct drm_panel *panel) 0237 { 0238 return 0; 0239 } 0240 #endif 0241 0242 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |