aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/video/fbdev/omap2/displays-new/panel-sharp-ls037v7dw01.c108
1 files changed, 54 insertions, 54 deletions
diff --git a/drivers/video/fbdev/omap2/displays-new/panel-sharp-ls037v7dw01.c b/drivers/video/fbdev/omap2/displays-new/panel-sharp-ls037v7dw01.c
index b2f710be565d..015d49300f2f 100644
--- a/drivers/video/fbdev/omap2/displays-new/panel-sharp-ls037v7dw01.c
+++ b/drivers/video/fbdev/omap2/displays-new/panel-sharp-ls037v7dw01.c
@@ -26,11 +26,11 @@ struct panel_drv_data {
26 26
27 struct omap_video_timings videomode; 27 struct omap_video_timings videomode;
28 28
29 int resb_gpio; 29 struct gpio_desc *resb_gpio; /* low = reset active min 20 us */
30 int ini_gpio; 30 struct gpio_desc *ini_gpio; /* high = power on */
31 int mo_gpio; 31 struct gpio_desc *mo_gpio; /* low = 480x640, high = 240x320 */
32 int lr_gpio; 32 struct gpio_desc *lr_gpio; /* high = conventional horizontal scanning */
33 int ud_gpio; 33 struct gpio_desc *ud_gpio; /* high = conventional vertical scanning */
34}; 34};
35 35
36static const struct omap_video_timings sharp_ls_timings = { 36static const struct omap_video_timings sharp_ls_timings = {
@@ -105,11 +105,11 @@ static int sharp_ls_enable(struct omap_dss_device *dssdev)
105 /* wait couple of vsyncs until enabling the LCD */ 105 /* wait couple of vsyncs until enabling the LCD */
106 msleep(50); 106 msleep(50);
107 107
108 if (gpio_is_valid(ddata->resb_gpio)) 108 if (ddata->resb_gpio)
109 gpio_set_value_cansleep(ddata->resb_gpio, 1); 109 gpiod_set_value_cansleep(ddata->resb_gpio, 1);
110 110
111 if (gpio_is_valid(ddata->ini_gpio)) 111 if (ddata->ini_gpio)
112 gpio_set_value_cansleep(ddata->ini_gpio, 1); 112 gpiod_set_value_cansleep(ddata->ini_gpio, 1);
113 113
114 dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; 114 dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
115 115
@@ -124,11 +124,11 @@ static void sharp_ls_disable(struct omap_dss_device *dssdev)
124 if (!omapdss_device_is_enabled(dssdev)) 124 if (!omapdss_device_is_enabled(dssdev))
125 return; 125 return;
126 126
127 if (gpio_is_valid(ddata->ini_gpio)) 127 if (ddata->ini_gpio)
128 gpio_set_value_cansleep(ddata->ini_gpio, 0); 128 gpiod_set_value_cansleep(ddata->ini_gpio, 0);
129 129
130 if (gpio_is_valid(ddata->resb_gpio)) 130 if (ddata->resb_gpio)
131 gpio_set_value_cansleep(ddata->resb_gpio, 0); 131 gpiod_set_value_cansleep(ddata->resb_gpio, 0);
132 132
133 /* wait at least 5 vsyncs after disabling the LCD */ 133 /* wait at least 5 vsyncs after disabling the LCD */
134 134
@@ -182,11 +182,32 @@ static struct omap_dss_driver sharp_ls_ops = {
182 .get_resolution = omapdss_default_get_resolution, 182 .get_resolution = omapdss_default_get_resolution,
183}; 183};
184 184
185static int sharp_ls_get_gpio(struct device *dev, int gpio, unsigned long flags,
186 char *desc, struct gpio_desc **gpiod)
187{
188 struct gpio_desc *gd;
189 int r;
190
191 *gpiod = NULL;
192
193 r = devm_gpio_request_one(dev, gpio, flags, desc);
194 if (r)
195 return r == -ENOENT ? 0 : r;
196
197 gd = gpio_to_desc(gpio);
198 if (IS_ERR(gd))
199 return PTR_ERR(gd) == -ENOENT ? 0 : PTR_ERR(gd);
200
201 *gpiod = gd;
202 return 0;
203}
204
185static int sharp_ls_probe_pdata(struct platform_device *pdev) 205static int sharp_ls_probe_pdata(struct platform_device *pdev)
186{ 206{
187 const struct panel_sharp_ls037v7dw01_platform_data *pdata; 207 const struct panel_sharp_ls037v7dw01_platform_data *pdata;
188 struct panel_drv_data *ddata = platform_get_drvdata(pdev); 208 struct panel_drv_data *ddata = platform_get_drvdata(pdev);
189 struct omap_dss_device *dssdev, *in; 209 struct omap_dss_device *dssdev, *in;
210 int r;
190 211
191 pdata = dev_get_platdata(&pdev->dev); 212 pdata = dev_get_platdata(&pdev->dev);
192 213
@@ -204,11 +225,26 @@ static int sharp_ls_probe_pdata(struct platform_device *pdev)
204 dssdev = &ddata->dssdev; 225 dssdev = &ddata->dssdev;
205 dssdev->name = pdata->name; 226 dssdev->name = pdata->name;
206 227
207 ddata->resb_gpio = pdata->resb_gpio; 228 r = sharp_ls_get_gpio(&pdev->dev, pdata->mo_gpio, GPIOF_OUT_INIT_LOW,
208 ddata->ini_gpio = pdata->ini_gpio; 229 "lcd MO", &ddata->mo_gpio);
209 ddata->mo_gpio = pdata->mo_gpio; 230 if (r)
210 ddata->lr_gpio = pdata->lr_gpio; 231 return r;
211 ddata->ud_gpio = pdata->ud_gpio; 232 r = sharp_ls_get_gpio(&pdev->dev, pdata->lr_gpio, GPIOF_OUT_INIT_HIGH,
233 "lcd LR", &ddata->lr_gpio);
234 if (r)
235 return r;
236 r = sharp_ls_get_gpio(&pdev->dev, pdata->ud_gpio, GPIOF_OUT_INIT_HIGH,
237 "lcd UD", &ddata->ud_gpio);
238 if (r)
239 return r;
240 r = sharp_ls_get_gpio(&pdev->dev, pdata->resb_gpio, GPIOF_OUT_INIT_LOW,
241 "lcd RESB", &ddata->resb_gpio);
242 if (r)
243 return r;
244 r = sharp_ls_get_gpio(&pdev->dev, pdata->ini_gpio, GPIOF_OUT_INIT_LOW,
245 "lcd INI", &ddata->ini_gpio);
246 if (r)
247 return r;
212 248
213 return 0; 249 return 0;
214} 250}
@@ -233,41 +269,6 @@ static int sharp_ls_probe(struct platform_device *pdev)
233 return -ENODEV; 269 return -ENODEV;
234 } 270 }
235 271
236 if (gpio_is_valid(ddata->mo_gpio)) {
237 r = devm_gpio_request_one(&pdev->dev, ddata->mo_gpio,
238 GPIOF_OUT_INIT_LOW, "lcd MO");
239 if (r)
240 goto err_gpio;
241 }
242
243 if (gpio_is_valid(ddata->lr_gpio)) {
244 r = devm_gpio_request_one(&pdev->dev, ddata->lr_gpio,
245 GPIOF_OUT_INIT_HIGH, "lcd LR");
246 if (r)
247 goto err_gpio;
248 }
249
250 if (gpio_is_valid(ddata->ud_gpio)) {
251 r = devm_gpio_request_one(&pdev->dev, ddata->ud_gpio,
252 GPIOF_OUT_INIT_HIGH, "lcd UD");
253 if (r)
254 goto err_gpio;
255 }
256
257 if (gpio_is_valid(ddata->resb_gpio)) {
258 r = devm_gpio_request_one(&pdev->dev, ddata->resb_gpio,
259 GPIOF_OUT_INIT_LOW, "lcd RESB");
260 if (r)
261 goto err_gpio;
262 }
263
264 if (gpio_is_valid(ddata->ini_gpio)) {
265 r = devm_gpio_request_one(&pdev->dev, ddata->ini_gpio,
266 GPIOF_OUT_INIT_LOW, "lcd INI");
267 if (r)
268 goto err_gpio;
269 }
270
271 ddata->videomode = sharp_ls_timings; 272 ddata->videomode = sharp_ls_timings;
272 273
273 dssdev = &ddata->dssdev; 274 dssdev = &ddata->dssdev;
@@ -287,7 +288,6 @@ static int sharp_ls_probe(struct platform_device *pdev)
287 return 0; 288 return 0;
288 289
289err_reg: 290err_reg:
290err_gpio:
291 omap_dss_put_device(ddata->in); 291 omap_dss_put_device(ddata->in);
292 return r; 292 return r;
293} 293}