aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Reding <thierry.reding@gmail.com>2016-05-06 10:01:37 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2016-05-06 10:04:48 -0400
commit83127f67e450a9a0882da495d59c88a71da25389 (patch)
treed6df2f41d7dbc35ea0918af7ec00b81ac4c80a62
parent445d84a42bf17128e22101a04cde17b9a7c2e235 (diff)
drm/panel: Flesh out kerneldoc
Write more complete kerneldoc comments for the DRM panel API and integrate the helpers in the DRM DocBook reference. Signed-off-by: Thierry Reding <treding@nvidia.com>drm/panel: Add helper for simple panel connector Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/20160506140137.GA4641@ulmo.ba.sec
-rw-r--r--Documentation/DocBook/gpu.tmpl12
-rw-r--r--drivers/gpu/drm/drm_panel.c61
-rw-r--r--include/drm/drm_panel.h59
3 files changed, 129 insertions, 3 deletions
diff --git a/Documentation/DocBook/gpu.tmpl b/Documentation/DocBook/gpu.tmpl
index 56386d3a1b2e..9dd48f7490df 100644
--- a/Documentation/DocBook/gpu.tmpl
+++ b/Documentation/DocBook/gpu.tmpl
@@ -1671,17 +1671,23 @@ void intel_crt_init(struct drm_device *dev)
1671!Pdrivers/gpu/drm/drm_crtc.c Tile group 1671!Pdrivers/gpu/drm/drm_crtc.c Tile group
1672 </sect2> 1672 </sect2>
1673 <sect2> 1673 <sect2>
1674 <title>Bridges</title> 1674 <title>Bridges</title>
1675 <sect3> 1675 <sect3>
1676 <title>Overview</title> 1676 <title>Overview</title>
1677!Pdrivers/gpu/drm/drm_bridge.c overview 1677!Pdrivers/gpu/drm/drm_bridge.c overview
1678 </sect3> 1678 </sect3>
1679 <sect3> 1679 <sect3>
1680 <title>Default bridge callback sequence</title> 1680 <title>Default bridge callback sequence</title>
1681!Pdrivers/gpu/drm/drm_bridge.c bridge callbacks 1681!Pdrivers/gpu/drm/drm_bridge.c bridge callbacks
1682 </sect3> 1682 </sect3>
1683!Edrivers/gpu/drm/drm_bridge.c 1683!Edrivers/gpu/drm/drm_bridge.c
1684 </sect2> 1684 </sect2>
1685 <sect2>
1686 <title>Panel Helper Reference</title>
1687!Iinclude/drm/drm_panel.h
1688!Edrivers/gpu/drm/drm_panel.c
1689!Pdrivers/gpu/drm/drm_panel.c drm panel
1690 </sect2>
1685 </sect1> 1691 </sect1>
1686 1692
1687 <!-- Internals: kms properties --> 1693 <!-- Internals: kms properties -->
diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
index 2ef988e037b7..3dfe3c886502 100644
--- a/drivers/gpu/drm/drm_panel.c
+++ b/drivers/gpu/drm/drm_panel.c
@@ -30,12 +30,36 @@
30static DEFINE_MUTEX(panel_lock); 30static DEFINE_MUTEX(panel_lock);
31static LIST_HEAD(panel_list); 31static LIST_HEAD(panel_list);
32 32
33/**
34 * DOC: drm panel
35 *
36 * The DRM panel helpers allow drivers to register panel objects with a
37 * central registry and provide functions to retrieve those panels in display
38 * drivers.
39 */
40
41/**
42 * drm_panel_init - initialize a panel
43 * @panel: DRM panel
44 *
45 * Sets up internal fields of the panel so that it can subsequently be added
46 * to the registry.
47 */
33void drm_panel_init(struct drm_panel *panel) 48void drm_panel_init(struct drm_panel *panel)
34{ 49{
35 INIT_LIST_HEAD(&panel->list); 50 INIT_LIST_HEAD(&panel->list);
36} 51}
37EXPORT_SYMBOL(drm_panel_init); 52EXPORT_SYMBOL(drm_panel_init);
38 53
54/**
55 * drm_panel_add - add a panel to the global registry
56 * @panel: panel to add
57 *
58 * Add a panel to the global registry so that it can be looked up by display
59 * drivers.
60 *
61 * Return: 0 on success or a negative error code on failure.
62 */
39int drm_panel_add(struct drm_panel *panel) 63int drm_panel_add(struct drm_panel *panel)
40{ 64{
41 mutex_lock(&panel_lock); 65 mutex_lock(&panel_lock);
@@ -46,6 +70,12 @@ int drm_panel_add(struct drm_panel *panel)
46} 70}
47EXPORT_SYMBOL(drm_panel_add); 71EXPORT_SYMBOL(drm_panel_add);
48 72
73/**
74 * drm_panel_remove - remove a panel from the global registry
75 * @panel: DRM panel
76 *
77 * Removes a panel from the global registry.
78 */
49void drm_panel_remove(struct drm_panel *panel) 79void drm_panel_remove(struct drm_panel *panel)
50{ 80{
51 mutex_lock(&panel_lock); 81 mutex_lock(&panel_lock);
@@ -54,6 +84,18 @@ void drm_panel_remove(struct drm_panel *panel)
54} 84}
55EXPORT_SYMBOL(drm_panel_remove); 85EXPORT_SYMBOL(drm_panel_remove);
56 86
87/**
88 * drm_panel_attach - attach a panel to a connector
89 * @panel: DRM panel
90 * @connector: DRM connector
91 *
92 * After obtaining a pointer to a DRM panel a display driver calls this
93 * function to attach a panel to a connector.
94 *
95 * An error is returned if the panel is already attached to another connector.
96 *
97 * Return: 0 on success or a negative error code on failure.
98 */
57int drm_panel_attach(struct drm_panel *panel, struct drm_connector *connector) 99int drm_panel_attach(struct drm_panel *panel, struct drm_connector *connector)
58{ 100{
59 if (panel->connector) 101 if (panel->connector)
@@ -66,6 +108,15 @@ int drm_panel_attach(struct drm_panel *panel, struct drm_connector *connector)
66} 108}
67EXPORT_SYMBOL(drm_panel_attach); 109EXPORT_SYMBOL(drm_panel_attach);
68 110
111/**
112 * drm_panel_detach - detach a panel from a connector
113 * @panel: DRM panel
114 *
115 * Detaches a panel from the connector it is attached to. If a panel is not
116 * attached to any connector this is effectively a no-op.
117 *
118 * Return: 0 on success or a negative error code on failure.
119 */
69int drm_panel_detach(struct drm_panel *panel) 120int drm_panel_detach(struct drm_panel *panel)
70{ 121{
71 panel->connector = NULL; 122 panel->connector = NULL;
@@ -76,6 +127,16 @@ int drm_panel_detach(struct drm_panel *panel)
76EXPORT_SYMBOL(drm_panel_detach); 127EXPORT_SYMBOL(drm_panel_detach);
77 128
78#ifdef CONFIG_OF 129#ifdef CONFIG_OF
130/**
131 * of_drm_find_panel - look up a panel using a device tree node
132 * @np: device tree node of the panel
133 *
134 * Searches the set of registered panels for one that matches the given device
135 * tree node. If a matching panel is found, return a pointer to it.
136 *
137 * Return: A pointer to the panel registered for the specified device tree
138 * node or NULL if no panel matching the device tree node can be found.
139 */
79struct drm_panel *of_drm_find_panel(struct device_node *np) 140struct drm_panel *of_drm_find_panel(struct device_node *np)
80{ 141{
81 struct drm_panel *panel; 142 struct drm_panel *panel;
diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
index 13ff44b28893..220d1e2b3db1 100644
--- a/include/drm/drm_panel.h
+++ b/include/drm/drm_panel.h
@@ -75,6 +75,14 @@ struct drm_panel_funcs {
75 struct display_timing *timings); 75 struct display_timing *timings);
76}; 76};
77 77
78/**
79 * struct drm_panel - DRM panel object
80 * @drm: DRM device owning the panel
81 * @connector: DRM connector that the panel is attached to
82 * @dev: parent device of the panel
83 * @funcs: operations that can be performed on the panel
84 * @list: panel entry in registry
85 */
78struct drm_panel { 86struct drm_panel {
79 struct drm_device *drm; 87 struct drm_device *drm;
80 struct drm_connector *connector; 88 struct drm_connector *connector;
@@ -85,6 +93,17 @@ struct drm_panel {
85 struct list_head list; 93 struct list_head list;
86}; 94};
87 95
96/**
97 * drm_disable_unprepare - power off a panel
98 * @panel: DRM panel
99 *
100 * Calling this function will completely power off a panel (assert the panel's
101 * reset, turn off power supplies, ...). After this function has completed, it
102 * is usually no longer possible to communicate with the panel until another
103 * call to drm_panel_prepare().
104 *
105 * Return: 0 on success or a negative error code on failure.
106 */
88static inline int drm_panel_unprepare(struct drm_panel *panel) 107static inline int drm_panel_unprepare(struct drm_panel *panel)
89{ 108{
90 if (panel && panel->funcs && panel->funcs->unprepare) 109 if (panel && panel->funcs && panel->funcs->unprepare)
@@ -93,6 +112,16 @@ static inline int drm_panel_unprepare(struct drm_panel *panel)
93 return panel ? -ENOSYS : -EINVAL; 112 return panel ? -ENOSYS : -EINVAL;
94} 113}
95 114
115/**
116 * drm_panel_disable - disable a panel
117 * @panel: DRM panel
118 *
119 * This will typically turn off the panel's backlight or disable the display
120 * drivers. For smart panels it should still be possible to communicate with
121 * the integrated circuitry via any command bus after this call.
122 *
123 * Return: 0 on success or a negative error code on failure.
124 */
96static inline int drm_panel_disable(struct drm_panel *panel) 125static inline int drm_panel_disable(struct drm_panel *panel)
97{ 126{
98 if (panel && panel->funcs && panel->funcs->disable) 127 if (panel && panel->funcs && panel->funcs->disable)
@@ -101,6 +130,16 @@ static inline int drm_panel_disable(struct drm_panel *panel)
101 return panel ? -ENOSYS : -EINVAL; 130 return panel ? -ENOSYS : -EINVAL;
102} 131}
103 132
133/**
134 * drm_panel_prepare - power on a panel
135 * @panel: DRM panel
136 *
137 * Calling this function will enable power and deassert any reset signals to
138 * the panel. After this has completed it is possible to communicate with any
139 * integrated circuitry via a command bus.
140 *
141 * Return: 0 on success or a negative error code on failure.
142 */
104static inline int drm_panel_prepare(struct drm_panel *panel) 143static inline int drm_panel_prepare(struct drm_panel *panel)
105{ 144{
106 if (panel && panel->funcs && panel->funcs->prepare) 145 if (panel && panel->funcs && panel->funcs->prepare)
@@ -109,6 +148,16 @@ static inline int drm_panel_prepare(struct drm_panel *panel)
109 return panel ? -ENOSYS : -EINVAL; 148 return panel ? -ENOSYS : -EINVAL;
110} 149}
111 150
151/**
152 * drm_panel_enable - enable a panel
153 * @panel: DRM panel
154 *
155 * Calling this function will cause the panel display drivers to be turned on
156 * and the backlight to be enabled. Content will be visible on screen after
157 * this call completes.
158 *
159 * Return: 0 on success or a negative error code on failure.
160 */
112static inline int drm_panel_enable(struct drm_panel *panel) 161static inline int drm_panel_enable(struct drm_panel *panel)
113{ 162{
114 if (panel && panel->funcs && panel->funcs->enable) 163 if (panel && panel->funcs && panel->funcs->enable)
@@ -117,6 +166,16 @@ static inline int drm_panel_enable(struct drm_panel *panel)
117 return panel ? -ENOSYS : -EINVAL; 166 return panel ? -ENOSYS : -EINVAL;
118} 167}
119 168
169/**
170 * drm_panel_get_modes - probe the available display modes of a panel
171 * @panel: DRM panel
172 *
173 * The modes probed from the panel are automatically added to the connector
174 * that the panel is attached to.
175 *
176 * Return: The number of modes available from the panel on success or a
177 * negative error code on failure.
178 */
120static inline int drm_panel_get_modes(struct drm_panel *panel) 179static inline int drm_panel_get_modes(struct drm_panel *panel)
121{ 180{
122 if (panel && panel->funcs && panel->funcs->get_modes) 181 if (panel && panel->funcs && panel->funcs->get_modes)