Lines Matching defs: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,
60 INIT_LIST_HEAD(&panel->list);
61 INIT_LIST_HEAD(&panel->followers);
62 mutex_init(&panel->follower_lock);
63 panel->dev = dev;
64 panel->funcs = funcs;
65 panel->connector_type = connector_type;
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)
79 list_add_tail(&panel->list, &panel_list);
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)
93 list_del_init(&panel->list);
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)
113 if (!panel)
116 if (panel->prepared) {
117 dev_warn(panel->dev, "Skipping prepare of already prepared panel\n");
121 mutex_lock(&panel->follower_lock);
123 if (panel->funcs && panel->funcs->prepare) {
124 ret = panel->funcs->prepare(panel);
128 panel->prepared = true;
130 list_for_each_entry(follower, &panel->followers, list) {
133 dev_info(panel->dev, "%ps failed: %d\n",
139 mutex_unlock(&panel->follower_lock);
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)
161 if (!panel)
164 if (!panel->prepared) {
165 dev_warn(panel->dev, "Skipping unprepare of already unprepared panel\n");
169 mutex_lock(&panel->follower_lock);
171 list_for_each_entry(follower, &panel->followers, list) {
174 dev_info(panel->dev, "%ps failed: %d\n",
178 if (panel->funcs && panel->funcs->unprepare) {
179 ret = panel->funcs->unprepare(panel);
183 panel->prepared = false;
187 mutex_unlock(&panel->follower_lock);
194 * drm_panel_enable - enable a panel
195 * @panel: DRM panel
197 * Calling this function will cause the panel display drivers to be turned on
203 int drm_panel_enable(struct drm_panel *panel)
207 if (!panel)
210 if (panel->enabled) {
211 dev_warn(panel->dev, "Skipping enable of already enabled panel\n");
215 if (panel->funcs && panel->funcs->enable) {
216 ret = panel->funcs->enable(panel);
220 panel->enabled = true;
222 ret = backlight_enable(panel->backlight);
224 DRM_DEV_INFO(panel->dev, "failed to enable backlight: %d\n",
232 * drm_panel_disable - disable a panel
233 * @panel: DRM panel
235 * This will typically turn off the panel's backlight or disable the display
241 int drm_panel_disable(struct drm_panel *panel)
245 if (!panel)
248 if (!panel->enabled) {
249 dev_warn(panel->dev, "Skipping disable of already disabled panel\n");
253 ret = backlight_disable(panel->backlight);
255 DRM_DEV_INFO(panel->dev, "failed to disable backlight: %d\n",
258 if (panel->funcs && panel->funcs->disable) {
259 ret = panel->funcs->disable(panel);
263 panel->enabled = false;
270 * drm_panel_get_modes - probe the available display modes of a panel
271 * @panel: DRM panel
274 * The modes probed from the panel are automatically added to the connector
275 * that the panel is attached to.
277 * Return: The number of modes available from the panel on success or a
280 int drm_panel_get_modes(struct drm_panel *panel,
283 if (!panel)
286 if (panel->funcs && panel->funcs->get_modes)
287 return panel->funcs->get_modes(panel, connector);
295 * of_drm_find_panel - look up a panel using a device tree node
296 * @np: device tree node of the panel
299 * tree node. If a matching panel is found, return a pointer to it.
301 * Return: A pointer to the panel registered for the specified device tree
302 * node or an ERR_PTR() if no panel matching the device tree node can be found.
306 * - EPROBE_DEFER: the panel device has not been probed yet, and the caller
312 struct drm_panel *panel;
319 list_for_each_entry(panel, &panel_list, list) {
320 if (panel->dev->of_node == np) {
322 return panel;
332 * of_drm_get_panel_orientation - look up the orientation of the panel through
334 * @np: device tree node of the panel
337 * Looks up the rotation of a panel in the device tree. The orientation of the
338 * panel is expressed as a property name "rotation" in the device tree. The
376 * drm_is_panel_follower() - Check if the device is a panel follower
380 * a panel using the panel follower API.
382 * The "panel" property of the follower points to the panel to be followed.
384 * Return: true if we should be power sequenced with a panel; false otherwise.
389 * The "panel" property is actually a phandle, but for simplicity we
393 return of_property_read_bool(dev->of_node, "panel");
398 * drm_panel_add_follower() - Register something to follow panel state.
400 * @follower: The panel follower descriptor for the follower.
402 * A panel follower is called right after preparing the panel and right before
403 * unpreparing the panel. It's primary intention is to power on an associated
405 * devices are allowed the follow the same panel.
407 * If a follower is added to a panel that's already been turned on, the
411 * The "panel" property of the follower points to the panel to be followed.
414 * follower_dev is not actually following a panel. The caller may
415 * choose to ignore this return value if following a panel is optional.
421 struct drm_panel *panel;
424 panel_np = of_parse_phandle(follower_dev->of_node, "panel", 0);
428 panel = of_drm_find_panel(panel_np);
430 if (IS_ERR(panel))
431 return PTR_ERR(panel);
433 get_device(panel->dev);
434 follower->panel = panel;
436 mutex_lock(&panel->follower_lock);
438 list_add_tail(&follower->list, &panel->followers);
439 if (panel->prepared) {
442 dev_info(panel->dev, "%ps failed: %d\n",
446 mutex_unlock(&panel->follower_lock);
454 * @follower: The panel follower descriptor for the follower.
457 * unprepare function if we're removed from a panel that's currently prepared.
463 struct drm_panel *panel = follower->panel;
466 mutex_lock(&panel->follower_lock);
468 if (panel->prepared) {
471 dev_info(panel->dev, "%ps failed: %d\n",
476 mutex_unlock(&panel->follower_lock);
478 put_device(panel->dev);
490 * @follower: The panel follower descriptor for the follower.
513 * @panel: DRM panel
515 * Use this function to enable backlight handling if your panel
518 * When the panel is enabled backlight will be enabled after a
521 * When the panel is disabled backlight will be disabled before the
524 * A typical implementation for a panel driver supporting device tree
531 int drm_panel_of_backlight(struct drm_panel *panel)
535 if (!panel || !panel->dev)
538 backlight = devm_of_find_backlight(panel->dev);
543 panel->backlight = backlight;
550 MODULE_DESCRIPTION("DRM panel infrastructure");