Lines Matching full:panel

36  * DOC: drm panel
38 * The DRM panel helpers allow drivers to register panel objects with a
47 * drm_panel_init - initialize a panel
48 * @panel: DRM panel
49 * @dev: parent device of the panel
50 * @funcs: panel operations
52 * the panel interface
54 * Initialize the panel structure for subsequent registration with
57 void drm_panel_init(struct drm_panel *panel, struct device *dev, in drm_panel_init() argument
60 INIT_LIST_HEAD(&panel->list); in drm_panel_init()
61 INIT_LIST_HEAD(&panel->followers); in drm_panel_init()
62 mutex_init(&panel->follower_lock); in drm_panel_init()
63 panel->dev = dev; in drm_panel_init()
64 panel->funcs = funcs; in drm_panel_init()
65 panel->connector_type = connector_type; in drm_panel_init()
70 * drm_panel_add - add a panel to the global registry
71 * @panel: panel to add
73 * Add a panel to the global registry so that it can be looked up by display
76 void drm_panel_add(struct drm_panel *panel) in drm_panel_add() argument
79 list_add_tail(&panel->list, &panel_list); in drm_panel_add()
85 * drm_panel_remove - remove a panel from the global registry
86 * @panel: DRM panel
88 * Removes a panel from the global registry.
90 void drm_panel_remove(struct drm_panel *panel) in drm_panel_remove() argument
93 list_del_init(&panel->list); in drm_panel_remove()
99 * drm_panel_prepare - power on a panel
100 * @panel: DRM panel
103 * the panel. After this has completed it is possible to communicate with any
108 int drm_panel_prepare(struct drm_panel *panel) in drm_panel_prepare() argument
113 if (!panel) in drm_panel_prepare()
116 if (panel->prepared) { in drm_panel_prepare()
117 dev_warn(panel->dev, "Skipping prepare of already prepared panel\n"); in drm_panel_prepare()
121 mutex_lock(&panel->follower_lock); in drm_panel_prepare()
123 if (panel->funcs && panel->funcs->prepare) { in drm_panel_prepare()
124 ret = panel->funcs->prepare(panel); in drm_panel_prepare()
128 panel->prepared = true; in drm_panel_prepare()
130 list_for_each_entry(follower, &panel->followers, list) { in drm_panel_prepare()
133 dev_info(panel->dev, "%ps failed: %d\n", in drm_panel_prepare()
139 mutex_unlock(&panel->follower_lock); in drm_panel_prepare()
146 * drm_panel_unprepare - power off a panel
147 * @panel: DRM panel
149 * Calling this function will completely power off a panel (assert the panel's
151 * is usually no longer possible to communicate with the panel until another
156 int drm_panel_unprepare(struct drm_panel *panel) in drm_panel_unprepare() argument
161 if (!panel) in drm_panel_unprepare()
166 * - Your panel driver incorrectly calls drm_panel_unprepare() in its in drm_panel_unprepare()
168 * - You are using panel-edp or panel-simple and your DRM modeset in drm_panel_unprepare()
169 * driver's shutdown() callback happened after the panel's shutdown(). in drm_panel_unprepare()
173 if (!panel->prepared) { in drm_panel_unprepare()
174 dev_warn(panel->dev, "Skipping unprepare of already unprepared panel\n"); in drm_panel_unprepare()
178 mutex_lock(&panel->follower_lock); in drm_panel_unprepare()
180 list_for_each_entry(follower, &panel->followers, list) { in drm_panel_unprepare()
183 dev_info(panel->dev, "%ps failed: %d\n", in drm_panel_unprepare()
187 if (panel->funcs && panel->funcs->unprepare) { in drm_panel_unprepare()
188 ret = panel->funcs->unprepare(panel); in drm_panel_unprepare()
192 panel->prepared = false; in drm_panel_unprepare()
196 mutex_unlock(&panel->follower_lock); in drm_panel_unprepare()
203 * drm_panel_enable - enable a panel
204 * @panel: DRM panel
206 * Calling this function will cause the panel display drivers to be turned on
212 int drm_panel_enable(struct drm_panel *panel) in drm_panel_enable() argument
216 if (!panel) in drm_panel_enable()
219 if (panel->enabled) { in drm_panel_enable()
220 dev_warn(panel->dev, "Skipping enable of already enabled panel\n"); in drm_panel_enable()
224 if (panel->funcs && panel->funcs->enable) { in drm_panel_enable()
225 ret = panel->funcs->enable(panel); in drm_panel_enable()
229 panel->enabled = true; in drm_panel_enable()
231 ret = backlight_enable(panel->backlight); in drm_panel_enable()
233 DRM_DEV_INFO(panel->dev, "failed to enable backlight: %d\n", in drm_panel_enable()
241 * drm_panel_disable - disable a panel
242 * @panel: DRM panel
244 * This will typically turn off the panel's backlight or disable the display
250 int drm_panel_disable(struct drm_panel *panel) in drm_panel_disable() argument
254 if (!panel) in drm_panel_disable()
259 * - Your panel driver incorrectly calls drm_panel_disable() in its in drm_panel_disable()
261 * - You are using panel-edp or panel-simple and your DRM modeset in drm_panel_disable()
262 * driver's shutdown() callback happened after the panel's shutdown(). in drm_panel_disable()
266 if (!panel->enabled) { in drm_panel_disable()
267 dev_warn(panel->dev, "Skipping disable of already disabled panel\n"); in drm_panel_disable()
271 ret = backlight_disable(panel->backlight); in drm_panel_disable()
273 DRM_DEV_INFO(panel->dev, "failed to disable backlight: %d\n", in drm_panel_disable()
276 if (panel->funcs && panel->funcs->disable) { in drm_panel_disable()
277 ret = panel->funcs->disable(panel); in drm_panel_disable()
281 panel->enabled = false; in drm_panel_disable()
288 * drm_panel_get_modes - probe the available display modes of a panel
289 * @panel: DRM panel
292 * The modes probed from the panel are automatically added to the connector
293 * that the panel is attached to.
295 * Return: The number of modes available from the panel on success, or 0 on
298 int drm_panel_get_modes(struct drm_panel *panel, in drm_panel_get_modes() argument
301 if (!panel) in drm_panel_get_modes()
304 if (panel->funcs && panel->funcs->get_modes) { in drm_panel_get_modes()
307 num = panel->funcs->get_modes(panel, connector); in drm_panel_get_modes()
318 * of_drm_find_panel - look up a panel using a device tree node
319 * @np: device tree node of the panel
322 * tree node. If a matching panel is found, return a pointer to it.
324 * Return: A pointer to the panel registered for the specified device tree
325 * node or an ERR_PTR() if no panel matching the device tree node can be found.
329 * - EPROBE_DEFER: the panel device has not been probed yet, and the caller
335 struct drm_panel *panel; in of_drm_find_panel() local
342 list_for_each_entry(panel, &panel_list, list) { in of_drm_find_panel()
343 if (panel->dev->of_node == np) { in of_drm_find_panel()
345 return panel; in of_drm_find_panel()
355 * of_drm_get_panel_orientation - look up the orientation of the panel through
357 * @np: device tree node of the panel
360 * Looks up the rotation of a panel in the device tree. The orientation of the
361 * panel is expressed as a property name "rotation" in the device tree. The
399 * drm_is_panel_follower() - Check if the device is a panel follower
403 * a panel using the panel follower API.
405 * The "panel" property of the follower points to the panel to be followed.
407 * Return: true if we should be power sequenced with a panel; false otherwise.
412 * The "panel" property is actually a phandle, but for simplicity we in drm_is_panel_follower()
416 return of_property_read_bool(dev->of_node, "panel"); in drm_is_panel_follower()
421 * drm_panel_add_follower() - Register something to follow panel state.
423 * @follower: The panel follower descriptor for the follower.
425 * A panel follower is called right after preparing the panel and right before
426 * unpreparing the panel. It's primary intention is to power on an associated
428 * devices are allowed the follow the same panel.
430 * If a follower is added to a panel that's already been turned on, the
434 * The "panel" property of the follower points to the panel to be followed.
437 * follower_dev is not actually following a panel. The caller may
438 * choose to ignore this return value if following a panel is optional.
444 struct drm_panel *panel; in drm_panel_add_follower() local
447 panel_np = of_parse_phandle(follower_dev->of_node, "panel", 0); in drm_panel_add_follower()
451 panel = of_drm_find_panel(panel_np); in drm_panel_add_follower()
453 if (IS_ERR(panel)) in drm_panel_add_follower()
454 return PTR_ERR(panel); in drm_panel_add_follower()
456 get_device(panel->dev); in drm_panel_add_follower()
457 follower->panel = panel; in drm_panel_add_follower()
459 mutex_lock(&panel->follower_lock); in drm_panel_add_follower()
461 list_add_tail(&follower->list, &panel->followers); in drm_panel_add_follower()
462 if (panel->prepared) { in drm_panel_add_follower()
465 dev_info(panel->dev, "%ps failed: %d\n", in drm_panel_add_follower()
469 mutex_unlock(&panel->follower_lock); in drm_panel_add_follower()
477 * @follower: The panel follower descriptor for the follower.
480 * unprepare function if we're removed from a panel that's currently prepared.
486 struct drm_panel *panel = follower->panel; in drm_panel_remove_follower() local
489 mutex_lock(&panel->follower_lock); in drm_panel_remove_follower()
491 if (panel->prepared) { in drm_panel_remove_follower()
494 dev_info(panel->dev, "%ps failed: %d\n", in drm_panel_remove_follower()
499 mutex_unlock(&panel->follower_lock); in drm_panel_remove_follower()
501 put_device(panel->dev); in drm_panel_remove_follower()
513 * @follower: The panel follower descriptor for the follower.
536 * @panel: DRM panel
538 * Use this function to enable backlight handling if your panel
541 * When the panel is enabled backlight will be enabled after a
544 * When the panel is disabled backlight will be disabled before the
547 * A typical implementation for a panel driver supporting device tree
554 int drm_panel_of_backlight(struct drm_panel *panel) in drm_panel_of_backlight() argument
558 if (!panel || !panel->dev) in drm_panel_of_backlight()
561 backlight = devm_of_find_backlight(panel->dev); in drm_panel_of_backlight()
566 panel->backlight = backlight; in drm_panel_of_backlight()
573 MODULE_DESCRIPTION("DRM panel infrastructure");