aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2014-05-15 05:48:43 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2014-05-20 02:35:40 -0400
commitfbf7309823a15da2b96e8e15781b8ac9074b44c0 (patch)
tree7059d7ed8056684492b662599ddd1a76600917a4 /drivers/video
parente2ccb0eee57b2fc267444e504ed872720ae10ee6 (diff)
OMAPDSS: panel-lgphilips-lb035q02: use gpiod for enable gpio
The new gpiod API supports automatic handling of active-high/active-low with DT. To make it possible to use that when booting with DT, change the driver's handling of the enable GPIO to use gpiod. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c b/drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c
index 2e6b513222d9..6e6acd696a70 100644
--- a/drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c
+++ b/drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c
@@ -50,9 +50,10 @@ struct panel_drv_data {
50 50
51 struct omap_video_timings videomode; 51 struct omap_video_timings videomode;
52 52
53 int reset_gpio; 53 /* used for non-DT boot, to be removed */
54 int backlight_gpio; 54 int backlight_gpio;
55 int enable_gpio; 55
56 struct gpio_desc *enable_gpio;
56}; 57};
57 58
58#define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev) 59#define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev)
@@ -165,8 +166,8 @@ static int lb035q02_enable(struct omap_dss_device *dssdev)
165 if (r) 166 if (r)
166 return r; 167 return r;
167 168
168 if (gpio_is_valid(ddata->enable_gpio)) 169 if (ddata->enable_gpio)
169 gpio_set_value_cansleep(ddata->enable_gpio, 1); 170 gpiod_set_value_cansleep(ddata->enable_gpio, 1);
170 171
171 if (gpio_is_valid(ddata->backlight_gpio)) 172 if (gpio_is_valid(ddata->backlight_gpio))
172 gpio_set_value_cansleep(ddata->backlight_gpio, 1); 173 gpio_set_value_cansleep(ddata->backlight_gpio, 1);
@@ -184,8 +185,8 @@ static void lb035q02_disable(struct omap_dss_device *dssdev)
184 if (!omapdss_device_is_enabled(dssdev)) 185 if (!omapdss_device_is_enabled(dssdev))
185 return; 186 return;
186 187
187 if (gpio_is_valid(ddata->enable_gpio)) 188 if (ddata->enable_gpio)
188 gpio_set_value_cansleep(ddata->enable_gpio, 0); 189 gpiod_set_value_cansleep(ddata->enable_gpio, 0);
189 190
190 if (gpio_is_valid(ddata->backlight_gpio)) 191 if (gpio_is_valid(ddata->backlight_gpio))
191 gpio_set_value_cansleep(ddata->backlight_gpio, 0); 192 gpio_set_value_cansleep(ddata->backlight_gpio, 0);
@@ -243,6 +244,7 @@ static int lb035q02_probe_pdata(struct spi_device *spi)
243 const struct panel_lb035q02_platform_data *pdata; 244 const struct panel_lb035q02_platform_data *pdata;
244 struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev); 245 struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev);
245 struct omap_dss_device *dssdev, *in; 246 struct omap_dss_device *dssdev, *in;
247 int r;
246 248
247 pdata = dev_get_platdata(&spi->dev); 249 pdata = dev_get_platdata(&spi->dev);
248 250
@@ -260,10 +262,19 @@ static int lb035q02_probe_pdata(struct spi_device *spi)
260 dssdev = &ddata->dssdev; 262 dssdev = &ddata->dssdev;
261 dssdev->name = pdata->name; 263 dssdev->name = pdata->name;
262 264
263 ddata->enable_gpio = pdata->enable_gpio; 265 r = devm_gpio_request_one(&spi->dev, pdata->enable_gpio,
266 GPIOF_OUT_INIT_LOW, "panel enable");
267 if (r)
268 goto err_gpio;
269
270 ddata->enable_gpio = gpio_to_desc(pdata->enable_gpio);
271
264 ddata->backlight_gpio = pdata->backlight_gpio; 272 ddata->backlight_gpio = pdata->backlight_gpio;
265 273
266 return 0; 274 return 0;
275err_gpio:
276 omap_dss_put_device(ddata->in);
277 return r;
267} 278}
268 279
269static int lb035q02_panel_spi_probe(struct spi_device *spi) 280static int lb035q02_panel_spi_probe(struct spi_device *spi)
@@ -288,13 +299,6 @@ static int lb035q02_panel_spi_probe(struct spi_device *spi)
288 return -ENODEV; 299 return -ENODEV;
289 } 300 }
290 301
291 if (gpio_is_valid(ddata->enable_gpio)) {
292 r = devm_gpio_request_one(&spi->dev, ddata->enable_gpio,
293 GPIOF_OUT_INIT_LOW, "panel enable");
294 if (r)
295 goto err_gpio;
296 }
297
298 if (gpio_is_valid(ddata->backlight_gpio)) { 302 if (gpio_is_valid(ddata->backlight_gpio)) {
299 r = devm_gpio_request_one(&spi->dev, ddata->backlight_gpio, 303 r = devm_gpio_request_one(&spi->dev, ddata->backlight_gpio,
300 GPIOF_OUT_INIT_LOW, "panel backlight"); 304 GPIOF_OUT_INIT_LOW, "panel backlight");