aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/omap2/dss/output.c
diff options
context:
space:
mode:
authorArchit Taneja <archit@ti.com>2012-08-29 04:00:15 -0400
committerArchit Taneja <archit@ti.com>2012-09-26 07:01:46 -0400
commit6d71b923e53184808b0206ebd74159c41a2dcf38 (patch)
tree6873941b6b3a22e31c101bccbf5eeb9fedf77069 /drivers/video/omap2/dss/output.c
parent81b87f515f6abbbe4eef42835065db9d0831ef35 (diff)
OMAPDSS: output: Add set/unset device ops for omap_dss_output
An output entity represented by the struct omap_dss_output connects to a omap_dss_device entity. Add functions to set or unset an output's device. This is similar to how managers and devices were connected previously. An output can connect to a device without being connected to a manager. However, the output needs to eventually connect to a manager so that the connected panel can be enabled. Keep the omap_overlay_manager pointer in omap_dss_device for now to prevent breaking things. This will be removed later when outputs are supported completely. Signed-off-by: Archit Taneja <archit@ti.com>
Diffstat (limited to 'drivers/video/omap2/dss/output.c')
-rw-r--r--drivers/video/omap2/dss/output.c67
1 files changed, 67 insertions, 0 deletions
diff --git a/drivers/video/omap2/dss/output.c b/drivers/video/omap2/dss/output.c
index 388a6c997b9c..1a84b79d5580 100644
--- a/drivers/video/omap2/dss/output.c
+++ b/drivers/video/omap2/dss/output.c
@@ -16,6 +16,7 @@
16 */ 16 */
17 17
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/module.h>
19#include <linux/platform_device.h> 20#include <linux/platform_device.h>
20#include <linux/slab.h> 21#include <linux/slab.h>
21 22
@@ -24,6 +25,72 @@
24#include "dss.h" 25#include "dss.h"
25 26
26static LIST_HEAD(output_list); 27static LIST_HEAD(output_list);
28static DEFINE_MUTEX(output_lock);
29
30int omapdss_output_set_device(struct omap_dss_output *out,
31 struct omap_dss_device *dssdev)
32{
33 int r;
34
35 mutex_lock(&output_lock);
36
37 if (out->device) {
38 DSSERR("output already has device %s connected to it\n",
39 out->device->name);
40 r = -EINVAL;
41 goto err;
42 }
43
44 if (out->type != dssdev->type) {
45 DSSERR("output type and display type don't match\n");
46 r = -EINVAL;
47 goto err;
48 }
49
50 out->device = dssdev;
51 dssdev->output = out;
52
53 mutex_unlock(&output_lock);
54
55 return 0;
56err:
57 mutex_unlock(&output_lock);
58
59 return r;
60}
61EXPORT_SYMBOL(omapdss_output_set_device);
62
63int omapdss_output_unset_device(struct omap_dss_output *out)
64{
65 int r;
66
67 mutex_lock(&output_lock);
68
69 if (!out->device) {
70 DSSERR("output doesn't have a device connected to it\n");
71 r = -EINVAL;
72 goto err;
73 }
74
75 if (out->device->state != OMAP_DSS_DISPLAY_DISABLED) {
76 DSSERR("device %s is not disabled, cannot unset device\n",
77 out->device->name);
78 r = -EINVAL;
79 goto err;
80 }
81
82 out->device->output = NULL;
83 out->device = NULL;
84
85 mutex_unlock(&output_lock);
86
87 return 0;
88err:
89 mutex_unlock(&output_lock);
90
91 return r;
92}
93EXPORT_SYMBOL(omapdss_output_unset_device);
27 94
28void dss_register_output(struct omap_dss_output *out) 95void dss_register_output(struct omap_dss_output *out)
29{ 96{