aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_panel.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-01-29 23:49:12 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-29 23:49:12 -0500
commit9b0cd304f26b9fca140de15deeac2bf357d1f388 (patch)
tree03a0d74614865a5b776b2a98a433232013b1d369 /drivers/gpu/drm/drm_panel.c
parentca2a650f3dfdc30d71d21bcbb04d2d057779f3f9 (diff)
parentef64cf9d06049e4e9df661f3be60b217e476bee1 (diff)
Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux
Pull drm updates from Dave Airlie: "Been a bit busy, first week of kids school, and waiting on other trees to go in before I could send this, so its a bit later than I'd normally like. Highlights: - core: timestamp fixes, lots of misc cleanups - new drivers: bochs virtual vga - vmwgfx: major overhaul for their nextgen virt gpu. - i915: runtime D3 on HSW, watermark fixes, power well work, fbc fixes, bdw is no longer prelim. - nouveau: gk110/208 acceleration, more pm groundwork, old overlay support - radeon: dpm rework and clockgating for CIK, pci config reset, big endian fixes - tegra: panel support and DSI support, build as module, prime. - armada, omap, gma500, rcar, exynos, mgag200, cirrus, ast: fixes - msm: hdmi support for mdp5" * 'drm-next' of git://people.freedesktop.org/~airlied/linux: (595 commits) drm/nouveau: resume display if any later suspend bits fail drm/nouveau: fix lock unbalance in nouveau_crtc_page_flip drm/nouveau: implement hooks for needed for drm vblank timestamping support drm/nouveau/disp: add a method to fetch info needed by drm vblank timestamping drm/nv50: fill in crtc mode struct members from crtc_mode_fixup drm/radeon/dce8: workaround for atom BlankCrtc table drm/radeon/DCE4+: clear bios scratch dpms bit (v2) drm/radeon: set si_notify_smc_display_change properly drm/radeon: fix DAC interrupt handling on DCE5+ drm/radeon: clean up active vram sizing drm/radeon: skip async dma init on r6xx drm/radeon/runpm: don't runtime suspend non-PX cards drm/radeon: add ring to fence trace functions drm/radeon: add missing trace point drm/radeon: fix VMID use tracking drm: ast,cirrus,mgag200: use drm_can_sleep drm/gma500: Lock struct_mutex around cursor updates drm/i915: Fix the offset issue for the stolen GEM objects DRM: armada: fix missing DRM_KMS_FB_HELPER select drm/i915: Decouple GPU error reporting from ring initialisation ...
Diffstat (limited to 'drivers/gpu/drm/drm_panel.c')
-rw-r--r--drivers/gpu/drm/drm_panel.c100
1 files changed, 100 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
new file mode 100644
index 000000000000..2ef988e037b7
--- /dev/null
+++ b/drivers/gpu/drm/drm_panel.c
@@ -0,0 +1,100 @@
1/*
2 * Copyright (C) 2013, NVIDIA Corporation. All rights reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sub license,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the
12 * next paragraph) shall be included in all copies or substantial portions
13 * of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
22 */
23
24#include <linux/err.h>
25#include <linux/module.h>
26
27#include <drm/drm_crtc.h>
28#include <drm/drm_panel.h>
29
30static DEFINE_MUTEX(panel_lock);
31static LIST_HEAD(panel_list);
32
33void drm_panel_init(struct drm_panel *panel)
34{
35 INIT_LIST_HEAD(&panel->list);
36}
37EXPORT_SYMBOL(drm_panel_init);
38
39int drm_panel_add(struct drm_panel *panel)
40{
41 mutex_lock(&panel_lock);
42 list_add_tail(&panel->list, &panel_list);
43 mutex_unlock(&panel_lock);
44
45 return 0;
46}
47EXPORT_SYMBOL(drm_panel_add);
48
49void drm_panel_remove(struct drm_panel *panel)
50{
51 mutex_lock(&panel_lock);
52 list_del_init(&panel->list);
53 mutex_unlock(&panel_lock);
54}
55EXPORT_SYMBOL(drm_panel_remove);
56
57int drm_panel_attach(struct drm_panel *panel, struct drm_connector *connector)
58{
59 if (panel->connector)
60 return -EBUSY;
61
62 panel->connector = connector;
63 panel->drm = connector->dev;
64
65 return 0;
66}
67EXPORT_SYMBOL(drm_panel_attach);
68
69int drm_panel_detach(struct drm_panel *panel)
70{
71 panel->connector = NULL;
72 panel->drm = NULL;
73
74 return 0;
75}
76EXPORT_SYMBOL(drm_panel_detach);
77
78#ifdef CONFIG_OF
79struct drm_panel *of_drm_find_panel(struct device_node *np)
80{
81 struct drm_panel *panel;
82
83 mutex_lock(&panel_lock);
84
85 list_for_each_entry(panel, &panel_list, list) {
86 if (panel->dev->of_node == np) {
87 mutex_unlock(&panel_lock);
88 return panel;
89 }
90 }
91
92 mutex_unlock(&panel_lock);
93 return NULL;
94}
95EXPORT_SYMBOL(of_drm_find_panel);
96#endif
97
98MODULE_AUTHOR("Thierry Reding <treding@nvidia.com>");
99MODULE_DESCRIPTION("DRM panel infrastructure");
100MODULE_LICENSE("GPL and additional rights");