aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2018-05-28 10:18:26 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2018-09-03 09:13:28 -0400
commit57e0478a29cf280c8ea26d06d393994ff336eeb6 (patch)
treec365075f97281d95caf0790741c6e41142dad680 /drivers/gpu
parentac2d1fcbebd6e9ff3a5ef645f88611a6ba9b4ece (diff)
drm/omap: panel-nec-nl8048hl11: Convert to the GPIO descriptors API
The GPIO descriptor API is favoured over the plain GPIO API for consumer drivers. Using it simplifies the driver code. The reset GPIO is mandatory, so drop conditional tests through the driver. The qvga GPIO is unused, so drop it completely. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c54
1 files changed, 11 insertions, 43 deletions
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c b/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c
index b4dba55b678b..767ffd2fa0f4 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c
@@ -11,11 +11,10 @@
11 * (at your option) any later version. 11 * (at your option) any later version.
12 */ 12 */
13 13
14#include <linux/module.h>
15#include <linux/delay.h> 14#include <linux/delay.h>
16#include <linux/spi/spi.h>
17#include <linux/gpio/consumer.h> 15#include <linux/gpio/consumer.h>
18#include <linux/of_gpio.h> 16#include <linux/module.h>
17#include <linux/spi/spi.h>
19 18
20#include "../dss/omapdss.h" 19#include "../dss/omapdss.h"
21 20
@@ -24,8 +23,7 @@ struct panel_drv_data {
24 23
25 struct videomode vm; 24 struct videomode vm;
26 25
27 int res_gpio; 26 struct gpio_desc *res_gpio;
28 int qvga_gpio;
29 27
30 struct spi_device *spi; 28 struct spi_device *spi;
31}; 29};
@@ -140,8 +138,7 @@ static int nec_8048_enable(struct omap_dss_device *dssdev)
140 if (r) 138 if (r)
141 return r; 139 return r;
142 140
143 if (gpio_is_valid(ddata->res_gpio)) 141 gpiod_set_value_cansleep(ddata->res_gpio, 1);
144 gpio_set_value_cansleep(ddata->res_gpio, 1);
145 142
146 dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; 143 dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
147 144
@@ -156,8 +153,7 @@ static void nec_8048_disable(struct omap_dss_device *dssdev)
156 if (!omapdss_device_is_enabled(dssdev)) 153 if (!omapdss_device_is_enabled(dssdev))
157 return; 154 return;
158 155
159 if (gpio_is_valid(ddata->res_gpio)) 156 gpiod_set_value_cansleep(ddata->res_gpio, 0);
160 gpio_set_value_cansleep(ddata->res_gpio, 0);
161 157
162 src->ops->disable(src); 158 src->ops->disable(src);
163 159
@@ -203,29 +199,11 @@ static const struct omap_dss_driver nec_8048_ops = {
203 .check_timings = nec_8048_check_timings, 199 .check_timings = nec_8048_check_timings,
204}; 200};
205 201
206static int nec_8048_probe_of(struct spi_device *spi)
207{
208 struct device_node *node = spi->dev.of_node;
209 struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev);
210 int gpio;
211
212 gpio = of_get_named_gpio(node, "reset-gpios", 0);
213 if (!gpio_is_valid(gpio)) {
214 dev_err(&spi->dev, "failed to parse enable gpio\n");
215 return gpio;
216 }
217 ddata->res_gpio = gpio;
218
219 /* XXX the panel spec doesn't mention any QVGA pin?? */
220 ddata->qvga_gpio = -ENOENT;
221
222 return 0;
223}
224
225static int nec_8048_probe(struct spi_device *spi) 202static int nec_8048_probe(struct spi_device *spi)
226{ 203{
227 struct panel_drv_data *ddata; 204 struct panel_drv_data *ddata;
228 struct omap_dss_device *dssdev; 205 struct omap_dss_device *dssdev;
206 struct gpio_desc *gpio;
229 int r; 207 int r;
230 208
231 dev_dbg(&spi->dev, "%s\n", __func__); 209 dev_dbg(&spi->dev, "%s\n", __func__);
@@ -249,23 +227,13 @@ static int nec_8048_probe(struct spi_device *spi)
249 227
250 ddata->spi = spi; 228 ddata->spi = spi;
251 229
252 r = nec_8048_probe_of(spi); 230 gpio = devm_gpiod_get(&spi->dev, "reset", GPIOD_OUT_LOW);
253 if (r) 231 if (IS_ERR(gpio)) {
254 return r; 232 dev_err(&spi->dev, "failed to get reset gpio\n");
255 233 return PTR_ERR(gpio);
256 if (gpio_is_valid(ddata->qvga_gpio)) {
257 r = devm_gpio_request_one(&spi->dev, ddata->qvga_gpio,
258 GPIOF_OUT_INIT_HIGH, "lcd QVGA");
259 if (r)
260 return r;
261 } 234 }
262 235
263 if (gpio_is_valid(ddata->res_gpio)) { 236 ddata->res_gpio = gpio;
264 r = devm_gpio_request_one(&spi->dev, ddata->res_gpio,
265 GPIOF_OUT_INIT_LOW, "lcd RES");
266 if (r)
267 return r;
268 }
269 237
270 ddata->vm = nec_8048_panel_vm; 238 ddata->vm = nec_8048_panel_vm;
271 239