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,
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)
166 * - Your panel driver incorrectly calls drm_panel_unprepare() in its
168 * - You are using panel-edp or panel-simple and your DRM modeset
169 * driver's shutdown() callback happened after the panel's shutdown().
173 if (!panel->prepared) {
174 dev_warn(panel->dev, "Skipping unprepare of already unprepared panel\n");
178 mutex_lock(&panel->follower_lock);
180 list_for_each_entry(follower, &panel->followers, list) {
183 dev_info(panel->dev, "%ps failed: %d\n",
187 if (panel->funcs && panel->funcs->unprepare) {
188 ret = panel->funcs->unprepare(panel);
192 panel->prepared = false;
196 mutex_unlock(&panel->follower_lock);
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)
216 if (!panel)
219 if (panel->enabled) {
220 dev_warn(panel->dev, "Skipping enable of already enabled panel\n");
224 if (panel->funcs && panel->funcs->enable) {
225 ret = panel->funcs->enable(panel);
229 panel->enabled = true;
231 ret = backlight_enable(panel->backlight);
233 DRM_DEV_INFO(panel->dev, "failed to enable backlight: %d\n",
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)
254 if (!panel)
259 * - Your panel driver incorrectly calls drm_panel_disable() in its
261 * - You are using panel-edp or panel-simple and your DRM modeset
262 * driver's shutdown() callback happened after the panel's shutdown().
266 if (!panel->enabled) {
267 dev_warn(panel->dev, "Skipping disable of already disabled panel\n");
271 ret = backlight_disable(panel->backlight);
273 DRM_DEV_INFO(panel->dev, "failed to disable backlight: %d\n",
276 if (panel->funcs && panel->funcs->disable) {
277 ret = panel->funcs->disable(panel);
281 panel->enabled = false;
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,
301 if (!panel)
304 if (panel->funcs && panel->funcs->get_modes) {
307 num = panel->funcs->get_modes(panel, connector);
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;
342 list_for_each_entry(panel, &panel_list, list) {
343 if (panel->dev->of_node == np) {
345 return 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
416 return of_property_read_bool(dev->of_node, "panel");
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;
447 panel_np = of_parse_phandle(follower_dev->of_node, "panel", 0);
451 panel = of_drm_find_panel(panel_np);
453 if (IS_ERR(panel))
454 return PTR_ERR(panel);
456 get_device(panel->dev);
457 follower->panel = panel;
459 mutex_lock(&panel->follower_lock);
461 list_add_tail(&follower->list, &panel->followers);
462 if (panel->prepared) {
465 dev_info(panel->dev, "%ps failed: %d\n",
469 mutex_unlock(&panel->follower_lock);
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;
489 mutex_lock(&panel->follower_lock);
491 if (panel->prepared) {
494 dev_info(panel->dev, "%ps failed: %d\n",
499 mutex_unlock(&panel->follower_lock);
501 put_device(panel->dev);
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)
558 if (!panel || !panel->dev)
561 backlight = devm_of_find_backlight(panel->dev);
566 panel->backlight = backlight;
573 MODULE_DESCRIPTION("DRM panel infrastructure");