• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/drivers/staging/msm/
1/* Copyright (c) 2008-2009, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15 * 02110-1301, USA.
16 */
17
18#include <linux/module.h>
19#include <linux/moduleparam.h>
20#include <linux/kernel.h>
21#include <linux/slab.h>
22#include <linux/delay.h>
23#include <linux/mm.h>
24#include <linux/fb.h>
25#include <linux/init.h>
26#include <linux/ioport.h>
27#include <linux/device.h>
28#include <linux/dma-mapping.h>
29#include <linux/uaccess.h>
30#include <linux/workqueue.h>
31#include <linux/string.h>
32#include <linux/version.h>
33#include <linux/proc_fs.h>
34#include <linux/vmalloc.h>
35#include <linux/debugfs.h>
36
37#include "msm_fb_panel.h"
38
39int panel_next_on(struct platform_device *pdev)
40{
41	int ret = 0;
42	struct msm_fb_panel_data *pdata;
43	struct msm_fb_panel_data *next_pdata;
44	struct platform_device *next_pdev;
45
46	pdata = (struct msm_fb_panel_data *)pdev->dev.platform_data;
47
48	if (pdata) {
49		next_pdev = pdata->next;
50		if (next_pdev) {
51			next_pdata =
52			    (struct msm_fb_panel_data *)next_pdev->dev.
53			    platform_data;
54			if ((next_pdata) && (next_pdata->on))
55				ret = next_pdata->on(next_pdev);
56		}
57	}
58
59	return ret;
60}
61
62int panel_next_off(struct platform_device *pdev)
63{
64	int ret = 0;
65	struct msm_fb_panel_data *pdata;
66	struct msm_fb_panel_data *next_pdata;
67	struct platform_device *next_pdev;
68
69	pdata = (struct msm_fb_panel_data *)pdev->dev.platform_data;
70
71	if (pdata) {
72		next_pdev = pdata->next;
73		if (next_pdev) {
74			next_pdata =
75			    (struct msm_fb_panel_data *)next_pdev->dev.
76			    platform_data;
77			if ((next_pdata) && (next_pdata->on))
78				ret = next_pdata->off(next_pdev);
79		}
80	}
81
82	return ret;
83}
84
85struct platform_device *msm_fb_device_alloc(struct msm_fb_panel_data *pdata,
86						u32 type, u32 id)
87{
88	struct platform_device *this_dev = NULL;
89	char dev_name[16];
90
91	switch (type) {
92	case EBI2_PANEL:
93		snprintf(dev_name, sizeof(dev_name), "ebi2_lcd");
94		break;
95
96	case MDDI_PANEL:
97		snprintf(dev_name, sizeof(dev_name), "mddi");
98		break;
99
100	case EXT_MDDI_PANEL:
101		snprintf(dev_name, sizeof(dev_name), "mddi_ext");
102		break;
103
104	case TV_PANEL:
105		snprintf(dev_name, sizeof(dev_name), "tvenc");
106		break;
107
108	case HDMI_PANEL:
109	case LCDC_PANEL:
110		snprintf(dev_name, sizeof(dev_name), "lcdc");
111		break;
112
113	default:
114		return NULL;
115	}
116
117	if (pdata != NULL)
118		pdata->next = NULL;
119	else
120		return NULL;
121
122	this_dev =
123	    platform_device_alloc(dev_name, ((u32) type << 16) | (u32) id);
124
125	if (this_dev) {
126		if (platform_device_add_data
127		    (this_dev, pdata, sizeof(struct msm_fb_panel_data))) {
128			printk
129			    ("msm_fb_device_alloc: platform_device_add_data failed!\n");
130			platform_device_put(this_dev);
131			return NULL;
132		}
133	}
134
135	return this_dev;
136}
137