Lines Matching refs: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 0 on
280 int drm_panel_get_modes(struct drm_panel *panel,
283 if (!panel)
286 if (panel->funcs && panel->funcs->get_modes) {
289 num = panel->funcs->get_modes(panel, connector);
300 * of_drm_find_panel - look up a panel using a device tree node
301 * @np: device tree node of the panel
304 * tree node. If a matching panel is found, return a pointer to it.
306 * Return: A pointer to the panel registered for the specified device tree
307 * node or an ERR_PTR() if no panel matching the device tree node can be found.
311 * - EPROBE_DEFER: the panel device has not been probed yet, and the caller
317 struct drm_panel *panel;
324 list_for_each_entry(panel, &panel_list, list) {
325 if (panel->dev->of_node == np) {
327 return panel;
337 * of_drm_get_panel_orientation - look up the orientation of the panel through
339 * @np: device tree node of the panel
342 * Looks up the rotation of a panel in the device tree. The orientation of the
343 * panel is expressed as a property name "rotation" in the device tree. The
381 * drm_is_panel_follower() - Check if the device is a panel follower
385 * a panel using the panel follower API.
387 * The "panel" property of the follower points to the panel to be followed.
389 * Return: true if we should be power sequenced with a panel; false otherwise.
394 * The "panel" property is actually a phandle, but for simplicity we
398 return of_property_read_bool(dev->of_node, "panel");
403 * drm_panel_add_follower() - Register something to follow panel state.
405 * @follower: The panel follower descriptor for the follower.
407 * A panel follower is called right after preparing the panel and right before
408 * unpreparing the panel. It's primary intention is to power on an associated
410 * devices are allowed the follow the same panel.
412 * If a follower is added to a panel that's already been turned on, the
416 * The "panel" property of the follower points to the panel to be followed.
419 * follower_dev is not actually following a panel. The caller may
420 * choose to ignore this return value if following a panel is optional.
426 struct drm_panel *panel;
429 panel_np = of_parse_phandle(follower_dev->of_node, "panel", 0);
433 panel = of_drm_find_panel(panel_np);
435 if (IS_ERR(panel))
436 return PTR_ERR(panel);
438 get_device(panel->dev);
439 follower->panel = panel;
441 mutex_lock(&panel->follower_lock);
443 list_add_tail(&follower->list, &panel->followers);
444 if (panel->prepared) {
447 dev_info(panel->dev, "%ps failed: %d\n",
451 mutex_unlock(&panel->follower_lock);
459 * @follower: The panel follower descriptor for the follower.
462 * unprepare function if we're removed from a panel that's currently prepared.
468 struct drm_panel *panel = follower->panel;
471 mutex_lock(&panel->follower_lock);
473 if (panel->prepared) {
476 dev_info(panel->dev, "%ps failed: %d\n",
481 mutex_unlock(&panel->follower_lock);
483 put_device(panel->dev);
495 * @follower: The panel follower descriptor for the follower.
518 * @panel: DRM panel
520 * Use this function to enable backlight handling if your panel
523 * When the panel is enabled backlight will be enabled after a
526 * When the panel is disabled backlight will be disabled before the
529 * A typical implementation for a panel driver supporting device tree
536 int drm_panel_of_backlight(struct drm_panel *panel)
540 if (!panel || !panel->dev)
543 backlight = devm_of_find_backlight(panel->dev);
548 panel->backlight = backlight;
555 MODULE_DESCRIPTION("DRM panel infrastructure");