ARM: pmu: add support for interrupt-affinity property
[linux/fpc-iii.git] / drivers / gpu / drm / drm_bridge.c
blobd1187e571c6dd038648aa86b73d0cb2ddd526792
1 /*
2 * Copyright (c) 2014 Samsung Electronics Co., Ltd
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:
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.
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.
24 #include <linux/err.h>
25 #include <linux/module.h>
27 #include <drm/drm_crtc.h>
29 #include "drm/drmP.h"
31 static DEFINE_MUTEX(bridge_lock);
32 static LIST_HEAD(bridge_list);
34 int drm_bridge_add(struct drm_bridge *bridge)
36 mutex_lock(&bridge_lock);
37 list_add_tail(&bridge->list, &bridge_list);
38 mutex_unlock(&bridge_lock);
40 return 0;
42 EXPORT_SYMBOL(drm_bridge_add);
44 void drm_bridge_remove(struct drm_bridge *bridge)
46 mutex_lock(&bridge_lock);
47 list_del_init(&bridge->list);
48 mutex_unlock(&bridge_lock);
50 EXPORT_SYMBOL(drm_bridge_remove);
52 extern int drm_bridge_attach(struct drm_device *dev, struct drm_bridge *bridge)
54 if (!dev || !bridge)
55 return -EINVAL;
57 if (bridge->dev)
58 return -EBUSY;
60 bridge->dev = dev;
62 if (bridge->funcs->attach)
63 return bridge->funcs->attach(bridge);
65 return 0;
67 EXPORT_SYMBOL(drm_bridge_attach);
69 #ifdef CONFIG_OF
70 struct drm_bridge *of_drm_find_bridge(struct device_node *np)
72 struct drm_bridge *bridge;
74 mutex_lock(&bridge_lock);
76 list_for_each_entry(bridge, &bridge_list, list) {
77 if (bridge->of_node == np) {
78 mutex_unlock(&bridge_lock);
79 return bridge;
83 mutex_unlock(&bridge_lock);
84 return NULL;
86 EXPORT_SYMBOL(of_drm_find_bridge);
87 #endif
89 MODULE_AUTHOR("Ajay Kumar <ajaykumar.rs@samsung.com>");
90 MODULE_DESCRIPTION("DRM bridge infrastructure");
91 MODULE_LICENSE("GPL and additional rights");