aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/omap2/displays
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2013-04-03 04:39:19 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2013-04-03 08:19:47 -0400
commit31030985450977d978a1781111a4ddadb86c4ae8 (patch)
treeafb8a72d08a0f76040da317bf5cde5d224fb35d3 /drivers/video/omap2/displays
parent7e930086e739c9eb5bd9ccd2017f26aa87153dd8 (diff)
OMAPDSS: LS037V7DW01: handle gpios in panel driver
Move the GPIO handling from board file's platform callbacks to the panel driver, which gets the gpios via platform data. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video/omap2/displays')
-rw-r--r--drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c71
1 files changed, 60 insertions, 11 deletions
diff --git a/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c b/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c
index eb6bd817a079..e6d9c9bf41f0 100644
--- a/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c
+++ b/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c
@@ -23,11 +23,10 @@
23#include <linux/fb.h> 23#include <linux/fb.h>
24#include <linux/err.h> 24#include <linux/err.h>
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/gpio.h>
26 27
27#include <video/omapdss.h> 28#include <video/omapdss.h>
28 29#include <video/omap-panel-data.h>
29struct sharp_data {
30};
31 30
32static struct omap_video_timings sharp_ls_timings = { 31static struct omap_video_timings sharp_ls_timings = {
33 .x_res = 480, 32 .x_res = 480,
@@ -50,31 +49,67 @@ static struct omap_video_timings sharp_ls_timings = {
50 .sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES, 49 .sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES,
51}; 50};
52 51
52static inline struct panel_sharp_ls037v7dw01_data
53*get_panel_data(const struct omap_dss_device *dssdev)
54{
55 return (struct panel_sharp_ls037v7dw01_data *) dssdev->data;
56}
53 57
54static int sharp_ls_panel_probe(struct omap_dss_device *dssdev) 58static int sharp_ls_panel_probe(struct omap_dss_device *dssdev)
55{ 59{
56 struct sharp_data *sd; 60 struct panel_sharp_ls037v7dw01_data *pd = get_panel_data(dssdev);
61 int r;
62
63 if (!pd)
64 return -EINVAL;
57 65
58 dssdev->panel.timings = sharp_ls_timings; 66 dssdev->panel.timings = sharp_ls_timings;
59 67
60 sd = kzalloc(sizeof(*sd), GFP_KERNEL); 68 if (gpio_is_valid(pd->mo_gpio)) {
61 if (!sd) 69 r = devm_gpio_request_one(&dssdev->dev, pd->mo_gpio,
62 return -ENOMEM; 70 GPIOF_OUT_INIT_LOW, "lcd MO");
71 if (r)
72 return r;
73 }
74
75 if (gpio_is_valid(pd->lr_gpio)) {
76 r = devm_gpio_request_one(&dssdev->dev, pd->lr_gpio,
77 GPIOF_OUT_INIT_HIGH, "lcd LR");
78 if (r)
79 return r;
80 }
63 81
64 dev_set_drvdata(&dssdev->dev, sd); 82 if (gpio_is_valid(pd->ud_gpio)) {
83 r = devm_gpio_request_one(&dssdev->dev, pd->ud_gpio,
84 GPIOF_OUT_INIT_HIGH, "lcd UD");
85 if (r)
86 return r;
87 }
88
89 if (gpio_is_valid(pd->resb_gpio)) {
90 r = devm_gpio_request_one(&dssdev->dev, pd->resb_gpio,
91 GPIOF_OUT_INIT_LOW, "lcd RESB");
92 if (r)
93 return r;
94 }
95
96 if (gpio_is_valid(pd->ini_gpio)) {
97 r = devm_gpio_request_one(&dssdev->dev, pd->ini_gpio,
98 GPIOF_OUT_INIT_LOW, "lcd INI");
99 if (r)
100 return r;
101 }
65 102
66 return 0; 103 return 0;
67} 104}
68 105
69static void __exit sharp_ls_panel_remove(struct omap_dss_device *dssdev) 106static void __exit sharp_ls_panel_remove(struct omap_dss_device *dssdev)
70{ 107{
71 struct sharp_data *sd = dev_get_drvdata(&dssdev->dev);
72
73 kfree(sd);
74} 108}
75 109
76static int sharp_ls_power_on(struct omap_dss_device *dssdev) 110static int sharp_ls_power_on(struct omap_dss_device *dssdev)
77{ 111{
112 struct panel_sharp_ls037v7dw01_data *pd = get_panel_data(dssdev);
78 int r = 0; 113 int r = 0;
79 114
80 if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) 115 if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE)
@@ -96,6 +131,12 @@ static int sharp_ls_power_on(struct omap_dss_device *dssdev)
96 goto err1; 131 goto err1;
97 } 132 }
98 133
134 if (gpio_is_valid(pd->resb_gpio))
135 gpio_set_value_cansleep(pd->resb_gpio, 1);
136
137 if (gpio_is_valid(pd->ini_gpio))
138 gpio_set_value_cansleep(pd->ini_gpio, 1);
139
99 return 0; 140 return 0;
100err1: 141err1:
101 omapdss_dpi_display_disable(dssdev); 142 omapdss_dpi_display_disable(dssdev);
@@ -105,9 +146,17 @@ err0:
105 146
106static void sharp_ls_power_off(struct omap_dss_device *dssdev) 147static void sharp_ls_power_off(struct omap_dss_device *dssdev)
107{ 148{
149 struct panel_sharp_ls037v7dw01_data *pd = get_panel_data(dssdev);
150
108 if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) 151 if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
109 return; 152 return;
110 153
154 if (gpio_is_valid(pd->ini_gpio))
155 gpio_set_value_cansleep(pd->ini_gpio, 0);
156
157 if (gpio_is_valid(pd->resb_gpio))
158 gpio_set_value_cansleep(pd->resb_gpio, 0);
159
111 if (dssdev->platform_disable) 160 if (dssdev->platform_disable)
112 dssdev->platform_disable(dssdev); 161 dssdev->platform_disable(dssdev);
113 162